svn commit: trunk/busybox/networking

vda at busybox.net vda at busybox.net
Thu Jan 25 00:00:03 UTC 2007


Author: vda
Date: 2007-01-24 16:00:02 -0800 (Wed, 24 Jan 2007)
New Revision: 17515

Log:
accidentally applied wrong (old) patch, fixing up...


Modified:
   trunk/busybox/networking/ping.c


Changeset:
Modified: trunk/busybox/networking/ping.c
===================================================================
--- trunk/busybox/networking/ping.c	2007-01-24 23:55:34 UTC (rev 17514)
+++ trunk/busybox/networking/ping.c	2007-01-25 00:00:02 UTC (rev 17515)
@@ -249,7 +249,7 @@
 	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 void pingstats(void)
+static void pingstats(int junk ATTRIBUTE_UNUSED)
 {
 	int status;
 
@@ -286,7 +286,7 @@
 	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 @@
 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 @@
 	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 @@
 
 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 @@
 #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 */




More information about the busybox-cvs mailing list