nmcli: connection: don't overwrite port-type if explicitly set
When processing the "type" property we deduce the port-type in some
cases and set it. If the user has chosen a port-type we must not
overwrite it. In any case, we should raise an error when validating the
connection.
Fixes: c5324ed285
('nmcli: streamline connection addition')
This commit is contained in:

committed by
Íñigo Huguet

parent
bb850fda0e
commit
6a133d10a1
@@ -4616,9 +4616,12 @@ set_connection_type(NmCli *nmc,
|
||||
gboolean allow_reset,
|
||||
GError **error)
|
||||
{
|
||||
NMSettingConnection *s_con = nm_connection_get_setting_connection(con);
|
||||
GError *local = NULL;
|
||||
const char *port_type = NULL;
|
||||
|
||||
nm_assert(s_con);
|
||||
|
||||
value = check_valid_name_toplevel(value, &port_type, &local);
|
||||
if (!value) {
|
||||
if (!allow_reset)
|
||||
@@ -4632,7 +4635,7 @@ set_connection_type(NmCli *nmc,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (port_type) {
|
||||
if (!nm_setting_connection_get_port_type(s_con) && port_type) {
|
||||
if (!set_property(nmc->client,
|
||||
con,
|
||||
NM_SETTING_CONNECTION_SETTING_NAME,
|
||||
|
Reference in New Issue
Block a user