changeset 2845:6514dd3b9c01 draft

Add a guard to IPv4LL probed in case of an ARP race.
author Roy Marples <roy@marples.name>
date Fri, 14 Nov 2014 07:16:49 +0000
parents 98e127cdf2a7
children 8ac6ab596fb0
files ipv4ll.c
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ipv4ll.c	Thu Nov 13 18:45:04 2014 +0000
+++ b/ipv4ll.c	Fri Nov 14 07:16:49 2014 +0000
@@ -107,15 +107,17 @@
 	struct dhcp_state *state = D_STATE(astate->iface);
 	struct dhcp_message *offer;
 
-	/* A DHCP lease could have already been offered.
-	 * Backup this lease and replace once the IPv4LL addres is bound */
-	offer = state->offer;
-	state->offer = ipv4ll_make_lease(astate->addr.s_addr);
-	if (state->offer == NULL)
-		syslog(LOG_ERR, "%s: %m", __func__);
-	else
-		dhcp_bind(astate->iface, astate);
-	state->offer = offer;
+	if (state->state != DHS_BOUND) {
+		/* A DHCP lease could have already been offered.
+		 * Backup and replace once the IPv4LL addres is bound */
+		offer = state->offer;
+		state->offer = ipv4ll_make_lease(astate->addr.s_addr);
+		if (state->offer == NULL)
+			syslog(LOG_ERR, "%s: %m", __func__);
+		else
+			dhcp_bind(astate->iface, astate);
+		state->offer = offer;
+	}
 }
 
 static void