]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/address: move post-processes on address removal to address_drop() 30631/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 22 Dec 2023 16:32:44 +0000 (01:32 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 25 Dec 2023 11:19:40 +0000 (20:19 +0900)
For consistency with other follow-up processes after address removal.

No functional change, just refactoring and preparation for later
commits.

src/network/networkd-address.c

index 629c4d697f994a292e622bbd5594fac3f654b0fb..f95a138a2e3e3ba2be2498e2dd11cfdb016f3120 100644 (file)
@@ -206,16 +206,9 @@ Address *address_free(Address *address) {
                         address->network->dhcp_server_address = NULL;
         }
 
-        if (address->link) {
+        if (address->link)
                 set_remove(address->link->addresses, address);
 
-                if (address->family == AF_INET6 &&
-                    in6_addr_equal(&address->in_addr.in6, &address->link->ipv6ll_address))
-                        memzero(&address->link->ipv6ll_address, sizeof(struct in6_addr));
-
-                ipv4acd_detach(address->link, address);
-        }
-
         config_section_free(address->section);
         free(address->label);
         free(address->netlabel);
@@ -781,6 +774,13 @@ static int address_drop(Address *address) {
 
         address_del_netlabel(address);
 
+        /* FIXME: if the IPv6LL address is dropped, stop DHCPv6, NDISC, RADV. */
+        if (address->family == AF_INET6 &&
+            in6_addr_equal(&address->in_addr.in6, &link->ipv6ll_address))
+                link->ipv6ll_address = (const struct in6_addr) {};
+
+        ipv4acd_detach(link, address);
+
         address_free(address);
 
         link_update_operstate(link, /* also_update_master = */ true);