1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

networkd: DHCPv6 - separate DHCPv6 options from DHCPv4 options

Closes https://github.com/systemd/systemd/issues/12917
This commit is contained in:
Susant Sahani 2019-07-09 19:53:28 +05:30 committed by Yu Watanabe
parent f34635bcda
commit caa8ca4286
6 changed files with 47 additions and 13 deletions

View File

@ -1293,7 +1293,7 @@
<refsect1>
<title>[DHCP] Section Options</title>
<para>The <literal>[DHCP]</literal> section configures the
DHCPv4 and DHCP6 client, if it is enabled with the
DHCPv4 client, if it is enabled with the
<varname>DHCP=</varname> setting described above:</para>
<variablelist class='network-directives'>
@ -1526,6 +1526,30 @@
</listitem>
</varlistentry>
<varlistentry>
<term><varname>BlackList=</varname></term>
<listitem>
<para>A whitespace-separated list of IPv4 addresses. DHCP offers from servers in the list are rejected.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>[DHCPv6] Section Options</title>
<para>The <literal>[DHCPv6]</literal> section configures the DHCPv6 client, if it is enabled with the
<varname>DHCPv6=</varname> setting described above:</para>
<variablelist class='network-directives'>
<varlistentry>
<term><varname>UseDNS=</varname></term>
<term><varname>UseNTP=</varname></term>
<listitem>
<para>As in the <literal>[DHCP]</literal> section.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>RapidCommit=</varname></term>
<listitem>
@ -1555,15 +1579,8 @@
</listitem>
</varlistentry>
<varlistentry>
<term><varname>BlackList=</varname></term>
<listitem>
<para>A whitespace-separated list of IPv4 addresses. DHCP offers from servers in the list are rejected.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
</refsect1>
<refsect1>
<title>[IPv6AcceptRA] Section Options</title>

View File

@ -3474,7 +3474,7 @@ int link_save(Link *link) {
space = true;
}
if (link->network->dhcp_use_dns && dhcp6_lease) {
if (link->network->dhcp6_use_dns && dhcp6_lease) {
struct in6_addr *in6_addrs;
r = sd_dhcp6_lease_get_dns(dhcp6_lease, &in6_addrs);
@ -3517,7 +3517,7 @@ int link_save(Link *link) {
space = true;
}
if (link->network->dhcp_use_ntp && dhcp6_lease) {
if (link->network->dhcp6_use_ntp && dhcp6_lease) {
struct in6_addr *in6_addrs;
char **hosts;

View File

@ -161,15 +161,17 @@ DHCP.UseTimezone, config_parse_bool,
DHCP.IAID, config_parse_iaid, 0, 0
DHCP.ListenPort, config_parse_uint16, 0, offsetof(Network, dhcp_client_port)
DHCP.SendRelease, config_parse_bool, 0, offsetof(Network, dhcp_send_release)
DHCP.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit)
DHCP.BlackList, config_parse_dhcp_black_listed_ip_address, 0, 0
DHCP.ForceDHCPv6PDOtherInformation, config_parse_bool, 0, offsetof(Network, dhcp6_force_pd_other_information)
IPv6AcceptRA.UseAutonomousPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_autonomous_prefix)
IPv6AcceptRA.UseOnLinkPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_onlink_prefix)
IPv6AcceptRA.UseDNS, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_dns)
IPv6AcceptRA.UseDomains, config_parse_dhcp_use_domains, 0, offsetof(Network, ipv6_accept_ra_use_domains)
IPv6AcceptRA.RouteTable, config_parse_section_route_table, 0, 0
IPv6AcceptRA.BlackList, config_parse_ndisc_black_listed_prefix, 0, 0
DHCPv6.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp6_use_dns)
DHCPv6.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp6_use_ntp)
DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit)
DHCPv6.ForceDHCPv6PDOtherInformation, config_parse_bool, 0, offsetof(Network, dhcp6_force_pd_other_information)
DHCPServer.MaxLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_max_lease_time_usec)
DHCPServer.DefaultLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_default_lease_time_usec)
DHCPServer.EmitDNS, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_dns)
@ -230,3 +232,5 @@ DHCPv4.UseHostname, config_parse_bool,
DHCP.UseDomainName, config_parse_dhcp_use_domains, 0, offsetof(Network, dhcp_use_domains)
DHCPv4.UseDomainName, config_parse_dhcp_use_domains, 0, offsetof(Network, dhcp_use_domains)
DHCPv4.CriticalConnection, config_parse_bool, 0, offsetof(Network, dhcp_critical)
DHCP.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit)
DHCP.ForceDHCPv6PDOtherInformation, config_parse_bool, 0, offsetof(Network, dhcp6_force_pd_other_information)

View File

@ -361,6 +361,9 @@ int network_load_one(Manager *manager, const char *filename) {
.dhcp_use_timezone = false,
.rapid_commit = true,
.dhcp6_use_ntp = true,
.dhcp6_use_dns = true,
.dhcp_server_emit_dns = true,
.dhcp_server_emit_ntp = true,
.dhcp_server_emit_router = true,
@ -426,6 +429,7 @@ int network_load_one(Manager *manager, const char *filename) {
"Route\0"
"DHCP\0"
"DHCPv4\0" /* compat */
"DHCPv6\0"
"DHCPServer\0"
"IPv6AcceptRA\0"
"IPv6NDPProxyAddress\0"

View File

@ -101,6 +101,10 @@ struct Network {
DHCPUseDomains dhcp_use_domains;
Set *dhcp_black_listed_ip;
/* DHCPv6 Client support*/
bool dhcp6_use_dns;
bool dhcp6_use_ntp;
/* DHCP Server Support */
bool dhcp_server;
bool dhcp_server_emit_dns;

View File

@ -66,6 +66,11 @@ UseTimezone=
RouteTable=
BlackList=
SendRelease=
[DHCPv6]
UseNTP=
UseDNS=
RapidCommit=
ForceDHCPv6PDOtherInformation=
[Route]
Destination=
Protocol=