svn commit: trunk/busybox: include libbb networking networking/libi etc...

vda at busybox.net vda at busybox.net
Tue Nov 21 20:34:22 UTC 2006


Author: vda
Date: 2006-11-21 12:34:21 -0800 (Tue, 21 Nov 2006)
New Revision: 16612

Log:
bb_INET_default[] is really just a const "default",
nothing INET-specific


Modified:
   trunk/busybox/include/inet_common.h
   trunk/busybox/include/libbb.h
   trunk/busybox/libbb/inet_common.c
   trunk/busybox/libbb/messages.c
   trunk/busybox/networking/ifconfig.c
   trunk/busybox/networking/libiproute/utils.c
   trunk/busybox/networking/route.c


Changeset:
Modified: trunk/busybox/include/inet_common.h
===================================================================
--- trunk/busybox/include/inet_common.h	2006-11-21 20:32:38 UTC (rev 16611)
+++ trunk/busybox/include/inet_common.h	2006-11-21 20:34:21 UTC (rev 16612)
@@ -14,16 +14,12 @@
 #include <sys/socket.h>
 #include "platform.h"
 
-
-extern const char bb_INET_default[];    /* = "default" */
-
 /* hostfirst!=0 If we expect this to be a hostname,
    try hostname database first
  */
 extern int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst);
 
-
-/* numeric: & 0x8000: default instead of *,
+/* numeric: & 0x8000: "default" instead of "*",
  *          & 0x4000: host instead of net,
  *          & 0x0fff: don't resolve
  */

Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2006-11-21 20:32:38 UTC (rev 16611)
+++ trunk/busybox/include/libbb.h	2006-11-21 20:34:21 UTC (rev 16612)
@@ -604,6 +604,8 @@
 extern const char bb_msg_standard_input[];
 extern const char bb_msg_standard_output[];
 
+extern const char bb_str_default[];
+
 extern const char bb_path_mtab_file[];
 extern const char bb_path_nologin_file[];
 extern const char bb_path_passwd_file[];

Modified: trunk/busybox/libbb/inet_common.c
===================================================================
--- trunk/busybox/libbb/inet_common.c	2006-11-21 20:32:38 UTC (rev 16611)
+++ trunk/busybox/libbb/inet_common.c	2006-11-21 20:34:21 UTC (rev 16612)
@@ -12,8 +12,6 @@
 #include "libbb.h"
 #include "inet_common.h"
 
-const char bb_INET_default[] = "default";
-
 int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst)
 {
 	struct hostent *hp;
@@ -24,9 +22,9 @@
 	s_in->sin_port = 0;
 
 	/* Default is special, meaning 0.0.0.0. */
-	if (!strcmp(name, bb_INET_default)) {
+	if (!strcmp(name, bb_str_default)) {
 		s_in->sin_addr.s_addr = INADDR_ANY;
-		return (1);
+		return 1;
 	}
 	/* Look to see if it's a dotted quad. */
 	if (inet_aton(name, &s_in->sin_addr)) {
@@ -102,7 +100,7 @@
 				  s_in->sin_family);
 #endif
 		errno = EAFNOSUPPORT;
-		return (-1);
+		return -1;
 	}
 	ad = (unsigned long) s_in->sin_addr.s_addr;
 #ifdef DEBUG
@@ -111,15 +109,15 @@
 	if (ad == INADDR_ANY) {
 		if ((numeric & 0x0FFF) == 0) {
 			if (numeric & 0x8000)
-				safe_strncpy(name, bb_INET_default, len);
+				safe_strncpy(name, bb_str_default, len);
 			else
 				safe_strncpy(name, "*", len);
-			return (0);
+			return 0;
 		}
 	}
 	if (numeric & 0x0FFF) {
 		safe_strncpy(name, inet_ntoa(s_in->sin_addr), len);
-		return (0);
+		return 0;
 	}
 
 	if ((ad & (~netmask)) != 0 || (numeric & 0x4000))
@@ -132,7 +130,7 @@
 			bb_error_msg("rresolve: found %s %08lx in cache",
 					  (host ? "host" : "net"), ad);
 #endif
-			return (0);
+			return 0;
 		}
 		pn = pn->next;
 	}
@@ -167,7 +165,7 @@
 	pn->name = xstrdup(name);
 	INET_nn = pn;
 
-	return (0);
+	return 0;
 }
 
 #ifdef CONFIG_FEATURE_IPV6
@@ -179,7 +177,8 @@
 
 	memset(&req, '\0', sizeof req);
 	req.ai_family = AF_INET6;
-	if ((s = getaddrinfo(name, NULL, &req, &ai))) {
+	s = getaddrinfo(name, NULL, &req, &ai);
+	if (s) {
 		bb_error_msg("getaddrinfo: %s: %d", name, s);
 		return -1;
 	}
@@ -187,7 +186,7 @@
 
 	freeaddrinfo(ai);
 
-	return (0);
+	return 0;
 }
 
 #ifndef IN6_IS_ADDR_UNSPECIFIED
