Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4736bb27 authored by Xin Long's avatar Xin Long Committed by Greg Kroah-Hartman
Browse files

ip_tunnel: allow not to count pkts on tstats by setting skb's dev to NULL



commit 5684abf7020dfc5f0b6ba1d68eda3663871fce52 upstream.

iptunnel_xmit() works as a common function, also used by a udp tunnel
which doesn't have to have a tunnel device, like how TIPC works with
udp media.

In these cases, we should allow not to count pkts on dev's tstats, so
that udp tunnel can work with no tunnel device safely.

Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Cc: Tommi Rantala <tommi.t.rantala@nokia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 475f7781
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -89,10 +89,13 @@ void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
	__ip_select_ident(net, iph, skb_shinfo(skb)->gso_segs ?: 1);
	__ip_select_ident(net, iph, skb_shinfo(skb)->gso_segs ?: 1);


	err = ip_local_out(net, sk, skb);
	err = ip_local_out(net, sk, skb);

	if (dev) {
		if (unlikely(net_xmit_eval(err)))
		if (unlikely(net_xmit_eval(err)))
			pkt_len = 0;
			pkt_len = 0;
		iptunnel_xmit_stats(dev, pkt_len);
		iptunnel_xmit_stats(dev, pkt_len);
	}
	}
}
EXPORT_SYMBOL_GPL(iptunnel_xmit);
EXPORT_SYMBOL_GPL(iptunnel_xmit);


int __iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
int __iptunnel_pull_header(struct sk_buff *skb, int hdr_len,