network: set broadcast address on request

Previously, the broadcast address was set to a Address object in
address_section_verify() (or address_acquire()). But, for wireguard
interfaces, we do not use the broadcast address. The .network file may
be assigned to multiple interfaces, hence, we cannot determine if we
should set the broadcast address in address_section_verify().

This makes the broadcast address set in link_request_address().
Then, we set the broadcast address only when we need it.
This commit is contained in:
Yu Watanabe
2022-02-24 07:07:04 +09:00
parent 5d0030310c
commit e680486d6f
4 changed files with 37 additions and 33 deletions
+1 -1
View File
@@ -106,7 +106,7 @@ int link_request_dhcp_server_address(Link *link) {
address->family = AF_INET;
address->in_addr.in = link->network->dhcp_server_address;
address->prefixlen = link->network->dhcp_server_address_prefixlen;
address_set_broadcast(address);
address_set_broadcast(address, link);
if (address_get(link, address, &existing) >= 0 &&
address_exists(existing) &&