config: parse autoconnect-ports value on config

As part of the conscious language effort we must provide an alternative
option to configure autoconnect-ports system-wide on NetworkManager
configuration file.

(cherry picked from commit ad68b28843)
This commit is contained in:
Fernando Fernandez Mancera 2024-08-04 23:52:44 +02:00
parent 7db5ce8c65
commit 7bf05b7fa5
2 changed files with 16 additions and 1 deletions

View file

@ -857,8 +857,13 @@ ipv6.ip6-privacy=0
<listitem><para>If left unspecified, the default value is 3 tries before failing the connection.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>connection.autoconnect-ports</varname></term>
</varlistentry>
<varlistentry>
<term><varname>connection.autoconnect-slaves</varname></term>
<listitem><para>This is deprecated, please use "connection.autoconnect-ports" instead.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>connection.down-on-poweroff</varname></term>

View file

@ -5375,6 +5375,16 @@ should_connect_ports(NMConnection *connection, NMDevice *device)
val =
nm_config_data_get_connection_default_int64(NM_CONFIG_GET_DATA,
NM_CON_DEFAULT("connection.autoconnect-ports"),
device,
0,
1,
-1);
/* Trust "connection.autoconnect-ports" first, if set to default fallback to the deprecated term. */
if (val == NM_TERNARY_DEFAULT)
val = nm_config_data_get_connection_default_int64(
NM_CONFIG_GET_DATA,
NM_CON_DEFAULT("connection.autoconnect-slaves"),
device,
0,