2017-12-14 16:05:41

by Haishuang Yan

[permalink] [raw]
Subject: [PATCH 1/2] ip_gre: fix error path when erspan_rcv failed

When erspan_rcv call return PACKET_REJECT, we shoudn't call ipgre_rcv to
process packets again, instead send icmp unreachable message in error
path.

Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
Cc: William Tu <[email protected]>
Signed-off-by: Haishuang Yan <[email protected]>
---
net/ipv4/ip_gre.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 9253d6f..61ee014 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -411,11 +411,13 @@ static int gre_rcv(struct sk_buff *skb)
if (unlikely(tpi.proto == htons(ETH_P_ERSPAN))) {
if (erspan_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)
return 0;
+ goto out;
}

if (ipgre_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)
return 0;

+out:
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
drop:
kfree_skb(skb);
--
1.8.3.1




2017-12-14 16:05:54

by Haishuang Yan

[permalink] [raw]
Subject: [PATCH 2/2] ip6_gre: fix error path when ip6erspan_rcv failed

Same as ipv4 code, when ip6erspan_rcv call return PACKET_REJECT, we
should call icmpv6_send to send icmp unreachable message in error path.

Fixes: 5a963eb61b7c ("ip6_gre: Add ERSPAN native tunnel support")
Cc: William Tu <[email protected]>
Signed-off-by: Haishuang Yan <[email protected]>
---
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 b8b0e4b..68e7eef 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -580,12 +580,13 @@ static int gre_rcv(struct sk_buff *skb)
if (unlikely(tpi.proto == htons(ETH_P_ERSPAN))) {
if (ip6erspan_rcv(skb, hdr_len, &tpi) == PACKET_RCVD)
return 0;
- goto drop;
+ goto out;
}

if (ip6gre_rcv(skb, &tpi) == PACKET_RCVD)
return 0;

+out:
icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0);
drop:
kfree_skb(skb);
--
1.8.3.1



2017-12-14 18:26:08

by William Tu

[permalink] [raw]
Subject: Re: [PATCH 1/2] ip_gre: fix error path when erspan_rcv failed

On Thu, Dec 14, 2017 at 8:05 AM, Haishuang Yan
<[email protected]> wrote:
> When erspan_rcv call return PACKET_REJECT, we shoudn't call ipgre_rcv to
> process packets again, instead send icmp unreachable message in error
> path.
>
> Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
> Cc: William Tu <[email protected]>
> Signed-off-by: Haishuang Yan <[email protected]>
> ---

Thanks for the patch.
Acked-by: William Tu <[email protected]>

2017-12-14 18:27:58

by William Tu

[permalink] [raw]
Subject: Re: [PATCH 2/2] ip6_gre: fix error path when ip6erspan_rcv failed

On Thu, Dec 14, 2017 at 8:05 AM, Haishuang Yan
<[email protected]> wrote:
> Same as ipv4 code, when ip6erspan_rcv call return PACKET_REJECT, we
> should call icmpv6_send to send icmp unreachable message in error path.
>
> Fixes: 5a963eb61b7c ("ip6_gre: Add ERSPAN native tunnel support")
> Cc: William Tu <[email protected]>
> Signed-off-by: Haishuang Yan <[email protected]>
> ---

Looks good to me. Thanks.
Acked-by: William Tu <[email protected]>