Lines Matching refs:drv
174 wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv,
187 static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
189 static void del_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
191 static int have_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
196 static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv,
199 static int nl80211_leave_ibss(struct wpa_driver_nl80211_data *drv,
254 struct i802_bss * get_bss_ifindex(struct wpa_driver_nl80211_data *drv,
259 for (bss = drv->first_bss; bss; bss = bss->next) {
274 void nl80211_mark_disconnected(struct wpa_driver_nl80211_data *drv)
276 if (drv->associated)
277 os_memcpy(drv->prev_bssid, drv->bssid, ETH_ALEN);
278 drv->associated = 0;
279 os_memset(drv->bssid, 0, ETH_ALEN);
381 int send_and_recv_msgs(struct wpa_driver_nl80211_data *drv,
386 return send_and_recv(drv->global, drv->global->nl, msg,
452 void * nl80211_cmd(struct wpa_driver_nl80211_data *drv,
457 return genlmsg_put(msg, 0, 0, drv->global->nl80211_id,
478 if (!nl80211_cmd(bss->drv, msg, flags, cmd) ||
489 nl80211_ifindex_msg(struct wpa_driver_nl80211_data *drv, int ifindex,
498 if (!nl80211_cmd(drv, msg, flags, cmd) ||
508 struct nl_msg * nl80211_drv_msg(struct wpa_driver_nl80211_data *drv, int flags,
511 return nl80211_ifindex_msg(drv, drv->ifindex, flags, cmd);
517 return nl80211_ifindex_msg(bss->drv, bss->ifindex, flags, cmd);
562 if (send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data) == 0)
579 if (send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data) == 0)
595 return send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data);
599 static int nl80211_register_beacons(struct wpa_driver_nl80211_data *drv,
609 if (!nl80211_cmd(drv, msg, 0, NL80211_CMD_REGISTER_BEACONS) ||
615 ret = send_and_recv(drv->global, w->nl_beacons, msg, NULL, NULL);
643 struct wpa_driver_nl80211_data *drv;
660 dl_list_for_each(drv, &w->drvs, struct wpa_driver_nl80211_data,
665 wpa_supplicant_event(drv->ctx, EVENT_RX_MGMT, &event);
712 w->nl_beacons = nl_create_handle(bss->drv->global->nl_cb,
719 if (nl80211_register_beacons(bss->drv, w)) {
732 /* drv entry for this bss already there? */
734 if (tmp_bss->drv == bss->drv) {
741 dl_list_add(&w->drvs, &bss->drv->wiphy_list);
760 /* still any for this drv present? */
762 if (tmp_bss->drv == bss->drv) {
769 dl_list_del(&bss->drv->wiphy_list);
786 struct wpa_driver_nl80211_data *drv = bss->drv;
788 return drv->ifindex;
795 struct wpa_driver_nl80211_data *drv = bss->drv;
796 if (!drv->associated)
798 os_memcpy(bssid, drv->bssid, ETH_ALEN);
806 struct wpa_driver_nl80211_data *drv = bss->drv;
807 if (!drv->associated)
809 os_memcpy(ssid, drv->ssid, drv->ssid_len);
810 return drv->ssid_len;
815 struct nl80211_global *global, struct wpa_driver_nl80211_data *drv,
820 if (drv && os_strcmp(drv->first_bss->ifname, ifname) == 0) {
821 if (if_nametoindex(drv->first_bss->ifname) == 0) {
823 drv->first_bss->ifname);
826 if (!drv->if_removed)
829 drv->first_bss->ifname);
830 drv->if_removed = 0;
838 if (drv)
839 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS, &event);
847 struct nl80211_global *global, struct wpa_driver_nl80211_data *drv,
852 if (drv && os_strcmp(drv->first_bss->ifname, ifname) == 0) {
853 if (drv->if_removed) {
860 drv->if_removed = 1;
871 if (drv)
872 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS, &event);
879 static int wpa_driver_nl80211_own_ifname(struct wpa_driver_nl80211_data *drv,
892 drv->first_bss->ifname) == 0)
904 static int wpa_driver_nl80211_own_ifindex(struct wpa_driver_nl80211_data *drv,
907 if (drv->ifindex == ifindex)
910 if (drv->if_removed && wpa_driver_nl80211_own_ifname(drv, buf, len)) {
911 nl80211_check_global(drv->global);
914 wpa_driver_nl80211_finish_drv_init(drv, NULL, 0, NULL);
925 struct wpa_driver_nl80211_data *drv;
926 dl_list_for_each(drv, &global->interfaces,
928 if (wpa_driver_nl80211_own_ifindex(drv, idx, buf, len) ||
929 have_ifidx(drv, idx, IFIDX_ANY))
930 return drv;
941 struct wpa_driver_nl80211_data *drv;
992 drv = nl80211_find_drv(global, ifi->ifi_index, buf, len);
993 if (!drv)
996 if (!drv->if_disabled && !(ifi->ifi_flags & IFF_UP)) {
999 linux_iface_up(drv->global->ioctl_sock, namebuf) > 0) {
1002 drv->ignore_if_down_event = 0;
1007 if (os_strcmp(drv->first_bss->ifname, ifname) != 0) {
1010 drv->first_bss->ifname);
1011 } else if (drv->ignore_if_down_event) {
1014 drv->ignore_if_down_event = 0;
1016 drv->if_disabled = 1;
1017 wpa_supplicant_event(drv->ctx,
1021 * Try to get drv again, since it may be removed as
1025 drv = nl80211_find_drv(global, ifi->ifi_index,
1027 if (!drv)
1032 if (drv->if_disabled && (ifi->ifi_flags & IFF_UP)) {
1034 linux_iface_up(drv->global->ioctl_sock, namebuf) == 0) {
1038 } else if (if_nametoindex(drv->first_bss->ifname) == 0) {
1041 drv->first_bss->ifname);
1042 } else if (drv->if_removed) {
1045 "removed", drv->first_bss->ifname);
1051 bss = get_bss_ifindex(drv, ifi->ifi_index);
1053 linux_get_ifhwaddr(drv->global->ioctl_sock,
1070 drv->if_disabled = 0;
1071 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED,
1082 if (drv->operstate == 1 &&
1086 netlink_send_oper_ifla(drv->global->netlink, drv->ifindex,
1092 wpa_driver_nl80211_event_newlink(global, drv, ifi->ifi_index,
1095 if (ifi->ifi_family == AF_BRIDGE && brid && drv) {
1107 add_ifidx(drv, brid, ifi->ifi_index);
1109 for (bss = drv->first_bss; bss; bss = bss->next) {
1124 struct wpa_driver_nl80211_data *drv;
1171 drv = nl80211_find_drv(global, ifi->ifi_index, buf, len);
1173 if (ifi->ifi_family == AF_BRIDGE && brid && drv) {
1186 del_ifidx(drv, brid, ifi->ifi_index);
1190 wpa_driver_nl80211_event_dellink(global, drv, ifi->ifi_index,
1196 struct wpa_driver_nl80211_data *drv;
1265 int nl80211_get_assoc_ssid(struct wpa_driver_nl80211_data *drv, u8 *ssid)
1271 msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_GET_SCAN);
1273 arg.drv = drv;
1274 ret = send_and_recv_msgs(drv, msg, nl80211_get_assoc_freq_handler,
1286 unsigned int nl80211_get_assoc_freq(struct wpa_driver_nl80211_data *drv)
1292 msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_GET_SCAN);
1294 arg.drv = drv;
1295 ret = send_and_recv_msgs(drv, msg, nl80211_get_assoc_freq_handler,
1298 unsigned int freq = drv->nlmode == NL80211_IFTYPE_ADHOC ?
1303 drv->assoc_freq = freq;
1304 return drv->assoc_freq;
1308 return drv->assoc_freq;
1374 int nl80211_get_link_signal(struct wpa_driver_nl80211_data *drv,
1382 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_GET_STATION)) ||
1383 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, drv->bssid)) {
1388 return send_and_recv_msgs(drv, msg, get_link_signal, sig);
1436 int nl80211_get_link_noise(struct wpa_driver_nl80211_data *drv,
1442 sig_change->frequency = drv->assoc_freq;
1444 msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_GET_SURVEY);
1445 return send_and_recv_msgs(drv, msg, get_link_noise, sig_change);
1477 struct wpa_driver_nl80211_data *drv = bss->drv;
1489 if (!nl80211_cmd(drv, msg, 0, NL80211_CMD_REQ_SET_REG) ||
1494 if (send_and_recv_msgs(drv, msg, NULL, NULL))
1520 struct wpa_driver_nl80211_data *drv = bss->drv;
1528 nl80211_cmd(drv, msg, 0, NL80211_CMD_GET_REG);
1530 ret = send_and_recv_msgs(drv, msg, nl80211_get_country, alpha2);
1653 struct wpa_driver_nl80211_data *drv = ctx;
1661 if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE)
1662 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_DISABLED, NULL);
1668 struct wpa_driver_nl80211_data *drv = ctx;
1670 if (i802_set_iface_flags(drv->first_bss, 1)) {
1676 if (is_p2p_net_interface(drv->nlmode))
1677 nl80211_disable_11b_rates(drv, drv->ifindex, 1);
1683 if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE)
1684 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED, NULL);
1692 struct wpa_driver_nl80211_data *drv = eloop_ctx;
1743 wpa_supplicant_event(drv->ctx, EVENT_EAPOL_TX_STATUS, &event);
1770 wpa_driver_nl80211_drv_init_rfkill(struct wpa_driver_nl80211_data *drv)
1774 if (drv->rfkill)
1781 rcfg->ctx = drv;
1790 if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) {
1791 struct nl80211_global *global = drv->global;
1796 if (drv == tmp1 || drv->wiphy_idx != tmp1->wiphy_idx ||
1808 os_strlcpy(rcfg->ifname, drv->first_bss->ifname,
1814 drv->rfkill = rfkill_init(rcfg);
1815 if (!drv->rfkill) {
1827 struct wpa_driver_nl80211_data *drv;
1832 drv = os_zalloc(sizeof(*drv));
1833 if (drv == NULL)
1835 drv->global = global_priv;
1836 drv->ctx = ctx;
1837 drv->hostapd = !!hostapd;
1838 drv->eapol_sock = -1;
1845 drv->set_rekey_offload = 1;
1847 drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int);
1848 drv->if_indices = drv->default_if_indices;
1849 drv->if_indices_reason = drv->default_if_indices_reason;
1851 drv->first_bss = os_zalloc(sizeof(*drv->first_bss));
1852 if (!drv->first_bss) {
1853 os_free(drv);
1856 bss = drv->first_bss;
1857 bss->drv = drv;
1861 drv->monitor_ifidx = -1;
1862 drv->monitor_sock = -1;
1863 drv->eapol_tx_sock = -1;
1864 drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED;
1869 if (wpa_driver_nl80211_finish_drv_init(drv, set_addr, 1, driver_params))
1872 drv->eapol_tx_sock = socket(PF_PACKET, SOCK_DGRAM, 0);
1873 if (drv->eapol_tx_sock < 0)
1876 if (drv->data_tx_status) {
1879 if (setsockopt(drv->eapol_tx_sock, SOL_SOCKET, SO_WIFI_STATUS,
1883 drv->data_tx_status = 0;
1884 if (!drv->use_monitor)
1885 drv->capa.flags &=
1888 eloop_register_read_sock(drv->eapol_tx_sock,
1890 drv, NULL);
1894 if (drv->global) {
1895 nl80211_check_global(drv->global);
1896 dl_list_add(&drv->global->interfaces, &drv->list);
1897 drv->in_interface_list = 1;
1928 struct wpa_driver_nl80211_data *drv = bss->drv;
1945 ret = send_and_recv(drv->global, nl_handle, msg, NULL, NULL);
1992 struct wpa_driver_nl80211_data *drv = bss->drv;
2000 if (drv->nlmode == NL80211_IFTYPE_ADHOC) {
2056 if ((drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT)) {
2073 drv->capa.key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_FT |
2106 if ((drv->capa.rrm_flags & WPA_DRIVER_FLAGS_TX_POWER_INSERTION) &&
2156 ret = send_and_recv(bss->drv->global, bss->nl_mgmt, msg, NULL, NULL);
2302 ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL);
2317 ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL);
2333 return linux_set_iface_flags(bss->drv->global->ioctl_sock,
2345 /* struct wpa_driver_nl80211_data *drv = arg; */
2370 static void qca_vendor_test(struct wpa_driver_nl80211_data *drv)
2377 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
2388 ret = send_and_recv_msgs(drv, msg, qca_vendor_test_cmd_handler, drv);
2397 wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv,
2401 struct i802_bss *bss = drv->first_bss;
2405 drv->ifindex = if_nametoindex(bss->ifname);
2406 bss->ifindex = drv->ifindex;
2407 bss->wdev_id = drv->global->if_add_wdevid;
2408 bss->wdev_id_set = drv->global->if_add_wdevid_set;
2410 bss->if_dynamic = drv->ifindex == drv->global->if_add_ifindex;
2411 bss->if_dynamic = bss->if_dynamic || drv->global->if_add_wdevid_set;
2412 drv->global->if_add_wdevid_set = 0;
2419 linux_iface_up(drv->global->ioctl_sock, bss->ifname) > 0)
2420 drv->start_iface_up = 1;
2422 if (wpa_driver_nl80211_capa(drv))
2429 bss->ifname, drv->phyname);
2432 (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 0) ||
2433 linux_set_ifhwaddr(drv->global->ioctl_sock, bss->ifname,
2438 drv->start_mode_ap = 1;
2440 if (drv->hostapd || bss->static_ap)
2456 wpa_driver_nl80211_drv_init_rfkill(drv);
2458 if (!rfkill_is_blocked(drv->rfkill)) {
2467 nl80211_disable_11b_rates(bss->drv,
2468 bss->drv->ifindex, 1);
2476 drv->if_disabled = 1;
2481 if (!drv->hostapd && nlmode != NL80211_IFTYPE_P2P_DEVICE)
2482 netlink_send_oper_ifla(drv->global->netlink, drv->ifindex,
2486 if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname,
2489 os_memcpy(drv->perm_addr, bss->addr, ETH_ALEN);
2494 drv, drv->ctx);
2497 if (drv->vendor_cmd_test_avail)
2498 qca_vendor_test(drv);
2507 struct wpa_driver_nl80211_data *drv = bss->drv;
2510 drv->ifindex);
2512 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_DEL_BEACON);
2513 return send_and_recv_msgs(drv, msg, NULL, NULL);
2526 struct wpa_driver_nl80211_data *drv = bss->drv;
2530 bss->ifname, drv->disabled_11b_rates);
2533 if (drv->data_tx_status)
2534 eloop_unregister_read_sock(drv->eapol_tx_sock);
2535 if (drv->eapol_tx_sock >= 0)
2536 close(drv->eapol_tx_sock);
2541 if (linux_br_del_if(drv->global->ioctl_sock, bss->brname,
2546 if (drv->rtnl_sk)
2547 nl80211_handle_destroy(drv->rtnl_sk);
2550 if (linux_set_iface_flags(drv->global->ioctl_sock, bss->brname,
2555 if (linux_br_del(drv->global->ioctl_sock, bss->brname) < 0)
2561 nl80211_remove_monitor_interface(drv);
2563 if (is_ap_interface(drv->nlmode))
2566 if (drv->eapol_sock >= 0) {
2567 eloop_unregister_read_sock(drv->eapol_sock);
2568 close(drv->eapol_sock);
2571 if (drv->if_indices != drv->default_if_indices)
2572 os_free(drv->if_indices);
2574 if (drv->if_indices_reason != drv->default_if_indices_reason)
2575 os_free(drv->if_indices_reason);
2577 if (drv->disabled_11b_rates)
2578 nl80211_disable_11b_rates(drv, drv->ifindex, 0);
2580 netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, 0,
2582 eloop_cancel_timeout(wpa_driver_nl80211_send_rfkill, drv, drv->ctx);
2583 rfkill_deinit(drv->rfkill);
2585 eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx);
2587 if (!drv->start_iface_up)
2590 if (drv->addr_changed) {
2591 if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname,
2596 if (linux_set_ifhwaddr(drv->global->ioctl_sock, bss->ifname,
2597 drv->perm_addr) < 0) {
2603 if (drv->nlmode != NL80211_IFTYPE_P2P_DEVICE) {
2604 if (!drv->hostapd || !drv->start_mode_ap)
2613 nl80211_destroy_bss(drv->first_bss);
2615 os_free(drv->filter_ssids);
2617 os_free(drv->auth_ie);
2619 if (drv->in_interface_list)
2620 dl_list_del(&drv->list);
2622 os_free(drv->extended_capa);
2623 os_free(drv->extended_capa_mask);
2624 for (i = 0; i < drv->num_iface_ext_capa; i++) {
2625 os_free(drv->iface_ext_capa[i].ext_capa);
2626 os_free(drv->iface_ext_capa[i].ext_capa_mask);
2628 os_free(drv->first_bss);
2629 os_free(drv);
2725 static int issue_key_mgmt_set_key(struct wpa_driver_nl80211_data *drv,
2731 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD))
2734 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
2743 ret = send_and_recv_msgs(drv, msg, NULL, (void *) -1);
2761 struct wpa_driver_nl80211_data *drv = bss->drv;
2768 if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE)
2785 (drv->capa.flags & WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD)) {
2788 ret = issue_key_mgmt_set_key(drv, key, key_len);
2794 msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_DEL_KEY);
2803 msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_NEW_KEY);
2842 ret = send_and_recv_msgs(drv, msg, NULL, key ? (void *) -1 : NULL);
2855 if (is_ap_interface(drv->nlmode) && addr &&
2859 msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_SET_KEY);
2887 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
2991 int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv,
2998 if (!(msg = nl80211_drv_msg(drv, 0, cmd)) ||
3007 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
3009 wpa_dbg(drv->ctx, MSG_DEBUG,
3017 static int wpa_driver_nl80211_disconnect(struct wpa_driver_nl80211_data *drv,
3023 nl80211_mark_disconnected(drv);
3025 ret = wpa_driver_nl80211_mlme(drv, NULL, NL80211_CMD_DISCONNECT,
3031 drv->ignore_next_local_disconnect = ret == 0;
3040 struct wpa_driver_nl80211_data *drv = bss->drv;
3043 if (drv->nlmode == NL80211_IFTYPE_ADHOC) {
3044 nl80211_mark_disconnected(drv);
3045 return nl80211_leave_ibss(drv, 1);
3047 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME))
3048 return wpa_driver_nl80211_disconnect(drv, reason_code);
3051 nl80211_mark_disconnected(drv);
3052 ret = wpa_driver_nl80211_mlme(drv, addr, NL80211_CMD_DEAUTHENTICATE,
3058 drv->ignore_next_local_deauth = ret == 0;
3063 static void nl80211_copy_auth_params(struct wpa_driver_nl80211_data *drv,
3068 drv->auth_freq = params->freq;
3069 drv->auth_alg = params->auth_alg;
3070 drv->auth_wep_tx_keyidx = params->wep_tx_keyidx;
3071 drv->auth_local_state_change = params->local_state_change;
3072 drv->auth_p2p = params->p2p;
3075 os_memcpy(drv->auth_bssid_, params->bssid, ETH_ALEN);
3077 os_memset(drv->auth_bssid_, 0, ETH_ALEN);
3080 os_memcpy(drv->auth_ssid, params->ssid, params->ssid_len);
3081 drv->auth_ssid_len = params->ssid_len;
3083 drv->auth_ssid_len = 0;
3086 os_free(drv->auth_ie);
3087 drv->auth_ie = NULL;
3088 drv->auth_ie_len = 0;
3090 drv->auth_ie = os_malloc(params->ie_len);
3091 if (drv->auth_ie) {
3092 os_memcpy(drv->auth_ie, params->ie, params->ie_len);
3093 drv->auth_ie_len = params->ie_len;
3100 os_memcpy(drv->auth_wep_key[i], params->wep_key[i],
3102 drv->auth_wep_key_len[i] = params->wep_key_len[i];
3104 drv->auth_wep_key_len[i] = 0;
3111 struct wpa_driver_nl80211_data *drv = bss->drv;
3113 if (is_p2p_net_interface(drv->nlmode) || !drv->disabled_11b_rates)
3124 nl80211_disable_11b_rates(drv, drv->ifindex, 0);
3131 struct wpa_driver_nl80211_data *drv = bss->drv;
3141 is_retry = drv->retry_auth;
3142 drv->retry_auth = 0;
3143 drv->ignore_deauth_event = 0;
3145 nl80211_mark_disconnected(drv);
3146 os_memset(drv->auth_bssid, 0, ETH_ALEN);
3148 os_memcpy(drv->auth_attempt_bssid, params->bssid, ETH_ALEN);
3150 os_memset(drv->auth_attempt_bssid, 0, ETH_ALEN);
3154 if (drv->nlmode != nlmode &&
3160 drv->ifindex);
3162 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_AUTHENTICATE);
3233 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
3236 wpa_dbg(drv->ctx, MSG_DEBUG,
3249 drv->ignore_deauth_event = 1;
3281 nl80211_copy_auth_params(drv, params);
3282 drv->scan_for_auth = 1;
3293 os_memcpy(event.timeout_event.addr, drv->auth_bssid_,
3295 wpa_supplicant_event(drv->ctx, EVENT_AUTH_TIMED_OUT,
3309 int wpa_driver_nl80211_authenticate_retry(struct wpa_driver_nl80211_data *drv)
3312 struct i802_bss *bss = drv->first_bss;
3318 params.freq = drv->auth_freq;
3319 params.auth_alg = drv->auth_alg;
3320 params.wep_tx_keyidx = drv->auth_wep_tx_keyidx;
3321 params.local_state_change = drv->auth_local_state_change;
3322 params.p2p = drv->auth_p2p;
3324 if (!is_zero_ether_addr(drv->auth_bssid_))
3325 params.bssid = drv->auth_bssid_;
3327 if (drv->auth_ssid_len) {
3328 params.ssid = drv->auth_ssid;
3329 params.ssid_len = drv->auth_ssid_len;
3332 params.ie = drv->auth_ie;
3333 params.ie_len = drv->auth_ie_len;
3336 if (drv->auth_wep_key_len[i]) {
3337 params.wep_key[i] = drv->auth_wep_key[i];
3338 params.wep_key_len[i] = drv->auth_wep_key_len[i];
3342 drv->retry_auth = 1;
3355 struct wpa_driver_nl80211_data *drv = bss->drv;
3359 if (freq == 0 && drv->nlmode == NL80211_IFTYPE_ADHOC) {
3360 freq = nl80211_get_assoc_freq(drv);
3371 if (drv->use_monitor) {
3374 return nl80211_send_monitor(drv, data, len, encrypt, noack);
3392 drv->send_action_cookie,
3394 drv->send_action_cookie = cookie;
3410 struct wpa_driver_nl80211_data *drv = bss->drv;
3420 fc, fc2str(fc), drv->nlmode);
3422 if ((is_sta_interface(drv->nlmode) ||
3423 drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) &&
3433 drv->last_mgmt_freq);
3434 freq = drv->last_mgmt_freq;
3441 if (drv->device_ap_sme && is_ap_interface(drv->nlmode)) {
3451 &drv->send_action_cookie,
3498 struct wpa_driver_nl80211_data *drv = bss->drv;
3517 return send_and_recv_msgs(drv, msg, NULL, NULL);
3525 struct wpa_driver_nl80211_data *drv = bss->drv;
3531 if (!(drv->capa.max_acl_mac_addrs))
3534 if (params->num_mac_acl > drv->capa.max_acl_mac_addrs)
3550 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_SET_MAC_ACL)) ||
3561 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
3599 struct wpa_driver_nl80211_data *drv = bss->drv;
3603 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_SET_MESH_CONFIG);
3613 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
3723 struct wpa_driver_nl80211_data *drv = bss->drv;
3738 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
3770 struct wpa_driver_nl80211_data *drv = bss->drv;
3789 else if (!drv->device_ap_sme && !drv->use_monitor &&
3810 nl80211_put_beacon_rate(msg, drv->capa.flags, params) ||
3950 if (drv->capa.flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER) {
3960 if (drv->p2p_go_ctwindow_supported) {
3979 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
4017 if (is_mesh_interface(drv->nlmode) && params->ht_opmode != -1) {
4114 struct wpa_driver_nl80211_data *drv = bss->drv;
4123 msg = nl80211_drv_msg(drv, 0, set_chan ? NL80211_CMD_SET_CHANNEL :
4130 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
4195 struct wpa_driver_nl80211_data *drv = bss->drv;
4201 !(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT))
4220 drv->capa.flags) &&
4260 if (is_ap_interface(drv->nlmode) &&
4294 } else if (FULL_AP_CLIENT_STATE_SUPP(drv->capa.flags) &&
4348 if (!is_mesh_interface(drv->nlmode)) {
4349 if (!FULL_AP_CLIENT_STATE_SUPP(drv->capa.flags)) {
4398 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
4415 struct wpa_driver_nl80211_data *drv = bss->drv;
4433 err = rtnl_neigh_delete(drv->rtnl_sk, rn, 0);
4452 struct wpa_driver_nl80211_data *drv = bss->drv;
4470 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
4475 if (drv->rtnl_sk)
4484 void nl80211_remove_iface(struct wpa_driver_nl80211_data *drv, int ifidx)
4492 dl_list_for_each(drv2, &drv->global->interfaces,
4500 msg = nl80211_ifindex_msg(drv, ifidx, 0, NL80211_CMD_DEL_INTERFACE);
4501 if (send_and_recv_msgs(drv, msg, NULL, NULL) == 0)
4536 static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv,
4550 msg = nl80211_cmd_msg(drv->first_bss, 0, NL80211_CMD_NEW_INTERFACE);
4577 ret = send_and_recv_msgs(drv, msg, handler, arg);
4601 if (drv->hostapd ||
4606 add_ifidx(drv, ifidx, IFIDX_ANY);
4610 linux_set_ifhwaddr(drv->global->ioctl_sock, ifname, addr)) {
4611 nl80211_remove_iface(drv, ifidx);
4619 int nl80211_create_iface(struct wpa_driver_nl80211_data *drv,
4627 ret = nl80211_create_iface_once(drv, ifname, iftype, addr, wds, handler,
4636 linux_set_ifhwaddr(drv->global->ioctl_sock, ifname,
4638 (linux_set_iface_flags(drv->global->ioctl_sock,
4640 linux_set_ifhwaddr(drv->global->ioctl_sock, ifname,
4642 linux_set_iface_flags(drv->global->ioctl_sock,
4650 nl80211_remove_iface(drv, if_nametoindex(ifname));
4653 ret = nl80211_create_iface_once(drv, ifname, iftype, addr,
4661 nl80211_disable_11b_rates(drv, ret, 1);
4670 struct wpa_driver_nl80211_data *drv = bss->drv;
4673 bss->ifname, drv->device_ap_sme, drv->use_monitor);
4680 if (!drv->device_ap_sme)
4683 if (!drv->device_ap_sme && !drv->use_monitor)
4687 if (drv->device_ap_sme && !drv->use_monitor)
4692 if (!drv->device_ap_sme && drv->use_monitor &&
4693 nl80211_create_monitor_interface(drv) &&
4694 !drv->device_ap_sme)
4697 if (drv->device_ap_sme &&
4710 struct wpa_driver_nl80211_data *drv = bss->drv;
4713 bss->ifname, drv->device_ap_sme, drv->use_monitor);
4714 if (drv->device_ap_sme) {
4716 if (!drv->use_monitor)
4718 } else if (drv->use_monitor)
4719 nl80211_remove_monitor_interface(drv);
4735 if (bss->drv->eapol_tx_sock < 0) {
4746 ret = sendto(bss->drv->eapol_tx_sock, data, data_len, 0,
4763 struct wpa_driver_nl80211_data *drv = bss->drv;
4770 if (drv->device_ap_sme || !drv->use_monitor)
4868 return send_and_recv_msgs(bss->drv, msg, NULL, NULL);
4875 static int wpa_driver_nl80211_ap(struct wpa_driver_nl80211_data *drv,
4887 old_mode = drv->nlmode;
4888 if (wpa_driver_nl80211_set_mode(drv->first_bss, nlmode)) {
4889 nl80211_remove_monitor_interface(drv);
4894 nl80211_set_channel(drv->first_bss, ¶ms->freq, 0)) {
4896 wpa_driver_nl80211_set_mode(drv->first_bss, old_mode);
4897 nl80211_remove_monitor_interface(drv);
4905 static int nl80211_leave_ibss(struct wpa_driver_nl80211_data *drv,
4911 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_LEAVE_IBSS);
4912 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
4922 wpa_driver_nl80211_set_mode(drv->first_bss,
4974 static int wpa_driver_nl80211_ibss(struct wpa_driver_nl80211_data *drv,
4981 wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
4983 if (wpa_driver_nl80211_set_mode_ibss(drv->first_bss, ¶ms->freq)) {
4990 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_JOIN_IBSS)) ||
4991 params->ssid == NULL || params->ssid_len > sizeof(drv->ssid))
4998 os_memcpy(drv->ssid, params->ssid, params->ssid_len);
4999 drv->ssid_len = params->ssid_len;
5044 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
5053 nl80211_leave_ibss(drv, 0);
5068 static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
5095 drv->assoc_freq = params->freq.freq;
5097 drv->assoc_freq = 0;
5120 if (params->ssid_len > sizeof(drv->ssid))
5122 os_memcpy(drv->ssid, params->ssid, params->ssid_len);
5123 drv->ssid_len = params->ssid_len;
5153 !(drv->capa.enc & WPA_DRIVER_CAPA_ENC_GTK_NOT_USED)) {
5232 u32 drv_rrm_flags = drv->capa.rrm_flags;
5253 drv->connect_reassoc = 0;
5260 drv->connect_reassoc = 1;
5268 struct wpa_driver_nl80211_data *drv,
5282 ret = issue_key_mgmt_set_key(drv, params->psk, 32);
5288 wpa_printf(MSG_DEBUG, "nl80211: Connect (ifindex=%d)", drv->ifindex);
5289 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_CONNECT);
5293 ret = nl80211_connect_common(drv, params, msg);
5330 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
5348 struct wpa_driver_nl80211_data *drv,
5355 os_memcpy(drv->auth_attempt_bssid, params->bssid, ETH_ALEN);
5357 os_memset(drv->auth_attempt_bssid, 0, ETH_ALEN);
5359 drv, params);
5370 drv, WLAN_REASON_PREV_AUTH_NOT_VALID))
5372 ret = wpa_driver_nl80211_try_connect(drv, params);
5382 struct wpa_driver_nl80211_data *drv = bss->drv;
5389 return wpa_driver_nl80211_ap(drv, params);
5392 return wpa_driver_nl80211_ibss(drv, params);
5394 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME)) {
5400 return wpa_driver_nl80211_connect(drv, params);
5403 nl80211_mark_disconnected(drv);
5406 drv->ifindex);
5407 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_ASSOCIATE);
5411 ret = nl80211_connect_common(drv, params, msg);
5431 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
5434 wpa_dbg(drv->ctx, MSG_DEBUG,
5437 nl80211_dump_scan(drv);
5449 static int nl80211_set_mode(struct wpa_driver_nl80211_data *drv,
5458 msg = nl80211_cmd_msg(drv->first_bss, 0, NL80211_CMD_SET_INTERFACE);
5462 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
5479 struct wpa_driver_nl80211_data *drv = bss->drv;
5482 int was_ap = is_ap_interface(drv->nlmode);
5489 mode_switch_res = nl80211_set_mode(drv, drv->ifindex, nlmode);
5494 drv->nlmode = nlmode;
5502 if (nlmode == drv->nlmode) {
5539 mode_switch_res = nl80211_set_mode(drv, drv->ifindex, nlmode);
5553 drv->nlmode = nlmode;
5554 drv->ignore_if_down_event = 1;
5558 res = linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1);
5568 "from %d failed", nlmode, drv->nlmode);
5576 nl80211_disable_11b_rates(drv, drv->ifindex, 1);
5577 } else if (drv->disabled_11b_rates) {
5581 nl80211_disable_11b_rates(drv, drv->ifindex, 0);
5629 struct wpa_driver_nl80211_data *drv = bss->drv;
5631 if (!drv->has_capability)
5633 os_memcpy(capa, &drv->capa, sizeof(*capa));
5634 if (drv->extended_capa && drv->extended_capa_mask) {
5635 capa->extended_capa = drv->extended_capa;
5636 capa->extended_capa_mask = drv->extended_capa_mask;
5637 capa->extended_capa_len = drv->extended_capa_len;
5647 struct wpa_driver_nl80211_data *drv = bss->drv;
5650 bss->ifname, drv->operstate, state,
5652 drv->operstate = state;
5653 return netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, -1,
5661 struct wpa_driver_nl80211_data *drv = bss->drv;
5666 if (!drv->associated && is_zero_ether_addr(drv->bssid) && !authorized) {
5672 MACSTR, authorized ? "" : "un", MAC2STR(drv->bssid));
5680 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, drv->bssid) ||
5686 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
5736 struct wpa_driver_nl80211_data *drv = bss->drv;
5739 msg = nl80211_ifindex_msg(drv, if_nametoindex(iface), 0,
5750 return send_and_recv_msgs(drv, msg, get_key_handler, seq);
5757 struct wpa_driver_nl80211_data *drv = bss->drv;
5767 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_SET_WIPHY)) ||
5773 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
5785 struct wpa_driver_nl80211_data *drv = bss->drv;
5795 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_SET_WIPHY)) ||
5801 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
5823 res = send_and_recv_msgs(bss->drv, msg, NULL, NULL);
5914 return send_and_recv_msgs(bss->drv, msg, get_sta_handler, data);
5922 struct wpa_driver_nl80211_data *drv = bss->drv;
5970 if (send_and_recv_msgs(drv, msg, NULL, NULL) == 0)
5982 struct wpa_driver_nl80211_data *drv = bss->drv;
5997 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
6037 struct wpa_driver_nl80211_data *drv = bss->drv;
6048 if (is_mesh_interface(drv->nlmode))
6051 if (drv->device_ap_sme)
6072 struct wpa_driver_nl80211_data *drv = bss->drv;
6075 if (is_mesh_interface(drv->nlmode))
6078 if (drv->device_ap_sme)
6095 static void dump_ifidx(struct wpa_driver_nl80211_data *drv)
6103 for (i = 0; i < drv->num_if_indices; i++) {
6104 if (!drv->if_indices[i])
6107 drv->if_indices[i],
6108 drv->if_indices_reason[i]);
6116 drv->num_if_indices, buf);
6120 static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
6129 if (have_ifidx(drv, ifidx, ifidx_reason)) {
6134 for (i = 0; i < drv->num_if_indices; i++) {
6135 if (drv->if_indices[i] == 0) {
6136 drv->if_indices[i] = ifidx;
6137 drv->if_indices_reason[i] = ifidx_reason;
6138 dump_ifidx(drv);
6143 if (drv->if_indices != drv->default_if_indices)
6144 old = drv->if_indices;
6148 if (drv->if_indices_reason != drv->default_if_indices_reason)
6149 old_reason = drv->if_indices_reason;
6153 drv->if_indices = os_realloc_array(old, drv->num_if_indices + 1,
6155 drv->if_indices_reason = os_realloc_array(old_reason,
6156 drv->num_if_indices + 1,
6158 if (!drv->if_indices) {
6160 drv->if_indices = drv->default_if_indices;
6162 drv->if_indices = old;
6164 if (!drv->if_indices_reason) {
6166 drv->if_indices_reason = drv->default_if_indices_reason;
6168 drv->if_indices_reason = old_reason;
6170 if (!drv->if_indices || !drv->if_indices_reason) {
6177 os_memcpy(drv->if_indices, drv->default_if_indices,
6178 sizeof(drv->default_if_indices));
6180 os_memcpy(drv->if_indices_reason,
6181 drv->default_if_indices_reason,
6182 sizeof(drv->default_if_indices_reason));
6183 drv->if_indices[drv->num_if_indices] = ifidx;
6184 drv->if_indices_reason[drv->num_if_indices] = ifidx_reason;
6185 drv->num_if_indices++;
6186 dump_ifidx(drv);
6190 static void del_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
6195 for (i = 0; i < drv->num_if_indices; i++) {
6196 if ((drv->if_indices[i] == ifidx || ifidx == IFIDX_ANY) &&
6197 (drv->if_indices_reason[i] == ifidx_reason ||
6199 drv->if_indices[i] = 0;
6203 dump_ifidx(drv);
6207 static int have_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
6212 for (i = 0; i < drv->num_if_indices; i++)
6213 if (drv->if_indices[i] == ifidx &&
6214 (drv->if_indices_reason[i] == ifidx_reason ||
6226 struct wpa_driver_nl80211_data *drv = bss->drv;
6237 if (nl80211_create_iface(drv, name,
6243 linux_br_add_if(drv->global->ioctl_sock,
6247 if (linux_set_iface_flags(drv->global->ioctl_sock, name, 1)) {
6254 linux_br_del_if(drv->global->ioctl_sock, bridge_ifname,
6258 nl80211_remove_iface(drv, if_nametoindex(name));
6266 struct wpa_driver_nl80211_data *drv = eloop_ctx;
6280 if (have_ifidx(drv, lladdr.sll_ifindex, IFIDX_ANY))
6281 drv_event_eapol_rx(drv->ctx, lladdr.sll_addr, buf, len);
6285 static int i802_check_bridge(struct wpa_driver_nl80211_data *drv,
6299 if (linux_br_add(drv->global->ioctl_sock, brname) < 0) {
6307 add_ifidx(drv, br_ifindex, drv->ifindex);
6317 if (linux_br_del_if(drv->global->ioctl_sock, in_br, ifname) <
6329 if (linux_br_add_if(drv->global->ioctl_sock, brname, ifname) < 0) {
6344 struct wpa_driver_nl80211_data *drv;
6357 drv = bss->drv;
6369 add_ifidx(drv, if_nametoindex(master_ifname), drv->ifindex);
6388 add_ifidx(drv, ifindex, drv->ifindex);
6395 add_ifidx(drv, drv->ifindex, IFIDX_ANY);
6398 if (i802_check_bridge(drv, bss, params->bridge[0],
6407 add_ifidx(drv, br_ifindex, drv->ifindex);
6411 drv->rtnl_sk = nl_socket_alloc();
6412 if (drv->rtnl_sk == NULL) {
6417 if (nl_connect(drv->rtnl_sk, NETLINK_ROUTE)) {
6425 drv->eapol_sock = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_PAE));
6426 if (drv->eapol_sock < 0) {
6432 if (eloop_register_read_sock(drv->eapol_sock, handle_eapol, drv, NULL))
6438 if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname,
6441 os_memcpy(drv->perm_addr, params->own_addr, ETH_ALEN);
6487 struct wpa_driver_nl80211_data *drv;
6488 dl_list_for_each(drv, &global->interfaces,
6490 if (os_memcmp(addr, drv->first_bss->addr, ETH_ALEN) == 0)
6497 static int nl80211_vif_addr(struct wpa_driver_nl80211_data *drv, u8 *new_addr)
6501 if (!drv->global)
6504 os_memcpy(new_addr, drv->first_bss->addr, ETH_ALEN);
6506 new_addr[0] = drv->first_bss->addr[0] | 0x02;
6508 if (!nl80211_addr_in_use(drv->global, new_addr))
6557 struct wpa_driver_nl80211_data *drv = bss->drv;
6568 ifidx = nl80211_create_iface(drv, ifname, nlmode, addr,
6577 drv->global->if_add_wdevid = p2pdev_info.wdev_id;
6578 drv->global->if_add_wdevid_set = p2pdev_info.wdev_id_set;
6585 ifidx = nl80211_create_iface(drv, ifname, nlmode, addr,
6598 else if (linux_get_ifhwaddr(drv->global->ioctl_sock,
6601 nl80211_remove_iface(drv, ifidx);
6613 if (linux_get_ifhwaddr(drv->global->ioctl_sock, ifname,
6616 nl80211_remove_iface(drv, ifidx);
6619 if (nl80211_addr_in_use(drv->global, new_addr)) {
6622 if (nl80211_vif_addr(drv, new_addr) < 0) {
6624 nl80211_remove_iface(drv, ifidx);
6627 if (linux_set_ifhwaddr(drv->global->ioctl_sock, ifname,
6630 nl80211_remove_iface(drv, ifidx);
6641 nl80211_remove_iface(drv, ifidx);
6646 i802_check_bridge(drv, new_bss, bridge, ifname) < 0) {
6651 nl80211_remove_iface(drv, ifidx);
6656 if (linux_set_iface_flags(drv->global->ioctl_sock, ifname, 1))
6659 nl80211_remove_iface(drv, ifidx);
6666 new_bss->drv = drv;
6667 new_bss->next = drv->first_bss->next;
6668 new_bss->freq = drv->first_bss->freq;
6671 drv->first_bss->next = new_bss;
6681 if (drv->global)
6682 drv->global->if_add_ifindex = ifidx;
6689 (drv->hostapd ||
6693 add_ifidx(drv, ifidx, IFIDX_ANY);
6703 struct wpa_driver_nl80211_data *drv = bss->drv;
6709 nl80211_remove_iface(drv, ifindex);
6712 dl_list_for_each(drv2, &drv->global->interfaces,
6723 if (linux_br_del_if(drv->global->ioctl_sock, bss->brname,
6730 if (linux_br_del(drv->global->ioctl_sock, bss->brname) < 0)
6736 if (bss != drv->first_bss) {
6740 for (tbss = drv->first_bss; tbss; tbss = tbss->next) {
6759 if (!bss->added_if && !drv->first_bss->next)
6764 if (drv->first_bss->next) {
6765 drv->first_bss = drv->first_bss->next;
6766 drv->ctx = drv->first_bss->ctx;
6797 struct wpa_driver_nl80211_data *drv = bss->drv;
6810 (offchanok && ((drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) ||
6811 drv->test_use_roc_tx) &&
6821 ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie);
6835 if (drv->num_send_action_cookies == MAX_SEND_ACTION_COOKIES) {
6839 drv->send_action_cookies[0]);
6840 os_memmove(&drv->send_action_cookies[0],
6841 &drv->send_action_cookies[1],
6844 drv->num_send_action_cookies--;
6846 drv->send_action_cookies[drv->num_send_action_cookies] = cookie;
6847 drv->num_send_action_cookies++;
6864 struct wpa_driver_nl80211_data *drv = bss->drv;
6871 drv->ifindex, freq, wait_time, no_cck);
6892 if (is_ap_interface(drv->nlmode) &&
6893 (!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) ||
6894 (int) freq == bss->freq || drv->device_ap_sme ||
6895 !drv->use_monitor))
6902 &drv->send_action_cookie,
6912 struct wpa_driver_nl80211_data *drv = bss->drv;
6924 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
6934 struct wpa_driver_nl80211_data *drv = bss->drv;
6939 nl80211_frame_wait_cancel(bss, drv->send_action_cookie);
6946 for (i = drv->num_send_action_cookies; i > 0; i--) {
6947 cookie = drv->send_action_cookies[i - 1];
6948 if (cookie != drv->send_action_cookie)
6951 drv->num_send_action_cookies = 0;
6959 struct wpa_driver_nl80211_data *drv = bss->drv;
6972 ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie);
6977 drv->remain_on_chan_cookie = cookie;
6978 drv->pending_remain_on_chan = 1;
6991 struct wpa_driver_nl80211_data *drv = bss->drv;
6995 if (!drv->pending_remain_on_chan) {
7003 (long long unsigned int) drv->remain_on_chan_cookie);
7007 nla_put_u64(msg, NL80211_ATTR_COOKIE, drv->remain_on_chan_cookie)) {
7012 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
7023 struct wpa_driver_nl80211_data *drv = bss->drv;
7026 if (bss->nl_preq && drv->device_ap_sme &&
7027 is_ap_interface(drv->nlmode) && !bss->in_deinit &&
7050 bss->nl_preq = nl_create_handle(drv->global->nl_cb, "preq");
7074 static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv,
7086 msg = nl80211_ifindex_msg(drv, ifindex, 0,
7109 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
7114 drv->disabled_11b_rates = disabled;
7127 struct wpa_driver_nl80211_data *drv = bss->drv;
7128 if (!is_ap_interface(drv->nlmode))
7137 if (drv->nlmode == NL80211_IFTYPE_P2P_GO && bss->if_dynamic)
7147 struct wpa_driver_nl80211_data *drv = bss->drv;
7148 if (!is_ap_interface(drv->nlmode))
7159 struct wpa_driver_nl80211_data *drv = bss->drv;
7160 if (drv->nlmode != NL80211_IFTYPE_P2P_CLIENT)
7183 nl80211_disable_11b_rates(bss->drv, bss->drv->ifindex, 1);
7190 struct wpa_driver_nl80211_data *drv = bss->drv;
7206 return send_and_recv_msgs(drv, msg, NULL, NULL);
7238 static int nl80211_get_channel_width(struct wpa_driver_nl80211_data *drv,
7243 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_GET_INTERFACE);
7244 return send_and_recv_msgs(drv, msg, get_channel_width, sig);
7251 struct wpa_driver_nl80211_data *drv = bss->drv;
7255 res = nl80211_get_link_signal(drv, si);
7257 if (drv->nlmode != NL80211_IFTYPE_ADHOC &&
7258 drv->nlmode != NL80211_IFTYPE_MESH_POINT)
7263 res = nl80211_get_channel_width(drv, si);
7267 return nl80211_get_link_noise(drv, si);
7283 struct wpa_driver_nl80211_data *drv = bss->drv;
7293 drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CONCURRENT;
7294 drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P;
7299 drv->use_monitor = 1;
7302 drv->capa.flags &= ~WPA_DRIVER_FLAGS_SME;
7303 drv->force_connect_cmd = 1;
7307 drv->capa.flags |= WPA_DRIVER_FLAGS_BSS_SELECTION;
7310 drv->capa.flags &= ~WPA_DRIVER_FLAGS_OFFCHANNEL_TX;
7311 drv->test_use_roc_tx = 1;
7393 struct wpa_driver_nl80211_data *drv = bss->drv;
7394 return drv->phyname;
7410 return send_and_recv_msgs(bss->drv, msg, NULL, NULL);
7579 struct wpa_driver_nl80211_data *drv = bss->drv;
7590 msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_GET_SURVEY);
7599 err = send_and_recv_msgs(drv, msg, survey_handler,
7606 wpa_supplicant_event(drv->ctx, EVENT_SURVEY, &data);
7618 struct wpa_driver_nl80211_data *drv = bss->drv;
7623 if (!drv->set_rekey_offload)
7640 ret = send_and_recv_msgs(drv, msg, NULL, (void *) -1);
7644 drv->set_rekey_offload = 0;
7691 struct wpa_driver_nl80211_data *drv = bss->drv;
7695 if (!drv->poll_command_supported) {
7706 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
7725 return send_and_recv_msgs(bss->drv, msg, NULL, NULL);
7758 struct wpa_driver_nl80211_data *drv = bss->drv;
7766 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_RADAR)) {
7772 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_RADAR_DETECT)) ||
7778 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
7794 struct wpa_driver_nl80211_data *drv = bss->drv;
7797 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT))
7803 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_TDLS_MGMT)) ||
7825 return send_and_recv_msgs(drv, msg, NULL, NULL);
7836 struct wpa_driver_nl80211_data *drv = bss->drv;
7841 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT))
7868 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_TDLS_OPER)) ||
7875 res = send_and_recv_msgs(drv, msg, NULL, NULL);
7888 struct wpa_driver_nl80211_data *drv = bss->drv;
7892 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT) ||
7893 !(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_CHANNEL_SWITCH))
7909 return send_and_recv_msgs(drv, msg, NULL, NULL);
7917 struct wpa_driver_nl80211_data *drv = bss->drv;
7920 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT) ||
7921 !(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_CHANNEL_SWITCH))
7935 return send_and_recv_msgs(drv, msg, NULL, NULL);
7958 struct wpa_driver_nl80211_data *drv = bss->drv;
7967 if (drv->scan_vendor_cmd_avail && !params->only_new_results)
8069 struct wpa_driver_nl80211_data *drv = bss->drv;
8073 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_UPDATE_FT_IES)) ||
8080 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
8093 struct wpa_driver_nl80211_data *drv = bss->drv;
8095 if (drv->nlmode != NL80211_IFTYPE_P2P_DEVICE)
8130 struct wpa_driver_nl80211_data *drv = bss->drv;
8185 drv->phyname,
8186 MAC2STR(drv->perm_addr),
8187 drv->ifindex,
8188 drv->operstate,
8189 scan_state_str(drv->scan_state),
8190 MAC2STR(drv->auth_bssid),
8191 MAC2STR(drv->auth_attempt_bssid),
8192 MAC2STR(drv->bssid),
8193 MAC2STR(drv->prev_bssid),
8194 drv->associated,
8195 drv->assoc_freq,
8196 drv->monitor_sock,
8197 drv->monitor_ifidx,
8198 drv->monitor_refcount,
8199 drv->last_mgmt_freq,
8200 drv->eapol_tx_sock,
8201 drv->ignore_if_down_event ?
8203 drv->scan_complete_events ?
8205 drv->disabled_11b_rates ?
8207 drv->pending_remain_on_chan ?
8209 drv->in_interface_list ? "in_interface_list=1\n" : "",
8210 drv->device_ap_sme ? "device_ap_sme=1\n" : "",
8211 drv->poll_command_supported ?
8213 drv->data_tx_status ? "data_tx_status=1\n" : "",
8214 drv->scan_for_auth ? "scan_for_auth=1\n" : "",
8215 drv->retry_auth ? "retry_auth=1\n" : "",
8216 drv->use_monitor ? "use_monitor=1\n" : "",
8217 drv->ignore_next_local_disconnect ?
8219 drv->ignore_next_local_deauth ?
8225 if (drv->has_capability) {
8249 drv->capa.key_mgmt,
8250 drv->capa.enc,
8251 drv->capa.auth,
8252 (unsigned long long) drv->capa.flags,
8253 drv->capa.rrm_flags,
8254 drv->capa.max_scan_ssids,
8255 drv->capa.max_sched_scan_ssids,
8256 drv->capa.sched_scan_supported,
8257 drv->capa.max_match_sets,
8258 drv->capa.max_remain_on_chan,
8259 drv->capa.max_stations,
8260 drv->capa.probe_resp_offloads,
8261 drv->capa.max_acl_mac_addrs,
8262 drv->capa.num_multichan_concurrent,
8263 drv->capa.mac_addr_rand_sched_scan_supported,
8264 drv->capa.mac_addr_rand_scan_supported,
8265 drv->capa.conc_capab,
8266 drv->capa.max_conc_chan_2_4,
8267 drv->capa.max_conc_chan_5_0,
8268 drv->capa.max_sched_scan_plans,
8269 drv->capa.max_sched_scan_plan_interval,
8270 drv->capa.max_sched_scan_plan_iterations);
8310 struct wpa_driver_nl80211_data *drv = bss->drv;
8322 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_AP_CSA)) {
8327 if ((drv->nlmode != NL80211_IFTYPE_AP) &&
8328 (drv->nlmode != NL80211_IFTYPE_P2P_GO))
8355 if (drv->capa.max_csa_counters &&
8356 csa_off_len > drv->capa.max_csa_counters) {
8414 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
8434 struct wpa_driver_nl80211_data *drv = bss->drv;
8442 if (!is_sta_interface(drv->nlmode))
8455 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
8466 struct wpa_driver_nl80211_data *drv = bss->drv;
8472 if (!is_sta_interface(drv->nlmode))
8482 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
8548 struct wpa_driver_nl80211_data *drv = bss->drv;
8558 nl80211_cmd(drv, msg, 0, subcmd);
8562 ret = send_and_recv_msgs(drv, msg, cmd_reply_handler, buf);
8577 ret = send_and_recv_msgs(drv, msg, vendor_reply_handler, buf);
8593 struct wpa_driver_nl80211_data *drv = bss->drv;
8600 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_SET_QOS_MAP)) ||
8606 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
8618 struct wpa_driver_nl80211_data *drv = bss->drv;
8648 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
8660 struct wpa_driver_nl80211_data *drv = bss->drv;
8666 if (!drv->roaming_vendor_cmd_avail) {
8672 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
8687 return send_and_recv_msgs(drv, msg, NULL, NULL);
8695 struct wpa_driver_nl80211_data *drv = bss->drv;
8702 addr = drv->perm_addr;
8704 if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 0) < 0)
8707 if (linux_set_ifhwaddr(drv->global->ioctl_sock, bss->ifname, addr) < 0)
8712 if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname,
8722 drv->addr_changed = new_addr;
8725 if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1) < 0)
8804 struct wpa_driver_nl80211_data *drv = bss->drv;
8809 wpa_printf(MSG_DEBUG, "nl80211: mesh join (ifindex=%d)", drv->ifindex);
8810 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_JOIN_MESH);
8851 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
8859 drv->assoc_freq = bss->freq = params->freq.freq;
8902 struct wpa_driver_nl80211_data *drv = bss->drv;
8906 wpa_printf(MSG_DEBUG, "nl80211: mesh leave (ifindex=%d)", drv->ifindex);
8907 msg = nl80211_drv_msg(drv, 0, NL80211_CMD_LEAVE_MESH);
8908 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
8917 if (wpa_driver_nl80211_set_mode(drv->first_bss,
8934 struct wpa_driver_nl80211_data *drv = bss->drv;
8950 if (!drv->rtnl_sk) {
8997 res = rtnl_neigh_add(drv->rtnl_sk, rn, NLM_F_CREATE);
9022 struct wpa_driver_nl80211_data *drv = bss->drv;
9047 if (!drv->rtnl_sk) {
9073 res = rtnl_neigh_delete(drv->rtnl_sk, rn, 0);
9244 struct wpa_driver_nl80211_data *drv = bss->drv;
9254 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
9282 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
9295 struct wpa_driver_nl80211_data *drv = bss->drv;
9301 if (!drv->setband_vendor_cmd_avail)
9318 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
9329 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
9407 struct wpa_driver_nl80211_data *drv = bss->drv;
9415 if (!drv->get_pref_freq_list)
9444 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
9445 nla_put_u32(msg, NL80211_ATTR_IFINDEX, drv->ifindex) ||
9462 ret = send_and_recv_msgs(drv, msg, preferred_freq_info_handler, ¶m);
9483 struct wpa_driver_nl80211_data *drv = bss->drv;
9488 if (!drv->set_prob_oper_freq)
9495 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
9514 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
9533 struct wpa_driver_nl80211_data *drv = bss->drv;
9542 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_P2P_LISTEN_OFFLOAD))
9545 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
9570 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
9589 struct wpa_driver_nl80211_data *drv = bss->drv;
9594 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_P2P_LISTEN_OFFLOAD))
9597 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
9605 return send_and_recv_msgs(drv, msg, NULL, NULL);
9612 struct wpa_driver_nl80211_data *drv = bss->drv;
9628 if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
9644 ret = send_and_recv_msgs(drv, msg, NULL, NULL);
9757 struct wpa_driver_nl80211_data *drv = bss->drv;
9767 *ext_capa = drv->extended_capa;
9768 *ext_capa_mask = drv->extended_capa_mask;
9769 *ext_capa_len = drv->extended_capa_len;
9772 for (i = 0; i < drv->num_iface_ext_capa; i++) {
9773 if (nlmode == drv->iface_ext_capa[i].iftype) {
9774 *ext_capa = drv->iface_ext_capa[i].ext_capa;
9775 *ext_capa_mask = drv->iface_ext_capa[i].ext_capa_mask;
9776 *ext_capa_len = drv->iface_ext_capa[i].ext_capa_len;