Lines Matching full:ap
2 * hostapd / AP table
25 /* AP list is a double linked list with head->prev pointing to the end of the
27 * whenever a beacon has been received from the AP in question. The tail entry
31 static int ap_list_beacon_olbc(struct hostapd_iface *iface, struct ap_info *ap)
37 iface->conf->channel != ap->channel)
40 if (ap->erp != -1 && (ap->erp & ERP_INFO_NON_ERP_PRESENT))
44 int rate = (ap->supported_rates[i] & 0x7f) * 5;
53 static struct ap_info * ap_get_ap(struct hostapd_iface *iface, const u8 *ap)
57 s = iface->ap_hash[STA_HASH(ap)];
58 while (s != NULL && !ether_addr_equal(s->addr, ap))
64 static void ap_ap_list_add(struct hostapd_iface *iface, struct ap_info *ap)
67 ap->prev = iface->ap_list->prev;
68 iface->ap_list->prev = ap;
70 ap->prev = ap;
71 ap->next = iface->ap_list;
72 iface->ap_list = ap;
76 static void ap_ap_list_del(struct hostapd_iface *iface, struct ap_info *ap)
78 if (iface->ap_list == ap)
79 iface->ap_list = ap->next;
81 ap->prev->next = ap->next;
83 if (ap->next)
84 ap->next->prev = ap->prev;
86 iface->ap_list->prev = ap->prev;
90 static void ap_ap_hash_add(struct hostapd_iface *iface, struct ap_info *ap)
92 ap->hnext = iface->ap_hash[STA_HASH(ap->addr)];
93 iface->ap_hash[STA_HASH(ap->addr)] = ap;
97 static void ap_ap_hash_del(struct hostapd_iface *iface, struct ap_info *ap)
101 s = iface->ap_hash[STA_HASH(ap->addr)];
103 if (ether_addr_equal(s->addr, ap->addr)) {
104 iface->ap_hash[STA_HASH(ap->addr)] = s->hnext;
109 !ether_addr_equal(s->hnext->addr, ap->addr))
114 wpa_printf(MSG_INFO, "AP: could not remove AP " MACSTR
115 " from hash table", MAC2STR(ap->addr));
119 static void ap_free_ap(struct hostapd_iface *iface, struct ap_info *ap)
121 ap_ap_hash_del(iface, ap);
122 ap_ap_list_del(iface, ap);
125 os_free(ap);
131 struct ap_info *ap, *prev;
133 ap = iface->ap_list;
135 while (ap) {
136 prev = ap;
137 ap = ap->next;
147 struct ap_info *ap;
149 ap = os_zalloc(sizeof(struct ap_info));
150 if (ap == NULL)
153 /* initialize AP info data */
154 os_memcpy(ap->addr, addr, ETH_ALEN);
155 ap_ap_list_add(iface, ap);
157 ap_ap_hash_add(iface, ap);
159 if (iface->num_ap > iface->conf->ap_table_max_size && ap != ap->prev) {
160 wpa_printf(MSG_DEBUG, "Removing the least recently used AP "
161 MACSTR " from AP table", MAC2STR(ap->prev->addr));
162 ap_free_ap(iface, ap->prev);
165 return ap;
174 struct ap_info *ap;
181 ap = ap_get_ap(iface, mgmt->bssid);
182 if (!ap) {
183 ap = ap_ap_add(iface, mgmt->bssid);
184 if (!ap) {
186 "Failed to allocate AP information entry");
192 merge_byte_arrays(ap->supported_rates, WLAN_SUPP_RATES_MAX,
197 ap->erp = elems->erp_info[0];
199 ap->erp = -1;
202 ap->channel = elems->ds_params[0];
204 ap->channel = elems->ht_operation[0];
206 ap->channel = fi->channel;
209 ap->ht_support = 1;
211 ap->ht_support = 0;
213 os_get_reltime(&ap->last_beacon);
215 if (!new_ap && ap != iface->ap_list) {
216 /* move AP entry into the beginning of the list so that the
218 ap_ap_list_del(iface, ap);
219 ap_ap_list_add(iface, ap);
223 ap_list_beacon_olbc(iface, ap)) {
225 wpa_printf(MSG_DEBUG, "OLBC AP detected: " MACSTR
227 MAC2STR(ap->addr), ap->channel);
231 if (!iface->olbc_ht && !ap->ht_support &&
232 (ap->channel == 0 ||
233 ap->channel == iface->conf->channel ||
234 ap->channel == iface->conf->channel +
238 wpa_printf(MSG_DEBUG, "OLBC HT AP detected: " MACSTR
240 MAC2STR(ap->addr), ap->channel);
252 struct ap_info *ap;
261 ap = iface->ap_list->prev;
262 if (!os_reltime_expired(&now, &ap->last_beacon,
266 ap_free_ap(iface, ap);
273 ap = iface->ap_list;
274 while (ap && (olbc == 0 || olbc_ht == 0)) {
275 if (ap_list_beacon_olbc(iface, ap))
277 if (!ap->ht_support)
279 ap = ap->next;