commit 46eee484f9a3(core: fix matching VLAN connections to interfaces) can not
work, and the problem is the same.

Example of problem:
Assume there are two connections, one is "Auto eth0" and the other is
"Vlan43", and the "Auto eth0" is the first connection on the list.
Assume we want to find a correct connection for vlan43 device first,
and match_ethernet_connection() will return TRUE, so
real_get_best_auto_connection() will return connection "Auto eth0" .

The logic of function match_ethernet_connection() is confused,
the goal of this function is to check whether the connection will match the 
device,
not that whether the device will match the connection.
So we should first check the virtual interface name of the connection,
and if mismatch, we can quit as soon as possible.

Signed-off-by: Weiping Pan <[email protected]>
---
 src/nm-device-ethernet.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/nm-device-ethernet.c b/src/nm-device-ethernet.c
index f39fd66..7fe4964 100644
--- a/src/nm-device-ethernet.c
+++ b/src/nm-device-ethernet.c
@@ -597,6 +597,14 @@ match_ethernet_connection (NMDevice *device, NMConnection 
*connection,
        NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
        NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
        NMSettingWired *s_wired;
+       char *driver;
+
+       driver = nm_device_get_driver (device);
+       if (!strcmp (driver, "8021q") || !strcmp (driver, "bonding")) {
+               iface = nm_connection_get_virtual_iface_name (connection);
+               if (!iface || strcmp (nm_device_get_iface (device), iface))
+                       return FALSE;
+       }
 
        s_wired = nm_connection_get_setting_wired (connection);
 
-- 
1.7.7.6

_______________________________________________
networkmanager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to