2004-06-24 14:18:37 +00:00
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* Dan Williams <dcbw@redhat.com>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*
|
|
|
|
|
* (C) Copyright 2004 Red Hat, Inc.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "NetworkManagerAP.h"
|
|
|
|
|
#include "NetworkManagerUtils.h"
|
2005-03-14 Ray Strode <rstrode@redhat.com>
Fourth (probably working) cut at porting to
dbus 0.30 api and new hal. This cut adds
some new logging macros to make debugging
easier.
* dispatcher-daemon/NetworkManagerDispatcher.c:
* info-daemon/NetworkmanagerInfo.c:
* info-daemon/NetworkManagerInfoPassphraseDialog.c:
* info-daemon/NetworkManagerInfoVPN.c:
* src/NetworkManager.c:
* src/NetworkManagerAP.c:
* src/NetworkManagerAPList.c:
* src/NetworkManagerDHCP.c:
* src/NetworkManagerDbus.c:
* src/NetworkManagerDevice.c:
* src/NetworkManagerPolicy.c:
* src/NetworkManagerSystem.c:
* src/NetworkManagerUtils.c:
* src/NetworkManagerWireless.c:
* src/autoip.c:
* src/nm-dbus-nm.c:
* src/backends/NetworkManagerDebian.c:
* src/backends/NetworkManagerGentoo.c:
* src/backends/NetworkManagerRedHat.c:
* src/backends/NetworkManagerSlackware.c:
use new logging macros.
* dispatcher-daemon/NetworkManagerDispatcher.c:
(nmd_dbus_filter): s/dbus_free/g_free/
* info-daemon/Makefile.am: link in utils library.
* info-daemon/NetworkmanagerInfo.c: use new logging
macros.
(nmi_dbus_get_network): don't assume enumerations
are 32-bit.
(nmi_dbus_nmi_message_handler): don't free what
doesn't belong to us.
* libnm_glib/libnm_glib.c:
(libnm_glib_get_nm_status):
(libnm_glib_init): don't free what doesn't
belong to us.
(libnm_glib_dbus): strdup result, so it doesn't get
lost when message is unref'd.
* panel-applet/NMWirelessAppletDbus.c:
(nmwa_dbus_update_devices): s/dbus_free/g_free/
* src/NetworkManager.c:
(nm_monitor_wired_link_state): request initial status
dump of all cards when we start up, instead of relying
on /sys/.../carrier.
(nm_info_handler), (nm_set_up_log_handlers):
log handlers to specify what syslog priorites
the logging macros default to.
* src/NetworkManagerAPList.c:
(nm_ap_list_populate_from_nmi):
s/dbus_free_string_array/g_strfreev/
* src/NetworkManagerDbus.c:
(nm_dbus_get_network_object):
validate d-bus message argument types.
Advance message iterator after reading argument,
prepend instead of append to GSList.
* src/NetworkManagerDevice.c:
(nm_device_probe_wired_link_status):
remove redundant /sys in /sys path. remove wrong
contents == NULL means has carrier assumption.
* src/nm-netlink-monitor.c
(nm_netlink_monitor_request_status): implement
function to ask kernel to dump interface link
status over netlink socket.
* test/*.c: s/dbus_free/g_free/
* utils/nm-utils.h:
(nm_print_backtrace): new macro to print backtrace.
(nm_get_timestamp): new macro to get sub-second precise
unix timestamp.
(nm_info), (nm_debug), (nm_warning), (nm_error):
new logging functions. nm_info just prints,
nm_debug includes timestamp and function,
nm_warning includes function, nm_error includes
backtrace and sigtrap.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@497 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-15 05:30:15 +00:00
|
|
|
#include "nm-utils.h"
|
2007-02-16 11:23:49 +00:00
|
|
|
#include "nm-dbus-manager.h"
|
2005-12-07 17:40:37 +00:00
|
|
|
#include <wireless.h>
|
2007-02-16 11:23:49 +00:00
|
|
|
#include "wpa.h"
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
#include "nm-access-point-glue.h"
|
|
|
|
|
|
|
|
|
|
/* This is a controlled list. Want to add to it? Stop. Ask first. */
|
2007-06-27 16:18:52 +00:00
|
|
|
static const char * default_ssid_list[] =
|
2007-02-16 11:23:49 +00:00
|
|
|
{
|
|
|
|
|
"linksys",
|
|
|
|
|
"linksys-a",
|
|
|
|
|
"linksys-g",
|
|
|
|
|
"default",
|
|
|
|
|
"belkin54g",
|
|
|
|
|
"NETGEAR",
|
|
|
|
|
NULL
|
|
|
|
|
};
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Encapsulates Access Point information
|
|
|
|
|
*/
|
2007-02-16 11:23:49 +00:00
|
|
|
typedef struct
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-03-16 09:06:48 +00:00
|
|
|
char *dbus_path;
|
|
|
|
|
|
2005-12-14 19:12:20 +00:00
|
|
|
/* Scanned or cached values */
|
2007-06-27 16:18:52 +00:00
|
|
|
GByteArray * ssid;
|
2005-12-18 02:53:32 +00:00
|
|
|
struct ether_addr address;
|
2005-12-07 17:40:37 +00:00
|
|
|
int mode; /* from IW_MODE_* in wireless.h */
|
2005-10-15 04:11:01 +00:00
|
|
|
gint8 strength;
|
2007-09-10 19:56:31 +00:00
|
|
|
guint32 freq; /* Frequency in GHz * 1000; ie 2.412 == 2412 */
|
2005-10-15 04:11:01 +00:00
|
|
|
guint16 rate;
|
2007-08-28 14:47:31 +00:00
|
|
|
|
|
|
|
|
guint32 flags; /* General flags */
|
|
|
|
|
guint32 wpa_flags; /* WPA-related flags */
|
|
|
|
|
guint32 rsn_flags; /* RSN (WPA2) -related flags */
|
2005-10-15 04:11:01 +00:00
|
|
|
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
/* Non-scanned attributes */
|
2005-10-15 04:11:01 +00:00
|
|
|
gboolean invalid;
|
|
|
|
|
gboolean artificial; /* Whether or not the AP is from a scan */
|
2006-02-02 18:05:19 +00:00
|
|
|
gboolean broadcast; /* Whether or not the AP is broadcasting (hidden) */
|
2006-06-20 02:24:57 +00:00
|
|
|
gboolean user_created; /* Whether or not the AP was created
|
|
|
|
|
* by the user with "Create network..."
|
|
|
|
|
* A subset of Ad-Hoc mode. user_created
|
|
|
|
|
* implies Ad-Hoc, but not necessarily
|
|
|
|
|
* the other way around.
|
|
|
|
|
*/
|
2007-03-26 12:29:49 +00:00
|
|
|
glong last_seen; /* Last time the AP was seen in a scan in seconds */
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
/* Things from user prefs/NetworkManagerInfo */
|
2005-12-14 20:48:08 +00:00
|
|
|
GTimeVal timestamp;
|
|
|
|
|
GSList * user_addresses;
|
2007-02-16 11:23:49 +00:00
|
|
|
} NMAccessPointPrivate;
|
|
|
|
|
|
|
|
|
|
#define NM_AP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_AP, NMAccessPointPrivate))
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (NMAccessPoint, nm_ap, G_TYPE_OBJECT)
|
|
|
|
|
|
|
|
|
|
enum {
|
2007-09-19 20:44:37 +00:00
|
|
|
PROPERTIES_CHANGED,
|
2007-02-16 11:23:49 +00:00
|
|
|
|
|
|
|
|
LAST_SIGNAL
|
2004-06-24 14:18:37 +00:00
|
|
|
};
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
PROP_0,
|
2007-08-28 14:47:31 +00:00
|
|
|
PROP_FLAGS,
|
|
|
|
|
PROP_WPA_FLAGS,
|
|
|
|
|
PROP_RSN_FLAGS,
|
2007-06-27 16:18:52 +00:00
|
|
|
PROP_SSID,
|
2007-02-16 11:23:49 +00:00
|
|
|
PROP_FREQUENCY,
|
2007-02-19 13:09:32 +00:00
|
|
|
PROP_HW_ADDRESS,
|
2007-02-16 11:23:49 +00:00
|
|
|
PROP_MODE,
|
|
|
|
|
PROP_RATE,
|
|
|
|
|
PROP_STRENGTH,
|
|
|
|
|
LAST_PROP
|
2005-09-15 14:47:17 +00:00
|
|
|
};
|
|
|
|
|
|
2007-09-19 20:44:37 +00:00
|
|
|
#define DBUS_PROP_FLAGS "Flags"
|
|
|
|
|
#define DBUS_PROP_WPA_FLAGS "WpaFlags"
|
|
|
|
|
#define DBUS_PROP_RSN_FLAGS "RsnFlags"
|
|
|
|
|
#define DBUS_PROP_SSID "Ssid"
|
|
|
|
|
#define DBUS_PROP_FREQUENCY "Frequency"
|
|
|
|
|
#define DBUS_PROP_HW_ADDRESS "HwAddress"
|
|
|
|
|
#define DBUS_PROP_MODE "Mode"
|
|
|
|
|
#define DBUS_PROP_RATE "Rate"
|
|
|
|
|
#define DBUS_PROP_STRENGTH "Strength"
|
2007-06-27 16:18:52 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
static void
|
|
|
|
|
nm_ap_init (NMAccessPoint *ap)
|
|
|
|
|
{
|
2007-03-16 09:06:48 +00:00
|
|
|
NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (ap);
|
|
|
|
|
|
2007-09-19 20:44:37 +00:00
|
|
|
priv->dbus_path = NULL;
|
2007-06-22 15:09:02 +00:00
|
|
|
priv->mode = IW_MODE_INFRA;
|
2007-08-28 14:47:31 +00:00
|
|
|
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;
|
2007-06-22 15:09:02 +00:00
|
|
|
priv->broadcast = TRUE;
|
2007-02-16 11:23:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (object);
|
|
|
|
|
|
2007-03-16 09:06:48 +00:00
|
|
|
g_free (priv->dbus_path);
|
2007-08-13 20:36:30 +00:00
|
|
|
if (priv->ssid)
|
|
|
|
|
g_byte_array_free (priv->ssid, TRUE);
|
2007-02-16 11:23:49 +00:00
|
|
|
g_slist_foreach (priv->user_addresses, (GFunc)g_free, NULL);
|
|
|
|
|
g_slist_free (priv->user_addresses);
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (nm_ap_parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_property (GObject *object, guint prop_id,
|
|
|
|
|
const GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (object);
|
2007-06-27 16:18:52 +00:00
|
|
|
GArray * ssid;
|
2007-02-16 11:23:49 +00:00
|
|
|
int mode;
|
2007-09-19 20:44:37 +00:00
|
|
|
char *dbus_prop = NULL;
|
2007-02-16 11:23:49 +00:00
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2007-08-28 14:47:31 +00:00
|
|
|
case PROP_FLAGS:
|
2007-09-19 20:44:37 +00:00
|
|
|
dbus_prop = DBUS_PROP_FLAGS;
|
2007-08-28 14:47:31 +00:00
|
|
|
priv->flags = g_value_get_uint (value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_WPA_FLAGS:
|
2007-09-19 20:44:37 +00:00
|
|
|
dbus_prop = DBUS_PROP_WPA_FLAGS;
|
2007-08-28 14:47:31 +00:00
|
|
|
priv->wpa_flags = g_value_get_uint (value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_RSN_FLAGS:
|
2007-09-19 20:44:37 +00:00
|
|
|
dbus_prop = DBUS_PROP_RSN_FLAGS;
|
2007-08-28 14:47:31 +00:00
|
|
|
priv->rsn_flags = g_value_get_uint (value);
|
2007-02-16 11:23:49 +00:00
|
|
|
break;
|
2007-06-27 16:18:52 +00:00
|
|
|
case PROP_SSID:
|
2007-09-19 20:44:37 +00:00
|
|
|
dbus_prop = DBUS_PROP_SSID;
|
2007-06-27 16:18:52 +00:00
|
|
|
ssid = g_value_get_boxed (value);
|
|
|
|
|
if (priv->ssid) {
|
|
|
|
|
g_byte_array_free (priv->ssid, TRUE);
|
|
|
|
|
priv->ssid = NULL;
|
2007-02-16 11:23:49 +00:00
|
|
|
}
|
2007-06-27 16:18:52 +00:00
|
|
|
if (ssid) {
|
|
|
|
|
int i;
|
|
|
|
|
unsigned char byte;
|
|
|
|
|
priv->ssid = g_byte_array_sized_new (ssid->len);
|
|
|
|
|
for (i = 0; i < ssid->len; i++) {
|
|
|
|
|
byte = g_array_index (ssid, unsigned char, i);
|
|
|
|
|
g_byte_array_append (priv->ssid, &byte, 1);
|
|
|
|
|
}
|
2007-02-16 11:23:49 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case PROP_FREQUENCY:
|
2007-09-19 20:44:37 +00:00
|
|
|
dbus_prop = DBUS_PROP_FREQUENCY;
|
2007-09-10 19:56:31 +00:00
|
|
|
priv->freq = g_value_get_uint (value);
|
2007-02-16 11:23:49 +00:00
|
|
|
break;
|
|
|
|
|
case PROP_MODE:
|
2007-09-19 20:44:37 +00:00
|
|
|
dbus_prop = DBUS_PROP_MODE;
|
2007-02-16 11:23:49 +00:00
|
|
|
mode = g_value_get_int (value);
|
|
|
|
|
|
|
|
|
|
if (mode == IW_MODE_ADHOC || mode == IW_MODE_INFRA)
|
|
|
|
|
priv->mode = mode;
|
|
|
|
|
else
|
|
|
|
|
g_warning ("Invalid mode");
|
|
|
|
|
break;
|
|
|
|
|
case PROP_RATE:
|
2007-09-19 20:44:37 +00:00
|
|
|
dbus_prop = DBUS_PROP_RATE;
|
2007-02-16 11:23:49 +00:00
|
|
|
priv->rate = g_value_get_uint (value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_STRENGTH:
|
2007-09-19 20:44:37 +00:00
|
|
|
dbus_prop = DBUS_PROP_STRENGTH;
|
|
|
|
|
priv->strength = g_value_get_char (value);
|
2007-02-16 11:23:49 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-09-19 20:44:37 +00:00
|
|
|
|
|
|
|
|
if (dbus_prop) {
|
|
|
|
|
GHashTable * hash;
|
|
|
|
|
|
|
|
|
|
hash = g_hash_table_new (g_str_hash, g_str_equal);
|
|
|
|
|
g_hash_table_insert (hash, dbus_prop, (gpointer) value);
|
|
|
|
|
g_signal_emit (object, signals[PROPERTIES_CHANGED], 0, hash);
|
|
|
|
|
g_hash_table_destroy (hash);
|
|
|
|
|
}
|
2007-02-16 11:23:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
get_property (GObject *object, guint prop_id,
|
|
|
|
|
GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (object);
|
2007-02-19 13:09:32 +00:00
|
|
|
char hw_addr_buf[20];
|
2007-06-27 16:18:52 +00:00
|
|
|
GArray * ssid;
|
2007-08-09 09:19:57 +00:00
|
|
|
int len;
|
2007-06-27 16:18:52 +00:00
|
|
|
int i;
|
2007-02-16 11:23:49 +00:00
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2007-08-28 14:47:31 +00:00
|
|
|
case PROP_FLAGS:
|
|
|
|
|
g_value_set_uint (value, priv->flags);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_WPA_FLAGS:
|
|
|
|
|
g_value_set_uint (value, priv->wpa_flags);
|
2007-02-16 11:23:49 +00:00
|
|
|
break;
|
2007-08-28 14:47:31 +00:00
|
|
|
case PROP_RSN_FLAGS:
|
|
|
|
|
g_value_set_uint (value, priv->rsn_flags);
|
2007-02-16 11:23:49 +00:00
|
|
|
break;
|
2007-06-27 16:18:52 +00:00
|
|
|
case PROP_SSID:
|
2007-08-09 09:19:57 +00:00
|
|
|
len = priv->ssid ? priv->ssid->len : 0;
|
|
|
|
|
ssid = g_array_sized_new (FALSE, TRUE, sizeof (unsigned char), len);
|
|
|
|
|
for (i = 0; i < len; i++)
|
2007-06-27 16:18:52 +00:00
|
|
|
g_array_append_val (ssid, priv->ssid->data[i]);
|
|
|
|
|
g_value_set_boxed (value, ssid);
|
|
|
|
|
g_array_free (ssid, TRUE);
|
2007-02-16 11:23:49 +00:00
|
|
|
break;
|
|
|
|
|
case PROP_FREQUENCY:
|
2007-09-10 19:56:31 +00:00
|
|
|
g_value_set_uint (value, priv->freq);
|
2007-02-16 11:23:49 +00:00
|
|
|
break;
|
2007-02-19 13:09:32 +00:00
|
|
|
case PROP_HW_ADDRESS:
|
|
|
|
|
memset (hw_addr_buf, 0, 20);
|
|
|
|
|
iw_ether_ntop (&priv->address, hw_addr_buf);
|
|
|
|
|
g_value_set_string (value, &hw_addr_buf[0]);
|
|
|
|
|
break;
|
2007-02-16 11:23:49 +00:00
|
|
|
case PROP_MODE:
|
|
|
|
|
g_value_set_int (value, priv->mode);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_RATE:
|
|
|
|
|
g_value_set_uint (value, priv->rate);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_STRENGTH:
|
2007-08-09 09:19:57 +00:00
|
|
|
g_value_set_char (value, priv->strength);
|
2007-02-16 11:23:49 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nm_ap_class_init (NMAccessPointClass *ap_class)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (ap_class);
|
2007-08-28 14:47:31 +00:00
|
|
|
guint32 all_sec_flags;
|
2007-02-16 11:23:49 +00:00
|
|
|
|
|
|
|
|
g_type_class_add_private (ap_class, sizeof (NMAccessPointPrivate));
|
|
|
|
|
|
|
|
|
|
/* virtual methods */
|
|
|
|
|
object_class->set_property = set_property;
|
|
|
|
|
object_class->get_property = get_property;
|
|
|
|
|
object_class->finalize = finalize;
|
|
|
|
|
|
|
|
|
|
/* properties */
|
|
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
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;
|
2007-03-26 12:29:49 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_object_class_install_property
|
2007-08-28 14:47:31 +00:00
|
|
|
(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,
|
2007-02-16 11:23:49 +00:00
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property
|
2007-08-28 14:47:31 +00:00
|
|
|
(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));
|
2007-02-16 11:23:49 +00:00
|
|
|
|
|
|
|
|
g_object_class_install_property
|
2007-06-27 16:18:52 +00:00
|
|
|
(object_class, PROP_SSID,
|
|
|
|
|
g_param_spec_boxed (NM_AP_SSID,
|
|
|
|
|
"SSID",
|
|
|
|
|
"SSID",
|
|
|
|
|
DBUS_TYPE_G_UCHAR_ARRAY,
|
|
|
|
|
G_PARAM_READWRITE));
|
2007-02-16 11:23:49 +00:00
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_FREQUENCY,
|
2007-09-10 19:56:31 +00:00
|
|
|
g_param_spec_uint (NM_AP_FREQUENCY,
|
|
|
|
|
"Frequency",
|
|
|
|
|
"Frequency",
|
|
|
|
|
0, 10000, 0,
|
|
|
|
|
G_PARAM_READWRITE));
|
2007-02-16 11:23:49 +00:00
|
|
|
|
2007-02-19 13:09:32 +00:00
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_HW_ADDRESS,
|
|
|
|
|
g_param_spec_string (NM_AP_HW_ADDRESS,
|
|
|
|
|
"MAC Address",
|
|
|
|
|
"Hardware MAC address",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READABLE));
|
2007-02-16 11:23:49 +00:00
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_MODE,
|
|
|
|
|
g_param_spec_int (NM_AP_MODE,
|
|
|
|
|
"Mode",
|
|
|
|
|
"Mode",
|
|
|
|
|
IW_MODE_ADHOC, IW_MODE_INFRA, IW_MODE_INFRA,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_RATE,
|
|
|
|
|
g_param_spec_uint (NM_AP_RATE,
|
|
|
|
|
"Rate",
|
|
|
|
|
"Rate",
|
|
|
|
|
0, G_MAXUINT16, 0,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_STRENGTH,
|
2007-08-09 09:19:57 +00:00
|
|
|
g_param_spec_char (NM_AP_STRENGTH,
|
|
|
|
|
"Strength",
|
|
|
|
|
"Strength",
|
|
|
|
|
G_MININT8, G_MAXINT8, 0,
|
|
|
|
|
G_PARAM_READWRITE));
|
2007-02-16 11:23:49 +00:00
|
|
|
|
|
|
|
|
/* Signals */
|
2007-09-19 20:44:37 +00:00
|
|
|
signals[PROPERTIES_CHANGED] =
|
|
|
|
|
g_signal_new ("properties_changed",
|
2007-02-16 11:23:49 +00:00
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
2007-09-19 20:44:37 +00:00
|
|
|
G_STRUCT_OFFSET (NMAccessPointClass, properties_changed),
|
2007-02-16 11:23:49 +00:00
|
|
|
NULL, NULL,
|
2007-09-19 20:44:37 +00:00
|
|
|
g_cclosure_marshal_VOID__BOXED,
|
|
|
|
|
G_TYPE_NONE, 1, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE));
|
2007-02-16 11:23:49 +00:00
|
|
|
|
|
|
|
|
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (ap_class),
|
|
|
|
|
&dbus_glib_nm_access_point_object_info);
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-19 20:44:37 +00:00
|
|
|
void
|
|
|
|
|
nm_ap_export_to_dbus (NMAccessPoint *ap)
|
|
|
|
|
{
|
|
|
|
|
NMAccessPointPrivate *priv;
|
|
|
|
|
NMDBusManager *mgr;
|
|
|
|
|
DBusGConnection *g_connection;
|
|
|
|
|
static guint32 counter = 0;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
|
|
|
|
|
|
|
|
|
priv = NM_AP_GET_PRIVATE (ap);
|
|
|
|
|
|
|
|
|
|
if (priv->dbus_path) {
|
|
|
|
|
nm_warning ("Tried to export AP %s twice.", priv->dbus_path);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mgr = nm_dbus_manager_get ();
|
|
|
|
|
g_assert (mgr);
|
|
|
|
|
|
|
|
|
|
g_connection = nm_dbus_manager_get_connection (mgr);
|
|
|
|
|
g_assert (g_connection);
|
|
|
|
|
|
|
|
|
|
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH_ACCESS_POINT "/%d", counter++);
|
|
|
|
|
dbus_g_connection_register_g_object (g_connection, priv->dbus_path, G_OBJECT (ap));
|
|
|
|
|
|
|
|
|
|
g_object_unref (mgr);
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
/*
|
|
|
|
|
* nm_ap_new
|
|
|
|
|
*
|
|
|
|
|
* Create a new, blank user access point info structure
|
|
|
|
|
*
|
|
|
|
|
*/
|
2007-02-16 11:23:49 +00:00
|
|
|
NMAccessPoint *nm_ap_new (void)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
GObject *object;
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
object = g_object_new (NM_TYPE_AP, NULL);
|
2007-03-16 09:06:48 +00:00
|
|
|
if (!object)
|
|
|
|
|
return NULL;
|
2007-02-16 11:23:49 +00:00
|
|
|
|
|
|
|
|
return (NMAccessPoint *) object;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-02-05 12:14:09 +00:00
|
|
|
#define IEEE80211_CAP_ESS 0x0001
|
|
|
|
|
#define IEEE80211_CAP_IBSS 0x0002
|
|
|
|
|
#define IEEE80211_CAP_PRIVACY 0x0010
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
foreach_property_cb (gpointer key, gpointer value, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
GValue *variant = (GValue *) value;
|
|
|
|
|
NMAccessPoint *ap = (NMAccessPoint *) user_data;
|
|
|
|
|
|
|
|
|
|
if (G_VALUE_HOLDS_BOXED (variant)) {
|
|
|
|
|
GArray *array = g_value_get_boxed (variant);
|
|
|
|
|
|
|
|
|
|
if (!strcmp (key, "ssid")) {
|
2007-06-27 16:18:52 +00:00
|
|
|
guint32 len = MIN (IW_ESSID_MAX_SIZE, array->len);
|
|
|
|
|
GByteArray * ssid;
|
2007-02-05 12:14:09 +00:00
|
|
|
|
|
|
|
|
/* Stupid ieee80211 layer uses <hidden> */
|
2007-06-27 16:18:52 +00:00
|
|
|
if (((len == 8) || (len == 9))
|
2007-02-05 12:14:09 +00:00
|
|
|
&& (memcmp (array->data, "<hidden>", 8) == 0))
|
|
|
|
|
return;
|
2007-06-27 16:18:52 +00:00
|
|
|
|
|
|
|
|
ssid = g_byte_array_sized_new (len);
|
2007-09-10 19:51:25 +00:00
|
|
|
g_byte_array_append (ssid, (const guint8 *) array->data, len);
|
2007-06-27 16:18:52 +00:00
|
|
|
nm_ap_set_ssid (ap, ssid);
|
|
|
|
|
g_byte_array_free (ssid, TRUE);
|
2007-02-05 12:14:09 +00:00
|
|
|
} else if (!strcmp (key, "bssid")) {
|
|
|
|
|
struct ether_addr addr;
|
|
|
|
|
|
|
|
|
|
if (array->len != ETH_ALEN)
|
|
|
|
|
return;
|
|
|
|
|
memset (&addr, 0, sizeof (struct ether_addr));
|
|
|
|
|
memcpy (&addr, array->data, ETH_ALEN);
|
|
|
|
|
nm_ap_set_address (ap, &addr);
|
|
|
|
|
} else if (!strcmp (key, "wpaie")) {
|
|
|
|
|
guint8 * ie = (guint8 *) array->data;
|
2007-08-28 14:47:31 +00:00
|
|
|
guint32 flags = nm_ap_get_wpa_flags (ap);
|
|
|
|
|
|
2007-02-05 12:14:09 +00:00
|
|
|
if (array->len <= 0 || array->len > WPA_MAX_IE_LEN)
|
|
|
|
|
return;
|
2007-08-28 14:47:31 +00:00
|
|
|
flags = nm_ap_add_security_from_ie (flags, ie, array->len);
|
|
|
|
|
nm_ap_set_wpa_flags (ap, flags);
|
2007-02-05 12:14:09 +00:00
|
|
|
} else if (!strcmp (key, "rsnie")) {
|
|
|
|
|
guint8 * ie = (guint8 *) array->data;
|
2007-08-28 14:47:31 +00:00
|
|
|
guint32 flags = nm_ap_get_rsn_flags (ap);
|
|
|
|
|
|
2007-02-05 12:14:09 +00:00
|
|
|
if (array->len <= 0 || array->len > WPA_MAX_IE_LEN)
|
|
|
|
|
return;
|
2007-08-28 14:47:31 +00:00
|
|
|
flags = nm_ap_add_security_from_ie (flags, ie, array->len);
|
|
|
|
|
nm_ap_set_rsn_flags (ap, flags);
|
2007-02-05 12:14:09 +00:00
|
|
|
}
|
|
|
|
|
} else if (G_VALUE_HOLDS_INT (variant)) {
|
|
|
|
|
gint32 int_val = g_value_get_int (variant);
|
|
|
|
|
|
|
|
|
|
if (!strcmp (key, "frequency")) {
|
2007-09-10 19:56:31 +00:00
|
|
|
nm_ap_set_freq (ap, (guint32) int_val);
|
2007-02-05 12:14:09 +00:00
|
|
|
} else if (!strcmp (key, "maxrate")) {
|
|
|
|
|
nm_ap_set_rate (ap, int_val);
|
|
|
|
|
}
|
|
|
|
|
} else if (G_VALUE_HOLDS_UINT (variant)) {
|
|
|
|
|
guint32 val = g_value_get_uint (variant);
|
|
|
|
|
|
|
|
|
|
if (!strcmp (key, "capabilities")) {
|
|
|
|
|
if (val & IEEE80211_CAP_ESS) {
|
|
|
|
|
nm_ap_set_mode (ap, IW_MODE_INFRA);
|
|
|
|
|
} else if (val & IEEE80211_CAP_IBSS) {
|
|
|
|
|
nm_ap_set_mode (ap, IW_MODE_ADHOC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (val & IEEE80211_CAP_PRIVACY) {
|
2007-08-28 14:47:31 +00:00
|
|
|
guint32 flags = nm_ap_get_flags (ap);
|
|
|
|
|
nm_ap_set_flags (ap, flags | NM_802_11_AP_FLAGS_PRIVACY);
|
2007-02-05 12:14:09 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NMAccessPoint *
|
|
|
|
|
nm_ap_new_from_properties (GHashTable *properties)
|
|
|
|
|
{
|
|
|
|
|
NMAccessPoint *ap;
|
|
|
|
|
GTimeVal cur_time;
|
2007-08-15 01:31:53 +00:00
|
|
|
const struct ether_addr * addr;
|
|
|
|
|
const char bad_bssid1[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
|
|
|
const char bad_bssid2[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
2007-02-05 12:14:09 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (properties != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
ap = nm_ap_new ();
|
|
|
|
|
|
|
|
|
|
g_hash_table_foreach (properties, foreach_property_cb, ap);
|
|
|
|
|
|
2007-08-15 01:31:53 +00:00
|
|
|
/* ignore APs with invalid BSSIDs */
|
|
|
|
|
addr = nm_ap_get_address (ap);
|
2007-08-15 02:54:15 +00:00
|
|
|
if ( !(memcmp (addr->ether_addr_octet, bad_bssid1, ETH_ALEN))
|
|
|
|
|
|| !(memcmp (addr->ether_addr_octet, bad_bssid2, ETH_ALEN))) {
|
2007-08-15 01:31:53 +00:00
|
|
|
g_object_unref (ap);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-05 12:14:09 +00:00
|
|
|
g_get_current_time (&cur_time);
|
2007-03-26 12:29:49 +00:00
|
|
|
nm_ap_set_last_seen (ap, cur_time.tv_sec);
|
2007-02-05 12:14:09 +00:00
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
if (!nm_ap_get_ssid (ap))
|
2007-02-05 12:14:09 +00:00
|
|
|
nm_ap_set_broadcast (ap, FALSE);
|
|
|
|
|
|
|
|
|
|
return ap;
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-21 01:41:04 +00:00
|
|
|
#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
|
|
|
|
|
#define MAC_ARG(x) ((guint8*)(x))[0],((guint8*)(x))[1],((guint8*)(x))[2],((guint8*)(x))[3],((guint8*)(x))[4],((guint8*)(x))[5]
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
nm_ap_print_self (NMAccessPoint *ap,
|
|
|
|
|
const char * prefix)
|
|
|
|
|
{
|
|
|
|
|
NMAccessPointPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
|
|
|
|
|
|
|
|
|
priv = NM_AP_GET_PRIVATE (ap);
|
|
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
nm_info ("%s'%s' (%p) stamp=%ld flags=0x%X wpa-flags=0x%X rsn-flags=0x%x "
|
2007-09-10 19:56:31 +00:00
|
|
|
"bssid=" MAC_FMT " strength=%d freq=%d rate=%d inval=%d "
|
2007-08-28 14:47:31 +00:00
|
|
|
"mode=%d seen=%ld",
|
2007-08-21 01:41:04 +00:00
|
|
|
prefix,
|
|
|
|
|
priv->ssid ? nm_utils_escape_ssid (priv->ssid->data, priv->ssid->len) : "(none)",
|
|
|
|
|
ap,
|
|
|
|
|
priv->timestamp.tv_sec,
|
2007-08-28 14:47:31 +00:00
|
|
|
priv->flags,
|
|
|
|
|
priv->wpa_flags,
|
|
|
|
|
priv->rsn_flags,
|
2007-08-21 01:41:04 +00:00
|
|
|
MAC_ARG (priv->address.ether_addr_octet),
|
|
|
|
|
priv->strength,
|
2007-09-10 19:56:31 +00:00
|
|
|
priv->freq,
|
2007-08-21 01:41:04 +00:00
|
|
|
priv->rate,
|
|
|
|
|
priv->invalid,
|
|
|
|
|
priv->mode,
|
|
|
|
|
priv->last_seen);
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-16 09:06:48 +00:00
|
|
|
const char *
|
|
|
|
|
nm_ap_get_dbus_path (NMAccessPoint *ap)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_AP_GET_PRIVATE (ap)->dbus_path;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-05 12:14:09 +00:00
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
/*
|
2004-08-24 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerAP.[ch]
- Add a "enc_method_good" member and accessors to an Access Point
to signal when we've found the correct encryption method
for an access point
- Add a "timestamp" member and accessors, remove "priority" member
and accessors (use timestamps instead)
- Rename "wep_key"->"enc_key"
- (nm_ap_get_enc_key_hashed): new, return the correct mangled key
for a specified encryption method using the access points
source encryption key/passphrase
* src/NetworkManagerAPList.c
- When updating a network with dbus, grab timestamp now instead of
priority
* src/NetworkManagerDBus.[ch]
- Add signal for "DeviceActivating"
- Switch priority->timestamp
* src/NetworkManagerDevice.c
- Change references of "wep_key" -> "enc_key" or "key"
- Signal DeviceActivating when starting activation
- When activating a wireless device, if the access point we are connecting
to is encrypted, and we have a source key, try to generate a mangled
key and use that (ie, generate real WEP key from a passphrase)
- Rework device activation to fallback to other encryption methods if
a previous one didn't work (ie, try mangling a key as a 104-bit passphrase
first, then if that doesn't work fall back to direct hex key).
- (nm_device_update_best_ap): fix a deadlock, and use timestamps instead of
priority. We now prefer the latest access point used, rather than using
a priority scheme
- (nm_device_do_normal_scan): make the encryption method "unknown" on access
points we've just discovered, and merge in correct info from the global
access point lists
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@68 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-25 22:41:12 +00:00
|
|
|
* Get/set functions for timestamp
|
2004-06-24 14:18:37 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
const GTimeVal *nm_ap_get_timestamp (const NMAccessPoint *ap)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), 0);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
return (&NM_AP_GET_PRIVATE (ap)->timestamp);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
2006-03-09 Robert Love <rml@novell.com>
* src/NetworkManagerAP.c, src/NetworkManagerAP.h: Have the function
nm_ap_set_timestamp() take the second and micro-second parameters as
direct arguments, which avoids both a dynamic memory allocation and a
structure-to-structure copy! Add a new interface, the aptly named
nm_ap_set_timestamp_via_timestamp(), to set the timestamp from an
existing GTimeVal, as nm_ap_set_timestamp() once did, for use with
the return from nm_ap_get_timestamp(). New users should use the new
nm_ap_set_timestamp(), not nm_ap_set_timestamp_via_timestamp(), for
the extreme benefit to performance.
* src/NetworkManagerAPList.c, src/nm-dbus-nmi.c,
src/backends/NetworkManagerSuSE.c: Use the new functions as needed.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1569 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-09 15:24:30 +00:00
|
|
|
void nm_ap_set_timestamp (NMAccessPoint *ap, glong sec, glong usec)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
NMAccessPointPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
priv = NM_AP_GET_PRIVATE (ap);
|
|
|
|
|
|
|
|
|
|
priv->timestamp.tv_sec = sec;
|
|
|
|
|
priv->timestamp.tv_usec = usec;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
2006-03-09 Robert Love <rml@novell.com>
* src/NetworkManagerAP.c, src/NetworkManagerAP.h: Have the function
nm_ap_set_timestamp() take the second and micro-second parameters as
direct arguments, which avoids both a dynamic memory allocation and a
structure-to-structure copy! Add a new interface, the aptly named
nm_ap_set_timestamp_via_timestamp(), to set the timestamp from an
existing GTimeVal, as nm_ap_set_timestamp() once did, for use with
the return from nm_ap_get_timestamp(). New users should use the new
nm_ap_set_timestamp(), not nm_ap_set_timestamp_via_timestamp(), for
the extreme benefit to performance.
* src/NetworkManagerAPList.c, src/nm-dbus-nmi.c,
src/backends/NetworkManagerSuSE.c: Use the new functions as needed.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1569 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-09 15:24:30 +00:00
|
|
|
void nm_ap_set_timestamp_via_timestamp (NMAccessPoint *ap, const GTimeVal *timestamp)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2006-03-09 Robert Love <rml@novell.com>
* src/NetworkManagerAP.c, src/NetworkManagerAP.h: Have the function
nm_ap_set_timestamp() take the second and micro-second parameters as
direct arguments, which avoids both a dynamic memory allocation and a
structure-to-structure copy! Add a new interface, the aptly named
nm_ap_set_timestamp_via_timestamp(), to set the timestamp from an
existing GTimeVal, as nm_ap_set_timestamp() once did, for use with
the return from nm_ap_get_timestamp(). New users should use the new
nm_ap_set_timestamp(), not nm_ap_set_timestamp_via_timestamp(), for
the extreme benefit to performance.
* src/NetworkManagerAPList.c, src/nm-dbus-nmi.c,
src/backends/NetworkManagerSuSE.c: Use the new functions as needed.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1569 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-09 15:24:30 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
NM_AP_GET_PRIVATE (ap)->timestamp = *timestamp;
|
2006-03-09 Robert Love <rml@novell.com>
* src/NetworkManagerAP.c, src/NetworkManagerAP.h: Have the function
nm_ap_set_timestamp() take the second and micro-second parameters as
direct arguments, which avoids both a dynamic memory allocation and a
structure-to-structure copy! Add a new interface, the aptly named
nm_ap_set_timestamp_via_timestamp(), to set the timestamp from an
existing GTimeVal, as nm_ap_set_timestamp() once did, for use with
the return from nm_ap_get_timestamp(). New users should use the new
nm_ap_set_timestamp(), not nm_ap_set_timestamp_via_timestamp(), for
the extreme benefit to performance.
* src/NetworkManagerAPList.c, src/nm-dbus-nmi.c,
src/backends/NetworkManagerSuSE.c: Use the new functions as needed.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1569 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-09 15:24:30 +00:00
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
/*
|
2007-06-27 16:18:52 +00:00
|
|
|
* Get/set functions for ssid
|
2004-06-24 14:18:37 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2007-06-27 16:18:52 +00:00
|
|
|
const GByteArray * nm_ap_get_ssid (const NMAccessPoint *ap)
|
2006-01-24 00:46:52 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), NULL);
|
2006-01-24 00:46:52 +00:00
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
return NM_AP_GET_PRIVATE (ap)->ssid;
|
2006-01-24 00:46:52 +00:00
|
|
|
}
|
|
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
void nm_ap_set_ssid (NMAccessPoint *ap, const GByteArray * ssid)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-09-19 20:44:37 +00:00
|
|
|
NMAccessPointPrivate *priv;
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-09-19 20:44:37 +00:00
|
|
|
priv = NM_AP_GET_PRIVATE (ap);
|
|
|
|
|
|
|
|
|
|
if ((ssid == priv->ssid) && ssid == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* same SSID */
|
|
|
|
|
if ((ssid && priv->ssid) && (ssid->len == priv->ssid->len)) {
|
|
|
|
|
if (!memcmp (ssid->data, priv->ssid->data, ssid->len))
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
g_object_set (ap, NM_AP_SSID, ssid, NULL);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
guint32
|
|
|
|
|
nm_ap_get_flags (NMAccessPoint *ap)
|
2005-12-21 21:08:00 +00:00
|
|
|
{
|
2007-08-28 14:47:31 +00:00
|
|
|
guint32 flags;
|
2005-12-21 21:08:00 +00:00
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), NM_802_11_AP_FLAGS_NONE);
|
2007-02-16 11:23:49 +00:00
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
g_object_get (ap, NM_AP_FLAGS, &flags, NULL);
|
2007-02-16 11:23:49 +00:00
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
return flags;
|
2005-12-21 21:08:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
void
|
|
|
|
|
nm_ap_set_flags (NMAccessPoint *ap, guint32 flags)
|
2005-12-31 08:21:24 +00:00
|
|
|
{
|
2007-09-19 20:44:37 +00:00
|
|
|
NMAccessPointPrivate *priv;
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2007-09-19 20:44:37 +00:00
|
|
|
priv = NM_AP_GET_PRIVATE (ap);
|
|
|
|
|
|
|
|
|
|
if (priv->flags != flags)
|
|
|
|
|
g_object_set (ap, NM_AP_FLAGS, flags, NULL);
|
2005-12-31 08:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
guint32
|
|
|
|
|
nm_ap_get_wpa_flags (NMAccessPoint *ap)
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
{
|
2007-08-28 14:47:31 +00:00
|
|
|
guint32 flags;
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), NM_802_11_AP_SEC_NONE);
|
2007-02-16 11:23:49 +00:00
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
g_object_get (ap, NM_AP_WPA_FLAGS, &flags, NULL);
|
2007-02-16 11:23:49 +00:00
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
return flags;
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
void
|
|
|
|
|
nm_ap_set_wpa_flags (NMAccessPoint *ap, guint32 flags)
|
2005-12-16 03:23:36 +00:00
|
|
|
{
|
2007-09-19 20:44:37 +00:00
|
|
|
NMAccessPointPrivate *priv;
|
|
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2005-12-16 03:23:36 +00:00
|
|
|
|
2007-09-19 20:44:37 +00:00
|
|
|
priv = NM_AP_GET_PRIVATE (ap);
|
|
|
|
|
|
|
|
|
|
if (priv->wpa_flags != flags)
|
|
|
|
|
g_object_set (ap, NM_AP_WPA_FLAGS, flags, NULL);
|
2005-12-16 03:23:36 +00:00
|
|
|
}
|
|
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
guint32
|
|
|
|
|
nm_ap_get_rsn_flags (NMAccessPoint *ap)
|
2005-12-16 03:23:36 +00:00
|
|
|
{
|
2007-08-28 14:47:31 +00:00
|
|
|
guint32 flags;
|
2007-02-16 11:23:49 +00:00
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), NM_802_11_AP_SEC_NONE);
|
2007-02-16 11:23:49 +00:00
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
g_object_get (ap, NM_AP_RSN_FLAGS, &flags, NULL);
|
2005-12-16 03:23:36 +00:00
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
return flags;
|
2005-12-16 03:23:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
void
|
|
|
|
|
nm_ap_set_rsn_flags (NMAccessPoint *ap, guint32 flags)
|
|
|
|
|
{
|
2007-09-19 20:44:37 +00:00
|
|
|
NMAccessPointPrivate *priv;
|
|
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
|
|
|
|
|
2007-09-19 20:44:37 +00:00
|
|
|
priv = NM_AP_GET_PRIVATE (ap);
|
|
|
|
|
|
|
|
|
|
if (priv->rsn_flags != flags)
|
|
|
|
|
g_object_set (ap, NM_AP_RSN_FLAGS, flags, NULL);
|
2007-08-28 14:47:31 +00:00
|
|
|
}
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
/*
|
|
|
|
|
* Get/set functions for address
|
|
|
|
|
*
|
|
|
|
|
*/
|
2005-05-03 Dan Williams <dcbw@redhat.com>
* Kill dhcpcd. We now use "dhcdbd", a dbus daemon that controls dhclient.
This means that NetworkManager shouldn't have DHCP issues anymore. It also
means you need dhcdbd, which you can get here (get the latest one):
http://people.redhat.com/jvdias/dhcdbd/
Technically NetworkManager can use any DHCP daemon that uses the same DBUS
interface as dhcdbd.
* Rewrite device activation to facilitate the new DHCP infrastructure and
future improvements. Its now "activation request" based, ie there is a single
activation request composed of the device, access point, and other info which
follows the entire activation process. There are 5 stages of the activation
process which correspond to:
1) Device preparation
2) Device configuration (bring it up, set ESSID/Key/etc)
3) IP Config Start (fire off DHCP if we're using it)
4) IP Config Get (grab config from DHCP or static config files)
5) IP Config Commit (set device's IP address, DNS, etc)
Note that there is no longer a "scanning" step, since the access point must
be known _before_ activation starts. If the access point drops out or does
not exist for some reason, the entire activation process fails and must be
restarted for a different access point or device.
Patch from Bill Moss:
* gnome/applet/applet.c
- Fix type of vpn_failure dialog -> vpn_banner dialog
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@597 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-03 20:41:36 +00:00
|
|
|
const struct ether_addr * nm_ap_get_address (const NMAccessPoint *ap)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), NULL);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
return &NM_AP_GET_PRIVATE (ap)->address;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
void nm_ap_set_address (NMAccessPoint *ap, const struct ether_addr * addr)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-09-19 20:44:37 +00:00
|
|
|
NMAccessPointPrivate *priv;
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2005-12-18 02:53:32 +00:00
|
|
|
g_return_if_fail (addr != NULL);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-09-19 20:44:37 +00:00
|
|
|
priv = NM_AP_GET_PRIVATE (ap);
|
|
|
|
|
|
|
|
|
|
if (memcmp (addr, &priv->address, sizeof (priv->address))) {
|
|
|
|
|
GHashTable * hash;
|
|
|
|
|
char buf[20];
|
|
|
|
|
GValue value = {0,};
|
|
|
|
|
|
|
|
|
|
memcpy (&NM_AP_GET_PRIVATE (ap)->address, addr, sizeof (struct ether_addr));
|
|
|
|
|
|
|
|
|
|
hash = g_hash_table_new (g_str_hash, g_str_equal);
|
|
|
|
|
|
|
|
|
|
memset (buf, 0, sizeof (buf));
|
|
|
|
|
iw_ether_ntop (&priv->address, buf);
|
|
|
|
|
g_value_init (&value, G_TYPE_STRING);
|
|
|
|
|
g_value_set_string (&value, &buf[0]);
|
|
|
|
|
|
|
|
|
|
g_hash_table_insert (hash, DBUS_PROP_HW_ADDRESS, (gpointer) &value);
|
|
|
|
|
g_signal_emit (ap, signals[PROPERTIES_CHANGED], 0, hash);
|
|
|
|
|
g_hash_table_destroy (hash);
|
|
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-12-16 04:24:20 +00:00
|
|
|
/*
|
|
|
|
|
* Get/set functions for mode (ie Ad-Hoc, Infrastructure, etc)
|
|
|
|
|
*
|
|
|
|
|
*/
|
2007-02-16 11:23:49 +00:00
|
|
|
int nm_ap_get_mode (NMAccessPoint *ap)
|
2004-12-16 04:24:20 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
int mode;
|
2004-12-16 04:24:20 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), -1);
|
|
|
|
|
|
|
|
|
|
g_object_get (ap, NM_AP_MODE, &mode, NULL);
|
|
|
|
|
|
|
|
|
|
return mode;
|
2004-12-16 04:24:20 +00:00
|
|
|
}
|
|
|
|
|
|
2005-12-07 17:40:37 +00:00
|
|
|
void nm_ap_set_mode (NMAccessPoint *ap, const int mode)
|
2004-12-16 04:24:20 +00:00
|
|
|
{
|
2007-09-19 20:44:37 +00:00
|
|
|
NMAccessPointPrivate *priv;
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2004-12-16 04:24:20 +00:00
|
|
|
|
2007-09-19 20:44:37 +00:00
|
|
|
priv = NM_AP_GET_PRIVATE (ap);
|
|
|
|
|
|
|
|
|
|
if (priv->mode != mode)
|
|
|
|
|
g_object_set (ap, NM_AP_MODE, mode, NULL);
|
2004-12-16 04:24:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
/*
|
2004-09-13 17:43:16 +00:00
|
|
|
* Get/set functions for strength
|
2004-06-24 14:18:37 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2007-02-16 11:23:49 +00:00
|
|
|
gint8 nm_ap_get_strength (NMAccessPoint *ap)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
gint8 strength;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), 0);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_object_get (ap, NM_AP_STRENGTH, &strength, NULL);
|
|
|
|
|
|
|
|
|
|
return strength;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
void nm_ap_set_strength (NMAccessPoint *ap, const gint8 strength)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
NMAccessPointPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
priv = NM_AP_GET_PRIVATE (ap);
|
|
|
|
|
|
2007-09-19 20:44:37 +00:00
|
|
|
if (priv->strength != strength)
|
|
|
|
|
g_object_set (ap, NM_AP_STRENGTH, strength, NULL);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Get/set functions for frequency
|
|
|
|
|
*
|
|
|
|
|
*/
|
2007-09-10 19:56:31 +00:00
|
|
|
guint32
|
|
|
|
|
nm_ap_get_freq (NMAccessPoint *ap)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-09-10 19:56:31 +00:00
|
|
|
guint32 freq;
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), 0);
|
|
|
|
|
|
|
|
|
|
g_object_get (ap, NM_AP_FREQUENCY, &freq, NULL);
|
|
|
|
|
|
|
|
|
|
return freq;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
2007-09-10 19:56:31 +00:00
|
|
|
void
|
|
|
|
|
nm_ap_set_freq (NMAccessPoint *ap,
|
|
|
|
|
const guint32 freq)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_object_set (ap, NM_AP_FREQUENCY, freq, NULL);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Get/set functions for rate
|
|
|
|
|
*
|
|
|
|
|
*/
|
2007-02-16 11:23:49 +00:00
|
|
|
guint16 nm_ap_get_rate (NMAccessPoint *ap)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
guint16 rate;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), 0);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_object_get (ap, NM_AP_RATE, &rate, NULL);
|
|
|
|
|
|
|
|
|
|
return rate;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_rate (NMAccessPoint *ap, guint16 rate)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_object_set (ap, NM_AP_RATE, rate, NULL);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2004-07-28 02:49:33 +00:00
|
|
|
* Get/set functions for "invalid" access points, ie ones
|
|
|
|
|
* for which a user explicitly does not wish to connect to
|
|
|
|
|
* (by cancelling requests for WEP key, for example)
|
2004-06-24 14:18:37 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
gboolean nm_ap_get_invalid (const NMAccessPoint *ap)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), TRUE);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
return NM_AP_GET_PRIVATE (ap)->invalid;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-07-28 02:49:33 +00:00
|
|
|
void nm_ap_set_invalid (NMAccessPoint *ap, gboolean invalid)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
NM_AP_GET_PRIVATE (ap)->invalid = invalid;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
2004-08-02 21:12:40 +00:00
|
|
|
|
|
|
|
|
|
2004-10-15 17:04:57 +00:00
|
|
|
/*
|
|
|
|
|
* Get/Set functions to indicate that an access point is
|
|
|
|
|
* 'artificial', ie whether or not it was actually scanned
|
|
|
|
|
* by the card or not
|
|
|
|
|
*
|
|
|
|
|
*/
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
gboolean nm_ap_get_artificial (const NMAccessPoint *ap)
|
2004-10-15 17:04:57 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), FALSE);
|
2004-10-15 17:04:57 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
return NM_AP_GET_PRIVATE (ap)->artificial;
|
2004-10-15 17:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_artificial (NMAccessPoint *ap, gboolean artificial)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2004-10-15 17:04:57 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
NM_AP_GET_PRIVATE (ap)->artificial = artificial;
|
2004-10-15 17:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-02-02 18:05:19 +00:00
|
|
|
/*
|
|
|
|
|
* Get/Set functions to indicate whether an access point is broadcasting
|
|
|
|
|
* (hidden). This is a superset of artificial.
|
|
|
|
|
*/
|
2007-02-16 11:23:49 +00:00
|
|
|
gboolean nm_ap_get_broadcast (NMAccessPoint *ap)
|
2006-02-02 18:05:19 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), TRUE);
|
|
|
|
|
|
|
|
|
|
return NM_AP_GET_PRIVATE (ap)->broadcast;
|
2006-02-02 18:05:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_broadcast (NMAccessPoint *ap, gboolean broadcast)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
|
|
|
|
|
|
|
|
|
NM_AP_GET_PRIVATE (ap)->broadcast = broadcast;
|
2006-02-02 18:05:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
/*
|
|
|
|
|
* Get/Set functions for how long ago the AP was last seen in a scan.
|
|
|
|
|
* APs older than a certain date are dropped from the list.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2007-03-26 12:29:49 +00:00
|
|
|
glong nm_ap_get_last_seen (const NMAccessPoint *ap)
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), FALSE);
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
|
2007-03-26 12:29:49 +00:00
|
|
|
return NM_AP_GET_PRIVATE (ap)->last_seen;
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-26 12:29:49 +00:00
|
|
|
void nm_ap_set_last_seen (NMAccessPoint *ap, const glong last_seen)
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
|
2007-03-26 12:29:49 +00:00
|
|
|
NM_AP_GET_PRIVATE (ap)->last_seen = last_seen;
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-12-17 17:16:22 +00:00
|
|
|
/*
|
|
|
|
|
* Get/Set functions to indicate that an access point is
|
|
|
|
|
* user-created, ie whether or not its a network filled with
|
|
|
|
|
* information from the user and intended to create a new Ad-Hoc
|
|
|
|
|
* wireless network.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
gboolean nm_ap_get_user_created (const NMAccessPoint *ap)
|
2004-12-17 17:16:22 +00:00
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), FALSE);
|
2004-12-17 17:16:22 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
return NM_AP_GET_PRIVATE (ap)->user_created;
|
2004-12-17 17:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_user_created (NMAccessPoint *ap, gboolean user_created)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
2004-12-17 17:16:22 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
NM_AP_GET_PRIVATE (ap)->user_created = user_created;
|
2004-12-17 17:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
/*
|
|
|
|
|
* Get/Set functions for user address list
|
|
|
|
|
*
|
|
|
|
|
* The internal address list is always "owned" by the AP and
|
|
|
|
|
* the list returned by nm_ap_get_user_addresses() is a deep copy.
|
|
|
|
|
* Likewise, when setting the list, a deep copy is made for the
|
|
|
|
|
* ap's actual list.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2005-01-18 Dan Williams <dcbw@redhat.com>
* dhcpcd/client.c
- Remove some debug messages
- Wrap others in #ifdef DEBUG/#endif
* src/NetworkManager.c
- Remove some debug messages
- Clarify some debug messages
- Remove code related to old single-thread wireless scanning
* src/NetworkManagerAP.[ch]
- New AP property "last_seen" to track how recently an AP was
found in a scan
- Start using 'const' more in function arguments
* src/NetworkManagerAPList.[ch]
- (nm_ap_list_merge_scanned_ap): new, selectively update attributes
of an AP found in an AP list from a source AP, or if not found
in the list add the source AP
- (nm_ap_list_combine): remove, no longer needed
* src/NetworkManagerDevice.c
- Each device now has a "worker" thread from start to end of its life.
Scanning for wireless devices now happens in that thread,
not in a single "wireless scanning thread" for all devices as
previously. Activation consists of adding an idle handler to the
thread's main loop/context, which gets run at the next available
opportunity.
- Wireless scanning is also simplified, there is now only one list of
access points per wireless device, and APs older than 60s are
removed from the list. Previously, we kept results for the last
3 scans and merged whole lists, which was complicated.
- Cleaned up activation debug messages.
- Wireless activation and access-point search routines now use Open System
authentication before trying Shared Key.
- Removed some code in nm_device_update_best_ap() that could cause cards
to loose their link to the access point.
- Scanning now uses a backoff algorithm, where the inverval becomes
progressively longer between scans when the list of scanned access
points doesn't change. A change will revert to the shortest scan
interval (20s).
* src/NetworkManagerWireless.[ch]
- Remove code related to old single-thread wireless scanning
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@382 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-01-18 22:08:22 +00:00
|
|
|
GSList *nm_ap_get_user_addresses (const NMAccessPoint *ap)
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
{
|
|
|
|
|
GSList *new = NULL;
|
2005-02-10 04:39:40 +00:00
|
|
|
GSList *elt = NULL;
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), NULL);
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
for (elt = NM_AP_GET_PRIVATE (ap)->user_addresses; elt; elt = g_slist_next (elt))
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
{
|
2005-02-10 04:39:40 +00:00
|
|
|
if (elt->data)
|
|
|
|
|
new = g_slist_append (new, g_strdup (elt->data));
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a _deep__copy_ of the address list */
|
2007-02-16 11:23:49 +00:00
|
|
|
return new;
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_user_addresses (NMAccessPoint *ap, GSList *list)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
NMAccessPointPrivate *priv;
|
2005-02-10 04:39:40 +00:00
|
|
|
GSList *elt = NULL;
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
GSList *new = NULL;
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_if_fail (NM_IS_AP (ap));
|
|
|
|
|
|
|
|
|
|
priv = NM_AP_GET_PRIVATE (ap);
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
|
|
|
|
|
/* Free existing list */
|
2007-02-16 11:23:49 +00:00
|
|
|
g_slist_foreach (priv->user_addresses, (GFunc) g_free, NULL);
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
|
|
|
|
|
/* Copy new list and set as our own */
|
2005-02-10 04:39:40 +00:00
|
|
|
for (elt = list; elt; elt = g_slist_next (elt))
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
{
|
2005-02-10 04:39:40 +00:00
|
|
|
if (elt->data)
|
2007-08-17 21:31:22 +00:00
|
|
|
new = g_slist_append (new, g_ascii_strup (elt->data, -1));
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
}
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
priv->user_addresses = new;
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
}
|
|
|
|
|
|
2005-01-21 19:32:08 +00:00
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
gboolean nm_ap_has_manufacturer_default_ssid (NMAccessPoint *ap)
|
2005-09-15 14:47:17 +00:00
|
|
|
{
|
2007-06-27 16:18:52 +00:00
|
|
|
const char **default_ssid = default_ssid_list;
|
|
|
|
|
const GByteArray * this_ssid;
|
2005-09-15 14:47:17 +00:00
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_AP (ap), FALSE);
|
2007-06-27 16:18:52 +00:00
|
|
|
this_ssid = NM_AP_GET_PRIVATE (ap)->ssid;
|
2005-09-15 14:47:17 +00:00
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
while (*default_ssid) {
|
|
|
|
|
if (this_ssid->len == strlen (*default_ssid)) {
|
|
|
|
|
if (!memcmp (*default_ssid, this_ssid->data, this_ssid->len))
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
default_ssid++;
|
2005-09-15 14:47:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2005-10-15 04:11:01 +00:00
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
guint32
|
|
|
|
|
nm_ap_add_security_from_ie (guint32 flags,
|
|
|
|
|
const guint8 *wpa_ie,
|
|
|
|
|
guint32 length)
|
2005-10-15 04:11:01 +00:00
|
|
|
{
|
2007-08-28 14:47:31 +00:00
|
|
|
wpa_ie_data * cap_data;
|
2005-10-15 04:11:01 +00:00
|
|
|
|
2005-12-14 20:48:08 +00:00
|
|
|
if (!(cap_data = wpa_parse_wpa_ie (wpa_ie, length)))
|
2007-08-28 14:47:31 +00:00
|
|
|
return NM_802_11_AP_SEC_NONE;
|
|
|
|
|
|
|
|
|
|
/* Pairwise cipher flags */
|
|
|
|
|
if (cap_data->pairwise_cipher & IW_AUTH_CIPHER_WEP40)
|
|
|
|
|
flags |= NM_802_11_AP_SEC_PAIR_WEP40;
|
|
|
|
|
if (cap_data->pairwise_cipher & IW_AUTH_CIPHER_WEP104)
|
|
|
|
|
flags |= NM_802_11_AP_SEC_PAIR_WEP104;
|
|
|
|
|
if (cap_data->pairwise_cipher & IW_AUTH_CIPHER_TKIP)
|
|
|
|
|
flags |= NM_802_11_AP_SEC_PAIR_TKIP;
|
|
|
|
|
if (cap_data->pairwise_cipher & IW_AUTH_CIPHER_CCMP)
|
|
|
|
|
flags |= NM_802_11_AP_SEC_PAIR_CCMP;
|
|
|
|
|
|
|
|
|
|
/* Group cipher flags */
|
|
|
|
|
if (cap_data->group_cipher & IW_AUTH_CIPHER_WEP40)
|
|
|
|
|
flags |= NM_802_11_AP_SEC_GROUP_WEP40;
|
|
|
|
|
if (cap_data->group_cipher & IW_AUTH_CIPHER_WEP104)
|
|
|
|
|
flags |= NM_802_11_AP_SEC_GROUP_WEP104;
|
|
|
|
|
if (cap_data->group_cipher & IW_AUTH_CIPHER_TKIP)
|
|
|
|
|
flags |= NM_802_11_AP_SEC_GROUP_TKIP;
|
|
|
|
|
if (cap_data->group_cipher & IW_AUTH_CIPHER_CCMP)
|
|
|
|
|
flags |= NM_802_11_AP_SEC_GROUP_CCMP;
|
2005-10-15 04:11:01 +00:00
|
|
|
|
2005-12-14 20:48:08 +00:00
|
|
|
if (cap_data->key_mgmt & IW_AUTH_KEY_MGMT_802_1X)
|
2007-08-28 14:47:31 +00:00
|
|
|
flags |= NM_802_11_AP_SEC_KEY_MGMT_802_1X;
|
2005-12-14 20:48:08 +00:00
|
|
|
if (cap_data->key_mgmt & IW_AUTH_KEY_MGMT_PSK)
|
2007-08-28 14:47:31 +00:00
|
|
|
flags |= NM_802_11_AP_SEC_KEY_MGMT_PSK;
|
2006-08-04 15:46:06 +00:00
|
|
|
|
|
|
|
|
g_slice_free (wpa_ie_data, cap_data);
|
2007-08-28 14:47:31 +00:00
|
|
|
return flags;
|
2005-10-15 04:11:01 +00:00
|
|
|
}
|
|
|
|
|
|
2007-09-10 19:11:40 +00:00
|
|
|
static gboolean
|
|
|
|
|
match_cipher (const char * cipher,
|
|
|
|
|
const char * expected,
|
|
|
|
|
guint32 wpa_flags,
|
|
|
|
|
guint32 rsn_flags,
|
|
|
|
|
guint32 flag)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp (cipher, expected) != 0)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (!(wpa_flags & flag) && !(rsn_flags & flag))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
security_compatible (NMAccessPoint *self,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
NMSettingWireless *s_wireless)
|
|
|
|
|
{
|
|
|
|
|
NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (self);
|
|
|
|
|
NMSettingWirelessSecurity *s_wireless_sec;
|
|
|
|
|
guint32 flags = priv->flags;
|
|
|
|
|
guint32 wpa_flags = priv->wpa_flags;
|
|
|
|
|
guint32 rsn_flags = priv->rsn_flags;
|
|
|
|
|
|
|
|
|
|
if (!s_wireless->security) {
|
|
|
|
|
if ( (flags & NM_802_11_AP_FLAGS_PRIVACY)
|
|
|
|
|
|| (wpa_flags != NM_802_11_AP_SEC_NONE)
|
|
|
|
|
|| (rsn_flags != NM_802_11_AP_SEC_NONE))
|
|
|
|
|
return FALSE;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strcmp (s_wireless->security, "802-11-wireless-security") != 0)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
s_wireless_sec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection, "802-11-wireless-security");
|
|
|
|
|
if (s_wireless_sec == NULL || !s_wireless_sec->key_mgmt)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* Static WEP */
|
|
|
|
|
if (!strcmp (s_wireless_sec->key_mgmt, "none")) {
|
|
|
|
|
if ( !(flags & NM_802_11_AP_FLAGS_PRIVACY)
|
|
|
|
|
|| (wpa_flags != NM_802_11_AP_SEC_NONE)
|
|
|
|
|
|| (rsn_flags != NM_802_11_AP_SEC_NONE))
|
|
|
|
|
return FALSE;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Adhoc WPA */
|
|
|
|
|
if (!strcmp (s_wireless_sec->key_mgmt, "wpa-none")) {
|
|
|
|
|
if (priv->mode != IW_MODE_ADHOC)
|
|
|
|
|
return FALSE;
|
|
|
|
|
// FIXME: validate ciphers if the BSSID actually puts WPA/RSN IE in
|
|
|
|
|
// it's beacon
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Stuff after this point requires infrastructure */
|
|
|
|
|
if (priv->mode != IW_MODE_INFRA)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* Dynamic WEP or LEAP/Network EAP */
|
|
|
|
|
if (!strcmp (s_wireless_sec->key_mgmt, "ieee8021x")) {
|
|
|
|
|
// FIXME: should we allow APs that advertise WPA/RSN support here?
|
|
|
|
|
if ( !(flags & NM_802_11_AP_FLAGS_PRIVACY)
|
|
|
|
|
|| (wpa_flags != NM_802_11_AP_SEC_NONE)
|
|
|
|
|
|| (rsn_flags != NM_802_11_AP_SEC_NONE))
|
|
|
|
|
return FALSE;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* WPA[2]-PSK */
|
|
|
|
|
if (!strcmp (s_wireless_sec->key_mgmt, "wpa-psk")) {
|
|
|
|
|
GSList * elt;
|
|
|
|
|
gboolean found = FALSE;
|
|
|
|
|
|
|
|
|
|
if (!s_wireless_sec->pairwise || !s_wireless_sec->group)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if ( !(wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK)
|
|
|
|
|
&& !(rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
// FIXME: should handle WPA and RSN separately here to ensure that
|
|
|
|
|
// if the Connection only uses WPA we don't match a cipher against
|
|
|
|
|
// the AP's RSN IE instead
|
|
|
|
|
|
|
|
|
|
/* Match at least one pairwise cipher with AP's capability */
|
|
|
|
|
for (elt = s_wireless_sec->pairwise; elt; elt = g_slist_next (elt)) {
|
|
|
|
|
if ((found = match_cipher (elt->data, "tkip", wpa_flags, rsn_flags, NM_802_11_AP_SEC_PAIR_TKIP)))
|
|
|
|
|
break;
|
|
|
|
|
if ((found = match_cipher (elt->data, "ccmp", wpa_flags, rsn_flags, NM_802_11_AP_SEC_PAIR_CCMP)))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!found)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* Match at least one group cipher with AP's capability */
|
|
|
|
|
for (elt = s_wireless_sec->group; elt; elt = g_slist_next (elt)) {
|
|
|
|
|
if ((found = match_cipher (elt->data, "wep40", wpa_flags, rsn_flags, NM_802_11_AP_SEC_GROUP_WEP40)))
|
|
|
|
|
break;
|
|
|
|
|
if ((found = match_cipher (elt->data, "wep104", wpa_flags, rsn_flags, NM_802_11_AP_SEC_GROUP_WEP104)))
|
|
|
|
|
break;
|
|
|
|
|
if ((found = match_cipher (elt->data, "tkip", wpa_flags, rsn_flags, NM_802_11_AP_SEC_GROUP_TKIP)))
|
|
|
|
|
break;
|
|
|
|
|
if ((found = match_cipher (elt->data, "ccmp", wpa_flags, rsn_flags, NM_802_11_AP_SEC_GROUP_CCMP)))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!found)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!strcmp (s_wireless_sec->key_mgmt, "wpa-eap")) {
|
|
|
|
|
// FIXME: implement
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
|
nm_ap_check_compatible (NMAccessPoint *self,
|
|
|
|
|
NMConnection *connection)
|
|
|
|
|
{
|
|
|
|
|
NMAccessPointPrivate *priv;
|
|
|
|
|
NMSettingWireless *s_wireless;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (NM_IS_AP (self), FALSE);
|
|
|
|
|
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
|
|
|
|
|
|
|
|
|
|
priv = NM_AP_GET_PRIVATE (self);
|
|
|
|
|
|
|
|
|
|
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, "802-11-wireless");
|
|
|
|
|
if (s_wireless == NULL)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (!nm_utils_same_ssid (s_wireless->ssid, priv->ssid, TRUE))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (s_wireless->bssid) {
|
|
|
|
|
if (memcmp (s_wireless->bssid->data, &priv->address, ETH_ALEN))
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (s_wireless->mode) {
|
|
|
|
|
if ( !strcmp (s_wireless->mode, "infrastructure")
|
|
|
|
|
&& (priv->mode != IW_MODE_INFRA))
|
|
|
|
|
return FALSE;
|
|
|
|
|
if ( !strcmp (s_wireless->mode, "adhoc")
|
|
|
|
|
&& (priv->mode != IW_MODE_ADHOC))
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (s_wireless->band) {
|
|
|
|
|
if (!strcmp (s_wireless->band, "a")) {
|
|
|
|
|
if (priv->freq < 5170 || priv->freq > 5825)
|
|
|
|
|
return FALSE;
|
|
|
|
|
} else if (!strcmp (s_wireless->band, "bg")) {
|
|
|
|
|
if (priv->freq < 2412 || priv->freq > 2472)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (s_wireless->channel) {
|
|
|
|
|
guint32 ap_chan = freq_to_channel (priv->freq);
|
|
|
|
|
|
|
|
|
|
if (s_wireless->channel != ap_chan)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return security_compatible (self, connection, s_wireless);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct cf_pair {
|
|
|
|
|
guint32 chan;
|
2007-09-10 19:51:25 +00:00
|
|
|
guint32 freq;
|
2007-09-10 19:11:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static struct cf_pair cf_table[46] = {
|
|
|
|
|
/* B/G band */
|
|
|
|
|
{ 1, 2412 },
|
|
|
|
|
{ 2, 2417 },
|
|
|
|
|
{ 3, 2422 },
|
|
|
|
|
{ 4, 2427 },
|
|
|
|
|
{ 5, 2432 },
|
|
|
|
|
{ 6, 2437 },
|
|
|
|
|
{ 7, 2442 },
|
|
|
|
|
{ 8, 2447 },
|
|
|
|
|
{ 9, 2452 },
|
|
|
|
|
{ 10, 2457 },
|
|
|
|
|
{ 11, 2462 },
|
|
|
|
|
{ 12, 2467 },
|
|
|
|
|
{ 13, 2472 },
|
|
|
|
|
/* A band */
|
|
|
|
|
{ 34, 5170 },
|
|
|
|
|
{ 36, 5180 },
|
|
|
|
|
{ 38, 5190 },
|
|
|
|
|
{ 40, 5200 },
|
|
|
|
|
{ 42, 5210 },
|
|
|
|
|
{ 44, 5220 },
|
|
|
|
|
{ 46, 5230 },
|
|
|
|
|
{ 48, 5240 },
|
|
|
|
|
{ 50, 5250 },
|
|
|
|
|
{ 52, 5260 },
|
|
|
|
|
{ 56, 5280 },
|
|
|
|
|
{ 58, 5290 },
|
|
|
|
|
{ 60, 5300 },
|
|
|
|
|
{ 64, 5320 },
|
|
|
|
|
{ 100, 5500 },
|
|
|
|
|
{ 104, 5520 },
|
|
|
|
|
{ 108, 5540 },
|
|
|
|
|
{ 112, 5560 },
|
|
|
|
|
{ 116, 5580 },
|
|
|
|
|
{ 120, 5600 },
|
|
|
|
|
{ 124, 5620 },
|
|
|
|
|
{ 128, 5640 },
|
|
|
|
|
{ 132, 5660 },
|
|
|
|
|
{ 136, 5680 },
|
|
|
|
|
{ 140, 5700 },
|
|
|
|
|
{ 149, 5745 },
|
|
|
|
|
{ 152, 5760 },
|
|
|
|
|
{ 153, 5765 },
|
|
|
|
|
{ 157, 5785 },
|
|
|
|
|
{ 160, 5800 },
|
|
|
|
|
{ 161, 5805 },
|
|
|
|
|
{ 165, 5825 },
|
|
|
|
|
{ 0, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
guint32
|
2007-09-10 19:51:25 +00:00
|
|
|
freq_to_channel (guint32 freq)
|
2007-09-10 19:11:40 +00:00
|
|
|
{
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
while (cf_table[i].chan && (cf_table[i].freq != freq))
|
|
|
|
|
i++;
|
|
|
|
|
return cf_table[i].chan;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-10 19:51:25 +00:00
|
|
|
guint32
|
2007-09-10 19:11:40 +00:00
|
|
|
channel_to_freq (guint32 channel)
|
|
|
|
|
{
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
while (cf_table[i].chan && (cf_table[i].chan != channel))
|
|
|
|
|
i++;
|
|
|
|
|
return cf_table[i].freq;
|
|
|
|
|
}
|
|
|
|
|
|