Block polling during a discover. This prevents the code from binding twice to a working lease. --- contrib/isc-dhcp/includes/dhcpd.h Thu Aug 7 09:27:14 2003 +++ contrib/isc-dhcp/includes/dhcpd.h.new Thu Aug 7 13:48:02 2003 @@ -786,6 +786,7 @@ int ieee80211; /* True if media is ieee802.11 */ int havemedia; /* True if we have a media table */ int linkstate; /* True if we have link */ + int polling; /* True if polling is enabled */ int forcediscover; /* True if a discover is needed */ int index; /* Its index. */ int rfdesc; /* Its read file descriptor. */ --- contrib/isc-dhcp/client/dhclient.c.orig Thu Aug 7 13:58:57 2003 +++ contrib/isc-dhcp/client/dhclient.c Thu Aug 7 16:54:11 2003 @@ -260,8 +260,13 @@ #ifdef __FreeBSD__ set_ieee80211 (tmp); #endif + /* Init some interface vars, enable polling */ +#ifdef ENABLE_POLLING_MODE tmp -> forcediscover = 0; tmp -> linkstate = 0; + tmp -> polling = 1; +#endif /* ifdef ENABLE_POLLING_MODE */ + if (interfaces) { interface_reference (&tmp -> next, interfaces, MDL); @@ -944,8 +949,10 @@ (long)(client -> active -> renewal - cur_time)); client -> state = S_BOUND; #ifdef ENABLE_POLLING_MODE + /* Init some interface vars, enable polling */ client -> interface -> linkstate = HAVELINK; client -> interface -> forcediscover = 0; + client -> interface -> polling = 1; #endif /* ifdef ENABLE_POLLING_MODE */ reinitialize_interfaces (); go_daemon (); @@ -1409,6 +1416,11 @@ int interval; int increase = 1; +#ifdef ENABLE_POLLING_MODE + /* Disable polling for this interface */ + client -> interface -> polling = 0; +#endif + /* Figure out how long it's been since we started transmitting. */ interval = cur_time - client -> first_sending; @@ -1552,6 +1564,10 @@ log_info ("bound: renewal in %ld %s.", (long)(client -> active -> renewal - cur_time), "seconds"); +#ifdef ENABLE_POLLING_MODE + /* Enable polling for thsi interface */ + client -> interface -> polling = 1; +#endif add_timeout (client -> active -> renewal, state_bound, client, 0, 0); } else { @@ -1609,6 +1625,12 @@ } log_info ("No working leases in persistent database - sleeping."); + +#ifdef ENABLE_POLLING_MODE + /* Enable polling for this interface */ + client -> interface -> polling = 1; +#endif + script_init (client, "FAIL", (struct string_list *)0); if (client -> alias) script_write_params (client, "alias_", client -> alias); @@ -3341,12 +3363,11 @@ struct interface_info *ip; struct client_state *client; -#ifdef DEBUG - printf ("Polling interface status\n"); -#endif for (ip = interfaces; ip; ip = ip -> next) { - + if (! ip -> polling) + continue; #ifdef DEBUG + printf ("%s: Polling interface state\n", ip -> name); for (client = ip -> client; client; client = client -> next) { printf ("%s: client state of %d\n", ip -> name, ip -> client -> state);