Commit ff88a840 authored by Dan Williams's avatar Dan Williams
Browse files

2005-10-19 Dan Williams <dcbw@redhat.com>

	* src/NetworkManagerDevice.c
		- (process_scan_results): don't drop the last (or only)
			access point we see


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1049 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent de3985c5
2005-10-19 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerDevice.c
- (process_scan_results): don't drop the last (or only)
access point we see
2005-10-19 Christopher Aillon <caillon@redhat.com> 2005-10-19 Christopher Aillon <caillon@redhat.com>
* src/backends/NetworkManagerSlackware.c: * src/backends/NetworkManagerSlackware.c:
......
...@@ -4496,6 +4496,39 @@ static guint8 * get_scan_results (NMDevice *dev, NMSock *sk, guint32 *data_len) ...@@ -4496,6 +4496,39 @@ static guint8 * get_scan_results (NMDevice *dev, NMSock *sk, guint32 *data_len)
} }
static void add_new_ap_to_device_list (NMDevice *dev, NMAccessPoint *ap)
{
gboolean new = FALSE;
gboolean strength_changed = FALSE;
GTimeVal cur_time;
g_return_if_fail (dev != NULL);
g_return_if_fail (ap != NULL);
g_get_current_time (&cur_time);
nm_ap_set_last_seen (ap, &cur_time);
/* If the AP is not broadcasting its ESSID, try to fill it in here from our
* allowed list where we cache known MAC->ESSID associations.
*/
if (!nm_ap_get_essid (ap))
nm_ap_list_copy_one_essid_by_address (ap, dev->app_data->allowed_ap_list);
/* Add the AP to the device's AP list */
if (nm_ap_list_merge_scanned_ap (nm_device_ap_list_get (dev), ap, &new, &strength_changed))
{
DBusConnection *con = dev->app_data->dbus_connection;
/* Handle dbus signals that we need to broadcast when the AP is added to the list or changes strength */
if (new)
nm_dbus_signal_wireless_network_change (con, dev, ap, NETWORK_STATUS_APPEARED, -1);
else if (strength_changed)
{
nm_dbus_signal_wireless_network_change (con, dev, ap, NETWORK_STATUS_STRENGTH_CHANGED,
nm_ap_get_strength (ap));
}
}
}
static gboolean process_scan_results (NMDevice *dev, const guint8 *res_buf, guint32 res_buf_len) static gboolean process_scan_results (NMDevice *dev, const guint8 *res_buf, guint32 res_buf_len)
{ {
char *pos, *end, *custom, *genie, *gpos, *gend; char *pos, *end, *custom, *genie, *gpos, *gend;
...@@ -4513,6 +4546,7 @@ static gboolean process_scan_results (NMDevice *dev, const guint8 *res_buf, guin ...@@ -4513,6 +4546,7 @@ static gboolean process_scan_results (NMDevice *dev, const guint8 *res_buf, guin
while (pos + IW_EV_LCP_LEN <= end) while (pos + IW_EV_LCP_LEN <= end)
{ {
int ssid_len; int ssid_len;
/* Event data may be unaligned, so make a local, aligned copy /* Event data may be unaligned, so make a local, aligned copy
* before processing. */ * before processing. */
memcpy (&iwe_buf, pos, IW_EV_LCP_LEN); memcpy (&iwe_buf, pos, IW_EV_LCP_LEN);
...@@ -4545,32 +4579,7 @@ static gboolean process_scan_results (NMDevice *dev, const guint8 *res_buf, guin ...@@ -4545,32 +4579,7 @@ static gboolean process_scan_results (NMDevice *dev, const guint8 *res_buf, guin
/* Merge previous AP */ /* Merge previous AP */
if (ap) if (ap)
{ {
gboolean new = FALSE; add_new_ap_to_device_list (dev, ap);
gboolean strength_changed = FALSE;
GTimeVal cur_time;
g_get_current_time (&cur_time);
nm_ap_set_last_seen (ap, &cur_time);
/* If the AP is not broadcasting its ESSID, try to fill it in here from our
* allowed list where we cache known MAC->ESSID associations.
*/
if (!nm_ap_get_essid (ap))
nm_ap_list_copy_one_essid_by_address (ap, dev->app_data->allowed_ap_list);
/* Add the AP to the device's AP list */
if (nm_ap_list_merge_scanned_ap (nm_device_ap_list_get (dev), ap, &new, &strength_changed))
{
DBusConnection *con = dev->app_data->dbus_connection;
/* Handle dbus signals that we need to broadcast when the AP is added to the list or changes strength */
if (new)
nm_dbus_signal_wireless_network_change (con, dev, ap, NETWORK_STATUS_APPEARED, -1);
else if (strength_changed)
{
nm_dbus_signal_wireless_network_change (con, dev, ap, NETWORK_STATUS_STRENGTH_CHANGED,
nm_ap_get_strength (ap));
}
}
nm_ap_unref (ap); nm_ap_unref (ap);
ap = NULL; ap = NULL;
} }
...@@ -4709,11 +4718,20 @@ static gboolean process_scan_results (NMDevice *dev, const guint8 *res_buf, guin ...@@ -4709,11 +4718,20 @@ static gboolean process_scan_results (NMDevice *dev, const guint8 *res_buf, guin
g_free (ie_buf); g_free (ie_buf);
} }
break; break;
default:
break;
} }
pos += iwe->len; pos += iwe->len;
} }
if (ap)
{
add_new_ap_to_device_list (dev, ap);
nm_ap_unref (ap);
ap = NULL;
}
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment