Skip to content

Commit d4d576f

Browse files
sbrivio-rhdavem330
authored andcommitted
ip6_tunnel: Fix encapsulation layout
Commit 058214a ("ip6_tun: Add infrastructure for doing encapsulation") added the ip6_tnl_encap() call in ip6_tnl_xmit(), before the call to ipv6_push_frag_opts() to append the IPv6 Tunnel Encapsulation Limit option (option 4, RFC 2473, par. 5.1) to the outer IPv6 header. As long as the option didn't actually end up in generated packets, this wasn't an issue. Then commit 89a23c8 ("ip6_tunnel: Fix missing tunnel encapsulation limit option") fixed sending of this option, and the resulting layout, e.g. for FoU, is: .-------------------.------------.----------.-------------------.----- - - | Outer IPv6 Header | UDP header | Option 4 | Inner IPv6 Header | Payload '-------------------'------------'----------'-------------------'----- - - Needless to say, FoU and GUE (at least) won't work over IPv6. The option is appended by default, and I couldn't find a way to disable it with the current iproute2. Turn this into a more reasonable: .-------------------.----------.------------.-------------------.----- - - | Outer IPv6 Header | Option 4 | UDP header | Inner IPv6 Header | Payload '-------------------'----------'------------'-------------------'----- - - With this, and with 84dad55 ("udp6: fix encap return code for resubmitting"), FoU and GUE work again over IPv6. Fixes: 058214a ("ip6_tun: Add infrastructure for doing encapsulation") Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b06f9d9 commit d4d576f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

net/ipv6/ip6_tunnel.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,11 +1184,6 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
11841184
}
11851185
skb_dst_set(skb, dst);
11861186

1187-
if (encap_limit >= 0) {
1188-
init_tel_txopt(&opt, encap_limit);
1189-
ipv6_push_frag_opts(skb, &opt.ops, &proto);
1190-
}
1191-
11921187
if (hop_limit == 0) {
11931188
if (skb->protocol == htons(ETH_P_IP))
11941189
hop_limit = ip_hdr(skb)->ttl;
@@ -1210,6 +1205,11 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
12101205
if (err)
12111206
return err;
12121207

1208+
if (encap_limit >= 0) {
1209+
init_tel_txopt(&opt, encap_limit);
1210+
ipv6_push_frag_opts(skb, &opt.ops, &proto);
1211+
}
1212+
12131213
skb_push(skb, sizeof(struct ipv6hdr));
12141214
skb_reset_network_header(skb);
12151215
ipv6h = ipv6_hdr(skb);

0 commit comments

Comments
 (0)