ip6_tunnel: allow not to count pkts on tstats by passing dev as NULL
authorXin Long <lucien.xin@gmail.com>
Mon, 17 Jun 2019 13:34:14 +0000 (21:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Jul 2019 07:04:28 +0000 (09:04 +0200)
[ Upstream commit 6f6a8622057c92408930c31698394fae1557b188 ]

A similar fix to Patch "ip_tunnel: allow not to count pkts on tstats by
setting skb's dev to NULL" is also needed by ip6_tunnel.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/ip6_tunnel.h

index d66f70f63734c2d32ad81498bd9439f7783adcb5..3b0e3cdee1c338d91518cb56119591982fbbf954 100644 (file)
@@ -152,9 +152,12 @@ static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
        memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
        pkt_len = skb->len - skb_inner_network_offset(skb);
        err = ip6_local_out(dev_net(skb_dst(skb)->dev), sk, skb);
-       if (unlikely(net_xmit_eval(err)))
-               pkt_len = -1;
-       iptunnel_xmit_stats(dev, pkt_len);
+
+       if (dev) {
+               if (unlikely(net_xmit_eval(err)))
+                       pkt_len = -1;
+               iptunnel_xmit_stats(dev, pkt_len);
+       }
 }
 #endif
 #endif