lwtunnel: subtract tunnel headroom from mtu on output redirect
authorDavid Lebrun <david.lebrun@uclouvain.be>
Wed, 16 Nov 2016 09:05:46 +0000 (10:05 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Nov 2016 22:01:15 +0000 (17:01 -0500)
This patch changes the lwtunnel_headroom() function which is called
in ipv4_mtu() and ip6_mtu(), to also return the correct headroom
value when the lwtunnel state is OUTPUT_REDIRECT.

This patch enables e.g. SR-IPv6 encapsulations to work without
manually setting the route mtu.

Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/lwtunnel.h

index 82e76fe1c1f747a633ed1c92258a40451ec16e63..d4c1c75b886244f76f9539c0709bb72be7974578 100644 (file)
@@ -94,7 +94,8 @@ static inline bool lwtunnel_xmit_redirect(struct lwtunnel_state *lwtstate)
 static inline unsigned int lwtunnel_headroom(struct lwtunnel_state *lwtstate,
                                             unsigned int mtu)
 {
-       if (lwtunnel_xmit_redirect(lwtstate) && lwtstate->headroom < mtu)
+       if ((lwtunnel_xmit_redirect(lwtstate) ||
+            lwtunnel_output_redirect(lwtstate)) && lwtstate->headroom < mtu)
                return lwtstate->headroom;
 
        return 0;