diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-19 11:24:47 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-19 11:24:47 +0000 |
commit | a61cb92f2d1d9a7862813f37e3e3229e27ad21de (patch) | |
tree | 4f8e65a81c1f5147c0372289f176e275c6aafba9 | |
parent | 6d9ea24611090f06b74e0e5b038b6c5b4bbe1063 (diff) | |
download | busybox-w32-a61cb92f2d1d9a7862813f37e3e3229e27ad21de.tar.gz busybox-w32-a61cb92f2d1d9a7862813f37e3e3229e27ad21de.tar.bz2 busybox-w32-a61cb92f2d1d9a7862813f37e3e3229e27ad21de.zip |
make /etc/network parsing configurable. -200 bytes when off.
-rw-r--r-- | libbb/Config.in | 8 | ||||
-rw-r--r-- | libbb/inet_common.c | 9 |
2 files changed, 13 insertions, 4 deletions
diff --git a/libbb/Config.in b/libbb/Config.in index 0a3769df2..5f4e416dd 100644 --- a/libbb/Config.in +++ b/libbb/Config.in | |||
@@ -26,6 +26,14 @@ config MD5_SIZE_VS_SPEED | |||
26 | 2 3.0 5088 | 26 | 2 3.0 5088 |
27 | 3 (smallest) 5.1 4912 | 27 | 3 (smallest) 5.1 4912 |
28 | 28 | ||
29 | config FEATURE_ETC_NETWORKS | ||
30 | bool "Support for /etc/networks" | ||
31 | default n | ||
32 | help | ||
33 | Enable support for network names in /etc/networks. This is | ||
34 | a rarely used feature which allows you to use names | ||
35 | instead of IP/mask pairs in route command. | ||
36 | |||
29 | config FEATURE_EDITING | 37 | config FEATURE_EDITING |
30 | bool "Command line editing" | 38 | bool "Command line editing" |
31 | default n | 39 | default n |
diff --git a/libbb/inet_common.c b/libbb/inet_common.c index 8449201ab..ec3c3f9bb 100644 --- a/libbb/inet_common.c +++ b/libbb/inet_common.c | |||
@@ -14,7 +14,9 @@ | |||
14 | int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst) | 14 | int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst) |
15 | { | 15 | { |
16 | struct hostent *hp; | 16 | struct hostent *hp; |
17 | #if ENABLE_FEATURE_ETC_NETWORKS | ||
17 | struct netent *np; | 18 | struct netent *np; |
19 | #endif | ||
18 | 20 | ||
19 | /* Grmpf. -FvK */ | 21 | /* Grmpf. -FvK */ |
20 | s_in->sin_family = AF_INET; | 22 | s_in->sin_family = AF_INET; |
@@ -43,6 +45,7 @@ int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst) | |||
43 | return 0; | 45 | return 0; |
44 | } | 46 | } |
45 | } | 47 | } |
48 | #if ENABLE_FEATURE_ETC_NETWORKS | ||
46 | /* Try the NETWORKS database to see if this is a known network. */ | 49 | /* Try the NETWORKS database to see if this is a known network. */ |
47 | #ifdef DEBUG | 50 | #ifdef DEBUG |
48 | bb_error_msg("getnetbyname(%s)", name); | 51 | bb_error_msg("getnetbyname(%s)", name); |
@@ -52,6 +55,7 @@ int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst) | |||
52 | s_in->sin_addr.s_addr = htonl(np->n_net); | 55 | s_in->sin_addr.s_addr = htonl(np->n_net); |
53 | return 1; | 56 | return 1; |
54 | } | 57 | } |
58 | #endif | ||
55 | if (hostfirst) { | 59 | if (hostfirst) { |
56 | /* Don't try again */ | 60 | /* Don't try again */ |
57 | return -1; | 61 | return -1; |
@@ -140,10 +144,7 @@ char *INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask) | |||
140 | ent = gethostbyaddr((char *) &ad, 4, AF_INET); | 144 | ent = gethostbyaddr((char *) &ad, 4, AF_INET); |
141 | if (ent) | 145 | if (ent) |
142 | name = xstrdup(ent->h_name); | 146 | name = xstrdup(ent->h_name); |
143 | } else { | 147 | } else if (ENABLE_FEATURE_ETC_NETWORKS) { |
144 | /* Hmmm... this is very rare to have named nets, | ||
145 | * and this getnetbyaddr() call is the only one in bbox. | ||
146 | * Maybe get rid of or make configurable? */ | ||
147 | struct netent *np; | 148 | struct netent *np; |
148 | #ifdef DEBUG | 149 | #ifdef DEBUG |
149 | bb_error_msg("getnetbyaddr (%08x)", (unsigned)host_ad); | 150 | bb_error_msg("getnetbyaddr (%08x)", (unsigned)host_ad); |