]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/dhcp-pd: use correct flag when DHCPv4 6rd is enabled
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 Nov 2023 17:39:33 +0000 (02:39 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 Nov 2023 18:30:34 +0000 (03:30 +0900)
Previously, Link.dhcp6_configured flag was unconditionally used even if
the route is configured based on the DHCPv4 protocol.

Follow-up for a27588d4e7f780243a1828e2af56562f9d779412 and
e49bad0179cb670edeac12ef062887af0ac4c8c5.

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

index 56bbc4acc54570bafb28f9fdbb41848272d99b04..af2fe9efcd760cf36cb401c7b713616c7f2fb4dd 100644 (file)
@@ -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) {
index 8bbbc4ec85ce82fb380a2a5a9f53ed261c8f3838..938bbf482eca8292ca95e524d27680f7b47a93a2 100644 (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;