diff options
| author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-09-28 22:31:51 +0000 |
|---|---|---|
| committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-09-28 22:31:51 +0000 |
| commit | f64b811576ab7c80cc80dd4d33f8ecc9fbc2e84d (patch) | |
| tree | c614c98ae0690799ceb7ed7dc6eaf49559319367 | |
| parent | fc9975761320f38189e69a6e63666fa86019c550 (diff) | |
| download | busybox-w32-f64b811576ab7c80cc80dd4d33f8ecc9fbc2e84d.tar.gz busybox-w32-f64b811576ab7c80cc80dd4d33f8ecc9fbc2e84d.tar.bz2 busybox-w32-f64b811576ab7c80cc80dd4d33f8ecc9fbc2e84d.zip | |
ifupdown: make dhcp start/stop scripts user configurable
in /etc/network/interfaces. Patch author is Gabriel L. Somlo <somlo@cmu.edu>
git-svn-id: svn://busybox.net/trunk/busybox@16252 69ca8d6d-28ef-0310-b511-8ec308f3f277
| -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 99b1c59d9..fae0684b5 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
| @@ -452,6 +452,14 @@ static int static_down(struct interface_defn_t *ifd, execfn *exec) | |||
| 452 | 452 | ||
| 453 | static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) | 453 | static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) |
| 454 | { | 454 | { |
| 455 | int i; | ||
| 456 | |||
| 457 | for (i = 0; i < ifd->n_options; i++) { | ||
| 458 | if (strcmp(ifd->option[i].name, "dhcp-start-cmd") == 0) { | ||
| 459 | return execute(ifd->option[i].value, ifd, exec); | ||
| 460 | } | ||
| 461 | } | ||
| 462 | |||
| 455 | if (execute("udhcpc -n -p /var/run/udhcpc.%iface%.pid -i " | 463 | if (execute("udhcpc -n -p /var/run/udhcpc.%iface%.pid -i " |
| 456 | "%iface% [[-H %hostname%]] [[-c %clientid%]]", ifd, exec)) return 1; | 464 | "%iface% [[-H %hostname%]] [[-c %clientid%]]", ifd, exec)) return 1; |
| 457 | if (execute("pump -i %iface% [[-h %hostname%]] [[-l %leasehours%]]", ifd, exec)) return 1; | 465 | 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) | |||
| 463 | 471 | ||
| 464 | static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) | 472 | static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) |
| 465 | { | 473 | { |
| 474 | int i; | ||
| 475 | |||
| 476 | for (i = 0; i < ifd->n_options; i++) { | ||
| 477 | if (strcmp(ifd->option[i].name, "dhcp-stop-cmd") == 0) { | ||
| 478 | return execute(ifd->option[i].value, ifd, exec); | ||
| 479 | } | ||
| 480 | } | ||
| 481 | |||
| 466 | /* SIGUSR2 forces udhcpc to release the current lease and go inactive, | 482 | /* SIGUSR2 forces udhcpc to release the current lease and go inactive, |
| 467 | * and SIGTERM causes udhcpc to exit. Signals are queued and processed | 483 | * and SIGTERM causes udhcpc to exit. Signals are queued and processed |
| 468 | * sequentially so we don't need to sleep */ | 484 | * sequentially so we don't need to sleep */ |
