--- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -532,7 +532,7 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) { if (execable("/sbin/udhcpc")) { - return( execute("udhcpc -n -p /var/run/udhcpc.%iface%.pid -i " + return( execute("udhcpc -b -p /var/run/udhcpc.%iface%.pid -i " "%iface% [[-H %hostname%]] [[-c %clientid%]]", ifd, exec)); } else if (execable("/sbin/pump")) { return( execute("pump -i %iface% [[-h %hostname%]] [[-l %leasehours%]]", ifd, exec)); --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -287,6 +287,7 @@ state = INIT_SELECTING; run_script(NULL, "deconfig"); change_mode(LISTEN_RAW); + xid = random_xid(); for (;;) { @@ -315,27 +316,26 @@ /* timeout dropped to zero */ switch (state) { case INIT_SELECTING: + if(client_config.background_if_no_lease) + { + LOG(LOG_INFO, "Backgrounding"); + client_background(); + } if (packet_num < 3) { - if (packet_num == 0) - xid = random_xid(); - /* send discover packet */ send_discover(xid, requested_ip); /* broadcast */ - timeout = now + ((packet_num == 2) ? 4 : 2); + timeout = now + 2; packet_num++; } else { run_script(NULL, "leasefail"); - if (client_config.background_if_no_lease) { - LOG(LOG_INFO, "No lease, forking to background."); - client_background(); - } else if (client_config.abort_if_no_lease) { + if (client_config.abort_if_no_lease) { LOG(LOG_INFO, "No lease, failing."); return 1; } /* wait to try again */ packet_num = 0; - timeout = now + 60; + timeout = now + 2; } break; case RENEW_REQUESTED: