Merge pull request #16313 from yuwata/network-move-ipv6ll-gen-mode

network: move IPv6LinkLocalAddressGenerationMode= to [Network] section
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-06-30 17:13:02 +02:00 committed by GitHub
commit 6c3a19d5b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 43 additions and 44 deletions

6
NEWS
View File

@ -145,7 +145,7 @@ CHANGES WITH 246 in spe:
frame ring buffer sizes.
* networkd.conf gained a new boolean setting ManageForeignRoutes=. If
enabled systemd-networkd manage all routes configured by other tools.
enabled systemd-networkd manages all routes configured by other tools.
* systemd-networkd's [IPv6Prefix] section in .network files gained a
new boolean setting Assign=. If enabled an address from the prefix is
@ -212,7 +212,7 @@ CHANGES WITH 246 in spe:
* systemd-networkd supports a new Group= setting in the [Link] section
of the .network files, to control the link group.
* systemd-networkd's [Link] section gained a new
* systemd-networkd's [Network] section gained a new
IPv6LinkLocalAddressGenerationMode= setting, which specifies how IPv6
link local address is generated.
@ -229,7 +229,7 @@ CHANGES WITH 246 in spe:
automatically chosen and assigned to the interface.
* systemd-networkd's [DHCPv6] section gained a new setting RouteMetric=
which set the route priority for routes specified by the DHCP server.
which sets the route priority for routes specified by the DHCP server.
* systemd-networkd's [DHCPv6] section gained a new setting VendorClass=
which configures the vendor class information sent to DHCP server.

View File

@ -193,16 +193,6 @@
This happens when multicast routing is enabled.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>IPv6LinkLocalAddressGenerationMode=</varname></term>
<listitem>
<para>Specifies how IPv6 link local address is generated. Takes one of <literal>eui64</literal>,
<literal>none</literal>, <literal>stable-privacy</literal> and <literal>random</literal>.
When unset, the kernel's default will be used. Note that if <varname>LinkLocalAdressing=</varname>
not configured as <literal>ipv6</literal> then <varname>IPv6LinkLocalAddressGenerationMode=</varname>
is ignored.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Unmanaged=</varname></term>
<listitem>
@ -308,6 +298,16 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>IPv6LinkLocalAddressGenerationMode=</varname></term>
<listitem>
<para>Specifies how IPv6 link local address is generated. Takes one of <literal>eui64</literal>,
<literal>none</literal>, <literal>stable-privacy</literal> and <literal>random</literal>.
When unset, the kernel's default will be used. Note that if <varname>LinkLocalAdressing=</varname>
not configured as <literal>ipv6</literal> then <varname>IPv6LinkLocalAddressGenerationMode=</varname>
is ignored.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>IPv4LLRoute=</varname></term>
<listitem>

View File

