diff options
author | Denis Vlasenko | 2006-09-28 22:31:51 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-09-28 22:31:51 +0000 |
commit | 06b543b2176ccde370e2e26aca151563d4718c18 (patch) | |
tree | c614c98ae0690799ceb7ed7dc6eaf49559319367 /networking | |
parent | 524176680d6026affb91f31182af83c285325d11 (diff) | |
download | busybox-06b543b2176ccde370e2e26aca151563d4718c18.zip busybox-06b543b2176ccde370e2e26aca151563d4718c18.tar.gz |
ifupdown: make dhcp start/stop scripts user configurable
in /etc/network/interfaces. Patch author is Gabriel L. Somlo <somlo@cmu.edu>
Diffstat (limited to 'networking')
-rw-r--r-- | networking/ifupdown.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 99b1c59..fae0684 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -452,6 +452,14 @@ static int static_down(struct interface_defn_t *ifd, execfn *exec) static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) { + int i; + + for (i = 0; i < ifd->n_options; i++) { + if (strcmp(ifd->option[i].name, "dhcp-start-cmd") == 0) { + return execute(ifd->option[i].value, ifd, exec); + } + } + if (execute("udhcpc -n -p /var/run/udhcpc.%iface%.pid -i " "%iface% [[-H %hostname%]] [[-c %clientid%]]", ifd, exec)) return 1; if (execute("pump -i %iface% [[-h %hostname%]] [[-l %leasehours%]]", ifd, exec)) return 1; @@ -463,6 +471,14 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) { + int i; + + for (i = 0; i < ifd->n_options; i++) { + if (strcmp(ifd->option[i].name, "dhcp-stop-cmd") == 0) { + return execute(ifd->option[i].value, ifd, exec); + } + } + /* SIGUSR2 forces udhcpc to release the current lease and go inactive, * and SIGTERM causes udhcpc to exit. Signals are queued and processed * sequentially so we don't need to sleep */ |