Commit 87de1201 authored by David S. Miller's avatar David S. Miller

Merge branch 'erspan-fixes'

William Tu says:

====================
a couple of erspan fixes

The series fixes a couple of erspan issues.
The first patch adds the erspan v2 proto type to the ip6 tunnel lookup.
The second patch improves the error handling when users screws the
version number in metadata.  The final patch makes sure the skb has
enough headroom for pushing erspan header when xmit.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4eb57ecc e41c7c68
...@@ -126,7 +126,8 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev, ...@@ -126,7 +126,8 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,
struct ip6_tnl *t, *cand = NULL; struct ip6_tnl *t, *cand = NULL;
struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); struct ip6gre_net *ign = net_generic(net, ip6gre_net_id);
int dev_type = (gre_proto == htons(ETH_P_TEB) || int dev_type = (gre_proto == htons(ETH_P_TEB) ||
gre_proto == htons(ETH_P_ERSPAN)) ? gre_proto == htons(ETH_P_ERSPAN) ||
gre_proto == htons(ETH_P_ERSPAN2)) ?
ARPHRD_ETHER : ARPHRD_IP6GRE; ARPHRD_ETHER : ARPHRD_IP6GRE;
int score, cand_score = 4; int score, cand_score = 4;
...@@ -902,6 +903,9 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, ...@@ -902,6 +903,9 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
truncate = true; truncate = true;
} }
if (skb_cow_head(skb, dev->needed_headroom))
goto tx_err;
t->parms.o_flags &= ~TUNNEL_KEY; t->parms.o_flags &= ~TUNNEL_KEY;
IPCB(skb)->flags = 0; IPCB(skb)->flags = 0;
...@@ -944,6 +948,8 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, ...@@ -944,6 +948,8 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
md->u.md2.dir, md->u.md2.dir,
get_hwid(&md->u.md2), get_hwid(&md->u.md2),
truncate, false); truncate, false);
} else {
goto tx_err;
} }
} else { } else {
switch (skb->protocol) { switch (skb->protocol) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment