From e4d54a59f6db20a79181e1666a28d292b07a4652 Mon Sep 17 00:00:00 2001
From: Justin Maggard <jmaggard10@gmail.com>
Date: Wed, 16 Jul 2014 11:12:12 -0700
Subject: [PATCH] gdhcp: Request an actual IP address when rebinding

We need to specify a requested IP address when our DHCP client state
is REBINDING as well as REQUESTING and REBOOTING; or else we end up
sending a DHCP request for 0.0.0.0, which generally just gets ignored.
---
 gdhcp/client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdhcp/client.c b/gdhcp/client.c
index 7b47ad2..45922f1 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -484,13 +484,13 @@ static int send_request(GDHCPClient *dhcp_client)
 
 	add_send_options(dhcp_client, &packet);
 
-	if (dhcp_client->state == RENEWING) {
+	if (dhcp_client->state == RENEWING || dhcp_client->state == REBINDING)
 		packet.ciaddr = htonl(dhcp_client->requested_ip);
 
+	if (dhcp_client->state == RENEWING)
 		return dhcp_send_kernel_packet(&packet,
 				dhcp_client->requested_ip, CLIENT_PORT,
 				dhcp_client->server_ip, SERVER_PORT);
-	}
 
 	return dhcp_send_raw_packet(&packet, INADDR_ANY, CLIENT_PORT,
 					INADDR_BROADCAST, SERVER_PORT,
-- 
2.1.0

