2005-12-07 Robert Love <rml@novell.com>
* gnome/applet/applet-dbus-info.c, include/NetworkManager.h, src/NetworkManagerAP.c, src/NetworkManagerAP.h, src/NetworkManagerAPList.c, src/NetworkManagerDbus.c, src/NetworkManagerDevice.c, src/NetworkManagerDevice.h, src/nm-dbus-nm.c: Convert NM_DEVICE_AUTH_METHOD_* to use the wireless-tools constants directly. UNKNOWN is now -1 and NONE is zero. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1144 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
|||||||
|
2005-12-07 Robert Love <rml@novell.com>
|
||||||
|
|
||||||
|
* gnome/applet/applet-dbus-info.c, include/NetworkManager.h,
|
||||||
|
src/NetworkManagerAP.c, src/NetworkManagerAP.h,
|
||||||
|
src/NetworkManagerAPList.c, src/NetworkManagerDbus.c,
|
||||||
|
src/NetworkManagerDevice.c, src/NetworkManagerDevice.h,
|
||||||
|
src/nm-dbus-nm.c: Convert NM_DEVICE_AUTH_METHOD_* to use the
|
||||||
|
wireless-tools constants directly. UNKNOWN is now -1 and NONE is
|
||||||
|
zero.
|
||||||
|
|
||||||
2005-12-07 Robert Love <rml@novell.com>
|
2005-12-07 Robert Love <rml@novell.com>
|
||||||
|
|
||||||
* src/backends/NetworkManagerSuSE.c: In static configurations, if the
|
* src/backends/NetworkManagerSuSE.c: In static configurations, if the
|
||||||
|
@@ -406,7 +406,7 @@ static DBusMessage *nmi_dbus_get_network_properties (NMWirelessApplet *applet, D
|
|||||||
gint32 i;
|
gint32 i;
|
||||||
NMEncKeyType key_type = -1;
|
NMEncKeyType key_type = -1;
|
||||||
gboolean trusted = FALSE;
|
gboolean trusted = FALSE;
|
||||||
NMDeviceAuthMethod auth_method = NM_DEVICE_AUTH_METHOD_UNKNOWN;
|
int auth_method = -1;
|
||||||
|
|
||||||
g_return_val_if_fail (applet != NULL, NULL);
|
g_return_val_if_fail (applet != NULL, NULL);
|
||||||
g_return_val_if_fail (message != NULL, NULL);
|
g_return_val_if_fail (message != NULL, NULL);
|
||||||
@@ -894,8 +894,7 @@ static DBusMessage *nmi_dbus_get_vpn_connection_routes (NMWirelessApplet *applet
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void nmi_save_network_info (NMWirelessApplet *applet, const char *essid, const char *enc_key_source,
|
static void nmi_save_network_info (NMWirelessApplet *applet, const char *essid, const char *enc_key_source,
|
||||||
const NMEncKeyType enc_key_type, const NMDeviceAuthMethod auth_method,
|
const NMEncKeyType enc_key_type, int auth_method, gboolean user_requested)
|
||||||
gboolean user_requested)
|
|
||||||
{
|
{
|
||||||
char * key;
|
char * key;
|
||||||
GConfEntry * gconf_entry;
|
GConfEntry * gconf_entry;
|
||||||
@@ -961,7 +960,7 @@ static void nmi_save_network_info (NMWirelessApplet *applet, const char *essid,
|
|||||||
g_free (key);
|
g_free (key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth_method != NM_DEVICE_AUTH_METHOD_UNKNOWN)
|
if (auth_method != -1)
|
||||||
{
|
{
|
||||||
key = g_strdup_printf ("%s/%s/auth_method", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
|
key = g_strdup_printf ("%s/%s/auth_method", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
|
||||||
gconf_client_set_int (applet->gconf_client, key, auth_method, NULL);
|
gconf_client_set_int (applet->gconf_client, key, auth_method, NULL);
|
||||||
@@ -982,7 +981,7 @@ static void nmi_save_network_info (NMWirelessApplet *applet, const char *essid,
|
|||||||
static void nmi_dbus_update_network_info (NMWirelessApplet *applet, DBusMessage *message)
|
static void nmi_dbus_update_network_info (NMWirelessApplet *applet, DBusMessage *message)
|
||||||
{
|
{
|
||||||
char * network = NULL;
|
char * network = NULL;
|
||||||
NMDeviceAuthMethod auth_method = NM_DEVICE_AUTH_METHOD_UNKNOWN;
|
int auth_method = -1;
|
||||||
char * enc_key_source = NULL;
|
char * enc_key_source = NULL;
|
||||||
int enc_key_type = -1;
|
int enc_key_type = -1;
|
||||||
gboolean user_requested;
|
gboolean user_requested;
|
||||||
@@ -999,7 +998,7 @@ static void nmi_dbus_update_network_info (NMWirelessApplet *applet, DBusMessage
|
|||||||
DBUS_TYPE_INT32, &auth_method,
|
DBUS_TYPE_INT32, &auth_method,
|
||||||
DBUS_TYPE_BOOLEAN, &user_requested,
|
DBUS_TYPE_BOOLEAN, &user_requested,
|
||||||
DBUS_TYPE_INVALID);
|
DBUS_TYPE_INVALID);
|
||||||
if (!args_good || (strlen (network) <= 0) || (auth_method == NM_DEVICE_AUTH_METHOD_UNKNOWN))
|
if (!args_good || (strlen (network) <= 0) || (auth_method == -1))
|
||||||
return;
|
return;
|
||||||
if (enc_key_source && strlen (enc_key_source) && ((enc_key_type == NM_ENC_TYPE_UNKNOWN) || (enc_key_type == NM_ENC_TYPE_NONE)))
|
if (enc_key_source && strlen (enc_key_source) && ((enc_key_type == NM_ENC_TYPE_UNKNOWN) || (enc_key_type == NM_ENC_TYPE_NONE)))
|
||||||
return;
|
return;
|
||||||
|
@@ -126,19 +126,6 @@ typedef enum NMNetworkType
|
|||||||
} NMNetworkType;
|
} NMNetworkType;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Authentication modes
|
|
||||||
*/
|
|
||||||
typedef enum NMDeviceAuthMethod
|
|
||||||
{
|
|
||||||
NM_DEVICE_AUTH_METHOD_UNKNOWN = 0,
|
|
||||||
NM_DEVICE_AUTH_METHOD_NONE,
|
|
||||||
NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM,
|
|
||||||
NM_DEVICE_AUTH_METHOD_SHARED_KEY,
|
|
||||||
NM_DEVICE_AUTH_METHOD_WPA_PSK
|
|
||||||
} NMDeviceAuthMethod;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Device activation stages
|
* Device activation stages
|
||||||
*/
|
*/
|
||||||
|
@@ -58,7 +58,7 @@ struct NMAccessPoint
|
|||||||
gboolean trusted;
|
gboolean trusted;
|
||||||
char * enc_key;
|
char * enc_key;
|
||||||
NMEncKeyType enc_type;
|
NMEncKeyType enc_type;
|
||||||
NMDeviceAuthMethod auth_method;
|
int auth_method; /* from wireless.h; -1 is unknown, zero is none */
|
||||||
GTimeVal timestamp;
|
GTimeVal timestamp;
|
||||||
GSList * user_addresses;
|
GSList * user_addresses;
|
||||||
};
|
};
|
||||||
@@ -91,7 +91,7 @@ NMAccessPoint * nm_ap_new (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ap->mode = IW_MODE_INFRA;
|
ap->mode = IW_MODE_INFRA;
|
||||||
ap->auth_method = NM_DEVICE_AUTH_METHOD_UNKNOWN;
|
ap->auth_method = -1;
|
||||||
ap->refcount = 1;
|
ap->refcount = 1;
|
||||||
|
|
||||||
return (ap);
|
return (ap);
|
||||||
@@ -311,14 +311,14 @@ NMEncKeyType nm_ap_get_enc_type (const NMAccessPoint *ap)
|
|||||||
* Get/set functions for auth_method
|
* Get/set functions for auth_method
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
NMDeviceAuthMethod nm_ap_get_auth_method (const NMAccessPoint *ap)
|
int nm_ap_get_auth_method (const NMAccessPoint *ap)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (ap != NULL, NM_DEVICE_AUTH_METHOD_UNKNOWN);
|
g_return_val_if_fail (ap != NULL, -1);
|
||||||
|
|
||||||
return (ap->auth_method);
|
return (ap->auth_method);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nm_ap_set_auth_method (NMAccessPoint *ap, NMDeviceAuthMethod auth_method)
|
void nm_ap_set_auth_method (NMAccessPoint *ap, int auth_method)
|
||||||
{
|
{
|
||||||
g_return_if_fail (ap != NULL);
|
g_return_if_fail (ap != NULL);
|
||||||
|
|
||||||
|
@@ -48,8 +48,8 @@ char * nm_ap_get_enc_key_hashed (const NMAccessPoint *ap);
|
|||||||
void nm_ap_set_enc_key_source (NMAccessPoint *ap, const char *key, NMEncKeyType type);
|
void nm_ap_set_enc_key_source (NMAccessPoint *ap, const char *key, NMEncKeyType type);
|
||||||
NMEncKeyType nm_ap_get_enc_type (const NMAccessPoint *ap);
|
NMEncKeyType nm_ap_get_enc_type (const NMAccessPoint *ap);
|
||||||
|
|
||||||
NMDeviceAuthMethod nm_ap_get_auth_method (const NMAccessPoint *ap);
|
int nm_ap_get_auth_method (const NMAccessPoint *ap);
|
||||||
void nm_ap_set_auth_method (NMAccessPoint *ap, const NMDeviceAuthMethod auth_method);
|
void nm_ap_set_auth_method (NMAccessPoint *ap, int auth_method);
|
||||||
|
|
||||||
gboolean nm_ap_get_encrypted (const NMAccessPoint *ap);
|
gboolean nm_ap_get_encrypted (const NMAccessPoint *ap);
|
||||||
void nm_ap_set_encrypted (NMAccessPoint *ap, gboolean encrypted);
|
void nm_ap_set_encrypted (NMAccessPoint *ap, gboolean encrypted);
|
||||||
|
@@ -529,15 +529,15 @@ void nm_ap_list_copy_properties (NMAccessPointList *dest, NMAccessPointList *sou
|
|||||||
{
|
{
|
||||||
nm_ap_set_invalid (dest_ap, nm_ap_get_invalid (src_ap));
|
nm_ap_set_invalid (dest_ap, nm_ap_get_invalid (src_ap));
|
||||||
nm_ap_set_enc_key_source (dest_ap, nm_ap_get_enc_key_source (src_ap), nm_ap_get_enc_type (src_ap));
|
nm_ap_set_enc_key_source (dest_ap, nm_ap_get_enc_key_source (src_ap), nm_ap_get_enc_type (src_ap));
|
||||||
if (nm_ap_get_auth_method (src_ap) != NM_DEVICE_AUTH_METHOD_UNKNOWN)
|
if (nm_ap_get_auth_method (src_ap) != -1)
|
||||||
{
|
{
|
||||||
/* Ensure that we don't set the NONE auth method from the src_ap
|
/* Ensure that we don't set the NONE auth method from the src_ap
|
||||||
* if the dest_ap has encryption enabled.
|
* if the dest_ap has encryption enabled.
|
||||||
*/
|
*/
|
||||||
if (nm_ap_get_encrypted (dest_ap) && (nm_ap_get_auth_method (src_ap) != NM_DEVICE_AUTH_METHOD_NONE))
|
if (nm_ap_get_encrypted (dest_ap) && (nm_ap_get_auth_method (src_ap) != 0))
|
||||||
nm_ap_set_auth_method (dest_ap, nm_ap_get_auth_method (src_ap));
|
nm_ap_set_auth_method (dest_ap, nm_ap_get_auth_method (src_ap));
|
||||||
else if (!nm_ap_get_encrypted (dest_ap))
|
else if (!nm_ap_get_encrypted (dest_ap))
|
||||||
nm_ap_set_auth_method (dest_ap, NM_DEVICE_AUTH_METHOD_NONE);
|
nm_ap_set_auth_method (dest_ap, 0);
|
||||||
}
|
}
|
||||||
nm_ap_set_timestamp (dest_ap, nm_ap_get_timestamp (src_ap));
|
nm_ap_set_timestamp (dest_ap, nm_ap_get_timestamp (src_ap));
|
||||||
}
|
}
|
||||||
|
@@ -618,7 +618,7 @@ gboolean nm_dbus_update_network_info (DBusConnection *connection, NMAccessPoint
|
|||||||
g_return_val_if_fail (ap != NULL, FALSE);
|
g_return_val_if_fail (ap != NULL, FALSE);
|
||||||
|
|
||||||
auth_method = nm_ap_get_auth_method (ap);
|
auth_method = nm_ap_get_auth_method (ap);
|
||||||
if (auth_method == NM_DEVICE_AUTH_METHOD_UNKNOWN)
|
if (auth_method == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
essid = nm_ap_get_essid (ap);
|
essid = nm_ap_get_essid (ap);
|
||||||
@@ -747,7 +747,7 @@ static void nm_dbus_get_network_data_cb (DBusPendingCall *pcall, void *user_data
|
|||||||
gint timestamp_secs = -1;
|
gint timestamp_secs = -1;
|
||||||
NMEncKeyType key_type = -1;
|
NMEncKeyType key_type = -1;
|
||||||
gboolean trusted = FALSE;
|
gboolean trusted = FALSE;
|
||||||
NMDeviceAuthMethod auth_method = NM_DEVICE_AUTH_METHOD_UNKNOWN;
|
int auth_method = -1;
|
||||||
char ** addresses;
|
char ** addresses;
|
||||||
int num_addresses;
|
int num_addresses;
|
||||||
|
|
||||||
|
@@ -315,8 +315,8 @@ void nm_device_copy_allowed_to_dev_list (NMDevice *dev, NMAccessPointList *allow
|
|||||||
/* Assume that if the allowed list AP has a saved encryption
|
/* Assume that if the allowed list AP has a saved encryption
|
||||||
* key that the AP is encrypted.
|
* key that the AP is encrypted.
|
||||||
*/
|
*/
|
||||||
if ( (nm_ap_get_auth_method (src_ap) == NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM)
|
if ( (nm_ap_get_auth_method (src_ap) == IW_AUTH_ALG_OPEN_SYSTEM)
|
||||||
|| (nm_ap_get_auth_method (src_ap) == NM_DEVICE_AUTH_METHOD_SHARED_KEY))
|
|| (nm_ap_get_auth_method (src_ap) == IW_AUTH_ALG_SHARED_KEY))
|
||||||
nm_ap_set_encrypted (dst_ap, TRUE);
|
nm_ap_set_encrypted (dst_ap, TRUE);
|
||||||
|
|
||||||
nm_ap_list_append_ap (dev_list, dst_ap);
|
nm_ap_list_append_ap (dev_list, dst_ap);
|
||||||
@@ -1462,7 +1462,7 @@ void nm_device_get_ap_address (NMDevice *dev, struct ether_addr *addr)
|
|||||||
* NOTE that at this time, the key must be the raw HEX key, not
|
* NOTE that at this time, the key must be the raw HEX key, not
|
||||||
* a passphrase.
|
* a passphrase.
|
||||||
*/
|
*/
|
||||||
void nm_device_set_enc_key (NMDevice *dev, const char *key, NMDeviceAuthMethod auth_method)
|
void nm_device_set_enc_key (NMDevice *dev, const char *key, int auth_method)
|
||||||
{
|
{
|
||||||
NMSock *sk;
|
NMSock *sk;
|
||||||
struct iwreq wreq;
|
struct iwreq wreq;
|
||||||
@@ -1513,10 +1513,10 @@ void nm_device_set_enc_key (NMDevice *dev, const char *key, NMDeviceAuthMethod a
|
|||||||
{
|
{
|
||||||
switch (auth_method)
|
switch (auth_method)
|
||||||
{
|
{
|
||||||
case NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM:
|
case IW_AUTH_ALG_OPEN_SYSTEM:
|
||||||
wreq.u.data.flags |= IW_ENCODE_OPEN;
|
wreq.u.data.flags |= IW_ENCODE_OPEN;
|
||||||
break;
|
break;
|
||||||
case NM_DEVICE_AUTH_METHOD_SHARED_KEY:
|
case IW_AUTH_ALG_SHARED_KEY:
|
||||||
wreq.u.data.flags |= IW_ENCODE_RESTRICTED;
|
wreq.u.data.flags |= IW_ENCODE_RESTRICTED;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -2118,27 +2118,27 @@ NMActRequest *nm_device_get_act_request (NMDevice *dev)
|
|||||||
* (which is found from NMI) and ensure that its valid with the encryption status of the AP.
|
* (which is found from NMI) and ensure that its valid with the encryption status of the AP.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static NMDeviceAuthMethod get_initial_auth_method (NMAccessPoint *ap, NMAccessPointList *allowed_list)
|
static int get_initial_auth_method (NMAccessPoint *ap, NMAccessPointList *allowed_list)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (ap != NULL, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
g_return_val_if_fail (ap != NULL, IW_AUTH_ALG_OPEN_SYSTEM);
|
||||||
|
|
||||||
if (nm_ap_get_encrypted (ap))
|
if (nm_ap_get_encrypted (ap))
|
||||||
{
|
{
|
||||||
NMDeviceAuthMethod auth = nm_ap_get_auth_method (ap);
|
int auth = nm_ap_get_auth_method (ap);
|
||||||
NMAccessPoint *allowed_ap = nm_ap_list_get_ap_by_essid (allowed_list, nm_ap_get_essid (ap));
|
NMAccessPoint *allowed_ap = nm_ap_list_get_ap_by_essid (allowed_list, nm_ap_get_essid (ap));
|
||||||
|
|
||||||
/* Prefer default auth method if we found one for this AP in our allowed list. */
|
/* Prefer default auth method if we found one for this AP in our allowed list. */
|
||||||
if (allowed_ap)
|
if (allowed_ap)
|
||||||
auth = nm_ap_get_auth_method (allowed_ap);
|
auth = nm_ap_get_auth_method (allowed_ap);
|
||||||
|
|
||||||
if ( (auth == NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM)
|
if ( (auth == IW_AUTH_ALG_OPEN_SYSTEM)
|
||||||
|| (auth == NM_DEVICE_AUTH_METHOD_SHARED_KEY))
|
|| (auth == IW_AUTH_ALG_SHARED_KEY))
|
||||||
return (auth);
|
return (auth);
|
||||||
else
|
else
|
||||||
return (NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
return (IW_AUTH_ALG_OPEN_SYSTEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (NM_DEVICE_AUTH_METHOD_NONE);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2178,7 +2178,7 @@ static gboolean nm_device_activate_stage1_device_prepare (NMActRequest *req)
|
|||||||
if (nm_ap_get_encrypted (ap) || nm_ap_is_enc_key_valid (ap))
|
if (nm_ap_get_encrypted (ap) || nm_ap_is_enc_key_valid (ap))
|
||||||
{
|
{
|
||||||
nm_ap_set_encrypted (ap, TRUE);
|
nm_ap_set_encrypted (ap, TRUE);
|
||||||
nm_ap_set_auth_method (ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
nm_ap_set_auth_method (ap, IW_AUTH_ALG_OPEN_SYSTEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2266,14 +2266,14 @@ static gboolean nm_device_is_up_and_associated_wait (NMDevice *dev, int timeout,
|
|||||||
*/
|
*/
|
||||||
static gboolean nm_device_set_wireless_config (NMDevice *dev, NMAccessPoint *ap)
|
static gboolean nm_device_set_wireless_config (NMDevice *dev, NMAccessPoint *ap)
|
||||||
{
|
{
|
||||||
NMDeviceAuthMethod auth;
|
int auth;
|
||||||
const char *essid = NULL;
|
const char *essid = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, FALSE);
|
g_return_val_if_fail (dev != NULL, FALSE);
|
||||||
g_return_val_if_fail (nm_device_is_802_11_wireless (dev), FALSE);
|
g_return_val_if_fail (nm_device_is_802_11_wireless (dev), FALSE);
|
||||||
g_return_val_if_fail (ap != NULL, FALSE);
|
g_return_val_if_fail (ap != NULL, FALSE);
|
||||||
g_return_val_if_fail (nm_ap_get_essid (ap) != NULL, FALSE);
|
g_return_val_if_fail (nm_ap_get_essid (ap) != NULL, FALSE);
|
||||||
g_return_val_if_fail (nm_ap_get_auth_method (ap) != NM_DEVICE_AUTH_METHOD_UNKNOWN, FALSE);
|
g_return_val_if_fail (nm_ap_get_auth_method (ap) != -1, FALSE);
|
||||||
|
|
||||||
dev->options.wireless.failed_link_count = 0;
|
dev->options.wireless.failed_link_count = 0;
|
||||||
|
|
||||||
@@ -2298,9 +2298,9 @@ static gboolean nm_device_set_wireless_config (NMDevice *dev, NMAccessPoint *ap)
|
|||||||
{
|
{
|
||||||
char * hashed_key = nm_ap_get_enc_key_hashed (ap);
|
char * hashed_key = nm_ap_get_enc_key_hashed (ap);
|
||||||
|
|
||||||
if (auth == NM_DEVICE_AUTH_METHOD_NONE)
|
if (auth == 0)
|
||||||
{
|
{
|
||||||
nm_ap_set_auth_method (ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
nm_ap_set_auth_method (ap, IW_AUTH_ALG_OPEN_SYSTEM);
|
||||||
nm_warning ("Activation (%s/wireless): AP '%s' said it was encrypted, but had "
|
nm_warning ("Activation (%s/wireless): AP '%s' said it was encrypted, but had "
|
||||||
"'none' for authentication method. Using Open System authentication method.",
|
"'none' for authentication method. Using Open System authentication method.",
|
||||||
nm_device_get_iface (dev), nm_ap_get_essid (ap));
|
nm_device_get_iface (dev), nm_ap_get_essid (ap));
|
||||||
@@ -2309,14 +2309,14 @@ static gboolean nm_device_set_wireless_config (NMDevice *dev, NMAccessPoint *ap)
|
|||||||
g_free (hashed_key);
|
g_free (hashed_key);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nm_device_set_enc_key (dev, NULL, NM_DEVICE_AUTH_METHOD_NONE);
|
nm_device_set_enc_key (dev, NULL, 0);
|
||||||
|
|
||||||
nm_device_set_essid (dev, essid);
|
nm_device_set_essid (dev, essid);
|
||||||
|
|
||||||
nm_info ("Activation (%s/wireless): using essid '%s', with %s authentication.",
|
nm_info ("Activation (%s/wireless): using essid '%s', with %s authentication.",
|
||||||
nm_device_get_iface (dev), essid, (auth == NM_DEVICE_AUTH_METHOD_NONE) ? "no" :
|
nm_device_get_iface (dev), essid, (auth == 0) ? "no" :
|
||||||
((auth == NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM) ? "Open System" :
|
((auth == IW_AUTH_ALG_OPEN_SYSTEM) ? "Open System" :
|
||||||
((auth == NM_DEVICE_AUTH_METHOD_SHARED_KEY) ? "Shared Key" : "unknown")));
|
((auth == IW_AUTH_ALG_SHARED_KEY) ? "Shared Key" : "unknown")));
|
||||||
|
|
||||||
/* Bring the device up and pause to allow card to associate. After we set the ESSID
|
/* Bring the device up and pause to allow card to associate. After we set the ESSID
|
||||||
* on the card, the card has to scan all channels to find our requested AP (which can
|
* on the card, the card has to scan all channels to find our requested AP (which can
|
||||||
@@ -2346,7 +2346,7 @@ static void nm_device_wireless_configure_adhoc (NMActRequest *req)
|
|||||||
NMData * data;
|
NMData * data;
|
||||||
NMDevice * dev;
|
NMDevice * dev;
|
||||||
NMAccessPoint * ap;
|
NMAccessPoint * ap;
|
||||||
NMDeviceAuthMethod auth = NM_DEVICE_AUTH_METHOD_NONE;
|
int auth = 0;
|
||||||
NMAPListIter * iter;
|
NMAPListIter * iter;
|
||||||
NMAccessPoint * tmp_ap;
|
NMAccessPoint * tmp_ap;
|
||||||
double card_freqs[IW_MAX_FREQUENCIES];
|
double card_freqs[IW_MAX_FREQUENCIES];
|
||||||
@@ -2368,7 +2368,7 @@ static void nm_device_wireless_configure_adhoc (NMActRequest *req)
|
|||||||
g_assert (ap);
|
g_assert (ap);
|
||||||
|
|
||||||
if (nm_ap_get_encrypted (ap))
|
if (nm_ap_get_encrypted (ap))
|
||||||
auth = NM_DEVICE_AUTH_METHOD_SHARED_KEY;
|
auth = IW_AUTH_ALG_SHARED_KEY;
|
||||||
|
|
||||||
/* Build our local list of frequencies to whittle down until we find a free one */
|
/* Build our local list of frequencies to whittle down until we find a free one */
|
||||||
memset (&card_freqs, 0, sizeof (card_freqs));
|
memset (&card_freqs, 0, sizeof (card_freqs));
|
||||||
@@ -2630,16 +2630,16 @@ static void nm_device_wireless_configure (NMActRequest *req)
|
|||||||
|
|
||||||
if (!link)
|
if (!link)
|
||||||
{
|
{
|
||||||
if (nm_ap_get_auth_method (ap) == NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM)
|
if (nm_ap_get_auth_method (ap) == IW_AUTH_ALG_OPEN_SYSTEM)
|
||||||
{
|
{
|
||||||
nm_debug ("Activation (%s/wireless): no hardware link to '%s' in Open System mode, trying Shared Key.",
|
nm_debug ("Activation (%s/wireless): no hardware link to '%s' in Open System mode, trying Shared Key.",
|
||||||
nm_device_get_iface (dev), nm_ap_get_essid (ap) ? nm_ap_get_essid (ap) : "(none)");
|
nm_device_get_iface (dev), nm_ap_get_essid (ap) ? nm_ap_get_essid (ap) : "(none)");
|
||||||
/* Back down to Shared Key mode */
|
/* Back down to Shared Key mode */
|
||||||
nm_ap_set_auth_method (ap, NM_DEVICE_AUTH_METHOD_SHARED_KEY);
|
nm_ap_set_auth_method (ap, IW_AUTH_ALG_SHARED_KEY);
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (nm_ap_get_auth_method (ap) == NM_DEVICE_AUTH_METHOD_SHARED_KEY)
|
else if (nm_ap_get_auth_method (ap) == IW_AUTH_ALG_SHARED_KEY)
|
||||||
{
|
{
|
||||||
/* Didn't work in Shared Key either. */
|
/* Didn't work in Shared Key either. */
|
||||||
nm_debug ("Activation (%s/wireless): no hardware link to '%s' in Shared Key mode, need correct key?",
|
nm_debug ("Activation (%s/wireless): no hardware link to '%s' in Shared Key mode, need correct key?",
|
||||||
@@ -2942,7 +2942,7 @@ static gboolean nm_device_activate_stage4_ip_config_get (NMActRequest *req)
|
|||||||
if (nm_device_is_802_11_wireless (dev))
|
if (nm_device_is_802_11_wireless (dev))
|
||||||
{
|
{
|
||||||
nm_device_set_essid (dev, "");
|
nm_device_set_essid (dev, "");
|
||||||
nm_device_set_enc_key (dev, NULL, NM_DEVICE_AUTH_METHOD_NONE);
|
nm_device_set_enc_key (dev, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nm_device_is_up (dev))
|
if (!nm_device_is_up (dev))
|
||||||
@@ -3027,15 +3027,15 @@ static gboolean nm_device_activate_stage4_ip_config_timeout (NMActRequest *req)
|
|||||||
* and also for Open System mode (where you cannot know WEP key is wrong ever), we try to
|
* and also for Open System mode (where you cannot know WEP key is wrong ever), we try to
|
||||||
* do DHCP and if that fails, fall back to next auth mode and try again.
|
* do DHCP and if that fails, fall back to next auth mode and try again.
|
||||||
*/
|
*/
|
||||||
if (nm_ap_get_auth_method (ap) == NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM)
|
if (nm_ap_get_auth_method (ap) == IW_AUTH_ALG_OPEN_SYSTEM)
|
||||||
{
|
{
|
||||||
/* Back down to Shared Key mode */
|
/* Back down to Shared Key mode */
|
||||||
nm_debug ("Activation (%s/wireless): could not get IP configuration info for '%s' in Open System mode, trying Shared Key.",
|
nm_debug ("Activation (%s/wireless): could not get IP configuration info for '%s' in Open System mode, trying Shared Key.",
|
||||||
nm_device_get_iface (dev), nm_ap_get_essid (ap) ? nm_ap_get_essid (ap) : "(none)");
|
nm_device_get_iface (dev), nm_ap_get_essid (ap) ? nm_ap_get_essid (ap) : "(none)");
|
||||||
nm_ap_set_auth_method (ap, NM_DEVICE_AUTH_METHOD_SHARED_KEY);
|
nm_ap_set_auth_method (ap, IW_AUTH_ALG_SHARED_KEY);
|
||||||
nm_device_activate_schedule_stage2_device_config (req);
|
nm_device_activate_schedule_stage2_device_config (req);
|
||||||
}
|
}
|
||||||
else if ((nm_ap_get_auth_method (ap) == NM_DEVICE_AUTH_METHOD_SHARED_KEY))
|
else if ((nm_ap_get_auth_method (ap) == IW_AUTH_ALG_SHARED_KEY))
|
||||||
{
|
{
|
||||||
/* Shared Key mode failed, we must have bad WEP key */
|
/* Shared Key mode failed, we must have bad WEP key */
|
||||||
nm_debug ("Activation (%s/wireless): could not get IP configuration info for '%s' in Shared Key mode, asking for new key.",
|
nm_debug ("Activation (%s/wireless): could not get IP configuration info for '%s' in Shared Key mode, asking for new key.",
|
||||||
@@ -3400,7 +3400,7 @@ gboolean nm_device_deactivate (NMDevice *dev)
|
|||||||
if (nm_device_is_802_11_wireless (dev))
|
if (nm_device_is_802_11_wireless (dev))
|
||||||
{
|
{
|
||||||
nm_device_set_essid (dev, "");
|
nm_device_set_essid (dev, "");
|
||||||
nm_device_set_enc_key (dev, NULL, NM_DEVICE_AUTH_METHOD_NONE);
|
nm_device_set_enc_key (dev, NULL, 0);
|
||||||
nm_device_set_mode (dev, IW_MODE_INFRA);
|
nm_device_set_mode (dev, IW_MODE_INFRA);
|
||||||
nm_wireless_set_scan_interval (dev->app_data, dev, NM_WIRELESS_SCAN_INTERVAL_ACTIVE);
|
nm_wireless_set_scan_interval (dev->app_data, dev, NM_WIRELESS_SCAN_INTERVAL_ACTIVE);
|
||||||
}
|
}
|
||||||
@@ -3448,12 +3448,12 @@ void nm_device_set_user_key_for_network (NMActRequest *req, const char *key, con
|
|||||||
NMAccessPoint * allowed_ap;
|
NMAccessPoint * allowed_ap;
|
||||||
|
|
||||||
/* Start off at Open System auth mode with the new key */
|
/* Start off at Open System auth mode with the new key */
|
||||||
nm_ap_set_auth_method (ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
nm_ap_set_auth_method (ap, IW_AUTH_ALG_OPEN_SYSTEM);
|
||||||
nm_ap_set_enc_key_source (ap, key, enc_type);
|
nm_ap_set_enc_key_source (ap, key, enc_type);
|
||||||
|
|
||||||
/* Be sure to update NMI with the new auth mode */
|
/* Be sure to update NMI with the new auth mode */
|
||||||
if ((allowed_ap = nm_ap_list_get_ap_by_essid (data->allowed_ap_list, nm_ap_get_essid (ap))))
|
if ((allowed_ap = nm_ap_list_get_ap_by_essid (data->allowed_ap_list, nm_ap_get_essid (ap))))
|
||||||
nm_ap_set_auth_method (allowed_ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
nm_ap_set_auth_method (allowed_ap, IW_AUTH_ALG_OPEN_SYSTEM);
|
||||||
|
|
||||||
nm_device_activate_schedule_stage1_device_prepare (req);
|
nm_device_activate_schedule_stage1_device_prepare (req);
|
||||||
}
|
}
|
||||||
@@ -3791,9 +3791,9 @@ NMAccessPoint * nm_device_wireless_get_activation_ap (NMDevice *dev, const char
|
|||||||
nm_ap_set_essid (ap, essid);
|
nm_ap_set_essid (ap, essid);
|
||||||
nm_ap_set_encrypted (ap, encrypted);
|
nm_ap_set_encrypted (ap, encrypted);
|
||||||
if (encrypted)
|
if (encrypted)
|
||||||
nm_ap_set_auth_method (ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
nm_ap_set_auth_method (ap, IW_AUTH_ALG_OPEN_SYSTEM);
|
||||||
else
|
else
|
||||||
nm_ap_set_auth_method (ap, NM_DEVICE_AUTH_METHOD_NONE);
|
nm_ap_set_auth_method (ap, 0);
|
||||||
nm_ap_set_artificial (ap, TRUE);
|
nm_ap_set_artificial (ap, TRUE);
|
||||||
nm_ap_list_append_ap (nm_device_ap_list_get (dev), ap);
|
nm_ap_list_append_ap (nm_device_ap_list_get (dev), ap);
|
||||||
nm_ap_unref (ap);
|
nm_ap_unref (ap);
|
||||||
@@ -4594,7 +4594,7 @@ static gboolean process_scan_results (NMDevice *dev, const guint8 *res_buf, guin
|
|||||||
/* New AP with some defaults */
|
/* New AP with some defaults */
|
||||||
ap = nm_ap_new ();
|
ap = nm_ap_new ();
|
||||||
nm_ap_set_address (ap, (const struct ether_addr *)(iwe->u.ap_addr.sa_data));
|
nm_ap_set_address (ap, (const struct ether_addr *)(iwe->u.ap_addr.sa_data));
|
||||||
nm_ap_set_auth_method (ap, NM_DEVICE_AUTH_METHOD_NONE);
|
nm_ap_set_auth_method (ap, 0);
|
||||||
nm_ap_set_mode (ap, IW_MODE_INFRA);
|
nm_ap_set_mode (ap, IW_MODE_INFRA);
|
||||||
break;
|
break;
|
||||||
case SIOCGIWMODE:
|
case SIOCGIWMODE:
|
||||||
@@ -4642,7 +4642,7 @@ static gboolean process_scan_results (NMDevice *dev, const guint8 *res_buf, guin
|
|||||||
if (!(iwe->u.data.flags & IW_ENCODE_DISABLED))
|
if (!(iwe->u.data.flags & IW_ENCODE_DISABLED))
|
||||||
{
|
{
|
||||||
nm_ap_set_encrypted (ap, TRUE);
|
nm_ap_set_encrypted (ap, TRUE);
|
||||||
nm_ap_set_auth_method (ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
nm_ap_set_auth_method (ap, IW_AUTH_ALG_OPEN_SYSTEM);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#if 0
|
#if 0
|
||||||
|
@@ -100,7 +100,7 @@ NMAccessPoint *nm_device_get_best_ap (NMDevice *dev);
|
|||||||
void nm_device_set_wireless_scan_interval (NMDevice *dev, NMWirelessScanInterval interval);
|
void nm_device_set_wireless_scan_interval (NMDevice *dev, NMWirelessScanInterval interval);
|
||||||
|
|
||||||
/* There is no function to get the WEP key since that's a slight security risk */
|
/* There is no function to get the WEP key since that's a slight security risk */
|
||||||
void nm_device_set_enc_key (NMDevice *dev, const char *key, NMDeviceAuthMethod auth_method);
|
void nm_device_set_enc_key (NMDevice *dev, const char *key, int auth_method);
|
||||||
|
|
||||||
NMActRequest * nm_device_get_act_request (NMDevice *dev);
|
NMActRequest * nm_device_get_act_request (NMDevice *dev);
|
||||||
gboolean nm_device_activation_start (NMActRequest *req);
|
gboolean nm_device_activation_start (NMActRequest *req);
|
||||||
|
@@ -303,7 +303,7 @@ static DBusMessage *nm_dbus_nm_create_wireless_network (DBusConnection *connecti
|
|||||||
{
|
{
|
||||||
nm_ap_set_encrypted (new_ap, TRUE);
|
nm_ap_set_encrypted (new_ap, TRUE);
|
||||||
nm_ap_set_enc_key_source (new_ap, key, (NMEncKeyType)key_type);
|
nm_ap_set_enc_key_source (new_ap, key, (NMEncKeyType)key_type);
|
||||||
nm_ap_set_auth_method (new_ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
nm_ap_set_auth_method (new_ap, IW_AUTH_ALG_OPEN_SYSTEM);
|
||||||
}
|
}
|
||||||
nm_ap_set_mode (new_ap, IW_MODE_ADHOC);
|
nm_ap_set_mode (new_ap, IW_MODE_ADHOC);
|
||||||
nm_ap_set_user_created (new_ap, TRUE);
|
nm_ap_set_user_created (new_ap, TRUE);
|
||||||
|
Reference in New Issue
Block a user