Skip to content

Commit 02ca042

Browse files
Jakub Sitnickidavem330
authored andcommitted
ip6_tunnel: Account for tunnel header in tunnel MTU
With ip6gre we have a tunnel header which also makes the tunnel MTU smaller. We need to reserve room for it. Previously we were using up space reserved for the Tunnel Encapsulation Limit option header (RFC 2473). Also, after commit b05229f ("gre6: Cleanup GREv6 transmit path, call common GRE functions") our contract with the caller has changed. Now we check if the packet length exceeds the tunnel MTU after the tunnel header has been pushed, unlike before. This is reflected in the check where we look at the packet length minus the size of the tunnel header, which is already accounted for in tunnel MTU. Fixes: b05229f ("gre6: Cleanup GREv6 transmit path, call common GRE functions") Signed-off-by: Jakub Sitnicki <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1666d49 commit 02ca042

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ipv6/ip6_tunnel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
11081108
t->parms.name);
11091109
goto tx_err_dst_release;
11101110
}
1111-
mtu = dst_mtu(dst) - psh_hlen;
1111+
mtu = dst_mtu(dst) - psh_hlen - t->tun_hlen;
11121112
if (encap_limit >= 0) {
11131113
max_headroom += 8;
11141114
mtu -= 8;
@@ -1117,7 +1117,7 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
11171117
mtu = IPV6_MIN_MTU;
11181118
if (skb_dst(skb) && !t->parms.collect_md)
11191119
skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu);
1120-
if (skb->len > mtu && !skb_is_gso(skb)) {
1120+
if (skb->len - t->tun_hlen > mtu && !skb_is_gso(skb)) {
11211121
*pmtu = mtu;
11221122
err = -EMSGSIZE;
11231123
goto tx_err_dst_release;

0 commit comments

Comments
 (0)