[PATCH V2] ethernet: fix match_ethernet_connection()
- From: Weiping Pan <wpan redhat com>
- To: networkmanager-list gnome org
- Cc: tgraf redhat com
- Subject: [PATCH V2] ethernet: fix match_ethernet_connection()
- Date: Thu, 23 Feb 2012 15:25:02 +0800
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.
Changelog:
V2: fix definition of iface
Signed-off-by: Weiping Pan <wpan redhat com>
---
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..fa89f8c 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;
+ const char *driver;
+
+ driver = nm_device_get_driver (device);
+ if (!strcmp (driver, "8021q") || !strcmp (driver, "bonding")) {
+ const char *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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]