@@ -205,23 +204,24 @@
 	/* Grmpf. -FvK */
 	if (sin6->sin6_family != AF_INET6) {
 #ifdef DEBUG
-		bb_error_msg(_("rresolve: unsupport address family %d!"),
+		bb_error_msg("rresolve: unsupport address family %d!",
 				  sin6->sin6_family);
 #endif
 		errno = EAFNOSUPPORT;
-		return (-1);
+		return -1;
 	}
 	if (numeric & 0x7FFF) {
 		inet_ntop(AF_INET6, &sin6->sin6_addr, name, len);
-		return (0);
+		return 0;
 	}
 	if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
 		if (numeric & 0x8000) {
-			strcpy(name, "default");
+			strcpy(name, bb_str_default);
 		} else {
-			strcpy(name, "*");
+			name[0] = '*';
+			name[1] = '\0';
 		}
-		return (0);
+		return 0;
 	}
 
 	s = getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6), name, len, NULL, 0, 0);
@@ -229,7 +229,7 @@
 		bb_error_msg("getnameinfo failed");
 		return -1;
 	}
-	return (0);
+	return 0;
 }
 
 #endif							/* CONFIG_FEATURE_IPV6 */

Modified: trunk/busybox/libbb/messages.c
===================================================================
--- trunk/busybox/libbb/messages.c	2006-11-21 20:32:38 UTC (rev 16611)
+++ trunk/busybox/libbb/messages.c	2006-11-21 20:34:21 UTC (rev 16612)
@@ -28,6 +28,8 @@
 const char bb_msg_standard_input[] = "standard input";
 const char bb_msg_standard_output[] = "standard output";
 
+const char bb_str_default[] = "default";
+
 const char bb_path_passwd_file[] = "/etc/passwd";
 const char bb_path_shadow_file[] = "/etc/shadow";
 const char bb_path_group_file[] = "/etc/group";

Modified: trunk/busybox/networking/ifconfig.c
===================================================================
--- trunk/busybox/networking/ifconfig.c	2006-11-21 20:32:38 UTC (rev 16611)
+++ trunk/busybox/networking/ifconfig.c	2006-11-21 20:34:21 UTC (rev 16612)
@@ -394,7 +394,7 @@
 
 						sai.sin_family = AF_INET;
 						sai.sin_port = 0;
-						if (!strcmp(host, bb_INET_default)) {
+						if (!strcmp(host, bb_str_default)) {
 							/* Default is special, meaning 0.0.0.0. */
 							sai.sin_addr.s_addr = INADDR_ANY;
 #if ENABLE_FEATURE_IFCONFIG_BROADCAST_PLUS

Modified: trunk/busybox/networking/libiproute/utils.c
===================================================================
--- trunk/busybox/networking/libiproute/utils.c	2006-11-21 20:32:38 UTC (rev 16611)
+++ trunk/busybox/networking/libiproute/utils.c	2006-11-21 20:34:21 UTC (rev 16612)
@@ -125,7 +125,7 @@
 
 	memset(addr, 0, sizeof(*addr));
 
-	if (strcmp(name, bb_INET_default) == 0 ||
+	if (strcmp(name, bb_str_default) == 0 ||
 		strcmp(name, "all") == 0 || strcmp(name, "any") == 0) {
 		addr->family = family;
 		addr->bytelen = (family == AF_INET6 ? 16 : 4);
@@ -169,7 +169,7 @@
 
 	memset(dst, 0, sizeof(*dst));
 
-	if (strcmp(arg, bb_INET_default) == 0 || strcmp(arg, "any") == 0) {
+	if (strcmp(arg, bb_str_default) == 0 || strcmp(arg, "any") == 0) {
 		dst->family = family;
 		dst->bytelen = 0;
 		dst->bitlen = 0;

Modified: trunk/busybox/networking/route.c
===================================================================
--- trunk/busybox/networking/route.c	2006-11-21 20:32:38 UTC (rev 16611)
+++ trunk/busybox/networking/route.c	2006-11-21 20:34:21 UTC (rev 16612)
@@ -186,7 +186,7 @@
 #endif
 		} else {
 			/* Default netmask. */
-			netmask = bb_INET_default;
+			netmask = bb_str_default;
 		}
 		/* Prefer hostname lookup is -host flag (xflag==1) was given. */
 		isnet = INET_resolve(target, (struct sockaddr_in *) &rt.rt_dst,
@@ -346,7 +346,7 @@
 		/* We know args isn't NULL from the check in route_main. */
 		const char *target = *args++;
 
-		if (strcmp(target, bb_INET_default) == 0) {
+		if (strcmp(target, bb_str_default) == 0) {
 			prefix_len = 0;
 			memset(&sa6, 0, sizeof(sa6));
 		} else {




More information about the busybox-cvs mailing list