Skip to contentSkip to conversation

icmp: pass RFC 8335 reply messages to ping_rcv

PATCH Superseded Andreas Roeseler 2 participants 4 messages Apr 12, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 icmp: pass RFC 8335 reply messages to ping_rcv

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.

---
 net/ipv4/icmp.c | 5 +++++
 1 file changed, 5 insertions(+)
net/ipv4/icmp.c +5 -0
index 76990e13a2f9..8bd988fbcb31 100644
@@ -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
 	 *
Signature · 1 line
2.30.0
#1 lore raw
Quoted 19 lines · Andreas Roeseler

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.

---
 net/ipv4/icmp.c | 5 +++++
 1 file changed, 5 insertions(+)
net/ipv4/icmp.c +0 -0
index 76990e13a2f9..8bd988fbcb31 100644

net/ipv4/icmp.c int icmp_rcv(struct sk_buff *skb) · line 1203

Quoted 8 lines
net/ipv4/icmp.c +5 -0
@@ -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;
+       }
+

Do you need the same for ICMPV6_EXT_ECHO_REPLY ?

#2 lore raw
Quoted 28 lines · Willem de Bruijn
Quoted 26 lines · Andreas Roeseler

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.

---
 net/ipv4/icmp.c | 5 +++++

 1 file changed, 5 insertions(+)
net/ipv4/icmp.c +0 -0
index 76990e13a2f9..8bd988fbcb31 100644
@@ -1196,6 +1196,11 @@ int icmp_rcv(struct sk_buff *skb)
                 goto success_check;
         }
 
Quoted 7 lines

net/ipv4/icmp.c int icmp_rcv(struct sk_buff *skb) · line 1203

Quoted 5 lines
net/ipv4/icmp.c +5 -0
+       if (icmph->type == ICMP_EXT_ECHOREPLY) {
+               success = ping_rcv(skb);
+               goto success_check;
+       }
+

Do you need the same for ICMPV6_EXT_ECHO_REPLY ?

Yes, but this should be handled in icmpv6_rcv in net/ipv6/icmp.c and we're thinking of including all icmpv6 support for RFC 8335 (replying and parsing replies) in a separate patch.

#3 lore raw
Quoted 38 lines · Andreas Roeseler
Quoted 28 lines · Willem de Bruijn
Quoted 26 lines · Andreas Roeseler

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.

---
 net/ipv4/icmp.c | 5 +++++
 1 file changed, 5 insertions(+)
net/ipv4/icmp.c +0 -0
index 76990e13a2f9..8bd988fbcb31 100644
@@ -1196,6 +1196,11 @@ int icmp_rcv(struct sk_buff *skb)
                goto success_check;
        }
 
Quoted 7 lines

net/ipv4/icmp.c int icmp_rcv(struct sk_buff *skb) · line 1203

Quoted 5 lines
net/ipv4/icmp.c +5 -0
+       if (icmph->type == ICMP_EXT_ECHOREPLY) {
+               success = ping_rcv(skb);
+               goto success_check;
+       }
+

Do you need the same for ICMPV6_EXT_ECHO_REPLY ?

Quoted 3 lines

Yes, but this should be handled in icmpv6_rcv in net/ipv6/icmp.c and we're thinking of including all icmpv6 support for RFC 8335 (replying and parsing replies) in a separate patch.

Please send them together in the same patchset.

Sending ipv4 and ipv6 separately can lead to missing or subtly differently implemented features. It's preferable to be able to review both at the same time.