mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 16:30:31 +01:00
2007-10-08 Dan Williams <dcbw@redhat.com>
* src/nm-device-802-11-wireless.c src/nm-device-802-11-wireless.h - (nm_device_802_11_wireless_class_init, merge_scanned_ap): new 'hidden-ap-found' signal (for internal use only) that allows the NMManager to fill in the AP's SSID if a connection has that AP's BSSID in its seen-bssids list * src/nm-manager.c - (manager_hidden_ap_found, nm_manager_add_device): attach to a wireless device's hidden-ap-found signal and fill in the APs SSID if possible git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2953 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
a9251b8b68
commit
d66216620d
4 changed files with 95 additions and 9 deletions
14
ChangeLog
14
ChangeLog
|
|
@ -1,3 +1,17 @@
|
|||
2007-10-08 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/nm-device-802-11-wireless.c
|
||||
src/nm-device-802-11-wireless.h
|
||||
- (nm_device_802_11_wireless_class_init, merge_scanned_ap): new
|
||||
'hidden-ap-found' signal (for internal use only) that allows the
|
||||
NMManager to fill in the AP's SSID if a connection has that AP's
|
||||
BSSID in its seen-bssids list
|
||||
|
||||
* src/nm-manager.c
|
||||
- (manager_hidden_ap_found, nm_manager_add_device): attach to a
|
||||
wireless device's hidden-ap-found signal and fill in the APs SSID
|
||||
if possible
|
||||
|
||||
2007-10-07 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/nm-manager.c
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ enum {
|
|||
enum {
|
||||
ACCESS_POINT_ADDED,
|
||||
ACCESS_POINT_REMOVED,
|
||||
HIDDEN_AP_FOUND,
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
|
|
@ -189,12 +190,6 @@ static void device_cleanup (NMDevice80211Wireless *self);
|
|||
static int nm_device_802_11_wireless_get_bitrate (NMDevice80211Wireless *self);
|
||||
|
||||
|
||||
static void
|
||||
access_point_added (NMDevice80211Wireless *device, NMAccessPoint *ap)
|
||||
{
|
||||
g_signal_emit (device, signals[ACCESS_POINT_ADDED], 0, ap);
|
||||
}
|
||||
|
||||
static void
|
||||
access_point_removed (NMDevice80211Wireless *device, NMAccessPoint *ap)
|
||||
{
|
||||
|
|
@ -1625,6 +1620,9 @@ merge_scanned_ap (NMDevice80211Wireless *self,
|
|||
GSList * elt;
|
||||
NMAccessPoint * found_ap = NULL;
|
||||
|
||||
/* Allow the manager to fill in the SSID if possible */
|
||||
g_signal_emit (self, signals[HIDDEN_AP_FOUND], 0, merge_ap);
|
||||
|
||||
for (elt = self->priv->ap_list; elt; elt = g_slist_next (elt)) {
|
||||
NMAccessPoint * list_ap = NM_AP (elt->data);
|
||||
const GByteArray * list_ssid = nm_ap_get_ssid (list_ap);
|
||||
|
|
@ -1681,7 +1679,7 @@ merge_scanned_ap (NMDevice80211Wireless *self,
|
|||
g_object_ref (merge_ap);
|
||||
self->priv->ap_list = g_slist_append (self->priv->ap_list, merge_ap);
|
||||
nm_ap_export_to_dbus (merge_ap);
|
||||
access_point_added (self, merge_ap);
|
||||
g_signal_emit (self, signals[ACCESS_POINT_ADDED], 0, merge_ap);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2935,6 +2933,16 @@ nm_device_802_11_wireless_class_init (NMDevice80211WirelessClass *klass)
|
|||
G_TYPE_NONE, 1,
|
||||
G_TYPE_OBJECT);
|
||||
|
||||
signals[HIDDEN_AP_FOUND] =
|
||||
g_signal_new ("hidden-ap-found",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMDevice80211WirelessClass, hidden_ap_found),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_OBJECT);
|
||||
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
g_signal_new ("properties_changed",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
|
|
|
|||
|
|
@ -69,9 +69,10 @@ struct _NMDevice80211WirelessClass
|
|||
NMDeviceClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*access_point_added) (NMDevice80211Wireless *device, NMAccessPoint *ap);
|
||||
void (*access_point_added) (NMDevice80211Wireless *device, NMAccessPoint *ap);
|
||||
void (*access_point_removed) (NMDevice80211Wireless *device, NMAccessPoint *ap);
|
||||
void (*properties_changed) (NMDevice80211Wireless *device, GHashTable *properties);
|
||||
void (*hidden_ap_found) (NMDevice80211Wireless *device, NMAccessPoint *ap);
|
||||
void (*properties_changed) (NMDevice80211Wireless *device, GHashTable *properties);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -868,6 +868,60 @@ manager_device_state_changed (NMDeviceInterface *device, NMDeviceState state, gp
|
|||
nm_manager_update_state (manager);
|
||||
}
|
||||
|
||||
static void
|
||||
manager_hidden_ap_found (NMDeviceInterface *device,
|
||||
NMAccessPoint *ap,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMManager *manager = NM_MANAGER (user_data);
|
||||
const struct ether_addr *ap_addr;
|
||||
const GByteArray *ap_ssid;
|
||||
GSList *iter;
|
||||
GSList *connections;
|
||||
gboolean done = FALSE;
|
||||
|
||||
ap_ssid = nm_ap_get_ssid (ap);
|
||||
if (ap_ssid && ap_ssid->len)
|
||||
return;
|
||||
|
||||
ap_addr = nm_ap_get_address (ap);
|
||||
g_assert (ap_addr);
|
||||
|
||||
/* Look for this AP's BSSID in the seen-bssids list of a connection,
|
||||
* and if a match is found, copy over the SSID */
|
||||
connections = nm_manager_get_connections (manager, NM_CONNECTION_TYPE_SYSTEM);
|
||||
connections = g_slist_concat (connections, nm_manager_get_connections (manager, NM_CONNECTION_TYPE_USER));
|
||||
|
||||
for (iter = connections; iter && !done; iter = g_slist_next (iter)) {
|
||||
NMConnection *connection = NM_CONNECTION (iter->data);
|
||||
NMSettingWireless *s_wireless;
|
||||
GSList *seen_iter;
|
||||
|
||||
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_SETTING_WIRELESS);
|
||||
if (!s_wireless || !s_wireless->seen_bssids)
|
||||
goto next;
|
||||
g_assert (s_wireless->ssid);
|
||||
|
||||
for (seen_iter = s_wireless->seen_bssids; seen_iter; seen_iter = g_slist_next (seen_iter)) {
|
||||
struct ether_addr seen_addr;
|
||||
|
||||
if (!ether_aton_r ((char *) seen_iter->data, &seen_addr))
|
||||
continue;
|
||||
|
||||
if (memcmp (ap_addr, &seen_addr, sizeof (struct ether_addr)))
|
||||
continue;
|
||||
|
||||
/* Copy the SSID from the connection to the AP */
|
||||
nm_ap_set_ssid (ap, s_wireless->ssid);
|
||||
done = TRUE;
|
||||
}
|
||||
|
||||
next:
|
||||
g_object_unref (connection);
|
||||
}
|
||||
g_slist_free (connections);
|
||||
}
|
||||
|
||||
void
|
||||
nm_manager_add_device (NMManager *manager, NMDevice *device)
|
||||
{
|
||||
|
|
@ -884,6 +938,15 @@ nm_manager_add_device (NMManager *manager, NMDevice *device)
|
|||
G_CALLBACK (manager_device_state_changed),
|
||||
manager);
|
||||
|
||||
/* Attach to the access-point-added signal so that the manager can fill
|
||||
* non-SSID-broadcasting APs with an SSID.
|
||||
*/
|
||||
if (NM_IS_DEVICE_802_11_WIRELESS (device)) {
|
||||
g_signal_connect (device, "hidden-ap-found",
|
||||
G_CALLBACK (manager_hidden_ap_found),
|
||||
manager);
|
||||
}
|
||||
|
||||
if (!priv->sleeping) {
|
||||
if (!NM_IS_DEVICE_802_11_WIRELESS (device) || priv->wireless_enabled) {
|
||||
nm_device_bring_down (device, TRUE);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue