Compare commits

..

17 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 943142a97d
Merge pull request #17185 from yuwata/ethtool-update
ethtool: add several link modes
2020-10-23 08:22:09 +02:00
Yu Watanabe 9c914c0401
Merge pull request #17357 from yuwata/network-dhcp6-pd-announce-17353
network: add an option to control announcement of delegated prefix
2020-10-23 12:57:58 +09:00
Dan Streetman e16e4b3bed network: move set-MAC and set-nomaster operations out of link_up()
These should not be bundled into the link_up() operation, as that is
not (currently) called during interface configuration if the interface
already is IFF_UP, which is unrelated to the need to change the mac
to a user-defined value, or set 'nomaster' on the interface.

Additionally, there is no need to re-set the mac or re-assert nomaster
every time the interface is brought up; those should be only part of
normal initial interface configuration.

Fixes: #17391
2020-10-23 12:09:31 +09:00
Yu Watanabe 610e747748 test-network: use new IPv6SendRA= setting 2020-10-19 14:55:21 +09:00
Yu Watanabe e5ff2245d3 man: update documents about IPv6 RA and DHCPv6-PD 2020-10-19 14:55:21 +09:00
Yu Watanabe 99e1ab06b4 fuzz: move DNSDefaultRoute= setting to [Network] section 2020-10-19 14:55:21 +09:00
Yu Watanabe 27ff0490e6 network: rename IPv6PrefixDelegation= to IPv6SendRA= 2020-10-19 14:55:18 +09:00
Yu Watanabe 4afd986753 network: introduce Announce= in [DHCPv6PrefixDelegation]
When disabled, the delegated prefixes are not emit by RA.

Closes #17353.
2020-10-19 12:09:36 +09:00
Yu Watanabe e502f94dcf network: introduce DHCPv6PrefixDelegation= setting
Then, the link can configure prefix delegated by DHCPv6 without emitting
RA.
2020-10-19 10:09:38 +09:00
Yu Watanabe 8a08bbfc98 network: drop static prefixes and static route prefixes earlier if IPv6PrefixDelegation=no or dhcpv6 2020-10-19 10:09:38 +09:00
Yu Watanabe db5756f3f3 network: sort and rename elements in Network object 2020-10-19 10:09:38 +09:00
Yu Watanabe 69e0f833a3 network: introduce network_adjust_radv() 2020-10-19 10:09:38 +09:00
Yu Watanabe a3c1a94947 network: clear DNS and domains for RA when an empty string is assigned 2020-10-19 10:09:38 +09:00
Yu Watanabe 5e2767720a network: use string_hash_ops_free for search domains 2020-10-19 10:09:38 +09:00
Yu Watanabe fe2aeef816 ethtool: add several new link modes 2020-09-28 22:49:33 +09:00
Yu Watanabe 41f4269619 ethtool: convert underscore to hyphen 2020-09-28 22:44:05 +09:00
Yu Watanabe 7207d82c13 shared/linux: update ethtool.h 2020-09-28 22:42:44 +09:00
15 changed files with 592 additions and 201 deletions

View File

