]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not re-attach sd-event object
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 16 Mar 2020 07:17:04 +0000 (16:17 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 16 Mar 2020 15:32:55 +0000 (00:32 +0900)
Fixes #15126.

src/network/networkd-dhcp4.c
src/network/networkd-ipv4ll.c

index 13e3e32f40e8c6add46c852127b8f29d9beb6e5a..226c73c15c44fc3e6233a2697f13a1161e28ee53 100644 (file)
@@ -1334,11 +1334,11 @@ int dhcp4_configure(Link *link) {
                         return log_oom();
                 if (r < 0)
                         return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to create DHCP4 client: %m");
-        }
 
-        r = sd_dhcp_client_attach_event(link->dhcp_client, NULL, 0);
-        if (r < 0)
-                return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to attach event: %m");
+                r = sd_dhcp_client_attach_event(link->dhcp_client, NULL, 0);
+                if (r < 0)
+                        return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to attach event: %m");
+        }
 
         r = sd_dhcp_client_set_mac(link->dhcp_client,
                                    (const uint8_t *) &link->mac,
index 5750ea091efe6838713c0f866b6a9a448b0e3972..8dac99fed8cc227c87ed38aa17030d75d90bae12 100644 (file)
@@ -154,6 +154,10 @@ int ipv4ll_configure(Link *link) {
                 r = sd_ipv4ll_new(&link->ipv4ll);
                 if (r < 0)
                         return r;
+
+                r = sd_ipv4ll_attach_event(link->ipv4ll, NULL, 0);
+                if (r < 0)
+                        return r;
         }
 
         if (link->sd_device &&
@@ -163,10 +167,6 @@ int ipv4ll_configure(Link *link) {
                         return r;
         }
 
-        r = sd_ipv4ll_attach_event(link->ipv4ll, NULL, 0);
-        if (r < 0)
-                return r;
-
         r = sd_ipv4ll_set_mac(link->ipv4ll, &link->mac);
         if (r < 0)
                 return r;