diff mbox series

[v3,net-next,1/3] net: add support for sending RFC8335 PROBE

Message ID d038c95149a0497e4fda40f856e1a1179065da9b.1605386600.git.andreas.a.roeseler@gmail.com
State Superseded
Headers show
Series add support sending RFC8335 PROBE | expand

Commit Message

Andreas Roeseler Nov. 14, 2020, 8:56 p.m. UTC
Modifying the ping_supported function to support probe message types
allows the user to send probe requests through the existing framework
for sending ping requests.

Signed-off-by: Andreas Roeseler <andreas.a.roeseler@gmail.com>
---
Changes since v1:
 - Switch to correct base tree

Changes since v2:
 - Switch to net-next tree 67c70b5eb2bf7d0496fcb62d308dc3096bc11553
---
 net/ipv4/ping.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski Nov. 17, 2020, 9:52 p.m. UTC | #1
On Sat, 14 Nov 2020 12:56:11 -0800 Andreas Roeseler wrote:
> Modifying the ping_supported function to support probe message types
> allows the user to send probe requests through the existing framework
> for sending ping requests.
> 
> Signed-off-by: Andreas Roeseler <andreas.a.roeseler@gmail.com>

You need to reorder the patches so that defines are added first.

Otherwise if someone lands on this patch during bisection the kernel
will not build:

../net/ipv4/ping.c: In function ‘ping_supported’:
../net/ipv4/ping.c:456:39: error: ‘ICMP_EXT_ECHO’ undeclared (first use in this function); did you mean ‘ICMP_ECHO’?
  456 |         (family == AF_INET && type == ICMP_EXT_ECHO && code == 0) ||
      |                                       ^~~~~~~~~~~~~
      |                                       ICMP_ECHO
../net/ipv4/ping.c:456:39: note: each undeclared identifier is reported only once for each function it appears in
../net/ipv4/ping.c:458:40: error: ‘ICMPV6_EXT_ECHO_REQUEST’ undeclared (first use in this function); did you mean ‘ICMPV6_ECHO_REQUEST’?
  458 |         (family == AF_INET6 && type == ICMPV6_EXT_ECHO_REQUEST && code == 0);
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~
      |                                        ICMPV6_ECHO_REQUEST
../net/ipv4/ping.c:459:1: error: control reaches end of non-void function [-Werror=return-type]
  459 | }
      | ^
cc1: some warnings being treated as errors
make[3]: *** [net/ipv4/ping.o] Error 1
make[2]: *** [net/ipv4] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [net] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [__sub-make] Error 2
diff mbox series

Patch

diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 248856b301c4..39bdcb2bfc92 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -453,7 +453,9 @@  EXPORT_SYMBOL_GPL(ping_bind);
 static inline int ping_supported(int family, int type, int code)
 {
 	return (family == AF_INET && type == ICMP_ECHO && code == 0) ||
-	       (family == AF_INET6 && type == ICMPV6_ECHO_REQUEST && code == 0);
+	       (family == AF_INET && type == ICMP_EXT_ECHO && code == 0) ||
+	       (family == AF_INET6 && type == ICMPV6_ECHO_REQUEST && code == 0) ||
+	       (family == AF_INET6 && type == ICMPV6_EXT_ECHO_REQUEST && code == 0);
 }
 
 /*