Commit 8b52e506 authored by Beniamino Galvani's avatar Beniamino Galvani

cli: fix addition of slave connection types

 $ nmcli connection add type bond-slave ifname aoeu master aoeu
 Error: bad connection type: 'bond-slave' not among [802-1x, adsl,
 bluetooth, bond, bridge, bridge-port, cdma, connection, dcb, dummy,
 generic, gsm, infiniband, ipv4, ipv6, ip-tunnel, macsec, macvlan,
 802-11-olpc-mesh (olpc-mesh), ppp, pppoe, proxy, serial, team,
 team-port, tun, user, vlan, vpn, vxlan, wimax, 802-3-ethernet
 (ethernet), 802-11-wireless (wifi), 802-11-wireless-security
 (wifi-sec)].

Fixes: d3281799
parent 8acb2b11
......@@ -3703,14 +3703,6 @@ set_connection_type (NmCli *nmc, NMConnection *con, const OptionInfo *option, co
GError *local = NULL;
const gchar *master[] = { "master", NULL };
value = check_valid_name_toplevel (value, &local);
if (!value) {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("Error: bad connection type: %s."), local->message);
g_clear_error (&local);
return FALSE;
}
if (g_strcmp0 (value, "bond-slave") == 0) {
value = NM_SETTING_WIRED_SETTING_NAME;
if (!set_property (con, NM_SETTING_CONNECTION_SETTING_NAME,
......@@ -3735,6 +3727,14 @@ set_connection_type (NmCli *nmc, NMConnection *con, const OptionInfo *option, co
return FALSE;
}
enable_options (NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_MASTER, master);
} else {
value = check_valid_name_toplevel (value, &local);
if (!value) {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("Error: bad connection type: %s"), local->message);
g_clear_error (&local);
return FALSE;
}
}
/* ifname is mandatory for all connection types except virtual ones (bond, team, bridge, vlan) */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment