]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: dhcp-pd: rename [DHCPv6PrefixDelegation] -> [DHCPPrefixDelegation]
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 4 Dec 2021 22:29:05 +0000 (07:29 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 7 Dec 2021 11:30:30 +0000 (20:30 +0900)
This just changes the names of settings, variables, functions, files, and so on.
No functionality is changed.

Preparation for supporting 6rd.

28 files changed:
man/systemd.network.xml
src/network/networkd-address-generation.c
src/network/networkd-address-generation.h
src/network/networkd-dhcp-common.c
src/network/networkd-dhcp-prefix-delegation.c
src/network/networkd-dhcp-prefix-delegation.h
src/network/networkd-dhcp6.c
src/network/networkd-link.c
src/network/networkd-link.h
src/network/networkd-manager.c
src/network/networkd-manager.h
src/network/networkd-network-gperf.gperf
src/network/networkd-network.c
src/network/networkd-network.h
src/network/networkd-radv.c
src/network/networkd-util.c
src/network/networkd-util.h
test/fuzz/fuzz-network-parser/directives.network
test/test-network/conf/dhcp-pd-downstream-dummy97.network [moved from test/test-network/conf/dhcp6pd-downstream-dummy97.network with 79% similarity]
test/test-network/conf/dhcp-pd-downstream-dummy98.network [moved from test/test-network/conf/dhcp6pd-downstream-dummy98.network with 79% similarity]
test/test-network/conf/dhcp-pd-downstream-dummy99.network [moved from test/test-network/conf/dhcp6pd-downstream-dummy99.network with 76% similarity]
test/test-network/conf/dhcp-pd-downstream-test1.network [moved from test/test-network/conf/dhcp6pd-downstream-test1.network with 79% similarity]
test/test-network/conf/dhcp-pd-downstream-veth97-peer.network [moved from test/test-network/conf/dhcp6pd-downstream-veth97-peer.network with 100% similarity]
test/test-network/conf/dhcp-pd-downstream-veth97.network [moved from test/test-network/conf/dhcp6pd-downstream-veth97.network with 82% similarity]
test/test-network/conf/dhcp-pd-downstream-veth98-peer.network [moved from test/test-network/conf/dhcp6pd-downstream-veth98-peer.network with 100% similarity]
test/test-network/conf/dhcp-pd-downstream-veth98.network [moved from test/test-network/conf/dhcp6pd-downstream-veth98.network with 83% similarity]
test/test-network/conf/dhcp6pd-upstream.network
test/test-network/systemd-networkd-tests.py

index 68d91390cc77edb5c9ee3878fc2da988616774ce..6282e1f7f00dab57fe1e509d300ed24d82fa1612 100644 (file)
@@ -854,18 +854,18 @@ Table=1234</programlisting></para>
           <listitem><para>Whether to enable or disable Router Advertisement sending on a link. Takes a
           boolean value. When enabled, prefixes configured in [IPv6Prefix] sections and routes
           configured in [IPv6RoutePrefix] sections are distributed as defined in the [IPv6SendRA]
-          section. If <varname>DHCPv6PrefixDelegation=</varname> is enabled, then the delegated
-          prefixes are also distributed. See <varname>DHCPv6PrefixDelegation=</varname> setting and the
-          [IPv6SendRA], [IPv6Prefix], [IPv6RoutePrefix], and [DHCPv6PrefixDelegation] sections for more
+          section. If <varname>DHCPPrefixDelegation=</varname> is enabled, then the delegated prefixes
+          are also distributed. See <varname>DCHPPrefixDelegation=</varname> setting and the
+          [IPv6SendRA], [IPv6Prefix], [IPv6RoutePrefix], and [DHCPPrefixDelegation] sections for more
           configuration options.</para></listitem>
         </varlistentry>
         <varlistentry>
-          <term><varname>DHCPv6PrefixDelegation=</varname></term>
+          <term><varname>DHCPPrefixDelegation=</varname></term>
           <listitem><para>Takes a boolean value. When enabled, requests prefixes using a DHCPv6 client
           configured on another link. By default, an address within each delegated prefix will be
           assigned, and the prefixes will be announced through IPv6 Router Advertisement when
           <varname>IPv6SendRA=</varname> is enabled. Such default settings can be configured in
-          [DHCPv6PrefixDelegation] section. Defaults to disabled.</para></listitem>
+          [DHCPPrefixDelegation] section. Defaults to disabled.</para></listitem>
         </varlistentry>
         <varlistentry>
           <term><varname>IPv6MTUBytes=</varname></term>
@@ -2076,9 +2076,9 @@ Table=1234</programlisting></para>
           <listitem>
             <para>When true (the default), the client will request the DHCPv6 server to delegate
             prefixes. If the server provides prefixes to be delegated, then subnets of the prefixes are
-            assigned to the interfaces which enables <varname>DHCPv6PrefixDelegation=</varname>.
-            See also <varname>DHCPv6PrefixDelegation=</varname> in [Network] section,
-            [DHCPv6PrefixDelegation] section, and
+            assigned to the interfaces which enables <varname>DHCPPrefixDelegation=</varname>.
+            See also <varname>DHCPPrefixDelegation=</varname> in [Network] section,
+            [DHCPPrefixDelegation] section, and
             <ulink url="https://www.rfc-editor.org/rfc/rfc8415.html#section-6.3">RFC 8415</ulink>.
             </para>
           </listitem>
@@ -2102,9 +2102,9 @@ Table=1234</programlisting></para>
             <para>Allows DHCPv6 client to start without router advertisements's managed or other
             address configuration flag. Takes one of <literal>no</literal>, <literal>solicit</literal>
             or <literal>information-request</literal>. If this is not specified,
-            <literal>solicit</literal> is used when <varname>DHCPv6PrefixDelegation=</varname> is
+            <literal>solicit</literal> is used when <varname>DHCPPrefixDelegation=</varname> is
             enabled and <varname>UplinkInterface=:self</varname> is specified in the
-            [DHCPv6PrefixDelegation] section. Otherwise, defaults to <literal>no</literal>, and the
+            [DHCPPrefixDelegation] section. Otherwise, defaults to <literal>no</literal>, and the
             DHCPv6 client will be started when an RA is received. See also
             <varname>DHCPv6Client=</varname> setting in the [IPv6AcceptRA] section.</para>
           </listitem>
@@ -2113,9 +2113,9 @@ Table=1234</programlisting></para>
   </refsect1>
 
   <refsect1>
-    <title>[DHCPv6PrefixDelegation] Section Options</title>
-    <para>The [DHCPv6PrefixDelegation] section configures delegated prefixes assigned by DHCPv6 server.
-    The settings in this section are used only when <varname>DHCPv6PrefixDelegation=</varname> setting
+    <title>[DHCPPrefixDelegation] Section Options</title>
+    <para>The [DHCPPrefixDelegation] section configures delegated prefixes assigned by DHCPv6 server.
+    The settings in this section are used only when <varname>DHCPPrefixDelegation=</varname> setting
     is enabled.</para>
 
     <variablelist class='network-directives'>
@@ -2436,7 +2436,7 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
           to <literal>always</literal>, the DHCPv6 client will be started in managed mode when an RA
           is received, even if neither managed nor other information flag is set in the RA. This will
           be ignored when <varname>WithoutRA=</varname> in the [DHCPv6] section is enabled, or
-          <varname>UplinkInterface=:self</varname> in the [DHCPv6PrefixDelegation] section is
+          <varname>UplinkInterface=:self</varname> in the [DHCPPrefixDelegation] section is
           specified. Defaults to true.</para>
         </listitem>
       </varlistentry>
@@ -2710,8 +2710,8 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
         values <literal>:none</literal> and <literal>:auto</literal>. When emitting DNS servers or
         search domains is enabled but no servers are specified, the servers configured in the uplink
         interface will be emitted. When <literal>:auto</literal>, the value specified to the same
-        setting in the [DHCPv6PrefixDelegation] section will be used if
-        <varname>DHCPv6PrefixDelegation=</varname> is enabled, otherwise the link which has a default
+        setting in the [DHCPPrefixDelegation] section will be used if
+        <varname>DHCPPrefixDelegation=</varname> is enabled, otherwise the link which has a default
         gateway with the highest priority will be automatically selected. When <literal>:none</literal>,
         no uplink interface will be selected. Defaults to <literal>:auto</literal>.</para></listitem>
       </varlistentry>
@@ -4375,7 +4375,7 @@ Name=enp2s0
 
 [Network]
 IPv6SendRA=yes
-DHCPv6PrefixDelegation=yes</programlisting>
+DHCPPrefixDelegation=yes</programlisting>
 
       <para>This will enable DHCPv6-PD on the interface enp1s0 as an upstream interface where the
       DHCPv6 client is running and enp2s0 as a downstream interface where the prefix is delegated to.
index 4cf4dd590eeb7038e0b21759ec82f04ef231c311..c9c53b22cc0e98f5e1e587b00ebae74ae8ea3d9d 100644 (file)
@@ -22,7 +22,7 @@
 #define RESERVED_SUBNET_ANYCAST_ADDRESSES        ((const struct in6_addr) { .s6_addr = { 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80 } })
 #define RESERVED_SUBNET_ANYCAST_PREFIXLEN        57
 
-#define DHCP6PD_APP_ID SD_ID128_MAKE(fb,b9,37,ca,4a,ed,4a,4d,b0,70,7f,aa,71,c0,c9,85)
+#define DHCP_PD_APP_ID SD_ID128_MAKE(fb,b9,37,ca,4a,ed,4a,4d,b0,70,7f,aa,71,c0,c9,85)
 #define NDISC_APP_ID   SD_ID128_MAKE(13,ac,81,a7,d5,3f,49,78,92,79,5d,0c,29,3a,bc,7e)
 #define RADV_APP_ID    SD_ID128_MAKE(1f,1e,90,c8,5c,78,4f,dc,8e,61,2d,59,0d,53,c1,25)
 
@@ -252,8 +252,8 @@ static int generate_addresses(
         return 0;
 }
 
-int dhcp6_pd_generate_addresses(Link *link, const struct in6_addr *prefix, uint8_t prefixlen, Set **ret) {
-        return generate_addresses(link, link->network->dhcp6_pd_tokens, &DHCP6PD_APP_ID, prefix, prefixlen, ret);
+int dhcp_pd_generate_addresses(Link *link, const struct in6_addr *prefix, uint8_t prefixlen, Set **ret) {
+        return generate_addresses(link, link->network->dhcp_pd_tokens, &DHCP_PD_APP_ID, prefix, prefixlen, ret);
 }
 
 int ndisc_generate_addresses(Link *link, const struct in6_addr *prefix, uint8_t prefixlen, Set **ret) {
index d8d9d6e8f0e30918c852fa3e39e274e11b5aad81..e9c924eb978f1c33da41f27908d7fa7494a84089 100644 (file)
@@ -7,7 +7,7 @@
 
 typedef struct Link Link;
 
-int dhcp6_pd_generate_addresses(Link *link, const struct in6_addr *prefix, uint8_t prefixlen, Set **ret);
+int dhcp_pd_generate_addresses(Link *link, const struct in6_addr *prefix, uint8_t prefixlen, Set **ret);
 int ndisc_generate_addresses(Link *link, const struct in6_addr *prefix, uint8_t prefixlen, Set **ret);
 int radv_generate_addresses(Link *link, Set *tokens, const struct in6_addr *prefix, uint8_t prefixlen, Set **ret);
 
index 66d4153c84e374c8214829de0d22564872e72c3e..7996960bd12b12f3f82909bf2c19dc33be765e52 100644 (file)
@@ -1267,9 +1267,9 @@ int config_parse_uplink(
         } else if (streq(section, "IPv6SendRA")) {
                 index = &network->router_uplink_index;
                 name = &network->router_uplink_name;
-        } else if (streq(section, "DHCPv6PrefixDelegation")) {
-                index = &network->dhcp6_pd_uplink_index;
-                name = &network->dhcp6_pd_uplink_name;
+        } else if (STR_IN_SET(section, "DHCPv6PrefixDelegation", "DHCPPrefixDelegation")) {
+                index = &network->dhcp_pd_uplink_index;
+                name = &network->dhcp_pd_uplink_name;
                 accept_none = false;
         } else
                 assert_not_reached();
index ade606c1924b29ad7204750475938f39423d6221..fc0caace770321475415387db0b5b8eca0f85ade 100644 (file)
 #include "string-util.h"
 #include "strv.h"
 
-bool link_dhcp6_pd_is_enabled(Link *link) {
+bool link_dhcp_pd_is_enabled(Link *link) {
         assert(link);
 
         if (!link->network)
                 return false;
 
-        return link->network->dhcp6_pd;
+        return link->network->dhcp_pd;
 }
 
-bool dhcp6_pd_is_uplink(Link *link, Link *target, bool accept_auto) {
+bool dhcp_pd_is_uplink(Link *link, Link *target, bool accept_auto) {
         assert(link);
         assert(target);
 
-        if (!link_dhcp6_pd_is_enabled(link))
+        if (!link_dhcp_pd_is_enabled(link))
                 return false;
 
-        if (link->network->dhcp6_pd_uplink_name)
-                return streq_ptr(target->ifname, link->network->dhcp6_pd_uplink_name) ||
-                        strv_contains(target->alternative_names, link->network->dhcp6_pd_uplink_name);
+        if (link->network->dhcp_pd_uplink_name)
+                return streq_ptr(target->ifname, link->network->dhcp_pd_uplink_name) ||
+                        strv_contains(target->alternative_names, link->network->dhcp_pd_uplink_name);
 
-        if (link->network->dhcp6_pd_uplink_index > 0)
-                return target->ifindex == link->network->dhcp6_pd_uplink_index;
+        if (link->network->dhcp_pd_uplink_index > 0)
+                return target->ifindex == link->network->dhcp_pd_uplink_index;
 
-        if (link->network->dhcp6_pd_uplink_index == UPLINK_INDEX_SELF)
+        if (link->network->dhcp_pd_uplink_index == UPLINK_INDEX_SELF)
                 return link == target;
 
-        assert(link->network->dhcp6_pd_uplink_index == UPLINK_INDEX_AUTO);
+        assert(link->network->dhcp_pd_uplink_index == UPLINK_INDEX_AUTO);
         return accept_auto;
 }
 
@@ -62,21 +62,21 @@ bool dhcp6_lease_has_pd_prefix(sd_dhcp6_lease *lease) {
         return sd_dhcp6_lease_get_pd(lease, &pd_prefix, &pd_prefix_len, &lifetime_preferred_sec, &lifetime_valid_sec) >= 0;
 }
 
-static void link_remove_dhcp6_pd_prefix(Link *link, const struct in6_addr *prefix) {
+static void link_remove_dhcp_pd_subnet_prefix(Link *link, const struct in6_addr *prefix) {
         void *key;
 
         assert(link);
         assert(link->manager);
         assert(prefix);
 
-        if (hashmap_get(link->manager->links_by_dhcp6_pd_prefix, prefix) != link)
+        if (hashmap_get(link->manager->links_by_dhcp_pd_subnet_prefix, prefix) != link)
                 return;
 
-        hashmap_remove2(link->manager->links_by_dhcp6_pd_prefix, prefix, &key);
+        hashmap_remove2(link->manager->links_by_dhcp_pd_subnet_prefix, prefix, &key);
         free(key);
 }
 
-static int link_add_dhcp6_pd_prefix(Link *link, const struct in6_addr *prefix) {
+static int link_add_dhcp_pd_subnet_prefix(Link *link, const struct in6_addr *prefix) {
         _cleanup_free_ struct in6_addr *copy = NULL;
         int r;
 
@@ -87,7 +87,7 @@ static int link_add_dhcp6_pd_prefix(Link *link, const struct in6_addr *prefix) {
         if (!copy)
                 return -ENOMEM;
 
-        r = hashmap_ensure_put(&link->manager->links_by_dhcp6_pd_prefix, &in6_addr_hash_ops_free, copy, link);
+        r = hashmap_ensure_put(&link->manager->links_by_dhcp_pd_subnet_prefix, &in6_addr_hash_ops_free, copy, link);
         if (r < 0)
                 return r;
         if (r > 0)
@@ -96,13 +96,13 @@ static int link_add_dhcp6_pd_prefix(Link *link, const struct in6_addr *prefix) {
         return 0;
 }
 
-static int link_get_by_dhcp6_pd_prefix(Manager *manager, const struct in6_addr *prefix, Link **ret) {
+static int link_get_by_dhcp_pd_subnet_prefix(Manager *manager, const struct in6_addr *prefix, Link **ret) {
         Link *link;
 
         assert(manager);
         assert(prefix);
 
-        link = hashmap_get(manager->links_by_dhcp6_pd_prefix, prefix);
+        link = hashmap_get(manager->links_by_dhcp_pd_subnet_prefix, prefix);
         if (!link)
                 return -ENODEV;
 
@@ -111,18 +111,18 @@ static int link_get_by_dhcp6_pd_prefix(Manager *manager, const struct in6_addr *
         return 0;
 }
 
-static int dhcp6_pd_get_assigned_prefix(Link *link, const struct in6_addr *pd_prefix, uint8_t pd_prefix_len, struct in6_addr *ret) {
+static int dhcp_pd_get_assigned_subnet_prefix(Link *link, const struct in6_addr *pd_prefix, uint8_t pd_prefix_len, struct in6_addr *ret) {
         assert(link);
         assert(pd_prefix);
 
-        if (!link_dhcp6_pd_is_enabled(link))
+        if (!link_dhcp_pd_is_enabled(link))
                 return -ENOENT;
 
-        if (link->network->dhcp6_pd_assign) {
+        if (link->network->dhcp_pd_assign) {
                 Address *address;
 
                 SET_FOREACH(address, link->addresses) {
-                        if (address->source != NETWORK_CONFIG_SOURCE_DHCP6PD)
+                        if (address->source != NETWORK_CONFIG_SOURCE_DHCP_PD)
                                 continue;
                         assert(address->family == AF_INET6);
 
@@ -141,7 +141,7 @@ static int dhcp6_pd_get_assigned_prefix(Link *link, const struct in6_addr *pd_pr
                 Route *route;
 
                 SET_FOREACH(route, link->routes) {
-                        if (route->source != NETWORK_CONFIG_SOURCE_DHCP6PD)
+                        if (route->source != NETWORK_CONFIG_SOURCE_DHCP_PD)
                                 continue;
                         assert(route->family == AF_INET6);
 
@@ -156,23 +156,23 @@ static int dhcp6_pd_get_assigned_prefix(Link *link, const struct in6_addr *pd_pr
         return -ENOENT;
 }
 
-int dhcp6_pd_remove(Link *link, bool only_marked) {
+int dhcp_pd_remove(Link *link, bool only_marked) {
         int k, r = 0;
 
         assert(link);
         assert(link->manager);
 
-        if (!link_dhcp6_pd_is_enabled(link))
+        if (!link_dhcp_pd_is_enabled(link))
                 return 0;
 
         if (!only_marked)
-                link->dhcp6_pd_configured = false;
+                link->dhcp_pd_configured = false;
 
-        if (!link->network->dhcp6_pd_assign) {
+        if (!link->network->dhcp_pd_assign) {
                 Route *route;
 
                 SET_FOREACH(route, link->routes) {
-                        if (route->source != NETWORK_CONFIG_SOURCE_DHCP6PD)
+                        if (route->source != NETWORK_CONFIG_SOURCE_DHCP_PD)
                                 continue;
                         if (only_marked && !route_is_marked(route))
                                 continue;
@@ -180,7 +180,7 @@ int dhcp6_pd_remove(Link *link, bool only_marked) {
                         if (link->radv)
                                 (void) sd_radv_remove_prefix(link->radv, &route->dst.in6, 64);
 
-                        link_remove_dhcp6_pd_prefix(link, &route->dst.in6);
+                        link_remove_dhcp_pd_subnet_prefix(link, &route->dst.in6);
 
                         k = route_remove(route);
                         if (k < 0)
@@ -194,7 +194,7 @@ int dhcp6_pd_remove(Link *link, bool only_marked) {
                 SET_FOREACH(address, link->addresses) {
                         struct in6_addr prefix;
 
-                        if (address->source != NETWORK_CONFIG_SOURCE_DHCP6PD)
+                        if (address->source != NETWORK_CONFIG_SOURCE_DHCP_PD)
                                 continue;
                         if (only_marked && !address_is_marked(address))
                                 continue;
@@ -205,7 +205,7 @@ int dhcp6_pd_remove(Link *link, bool only_marked) {
                         if (link->radv)
                                 (void) sd_radv_remove_prefix(link->radv, &prefix, 64);
 
-                        link_remove_dhcp6_pd_prefix(link, &prefix);
+                        link_remove_dhcp_pd_subnet_prefix(link, &prefix);
 
                         k = address_remove(address);
                         if (k < 0)
@@ -218,38 +218,38 @@ int dhcp6_pd_remove(Link *link, bool only_marked) {
         return r;
 }
 
-static int dhcp6_pd_check_ready(Link *link);
+static int dhcp_pd_check_ready(Link *link);
 
-static int dhcp6_pd_address_ready_callback(Address *address) {
+static int dhcp_pd_address_ready_callback(Address *address) {
         Address *a;
 
         assert(address);
         assert(address->link);
 
         SET_FOREACH(a, address->link->addresses)
-                if (a->source == NETWORK_CONFIG_SOURCE_DHCP6PD)
+                if (a->source == NETWORK_CONFIG_SOURCE_DHCP_PD)
                         a->callback = NULL;
 
-        return dhcp6_pd_check_ready(address->link);
+        return dhcp_pd_check_ready(address->link);
 }
 
-static int dhcp6_pd_check_ready(Link *link) {
+static int dhcp_pd_check_ready(Link *link) {
         int r;
 
         assert(link);
         assert(link->network);
 
-        if (link->dhcp6_pd_messages > 0) {
-                log_link_debug(link, "%s(): DHCPv6PD addresses and routes are not set.", __func__);
+        if (link->dhcp_pd_messages > 0) {
+                log_link_debug(link, "%s(): DHCP-PD addresses and routes are not set.", __func__);
                 return 0;
         }
 
-        if (link->network->dhcp6_pd_assign) {
+        if (link->network->dhcp_pd_assign) {
                 bool has_ready = false;
                 Address *address;
 
                 SET_FOREACH(address, link->addresses) {
-                        if (address->source != NETWORK_CONFIG_SOURCE_DHCP6PD)
+                        if (address->source != NETWORK_CONFIG_SOURCE_DHCP_PD)
                                 continue;
                         if (address_is_ready(address)) {
                                 has_ready = true;
@@ -259,19 +259,19 @@ static int dhcp6_pd_check_ready(Link *link) {
 
                 if (!has_ready) {
                         SET_FOREACH(address, link->addresses)
-                                if (address->source == NETWORK_CONFIG_SOURCE_DHCP6PD)
-                                        address->callback = dhcp6_pd_address_ready_callback;
+                                if (address->source == NETWORK_CONFIG_SOURCE_DHCP_PD)
+                                        address->callback = dhcp_pd_address_ready_callback;
 
-                        log_link_debug(link, "%s(): no DHCPv6PD address is ready.", __func__);
+                        log_link_debug(link, "%s(): no DHCP-PD address is ready.", __func__);
                         return 0;
                 }
         }
 
-        link->dhcp6_pd_configured = true;
+        link->dhcp_pd_configured = true;
 
-        log_link_debug(link, "DHCPv6 PD addresses and routes set.");
+        log_link_debug(link, "DHCP-PD addresses and routes set.");
 
-        r = dhcp6_pd_remove(link, /* only_marked = */ true);
+        r = dhcp_pd_remove(link, /* only_marked = */ true);
         if (r < 0)
                 return r;
 
@@ -279,26 +279,26 @@ static int dhcp6_pd_check_ready(Link *link) {
         return 1;
 }
 
-static int dhcp6_pd_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
+static int dhcp_pd_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
         int r;
 
         assert(link);
-        assert(link->dhcp6_pd_messages > 0);
+        assert(link->dhcp_pd_messages > 0);
 
-        link->dhcp6_pd_messages--;
+        link->dhcp_pd_messages--;
 
-        r = route_configure_handler_internal(rtnl, m, link, "Failed to add DHCPv6 Prefix Delegation route");
+        r = route_configure_handler_internal(rtnl, m, link, "Failed to add prefix route for DHCP delegated subnet prefix");
         if (r <= 0)
                 return r;
 
-        r = dhcp6_pd_check_ready(link);
+        r = dhcp_pd_check_ready(link);
         if (r < 0)
                 link_enter_failed(link);
 
         return 1;
 }
 
-static int dhcp6_pd_request_route(Link *link, const struct in6_addr *prefix, uint8_t prefixlen, usec_t lifetime_usec) {
+static int dhcp_pd_request_route(Link *link, const struct in6_addr *prefix, uint8_t prefixlen, usec_t lifetime_usec) {
         _cleanup_(route_freep) Route *route = NULL;
         Route *existing;
         int r;
@@ -307,54 +307,54 @@ static int dhcp6_pd_request_route(Link *link, const struct in6_addr *prefix, uin
         assert(link->network);
         assert(prefix);
 
-        if (link->network->dhcp6_pd_assign)
+        if (link->network->dhcp_pd_assign)
                 return 0;
 
         r = route_new(&route);
         if (r < 0)
                 return r;
 
-        route->source = NETWORK_CONFIG_SOURCE_DHCP6PD;
+        route->source = NETWORK_CONFIG_SOURCE_DHCP_PD;
         route->family = AF_INET6;
         route->dst.in6 = *prefix;
         route->dst_prefixlen = prefixlen;
         route->protocol = RTPROT_DHCP;
-        route->priority = link->network->dhcp6_pd_route_metric;
+        route->priority = link->network->dhcp_pd_route_metric;
         route->lifetime_usec = lifetime_usec;
 
         if (route_get(NULL, link, route, &existing) < 0)
-                link->dhcp6_pd_configured = false;
+                link->dhcp_pd_configured = false;
         else
                 route_unmark(existing);
 
-        r = link_request_route(link, TAKE_PTR(route), true, &link->dhcp6_pd_messages,
-                               dhcp6_pd_route_handler, NULL);
+        r = link_request_route(link, TAKE_PTR(route), true, &link->dhcp_pd_messages,
+                               dhcp_pd_route_handler, NULL);
         if (r < 0)
-                return log_link_error_errno(link, r, "Failed to request DHCPv6 prefix route: %m");
+                return log_link_error_errno(link, r, "Failed to request DHCP-PD prefix route: %m");
 
         return 0;
 }
 
-static int dhcp6_pd_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
+static int dhcp_pd_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
         int r;
 
         assert(link);
-        assert(link->dhcp6_pd_messages > 0);
+        assert(link->dhcp_pd_messages > 0);
 
-        link->dhcp6_pd_messages--;
+        link->dhcp_pd_messages--;
 
-        r = address_configure_handler_internal(rtnl, m, link, "Could not set DHCPv6 delegated prefix address");
+        r = address_configure_handler_internal(rtnl, m, link, "Could not set DHCP-PD address");
         if (r <= 0)
                 return r;
 
-        r = dhcp6_pd_check_ready(link);
+        r = dhcp_pd_check_ready(link);
         if (r < 0)
                 link_enter_failed(link);
 
         return 1;
 }
 
-static void log_dhcp6_pd_address(Link *link, const Address *address) {
+static void log_dhcp_pd_address(Link *link, const Address *address) {
         _cleanup_free_ char *buffer = NULL;
         int log_level;
 
@@ -368,13 +368,13 @@ static void log_dhcp6_pd_address(Link *link, const Address *address) {
 
         (void) in6_addr_prefix_to_string(&address->in_addr.in6, address->prefixlen, &buffer);
 
-        log_link_full(link, log_level, "DHCPv6-PD address %s (valid %s, preferred %s)",
+        log_link_full(link, log_level, "DHCP-PD address %s (valid %s, preferred %s)",
                       strna(buffer),
                       FORMAT_LIFETIME(address->lifetime_valid_usec),
                       FORMAT_LIFETIME(address->lifetime_preferred_usec));
 }
 
-static int dhcp6_pd_request_address(
+static int dhcp_pd_request_address(
                 Link *link,
                 const struct in6_addr *prefix,
                 uint8_t prefixlen,
@@ -389,12 +389,12 @@ static int dhcp6_pd_request_address(
         assert(link->network);
         assert(prefix);
 
-        if (!link->network->dhcp6_pd_assign)
+        if (!link->network->dhcp_pd_assign)
                 return 0;
 
-        r = dhcp6_pd_generate_addresses(link, prefix, prefixlen, &addresses);
+        r = dhcp_pd_generate_addresses(link, prefix, prefixlen, &addresses);
         if (r < 0)
-                return log_link_warning_errno(link, r, "Failed to generate addresses for acquired DHCPv6 delegated prefix: %m");
+                return log_link_warning_errno(link, r, "Failed to generate addresses for acquired DHCP delegated prefix: %m");
 
         SET_FOREACH(a, addresses) {
                 _cleanup_(address_freep) Address *address = NULL;
@@ -402,35 +402,35 @@ static int dhcp6_pd_request_address(
 
                 r = address_new(&address);
                 if (r < 0)
-                        return log_link_error_errno(link, r, "Failed to allocate address for DHCPv6 delegated prefix: %m");
+                        return log_link_error_errno(link, r, "Failed to allocate address for DHCP delegated prefix: %m");
 
-                address->source = NETWORK_CONFIG_SOURCE_DHCP6PD;
+                address->source = NETWORK_CONFIG_SOURCE_DHCP_PD;
                 address->family = AF_INET6;
                 address->in_addr.in6 = *a;
                 address->prefixlen = prefixlen;
                 address->lifetime_preferred_usec = lifetime_preferred_usec;
                 address->lifetime_valid_usec = lifetime_valid_usec;
                 if (prefixlen == 64)
-                        SET_FLAG(address->flags, IFA_F_MANAGETEMPADDR, link->network->dhcp6_pd_manage_temporary_address);
-                address->route_metric = link->network->dhcp6_pd_route_metric;
+                        SET_FLAG(address->flags, IFA_F_MANAGETEMPADDR, link->network->dhcp_pd_manage_temporary_address);
+                address->route_metric = link->network->dhcp_pd_route_metric;
 
-                log_dhcp6_pd_address(link, address);
+                log_dhcp_pd_address(link, address);
 
                 if (address_get(link, address, &existing) < 0)
-                        link->dhcp6_pd_configured = false;
+                        link->dhcp_pd_configured = false;
                 else
                         address_unmark(existing);
 
-                r = link_request_address(link, TAKE_PTR(address), true, &link->dhcp6_pd_messages,
-                                         dhcp6_pd_address_handler, NULL);
+                r = link_request_address(link, TAKE_PTR(address), true, &link->dhcp_pd_messages,
+                                         dhcp_pd_address_handler, NULL);
                 if (r < 0)
-                        return log_link_error_errno(link, r, "Failed to request DHCPv6 delegated prefix address: %m");
+                        return log_link_error_errno(link, r, "Failed to request DHCP delegated prefix address: %m");
         }
 
         return 0;
 }
 
-static int dhcp6_pd_calculate_prefix(
+static int dhcp_pd_calculate_subnet_prefix(
                 const struct in6_addr *pd_prefix,
                 uint8_t pd_prefix_len,
                 uint64_t subnet_id,
@@ -456,7 +456,7 @@ static int dhcp6_pd_calculate_prefix(
         return 0;
 }
 
-static int dhcp6_pd_get_preferred_prefix(
+static int dhcp_pd_get_preferred_subnet_prefix(
                 Link *link,
                 const struct in6_addr *pd_prefix,
                 uint8_t pd_prefix_len,
@@ -471,16 +471,16 @@ static int dhcp6_pd_get_preferred_prefix(
         assert(link->network);
         assert(pd_prefix);
 
-        if (link->network->dhcp6_pd_subnet_id >= 0) {
+        if (link->network->dhcp_pd_subnet_id >= 0) {
                 /* If the link has a preference for a particular subnet id try to allocate that */
 
-                r = dhcp6_pd_calculate_prefix(pd_prefix, pd_prefix_len, link->network->dhcp6_pd_subnet_id, &prefix);
+                r = dhcp_pd_calculate_subnet_prefix(pd_prefix, pd_prefix_len, link->network->dhcp_pd_subnet_id, &prefix);
                 if (r < 0)
                         return log_link_warning_errno(link, r,
                                                       "subnet id %" PRIu64 " is out of range. Only have %" PRIu64 " subnets.",
-                                                      link->network->dhcp6_pd_subnet_id, UINT64_C(1) << (64 - pd_prefix_len));
+                                                      link->network->dhcp_pd_subnet_id, UINT64_C(1) << (64 - pd_prefix_len));
 
-                if (link_get_by_dhcp6_pd_prefix(link->manager, &prefix, &assigned_link) >= 0 &&
+                if (link_get_by_dhcp_pd_subnet_prefix(link->manager, &prefix, &assigned_link) >= 0 &&
                     assigned_link != link) {
                         _cleanup_free_ char *assigned_buf = NULL;
 
@@ -498,18 +498,18 @@ static int dhcp6_pd_get_preferred_prefix(
                 /* If we do not have an allocation preference just iterate
                  * through the address space and return the first free prefix. */
 
-                r = dhcp6_pd_calculate_prefix(pd_prefix, pd_prefix_len, n, &prefix);
+                r = dhcp_pd_calculate_subnet_prefix(pd_prefix, pd_prefix_len, n, &prefix);
                 if (r < 0)
                         return log_link_warning_errno(link, r,
                                                       "Couldn't find a suitable prefix. Ran out of address space.");
 
                 /* Do not use explicitly requested subnet IDs. Note that the corresponding link may not
                  * appear yet. So, we need to check the ID is not used in any .network files. */
-                if (set_contains(link->manager->dhcp6_pd_subnet_ids, &n))
+                if (set_contains(link->manager->dhcp_pd_subnet_ids, &n))
                         continue;
 
                 /* Check that the prefix is not assigned to another link. */
-                if (link_get_by_dhcp6_pd_prefix(link->manager, &prefix, &assigned_link) < 0 ||
+                if (link_get_by_dhcp_pd_subnet_prefix(link->manager, &prefix, &assigned_link) < 0 ||
                     assigned_link == link) {
                         *ret = prefix;
                         return 0;
@@ -517,7 +517,7 @@ static int dhcp6_pd_get_preferred_prefix(
         }
 }
 
-static int dhcp6_pd_assign_prefix(
+static int dhcp_pd_assign_subnet_prefix(
                 Link *link,
                 const struct in6_addr *pd_prefix,
                 uint8_t pd_prefix_len,
@@ -532,13 +532,13 @@ static int dhcp6_pd_assign_prefix(
         assert(link->network);
         assert(pd_prefix);
 
-        if (dhcp6_pd_get_assigned_prefix(link, pd_prefix, pd_prefix_len, &prefix) < 0 &&
-            dhcp6_pd_get_preferred_prefix(link, pd_prefix, pd_prefix_len, &prefix) < 0)
+        if (dhcp_pd_get_assigned_subnet_prefix(link, pd_prefix, pd_prefix_len, &prefix) < 0 &&
+            dhcp_pd_get_preferred_subnet_prefix(link, pd_prefix, pd_prefix_len, &prefix) < 0)
                 return 0;
 
         (void) in6_addr_prefix_to_string(&prefix, 64, &buf);
 
-        if (link_radv_enabled(link) && link->network->dhcp6_pd_announce) {
+        if (link_radv_enabled(link) && link->network->dhcp_pd_announce) {
                 r = radv_add_prefix(link, &prefix, 64, lifetime_preferred_usec, lifetime_valid_usec);
                 if (r < 0)
                         return log_link_warning_errno(link, r,
@@ -546,19 +546,19 @@ static int dhcp6_pd_assign_prefix(
                                                       strna(buf));
         }
 
-        r = dhcp6_pd_request_route(link, &prefix, 64, lifetime_valid_usec);
+        r = dhcp_pd_request_route(link, &prefix, 64, lifetime_valid_usec);
         if (r < 0)
                 return log_link_warning_errno(link, r,
                                               "Failed to assign/update route for prefix %s: %m",
                                               strna(buf));
 
-        r = dhcp6_pd_request_address(link, &prefix, 64, lifetime_preferred_usec, lifetime_valid_usec);
+        r = dhcp_pd_request_address(link, &prefix, 64, lifetime_preferred_usec, lifetime_valid_usec);
         if (r < 0)
                 return log_link_warning_errno(link, r,
                                               "Failed to assign/update address for prefix %s: %m",
                                               strna(buf));
 
-        r = link_add_dhcp6_pd_prefix(link, &prefix);
+        r = link_add_dhcp_pd_subnet_prefix(link, &prefix);
         if (r < 0)
                 return log_link_warning_errno(link, r,
                                               "Failed to save assigned prefix %s: %m",
@@ -568,7 +568,7 @@ static int dhcp6_pd_assign_prefix(
         return 1;
 }
 
-static int dhcp6_pd_assign_prefix_on_uplink(
+static int dhcp_pd_assign_prefix_on_uplink(
                 Link *link,
                 const struct in6_addr *pd_prefix,
                 uint8_t pd_prefix_len,
@@ -584,16 +584,16 @@ static int dhcp6_pd_assign_prefix_on_uplink(
 
         (void) in6_addr_prefix_to_string(pd_prefix, pd_prefix_len, &buf);
 
-        if (link->network->dhcp6_pd_announce)
+        if (link->network->dhcp_pd_announce)
                 log_link_debug(link, "Ignoring Announce= setting on upstream interface.");
 
-        r = dhcp6_pd_request_route(link, pd_prefix, pd_prefix_len, lifetime_valid_usec);
+        r = dhcp_pd_request_route(link, pd_prefix, pd_prefix_len, lifetime_valid_usec);
         if (r < 0)
                 return log_link_warning_errno(link, r,
                                               "Failed to assign/update route for prefix %s: %m",
                                               strna(buf));
 
-        r = dhcp6_pd_request_address(link, pd_prefix, pd_prefix_len, lifetime_preferred_usec, lifetime_valid_usec);
+        r = dhcp_pd_request_address(link, pd_prefix, pd_prefix_len, lifetime_preferred_usec, lifetime_valid_usec);
         if (r < 0)
                 return log_link_warning_errno(link, r,
                                               "Failed to assign/update address for prefix %s: %m",
@@ -603,68 +603,68 @@ static int dhcp6_pd_assign_prefix_on_uplink(
         return 1;
 }
 
-static int dhcp6_pd_prepare(Link *link) {
+static int dhcp_pd_prepare(Link *link) {
         if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
                 return 0;
 
-        if (!link_dhcp6_pd_is_enabled(link))
+        if (!link_dhcp_pd_is_enabled(link))
                 return 0;
 
-        if (link_radv_enabled(link) && link->network->dhcp6_pd_announce && !link->radv)
+        if (link_radv_enabled(link) && link->network->dhcp_pd_announce && !link->radv)
                 return 0;
 
-        link_mark_addresses(link, NETWORK_CONFIG_SOURCE_DHCP6PD, NULL);
-        link_mark_routes(link, NETWORK_CONFIG_SOURCE_DHCP6PD, NULL);
+        link_mark_addresses(link, NETWORK_CONFIG_SOURCE_DHCP_PD, NULL);
+        link_mark_routes(link, NETWORK_CONFIG_SOURCE_DHCP_PD, NULL);
 
         return 1;
 }
 
-static int dhcp6_pd_finalize(Link *link) {
+static int dhcp_pd_finalize(Link *link) {
         int r;
 
         if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
                 return 0;
 
-        if (link->dhcp6_pd_messages == 0) {
-                link->dhcp6_pd_configured = false;
+        if (link->dhcp_pd_messages == 0) {
+                link->dhcp_pd_configured = false;
 
-                r = dhcp6_pd_remove(link, /* only_marked = */ true);
+                r = dhcp_pd_remove(link, /* only_marked = */ true);
                 if (r < 0)
                         return r;
         }
 
-        if (!link->dhcp6_pd_configured)
+        if (!link->dhcp_pd_configured)
                 link_set_state(link, LINK_STATE_CONFIGURING);
 
         link_check_ready(link);
         return 0;
 }
 
-void dhcp6_pd_prefix_lost(Link *dhcp6_link) {
+void dhcp_pd_prefix_lost(Link *uplink) {
         Route *route;
         Link *link;
         int r;
 
-        assert(dhcp6_link);
-        assert(dhcp6_link->manager);
+        assert(uplink);
+        assert(uplink->manager);
 
-        HASHMAP_FOREACH(link, dhcp6_link->manager->links_by_index) {
-                if (!dhcp6_pd_is_uplink(link, dhcp6_link, /* accept_auto = */ true))
+        HASHMAP_FOREACH(link, uplink->manager->links_by_index) {
+                if (!dhcp_pd_is_uplink(link, uplink, /* accept_auto = */ true))
                         continue;
 
-                r = dhcp6_pd_remove(link, /* only_marked = */ false);
+                r = dhcp_pd_remove(link, /* only_marked = */ false);
                 if (r < 0)
                         link_enter_failed(link);
         }
 
-        SET_FOREACH(route, dhcp6_link->manager->routes) {
-                if (route->source != NETWORK_CONFIG_SOURCE_DHCP6)
+        SET_FOREACH(route, uplink->manager->routes) {
+                if (IN_SET(route->source, NETWORK_CONFIG_SOURCE_DHCP4, NETWORK_CONFIG_SOURCE_DHCP6))
                         continue;
                 if (route->family != AF_INET6)
                         continue;
                 if (route->type != RTN_UNREACHABLE)
                         continue;
-                if (!set_contains(dhcp6_link->dhcp6_pd_prefixes,
+                if (!set_contains(uplink->dhcp_pd_prefixes,
                                   &(struct in_addr_prefix) {
                                           .family = AF_INET6,
                                           .prefixlen = route->dst_prefixlen,
@@ -673,13 +673,13 @@ void dhcp6_pd_prefix_lost(Link *dhcp6_link) {
 
                 (void) route_remove(route);
 
-                route_cancel_request(route, dhcp6_link);
+                route_cancel_request(route, uplink);
         }
 
-        set_clear(dhcp6_link->dhcp6_pd_prefixes);
+        set_clear(uplink->dhcp_pd_prefixes);
 }
 
-static int dhcp6_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
+static int dhcp6_unreachable_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
         int r;
 
         assert(link);
@@ -687,7 +687,7 @@ static int dhcp6_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *li
 
         link->dhcp6_messages--;
 
-        r = route_configure_handler_internal(rtnl, m, link, "Failed to set unreachable route for DHCPv6 delegated subnet");
+        r = route_configure_handler_internal(rtnl, m, link, "Failed to set unreachable route for DHCP delegated prefix");
         if (r <= 0)
                 return r;
 
@@ -698,12 +698,15 @@ static int dhcp6_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *li
         return 1;
 }
 
-static int dhcp6_request_unreachable_route(
+static int dhcp_request_unreachable_route(
                 Link *link,
                 const struct in6_addr *addr,
                 uint8_t prefixlen,
                 usec_t lifetime_usec,
-                const union in_addr_union *server_address) {
+                NetworkConfigSource source,
+                const union in_addr_union *server_address,
+                unsigned *counter,
+                link_netlink_message_handler_t callback) {
 
         _cleanup_(route_freep) Route *route = NULL;
         Route *existing;
@@ -711,13 +714,16 @@ static int dhcp6_request_unreachable_route(
 
         assert(link);
         assert(addr);
+        assert(IN_SET(source, NETWORK_CONFIG_SOURCE_DHCP4, NETWORK_CONFIG_SOURCE_DHCP6));
         assert(server_address);
+        assert(counter);
+        assert(callback);
 
         if (prefixlen >= 64) {
                 _cleanup_free_ char *buf = NULL;
 
                 (void) in6_addr_prefix_to_string(addr, prefixlen, &buf);
-                log_link_debug(link, "Not adding a blocking route for DHCPv6 delegated prefix %s since the prefix has length >= 64.",
+                log_link_debug(link, "Not adding a blocking route for DHCP delegated prefix %s since the prefix has length >= 64.",
                                strna(buf));
                 return 0;
         }
@@ -726,7 +732,7 @@ static int dhcp6_request_unreachable_route(
         if (r < 0)
                 return log_oom();
 
-        route->source = NETWORK_CONFIG_SOURCE_DHCP6;
+        route->source = source;
         route->provider = *server_address;
         route->family = AF_INET6;
         route->dst.in6 = *addr;
@@ -741,20 +747,31 @@ static int dhcp6_request_unreachable_route(
         else
                 route_unmark(existing);
 
-        r = link_request_route(link, TAKE_PTR(route), true, &link->dhcp6_messages,
-                               dhcp6_route_handler, NULL);
+        r = link_request_route(link, TAKE_PTR(route), true, counter, callback, NULL);
         if (r < 0) {
                 _cleanup_free_ char *buf = NULL;
 
                 (void) in6_addr_prefix_to_string(addr, prefixlen, &buf);
-                return log_link_error_errno(link, r, "Failed to request unreachable route for DHCPv6 delegated subnet %s: %m",
+                return log_link_error_errno(link, r, "Failed to request unreachable route for DHCP delegated prefix %s: %m",
                                             strna(buf));
         }
 
         return 0;
 }
 
-static int dhcp6_pd_prefix_add(Link *link, const struct in6_addr *prefix, uint8_t prefixlen) {
+static int dhcp6_request_unreachable_route(
+                Link *link,
+                const struct in6_addr *addr,
+                uint8_t prefixlen,
+                usec_t lifetime_usec,
+                const union in_addr_union *server_address) {
+
+        return dhcp_request_unreachable_route(link, addr, prefixlen, lifetime_usec,
+                                              NETWORK_CONFIG_SOURCE_DHCP6, server_address,
+                                              &link->dhcp6_messages, dhcp6_unreachable_route_handler);
+}
+
+static int dhcp_pd_prefix_add(Link *link, const struct in6_addr *prefix, uint8_t prefixlen) {
         _cleanup_free_ char *buf = NULL;
         struct in_addr_prefix *p;
         int r;
@@ -775,22 +792,22 @@ static int dhcp6_pd_prefix_add(Link *link, const struct in6_addr *prefix, uint8_
         (void) in6_addr_prefix_to_string(prefix, prefixlen, &buf);
 
         log_link_full(link,
-                      set_contains(link->dhcp6_pd_prefixes, p) ? LOG_DEBUG :
+                      set_contains(link->dhcp_pd_prefixes, p) ? LOG_DEBUG :
                       prefixlen > 64 || prefixlen < 48 ? LOG_WARNING : LOG_INFO,
-                      "DHCPv6: received PD Prefix %s%s",
+                      "DHCP: received PD Prefix %s%s",
                       strna(buf),
                       prefixlen > 64 ? " with prefix length > 64, ignoring." :
                       prefixlen < 48 ? " with prefix length < 48, looks unusual.": "");
 
         /* Store PD prefix even if prefixlen > 64, not to make logged at warning level so frequently. */
-        r = set_ensure_consume(&link->dhcp6_pd_prefixes, &in_addr_prefix_hash_ops_free, p);
+        r = set_ensure_consume(&link->dhcp_pd_prefixes, &in_addr_prefix_hash_ops_free, p);
         if (r < 0)
-                return log_link_error_errno(link, r, "Failed to store DHCPv6 PD prefix %s: %m", strna(buf));
+                return log_link_error_errno(link, r, "Failed to store DHCP PD prefix %s: %m", strna(buf));
 
         return 0;
 }
 
-static int dhcp6_pd_assign_prefixes(Link *link, Link *uplink) {
+static int dhcp6_pd_assign_subnet_prefixes(Link *link, Link *uplink) {
         usec_t timestamp_usec;
         int r;
 
@@ -798,7 +815,7 @@ static int dhcp6_pd_assign_prefixes(Link *link, Link *uplink) {
         assert(uplink);
         assert(uplink->dhcp6_lease);
 
-        r = dhcp6_pd_prepare(link);
+        r = dhcp_pd_prepare(link);
         if (r <= 0)
                 return r;
 
@@ -829,41 +846,41 @@ static int dhcp6_pd_assign_prefixes(Link *link, Link *uplink) {
                 lifetime_valid_usec = usec_add(lifetime_valid_sec * USEC_PER_SEC, timestamp_usec);
 
                 if (link == uplink)
-                        r = dhcp6_pd_assign_prefix_on_uplink(link, &pd_prefix, pd_prefix_len, lifetime_preferred_usec, lifetime_valid_usec);
+                        r = dhcp_pd_assign_prefix_on_uplink(link, &pd_prefix, pd_prefix_len, lifetime_preferred_usec, lifetime_valid_usec);
                 else
-                        r = dhcp6_pd_assign_prefix(link, &pd_prefix, pd_prefix_len, lifetime_preferred_usec, lifetime_valid_usec);
+                        r = dhcp_pd_assign_subnet_prefix(link, &pd_prefix, pd_prefix_len, lifetime_preferred_usec, lifetime_valid_usec);
                 if (r < 0)
                         return r;
         }
 
-        return dhcp6_pd_finalize(link);
+        return dhcp_pd_finalize(link);
 }
 
-int dhcp6_pd_prefix_acquired(Link *dhcp6_link) {
+int dhcp6_pd_prefix_acquired(Link *uplink) {
         union in_addr_union server_address;
         usec_t timestamp_usec;
         Link *link;
         int r;
 
-        assert(dhcp6_link);
-        assert(dhcp6_link->dhcp6_lease);
+        assert(uplink);
+        assert(uplink->dhcp6_lease);
 
-        r = sd_dhcp6_lease_get_server_address(dhcp6_link->dhcp6_lease, &server_address.in6);
+        r = sd_dhcp6_lease_get_server_address(uplink->dhcp6_lease, &server_address.in6);
         if (r < 0)
-                return log_link_warning_errno(dhcp6_link, r, "Failed to get server address of DHCPv6 lease: %m");
+                return log_link_warning_errno(uplink, r, "Failed to get server address of DHCPv6 lease: %m");
 
-        r = sd_dhcp6_lease_get_timestamp(dhcp6_link->dhcp6_lease, clock_boottime_or_monotonic(), &timestamp_usec);
+        r = sd_dhcp6_lease_get_timestamp(uplink->dhcp6_lease, clock_boottime_or_monotonic(), &timestamp_usec);
         if (r < 0)
-                return log_link_warning_errno(dhcp6_link, r, "Failed to get timestamp of DHCPv6 lease: %m");
+                return log_link_warning_errno(uplink, r, "Failed to get timestamp of DHCPv6 lease: %m");
 
         /* First, logs acquired prefixes and request unreachable routes. */
-        for (sd_dhcp6_lease_reset_pd_prefix_iter(dhcp6_link->dhcp6_lease);;) {
+        for (sd_dhcp6_lease_reset_pd_prefix_iter(uplink->dhcp6_lease);;) {
                 uint32_t lifetime_preferred_sec, lifetime_valid_sec;
                 usec_t lifetime_valid_usec;
                 struct in6_addr pd_prefix;
                 uint8_t pd_prefix_len;
 
-                r = sd_dhcp6_lease_get_pd(dhcp6_link->dhcp6_lease, &pd_prefix, &pd_prefix_len,
+                r = sd_dhcp6_lease_get_pd(uplink->dhcp6_lease, &pd_prefix, &pd_prefix_len,
                                           &lifetime_preferred_sec, &lifetime_valid_sec);
                 if (r < 0)
                         break;
@@ -871,31 +888,31 @@ int dhcp6_pd_prefix_acquired(Link *dhcp6_link) {
                 /* Mask prefix for safety. */
                 r = in6_addr_mask(&pd_prefix, pd_prefix_len);
                 if (r < 0)
-                        return log_link_error_errno(dhcp6_link, r, "Failed to mask DHCPv6 PD prefix: %m");
+                        return log_link_error_errno(uplink, r, "Failed to mask DHCPv6 PD prefix: %m");
 
                 lifetime_valid_usec = usec_add(lifetime_valid_sec * USEC_PER_SEC, timestamp_usec);
 
-                r = dhcp6_pd_prefix_add(dhcp6_link, &pd_prefix, pd_prefix_len);
+                r = dhcp_pd_prefix_add(uplink, &pd_prefix, pd_prefix_len);
                 if (r < 0)
                         return r;
 
-                r = dhcp6_request_unreachable_route(dhcp6_link, &pd_prefix, pd_prefix_len, lifetime_valid_usec, &server_address);
+                r = dhcp6_request_unreachable_route(uplink, &pd_prefix, pd_prefix_len, lifetime_valid_usec, &server_address);
                 if (r < 0)
                         return r;
         }
 
         /* Then, assign subnet prefixes. */
-        HASHMAP_FOREACH(link, dhcp6_link->manager->links_by_index) {
-                if (!dhcp6_pd_is_uplink(link, dhcp6_link, /* accept_auto = */ true))
+        HASHMAP_FOREACH(link, uplink->manager->links_by_index) {
+                if (!dhcp_pd_is_uplink(link, uplink, /* accept_auto = */ true))
                         continue;
 
-                r = dhcp6_pd_assign_prefixes(link, dhcp6_link);
+                r = dhcp6_pd_assign_subnet_prefixes(link, uplink);
                 if (r < 0) {
-                        /* When failed on the upstream interface (i.e., the case link == dhcp6_link),
+                        /* When failed on the upstream interface (i.e., the case link == uplink),
                          * immediately abort the assignment of the prefixes. As, the all assigned
                          * prefixes will be dropped soon in link_enter_failed(), and it is meaningless
                          * to continue the assignment. */
-                        if (link == dhcp6_link)
+                        if (link == uplink)
                                 return r;
 
                         link_enter_failed(link);
@@ -929,20 +946,20 @@ static bool dhcp6_pd_uplink_is_ready(Link *link) {
         return dhcp6_lease_has_pd_prefix(link->dhcp6_lease);
 }
 
-int dhcp6_pd_find_uplink(Link *link, Link **ret) {
+int dhcp_pd_find_uplink(Link *link, Link **ret) {
         Link *uplink = NULL;
         int r = 0;
 
         assert(link);
         assert(link->manager);
-        assert(link_dhcp6_pd_is_enabled(link));
+        assert(link_dhcp_pd_is_enabled(link));
         assert(ret);
 
-        if (link->network->dhcp6_pd_uplink_name)
-                r = link_get_by_name(link->manager, link->network->dhcp6_pd_uplink_name, &uplink);
-        else if (link->network->dhcp6_pd_uplink_index > 0)
-                r = link_get_by_index(link->manager, link->network->dhcp6_pd_uplink_index, &uplink);
-        else if (link->network->dhcp6_pd_uplink_index == UPLINK_INDEX_SELF)
+        if (link->network->dhcp_pd_uplink_name)
+                r = link_get_by_name(link->manager, link->network->dhcp_pd_uplink_name, &uplink);
+        else if (link->network->dhcp_pd_uplink_index > 0)
+                r = link_get_by_index(link->manager, link->network->dhcp_pd_uplink_index, &uplink);
+        else if (link->network->dhcp_pd_uplink_index == UPLINK_INDEX_SELF)
                 uplink = link;
         if (r < 0)
                 return r;
@@ -967,22 +984,22 @@ int dhcp6_pd_find_uplink(Link *link, Link **ret) {
         return -ENODEV;
 }
 
-int dhcp6_request_prefix_delegation(Link *link) {
+int dhcp_request_prefix_delegation(Link *link) {
         Link *uplink;
 
         assert(link);
 
-        if (!link_dhcp6_pd_is_enabled(link))
+        if (!link_dhcp_pd_is_enabled(link))
                 return 0;
 
-        if (dhcp6_pd_find_uplink(link, &uplink) < 0)
+        if (dhcp_pd_find_uplink(link, &uplink) < 0)
                 return 0;
 
         log_link_debug(link, "Requesting subnets of delegated prefixes acquired by %s", uplink->ifname);
-        return dhcp6_pd_assign_prefixes(link, uplink);
+        return dhcp6_pd_assign_subnet_prefixes(link, uplink);
 }
 
-int config_parse_dhcp6_pd_subnet_id(
+int config_parse_dhcp_pd_subnet_id(
                 const char *unit,
                 const char *filename,
                 unsigned line,
index aeb21d68c6af0b60fb9fc1dd4305318b4322e6b5..1157f723c2efab58d573ac43e4caa50e455c3bb5 100644 (file)
@@ -3,17 +3,19 @@
 
 #include <stdbool.h>
 
+#include "sd-dhcp6-lease.h"
+
 #include "conf-parser.h"
 
 typedef struct Link Link;
 
-bool link_dhcp6_pd_is_enabled(Link *link);
-bool dhcp6_pd_is_uplink(Link *link, Link *target, bool accept_auto);
-int dhcp6_pd_find_uplink(Link *link, Link **ret);
+bool link_dhcp_pd_is_enabled(Link *link);
+bool dhcp_pd_is_uplink(Link *link, Link *target, bool accept_auto);
+int dhcp_pd_find_uplink(Link *link, Link **ret);
 bool dhcp6_lease_has_pd_prefix(sd_dhcp6_lease *lease);
-int dhcp6_pd_remove(Link *link, bool only_marked);
-int dhcp6_request_prefix_delegation(Link *link);
-int dhcp6_pd_prefix_acquired(Link *dhcp6_link);
-void dhcp6_pd_prefix_lost(Link *dhcp6_link);
+int dhcp_pd_remove(Link *link, bool only_marked);
+int dhcp_request_prefix_delegation(Link *link);
+int dhcp6_pd_prefix_acquired(Link *uplink);
+void dhcp_pd_prefix_lost(Link *uplink);
 
-CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_pd_subnet_id);
+CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_pd_subnet_id);
index b9831e7fa1272a721b5f315ec3526096b3130a90..9e9036699331c116810da010f1567bf1a5cd80ac 100644 (file)
@@ -36,7 +36,7 @@ static DHCP6ClientStartMode link_get_dhcp6_client_start_mode(Link *link) {
                 return link->network->dhcp6_client_start_mode;
 
         /* When this interface itself is an uplink interface, then start dhcp6 client in managed mode. */
-        if (dhcp6_pd_is_uplink(link, link, /* accept_auto = */ false))
+        if (dhcp_pd_is_uplink(link, link, /* accept_auto = */ false))
                 return DHCP6_CLIENT_START_MODE_SOLICIT;
 
         /* Otherwise, start dhcp6 client when RA is received. */
@@ -323,7 +323,7 @@ static int dhcp6_lease_ip_acquired(sd_dhcp6_client *client, Link *link) {
                         return r;
         } else if (dhcp6_lease_has_pd_prefix(lease_old))
                 /* When we had PD prefixes but not now, we need to remove them. */
-                dhcp6_pd_prefix_lost(link);
+                dhcp_pd_prefix_lost(link);
 
         if (link->dhcp6_messages == 0) {
                 link->dhcp6_configured = true;
@@ -354,7 +354,7 @@ static int dhcp6_lease_lost(Link *link) {
         log_link_info(link, "DHCPv6 lease lost");
 
         if (dhcp6_lease_has_pd_prefix(link->dhcp6_lease))
-                dhcp6_pd_prefix_lost(link);
+                dhcp_pd_prefix_lost(link);
 
         link->dhcp6_lease = sd_dhcp6_lease_unref(link->dhcp6_lease);
 
index c2b632ba5bd99cd66e5772981b3ac7ddfa396c7e..67b4579165b0a8b92d780b1fcbf8eef18e895246 100644 (file)
@@ -235,7 +235,7 @@ static Link *link_free(Link *link) {
 
         link->addresses = set_free(link->addresses);
 
-        link->dhcp6_pd_prefixes = set_free(link->dhcp6_pd_prefixes);
+        link->dhcp_pd_prefixes = set_free(link->dhcp_pd_prefixes);
 
         link_free_engines(link);
 
@@ -381,7 +381,7 @@ int link_stop_engines(Link *link, bool may_keep_dhcp) {
         if (k < 0)
                 r = log_link_warning_errno(link, k, "Could not stop DHCPv6 client: %m");
 
-        k = dhcp6_pd_remove(link, /* only_marked = */ false);
+        k = dhcp_pd_remove(link, /* only_marked = */ false);
         if (k < 0)
                 r = log_link_warning_errno(link, k, "Could not remove DHCPv6 PD addresses and routes: %m");
 
@@ -495,7 +495,7 @@ void link_check_ready(Link *link) {
                            NETWORK_CONFIG_SOURCE_IPV4LL,
                            NETWORK_CONFIG_SOURCE_DHCP4,
                            NETWORK_CONFIG_SOURCE_DHCP6,
-                           NETWORK_CONFIG_SOURCE_DHCP6PD,
+                           NETWORK_CONFIG_SOURCE_DHCP_PD,
                            NETWORK_CONFIG_SOURCE_NDISC)) {
                         has_dynamic_address = true;
                         break;
@@ -503,26 +503,26 @@ void link_check_ready(Link *link) {
         }
 
         if ((link_ipv4ll_enabled(link) || link_dhcp4_enabled(link) || link_dhcp6_with_address_enabled(link) ||
-             (link_dhcp6_pd_is_enabled(link) && link->network->dhcp6_pd_assign)) && !has_dynamic_address)
+             (link_dhcp_pd_is_enabled(link) && link->network->dhcp_pd_assign)) && !has_dynamic_address)
                 /* When DHCP[46] or IPv4LL is enabled, at least one address is acquired by them. */
-                return (void) log_link_debug(link, "%s(): DHCPv4, DHCPv6, DHCPv6PD or IPv4LL is enabled but no dynamic address is assigned yet.", __func__);
+                return (void) log_link_debug(link, "%s(): DHCPv4, DHCPv6, DHCP-PD or IPv4LL is enabled but no dynamic address is assigned yet.", __func__);
 
         /* Ignore NDisc when ConfigureWithoutCarrier= is enabled, as IPv6AcceptRA= is enabled by default. */
         if (link_ipv4ll_enabled(link) || link_dhcp4_enabled(link) ||
-            link_dhcp6_enabled(link) || link_dhcp6_pd_is_enabled(link) ||
+            link_dhcp6_enabled(link) || link_dhcp_pd_is_enabled(link) ||
             (!link->network->configure_without_carrier && link_ipv6_accept_ra_enabled(link))) {
 
                 if (!link->ipv4ll_address_configured && !link->dhcp4_configured &&
-                    !link->dhcp6_configured && !link->dhcp6_pd_configured && !link->ndisc_configured)
+                    !link->dhcp6_configured && !link->dhcp_pd_configured && !link->ndisc_configured)
                         /* When DHCP[46], NDisc, or IPv4LL is enabled, at least one protocol must be finished. */
                         return (void) log_link_debug(link, "%s(): dynamic addresses or routes are not configured.", __func__);
 
-                log_link_debug(link, "%s(): IPv4LL:%s DHCPv4:%s DHCPv6:%s DHCPv6PD:%s NDisc:%s",
+                log_link_debug(link, "%s(): IPv4LL:%s DHCPv4:%s DHCPv6:%s DHCP-PD:%s NDisc:%s",
                                __func__,
                                yes_no(link->ipv4ll_address_configured),
                                yes_no(link->dhcp4_configured),
                                yes_no(link->dhcp6_configured),
-                               yes_no(link->dhcp6_pd_configured),
+                               yes_no(link->dhcp_pd_configured),
                                yes_no(link->ndisc_configured));
         }
 
@@ -669,14 +669,14 @@ static int link_acquire_dynamic_conf(Link *link) {
                         return r;
         }
 
-        if (!link_radv_enabled(link) || !link->network->dhcp6_pd_announce) {
+        if (!link_radv_enabled(link) || !link->network->dhcp_pd_announce) {
                 /* DHCPv6PD downstream does not require IPv6LL address. But may require RADV to be
                  * configured, and RADV may not be configured yet here. Only acquire subnet prefix when
                  * RADV is disabled, or the announcement of the prefix is disabled. Otherwise, the
                  * below will be called in radv_start(). */
-                r = dhcp6_request_prefix_delegation(link);
+                r = dhcp_request_prefix_delegation(link);
                 if (r < 0)
-                        return log_link_warning_errno(link, r, "Failed to request DHCPv6 prefix delegation: %m");
+                        return log_link_warning_errno(link, r, "Failed to request DHCP delegated subnet prefix: %m");
         }
 
         if (link->lldp_tx) {
index 4f746db110738ea98fe7f880a436716affc724b9..8190f4f8bb7be389adb0a24eda0ee8348920d6c7 100644 (file)
@@ -146,11 +146,12 @@ typedef struct Link {
 
         sd_dhcp6_client *dhcp6_client;
         sd_dhcp6_lease *dhcp6_lease;
-        Set *dhcp6_pd_prefixes;
         unsigned dhcp6_messages;
-        unsigned dhcp6_pd_messages;
-        bool dhcp6_configured:1;
-        bool dhcp6_pd_configured:1;
+        bool dhcp6_configured;
+
+        Set *dhcp_pd_prefixes;
+        unsigned dhcp_pd_messages;
+        bool dhcp_pd_configured;
 
         /* This is about LLDP reception */
         sd_lldp_rx *lldp_rx;
index a122e0880020b4096adb00e4af62eb1403a5fe8e..7e89366ae8a65d8ef9d4434fe70cce89608686f4 100644 (file)
@@ -499,10 +499,10 @@ Manager* manager_free(Manager *m) {
         m->dirty_links = set_free_with_destructor(m->dirty_links, link_unref);
         m->links_by_name = hashmap_free(m->links_by_name);
         m->links_by_hw_addr = hashmap_free(m->links_by_hw_addr);
-        m->links_by_dhcp6_pd_prefix = hashmap_free(m->links_by_dhcp6_pd_prefix);
+        m->links_by_dhcp_pd_subnet_prefix = hashmap_free(m->links_by_dhcp_pd_subnet_prefix);
         m->links_by_index = hashmap_free_with_destructor(m->links_by_index, link_unref);
 
-        m->dhcp6_pd_subnet_ids = set_free(m->dhcp6_pd_subnet_ids);
+        m->dhcp_pd_subnet_ids = set_free(m->dhcp_pd_subnet_ids);
         m->networks = ordered_hashmap_free_with_destructor(m->networks, network_unref);
 
         m->netdevs = hashmap_free_with_destructor(m->netdevs, netdev_unref);
@@ -586,7 +586,7 @@ int manager_load_config(Manager *m) {
         if (r < 0)
                 return r;
 
-        return manager_build_dhcp6_pd_subnet_ids(m);
+        return manager_build_dhcp_pd_subnet_ids(m);
 }
 
 bool manager_should_reload(Manager *m) {
index ae9d5adf1b5f64b6a18efaa2c61db6a802ba1340..36313589a3766afa689d846d4e05ce92c777c2b9 100644 (file)
@@ -48,11 +48,11 @@ struct Manager {
         Hashmap *links_by_index;
         Hashmap *links_by_name;
         Hashmap *links_by_hw_addr;
-        Hashmap *links_by_dhcp6_pd_prefix;
+        Hashmap *links_by_dhcp_pd_subnet_prefix;
         Hashmap *netdevs;
         OrderedHashmap *networks;
         OrderedSet *address_pools;
-        Set *dhcp6_pd_subnet_ids;
+        Set *dhcp_pd_subnet_ids;
 
         usec_t network_dirs_ts_usec;
 
index 8de72911aa707e7a4976ebb5c358f738d590cebe..bdc67842097f5ded956308633e9db682dca7f776 100644 (file)
@@ -140,7 +140,7 @@ Network.ConfigureWithoutCarrier,             config_parse_bool,
 Network.IgnoreCarrierLoss,                   config_parse_ignore_carrier_loss,                         0,                             0
 Network.KeepConfiguration,                   config_parse_keep_configuration,                          0,                             offsetof(Network, keep_configuration)
 Network.IPv6SendRA,                          config_parse_router_prefix_delegation,                    0,                             offsetof(Network, router_prefix_delegation)
-Network.DHCPv6PrefixDelegation,              config_parse_tristate,                                    0,                             offsetof(Network, dhcp6_pd)
+Network.DHCPPrefixDelegation,                config_parse_tristate,                                    0,                             offsetof(Network, dhcp_pd)
 Address.Address,                             config_parse_address,                                     0,                             0
 Address.Peer,                                config_parse_address,                                     0,                             0
 Address.Broadcast,                           config_parse_broadcast,                                   0,                             0
@@ -329,13 +329,13 @@ BridgeMDB.VLANId,                            config_parse_mdb_vlan_id,
 BridgeVLAN.PVID,                             config_parse_brvlan_pvid,                                 0,                             0
 BridgeVLAN.VLAN,                             config_parse_brvlan_vlan,                                 0,                             0
 BridgeVLAN.EgressUntagged,                   config_parse_brvlan_untagged,                             0,                             0
-DHCPv6PrefixDelegation.UplinkInterface,      config_parse_uplink,                                      0,                             0
-DHCPv6PrefixDelegation.SubnetId,             config_parse_dhcp6_pd_subnet_id,                          0,                             offsetof(Network, dhcp6_pd_subnet_id)
-DHCPv6PrefixDelegation.Announce,             config_parse_bool,                                        0,                             offsetof(Network, dhcp6_pd_announce)
-DHCPv6PrefixDelegation.Assign,               config_parse_bool,                                        0,                             offsetof(Network, dhcp6_pd_assign)
-DHCPv6PrefixDelegation.ManageTemporaryAddress, config_parse_bool,                                      0,                             offsetof(Network, dhcp6_pd_manage_temporary_address)
-DHCPv6PrefixDelegation.Token,                config_parse_address_generation_type,                     0,                             offsetof(Network, dhcp6_pd_tokens)
-DHCPv6PrefixDelegation.RouteMetric,          config_parse_uint32,                                      0,                             offsetof(Network, dhcp6_pd_route_metric)
+DHCPPrefixDelegation.UplinkInterface,        config_parse_uplink,                                      0,                             0
+DHCPPrefixDelegation.SubnetId,               config_parse_dhcp_pd_subnet_id,                           0,                             offsetof(Network, dhcp_pd_subnet_id)
+DHCPPrefixDelegation.Announce,               config_parse_bool,                                        0,                             offsetof(Network, dhcp_pd_announce)
+DHCPPrefixDelegation.Assign,                 config_parse_bool,                                        0,                             offsetof(Network, dhcp_pd_assign)
+DHCPPrefixDelegation.ManageTemporaryAddress, config_parse_bool,                                        0,                             offsetof(Network, dhcp_pd_manage_temporary_address)
+DHCPPrefixDelegation.Token,                  config_parse_address_generation_type,                     0,                             offsetof(Network, dhcp_pd_tokens)
+DHCPPrefixDelegation.RouteMetric,            config_parse_uint32,                                      0,                             offsetof(Network, dhcp_pd_route_metric)
 IPv6SendRA.RouterLifetimeSec,                config_parse_router_lifetime,                             0,                             offsetof(Network, router_lifetime_usec)
 IPv6SendRA.Managed,                          config_parse_bool,                                        0,                             offsetof(Network, router_managed)
 IPv6SendRA.OtherInformation,                 config_parse_bool,                                        0,                             offsetof(Network, router_other_information)
@@ -513,6 +513,7 @@ TrivialLinkEqualizer.Id,                     config_parse_trivial_link_equalizer
 Network.IPv4LL,                              config_parse_ipv4ll,                                      0,                             offsetof(Network, link_local)
 Network.IPv6Token,                           config_parse_address_generation_type,                     0,                             offsetof(Network, ndisc_tokens)
 Network.IPv6PrefixDelegation,                config_parse_router_prefix_delegation,                    0,                             offsetof(Network, router_prefix_delegation)
+Network.DHCPv6PrefixDelegation,              config_parse_tristate,                                    0,                             offsetof(Network, dhcp_pd)
 IPv6PrefixDelegation.RouterLifetimeSec,      config_parse_sec,                                         0,                             offsetof(Network, router_lifetime_usec)
 IPv6PrefixDelegation.Managed,                config_parse_bool,                                        0,                             offsetof(Network, router_managed)
 IPv6PrefixDelegation.OtherInformation,       config_parse_bool,                                        0,                             offsetof(Network, router_other_information)
@@ -552,6 +553,12 @@ DHCPv4.CriticalConnection,                   config_parse_tristate,
 DHCPv6.RouteMetric,                          config_parse_dhcp_or_ra_route_metric,                     AF_INET6,                      0
 DHCPv6.RapidCommit,                          config_parse_warn_compat,                                 DISABLED_LEGACY,               0
 DHCPv6.ForceDHCPv6PDOtherInformation,        config_parse_warn_compat,                                 DISABLED_LEGACY,               0
+DHCPv6PrefixDelegation.SubnetId,             config_parse_dhcp_pd_subnet_id,                           0,                             offsetof(Network, dhcp_pd_subnet_id)
+DHCPv6PrefixDelegation.Announce,             config_parse_bool,                                        0,                             offsetof(Network, dhcp_pd_announce)
+DHCPv6PrefixDelegation.Assign,               config_parse_bool,                                        0,                             offsetof(Network, dhcp_pd_assign)
+DHCPv6PrefixDelegation.ManageTemporaryAddress, config_parse_bool,                                      0,                             offsetof(Network, dhcp_pd_manage_temporary_address)
+DHCPv6PrefixDelegation.Token,                config_parse_address_generation_type,                     0,                             offsetof(Network, dhcp_pd_tokens)
+DHCPv6PrefixDelegation.RouteMetric,          config_parse_uint32,                                      0,                             offsetof(Network, dhcp_pd_route_metric)
 IPv6AcceptRA.DenyList,                       config_parse_in_addr_prefixes,                            AF_INET6,                      offsetof(Network, ndisc_deny_listed_prefix)
 IPv6AcceptRA.BlackList,                      config_parse_in_addr_prefixes,                            AF_INET6,                      offsetof(Network, ndisc_deny_listed_prefix)
 TrafficControlQueueingDiscipline.Parent,                        config_parse_qdisc_parent,             _QDISC_KIND_INVALID,           0
index a659f00f64f879f5a8663a50a13dd6f90e962a2a..873ad2e70341a3fc5f47656b7ac5341ab1f58a43 100644 (file)
@@ -412,12 +412,12 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
                 .dhcp6_duid.type = _DUID_TYPE_INVALID,
                 .dhcp6_client_start_mode = _DHCP6_CLIENT_START_MODE_INVALID,
 
-                .dhcp6_pd = -1,
-                .dhcp6_pd_announce = true,
-                .dhcp6_pd_assign = true,
-                .dhcp6_pd_manage_temporary_address = true,
-                .dhcp6_pd_subnet_id = -1,
-                .dhcp6_pd_route_metric = DHCP6PD_ROUTE_METRIC,
+                .dhcp_pd = -1,
+                .dhcp_pd_announce = true,
+                .dhcp_pd_assign = true,
+                .dhcp_pd_manage_temporary_address = true,
+                .dhcp_pd_subnet_id = -1,
+                .dhcp_pd_route_metric = DHCP6PD_ROUTE_METRIC,
 
                 .dhcp_server_bind_to_interface = true,
                 .dhcp_server_emit[SD_DHCP_LEASE_DNS].emit = true,
@@ -498,7 +498,8 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
                         "DHCP\0" /* compat */
                         "DHCPv4\0"
                         "DHCPv6\0"
-                        "DHCPv6PrefixDelegation\0"
+                        "DHCPv6PrefixDelegation\0" /* compat */
+                        "DHCPPrefixDelegation\0"
                         "DHCPServer\0"
                         "DHCPServerStaticLease\0"
                         "IPv6AcceptRA\0"
@@ -648,7 +649,7 @@ int network_reload(Manager *manager) {
         ordered_hashmap_free_with_destructor(manager->networks, network_unref);
         manager->networks = new_networks;
 
-        return manager_build_dhcp6_pd_subnet_ids(manager);
+        return manager_build_dhcp_pd_subnet_ids(manager);
 
 failure:
         ordered_hashmap_free_with_destructor(new_networks, network_unref);
@@ -656,25 +657,25 @@ failure:
         return r;
 }
 
-int manager_build_dhcp6_pd_subnet_ids(Manager *manager) {
+int manager_build_dhcp_pd_subnet_ids(Manager *manager) {
         Network *n;
         int r;
 
         assert(manager);
 
-        set_clear(manager->dhcp6_pd_subnet_ids);
+        set_clear(manager->dhcp_pd_subnet_ids);
 
         ORDERED_HASHMAP_FOREACH(n, manager->networks) {
                 if (n->unmanaged)
                         continue;
 
-                if (!n->dhcp6_pd)
+                if (!n->dhcp_pd)
                         continue;
 
-                if (n->dhcp6_pd_subnet_id < 0)
+                if (n->dhcp_pd_subnet_id < 0)
                         continue;
 
-                r = set_ensure_put(&manager->dhcp6_pd_subnet_ids, &uint64_hash_ops, &n->dhcp6_pd_subnet_id);
+                r = set_ensure_put(&manager->dhcp_pd_subnet_ids, &uint64_hash_ops, &n->dhcp_pd_subnet_id);
                 if (r < 0)
                         return r;
         }
@@ -756,7 +757,7 @@ static Network *network_free(Network *network) {
         free(network->dhcp_server_timezone);
         free(network->dhcp_server_uplink_name);
         free(network->router_uplink_name);
-        free(network->dhcp6_pd_uplink_name);
+        free(network->dhcp_pd_uplink_name);
 
         for (sd_dhcp_lease_server_type_t t = 0; t < _SD_DHCP_LEASE_SERVER_TYPE_MAX; t++)
                 free(network->dhcp_server_emit[t].addresses);
@@ -771,7 +772,7 @@ static Network *network_free(Network *network) {
         ordered_hashmap_free(network->dhcp_server_send_vendor_options);
         ordered_hashmap_free(network->dhcp6_client_send_options);
         ordered_hashmap_free(network->dhcp6_client_send_vendor_options);
-        set_free(network->dhcp6_pd_tokens);
+        set_free(network->dhcp_pd_tokens);
         set_free(network->ndisc_tokens);
 
         return mfree(network);
index 295b2dbefae01616c2c7270eba229ba23b5cb0cc..863ea24cecdbbf7c938a508ea276d09e83aef995 100644 (file)
@@ -229,16 +229,16 @@ struct Network {
         int router_uplink_index;
         char *router_uplink_name;
 
-        /* DHCPv6 Prefix Delegation support */
-        int dhcp6_pd;
-        bool dhcp6_pd_announce;
-        bool dhcp6_pd_assign;
-        bool dhcp6_pd_manage_temporary_address;
-        int64_t dhcp6_pd_subnet_id;
-        uint32_t dhcp6_pd_route_metric;
-        Set *dhcp6_pd_tokens;
-        int dhcp6_pd_uplink_index;
-        char *dhcp6_pd_uplink_name;
+        /* DHCP Prefix Delegation support */
+        int dhcp_pd;
+        bool dhcp_pd_announce;
+        bool dhcp_pd_assign;
+        bool dhcp_pd_manage_temporary_address;
+        int64_t dhcp_pd_subnet_id;
+        uint32_t dhcp_pd_route_metric;
+        Set *dhcp_pd_tokens;
+        int dhcp_pd_uplink_index;
+        char *dhcp_pd_uplink_name;
 
         /* Bridge Support */
         int use_bpdu;
@@ -366,7 +366,7 @@ int network_reload(Manager *manager);
 int network_load_one(Manager *manager, OrderedHashmap **networks, const char *filename);
 int network_verify(Network *network);
 
-int manager_build_dhcp6_pd_subnet_ids(Manager *manager);
+int manager_build_dhcp_pd_subnet_ids(Manager *manager);
 
 int network_get_by_name(Manager *manager, const char *name, Network **ret);
 void network_apply_anonymize_if_set(Network *network);
index 558bc1ac01bf80fb787d741442899e3dd20983be..6fabd8f5c554c60be70caa4759711af169c24201 100644 (file)
@@ -27,9 +27,9 @@ void network_adjust_radv(Network *network) {
 
         /* After this function is called, network->router_prefix_delegation can be treated as a boolean. */
 
-        if (network->dhcp6_pd < 0)
+        if (network->dhcp_pd < 0)
                 /* For backward compatibility. */
-                network->dhcp6_pd = FLAGS_SET(network->router_prefix_delegation, RADV_PREFIX_DELEGATION_DHCP6);
+                network->dhcp_pd = FLAGS_SET(network->router_prefix_delegation, RADV_PREFIX_DELEGATION_DHCP6);
 
         if (!FLAGS_SET(network->link_local, ADDRESS_FAMILY_IPV6)) {
                 if (network->router_prefix_delegation != RADV_PREFIX_DELEGATION_NONE)
@@ -421,8 +421,8 @@ static int radv_find_uplink(Link *link, Link **ret) {
                 return link_get_by_index(link->manager, link->network->router_uplink_index, ret);
 
         if (link->network->router_uplink_index == UPLINK_INDEX_AUTO) {
-                if (link_dhcp6_pd_is_enabled(link))
-                        r = dhcp6_pd_find_uplink(link, ret); /* When DHCPv6PD is enabled, use its uplink. */
+                if (link_dhcp_pd_is_enabled(link))
+                        r = dhcp_pd_find_uplink(link, ret); /* When DHCP-PD is enabled, use its uplink. */
                 else
                         r = manager_find_uplink(link->manager, AF_INET6, link, ret);
                 if (r < 0)
@@ -642,10 +642,10 @@ int radv_start(Link *link) {
         if (sd_radv_is_running(link->radv))
                 return 0;
 
-        if (link->network->dhcp6_pd_announce) {
-                r = dhcp6_request_prefix_delegation(link);
+        if (link->network->dhcp_pd_announce) {
+                r = dhcp_request_prefix_delegation(link);
                 if (r < 0)
-                        return log_link_debug_errno(link, r, "Failed to request DHCPv6 prefix delegation: %m");
+                        return log_link_debug_errno(link, r, "Failed to request DHCP delegated subnet prefix: %m");
         }
 
         log_link_debug(link, "Starting IPv6 Router Advertisements");
index a3adde5ca4cdeebb892fe3c16f6a1825b2f3b2a6..ac6f1680ca4b1fecd5de9ccf43878e1cb32b2537 100644 (file)
@@ -17,7 +17,7 @@ static const char * const network_config_source_table[_NETWORK_CONFIG_SOURCE_MAX
         [NETWORK_CONFIG_SOURCE_IPV4LL]  = "IPv4LL",
         [NETWORK_CONFIG_SOURCE_DHCP4]   = "DHCPv4",
         [NETWORK_CONFIG_SOURCE_DHCP6]   = "DHCPv6",
-        [NETWORK_CONFIG_SOURCE_DHCP6PD] = "DHCPv6-PD",
+        [NETWORK_CONFIG_SOURCE_DHCP_PD] = "DHCP-PD",
         [NETWORK_CONFIG_SOURCE_NDISC]   = "NDisc",
         [NETWORK_CONFIG_SOURCE_RUNTIME] = "runtime",
 };
index ba03ddcc5564e536d572bd9650e0021dd8ead149..d94243855e712515321cdcdd6faa4290ae62212e 100644 (file)
@@ -25,7 +25,7 @@ typedef enum NetworkConfigSource {
         NETWORK_CONFIG_SOURCE_IPV4LL,
         NETWORK_CONFIG_SOURCE_DHCP4,
         NETWORK_CONFIG_SOURCE_DHCP6,
-        NETWORK_CONFIG_SOURCE_DHCP6PD,
+        NETWORK_CONFIG_SOURCE_DHCP_PD,
         NETWORK_CONFIG_SOURCE_NDISC,
         NETWORK_CONFIG_SOURCE_RUNTIME, /* through D-Bus method */
         _NETWORK_CONFIG_SOURCE_MAX,
index 9889fbfad49190b1d99aca0e41be075b1cd5e7a4..ca9000cdee814d4963c9af6d1fbda188e654efe9 100644 (file)
@@ -150,6 +150,13 @@ IAID=
 DUIDType=
 DUIDRawData=
 [DHCPv6PrefixDelegation]
+SubnetId=
+Announce=
+Assign=
+ManageTemporaryAddress=
+Token=
+RouteMetric=
+[DHCPPrefixDelegation]
 UplinkInterface=
 SubnetId=
 Announce=
@@ -240,6 +247,7 @@ VRF=
 IgnoreCarrierLoss=
 KeepConfiguration=
 DHCPv6PrefixDelegation=
+DHCPPrefixDelegation=
 BatmanAdvanced=
 IPoIB=
 [IPv6Prefix]
similarity index 79%
rename from test/test-network/conf/dhcp6pd-downstream-dummy97.network
rename to test/test-network/conf/dhcp-pd-downstream-dummy97.network
index b53bc3cc4d1d3dcb412c1765ad3042e294c944f6..e3e41a07e8d43b7f8b1913fc8197e337727988db 100644 (file)
@@ -6,9 +6,9 @@ Name=dummy97
 IPv6PrivacyExtensions=yes
 IPv6AcceptRA=no
 DHCP=no
-DHCPv6PrefixDelegation=yes
+DHCPPrefixDelegation=yes
 
-[DHCPv6PrefixDelegation]
+[DHCPPrefixDelegation]
 UplinkInterface=veth99
 SubnetId=1
 Announce=no
similarity index 79%
rename from test/test-network/conf/dhcp6pd-downstream-dummy98.network
rename to test/test-network/conf/dhcp-pd-downstream-dummy98.network
index ea66d49a2fa260439c797bc15c261ca56a03ee89..31090682fe910bd746c322abacc8958de30ac5f7 100644 (file)
@@ -6,9 +6,9 @@ Name=dummy98
 IPv6PrivacyExtensions=yes
 IPv6AcceptRA=no
 DHCP=no
-DHCPv6PrefixDelegation=yes
+DHCPPrefixDelegation=yes
 
-[DHCPv6PrefixDelegation]
+[DHCPPrefixDelegation]
 UplinkInterface=veth99
 SubnetId=2
 Announce=no
similarity index 76%
rename from test/test-network/conf/dhcp6pd-downstream-dummy99.network
rename to test/test-network/conf/dhcp-pd-downstream-dummy99.network
index ad56f262622363686892bac3b890014380bb4c22..01c1d559aa3bfa9f2d6d6d336eaf9432805951e8 100644 (file)
@@ -6,9 +6,9 @@ Name=dummy99
 IPv6PrivacyExtensions=yes
 IPv6AcceptRA=no
 DHCP=no
-DHCPv6PrefixDelegation=yes
+DHCPPrefixDelegation=yes
 
-[DHCPv6PrefixDelegation]
+[DHCPPrefixDelegation]
 UplinkInterface=veth99
 Assign=no
 Announce=no
similarity index 79%
rename from test/test-network/conf/dhcp6pd-downstream-test1.network
rename to test/test-network/conf/dhcp-pd-downstream-test1.network
index 78ddc72e2d9de1f660b8d53a51d65929e613beda..a8720c3d182933187eca5adee9d30d7390076edf 100644 (file)
@@ -6,9 +6,9 @@ Name=test1
 IPv6PrivacyExtensions=yes
 IPv6AcceptRA=no
 DHCP=no
-DHCPv6PrefixDelegation=yes
+DHCPPrefixDelegation=yes
 
-[DHCPv6PrefixDelegation]
+[DHCPPrefixDelegation]
 UplinkInterface=veth99
 SubnetId=0
 Announce=no
similarity index 82%
rename from test/test-network/conf/dhcp6pd-downstream-veth97.network
rename to test/test-network/conf/dhcp-pd-downstream-veth97.network
index 5c41ea9837595363852b4e319d16592463fd2252..daf1e9dbbdf1007964da5c2900e9496432f51492 100644 (file)
@@ -6,10 +6,10 @@ Name=veth97
 IPv6PrivacyExtensions=yes
 IPv6AcceptRA=no
 DHCP=no
-DHCPv6PrefixDelegation=yes
+DHCPPrefixDelegation=yes
 IPv6SendRA=yes
 
-[DHCPv6PrefixDelegation]
+[DHCPPrefixDelegation]
 SubnetId=8
 Announce=yes
 Token=eui64
similarity index 83%
rename from test/test-network/conf/dhcp6pd-downstream-veth98.network
rename to test/test-network/conf/dhcp-pd-downstream-veth98.network
index a977099389a253aaa884a2d5cdfbfaa8a9b97f8c..ef3770004148dc1b61e0d7271a300b972647d2f2 100644 (file)
@@ -6,10 +6,10 @@ Name=veth98
 IPv6PrivacyExtensions=yes
 IPv6AcceptRA=no
 DHCP=no
-DHCPv6PrefixDelegation=yes
+DHCPPrefixDelegation=yes
 IPv6SendRA=yes
 
-[DHCPv6PrefixDelegation]
+[DHCPPrefixDelegation]
 UplinkInterface=veth99
 SubnetId=9
 Announce=yes
index dd26f2ae5fc6d564a6b9c90d1a05b4162639ee0c..4b8cd7d3244fe8d9a69e3260198be72e0997cb39 100644 (file)
@@ -6,12 +6,12 @@ Name=veth99
 IPv6PrivacyExtensions=yes
 IPv6AcceptRA=no
 DHCP=ipv6
-DHCPv6PrefixDelegation=yes
+DHCPPrefixDelegation=yes
 
 [DHCPv6]
 WithoutRA=solicit
 
-[DHCPv6PrefixDelegation]
+[DHCPPrefixDelegation]
 UplinkInterface=:self
 SubnetId=10
 Announce=no
index f9af5f14d30ac18070f76ed101d0fe49ae82f1a5..f6c91ea96959c99cd25262bb5de022efa0b9b33d 100755 (executable)
@@ -4994,7 +4994,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
         print(output)
         self.assertRegex(output, 'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global dynamic veth99')
 
-class NetworkdDHCP6PDTests(unittest.TestCase, Utilities):
+class NetworkdDHCPPDTests(unittest.TestCase, Utilities):
     links = [
         'dummy97',
         'dummy98',
@@ -5012,14 +5012,14 @@ class NetworkdDHCP6PDTests(unittest.TestCase, Utilities):
         '25-veth.netdev',
         '25-veth-downstream-veth97.netdev',
         '25-veth-downstream-veth98.netdev',
-        'dhcp6pd-downstream-dummy97.network',
-        'dhcp6pd-downstream-dummy98.network',
-        'dhcp6pd-downstream-dummy99.network',
-        'dhcp6pd-downstream-test1.network',
-        'dhcp6pd-downstream-veth97.network',
-        'dhcp6pd-downstream-veth97-peer.network',
-        'dhcp6pd-downstream-veth98.network',
-        'dhcp6pd-downstream-veth98-peer.network',
+        'dhcp-pd-downstream-dummy97.network',
+        'dhcp-pd-downstream-dummy98.network',
+        'dhcp-pd-downstream-dummy99.network',
+        'dhcp-pd-downstream-test1.network',
+        'dhcp-pd-downstream-veth97.network',
+        'dhcp-pd-downstream-veth97-peer.network',
+        'dhcp-pd-downstream-veth98.network',
+        'dhcp-pd-downstream-veth98-peer.network',
         'dhcp6pd-server.network',
         'dhcp6pd-upstream.network',
     ]
@@ -5037,12 +5037,12 @@ class NetworkdDHCP6PDTests(unittest.TestCase, Utilities):
 
     def test_dhcp6pd(self):
         copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp6pd-server.network', 'dhcp6pd-upstream.network',
-                                        '25-veth-downstream-veth97.netdev', 'dhcp6pd-downstream-veth97.network', 'dhcp6pd-downstream-veth97-peer.network',
-                                        '25-veth-downstream-veth98.netdev', 'dhcp6pd-downstream-veth98.network', 'dhcp6pd-downstream-veth98-peer.network',
-                                        '11-dummy.netdev', 'dhcp6pd-downstream-test1.network',
-                                        'dhcp6pd-downstream-dummy97.network',
-                                        '12-dummy.netdev', 'dhcp6pd-downstream-dummy98.network',
-                                        '13-dummy.netdev', 'dhcp6pd-downstream-dummy99.network')
+                                        '25-veth-downstream-veth97.netdev', 'dhcp-pd-downstream-veth97.network', 'dhcp-pd-downstream-veth97-peer.network',
+                                        '25-veth-downstream-veth98.netdev', 'dhcp-pd-downstream-veth98.network', 'dhcp-pd-downstream-veth98-peer.network',
+                                        '11-dummy.netdev', 'dhcp-pd-downstream-test1.network',
+                                        'dhcp-pd-downstream-dummy97.network',
+                                        '12-dummy.netdev', 'dhcp-pd-downstream-dummy98.network',
+                                        '13-dummy.netdev', 'dhcp-pd-downstream-dummy99.network')
 
         start_networkd()
         self.wait_online(['veth-peer:routable'])