aboutsummaryrefslogtreecommitdiff
path: root/networking/ping.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-12-13 15:53:06 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-12-13 15:53:06 +0100
commit623e55a396597be7d6f3be332f28c2f0e3b09a1d (patch)
tree85462a39fa7ca5edd8b5d8cf0eba8f104ece3c25 /networking/ping.c
parentd067acb0052c20edbfe7f13c99b8947ce8911eb7 (diff)
downloadbusybox-623e55a396597be7d6f3be332f28c2f0e3b09a1d.tar.gz
traceroute: even with -v, don't show other ping processes reply's
function old new delta traceroute_init 1135 1151 +16 common_ping_main 1919 1935 +16 common_traceroute_main 1715 1668 -47 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 32/-47) Total: -15 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/ping.c')
-rw-r--r--networking/ping.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/networking/ping.c b/networking/ping.c
index 5f7e5b9b5..318d561bb 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -332,6 +332,11 @@ static int common_ping_main(sa_family_t af, char **argv)
create_icmp_socket(lsa);
G.myid = (uint16_t) getpid();
+ /* we can use native-endian ident, but other Unix ping/traceroute
+ * utils use *big-endian pid*, and e.g. traceroute on our machine may be
+ * *not* from busybox, idents may collide. Follow the convention:
+ */
+ G.myid = htons(G.myid);
#if ENABLE_PING6
if (lsa->u.sa.sa_family == AF_INET6)
ping6(lsa);
@@ -927,6 +932,11 @@ static int common_ping_main(int opt, char **argv)
G.interval_us = interval * 1000000;
myid = (uint16_t) getpid();
+ /* we can use native-endian ident, but other Unix ping/traceroute
+ * utils use *big-endian pid*, and e.g. traceroute on our machine may be
+ * *not* from busybox, idents may collide. Follow the convention:
+ */
+ myid = htons(myid);
hostname = argv[optind];
#if ENABLE_PING6
{