diff --git a/ChangeLog b/ChangeLog index 9ba46ceb5..085c6d387 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-01-18 Dan Williams + + * 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 * system-settings/plugins/ifcfg/parser.c diff --git a/src/nm-device-802-11-wireless.c b/src/nm-device-802-11-wireless.c index a6609df70..ac7e3701b 100644 --- a/src/nm-device-802-11-wireless.c +++ b/src/nm-device-802-11-wireless.c @@ -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); diff --git a/src/nm-device-802-3-ethernet.c b/src/nm-device-802-3-ethernet.c index 80d684d8a..98759e2a3 100644 --- a/src/nm-device-802-3-ethernet.c +++ b/src/nm-device-802-3-ethernet.c @@ -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;