diff options
| author | Wade Berrier <wberrier@gmail.com> | 2008-11-14 21:18:45 +0000 |
|---|---|---|
| committer | Wade Berrier <wberrier@gmail.com> | 2008-11-14 21:18:45 +0000 |
| commit | 142c5cb2a2a7bdceeebec7a55759852bb7ada066 (patch) | |
| tree | 088895cbbd41ed88152a84e690f6d9e38818fa3e | |
| parent | 86c285d9003b3b8196707130d48d5c698b6cd3d3 (diff) | |
| download | busybox-w32-142c5cb2a2a7bdceeebec7a55759852bb7ada066.tar.gz busybox-w32-142c5cb2a2a7bdceeebec7a55759852bb7ada066.tar.bz2 busybox-w32-142c5cb2a2a7bdceeebec7a55759852bb7ada066.zip | |
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.in | 9 | ||||
| -rw-r--r-- | networking/ifupdown.c | 6 |
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 | |||
| 858 | 858 | ||
| 859 | source networking/udhcp/Config.in | 859 | source networking/udhcp/Config.in |
| 860 | 860 | ||
| 861 | config IFUPDOWN_UDHCPC_CMD_OPTIONS | ||
| 862 | string "ifup udhcpc command line options" | ||
| 863 | default "-R -n" | ||
| 864 | depends on IFUPDOWN && APP_UDHCPC | ||
| 865 | help | ||
| 866 | Command line options to pass to udhcpc from ifup. | ||
| 867 | Intended to alter options not available in /etc/network/interfaces. | ||
| 868 | (IE: --syslog --background etc...) | ||
| 869 | |||
| 861 | config VCONFIG | 870 | config VCONFIG |
| 862 | bool "vconfig" | 871 | bool "vconfig" |
| 863 | default n | 872 | 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 @@ | |||
| 31 | #define MAX_INTERFACE_LENGTH 10 | 31 | #define MAX_INTERFACE_LENGTH 10 |
| 32 | #endif | 32 | #endif |
| 33 | 33 | ||
| 34 | #define UDHCPC_CMD_OPTIONS CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS | ||
| 35 | |||
| 34 | #define debug_noise(args...) /*fprintf(stderr, args)*/ | 36 | #define debug_noise(args...) /*fprintf(stderr, args)*/ |
| 35 | 37 | ||
| 36 | /* Forward declaration */ | 38 | /* Forward declaration */ |
| @@ -487,7 +489,7 @@ static const struct dhcp_client_t ext_dhcp_clients[] = { | |||
| 487 | "pump -i %iface% -k", | 489 | "pump -i %iface% -k", |
| 488 | }, | 490 | }, |
| 489 | { "udhcpc", | 491 | { "udhcpc", |
| 490 | "udhcpc -R -n -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -H %hostname%]][[ -c %clientid%]]" | 492 | "udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -H %hostname%]][[ -c %clientid%]]" |
| 491 | "[[ -s %script%]][[ %udhcpc_opts%]]", | 493 | "[[ -s %script%]][[ %udhcpc_opts%]]", |
| 492 | "kill `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", | 494 | "kill `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", |
| 493 | }, | 495 | }, |
| @@ -526,7 +528,7 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) | |||
| 526 | if (!execute("ifconfig %iface%[[ hw %hwaddress%]] up", ifd, exec)) | 528 | if (!execute("ifconfig %iface%[[ hw %hwaddress%]] up", ifd, exec)) |
| 527 | return 0; | 529 | return 0; |
| 528 | #endif | 530 | #endif |
| 529 | return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid " | 531 | return execute("udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid " |
| 530 | "-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]][[ %udhcpc_opts%]]", | 532 | "-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]][[ %udhcpc_opts%]]", |
| 531 | ifd, exec); | 533 | ifd, exec); |
| 532 | } | 534 | } |
