a couple of erspan fixes
Subsystems (3)
cover 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.
William Tu (3):
ip6gre: add erspan v2 to tunnel lookup
ip6erspan: improve error handling for erspan version number.
ip6erspan: make sure enough headroom at xmit.
net/ipv6/ip6_gre.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
PATCH 1/3 ip6gre: add erspan v2 to tunnel lookup
The patch adds the erspan v2 proto in ip6gre_tunnel_lookup so the erspan v2 tunnel can be found correctly.
--- net/ipv6/ip6_gre.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/ip6_gre.c +2 -1
@@ -126,7 +126,8 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,struct ip6_tnl *t, *cand =NULL ;struct ip6gre_net *ign =net_generic (net, ip6gre_net_id);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 ;int score, cand_score =4 ;
Signature · 1 line
2.7.4
PATCH 2/3 ip6erspan: improve error handling for erspan version number.
In reply to William TuWhen users fill in incorrect erspan version number through the struct erspan_metadata uapi, current code skips pushing the erspan header but continue pushing the gre header, which is incorrect. The patch fixes it by returning error.
--- net/ipv6/ip6_gre.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/ip6_gre.c +2 -0
@@ -948,6 +948,8 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, md->u.md2.dir,get_hwid (&md->u.md2), truncate, false); + }else { + goto tx_err; } }else {switch (skb->protocol) {
Signature · 1 line
2.7.4
PATCH 3/3 ip6erspan: make sure enough headroom at xmit.
In reply to William TuThe patch adds skb_cow_header() to ensure enough headroom at ip6erspan_tunnel_xmit before pushing the erspan header to the skb.
--- net/ipv6/ip6_gre.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv6/ip6_gre.c +3 -0
@@ -906,6 +906,9 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, truncate = true; } +if (skb_cow_head (skb, dev->needed_headroom)) + goto tx_err; + t->parms.o_flags &= ~TUNNEL_KEY ;IPCB (skb)->flags =0 ;
Signature · 1 line
2.7.4
David Miller
maintainerFrom: William Tu <[email protected]>
Date: Fri, 9 Mar 2018 07:34:39 -0800
Quoted 5 lines
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.
Series applied, thanks William.