diff options
-rw-r--r-- | include/inet_common.h | 6 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | libbb/inet_common.c | 38 | ||||
-rw-r--r-- | libbb/messages.c | 2 | ||||
-rw-r--r-- | networking/ifconfig.c | 2 | ||||
-rw-r--r-- | networking/libiproute/utils.c | 4 | ||||
-rw-r--r-- | networking/route.c | 4 |
7 files changed, 29 insertions, 29 deletions
diff --git a/include/inet_common.h b/include/inet_common.h index 680d441..1c16f6c 100644 --- a/include/inet_common.h +++ b/include/inet_common.h @@ -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 */ diff --git a/include/libbb.h b/include/libbb.h index f574f9b..bec3ce1 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -604,6 +604,8 @@ extern const char bb_msg_invalid_arg[]; 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[]; diff --git a/libbb/inet_common.c b/libbb/inet_common.c index ccf0c35..d8e0035 100644 --- a/libbb/inet_common.c +++ b/libbb/inet_common.c @@ -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 @@ int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst) 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 @@ int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in, 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 @@ int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in, 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 @@ int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in, 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 @@ int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in, pn->name = xstrdup(name); INET_nn = pn; - return (0); + return 0; } #ifdef CONFIG_FEATURE_IPV6 @@ -179,7 +177,8 @@ int INET6_resolve(const char *name, struct sockaddr_in6 *sin6) 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 @@ int INET6_resolve(const char *name, struct sockaddr_in6 *sin6) freeaddrinfo(ai); - return (0); + return 0; } #ifndef IN6_IS_ADDR_UNSPECIFIED @@ -205,23 +204,24 @@ int INET6_rresolve(char *name, size_t len, struct sockaddr_in6 *sin6, /* 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 @@ int INET6_rresolve(char *name, size_t len, struct sockaddr_in6 *sin6, bb_error_msg("getnameinfo failed"); return -1; } - return (0); + return 0; } #endif /* CONFIG_FEATURE_IPV6 */ diff --git a/libbb/messages.c b/libbb/messages.c index bd41216..e3c0faf 100644 --- a/libbb/messages.c +++ b/libbb/messages.c @@ -28,6 +28,8 @@ const char bb_msg_invalid_arg[] = "invalid argument '%s' to '%s'"; 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"; diff --git a/networking/ifconfig.c b/networking/ifconfig.c index 00dc455..05be7dc 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c @@ -394,7 +394,7 @@ int ifconfig_main(int argc, char **argv) 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 diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c index f92179c..e608531 100644 --- a/networking/libiproute/utils.c +++ b/networking/libiproute/utils.c @@ -125,7 +125,7 @@ int get_addr_1(inet_prefix * addr, char *name, int family) 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 @@ int get_prefix_1(inet_prefix * dst, char *arg, int family) 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; diff --git a/networking/route.c b/networking/route.c index c99405d..f343d06 100644 --- a/networking/route.c +++ b/networking/route.c @@ -186,7 +186,7 @@ static void INET_setroute(int action, char **args) #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 @@ static void INET6_setroute(int action, char **args) /* 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 { |