]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: ipv4ll: reset MAC address without stopping sd-ipv4ll engine
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 20 Jun 2021 19:28:09 +0000 (04:28 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 30 Jun 2021 15:49:02 +0000 (00:49 +0900)
src/network/networkd-ipv4ll.c

index e1dbbabf8f37445d8f4ec9319bb014a59ea9d961..be6fedf90fd7ca8fdbc7a299e6234068d7e53136 100644 (file)
@@ -184,31 +184,16 @@ int ipv4ll_configure(Link *link) {
 }
 
 int ipv4ll_update_mac(Link *link) {
-        bool restart;
-        int r;
-
         assert(link);
 
+        if (link->hw_addr.length != ETH_ALEN)
+                return 0;
+        if (ether_addr_is_null(&link->hw_addr.ether))
+                return 0;
         if (!link->ipv4ll)
                 return 0;
 
-        restart = sd_ipv4ll_is_running(link->ipv4ll) > 0;
-
-        r = sd_ipv4ll_stop(link->ipv4ll);
-        if (r < 0)
-                return r;
-
-        r = sd_ipv4ll_set_mac(link->ipv4ll, &link->hw_addr.ether);
-        if (r < 0)
-                return r;
-
-        if (restart) {
-                r = sd_ipv4ll_start(link->ipv4ll);
-                if (r < 0)
-                        return r;
-        }
-
-        return 0;
+        return sd_ipv4ll_set_mac(link->ipv4ll, &link->hw_addr.ether);
 }
 
 int config_parse_ipv4ll(