Home | History | Annotate | Download | only in ap

Lines Matching defs:hapd

35 static int hostapd_flush_old_stations(struct hostapd_data *hapd);
36 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd);
37 static int hostapd_broadcast_wep_clear(struct hostapd_data *hapd);
42 static void hostapd_reload_bss(struct hostapd_data *hapd)
45 radius_client_reconfig(hapd->radius, hapd->conf->radius);
48 if (hostapd_setup_wpa_psk(hapd->conf)) {
53 if (hapd->conf->ieee802_1x || hapd->conf->wpa)
54 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
56 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
58 if (hapd->conf->wpa && hapd->wpa_auth == NULL) {
59 hostapd_setup_wpa(hapd);
60 if (hapd->wpa_auth)
61 wpa_init_keys(hapd->wpa_auth);
62 } else if (hapd->conf->wpa) {
65 hostapd_reconfig_wpa(hapd);
66 wpa_ie = wpa_auth_get_wpa_ie(hapd->wpa_auth, &wpa_ie_len);
67 if (hostapd_set_generic_elem(hapd, wpa_ie, wpa_ie_len))
70 } else if (hapd->wpa_auth) {
71 wpa_deinit(hapd->wpa_auth);
72 hapd->wpa_auth = NULL;
73 hostapd_set_privacy(hapd, 0);
74 hostapd_setup_encryption(hapd->conf->iface, hapd);
75 hostapd_set_generic_elem(hapd, (u8 *) "", 0);
78 ieee802_11_set_beacon(hapd);
79 hostapd_update_wps(hapd);
81 if (hapd->conf->ssid.ssid_set &&
82 hostapd_set_ssid(hapd, (u8 *) hapd->conf->ssid.ssid,
83 hapd->conf->ssid.ssid_len)) {
87 wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface);
93 struct hostapd_data *hapd = iface->bss[0];
118 oldconf = hapd->iconf;
122 hapd = iface->bss[j];
123 hapd->iconf = newconf;
124 hapd->conf = &newconf->bss[j];
125 hostapd_reload_bss(hapd);
135 static void hostapd_broadcast_key_clear_iface(struct hostapd_data *hapd,
141 if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_NONE, NULL, i,
149 if (hapd->conf->ieee80211w) {
151 if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_NONE,
164 static int hostapd_broadcast_wep_clear(struct hostapd_data *hapd)
166 hostapd_broadcast_key_clear_iface(hapd, hapd->conf->iface);
171 static int hostapd_broadcast_wep_set(struct hostapd_data *hapd)
174 struct hostapd_ssid *ssid = &hapd->conf->ssid;
178 hostapd_drv_set_key(hapd->conf->iface,
179 hapd, WPA_ALG_WEP, broadcast_ether_addr, idx,
193 ifname = hostapd_get_vlan_id_ifname(hapd->conf->vlan,
199 if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_WEP,
215 * @hapd: Pointer to BSS data
223 static void hostapd_cleanup(struct hostapd_data *hapd)
225 if (hapd->iface->ctrl_iface_deinit)
226 hapd->iface->ctrl_iface_deinit(hapd);
228 iapp_deinit(hapd->iapp);
229 hapd->iapp = NULL;
230 accounting_deinit(hapd);
231 hostapd_deinit_wpa(hapd);
232 vlan_deinit(hapd);
233 hostapd_acl_deinit(hapd);
235 radius_client_deinit(hapd->radius);
236 hapd->radius = NULL;
239 hostapd_deinit_wps(hapd);
241 authsrv_deinit(hapd);
243 if (hapd->interface_added &&
244 hostapd_if_remove(hapd, WPA_IF_AP_BSS, hapd->conf->iface)) {
246 hapd->conf->iface);
249 os_free(hapd->probereq_cb);
250 hapd->probereq_cb = NULL;
253 wpabuf_free(hapd->p2p_beacon_ie);
254 hapd->p2p_beacon_ie = NULL;
255 wpabuf_free(hapd->p2p_probe_resp_ie);
256 hapd->p2p_probe_resp_ie = NULL;
259 wpabuf_free(hapd->time_adv);
300 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd)
304 hostapd_broadcast_wep_set(hapd);
306 if (hapd->conf->ssid.wep.default_len) {
307 hostapd_set_privacy(hapd, 1);
315 hostapd_drv_set_authmode(hapd, hapd->conf->auth_algs);
318 if (hapd->conf->ssid.wep.key[i] &&
319 hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i,
320 i == hapd->conf->ssid.wep.idx, NULL, 0,
321 hapd->conf->ssid.wep.key[i],
322 hapd->conf->ssid.wep.len[i])) {
327 if (hapd->conf->ssid.wep.key[i] &&
328 i == hapd->conf->ssid.wep.idx)
329 hostapd_set_privacy(hapd, 1);
336 static int hostapd_flush_old_stations(struct hostapd_data *hapd)
341 if (hostapd_drv_none(hapd) || hapd->drv_priv == NULL)
344 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "Flushing old station entries");
345 if (hostapd_flush(hapd)) {
346 wpa_msg(hapd->msg_ctx, MSG_WARNING, "Could not connect to "
350 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "Deauthenticate all stations");
352 hostapd_drv_sta_deauth(hapd, addr, WLAN_REASON_PREV_AUTH_NOT_VALID);
353 hostapd_free_stas(hapd);
369 struct hostapd_data *hapd = iface->bss[0];
373 if (hostapd_drv_none(hapd))
394 hapd->own_addr[i];
438 if ((hapd->own_addr[i] & mask[i]) != hapd->own_addr[i]) {
441 MAC2STR(mask), MAC2STR(hapd->own_addr));
471 * @hapd: Pointer to BSS data
479 static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
481 struct hostapd_bss_config *conf = hapd->conf;
488 if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0) {
491 inc_byte_array(hapd->own_addr, ETH_ALEN);
492 } while (mac_in_conf(hapd->iconf, hapd->own_addr));
495 os_memcpy(hapd->own_addr, hapd->conf->bssid, ETH_ALEN);
497 if (hostapd_mac_comp(hapd->own_addr,
498 hapd->iface->bss[0]->own_addr) ==
502 "the radio", hapd->conf->iface);
507 hapd->interface_added = 1;
508 if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS,
509 hapd->conf->iface, hapd->own_addr, hapd,
510 &hapd->drv_priv, force_ifname, if_addr,
511 hapd->conf->bridge[0] ? hapd->conf->bridge :
514 MACSTR ")", MAC2STR(hapd->own_addr));
520 conf->wmm_enabled = hapd->iconf->ieee80211n;
522 hostapd_flush_old_stations(hapd);
523 hostapd_set_privacy(hapd, 0);
525 hostapd_broadcast_wep_clear(hapd);
526 if (hostapd_setup_encryption(hapd->conf->iface, hapd))
534 ssid_len = hostapd_get_ssid(hapd, ssid, sizeof(ssid));
558 if (!hostapd_drv_none(hapd)) {
561 hapd->conf->iface, MAC2STR(hapd->own_addr),
562 hapd->conf->ssid.ssid);
572 if (set_ssid && hostapd_set_ssid(hapd, (u8 *) conf->ssid.ssid,
581 hapd->radius = radius_client_init(hapd, conf->radius);
582 if (hapd->radius == NULL) {
588 if (hostapd_acl_init(hapd)) {
592 if (hostapd_init_wps(hapd, conf))
595 if (authsrv_init(hapd) < 0)
598 if (ieee802_1x_init(hapd)) {
603 if (hapd->conf->wpa && hostapd_setup_wpa(hapd))
606 if (accounting_init(hapd)) {
611 if (hapd->conf->ieee802_11f &&
612 (hapd->iapp = iapp_init(hapd, hapd->conf->iapp_iface)) == NULL) {
618 if (hapd->iface->ctrl_iface_init &&
619 hapd->iface->ctrl_iface_init(hapd)) {
624 if (!hostapd_drv_none(hapd) && vlan_init(hapd)) {
629 ieee802_11_set_beacon(hapd);
631 if (hapd->wpa_auth && wpa_init_keys(hapd->wpa_auth) < 0)
634 if (hapd->driver && hapd->driver->set_operstate)
635 hapd->driver->set_operstate(hapd->drv_priv, 1);
643 struct hostapd_data *hapd = iface->bss[0];
650 if (hostapd_set_tx_queue_params(hapd, i, p->aifs, p->cwmin,
662 struct hostapd_data *hapd = iface->bss[0];
671 iface->bss[i]->driver = hapd->driver;
672 iface->bss[i]->drv_priv = hapd->drv_priv;
678 if (hapd->iconf->country[0] && hapd->iconf->country[1]) {
679 os_memcpy(country, hapd->iconf->country, 3);
681 if (hostapd_set_country(hapd, country) < 0) {
712 struct hostapd_data *hapd = iface->bss[0];
723 if (hapd->iconf->channel) {
724 iface->freq = hostapd_hw_get_freq(hapd, hapd->iconf->channel);
727 hostapd_hw_mode_txt(hapd->iconf->hw_mode),
728 hapd->iconf->channel, iface->freq);
730 if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq,
731 hapd->iconf->channel,
732 hapd->iconf->ieee80211n,
733 hapd->iconf->secondary_channel)) {
744 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
751 if (hapd->iconf->rts_threshold > -1 &&
752 hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) {
758 if (hapd->iconf->fragm_threshold > -1 &&
759 hostapd_set_frag(hapd, hapd->iconf->fragm_threshold)) {
765 prev_addr = hapd->own_addr;
768 hapd = iface->bss[j];
770 os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN);
771 if (hostapd_setup_bss(hapd, j == 0))
773 if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0)
774 prev_addr = hapd->own_addr;
781 if (hostapd_driver_commit(hapd) < 0) {
798 if (hapd->setup_complete_cb)
799 hapd->setup_complete_cb(hapd->setup_complete_cb_ctx);
849 struct hostapd_data *hapd;
851 hapd = os_zalloc(sizeof(*hapd));
852 if (hapd == NULL)
855 hapd->new_assoc_sta_cb = hostapd_new_assoc_sta;
856 hapd->iconf = conf;
857 hapd->conf = bss;
858 hapd->iface = hapd_iface;
859 hapd->driver = hapd->iconf->driver;
861 return hapd;
874 struct hostapd_data *hapd = iface->bss[j];
875 hostapd_free_stas(hapd);
876 hostapd_flush_old_stations(hapd);
877 hostapd_cleanup(hapd);
893 * @hapd: Pointer to BSS data
902 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
905 if (hapd->tkip_countermeasures) {
906 hostapd_drv_sta_deauth(hapd, sta->addr,
911 hostapd_prune_associations(hapd, sta->addr);
914 if (hapd->conf->ieee802_11f)
915 iapp_new_station(hapd->iapp, sta);
920 hapd->num_sta_no_p2p++;
921 if (hapd->num_sta_no_p2p == 1)
922 hostapd_p2p_non_p2p_sta_connected(hapd);
929 if (!hapd->conf->ieee802_1x && !hapd->conf->wpa)
930 accounting_sta_start(hapd, sta);
933 ieee802_1x_new_station(hapd, sta);
939 wpa_auth_sta_associated(hapd->wpa_auth, sta->wpa_sm);