Lines Matching refs:drv
173 wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv,
186 static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
188 static void del_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
190 static int have_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
195 static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv,
198 static int nl80211_leave_ibss(struct wpa_driver_nl80211_data *drv,
247 struct i802_bss * get_bss_ifindex(struct wpa_driver_nl80211_data *drv, in get_bss_ifindex() argument
252 for (bss = drv->first_bss; bss; bss = bss->next) { in get_bss_ifindex()
267 void nl80211_mark_disconnected(struct wpa_driver_nl80211_data *drv) in nl80211_mark_disconnected() argument
269 if (drv->associated) in nl80211_mark_disconnected()
270 os_memcpy(drv->prev_bssid, drv->bssid, ETH_ALEN); in nl80211_mark_disconnected()
271 drv->associated = 0; in nl80211_mark_disconnected()
272 os_memset(drv->bssid, 0, ETH_ALEN); in nl80211_mark_disconnected()
374 int send_and_recv_msgs(struct wpa_driver_nl80211_data *drv, in send_and_recv_msgs() argument
379 return send_and_recv(drv->global, drv->global->nl, msg, in send_and_recv_msgs()
445 void * nl80211_cmd(struct wpa_driver_nl80211_data *drv, in nl80211_cmd() argument
448 return genlmsg_put(msg, 0, 0, drv->global->nl80211_id, in nl80211_cmd()
469 if (!nl80211_cmd(bss->drv, msg, flags, cmd) || in nl80211_cmd_msg()
480 nl80211_ifindex_msg(struct wpa_driver_nl80211_data *drv, int ifindex, in nl80211_ifindex_msg() argument
489 if (!nl80211_cmd(drv, msg, flags, cmd) || in nl80211_ifindex_msg()
499 struct nl_msg * nl80211_drv_msg(struct wpa_driver_nl80211_data *drv, int flags, in nl80211_drv_msg() argument
502 return nl80211_ifindex_msg(drv, drv->ifindex, flags, cmd); in nl80211_drv_msg()
508 return nl80211_ifindex_msg(bss->drv, bss->ifindex, flags, cmd); in nl80211_bss_msg()
553 if (send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data) == 0) in nl80211_get_wiphy_index()
570 if (send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data) == 0) in nl80211_get_ifmode()
586 return send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data); in nl80211_get_macaddr()
590 static int nl80211_register_beacons(struct wpa_driver_nl80211_data *drv, in nl80211_register_beacons() argument
600 if (!nl80211_cmd(drv, msg, 0, NL80211_CMD_REGISTER_BEACONS) || in nl80211_register_beacons()
606 ret = send_and_recv(drv->global, w->nl_beacons, msg, NULL, NULL); in nl80211_register_beacons()
634 struct wpa_driver_nl80211_data *drv; in process_beacon_event() local
651 dl_list_for_each(drv, &w->drvs, struct wpa_driver_nl80211_data, in process_beacon_event()
656 wpa_supplicant_event(drv->ctx, EVENT_RX_MGMT, &event); in process_beacon_event()
698 w->nl_beacons = nl_create_handle(bss->drv->global->nl_cb, in nl80211_get_wiphy_data_ap()
705 if (nl80211_register_beacons(bss->drv, w)) { in nl80211_get_wiphy_data_ap()
718 if (tmp_bss->drv == bss->drv) { in nl80211_get_wiphy_data_ap()
725 dl_list_add(&w->drvs, &bss->drv->wiphy_list); in nl80211_get_wiphy_data_ap()
746 if (tmp_bss->drv == bss->drv) { in nl80211_put_wiphy_data_ap()
753 dl_list_del(&bss->drv->wiphy_list); in nl80211_put_wiphy_data_ap()
769 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_get_ifindex() local
771 return drv->ifindex; in nl80211_get_ifindex()
778 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_get_bssid() local
779 if (!drv->associated) in wpa_driver_nl80211_get_bssid()
781 os_memcpy(bssid, drv->bssid, ETH_ALEN); in wpa_driver_nl80211_get_bssid()
789 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_get_ssid() local
790 if (!drv->associated) in wpa_driver_nl80211_get_ssid()
792 os_memcpy(ssid, drv->ssid, drv->ssid_len); in wpa_driver_nl80211_get_ssid()
793 return drv->ssid_len; in wpa_driver_nl80211_get_ssid()
798 struct nl80211_global *global, struct wpa_driver_nl80211_data *drv, in wpa_driver_nl80211_event_newlink() argument
803 if (drv && os_strcmp(drv->first_bss->ifname, ifname) == 0) { in wpa_driver_nl80211_event_newlink()
804 if (if_nametoindex(drv->first_bss->ifname) == 0) { in wpa_driver_nl80211_event_newlink()
806 drv->first_bss->ifname); in wpa_driver_nl80211_event_newlink()
809 if (!drv->if_removed) in wpa_driver_nl80211_event_newlink()
812 drv->first_bss->ifname); in wpa_driver_nl80211_event_newlink()
813 drv->if_removed = 0; in wpa_driver_nl80211_event_newlink()
821 if (drv) in wpa_driver_nl80211_event_newlink()
822 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS, &event); in wpa_driver_nl80211_event_newlink()
830 struct nl80211_global *global, struct wpa_driver_nl80211_data *drv, in wpa_driver_nl80211_event_dellink() argument
835 if (drv && os_strcmp(drv->first_bss->ifname, ifname) == 0) { in wpa_driver_nl80211_event_dellink()
836 if (drv->if_removed) { in wpa_driver_nl80211_event_dellink()
843 drv->if_removed = 1; in wpa_driver_nl80211_event_dellink()
854 if (drv) in wpa_driver_nl80211_event_dellink()
855 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS, &event); in wpa_driver_nl80211_event_dellink()
862 static int wpa_driver_nl80211_own_ifname(struct wpa_driver_nl80211_data *drv, in wpa_driver_nl80211_own_ifname() argument
875 drv->first_bss->ifname) == 0) in wpa_driver_nl80211_own_ifname()
887 static int wpa_driver_nl80211_own_ifindex(struct wpa_driver_nl80211_data *drv, in wpa_driver_nl80211_own_ifindex() argument
890 if (drv->ifindex == ifindex) in wpa_driver_nl80211_own_ifindex()
893 if (drv->if_removed && wpa_driver_nl80211_own_ifname(drv, buf, len)) { in wpa_driver_nl80211_own_ifindex()
894 nl80211_check_global(drv->global); in wpa_driver_nl80211_own_ifindex()
897 wpa_driver_nl80211_finish_drv_init(drv, NULL, 0, NULL); in wpa_driver_nl80211_own_ifindex()
908 struct wpa_driver_nl80211_data *drv; in nl80211_find_drv() local
909 dl_list_for_each(drv, &global->interfaces, in nl80211_find_drv()
911 if (wpa_driver_nl80211_own_ifindex(drv, idx, buf, len) || in nl80211_find_drv()
912 have_ifidx(drv, idx, IFIDX_ANY)) in nl80211_find_drv()
913 return drv; in nl80211_find_drv()
924 struct wpa_driver_nl80211_data *drv; in wpa_driver_nl80211_event_rtm_newlink() local
975 drv = nl80211_find_drv(global, ifi->ifi_index, buf, len); in wpa_driver_nl80211_event_rtm_newlink()
976 if (!drv) in wpa_driver_nl80211_event_rtm_newlink()
979 if (!drv->if_disabled && !(ifi->ifi_flags & IFF_UP)) { in wpa_driver_nl80211_event_rtm_newlink()
982 linux_iface_up(drv->global->ioctl_sock, namebuf) > 0) { in wpa_driver_nl80211_event_rtm_newlink()
985 drv->ignore_if_down_event = 0; in wpa_driver_nl80211_event_rtm_newlink()
990 if (os_strcmp(drv->first_bss->ifname, ifname) != 0) { in wpa_driver_nl80211_event_rtm_newlink()
993 drv->first_bss->ifname); in wpa_driver_nl80211_event_rtm_newlink()
994 } else if (drv->ignore_if_down_event) { in wpa_driver_nl80211_event_rtm_newlink()
997 drv->ignore_if_down_event = 0; in wpa_driver_nl80211_event_rtm_newlink()
999 drv->if_disabled = 1; in wpa_driver_nl80211_event_rtm_newlink()
1000 wpa_supplicant_event(drv->ctx, in wpa_driver_nl80211_event_rtm_newlink()
1008 drv = nl80211_find_drv(global, ifi->ifi_index, in wpa_driver_nl80211_event_rtm_newlink()
1010 if (!drv) in wpa_driver_nl80211_event_rtm_newlink()
1015 if (drv->if_disabled && (ifi->ifi_flags & IFF_UP)) { in wpa_driver_nl80211_event_rtm_newlink()
1017 linux_iface_up(drv->global->ioctl_sock, namebuf) == 0) { in wpa_driver_nl80211_event_rtm_newlink()
1021 } else if (if_nametoindex(drv->first_bss->ifname) == 0) { in wpa_driver_nl80211_event_rtm_newlink()
1024 drv->first_bss->ifname); in wpa_driver_nl80211_event_rtm_newlink()
1025 } else if (drv->if_removed) { in wpa_driver_nl80211_event_rtm_newlink()
1028 "removed", drv->first_bss->ifname); in wpa_driver_nl80211_event_rtm_newlink()
1034 bss = get_bss_ifindex(drv, ifi->ifi_index); in wpa_driver_nl80211_event_rtm_newlink()
1036 linux_get_ifhwaddr(drv->global->ioctl_sock, in wpa_driver_nl80211_event_rtm_newlink()
1053 drv->if_disabled = 0; in wpa_driver_nl80211_event_rtm_newlink()
1054 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED, in wpa_driver_nl80211_event_rtm_newlink()
1065 if (drv->operstate == 1 && in wpa_driver_nl80211_event_rtm_newlink()
1069 netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, in wpa_driver_nl80211_event_rtm_newlink()
1075 wpa_driver_nl80211_event_newlink(global, drv, ifi->ifi_index, in wpa_driver_nl80211_event_rtm_newlink()
1078 if (ifi->ifi_family == AF_BRIDGE && brid && drv) { in wpa_driver_nl80211_event_rtm_newlink()
1090 add_ifidx(drv, brid, ifi->ifi_index); in wpa_driver_nl80211_event_rtm_newlink()
1092 for (bss = drv->first_bss; bss; bss = bss->next) { in wpa_driver_nl80211_event_rtm_newlink()
1107 struct wpa_driver_nl80211_data *drv; in wpa_driver_nl80211_event_rtm_dellink() local
1154 drv = nl80211_find_drv(global, ifi->ifi_index, buf, len); in wpa_driver_nl80211_event_rtm_dellink()
1156 if (ifi->ifi_family == AF_BRIDGE && brid && drv) { in wpa_driver_nl80211_event_rtm_dellink()
1169 del_ifidx(drv, brid, ifi->ifi_index); in wpa_driver_nl80211_event_rtm_dellink()
1173 wpa_driver_nl80211_event_dellink(global, drv, ifi->ifi_index, in wpa_driver_nl80211_event_rtm_dellink()
1178 unsigned int nl80211_get_assoc_freq(struct wpa_driver_nl80211_data *drv) in nl80211_get_assoc_freq() argument
1184 msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_GET_SCAN); in nl80211_get_assoc_freq()
1186 arg.drv = drv; in nl80211_get_assoc_freq()
1187 ret = send_and_recv_msgs(drv, msg, bss_info_handler, &arg); in nl80211_get_assoc_freq()
1189 unsigned int freq = drv->nlmode == NL80211_IFTYPE_ADHOC ? in nl80211_get_assoc_freq()
1194 drv->assoc_freq = freq; in nl80211_get_assoc_freq()
1195 return drv->assoc_freq; in nl80211_get_assoc_freq()
1199 return drv->assoc_freq; in nl80211_get_assoc_freq()
1265 int nl80211_get_link_signal(struct wpa_driver_nl80211_data *drv, in nl80211_get_link_signal() argument
1273 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_GET_STATION)) || in nl80211_get_link_signal()
1274 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, drv->bssid)) { in nl80211_get_link_signal()
1279 return send_and_recv_msgs(drv, msg, get_link_signal, sig); in nl80211_get_link_signal()
1327 int nl80211_get_link_noise(struct wpa_driver_nl80211_data *drv, in nl80211_get_link_noise() argument
1333 sig_change->frequency = drv->assoc_freq; in nl80211_get_link_noise()
1335 msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_GET_SURVEY); in nl80211_get_link_noise()
1336 return send_and_recv_msgs(drv, msg, get_link_noise, sig_change); in nl80211_get_link_noise()
1368 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_set_country() local
1380 if (!nl80211_cmd(drv, msg, 0, NL80211_CMD_REQ_SET_REG) || in wpa_driver_nl80211_set_country()
1385 if (send_and_recv_msgs(drv, msg, NULL, NULL)) in wpa_driver_nl80211_set_country()
1411 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_get_country() local
1419 nl80211_cmd(drv, msg, 0, NL80211_CMD_GET_REG); in wpa_driver_nl80211_get_country()
1421 ret = send_and_recv_msgs(drv, msg, nl80211_get_country, alpha2); in wpa_driver_nl80211_get_country()
1544 struct wpa_driver_nl80211_data *drv = ctx; in wpa_driver_nl80211_rfkill_blocked() local
1552 if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) in wpa_driver_nl80211_rfkill_blocked()
1553 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_DISABLED, NULL); in wpa_driver_nl80211_rfkill_blocked()
1559 struct wpa_driver_nl80211_data *drv = ctx; in wpa_driver_nl80211_rfkill_unblocked() local
1561 if (i802_set_iface_flags(drv->first_bss, 1)) { in wpa_driver_nl80211_rfkill_unblocked()
1567 if (is_p2p_net_interface(drv->nlmode)) in wpa_driver_nl80211_rfkill_unblocked()
1568 nl80211_disable_11b_rates(drv, drv->ifindex, 1); in wpa_driver_nl80211_rfkill_unblocked()
1574 if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) in wpa_driver_nl80211_rfkill_unblocked()
1575 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED, NULL); in wpa_driver_nl80211_rfkill_unblocked()
1583 struct wpa_driver_nl80211_data *drv = eloop_ctx; in wpa_driver_nl80211_handle_eapol_tx_status() local
1634 wpa_supplicant_event(drv->ctx, EVENT_EAPOL_TX_STATUS, &event); in wpa_driver_nl80211_handle_eapol_tx_status()
1661 wpa_driver_nl80211_drv_init_rfkill(struct wpa_driver_nl80211_data *drv) in wpa_driver_nl80211_drv_init_rfkill() argument
1665 if (drv->rfkill) in wpa_driver_nl80211_drv_init_rfkill()
1672 rcfg->ctx = drv; in wpa_driver_nl80211_drv_init_rfkill()
1681 if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) { in wpa_driver_nl80211_drv_init_rfkill()
1682 struct nl80211_global *global = drv->global; in wpa_driver_nl80211_drv_init_rfkill()
1687 if (drv == tmp1 || drv->wiphy_idx != tmp1->wiphy_idx || in wpa_driver_nl80211_drv_init_rfkill()
1699 os_strlcpy(rcfg->ifname, drv->first_bss->ifname, in wpa_driver_nl80211_drv_init_rfkill()
1705 drv->rfkill = rfkill_init(rcfg); in wpa_driver_nl80211_drv_init_rfkill()
1706 if (!drv->rfkill) { in wpa_driver_nl80211_drv_init_rfkill()
1718 struct wpa_driver_nl80211_data *drv; in wpa_driver_nl80211_drv_init() local
1723 drv = os_zalloc(sizeof(*drv)); in wpa_driver_nl80211_drv_init()
1724 if (drv == NULL) in wpa_driver_nl80211_drv_init()
1726 drv->global = global_priv; in wpa_driver_nl80211_drv_init()
1727 drv->ctx = ctx; in wpa_driver_nl80211_drv_init()
1728 drv->hostapd = !!hostapd; in wpa_driver_nl80211_drv_init()
1729 drv->eapol_sock = -1; in wpa_driver_nl80211_drv_init()
1736 drv->set_rekey_offload = 1; in wpa_driver_nl80211_drv_init()
1738 drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int); in wpa_driver_nl80211_drv_init()
1739 drv->if_indices = drv->default_if_indices; in wpa_driver_nl80211_drv_init()
1740 drv->if_indices_reason = drv->default_if_indices_reason; in wpa_driver_nl80211_drv_init()
1742 drv->first_bss = os_zalloc(sizeof(*drv->first_bss)); in wpa_driver_nl80211_drv_init()
1743 if (!drv->first_bss) { in wpa_driver_nl80211_drv_init()
1744 os_free(drv); in wpa_driver_nl80211_drv_init()
1747 bss = drv->first_bss; in wpa_driver_nl80211_drv_init()
1748 bss->drv = drv; in wpa_driver_nl80211_drv_init()
1752 drv->monitor_ifidx = -1; in wpa_driver_nl80211_drv_init()
1753 drv->monitor_sock = -1; in wpa_driver_nl80211_drv_init()
1754 drv->eapol_tx_sock = -1; in wpa_driver_nl80211_drv_init()
1755 drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED; in wpa_driver_nl80211_drv_init()
1760 if (wpa_driver_nl80211_finish_drv_init(drv, set_addr, 1, driver_params)) in wpa_driver_nl80211_drv_init()
1763 drv->eapol_tx_sock = socket(PF_PACKET, SOCK_DGRAM, 0); in wpa_driver_nl80211_drv_init()
1764 if (drv->eapol_tx_sock < 0) in wpa_driver_nl80211_drv_init()
1767 if (drv->data_tx_status) { in wpa_driver_nl80211_drv_init()
1770 if (setsockopt(drv->eapol_tx_sock, SOL_SOCKET, SO_WIFI_STATUS, in wpa_driver_nl80211_drv_init()
1774 drv->data_tx_status = 0; in wpa_driver_nl80211_drv_init()
1775 if (!drv->use_monitor) in wpa_driver_nl80211_drv_init()
1776 drv->capa.flags &= in wpa_driver_nl80211_drv_init()
1779 eloop_register_read_sock(drv->eapol_tx_sock, in wpa_driver_nl80211_drv_init()
1781 drv, NULL); in wpa_driver_nl80211_drv_init()
1785 if (drv->global) { in wpa_driver_nl80211_drv_init()
1786 nl80211_check_global(drv->global); in wpa_driver_nl80211_drv_init()
1787 dl_list_add(&drv->global->interfaces, &drv->list); in wpa_driver_nl80211_drv_init()
1788 drv->in_interface_list = 1; in wpa_driver_nl80211_drv_init()
1819 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_register_frame() local
1836 ret = send_and_recv(drv->global, nl_handle, msg, NULL, NULL); in nl80211_register_frame()
1883 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_mgmt_subscribe_non_ap() local
1891 if (drv->nlmode == NL80211_IFTYPE_ADHOC) { in nl80211_mgmt_subscribe_non_ap()
1947 if ((drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT)) { in nl80211_mgmt_subscribe_non_ap()
1964 drv->capa.key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_FT | in nl80211_mgmt_subscribe_non_ap()
1993 if ((drv->capa.rrm_flags & WPA_DRIVER_FLAGS_TX_POWER_INSERTION) && in nl80211_mgmt_subscribe_non_ap()
2043 ret = send_and_recv(bss->drv->global, bss->nl_mgmt, msg, NULL, NULL); in nl80211_register_spurious_class3()
2147 ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL); in nl80211_del_p2pdev()
2162 ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL); in nl80211_set_p2pdev()
2178 return linux_set_iface_flags(bss->drv->global->ioctl_sock, in i802_set_iface_flags()
2215 static void qca_vendor_test(struct wpa_driver_nl80211_data *drv) in qca_vendor_test() argument
2222 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) || in qca_vendor_test()
2233 ret = send_and_recv_msgs(drv, msg, qca_vendor_test_cmd_handler, drv); in qca_vendor_test()
2242 wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv, in wpa_driver_nl80211_finish_drv_init() argument
2246 struct i802_bss *bss = drv->first_bss; in wpa_driver_nl80211_finish_drv_init()
2250 drv->ifindex = if_nametoindex(bss->ifname); in wpa_driver_nl80211_finish_drv_init()
2251 bss->ifindex = drv->ifindex; in wpa_driver_nl80211_finish_drv_init()
2252 bss->wdev_id = drv->global->if_add_wdevid; in wpa_driver_nl80211_finish_drv_init()
2253 bss->wdev_id_set = drv->global->if_add_wdevid_set; in wpa_driver_nl80211_finish_drv_init()
2255 bss->if_dynamic = drv->ifindex == drv->global->if_add_ifindex; in wpa_driver_nl80211_finish_drv_init()
2256 bss->if_dynamic = bss->if_dynamic || drv->global->if_add_wdevid_set; in wpa_driver_nl80211_finish_drv_init()
2257 drv->global->if_add_wdevid_set = 0; in wpa_driver_nl80211_finish_drv_init()
2264 linux_iface_up(drv->global->ioctl_sock, bss->ifname) > 0) in wpa_driver_nl80211_finish_drv_init()
2265 drv->start_iface_up = 1; in wpa_driver_nl80211_finish_drv_init()
2267 if (wpa_driver_nl80211_capa(drv)) in wpa_driver_nl80211_finish_drv_init()
2274 bss->ifname, drv->phyname); in wpa_driver_nl80211_finish_drv_init()
2277 (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 0) || in wpa_driver_nl80211_finish_drv_init()
2278 linux_set_ifhwaddr(drv->global->ioctl_sock, bss->ifname, in wpa_driver_nl80211_finish_drv_init()
2283 drv->start_mode_ap = 1; in wpa_driver_nl80211_finish_drv_init()
2285 if (drv->hostapd || bss->static_ap) in wpa_driver_nl80211_finish_drv_init()
2300 wpa_driver_nl80211_drv_init_rfkill(drv); in wpa_driver_nl80211_finish_drv_init()
2302 if (!rfkill_is_blocked(drv->rfkill)) { in wpa_driver_nl80211_finish_drv_init()
2311 nl80211_disable_11b_rates(bss->drv, in wpa_driver_nl80211_finish_drv_init()
2312 bss->drv->ifindex, 1); in wpa_driver_nl80211_finish_drv_init()
2320 drv->if_disabled = 1; in wpa_driver_nl80211_finish_drv_init()
2325 if (!drv->hostapd && nlmode != NL80211_IFTYPE_P2P_DEVICE) in wpa_driver_nl80211_finish_drv_init()
2326 netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, in wpa_driver_nl80211_finish_drv_init()
2330 if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname, in wpa_driver_nl80211_finish_drv_init()
2333 os_memcpy(drv->perm_addr, bss->addr, ETH_ALEN); in wpa_driver_nl80211_finish_drv_init()
2338 drv, drv->ctx); in wpa_driver_nl80211_finish_drv_init()
2341 if (drv->vendor_cmd_test_avail) in wpa_driver_nl80211_finish_drv_init()
2342 qca_vendor_test(drv); in wpa_driver_nl80211_finish_drv_init()
2348 static int wpa_driver_nl80211_del_beacon(struct wpa_driver_nl80211_data *drv) in wpa_driver_nl80211_del_beacon() argument
2353 drv->ifindex); in wpa_driver_nl80211_del_beacon()
2354 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_DEL_BEACON); in wpa_driver_nl80211_del_beacon()
2355 return send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_del_beacon()
2368 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_deinit() local
2371 bss->ifname, drv->disabled_11b_rates); in wpa_driver_nl80211_deinit()
2374 if (drv->data_tx_status) in wpa_driver_nl80211_deinit()
2375 eloop_unregister_read_sock(drv->eapol_tx_sock); in wpa_driver_nl80211_deinit()
2376 if (drv->eapol_tx_sock >= 0) in wpa_driver_nl80211_deinit()
2377 close(drv->eapol_tx_sock); in wpa_driver_nl80211_deinit()
2382 if (linux_br_del_if(drv->global->ioctl_sock, bss->brname, in wpa_driver_nl80211_deinit()
2387 if (drv->rtnl_sk) in wpa_driver_nl80211_deinit()
2388 nl80211_handle_destroy(drv->rtnl_sk); in wpa_driver_nl80211_deinit()
2391 if (linux_set_iface_flags(drv->global->ioctl_sock, bss->brname, in wpa_driver_nl80211_deinit()
2396 if (linux_br_del(drv->global->ioctl_sock, bss->brname) < 0) in wpa_driver_nl80211_deinit()
2402 nl80211_remove_monitor_interface(drv); in wpa_driver_nl80211_deinit()
2404 if (is_ap_interface(drv->nlmode)) in wpa_driver_nl80211_deinit()
2405 wpa_driver_nl80211_del_beacon(drv); in wpa_driver_nl80211_deinit()
2407 if (drv->eapol_sock >= 0) { in wpa_driver_nl80211_deinit()
2408 eloop_unregister_read_sock(drv->eapol_sock); in wpa_driver_nl80211_deinit()
2409 close(drv->eapol_sock); in wpa_driver_nl80211_deinit()
2412 if (drv->if_indices != drv->default_if_indices) in wpa_driver_nl80211_deinit()
2413 os_free(drv->if_indices); in wpa_driver_nl80211_deinit()
2415 if (drv->if_indices_reason != drv->default_if_indices_reason) in wpa_driver_nl80211_deinit()
2416 os_free(drv->if_indices_reason); in wpa_driver_nl80211_deinit()
2418 if (drv->disabled_11b_rates) in wpa_driver_nl80211_deinit()
2419 nl80211_disable_11b_rates(drv, drv->ifindex, 0); in wpa_driver_nl80211_deinit()
2421 netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, 0, in wpa_driver_nl80211_deinit()
2423 eloop_cancel_timeout(wpa_driver_nl80211_send_rfkill, drv, drv->ctx); in wpa_driver_nl80211_deinit()
2424 rfkill_deinit(drv->rfkill); in wpa_driver_nl80211_deinit()
2426 eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx); in wpa_driver_nl80211_deinit()
2428 if (!drv->start_iface_up) in wpa_driver_nl80211_deinit()
2431 if (drv->addr_changed) { in wpa_driver_nl80211_deinit()
2432 if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, in wpa_driver_nl80211_deinit()
2437 if (linux_set_ifhwaddr(drv->global->ioctl_sock, bss->ifname, in wpa_driver_nl80211_deinit()
2438 drv->perm_addr) < 0) { in wpa_driver_nl80211_deinit()
2444 if (drv->nlmode != NL80211_IFTYPE_P2P_DEVICE) { in wpa_driver_nl80211_deinit()
2445 if (!drv->hostapd || !drv->start_mode_ap) in wpa_driver_nl80211_deinit()
2454 nl80211_destroy_bss(drv->first_bss); in wpa_driver_nl80211_deinit()
2456 os_free(drv->filter_ssids); in wpa_driver_nl80211_deinit()
2458 os_free(drv->auth_ie); in wpa_driver_nl80211_deinit()
2460 if (drv->in_interface_list) in wpa_driver_nl80211_deinit()
2461 dl_list_del(&drv->list); in wpa_driver_nl80211_deinit()
2463 os_free(drv->extended_capa); in wpa_driver_nl80211_deinit()
2464 os_free(drv->extended_capa_mask); in wpa_driver_nl80211_deinit()
2465 os_free(drv->first_bss); in wpa_driver_nl80211_deinit()
2466 os_free(drv); in wpa_driver_nl80211_deinit()
2562 static int issue_key_mgmt_set_key(struct wpa_driver_nl80211_data *drv, in issue_key_mgmt_set_key() argument
2568 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD)) in issue_key_mgmt_set_key()
2571 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) || in issue_key_mgmt_set_key()
2580 ret = send_and_recv_msgs(drv, msg, NULL, (void *) -1); in issue_key_mgmt_set_key()
2598 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_set_key() local
2605 if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) in wpa_driver_nl80211_set_key()
2622 (drv->capa.flags & WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD)) { in wpa_driver_nl80211_set_key()
2625 ret = issue_key_mgmt_set_key(drv, key, key_len); in wpa_driver_nl80211_set_key()
2631 msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_DEL_KEY); in wpa_driver_nl80211_set_key()
2640 msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_NEW_KEY); in wpa_driver_nl80211_set_key()
2679 ret = send_and_recv_msgs(drv, msg, NULL, key ? (void *) -1 : NULL); in wpa_driver_nl80211_set_key()
2692 if (is_ap_interface(drv->nlmode) && addr && in wpa_driver_nl80211_set_key()
2696 msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_SET_KEY); in wpa_driver_nl80211_set_key()
2724 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_set_key()
2828 int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv, in wpa_driver_nl80211_mlme() argument
2835 if (!(msg = nl80211_drv_msg(drv, 0, cmd)) || in wpa_driver_nl80211_mlme()
2844 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_mlme()
2846 wpa_dbg(drv->ctx, MSG_DEBUG, in wpa_driver_nl80211_mlme()
2854 static int wpa_driver_nl80211_disconnect(struct wpa_driver_nl80211_data *drv, in wpa_driver_nl80211_disconnect() argument
2860 nl80211_mark_disconnected(drv); in wpa_driver_nl80211_disconnect()
2862 ret = wpa_driver_nl80211_mlme(drv, NULL, NL80211_CMD_DISCONNECT, in wpa_driver_nl80211_disconnect()
2868 drv->ignore_next_local_disconnect = ret == 0; in wpa_driver_nl80211_disconnect()
2877 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_deauthenticate() local
2880 if (drv->nlmode == NL80211_IFTYPE_ADHOC) { in wpa_driver_nl80211_deauthenticate()
2881 nl80211_mark_disconnected(drv); in wpa_driver_nl80211_deauthenticate()
2882 return nl80211_leave_ibss(drv, 1); in wpa_driver_nl80211_deauthenticate()
2884 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME)) in wpa_driver_nl80211_deauthenticate()
2885 return wpa_driver_nl80211_disconnect(drv, reason_code); in wpa_driver_nl80211_deauthenticate()
2888 nl80211_mark_disconnected(drv); in wpa_driver_nl80211_deauthenticate()
2889 ret = wpa_driver_nl80211_mlme(drv, addr, NL80211_CMD_DEAUTHENTICATE, in wpa_driver_nl80211_deauthenticate()
2895 drv->ignore_next_local_deauth = ret == 0; in wpa_driver_nl80211_deauthenticate()
2900 static void nl80211_copy_auth_params(struct wpa_driver_nl80211_data *drv, in nl80211_copy_auth_params() argument
2905 drv->auth_freq = params->freq; in nl80211_copy_auth_params()
2906 drv->auth_alg = params->auth_alg; in nl80211_copy_auth_params()
2907 drv->auth_wep_tx_keyidx = params->wep_tx_keyidx; in nl80211_copy_auth_params()
2908 drv->auth_local_state_change = params->local_state_change; in nl80211_copy_auth_params()
2909 drv->auth_p2p = params->p2p; in nl80211_copy_auth_params()
2912 os_memcpy(drv->auth_bssid_, params->bssid, ETH_ALEN); in nl80211_copy_auth_params()
2914 os_memset(drv->auth_bssid_, 0, ETH_ALEN); in nl80211_copy_auth_params()
2917 os_memcpy(drv->auth_ssid, params->ssid, params->ssid_len); in nl80211_copy_auth_params()
2918 drv->auth_ssid_len = params->ssid_len; in nl80211_copy_auth_params()
2920 drv->auth_ssid_len = 0; in nl80211_copy_auth_params()
2923 os_free(drv->auth_ie); in nl80211_copy_auth_params()
2924 drv->auth_ie = NULL; in nl80211_copy_auth_params()
2925 drv->auth_ie_len = 0; in nl80211_copy_auth_params()
2927 drv->auth_ie = os_malloc(params->ie_len); in nl80211_copy_auth_params()
2928 if (drv->auth_ie) { in nl80211_copy_auth_params()
2929 os_memcpy(drv->auth_ie, params->ie, params->ie_len); in nl80211_copy_auth_params()
2930 drv->auth_ie_len = params->ie_len; in nl80211_copy_auth_params()
2937 os_memcpy(drv->auth_wep_key[i], params->wep_key[i], in nl80211_copy_auth_params()
2939 drv->auth_wep_key_len[i] = params->wep_key_len[i]; in nl80211_copy_auth_params()
2941 drv->auth_wep_key_len[i] = 0; in nl80211_copy_auth_params()
2948 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_unmask_11b_rates() local
2950 if (is_p2p_net_interface(drv->nlmode) || !drv->disabled_11b_rates) in nl80211_unmask_11b_rates()
2961 nl80211_disable_11b_rates(drv, drv->ifindex, 0); in nl80211_unmask_11b_rates()
2968 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_authenticate() local
2978 is_retry = drv->retry_auth; in wpa_driver_nl80211_authenticate()
2979 drv->retry_auth = 0; in wpa_driver_nl80211_authenticate()
2980 drv->ignore_deauth_event = 0; in wpa_driver_nl80211_authenticate()
2982 nl80211_mark_disconnected(drv); in wpa_driver_nl80211_authenticate()
2983 os_memset(drv->auth_bssid, 0, ETH_ALEN); in wpa_driver_nl80211_authenticate()
2985 os_memcpy(drv->auth_attempt_bssid, params->bssid, ETH_ALEN); in wpa_driver_nl80211_authenticate()
2987 os_memset(drv->auth_attempt_bssid, 0, ETH_ALEN); in wpa_driver_nl80211_authenticate()
2991 if (drv->nlmode != nlmode && in wpa_driver_nl80211_authenticate()
2997 drv->ifindex); in wpa_driver_nl80211_authenticate()
2999 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_AUTHENTICATE); in wpa_driver_nl80211_authenticate()
3068 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_authenticate()
3071 wpa_dbg(drv->ctx, MSG_DEBUG, in wpa_driver_nl80211_authenticate()
3084 drv->ignore_deauth_event = 1; in wpa_driver_nl80211_authenticate()
3116 nl80211_copy_auth_params(drv, params); in wpa_driver_nl80211_authenticate()
3117 drv->scan_for_auth = 1; in wpa_driver_nl80211_authenticate()
3128 os_memcpy(event.timeout_event.addr, drv->auth_bssid_, in wpa_driver_nl80211_authenticate()
3130 wpa_supplicant_event(drv->ctx, EVENT_AUTH_TIMED_OUT, in wpa_driver_nl80211_authenticate()
3144 int wpa_driver_nl80211_authenticate_retry(struct wpa_driver_nl80211_data *drv) in wpa_driver_nl80211_authenticate_retry() argument
3147 struct i802_bss *bss = drv->first_bss; in wpa_driver_nl80211_authenticate_retry()
3153 params.freq = drv->auth_freq; in wpa_driver_nl80211_authenticate_retry()
3154 params.auth_alg = drv->auth_alg; in wpa_driver_nl80211_authenticate_retry()
3155 params.wep_tx_keyidx = drv->auth_wep_tx_keyidx; in wpa_driver_nl80211_authenticate_retry()
3156 params.local_state_change = drv->auth_local_state_change; in wpa_driver_nl80211_authenticate_retry()
3157 params.p2p = drv->auth_p2p; in wpa_driver_nl80211_authenticate_retry()
3159 if (!is_zero_ether_addr(drv->auth_bssid_)) in wpa_driver_nl80211_authenticate_retry()
3160 params.bssid = drv->auth_bssid_; in wpa_driver_nl80211_authenticate_retry()
3162 if (drv->auth_ssid_len) { in wpa_driver_nl80211_authenticate_retry()
3163 params.ssid = drv->auth_ssid; in wpa_driver_nl80211_authenticate_retry()
3164 params.ssid_len = drv->auth_ssid_len; in wpa_driver_nl80211_authenticate_retry()
3167 params.ie = drv->auth_ie; in wpa_driver_nl80211_authenticate_retry()
3168 params.ie_len = drv->auth_ie_len; in wpa_driver_nl80211_authenticate_retry()
3171 if (drv->auth_wep_key_len[i]) { in wpa_driver_nl80211_authenticate_retry()
3172 params.wep_key[i] = drv->auth_wep_key[i]; in wpa_driver_nl80211_authenticate_retry()
3173 params.wep_key_len[i] = drv->auth_wep_key_len[i]; in wpa_driver_nl80211_authenticate_retry()
3177 drv->retry_auth = 1; in wpa_driver_nl80211_authenticate_retry()
3190 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_send_frame() local
3194 if (freq == 0 && drv->nlmode == NL80211_IFTYPE_ADHOC) { in wpa_driver_nl80211_send_frame()
3195 freq = nl80211_get_assoc_freq(drv); in wpa_driver_nl80211_send_frame()
3206 if (drv->use_monitor) { in wpa_driver_nl80211_send_frame()
3209 return nl80211_send_monitor(drv, data, len, encrypt, noack); in wpa_driver_nl80211_send_frame()
3227 drv->send_action_cookie, in wpa_driver_nl80211_send_frame()
3229 drv->send_action_cookie = cookie; in wpa_driver_nl80211_send_frame()
3245 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_send_mlme() local
3255 fc, fc2str(fc), drv->nlmode); in wpa_driver_nl80211_send_mlme()
3257 if ((is_sta_interface(drv->nlmode) || in wpa_driver_nl80211_send_mlme()
3258 drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) && in wpa_driver_nl80211_send_mlme()
3268 drv->last_mgmt_freq); in wpa_driver_nl80211_send_mlme()
3269 freq = drv->last_mgmt_freq; in wpa_driver_nl80211_send_mlme()
3276 if (drv->device_ap_sme && is_ap_interface(drv->nlmode)) { in wpa_driver_nl80211_send_mlme()
3286 &drv->send_action_cookie, in wpa_driver_nl80211_send_mlme()
3333 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_set_bss() local
3352 return send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_set_bss()
3360 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_set_acl() local
3366 if (!(drv->capa.max_acl_mac_addrs)) in wpa_driver_nl80211_set_acl()
3369 if (params->num_mac_acl > drv->capa.max_acl_mac_addrs) in wpa_driver_nl80211_set_acl()
3385 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_SET_MAC_ACL)) || in wpa_driver_nl80211_set_acl()
3396 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_set_acl()
3422 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_set_ap() local
3591 if (drv->capa.flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER) { in wpa_driver_nl80211_set_ap()
3601 if (drv->p2p_go_ctwindow_supported) { in wpa_driver_nl80211_set_ap()
3620 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_set_ap()
3735 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_set_channel() local
3744 msg = nl80211_drv_msg(drv, 0, set_chan ? NL80211_CMD_SET_CHANNEL : in nl80211_set_channel()
3751 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_set_channel()
3816 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_sta_add() local
3822 !(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT)) in wpa_driver_nl80211_sta_add()
3841 (params->set && FULL_AP_CLIENT_STATE_SUPP(drv->capa.flags) && in wpa_driver_nl80211_sta_add()
3908 } else if (FULL_AP_CLIENT_STATE_SUPP(drv->capa.flags) && in wpa_driver_nl80211_sta_add()
3962 if (!is_mesh_interface(drv->nlmode)) { in wpa_driver_nl80211_sta_add()
3963 if (!FULL_AP_CLIENT_STATE_SUPP(drv->capa.flags)) { in wpa_driver_nl80211_sta_add()
4003 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_sta_add()
4020 struct wpa_driver_nl80211_data *drv = bss->drv; in rtnl_neigh_delete_fdb_entry() local
4038 err = rtnl_neigh_delete(drv->rtnl_sk, rn, 0); in rtnl_neigh_delete_fdb_entry()
4057 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_sta_remove() local
4075 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_sta_remove()
4080 if (drv->rtnl_sk) in wpa_driver_nl80211_sta_remove()
4089 void nl80211_remove_iface(struct wpa_driver_nl80211_data *drv, int ifidx) in nl80211_remove_iface() argument
4097 dl_list_for_each(drv2, &drv->global->interfaces, in nl80211_remove_iface()
4105 msg = nl80211_ifindex_msg(drv, ifidx, 0, NL80211_CMD_DEL_INTERFACE); in nl80211_remove_iface()
4106 if (send_and_recv_msgs(drv, msg, NULL, NULL) == 0) in nl80211_remove_iface()
4141 static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv, in nl80211_create_iface_once() argument
4155 msg = nl80211_cmd_msg(drv->first_bss, 0, NL80211_CMD_NEW_INTERFACE); in nl80211_create_iface_once()
4182 ret = send_and_recv_msgs(drv, msg, handler, arg); in nl80211_create_iface_once()
4206 if (drv->hostapd || in nl80211_create_iface_once()
4211 add_ifidx(drv, ifidx, IFIDX_ANY); in nl80211_create_iface_once()
4215 linux_set_ifhwaddr(drv->global->ioctl_sock, ifname, addr)) { in nl80211_create_iface_once()
4216 nl80211_remove_iface(drv, ifidx); in nl80211_create_iface_once()
4224 int nl80211_create_iface(struct wpa_driver_nl80211_data *drv, in nl80211_create_iface() argument
4232 ret = nl80211_create_iface_once(drv, ifname, iftype, addr, wds, handler, in nl80211_create_iface()
4241 linux_set_ifhwaddr(drv->global->ioctl_sock, ifname, in nl80211_create_iface()
4243 (linux_set_iface_flags(drv->global->ioctl_sock, in nl80211_create_iface()
4245 linux_set_ifhwaddr(drv->global->ioctl_sock, ifname, in nl80211_create_iface()
4247 linux_set_iface_flags(drv->global->ioctl_sock, in nl80211_create_iface()
4255 nl80211_remove_iface(drv, if_nametoindex(ifname)); in nl80211_create_iface()
4258 ret = nl80211_create_iface_once(drv, ifname, iftype, addr, in nl80211_create_iface()
4266 nl80211_disable_11b_rates(drv, ret, 1); in nl80211_create_iface()
4275 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_setup_ap() local
4278 bss->ifname, drv->device_ap_sme, drv->use_monitor); in nl80211_setup_ap()
4285 if (!drv->device_ap_sme) in nl80211_setup_ap()
4288 if (!drv->device_ap_sme && !drv->use_monitor) in nl80211_setup_ap()
4292 if (drv->device_ap_sme && !drv->use_monitor) in nl80211_setup_ap()
4296 if (!drv->device_ap_sme && drv->use_monitor && in nl80211_setup_ap()
4297 nl80211_create_monitor_interface(drv) && in nl80211_setup_ap()
4298 !drv->device_ap_sme) in nl80211_setup_ap()
4301 if (drv->device_ap_sme && in nl80211_setup_ap()
4314 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_teardown_ap() local
4317 bss->ifname, drv->device_ap_sme, drv->use_monitor); in nl80211_teardown_ap()
4318 if (drv->device_ap_sme) { in nl80211_teardown_ap()
4320 if (!drv->use_monitor) in nl80211_teardown_ap()
4322 } else if (drv->use_monitor) in nl80211_teardown_ap()
4323 nl80211_remove_monitor_interface(drv); in nl80211_teardown_ap()
4338 if (bss->drv->eapol_tx_sock < 0) { in nl80211_send_eapol_data()
4349 ret = sendto(bss->drv->eapol_tx_sock, data, data_len, 0, in nl80211_send_eapol_data()
4366 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_hapd_send_eapol() local
4373 if (drv->device_ap_sme || !drv->use_monitor) in wpa_driver_nl80211_hapd_send_eapol()
4471 return send_and_recv_msgs(bss->drv, msg, NULL, NULL); in wpa_driver_nl80211_sta_set_flags()
4478 static int wpa_driver_nl80211_ap(struct wpa_driver_nl80211_data *drv, in wpa_driver_nl80211_ap() argument
4490 old_mode = drv->nlmode; in wpa_driver_nl80211_ap()
4491 if (wpa_driver_nl80211_set_mode(drv->first_bss, nlmode)) { in wpa_driver_nl80211_ap()
4492 nl80211_remove_monitor_interface(drv); in wpa_driver_nl80211_ap()
4497 nl80211_set_channel(drv->first_bss, ¶ms->freq, 0)) { in wpa_driver_nl80211_ap()
4499 wpa_driver_nl80211_set_mode(drv->first_bss, old_mode); in wpa_driver_nl80211_ap()
4500 nl80211_remove_monitor_interface(drv); in wpa_driver_nl80211_ap()
4508 static int nl80211_leave_ibss(struct wpa_driver_nl80211_data *drv, in nl80211_leave_ibss() argument
4514 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_LEAVE_IBSS); in nl80211_leave_ibss()
4515 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_leave_ibss()
4525 wpa_driver_nl80211_set_mode(drv->first_bss, in nl80211_leave_ibss()
4577 static int wpa_driver_nl80211_ibss(struct wpa_driver_nl80211_data *drv, in wpa_driver_nl80211_ibss() argument
4584 wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); in wpa_driver_nl80211_ibss()
4586 if (wpa_driver_nl80211_set_mode_ibss(drv->first_bss, ¶ms->freq)) { in wpa_driver_nl80211_ibss()
4593 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_JOIN_IBSS)) || in wpa_driver_nl80211_ibss()
4594 params->ssid == NULL || params->ssid_len > sizeof(drv->ssid)) in wpa_driver_nl80211_ibss()
4601 os_memcpy(drv->ssid, params->ssid, params->ssid_len); in wpa_driver_nl80211_ibss()
4602 drv->ssid_len = params->ssid_len; in wpa_driver_nl80211_ibss()
4647 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_ibss()
4656 nl80211_leave_ibss(drv, 0); in wpa_driver_nl80211_ibss()
4671 static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv, in nl80211_connect_common() argument
4695 drv->assoc_freq = params->freq.freq; in nl80211_connect_common()
4697 drv->assoc_freq = 0; in nl80211_connect_common()
4720 if (params->ssid_len > sizeof(drv->ssid)) in nl80211_connect_common()
4722 os_memcpy(drv->ssid, params->ssid, params->ssid_len); in nl80211_connect_common()
4723 drv->ssid_len = params->ssid_len; in nl80211_connect_common()
4753 !(drv->capa.enc & WPA_DRIVER_CAPA_ENC_GTK_NOT_USED)) { in nl80211_connect_common()
4824 u32 drv_rrm_flags = drv->capa.rrm_flags; in nl80211_connect_common()
4844 drv->connect_reassoc = 0; in nl80211_connect_common()
4851 drv->connect_reassoc = 1; in nl80211_connect_common()
4859 struct wpa_driver_nl80211_data *drv, in wpa_driver_nl80211_try_connect() argument
4873 ret = issue_key_mgmt_set_key(drv, params->psk, 32); in wpa_driver_nl80211_try_connect()
4879 wpa_printf(MSG_DEBUG, "nl80211: Connect (ifindex=%d)", drv->ifindex); in wpa_driver_nl80211_try_connect()
4880 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_CONNECT); in wpa_driver_nl80211_try_connect()
4884 ret = nl80211_connect_common(drv, params, msg); in wpa_driver_nl80211_try_connect()
4921 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_try_connect()
4939 struct wpa_driver_nl80211_data *drv, in wpa_driver_nl80211_connect() argument
4946 os_memcpy(drv->auth_attempt_bssid, params->bssid, ETH_ALEN); in wpa_driver_nl80211_connect()
4948 os_memset(drv->auth_attempt_bssid, 0, ETH_ALEN); in wpa_driver_nl80211_connect()
4950 ret = wpa_driver_nl80211_try_connect(drv, params); in wpa_driver_nl80211_connect()
4961 drv, WLAN_REASON_PREV_AUTH_NOT_VALID)) in wpa_driver_nl80211_connect()
4963 ret = wpa_driver_nl80211_try_connect(drv, params); in wpa_driver_nl80211_connect()
4973 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_associate() local
4980 return wpa_driver_nl80211_ap(drv, params); in wpa_driver_nl80211_associate()
4983 return wpa_driver_nl80211_ibss(drv, params); in wpa_driver_nl80211_associate()
4985 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME)) { in wpa_driver_nl80211_associate()
4991 return wpa_driver_nl80211_connect(drv, params); in wpa_driver_nl80211_associate()
4994 nl80211_mark_disconnected(drv); in wpa_driver_nl80211_associate()
4997 drv->ifindex); in wpa_driver_nl80211_associate()
4998 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_ASSOCIATE); in wpa_driver_nl80211_associate()
5002 ret = nl80211_connect_common(drv, params, msg); in wpa_driver_nl80211_associate()
5006 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_associate()
5009 wpa_dbg(drv->ctx, MSG_DEBUG, in wpa_driver_nl80211_associate()
5012 nl80211_dump_scan(drv); in wpa_driver_nl80211_associate()
5024 static int nl80211_set_mode(struct wpa_driver_nl80211_data *drv, in nl80211_set_mode() argument
5033 msg = nl80211_cmd_msg(drv->first_bss, 0, NL80211_CMD_SET_INTERFACE); in nl80211_set_mode()
5037 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_set_mode()
5054 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_set_mode_impl() local
5057 int was_ap = is_ap_interface(drv->nlmode); in wpa_driver_nl80211_set_mode_impl()
5061 mode_switch_res = nl80211_set_mode(drv, drv->ifindex, nlmode); in wpa_driver_nl80211_set_mode_impl()
5066 drv->nlmode = nlmode; in wpa_driver_nl80211_set_mode_impl()
5074 if (nlmode == drv->nlmode) { in wpa_driver_nl80211_set_mode_impl()
5111 mode_switch_res = nl80211_set_mode(drv, drv->ifindex, nlmode); in wpa_driver_nl80211_set_mode_impl()
5125 drv->nlmode = nlmode; in wpa_driver_nl80211_set_mode_impl()
5126 drv->ignore_if_down_event = 1; in wpa_driver_nl80211_set_mode_impl()
5130 res = linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1); in wpa_driver_nl80211_set_mode_impl()
5140 "from %d failed", nlmode, drv->nlmode); in wpa_driver_nl80211_set_mode_impl()
5148 nl80211_disable_11b_rates(drv, drv->ifindex, 1); in wpa_driver_nl80211_set_mode_impl()
5149 } else if (drv->disabled_11b_rates) { in wpa_driver_nl80211_set_mode_impl()
5153 nl80211_disable_11b_rates(drv, drv->ifindex, 0); in wpa_driver_nl80211_set_mode_impl()
5201 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_get_capa() local
5203 if (!drv->has_capability) in wpa_driver_nl80211_get_capa()
5205 os_memcpy(capa, &drv->capa, sizeof(*capa)); in wpa_driver_nl80211_get_capa()
5206 if (drv->extended_capa && drv->extended_capa_mask) { in wpa_driver_nl80211_get_capa()
5207 capa->extended_capa = drv->extended_capa; in wpa_driver_nl80211_get_capa()
5208 capa->extended_capa_mask = drv->extended_capa_mask; in wpa_driver_nl80211_get_capa()
5209 capa->extended_capa_len = drv->extended_capa_len; in wpa_driver_nl80211_get_capa()
5219 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_set_operstate() local
5222 bss->ifname, drv->operstate, state, in wpa_driver_nl80211_set_operstate()
5224 drv->operstate = state; in wpa_driver_nl80211_set_operstate()
5225 return netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, -1, in wpa_driver_nl80211_set_operstate()
5233 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_set_supp_port() local
5238 if (!drv->associated && is_zero_ether_addr(drv->bssid) && !authorized) { in wpa_driver_nl80211_set_supp_port()
5244 MACSTR, authorized ? "" : "un", MAC2STR(drv->bssid)); in wpa_driver_nl80211_set_supp_port()
5252 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, drv->bssid) || in wpa_driver_nl80211_set_supp_port()
5258 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_set_supp_port()
5308 struct wpa_driver_nl80211_data *drv = bss->drv; in i802_get_seqnum() local
5311 msg = nl80211_ifindex_msg(drv, if_nametoindex(iface), 0, in i802_get_seqnum()
5322 return send_and_recv_msgs(drv, msg, get_key_handler, seq); in i802_get_seqnum()
5329 struct wpa_driver_nl80211_data *drv = bss->drv; in i802_set_rts() local
5339 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_SET_WIPHY)) || in i802_set_rts()
5345 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in i802_set_rts()
5357 struct wpa_driver_nl80211_data *drv = bss->drv; in i802_set_frag() local
5367 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_SET_WIPHY)) || in i802_set_frag()
5373 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in i802_set_frag()
5395 res = send_and_recv_msgs(bss->drv, msg, NULL, NULL); in i802_flush()
5488 return send_and_recv_msgs(bss->drv, msg, get_sta_handler, data); in i802_read_sta_data()
5496 struct wpa_driver_nl80211_data *drv = bss->drv; in i802_set_tx_queue_params() local
5544 if (send_and_recv_msgs(drv, msg, NULL, NULL) == 0) in i802_set_tx_queue_params()
5556 struct wpa_driver_nl80211_data *drv = bss->drv; in i802_set_sta_vlan() local
5571 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in i802_set_sta_vlan()
5610 struct wpa_driver_nl80211_data *drv = bss->drv; in i802_sta_deauth() local
5613 if (is_mesh_interface(drv->nlmode)) in i802_sta_deauth()
5616 if (drv->device_ap_sme) in i802_sta_deauth()
5637 struct wpa_driver_nl80211_data *drv = bss->drv; in i802_sta_disassoc() local
5640 if (is_mesh_interface(drv->nlmode)) in i802_sta_disassoc()
5643 if (drv->device_ap_sme) in i802_sta_disassoc()
5660 static void dump_ifidx(struct wpa_driver_nl80211_data *drv) in dump_ifidx() argument
5668 for (i = 0; i < drv->num_if_indices; i++) { in dump_ifidx()
5669 if (!drv->if_indices[i]) in dump_ifidx()
5672 drv->if_indices[i], in dump_ifidx()
5673 drv->if_indices_reason[i]); in dump_ifidx()
5681 drv->num_if_indices, buf); in dump_ifidx()
5685 static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx, in add_ifidx() argument
5694 if (have_ifidx(drv, ifidx, ifidx_reason)) { in add_ifidx()
5699 for (i = 0; i < drv->num_if_indices; i++) { in add_ifidx()
5700 if (drv->if_indices[i] == 0) { in add_ifidx()
5701 drv->if_indices[i] = ifidx; in add_ifidx()
5702 drv->if_indices_reason[i] = ifidx_reason; in add_ifidx()
5703 dump_ifidx(drv); in add_ifidx()
5708 if (drv->if_indices != drv->default_if_indices) in add_ifidx()
5709 old = drv->if_indices; in add_ifidx()
5713 if (drv->if_indices_reason != drv->default_if_indices_reason) in add_ifidx()
5714 old_reason = drv->if_indices_reason; in add_ifidx()
5718 drv->if_indices = os_realloc_array(old, drv->num_if_indices + 1, in add_ifidx()
5720 drv->if_indices_reason = os_realloc_array(old_reason, in add_ifidx()
5721 drv->num_if_indices + 1, in add_ifidx()
5723 if (!drv->if_indices) { in add_ifidx()
5725 drv->if_indices = drv->default_if_indices; in add_ifidx()
5727 drv->if_indices = old; in add_ifidx()
5729 if (!drv->if_indices_reason) { in add_ifidx()
5731 drv->if_indices_reason = drv->default_if_indices_reason; in add_ifidx()
5733 drv->if_indices_reason = old_reason; in add_ifidx()
5735 if (!drv->if_indices || !drv->if_indices_reason) { in add_ifidx()
5742 os_memcpy(drv->if_indices, drv->default_if_indices, in add_ifidx()
5743 sizeof(drv->default_if_indices)); in add_ifidx()
5745 os_memcpy(drv->if_indices_reason, in add_ifidx()
5746 drv->default_if_indices_reason, in add_ifidx()
5747 sizeof(drv->default_if_indices_reason)); in add_ifidx()
5748 drv->if_indices[drv->num_if_indices] = ifidx; in add_ifidx()
5749 drv->if_indices_reason[drv->num_if_indices] = ifidx_reason; in add_ifidx()
5750 drv->num_if_indices++; in add_ifidx()
5751 dump_ifidx(drv); in add_ifidx()
5755 static void del_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx, in del_ifidx() argument
5760 for (i = 0; i < drv->num_if_indices; i++) { in del_ifidx()
5761 if ((drv->if_indices[i] == ifidx || ifidx == IFIDX_ANY) && in del_ifidx()
5762 (drv->if_indices_reason[i] == ifidx_reason || in del_ifidx()
5764 drv->if_indices[i] = 0; in del_ifidx()
5768 dump_ifidx(drv); in del_ifidx()
5772 static int have_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx, in have_ifidx() argument
5777 for (i = 0; i < drv->num_if_indices; i++) in have_ifidx()
5778 if (drv->if_indices[i] == ifidx && in have_ifidx()
5779 (drv->if_indices_reason[i] == ifidx_reason || in have_ifidx()
5791 struct wpa_driver_nl80211_data *drv = bss->drv; in i802_set_wds_sta() local
5802 if (nl80211_create_iface(drv, name, in i802_set_wds_sta()
5808 linux_br_add_if(drv->global->ioctl_sock, in i802_set_wds_sta()
5812 if (linux_set_iface_flags(drv->global->ioctl_sock, name, 1)) { in i802_set_wds_sta()
5819 linux_br_del_if(drv->global->ioctl_sock, bridge_ifname, in i802_set_wds_sta()
5823 nl80211_remove_iface(drv, if_nametoindex(name)); in i802_set_wds_sta()
5831 struct wpa_driver_nl80211_data *drv = eloop_ctx; in handle_eapol() local
5845 if (have_ifidx(drv, lladdr.sll_ifindex, IFIDX_ANY)) in handle_eapol()
5846 drv_event_eapol_rx(drv->ctx, lladdr.sll_addr, buf, len); in handle_eapol()
5850 static int i802_check_bridge(struct wpa_driver_nl80211_data *drv, in i802_check_bridge() argument
5864 if (linux_br_add(drv->global->ioctl_sock, brname) < 0) { in i802_check_bridge()
5872 add_ifidx(drv, br_ifindex, drv->ifindex); in i802_check_bridge()
5882 if (linux_br_del_if(drv->global->ioctl_sock, in_br, ifname) < in i802_check_bridge()
5894 if (linux_br_add_if(drv->global->ioctl_sock, brname, ifname) < 0) { in i802_check_bridge()
5909 struct wpa_driver_nl80211_data *drv; in i802_init() local
5922 drv = bss->drv; in i802_init()
5934 add_ifidx(drv, if_nametoindex(master_ifname), drv->ifindex); in i802_init()
5953 add_ifidx(drv, ifindex, drv->ifindex); in i802_init()
5960 add_ifidx(drv, drv->ifindex, IFIDX_ANY); in i802_init()
5963 if (i802_check_bridge(drv, bss, params->bridge[0], in i802_init()
5972 add_ifidx(drv, br_ifindex, drv->ifindex); in i802_init()
5976 drv->rtnl_sk = nl_socket_alloc(); in i802_init()
5977 if (drv->rtnl_sk == NULL) { in i802_init()
5982 if (nl_connect(drv->rtnl_sk, NETLINK_ROUTE)) { in i802_init()
5990 drv->eapol_sock = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_PAE)); in i802_init()
5991 if (drv->eapol_sock < 0) { in i802_init()
5997 if (eloop_register_read_sock(drv->eapol_sock, handle_eapol, drv, NULL)) in i802_init()
6003 if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname, in i802_init()
6006 os_memcpy(drv->perm_addr, params->own_addr, ETH_ALEN); in i802_init()
6052 struct wpa_driver_nl80211_data *drv; in nl80211_addr_in_use() local
6053 dl_list_for_each(drv, &global->interfaces, in nl80211_addr_in_use()
6055 if (os_memcmp(addr, drv->first_bss->addr, ETH_ALEN) == 0) in nl80211_addr_in_use()
6062 static int nl80211_vif_addr(struct wpa_driver_nl80211_data *drv, u8 *new_addr) in nl80211_vif_addr() argument
6066 if (!drv->global) in nl80211_vif_addr()
6069 os_memcpy(new_addr, drv->first_bss->addr, ETH_ALEN); in nl80211_vif_addr()
6071 new_addr[0] = drv->first_bss->addr[0] | 0x02; in nl80211_vif_addr()
6073 if (!nl80211_addr_in_use(drv->global, new_addr)) in nl80211_vif_addr()
6122 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_if_add() local
6133 ifidx = nl80211_create_iface(drv, ifname, nlmode, addr, in wpa_driver_nl80211_if_add()
6142 drv->global->if_add_wdevid = p2pdev_info.wdev_id; in wpa_driver_nl80211_if_add()
6143 drv->global->if_add_wdevid_set = p2pdev_info.wdev_id_set; in wpa_driver_nl80211_if_add()
6150 ifidx = nl80211_create_iface(drv, ifname, nlmode, addr, in wpa_driver_nl80211_if_add()
6163 else if (linux_get_ifhwaddr(drv->global->ioctl_sock, in wpa_driver_nl80211_if_add()
6166 nl80211_remove_iface(drv, ifidx); in wpa_driver_nl80211_if_add()
6178 if (linux_get_ifhwaddr(drv->global->ioctl_sock, ifname, in wpa_driver_nl80211_if_add()
6181 nl80211_remove_iface(drv, ifidx); in wpa_driver_nl80211_if_add()
6184 if (nl80211_addr_in_use(drv->global, new_addr)) { in wpa_driver_nl80211_if_add()
6187 if (nl80211_vif_addr(drv, new_addr) < 0) { in wpa_driver_nl80211_if_add()
6189 nl80211_remove_iface(drv, ifidx); in wpa_driver_nl80211_if_add()
6192 if (linux_set_ifhwaddr(drv->global->ioctl_sock, ifname, in wpa_driver_nl80211_if_add()
6195 nl80211_remove_iface(drv, ifidx); in wpa_driver_nl80211_if_add()
6206 nl80211_remove_iface(drv, ifidx); in wpa_driver_nl80211_if_add()
6211 i802_check_bridge(drv, new_bss, bridge, ifname) < 0) { in wpa_driver_nl80211_if_add()
6216 nl80211_remove_iface(drv, ifidx); in wpa_driver_nl80211_if_add()
6221 if (linux_set_iface_flags(drv->global->ioctl_sock, ifname, 1)) in wpa_driver_nl80211_if_add()
6224 nl80211_remove_iface(drv, ifidx); in wpa_driver_nl80211_if_add()
6231 new_bss->drv = drv; in wpa_driver_nl80211_if_add()
6232 new_bss->next = drv->first_bss->next; in wpa_driver_nl80211_if_add()
6233 new_bss->freq = drv->first_bss->freq; in wpa_driver_nl80211_if_add()
6236 drv->first_bss->next = new_bss; in wpa_driver_nl80211_if_add()
6246 if (drv->global) in wpa_driver_nl80211_if_add()
6247 drv->global->if_add_ifindex = ifidx; in wpa_driver_nl80211_if_add()
6254 (drv->hostapd || in wpa_driver_nl80211_if_add()
6258 add_ifidx(drv, ifidx, IFIDX_ANY); in wpa_driver_nl80211_if_add()
6268 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_if_remove() local
6274 nl80211_remove_iface(drv, ifindex); in wpa_driver_nl80211_if_remove()
6277 dl_list_for_each(drv2, &drv->global->interfaces, in wpa_driver_nl80211_if_remove()
6288 if (linux_br_del_if(drv->global->ioctl_sock, bss->brname, in wpa_driver_nl80211_if_remove()
6295 if (linux_br_del(drv->global->ioctl_sock, bss->brname) < 0) in wpa_driver_nl80211_if_remove()
6301 if (bss != drv->first_bss) { in wpa_driver_nl80211_if_remove()
6305 for (tbss = drv->first_bss; tbss; tbss = tbss->next) { in wpa_driver_nl80211_if_remove()
6324 if (!bss->added_if && !drv->first_bss->next) in wpa_driver_nl80211_if_remove()
6325 wpa_driver_nl80211_del_beacon(drv); in wpa_driver_nl80211_if_remove()
6329 if (drv->first_bss->next) { in wpa_driver_nl80211_if_remove()
6330 drv->first_bss = drv->first_bss->next; in wpa_driver_nl80211_if_remove()
6331 drv->ctx = drv->first_bss->ctx; in wpa_driver_nl80211_if_remove()
6362 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_send_frame_cmd() local
6375 (offchanok && ((drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) || in nl80211_send_frame_cmd()
6376 drv->test_use_roc_tx) && in nl80211_send_frame_cmd()
6386 ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie); in nl80211_send_frame_cmd()
6400 if (drv->num_send_action_cookies == MAX_SEND_ACTION_COOKIES) { in nl80211_send_frame_cmd()
6404 drv->send_action_cookies[0]); in nl80211_send_frame_cmd()
6405 os_memmove(&drv->send_action_cookies[0], in nl80211_send_frame_cmd()
6406 &drv->send_action_cookies[1], in nl80211_send_frame_cmd()
6409 drv->num_send_action_cookies--; in nl80211_send_frame_cmd()
6411 drv->send_action_cookies[drv->num_send_action_cookies] = cookie; in nl80211_send_frame_cmd()
6412 drv->num_send_action_cookies++; in nl80211_send_frame_cmd()
6429 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_send_action() local
6436 drv->ifindex, freq, wait_time, no_cck); in wpa_driver_nl80211_send_action()
6449 if (is_ap_interface(drv->nlmode) && in wpa_driver_nl80211_send_action()
6450 (!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) || in wpa_driver_nl80211_send_action()
6451 (int) freq == bss->freq || drv->device_ap_sme || in wpa_driver_nl80211_send_action()
6452 !drv->use_monitor)) in wpa_driver_nl80211_send_action()
6459 &drv->send_action_cookie, in wpa_driver_nl80211_send_action()
6469 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_frame_wait_cancel() local
6481 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_frame_wait_cancel()
6491 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_send_action_cancel_wait() local
6496 nl80211_frame_wait_cancel(bss, drv->send_action_cookie); in wpa_driver_nl80211_send_action_cancel_wait()
6503 for (i = drv->num_send_action_cookies; i > 0; i--) { in wpa_driver_nl80211_send_action_cancel_wait()
6504 cookie = drv->send_action_cookies[i - 1]; in wpa_driver_nl80211_send_action_cancel_wait()
6505 if (cookie != drv->send_action_cookie) in wpa_driver_nl80211_send_action_cancel_wait()
6508 drv->num_send_action_cookies = 0; in wpa_driver_nl80211_send_action_cancel_wait()
6516 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_remain_on_channel() local
6529 ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie); in wpa_driver_nl80211_remain_on_channel()
6534 drv->remain_on_chan_cookie = cookie; in wpa_driver_nl80211_remain_on_channel()
6535 drv->pending_remain_on_chan = 1; in wpa_driver_nl80211_remain_on_channel()
6548 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_cancel_remain_on_channel() local
6552 if (!drv->pending_remain_on_chan) { in wpa_driver_nl80211_cancel_remain_on_channel()
6560 (long long unsigned int) drv->remain_on_chan_cookie); in wpa_driver_nl80211_cancel_remain_on_channel()
6564 nla_put_u64(msg, NL80211_ATTR_COOKIE, drv->remain_on_chan_cookie)) { in wpa_driver_nl80211_cancel_remain_on_channel()
6569 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_cancel_remain_on_channel()
6580 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_probe_req_report() local
6583 if (bss->nl_preq && drv->device_ap_sme && in wpa_driver_nl80211_probe_req_report()
6584 is_ap_interface(drv->nlmode) && !bss->in_deinit && in wpa_driver_nl80211_probe_req_report()
6607 bss->nl_preq = nl_create_handle(drv->global->nl_cb, "preq"); in wpa_driver_nl80211_probe_req_report()
6631 static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv, in nl80211_disable_11b_rates() argument
6643 msg = nl80211_ifindex_msg(drv, ifindex, 0, in nl80211_disable_11b_rates()
6666 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_disable_11b_rates()
6671 drv->disabled_11b_rates = disabled; in nl80211_disable_11b_rates()
6684 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_deinit_ap() local
6685 if (!is_ap_interface(drv->nlmode)) in wpa_driver_nl80211_deinit_ap()
6687 wpa_driver_nl80211_del_beacon(drv); in wpa_driver_nl80211_deinit_ap()
6694 if (drv->nlmode == NL80211_IFTYPE_P2P_GO && bss->if_dynamic) in wpa_driver_nl80211_deinit_ap()
6704 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_stop_ap() local
6705 if (!is_ap_interface(drv->nlmode)) in wpa_driver_nl80211_stop_ap()
6707 wpa_driver_nl80211_del_beacon(drv); in wpa_driver_nl80211_stop_ap()
6716 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_deinit_p2p_cli() local
6717 if (drv->nlmode != NL80211_IFTYPE_P2P_CLIENT) in wpa_driver_nl80211_deinit_p2p_cli()
6740 nl80211_disable_11b_rates(bss->drv, bss->drv->ifindex, 1); in wpa_driver_nl80211_resume()
6747 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_signal_monitor() local
6763 return send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_signal_monitor()
6795 static int nl80211_get_channel_width(struct wpa_driver_nl80211_data *drv, in nl80211_get_channel_width() argument
6800 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_GET_INTERFACE); in nl80211_get_channel_width()
6801 return send_and_recv_msgs(drv, msg, get_channel_width, sig); in nl80211_get_channel_width()
6808 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_signal_poll() local
6812 res = nl80211_get_link_signal(drv, si); in nl80211_signal_poll()
6814 if (drv->nlmode != NL80211_IFTYPE_ADHOC && in nl80211_signal_poll()
6815 drv->nlmode != NL80211_IFTYPE_MESH_POINT) in nl80211_signal_poll()
6820 res = nl80211_get_channel_width(drv, si); in nl80211_signal_poll()
6824 return nl80211_get_link_noise(drv, si); in nl80211_signal_poll()
6846 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_set_param() local
6850 drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CONCURRENT; in nl80211_set_param()
6851 drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P; in nl80211_set_param()
6857 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_set_param() local
6858 drv->use_monitor = 1; in nl80211_set_param()
6863 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_set_param() local
6864 drv->capa.flags &= ~WPA_DRIVER_FLAGS_SME; in nl80211_set_param()
6865 drv->force_connect_cmd = 1; in nl80211_set_param()
6870 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_set_param() local
6871 drv->capa.flags &= ~WPA_DRIVER_FLAGS_OFFCHANNEL_TX; in nl80211_set_param()
6872 drv->test_use_roc_tx = 1; in nl80211_set_param()
6954 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_get_radio_name() local
6955 return drv->phyname; in nl80211_get_radio_name()
6971 return send_and_recv_msgs(bss->drv, msg, NULL, NULL); in nl80211_pmkid()
7140 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_get_survey() local
7151 msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_GET_SURVEY); in wpa_driver_nl80211_get_survey()
7160 err = send_and_recv_msgs(drv, msg, survey_handler, in wpa_driver_nl80211_get_survey()
7167 wpa_supplicant_event(drv->ctx, EVENT_SURVEY, &data); in wpa_driver_nl80211_get_survey()
7179 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_set_rekey_info() local
7184 if (!drv->set_rekey_offload) in nl80211_set_rekey_info()
7201 ret = send_and_recv_msgs(drv, msg, NULL, (void *) -1); in nl80211_set_rekey_info()
7205 drv->set_rekey_offload = 0; in nl80211_set_rekey_info()
7252 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_poll_client() local
7256 if (!drv->poll_command_supported) { in nl80211_poll_client()
7267 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_poll_client()
7286 return send_and_recv_msgs(bss->drv, msg, NULL, NULL); in nl80211_set_power_save()
7319 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_start_radar_detection() local
7327 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_RADAR)) { in nl80211_start_radar_detection()
7333 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_RADAR_DETECT)) || in nl80211_start_radar_detection()
7339 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_start_radar_detection()
7355 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_send_tdls_mgmt() local
7358 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT)) in nl80211_send_tdls_mgmt()
7364 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_TDLS_MGMT)) || in nl80211_send_tdls_mgmt()
7386 return send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_send_tdls_mgmt()
7397 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_tdls_oper() local
7401 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT)) in nl80211_tdls_oper()
7428 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_TDLS_OPER)) || in nl80211_tdls_oper()
7435 return send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_tdls_oper()
7444 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_tdls_enable_channel_switch() local
7448 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT) || in nl80211_tdls_enable_channel_switch()
7449 !(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_CHANNEL_SWITCH)) in nl80211_tdls_enable_channel_switch()
7465 return send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_tdls_enable_channel_switch()
7473 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_tdls_disable_channel_switch() local
7476 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT) || in nl80211_tdls_disable_channel_switch()
7477 !(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_CHANNEL_SWITCH)) in nl80211_tdls_disable_channel_switch()
7491 return send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_tdls_disable_channel_switch()
7514 struct wpa_driver_nl80211_data *drv = bss->drv; in driver_nl80211_scan2() local
7523 if (drv->scan_vendor_cmd_avail && !params->only_new_results) in driver_nl80211_scan2()
7623 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_update_ft_ies() local
7627 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_UPDATE_FT_IES)) || in wpa_driver_nl80211_update_ft_ies()
7634 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_update_ft_ies()
7647 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_get_macaddr() local
7649 if (drv->nlmode != NL80211_IFTYPE_P2P_DEVICE) in wpa_driver_nl80211_get_macaddr()
7684 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_status() local
7739 drv->phyname, in wpa_driver_nl80211_status()
7740 MAC2STR(drv->perm_addr), in wpa_driver_nl80211_status()
7741 drv->ifindex, in wpa_driver_nl80211_status()
7742 drv->operstate, in wpa_driver_nl80211_status()
7743 scan_state_str(drv->scan_state), in wpa_driver_nl80211_status()
7744 MAC2STR(drv->auth_bssid), in wpa_driver_nl80211_status()
7745 MAC2STR(drv->auth_attempt_bssid), in wpa_driver_nl80211_status()
7746 MAC2STR(drv->bssid), in wpa_driver_nl80211_status()
7747 MAC2STR(drv->prev_bssid), in wpa_driver_nl80211_status()
7748 drv->associated, in wpa_driver_nl80211_status()
7749 drv->assoc_freq, in wpa_driver_nl80211_status()
7750 drv->monitor_sock, in wpa_driver_nl80211_status()
7751 drv->monitor_ifidx, in wpa_driver_nl80211_status()
7752 drv->monitor_refcount, in wpa_driver_nl80211_status()
7753 drv->last_mgmt_freq, in wpa_driver_nl80211_status()
7754 drv->eapol_tx_sock, in wpa_driver_nl80211_status()
7755 drv->ignore_if_down_event ? in wpa_driver_nl80211_status()
7757 drv->scan_complete_events ? in wpa_driver_nl80211_status()
7759 drv->disabled_11b_rates ? in wpa_driver_nl80211_status()
7761 drv->pending_remain_on_chan ? in wpa_driver_nl80211_status()
7763 drv->in_interface_list ? "in_interface_list=1\n" : "", in wpa_driver_nl80211_status()
7764 drv->device_ap_sme ? "device_ap_sme=1\n" : "", in wpa_driver_nl80211_status()
7765 drv->poll_command_supported ? in wpa_driver_nl80211_status()
7767 drv->data_tx_status ? "data_tx_status=1\n" : "", in wpa_driver_nl80211_status()
7768 drv->scan_for_auth ? "scan_for_auth=1\n" : "", in wpa_driver_nl80211_status()
7769 drv->retry_auth ? "retry_auth=1\n" : "", in wpa_driver_nl80211_status()
7770 drv->use_monitor ? "use_monitor=1\n" : "", in wpa_driver_nl80211_status()
7771 drv->ignore_next_local_disconnect ? in wpa_driver_nl80211_status()
7773 drv->ignore_next_local_deauth ? in wpa_driver_nl80211_status()
7779 if (drv->has_capability) { in wpa_driver_nl80211_status()
7803 drv->capa.key_mgmt, in wpa_driver_nl80211_status()
7804 drv->capa.enc, in wpa_driver_nl80211_status()
7805 drv->capa.auth, in wpa_driver_nl80211_status()
7806 (unsigned long long) drv->capa.flags, in wpa_driver_nl80211_status()
7807 drv->capa.rrm_flags, in wpa_driver_nl80211_status()
7808 drv->capa.max_scan_ssids, in wpa_driver_nl80211_status()
7809 drv->capa.max_sched_scan_ssids, in wpa_driver_nl80211_status()
7810 drv->capa.sched_scan_supported, in wpa_driver_nl80211_status()
7811 drv->capa.max_match_sets, in wpa_driver_nl80211_status()
7812 drv->capa.max_remain_on_chan, in wpa_driver_nl80211_status()
7813 drv->capa.max_stations, in wpa_driver_nl80211_status()
7814 drv->capa.probe_resp_offloads, in wpa_driver_nl80211_status()
7815 drv->capa.max_acl_mac_addrs, in wpa_driver_nl80211_status()
7816 drv->capa.num_multichan_concurrent, in wpa_driver_nl80211_status()
7817 drv->capa.mac_addr_rand_sched_scan_supported, in wpa_driver_nl80211_status()
7818 drv->capa.mac_addr_rand_scan_supported, in wpa_driver_nl80211_status()
7819 drv->capa.conc_capab, in wpa_driver_nl80211_status()
7820 drv->capa.max_conc_chan_2_4, in wpa_driver_nl80211_status()
7821 drv->capa.max_conc_chan_5_0, in wpa_driver_nl80211_status()
7822 drv->capa.max_sched_scan_plans, in wpa_driver_nl80211_status()
7823 drv->capa.max_sched_scan_plan_interval, in wpa_driver_nl80211_status()
7824 drv->capa.max_sched_scan_plan_iterations); in wpa_driver_nl80211_status()
7864 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_switch_channel() local
7876 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_AP_CSA)) { in nl80211_switch_channel()
7881 if ((drv->nlmode != NL80211_IFTYPE_AP) && in nl80211_switch_channel()
7882 (drv->nlmode != NL80211_IFTYPE_P2P_GO)) in nl80211_switch_channel()
7909 if (drv->capa.max_csa_counters && in nl80211_switch_channel()
7910 csa_off_len > drv->capa.max_csa_counters) { in nl80211_switch_channel()
7968 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_switch_channel()
7988 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_add_ts() local
7996 if (!is_sta_interface(drv->nlmode)) in nl80211_add_ts()
8009 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_add_ts()
8020 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_del_ts() local
8026 if (!is_sta_interface(drv->nlmode)) in nl80211_del_ts()
8036 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_del_ts()
8102 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_vendor_cmd() local
8112 nl80211_cmd(drv, msg, 0, subcmd); in nl80211_vendor_cmd()
8116 ret = send_and_recv_msgs(drv, msg, cmd_reply_handler, buf); in nl80211_vendor_cmd()
8131 ret = send_and_recv_msgs(drv, msg, vendor_reply_handler, buf); in nl80211_vendor_cmd()
8147 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_set_qos_map() local
8154 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_SET_QOS_MAP)) || in nl80211_set_qos_map()
8160 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_set_qos_map()
8172 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_set_wowlan() local
8202 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_set_wowlan()
8214 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_roaming() local
8220 if (!drv->roaming_vendor_cmd_avail) { in nl80211_roaming()
8226 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) || in nl80211_roaming()
8241 return send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_roaming()
8249 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_set_mac_addr() local
8253 addr = drv->perm_addr; in nl80211_set_mac_addr()
8255 if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 0) < 0) in nl80211_set_mac_addr()
8258 if (linux_set_ifhwaddr(drv->global->ioctl_sock, bss->ifname, addr) < 0) in nl80211_set_mac_addr()
8263 if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, in nl80211_set_mac_addr()
8273 drv->addr_changed = new_addr; in nl80211_set_mac_addr()
8276 if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1) < 0) in nl80211_set_mac_addr()
8315 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_join_mesh() local
8320 wpa_printf(MSG_DEBUG, "nl80211: mesh join (ifindex=%d)", drv->ifindex); in nl80211_join_mesh()
8321 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_JOIN_MESH); in nl80211_join_mesh()
8379 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_join_mesh()
8430 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_nl80211_leave_mesh() local
8434 wpa_printf(MSG_DEBUG, "nl80211: mesh leave (ifindex=%d)", drv->ifindex); in wpa_driver_nl80211_leave_mesh()
8435 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_LEAVE_MESH); in wpa_driver_nl80211_leave_mesh()
8436 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_nl80211_leave_mesh()
8445 if (wpa_driver_nl80211_set_mode(drv->first_bss, in wpa_driver_nl80211_leave_mesh()
8462 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_br_add_ip_neigh() local
8478 if (!drv->rtnl_sk) { in wpa_driver_br_add_ip_neigh()
8525 res = rtnl_neigh_add(drv->rtnl_sk, rn, NLM_F_CREATE); in wpa_driver_br_add_ip_neigh()
8550 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_br_delete_ip_neigh() local
8575 if (!drv->rtnl_sk) { in wpa_driver_br_delete_ip_neigh()
8601 res = rtnl_neigh_delete(drv->rtnl_sk, rn, 0); in wpa_driver_br_delete_ip_neigh()
8772 struct wpa_driver_nl80211_data *drv = bss->drv; in wpa_driver_do_acs() local
8782 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) || in wpa_driver_do_acs()
8810 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in wpa_driver_do_acs()
8823 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_set_band() local
8829 if (!drv->setband_vendor_cmd_avail) in nl80211_set_band()
8846 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) || in nl80211_set_band()
8857 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_set_band()
8935 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_get_pref_freq_list() local
8943 if (!drv->get_pref_freq_list) in nl80211_get_pref_freq_list()
8972 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) || in nl80211_get_pref_freq_list()
8973 nla_put_u32(msg, NL80211_ATTR_IFINDEX, drv->ifindex) || in nl80211_get_pref_freq_list()
8990 ret = send_and_recv_msgs(drv, msg, preferred_freq_info_handler, ¶m); in nl80211_get_pref_freq_list()
9011 struct wpa_driver_nl80211_data *drv = bss->drv; in nl80211_set_prob_oper_freq() local
9016 if (!drv->set_prob_oper_freq) in nl80211_set_prob_oper_freq()
9023 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) || in nl80211_set_prob_oper_freq()
9042 ret = send_and_recv_msgs(drv, msg, NULL, NULL); in nl80211_set_prob_oper_freq()