From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eyal Birger Subject: [PATCH ipsec] vti6: fix PMTU caching and reporting on xmit Date: Thu, 7 Jun 2018 10:11:02 +0300 Message-ID: <1528355462-17871-1-git-send-email-eyal.birger@gmail.com> Cc: herbert@gondor.apana.org.au, davem@davemloft.net, Eyal Birger To: netdev@vger.kernel.org, steffen.klassert@secunet.com Return-path: Received: from mail-wm0-f67.google.com ([74.125.82.67]:36229 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752570AbeFGHLX (ORCPT ); Thu, 7 Jun 2018 03:11:23 -0400 Received: by mail-wm0-f67.google.com with SMTP id v131-v6so16647940wma.1 for ; Thu, 07 Jun 2018 00:11:23 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: When setting the skb->dst before doing the MTU check, the route PMTU caching and reporting is done on the new dst which is about to be released. Instead, PMTU handling should be done using the original dst. This is aligned with IPv4 VTI. Signed-off-by: Eyal Birger Fixes: ccd740cbc6 ("vti6: Add pmtu handling to vti6_xmit.") --- net/ipv6/ip6_vti.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index ca957dd..e675ec7 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c @@ -480,10 +480,6 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) goto tx_err_dst_release; } - skb_scrub_packet(skb, !net_eq(t->net, dev_net(dev))); - skb_dst_set(skb, dst); - skb->dev = skb_dst(skb)->dev; - mtu = dst_mtu(dst); if (!skb->ignore_df && skb->len > mtu) { skb_dst_update_pmtu(skb, mtu); @@ -498,9 +494,14 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) htonl(mtu)); } - return -EMSGSIZE; + err = -EMSGSIZE; + goto tx_err_dst_release; } + skb_scrub_packet(skb, !net_eq(t->net, dev_net(dev))); + skb_dst_set(skb, dst); + skb->dev = skb_dst(skb)->dev; + err = dst_output(t->net, skb->sk, skb); if (net_xmit_eval(err) == 0) { struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); -- 2.7.4