From 0d1c2010322b5e314d00214c1b940d7df4799ba3 Mon Sep 17 00:00:00 2001
From: Vlad Lungu <vlad.lungu@windriver.com>
Date: Wed, 29 Oct 2014 15:28:09 +0200
Subject: [PATCH] Fix DHCP handling of link state

When link status goes down, admin status of the interface
stays up until link status goes up again. This is not optimal.

We need to notify the DHCP client when the link status goes down too.

Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
---
 src/core/netif.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/core/netif.c b/src/core/netif.c
index 36e801b..34b603d 100644
--- a/src/core/netif.c
+++ b/src/core/netif.c
@@ -652,6 +652,13 @@ void netif_set_link_down(struct netif *netif )
 {
   if (netif->flags & NETIF_FLAG_LINK_UP) {
     netif->flags &= ~NETIF_FLAG_LINK_UP;
+
+#if LWIP_DHCP
+    if (netif->dhcp) {
+      dhcp_network_changed(netif);
+    }
+#endif /* LWIP_DHCP */
+
     NETIF_LINK_CALLBACK(netif);
   }
 }
-- 
1.7.9.5

