diff options
author | Martin Blapp <mbr@FreeBSD.org> | 2004-01-19 22:07:59 +0000 |
---|---|---|
committer | Martin Blapp <mbr@FreeBSD.org> | 2004-01-19 22:07:59 +0000 |
commit | cf5d2c693463f6873d67a75de65285544477e388 (patch) | |
tree | 62d1ac8d62d71de66aef65ab5cac999cf3163df5 | |
parent | 863fa48f657ac2268716eb8027eede1629f15e0f (diff) |
Notes
-rw-r--r-- | contrib/isc-dhcp/FREEBSD-upgrade | 1 | ||||
-rw-r--r-- | contrib/isc-dhcp/client/dhclient.c | 31 |
2 files changed, 28 insertions, 4 deletions
diff --git a/contrib/isc-dhcp/FREEBSD-upgrade b/contrib/isc-dhcp/FREEBSD-upgrade index e67b83fd7d8b..b1c24241d7dd 100644 --- a/contrib/isc-dhcp/FREEBSD-upgrade +++ b/contrib/isc-dhcp/FREEBSD-upgrade @@ -46,6 +46,7 @@ Local Changes: r1.6 - document -D option. - remove dhcpd from SEE ALSO section. client/dhclient.c + r1.35 - interface polling r1.32 - interface polling r1.31 - interface polling r1.30 - interface polling diff --git a/contrib/isc-dhcp/client/dhclient.c b/contrib/isc-dhcp/client/dhclient.c index c2e302376f63..15da9c99bb40 100644 --- a/contrib/isc-dhcp/client/dhclient.c +++ b/contrib/isc-dhcp/client/dhclient.c @@ -1773,6 +1773,19 @@ void send_request (cpp) client -> packet.secs = htons (65535); } + + /* + * Only try the first ten seconds to renew a lease from a + * given dhcp-server adress. After that, fall back to use + * state_reboot with INADDR_BROADCAST. + */ + if (destination.sin_addr.s_addr != INADDR_BROADCAST && + (client -> state == S_RENEWING || client -> state == S_REBINDING)) { + if (client -> active && client -> active -> expiry > cur_time && + interval >= 10) + goto cancel; + } + log_info ("DHCPREQUEST on %s to %s port %d", client -> name ? client -> name : client -> interface -> name, inet_ntoa (destination.sin_addr), @@ -1794,6 +1807,16 @@ void send_request (cpp) from, &destination, (struct hardware *)0); + /* + * If sendto() for a direct request fails, fall back to use + * state_reboot with INADDR_BROADCAST. + */ + if (result == -1 && destination.sin_addr.s_addr != INADDR_BROADCAST && + (client -> state == S_RENEWING || client -> state == S_REBINDING)) { + if (client -> active && client -> active -> expiry > cur_time) + goto cancel; + } + add_timeout (cur_time + client -> interval, send_request, client, 0, 0); } @@ -3413,9 +3436,9 @@ void state_polling (cpp) printf ("%s: Found Link on interface\n", ip -> name); #endif /* - * Set the interface to state_reboot. But of - * course we can not be sure that we really got link, - * we just assume it. + * Set the interface to state_bound. We assume that we have + * a working link. If we cannot reach the server directly, + * INADDR_BROADCAST is used. */ for (client = ip -> client; client; client = client -> next) { @@ -3423,7 +3446,7 @@ void state_polling (cpp) cancel_timeout (state_reboot, client); cancel_timeout (state_selecting, client); add_timeout (cur_time + random () % 5, - state_reboot, client, 0, 0); + state_bound, client, 0, 0); } ip -> linkstate = HAVELINK; } else { |