diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2013-11-14 13:35:50 +0100 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2013-11-14 13:53:44 +0100 |
commit | 9a019f1fb5b7d99a7d4ec7af89212402ea81793a (patch) | |
tree | 6021ecb485d46982da8cceaf1722ce2064fbfb84 | |
parent | 2a2af5825a6db62e7a88bb249cf7876551ed7fa3 (diff) | |
download | NetworkManager-9a019f1fb5b7d99a7d4ec7af89212402ea81793a.tar.gz |
device: bind the generated loopback connection to 'lo' interface
It is useful to bind the loopack connection to the loopback interface,
and it also allows activating it.
$ nmcli con up lo
Else "Error: no device found for connection 'lo'" is returned, because
connection_compatible() in libnm-glib/nm-device-generic.c wants the
connection to have an interface-name set.
-rw-r--r-- | src/devices/nm-device.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 1a0bcdca09..7b939ac508 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -1681,6 +1681,12 @@ nm_device_generate_connection (NMDevice *device) g_object_set (s_con, NM_SETTING_CONNECTION_TYPE, klass->connection_type, NULL); nm_connection_add_setting (connection, s_con); + /* Bind loopback connection to 'lo' device */ + if (nm_platform_link_get_type (ifindex) == NM_LINK_TYPE_LOOPBACK) + g_object_set (s_con, + NM_SETTING_CONNECTION_INTERFACE_NAME, ifname, + NULL); + /* If the device is a slave, update various slave settings */ if (ifindex) master_ifindex = nm_platform_link_get_master (ifindex); |