summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-25 00:00:02 +0000
committerDenis Vlasenko2007-01-25 00:00:02 +0000
commitaeb4bdd582d6b11adcdb128d97076101c3c61f1d (patch)
tree80ca04bd0f391a2060174a3464239e9212bc1f76
parent581930cc0d35e9c056d5e0ceb1ecc45a84e1458f (diff)
downloadbusybox-aeb4bdd582d6b11adcdb128d97076101c3c61f1d.zip
busybox-aeb4bdd582d6b11adcdb128d97076101c3c61f1d.tar.gz
accidentally applied wrong (old) patch, fixing up...
-rw-r--r--networking/ping.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/networking/ping.c b/networking/ping.c
index d653107..d8a3b77 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -249,7 +249,7 @@ static union {
struct sockaddr sa;
struct sockaddr_in sin;
#if ENABLE_PING6
- struct sockaddr_in sin6;
+ struct sockaddr_in6 sin6;
#endif
} pingaddr;
static struct sockaddr_in sourceaddr;
@@ -274,7 +274,7 @@ static const char *dotted;
/**************************************************************************/
-static void pingstats(void)
+static void pingstats(int junk ATTRIBUTE_UNUSED)
{
int status;
@@ -286,7 +286,7 @@ static void pingstats(void)
if (nrepeats)
printf("%lu duplicates, ", nrepeats);
if (ntransmitted)
- ntransmitted = (ntransmitted - nreceived) * 100 / ntransmitted);
+ ntransmitted = (ntransmitted - nreceived) * 100 / ntransmitted;
printf("%lu%% packet loss\n", ntransmitted);
if (nreceived)
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);
static void ping6(len_and_sockaddr *lsa)
{
char packet[datalen + MAXIPLEN + MAXICMPLEN];
- char buf[INET6_ADDRSTRLEN];
int sockopt;
struct msghdr msg;
struct sockaddr_in6 from;
@@ -657,7 +656,7 @@ static void ping6(len_and_sockaddr *lsa)
setsockopt(pingsock, SOL_IPV6, IPV6_HOPLIMIT, &const_int_1, sizeof(const_int_1));
if (if_index)
- pingaddr.sin6_scope_id = if_index;
+ pingaddr.sin6.sin6_scope_id = if_index;
printf("PING %s (%s): %d data bytes\n", hostname, dotted, datalen);
@@ -725,7 +724,7 @@ static int parse_nipquad(const char *str, struct sockaddr_in* addr)
int ping_main(int argc, char **argv)
{
- const char *hostname;
+ len_and_sockaddr *lsa;
char *opt_c, *opt_s, *opt_I;
USE_PING6(sa_family_t af = AF_UNSPEC;)
@@ -753,14 +752,14 @@ int ping_main(int argc, char **argv)
#else
lsa = host_and_af2sockaddr(hostname, 0, AF_INET);
#endif
- dotted = xmalloc_sockaddr2dotted_noport(lsa->sa, lsa->len);
+ dotted = xmalloc_sockaddr2dotted_noport(&lsa->sa, lsa->len);
#if ENABLE_PING6
if (lsa->sa.sa_family == AF_INET6)
ping6(lsa);
else
#endif
ping(lsa);
- pingstats();
+ pingstats(0);
return EXIT_SUCCESS;
}
#endif /* FEATURE_FANCY_PING */