diff --git a/ChangeLog b/ChangeLog index ccb4574318..214001ccda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2008-01-10 Dan Williams + + Fix gnome.org #464215. Requires the kernel patch titled + "Introduce WEXT scan capabilities" but will handle the patch not being + present, you'll just continue to have problems with hidden SSIDs when + using mac80211-based drivers. + + * src/supplicant-manager/nm-supplicant-config.h + src/supplicant-manager/nm-supplicant-config.c + - (nm_supplicant_config_add_setting_wireless): new parameter to indicate + whether the driver supports SSID scans or not. If it does, and if + the AP is hidden, use ap_scan=1 instead of ap_scan=2 + + * src/nm-device-802-11-wireless.c + - (constructor): check whether or not the driver supports SSID scans + - (build_supplicant_config): pass driver SSID scan capability when + building the wireless bits of the supplicant config + 2008-01-09 Dan Williams * src/nm-device.c diff --git a/src/nm-device-802-11-wireless.c b/src/nm-device-802-11-wireless.c index fc5b4e92ad..68c8a22301 100644 --- a/src/nm-device-802-11-wireless.c +++ b/src/nm-device-802-11-wireless.c @@ -142,6 +142,7 @@ struct _NMDevice80211WirelessPrivate /* Static options from driver */ guint8 we_version; guint32 capabilities; + gboolean has_scan_capa_ssid; }; @@ -370,6 +371,27 @@ static guint32 iw_freq_to_uint32 (struct iw_freq *freq) return (guint32) (iw_freq2float (freq) / 1000000); } + +/* Until a new wireless-tools comes out that has the defs and the structure, + * need to copy them here. + */ +/* Scan capability flags - in (struct iw_range *)->scan_capa */ +#define NM_IW_SCAN_CAPA_NONE 0x00 +#define NM_IW_SCAN_CAPA_ESSID 0x01 + +struct iw_range_with_scan_capa +{ + guint32 throughput; + guint32 min_nwid; + guint32 max_nwid; + guint16 old_num_channels; + guint8 old_num_frequency; + + guint8 scan_capa; +/* don't need the rest... */ +}; + + static GObject* constructor (GType type, guint n_construct_params, @@ -382,6 +404,7 @@ constructor (GType type, const char *iface; NMSock *sk = NULL; struct iw_range range; + struct iw_range_with_scan_capa *scan_capa_range; struct iwreq wrq; int i; @@ -423,6 +446,14 @@ constructor (GType type, priv->we_version = range.we_version_compiled; + /* Check for the ability to scan specific SSIDs. Until the scan_capa + * field gets added to wireless-tools, need to work around that by casting + * to the custom structure. + */ + scan_capa_range = (struct iw_range_with_scan_capa *) ⦥ + if (scan_capa_range->scan_capa & NM_IW_SCAN_CAPA_ESSID) + priv->has_scan_capa_ssid = TRUE; + /* 802.11 wireless-specific capabilities */ priv->capabilities = get_wireless_capabilities (self, &range, wrq.u.data.length); @@ -2404,8 +2435,9 @@ build_supplicant_config (NMDevice80211Wireless *self, NMConnection *connection, NMAccessPoint *ap) { - NMSupplicantConfig * config = NULL; - NMSettingWireless * s_wireless; + NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self); + NMSupplicantConfig *config = NULL; + NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wireless_sec; guint32 adhoc_freq = 0; @@ -2444,7 +2476,8 @@ build_supplicant_config (NMDevice80211Wireless *self, if (!nm_supplicant_config_add_setting_wireless (config, s_wireless, nm_ap_get_broadcast (ap), - adhoc_freq)) { + adhoc_freq, + priv->has_scan_capa_ssid)) { nm_warning ("Couldn't add 802-11-wireless setting to supplicant config."); goto error; } diff --git a/src/supplicant-manager/nm-supplicant-config.c b/src/supplicant-manager/nm-supplicant-config.c index 7090c3a22b..4688a57d82 100644 --- a/src/supplicant-manager/nm-supplicant-config.c +++ b/src/supplicant-manager/nm-supplicant-config.c @@ -327,7 +327,8 @@ gboolean nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, NMSettingWireless * setting, gboolean is_broadcast, - guint32 adhoc_freq) + guint32 adhoc_freq, + gboolean has_scan_capa_ssid) { NMSupplicantConfigPrivate *priv; gboolean is_adhoc; @@ -338,8 +339,14 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE (self); is_adhoc = (setting->mode && !strcmp (setting->mode, "adhoc")) ? TRUE : FALSE; - if (!is_broadcast || is_adhoc) + if (is_adhoc) priv->ap_scan = 2; + else if (is_broadcast == FALSE) { + /* drivers that support scanning specific SSIDs should use + * ap_scan=1, while those that do not should use ap_scan=2. + */ + priv->ap_scan = has_scan_capa_ssid ? 1 : 2; + } if (!nm_supplicant_config_add_option (self, "ssid", (char *) setting->ssid->data, diff --git a/src/supplicant-manager/nm-supplicant-config.h b/src/supplicant-manager/nm-supplicant-config.h index ee7ba4e3da..261161773a 100644 --- a/src/supplicant-manager/nm-supplicant-config.h +++ b/src/supplicant-manager/nm-supplicant-config.h @@ -68,7 +68,8 @@ GHashTable *nm_supplicant_config_get_blobs (NMSupplicantConfig * self); gboolean nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, NMSettingWireless * setting, gboolean is_broadcast, - guint32 adhoc_freq); + guint32 adhoc_freq, + gboolean has_scan_capa_ssid); gboolean nm_supplicant_config_add_setting_wireless_security (NMSupplicantConfig * self, NMSettingWirelessSecurity * setting,