@ -810,17 +810,23 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>IPv6PrefixDelegation=</varname></term>
<listitem><para>Whether to enable or disable Router Advertisement sending on a link. Allowed
values are <literal>static</literal> which distributes prefixes as defined in the
[IPv6PrefixDelegation] and any [IPv6Prefix] sections, <literal>dhcpv6</literal> which requests
prefixes using a DHCPv6 client configured for another link and any values configured in the
[IPv6PrefixDelegation] section while ignoring all static prefix configuration sections,
<literal>yes</literal> which uses both static configuration and DHCPv6, and
<literal>false</literal> which turns off IPv6 prefix delegation altogether. Defaults to
<literal>false</literal>. See the [IPv6PrefixDelegation] and the [IPv6Prefix] sections for more
<term><varname>IPv6SendRA=</varname></term>
<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
configuration options.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>DHCPv6PrefixDelegation=</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.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>IPv6MTUBytes=</varname></term>
<listitem><para>Configures IPv6 maximum transmission unit (MTU).
@ -1957,9 +1963,9 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
<refsect1>
<title>[DHCPv6PrefixDelegation] Section Options</title>
<para>The [DHCPv6PrefixDelegation] section configures delegated prefix assigned by DHCPv6 server.
The settings in this section are used only when <varname>IPv6PrefixDelegation=</varname> setting is
enabled, or set to <literal>dhcpv6</literal>.</para>
<para>The [DHCPv6PrefixDelegation] section configures delegated prefixes assigned by DHCPv6 server.
The settings in this section are used only when <varname>DHCPv6PrefixDelegation=</varname> setting
is enabled.</para>
<variablelist class='network-directives'>
<varlistentry>
@ -1969,9 +1975,16 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
delegation. You can either set "auto" (the default) or a specific subnet ID (as defined in
<ulink url="https://tools.ietf.org/html/rfc4291#section-2.5.4">RFC 4291</ulink>, 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
<varname>IPv6PrefixDelegation=</varname> and the corresponding configuration on the upstream
interface.</para>
inclusive.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Announce=</varname></term>
<listitem>
<para>Takes a boolean. When enabled, and <varname>IPv6SendRA=</varname> in [Network] section
is enabled, the delegated prefixes are distributed through the IPv6 Router Advertisement.
Defaults to yes.</para>
</listitem>
</varlistentry>
@ -1979,19 +1992,22 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
<term><varname>Assign=</varname></term>
<listitem>
<para>Takes a boolean. Specifies whether to add an address from the delegated prefixes which
are received from the WAN interface by the <varname>IPv6PrefixDelegation=</varname>. When
true (on LAN interfce), the EUI-64 algorithm will be used to form an interface identifier
from the delegated prefixes. Defaults to true.</para>
are received from the WAN interface by the DHCPv6 Prefix Delegation. When true (on LAN
interfce), the EUI-64 algorithm will be used by default to form an interface identifier from
the delegated prefixes. See also <varname>Token=</varname> setting below. Defaults to yes.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Token=</varname></term>
<listitem>
<para>Specifies an optional address generation mode for <varname>Assign=</varname>. 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
<varname>IPv6PrefixDelegation=</varname> prefixes to form a complete address.</para>
<para>Specifies an optional address generation mode for assigning an address in each
delegated prefix. Takes an IPv6 address. When set, the lower bits of the supplied address is
combined with the upper bits of each delegatad prefix received from the WAN interface by the
DHCPv6 Prefix Delegation to form a complete address. When <varname>Assign=</varname> is
disabled, this setting is ignored. When unset, the EUI-64 algorithm will be used to form
addresses. Defaults to unset.</para>
</listitem>
</varlistentry>
</variablelist>
@ -2213,10 +2229,11 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
</refsect1>
<refsect1>
<title>[IPv6PrefixDelegation] Section Options</title>
<para>The [IPv6PrefixDelegation] section contains settings for sending IPv6 Router Advertisements and
whether to act as a router, if enabled via the <varname>IPv6PrefixDelegation=</varname> option described
above. IPv6 network prefixes are defined with one or more [IPv6Prefix] sections.</para>
<title>[IPv6SendRA] Section Options</title>
<para>The [IPv6SendRA] section contains settings for sending IPv6 Router Advertisements and whether
to act as a router, if enabled via the <varname>IPv6SendRA=</varname> option described above. IPv6
network prefixes or routes are defined with one or more [IPv6Prefix] or [IPv6RoutePrefix] sections.
</para>
<variablelist class='network-directives'>
@ -3586,10 +3603,13 @@ DHCP=ipv6</programlisting>
Name=enp2s0
[Network]
IPv6PrefixDelegation=dhcpv6</programlisting>
IPv6SendRA=yes
DHCPv6PrefixDelegation=yes</programlisting>
<para>This will enable IPv6 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.</para>
<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.
The delegated prefixes are distributed by IPv6 Router Advertisement on the downstream network.
</para>
</example>
<example>

View File

@ -980,6 +980,7 @@ static int static_address_configure(const Address *address, Link *link, bool upd
int link_set_addresses(Link *link) {
Address *ad;
Prefix *p;
int r;
assert(link);
@ -1000,32 +1001,28 @@ int link_set_addresses(Link *link) {
return r;
}
if (link->network->router_prefix_delegation & RADV_PREFIX_DELEGATION_STATIC) {
Prefix *p;
HASHMAP_FOREACH(p, link->network->prefixes_by_section) {
_cleanup_(address_freep) Address *address = NULL;
HASHMAP_FOREACH(p, link->network->prefixes_by_section) {
_cleanup_(address_freep) Address *address = NULL;
if (!p->assign)
continue;
if (!p->assign)
continue;
r = address_new(&address);
if (r < 0)
return log_oom();
r = address_new(&address);
if (r < 0)
return log_oom();
r = sd_radv_prefix_get_prefix(p->radv_prefix, &address->in_addr.in6, &address->prefixlen);
if (r < 0)
return log_link_warning_errno(link, r, "Could not get RA prefix: %m");
r = sd_radv_prefix_get_prefix(p->radv_prefix, &address->in_addr.in6, &address->prefixlen);
if (r < 0)
return log_link_warning_errno(link, r, "Could not get RA prefix: %m");
r = generate_ipv6_eui_64_address(link, &address->in_addr.in6);
if (r < 0)
return log_link_warning_errno(link, r, "Could not generate EUI64 address: %m");
r = generate_ipv6_eui_64_address(link, &address->in_addr.in6);
if (r < 0)
return log_link_warning_errno(link, r, "Could not generate EUI64 address: %m");
address->family = AF_INET6;
r = static_address_configure(address, link, true);
if (r < 0)
return r;
}
address->family = AF_INET6;
r = static_address_configure(address, link, true);
if (r < 0)
return r;
}
if (link->address_messages == 0) {

View File

@ -1457,8 +1457,8 @@ int dhcp4_configure(Link *link) {
return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to set max attempts: %m");
}
if (link->network->ip_service_type > 0) {
r = sd_dhcp_client_set_service_type(link->dhcp_client, link->network->ip_service_type);
if (link->network->dhcp_ip_service_type > 0) {
r = sd_dhcp_client_set_service_type(link->dhcp_client, link->network->dhcp_ip_service_type);
if (r < 0)
return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to set IP service type: %m");
}

View File

@ -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) {
@ -421,11 +421,14 @@ static int dhcp6_pd_assign_prefix(Link *link, const union in_addr_union *prefix,
int r;
assert(link);
assert(link->network);
assert(prefix);
r = radv_add_prefix(link, &prefix->in6, prefix_len, lifetime_preferred, lifetime_valid);
if (r < 0)
return r;
if (link->network->dhcp6_pd_announce) {
r = radv_add_prefix(link, &prefix->in6, prefix_len, lifetime_preferred, lifetime_valid);
if (r < 0)
return r;
}
r = dhcp6_set_pd_route(link, prefix, pd_prefix);
if (r < 0)
@ -1424,7 +1427,7 @@ int dhcp6_configure(Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set ifindex: %m");
if (link->network->rapid_commit) {
if (link->network->dhcp6_rapid_commit) {
r = sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_RAPID_COMMIT);
if (r < 0)
return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set request flag for rapid commit: %m");

View File

@ -890,6 +890,105 @@ static int link_set_static_configs(Link *link) {
static int link_configure_continue(Link *link);
static int link_mac_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
int r;
assert(link);
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
r = sd_netlink_message_get_errno(m);
if (r < 0)
log_link_message_warning_errno(link, m, r, "Could not set MAC address, ignoring");
else
log_link_debug(link, "Setting MAC address done.");
return 1;
}
static int link_set_mac(Link *link) {
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
int r;
assert(link);
assert(link->network);
assert(link->manager);
assert(link->manager->rtnl);
if (!link->network->mac)
return 0;
log_link_debug(link, "Setting MAC address");
r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex);
if (r < 0)
return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m");
r = sd_netlink_message_append_ether_addr(req, IFLA_ADDRESS, link->network->mac);
if (r < 0)
return log_link_error_errno(link, r, "Could not set MAC address: %m");
r = netlink_call_async(link->manager->rtnl, NULL, req, link_mac_handler,
link_netlink_destroy_callback, link);
if (r < 0)
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
link_ref(link);
return 0;
}
static int link_nomaster_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
int r;
assert(link);
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
r = sd_netlink_message_get_errno(m);
if (r < 0)
log_link_message_warning_errno(link, m, r, "Could not set nomaster, ignoring");
else
log_link_debug(link, "Setting nomaster done.");
return 1;
}
static int link_set_nomaster(Link *link) {
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
int r;
assert(link);
assert(link->network);
assert(link->manager);
assert(link->manager->rtnl);
/* set it free if not enslaved with networkd */
if (link->network->bridge || link->network->bond || link->network->vrf)
return 0;
log_link_debug(link, "Setting nomaster");
r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex);
if (r < 0)
return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m");
r = sd_netlink_message_append_u32(req, IFLA_MASTER, 0);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_MASTER attribute: %m");
r = netlink_call_async(link->manager->rtnl, NULL, req, link_nomaster_handler,
link_netlink_destroy_callback, link);
if (r < 0)
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
link_ref(link);
return 0;
}
static int set_mtu_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
int r;
@ -1306,23 +1405,10 @@ static int link_up(Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m");
/* set it free if not enslaved with networkd */
if (!link->network->bridge && !link->network->bond && !link->network->vrf) {
r = sd_netlink_message_append_u32(req, IFLA_MASTER, 0);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_MASTER attribute: %m");
}
r = sd_rtnl_message_link_set_flags(req, IFF_UP, IFF_UP);
if (r < 0)
return log_link_error_errno(link, r, "Could not set link flags: %m");
if (link->network->mac) {
r = sd_netlink_message_append_ether_addr(req, IFLA_ADDRESS, link->network->mac);
if (r < 0)
return log_link_error_errno(link, r, "Could not set MAC address: %m");
}
r = netlink_call_async(link->manager->rtnl, NULL, req, link_up_handler,
link_netlink_destroy_callback, link);
if (r < 0)
@ -1970,6 +2056,14 @@ int link_configure(Link *link) {
if (r < 0)
return r;
r = link_set_mac(link);
if (r < 0)
return r;
r = link_set_nomaster(link);
if (r < 0)
return r;
r = link_set_flags(link);
if (r < 0)
return r;

View File

@ -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.IPv6SendRA, 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
@ -209,14 +211,14 @@ DHCPv4.SendRelease, config_parse_bool,
DHCPv4.SendDecline, config_parse_bool, 0, offsetof(Network, dhcp_send_decline)
DHCPv4.DenyList, config_parse_dhcp_acl_ip_address, 0, 0
DHCPv4.AllowList, config_parse_dhcp_acl_ip_address, 0, 0
DHCPv4.IPServiceType, config_parse_dhcp_ip_service_type, 0, offsetof(Network, ip_service_type)
DHCPv4.IPServiceType, config_parse_dhcp_ip_service_type, 0, offsetof(Network, dhcp_ip_service_type)
DHCPv4.SendOption, config_parse_dhcp_send_option, AF_INET, offsetof(Network, dhcp_client_send_options)
DHCPv4.SendVendorOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_client_send_vendor_options)
DHCPv4.RouteMTUBytes, config_parse_mtu, AF_INET, offsetof(Network, dhcp_route_mtu)
DHCPv4.FallbackLeaseLifetimeSec, config_parse_dhcp_fallback_lease_lifetime, 0, 0
DHCPv6.UseDNS, config_parse_dhcp_use_dns, 0, 0
DHCPv6.UseNTP, config_parse_dhcp_use_ntp, 0, 0
DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit)
DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, dhcp6_rapid_commit)
DHCPv6.MUDURL, config_parse_dhcp6_mud_url, 0, 0
DHCPv6.RequestOptions, config_parse_dhcp_request_options, AF_INET6, 0
DHCPv6.UserClass, config_parse_dhcp_user_class, AF_INET6, offsetof(Network, dhcp6_user_class)
@ -280,19 +282,19 @@ 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.Announce, config_parse_bool, 0, offsetof(Network, dhcp6_pd_announce)
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)
IPv6PrefixDelegation.RouterPreference, config_parse_router_preference, 0, 0
IPv6PrefixDelegation.EmitDNS, config_parse_bool, 0, offsetof(Network, router_emit_dns)
IPv6PrefixDelegation.DNS, config_parse_radv_dns, 0, 0
IPv6PrefixDelegation.EmitDomains, config_parse_bool, 0, offsetof(Network, router_emit_domains)
IPv6PrefixDelegation.Domains, config_parse_radv_search_domains, 0, 0
IPv6PrefixDelegation.DNSLifetimeSec, config_parse_sec, 0, offsetof(Network, router_dns_lifetime_usec)
IPv6SendRA.RouterLifetimeSec, config_parse_sec, 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)
IPv6SendRA.RouterPreference, config_parse_router_preference, 0, 0
IPv6SendRA.EmitDNS, config_parse_bool, 0, offsetof(Network, router_emit_dns)
IPv6SendRA.DNS, config_parse_radv_dns, 0, 0
IPv6SendRA.EmitDomains, config_parse_bool, 0, offsetof(Network, router_emit_domains)
IPv6SendRA.Domains, config_parse_radv_search_domains, 0, 0
IPv6SendRA.DNSLifetimeSec, config_parse_sec, 0, offsetof(Network, router_dns_lifetime_usec)
IPv6Prefix.Prefix, config_parse_prefix, 0, 0
IPv6Prefix.OnLink, config_parse_prefix_flags, 0, 0
IPv6Prefix.AddressAutoconfiguration, config_parse_prefix_flags, 0, 0
@ -429,6 +431,16 @@ TrivialLinkEqualizer.Handle, config_parse_qdisc_handle,
TrivialLinkEqualizer.Id, config_parse_trivial_link_equalizer_id, QDISC_KIND_TEQL, 0
/* backwards compatibility: do not add new entries to this section */
Network.IPv4LL, config_parse_ipv4ll, 0, offsetof(Network, link_local)
Network.IPv6PrefixDelegation, config_parse_router_prefix_delegation, 0, offsetof(Network, router_prefix_delegation)
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)
IPv6PrefixDelegation.RouterPreference, config_parse_router_preference, 0, 0
IPv6PrefixDelegation.EmitDNS, config_parse_bool, 0, offsetof(Network, router_emit_dns)
IPv6PrefixDelegation.DNS, config_parse_radv_dns, 0, 0
IPv6PrefixDelegation.EmitDomains, config_parse_bool, 0, offsetof(Network, router_emit_domains)
IPv6PrefixDelegation.Domains, config_parse_radv_search_domains, 0, 0
IPv6PrefixDelegation.DNSLifetimeSec, config_parse_sec, 0, offsetof(Network, router_dns_lifetime_usec)
DHCPv4.BlackList, config_parse_dhcp_acl_ip_address, 0, 0
DHCP.ClientIdentifier, config_parse_dhcp_client_identifier, 0, offsetof(Network, dhcp_client_identifier)
DHCP.UseDNS, config_parse_dhcp_use_dns, 0, 0
@ -452,7 +464,7 @@ DHCP.RouteTable, config_parse_section_route_table,
DHCP.UseTimezone, config_parse_bool, 0, offsetof(Network, dhcp_use_timezone)
DHCP.IAID, config_parse_iaid, 0, 0
DHCP.ListenPort, config_parse_uint16, 0, offsetof(Network, dhcp_client_port)
DHCP.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit)
DHCP.RapidCommit, config_parse_bool, 0, offsetof(Network, dhcp6_rapid_commit)
DHCP.ForceDHCPv6PDOtherInformation, config_parse_bool, 0, offsetof(Network, dhcp6_force_pd_other_information)
DHCPv4.UseDomainName, config_parse_dhcp_use_domains, 0, offsetof(Network, dhcp_use_domains)
DHCPv4.CriticalConnection, config_parse_tristate, 0, offsetof(Network, dhcp_critical)

View File

@ -214,14 +214,6 @@ int network_verify(Network *network) {
if (network->link_local < 0)
network->link_local = network->bridge ? ADDRESS_FAMILY_NO : ADDRESS_FAMILY_IPV6;
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. "
"Disabling IPv6PrefixDelegation=.", network->filename);
network->router_prefix_delegation = RADV_PREFIX_DELEGATION_NONE;
}
}
if (FLAGS_SET(network->link_local, ADDRESS_FAMILY_FALLBACK_IPV4) &&
!FLAGS_SET(network->dhcp, ADDRESS_FAMILY_IPV4)) {
log_warning("%s: fallback assignment of IPv4 link local address is enabled but DHCPv4 is disabled. "
@ -235,6 +227,7 @@ int network_verify(Network *network) {
network_adjust_ipv6_accept_ra(network);
network_adjust_dhcp(network);
network_adjust_radv(network);
if (network->mtu > 0 && network->dhcp_use_mtu) {
log_warning("%s: MTUBytes= in [Link] section and UseMTU= in [DHCP] section are set. "
@ -336,7 +329,16 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.required_for_online = true,
.required_operstate_for_online = LINK_OPERSTATE_RANGE_DEFAULT,
.arp = -1,
.multicast = -1,
.allmulticast = -1,
.configure_without_carrier = false,
.ignore_carrier_loss = -1,
.keep_configuration = _KEEP_CONFIGURATION_INVALID,
.dhcp = ADDRESS_FAMILY_NO,
.duid.type = _DUID_TYPE_INVALID,
.dhcp_critical = -1,
.dhcp_use_ntp = true,
.dhcp_use_sip = true,
@ -358,14 +360,17 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.dhcp_use_mtu = false,
/* NOTE: from man: UseTimezone=... Defaults to "no".*/
.dhcp_use_timezone = false,
.rapid_commit = true,
.dhcp_ip_service_type = -1,
.dhcp6_rapid_commit = true,
.dhcp6_route_metric = DHCP_ROUTE_METRIC,
.dhcp6_use_ntp = true,
.dhcp6_use_dns = true,
.dhcp6_pd_subnet_id = -1,
.dhcp6_pd = -1,
.dhcp6_pd_announce = true,
.dhcp6_pd_assign = true,
.dhcp6_pd_subnet_id = -1,
.dhcp_server_emit[SD_DHCP_LEASE_DNS].emit = true,
.dhcp_server_emit[SD_DHCP_LEASE_NTP].emit = true,
@ -404,17 +409,13 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.ipv6ll_address_gen_mode = _IPV6_LINK_LOCAL_ADDRESS_GEN_MODE_INVALID,
.ipv4_accept_local = -1,
.ipv6_privacy_extensions = IPV6_PRIVACY_EXTENSIONS_NO,
.ipv6_accept_ra = -1,
.ipv6_dad_transmits = -1,
.ipv6_hop_limit = -1,
.ipv6_proxy_ndp = -1,
.duid.type = _DUID_TYPE_INVALID,
.proxy_arp = -1,
.arp = -1,
.multicast = -1,
.allmulticast = -1,
.ipv6_accept_ra_use_dns = true,
.ipv6_accept_ra_use_autonomous_prefix = true,
.ipv6_accept_ra_use_onlink_prefix = true,
@ -422,15 +423,11 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.ipv6_accept_ra_route_table_set = false,
.ipv6_accept_ra_start_dhcp6_client = true,
.configure_without_carrier = false,
.ignore_carrier_loss = -1,
.keep_configuration = _KEEP_CONFIGURATION_INVALID,
.can_triple_sampling = -1,
.can_termination = -1,
.can_listen_only = -1,
.can_fd_mode = -1,
.can_non_iso = -1,
.ip_service_type = -1,
};
r = config_parse_many(
@ -456,6 +453,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
"BridgeFDB\0"
"BridgeMDB\0"
"BridgeVLAN\0"
"IPv6SendRA\0"
"IPv6PrefixDelegation\0"
"IPv6Prefix\0"
"IPv6RoutePrefix\0"
@ -620,11 +618,11 @@ static Network *network_free(Network *network) {
for (unsigned i = 0; i < network->n_dns; i++)
in_addr_full_free(network->dns[i]);
free(network->dns);
ordered_set_free_free(network->search_domains);
ordered_set_free_free(network->route_domains);
ordered_set_free(network->search_domains);
ordered_set_free(network->route_domains);
strv_free(network->bind_carrier);
ordered_set_free_free(network->router_search_domains);
ordered_set_free(network->router_search_domains);
free(network->router_dns);
set_free_free(network->ndisc_deny_listed_prefix);
@ -864,8 +862,8 @@ int config_parse_domains(
assert(rvalue);
if (isempty(rvalue)) {
n->search_domains = ordered_set_free_free(n->search_domains);
n->route_domains = ordered_set_free_free(n->route_domains);
n->search_domains = ordered_set_free(n->search_domains);
n->route_domains = ordered_set_free(n->route_domains);
return 0;
}
@ -913,7 +911,7 @@ int config_parse_domains(
}
OrderedSet **set = is_route ? &n->route_domains : &n->search_domains;
r = ordered_set_ensure_allocated(set, &string_hash_ops);
r = ordered_set_ensure_allocated(set, &string_hash_ops_free);
if (r < 0)
return log_oom();

View File

@ -57,12 +57,14 @@ typedef struct NetworkDHCPServerEmitAddress {
struct Network {
Manager *manager;
char *filename;
char *name;
usec_t timestamp;
unsigned n_ref;
char *name;
char *filename;
usec_t timestamp;
char *description;
/* [Match] section */
Set *match_mac;
Set *match_permanent_mac;
char **match_path;
@ -75,8 +77,7 @@ struct Network {
Set *match_bssid;
LIST_HEAD(Condition, conditions);
char *description;
/* Master or stacked netdevs */
NetDev *bridge;
NetDev *bond;
NetDev *vrf;
@ -87,9 +88,31 @@ struct Network {
char *vrf_name;
Hashmap *stacked_netdev_names;
/* [Link] section */
struct ether_addr *mac;
uint32_t mtu;
uint32_t group;
int arp;
int multicast;
int allmulticast;
bool unmanaged;
bool required_for_online; /* Is this network required to be considered online? */
LinkOperationalStateRange required_operstate_for_online;
/* misc settings */
bool configure_without_carrier;
int ignore_carrier_loss;
KeepConfiguration keep_configuration;
char **bind_carrier;
bool default_route_on_device;
bool ip_masquerade;
/* DHCP Client Support */
AddressFamily dhcp;
DHCPClientIdentifier dhcp_client_identifier;
DUID duid;
uint32_t iaid;
bool iaid_set;
char *dhcp_vendor_class_identifier;
char *dhcp_mudurl;
char **dhcp_user_class;
@ -102,7 +125,7 @@ struct Network {
uint32_t dhcp_route_mtu;
uint16_t dhcp_client_port;
int dhcp_critical;
int ip_service_type;
int dhcp_ip_service_type;
bool dhcp_anonymize;
bool dhcp_send_hostname;
bool dhcp_broadcast;
@ -116,7 +139,6 @@ struct Network {
bool dhcp_use_routes;
int dhcp_use_gateway;
bool dhcp_use_timezone;
bool rapid_commit;
bool dhcp_use_hostname;
bool dhcp_route_table_set;
bool dhcp_send_release;
@ -127,14 +149,13 @@ struct Network {
Set *dhcp_request_options;
OrderedHashmap *dhcp_client_send_options;
OrderedHashmap *dhcp_client_send_vendor_options;
OrderedHashmap *dhcp_server_send_options;
OrderedHashmap *dhcp_server_send_vendor_options;
/* DHCPv6 Client support*/
bool dhcp6_use_dns;
bool dhcp6_use_dns_set;
bool dhcp6_use_ntp;
bool dhcp6_use_ntp_set;
bool dhcp6_rapid_commit;
uint8_t dhcp6_pd_length;
uint32_t dhcp6_route_metric;
bool dhcp6_route_metric_set;
@ -146,6 +167,8 @@ struct Network {
OrderedHashmap *dhcp6_client_send_options;
OrderedHashmap *dhcp6_client_send_vendor_options;
Set *dhcp6_request_options;
/* Start DHCPv6 PD also when 'O' RA flag is set, see RFC 7084, WPD-4 */
bool dhcp6_force_pd_other_information;
/* DHCP Server Support */
bool dhcp_server;
@ -156,15 +179,15 @@ struct Network {
usec_t dhcp_server_default_lease_time_usec, dhcp_server_max_lease_time_usec;
uint32_t dhcp_server_pool_offset;
uint32_t dhcp_server_pool_size;
OrderedHashmap *dhcp_server_send_options;
OrderedHashmap *dhcp_server_send_vendor_options;
/* link local addressing support */
AddressFamily link_local;
IPv6LinkLocalAddressGenMode ipv6ll_address_gen_mode;
bool ipv4ll_route;
bool default_route_on_device;
/* IPv6 prefix delegation support */
/* IPv6 RA support */
RADVPrefixDelegation router_prefix_delegation;
usec_t router_lifetime_usec;
uint8_t router_preference;
@ -176,13 +199,12 @@ struct Network {
struct in6_addr *router_dns;
unsigned n_router_dns;
OrderedSet *router_search_domains;
bool dhcp6_force_pd_other_information; /* Start DHCPv6 PD also when 'O'
RA flag is set, see RFC 7084,
WPD-4 */
/* DHCPv6 Prefix Delegation support */
int64_t dhcp6_pd_subnet_id;
int dhcp6_pd;
bool dhcp6_pd_announce;
bool dhcp6_pd_assign;
int64_t dhcp6_pd_subnet_id;
union in_addr_union dhcp6_pd_token;
/* Bridge Support */
@ -201,6 +223,7 @@ struct Network {
uint16_t priority;
MulticastRouter multicast_router;
/* Bridge VLAN */
bool use_br_vlan;
uint16_t pvid;
uint32_t br_vid_bitmap[BRIDGE_VLAN_BITMAP_LEN];
@ -218,18 +241,19 @@ struct Network {
int can_fd_mode;
int can_non_iso;
/* sysctl settings */
AddressFamily ip_forward;
bool ip_masquerade;
int ipv4_accept_local;
int ipv6_accept_ra;
int ipv6_dad_transmits;
int ipv6_hop_limit;
int ipv6_proxy_ndp;
Set *ipv6_proxy_ndp_addresses;
int proxy_arp;
uint32_t ipv6_mtu;
IPv6PrivacyExtensions ipv6_privacy_extensions;
int ipv6_proxy_ndp;
Set *ipv6_proxy_ndp_addresses;
/* IPv6 accept RA */
int ipv6_accept_ra;
bool ipv6_accept_ra_use_dns;
bool ipv6_accept_ra_use_autonomous_prefix;
bool ipv6_accept_ra_use_onlink_prefix;
@ -242,26 +266,6 @@ struct Network {
Set *ndisc_deny_listed_prefix;
OrderedSet *ipv6_tokens;
IPv6PrivacyExtensions ipv6_privacy_extensions;
struct ether_addr *mac;
uint32_t mtu;
uint32_t group;
int arp;
int multicast;
int allmulticast;
bool unmanaged;
bool configure_without_carrier;
int ignore_carrier_loss;
KeepConfiguration keep_configuration;
uint32_t iaid;
DUID duid;
bool iaid_set;
bool required_for_online; /* Is this network required to be considered online? */
LinkOperationalStateRange required_operstate_for_online;
/* LLDP support */
LLDPMode lldp_mode; /* LLDP reception */
LLDPEmit lldp_emit; /* LLDP transmission */
@ -284,7 +288,6 @@ struct Network {
struct in_addr_full **dns;
unsigned n_dns;
OrderedSet *search_domains, *route_domains;
int dns_default_route;
ResolveSupport llmnr;
ResolveSupport mdns;
@ -292,8 +295,8 @@ struct Network {
DnsOverTlsMode dns_over_tls_mode;
Set *dnssec_negative_trust_anchors;
/* NTP */
char **ntp;
char **bind_carrier;
};
Network *network_ref(Network *network);

View File

@ -180,6 +180,35 @@ void network_drop_invalid_route_prefixes(Network *network) {
route_prefix_free(prefix);
}
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. "
"Disabling IPv6PrefixDelegation=.", network->filename);
network->router_prefix_delegation = RADV_PREFIX_DELEGATION_NONE;
}
if (network->router_prefix_delegation == RADV_PREFIX_DELEGATION_NONE) {
network->n_router_dns = 0;
network->router_dns = mfree(network->router_dns);
network->router_search_domains = ordered_set_free(network->router_search_domains);
}
if (!FLAGS_SET(network->router_prefix_delegation, RADV_PREFIX_DELEGATION_STATIC)) {
network->prefixes_by_section = hashmap_free_with_destructor(network->prefixes_by_section, prefix_free);
network->route_prefixes_by_section = hashmap_free_with_destructor(network->route_prefixes_by_section, route_prefix_free);
}
}
int config_parse_prefix(
const char *unit,
const char *filename,
@ -608,10 +637,12 @@ 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) {
RoutePrefix *q;
Prefix *p;
int r;
assert(link);
@ -658,29 +689,24 @@ int radv_configure(Link *link) {
return r;
}
if (link->network->router_prefix_delegation & RADV_PREFIX_DELEGATION_STATIC) {
RoutePrefix *q;
Prefix *p;
HASHMAP_FOREACH(p, link->network->prefixes_by_section) {
r = sd_radv_add_prefix(link->radv, p->radv_prefix, false);
if (r == -EEXIST)
continue;
if (r == -ENOEXEC) {
log_link_warning_errno(link, r, "[IPv6Prefix] section configured without Prefix= setting, ignoring section.");
continue;
}
if (r < 0)
return r;
HASHMAP_FOREACH(p, link->network->prefixes_by_section) {
r = sd_radv_add_prefix(link->radv, p->radv_prefix, false);
if (r == -EEXIST)
continue;
if (r == -ENOEXEC) {
log_link_warning_errno(link, r, "[IPv6Prefix] section configured without Prefix= setting, ignoring section.");
continue;
}
if (r < 0)
return r;
}
HASHMAP_FOREACH(q, link->network->route_prefixes_by_section) {
r = sd_radv_add_route_prefix(link->radv, q->radv_route_prefix, false);
if (r == -EEXIST)
continue;
if (r < 0)
return r;
}
HASHMAP_FOREACH(q, link->network->route_prefixes_by_section) {
r = sd_radv_add_route_prefix(link->radv, q->radv_route_prefix, false);
if (r == -EEXIST)
continue;
if (r < 0)
return r;
}
return 0;
@ -771,6 +797,12 @@ int config_parse_radv_dns(
assert(lvalue);
assert(rvalue);
if (isempty(rvalue)) {
n->n_router_dns = 0;
n->router_dns = mfree(n->router_dns);
return 0;
}
for (const char *p = rvalue;;) {
_cleanup_free_ char *w = NULL;
union in_addr_union a;
@ -832,6 +864,11 @@ int config_parse_radv_search_domains(
assert(lvalue);
assert(rvalue);
if (isempty(rvalue)) {
n->router_search_domains = ordered_set_free(n->router_search_domains);
return 0;
}
for (const char *p = rvalue;;) {
_cleanup_free_ char *w = NULL, *idna = NULL;
@ -855,7 +892,7 @@ int config_parse_radv_search_domains(
/* transfer ownership to simplify subsequent operations */
idna = TAKE_PTR(w);
r = ordered_set_ensure_allocated(&n->router_search_domains, &string_hash_ops);
r = ordered_set_ensure_allocated(&n->router_search_domains, &string_hash_ops_free);
if (r < 0)
return log_oom();
@ -877,11 +914,51 @@ DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(
RADVPrefixDelegation,
RADV_PREFIX_DELEGATION_BOTH);
DEFINE_CONFIG_PARSE_ENUM(
config_parse_router_prefix_delegation,
radv_prefix_delegation,
RADVPrefixDelegation,
"Invalid router prefix delegation");
int config_parse_router_prefix_delegation(
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) {
RADVPrefixDelegation val, *ra = data;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
assert(data);
if (streq(lvalue, "IPv6SendRA")) {
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Invalid %s= setting, ignoring assignment: %s", lvalue, rvalue);
return 0;
}
/* When IPv6SendRA= is enabled, only static prefixes are sent by default, and users
* need to explicitly enable DHCPv6PrefixDelegation=. */
*ra = r ? RADV_PREFIX_DELEGATION_STATIC : RADV_PREFIX_DELEGATION_NONE;
return 0;
}
/* For backward compatibility */
val = radv_prefix_delegation_from_string(rvalue);
if (val < 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid %s= setting, ignoring assignment: %s", lvalue, rvalue);
return 0;
}
*ra = val;
return 0;
}
int config_parse_router_preference(
const char *unit,

View File

@ -47,6 +47,7 @@ RoutePrefix *route_prefix_free(RoutePrefix *prefix);
void network_drop_invalid_prefixes(Network *network);
void network_drop_invalid_route_prefixes(Network *network);
void network_adjust_radv(Network *network);
int radv_emit_dns(Link *link);
int radv_configure(Link *link);

View File

@ -112,21 +112,44 @@ static const char* const ethtool_link_mode_bit_table[] = {
[ETHTOOL_LINK_MODE_FEC_NONE_BIT] = "fec-none",
[ETHTOOL_LINK_MODE_FEC_RS_BIT] = "fec-rs",
[ETHTOOL_LINK_MODE_FEC_BASER_BIT] = "fec-baser",
[ETHTOOL_LINK_MODE_50000baseKR_Full_BIT] = "50000basekr_full",
[ETHTOOL_LINK_MODE_50000baseSR_Full_BIT] = "50000basesr_full",
[ETHTOOL_LINK_MODE_50000baseCR_Full_BIT] = "50000basecr_full",
[ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT] = "50000baselr_er_fr_full",
[ETHTOOL_LINK_MODE_50000baseDR_Full_BIT] = "50000basedr_full",
[ETHTOOL_LINK_MODE_100000baseKR2_Full_BIT] = "100000basekr2_full",
[ETHTOOL_LINK_MODE_100000baseSR2_Full_BIT] = "100000basesr2_full",
[ETHTOOL_LINK_MODE_100000baseCR2_Full_BIT] = "100000basecr2_full",
[ETHTOOL_LINK_MODE_100000baseLR2_ER2_FR2_Full_BIT] = "100000baselr2_er2_fr2_full",
[ETHTOOL_LINK_MODE_100000baseDR2_Full_BIT] = "100000basedr2_full",
[ETHTOOL_LINK_MODE_200000baseKR4_Full_BIT] = "200000basekr4_full",
[ETHTOOL_LINK_MODE_200000baseSR4_Full_BIT] = "200000basesr4_full",
[ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT] = "200000basecr4_full",
[ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT] = "200000baselr4_er4_fr4_full",
[ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT] = "200000basedr4_full",
[ETHTOOL_LINK_MODE_50000baseKR_Full_BIT] = "50000basekr-full",
[ETHTOOL_LINK_MODE_50000baseSR_Full_BIT] = "50000basesr-full",
[ETHTOOL_LINK_MODE_50000baseCR_Full_BIT] = "50000basecr-full",
[ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT] = "50000baselr-er-fr-full",
[ETHTOOL_LINK_MODE_50000baseDR_Full_BIT] = "50000basedr-full",
[ETHTOOL_LINK_MODE_100000baseKR2_Full_BIT] = "100000basekr2-full",
[ETHTOOL_LINK_MODE_100000baseSR2_Full_BIT] = "100000basesr2-full",
[ETHTOOL_LINK_MODE_100000baseCR2_Full_BIT] = "100000basecr2-full",
[ETHTOOL_LINK_MODE_100000baseLR2_ER2_FR2_Full_BIT] = "100000baselr2-er2-fr2-full",
[ETHTOOL_LINK_MODE_100000baseDR2_Full_BIT] = "100000basedr2-full",
[ETHTOOL_LINK_MODE_200000baseKR4_Full_BIT] = "200000basekr4-full",
[ETHTOOL_LINK_MODE_200000baseSR4_Full_BIT] = "200000basesr4-full",
[ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT] = "200000baselr4-er4-fr4-full",
[ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT] = "200000basedr4-full",
[ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT] = "200000basecr4-full",
[ETHTOOL_LINK_MODE_100baseT1_Full_BIT] = "100baset1-full",
[ETHTOOL_LINK_MODE_1000baseT1_Full_BIT] = "1000baset1-full",
[ETHTOOL_LINK_MODE_400000baseKR8_Full_BIT] = "400000basekr8-full",
[ETHTOOL_LINK_MODE_400000baseSR8_Full_BIT] = "400000basesr8-full",
[ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT] = "400000baselr8-er8-fr8-full",
[ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT] = "400000basedr8-full",
[ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT] = "400000basecr8-full",
[ETHTOOL_LINK_MODE_FEC_LLRS_BIT] = "fec-llrs",
[ETHTOOL_LINK_MODE_100000baseKR_Full_BIT] = "100000basekr-full",
[ETHTOOL_LINK_MODE_100000baseSR_Full_BIT] = "100000basesr-full",
[ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT] = "100000baselr-er-fr-full",
[ETHTOOL_LINK_MODE_100000baseCR_Full_BIT] = "100000basecr-full",
[ETHTOOL_LINK_MODE_100000baseDR_Full_BIT] = "100000basedr-full",
[ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT] = "200000basekr2-full",
[ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT] = "200000basesr2-full",
[ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT] = "200000baselr2-er2-fr2-full",
[ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT] = "200000basedr2-full",
[ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT] = "200000basecr2-full",
[ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT] = "400000basekr4-full",
[ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT] = "400000basesr4-full",
[ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT] = "400000baselr4-er4-fr4-full",
[ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT] = "400000basedr4-full",
[ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT] = "400000basecr4-full",
};
/* Make sure the array is large enough to fit all bits */
assert_cc((ELEMENTSOF(ethtool_link_mode_bit_table)-1) / 32 < N_ADVERTISE);

View File

@ -263,10 +263,32 @@ struct ethtool_tunable {
#define ETHTOOL_PHY_FAST_LINK_DOWN_ON 0
#define ETHTOOL_PHY_FAST_LINK_DOWN_OFF 0xff
/* Energy Detect Power Down (EDPD) is a feature supported by some PHYs, where
* the PHY's RX & TX blocks are put into a low-power mode when there is no
* link detected (typically cable is un-plugged). For RX, only a minimal
* link-detection is available, and for TX the PHY wakes up to send link pulses
* to avoid any lock-ups in case the peer PHY may also be running in EDPD mode.
*
* Some PHYs may support configuration of the wake-up interval for TX pulses,
* and some PHYs may support only disabling TX pulses entirely. For the latter
* a special value is required (ETHTOOL_PHY_EDPD_NO_TX) so that this can be
* configured from userspace (should the user want it).
*
* The interval units for TX wake-up are in milliseconds, since this should
* cover a reasonable range of intervals:
* - from 1 millisecond, which does not sound like much of a power-saver
* - to ~65 seconds which is quite a lot to wait for a link to come up when
* plugging a cable
*/
#define ETHTOOL_PHY_EDPD_DFLT_TX_MSECS 0xffff
#define ETHTOOL_PHY_EDPD_NO_TX 0xfffe
#define ETHTOOL_PHY_EDPD_DISABLE 0
enum phy_tunable_id {
ETHTOOL_PHY_ID_UNSPEC,
ETHTOOL_PHY_DOWNSHIFT,
ETHTOOL_PHY_FAST_LINK_DOWN,
ETHTOOL_PHY_EDPD,
/*
* Add your fresh new phy tunable attribute above and remember to update
* phy_tunable_strings[] in net/core/ethtool.c
@ -561,6 +583,76 @@ struct ethtool_pauseparam {
__u32 tx_pause;
};
/**
* enum ethtool_link_ext_state - link extended state
*/
enum ethtool_link_ext_state {
ETHTOOL_LINK_EXT_STATE_AUTONEG,
ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE,
ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH,
ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY,
ETHTOOL_LINK_EXT_STATE_NO_CABLE,
ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE,
ETHTOOL_LINK_EXT_STATE_EEPROM_ISSUE,
ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE,
ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED,
ETHTOOL_LINK_EXT_STATE_OVERHEAT,
};
/**
* enum ethtool_link_ext_substate_autoneg - more information in addition to
* ETHTOOL_LINK_EXT_STATE_AUTONEG.
*/
enum ethtool_link_ext_substate_autoneg {
ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED = 1,
ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED,
ETHTOOL_LINK_EXT_SUBSTATE_AN_NEXT_PAGE_EXCHANGE_FAILED,
ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED_FORCE_MODE,
ETHTOOL_LINK_EXT_SUBSTATE_AN_FEC_MISMATCH_DURING_OVERRIDE,
ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD,
};
/**
* enum ethtool_link_ext_substate_link_training - more information in addition to
* ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE.
*/
enum ethtool_link_ext_substate_link_training {
ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED = 1,
ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_INHIBIT_TIMEOUT,
ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_PARTNER_DID_NOT_SET_RECEIVER_READY,
ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT,
};
/**
* enum ethtool_link_ext_substate_logical_mismatch - more information in addition
* to ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH.
*/
enum ethtool_link_ext_substate_link_logical_mismatch {
ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK = 1,
ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_AM_LOCK,
ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_GET_ALIGN_STATUS,
ETHTOOL_LINK_EXT_SUBSTATE_LLM_FC_FEC_IS_NOT_LOCKED,
ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED,
};
/**
* enum ethtool_link_ext_substate_bad_signal_integrity - more information in
* addition to ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY.
*/
enum ethtool_link_ext_substate_bad_signal_integrity {
ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 1,
ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE,
};
/**
* enum ethtool_link_ext_substate_cable_issue - more information in
* addition to ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE.
*/
enum ethtool_link_ext_substate_cable_issue {
ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE = 1,
ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE,
};
#define ETH_GSTRING_LEN 32
/**
@ -575,6 +667,13 @@ struct ethtool_pauseparam {
* @ETH_SS_RSS_HASH_FUNCS: RSS hush function names
* @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS
* @ETH_SS_PHY_TUNABLES: PHY tunable names
* @ETH_SS_LINK_MODES: link mode names
* @ETH_SS_MSG_CLASSES: debug message class names
* @ETH_SS_WOL_MODES: wake-on-lan modes
* @ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags
* @ETH_SS_TS_TX_TYPES: timestamping Tx types
* @ETH_SS_TS_RX_FILTERS: timestamping Rx filters
* @ETH_SS_UDP_TUNNEL_TYPES: UDP tunnel types
*/
enum ethtool_stringset {
ETH_SS_TEST = 0,
@ -586,6 +685,16 @@ enum ethtool_stringset {
ETH_SS_TUNABLES,
ETH_SS_PHY_STATS,
ETH_SS_PHY_TUNABLES,
ETH_SS_LINK_MODES,
ETH_SS_MSG_CLASSES,
ETH_SS_WOL_MODES,
ETH_SS_SOF_TIMESTAMPING,
ETH_SS_TS_TX_TYPES,
ETH_SS_TS_RX_FILTERS,
ETH_SS_UDP_TUNNEL_TYPES,
/* add new constants above here */
ETH_SS_COUNT
};
/**
@ -1303,6 +1412,7 @@ enum ethtool_fec_config_bits {
ETHTOOL_FEC_OFF_BIT,
ETHTOOL_FEC_RS_BIT,
ETHTOOL_FEC_BASER_BIT,
ETHTOOL_FEC_LLRS_BIT,
};
#define ETHTOOL_FEC_NONE (1 << ETHTOOL_FEC_NONE_BIT)
@ -1310,6 +1420,7 @@ enum ethtool_fec_config_bits {
#define ETHTOOL_FEC_OFF (1 << ETHTOOL_FEC_OFF_BIT)
#define ETHTOOL_FEC_RS (1 << ETHTOOL_FEC_RS_BIT)
#define ETHTOOL_FEC_BASER (1 << ETHTOOL_FEC_BASER_BIT)
#define ETHTOOL_FEC_LLRS (1 << ETHTOOL_FEC_LLRS_BIT)
/* CMDs currently supported */
#define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings.
@ -1487,7 +1598,29 @@ enum ethtool_link_mode_bit_indices {
ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 64,
ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT = 65,
ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT = 66,
ETHTOOL_LINK_MODE_100baseT1_Full_BIT = 67,
ETHTOOL_LINK_MODE_1000baseT1_Full_BIT = 68,
ETHTOOL_LINK_MODE_400000baseKR8_Full_BIT = 69,
ETHTOOL_LINK_MODE_400000baseSR8_Full_BIT = 70,
ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT = 71,
ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT = 72,
ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT = 73,
ETHTOOL_LINK_MODE_FEC_LLRS_BIT = 74,
ETHTOOL_LINK_MODE_100000baseKR_Full_BIT = 75,
ETHTOOL_LINK_MODE_100000baseSR_Full_BIT = 76,
ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT = 77,
ETHTOOL_LINK_MODE_100000baseCR_Full_BIT = 78,
ETHTOOL_LINK_MODE_100000baseDR_Full_BIT = 79,
ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT = 80,
ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT = 81,
ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT = 82,
ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT = 83,
ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT = 84,
ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT = 85,
ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT = 86,
ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT = 87,
ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT = 88,
ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 89,
/* must be last entry */
__ETHTOOL_LINK_MODE_MASK_NBITS
};
@ -1598,6 +1731,7 @@ enum ethtool_link_mode_bit_indices {
#define SPEED_56000 56000
#define SPEED_100000 100000
#define SPEED_200000 200000
#define SPEED_400000 400000
#define SPEED_UNKNOWN -1
@ -1623,6 +1757,18 @@ static inline int ethtool_validate_duplex(__u8 duplex)
return 0;
}
#define MASTER_SLAVE_CFG_UNSUPPORTED 0
#define MASTER_SLAVE_CFG_UNKNOWN 1
#define MASTER_SLAVE_CFG_MASTER_PREFERRED 2
#define MASTER_SLAVE_CFG_SLAVE_PREFERRED 3
#define MASTER_SLAVE_CFG_MASTER_FORCE 4
#define MASTER_SLAVE_CFG_SLAVE_FORCE 5
#define MASTER_SLAVE_STATE_UNSUPPORTED 0
#define MASTER_SLAVE_STATE_UNKNOWN 1
#define MASTER_SLAVE_STATE_MASTER 2
#define MASTER_SLAVE_STATE_SLAVE 3
#define MASTER_SLAVE_STATE_ERR 4
/* Which connector port. */
#define PORT_TP 0x00
#define PORT_AUI 0x01
@ -1662,6 +1808,8 @@ static inline int ethtool_validate_duplex(__u8 duplex)
#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
#define WAKE_FILTER (1 << 7)
#define WOL_MODE_COUNT 8
/* L2-L4 network traffic flow types */
#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
#define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
@ -1859,7 +2007,9 @@ struct ethtool_link_settings {
__u8 eth_tp_mdix_ctrl;
__s8 link_mode_masks_nwords;
__u8 transceiver;
__u8 reserved1[3];
__u8 master_slave_cfg;
__u8 master_slave_state;
__u8 reserved1[1];
__u32 reserved[7];
__u32 link_mode_masks[0];
/* layout of link_mode_masks fields:

View File

@ -137,6 +137,7 @@ SendVendorOption=
RouteMetric=
[DHCPv6PrefixDelegation]
SubnetId=
Announce=
Assign=
Token=
[Route]
@ -190,6 +191,7 @@ DNSOverTLS=
Bond=
IPv6ProxyNDP=
DNS=
DNSDefaultRoute=
ActiveSlave=
LLMNR=
DNSSEC=
@ -207,6 +209,7 @@ ConfigureWithoutCarrier=
NTP=
DHCP=
Domains=
IPv6SendRA=
IPv6PrefixDelegation=
VLAN=
DHCPServer=
@ -214,6 +217,7 @@ BindCarrier=
VRF=
IgnoreCarrierLoss=
KeepConfiguration=
DHCPv6PrefixDelegation=
[IPv6Prefix]
Prefix=
OnLink=
@ -270,11 +274,20 @@ InvertRule=
Family=
SuppressPrefixLength=
User=
[IPv6SendRA]
RouterPreference=
DNSLifetimeSec=
DNS=
RouterLifetimeSec=
Domains=
EmitDNS=
EmitDomains=
Managed=
OtherInformation=
[IPv6PrefixDelegation]
RouterPreference=
DNSLifetimeSec=
DNS=
DNSDefaultRoute=
RouterLifetimeSec=
Domains=
EmitDNS=

View File

@ -2,9 +2,9 @@
Name=veth-peer
[Network]
IPv6PrefixDelegation=yes
IPv6SendRA=yes
[IPv6PrefixDelegation]
[IPv6SendRA]
DNS=_link_local 2002:da8:1:0::1
DNSLifetimeSec=1min

View File

@ -3,7 +3,7 @@ Name=veth99
[Network]
DHCP=no
IPv6PrefixDelegation=yes
IPv6SendRA=yes
[IPv6Prefix]
Prefix=2001:db8:0:1::/64