diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index e6e2313864..37b228c618 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_VERSION:=20100117 +PKG_VERSION:=20100309 PKG_RELEASE:=1 -PKG_REV:=43a7fe2e0e614e52fa05ff4d78af91bd4e17d3b2 +PKG_REV:=7b90c16aa9ca377b1a6d160c1ba0f2bd304f7e2f PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git diff --git a/package/hostapd/patches/100-madwifi_fix.patch b/package/hostapd/patches/100-madwifi_fix.patch index f83f625e4f..736b295031 100644 --- a/package/hostapd/patches/100-madwifi_fix.patch +++ b/package/hostapd/patches/100-madwifi_fix.patch @@ -1,15 +1,15 @@ --- a/src/drivers/driver_madwifi.c +++ b/src/drivers/driver_madwifi.c -@@ -1170,8 +1170,6 @@ madwifi_init(struct hostapd_data *hapd, +@@ -1177,8 +1177,6 @@ madwifi_init(struct hostapd_data *hapd, goto bad; } - /* mark down during setup */ - linux_set_iface_flags(drv->ioctl_sock, drv->iface, 0); - madwifi_set_privacy(drv->iface, drv, 0); /* default to no privacy */ + madwifi_set_privacy(drv, 0); /* default to no privacy */ madwifi_receive_probe_req(drv); -@@ -1261,8 +1259,7 @@ madwifi_set_countermeasures(void *priv, +@@ -1268,8 +1266,7 @@ madwifi_set_countermeasures(void *priv, static int madwifi_commit(void *priv) { diff --git a/package/hostapd/patches/110-countrycode.patch b/package/hostapd/patches/110-countrycode.patch index dec26ee02f..083de89c14 100644 --- a/package/hostapd/patches/110-countrycode.patch +++ b/package/hostapd/patches/110-countrycode.patch @@ -1,6 +1,6 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -649,7 +649,6 @@ static int setup_interface(struct hostap +@@ -650,7 +650,6 @@ static int setup_interface(struct hostap country[3] = '\0'; if (hostapd_set_country(hapd, country) < 0) { wpa_printf(MSG_ERROR, "Failed to set country code"); diff --git a/package/hostapd/patches/120-compile_fix.patch b/package/hostapd/patches/120-compile_fix.patch index 43a15787d5..89480c1849 100644 --- a/package/hostapd/patches/120-compile_fix.patch +++ b/package/hostapd/patches/120-compile_fix.patch @@ -18,7 +18,7 @@ #ifdef HOSTAPD -@@ -1499,7 +1500,6 @@ wpa_driver_madwifi_set_key(const char *i +@@ -1506,7 +1507,6 @@ wpa_driver_madwifi_set_key(const char *i wk.ik_keyix = key_idx; wk.ik_keylen = key_len; #ifdef WORDS_BIGENDIAN diff --git a/package/hostapd/patches/130-scan_wait.patch b/package/hostapd/patches/130-scan_wait.patch index 7fe928549a..1e29a41ca0 100644 --- a/package/hostapd/patches/130-scan_wait.patch +++ b/package/hostapd/patches/130-scan_wait.patch @@ -10,7 +10,7 @@ /* hostapd.c */ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -745,6 +745,9 @@ int hostapd_setup_interface_complete(str +@@ -746,6 +746,9 @@ int hostapd_setup_interface_complete(str wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", iface->bss[0]->conf->iface); @@ -116,7 +116,7 @@ os_program_deinit(); --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -1854,6 +1854,8 @@ struct hostapd_config * hostapd_config_r +@@ -1855,6 +1855,8 @@ struct hostapd_config * hostapd_config_r } #endif /* CONFIG_IEEE80211W */ #ifdef CONFIG_IEEE80211N diff --git a/package/hostapd/patches/140-wds_sta_remove.patch b/package/hostapd/patches/140-wds_sta_remove.patch deleted file mode 100644 index 80e036eef9..0000000000 --- a/package/hostapd/patches/140-wds_sta_remove.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/src/ap/sta_info.c -+++ b/src/ap/sta_info.c -@@ -121,7 +121,8 @@ void ap_free_sta(struct hostapd_data *ha - - accounting_sta_stop(hapd, sta); - -- hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0); -+ if (sta->flags & WLAN_STA_WDS) -+ hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0); - if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC) && - !(sta->flags & WLAN_STA_PREAUTH)) - hapd->drv.sta_remove(hapd, sta->addr); diff --git a/package/hostapd/patches/150-mbss_driver_handling.patch b/package/hostapd/patches/150-mbss_driver_handling.patch deleted file mode 100644 index 6c55b4095c..0000000000 --- a/package/hostapd/patches/150-mbss_driver_handling.patch +++ /dev/null @@ -1,1115 +0,0 @@ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -59,8 +59,10 @@ - #endif - - struct i802_bss { -+ struct wpa_driver_nl80211_data *drv; - struct i802_bss *next; - int ifindex; -+ char ifname[IFNAMSIZ + 1]; - unsigned int beacon_set:1; - }; - -@@ -68,7 +70,6 @@ struct wpa_driver_nl80211_data { - void *ctx; - struct netlink_data *netlink; - int ioctl_sock; /* socket for ioctl() use */ -- char ifname[IFNAMSIZ + 1]; - char brname[IFNAMSIZ]; - int ifindex; - int if_removed; -@@ -107,6 +108,8 @@ struct wpa_driver_nl80211_data { - - u64 remain_on_chan_cookie; - -+ struct i802_bss first_bss; -+ - #ifdef HOSTAPD - int eapol_sock; /* socket for EAPOL frames */ - -@@ -114,8 +117,6 @@ struct wpa_driver_nl80211_data { - int *if_indices; - int num_if_indices; - -- struct i802_bss bss; -- - int last_freq; - int last_freq_ht; - #endif /* HOSTAPD */ -@@ -135,8 +136,6 @@ static void nl80211_remove_monitor_inter - #ifdef HOSTAPD - static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx); - static void del_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx); --static struct i802_bss * get_bss(struct wpa_driver_nl80211_data *drv, -- int ifindex); - static int i802_set_freq(void *priv, struct hostapd_freq_params *freq); - static int wpa_driver_nl80211_if_remove(void *priv, - enum wpa_driver_if_type type, -@@ -278,7 +277,8 @@ nla_put_failure: - - static int wpa_driver_nl80211_get_bssid(void *priv, u8 *bssid) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - if (!drv->associated) - return -1; - os_memcpy(bssid, drv->bssid, ETH_ALEN); -@@ -288,7 +288,8 @@ static int wpa_driver_nl80211_get_bssid( - - static int wpa_driver_nl80211_get_ssid(void *priv, u8 *ssid) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - if (!drv->associated) - return -1; - os_memcpy(ssid, drv->ssid, drv->ssid_len); -@@ -313,7 +314,7 @@ static void wpa_driver_nl80211_event_lin - event.interface_status.ifname, - del ? "removed" : "added"); - -- if (os_strcmp(drv->ifname, event.interface_status.ifname) == 0) { -+ if (os_strcmp(drv->first_bss.ifname, event.interface_status.ifname) == 0) { - if (del) - drv->if_removed = 1; - else -@@ -336,7 +337,7 @@ static int wpa_driver_nl80211_own_ifname - rta_len = RTA_ALIGN(sizeof(struct rtattr)); - while (RTA_OK(attr, attrlen)) { - if (attr->rta_type == IFLA_IFNAME) { -- if (os_strcmp(((char *) attr) + rta_len, drv->ifname) -+ if (os_strcmp(((char *) attr) + rta_len, drv->first_bss.ifname) - == 0) - return 1; - else -@@ -356,7 +357,7 @@ static int wpa_driver_nl80211_own_ifinde - return 1; - - if (drv->if_removed && wpa_driver_nl80211_own_ifname(drv, buf, len)) { -- drv->ifindex = if_nametoindex(drv->ifname); -+ drv->first_bss.ifindex = if_nametoindex(drv->first_bss.ifname); - wpa_printf(MSG_DEBUG, "nl80211: Update ifindex for a removed " - "interface"); - wpa_driver_nl80211_finish_drv_init(drv); -@@ -785,7 +786,7 @@ static int process_event(struct nl_msg * - if (drv->ap_scan_as_station && - (gnlh->cmd == NL80211_CMD_NEW_SCAN_RESULTS || - gnlh->cmd == NL80211_CMD_SCAN_ABORTED)) { -- wpa_driver_nl80211_set_mode(drv, IEEE80211_MODE_AP); -+ wpa_driver_nl80211_set_mode(&drv->first_bss, IEEE80211_MODE_AP); - drv->ap_scan_as_station = 0; - } - -@@ -889,7 +890,8 @@ static void wpa_driver_nl80211_event_rec - */ - static int wpa_driver_nl80211_set_country(void *priv, const char *alpha2_arg) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - char alpha2[3]; - struct nl_msg *msg; - -@@ -978,7 +980,7 @@ static int wpa_driver_nl80211_get_info(s - genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, - 0, NL80211_CMD_GET_WIPHY, 0); - -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex); -+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->first_bss.ifindex); - - if (send_and_recv_msgs(drv, msg, wiphy_info_handler, info) == 0) - return 0; -@@ -1152,15 +1154,18 @@ static void * wpa_driver_nl80211_init(vo - { - struct wpa_driver_nl80211_data *drv; - struct netlink_config *cfg; -+ struct i802_bss *bss; - - drv = os_zalloc(sizeof(*drv)); - if (drv == NULL) - return NULL; - drv->ctx = ctx; -- os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname)); -+ bss = &drv->first_bss; -+ os_strlcpy(bss->ifname, ifname, sizeof(bss->ifname)); - drv->monitor_ifidx = -1; - drv->monitor_sock = -1; - drv->ioctl_sock = -1; -+ drv->first_bss.drv = drv; - - if (wpa_driver_nl80211_init_nl(drv, ctx)) { - os_free(drv); -@@ -1187,7 +1192,7 @@ static void * wpa_driver_nl80211_init(vo - if (wpa_driver_nl80211_finish_drv_init(drv)) - goto failed; - -- return drv; -+ return bss; - - failed: - netlink_deinit(drv->netlink); -@@ -1207,17 +1212,19 @@ failed: - static int - wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv) - { -- drv->ifindex = if_nametoindex(drv->ifname); -+ struct i802_bss *bss = &drv->first_bss; -+ -+ drv->ifindex = if_nametoindex(drv->first_bss.ifname); - - #ifndef HOSTAPD -- if (wpa_driver_nl80211_set_mode(drv, IEEE80211_MODE_INFRA) < 0) { -+ if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) { - wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to " - "use managed mode"); - } - -- if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1)) { -+ if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) { - wpa_printf(MSG_ERROR, "Could not set interface '%s' UP", -- drv->ifname); -+ bss->ifname); - return -1; - } - -@@ -1232,20 +1239,6 @@ wpa_driver_nl80211_finish_drv_init(struc - } - - --#ifdef HOSTAPD --static void wpa_driver_nl80211_free_bss(struct wpa_driver_nl80211_data *drv) --{ -- struct i802_bss *bss, *prev; -- bss = drv->bss.next; -- while (bss) { -- prev = bss; -- bss = bss->next; -- os_free(bss); -- } --} --#endif /* HOSTAPD */ -- -- - static int wpa_driver_nl80211_del_beacon(struct wpa_driver_nl80211_data *drv) - { - struct nl_msg *msg; -@@ -1273,14 +1266,15 @@ static int wpa_driver_nl80211_del_beacon - */ - static void wpa_driver_nl80211_deinit(void *priv) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - - if (drv->added_if_into_bridge) { -- if (linux_br_del_if(drv->ioctl_sock, drv->brname, drv->ifname) -+ if (linux_br_del_if(drv->ioctl_sock, drv->brname, bss->ifname) - < 0) - wpa_printf(MSG_INFO, "nl80211: Failed to remove " - "interface %s from bridge %s: %s", -- drv->ifname, drv->brname, strerror(errno)); -+ bss->ifname, drv->brname, strerror(errno)); - } - if (drv->added_bridge) { - if (linux_br_del(drv->ioctl_sock, drv->brname) < 0) -@@ -1310,8 +1304,6 @@ static void wpa_driver_nl80211_deinit(vo - - if (drv->if_indices != drv->default_if_indices) - os_free(drv->if_indices); -- -- wpa_driver_nl80211_free_bss(drv); - #endif /* HOSTAPD */ - - if (drv->disable_11b_rates) -@@ -1322,8 +1314,8 @@ static void wpa_driver_nl80211_deinit(vo - - eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx); - -- (void) linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 0); -- wpa_driver_nl80211_set_mode(drv, IEEE80211_MODE_INFRA); -+ (void) linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 0); -+ wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA); - - if (drv->ioctl_sock >= 0) - close(drv->ioctl_sock); -@@ -1355,7 +1347,7 @@ static void wpa_driver_nl80211_scan_time - { - struct wpa_driver_nl80211_data *drv = eloop_ctx; - if (drv->ap_scan_as_station) { -- wpa_driver_nl80211_set_mode(drv, IEEE80211_MODE_AP); -+ wpa_driver_nl80211_set_mode(&drv->first_bss, IEEE80211_MODE_AP); - drv->ap_scan_as_station = 0; - } - wpa_printf(MSG_DEBUG, "Scan timeout - try to get results"); -@@ -1372,7 +1364,8 @@ static void wpa_driver_nl80211_scan_time - static int wpa_driver_nl80211_scan(void *priv, - struct wpa_driver_scan_params *params) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - int ret = 0, timeout; - struct nl_msg *msg, *ssids, *freqs; - size_t i; -@@ -1421,12 +1414,12 @@ static int wpa_driver_nl80211_scan(void - * mac80211 does not allow scan requests in AP mode, so - * try to do this in station mode. - */ -- if (wpa_driver_nl80211_set_mode(drv, -+ if (wpa_driver_nl80211_set_mode(bss, - IEEE80211_MODE_INFRA)) - goto nla_put_failure; - - if (wpa_driver_nl80211_scan(drv, params)) { -- wpa_driver_nl80211_set_mode(drv, -+ wpa_driver_nl80211_set_mode(bss, - IEEE80211_MODE_AP); - goto nla_put_failure; - } -@@ -1662,7 +1655,8 @@ static void wpa_scan_results_free(struct - static struct wpa_scan_results * - wpa_driver_nl80211_get_scan_results(void *priv) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - struct wpa_scan_results *res; - int ret; -@@ -1701,7 +1695,8 @@ static int wpa_driver_nl80211_set_key(co - const u8 *seq, size_t seq_len, - const u8 *key, size_t key_len) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - int ifindex = if_nametoindex(ifname); - struct nl_msg *msg; - int ret; -@@ -1958,7 +1953,8 @@ static int wpa_driver_nl80211_disconnect - static int wpa_driver_nl80211_deauthenticate(void *priv, const u8 *addr, - int reason_code) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME)) - return wpa_driver_nl80211_disconnect(drv, addr, reason_code); - wpa_printf(MSG_DEBUG, "%s", __func__); -@@ -1971,7 +1967,8 @@ static int wpa_driver_nl80211_deauthenti - static int wpa_driver_nl80211_disassociate(void *priv, const u8 *addr, - int reason_code) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME)) - return wpa_driver_nl80211_disconnect(drv, addr, reason_code); - wpa_printf(MSG_DEBUG, "%s", __func__); -@@ -1984,7 +1981,8 @@ static int wpa_driver_nl80211_disassocia - static int wpa_driver_nl80211_authenticate( - void *priv, struct wpa_driver_auth_params *params) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - int ret = -1, i; - struct nl_msg *msg; - enum nl80211_auth_type type; -@@ -1996,7 +1994,7 @@ static int wpa_driver_nl80211_authentica - if (drv->nlmode != NL80211_IFTYPE_STATION) - wpa_driver_nl80211_set_mode(priv, IEEE80211_MODE_INFRA); - -- if (wpa_driver_nl80211_set_mode(drv, IEEE80211_MODE_INFRA) < 0) -+ if (wpa_driver_nl80211_set_mode(priv, IEEE80211_MODE_INFRA) < 0) - return -1; - - retry: -@@ -2013,7 +2011,7 @@ retry: - for (i = 0; i < 4; i++) { - if (!params->wep_key[i]) - continue; -- wpa_driver_nl80211_set_key(drv->ifname, drv, WPA_ALG_WEP, NULL, -+ wpa_driver_nl80211_set_key(bss->ifname, drv, WPA_ALG_WEP, NULL, - i, - i == params->wep_tx_keyidx, NULL, 0, - params->wep_key[i], -@@ -2348,7 +2346,8 @@ wpa_driver_nl80211_add_11b(struct hostap - static struct hostapd_hw_modes * - wpa_driver_nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - struct phy_info_arg result = { - .num_modes = num_modes, -@@ -2417,7 +2416,8 @@ static int wpa_driver_nl80211_send_frame - static int wpa_driver_nl80211_send_mlme(void *priv, const u8 *data, - size_t data_len) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct ieee80211_mgmt *mgmt; - int encrypt = 1; - u16 fc; -@@ -2448,23 +2448,15 @@ static int wpa_driver_nl80211_set_beacon - const u8 *tail, size_t tail_len, - int dtim_period, int beacon_int) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - u8 cmd = NL80211_CMD_NEW_BEACON; - int ret; - int beacon_set; - int ifindex = if_nametoindex(ifname); --#ifdef HOSTAPD -- struct i802_bss *bss; - -- bss = get_bss(drv, ifindex); -- if (bss == NULL) -- return -ENOENT; - beacon_set = bss->beacon_set; --#else /* HOSTAPD */ -- beacon_set = drv->beacon_set; --#endif /* HOSTAPD */ -- - msg = nlmsg_alloc(); - if (!msg) - return -ENOMEM; -@@ -2487,11 +2479,7 @@ static int wpa_driver_nl80211_set_beacon - wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", - ret, strerror(-ret)); - } else { --#ifdef HOSTAPD - bss->beacon_set = 1; --#else /* HOSTAPD */ -- drv->beacon_set = 1; --#endif /* HOSTAPD */ - } - return ret; - nla_put_failure: -@@ -2545,7 +2533,8 @@ nla_put_failure: - static int wpa_driver_nl80211_sta_add(const char *ifname, void *priv, - struct hostapd_sta_add_params *params) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - int ret = -ENOBUFS; - -@@ -2582,7 +2571,8 @@ static int wpa_driver_nl80211_sta_add(co - - static int wpa_driver_nl80211_sta_remove(void *priv, const u8 *addr) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - int ret; - -@@ -2594,7 +2584,7 @@ static int wpa_driver_nl80211_sta_remove - 0, NL80211_CMD_DEL_STATION, 0); - - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, -- if_nametoindex(drv->ifname)); -+ if_nametoindex(bss->ifname)); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); - - ret = send_and_recv_msgs(drv, msg, NULL, NULL); -@@ -3032,7 +3022,7 @@ nl80211_create_monitor_interface(struct - int optval; - socklen_t optlen; - -- snprintf(buf, IFNAMSIZ, "mon.%s", drv->ifname); -+ snprintf(buf, IFNAMSIZ, "mon.%s", drv->first_bss.ifname); - buf[IFNAMSIZ - 1] = '\0'; - - drv->monitor_ifidx = -@@ -3092,7 +3082,8 @@ static int wpa_driver_nl80211_hapd_send_ - void *priv, const u8 *addr, const u8 *data, - size_t data_len, int encrypt, const u8 *own_addr) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct ieee80211_hdr *hdr; - size_t len; - u8 *pos; -@@ -3177,7 +3168,8 @@ static int wpa_driver_nl80211_sta_set_fl - int total_flags, int flags_or, - int flags_and) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg, *flags = NULL; - struct nl80211_sta_flag_update upd; - -@@ -3195,7 +3187,7 @@ static int wpa_driver_nl80211_sta_set_fl - 0, NL80211_CMD_SET_STATION, 0); - - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, -- if_nametoindex(drv->ifname)); -+ if_nametoindex(bss->ifname)); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); - - /* -@@ -3234,7 +3226,7 @@ static int wpa_driver_nl80211_sta_set_fl - static int wpa_driver_nl80211_ap(struct wpa_driver_nl80211_data *drv, - struct wpa_driver_associate_params *params) - { -- if (wpa_driver_nl80211_set_mode(drv, params->mode) || -+ if (wpa_driver_nl80211_set_mode(&drv->first_bss, params->mode) || - wpa_driver_nl80211_set_freq(drv, params->freq, 0, 0)) { - nl80211_remove_monitor_interface(drv); - return -1; -@@ -3285,7 +3277,7 @@ static int wpa_driver_nl80211_ibss(struc - - wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); - -- if (wpa_driver_nl80211_set_mode(drv, params->mode)) { -+ if (wpa_driver_nl80211_set_mode(&drv->first_bss, params->mode)) { - wpa_printf(MSG_INFO, "nl80211: Failed to set interface into " - "IBSS mode"); - return -1; -@@ -3499,7 +3491,8 @@ nla_put_failure: - static int wpa_driver_nl80211_associate( - void *priv, struct wpa_driver_associate_params *params) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - int ret = -1; - struct nl_msg *msg; - -@@ -3510,7 +3503,7 @@ static int wpa_driver_nl80211_associate( - return wpa_driver_nl80211_ibss(drv, params); - - if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME)) { -- if (wpa_driver_nl80211_set_mode(drv, params->mode) < 0) -+ if (wpa_driver_nl80211_set_mode(priv, params->mode) < 0) - return -1; - return wpa_driver_nl80211_connect(drv, params); - } -@@ -3611,7 +3604,8 @@ nla_put_failure: - - static int wpa_driver_nl80211_set_mode(void *priv, int mode) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - int ret = -1; - int nlmode; - -@@ -3646,10 +3640,10 @@ static int wpa_driver_nl80211_set_mode(v - * take the device down, try to set the mode again, and bring the - * device back up. - */ -- if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 0) == 0) { -+ if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 0) == 0) { - /* Try to set the mode again while the interface is down */ - ret = nl80211_set_mode(drv, drv->ifindex, nlmode); -- if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1)) -+ if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) - ret = -1; - } - -@@ -3684,7 +3678,8 @@ done: - static int wpa_driver_nl80211_get_capa(void *priv, - struct wpa_driver_capa *capa) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - if (!drv->has_capability) - return -1; - os_memcpy(capa, &drv->capa, sizeof(*capa)); -@@ -3694,7 +3689,8 @@ static int wpa_driver_nl80211_get_capa(v - - static int wpa_driver_nl80211_set_operstate(void *priv, int state) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - - wpa_printf(MSG_DEBUG, "%s: operstate %d->%d (%s)", - __func__, drv->operstate, state, state ? "UP" : "DORMANT"); -@@ -3706,7 +3702,8 @@ static int wpa_driver_nl80211_set_operst - - static int wpa_driver_nl80211_set_supp_port(void *priv, int authorized) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - struct nl80211_sta_flag_update upd; - -@@ -3718,7 +3715,7 @@ static int wpa_driver_nl80211_set_supp_p - 0, NL80211_CMD_SET_STATION, 0); - - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, -- if_nametoindex(drv->ifname)); -+ if_nametoindex(bss->ifname)); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, drv->bssid); - - os_memset(&upd, 0, sizeof(upd)); -@@ -3735,20 +3732,6 @@ static int wpa_driver_nl80211_set_supp_p - - #ifdef HOSTAPD - --static struct i802_bss * get_bss(struct wpa_driver_nl80211_data *drv, -- int ifindex) --{ -- struct i802_bss *bss = &drv->bss; -- while (bss) { -- if (ifindex == bss->ifindex) -- return bss; -- bss = bss->next; -- } -- wpa_printf(MSG_DEBUG, "nl80211: get_bss(%d) failed", ifindex); -- return NULL; --} -- -- - static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx) - { - int i; -@@ -3842,7 +3825,8 @@ static int get_key_handler(struct nl_msg - static int i802_get_seqnum(const char *iface, void *priv, const u8 *addr, - int idx, u8 *seq) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - - msg = nlmsg_alloc(); -@@ -3868,7 +3852,8 @@ static int i802_get_seqnum(const char *i - static int i802_set_rate_sets(void *priv, int *supp_rates, int *basic_rates, - int mode) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - u8 rates[NL80211_MAX_SUPP_RATES]; - u8 rates_len = 0; -@@ -3887,7 +3872,7 @@ static int i802_set_rate_sets(void *priv - NLA_PUT(msg, NL80211_ATTR_BSS_BASIC_RATES, rates_len, rates); - - /* TODO: multi-BSS support */ -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(drv->ifname)); -+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname)); - - return send_and_recv_msgs(drv, msg, NULL, NULL); - nla_put_failure: -@@ -3898,7 +3883,8 @@ static int i802_set_rate_sets(void *priv - /* Set kernel driver on given frequency (MHz) */ - static int i802_set_freq(void *priv, struct hostapd_freq_params *freq) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - return wpa_driver_nl80211_set_freq(drv, freq->freq, freq->ht_enabled, - freq->sec_channel_offset); - } -@@ -3906,7 +3892,8 @@ static int i802_set_freq(void *priv, str - - static int i802_set_rts(void *priv, int rts) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - int ret = -ENOBUFS; - u32 val; -@@ -3937,7 +3924,8 @@ nla_put_failure: - - static int i802_set_frag(void *priv, int frag) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - int ret = -ENOBUFS; - u32 val; -@@ -3968,7 +3956,8 @@ nla_put_failure: - - static int i802_flush(void *priv) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - - msg = nlmsg_alloc(); -@@ -3982,7 +3971,7 @@ static int i802_flush(void *priv) - * XXX: FIX! this needs to flush all VLANs too - */ - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, -- if_nametoindex(drv->ifname)); -+ if_nametoindex(bss->ifname)); - - return send_and_recv_msgs(drv, msg, NULL, NULL); - nla_put_failure: -@@ -4044,7 +4033,8 @@ static int get_sta_handler(struct nl_msg - static int i802_read_sta_data(void *priv, struct hostap_sta_driver_data *data, - const u8 *addr) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - - os_memset(data, 0, sizeof(*data)); -@@ -4056,7 +4046,7 @@ static int i802_read_sta_data(void *priv - 0, NL80211_CMD_GET_STATION, 0); - - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(drv->ifname)); -+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname)); - - return send_and_recv_msgs(drv, msg, get_sta_handler, data); - nla_put_failure: -@@ -4067,7 +4057,8 @@ static int i802_read_sta_data(void *priv - static int i802_set_tx_queue_params(void *priv, int queue, int aifs, - int cw_min, int cw_max, int burst_time) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - struct nlattr *txq, *params; - -@@ -4078,7 +4069,7 @@ static int i802_set_tx_queue_params(void - genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, - 0, NL80211_CMD_SET_WIPHY, 0); - -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(drv->ifname)); -+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname)); - - txq = nla_nest_start(msg, NL80211_ATTR_WIPHY_TXQ_PARAMS); - if (!txq) -@@ -4110,7 +4101,8 @@ static int i802_set_tx_queue_params(void - - static int i802_set_bss(void *priv, int cts, int preamble, int slot) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - - msg = nlmsg_alloc(); -@@ -4128,7 +4120,7 @@ static int i802_set_bss(void *priv, int - NLA_PUT_U8(msg, NL80211_ATTR_BSS_SHORT_SLOT_TIME, slot); - - /* TODO: multi-BSS support */ -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(drv->ifname)); -+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname)); - - return send_and_recv_msgs(drv, msg, NULL, NULL); - nla_put_failure: -@@ -4157,7 +4149,8 @@ static int i802_set_short_slot_time(void - static int i802_set_sta_vlan(void *priv, const u8 *addr, - const char *ifname, int vlan_id) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - - msg = nlmsg_alloc(); -@@ -4168,7 +4161,7 @@ static int i802_set_sta_vlan(void *priv, - 0, NL80211_CMD_SET_STATION, 0); - - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, -- if_nametoindex(drv->ifname)); -+ if_nametoindex(bss->ifname)); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); - NLA_PUT_U32(msg, NL80211_ATTR_STA_VLAN, - if_nametoindex(ifname)); -@@ -4181,18 +4174,19 @@ static int i802_set_sta_vlan(void *priv, - - static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - char name[16]; - -- os_snprintf(name, sizeof(name), "%s.sta%d", drv->ifname, aid); -+ os_snprintf(name, sizeof(name), "%s.sta%d", bss->ifname, aid); - if (val) { -- if (nl80211_create_iface(priv, name, NL80211_IFTYPE_AP_VLAN, -+ if (nl80211_create_iface(drv, name, NL80211_IFTYPE_AP_VLAN, - NULL, 1) < 0) - return -1; - linux_set_iface_flags(drv->ioctl_sock, name, 1); - return i802_set_sta_vlan(priv, addr, name, 0); - } else { -- i802_set_sta_vlan(priv, addr, drv->ifname, 0); -+ i802_set_sta_vlan(priv, addr, bss->ifname, 0); - return wpa_driver_nl80211_if_remove(priv, WPA_IF_AP_VLAN, - name); - } -@@ -4244,7 +4238,8 @@ static int i802_sta_clear_stats(void *pr - static int i802_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr, - int reason) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct ieee80211_mgmt mgmt; - - memset(&mgmt, 0, sizeof(mgmt)); -@@ -4254,7 +4249,7 @@ static int i802_sta_deauth(void *priv, c - memcpy(mgmt.sa, own_addr, ETH_ALEN); - memcpy(mgmt.bssid, own_addr, ETH_ALEN); - mgmt.u.deauth.reason_code = host_to_le16(reason); -- return wpa_driver_nl80211_send_mlme(drv, (u8 *) &mgmt, -+ return wpa_driver_nl80211_send_mlme(bss, (u8 *) &mgmt, - IEEE80211_HDRLEN + - sizeof(mgmt.u.deauth)); - } -@@ -4263,7 +4258,8 @@ static int i802_sta_deauth(void *priv, c - static int i802_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr, - int reason) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct ieee80211_mgmt mgmt; - - memset(&mgmt, 0, sizeof(mgmt)); -@@ -4273,7 +4269,7 @@ static int i802_sta_disassoc(void *priv, - memcpy(mgmt.sa, own_addr, ETH_ALEN); - memcpy(mgmt.bssid, own_addr, ETH_ALEN); - mgmt.u.disassoc.reason_code = host_to_le16(reason); -- return wpa_driver_nl80211_send_mlme(drv, (u8 *) &mgmt, -+ return wpa_driver_nl80211_send_mlme(bss, (u8 *) &mgmt, - IEEE80211_HDRLEN + - sizeof(mgmt.u.disassoc)); - } -@@ -4335,17 +4331,17 @@ static void *i802_init(struct hostapd_da - struct wpa_init_params *params) - { - struct wpa_driver_nl80211_data *drv; -+ struct i802_bss *bss; - size_t i; - char brname[IFNAMSIZ]; - int ifindex, br_ifindex; - int br_added = 0; - -- drv = wpa_driver_nl80211_init(hapd, params->ifname); -- if (drv == NULL) -+ bss = wpa_driver_nl80211_init(hapd, params->ifname); -+ if (bss == NULL) - return NULL; - -- drv->bss.ifindex = drv->ifindex; -- -+ drv = bss->drv; - if (linux_br_get(brname, params->ifname) == 0) { - wpa_printf(MSG_DEBUG, "nl80211: Interface %s is in bridge %s", - params->ifname, brname); -@@ -4373,18 +4369,18 @@ static void *i802_init(struct hostapd_da - /* start listening for EAPOL on the default AP interface */ - add_ifidx(drv, drv->ifindex); - -- if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 0)) -+ if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 0)) - goto failed; - - if (params->bssid) { -- if (linux_set_ifhwaddr(drv->ioctl_sock, drv->ifname, -+ if (linux_set_ifhwaddr(drv->ioctl_sock, bss->ifname, - params->bssid)) - goto failed; - } - -- if (wpa_driver_nl80211_set_mode(drv, IEEE80211_MODE_AP)) { -+ if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_AP)) { - wpa_printf(MSG_ERROR, "nl80211: Failed to set interface %s " -- "into AP mode", drv->ifname); -+ "into AP mode", bss->ifname); - goto failed; - } - -@@ -4392,7 +4388,7 @@ static void *i802_init(struct hostapd_da - i802_check_bridge(drv, params->bridge[0], params->ifname) < 0) - goto failed; - -- if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1)) -+ if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) - goto failed; - - drv->eapol_sock = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_PAE)); -@@ -4407,10 +4403,10 @@ static void *i802_init(struct hostapd_da - goto failed; - } - -- if (linux_get_ifhwaddr(drv->ioctl_sock, drv->ifname, params->own_addr)) -+ if (linux_get_ifhwaddr(drv->ioctl_sock, bss->ifname, params->own_addr)) - goto failed; - -- return drv; -+ return bss; - - failed: - nl80211_remove_monitor_interface(drv); -@@ -4453,27 +4449,30 @@ static enum nl80211_iftype wpa_driver_nl - static int wpa_driver_nl80211_if_add(const char *iface, void *priv, - enum wpa_driver_if_type type, - const char *ifname, const u8 *addr, -- void *bss_ctx) -+ void *bss_ctx, void **drv_priv) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - int ifidx; - #ifdef HOSTAPD -- struct i802_bss *bss = NULL; -+ struct i802_bss *new_bss = NULL; - - if (type == WPA_IF_AP_BSS) { -- bss = os_zalloc(sizeof(*bss)); -- if (bss == NULL) -+ new_bss = os_zalloc(sizeof(*new_bss)); -+ if (new_bss == NULL) - return -1; - } --#endif /* HOSTAPD */ -+#endif - - ifidx = nl80211_create_iface(drv, ifname, - wpa_driver_nl80211_if_type(type), addr, - 0); -+ - if (ifidx < 0) { - #ifdef HOSTAPD -- os_free(bss); --#endif /* HOSTAPD */ -+ if (type == WPA_IF_AP_BSS) -+ os_free(new_bss); -+#endif - return -1; - } - -@@ -4481,12 +4480,15 @@ static int wpa_driver_nl80211_if_add(con - if (type == WPA_IF_AP_BSS) { - if (linux_set_iface_flags(drv->ioctl_sock, ifname, 1)) { - nl80211_remove_iface(drv, ifidx); -- os_free(bss); -+ os_free(new_bss); - return -1; - } -- bss->ifindex = ifidx; -- bss->next = drv->bss.next; -- drv->bss.next = bss; -+ strncpy(new_bss->ifname, ifname, IFNAMSIZ); -+ new_bss->ifindex = ifidx; -+ new_bss->drv = drv; -+ new_bss->next = drv->first_bss.next; -+ drv->first_bss.next = new_bss; -+ *drv_priv = new_bss; - } - #endif /* HOSTAPD */ - -@@ -4498,27 +4500,27 @@ static int wpa_driver_nl80211_if_remove( - enum wpa_driver_if_type type, - const char *ifname) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - int ifindex = if_nametoindex(ifname); - - nl80211_remove_iface(drv, ifindex); - --#ifdef HOSTAPD -- if (type == WPA_IF_AP_BSS) { -- struct i802_bss *bss, *prev; -- prev = &drv->bss; -- bss = drv->bss.next; -- while (bss) { -- if (ifindex == bss->ifindex) { -- prev->next = bss->next; -- os_free(bss); -- break; -- } -- prev = bss; -- bss = bss->next; -+ if (type != WPA_IF_AP_BSS) -+ return 0; -+ -+ if (bss != &drv->first_bss) { -+ struct i802_bss *tbss = &drv->first_bss; -+ -+ while (tbss) { -+ if (tbss->next != bss) -+ continue; -+ -+ tbss->next = bss->next; -+ os_free(bss); -+ break; - } - } --#endif /* HOSTAPD */ - - return 0; - } -@@ -4540,7 +4542,8 @@ static int cookie_handler(struct nl_msg - static int wpa_driver_nl80211_remain_on_channel(void *priv, unsigned int freq, - unsigned int duration) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - int ret; - u64 cookie; -@@ -4574,7 +4577,8 @@ nla_put_failure: - - static int wpa_driver_nl80211_cancel_remain_on_channel(void *priv) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - int ret; - -@@ -4629,7 +4633,8 @@ static void wpa_driver_nl80211_probe_req - - static int wpa_driver_nl80211_probe_req_report(void *priv, int report) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - - if (drv->nlmode != NL80211_IFTYPE_STATION) { - wpa_printf(MSG_DEBUG, "nl80211: probe_req_report control only " -@@ -4666,9 +4671,10 @@ static int wpa_driver_nl80211_probe_req_ - - static int wpa_driver_nl80211_alloc_interface_addr(void *priv, u8 *addr) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - -- if (linux_get_ifhwaddr(drv->ioctl_sock, drv->ifname, addr) < 0) -+ if (linux_get_ifhwaddr(drv->ioctl_sock, bss->ifname, addr) < 0) - return -1; - - if (addr[0] & 0x02) { -@@ -4738,7 +4744,8 @@ nla_put_failure: - - static int wpa_driver_nl80211_disable_11b_rates(void *priv, int disabled) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - drv->disable_11b_rates = disabled; - return nl80211_disable_11b_rates(drv, drv->ifindex, disabled); - } -@@ -4746,11 +4753,12 @@ static int wpa_driver_nl80211_disable_11 - - static int wpa_driver_nl80211_deinit_ap(void *priv) - { -- struct wpa_driver_nl80211_data *drv = priv; -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; - if (drv->nlmode != NL80211_IFTYPE_AP) - return -1; - wpa_driver_nl80211_del_beacon(drv); -- return wpa_driver_nl80211_set_mode(drv, IEEE80211_MODE_INFRA); -+ return wpa_driver_nl80211_set_mode(priv, IEEE80211_MODE_INFRA); - } - - ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -1472,11 +1472,12 @@ struct wpa_driver_ops { - * @addr: Local address to use for the interface or %NULL to use the - * parent interface address - * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces -+ * @drv_priv: Pointer for overwriting the driver context - * Returns: 0 on success, -1 on failure - */ - int (*if_add)(const char *iface, void *priv, - enum wpa_driver_if_type type, const char *ifname, -- const u8 *addr, void *bss_ctx); -+ const u8 *addr, void *bss_ctx, void **drv_priv); - - /** - * if_remove - Remove a virtual interface ---- a/src/drivers/driver_test.c -+++ b/src/drivers/driver_test.c -@@ -1030,7 +1030,7 @@ static int test_driver_bss_remove(void * - - static int test_driver_if_add(const char *iface, void *priv, - enum wpa_driver_if_type type, const char *ifname, -- const u8 *addr, void *bss_ctx) -+ const u8 *addr, void *bss_ctx, void **drv_priv) - { - wpa_printf(MSG_DEBUG, "%s(iface=%s type=%d ifname=%s bss_ctx=%p)", - __func__, iface, type, ifname, bss_ctx); ---- a/src/ap/ap_drv_ops.c -+++ b/src/ap/ap_drv_ops.c -@@ -242,7 +242,8 @@ static int hostapd_set_beacon(const char - - static int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname) - { -- return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, NULL, NULL); -+ return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, NULL, NULL, -+ &hapd->drv_priv); - } - - static int hostapd_vlan_if_remove(struct hostapd_data *hapd, -@@ -407,12 +408,13 @@ int hostapd_set_ssid(struct hostapd_data - - - int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type, -- const char *ifname, const u8 *addr, void *bss_ctx) -+ const char *ifname, const u8 *addr, void *bss_ctx, -+ void **drv_priv) - { - if (hapd->driver == NULL || hapd->driver->if_add == NULL) - return -1; - return hapd->driver->if_add(hapd->conf->iface, hapd->drv_priv, type, -- ifname, addr, bss_ctx); -+ ifname, addr, bss_ctx, drv_priv); - } - - ---- a/src/ap/ap_drv_ops.h -+++ b/src/ap/ap_drv_ops.h -@@ -26,7 +26,8 @@ int hostapd_set_generic_elem(struct host - int hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len); - int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len); - int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type, -- const char *ifname, const u8 *addr, void *bss_ctx); -+ const char *ifname, const u8 *addr, void *bss_ctx, -+ void **drv_priv); - int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type, - const char *ifname); - int hostapd_set_ieee8021x(struct hostapd_data *hapd, ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -484,7 +484,8 @@ static int hostapd_setup_bss(struct host - - hapd->interface_added = 1; - if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS, -- hapd->conf->iface, hapd->own_addr, hapd)) { -+ hapd->conf->iface, hapd->own_addr, hapd, -+ &hapd->drv_priv)) { - wpa_printf(MSG_ERROR, "Failed to add BSS (BSSID=" - MACSTR ")", MAC2STR(hapd->own_addr)); - return -1; diff --git a/package/hostapd/patches/160-sta_roam_between_bss.patch b/package/hostapd/patches/160-sta_roam_between_bss.patch deleted file mode 100644 index dfd5fd88c8..0000000000 --- a/package/hostapd/patches/160-sta_roam_between_bss.patch +++ /dev/null @@ -1,79 +0,0 @@ ---- a/src/ap/sta_info.c -+++ b/src/ap/sta_info.c -@@ -32,8 +32,8 @@ - #include "vlan_init.h" - #include "sta_info.h" - --static int ap_sta_in_other_bss(struct hostapd_data *hapd, -- struct sta_info *sta, u32 flags); -+static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd, -+ struct sta_info *sta); - static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx); - #ifdef CONFIG_IEEE80211W - static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx); -@@ -123,8 +123,8 @@ void ap_free_sta(struct hostapd_data *ha - - if (sta->flags & WLAN_STA_WDS) - hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0); -- if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC) && -- !(sta->flags & WLAN_STA_PREAUTH)) -+ -+ if (!(sta->flags & WLAN_STA_PREAUTH)) - hapd->drv.sta_remove(hapd, sta->addr); - - ap_sta_hash_del(hapd, sta); -@@ -451,6 +451,7 @@ struct sta_info * ap_sta_add(struct host - hapd->num_sta++; - ap_sta_hash_add(hapd, sta); - sta->ssid = &hapd->conf->ssid; -+ ap_sta_remove_in_other_bss(hapd, sta); - - return sta; - } -@@ -472,8 +473,8 @@ static int ap_sta_remove(struct hostapd_ - } - - --static int ap_sta_in_other_bss(struct hostapd_data *hapd, -- struct sta_info *sta, u32 flags) -+static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd, -+ struct sta_info *sta) - { - struct hostapd_iface *iface = hapd->iface; - size_t i; -@@ -488,11 +489,11 @@ static int ap_sta_in_other_bss(struct ho - if (bss == hapd || bss == NULL) - continue; - sta2 = ap_get_sta(bss, sta->addr); -- if (sta2 && ((sta2->flags & flags) == flags)) -- return 1; -- } -+ if (!sta2) -+ continue; - -- return 0; -+ ap_sta_disconnect(bss, sta2, sta2->addr, WLAN_REASON_DEAUTH_LEAVING); -+ } - } - - -@@ -502,8 +503,7 @@ void ap_sta_disassociate(struct hostapd_ - wpa_printf(MSG_DEBUG, "%s: disassociate STA " MACSTR, - hapd->conf->iface, MAC2STR(sta->addr)); - sta->flags &= ~WLAN_STA_ASSOC; -- if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC)) -- ap_sta_remove(hapd, sta); -+ ap_sta_remove(hapd, sta); - sta->timeout_next = STA_DEAUTH; - eloop_cancel_timeout(ap_handle_timer, hapd, sta); - eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DISASSOC, 0, -@@ -521,8 +521,7 @@ void ap_sta_deauthenticate(struct hostap - wpa_printf(MSG_DEBUG, "%s: deauthenticate STA " MACSTR, - hapd->conf->iface, MAC2STR(sta->addr)); - sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC); -- if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC)) -- ap_sta_remove(hapd, sta); -+ ap_sta_remove(hapd, sta); - sta->timeout_next = STA_REMOVE; - eloop_cancel_timeout(ap_handle_timer, hapd, sta); - eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DEAUTH, 0, diff --git a/package/hostapd/patches/200-multicall.patch b/package/hostapd/patches/200-multicall.patch index fbbba20e4c..4ba9301a39 100644 --- a/package/hostapd/patches/200-multicall.patch +++ b/package/hostapd/patches/200-multicall.patch @@ -75,18 +75,18 @@ ifdef CONFIG_AP @@ -631,6 +636,12 @@ CFLAGS += -DEAP_SERVER_WSC OBJS += ../src/ap/wps_hostapd.o - OBJS += ../src/eap_server/eap_wsc.o + OBJS += ../src/eap_server/eap_server_wsc.o endif +else + ifdef MULTICALL -+ OBJS += ../src/eap_server/eap.o -+ OBJS += ../src/eap_server/eap_identity.o -+ OBJS += ../src/eap_server/eap_methods.o ++ OBJS += ../src/eap_server/eap_server.o ++ OBJS += ../src/eap_server/eap_server_identity.o ++ OBJS += ../src/eap_server/eap_server_methods.o + endif endif ifdef NEED_RSN_AUTHENTICATOR -@@ -1260,6 +1271,12 @@ BCHECK=../src/drivers/build.wpa_supplica +@@ -1261,6 +1272,12 @@ BCHECK=../src/drivers/build.wpa_supplica wpa_priv: $(BCHECK) $(OBJS_priv) $(LDO) $(LDFLAGS) -o wpa_priv $(OBJS_priv) $(LIBS) @@ -99,7 +99,7 @@ wpa_supplicant: .config $(BCHECK) $(OBJS) $(EXTRA_progs) $(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) -@@ -1319,6 +1336,12 @@ endif +@@ -1320,6 +1337,12 @@ endif $(Q)$(CC) -c -o $@ $(CFLAGS) $< @$(E) " CC " $< @@ -114,7 +114,7 @@ wpa_cli.exe: wpa_cli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -2384,8 +2384,8 @@ union wpa_event_data { +@@ -2413,8 +2413,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -169,7 +169,7 @@ for (;;) { --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -1425,8 +1425,8 @@ static void wpa_supplicant_event_ibss_rs +@@ -1506,8 +1506,8 @@ static void wpa_supplicant_event_ibss_rs #endif /* CONFIG_IBSS_RSN */ diff --git a/package/hostapd/patches/310-scan_ssid.patch b/package/hostapd/patches/310-scan_ssid.patch index 5a7e10f6b7..1572098200 100644 --- a/package/hostapd/patches/310-scan_ssid.patch +++ b/package/hostapd/patches/310-scan_ssid.patch @@ -1,14 +1,14 @@ --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c -@@ -215,6 +215,7 @@ static void wpa_supplicant_scan(void *el +@@ -248,6 +248,7 @@ static void wpa_supplicant_scan(void *el enum wps_request_type req_type = WPS_REQ_ENROLLEE_INFO; #endif /* CONFIG_WPS */ struct wpa_driver_scan_params params; + int scan_ssid_all = 1; size_t max_ssids; + enum wpa_states prev_state; - if (wpa_s->disconnected && !wpa_s->scan_req) { -@@ -275,6 +276,16 @@ static void wpa_supplicant_scan(void *el +@@ -310,6 +311,16 @@ static void wpa_supplicant_scan(void *el wpa_s->wpa_state == WPA_INACTIVE) wpa_supplicant_set_state(wpa_s, WPA_SCANNING); @@ -25,7 +25,7 @@ /* Find the starting point from which to continue scanning */ ssid = wpa_s->conf->ssid; if (wpa_s->prev_scan_ssid != WILDCARD_SSID_SCAN) { -@@ -336,6 +347,9 @@ static void wpa_supplicant_scan(void *el +@@ -371,6 +382,9 @@ static void wpa_supplicant_scan(void *el int_array_sort_unique(params.freqs); } diff --git a/package/hostapd/patches/320-rescan_immediately.patch b/package/hostapd/patches/320-rescan_immediately.patch index a4020bc1dd..f486baf645 100644 --- a/package/hostapd/patches/320-rescan_immediately.patch +++ b/package/hostapd/patches/320-rescan_immediately.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -843,7 +843,7 @@ static void wpa_supplicant_event_scan_re +@@ -924,7 +924,7 @@ static void wpa_supplicant_event_scan_re wpa_printf(MSG_DEBUG, "Setup a new network"); wpa_supplicant_associate(wpa_s, NULL, ssid); } else diff --git a/package/hostapd/patches/330-madwifi_merge.patch b/package/hostapd/patches/330-madwifi_merge.patch index e3a89d1be6..f35eab3860 100644 --- a/package/hostapd/patches/330-madwifi_merge.patch +++ b/package/hostapd/patches/330-madwifi_merge.patch @@ -145,7 +145,7 @@ madwifi_raw_receive, drv, 1); if (drv->sock_raw == NULL) return -1; -@@ -1017,7 +1019,7 @@ madwifi_get_we_version(struct madwifi_dr +@@ -1016,7 +1018,7 @@ madwifi_get_we_version(struct madwifi_dr return -1; memset(&iwr, 0, sizeof(iwr)); @@ -154,7 +154,7 @@ iwr.u.data.pointer = (caddr_t) range; iwr.u.data.length = buflen; -@@ -1134,17 +1136,17 @@ madwifi_init(struct hostapd_data *hapd, +@@ -1133,17 +1135,17 @@ madwifi_init(struct hostapd_data *hapd, perror("socket[PF_INET,SOCK_DGRAM]"); goto bad; } @@ -175,7 +175,7 @@ handle_read, drv, 1); if (drv->sock_xmit == NULL) goto bad; -@@ -1158,7 +1160,7 @@ madwifi_init(struct hostapd_data *hapd, +@@ -1157,7 +1159,7 @@ madwifi_init(struct hostapd_data *hapd, 1); if (drv->sock_recv == NULL) goto bad; @@ -184,7 +184,7 @@ wpa_printf(MSG_DEBUG, "Interface in bridge %s; configure for " "EAPOL receive", brname); drv->sock_recv = l2_packet_init(brname, NULL, ETH_P_EAPOL, -@@ -1169,7 +1171,7 @@ madwifi_init(struct hostapd_data *hapd, +@@ -1168,7 +1170,7 @@ madwifi_init(struct hostapd_data *hapd, drv->sock_recv = drv->sock_xmit; memset(&iwr, 0, sizeof(iwr)); @@ -193,16 +193,7 @@ iwr.u.mode = IW_MODE_MASTER; -@@ -1179,7 +1181,7 @@ madwifi_init(struct hostapd_data *hapd, - goto bad; - } - -- madwifi_set_privacy(drv->iface, drv, 0); /* default to no privacy */ -+ madwifi_set_privacy(drv->ifname, drv, 0); /* default to no privacy */ - - madwifi_receive_probe_req(drv); - -@@ -1204,7 +1206,7 @@ madwifi_deinit(void *priv) +@@ -1203,7 +1205,7 @@ madwifi_deinit(void *priv) struct madwifi_driver_data *drv = priv; netlink_deinit(drv->netlink); @@ -211,7 +202,7 @@ if (drv->ioctl_sock >= 0) close(drv->ioctl_sock); if (drv->sock_recv != NULL && drv->sock_recv != drv->sock_xmit) -@@ -1223,7 +1225,7 @@ madwifi_set_ssid(const char *ifname, voi +@@ -1222,7 +1224,7 @@ madwifi_set_ssid(void *priv, const u8 *b struct iwreq iwr; memset(&iwr, 0, sizeof(iwr)); @@ -220,7 +211,7 @@ iwr.u.essid.flags = 1; /* SSID active */ iwr.u.essid.pointer = (caddr_t) buf; iwr.u.essid.length = len + 1; -@@ -1244,7 +1246,7 @@ madwifi_get_ssid(const char *ifname, voi +@@ -1243,7 +1245,7 @@ madwifi_get_ssid(void *priv, u8 *buf, in int ret = 0; memset(&iwr, 0, sizeof(iwr)); @@ -229,7 +220,7 @@ iwr.u.essid.pointer = (caddr_t) buf; iwr.u.essid.length = len; -@@ -1271,137 +1273,16 @@ madwifi_commit(void *priv) +@@ -1270,137 +1272,16 @@ madwifi_commit(void *priv) return 0; } @@ -370,7 +361,7 @@ const u8 *wpa_ie, size_t wpa_ie_len) { struct iwreq iwr; -@@ -1412,7 +1293,7 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa +@@ -1411,7 +1292,7 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa iwr.u.data.pointer = (void *) wpa_ie; iwr.u.data.length = wpa_ie_len; @@ -379,7 +370,7 @@ perror("ioctl[IEEE80211_IOCTL_SETOPTIE]"); return -1; } -@@ -1420,156 +1301,51 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa +@@ -1419,156 +1300,51 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa } static int @@ -544,7 +535,7 @@ ret = -1; if (wpa_driver_madwifi_set_auth_alg(drv, params->auth_alg) < 0) ret = -1; -@@ -1592,12 +1368,12 @@ wpa_driver_madwifi_associate(void *priv, +@@ -1591,12 +1367,12 @@ wpa_driver_madwifi_associate(void *priv, params->wpa_ie_len == 0) privacy = 0; @@ -559,7 +550,7 @@ ret = -1; if (params->bssid == NULL) { -@@ -1605,14 +1381,14 @@ wpa_driver_madwifi_associate(void *priv, +@@ -1604,14 +1380,14 @@ wpa_driver_madwifi_associate(void *priv, * roaming */ /* FIX: this does not seem to work; would probably need to * change something in the driver */ @@ -576,7 +567,7 @@ ret = -1; if (wpa_driver_wext_set_ssid(drv->wext, params->ssid, params->ssid_len) < 0) -@@ -1621,7 +1397,7 @@ wpa_driver_madwifi_associate(void *priv, +@@ -1620,7 +1396,7 @@ wpa_driver_madwifi_associate(void *priv, mlme.im_op = IEEE80211_MLME_ASSOC; os_memcpy(mlme.im_macaddr, params->bssid, IEEE80211_ADDR_LEN); if (set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, @@ -585,7 +576,7 @@ wpa_printf(MSG_DEBUG, "%s: SETMLME[ASSOC] failed", __func__); ret = -1; -@@ -1634,7 +1410,7 @@ wpa_driver_madwifi_associate(void *priv, +@@ -1633,7 +1409,7 @@ wpa_driver_madwifi_associate(void *priv, static int wpa_driver_madwifi_set_auth_alg(void *priv, int auth_alg) { @@ -594,7 +585,7 @@ int authmode; if ((auth_alg & WPA_AUTH_ALG_OPEN) && -@@ -1645,13 +1421,13 @@ wpa_driver_madwifi_set_auth_alg(void *pr +@@ -1644,13 +1420,13 @@ wpa_driver_madwifi_set_auth_alg(void *pr else authmode = IEEE80211_AUTH_OPEN; @@ -610,7 +601,7 @@ struct iwreq iwr; int ret = 0; const u8 *ssid = params->ssids[0].ssid; -@@ -1669,7 +1445,7 @@ wpa_driver_madwifi_scan(void *priv, stru +@@ -1668,7 +1444,7 @@ wpa_driver_madwifi_scan(void *priv, stru if (wpa_driver_wext_set_ssid(drv->wext, ssid, ssid_len) < 0) ret = -1; @@ -619,7 +610,7 @@ perror("ioctl[SIOCSIWSCAN]"); ret = -1; } -@@ -1691,14 +1467,14 @@ wpa_driver_madwifi_scan(void *priv, stru +@@ -1690,14 +1466,14 @@ wpa_driver_madwifi_scan(void *priv, stru static int wpa_driver_madwifi_get_bssid(void *priv, u8 *bssid) { @@ -636,7 +627,7 @@ return wpa_driver_wext_get_ssid(drv->wext, ssid); } -@@ -1706,14 +1482,14 @@ static int wpa_driver_madwifi_get_ssid(v +@@ -1705,14 +1481,14 @@ static int wpa_driver_madwifi_get_ssid(v static struct wpa_scan_results * wpa_driver_madwifi_get_scan_results(void *priv) { @@ -653,7 +644,7 @@ return wpa_driver_wext_set_operstate(drv->wext, state); } -@@ -1734,7 +1510,7 @@ static int wpa_driver_madwifi_set_probe_ +@@ -1733,7 +1509,7 @@ static int wpa_driver_madwifi_set_probe_ ret = set80211priv(priv, IEEE80211_IOCTL_SET_APPIEBUF, probe_req_ie, sizeof(struct ieee80211req_getset_appiebuf) + @@ -662,7 +653,7 @@ os_free(probe_req_ie); -@@ -1744,7 +1520,7 @@ static int wpa_driver_madwifi_set_probe_ +@@ -1743,7 +1519,7 @@ static int wpa_driver_madwifi_set_probe_ static void * wpa_driver_madwifi_init(void *ctx, const char *ifname) { @@ -671,7 +662,7 @@ drv = os_zalloc(sizeof(*drv)); if (drv == NULL) -@@ -1755,17 +1531,17 @@ static void * wpa_driver_madwifi_init(vo +@@ -1754,17 +1530,17 @@ static void * wpa_driver_madwifi_init(vo drv->ctx = ctx; os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname)); @@ -693,7 +684,7 @@ wpa_printf(MSG_DEBUG, "%s: failed to enable WPA support", __FUNCTION__); goto fail3; -@@ -1774,7 +1550,7 @@ static void * wpa_driver_madwifi_init(vo +@@ -1773,7 +1549,7 @@ static void * wpa_driver_madwifi_init(vo return drv; fail3: @@ -702,7 +693,7 @@ fail2: wpa_driver_wext_deinit(drv->wext); fail: -@@ -1785,38 +1561,37 @@ fail: +@@ -1784,38 +1560,37 @@ fail: static void wpa_driver_madwifi_deinit(void *priv) { @@ -748,7 +739,7 @@ #ifdef HOSTAPD .hapd_init = madwifi_init, .hapd_deinit = madwifi_deinit, -@@ -1836,7 +1611,8 @@ const struct wpa_driver_ops wpa_driver_m +@@ -1835,7 +1610,8 @@ const struct wpa_driver_ops wpa_driver_m .sta_clear_stats = madwifi_sta_clear_stats, .commit = madwifi_commit, .set_ap_wps_ie = madwifi_set_ap_wps_ie, @@ -758,7 +749,7 @@ .get_bssid = wpa_driver_madwifi_get_bssid, .get_ssid = wpa_driver_madwifi_get_ssid, .init = wpa_driver_madwifi_init, -@@ -1848,5 +1624,5 @@ const struct wpa_driver_ops wpa_driver_m +@@ -1847,5 +1623,5 @@ const struct wpa_driver_ops wpa_driver_m .disassociate = wpa_driver_madwifi_disassociate, .associate = wpa_driver_madwifi_associate, .set_operstate = wpa_driver_madwifi_set_operstate,