Skip to contentSkip to conversation

ip6_tunnel: disable dst caching if tunnel is dual-stack

PATCH In review Eli Cooper 2 participants 2 messages Dec 25, 2017 – Jan 2, 2018

Subsystems (3)
lore
Share & tools
lore

Eli Cooper

author
#0 lore raw

PATCH 1/1 ip6_tunnel: disable dst caching if tunnel is dual-stack

When an ip6_tunnel is in mode 'any', where the transport layer protocol can be either 4 or 41, dst_cache must be disabled.

This is because xfrm policies might apply to only one of the two protocols. Caching dst would cause xfrm policies for one protocol incorrectly used for the other.

---
 net/ipv6/ip6_tunnel.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv6/ip6_tunnel.c +3 -3
index 931c38f6ff4a..8aea23d15ddd 100644
@@ -1074,10 +1074,10 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
 			memcpy(&fl6->daddr, addr6, sizeof(fl6->daddr));
 			neigh_release(neigh);
 		}
-	} else if (!(t->parms.flags &
+	} else if (t->parms.proto != 0 && !(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
+		/* enable the cache only if neither the outer protocol nor the
+		 * routing decision depends on the current inner header value
 		 */
 		use_cache = true;
 	}
Signature · 1 line
2.15.1
maintainer
#1 lore raw

From: Eli Cooper <[email protected]>
Date: Mon, 25 Dec 2017 10:43:49 +0800

Quoted 9 lines

When an ip6_tunnel is in mode 'any', where the transport layer protocol can be either 4 or 41, dst_cache must be disabled.

This is because xfrm policies might apply to only one of the two protocols. Caching dst would cause xfrm policies for one protocol incorrectly used for the other.

Please do not CC: stable on networking changes, as per the netdev FAQ I queue these up by hand.

net/ipv6/ip6_tunnel.c int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield, · line 1078

Quoted 3 lines
net/ipv6/ip6_tunnel.c +1 -1
-	} else if (!(t->parms.flags &
+	} else if (t->parms.proto != 0 && !(t->parms.flags &
 		     (IP6_TNL_F_USE_ORIG_TCLASS | IP6_TNL_F_USE_ORIG_FWMARK))) {

When you adjust the indentation of an inner-expression, you must reindent the subsequent lines that are also part of that inner-expression.

I've fixed up both of these issues and applied your patch, but please take care of this yourself next time.

Thanks.