Lines Matching refs:ap

32 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 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 && os_memcmp(s->addr, ap, ETH_ALEN) != 0)
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;
91 struct ap_info *ap)
94 ap->iter_prev = iface->ap_iter_list->iter_prev;
95 iface->ap_iter_list->iter_prev = ap;
97 ap->iter_prev = ap;
98 ap->iter_next = iface->ap_iter_list;
99 iface->ap_iter_list = ap;
104 struct ap_info *ap)
106 if (iface->ap_iter_list == ap)
107 iface->ap_iter_list = ap->iter_next;
109 ap->iter_prev->iter_next = ap->iter_next;
111 if (ap->iter_next)
112 ap->iter_next->iter_prev = ap->iter_prev;
114 iface->ap_iter_list->iter_prev = ap->iter_prev;
118 static void ap_ap_hash_add(struct hostapd_iface *iface, struct ap_info *ap)
120 ap->hnext = iface->ap_hash[STA_HASH(ap->addr)];
121 iface->ap_hash[STA_HASH(ap->addr)] = ap;
125 static void ap_ap_hash_del(struct hostapd_iface *iface, struct ap_info *ap)
129 s = iface->ap_hash[STA_HASH(ap->addr)];
131 if (os_memcmp(s->addr, ap->addr, ETH_ALEN) == 0) {
132 iface->ap_hash[STA_HASH(ap->addr)] = s->hnext;
137 os_memcmp(s->hnext->addr, ap->addr, ETH_ALEN) != 0)
143 MAC2STR(ap->addr));
147 static void ap_free_ap(struct hostapd_iface *iface, struct ap_info *ap)
149 ap_ap_hash_del(iface, ap);
150 ap_ap_list_del(iface, ap);
151 ap_ap_iter_list_del(iface, ap);
154 os_free(ap);
160 struct ap_info *ap, *prev;
162 ap = iface->ap_list;
164 while (ap) {
165 prev = ap;
166 ap = ap->next;
195 struct ap_info *ap;
197 ap = os_zalloc(sizeof(struct ap_info));
198 if (ap == NULL)
202 os_memcpy(ap->addr, addr, ETH_ALEN);
203 ap_ap_list_add(iface, ap);
205 ap_ap_hash_add(iface, ap);
206 ap_ap_iter_list_add(iface, ap);
208 if (iface->num_ap > iface->conf->ap_table_max_size && ap != ap->prev) {
210 MACSTR " from AP table", MAC2STR(ap->prev->addr));
211 ap_free_ap(iface, ap->prev);
214 return ap;
223 struct ap_info *ap;
232 ap = ap_get_ap(iface, mgmt->bssid);
233 if (!ap) {
234 ap = ap_ap_add(iface, mgmt->bssid);
235 if (!ap) {
242 ap->beacon_int = le_to_host16(mgmt->u.beacon.beacon_int);
243 ap->capability = le_to_host16(mgmt->u.beacon.capab_info);
247 if (len >= sizeof(ap->ssid))
248 len = sizeof(ap->ssid) - 1;
249 os_memcpy(ap->ssid, elems->ssid, len);
250 ap->ssid[len] = '\0';
251 ap->ssid_len = len;
254 merge_byte_arrays(ap->supported_rates, WLAN_SUPP_RATES_MAX,
258 ap->wpa = elems->wpa_ie != NULL;
261 ap->erp = elems->erp_info[0];
263 ap->erp = -1;
266 ap->channel = elems->ds_params[0];
268 ap->channel = fi->channel;
271 ap->ht_support = 1;
273 ap->ht_support = 0;
275 ap->num_beacons++;
277 ap->last_beacon = now.sec;
279 ap->datarate = fi->datarate;
281 if (!new_ap && ap != iface->ap_list) {
284 ap_ap_list_del(iface, ap);
285 ap_ap_list_add(iface, ap);
289 ap_list_beacon_olbc(iface, ap)) {
292 "protection", MAC2STR(ap->addr));
297 if (!iface->olbc_ht && !ap->ht_support) {
301 " - enable protection", MAC2STR(ap->addr));
315 struct ap_info *ap;
326 ap = iface->ap_list->prev;
327 if (ap->last_beacon + iface->conf->ap_table_expiration_time >=
331 ap_free_ap(iface, ap);
338 ap = iface->ap_list;
339 while (ap && (olbc == 0 || olbc_ht == 0)) {
340 if (ap_list_beacon_olbc(iface, ap))
342 if (!ap->ht_support)
344 ap = ap->next;