changeset 1049:b6e62c7120c2 draft

Wait correctly after a DECLINE and ensure we send the IP we're declining and ServerID that issued it.
author Roy Marples <roy@marples.name>
date Tue, 28 Oct 2008 09:26:42 +0000
parents 065ec4ab79bb
children a74e3c5e71c9
files client.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/client.c	Tue Oct 28 09:25:26 2008 +0000
+++ b/client.c	Tue Oct 28 09:26:42 2008 +0000
@@ -1666,17 +1666,19 @@
 	int cookie = state->offer->cookie;
 
 	if (!IN_LINKLOCAL(htonl(state->fail.s_addr))) {
+		if (cookie) {
+			state->timeout.tv_sec = DHCP_ARP_FAIL;
+			state->timeout.tv_usec = 0;
+			do_socket(state, SOCKET_OPEN);
+			send_message(state, DHCP_DECLINE, options);
+			do_socket(state, SOCKET_CLOSED);
+		}
 		state->state = STATE_INIT;
 		free(state->offer);
 		state->offer = NULL;
 		state->lease.addr.s_addr = 0;
 		if (!cookie)
 			return 1;
-		state->timeout.tv_sec = DHCP_ARP_FAIL;
-		state->timeout.tv_usec = 0;
-		do_socket(state, SOCKET_OPEN);
-		send_message(state, DHCP_DECLINE, options);
-		do_socket(state, SOCKET_CLOSED);
 		return 0;
 	}