Commit 49695d1e authored by Paolo Abeni's avatar Paolo Abeni Committed by Greg Kroah-Hartman

ip6_tunnel: disable caching when the traffic class is inherited

[ Upstream commit b5c2d495 ]

If an ip6 tunnel is configured to inherit the traffic class from
the inner header, the dst_cache must be disabled or it will foul
the policy routing.

The issue is apprently there since at leat Linux-2.6.12-rc2.
Reported-by: default avatarLiam McBirnie <liam.mcbirnie@boeing.com>
Cc: Liam McBirnie <liam.mcbirnie@boeing.com>
Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2b54505c
...@@ -1043,6 +1043,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, ...@@ -1043,6 +1043,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
struct ipv6_tel_txoption opt; struct ipv6_tel_txoption opt;
struct dst_entry *dst = NULL, *ndst = NULL; struct dst_entry *dst = NULL, *ndst = NULL;
struct net_device *tdev; struct net_device *tdev;
bool use_cache = false;
int mtu; int mtu;
unsigned int max_headroom = sizeof(struct ipv6hdr); unsigned int max_headroom = sizeof(struct ipv6hdr);
u8 proto; u8 proto;
...@@ -1070,7 +1071,15 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, ...@@ -1070,7 +1071,15 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
memcpy(&fl6->daddr, addr6, sizeof(fl6->daddr)); memcpy(&fl6->daddr, addr6, sizeof(fl6->daddr));
neigh_release(neigh); neigh_release(neigh);
} else if (!fl6->flowi6_mark) } else if (!(t->parms.flags &
(IP6_TNL_F_USE_ORIG_TCLASS | IP6_TNL_F_USE_ORIG_FWMARK))) {
/* enable the cache only only if the routing decision does
* not depend on the current inner header value
*/
use_cache = true;
}
if (use_cache)
dst = ip6_tnl_dst_get(t); dst = ip6_tnl_dst_get(t);
if (!ip6_tnl_xmit_ctl(t, &fl6->saddr, &fl6->daddr)) if (!ip6_tnl_xmit_ctl(t, &fl6->saddr, &fl6->daddr))
...@@ -1134,7 +1143,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, ...@@ -1134,7 +1143,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
skb = new_skb; skb = new_skb;
} }
if (!fl6->flowi6_mark && ndst) if (use_cache && ndst)
ip6_tnl_dst_set(t, ndst); ip6_tnl_dst_set(t, ndst);
skb_dst_set(skb, dst); skb_dst_set(skb, dst);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment