From 6e86511f596794f987ca1114d5681e85f91eaed3 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 16 Jan 2024 16:16:16 +1100 Subject: icmp: Warn on receive errors from ping sockets Currently we silently ignore an errors receiving a packet from a ping socket. We don't expect that to happen, so it's probably worth reporting if it does. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- icmp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/icmp.c b/icmp.c index 88390fb..79f6c8c 100644 --- a/icmp.c +++ b/icmp.c @@ -81,8 +81,11 @@ void icmp_sock_handler(const struct ctx *c, int af, union epoll_ref ref) return; n = recvfrom(ref.fd, buf, sizeof(buf), 0, &sr.sa, &sl); - if (n < 0) + if (n < 0) { + warn("%s: recvfrom() error on ping socket: %s", + pname, strerror(errno)); return; + } if (af == AF_INET) { struct icmphdr *ih4 = (struct icmphdr *)buf; -- cgit v1.2.3