@ -1698,7 +1698,7 @@ static int link_configure_addrgen_mode(Link *link) {
if (!link_ipv6ll_enabled(link))
ipv6ll_mode = IN6_ADDR_GEN_MODE_NONE;
else if (link->network->ipv6_address_gen_mode < 0) {
else if (link->network->ipv6ll_address_gen_mode < 0) {
r = sysctl_read_ip_property(AF_INET6, link->ifname, "stable_secret", NULL);
if (r < 0) {
/* The file may not exist. And even if it exists, when stable_secret is unset,
@ -1709,7 +1709,7 @@ static int link_configure_addrgen_mode(Link *link) {
} else
ipv6ll_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY;
} else
ipv6ll_mode = link->network->ipv6_address_gen_mode;
ipv6ll_mode = link->network->ipv6ll_address_gen_mode;
r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode);
if (r < 0)
@ -4427,16 +4427,6 @@ void link_clean(Link *link) {
link_unref(set_remove(link->manager->dirty_links, link));
}
static const char* const link_ipv6_address_gen_mode_table[_LINK_IPV6_ADDRESS_GEN_MODE_MAX] = {
[LINK_IPV6_ADDRESSS_GEN_MODE_EUI64] = "eui64",
[LINK_IPV6_ADDRESSS_GEN_MODE_NONE] = "none",
[LINK_IPV6_ADDRESSS_GEN_MODE_STABLE_PRIVACY] = "stable-privacy",
[LINK_IPV6_ADDRESSS_GEN_MODE_RANDOM] = "random",
};
DEFINE_STRING_TABLE_LOOKUP(link_ipv6_address_gen_mode, LinkIPv6AddressGenMode);
DEFINE_CONFIG_PARSE_ENUM(config_parse_link_ipv6_address_gen_mode, link_ipv6_address_gen_mode, LinkIPv6AddressGenMode, "Failed to parse link IPv6 address generation mode");
static const char* const link_state_table[_LINK_STATE_MAX] = {
[LINK_STATE_PENDING] = "pending",
[LINK_STATE_INITIALIZED] = "initialized",

View File

@ -35,15 +35,6 @@ typedef enum LinkState {
_LINK_STATE_INVALID = -1
} LinkState;
typedef enum LinkIPv6AddressGenMode {
LINK_IPV6_ADDRESSS_GEN_MODE_EUI64 = IN6_ADDR_GEN_MODE_EUI64,
LINK_IPV6_ADDRESSS_GEN_MODE_NONE = IN6_ADDR_GEN_MODE_NONE,
LINK_IPV6_ADDRESSS_GEN_MODE_STABLE_PRIVACY = IN6_ADDR_GEN_MODE_STABLE_PRIVACY,
LINK_IPV6_ADDRESSS_GEN_MODE_RANDOM = IN6_ADDR_GEN_MODE_RANDOM,
_LINK_IPV6_ADDRESS_GEN_MODE_MAX,
_LINK_IPV6_ADDRESS_GEN_MODE_INVALID = -1
} LinkIPv6AddressGenMode;
typedef struct Manager Manager;
typedef struct Network Network;
typedef struct Address Address;
@ -220,9 +211,6 @@ int link_stop_clients(Link *link, bool may_keep_dhcp);
const char* link_state_to_string(LinkState s) _const_;
LinkState link_state_from_string(const char *s) _pure_;
const char* link_ipv6_address_gen_mode_to_string(LinkIPv6AddressGenMode s) _const_;
LinkIPv6AddressGenMode link_ipv6_address_gen_mode_from_string(const char *s) _pure_;
uint32_t link_get_vrf_table(Link *link);
uint32_t link_get_dhcp_route_table(Link *link);
uint32_t link_get_ipv6_accept_ra_route_table(Link *link);
@ -232,8 +220,6 @@ int link_request_set_nexthop(Link *link);
int link_reconfigure(Link *link, bool force);
int address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link);
CONFIG_PARSER_PROTOTYPE(config_parse_link_ipv6_address_gen_mode);
int log_link_message_full_errno(Link *link, sd_netlink_message *m, int level, int err, const char *msg);
#define log_link_message_error_errno(link, m, err, msg) log_link_message_full_errno(link, m, LOG_ERR, err, msg)
#define log_link_message_warning_errno(link, m, err, msg) log_link_message_full_errno(link, m, LOG_WARNING, err, msg)

View File

@ -52,7 +52,6 @@ Link.ARP, config_parse_tristate,
Link.Multicast, config_parse_tristate, 0, offsetof(Network, multicast)
Link.AllMulticast, config_parse_tristate, 0, offsetof(Network, allmulticast)
Link.Unmanaged, config_parse_bool, 0, offsetof(Network, unmanaged)
Link.IPv6LinkLocalAddressGenerationMode, config_parse_link_ipv6_address_gen_mode, 0, offsetof(Network, ipv6_address_gen_mode)
Link.RequiredForOnline, config_parse_required_for_online, 0, 0
Network.Description, config_parse_string, 0, offsetof(Network, description)
Network.Bridge, config_parse_ifname, 0, offsetof(Network, bridge_name)
@ -71,6 +70,7 @@ Network.VRF, config_parse_ifname,
Network.DHCP, config_parse_dhcp, 0, offsetof(Network, dhcp)
Network.DHCPServer, config_parse_bool, 0, offsetof(Network, dhcp_server)
Network.LinkLocalAddressing, config_parse_link_local_address_family, 0, offsetof(Network, link_local)
Network.IPv6LinkLocalAddressGenerationMode, config_parse_ipv6_link_local_address_gen_mode, 0, offsetof(Network, ipv6ll_address_gen_mode)
Network.IPv4LLRoute, config_parse_bool, 0, offsetof(Network, ipv4ll_route)
Network.DefaultRouteOnDevice, config_parse_bool, 0, offsetof(Network, default_route_on_device)
Network.IPv6Token, config_parse_address_generation_type, 0, 0

View File

@ -451,6 +451,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
/* If LinkLocalAddressing= is not set, then set to ADDRESS_FAMILY_IPV6 later. */
.link_local = _ADDRESS_FAMILY_INVALID,
.ipv6ll_address_gen_mode = _IPV6_LINK_LOCAL_ADDRESS_GEN_MODE_INVALID,
.ipv4_accept_local = -1,
@ -474,7 +475,6 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.configure_without_carrier = false,
.ignore_carrier_loss = -1,
.keep_configuration = _KEEP_CONFIGURATION_INVALID,
.ipv6_address_gen_mode = _LINK_IPV6_ADDRESS_GEN_MODE_INVALID,
.can_triple_sampling = -1,
.can_termination = -1,
.ip_service_type = -1,
@ -1392,3 +1392,13 @@ static const char* const keep_configuration_table[_KEEP_CONFIGURATION_MAX] = {
};
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(keep_configuration, KeepConfiguration, KEEP_CONFIGURATION_YES);
static const char* const ipv6_link_local_address_gen_mode_table[_IPV6_LINK_LOCAL_ADDRESS_GEN_MODE_MAX] = {
[IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_EUI64] = "eui64",
[IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_NONE] = "none",
[IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_STABLE_PRIVACY] = "stable-privacy",
[IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_RANDOM] = "random",
};
DEFINE_STRING_TABLE_LOOKUP(ipv6_link_local_address_gen_mode, IPv6LinkLocalAddressGenMode);
DEFINE_CONFIG_PARSE_ENUM(config_parse_ipv6_link_local_address_gen_mode, ipv6_link_local_address_gen_mode, IPv6LinkLocalAddressGenMode, "Failed to parse IPv6 link local address generation mode");

View File

@ -52,6 +52,15 @@ typedef enum KeepConfiguration {
_KEEP_CONFIGURATION_INVALID = -1,
} KeepConfiguration;
typedef enum IPv6LinkLocalAddressGenMode {
IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_EUI64 = IN6_ADDR_GEN_MODE_EUI64,
IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_NONE = IN6_ADDR_GEN_MODE_NONE,
IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_STABLE_PRIVACY = IN6_ADDR_GEN_MODE_STABLE_PRIVACY,
IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_RANDOM = IN6_ADDR_GEN_MODE_RANDOM,
_IPV6_LINK_LOCAL_ADDRESS_GEN_MODE_MAX,
_IPV6_LINK_LOCAL_ADDRESS_GEN_MODE_INVALID = -1
} IPv6LinkLocalAddressGenMode;
typedef struct Manager Manager;
typedef struct NetworkDHCPServerEmitAddress {
@ -163,8 +172,9 @@ struct Network {
uint32_t dhcp_server_pool_offset;
uint32_t dhcp_server_pool_size;
/* IPV4LL Support */
/* link local addressing support */
AddressFamily link_local;
IPv6LinkLocalAddressGenMode ipv6ll_address_gen_mode;
bool ipv4ll_route;
bool default_route_on_device;
@ -256,7 +266,6 @@ struct Network {
bool configure_without_carrier;
int ignore_carrier_loss;
KeepConfiguration keep_configuration;
LinkIPv6AddressGenMode ipv6_address_gen_mode;
uint32_t iaid;
DUID duid;
@ -351,6 +360,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_dnssec_negative_trust_anchors);
CONFIG_PARSER_PROTOTYPE(config_parse_ntp);
CONFIG_PARSER_PROTOTYPE(config_parse_required_for_online);
CONFIG_PARSER_PROTOTYPE(config_parse_keep_configuration);
CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_link_local_address_gen_mode);
const struct ConfigPerfItem* network_network_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
@ -359,3 +369,6 @@ IPv6PrivacyExtensions ipv6_privacy_extensions_from_string(const char *s) _pure_;
const char* keep_configuration_to_string(KeepConfiguration i) _const_;
KeepConfiguration keep_configuration_from_string(const char *s) _pure_;
const char* ipv6_link_local_address_gen_mode_to_string(IPv6LinkLocalAddressGenMode s) _const_;
IPv6LinkLocalAddressGenMode ipv6_link_local_address_gen_mode_from_string(const char *s) _pure_;

View File

@ -38,7 +38,6 @@ MTUBytes=
Multicast=
MACAddress=
Group=
IPv6LinkLocalAddressGenerationMode=
[BridgeFDB]
VLANId=
MACAddress=
@ -187,6 +186,7 @@ VXLAN=
L2TP=
MACsec=
LinkLocalAddressing=
IPv6LinkLocalAddressGenerationMode=
ConfigureWithoutCarrier=
NTP=
DHCP=