2005-12-08 Robert Love <rml@novell.com>

* include/NetworkManager.h: add WPA capabilities constants
	* src/NetworkManagerDevice.c: detect if wireless devices support WPA
	  or WPA2 and add the capabilities bits as appropriate.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1150 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Robert Love 2005-12-08 21:48:41 +00:00 committed by Robert Love
parent c521bf2e07
commit 9674539f15
3 changed files with 42 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2005-12-08 Robert Love <rml@novell.com>
* include/NetworkManager.h: add WPA capabilities constants
* src/NetworkManagerDevice.c: detect if wireless devices support WPA
or WPA2 and add the capabilities bits as appropriate.
2005-12-08 Robert Love <rml@novell.com>
* initscript/SUSE/networkmanager-dispatcher.in: new initscript for

View file

@ -101,6 +101,8 @@ typedef enum NMEncKeyType
#define NM_DEVICE_CAP_NM_SUPPORTED 0x0001
#define NM_DEVICE_CAP_CARRIER_DETECT 0x0002
#define NM_DEVICE_CAP_WIRELESS_SCAN 0x0004
#define NM_DEVICE_CAP_WIRELESS_WPA 0x0008
#define NM_DEVICE_CAP_WIRELESS_WPA2 0x0010
/*

View file

@ -653,14 +653,46 @@ static guint32 nm_device_wireless_discover_capabilities (NMDevice *dev)
}
}
/* A test wireless device is a pro at WPA and WPA2 */
if (dev->test_device)
caps |= NM_DEVICE_CAP_WIRELESS_WPA | NM_DEVICE_CAP_WIRELESS_WPA2;
else
{
if ((sk = nm_dev_sock_open (dev, DEV_WIRELESS, __FUNCTION__, NULL)))
{
struct iw_range range;
struct iwreq wrq;
memset (&wrq, 0, sizeof (wrq));
strncpy (wrq.ifr_name, nm_device_get_iface (dev), IFNAMSIZ);
wrq.u.data.pointer = (caddr_t) &range;
wrq.u.data.length = sizeof (struct iw_range);
if (ioctl (nm_dev_sock_get_fd (sk), SIOCGIWRANGE, &wrq) >= 0)
{
if (range.enc_capa & IW_ENC_CAPA_WPA)
caps |= NM_DEVICE_CAP_WIRELESS_WPA;
if (range.enc_capa & IW_ENC_CAPA_WPA2)
caps |= NM_DEVICE_CAP_WIRELESS_WPA2;
}
/*
* FIXME: Most drivers do not yet support enc_capa, so we should
* try another method here if neither WPA cap was set.
*/
nm_dev_sock_close (sk);
}
}
return caps;
}
/*
* nm_device_wireless_discover_capabilities
* nm_device_wired_discover_capabilities
*
* Figure out wireless-specific capabilities
* Figure out wired-specific capabilities
*
*/
static guint32 nm_device_wired_discover_capabilities (NMDevice *dev)