From a3ec3bd0f85befdc95657a249b4cc789667440d7 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 11 Feb 2018 13:37:07 +0100 Subject: [PATCH] arping: change a few message strings to be closer to iputils arping ARPING 192.168.1.1 from 192.168.1.172 wlan0 Unicast reply from 192.168.1.1 [F4:F2:6D:52:A8:DE] 1.672ms Sent 1 probes (1 broadcast(s)) Received 1 response(s) ARPING 192.168.1.1 from 192.168.1.172 wlan0 Unicast reply from 192.168.1.1 [f4:f2:6d:52:a8:de] 1.152ms Sent 1 probe(s) (1 broadcast(s)) Received 1 response(s) (0 request(s), 0 broadcast(s)) function old new delta finish 120 100 -20 Signed-off-by: Denys Vlasenko --- networking/arping.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/networking/arping.c b/networking/arping.c index fd2f52cdb..898c3054e 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -142,10 +142,10 @@ static void finish(void) { if (!(option_mask32 & QUIET)) { printf("Sent %u probe(s) (%u broadcast(s))\n" - "Received %u repl%s" + "Received %u response(s)" " (%u request(s), %u broadcast(s))\n", sent, brd_sent, - received, (received == 1) ? "ies" : "y", + received, req_recv, brd_recv); } if (option_mask32 & DAD) @@ -245,6 +245,7 @@ static void recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM) if (!(option_mask32 & QUIET)) { int s_printed = 0; +//TODO: arping from iputils-s20160308 print upprcase hex in MAC, follow them? printf("%scast re%s from %s [%02x:%02x:%02x:%02x:%02x:%02x]", FROM->sll_pkttype == PACKET_HOST ? "Uni" : "Broad", ah->ar_op == htons(ARPOP_REPLY) ? "ply" : "quest", @@ -252,14 +253,14 @@ static void recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM) p[0], p[1], p[2], p[3], p[4], p[5] ); if (dst_ip.s_addr != src.s_addr) { - printf("for %s ", inet_ntoa(dst_ip)); + printf("for %s", inet_ntoa(dst_ip)); s_printed = 1; } if (memcmp(p + ah->ar_hln + 4, me.sll_addr, ah->ar_hln)) { unsigned char *pp = p + ah->ar_hln + 4; if (!s_printed) - printf("for "); - printf("[%02x:%02x:%02x:%02x:%02x:%02x]", + printf(" for"); + printf(" [%02x:%02x:%02x:%02x:%02x:%02x]", pp[0], pp[1], pp[2], pp[3], pp[4], pp[5] ); } @@ -408,8 +409,8 @@ int arping_main(int argc UNUSED_PARAM, char **argv) if (!(option_mask32 & QUIET)) { /* inet_ntoa uses static storage, can't use in same printf */ - printf("ARPING to %s", inet_ntoa(dst)); - printf(" from %s via %s\n", inet_ntoa(src), device); + printf("ARPING %s", inet_ntoa(dst)); + printf(" from %s %s\n", inet_ntoa(src), device); } signal_SA_RESTART_empty_mask(SIGINT, (void (*)(int))finish); -- 2.25.1