aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWade Berrier <wberrier@gmail.com>2008-11-14 21:18:45 +0000
committerWade Berrier <wberrier@gmail.com>2008-11-14 21:18:45 +0000
commit142c5cb2a2a7bdceeebec7a55759852bb7ada066 (patch)
tree088895cbbd41ed88152a84e690f6d9e38818fa3e
parent86c285d9003b3b8196707130d48d5c698b6cd3d3 (diff)
downloadbusybox-142c5cb2a2a7bdceeebec7a55759852bb7ada066.tar.gz
ifupdown.c: allow options to udhcpc to be configurable from .config
This allows more control over options that are passed to udhcpc that are not configurable via /etc/network/interfaces. Example: rather than quit when an initial lease isn't found, you could use "--background" so that udhcpc keeps running and continually attempts to get an ip. That way, when you plug in the ethernet after powering on the device, you'll still get an ip.
-rw-r--r--networking/Config.in9
-rw-r--r--networking/ifupdown.c6
2 files changed, 13 insertions, 2 deletions
diff --git a/networking/Config.in b/networking/Config.in
index 95f894230..735415ccb 100644
--- a/networking/Config.in
+++ b/networking/Config.in
@@ -858,6 +858,15 @@ config FEATURE_TRACEROUTE_USE_ICMP
source networking/udhcp/Config.in
+config IFUPDOWN_UDHCPC_CMD_OPTIONS
+ string "ifup udhcpc command line options"
+ default "-R -n"
+ depends on IFUPDOWN && APP_UDHCPC
+ help
+ Command line options to pass to udhcpc from ifup.
+ Intended to alter options not available in /etc/network/interfaces.
+ (IE: --syslog --background etc...)
+
config VCONFIG
bool "vconfig"
default n
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index d7cb40f32..07855f07f 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -31,6 +31,8 @@
#define MAX_INTERFACE_LENGTH 10
#endif
+#define UDHCPC_CMD_OPTIONS CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS
+
#define debug_noise(args...) /*fprintf(stderr, args)*/
/* Forward declaration */
@@ -487,7 +489,7 @@ static const struct dhcp_client_t ext_dhcp_clients[] = {
"pump -i %iface% -k",
},
{ "udhcpc",
- "udhcpc -R -n -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -H %hostname%]][[ -c %clientid%]]"
+ "udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -H %hostname%]][[ -c %clientid%]]"
"[[ -s %script%]][[ %udhcpc_opts%]]",
"kill `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null",
},
@@ -526,7 +528,7 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
if (!execute("ifconfig %iface%[[ hw %hwaddress%]] up", ifd, exec))
return 0;
#endif
- return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid "
+ return execute("udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid "
"-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]][[ %udhcpc_opts%]]",
ifd, exec);
}