network/address: move post-processes on address removal to address_drop()

For consistency with other follow-up processes after address removal.

No functional change, just refactoring and preparation for later
commits.
This commit is contained in:
Yu Watanabe
2023-12-23 01:32:44 +09:00
parent 8ae3a4f5e2
commit f089d3ebd5

View 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);