1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

Merge pull request #30631 from yuwata/network-address-free

network/address: tiny cleanups for address_free()
This commit is contained in:
Luca Boccassi 2023-12-26 19:21:15 +01:00 committed by GitHub
commit 74ce6bbdee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,18 +201,14 @@ Address *address_free(Address *address) {
if (address->network) {
assert(address->section);
ordered_hashmap_remove(address->network->addresses_by_section, address->section);
if (address->network->dhcp_server_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);
@ -778,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);