]> git.baikalelectronics.ru Git - kernel.git/commit
vti4: Don't count header length twice on tunnel setup
authorStefano Brivio <sbrivio@redhat.com>
Thu, 15 Mar 2018 16:16:27 +0000 (17:16 +0100)
committerSteffen Klassert <steffen.klassert@secunet.com>
Mon, 19 Mar 2018 07:45:50 +0000 (08:45 +0100)
commit7a85c019051d6197c79213cc5d5f9ee72ca2e0c2
treed7464aea2a8e22ff88e08cc6e625b81d1bd738fc
parentbc37641ea48d367ede9027c0bef556e6d3a2aa6c
vti4: Don't count header length twice on tunnel setup

This re-introduces the effect of commit dc12b9e936f9 ("vti4:
Don't count header length twice.") which was accidentally
reverted by merge commit 1dafd180012a ("Merge branch 'master' of
git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec").

The commit message from Steffen Klassert said:

    We currently count the size of LL_MAX_HEADER and struct iphdr
    twice for vti4 devices, this leads to a wrong device mtu.
    The size of LL_MAX_HEADER and struct iphdr is already counted in
    ip_tunnel_bind_dev(), so don't do it again in vti_tunnel_init().

And this is still the case now: ip_tunnel_bind_dev() already
accounts for the header length of the link layer (not
necessarily LL_MAX_HEADER, if the output device is found), plus
one IP header.

For example, with a vti device on top of veth, with MTU of 1500,
the existing implementation would set the initial vti MTU to
1332, accounting once for LL_MAX_HEADER (128, included in
hard_header_len by vti) and twice for the same IP header (once
from hard_header_len, once from ip_tunnel_bind_dev()).

It should instead be 1480, because ip_tunnel_bind_dev() is able
to figure out that the output device is veth, so no additional
link layer header is attached, and will properly count one
single IP header.

The existing issue had the side effect of avoiding PMTUD for
most xfrm policies, by arbitrarily lowering the initial MTU.
However, the only way to get a consistent PMTU value is to let
the xfrm PMTU discovery do its course, and commit 9b7498655544
("vti: Add pmtu handling to vti_xmit.") now takes care of local
delivery cases where the application ignores local socket
notifications.

Fixes: 9c391875fad1 ("vti: switch to new ip tunnel code")
Fixes: 1dafd180012a ("Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Acked-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/ipv4/ip_vti.c