2008-01-18 Dan Williams <dcbw@redhat.com>

* src/nm-device-802-3-ethernet.c
		- (find_best_connection): check MAC address too
		- (real_get_best_connection): let autoconnect=True connections activate
			for devices that don't have carrier detection

	* src/nm-device-802-11-wireless.c
		- (find_best_connection): check MAC address too



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3248 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2008-01-18 17:04:46 +00:00
parent 35d98b7326
commit 0f5c20f9d9
3 changed files with 36 additions and 27 deletions

View file

@ -1,3 +1,13 @@
2008-01-18 Dan Williams <dcbw@redhat.com>
* src/nm-device-802-3-ethernet.c
- (find_best_connection): check MAC address too
- (real_get_best_connection): let autoconnect=True connections activate
for devices that don't have carrier detection
* src/nm-device-802-11-wireless.c
- (find_best_connection): check MAC address too
2008-01-18 Dan Williams <dcbw@redhat.com>
* system-settings/plugins/ifcfg/parser.c

View file

@ -845,19 +845,20 @@ real_check_connection_conflicts (NMDevice *device,
}
typedef struct BestConnectionInfo {
NMDevice80211Wireless * self;
NMConnection * found;
NMAccessPoint * found_ap;
NMDevice80211Wireless *self;
NMConnection *found;
NMAccessPoint *found_ap;
} BestConnectionInfo;
static void
find_best_connection (gpointer data, gpointer user_data)
{
BestConnectionInfo * info = (BestConnectionInfo *) user_data;
BestConnectionInfo *info = (BestConnectionInfo *) user_data;
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (info->self);
NMConnection *connection = NM_CONNECTION (data);
NMSettingConnection * s_con;
NMSettingWireless * s_wireless;
GSList * elt;
NMSettingConnection *s_con;
NMSettingWireless *s_wireless;
GSList *elt;
if (info->found)
return;
@ -871,8 +872,12 @@ find_best_connection (gpointer data, gpointer user_data)
return;
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
if (s_wireless == NULL)
return;
g_return_if_fail (s_wireless != NULL);
if (s_wireless->mac_address) {
if (memcmp (s_wireless->mac_address->data, priv->hw_addr.ether_addr_octet, ETH_ALEN))
return;
}
for (elt = info->self->priv->ap_list; elt; elt = g_slist_next (elt)) {
NMAccessPoint *ap = NM_AP (elt->data);

View file

@ -342,17 +342,18 @@ real_can_interrupt_activation (NMDevice *dev)
}
typedef struct BestConnectionInfo {
NMDevice8023Ethernet * self;
NMConnection * found;
NMDevice8023Ethernet *self;
NMConnection *found;
} BestConnectionInfo;
static void
find_best_connection (gpointer data, gpointer user_data)
{
BestConnectionInfo * info = (BestConnectionInfo *) user_data;
BestConnectionInfo *info = (BestConnectionInfo *) user_data;
NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (info->self);
NMConnection *connection = NM_CONNECTION (data);
NMSettingConnection * s_con;
NMSettingWired * s_wired;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
if (info->found)
return;
@ -366,8 +367,12 @@ find_best_connection (gpointer data, gpointer user_data)
return;
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
if (s_wired == NULL)
return;
g_return_if_fail (s_wired != NULL);
if (s_wired->mac_address) {
if (memcmp (s_wired->mac_address->data, priv->hw_addr.ether_addr_octet, ETH_ALEN))
return;
}
info->found = connection;
}
@ -379,17 +384,6 @@ real_get_best_connection (NMDevice *dev,
{
NMDevice8023Ethernet * self = NM_DEVICE_802_3_ETHERNET (dev);
BestConnectionInfo find_info;
guint32 caps;
caps = nm_device_get_capabilities (dev);
/* FIXME: for now, non-carrier-detect devices don't have a best connection,
* the user needs to pick one. In the near-future, we want to instead
* honor the first 'autoconnect':True connection we find that applies
* to this device.
*/
if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT))
return NULL;
memset (&find_info, 0, sizeof (BestConnectionInfo));
find_info.self = self;