Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 b05229f44228 ("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: b05229f44228 ("gre6: Cleanup GREv6 transmit path, call common GRE functions")
Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jakub Sitnicki and committed by
David S. Miller
02ca0423 1666d49e

+2 -2
+2 -2
net/ipv6/ip6_tunnel.c
··· 1108 1108 t->parms.name); 1109 1109 goto tx_err_dst_release; 1110 1110 } 1111 - mtu = dst_mtu(dst) - psh_hlen; 1111 + mtu = dst_mtu(dst) - psh_hlen - t->tun_hlen; 1112 1112 if (encap_limit >= 0) { 1113 1113 max_headroom += 8; 1114 1114 mtu -= 8; ··· 1117 1117 mtu = IPV6_MIN_MTU; 1118 1118 if (skb_dst(skb) && !t->parms.collect_md) 1119 1119 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)) { 1121 1121 *pmtu = mtu; 1122 1122 err = -EMSGSIZE; 1123 1123 goto tx_err_dst_release;