Commit 7a8f33aa authored by Dan Williams's avatar Dan Williams
Browse files

2007-08-28 Dan Williams <dcbw@redhat.com>

	Remove NMAPSecurity objects, they are replaced with flags on the APs for
	each AP's capabilities, and by NMConnection/NMSettings objects for user
	defined connections.

	* include/NetworkManager.h
		- Redefine 802.11 security properties.  There are now device capabilities
			and AP flags and AP security flags.  It was way to unclear before.

	* src/Makefile.am
	  src/nm-ap-security-leap.h
	  src/nm-ap-security-leap.c
	  src/nm-ap-security-wpa-eap.c
	  src/nm-ap-security-wpa-eap.h
	  src/nm-ap-security-private.h
	  src/nm-ap-security-wpa-psk.c
	  src/nm-ap-security-wpa-psk.h
	  src/nm-ap-security-wep.c
	  src/nm-ap-security-wep.h
	  src/nm-ap-security.c
	  src/nm-ap-security.h
		- Removed, to be replaced with NMConnection/NMSettings objects

	* src/nm-dbus-nmi.c
	  src/nm-dbus-nmi.h
		- Removed, to be replaced by code that talks to the new info daemon
			interface and gets NMConnection/NMSettings objects

	* src/backends/NetworkManagerSuSE.c
		- Remove usage of NMAPSecurity; should be replaced by a system-level
			info-daemon that does the same thing but talks the new info-daemon
			D-Bus interface

	* src/NetworkManagerAP.h
	  src/NetworkManagerAP.c
	  src/NetworkManagerAPList.c
	  libnm-glib/libnm-glib-test.c
		- Remove usage of NMAPSecurity objects and adjust to new flags for
			WPA/RSN

	* libnm-glib/nm-access-point.c
	  libnm-glib/nm-access-point.h
	  introspection/nm-access-point.xml
	  test/nm-tool.c
		- Adjust to new flags for AP security

	* utils/nm-utils.c
	  utils/nm-utils.h
	  src/vpn-manager/nm-dbus-vpn.c
		- Remove D-Bus pending call stuff from nm-utils and put it in the VPN
			stuff which is the only place it's used

	* src/nm-device-interface.c
	  src/nm-device-interface.h
	  introspection/nm-device.xml
	  src/nm-activation-request.c
	  src/nm-activation-request.h
	  src/nm-device.c
		- Add a new 'specific_object' argument that hints to NM what actual
			AP or other device-specific thing the connection should apply to.
			NMConnection objects can apply to more than one actual device/AP.

	* libnm-util/nm-connection.c
	* libnm-util/nm-connection.h
		- Add 'have_secrets" call stubs

	* libnm-util/cipher.h
		- Move NM_AUTH_TYPE_* defines here for now

	* src/nm-device-802-11-wireless.c
		- Remove usage of NMAPSecurity, to be replaced with NMConnection/
			NMSettings objects

	* src/NetworkManagerDbus.c
	* src/NetworkManagerPolicy.c
		- Remove usage of update_allowed_networks, should be pushing data in
			a different manner



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2738 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 478aa57f
2007-08-28 Dan Williams <dcbw@redhat.com>
Remove NMAPSecurity objects, they are replaced with flags on the APs for
each AP's capabilities, and by NMConnection/NMSettings objects for user
defined connections.
* include/NetworkManager.h
- Redefine 802.11 security properties. There are now device capabilities
and AP flags and AP security flags. It was way to unclear before.
* src/Makefile.am
src/nm-ap-security-leap.h
src/nm-ap-security-leap.c
src/nm-ap-security-wpa-eap.c
src/nm-ap-security-wpa-eap.h
src/nm-ap-security-private.h
src/nm-ap-security-wpa-psk.c
src/nm-ap-security-wpa-psk.h
src/nm-ap-security-wep.c
src/nm-ap-security-wep.h
src/nm-ap-security.c
src/nm-ap-security.h
- Removed, to be replaced with NMConnection/NMSettings objects
* src/nm-dbus-nmi.c
src/nm-dbus-nmi.h
- Removed, to be replaced by code that talks to the new info daemon
interface and gets NMConnection/NMSettings objects
* src/backends/NetworkManagerSuSE.c
- Remove usage of NMAPSecurity; should be replaced by a system-level
info-daemon that does the same thing but talks the new info-daemon
D-Bus interface
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
src/NetworkManagerAPList.c
libnm-glib/libnm-glib-test.c
- Remove usage of NMAPSecurity objects and adjust to new flags for
WPA/RSN
* libnm-glib/nm-access-point.c
libnm-glib/nm-access-point.h
introspection/nm-access-point.xml
test/nm-tool.c
- Adjust to new flags for AP security
* utils/nm-utils.c
utils/nm-utils.h
src/vpn-manager/nm-dbus-vpn.c
- Remove D-Bus pending call stuff from nm-utils and put it in the VPN
stuff which is the only place it's used
* src/nm-device-interface.c
src/nm-device-interface.h
introspection/nm-device.xml
src/nm-activation-request.c
src/nm-activation-request.h
src/nm-device.c
- Add a new 'specific_object' argument that hints to NM what actual
AP or other device-specific thing the connection should apply to.
NMConnection objects can apply to more than one actual device/AP.
* libnm-util/nm-connection.c
* libnm-util/nm-connection.h
- Add 'have_secrets" call stubs
* libnm-util/cipher.h
- Move NM_AUTH_TYPE_* defines here for now
* src/nm-device-802-11-wireless.c
- Remove usage of NMAPSecurity, to be replaced with NMConnection/
NMSettings objects
* src/NetworkManagerDbus.c
* src/NetworkManagerPolicy.c
- Remove usage of update_allowed_networks, should be pushing data in
a different manner
2007-08-27 Tambet Ingo <tambet@gmail.com>
* src/nm-manager.c (impl_manager_get_devices): Duplicate the device path,
......
......@@ -79,47 +79,42 @@ typedef enum NMDeviceType
#define NM_DEVICE_CAP_CARRIER_DETECT 0x00000002
/* 802.11 wireless-specific device capability bits */
#define NM_802_11_CAP_NONE 0x00000000
#define NM_802_11_CAP_PROTO_NONE 0x00000001
#define NM_802_11_CAP_PROTO_WEP 0x00000002
#define NM_802_11_CAP_PROTO_WPA 0x00000004
#define NM_802_11_CAP_PROTO_WPA2 0x00000008
#define NM_802_11_CAP_RESERVED1 0x00000010
#define NM_802_11_CAP_RESERVED2 0x00000020
#define NM_802_11_CAP_KEY_MGMT_PSK 0x00000040
#define NM_802_11_CAP_KEY_MGMT_802_1X 0x00000080
#define NM_802_11_CAP_RESERVED3 0x00000100
#define NM_802_11_CAP_RESERVED4 0x00000200
#define NM_802_11_CAP_RESERVED5 0x00000400
#define NM_802_11_CAP_RESERVED6 0x00000800
#define NM_802_11_CAP_CIPHER_WEP40 0x00001000
#define NM_802_11_CAP_CIPHER_WEP104 0x00002000
#define NM_802_11_CAP_CIPHER_TKIP 0x00004000
#define NM_802_11_CAP_CIPHER_CCMP 0x00008000
/* 802.11 wireless device-specific capabilities */
#define NM_802_11_DEVICE_CAP_NONE 0x00000000
#define NM_802_11_DEVICE_CAP_CIPHER_WEP40 0x00000001
#define NM_802_11_DEVICE_CAP_CIPHER_WEP104 0x00000002
#define NM_802_11_DEVICE_CAP_CIPHER_TKIP 0x00000004
#define NM_802_11_DEVICE_CAP_CIPHER_CCMP 0x00000008
#define NM_802_11_DEVICE_CAP_WPA 0x00000010
#define NM_802_11_DEVICE_CAP_RSN 0x00000020
/*
* NM-supported Authentication Methods
* 802.11 Access Point flags
*
*/
#define NM_AUTH_TYPE_WPA_PSK_AUTO 0x00000000
#define NM_AUTH_TYPE_NONE 0x00000001
#define NM_AUTH_TYPE_WEP40 0x00000002
#define NM_AUTH_TYPE_WPA_PSK_TKIP 0x00000004
#define NM_AUTH_TYPE_WPA_PSK_CCMP 0x00000008
#define NM_AUTH_TYPE_WEP104 0x00000010
#define NM_AUTH_TYPE_WPA_EAP 0x00000020
#define NM_AUTH_TYPE_LEAP 0x00000040
#define NM_802_11_AP_FLAGS_NONE 0x00000000
#define NM_802_11_AP_FLAGS_PRIVACY 0x00000001
/*
* EAP Methods
* 802.11 Access Point security flags
*
* These describe the current security requirements of the BSSID as extracted
* from various pieces of beacon information, like beacon flags and various
* information elements.
*/
#define NM_EAP_METHOD_MD5 0x00000001 /* EAP-MD5 */
#define NM_EAP_METHOD_MSCHAP 0x00000002 /* EAP-MSCHAPv2 */
#define NM_EAP_METHOD_OTP 0x00000004 /* EAP-OTP */
#define NM_EAP_METHOD_GTC 0x00000008 /* EAP-GTC */
#define NM_EAP_METHOD_PEAP 0x00000010 /* EAP-PEAP */
#define NM_EAP_METHOD_TLS 0x00000020 /* EAP-TLS */
#define NM_EAP_METHOD_TTLS 0x00000040 /* EAP-TTLS */
#define NM_802_11_AP_SEC_NONE 0x00000000
#define NM_802_11_AP_SEC_PAIR_WEP40 0x00000001
#define NM_802_11_AP_SEC_PAIR_WEP104 0x00000002
#define NM_802_11_AP_SEC_PAIR_TKIP 0x00000004
#define NM_802_11_AP_SEC_PAIR_CCMP 0x00000008
#define NM_802_11_AP_SEC_GROUP_WEP40 0x00000010
#define NM_802_11_AP_SEC_GROUP_WEP104 0x00000020
#define NM_802_11_AP_SEC_GROUP_TKIP 0x00000040
#define NM_802_11_AP_SEC_GROUP_CCMP 0x00000080
#define NM_802_11_AP_SEC_KEY_MGMT_PSK 0x00000100
#define NM_802_11_AP_SEC_KEY_MGMT_802_1X 0x00000200
/*
* Wireless network types
......
......@@ -2,8 +2,9 @@
<node name="/">
<interface name="org.freedesktop.NetworkManager.AccessPoint">
<property name="Capabilities" type="u" access="read"/>
<property name="Encrypted" type="b" access="read"/>
<property name="Flags" type="u" access="read"/>
<property name="WPAFlags" type="u" access="read"/>
<property name="RSNFlags" type="u" access="read"/>
<property name="Ssid" type="ay" access="read"/>
<property name="Frequency" type="d" access="read"/>
<property name="HwAddress" type="s" access="read"/>
......
......@@ -4,7 +4,7 @@
<interface name="org.freedesktop.NetworkManager.Device">
<method name="Activate">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_activate"/>
<arg name="connection" type="a{sa{sv}}" direction="in"/>
<arg name="connection" type="a{sa{sv}}o" direction="in"/>
</method>
<method name="Deactivate">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_deactivate"/>
......
......@@ -177,8 +177,9 @@ dump_access_point (NMAccessPoint *ap)
g_print ("\tMAC Address: %s\n", str);
g_free (str);
g_print ("\tCapabilities: %d\n", nm_access_point_get_capabilities (ap));
g_print ("\tEncrypted: %d\n", nm_access_point_is_encrypted (ap));
g_print ("\tFlags: 0x%X\n", nm_access_point_get_flags (ap));
g_print ("\tWPA Flags: 0x%X\n", nm_access_point_get_wpa_flags (ap));
g_print ("\tRSN Flags: 0x%X\n", nm_access_point_get_rsn_flags (ap));
g_print ("\tFrequency: %f\n", nm_access_point_get_frequency (ap));
g_print ("\tMode: %d\n", nm_access_point_get_mode (ap));
......
......@@ -102,19 +102,27 @@ strength_changed_proxy (NMAccessPoint *ap, guchar strength)
}
guint32
nm_access_point_get_capabilities (NMAccessPoint *ap)
nm_access_point_get_flags (NMAccessPoint *ap)
{
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), 0);
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NM_802_11_AP_FLAGS_NONE);
return nm_object_get_uint_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "Capabilities");
return nm_object_get_uint_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "Flags");
}
gboolean
nm_access_point_is_encrypted (NMAccessPoint *ap)
guint32
nm_access_point_get_wpa_flags (NMAccessPoint *ap)
{
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NM_802_11_AP_SEC_NONE);
return nm_object_get_uint_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "WPAFlags");
}
guint32
nm_access_point_get_rsn_flags (NMAccessPoint *ap)
{
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), FALSE);
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NM_802_11_AP_SEC_NONE);
return nm_object_get_boolean_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "Encrypted");
return nm_object_get_uint_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "RSNFlags");
}
GByteArray *
......
......@@ -29,8 +29,9 @@ GType nm_access_point_get_type (void);
NMAccessPoint *nm_access_point_new (DBusGConnection *connection, const char *path);
guint32 nm_access_point_get_capabilities (NMAccessPoint *ap);
gboolean nm_access_point_is_encrypted (NMAccessPoint *ap);
guint32 nm_access_point_get_flags (NMAccessPoint *ap);
guint32 nm_access_point_get_wpa_flags (NMAccessPoint *ap);
guint32 nm_access_point_get_rsn_flags (NMAccessPoint *ap);
GByteArray * nm_access_point_get_ssid (NMAccessPoint *ap);
gdouble nm_access_point_get_frequency (NMAccessPoint *ap);
char * nm_access_point_get_hw_address (NMAccessPoint *ap);
......
......@@ -28,6 +28,30 @@
extern "C" {
#endif
/*
* NM-supported Authentication Methods
*/
#define NM_AUTH_TYPE_WPA_PSK_AUTO 0x00000000
#define NM_AUTH_TYPE_NONE 0x00000001
#define NM_AUTH_TYPE_WEP40 0x00000002
#define NM_AUTH_TYPE_WPA_PSK_TKIP 0x00000004
#define NM_AUTH_TYPE_WPA_PSK_CCMP 0x00000008
#define NM_AUTH_TYPE_WEP104 0x00000010
#define NM_AUTH_TYPE_WPA_EAP 0x00000020
#define NM_AUTH_TYPE_LEAP 0x00000040
/*
* EAP Methods
*/
#define NM_EAP_METHOD_MD5 0x00000001 /* EAP-MD5 */
#define NM_EAP_METHOD_MSCHAP 0x00000002 /* EAP-MSCHAPv2 */
#define NM_EAP_METHOD_OTP 0x00000004 /* EAP-OTP */
#define NM_EAP_METHOD_GTC 0x00000008 /* EAP-GTC */
#define NM_EAP_METHOD_PEAP 0x00000010 /* EAP-PEAP */
#define NM_EAP_METHOD_TLS 0x00000020 /* EAP-TLS */
#define NM_EAP_METHOD_TTLS 0x00000040 /* EAP-TTLS */
typedef struct IEEE_802_11_Cipher IEEE_802_11_Cipher;
void ieee_802_11_cipher_ref (IEEE_802_11_Cipher *cipher);
......
......@@ -137,6 +137,15 @@ nm_connection_compare (NMConnection *connection, NMConnection *other)
return FALSE;
}
gboolean
nm_connection_have_secrets (NMConnection *connection)
{
/* FIXME: go through Settings objects and determine if there are any
* secrets required.
*/
return FALSE;
}
static void
add_one_setting_to_hash (gpointer key, gpointer data, gpointer user_data)
{
......
......@@ -21,6 +21,8 @@ NMSetting *nm_connection_get_setting (NMConnection *connection,
gboolean nm_connection_compare (NMConnection *connection,
NMConnection *other);
gboolean nm_connection_have_secrets (NMConnection *connection);
GHashTable *nm_connection_to_hash (NMConnection *connection);
void nm_connection_dump (NMConnection *connection);
void nm_connection_destroy (NMConnection *connection);
......
......@@ -34,8 +34,6 @@ NetworkManager_SOURCES = \
NetworkManagerDbusUtils.h \
nm-dbus-manager.h \
nm-dbus-manager.c \
nm-dbus-nmi.c \
nm-dbus-nmi.h \
nm-hal-manager.c \
nm-hal-manager.h \
nm-ip4-config.c \
......@@ -58,17 +56,6 @@ NetworkManager_SOURCES = \
nm-activation-request.h \
autoip.c \
autoip.h \
nm-ap-security.c \
nm-ap-security.h \
nm-ap-security-private.h \
nm-ap-security-wep.c \
nm-ap-security-wep.h \
nm-ap-security-wpa-eap.c \
nm-ap-security-wpa-eap.h \
nm-ap-security-wpa-psk.c \
nm-ap-security-wpa-psk.h \
nm-ap-security-leap.c \
nm-ap-security-leap.h \
nm-marshal-main.c \
kernel-types.h \
wpa.c \
......
......@@ -22,7 +22,6 @@
#include "NetworkManagerAP.h"
#include "NetworkManagerUtils.h"
#include "nm-utils.h"
#include "nm-ap-security.h"
#include "nm-dbus-manager.h"
#include <wireless.h>
#include "wpa.h"
......@@ -55,7 +54,10 @@ typedef struct
gint8 strength;
double freq;
guint16 rate;
guint32 capabilities;
guint32 flags; /* General flags */
guint32 wpa_flags; /* WPA-related flags */
guint32 rsn_flags; /* RSN (WPA2) -related flags */
/* Non-scanned attributes */
gboolean invalid;
......@@ -71,7 +73,6 @@ typedef struct
/* Things from user prefs/NetworkManagerInfo */
gboolean fallback;
NMAPSecurity * security;
GTimeVal timestamp;
GSList * user_addresses;
} NMAccessPointPrivate;
......@@ -90,8 +91,9 @@ static guint signals[LAST_SIGNAL] = { 0 };
enum {
PROP_0,
PROP_CAPABILITIES,
PROP_ENCRYPTED,
PROP_FLAGS,
PROP_WPA_FLAGS,
PROP_RSN_FLAGS,
PROP_SSID,
PROP_FREQUENCY,
PROP_HW_ADDRESS,
......@@ -110,7 +112,9 @@ nm_ap_init (NMAccessPoint *ap)
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH_ACCESS_POINT "/%d", counter++);
priv->mode = IW_MODE_INFRA;
priv->capabilities = NM_802_11_CAP_PROTO_NONE;
priv->flags = NM_802_11_AP_FLAGS_NONE;
priv->wpa_flags = NM_802_11_AP_SEC_NONE;
priv->rsn_flags = NM_802_11_AP_SEC_NONE;
priv->broadcast = TRUE;
}
......@@ -125,9 +129,6 @@ finalize (GObject *object)
g_slist_foreach (priv->user_addresses, (GFunc)g_free, NULL);
g_slist_free (priv->user_addresses);
if (priv->security)
g_object_unref (G_OBJECT (priv->security));
G_OBJECT_CLASS (nm_ap_parent_class)->finalize (object);
}
......@@ -140,8 +141,14 @@ set_property (GObject *object, guint prop_id,
int mode;
switch (prop_id) {
case PROP_CAPABILITIES:
priv->capabilities = g_value_get_uint (value);
case PROP_FLAGS:
priv->flags = g_value_get_uint (value);
break;
case PROP_WPA_FLAGS:
priv->wpa_flags = g_value_get_uint (value);
break;
case PROP_RSN_FLAGS:
priv->rsn_flags = g_value_get_uint (value);
break;
case PROP_SSID:
ssid = g_value_get_boxed (value);
......@@ -193,11 +200,14 @@ get_property (GObject *object, guint prop_id,
int i;
switch (prop_id) {
case PROP_CAPABILITIES:
g_value_set_uint (value, priv->capabilities);
case PROP_FLAGS:
g_value_set_uint (value, priv->flags);
break;
case PROP_WPA_FLAGS:
g_value_set_uint (value, priv->wpa_flags);
break;
case PROP_ENCRYPTED:
g_value_set_boolean (value, !(priv->capabilities & NM_802_11_CAP_PROTO_NONE));
case PROP_RSN_FLAGS:
g_value_set_uint (value, priv->rsn_flags);
break;
case PROP_SSID:
len = priv->ssid ? priv->ssid->len : 0;
......@@ -234,7 +244,7 @@ static void
nm_ap_class_init (NMAccessPointClass *ap_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (ap_class);
guint32 all_caps;
guint32 all_sec_flags;
g_type_class_add_private (ap_class, sizeof (NMAccessPointPrivate));
......@@ -245,39 +255,47 @@ nm_ap_class_init (NMAccessPointClass *ap_class)
/* properties */
all_caps = NM_802_11_CAP_NONE
| NM_802_11_CAP_PROTO_NONE
| NM_802_11_CAP_PROTO_WEP
| NM_802_11_CAP_PROTO_WPA
| NM_802_11_CAP_PROTO_WPA2
| NM_802_11_CAP_RESERVED1
| NM_802_11_CAP_RESERVED2
| NM_802_11_CAP_KEY_MGMT_PSK
| NM_802_11_CAP_KEY_MGMT_802_1X
| NM_802_11_CAP_RESERVED3
| NM_802_11_CAP_RESERVED4
| NM_802_11_CAP_RESERVED5
| NM_802_11_CAP_RESERVED6
| NM_802_11_CAP_CIPHER_WEP40
| NM_802_11_CAP_CIPHER_WEP104
| NM_802_11_CAP_CIPHER_TKIP
| NM_802_11_CAP_CIPHER_CCMP;
all_sec_flags = NM_802_11_AP_SEC_NONE
| NM_802_11_AP_SEC_PAIR_WEP40
| NM_802_11_AP_SEC_PAIR_WEP104
| NM_802_11_AP_SEC_PAIR_TKIP
| NM_802_11_AP_SEC_PAIR_CCMP
| NM_802_11_AP_SEC_GROUP_WEP40
| NM_802_11_AP_SEC_GROUP_WEP104
| NM_802_11_AP_SEC_GROUP_TKIP
| NM_802_11_AP_SEC_GROUP_CCMP
| NM_802_11_AP_SEC_KEY_MGMT_PSK
| NM_802_11_AP_SEC_KEY_MGMT_802_1X;
g_object_class_install_property
(object_class, PROP_CAPABILITIES,
g_param_spec_uint (NM_AP_CAPABILITIES,
"Capabilities",
"Capabilities",
NM_802_11_CAP_NONE, all_caps, NM_802_11_CAP_PROTO_NONE,
(object_class, PROP_FLAGS,
g_param_spec_uint (NM_AP_FLAGS,
"Flags",
"Flags",
NM_802_11_AP_FLAGS_NONE,
NM_802_11_AP_FLAGS_PRIVACY,
NM_802_11_AP_FLAGS_NONE,
G_PARAM_READWRITE));
g_object_class_install_property
(object_class, PROP_ENCRYPTED,
g_param_spec_boolean (NM_AP_ENCRYPTED,
"Encrypted",
"Is encrypted",
FALSE,
G_PARAM_READABLE));
(object_class, PROP_WPA_FLAGS,
g_param_spec_uint (NM_AP_WPA_FLAGS,
"WPA Flags",
"WPA Flags",
NM_802_11_AP_SEC_NONE,
all_sec_flags,
NM_802_11_AP_SEC_NONE,
G_PARAM_READWRITE));
g_object_class_install_property
(object_class, PROP_RSN_FLAGS,
g_param_spec_uint (NM_AP_RSN_FLAGS,
"RSN Flags",
"RSN Flags",
NM_802_11_AP_SEC_NONE,
all_sec_flags,
NM_802_11_AP_SEC_NONE,
G_PARAM_READWRITE));
g_object_class_install_property
(object_class, PROP_SSID,
......@@ -399,12 +417,11 @@ nm_ap_new_from_ap (NMAccessPoint *src_ap)
new_priv->strength = src_priv->strength;
new_priv->freq = src_priv->freq;
new_priv->rate = src_priv->rate;
new_priv->capabilities = src_priv->capabilities;
new_priv->artificial = src_priv->artificial;
new_priv->broadcast = src_priv->broadcast;
if (src_priv->security)
new_priv->security = nm_ap_security_new_copy (src_priv->security);
new_priv->flags = src_priv->flags;
new_priv->wpa_flags = src_priv->wpa_flags;
new_priv->rsn_flags = src_priv->rsn_flags;
return new_ap;
}
......@@ -446,14 +463,20 @@ foreach_property_cb (gpointer key, gpointer value, gpointer user_data)
nm_ap_set_address (ap, &addr);
} else if (!strcmp (key, "wpaie")) {
guint8 * ie = (guint8 *) array->data;
guint32 flags = nm_ap_get_wpa_flags (ap);
if (array->len <= 0 || array->len > WPA_MAX_IE_LEN)
return;
nm_ap_add_capabilities_from_ie (ap, ie, array->len);
flags = nm_ap_add_security_from_ie (flags, ie, array->len);
nm_ap_set_wpa_flags (ap, flags);
} else if (!strcmp (key, "rsnie")) {
guint8 * ie = (guint8 *) array->data;
guint32 flags = nm_ap_get_rsn_flags (ap);
if (array->len <= 0 || array->len > WPA_MAX_IE_LEN)
return;
nm_ap_add_capabilities_from_ie (ap, ie, array->len);
flags = nm_ap_add_security_from_ie (flags, ie, array->len);
nm_ap_set_rsn_flags (ap, flags);
}
} else if (G_VALUE_HOLDS_INT (variant)) {
gint32 int_val = g_value_get_int (variant);
......@@ -475,11 +498,8 @@ foreach_property_cb (gpointer key, gpointer value, gpointer user_data)
}
if (val & IEEE80211_CAP_PRIVACY) {
guint cur_caps;
cur_caps = nm_ap_get_capabilities (ap);
if (cur_caps == NM_802_11_CAP_NONE || cur_caps & NM_802_11_CAP_PROTO_NONE)
nm_ap_add_capabilities_for_wep (ap);
guint32 flags = nm_ap_get_flags (ap);
nm_ap_set_flags (ap, flags | NM_802_11_AP_FLAGS_PRIVACY);
}
}
}
......@@ -531,13 +551,16 @@ nm_ap_print_self (NMAccessPoint *ap,
priv = NM_AP_GET_PRIVATE (ap);
nm_info ("%s'%s' (%p) stamp=%ld caps=0x%X bssid=" MAC_FMT " strength=%d "
"freq=[%f/%d] rate=%d inval=%d mode=%d seen=%ld",
nm_info ("%s'%s' (%p) stamp=%ld flags=0x%X wpa-flags=0x%X rsn-flags=0x%x "
"bssid=" MAC_FMT " strength=%d freq=[%f/%d] rate=%d inval=%d "
"mode=%d seen=%ld",
prefix,
priv->ssid ? nm_utils_escape_ssid (priv->ssid->data, priv->ssid->len) : "(none)",
ap,
priv->timestamp.tv_sec,
priv->capabilities,
priv->flags,
priv->wpa_flags,
priv->rsn_flags,
MAC_ARG (priv->address.ether_addr_octet),
priv->strength,
(priv->freq > 20) ? priv->freq : 0,
......@@ -606,72 +629,69 @@ void nm_ap_set_ssid (NMAccessPoint *ap, const GByteArray * ssid)
}
guint32 nm_ap_get_capabilities (NMAccessPoint *ap)
guint32
nm_ap_get_flags (NMAccessPoint *ap)
{
guint32 caps;
guint32 flags;
g_return_val_if_fail (NM_IS_AP (ap), NM_802_11_CAP_NONE);
g_return_val_if_fail (NM_IS_AP (ap), NM_802_11_AP_FLAGS_NONE);
g_object_get (ap, NM_AP_CAPABILITIES, &caps, NULL);
g_object_get (ap, NM_AP_FLAGS, &flags, NULL);
return caps;
return flags;
}
void nm_ap_set_capabilities (NMAccessPoint *ap, guint32 capabilities)
void
nm_ap_set_flags (NMAccessPoint *ap, guint32 flags)
{
g_return_if_fail (NM_IS_AP (ap));
g_object_set (ap, NM_AP_CAPABILITIES, capabilities, NULL);
g_object_set (ap, NM_AP_FLAGS, flags, NULL);
}
/*
* Accessor function for encrypted flag
*