network: introduce DHCPv6PrefixDelegation= setting
Then, the link can configure prefix delegated by DHCPv6 without emitting RA.
This commit is contained in:
parent
8a08bbfc98
commit
e502f94dcf
|
@ -31,7 +31,7 @@ bool link_dhcp6_pd_is_enabled(Link *link) {
|
|||
if (!link->network)
|
||||
return false;
|
||||
|
||||
return link->network->router_prefix_delegation & RADV_PREFIX_DELEGATION_DHCP6;
|
||||
return link->network->dhcp6_pd;
|
||||
}
|
||||
|
||||
static bool dhcp6_lease_has_pd_prefix(sd_dhcp6_lease *lease) {
|
||||
|
|
|
@ -126,6 +126,8 @@ Network.BindCarrier, config_parse_strv,
|
|||
Network.ConfigureWithoutCarrier, config_parse_bool, 0, offsetof(Network, configure_without_carrier)
|
||||
Network.IgnoreCarrierLoss, config_parse_tristate, 0, offsetof(Network, ignore_carrier_loss)
|
||||
Network.KeepConfiguration, config_parse_keep_configuration, 0, offsetof(Network, keep_configuration)
|
||||
Network.IPv6PrefixDelegation, config_parse_router_prefix_delegation, 0, offsetof(Network, router_prefix_delegation)
|
||||
Network.DHCPv6PrefixDelegation, config_parse_tristate, 0, offsetof(Network, dhcp6_pd)
|
||||
Address.Address, config_parse_address, 0, 0
|
||||
Address.Peer, config_parse_address, 0, 0
|
||||
Address.Broadcast, config_parse_broadcast, 0, 0
|
||||
|
@ -280,7 +282,6 @@ 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
|
||||
Network.IPv6PrefixDelegation, config_parse_router_prefix_delegation, 0, offsetof(Network, router_prefix_delegation)
|
||||
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)
|
||||
|
|
|
@ -367,6 +367,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
|
|||
.dhcp6_use_ntp = true,
|
||||
.dhcp6_use_dns = true,
|
||||
|
||||
.dhcp6_pd = -1,
|
||||
.dhcp6_pd_subnet_id = -1,
|
||||
.dhcp6_pd_assign = true,
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ struct Network {
|
|||
OrderedSet *router_search_domains;
|
||||
|
||||
/* DHCPv6 Prefix Delegation support */
|
||||
bool dhcp6_pd;
|
||||
int dhcp6_pd;
|
||||
bool dhcp6_pd_assign;
|
||||
int64_t dhcp6_pd_subnet_id;
|
||||
union in_addr_union dhcp6_pd_token;
|
||||
|
|
|
@ -183,6 +183,12 @@ void network_drop_invalid_route_prefixes(Network *network) {
|
|||
void network_adjust_radv(Network *network) {
|
||||
assert(network);
|
||||
|
||||
/* After this function is called, network->router_prefix_delegation can be treated as a boolean. */
|
||||
|
||||
if (network->dhcp6_pd < 0)
|
||||
/* For backward compatibility. */
|
||||
network->dhcp6_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)
|
||||
log_warning("%s: IPv6PrefixDelegation= is enabled but IPv6 link local addressing is disabled. "
|
||||
|
@ -631,7 +637,7 @@ static bool link_radv_enabled(Link *link) {
|
|||
if (!link_ipv6ll_enabled(link))
|
||||
return false;
|
||||
|
||||
return link->network->router_prefix_delegation != RADV_PREFIX_DELEGATION_NONE;
|
||||
return link->network->router_prefix_delegation;
|
||||
}
|
||||
|
||||
int radv_configure(Link *link) {
|
||||
|
|
|
@ -214,6 +214,7 @@ BindCarrier=
|
|||
VRF=
|
||||
IgnoreCarrierLoss=
|
||||
KeepConfiguration=
|
||||
DHCPv6PrefixDelegation=
|
||||
[IPv6Prefix]
|
||||
Prefix=
|
||||
OnLink=
|
||||
|
|
Loading…
Reference in New Issue