* [PATCH net 1/3] ip6gre: add erspan v2 to tunnel lookup
2018-03-09 15:34 [PATCH net 0/3] a couple of erspan fixes William Tu
@ 2018-03-09 15:34 ` William Tu
2018-03-09 15:34 ` [PATCH net 2/3] ip6erspan: improve error handling for erspan version number William Tu
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: William Tu @ 2018-03-09 15:34 UTC (permalink / raw)
To: netdev
The patch adds the erspan v2 proto in ip6gre_tunnel_lookup
so the erspan v2 tunnel can be found correctly.
Signed-off-by: William Tu <u9012063@gmail.com>
---
net/ipv6/ip6_gre.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 18a3dfbd0300..a056c2bb4b9a 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -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;
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net 2/3] ip6erspan: improve error handling for erspan version number.
2018-03-09 15:34 [PATCH net 0/3] a couple of erspan fixes William Tu
2018-03-09 15:34 ` [PATCH net 1/3] ip6gre: add erspan v2 to tunnel lookup William Tu
@ 2018-03-09 15:34 ` William Tu
2018-03-09 15:34 ` [PATCH net 3/3] ip6erspan: make sure enough headroom at xmit William Tu
2018-03-09 18:04 ` [PATCH net 0/3] a couple of erspan fixes David Miller
3 siblings, 0 replies; 5+ messages in thread
From: William Tu @ 2018-03-09 15:34 UTC (permalink / raw)
To: netdev
When 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.
Signed-off-by: William Tu <u9012063@gmail.com>
---
net/ipv6/ip6_gre.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index a056c2bb4b9a..4ab476d3a46e 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -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) {
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net 3/3] ip6erspan: make sure enough headroom at xmit.
2018-03-09 15:34 [PATCH net 0/3] a couple of erspan fixes William Tu
2018-03-09 15:34 ` [PATCH net 1/3] ip6gre: add erspan v2 to tunnel lookup William Tu
2018-03-09 15:34 ` [PATCH net 2/3] ip6erspan: improve error handling for erspan version number William Tu
@ 2018-03-09 15:34 ` William Tu
2018-03-09 18:04 ` [PATCH net 0/3] a couple of erspan fixes David Miller
3 siblings, 0 replies; 5+ messages in thread
From: William Tu @ 2018-03-09 15:34 UTC (permalink / raw)
To: netdev
The patch adds skb_cow_header() to ensure enough headroom
at ip6erspan_tunnel_xmit before pushing the erspan header
to the skb.
Signed-off-by: William Tu <u9012063@gmail.com>
---
net/ipv6/ip6_gre.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 4ab476d3a46e..9a759bbbd8a6 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -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;
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net 0/3] a couple of erspan fixes
2018-03-09 15:34 [PATCH net 0/3] a couple of erspan fixes William Tu
` (2 preceding siblings ...)
2018-03-09 15:34 ` [PATCH net 3/3] ip6erspan: make sure enough headroom at xmit William Tu
@ 2018-03-09 18:04 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-03-09 18:04 UTC (permalink / raw)
To: u9012063; +Cc: netdev
From: William Tu <u9012063@gmail.com>
Date: Fri, 9 Mar 2018 07:34:39 -0800
> 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.
^ permalink raw reply [flat|nested] 5+ messages in thread