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

Commit 963a88b3 authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller
Browse files

tunnels: harmonize cleanup done on skb on xmit path



The goal of this patch is to harmonize cleanup done on a skbuff on xmit path.
Before this patch, behaviors were different depending of the tunnel type.

Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8b27f277
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1397,6 +1397,8 @@ static int vxlan6_xmit_skb(struct vxlan_sock *vs,
		skb->encapsulation = 1;
	}

	skb_scrub_packet(skb, false);

	min_headroom = LL_RESERVED_SPACE(dst->dev) + dst->header_len
			+ VXLAN_HLEN + sizeof(struct ipv6hdr)
			+ (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0);
@@ -1432,7 +1434,6 @@ static int vxlan6_xmit_skb(struct vxlan_sock *vs,
	memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
	IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
			      IPSKB_REROUTED);
	skb_dst_drop(skb);
	skb_dst_set(skb, dst);

	if (!skb_is_gso(skb) && !(dst->dev->features & NETIF_F_IPV6_CSUM)) {
@@ -1528,7 +1529,8 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
	if (err)
		return err;

	return iptunnel_xmit(rt, skb, src, dst, IPPROTO_UDP, tos, ttl, df);
	return iptunnel_xmit(rt, skb, src, dst, IPPROTO_UDP, tos, ttl, df,
			     false);
}
EXPORT_SYMBOL_GPL(vxlan_xmit_skb);

+0 −1
Original line number Diff line number Diff line
@@ -75,7 +75,6 @@ static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
	struct net_device_stats *stats = &dev->stats;
	int pkt_len, err;

	nf_reset(skb);
	pkt_len = skb->len;
	err = ip6_local_out(skb);

+1 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb,
		  __be32 src, __be32 dst, __u8 proto,
		  __u8 tos, __u8 ttl, __be16 df);
		  __u8 tos, __u8 ttl, __be16 df, bool xnet);

static inline void iptunnel_xmit_stats(int err,
				       struct net_device_stats *err_stats,
+2 −4
Original line number Diff line number Diff line
@@ -614,9 +614,6 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
		goto tx_error;
	}

	if (!net_eq(tunnel->net, dev_net(dev)))
		skb_scrub_packet(skb, true);

	if (tunnel->err_count > 0) {
		if (time_before(jiffies,
				tunnel->err_time + IPTUNNEL_ERR_TIMEO)) {
@@ -655,7 +652,8 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
	}

	err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, protocol,
			    ip_tunnel_ecn_encap(tos, inner_iph, skb), ttl, df);
			    ip_tunnel_ecn_encap(tos, inner_iph, skb), ttl, df,
			    !net_eq(tunnel->net, dev_net(dev)));
	iptunnel_xmit_stats(err, &dev->stats, dev->tstats);

	return;
+3 −4
Original line number Diff line number Diff line
@@ -48,16 +48,15 @@

int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb,
		  __be32 src, __be32 dst, __u8 proto,
		  __u8 tos, __u8 ttl, __be16 df)
		  __u8 tos, __u8 ttl, __be16 df, bool xnet)
{
	int pkt_len = skb->len;
	struct iphdr *iph;
	int err;

	nf_reset(skb);
	secpath_reset(skb);
	skb_scrub_packet(skb, xnet);

	skb->rxhash = 0;
	skb_dst_drop(skb);
	skb_dst_set(skb, &rt->dst);
	memset(IPCB(skb), 0, sizeof(*IPCB(skb)));

Loading