mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 04:10:14 +01:00
core: fix nmcli device connect dummy0 to add-and-activate dummy profile
$ ip link add dd type dummy $ nmcli device DEVICE TYPE STATE CONNECTION ... dd dummy unmanaged -- $ nmcli device connect dd Error: Failed to add/activate new connection: A 'dummy' setting is required. There are two problems here. The first is that we don't pass the interface name to nm_utils_complete_generic(), but dummy devices require "connection.interface-name" set. As a consequence, nm_utils_complete_generic() fails to normalize the connection and there is no [dummy] setting. Which then results in a failure with complete_connection(). The important part of the fix is to set the interface name. Once we do that, nm_utils_complete_generic() should be able to add the [dummy] setting and the second part is not strictly necessary. Still, the job of complete_connection() is not to verify the profile but to create it with best effort. If a [dummy] setting is still missing, we should just add it. The caller will then again try to normalize/verify the connection, and that might then fail -- but this time not with the wrong error message about missing 'dummy' setting. https://bugzilla.redhat.com/show_bug.cgi?id=1763054
This commit is contained in:
parent
f9b43ed7d4
commit
a32d04f0bb
1 changed files with 3 additions and 6 deletions
|
|
@ -57,16 +57,13 @@ complete_connection(NMDevice * device,
|
|||
NULL,
|
||||
_("Dummy connection"),
|
||||
NULL,
|
||||
NULL,
|
||||
nm_device_get_ip_iface(device),
|
||||
TRUE);
|
||||
|
||||
s_dummy = nm_connection_get_setting_dummy(connection);
|
||||
if (!s_dummy) {
|
||||
g_set_error_literal(error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_CONNECTION,
|
||||
"A 'dummy' setting is required.");
|
||||
return FALSE;
|
||||
s_dummy = NM_SETTING_DUMMY(nm_setting_dummy_new());
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_dummy));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue