mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-04 23:28:08 +02:00
config: make "ignore-carrier" a per-device configuration option
NetworkManager.conf already contains several per-device settings, that is, settings that have a device-spec as argument. main.ignore-carrier main.no-auto-default main.assume-ipv6ll-only keyfile.unmanged-devices Optimally, these settings should be moved to the new [device*] section. For now, only move main.ignore-carrier there. For the others it may not make sense to do so: - main.no-auto-default: is already merged with internal state from /var/lib/NetworkManager/no-auto-default.state. While NMConfig's write API would be fine to also persist and merge the no-auto-default setting, we'd still have to read the old file too. Thus, deprecating this setting gets quite cumbersome to still handle the old state file. Also, it seems a less useful setting to configure in the global configuration aside setting main.no-auto-default=*. - main.assume-ipv6ll-only: one day, I hope that we no longer assume connections at all, and this setting becomes entirely obsolete. - keyfile.unmanged-devices: this sets NM_UNMANAGED_USER_SETTINGS, which cannot be overruled via D-Bus. For a future device.managed setting we want it it to be overwritable via D-Bus by an explicit user action. Thus, a device.managed property should have a different semantic, this should be more like a device.unmanaged-force setting, which could be done.
This commit is contained in:
parent
3cda2df12b
commit
c7cee12189
3 changed files with 49 additions and 25 deletions
|
|
@ -224,30 +224,12 @@ no-auto-default=*
|
|||
<term><varname>ignore-carrier</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specify devices for which NetworkManager will (partially)
|
||||
ignore the carrier state. Normally, for
|
||||
device types that support carrier-detect, such as Ethernet
|
||||
and InfiniBand, NetworkManager will only allow a
|
||||
connection to be activated on the device if carrier is
|
||||
present (ie, a cable is plugged in), and it will
|
||||
deactivate the device if carrier drops for more than a few
|
||||
seconds.
|
||||
</para>
|
||||
<para>
|
||||
Listing a device here will allow activating connections on
|
||||
that device even when it does not have carrier, provided
|
||||
that the connection uses only statically-configured IP
|
||||
addresses. Additionally, it will allow any active
|
||||
connection (whether static or dynamic) to remain active on
|
||||
the device when carrier is lost.
|
||||
</para>
|
||||
<para>
|
||||
Note that the "carrier" property of NMDevices and device D-Bus
|
||||
interfaces will still reflect the actual device state; it's just
|
||||
that NetworkManager will not make use of that information.
|
||||
</para>
|
||||
<para>See <xref linkend="device-spec"/> for the syntax how to
|
||||
specify a device.
|
||||
This setting is deprecated for the per-device setting
|
||||
<literal>ignore-carrier</literal> which overwrites this setting
|
||||
if specified (See <xref linked="ignore-carrier"/>).
|
||||
Otherwise, it is a list of matches to specify for which device
|
||||
carrier should be ignored. See <xref linkend="device-spec"/> for the
|
||||
syntax how to specify a device.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
|
@ -713,6 +695,38 @@ unmanaged=1
|
|||
<para>
|
||||
The following properties can be configured per-device.
|
||||
<variablelist>
|
||||
<varlistentry id="ignore-carrier">
|
||||
<term><varname>ignore-carrier</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specify devices for which NetworkManager will (partially)
|
||||
ignore the carrier state. Normally, for
|
||||
device types that support carrier-detect, such as Ethernet
|
||||
and InfiniBand, NetworkManager will only allow a
|
||||
connection to be activated on the device if carrier is
|
||||
present (ie, a cable is plugged in), and it will
|
||||
deactivate the device if carrier drops for more than a few
|
||||
seconds.
|
||||
</para>
|
||||
<para>
|
||||
A device with carrier ignored will allow activating connections on
|
||||
that device even when it does not have carrier, provided
|
||||
that the connection uses only statically-configured IP
|
||||
addresses. Additionally, it will allow any active
|
||||
connection (whether static or dynamic) to remain active on
|
||||
the device when carrier is lost.
|
||||
</para>
|
||||
<para>
|
||||
Note that the "carrier" property of NMDevices and device D-Bus
|
||||
interfaces will still reflect the actual device state; it's just
|
||||
that NetworkManager will not make use of that information.
|
||||
</para>
|
||||
<para>
|
||||
This setting overwrites the deprecated <literal>main.ignore-carrier</literal>
|
||||
setting above.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect2>
|
||||
|
|
@ -1012,7 +1026,8 @@ enable=nm-version-min:1.3,nm-version-min:1.2.6,nm-version-min:1.0.16
|
|||
<title>Device List Format</title>
|
||||
<para>
|
||||
The configuration options <literal>main.no-auto-default</literal>, <literal>main.ignore-carrier</literal>,
|
||||
and <literal>keyfile.unmanaged-devices</literal> select devices based on a list of matchings.
|
||||
<literal>keyfile.unmanaged-devices</literal>, <literal>connection*.match-device</literal> and
|
||||
<literal>device*.match-device</literal> select devices based on a list of matchings.
|
||||
Devices can be specified using the following format:
|
||||
</para>
|
||||
<para>
|
||||
|
|
|
|||
|
|
@ -272,9 +272,16 @@ nm_config_data_get_rc_manager (const NMConfigData *self)
|
|||
gboolean
|
||||
nm_config_data_get_ignore_carrier (const NMConfigData *self, NMDevice *device)
|
||||
{
|
||||
gs_free char *value = NULL;
|
||||
gboolean has_match;
|
||||
|
||||
g_return_val_if_fail (NM_IS_CONFIG_DATA (self), FALSE);
|
||||
g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
|
||||
|
||||
value = nm_config_data_get_device_config (self, NM_CONFIG_KEYFILE_KEY_DEVICE_IGNORE_CARRIER, device, &has_match);
|
||||
if (has_match)
|
||||
return nm_config_parse_boolean (value, FALSE);
|
||||
|
||||
return nm_device_spec_match_list (device, NM_CONFIG_DATA_GET_PRIVATE (self)->ignore_carrier);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@
|
|||
#define NM_CONFIG_KEYFILE_KEY_IFUPDOWN_MANAGED "managed"
|
||||
#define NM_CONFIG_KEYFILE_KEY_AUDIT "audit"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEY_DEVICE_IGNORE_CARRIER "ignore-carrier"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEYPREFIX_WAS ".was."
|
||||
#define NM_CONFIG_KEYFILE_KEYPREFIX_SET ".set."
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue