svn commit: trunk/busybox: docs networking

vda at busybox.net vda at busybox.net
Tue Nov 7 19:05:44 UTC 2006


Author: vda
Date: 2006-11-07 11:05:43 -0800 (Tue, 07 Nov 2006)
New Revision: 16520

Log:
small ipv6 doc changes; nslookup a tiny bit smaller


Modified:
   trunk/busybox/docs/ipv4_ipv6.txt
   trunk/busybox/networking/nc.c
   trunk/busybox/networking/nslookup.c


Changeset:
Modified: trunk/busybox/docs/ipv4_ipv6.txt
===================================================================
--- trunk/busybox/docs/ipv4_ipv6.txt	2006-11-07 01:52:10 UTC (rev 16519)
+++ trunk/busybox/docs/ipv4_ipv6.txt	2006-11-07 19:05:43 UTC (rev 16520)
@@ -212,7 +212,8 @@
 Here's the corresponding server C code for a dual-stack platform:
 
     int ServSock, csock;
-    struct sockaddr addr, from;
+    /* struct sockaddr is too small! */
+    struct sockaddr_storage addr, from;
     ...
     ServSock = socket(AF_INET6, SOCK_STREAM, PF_INET6);
     bind(ServSock, &addr, sizeof(addr));

Modified: trunk/busybox/networking/nc.c
===================================================================
--- trunk/busybox/networking/nc.c	2006-11-07 01:52:10 UTC (rev 16519)
+++ trunk/busybox/networking/nc.c	2006-11-07 19:05:43 UTC (rev 16520)
@@ -25,7 +25,6 @@
 	SKIP_NC_EXTRA (const int execparam = 0;)
 	USE_NC_EXTRA  (char **execparam = NULL;)
 	struct sockaddr_in address;
-	struct hostent *hostinfo;
 	fd_set readfds, testfds;
 	int opt; /* must be signed (getopt returns -1) */
 
@@ -116,6 +115,7 @@
 
 			if (!execparam) close(sfd);
 		} else {
+			struct hostent *hostinfo;
 			hostinfo = xgethostbyname(argv[0]);
 
 			address.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list;

Modified: trunk/busybox/networking/nslookup.c
===================================================================
--- trunk/busybox/networking/nslookup.c	2006-11-07 01:52:10 UTC (rev 16519)
+++ trunk/busybox/networking/nslookup.c	2006-11-07 19:05:43 UTC (rev 16520)
@@ -82,9 +82,10 @@
 		while (cur) {
 			sockaddr_to_dotted(cur->ai_addr, str, sizeof(str));
 			printf("%s  %s\nAddress: %s", header, hostname, str);
-			if (getnameinfo(cur->ai_addr, cur->ai_addrlen, str, sizeof(str), NULL, 0, NI_NAMEREQD))
+			s[0] = ' ';
+			if (getnameinfo(cur->ai_addr, cur->ai_addrlen, str+1, sizeof(str)-1, NULL, 0, NI_NAMEREQD))
 				str[0] = '\0';
-			printf(" %s\n", str);
+			puts(str);
 			cur = cur->ai_next;
 		}
 	} else {




More information about the busybox-cvs mailing list