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

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



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3230 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2008-01-10 23:15:46 +00:00
parent 2497bea1d2
commit f9d6d60e4c
4 changed files with 65 additions and 6 deletions

View file

@ -1,3 +1,21 @@
2008-01-10 Dan Williams <dcbw@redhat.com>
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 <dcbw@redhat.com>
* src/nm-device.c

View file

@ -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 *) &range;
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;
}

View file

@ -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,

View file

@ -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,