1
0
mirror of https://github.com/systemd/systemd synced 2026-04-24 16:04:51 +02:00

Compare commits

..

No commits in common. "f81ac115dc1b2688756ffc78599ce98f31c57195" and "a14b9ca2c38ddf55bf22b0103e3bae361bf9b8fc" have entirely different histories.

10 changed files with 33 additions and 66 deletions

View File

@ -366,7 +366,7 @@
<varlistentry>
<term><varname>IPv6LinkLocalAddressGenerationMode=</varname></term>
<listitem>
<para>Specifies how IPv6 link-local address is generated. Takes one of
<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, <literal>stable-privacy</literal> is used if
<varname>IPv6StableSecretAddress=</varname> is specified, and if not,
@ -715,7 +715,7 @@ Table=1234</programlisting></para>
may trigger the start of the DHCPv6 client if the relevant flags are set in the RA data, or
if no routers are found on the link. The default is to disable RA reception for bridge
devices or when IP forwarding is enabled, and to enable it otherwise. Cannot be enabled on
bond devices and when link-local addressing is disabled.</para>
bond devices and when link local addressing is disabled.</para>
<para>Further settings for the IPv6 RA support may be configured in the [IPv6AcceptRA]
section, see below.</para>
@ -917,36 +917,17 @@ Table=1234</programlisting></para>
<varlistentry>
<term><varname>IgnoreCarrierLoss=</varname></term>
<listitem>
<para>Takes a boolean or a timespan. When true, <command>systemd-networkd</command> retains
both the static and dynamic configuration of the interface even if its carrier is lost. When
false, <command>systemd-networkd</command> drops both the static and dynamic configuration of
the interface. When a timespan is specified, <command>systemd-networkd</command> waits for
the specified timespan, and ignores the carrier loss if the link regain its carrier within
the timespan. Setting 0 seconds is equivalent to <literal>no</literal>, and
<literal>infinite</literal> is equivalent to <literal>yes</literal>.</para>
<para>Takes a boolean or a timespan. When true, networkd retains both the static and dynamic
configuration of the interface even if its carrier is lost. When a timespan is specified,
networkd waits for the specified timespan, and ignores the carrier loss if the link regain
its carrier within the timespan. Setting a finite timespan may be useful for a wireless
interface connecting to a network which has multiple access points with the same SSID, or an
interface which is reset on changing MTU. When unset, the value specified with
<varname>ConfigureWithoutCarrier=</varname> is used.</para>
<para>Setting a finite timespan may be useful when e.g. in the following cases:
<itemizedlist>
<listitem>
<para>A wireless interface connecting to a network which has multiple access points with
the same SSID.</para>
</listitem>
<listitem>
<para>Enslaving a wireless interface to a bond interface, which may disconnect from the
connected access point and causes its carrier to be lost.</para>
</listitem>
<listitem>
<para>The driver of the interface resets when the MTU is changed.</para>
</listitem>
</itemizedlist>
<para>When <varname>ActivationPolicy=</varname> is set to <literal>always-up</literal>, this
is forced to <literal>true</literal>.
</para>
<para>When <varname>Bond=</varname> is specified to a wireless interface, defaults to 3
seconds. When the DHCPv4 client is enabled and <varname>UseMTU=</varname> in the [DHCPv4]
sectionis enabled, defaults to 5 seconds. Otherwise, defaults to the value specified with
<varname>ConfigureWithoutCarrier=</varname>. When <varname>ActivationPolicy=</varname> is set
to <literal>always-up</literal>, this is forced to <literal>yes</literal>, and ignored any
user specified values.</para>
</listitem>
</varlistentry>
@ -2836,7 +2817,7 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
<listitem><para><varname>DNS=</varname> specifies a list of recursive DNS server IPv6 addresses
that are distributed via Router Advertisement messages when <varname>EmitDNS=</varname> is true.
<varname>DNS=</varname> also takes special value <literal>_link_local</literal>; in that case
the IPv6 link-local address is distributed. If <varname>DNS=</varname> is empty, DNS servers are
the IPv6 link local address is distributed. If <varname>DNS=</varname> is empty, DNS servers are
read from the [Network] section. If the [Network] section does not contain any DNS servers
either, DNS servers from the uplink interface specified in <varname>UplinkInterface=</varname>
will be used. When <varname>EmitDNS=</varname> is false, no DNS server information is sent in

View File

