[network-manager-applet/NMA_0_8] applet: consolidate manufacturer default SSID lists
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/NMA_0_8] applet: consolidate manufacturer default SSID lists
- Date: Thu, 24 Feb 2011 22:44:53 +0000 (UTC)
commit df0ab1add9b4f272751f4a0f9201532fe95c0f86
Author: Chris Aillon <caillon redhat com>
Date: Wed Feb 23 12:43:01 2011 -0600
applet: consolidate manufacturer default SSID lists
src/applet-device-wifi.c | 46 ++++++++++++++++++++++------------------------
1 files changed, 22 insertions(+), 24 deletions(-)
---
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index 439994d..ca0157a 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -157,31 +157,42 @@ wireless_menu_item_info_destroy (gpointer data)
g_slice_free (WirelessMenuItemInfo, data);
}
-static const char * default_ssid_list[] = {
+/*
+ * NOTE: this list should *not* contain networks that you would like to
+ * automatically roam to like "Starbucks" or "AT&T" or "T-Mobile HotSpot".
+ */
+static const char *manf_default_ssids[] = {
"linksys",
"linksys-a",
"linksys-g",
"default",
"belkin54g",
"NETGEAR",
+ "o2DSL",
+ "WLAN",
+ "ALICE-WLAN",
NULL
};
static gboolean
-is_manufacturer_default_ssid (const GByteArray *ssid)
+is_ssid_in_list (const GByteArray *ssid, const char **list)
{
- const char **default_ssid = default_ssid_list;
-
- while (*default_ssid) {
- if (ssid->len == strlen (*default_ssid)) {
- if (!memcmp (*default_ssid, ssid->data, ssid->len))
+ while (*list) {
+ if (ssid->len == strlen (*list)) {
+ if (!memcmp (*list, ssid->data, ssid->len))
return TRUE;
}
- default_ssid++;
+ list++;
}
return FALSE;
}
+static gboolean
+is_manufacturer_default_ssid (const GByteArray *ssid)
+{
+ return is_ssid_in_list (ssid, manf_default_ssids);
+}
+
static void
add_ciphers_from_flags (NMSettingWirelessSecurity *sec,
guint32 flags,
@@ -324,31 +335,17 @@ none:
}
static void
-check_common_ssid (NMAccessPoint *ap, NMSettingWireless *s_wifi)
+clamp_ap_to_bssid (NMAccessPoint *ap, NMSettingWireless *s_wifi)
{
const char *str_bssid;
struct ether_addr *eth_addr;
- const GByteArray *ssid;
GByteArray *bssid;
- const char *known[] = { "linksys", "o2DSL", "NETGEAR", "WLAN", "ALICE-WLAN" };
- guint i;
/* For a certain list of known ESSIDs which are commonly preset by ISPs
* and manufacturers and often unchanged by users, lock the connection
* to the BSSID so that we don't try to auto-connect to your grandma's
* neighbor's WiFi.
- *
- * NOTE: this list should *not* contain networks that you would like to
- * automatically roam to like "Starbucks" or "AT&T" or "T-Mobile HotSpot".
*/
- ssid = nm_access_point_get_ssid (ap);
- for (i = 0; i < G_N_ELEMENTS (known); i++) {
- if ( ssid->len == strlen (known[i])
- && memcmp (ssid->data, known[i], ssid->len) == 0)
- break;
- }
- if (i == G_N_ELEMENTS (known))
- return;
str_bssid = nm_access_point_get_hw_address (ap);
if (str_bssid) {
@@ -400,7 +397,8 @@ wireless_new_auto_connection (NMDevice *device,
else if (mode == NM_802_11_MODE_INFRA) {
g_object_set (s_wireless, NM_SETTING_WIRELESS_MODE, "infrastructure", NULL);
/* Lock connection to this AP if it's a manufacturer-default SSID */
- check_common_ssid (info->ap, s_wireless);
+ if (is_manufacturer_default_ssid (ap_ssid))
+ clamp_ap_to_bssid (info->ap, s_wireless);
} else
g_assert_not_reached ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]