Skip to content

Commit c92df55

Browse files
yuwatakeszybz
authored andcommitted
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 a27588d and e49bad0. (cherry picked from commit 706cd85) (cherry picked from commit 8be1bba)
1 parent 400bb7a commit c92df55

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/network/networkd-dhcp-prefix-delegation.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,8 @@ static int dhcp_request_unreachable_route(
688688
NetworkConfigSource source,
689689
const union in_addr_union *server_address,
690690
unsigned *counter,
691-
route_netlink_handler_t callback) {
691+
route_netlink_handler_t callback,
692+
bool *configured) {
692693

693694
_cleanup_(route_freep) Route *route = NULL;
694695
Route *existing;
@@ -700,6 +701,7 @@ static int dhcp_request_unreachable_route(
700701
assert(server_address);
701702
assert(counter);
702703
assert(callback);
704+
assert(configured);
703705

704706
if (prefixlen >= 64) {
705707
log_link_debug(link, "Not adding a blocking route for DHCP delegated prefix %s since the prefix has length >= 64.",
@@ -722,7 +724,7 @@ static int dhcp_request_unreachable_route(
722724
route->lifetime_usec = lifetime_usec;
723725

724726
if (route_get(link->manager, NULL, route, &existing) < 0)
725-
link->dhcp6_configured = false;
727+
*configured = false;
726728
else
727729
route_unmark(existing);
728730

@@ -743,7 +745,8 @@ static int dhcp4_request_unreachable_route(
743745

744746
return dhcp_request_unreachable_route(link, addr, prefixlen, lifetime_usec,
745747
NETWORK_CONFIG_SOURCE_DHCP4, server_address,
746-
&link->dhcp4_messages, dhcp4_unreachable_route_handler);
748+
&link->dhcp4_messages, dhcp4_unreachable_route_handler,
749+
&link->dhcp4_configured);
747750
}
748751

749752
static int dhcp6_request_unreachable_route(
@@ -755,7 +758,8 @@ static int dhcp6_request_unreachable_route(
755758

756759
return dhcp_request_unreachable_route(link, addr, prefixlen, lifetime_usec,
757760
NETWORK_CONFIG_SOURCE_DHCP6, server_address,
758-
&link->dhcp6_messages, dhcp6_unreachable_route_handler);
761+
&link->dhcp6_messages, dhcp6_unreachable_route_handler,
762+
&link->dhcp6_configured);
759763
}
760764

761765
static int dhcp_pd_prefix_add(Link *link, const struct in6_addr *prefix, uint8_t prefixlen) {

src/network/networkd-link.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ typedef struct Link {
127127
sd_dhcp_lease *dhcp_lease;
128128
char *lease_file;
129129
unsigned dhcp4_messages;
130-
bool dhcp4_configured:1;
130+
bool dhcp4_configured;
131131
char *dhcp4_6rd_tunnel_name;
132132

133133
sd_ipv4ll *ipv4ll;

0 commit comments

Comments
 (0)