Lines Matching full:ap
3 * Intersil Prism2 driver with Host AP (software access point) support
8 * This file is to be included into hostap.c when S/W AP functionality is
11 * AP: FIX:
37 MODULE_PARM_DESC(other_ap_policy, "Other AP beacon monitoring policy (0-3)");
42 MODULE_PARM_DESC(ap_max_inactivity, "AP timeout (in seconds) for station "
56 static struct sta_info* ap_get_sta(struct ap_data *ap, u8 *sta);
72 struct ap_data *ap = PDE_DATA(file_inode(m->file)); in ap_debug_proc_show() local
74 seq_printf(m, "BridgedUnicastFrames=%u\n", ap->bridged_unicast); in ap_debug_proc_show()
75 seq_printf(m, "BridgedMulticastFrames=%u\n", ap->bridged_multicast); in ap_debug_proc_show()
76 seq_printf(m, "max_inactivity=%u\n", ap->max_inactivity / HZ); in ap_debug_proc_show()
77 seq_printf(m, "bridge_packets=%u\n", ap->bridge_packets); in ap_debug_proc_show()
78 seq_printf(m, "nullfunc_ack=%u\n", ap->nullfunc_ack); in ap_debug_proc_show()
79 seq_printf(m, "autom_ap_wds=%u\n", ap->autom_ap_wds); in ap_debug_proc_show()
80 seq_printf(m, "auth_algs=%u\n", ap->local->auth_algs); in ap_debug_proc_show()
81 seq_printf(m, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc); in ap_debug_proc_show()
86 static void ap_sta_hash_add(struct ap_data *ap, struct sta_info *sta) in ap_sta_hash_add() argument
88 sta->hnext = ap->sta_hash[STA_HASH(sta->addr)]; in ap_sta_hash_add()
89 ap->sta_hash[STA_HASH(sta->addr)] = sta; in ap_sta_hash_add()
92 static void ap_sta_hash_del(struct ap_data *ap, struct sta_info *sta) in ap_sta_hash_del() argument
96 s = ap->sta_hash[STA_HASH(sta->addr)]; in ap_sta_hash_del()
99 ap->sta_hash[STA_HASH(sta->addr)] = s->hnext; in ap_sta_hash_del()
108 printk("AP: could not remove STA %pM from hash table\n", in ap_sta_hash_del()
112 static void ap_free_sta(struct ap_data *ap, struct sta_info *sta) in ap_free_sta() argument
114 if (sta->ap && sta->local) in ap_free_sta()
117 if (ap->proc != NULL) { in ap_free_sta()
120 remove_proc_entry(name, ap->proc); in ap_free_sta()
131 ap->num_sta--; in ap_free_sta()
134 ap->sta_aid[sta->aid - 1] = NULL; in ap_free_sta()
136 if (!sta->ap) in ap_free_sta()
179 struct ap_data *ap; in ap_handle_timer() local
183 if (sta == NULL || sta->local == NULL || sta->local->ap == NULL) { in ap_handle_timer()
189 ap = local->ap; in ap_handle_timer()
195 next_time = jiffies + ap->max_inactivity; in ap_handle_timer()
197 if (time_before(jiffies, sta->last_rx + ap->max_inactivity)) { in ap_handle_timer()
200 next_time = sta->last_rx + ap->max_inactivity; in ap_handle_timer()
205 next_time = jiffies + ap->max_inactivity; in ap_handle_timer()
214 if (sta->ap) in ap_handle_timer()
218 spin_lock(&ap->sta_table_lock); in ap_handle_timer()
219 ap_sta_hash_del(ap, sta); in ap_handle_timer()
221 spin_unlock(&ap->sta_table_lock); in ap_handle_timer()
226 if (was_assoc && !(sta->flags & WLAN_STA_ASSOC) && !sta->ap) in ap_handle_timer()
235 if (sta->ap) { in ap_handle_timer()
236 if (ap->autom_ap_wds) { in ap_handle_timer()
238 "connection to AP %pM\n", in ap_handle_timer()
251 sta->addr, ap->tx_callback_poll); in ap_handle_timer()
276 ap_free_sta(ap, sta); in ap_handle_timer()
292 void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap, in hostap_deauth_all_stas() argument
313 if (!resend || ap->num_sta <= 0) in hostap_deauth_all_stas()
323 struct ap_data *ap = PDE_DATA(file_inode(m->file)); in ap_control_proc_show() local
328 switch (ap->mac_restrictions.policy) { in ap_control_proc_show()
343 seq_printf(m, "MAC entries: %u\n", ap->mac_restrictions.entries); in ap_control_proc_show()
355 struct ap_data *ap = PDE_DATA(file_inode(m->file)); in ap_control_proc_start() local
356 spin_lock_bh(&ap->mac_restrictions.lock); in ap_control_proc_start()
357 return seq_list_start_head(&ap->mac_restrictions.mac_list, *_pos); in ap_control_proc_start()
362 struct ap_data *ap = PDE_DATA(file_inode(m->file)); in ap_control_proc_next() local
363 return seq_list_next(v, &ap->mac_restrictions.mac_list, _pos); in ap_control_proc_next()
368 struct ap_data *ap = PDE_DATA(file_inode(m->file)); in ap_control_proc_stop() local
369 spin_unlock_bh(&ap->mac_restrictions.lock); in ap_control_proc_stop()
467 int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac) in ap_control_kick_mac() argument
472 spin_lock_bh(&ap->sta_table_lock); in ap_control_kick_mac()
473 sta = ap_get_sta(ap, mac); in ap_control_kick_mac()
475 ap_sta_hash_del(ap, sta); in ap_control_kick_mac()
478 spin_unlock_bh(&ap->sta_table_lock); in ap_control_kick_mac()
487 if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap) in ap_control_kick_mac()
490 ap_free_sta(ap, sta); in ap_control_kick_mac()
498 void ap_control_kickall(struct ap_data *ap) in ap_control_kickall() argument
503 spin_lock_bh(&ap->sta_table_lock); in ap_control_kickall()
504 for (ptr = ap->sta_list.next, n = ptr->next; ptr != &ap->sta_list; in ap_control_kickall()
507 ap_sta_hash_del(ap, sta); in ap_control_kickall()
509 if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap && sta->local) in ap_control_kickall()
511 ap_free_sta(ap, sta); in ap_control_kickall()
513 spin_unlock_bh(&ap->sta_table_lock); in ap_control_kickall()
529 if (!sta->ap) in prism2_ap_proc_show()
534 sta->u.ap.channel, sta->last_rx_signal, in prism2_ap_proc_show()
537 for (i = 0; i < sta->u.ap.ssid_len; i++) { in prism2_ap_proc_show()
538 if (sta->u.ap.ssid[i] >= 32 && sta->u.ap.ssid[i] < 127) in prism2_ap_proc_show()
539 seq_putc(m, sta->u.ap.ssid[i]); in prism2_ap_proc_show()
541 seq_printf(m, "<%02x>", sta->u.ap.ssid[i]); in prism2_ap_proc_show()
557 struct ap_data *ap = PDE_DATA(file_inode(m->file)); in prism2_ap_proc_start() local
558 spin_lock_bh(&ap->sta_table_lock); in prism2_ap_proc_start()
559 return seq_list_start_head(&ap->sta_list, *_pos); in prism2_ap_proc_start()
564 struct ap_data *ap = PDE_DATA(file_inode(m->file)); in prism2_ap_proc_next() local
565 return seq_list_next(v, &ap->sta_list, _pos); in prism2_ap_proc_next()
570 struct ap_data *ap = PDE_DATA(file_inode(m->file)); in prism2_ap_proc_stop() local
571 spin_unlock_bh(&ap->sta_table_lock); in prism2_ap_proc_stop()
583 void hostap_check_sta_fw_version(struct ap_data *ap, int sta_fw_ver) in hostap_check_sta_fw_version() argument
585 if (!ap) in hostap_check_sta_fw_version()
591 ap->nullfunc_ack = 1; in hostap_check_sta_fw_version()
593 ap->nullfunc_ack = 0; in hostap_check_sta_fw_version()
597 "version 1.4.2 does not seem to work in Host AP mode\n", in hostap_check_sta_fw_version()
598 ap->local->dev->name); in hostap_check_sta_fw_version()
606 struct ap_data *ap = data; in hostap_ap_tx_cb() local
609 if (!ap->local->hostapd || !ap->local->apdev) { in hostap_ap_tx_cb()
621 skb->dev = ap->local->apdev; in hostap_ap_tx_cb()
634 struct ap_data *ap = data; in hostap_ap_tx_cb_auth() local
635 struct net_device *dev = ap->local->dev; in hostap_ap_tx_cb_auth()
642 if (ap->local->hostapd) { in hostap_ap_tx_cb_auth()
666 spin_lock(&ap->sta_table_lock); in hostap_ap_tx_cb_auth()
667 sta = ap_get_sta(ap, hdr->addr1); in hostap_ap_tx_cb_auth()
670 spin_unlock(&ap->sta_table_lock); in hostap_ap_tx_cb_auth()
702 struct ap_data *ap = data; in hostap_ap_tx_cb_assoc() local
703 struct net_device *dev = ap->local->dev; in hostap_ap_tx_cb_assoc()
710 if (ap->local->hostapd) { in hostap_ap_tx_cb_assoc()
730 spin_lock(&ap->sta_table_lock); in hostap_ap_tx_cb_assoc()
731 sta = ap_get_sta(ap, hdr->addr1); in hostap_ap_tx_cb_assoc()
734 spin_unlock(&ap->sta_table_lock); in hostap_ap_tx_cb_assoc()
767 struct ap_data *ap = data; in hostap_ap_tx_cb_poll() local
775 spin_lock(&ap->sta_table_lock); in hostap_ap_tx_cb_poll()
776 sta = ap_get_sta(ap, hdr->addr1); in hostap_ap_tx_cb_poll()
779 spin_unlock(&ap->sta_table_lock); in hostap_ap_tx_cb_poll()
783 ap->local->dev->name, hdr->addr1); in hostap_ap_tx_cb_poll()
794 struct ap_data *ap = local->ap; in hostap_init_data() local
796 if (ap == NULL) { in hostap_init_data()
797 printk(KERN_WARNING "hostap_init_data: ap == NULL\n"); in hostap_init_data()
800 memset(ap, 0, sizeof(struct ap_data)); in hostap_init_data()
801 ap->local = local; in hostap_init_data()
803 ap->ap_policy = GET_INT_PARM(other_ap_policy, local->card_idx); in hostap_init_data()
804 ap->bridge_packets = GET_INT_PARM(ap_bridge_packets, local->card_idx); in hostap_init_data()
805 ap->max_inactivity = in hostap_init_data()
807 ap->autom_ap_wds = GET_INT_PARM(autom_ap_wds, local->card_idx); in hostap_init_data()
809 spin_lock_init(&ap->sta_table_lock); in hostap_init_data()
810 INIT_LIST_HEAD(&ap->sta_list); in hostap_init_data()
812 /* Initialize task queue structure for AP management */ in hostap_init_data()
813 INIT_WORK(&local->ap->add_sta_proc_queue, handle_add_proc_queue); in hostap_init_data()
815 ap->tx_callback_idx = in hostap_init_data()
816 hostap_tx_callback_register(local, hostap_ap_tx_cb, ap); in hostap_init_data()
817 if (ap->tx_callback_idx == 0) in hostap_init_data()
819 "AP\n", local->dev->name); in hostap_init_data()
821 INIT_WORK(&local->ap->wds_oper_queue, handle_wds_oper_queue); in hostap_init_data()
823 ap->tx_callback_auth = in hostap_init_data()
824 hostap_tx_callback_register(local, hostap_ap_tx_cb_auth, ap); in hostap_init_data()
825 ap->tx_callback_assoc = in hostap_init_data()
826 hostap_tx_callback_register(local, hostap_ap_tx_cb_assoc, ap); in hostap_init_data()
827 ap->tx_callback_poll = in hostap_init_data()
828 hostap_tx_callback_register(local, hostap_ap_tx_cb_poll, ap); in hostap_init_data()
829 if (ap->tx_callback_auth == 0 || ap->tx_callback_assoc == 0 || in hostap_init_data()
830 ap->tx_callback_poll == 0) in hostap_init_data()
832 "AP\n", local->dev->name); in hostap_init_data()
834 spin_lock_init(&ap->mac_restrictions.lock); in hostap_init_data()
835 INIT_LIST_HEAD(&ap->mac_restrictions.mac_list); in hostap_init_data()
838 ap->initialized = 1; in hostap_init_data()
844 struct ap_data *ap = local->ap; in hostap_init_ap_proc() local
846 ap->proc = local->proc; in hostap_init_ap_proc()
847 if (ap->proc == NULL) in hostap_init_ap_proc()
851 proc_create_single_data("ap_debug", 0, ap->proc, ap_debug_proc_show, ap); in hostap_init_ap_proc()
855 proc_create_seq_data("ap_control", 0, ap->proc, &ap_control_proc_seqops, in hostap_init_ap_proc()
856 ap); in hostap_init_ap_proc()
857 proc_create_seq_data("ap", 0, ap->proc, &prism2_ap_proc_seqops, ap); in hostap_init_ap_proc()
863 void hostap_free_data(struct ap_data *ap) in hostap_free_data() argument
867 if (ap == NULL || !ap->initialized) { in hostap_free_data()
868 printk(KERN_DEBUG "hostap_free_data: ap has not yet been " in hostap_free_data()
873 flush_work(&ap->add_sta_proc_queue); in hostap_free_data()
876 flush_work(&ap->wds_oper_queue); in hostap_free_data()
877 if (ap->crypt) in hostap_free_data()
878 ap->crypt->deinit(ap->crypt_priv); in hostap_free_data()
879 ap->crypt = ap->crypt_priv = NULL; in hostap_free_data()
882 list_for_each_entry_safe(sta, n, &ap->sta_list, list) { in hostap_free_data()
883 ap_sta_hash_del(ap, sta); in hostap_free_data()
885 if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap && sta->local) in hostap_free_data()
887 ap_free_sta(ap, sta); in hostap_free_data()
891 if (ap->proc != NULL) { in hostap_free_data()
892 remove_proc_entry("ap_debug", ap->proc); in hostap_free_data()
897 if (ap->proc != NULL) { in hostap_free_data()
898 remove_proc_entry("ap", ap->proc); in hostap_free_data()
899 remove_proc_entry("ap_control", ap->proc); in hostap_free_data()
901 ap_control_flush_macs(&ap->mac_restrictions); in hostap_free_data()
904 ap->initialized = 0; in hostap_free_data()
908 /* caller should have mutex for AP STA list handling */
909 static struct sta_info* ap_get_sta(struct ap_data *ap, u8 *sta) in ap_get_sta() argument
913 s = ap->sta_hash[STA_HASH(sta)]; in ap_get_sta()
922 /* Called from timer handler and from scheduled AP queue handlers */
1006 sta->ap ? "AP" : "STA", in prism2_sta_proc_show()
1045 if (sta->ap) { in prism2_sta_proc_show()
1046 if (sta->u.ap.channel >= 0) in prism2_sta_proc_show()
1047 seq_printf(m, "channel=%d\n", sta->u.ap.channel); in prism2_sta_proc_show()
1049 for (i = 0; i < sta->u.ap.ssid_len; i++) { in prism2_sta_proc_show()
1050 if (sta->u.ap.ssid[i] >= 32 && sta->u.ap.ssid[i] < 127) in prism2_sta_proc_show()
1051 seq_putc(m, sta->u.ap.ssid[i]); in prism2_sta_proc_show()
1053 seq_printf(m, "<%02x>", sta->u.ap.ssid[i]); in prism2_sta_proc_show()
1065 struct ap_data *ap = container_of(work, struct ap_data, in handle_add_proc_queue() local
1071 entry = ap->add_sta_proc_entries; in handle_add_proc_queue()
1072 ap->add_sta_proc_entries = NULL; in handle_add_proc_queue()
1075 spin_lock_bh(&ap->sta_table_lock); in handle_add_proc_queue()
1076 sta = ap_get_sta(ap, entry->addr); in handle_add_proc_queue()
1079 spin_unlock_bh(&ap->sta_table_lock); in handle_add_proc_queue()
1084 name, 0, ap->proc, in handle_add_proc_queue()
1097 static struct sta_info * ap_add_sta(struct ap_data *ap, u8 *addr) in ap_add_sta() argument
1103 PDEBUG(DEBUG_AP, "AP: kmalloc failed\n"); in ap_add_sta()
1108 sta->local = ap->local; in ap_add_sta()
1113 spin_lock_bh(&ap->sta_table_lock); in ap_add_sta()
1114 list_add(&sta->list, &ap->sta_list); in ap_add_sta()
1115 ap->num_sta++; in ap_add_sta()
1116 ap_sta_hash_add(ap, sta); in ap_add_sta()
1117 spin_unlock_bh(&ap->sta_table_lock); in ap_add_sta()
1119 if (ap->proc) { in ap_add_sta()
1126 entry->next = ap->add_sta_proc_entries; in ap_add_sta()
1127 ap->add_sta_proc_entries = entry; in ap_add_sta()
1128 schedule_work(&ap->add_sta_proc_queue); in ap_add_sta()
1135 sta->timer.expires = jiffies + ap->max_inactivity; in ap_add_sta()
1136 if (!ap->local->hostapd) in ap_add_sta()
1208 static void ap_crypt_init(struct ap_data *ap) in ap_crypt_init() argument
1210 ap->crypt = lib80211_get_crypto_ops("WEP"); in ap_crypt_init()
1212 if (ap->crypt) { in ap_crypt_init()
1213 if (ap->crypt->init) { in ap_crypt_init()
1214 ap->crypt_priv = ap->crypt->init(0); in ap_crypt_init()
1215 if (ap->crypt_priv == NULL) in ap_crypt_init()
1216 ap->crypt = NULL; in ap_crypt_init()
1220 ap->crypt->set_key(key, WEP_KEY_LEN, NULL, in ap_crypt_init()
1221 ap->crypt_priv); in ap_crypt_init()
1226 if (ap->crypt == NULL) { in ap_crypt_init()
1227 printk(KERN_WARNING "AP could not initialize WEP: load module " in ap_crypt_init()
1239 * Called only as a scheduled task for pending AP frames.
1241 static char * ap_auth_make_challenge(struct ap_data *ap) in ap_auth_make_challenge() argument
1246 if (ap->crypt == NULL) { in ap_auth_make_challenge()
1247 ap_crypt_init(ap); in ap_auth_make_challenge()
1248 if (ap->crypt == NULL) in ap_auth_make_challenge()
1254 PDEBUG(DEBUG_AP, "AP: kmalloc failed for challenge\n"); in ap_auth_make_challenge()
1259 ap->crypt->extra_mpdu_prefix_len + in ap_auth_make_challenge()
1260 ap->crypt->extra_mpdu_postfix_len); in ap_auth_make_challenge()
1266 skb_reserve(skb, ap->crypt->extra_mpdu_prefix_len); in ap_auth_make_challenge()
1268 if (ap->crypt->encrypt_mpdu(skb, 0, ap->crypt_priv)) { in ap_auth_make_challenge()
1274 skb_copy_from_linear_data_offset(skb, ap->crypt->extra_mpdu_prefix_len, in ap_auth_make_challenge()
1282 /* Called only as a scheduled task for pending AP frames. */
1289 struct ap_data *ap = local->ap; in handle_authen() local
1309 spin_lock_bh(&local->ap->sta_table_lock); in handle_authen()
1310 sta = ap_get_sta(local->ap, hdr->addr2); in handle_authen()
1313 spin_unlock_bh(&local->ap->sta_table_lock); in handle_authen()
1333 ap_control_mac_deny(&ap->mac_restrictions, hdr->addr2)) { in handle_authen()
1366 if (sta && sta->ap) { in handle_authen()
1367 if (time_after(jiffies, sta->u.ap.last_beacon + in handle_authen()
1370 " assuming AP %pM is now STA\n", in handle_authen()
1372 sta->ap = 0; in handle_authen()
1376 txt = "AP trying to authenticate?"; in handle_authen()
1396 if (local->ap->num_sta >= MAX_STA_COUNT) { in handle_authen()
1403 sta = ap_add_sta(local->ap, hdr->addr2); in handle_authen()
1426 ap_auth_make_challenge(local->ap); in handle_authen()
1478 body, olen, hdr->addr2, ap->tx_callback_auth); in handle_authen()
1495 /* Called only as a scheduled task for pending AP frames. */
1519 spin_lock_bh(&local->ap->sta_table_lock); in handle_assoc()
1520 sta = ap_get_sta(local->ap, hdr->addr2); in handle_assoc()
1522 spin_unlock_bh(&local->ap->sta_table_lock); in handle_assoc()
1530 spin_unlock_bh(&local->ap->sta_table_lock); in handle_assoc()
1611 spin_lock_bh(&local->ap->sta_table_lock); in handle_assoc()
1613 if (local->ap->sta_aid[sta->aid - 1] == NULL) in handle_assoc()
1617 spin_unlock_bh(&local->ap->sta_table_lock); in handle_assoc()
1621 local->ap->sta_aid[sta->aid - 1] = sta; in handle_assoc()
1622 spin_unlock_bh(&local->ap->sta_table_lock); in handle_assoc()
1681 send_deauth ? 0 : local->ap->tx_callback_assoc); in handle_assoc()
1704 /* Called only as a scheduled task for pending AP frames. */
1730 spin_lock_bh(&local->ap->sta_table_lock); in handle_deauth()
1731 sta = ap_get_sta(local->ap, hdr->addr2); in handle_deauth()
1733 if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap) in handle_deauth()
1737 spin_unlock_bh(&local->ap->sta_table_lock); in handle_deauth()
1746 /* Called only as a scheduled task for pending AP frames. */
1772 spin_lock_bh(&local->ap->sta_table_lock); in handle_disassoc()
1773 sta = ap_get_sta(local->ap, hdr->addr2); in handle_disassoc()
1775 if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap) in handle_disassoc()
1779 spin_unlock_bh(&local->ap->sta_table_lock); in handle_disassoc()
1788 /* Called only as a scheduled task for pending AP frames. */
1805 /* Called only as a scheduled task for pending AP frames. */
1813 spin_lock_bh(&local->ap->sta_table_lock); in ap_handle_dropped_data()
1814 sta = ap_get_sta(local->ap, hdr->addr2); in ap_handle_dropped_data()
1817 spin_unlock_bh(&local->ap->sta_table_lock); in ap_handle_dropped_data()
1838 /* Called only as a scheduled task for pending AP frames. */
1863 /* Called only as a scheduled task for pending AP frames. */
1895 spin_lock_bh(&local->ap->sta_table_lock); in handle_pspoll()
1896 sta = ap_get_sta(local->ap, hdr->addr2); in handle_pspoll()
1899 spin_unlock_bh(&local->ap->sta_table_lock); in handle_pspoll()
1914 * the corresponding STA; "8802-11: 11.2.1.9 AP aging function" in handle_pspoll()
1953 struct ap_data *ap = container_of(work, struct ap_data, in handle_wds_oper_queue() local
1955 local_info_t *local = ap->local; in handle_wds_oper_queue()
1959 entry = local->ap->wds_oper_entries; in handle_wds_oper_queue()
1960 local->ap->wds_oper_entries = NULL; in handle_wds_oper_queue()
1965 "to AP %pM\n", in handle_wds_oper_queue()
1981 /* Called only as a scheduled task for pending AP frames. */
2016 if (local->ap->ap_policy != AP_OTHER_AP_EVEN_IBSS && in handle_beacon()
2034 if (local->ap->ap_policy == AP_OTHER_AP_SAME_SSID && in handle_beacon()
2082 spin_lock_bh(&local->ap->sta_table_lock); in handle_beacon()
2083 sta = ap_get_sta(local->ap, hdr->addr2); in handle_beacon()
2086 spin_unlock_bh(&local->ap->sta_table_lock); in handle_beacon()
2089 /* add new AP */ in handle_beacon()
2091 sta = ap_add_sta(local->ap, hdr->addr2); in handle_beacon()
2093 printk(KERN_INFO "prism2: kmalloc failed for AP " in handle_beacon()
2103 if (local->ap->autom_ap_wds) { in handle_beacon()
2108 sta->ap = 1; in handle_beacon()
2110 sta->u.ap.ssid_len = ssid_len; in handle_beacon()
2111 memcpy(sta->u.ap.ssid, ssid, ssid_len); in handle_beacon()
2112 sta->u.ap.ssid[ssid_len] = '\0'; in handle_beacon()
2114 sta->u.ap.ssid_len = 0; in handle_beacon()
2115 sta->u.ap.ssid[0] = '\0'; in handle_beacon()
2117 sta->u.ap.channel = channel; in handle_beacon()
2120 sta->u.ap.last_beacon = sta->last_rx = jiffies; in handle_beacon()
2161 * AP association; so send reject message to in handle_ap_item()
2177 if (local->ap->nullfunc_ack && in handle_ap_item()
2197 PDEBUG(DEBUG_AP, "Unknown frame in AP queue: type=0x%02x " in handle_ap_item()
2275 if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL && in hostap_rx()
2329 struct ap_data *ap = local->ap; in prism2_ap_get_sta_qual() local
2333 spin_lock_bh(&ap->sta_table_lock); in prism2_ap_get_sta_qual()
2335 for (ptr = ap->sta_list.next; ptr != NULL && ptr != &ap->sta_list; in prism2_ap_get_sta_qual()
2339 if (aplist && !sta->ap) in prism2_ap_get_sta_qual()
2359 spin_unlock_bh(&ap->sta_table_lock); in prism2_ap_get_sta_qual()
2372 struct ap_data *ap; in prism2_ap_translate_scan() local
2383 ap = local->ap; in prism2_ap_translate_scan()
2385 spin_lock_bh(&ap->sta_table_lock); in prism2_ap_translate_scan()
2387 for (ptr = ap->sta_list.next; ptr != NULL && ptr != &ap->sta_list; in prism2_ap_translate_scan()
2391 /* First entry *MUST* be the AP MAC address */ in prism2_ap_translate_scan()
2404 if (sta->ap) in prism2_ap_translate_scan()
2429 if (sta->ap) { in prism2_ap_translate_scan()
2432 iwe.u.data.length = sta->u.ap.ssid_len; in prism2_ap_translate_scan()
2436 sta->u.ap.ssid); in prism2_ap_translate_scan()
2447 sta->u.ap.ssid); in prism2_ap_translate_scan()
2449 if (sta->u.ap.channel > 0 && in prism2_ap_translate_scan()
2450 sta->u.ap.channel <= FREQ_COUNT) { in prism2_ap_translate_scan()
2453 iwe.u.freq.m = freq_list[sta->u.ap.channel - 1] in prism2_ap_translate_scan()
2476 spin_unlock_bh(&ap->sta_table_lock); in prism2_ap_translate_scan()
2482 static int prism2_hostapd_add_sta(struct ap_data *ap, in prism2_hostapd_add_sta() argument
2487 spin_lock_bh(&ap->sta_table_lock); in prism2_hostapd_add_sta()
2488 sta = ap_get_sta(ap, param->sta_addr); in prism2_hostapd_add_sta()
2491 spin_unlock_bh(&ap->sta_table_lock); in prism2_hostapd_add_sta()
2494 sta = ap_add_sta(ap, param->sta_addr); in prism2_hostapd_add_sta()
2499 if (!(sta->flags & WLAN_STA_ASSOC) && !sta->ap && sta->local) in prism2_hostapd_add_sta()
2521 static int prism2_hostapd_remove_sta(struct ap_data *ap, in prism2_hostapd_remove_sta() argument
2526 spin_lock_bh(&ap->sta_table_lock); in prism2_hostapd_remove_sta()
2527 sta = ap_get_sta(ap, param->sta_addr); in prism2_hostapd_remove_sta()
2529 ap_sta_hash_del(ap, sta); in prism2_hostapd_remove_sta()
2532 spin_unlock_bh(&ap->sta_table_lock); in prism2_hostapd_remove_sta()
2537 if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap && sta->local) in prism2_hostapd_remove_sta()
2539 ap_free_sta(ap, sta); in prism2_hostapd_remove_sta()
2545 static int prism2_hostapd_get_info_sta(struct ap_data *ap, in prism2_hostapd_get_info_sta() argument
2550 spin_lock_bh(&ap->sta_table_lock); in prism2_hostapd_get_info_sta()
2551 sta = ap_get_sta(ap, param->sta_addr); in prism2_hostapd_get_info_sta()
2554 spin_unlock_bh(&ap->sta_table_lock); in prism2_hostapd_get_info_sta()
2567 static int prism2_hostapd_set_flags_sta(struct ap_data *ap, in prism2_hostapd_set_flags_sta() argument
2572 spin_lock_bh(&ap->sta_table_lock); in prism2_hostapd_set_flags_sta()
2573 sta = ap_get_sta(ap, param->sta_addr); in prism2_hostapd_set_flags_sta()
2578 spin_unlock_bh(&ap->sta_table_lock); in prism2_hostapd_set_flags_sta()
2587 static int prism2_hostapd_sta_clear_stats(struct ap_data *ap, in prism2_hostapd_sta_clear_stats() argument
2593 spin_lock_bh(&ap->sta_table_lock); in prism2_hostapd_sta_clear_stats()
2594 sta = ap_get_sta(ap, param->sta_addr); in prism2_hostapd_sta_clear_stats()
2603 spin_unlock_bh(&ap->sta_table_lock); in prism2_hostapd_sta_clear_stats()
2612 int prism2_hostapd(struct ap_data *ap, struct prism2_hostapd_param *param) in prism2_hostapd() argument
2616 ap_control_kickall(ap); in prism2_hostapd()
2619 return prism2_hostapd_add_sta(ap, param); in prism2_hostapd()
2621 return prism2_hostapd_remove_sta(ap, param); in prism2_hostapd()
2623 return prism2_hostapd_get_info_sta(ap, param); in prism2_hostapd()
2625 return prism2_hostapd_set_flags_sta(ap, param); in prism2_hostapd()
2627 return prism2_hostapd_sta_clear_stats(ap, param); in prism2_hostapd()
2692 if (local->ap == NULL || skb->len < 10 || in hostap_handle_sta_tx()
2699 /* broadcast/multicast frame - no AP related processing */ in hostap_handle_sta_tx()
2700 if (local->ap->num_sta <= 0) in hostap_handle_sta_tx()
2706 spin_lock(&local->ap->sta_table_lock); in hostap_handle_sta_tx()
2707 sta = ap_get_sta(local->ap, hdr->addr1); in hostap_handle_sta_tx()
2710 spin_unlock(&local->ap->sta_table_lock); in hostap_handle_sta_tx()
2723 printk(KERN_DEBUG "AP: drop packet to non-associated " in hostap_handle_sta_tx()
2727 local->ap->tx_drop_nonassoc++; in hostap_handle_sta_tx()
2740 local->ap->last_tx_rate = meta->rate = in hostap_handle_sta_tx()
2766 * after AP wlan hw reset). */ in hostap_handle_sta_tx()
2832 spin_lock(&local->ap->sta_table_lock); in hostap_handle_sta_tx_exc()
2833 sta = ap_get_sta(local->ap, hdr->addr1); in hostap_handle_sta_tx_exc()
2835 spin_unlock(&local->ap->sta_table_lock); in hostap_handle_sta_tx_exc()
2871 spin_unlock(&local->ap->sta_table_lock); in hostap_handle_sta_tx_exc()
2902 spin_lock(&local->ap->sta_table_lock); in hostap_update_sta_ps()
2903 sta = ap_get_sta(local->ap, hdr->addr2); in hostap_update_sta_ps()
2906 spin_unlock(&local->ap->sta_table_lock); in hostap_update_sta_ps()
2933 if (local->ap == NULL) in hostap_handle_sta_rx()
2942 spin_lock(&local->ap->sta_table_lock); in hostap_handle_sta_rx()
2943 sta = ap_get_sta(local->ap, hdr->addr2); in hostap_handle_sta_rx()
2946 spin_unlock(&local->ap->sta_table_lock); in hostap_handle_sta_rx()
2993 * frames with no ToDS flag when the current AP returns in hostap_handle_sta_rx()
3034 if (local->ap->nullfunc_ack && stype == IEEE80211_STYPE_NULLFUNC && in hostap_handle_sta_rx()
3069 spin_lock(&local->ap->sta_table_lock); in hostap_handle_sta_crypto()
3070 sta = ap_get_sta(local->ap, hdr->addr2); in hostap_handle_sta_crypto()
3073 spin_unlock(&local->ap->sta_table_lock); in hostap_handle_sta_crypto()
3091 int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr) in hostap_is_sta_assoc() argument
3096 spin_lock(&ap->sta_table_lock); in hostap_is_sta_assoc()
3097 sta = ap_get_sta(ap, sta_addr); in hostap_is_sta_assoc()
3098 if (sta != NULL && (sta->flags & WLAN_STA_ASSOC) && !sta->ap) in hostap_is_sta_assoc()
3100 spin_unlock(&ap->sta_table_lock); in hostap_is_sta_assoc()
3107 int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr) in hostap_is_sta_authorized() argument
3112 spin_lock(&ap->sta_table_lock); in hostap_is_sta_authorized()
3113 sta = ap_get_sta(ap, sta_addr); in hostap_is_sta_authorized()
3114 if (sta != NULL && (sta->flags & WLAN_STA_ASSOC) && !sta->ap && in hostap_is_sta_authorized()
3116 ap->local->ieee_802_1x == 0)) in hostap_is_sta_authorized()
3118 spin_unlock(&ap->sta_table_lock); in hostap_is_sta_authorized()
3125 int hostap_add_sta(struct ap_data *ap, u8 *sta_addr) in hostap_add_sta() argument
3130 if (!ap) in hostap_add_sta()
3133 spin_lock(&ap->sta_table_lock); in hostap_add_sta()
3134 sta = ap_get_sta(ap, sta_addr); in hostap_add_sta()
3137 spin_unlock(&ap->sta_table_lock); in hostap_add_sta()
3140 sta = ap_add_sta(ap, sta_addr); in hostap_add_sta()
3144 sta->ap = 1; in hostap_add_sta()
3164 int hostap_update_rx_stats(struct ap_data *ap, in hostap_update_rx_stats() argument
3170 if (!ap) in hostap_update_rx_stats()
3173 spin_lock(&ap->sta_table_lock); in hostap_update_rx_stats()
3174 sta = ap_get_sta(ap, hdr->addr2); in hostap_update_rx_stats()
3189 spin_unlock(&ap->sta_table_lock); in hostap_update_rx_stats()
3198 struct ap_data *ap = local->ap; in hostap_update_rates() local
3200 if (!ap) in hostap_update_rates()
3203 spin_lock_bh(&ap->sta_table_lock); in hostap_update_rates()
3204 list_for_each_entry(sta, &ap->sta_list, list) { in hostap_update_rates()
3207 spin_unlock_bh(&ap->sta_table_lock); in hostap_update_rates()
3211 void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, in ap_crypt_get_ptrs() argument
3216 spin_lock_bh(&ap->sta_table_lock); in ap_crypt_get_ptrs()
3217 sta = ap_get_sta(ap, addr); in ap_crypt_get_ptrs()
3220 spin_unlock_bh(&ap->sta_table_lock); in ap_crypt_get_ptrs()
3223 sta = ap_add_sta(ap, addr); in ap_crypt_get_ptrs()
3239 struct ap_data *ap = local->ap; in hostap_add_wds_links() local
3242 spin_lock_bh(&ap->sta_table_lock); in hostap_add_wds_links()
3243 list_for_each_entry(sta, &ap->sta_list, list) { in hostap_add_wds_links()
3244 if (sta->ap) in hostap_add_wds_links()
3247 spin_unlock_bh(&ap->sta_table_lock); in hostap_add_wds_links()
3249 schedule_work(&local->ap->wds_oper_queue); in hostap_add_wds_links()
3263 entry->next = local->ap->wds_oper_entries; in hostap_wds_link_oper()
3264 local->ap->wds_oper_entries = entry; in hostap_wds_link_oper()
3267 schedule_work(&local->ap->wds_oper_queue); in hostap_wds_link_oper()