[PATCH net-next V2] icmp: ICMPV6: pass RFC 8335 reply messages to ping_rcv

Subsystems: networking [general], networking [ipv4/ipv6], the rest

STALE1979d

3 messages, 2 authors, 2021-04-20 · open the first message on its own page

[PATCH net-next V2] icmp: ICMPV6: pass RFC 8335 reply messages to ping_rcv

From: Andreas Roeseler <hidden>
Date: 2021-04-12 21:24:31

The current icmp_rcv function drops all unknown ICMP types, including
ICMP_EXT_ECHOREPLY (type 43). In order to parse Extended Echo Reply messages, we have
to pass these packets to the ping_rcv function, which does not do any
other filtering and passes the packet to the designated socket.

Pass incoming RFC 8335 ICMP Extended Echo Reply packets to the ping_rcv
handler instead of discarding the packet.

Signed-off-by: Andreas Roeseler <redacted>
---
Changes:
v1 -> v2:
 - Add ICMPV6 to patch
---
 net/ipv4/icmp.c | 5 +++++
 net/ipv6/icmp.c | 4 ++++
 2 files changed, 9 insertions(+)
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 76990e13a2f9..8bd988fbcb31 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -1196,6 +1196,11 @@ int icmp_rcv(struct sk_buff *skb)
 		goto success_check;
 	}
 
+	if (icmph->type == ICMP_EXT_ECHOREPLY) {
+		success = ping_rcv(skb);
+		goto success_check;
+	}
+
 	/*
 	 *	18 is the highest 'known' ICMP type. Anything else is a mystery
 	 *
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 1bca2b09d77e..e8398ffb5e35 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -916,6 +916,10 @@ static int icmpv6_rcv(struct sk_buff *skb)
 		success = ping_rcv(skb);
 		break;
 
+	case ICMPV6_EXT_ECHO_REPLY:
+		success = ping_rcv(skb);
+		break;
+
 	case ICMPV6_PKT_TOOBIG:
 		/* BUGGG_FUTURE: if packet contains rthdr, we cannot update
 		   standard destination cache. Seems, only "advanced"
-- 
2.31.1

Re: [PATCH net-next V2] icmp: ICMPV6: pass RFC 8335 reply messages to ping_rcv

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2021-04-13 21:52:14

On Mon, Apr 12, 2021 at 5:25 PM Andreas Roeseler
[off-list ref] wrote:
The current icmp_rcv function drops all unknown ICMP types, including
ICMP_EXT_ECHOREPLY (type 43). In order to parse Extended Echo Reply messages, we have
to pass these packets to the ping_rcv function, which does not do any
other filtering and passes the packet to the designated socket.

Pass incoming RFC 8335 ICMP Extended Echo Reply packets to the ping_rcv
handler instead of discarding the packet.

Signed-off-by: Andreas Roeseler <redacted>
Acked-by: Willem de Bruijn <willemb@google.com>

for future patches: please add reviewers of previous revisions
directly to the CC:

Re: [PATCH net-next V2] icmp: ICMPV6: pass RFC 8335 reply messages to ping_rcv

From: Andreas Roeseler <hidden>
Date: 2021-04-20 15:20:55

On Tue, 2021-04-13 at 17:51 -0400, Willem de Bruijn wrote:
On Mon, Apr 12, 2021 at 5:25 PM Andreas Roeseler
[off-list ref] wrote:
quoted
The current icmp_rcv function drops all unknown ICMP types,
including
ICMP_EXT_ECHOREPLY (type 43). In order to parse Extended Echo Reply
messages, we have
to pass these packets to the ping_rcv function, which does not do
any
other filtering and passes the packet to the designated socket.

Pass incoming RFC 8335 ICMP Extended Echo Reply packets to the
ping_rcv
handler instead of discarding the packet.

Signed-off-by: Andreas Roeseler <redacted>
Acked-by: Willem de Bruijn <willemb@google.com>

for future patches: please add reviewers of previous revisions
directly to the CC:
Please let me know if there is any feedback/comments for this patch
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help