From 8068601eeddef150e0323bc9094a6c54a36ac45b Mon Sep 17 00:00:00 2001
From: Justin Maggard <jmaggard10@gmail.com>
Date: Mon, 14 Jul 2014 10:27:47 -0700
Subject: [PATCH] gdhcp: Save the DHCP server IP when REBOOTING

We need to save the server IP when REBOOTING as well as SELECTING.
Without this, DHCP renew will never work, because we don't know where
to send the unicast renew packets.
---
 gdhcp/client.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gdhcp/client.c b/gdhcp/client.c
index 2b7202a..47ce2e8 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -2366,6 +2366,12 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
 			g_free(dhcp_client->assigned_ip);
 			dhcp_client->assigned_ip = get_ip(packet.yiaddr);
 
+			if (dhcp_client->state == REBOOTING) {
+				option = dhcp_get_option(&packet,
+							DHCP_SERVER_ID);
+				dhcp_client->server_ip = get_be32(option);
+			}
+
 			/* Address should be set up here */
 			if (dhcp_client->lease_available_cb)
 				dhcp_client->lease_available_cb(dhcp_client,
-- 
2.1.0

