network: Introduce UseDNR DHCPv6 option

This is equivalent to the DHCPv4 option introduced earlier.
This commit is contained in:
Ronan Pigott 2024-01-17 18:16:47 -07:00
parent 072071bc61
commit cff8947fac
7 changed files with 15 additions and 0 deletions

View file

@ -206,6 +206,7 @@ bool dhcp6_option_can_request(uint16_t option) {
case SD_DHCP6_OPTION_V6_DOTS_RI:
case SD_DHCP6_OPTION_V6_DOTS_ADDRESS:
case SD_DHCP6_OPTION_IPV6_ADDRESS_ANDSF:
case SD_DHCP6_OPTION_V6_DNR:
return true;
default:
return false;

View file

@ -3,6 +3,8 @@
#include <netinet/in.h>
#include "dns-resolver-internal.h"
#include "conf-parser.h"
#include "dhcp-duid-internal.h"
#include "in-addr-util.h"

View file

@ -646,6 +646,12 @@ static int dhcp6_configure(Link *link) {
return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to request domains: %m");
}
if (link_get_use_dnr(link, NETWORK_CONFIG_SOURCE_DHCP6)) {
r = sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_V6_DNR);
if (r < 0)
return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to request DNR: %m");
}
if (link->network->dhcp6_use_captive_portal > 0) {
r = sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_CAPTIVE_PORTAL);
if (r < 0)

View file

@ -106,6 +106,9 @@ bool link_get_use_dnr(Link *link, NetworkConfigSource proto) {
case NETWORK_CONFIG_SOURCE_DHCP4:
n = link->network->dhcp_use_dnr;
break;
case NETWORK_CONFIG_SOURCE_DHCP6:
n = link->network->dhcp6_use_dnr;
break;
default:
assert_not_reached();
}

View file

@ -277,6 +277,7 @@ DHCPv4.RapidCommit, config_parse_tristate,
DHCPv6.UseAddress, config_parse_bool, 0, offsetof(Network, dhcp6_use_address)
DHCPv6.UseDelegatedPrefix, config_parse_bool, 0, offsetof(Network, dhcp6_use_pd_prefix)
DHCPv6.UseDNS, config_parse_tristate, 0, offsetof(Network, dhcp6_use_dns)
DHCPv6.UseDNR, config_parse_tristate, 0, offsetof(Network, dhcp6_use_dnr)
DHCPv6.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp6_use_hostname)
DHCPv6.UseDomains, config_parse_use_domains, 0, offsetof(Network, dhcp6_use_domains)
DHCPv6.UseNTP, config_parse_tristate, 0, offsetof(Network, dhcp6_use_ntp)

View file

@ -407,6 +407,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.dhcp6_use_address = true,
.dhcp6_use_pd_prefix = true,
.dhcp6_use_dns = -1,
.dhcp6_use_dnr = -1,
.dhcp6_use_domains = _USE_DOMAINS_INVALID,
.dhcp6_use_hostname = true,
.dhcp6_use_ntp = -1,

View file

@ -185,6 +185,7 @@ struct Network {
bool dhcp6_send_hostname;
bool dhcp6_send_hostname_set;
int dhcp6_use_dns;
int dhcp6_use_dnr;
bool dhcp6_use_hostname;
int dhcp6_use_ntp;
bool dhcp6_use_captive_portal;