|
@@ -1,5 +1,5 @@
|
|
/*
|
|
/*
|
|
- * Copyright (c) 2007-2013 Nicira, Inc.
|
|
|
|
|
|
+ * Copyright (c) 2007-2014 Nicira, Inc.
|
|
*
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of version 2 of the GNU General Public
|
|
* modify it under the terms of version 2 of the GNU General Public
|
|
@@ -63,7 +63,7 @@ static __be16 filter_tnl_flags(__be16 flags)
|
|
static struct sk_buff *__build_header(struct sk_buff *skb,
|
|
static struct sk_buff *__build_header(struct sk_buff *skb,
|
|
int tunnel_hlen)
|
|
int tunnel_hlen)
|
|
{
|
|
{
|
|
- const struct ovs_key_ipv4_tunnel *tun_key = OVS_CB(skb)->tun_key;
|
|
|
|
|
|
+ const struct ovs_key_ipv4_tunnel *tun_key = OVS_CB(skb)->egress_tun_key;
|
|
struct tnl_ptk_info tpi;
|
|
struct tnl_ptk_info tpi;
|
|
|
|
|
|
skb = gre_handle_offloads(skb, !!(tun_key->tun_flags & TUNNEL_CSUM));
|
|
skb = gre_handle_offloads(skb, !!(tun_key->tun_flags & TUNNEL_CSUM));
|
|
@@ -129,6 +129,7 @@ static int gre_err(struct sk_buff *skb, u32 info,
|
|
static int gre_tnl_send(struct vport *vport, struct sk_buff *skb)
|
|
static int gre_tnl_send(struct vport *vport, struct sk_buff *skb)
|
|
{
|
|
{
|
|
struct net *net = ovs_dp_get_net(vport->dp);
|
|
struct net *net = ovs_dp_get_net(vport->dp);
|
|
|
|
+ struct ovs_key_ipv4_tunnel *tun_key;
|
|
struct flowi4 fl;
|
|
struct flowi4 fl;
|
|
struct rtable *rt;
|
|
struct rtable *rt;
|
|
int min_headroom;
|
|
int min_headroom;
|
|
@@ -136,16 +137,17 @@ static int gre_tnl_send(struct vport *vport, struct sk_buff *skb)
|
|
__be16 df;
|
|
__be16 df;
|
|
int err;
|
|
int err;
|
|
|
|
|
|
- if (unlikely(!OVS_CB(skb)->tun_key)) {
|
|
|
|
|
|
+ if (unlikely(!OVS_CB(skb)->egress_tun_key)) {
|
|
err = -EINVAL;
|
|
err = -EINVAL;
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ tun_key = OVS_CB(skb)->egress_tun_key;
|
|
/* Route lookup */
|
|
/* Route lookup */
|
|
memset(&fl, 0, sizeof(fl));
|
|
memset(&fl, 0, sizeof(fl));
|
|
- fl.daddr = OVS_CB(skb)->tun_key->ipv4_dst;
|
|
|
|
- fl.saddr = OVS_CB(skb)->tun_key->ipv4_src;
|
|
|
|
- fl.flowi4_tos = RT_TOS(OVS_CB(skb)->tun_key->ipv4_tos);
|
|
|
|
|
|
+ fl.daddr = tun_key->ipv4_dst;
|
|
|
|
+ fl.saddr = tun_key->ipv4_src;
|
|
|
|
+ fl.flowi4_tos = RT_TOS(tun_key->ipv4_tos);
|
|
fl.flowi4_mark = skb->mark;
|
|
fl.flowi4_mark = skb->mark;
|
|
fl.flowi4_proto = IPPROTO_GRE;
|
|
fl.flowi4_proto = IPPROTO_GRE;
|
|
|
|
|
|
@@ -153,7 +155,7 @@ static int gre_tnl_send(struct vport *vport, struct sk_buff *skb)
|
|
if (IS_ERR(rt))
|
|
if (IS_ERR(rt))
|
|
return PTR_ERR(rt);
|
|
return PTR_ERR(rt);
|
|
|
|
|
|
- tunnel_hlen = ip_gre_calc_hlen(OVS_CB(skb)->tun_key->tun_flags);
|
|
|
|
|
|
+ tunnel_hlen = ip_gre_calc_hlen(tun_key->tun_flags);
|
|
|
|
|
|
min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len
|
|
min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len
|
|
+ tunnel_hlen + sizeof(struct iphdr)
|
|
+ tunnel_hlen + sizeof(struct iphdr)
|
|
@@ -185,15 +187,14 @@ static int gre_tnl_send(struct vport *vport, struct sk_buff *skb)
|
|
goto err_free_rt;
|
|
goto err_free_rt;
|
|
}
|
|
}
|
|
|
|
|
|
- df = OVS_CB(skb)->tun_key->tun_flags & TUNNEL_DONT_FRAGMENT ?
|
|
|
|
|
|
+ df = tun_key->tun_flags & TUNNEL_DONT_FRAGMENT ?
|
|
htons(IP_DF) : 0;
|
|
htons(IP_DF) : 0;
|
|
|
|
|
|
skb->ignore_df = 1;
|
|
skb->ignore_df = 1;
|
|
|
|
|
|
return iptunnel_xmit(skb->sk, rt, skb, fl.saddr,
|
|
return iptunnel_xmit(skb->sk, rt, skb, fl.saddr,
|
|
- OVS_CB(skb)->tun_key->ipv4_dst, IPPROTO_GRE,
|
|
|
|
- OVS_CB(skb)->tun_key->ipv4_tos,
|
|
|
|
- OVS_CB(skb)->tun_key->ipv4_ttl, df, false);
|
|
|
|
|
|
+ tun_key->ipv4_dst, IPPROTO_GRE,
|
|
|
|
+ tun_key->ipv4_tos, tun_key->ipv4_ttl, df, false);
|
|
err_free_rt:
|
|
err_free_rt:
|
|
ip_rt_put(rt);
|
|
ip_rt_put(rt);
|
|
error:
|
|
error:
|