summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko2007-06-19 11:24:47 +0000
committerDenis Vlasenko2007-06-19 11:24:47 +0000
commita61cb92f2d1d9a7862813f37e3e3229e27ad21de (patch)
tree4f8e65a81c1f5147c0372289f176e275c6aafba9 /libbb
parent6d9ea24611090f06b74e0e5b038b6c5b4bbe1063 (diff)
downloadbusybox-a61cb92f2d1d9a7862813f37e3e3229e27ad21de.zip
busybox-a61cb92f2d1d9a7862813f37e3e3229e27ad21de.tar.gz
make /etc/network parsing configurable. -200 bytes when off.
Diffstat (limited to 'libbb')
-rw-r--r--libbb/Config.in8
-rw-r--r--libbb/inet_common.c9
2 files changed, 13 insertions, 4 deletions
diff --git a/libbb/Config.in b/libbb/Config.in
index 0a3769d..5f4e416 100644
--- a/libbb/Config.in
+++ b/libbb/Config.in
@@ -26,6 +26,14 @@ config MD5_SIZE_VS_SPEED
2 3.0 5088
3 (smallest) 5.1 4912
+config FEATURE_ETC_NETWORKS
+ bool "Support for /etc/networks"
+ default n
+ help
+ Enable support for network names in /etc/networks. This is
+ a rarely used feature which allows you to use names
+ instead of IP/mask pairs in route command.
+
config FEATURE_EDITING
bool "Command line editing"
default n
diff --git a/libbb/inet_common.c b/libbb/inet_common.c
index 8449201..ec3c3f9 100644
--- a/libbb/inet_common.c
+++ b/libbb/inet_common.c
@@ -14,7 +14,9 @@
int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst)
{
struct hostent *hp;
+#if ENABLE_FEATURE_ETC_NETWORKS
struct netent *np;
+#endif
/* Grmpf. -FvK */
s_in->sin_family = AF_INET;
@@ -43,6 +45,7 @@ int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst)
return 0;
}
}
+#if ENABLE_FEATURE_ETC_NETWORKS
/* Try the NETWORKS database to see if this is a known network. */
#ifdef DEBUG
bb_error_msg("getnetbyname(%s)", name);
@@ -52,6 +55,7 @@ int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst)
s_in->sin_addr.s_addr = htonl(np->n_net);
return 1;
}
+#endif
if (hostfirst) {
/* Don't try again */
return -1;
@@ -140,10 +144,7 @@ char *INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask)
ent = gethostbyaddr((char *) &ad, 4, AF_INET);
if (ent)
name = xstrdup(ent->h_name);
- } else {
- /* Hmmm... this is very rare to have named nets,
- * and this getnetbyaddr() call is the only one in bbox.
- * Maybe get rid of or make configurable? */
+ } else if (ENABLE_FEATURE_ETC_NETWORKS) {
struct netent *np;
#ifdef DEBUG
bb_error_msg("getnetbyaddr (%08x)", (unsigned)host_ad);