Mercurial > hg > dhcpcd
changeset 941:87b603630521 draft
Make TEST work once more.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Fri, 05 Sep 2008 07:31:09 +0000 |
| parents | fa5ad0e4a5ad |
| children | a36adae2cc8a |
| files | bind.c dhcpcd.c if-options.c |
| diffstat | 3 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/bind.c Fri Sep 05 07:22:03 2008 +0000 +++ b/bind.c Fri Sep 05 07:31:09 2008 +0000 @@ -173,6 +173,10 @@ } else reason = "BOUND"; } + if (options & DHCPCD_TEST) { + run_script(iface, "TEST"); + exit(EXIT_SUCCESS); + } if (lease->leasetime == ~0U) lease->renewaltime = lease->rebindtime = lease->leasetime; else {
--- a/dhcpcd.c Fri Sep 05 07:22:03 2008 +0000 +++ b/dhcpcd.c Fri Sep 05 07:31:09 2008 +0000 @@ -457,13 +457,17 @@ lease->addr.s_addr = dhcp->yiaddr; get_option_addr(&lease->server.s_addr, dhcp, DHO_SERVERID); log_dhcp(LOG_INFO, "offered", iface, dhcp); - if (ifo->options & DHCPCD_TEST) { + free(state->offer); + state->offer = dhcp; + *dhcpp = NULL; + if (options & DHCPCD_TEST) { + free(state->old); + state->old = state->new; + state->new = state->offer; + state->offer = NULL; run_script(iface, "TEST"); exit(EXIT_SUCCESS); } - free(state->offer); - state->offer = dhcp; - *dhcpp = NULL; delete_timeout(send_discover, iface); if (ifo->options & DHCPCD_ARP && iface->addr.s_addr != state->offer->yiaddr) @@ -1029,7 +1033,7 @@ /* If we have any other args, we should run as a single dhcpcd instance * for that interface. */ - if (optind == argc - 1) + if (optind == argc - 1 && !(options & DHCPCD_TEST)) snprintf(pidfile, sizeof(pidfile), PIDFILE, "-", argv[optind]); else { snprintf(pidfile, sizeof(pidfile), PIDFILE, "", "");
--- a/if-options.c Fri Sep 05 07:22:03 2008 +0000 +++ b/if-options.c Fri Sep 05 07:31:09 2008 +0000 @@ -262,7 +262,8 @@ case 'k': /* FALLTHROUGH */ case 'n': /* FALLTHROUGH */ case 'x': /* FALLTHROUGH */ - case 'B': /* We need to handle non interface options */ + case 'B': /* FALLTHROUGH */ + case 'T': /* We need to handle non interface options */ break; case 'c': strlcpy(ifo->script, arg, sizeof(ifo->script));
