Lines Matching refs:ap

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 && 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;
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 (os_memcmp(s->addr, ap->addr, ETH_ALEN) == 0) {
104 iface->ap_hash[STA_HASH(ap->addr)] = s->hnext;
109 os_memcmp(s->hnext->addr, ap->addr, ETH_ALEN) != 0)
115 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)
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) {
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) {
191 merge_byte_arrays(ap->supported_rates, WLAN_SUPP_RATES_MAX,
196 ap->erp = elems->erp_info[0];
198 ap->erp = -1;
201 ap->channel = elems->ds_params[0];
203 ap->channel = elems->ht_operation[0];
205 ap->channel = fi->channel;
208 ap->ht_support = 1;
210 ap->ht_support = 0;
212 os_get_reltime(&ap->last_beacon);
214 if (!new_ap && ap != iface->ap_list) {
217 ap_ap_list_del(iface, ap);
218 ap_ap_list_add(iface, ap);
222 ap_list_beacon_olbc(iface, ap)) {
226 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 +
240 MAC2STR(ap->addr), ap->channel);
254 struct ap_info *ap;
265 ap = iface->ap_list->prev;
266 if (!os_reltime_expired(&now, &ap->last_beacon,
270 ap_free_ap(iface, ap);
277 ap = iface->ap_list;
278 while (ap && (olbc == 0 || olbc_ht == 0)) {
279 if (ap_list_beacon_olbc(iface, ap))
281 if (!ap->ht_support)
283 ap = ap->next;