* [PATCH net] erspan: fix invalid erspan version.
@ 2018-05-17 0:24 William Tu
2018-05-17 19:49 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: William Tu @ 2018-05-17 0:24 UTC (permalink / raw)
To: netdev; +Cc: gvrose8192
ERSPAN only support version 1 and 2. When packets send to an
erspan device which does not have proper version number set,
drop the packet. In real case, we observe multicast packets
sent to the erspan pernet device, erspan0, which does not have
erspan version configured.
Reported-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: William Tu <u9012063@gmail.com>
---
net/ipv4/ip_gre.c | 4 +++-
net/ipv6/ip6_gre.c | 5 ++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 2409e648454d..2d8efeecf619 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -734,10 +734,12 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
erspan_build_header(skb, ntohl(tunnel->parms.o_key),
tunnel->index,
truncate, true);
- else
+ else if (tunnel->erspan_ver == 2)
erspan_build_header_v2(skb, ntohl(tunnel->parms.o_key),
tunnel->dir, tunnel->hwid,
truncate, true);
+ else
+ goto free_skb;
tunnel->parms.o_flags &= ~TUNNEL_KEY;
__gre_xmit(skb, dev, &tunnel->parms.iph, htons(ETH_P_ERSPAN));
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index bede77f24784..d20072fc38cb 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -991,11 +991,14 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
erspan_build_header(skb, ntohl(t->parms.o_key),
t->parms.index,
truncate, false);
- else
+ else if (t->parms.erspan_ver == 2)
erspan_build_header_v2(skb, ntohl(t->parms.o_key),
t->parms.dir,
t->parms.hwid,
truncate, false);
+ else
+ goto tx_err;
+
fl6.daddr = t->parms.raddr;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] erspan: fix invalid erspan version.
2018-05-17 0:24 [PATCH net] erspan: fix invalid erspan version William Tu
@ 2018-05-17 19:49 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-05-17 19:49 UTC (permalink / raw)
To: u9012063; +Cc: netdev, gvrose8192
From: William Tu <u9012063@gmail.com>
Date: Wed, 16 May 2018 17:24:32 -0700
> ERSPAN only support version 1 and 2. When packets send to an
> erspan device which does not have proper version number set,
> drop the packet. In real case, we observe multicast packets
> sent to the erspan pernet device, erspan0, which does not have
> erspan version configured.
>
> Reported-by: Greg Rose <gvrose8192@gmail.com>
> Signed-off-by: William Tu <u9012063@gmail.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-17 19:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-17 0:24 [PATCH net] erspan: fix invalid erspan version William Tu
2018-05-17 19:49 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).