From c205080a13db9b03e23e7eba5c7e9b75f97341d7 Mon Sep 17 00:00:00 2001 From: jmatthew Date: Mon, 21 Feb 2022 03:50:46 +0000 Subject: [PATCH] If the signature on an icmp echo reply doesn't match, don't count it as a reply we've received, and print out the source address and sequence number as that might help the user understand what's going on. ok florian@ dlg@ --- sbin/ping/ping.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 6fa634bca3e..fb31365ad31 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping.c,v 1.245 2021/07/12 15:09:19 beck Exp $ */ +/* $OpenBSD: ping.c,v 1.246 2022/02/21 03:50:46 jmatthew Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -1302,7 +1302,10 @@ pr_pack(u_char *buf, int cc, struct msghdr *mhdr) if (timingsafe_memcmp(mac, &payload.mac, sizeof(mac)) != 0) { - printf("signature mismatch!\n"); + printf("signature mismatch from %s: " + "icmp_seq=%u\n", pr_addr(from, fromlen), + ntohs(seq)); + --nreceived; return; } timinginfo=1; -- 2.20.1