@ -91,7 +91,7 @@ void network_adjust_dhcp(Network *network) {
if (!FLAGS_SET(network->link_local, ADDRESS_FAMILY_IPV6) &&
FLAGS_SET(network->dhcp, ADDRESS_FAMILY_IPV6)) {
log_warning("%s: DHCPv6 client is enabled but IPv6 link-local addressing is disabled. "
log_warning("%s: DHCPv6 client is enabled but IPv6 link local addressing is disabled. "
"Disabling DHCPv6 client.", network->filename);
SET_FLAG(network->dhcp, ADDRESS_FAMILY_IPV6, false);
}

View File

@ -735,6 +735,7 @@ static int dhcp4_request_routes(Link *link) {
}
static int dhcp_reset_mtu(Link *link) {
uint16_t mtu;
int r;
assert(link);
@ -742,9 +743,18 @@ static int dhcp_reset_mtu(Link *link) {
if (!link->network->dhcp_use_mtu)
return 0;
r = sd_dhcp_lease_get_mtu(link->dhcp_lease, &mtu);
if (r == -ENODATA)
return 0;
if (r < 0)
return log_link_error_errno(link, r, "DHCP error: failed to get MTU from lease: %m");
if (link->original_mtu == mtu)
return 0;
r = link_request_to_set_mtu(link, link->original_mtu);
if (r < 0)
return log_link_error_errno(link, r, "DHCP error: Could not queue request to reset MTU: %m");
return log_link_error_errno(link, r, "DHCP error: could not reset MTU: %m");
return 0;
}

View File

@ -245,4 +245,4 @@ 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");
"Failed to parse IPv6 link local address generation mode");

View File

@ -1636,8 +1636,6 @@ static int link_carrier_lost_handler(sd_event_source *s, uint64_t usec, void *us
}
static int link_carrier_lost(Link *link) {
uint16_t dhcp_mtu;
usec_t usec;
int r;
assert(link);
@ -1653,38 +1651,16 @@ static int link_carrier_lost(Link *link) {
if (!link->network)
return 0;
if (link->network->ignore_carrier_loss_set)
/* If IgnoreCarrierLoss= is explicitly specified, then use the specified value. */
usec = link->network->ignore_carrier_loss_usec;
else if (link->network->bond && link->wlan_iftype > 0)
/* Enslaving wlan interface to a bond disconnects from the connected AP, and causes its
* carrier to be lost. See #19832. */
usec = 3 * USEC_PER_SEC;
else if (link->network->dhcp_use_mtu &&
link->dhcp_lease &&
sd_dhcp_lease_get_mtu(link->dhcp_lease, &dhcp_mtu) >= 0 &&
dhcp_mtu != link->original_mtu)
/* Some drivers reset interfaces when changing MTU. Resetting interfaces by the static
* MTU should not cause any issues, as MTU is changed only once. However, setting MTU
* through DHCP lease causes an infinite loop of resetting the interface. See #18738. */
usec = 5 * USEC_PER_SEC;
else
/* Otherwise, use the currently set value. */
usec = link->network->ignore_carrier_loss_usec;
if (usec == USEC_INFINITY)
if (link->network->ignore_carrier_loss_usec == USEC_INFINITY)
return 0;
if (usec == 0)
if (link->network->ignore_carrier_loss_usec == 0)
return link_carrier_lost_impl(link);
return event_reset_time_relative(link->manager->event,
&link->carrier_lost_timer,
CLOCK_BOOTTIME,
usec,
link->network->ignore_carrier_loss_usec,
0,
link_carrier_lost_handler,
link,

View File

@ -69,7 +69,7 @@ typedef struct Link {
sd_device *sd_device;
char *driver;
/* link-local addressing */
/* link local addressing */
IPv6LinkLocalAddressGenMode ipv6ll_address_gen_mode;
/* wlan */

View File

@ -59,7 +59,7 @@ void network_adjust_ipv6_accept_ra(Network *network) {
if (!FLAGS_SET(network->link_local, ADDRESS_FAMILY_IPV6)) {
if (network->ipv6_accept_ra > 0)
log_warning("%s: IPv6AcceptRA= is enabled but IPv6 link-local addressing is disabled or not supported. "
log_warning("%s: IPv6AcceptRA= is enabled but IPv6 link local addressing is disabled or not supported. "
"Disabling IPv6AcceptRA=.", network->filename);
network->ipv6_accept_ra = false;
}

View File

@ -204,7 +204,7 @@ struct Network {
char *dhcp_server_boot_server_name;
char *dhcp_server_boot_filename;
/* link-local addressing support */
/* link local addressing support */
AddressFamily link_local;
IPv6LinkLocalAddressGenMode ipv6ll_address_gen_mode;
struct in6_addr ipv6ll_stable_secret;

View File

@ -33,7 +33,7 @@ void network_adjust_radv(Network *network) {
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. "
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;

View File

@ -284,7 +284,7 @@ int link_set_sysctl(Link *link) {
r = link_set_ipv6ll_stable_secret(link);
if (r < 0)
log_link_warning_errno(link, r, "Cannot set stable secret address for IPv6 link-local address: %m");
log_link_warning_errno(link, r, "Cannot set stable secret address for IPv6 link local address: %m");
r = link_set_ipv4_accept_local(link);
if (r < 0)