From 8b52e506a7bc9a3d57e65b3cf7ed78346176af1f Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 13 Apr 2017 08:43:09 +0200 Subject: [PATCH] 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: d32817999c2bc8da33e99b48671b068ad870a4e0 --- clients/cli/connections.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/clients/cli/connections.c b/clients/cli/connections.c index cdc20578aa..cdd19e907d 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -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) */