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