network/dhcp-pd: use correct flag when DHCPv4 6rd is enabled

Previously, Link.dhcp6_configured flag was unconditionally used even if
the route is configured based on the DHCPv4 protocol.

Follow-up for a27588d4e7 and
e49bad0179.
This commit is contained in:
Yu Watanabe
2023-11-11 03:30:34 +09:00
parent f3066d635a
commit 706cd85937
2 changed files with 9 additions and 5 deletions
@@ -665,7 +665,8 @@ static int dhcp_request_unreachable_route(
NetworkConfigSource source,
const union in_addr_union *server_address,
unsigned *counter,
route_netlink_handler_t callback) {
route_netlink_handler_t callback,
bool *configured) {
_cleanup_(route_freep) Route *route = NULL;
Route *existing;
@@ -677,6 +678,7 @@ static int dhcp_request_unreachable_route(
assert(server_address);
assert(counter);
assert(callback);
assert(configured);
if (prefixlen >= 64) {
log_link_debug(link, "Not adding a blocking route for DHCP delegated prefix %s since the prefix has length >= 64.",
@@ -699,7 +701,7 @@ static int dhcp_request_unreachable_route(
route->lifetime_usec = lifetime_usec;
if (route_get(link->manager, NULL, route, &existing) < 0)
link->dhcp6_configured = false;
*configured = false;
else
route_unmark(existing);
@@ -720,7 +722,8 @@ static int dhcp4_request_unreachable_route(
return dhcp_request_unreachable_route(link, addr, prefixlen, lifetime_usec,
NETWORK_CONFIG_SOURCE_DHCP4, server_address,
&link->dhcp4_messages, dhcp4_unreachable_route_handler);
&link->dhcp4_messages, dhcp4_unreachable_route_handler,
&link->dhcp4_configured);
}
static int dhcp6_request_unreachable_route(
@@ -732,7 +735,8 @@ static int dhcp6_request_unreachable_route(
return dhcp_request_unreachable_route(link, addr, prefixlen, lifetime_usec,
NETWORK_CONFIG_SOURCE_DHCP6, server_address,
&link->dhcp6_messages, dhcp6_unreachable_route_handler);
&link->dhcp6_messages, dhcp6_unreachable_route_handler,
&link->dhcp6_configured);
}
static int dhcp_pd_prefix_add(Link *link, const struct in6_addr *prefix, uint8_t prefixlen) {
+1 -1
View File
@@ -127,7 +127,7 @@ typedef struct Link {
sd_dhcp_lease *dhcp_lease;
char *lease_file;
unsigned dhcp4_messages;
bool dhcp4_configured:1;
bool dhcp4_configured;
char *dhcp4_6rd_tunnel_name;
Hashmap *ipv4acd_by_address;