Home Home > GIT Browse
diff options
authorTimo Teräs <timo.teras@iki.fi>2014-05-16 08:34:39 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-31 13:20:36 -0700
commit0bee206acd1bdbd2bb2e8116a78a12f7b7cb39ef (patch)
parent22b2efbb5aa8d97b5f2b7a030dea626d97c87a09 (diff)
ipv4: ip_tunnels: disable cache for nbma gre tunnels
[ Upstream commit 22fb22eaebf4d16987f3fd9c3484c436ee0badf2 ] The connected check fails to check for ip_gre nbma mode tunnels properly. ip_gre creates temporary tnl_params with daddr specified to pass-in the actual target on per-packet basis from neighbor layer. Detect these tunnels by inspecting the actual tunnel configuration. Minimal test case: ip route add via ip route add via ip tunnel add nbma0 mode gre key 1 tos c0 ip addr add dev nbma0 ip link set nbma0 up ip neigh add lladdr dev nbma0 ip neigh add lladdr dev nbma0 ping ping The second ping should be going to and head; but cached gre tunnel level route is used and it's actually going to via The lladdr's need to go to separate dst for the bug to trigger. Test case uses separate route entries, but this can also happen when the route entry is same: if there is a nexthop exception or the GRE tunnel is IPsec'ed in which case the dst points to xfrm bundle unique to the gre lladdr. Fixes: 7d442fab0a67 ("ipv4: Cache dst in tunnels") Signed-off-by: Timo Teräs <timo.teras@iki.fi> Cc: Tom Herbert <therbert@google.com> Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 6ec4beb54d8f..547bd393e283 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -536,9 +536,10 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
unsigned int max_headroom; /* The extra header space needed */
__be32 dst;
int err;
- bool connected = true;
+ bool connected;
inner_iph = (const struct iphdr *)skb_inner_network_header(skb);
+ connected = (tunnel->parms.iph.daddr != 0);
dst = tnl_params->daddr;
if (dst == 0) {