networkd: act on lease only if there is one
authorUmut Tezduyar Lindskog <umut.tezduyar@axis.com>
Mon, 17 Feb 2014 20:16:53 +0000 (21:16 +0100)
committerTom Gundersen <teg@jklm.no>
Mon, 17 Feb 2014 22:30:08 +0000 (23:30 +0100)
Interface could go down before acquiring a dhcp lease

src/network/networkd-link.c

index d83c4ce..9aca1b6 100644 (file)
@@ -626,10 +626,12 @@ static void dhcp_handler(sd_dhcp_client *client, int event, void *userdata) {
                                 return;
                         }
 
-                        r = dhcp_lease_lost(link);
-                        if (r < 0) {
-                                link_enter_failed(link);
-                                return;
+                        if (link->dhcp_lease) {
+                                r = dhcp_lease_lost(link);
+                                if (r < 0) {
+                                        link_enter_failed(link);
+                                        return;
+                                }
                         }
 
                         if (event == DHCP_EVENT_IP_CHANGE) {