} 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 {
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) {
- run_script(iface, "TEST");
- exit(EXIT_SUCCESS);
- }
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);
+ }
delete_timeout(send_discover, iface);
if (ifo->options & DHCPCD_ARP &&
iface->addr.s_addr != state->offer->yiaddr)
/* 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, "", "");
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));