diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-25 00:00:02 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-25 00:00:02 +0000 |
commit | aeb4bdd582d6b11adcdb128d97076101c3c61f1d (patch) | |
tree | 80ca04bd0f391a2060174a3464239e9212bc1f76 /networking/ping.c | |
parent | 581930cc0d35e9c056d5e0ceb1ecc45a84e1458f (diff) | |
download | busybox-w32-aeb4bdd582d6b11adcdb128d97076101c3c61f1d.tar.gz busybox-w32-aeb4bdd582d6b11adcdb128d97076101c3c61f1d.tar.bz2 busybox-w32-aeb4bdd582d6b11adcdb128d97076101c3c61f1d.zip |
accidentally applied wrong (old) patch, fixing up...
Diffstat (limited to 'networking/ping.c')
-rw-r--r-- | networking/ping.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/networking/ping.c b/networking/ping.c index d65310789..d8a3b772f 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -249,7 +249,7 @@ static union { | |||
249 | struct sockaddr sa; | 249 | struct sockaddr sa; |
250 | struct sockaddr_in sin; | 250 | struct sockaddr_in sin; |
251 | #if ENABLE_PING6 | 251 | #if ENABLE_PING6 |
252 | struct sockaddr_in sin6; | 252 | struct sockaddr_in6 sin6; |
253 | #endif | 253 | #endif |
254 | } pingaddr; | 254 | } pingaddr; |
255 | static struct sockaddr_in sourceaddr; | 255 | static struct sockaddr_in sourceaddr; |
@@ -274,7 +274,7 @@ static const char *dotted; | |||
274 | 274 | ||
275 | /**************************************************************************/ | 275 | /**************************************************************************/ |
276 | 276 | ||
277 | static void pingstats(void) | 277 | static void pingstats(int junk ATTRIBUTE_UNUSED) |
278 | { | 278 | { |
279 | int status; | 279 | int status; |
280 | 280 | ||
@@ -286,7 +286,7 @@ static void pingstats(void) | |||
286 | if (nrepeats) | 286 | if (nrepeats) |
287 | printf("%lu duplicates, ", nrepeats); | 287 | printf("%lu duplicates, ", nrepeats); |
288 | if (ntransmitted) | 288 | if (ntransmitted) |
289 | ntransmitted = (ntransmitted - nreceived) * 100 / ntransmitted); | 289 | ntransmitted = (ntransmitted - nreceived) * 100 / ntransmitted; |
290 | printf("%lu%% packet loss\n", ntransmitted); | 290 | printf("%lu%% packet loss\n", ntransmitted); |
291 | if (nreceived) | 291 | if (nreceived) |
292 | printf("round-trip min/avg/max = %lu.%lu/%lu.%lu/%lu.%lu ms\n", | 292 | printf("round-trip min/avg/max = %lu.%lu/%lu.%lu/%lu.%lu ms\n", |
@@ -613,7 +613,6 @@ extern int BUG_bad_offsetof_icmp6_cksum(void); | |||
613 | static void ping6(len_and_sockaddr *lsa) | 613 | static void ping6(len_and_sockaddr *lsa) |
614 | { | 614 | { |
615 | char packet[datalen + MAXIPLEN + MAXICMPLEN]; | 615 | char packet[datalen + MAXIPLEN + MAXICMPLEN]; |
616 | char buf[INET6_ADDRSTRLEN]; | ||
617 | int sockopt; | 616 | int sockopt; |
618 | struct msghdr msg; | 617 | struct msghdr msg; |
619 | struct sockaddr_in6 from; | 618 | struct sockaddr_in6 from; |
@@ -657,7 +656,7 @@ static void ping6(len_and_sockaddr *lsa) | |||
657 | setsockopt(pingsock, SOL_IPV6, IPV6_HOPLIMIT, &const_int_1, sizeof(const_int_1)); | 656 | setsockopt(pingsock, SOL_IPV6, IPV6_HOPLIMIT, &const_int_1, sizeof(const_int_1)); |
658 | 657 | ||
659 | if (if_index) | 658 | if (if_index) |
660 | pingaddr.sin6_scope_id = if_index; | 659 | pingaddr.sin6.sin6_scope_id = if_index; |
661 | 660 | ||
662 | printf("PING %s (%s): %d data bytes\n", hostname, dotted, datalen); | 661 | printf("PING %s (%s): %d data bytes\n", hostname, dotted, datalen); |
663 | 662 | ||
@@ -725,7 +724,7 @@ static int parse_nipquad(const char *str, struct sockaddr_in* addr) | |||
725 | 724 | ||
726 | int ping_main(int argc, char **argv) | 725 | int ping_main(int argc, char **argv) |
727 | { | 726 | { |
728 | const char *hostname; | 727 | len_and_sockaddr *lsa; |
729 | char *opt_c, *opt_s, *opt_I; | 728 | char *opt_c, *opt_s, *opt_I; |
730 | USE_PING6(sa_family_t af = AF_UNSPEC;) | 729 | USE_PING6(sa_family_t af = AF_UNSPEC;) |
731 | 730 | ||
@@ -753,14 +752,14 @@ int ping_main(int argc, char **argv) | |||
753 | #else | 752 | #else |
754 | lsa = host_and_af2sockaddr(hostname, 0, AF_INET); | 753 | lsa = host_and_af2sockaddr(hostname, 0, AF_INET); |
755 | #endif | 754 | #endif |
756 | dotted = xmalloc_sockaddr2dotted_noport(lsa->sa, lsa->len); | 755 | dotted = xmalloc_sockaddr2dotted_noport(&lsa->sa, lsa->len); |
757 | #if ENABLE_PING6 | 756 | #if ENABLE_PING6 |
758 | if (lsa->sa.sa_family == AF_INET6) | 757 | if (lsa->sa.sa_family == AF_INET6) |
759 | ping6(lsa); | 758 | ping6(lsa); |
760 | else | 759 | else |
761 | #endif | 760 | #endif |
762 | ping(lsa); | 761 | ping(lsa); |
763 | pingstats(); | 762 | pingstats(0); |
764 | return EXIT_SUCCESS; | 763 | return EXIT_SUCCESS; |
765 | } | 764 | } |
766 | #endif /* FEATURE_FANCY_PING */ | 765 | #endif /* FEATURE_FANCY_PING */ |