diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index 0b0c751e91..77986192d4 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -809,16 +809,6 @@
false. See the [IPv6PrefixDelegation] and the [IPv6Prefix] sections for more
configuration options.
-
- IPv6PDSubnetId=
- Configure a specific subnet ID on the interface from a (previously) received prefix delegation.
- You can either set "auto" (the default) or a specific subnet ID
- (as defined in RFC 4291, section 2.5.4),
- in which case the allowed value is hexadecimal, from 0 to 0x7fffffffffffffff inclusive.
- This option is only effective when used together with IPv6PrefixDelegation=
- and the corresponding configuration on the upstream interface.
-
-
IPv6MTUBytes=
Configures IPv6 maximum transmission unit (MTU).
@@ -1893,25 +1883,6 @@
-
- AssignAcquiredDelegatedPrefixAddress=
-
- Takes a boolean. Specifies whether to add an address from the delegated prefixes which are received
- from the WAN interface by the IPv6PrefixDelegation=. When true (on LAN interfce), the EUI-64
- algorithm will be used to form an interface identifier from the delegated prefixes. Defaults to true.
-
-
-
-
- AssignAcquiredDelegatedPrefixToken=
-
- Specifies an optional address generation mode for AssignAcquiredDelegatedPrefixAddress=.
- Takes an IPv6 address. When set, the lower bits of the supplied address are combined with the upper bits of a
- delegatad prefix received from the WAN interface by the IPv6PrefixDelegation= prefixes to
- form a complete address.
-
-
-
PrefixDelegationHint=
@@ -1966,6 +1937,48 @@
+
+ [DHCPv6PrefixDelegation] Section Options
+ The [DHCPv6PrefixDelegation] section configures delegated prefix assigned by DHCPv6 server.
+ The settings in this section are used only when IPv6PrefixDelegation= setting is
+ enabled, or set to dhcp6.
+
+
+
+ SubnetId=
+
+ Configure a specific subnet ID on the interface from a (previously) received prefix
+ delegation. You can either set "auto" (the default) or a specific subnet ID (as defined in
+ RFC 4291, section
+ 2.5.4), in which case the allowed value is hexadecimal, from 0 to 0x7fffffffffffffff
+ inclusive. This option is only effective when used together with
+ IPv6PrefixDelegation= and the corresponding configuration on the upstream
+ interface.
+
+
+
+
+ Assign=
+
+ Takes a boolean. Specifies whether to add an address from the delegated prefixes which
+ are received from the WAN interface by the IPv6PrefixDelegation=. When
+ true (on LAN interfce), the EUI-64 algorithm will be used to form an interface identifier
+ from the delegated prefixes. Defaults to true.
+
+
+
+
+ Token=
+
+ Specifies an optional address generation mode for Assign=. Takes an
+ IPv6 address. When set, the lower bits of the supplied address are combined with the upper
+ bits of a delegatad prefix received from the WAN interface by the
+ IPv6PrefixDelegation= prefixes to form a complete address.
+
+
+
+
+
[IPv6AcceptRA] Section Options
The [IPv6AcceptRA] section configures the IPv6 Router Advertisement (RA) client, if it is enabled
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index e87d9d1e7c..d671284b00 100644
--- a/src/network/networkd-dhcp6.c
+++ b/src/network/networkd-dhcp6.c
@@ -367,7 +367,7 @@ static int dhcp6_set_pd_address(Link *link,
assert(link->network);
assert(prefix);
- if (!link->network->dhcp6_pd_assign_prefix)
+ if (!link->network->dhcp6_pd_assign)
return 0;
r = address_new(&address);
@@ -376,8 +376,8 @@ static int dhcp6_set_pd_address(Link *link,
address->in_addr = *prefix;
- if (!in_addr_is_null(AF_INET6, &link->network->dhcp6_delegation_prefix_token))
- memcpy(address->in_addr.in6.s6_addr + 8, link->network->dhcp6_delegation_prefix_token.in6.s6_addr + 8, 8);
+ if (!in_addr_is_null(AF_INET6, &link->network->dhcp6_pd_token))
+ memcpy(address->in_addr.in6.s6_addr + 8, link->network->dhcp6_pd_token.in6.s6_addr + 8, 8);
else {
r = generate_ipv6_eui_64_address(link, &address->in_addr.in6);
if (r < 0)
@@ -437,7 +437,7 @@ static bool link_has_preferred_subnet_id(Link *link) {
if (!link->network)
return false;
- return link->network->router_prefix_subnet_id >= 0;
+ return link->network->dhcp6_pd_subnet_id >= 0;
}
static int dhcp6_get_preferred_delegated_prefix(
@@ -461,7 +461,7 @@ static int dhcp6_get_preferred_delegated_prefix(
prefix = *masked_pd_prefix;
if (link_has_preferred_subnet_id(link)) {
- uint64_t subnet_id = link->network->router_prefix_subnet_id;
+ uint64_t subnet_id = link->network->dhcp6_pd_subnet_id;
/* If the link has a preference for a particular subnet id try to allocate that */
if (subnet_id >= n_prefixes)
@@ -1556,7 +1556,18 @@ int config_parse_dhcp6_mud_url(
return free_and_replace(network->dhcp6_mudurl, unescaped);
}
-int config_parse_dhcp6_delegated_prefix_token(
+DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp6_client_start_mode, dhcp6_client_start_mode, DHCP6ClientStartMode,
+ "Failed to parse WithoutRA= setting");
+
+static const char* const dhcp6_client_start_mode_table[_DHCP6_CLIENT_START_MODE_MAX] = {
+ [DHCP6_CLIENT_START_MODE_NO] = "no",
+ [DHCP6_CLIENT_START_MODE_INFORMATION_REQUEST] = "information-request",
+ [DHCP6_CLIENT_START_MODE_SOLICIT] = "solicit",
+};
+
+DEFINE_STRING_TABLE_LOOKUP(dhcp6_client_start_mode, DHCP6ClientStartMode);
+
+int config_parse_dhcp6_pd_subnet_id(
const char *unit,
const char *filename,
unsigned line,
@@ -1568,7 +1579,52 @@ int config_parse_dhcp6_delegated_prefix_token(
void *data,
void *userdata) {
- Network *network = data;
+ int64_t *p = data;
+ uint64_t t;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ if (isempty(rvalue) || streq(rvalue, "auto")) {
+ *p = -1;
+ return 0;
+ }
+
+ r = safe_atoux64(rvalue, &t);
+ if (r < 0) {
+ log_syntax(unit, LOG_WARNING, filename, line, r,
+ "Failed to parse %s=, ignoring assignment: %s",
+ lvalue, rvalue);
+ return 0;
+ }
+ if (t > INT64_MAX) {
+ log_syntax(unit, LOG_WARNING, filename, line, 0,
+ "Invalid subnet id '%s', ignoring assignment.",
+ rvalue);
+ return 0;
+ }
+
+ *p = (int64_t) t;
+
+ return 0;
+}
+
+int config_parse_dhcp6_pd_token(
+ const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ union in_addr_union *addr = data, tmp;
int r;
assert(filename);
@@ -1577,33 +1633,24 @@ int config_parse_dhcp6_delegated_prefix_token(
assert(data);
if (isempty(rvalue)) {
- network->dhcp6_delegation_prefix_token = IN_ADDR_NULL;
+ *addr = IN_ADDR_NULL;
return 0;
}
- r = in_addr_from_string(AF_INET6, rvalue, &network->dhcp6_delegation_prefix_token);
+ r = in_addr_from_string(AF_INET6, rvalue, &tmp);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
- "Failed to parse DHCPv6 %s, ignoring: %s", lvalue, rvalue);
+ "Failed to parse DHCPv6 Prefix Delegation token, ignoring: %s", rvalue);
return 0;
}
- if (in_addr_is_null(AF_INET6, &network->dhcp6_delegation_prefix_token)) {
+ if (in_addr_is_null(AF_INET6, &tmp)) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
- "DHCPv6 %s cannot be the ANY address, ignoring: %s", lvalue, rvalue);
+ "DHCPv6 Prefix Delegation token cannot be the ANY address, ignoring: %s", rvalue);
return 0;
}
+ *addr = tmp;
+
return 0;
}
-
-DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp6_client_start_mode, dhcp6_client_start_mode, DHCP6ClientStartMode,
- "Failed to parse WithoutRA= setting");
-
-static const char* const dhcp6_client_start_mode_table[_DHCP6_CLIENT_START_MODE_MAX] = {
- [DHCP6_CLIENT_START_MODE_NO] = "no",
- [DHCP6_CLIENT_START_MODE_INFORMATION_REQUEST] = "information-request",
- [DHCP6_CLIENT_START_MODE_SOLICIT] = "solicit",
-};
-
-DEFINE_STRING_TABLE_LOOKUP(dhcp6_client_start_mode, DHCP6ClientStartMode);
diff --git a/src/network/networkd-dhcp6.h b/src/network/networkd-dhcp6.h
index fa44a2eb52..214456096d 100644
--- a/src/network/networkd-dhcp6.h
+++ b/src/network/networkd-dhcp6.h
@@ -34,8 +34,9 @@ int dhcp6_request_prefix_delegation(Link *link);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_pd_hint);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_mud_url);
-CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_delegated_prefix_token);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_client_start_mode);
+CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_pd_subnet_id);
+CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_pd_token);
const char* dhcp6_client_start_mode_to_string(DHCP6ClientStartMode i) _const_;
DHCP6ClientStartMode dhcp6_client_start_mode_from_string(const char *s) _pure_;
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index f3c578cbb4..3f1652b190 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -213,8 +213,6 @@ DHCPv6.UserClass, config_parse_dhcp_user_class,
DHCPv6.VendorClass, config_parse_dhcp_vendor_class, 0, offsetof(Network, dhcp6_vendor_class)
DHCPv6.SendVendorOption, config_parse_dhcp_send_option, AF_INET6, offsetof(Network, dhcp6_client_send_vendor_options)
DHCPv6.ForceDHCPv6PDOtherInformation, config_parse_bool, 0, offsetof(Network, dhcp6_force_pd_other_information)
-DHCPv6.AssignAcquiredDelegatedPrefixAddress, config_parse_bool, 0, offsetof(Network, dhcp6_pd_assign_prefix)
-DHCPv6.AssignAcquiredDelegatedPrefixToken, config_parse_dhcp6_delegated_prefix_token, 0, 0
DHCPv6.PrefixDelegationHint, config_parse_dhcp6_pd_hint, 0, 0
DHCPv6.WithoutRA, config_parse_dhcp6_client_start_mode, 0, offsetof(Network, dhcp6_without_ra)
DHCPv6.SendOption, config_parse_dhcp_send_option, AF_INET6, offsetof(Network, dhcp6_client_send_options)
@@ -271,7 +269,9 @@ BridgeVLAN.PVID, config_parse_brvlan_pvid,
BridgeVLAN.VLAN, config_parse_brvlan_vlan, 0, 0
BridgeVLAN.EgressUntagged, config_parse_brvlan_untagged, 0, 0
Network.IPv6PrefixDelegation, config_parse_router_prefix_delegation, 0, offsetof(Network, router_prefix_delegation)
-Network.IPv6PDSubnetId, config_parse_router_prefix_subnet_id, 0, 0
+DHCPv6PrefixDelegation.SubnetId, config_parse_dhcp6_pd_subnet_id, 0, offsetof(Network, dhcp6_pd_subnet_id)
+DHCPv6PrefixDelegation.Assign, config_parse_bool, 0, offsetof(Network, dhcp6_pd_assign)
+DHCPv6PrefixDelegation.Token, config_parse_dhcp6_pd_token, 0, offsetof(Network, dhcp6_pd_token)
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)
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 591d63c6b2..694d9b0c3a 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -420,7 +420,8 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.dhcp6_use_ntp = true,
.dhcp6_use_dns = true,
- .dhcp6_pd_assign_prefix = true,
+ .dhcp6_pd_subnet_id = -1,
+ .dhcp6_pd_assign = true,
.dhcp_server_emit[SD_DHCP_LEASE_DNS].emit = true,
.dhcp_server_emit[SD_DHCP_LEASE_NTP].emit = true,
@@ -429,7 +430,6 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.dhcp_server_emit_router = true,
.dhcp_server_emit_timezone = true,
- .router_prefix_subnet_id = -1,
.router_emit_dns = true,
.router_emit_domains = true,
diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
index 4c3c2bdd74..5dcb3c548b 100644
--- a/src/network/networkd-network.h
+++ b/src/network/networkd-network.h
@@ -184,7 +184,6 @@ struct Network {
/* IPv6 prefix delegation support */
RADVPrefixDelegation router_prefix_delegation;
- int64_t router_prefix_subnet_id;
usec_t router_lifetime_usec;
uint8_t router_preference;
bool router_managed;
@@ -198,8 +197,11 @@ struct Network {
bool dhcp6_force_pd_other_information; /* Start DHCPv6 PD also when 'O'
RA flag is set, see RFC 7084,
WPD-4 */
- bool dhcp6_pd_assign_prefix;
- union in_addr_union dhcp6_delegation_prefix_token;
+
+ /* DHCPv6 Prefix Delegation support */
+ int64_t dhcp6_pd_subnet_id;
+ bool dhcp6_pd_assign;
+ union in_addr_union dhcp6_pd_token;
/* Bridge Support */
int use_bpdu;
diff --git a/src/network/networkd-radv.c b/src/network/networkd-radv.c
index dbc8fd8074..e0c490baba 100644
--- a/src/network/networkd-radv.c
+++ b/src/network/networkd-radv.c
@@ -866,46 +866,3 @@ int config_parse_router_preference(const char *unit,
return 0;
}
-
-int config_parse_router_prefix_subnet_id(const char *unit,
- const char *filename,
- unsigned line,
- const char *section,
- unsigned section_line,
- const char *lvalue,
- int ltype,
- const char *rvalue,
- void *data,
- void *userdata) {
- Network *network = userdata;
- uint64_t t;
- int r;
-
- assert(filename);
- assert(lvalue);
- assert(rvalue);
- assert(data);
-
- if (isempty(rvalue) || streq(rvalue, "auto")) {
- network->router_prefix_subnet_id = -1;
- return 0;
- }
-
- r = safe_atoux64(rvalue, &t);
- if (r < 0) {
- log_syntax(unit, LOG_WARNING, filename, line, r,
- "Failed to parse %s=, ignoring assignment: %s",
- lvalue, rvalue);
- return 0;
- }
- if (t > INT64_MAX) {
- log_syntax(unit, LOG_WARNING, filename, line, r,
- "Invalid subnet id '%s', ignoring assignment.",
- rvalue);
- return 0;
- }
-
- network->router_prefix_subnet_id = (int64_t)t;
-
- return 0;
-}
diff --git a/src/network/networkd-radv.h b/src/network/networkd-radv.h
index 73143e7493..496ef97adc 100644
--- a/src/network/networkd-radv.h
+++ b/src/network/networkd-radv.h
@@ -60,7 +60,6 @@ RADVPrefixDelegation radv_prefix_delegation_from_string(const char *s) _pure_;
CONFIG_PARSER_PROTOTYPE(config_parse_router_prefix_delegation);
CONFIG_PARSER_PROTOTYPE(config_parse_router_preference);
-CONFIG_PARSER_PROTOTYPE(config_parse_router_prefix_subnet_id);
CONFIG_PARSER_PROTOTYPE(config_parse_prefix);
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_flags);
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_lifetime);
diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network
index aa04c1192a..5d80470719 100644
--- a/test/fuzz/fuzz-network-parser/directives.network
+++ b/test/fuzz/fuzz-network-parser/directives.network
@@ -130,10 +130,12 @@ SendOption=
RequestOptions=
UserClass=
VendorClass=
-AssignAcquiredDelegatedPrefixAddress=
-AssignAcquiredDelegatedPrefixToken=
SendVendorOption=
RouteMetric=
+[DHCPv6PrefixDelegation]
+SubnetId=
+Assign=
+Token=
[Route]
Destination=
Protocol=
@@ -203,7 +205,6 @@ NTP=
DHCP=
Domains=
IPv6PrefixDelegation=
-IPv6PDSubnetId=
VLAN=
DHCPServer=
BindCarrier=