mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 01:50:25 +01:00
nmcli: fix wrongly adding a generic setting when constructing connection
nmc_read_connection_properties() iterates over the input arguments, and
completes the connection.
Initially, the type is not yet known, in that case, we should not wrongly
assume that this is a generic connection. Later, when the type is specified,
con_settings() will return the correct settings.
Previously, this would wrongly add a [generic] section:
$ nmcli connection add type ethernet ifname eth1 con-name ethie autoconnect no ipv4.method auto ethernet.cloned-mac-address random
With the fix, it still works to specify the type later:
$ nmcli connection add ifname eth1 con-name ethie autoconnect no ipv4.method auto type ethernet
but it doesn't work, to specify the type after type-specific options:
$ nmcli connection add ifname eth1 con-name ethie autoconnect no ipv4.method auto ethernet.cloned-mac-address random type ethernet
Error: invalid or not allowed setting 'ethernet': 'ethernet' not among [connection, ipv4, ipv6, proxy].
The patch doesn't change the latter limitation.
Fixes: c5324ed285
This commit is contained in:
parent
ef52122469
commit
53aa340476
1 changed files with 0 additions and 2 deletions
|
|
@ -3638,8 +3638,6 @@ con_settings (NMConnection *connection, const NMMetaSettingValidPartItem *const*
|
|||
}
|
||||
|
||||
con_type = nm_setting_connection_get_connection_type (s_con);
|
||||
if (!con_type)
|
||||
con_type = NM_SETTING_GENERIC_SETTING_NAME;
|
||||
*type_settings = get_valid_settings_array (con_type);
|
||||
if (!*type_settings) {
|
||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue