diff mbox series

[net,1/2] net: ipv6: seg6_iptunnel: set tunnel headroom to zero

Message ID 20200204173019.4437-2-alex.aring@gmail.com
State Changes Requested
Delegated to: David Miller
Headers show
Series net: ipv6: seg6: headroom fixes | expand

Commit Message

Alexander Aring Feb. 4, 2020, 5:30 p.m. UTC
This patch sets headroom of segmentation route tunnel to zero. The
headroom setting was introduced for mpls in commit 14972cbd34ff
("net: lwtunnel: Handle fragmentation") which sits on layer 2.5. As the
Linux interface MTU value is Layer 3 and don't consider anything before
that it is misleading to set the headroom value to anything than 0.

Example setup to trigger this issue:

ip netns add foo
ip link add veth0 type veth peer name veth1
ip link set veth1 netns foo
ip link set mtu 1280 dev veth0

ip link set veth0 up
ip -n foo link set veth1 up

ip addr add beef::1/64 dev veth0
ip -6 route add beef::3 encap seg6 mode encap segs beef::2 dev veth0

then do a:

ping beef::3

You the sendmsg() will return -EINVAL because the packet doesn't fit
into the IPv6 minimum MTU anymore. It was consider the headroom value
in their destination mtu which substracts whatever headroom is from
the interface MTU 1280.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/ipv6/seg6_iptunnel.c | 2 --
 1 file changed, 2 deletions(-)

Comments

David Miller Feb. 6, 2020, 12:54 p.m. UTC | #1
From: Alexander Aring <alex.aring@gmail.com>
Date: Tue,  4 Feb 2020 12:30:18 -0500

> diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
> index ab7f124ff5d7..5b6e88f16e2d 100644
> --- a/net/ipv6/seg6_iptunnel.c
> +++ b/net/ipv6/seg6_iptunnel.c
> @@ -449,8 +449,6 @@ static int seg6_build_state(struct nlattr *nla,
>  	if (tuninfo->mode != SEG6_IPTUN_MODE_L2ENCAP)
>  		newts->flags |= LWTUNNEL_STATE_OUTPUT_REDIRECT;
>  
> -	newts->headroom = seg6_lwt_headroom(tuninfo);
> -
>  	*ts = newts;
>  
>  	return 0;

Even if this change is correct, you are eliminating the one and only
user of seg6_lwt_headroom() so you would have to kill that in this
patch as well.
Alexander Aring Feb. 8, 2020, 5:34 p.m. UTC | #2
Hi,

On Thu, Feb 06, 2020 at 01:54:18PM +0100, David Miller wrote:
> From: Alexander Aring <alex.aring@gmail.com>
> Date: Tue,  4 Feb 2020 12:30:18 -0500
> 
> > diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
> > index ab7f124ff5d7..5b6e88f16e2d 100644
> > --- a/net/ipv6/seg6_iptunnel.c
> > +++ b/net/ipv6/seg6_iptunnel.c
> > @@ -449,8 +449,6 @@ static int seg6_build_state(struct nlattr *nla,
> >  	if (tuninfo->mode != SEG6_IPTUN_MODE_L2ENCAP)
> >  		newts->flags |= LWTUNNEL_STATE_OUTPUT_REDIRECT;
> >  
> > -	newts->headroom = seg6_lwt_headroom(tuninfo);
> > -
> >  	*ts = newts;
> >  
> >  	return 0;
> 
> Even if this change is correct, you are eliminating the one and only
> user of seg6_lwt_headroom() so you would have to kill that in this
> patch as well.

Okay, this is in include/uapi but surrounding by __KERNEL__ so I guess
it's still okay to remove it?

btw: why it is not static in seg6_iptunnel.c then?

Anyway I will wait until I hear something back what the use of headroom
exactly is and why the original authors of segmentation routing sets it.
In my case it will simple not work with a IPv6 min mtu so I will set it
to zero for possible net-next patches.

- Alex
diff mbox series

Patch

diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
index ab7f124ff5d7..5b6e88f16e2d 100644
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -449,8 +449,6 @@  static int seg6_build_state(struct nlattr *nla,
 	if (tuninfo->mode != SEG6_IPTUN_MODE_L2ENCAP)
 		newts->flags |= LWTUNNEL_STATE_OUTPUT_REDIRECT;
 
-	newts->headroom = seg6_lwt_headroom(tuninfo);
-
 	*ts = newts;
 
 	return 0;