Lines Matching refs:drv

37 static int wpa_driver_wext_finish_drv_init(struct wpa_driver_wext_data *drv);
38 static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv);
42 int wpa_driver_wext_set_auth_param(struct wpa_driver_wext_data *drv, in wpa_driver_wext_set_auth_param() argument
49 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_set_auth_param()
53 if (ioctl(drv->ioctl_sock, SIOCSIWAUTH, &iwr) < 0) { in wpa_driver_wext_set_auth_param()
74 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_get_bssid() local
79 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_get_bssid()
81 if (ioctl(drv->ioctl_sock, SIOCGIWAP, &iwr) < 0) { in wpa_driver_wext_get_bssid()
99 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_set_bssid() local
104 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_set_bssid()
111 if (ioctl(drv->ioctl_sock, SIOCSIWAP, &iwr) < 0) { in wpa_driver_wext_set_bssid()
128 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_get_ssid() local
133 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_get_ssid()
137 if (ioctl(drv->ioctl_sock, SIOCGIWESSID, &iwr) < 0) { in wpa_driver_wext_get_ssid()
150 drv->we_version_compiled < 21) in wpa_driver_wext_get_ssid()
167 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_set_ssid() local
176 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_set_ssid()
182 if (drv->we_version_compiled < 21) { in wpa_driver_wext_set_ssid()
196 if (ioctl(drv->ioctl_sock, SIOCSIWESSID, &iwr) < 0) { in wpa_driver_wext_set_ssid()
214 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_set_freq() local
219 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_set_freq()
223 if (ioctl(drv->ioctl_sock, SIOCSIWFREQ, &iwr) < 0) { in wpa_driver_wext_set_freq()
330 struct wpa_driver_wext_data *drv, const char *ev, size_t len) in wpa_driver_wext_event_wireless_pmkidcand() argument
350 wpa_supplicant_event(drv->ctx, EVENT_PMKID_CANDIDATE, &data); in wpa_driver_wext_event_wireless_pmkidcand()
357 struct wpa_driver_wext_data *drv, const char *ev, int len) in wpa_driver_wext_event_wireless_assocreqie() argument
364 os_free(drv->assoc_req_ies); in wpa_driver_wext_event_wireless_assocreqie()
365 drv->assoc_req_ies = os_malloc(len); in wpa_driver_wext_event_wireless_assocreqie()
366 if (drv->assoc_req_ies == NULL) { in wpa_driver_wext_event_wireless_assocreqie()
367 drv->assoc_req_ies_len = 0; in wpa_driver_wext_event_wireless_assocreqie()
370 os_memcpy(drv->assoc_req_ies, ev, len); in wpa_driver_wext_event_wireless_assocreqie()
371 drv->assoc_req_ies_len = len; in wpa_driver_wext_event_wireless_assocreqie()
378 struct wpa_driver_wext_data *drv, const char *ev, int len) in wpa_driver_wext_event_wireless_assocrespie() argument
385 os_free(drv->assoc_resp_ies); in wpa_driver_wext_event_wireless_assocrespie()
386 drv->assoc_resp_ies = os_malloc(len); in wpa_driver_wext_event_wireless_assocrespie()
387 if (drv->assoc_resp_ies == NULL) { in wpa_driver_wext_event_wireless_assocrespie()
388 drv->assoc_resp_ies_len = 0; in wpa_driver_wext_event_wireless_assocrespie()
391 os_memcpy(drv->assoc_resp_ies, ev, len); in wpa_driver_wext_event_wireless_assocrespie()
392 drv->assoc_resp_ies_len = len; in wpa_driver_wext_event_wireless_assocrespie()
398 static void wpa_driver_wext_event_assoc_ies(struct wpa_driver_wext_data *drv) in wpa_driver_wext_event_assoc_ies() argument
402 if (drv->assoc_req_ies == NULL && drv->assoc_resp_ies == NULL) in wpa_driver_wext_event_assoc_ies()
406 if (drv->assoc_req_ies) { in wpa_driver_wext_event_assoc_ies()
407 data.assoc_info.req_ies = drv->assoc_req_ies; in wpa_driver_wext_event_assoc_ies()
408 data.assoc_info.req_ies_len = drv->assoc_req_ies_len; in wpa_driver_wext_event_assoc_ies()
410 if (drv->assoc_resp_ies) { in wpa_driver_wext_event_assoc_ies()
411 data.assoc_info.resp_ies = drv->assoc_resp_ies; in wpa_driver_wext_event_assoc_ies()
412 data.assoc_info.resp_ies_len = drv->assoc_resp_ies_len; in wpa_driver_wext_event_assoc_ies()
415 wpa_supplicant_event(drv->ctx, EVENT_ASSOCINFO, &data); in wpa_driver_wext_event_assoc_ies()
417 os_free(drv->assoc_req_ies); in wpa_driver_wext_event_assoc_ies()
418 drv->assoc_req_ies = NULL; in wpa_driver_wext_event_assoc_ies()
419 os_free(drv->assoc_resp_ies); in wpa_driver_wext_event_assoc_ies()
420 drv->assoc_resp_ies = NULL; in wpa_driver_wext_event_assoc_ies()
424 static void wpa_driver_wext_event_wireless(struct wpa_driver_wext_data *drv, in wpa_driver_wext_event_wireless() argument
443 if (drv->we_version_compiled > 18 && in wpa_driver_wext_event_wireless()
469 os_free(drv->assoc_req_ies); in wpa_driver_wext_event_wireless()
470 drv->assoc_req_ies = NULL; in wpa_driver_wext_event_wireless()
471 os_free(drv->assoc_resp_ies); in wpa_driver_wext_event_wireless()
472 drv->assoc_resp_ies = NULL; in wpa_driver_wext_event_wireless()
473 wpa_supplicant_event(drv->ctx, EVENT_DISASSOC, in wpa_driver_wext_event_wireless()
477 wpa_driver_wext_event_assoc_ies(drv); in wpa_driver_wext_event_wireless()
478 wpa_supplicant_event(drv->ctx, EVENT_ASSOC, in wpa_driver_wext_event_wireless()
489 drv->ctx, custom, iwe->u.data.length); in wpa_driver_wext_event_wireless()
500 wpa_driver_wext_event_wireless_custom(drv->ctx, buf); in wpa_driver_wext_event_wireless()
504 drv->scan_complete_events = 1; in wpa_driver_wext_event_wireless()
506 drv, drv->ctx); in wpa_driver_wext_event_wireless()
507 wpa_supplicant_event(drv->ctx, EVENT_SCAN_RESULTS, in wpa_driver_wext_event_wireless()
517 drv, custom, iwe->u.data.length); in wpa_driver_wext_event_wireless()
526 drv, custom, iwe->u.data.length); in wpa_driver_wext_event_wireless()
535 drv, custom, iwe->u.data.length); in wpa_driver_wext_event_wireless()
544 static void wpa_driver_wext_event_link(struct wpa_driver_wext_data *drv, in wpa_driver_wext_event_link() argument
561 if (os_strcmp(drv->ifname, event.interface_status.ifname) == 0) { in wpa_driver_wext_event_link()
563 if (drv->if_removed) { in wpa_driver_wext_event_link()
568 drv->if_removed = 1; in wpa_driver_wext_event_link()
570 if (if_nametoindex(drv->ifname) == 0) { in wpa_driver_wext_event_link()
574 drv->ifname); in wpa_driver_wext_event_link()
577 if (!drv->if_removed) { in wpa_driver_wext_event_link()
582 drv->if_removed = 0; in wpa_driver_wext_event_link()
586 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS, &event); in wpa_driver_wext_event_link()
590 static int wpa_driver_wext_own_ifname(struct wpa_driver_wext_data *drv, in wpa_driver_wext_own_ifname() argument
602 if (os_strcmp(((char *) attr) + rta_len, drv->ifname) in wpa_driver_wext_own_ifname()
615 static int wpa_driver_wext_own_ifindex(struct wpa_driver_wext_data *drv, in wpa_driver_wext_own_ifindex() argument
618 if (drv->ifindex == ifindex || drv->ifindex2 == ifindex) in wpa_driver_wext_own_ifindex()
621 if (drv->if_removed && wpa_driver_wext_own_ifname(drv, buf, len)) { in wpa_driver_wext_own_ifindex()
622 drv->ifindex = if_nametoindex(drv->ifname); in wpa_driver_wext_own_ifindex()
625 wpa_driver_wext_finish_drv_init(drv); in wpa_driver_wext_own_ifindex()
636 struct wpa_driver_wext_data *drv = ctx; in wpa_driver_wext_event_rtm_newlink() local
641 if (!wpa_driver_wext_own_ifindex(drv, ifi->ifi_index, buf, len)) { in wpa_driver_wext_event_rtm_newlink()
649 drv->operstate, ifi->ifi_flags, in wpa_driver_wext_event_rtm_newlink()
655 if (!drv->if_disabled && !(ifi->ifi_flags & IFF_UP)) { in wpa_driver_wext_event_rtm_newlink()
657 drv->if_disabled = 1; in wpa_driver_wext_event_rtm_newlink()
658 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_DISABLED, NULL); in wpa_driver_wext_event_rtm_newlink()
661 if (drv->if_disabled && (ifi->ifi_flags & IFF_UP)) { in wpa_driver_wext_event_rtm_newlink()
663 linux_iface_up(drv->ioctl_sock, drv->ifname) == 0) { in wpa_driver_wext_event_rtm_newlink()
667 } else if (if_nametoindex(drv->ifname) == 0) { in wpa_driver_wext_event_rtm_newlink()
670 drv->ifname); in wpa_driver_wext_event_rtm_newlink()
671 } else if (drv->if_removed) { in wpa_driver_wext_event_rtm_newlink()
674 "removed", drv->ifname); in wpa_driver_wext_event_rtm_newlink()
677 drv->if_disabled = 0; in wpa_driver_wext_event_rtm_newlink()
678 wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED, in wpa_driver_wext_event_rtm_newlink()
689 if (drv->operstate == 1 && in wpa_driver_wext_event_rtm_newlink()
692 netlink_send_oper_ifla(drv->netlink, drv->ifindex, in wpa_driver_wext_event_rtm_newlink()
702 drv, ((char *) attr) + rta_len, in wpa_driver_wext_event_rtm_newlink()
705 wpa_driver_wext_event_link(drv, in wpa_driver_wext_event_rtm_newlink()
717 struct wpa_driver_wext_data *drv = ctx; in wpa_driver_wext_event_rtm_dellink() local
727 wpa_driver_wext_event_link(drv, in wpa_driver_wext_event_rtm_dellink()
748 struct wpa_driver_wext_data *drv = ctx; in wpa_driver_wext_rfkill_unblocked() local
750 if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1)) { in wpa_driver_wext_rfkill_unblocked()
759 static void wext_get_phy_name(struct wpa_driver_wext_data *drv) in wext_get_phy_name() argument
765 drv->phyname[0] = '\0'; in wext_get_phy_name()
767 drv->ifname); in wext_get_phy_name()
775 rv = read(f, drv->phyname, sizeof(drv->phyname) - 1); in wext_get_phy_name()
783 drv->phyname[rv] = '\0'; in wext_get_phy_name()
784 pos = os_strchr(drv->phyname, '\n'); in wext_get_phy_name()
788 drv->ifname, drv->phyname); in wext_get_phy_name()
801 struct wpa_driver_wext_data *drv; in wpa_driver_wext_init() local
807 drv = os_zalloc(sizeof(*drv)); in wpa_driver_wext_init()
808 if (drv == NULL) in wpa_driver_wext_init()
810 drv->ctx = ctx; in wpa_driver_wext_init()
811 os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname)); in wpa_driver_wext_init()
816 drv->cfg80211 = 1; in wpa_driver_wext_init()
817 wext_get_phy_name(drv); in wpa_driver_wext_init()
820 drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0); in wpa_driver_wext_init()
821 if (drv->ioctl_sock < 0) { in wpa_driver_wext_init()
830 cfg->ctx = drv; in wpa_driver_wext_init()
833 drv->netlink = netlink_init(cfg); in wpa_driver_wext_init()
834 if (drv->netlink == NULL) { in wpa_driver_wext_init()
842 rcfg->ctx = drv; in wpa_driver_wext_init()
846 drv->rfkill = rfkill_init(rcfg); in wpa_driver_wext_init()
847 if (drv->rfkill == NULL) { in wpa_driver_wext_init()
852 drv->mlme_sock = -1; in wpa_driver_wext_init()
854 if (wpa_driver_wext_finish_drv_init(drv) < 0) in wpa_driver_wext_init()
857 wpa_driver_wext_set_auth_param(drv, IW_AUTH_WPA_ENABLED, 1); in wpa_driver_wext_init()
859 return drv; in wpa_driver_wext_init()
862 rfkill_deinit(drv->rfkill); in wpa_driver_wext_init()
863 netlink_deinit(drv->netlink); in wpa_driver_wext_init()
865 close(drv->ioctl_sock); in wpa_driver_wext_init()
867 os_free(drv); in wpa_driver_wext_init()
878 static int wext_hostap_ifname(struct wpa_driver_wext_data *drv, in wext_hostap_ifname() argument
889 drv->ifname, ifname); in wext_hostap_ifname()
904 wpa_driver_wext_alternative_ifindex(drv, ifname); in wext_hostap_ifname()
911 static int wext_add_hostap(struct wpa_driver_wext_data *drv) in wext_add_hostap() argument
918 snprintf(buf, sizeof(buf), "/sys/class/net/%s/device/net", drv->ifname); in wext_add_hostap()
924 if (ret < 0 && wext_hostap_ifname(drv, names[n]->d_name) == 0) in wext_add_hostap()
934 static void wext_check_hostap(struct wpa_driver_wext_data *drv) in wext_check_hostap() argument
952 drv->ifname); in wext_check_hostap()
963 wext_add_hostap(drv) == 0) in wext_check_hostap()
968 if (os_strncmp(drv->ifname, "wlan", 4) == 0) { in wext_check_hostap()
970 os_strlcpy(ifname2, drv->ifname, sizeof(ifname2)); in wext_check_hostap()
972 wpa_driver_wext_alternative_ifindex(drv, ifname2); in wext_check_hostap()
977 static int wpa_driver_wext_finish_drv_init(struct wpa_driver_wext_data *drv) in wpa_driver_wext_finish_drv_init() argument
981 if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1) < 0) { in wpa_driver_wext_finish_drv_init()
982 if (rfkill_is_blocked(drv->rfkill)) { in wpa_driver_wext_finish_drv_init()
985 drv->ifname); in wpa_driver_wext_finish_drv_init()
986 drv->if_disabled = 1; in wpa_driver_wext_finish_drv_init()
990 "interface '%s' UP", drv->ifname); in wpa_driver_wext_finish_drv_init()
998 wpa_driver_wext_flush_pmkid(drv); in wpa_driver_wext_finish_drv_init()
1000 if (wpa_driver_wext_set_mode(drv, 0) < 0) { in wpa_driver_wext_finish_drv_init()
1006 wpa_driver_wext_get_range(drv); in wpa_driver_wext_finish_drv_init()
1013 wpa_driver_wext_disconnect(drv); in wpa_driver_wext_finish_drv_init()
1015 drv->ifindex = if_nametoindex(drv->ifname); in wpa_driver_wext_finish_drv_init()
1017 wext_check_hostap(drv); in wpa_driver_wext_finish_drv_init()
1019 netlink_send_oper_ifla(drv->netlink, drv->ifindex, in wpa_driver_wext_finish_drv_init()
1024 drv, drv->ctx); in wpa_driver_wext_finish_drv_init()
1040 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_deinit() local
1042 wpa_driver_wext_set_auth_param(drv, IW_AUTH_WPA_ENABLED, 0); in wpa_driver_wext_deinit()
1044 eloop_cancel_timeout(wpa_driver_wext_scan_timeout, drv, drv->ctx); in wpa_driver_wext_deinit()
1050 wpa_driver_wext_disconnect(drv); in wpa_driver_wext_deinit()
1052 netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP); in wpa_driver_wext_deinit()
1053 netlink_deinit(drv->netlink); in wpa_driver_wext_deinit()
1054 rfkill_deinit(drv->rfkill); in wpa_driver_wext_deinit()
1056 if (drv->mlme_sock >= 0) in wpa_driver_wext_deinit()
1057 eloop_unregister_read_sock(drv->mlme_sock); in wpa_driver_wext_deinit()
1059 (void) linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 0); in wpa_driver_wext_deinit()
1061 close(drv->ioctl_sock); in wpa_driver_wext_deinit()
1062 if (drv->mlme_sock >= 0) in wpa_driver_wext_deinit()
1063 close(drv->mlme_sock); in wpa_driver_wext_deinit()
1064 os_free(drv->assoc_req_ies); in wpa_driver_wext_deinit()
1065 os_free(drv->assoc_resp_ies); in wpa_driver_wext_deinit()
1066 os_free(drv); in wpa_driver_wext_deinit()
1093 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_scan() local
1107 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_scan()
1120 if (ioctl(drv->ioctl_sock, SIOCSIWSCAN, &iwr) < 0) { in wpa_driver_wext_scan()
1129 if (drv->scan_complete_events) { in wpa_driver_wext_scan()
1139 eloop_cancel_timeout(wpa_driver_wext_scan_timeout, drv, drv->ctx); in wpa_driver_wext_scan()
1140 eloop_register_timeout(timeout, 0, wpa_driver_wext_scan_timeout, drv, in wpa_driver_wext_scan()
1141 drv->ctx); in wpa_driver_wext_scan()
1147 static u8 * wpa_driver_wext_giwscan(struct wpa_driver_wext_data *drv, in wpa_driver_wext_giwscan() argument
1160 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_giwscan()
1164 if (ioctl(drv->ioctl_sock, SIOCGIWSCAN, &iwr) == 0) in wpa_driver_wext_giwscan()
1275 static void wext_get_scan_qual(struct wpa_driver_wext_data *drv, in wext_get_scan_qual() argument
1292 (iwe->u.qual.level > drv->max_level))) { in wext_get_scan_qual()
1425 static int wext_19_iw_point(struct wpa_driver_wext_data *drv, u16 cmd) in wext_19_iw_point() argument
1427 return drv->we_version_compiled > 18 && in wext_19_iw_point()
1508 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_get_scan_results() local
1517 res_buf = wpa_driver_wext_giwscan(drv, &len); in wpa_driver_wext_get_scan_results()
1541 if (wext_19_iw_point(drv, iwe->cmd)) { in wpa_driver_wext_get_scan_results()
1572 wext_get_scan_qual(drv, iwe, &data); in wpa_driver_wext_get_scan_results()
1605 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_get_range() local
1621 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_get_range()
1628 if (ioctl(drv->ioctl_sock, SIOCGIWRANGE, &iwr) < 0) { in wpa_driver_wext_get_range()
1640 drv->has_capability = 1; in wpa_driver_wext_get_range()
1641 drv->we_version_compiled = range->we_version_compiled; in wpa_driver_wext_get_range()
1643 drv->capa.key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_WPA | in wpa_driver_wext_get_range()
1647 drv->capa.key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_WPA2 | in wpa_driver_wext_get_range()
1650 drv->capa.enc |= WPA_DRIVER_CAPA_ENC_WEP40 | in wpa_driver_wext_get_range()
1652 drv->capa.enc |= WPA_DRIVER_CAPA_ENC_WEP128; in wpa_driver_wext_get_range()
1654 drv->capa.enc |= WPA_DRIVER_CAPA_ENC_TKIP; in wpa_driver_wext_get_range()
1656 drv->capa.enc |= WPA_DRIVER_CAPA_ENC_CCMP; in wpa_driver_wext_get_range()
1658 drv->capa.flags |= WPA_DRIVER_FLAGS_4WAY_HANDSHAKE; in wpa_driver_wext_get_range()
1659 drv->capa.auth = WPA_DRIVER_AUTH_OPEN | in wpa_driver_wext_get_range()
1662 drv->capa.max_scan_ssids = 1; in wpa_driver_wext_get_range()
1666 drv->capa.key_mgmt, drv->capa.enc, in wpa_driver_wext_get_range()
1667 (unsigned long long) drv->capa.flags); in wpa_driver_wext_get_range()
1673 drv->max_level = range->max_qual.level; in wpa_driver_wext_get_range()
1680 static int wpa_driver_wext_set_psk(struct wpa_driver_wext_data *drv, in wpa_driver_wext_set_psk() argument
1689 if (!(drv->capa.flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE)) in wpa_driver_wext_set_psk()
1696 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_set_psk()
1708 ret = ioctl(drv->ioctl_sock, SIOCSIWENCODEEXT, &iwr); in wpa_driver_wext_set_psk()
1724 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_set_key_ext() local
1739 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_set_key_ext()
1794 if (ioctl(drv->ioctl_sock, SIOCSIWENCODEEXT, &iwr) < 0) { in wpa_driver_wext_set_key_ext()
1843 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_set_key() local
1852 ret = wpa_driver_wext_set_key_ext(drv, alg, addr, key_idx, set_tx, in wpa_driver_wext_set_key()
1869 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_set_key()
1877 if (ioctl(drv->ioctl_sock, SIOCSIWENCODE, &iwr) < 0) { in wpa_driver_wext_set_key()
1885 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_set_key()
1890 if (ioctl(drv->ioctl_sock, SIOCSIWENCODE, &iwr) < 0) { in wpa_driver_wext_set_key()
1905 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_set_countermeasures() local
1907 return wpa_driver_wext_set_auth_param(drv, in wpa_driver_wext_set_countermeasures()
1916 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_set_drop_unencrypted() local
1918 drv->use_crypt = enabled; in wpa_driver_wext_set_drop_unencrypted()
1919 return wpa_driver_wext_set_auth_param(drv, IW_AUTH_DROP_UNENCRYPTED, in wpa_driver_wext_set_drop_unencrypted()
1924 static int wpa_driver_wext_mlme(struct wpa_driver_wext_data *drv, in wpa_driver_wext_mlme() argument
1932 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_mlme()
1941 if (ioctl(drv->ioctl_sock, SIOCSIWMLME, &iwr) < 0) { in wpa_driver_wext_mlme()
1951 static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv) in wpa_driver_wext_disconnect() argument
1964 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_disconnect()
1965 if (ioctl(drv->ioctl_sock, SIOCGIWMODE, &iwr) < 0) { in wpa_driver_wext_disconnect()
1973 if (wpa_driver_wext_set_bssid(drv, null_bssid) < 0) { in wpa_driver_wext_disconnect()
1978 if (drv->cfg80211) { in wpa_driver_wext_disconnect()
1984 if (wpa_driver_wext_set_ssid(drv, (u8 *) "", 0) < 0) { in wpa_driver_wext_disconnect()
1999 if (wpa_driver_wext_set_ssid(drv, ssid, SSID_MAX_LEN) < 0) { in wpa_driver_wext_disconnect()
2010 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_deauthenticate() local
2013 ret = wpa_driver_wext_mlme(drv, addr, IW_MLME_DEAUTH, reason_code); in wpa_driver_wext_deauthenticate()
2014 wpa_driver_wext_disconnect(drv); in wpa_driver_wext_deauthenticate()
2022 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_set_gen_ie() local
2027 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_set_gen_ie()
2031 if (ioctl(drv->ioctl_sock, SIOCSIWGENIE, &iwr) < 0) { in wpa_driver_wext_set_gen_ie()
2075 wpa_driver_wext_auth_alg_fallback(struct wpa_driver_wext_data *drv, in wpa_driver_wext_auth_alg_fallback() argument
2085 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_auth_alg_fallback()
2100 if (!drv->use_crypt) { in wpa_driver_wext_auth_alg_fallback()
2109 if (ioctl(drv->ioctl_sock, SIOCSIWENCODE, &iwr) < 0) { in wpa_driver_wext_auth_alg_fallback()
2122 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_associate() local
2129 if (drv->cfg80211) { in wpa_driver_wext_associate()
2134 if (wpa_driver_wext_set_ssid(drv, (u8 *) "", 0) < 0) { in wpa_driver_wext_associate()
2141 if (wpa_driver_wext_set_drop_unencrypted(drv, params->drop_unencrypted) in wpa_driver_wext_associate()
2144 if (wpa_driver_wext_set_auth_alg(drv, params->auth_alg) < 0) in wpa_driver_wext_associate()
2146 if (wpa_driver_wext_set_mode(drv, params->mode) < 0) in wpa_driver_wext_associate()
2153 if (drv->auth_alg_fallback && in wpa_driver_wext_associate()
2154 wpa_driver_wext_auth_alg_fallback(drv, params) < 0) in wpa_driver_wext_associate()
2158 wpa_driver_wext_set_bssid(drv, NULL) < 0) in wpa_driver_wext_associate()
2164 if (wpa_driver_wext_set_gen_ie(drv, params->wpa_ie, params->wpa_ie_len) in wpa_driver_wext_associate()
2173 if (wpa_driver_wext_set_auth_param(drv, in wpa_driver_wext_associate()
2177 if (wpa_driver_wext_set_auth_param(drv, in wpa_driver_wext_associate()
2181 if (wpa_driver_wext_set_auth_param(drv, in wpa_driver_wext_associate()
2185 if (wpa_driver_wext_set_auth_param(drv, in wpa_driver_wext_associate()
2192 if (wpa_driver_wext_set_auth_param(drv, in wpa_driver_wext_associate()
2205 if (wpa_driver_wext_set_psk(drv, params->psk) < 0) in wpa_driver_wext_associate()
2207 if (wpa_driver_wext_set_auth_param(drv, in wpa_driver_wext_associate()
2223 if (wpa_driver_wext_set_auth_param(drv, IW_AUTH_MFP, value) < 0) in wpa_driver_wext_associate()
2227 wpa_driver_wext_set_freq(drv, params->freq.freq) < 0) in wpa_driver_wext_associate()
2229 if (!drv->cfg80211 && in wpa_driver_wext_associate()
2230 wpa_driver_wext_set_ssid(drv, params->ssid, params->ssid_len) < 0) in wpa_driver_wext_associate()
2233 wpa_driver_wext_set_bssid(drv, params->bssid) < 0) in wpa_driver_wext_associate()
2235 if (drv->cfg80211 && in wpa_driver_wext_associate()
2236 wpa_driver_wext_set_ssid(drv, params->ssid, params->ssid_len) < 0) in wpa_driver_wext_associate()
2245 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_set_auth_alg() local
2259 res = wpa_driver_wext_set_auth_param(drv, IW_AUTH_80211_AUTH_ALG, in wpa_driver_wext_set_auth_alg()
2261 drv->auth_alg_fallback = res == -2; in wpa_driver_wext_set_auth_alg()
2274 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_set_mode() local
2280 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_set_mode()
2282 if (ioctl(drv->ioctl_sock, SIOCSIWMODE, &iwr) == 0) { in wpa_driver_wext_set_mode()
2297 if (ioctl(drv->ioctl_sock, SIOCGIWMODE, &iwr) < 0) { in wpa_driver_wext_set_mode()
2308 if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 0) == 0) { in wpa_driver_wext_set_mode()
2311 if (ioctl(drv->ioctl_sock, SIOCSIWMODE, &iwr) < 0) in wpa_driver_wext_set_mode()
2317 (void) linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1); in wpa_driver_wext_set_mode()
2325 static int wpa_driver_wext_pmksa(struct wpa_driver_wext_data *drv, in wpa_driver_wext_pmksa() argument
2333 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_pmksa()
2344 if (ioctl(drv->ioctl_sock, SIOCSIWPMKSA, &iwr) < 0) { in wpa_driver_wext_pmksa()
2358 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_add_pmkid() local
2359 return wpa_driver_wext_pmksa(drv, IW_PMKSA_ADD, bssid, pmkid); in wpa_driver_wext_add_pmkid()
2366 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_remove_pmkid() local
2367 return wpa_driver_wext_pmksa(drv, IW_PMKSA_REMOVE, bssid, pmkid); in wpa_driver_wext_remove_pmkid()
2373 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_flush_pmkid() local
2374 return wpa_driver_wext_pmksa(drv, IW_PMKSA_FLUSH, NULL, NULL); in wpa_driver_wext_flush_pmkid()
2380 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_get_capa() local
2381 if (!drv->has_capability) in wpa_driver_wext_get_capa()
2383 os_memcpy(capa, &drv->capa, sizeof(*capa)); in wpa_driver_wext_get_capa()
2388 int wpa_driver_wext_alternative_ifindex(struct wpa_driver_wext_data *drv, in wpa_driver_wext_alternative_ifindex() argument
2392 drv->ifindex2 = -1; in wpa_driver_wext_alternative_ifindex()
2396 drv->ifindex2 = if_nametoindex(ifname); in wpa_driver_wext_alternative_ifindex()
2397 if (drv->ifindex2 <= 0) in wpa_driver_wext_alternative_ifindex()
2401 "wireless events", drv->ifindex2, ifname); in wpa_driver_wext_alternative_ifindex()
2409 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_set_operstate() local
2412 __func__, drv->operstate, state, state ? "UP" : "DORMANT"); in wpa_driver_wext_set_operstate()
2413 drv->operstate = state; in wpa_driver_wext_set_operstate()
2414 return netlink_send_oper_ifla(drv->netlink, drv->ifindex, -1, in wpa_driver_wext_set_operstate()
2419 int wpa_driver_wext_get_version(struct wpa_driver_wext_data *drv) in wpa_driver_wext_get_version() argument
2421 return drv->we_version_compiled; in wpa_driver_wext_get_version()
2427 struct wpa_driver_wext_data *drv = priv; in wext_get_radio_name() local
2428 return drv->phyname; in wext_get_radio_name()
2434 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_signal_poll() local
2444 os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); in wpa_driver_wext_signal_poll()
2449 if (ioctl(drv->ioctl_sock, SIOCGIWSTATS, &iwr) < 0) { in wpa_driver_wext_signal_poll()
2465 struct wpa_driver_wext_data *drv = priv; in wpa_driver_wext_status() local
2473 if (linux_get_ifhwaddr(drv->ioctl_sock, drv->ifname, addr)) in wpa_driver_wext_status()
2480 drv->ifindex, in wpa_driver_wext_status()
2481 drv->ifname, in wpa_driver_wext_status()