Re: [PATCH V2] ethernet: fix match_ethernet_connection()
- From: Dan Williams <dcbw redhat com>
- To: Weiping Pan <wpan redhat com>
- Cc: tgraf redhat com, networkmanager-list gnome org
- Subject: Re: [PATCH V2] ethernet: fix match_ethernet_connection()
- Date: Fri, 24 Feb 2012 14:30:27 -0600
On Thu, 2012-02-23 at 15:25 +0800, Weiping Pan wrote:
> 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);
I'm actually moving VLAN interfaces to a separate device class in the
'vlan-cleanups' branch, which in the process removes anything VLAN
related from nm-device-ethernet.c... Thus this hunk won't be required
there.
Dan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]