aboutsummaryrefslogtreecommitdiffstats
path: root/src/ap/ap_list.c
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2013-04-01 13:08:44 -0700
committerDmitry Shmidt <dimitrysh@google.com>2013-04-01 13:08:44 -0700
commit444d567b27731d8572ef37697dd12fd1c37c2f24 (patch)
tree5ee8491c6d0900875158235adf3852c4e550fc41 /src/ap/ap_list.c
parent0ccb66edb8d2a0a397320ace3ec2a03fb0d00d5f (diff)
downloadandroid_external_wpa_supplicant_8-444d567b27731d8572ef37697dd12fd1c37c2f24.tar.gz
android_external_wpa_supplicant_8-444d567b27731d8572ef37697dd12fd1c37c2f24.tar.bz2
android_external_wpa_supplicant_8-444d567b27731d8572ef37697dd12fd1c37c2f24.zip
Accumulative patch from commit 17b8995cf5813d7c027cd7a6884700e791d72392
17b8995 Interworking: Try to use same BSS entry for storing GAS results 3db5439 Optimize Extended Capabilities element to be of minimal length 8cd6b7b hostapd/wpa_s: Use driver's extended capabilities acb5464 Add ctrl_iface command FLUSH for clearing wpa_supplicant state 97236ce WPS: Skip rescanning after provisioning if AP was configured 4342326 Add ignore_old_scan_res configuration parameter 9599ccc WPS: Clear after_wps on new WPS connection 702621e WPS: Use latest updated BSS entry if multiple BSSID matches found ab547b5 WPS: Add more helpful debug for invalid WPS_REG command parsing a679c0f WPS: Allow hostapd process to control independent WPS interfaces ccdff94 WPS AP: Add support for reconfiguration with in-memory config 8970bae nl80211: Use nla_nest_start/end instead of nla_put_nested 558d69e P2P: Omit P2P Group Info in case of no connected peers 65a32cd AP: Fix infinite loop in WPA state machine when out of random bytes a5f61b2 Fix OLBC non-HT AP detection to check channel 69554d7 ap_list: Remove unused functions 08c99ca ap_list: Remove unused iteration list pointers 6b16917 ap_list: Remove unused fields 66f1f75 P2P: Fix provision discovery response handling in some cases 2f9b66d Extend ROAM command to handle multiple SSIDs per BSS Change-Id: I46002b1d3bbf6e376c2ae09bcb2c824c54805bbd Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'src/ap/ap_list.c')
-rw-r--r--src/ap/ap_list.c85
1 files changed, 13 insertions, 72 deletions
diff --git a/src/ap/ap_list.c b/src/ap/ap_list.c
index 18090ca1..9f02151f 100644
--- a/src/ap/ap_list.c
+++ b/src/ap/ap_list.c
@@ -50,7 +50,7 @@ static int ap_list_beacon_olbc(struct hostapd_iface *iface, struct ap_info *ap)
}
-struct ap_info * ap_get_ap(struct hostapd_iface *iface, const u8 *ap)
+static struct ap_info * ap_get_ap(struct hostapd_iface *iface, const u8 *ap)
{
struct ap_info *s;
@@ -87,34 +87,6 @@ static void ap_ap_list_del(struct hostapd_iface *iface, struct ap_info *ap)
}
-static void ap_ap_iter_list_add(struct hostapd_iface *iface,
- struct ap_info *ap)
-{
- if (iface->ap_iter_list) {
- ap->iter_prev = iface->ap_iter_list->iter_prev;
- iface->ap_iter_list->iter_prev = ap;
- } else
- ap->iter_prev = ap;
- ap->iter_next = iface->ap_iter_list;
- iface->ap_iter_list = ap;
-}
-
-
-static void ap_ap_iter_list_del(struct hostapd_iface *iface,
- struct ap_info *ap)
-{
- if (iface->ap_iter_list == ap)
- iface->ap_iter_list = ap->iter_next;
- else
- ap->iter_prev->iter_next = ap->iter_next;
-
- if (ap->iter_next)
- ap->iter_next->iter_prev = ap->iter_prev;
- else if (iface->ap_iter_list)
- iface->ap_iter_list->iter_prev = ap->iter_prev;
-}
-
-
static void ap_ap_hash_add(struct hostapd_iface *iface, struct ap_info *ap)
{
ap->hnext = iface->ap_hash[STA_HASH(ap->addr)];
@@ -148,7 +120,6 @@ static void ap_free_ap(struct hostapd_iface *iface, struct ap_info *ap)
{
ap_ap_hash_del(iface, ap);
ap_ap_list_del(iface, ap);
- ap_ap_iter_list_del(iface, ap);
iface->num_ap--;
os_free(ap);
@@ -171,25 +142,6 @@ static void hostapd_free_aps(struct hostapd_iface *iface)
}
-int ap_ap_for_each(struct hostapd_iface *iface,
- int (*func)(struct ap_info *s, void *data), void *data)
-{
- struct ap_info *s;
- int ret = 0;
-
- s = iface->ap_list;
-
- while (s) {
- ret = func(s, data);
- if (ret)
- break;
- s = s->next;
- }
-
- return ret;
-}
-
-
static struct ap_info * ap_ap_add(struct hostapd_iface *iface, const u8 *addr)
{
struct ap_info *ap;
@@ -203,7 +155,6 @@ static struct ap_info * ap_ap_add(struct hostapd_iface *iface, const u8 *addr)
ap_ap_list_add(iface, ap);
iface->num_ap++;
ap_ap_hash_add(iface, ap);
- ap_ap_iter_list_add(iface, ap);
if (iface->num_ap > iface->conf->ap_table_max_size && ap != ap->prev) {
wpa_printf(MSG_DEBUG, "Removing the least recently used AP "
@@ -223,7 +174,6 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
struct ap_info *ap;
struct os_time now;
int new_ap = 0;
- size_t len;
int set_beacon = 0;
if (iface->conf->ap_table_max_size < 1)
@@ -239,24 +189,10 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
new_ap = 1;
}
- ap->beacon_int = le_to_host16(mgmt->u.beacon.beacon_int);
- ap->capability = le_to_host16(mgmt->u.beacon.capab_info);
-
- if (elems->ssid) {
- len = elems->ssid_len;
- if (len >= sizeof(ap->ssid))
- len = sizeof(ap->ssid) - 1;
- os_memcpy(ap->ssid, elems->ssid, len);
- ap->ssid[len] = '\0';
- ap->ssid_len = len;
- }
-
merge_byte_arrays(ap->supported_rates, WLAN_SUPP_RATES_MAX,
elems->supp_rates, elems->supp_rates_len,
elems->ext_supp_rates, elems->ext_supp_rates_len);
- ap->wpa = elems->wpa_ie != NULL;
-
if (elems->erp_info && elems->erp_info_len == 1)
ap->erp = elems->erp_info[0];
else
@@ -264,6 +200,8 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
if (elems->ds_params && elems->ds_params_len == 1)
ap->channel = elems->ds_params[0];
+ else if (elems->ht_operation && elems->ht_operation_len >= 1)
+ ap->channel = elems->ht_operation[0];
else if (fi)
ap->channel = fi->channel;
@@ -272,11 +210,8 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
else
ap->ht_support = 0;
- ap->num_beacons++;
os_get_time(&now);
ap->last_beacon = now.sec;
- if (fi)
- ap->datarate = fi->datarate;
if (!new_ap && ap != iface->ap_list) {
/* move AP entry into the beginning of the list so that the
@@ -288,17 +223,23 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
if (!iface->olbc &&
ap_list_beacon_olbc(iface, ap)) {
iface->olbc = 1;
- wpa_printf(MSG_DEBUG, "OLBC AP detected: " MACSTR " - enable "
- "protection", MAC2STR(ap->addr));
+ wpa_printf(MSG_DEBUG, "OLBC AP detected: " MACSTR
+ " (channel %d) - enable protection",
+ MAC2STR(ap->addr), ap->channel);
set_beacon++;
}
#ifdef CONFIG_IEEE80211N
- if (!iface->olbc_ht && !ap->ht_support) {
+ if (!iface->olbc_ht && !ap->ht_support &&
+ (ap->channel == 0 ||
+ ap->channel == iface->conf->channel ||
+ ap->channel == iface->conf->channel +
+ iface->conf->secondary_channel * 4)) {
iface->olbc_ht = 1;
hostapd_ht_operation_update(iface);
wpa_printf(MSG_DEBUG, "OLBC HT AP detected: " MACSTR
- " - enable protection", MAC2STR(ap->addr));
+ " (channel %d) - enable protection",
+ MAC2STR(ap->addr), ap->channel);
set_beacon++;
}
#endif /* CONFIG_IEEE80211N */