mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 08:40:09 +01:00
cli: fail nmcli connection up $PROFILE ifname $DEVICE for non-existing virtual device
$ nmcli connection add type dummy con-name x autoconnect no ipv4.method disabled ipv6.method disabled ifname d0 $ mcli connection up x ifname bogus Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/12) This is not right. A non-existing ifname argument was simply ignored and nmcli would tell NetworkManager to activate the profile (on any device). Instead, if the user specifies a device argument, also for a virtual type, it must exist. Note that usually for virtual devices (like 'dummy'), the device in fact does not exist, so passing `ifname` is likely to fail. If the device already exists, then the command is no going to work as expected, with $ mcli connection up x ifname d0 succeeding, while $ mcli connection up x ifname d1 fails (as intended) with Error: device 'd1' not compatible with connection 'x': The interface names of the device and the connection didn't match..
This commit is contained in:
parent
bb3c93bfd4
commit
d0349f17b7
1 changed files with 1 additions and 2 deletions
|
|
@ -2844,8 +2844,7 @@ nmc_activate_connection(NmCli * nmc,
|
|||
&spec_object,
|
||||
&local);
|
||||
|
||||
/* Virtual connection may not have their interfaces created yet */
|
||||
if (!device_found && !nm_connection_is_virtual(connection)) {
|
||||
if (!device_found) {
|
||||
g_set_error(error, NMCLI_ERROR, NMC_RESULT_ERROR_CON_ACTIVATION, "%s", local->message);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue