Lines Matching refs:drv
184 get80211param(struct atheros_driver_data *drv, int op, int *data) in get80211param() argument
189 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); in get80211param()
192 if (ioctl(drv->ioctl_sock, IEEE80211_IOCTL_GETPARAM, &iwr) < 0) in get80211param()
202 set80211priv(struct atheros_driver_data *drv, int op, void *data, int len) in set80211priv() argument
213 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); in set80211priv()
229 if (ioctl(drv->ioctl_sock, op, &iwr) < 0) { in set80211priv()
232 __func__, drv->iface, op, in set80211priv()
241 set80211param(struct atheros_driver_data *drv, int op, int arg) in set80211param() argument
246 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); in set80211param()
250 if (ioctl(drv->ioctl_sock, IEEE80211_IOCTL_SETPARAM, &iwr) < 0) { in set80211param()
253 __func__, drv->iface, op, athr_get_param_name(op), in set80211param()
278 atheros_configure_wpa(struct atheros_driver_data *drv, in atheros_configure_wpa() argument
316 if (set80211param(drv, IEEE80211_PARAM_MCASTCIPHER, v)) { in atheros_configure_wpa()
323 if (set80211param(drv, IEEE80211_PARAM_MCASTKEYLEN, v)) { in atheros_configure_wpa()
346 if (set80211param(drv, IEEE80211_PARAM_UCASTCIPHERS, v)) { in atheros_configure_wpa()
354 if (set80211param(drv, IEEE80211_PARAM_KEYMGTALGS, in atheros_configure_wpa()
372 if (set80211param(drv, IEEE80211_PARAM_RSNCAPS, v)) { in atheros_configure_wpa()
379 if (set80211param(drv, IEEE80211_PARAM_WPA, params->wpa)) { in atheros_configure_wpa()
389 struct atheros_driver_data *drv = priv; in atheros_set_ieee8021x() local
399 return atheros_set_privacy(drv, 0); in atheros_set_ieee8021x()
405 if (params->wpa && atheros_configure_wpa(drv, params) != 0) { in atheros_set_ieee8021x()
421 struct atheros_driver_data *drv = priv; in atheros_set_privacy() local
425 return set80211param(drv, IEEE80211_PARAM_PRIVACY, enabled); in atheros_set_privacy()
431 struct atheros_driver_data *drv = priv; in atheros_set_sta_authorized() local
444 ret = set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme)); in atheros_set_sta_authorized()
469 struct atheros_driver_data *drv = priv; in atheros_del_key() local
484 ret = set80211priv(drv, IEEE80211_IOCTL_DELKEY, &wk, sizeof(wk)); in atheros_del_key()
497 struct atheros_driver_data *drv = priv; in atheros_set_key() local
509 return atheros_del_key(drv, addr, key_idx); in atheros_set_key()
576 ret = set80211priv(drv, IEEE80211_IOCTL_SETKEY, &wk, sizeof(wk)); in atheros_set_key()
592 struct atheros_driver_data *drv = priv; in atheros_get_seqnum() local
605 if (set80211priv(drv, IEEE80211_IOCTL_GETKEY, &wk, sizeof(wk))) { in atheros_get_seqnum()
649 struct atheros_driver_data *drv = priv; in atheros_read_sta_driver_data() local
659 if (set80211priv(drv, IEEE80211_IOCTL_STA_STATS, in atheros_read_sta_driver_data()
663 if (os_memcmp(addr, drv->acct_mac, ETH_ALEN) == 0) { in atheros_read_sta_driver_data()
664 os_memcpy(data, &drv->acct_data, sizeof(*data)); in atheros_read_sta_driver_data()
684 struct atheros_driver_data *drv = priv; in atheros_sta_clear_stats() local
692 ret = set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, in atheros_sta_clear_stats()
706 struct atheros_driver_data *drv = priv; in atheros_set_opt_ie() local
714 wpabuf_free(drv->wpa_ie); in atheros_set_opt_ie()
716 drv->wpa_ie = wpabuf_alloc_copy(ie, ie_len); in atheros_set_opt_ie()
718 drv->wpa_ie = NULL; in atheros_set_opt_ie()
728 if (drv->wps_beacon_ie != NULL) { in atheros_set_opt_ie()
730 wpabuf_head(drv->wps_beacon_ie), in atheros_set_opt_ie()
731 wpabuf_len(drv->wps_beacon_ie)); in atheros_set_opt_ie()
732 app_ie->app_buflen = ie_len + wpabuf_len(drv->wps_beacon_ie); in atheros_set_opt_ie()
736 set80211priv(drv, IEEE80211_IOCTL_SET_APPIEBUF, app_ie, in atheros_set_opt_ie()
742 if (drv->wps_probe_resp_ie != NULL) { in atheros_set_opt_ie()
744 wpabuf_head(drv->wps_probe_resp_ie), in atheros_set_opt_ie()
745 wpabuf_len(drv->wps_probe_resp_ie)); in atheros_set_opt_ie()
747 wpabuf_len(drv->wps_probe_resp_ie); in atheros_set_opt_ie()
752 set80211priv(drv, IEEE80211_IOCTL_SET_APPIEBUF, app_ie, in atheros_set_opt_ie()
762 struct atheros_driver_data *drv = priv; in atheros_sta_deauth() local
772 ret = set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme)); in atheros_sta_deauth()
786 struct atheros_driver_data *drv = priv; in atheros_sta_disassoc() local
796 ret = set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme)); in atheros_sta_disassoc()
810 struct atheros_driver_data *drv = ctx; in atheros_set_qos_map() local
824 os_strlcpy(iwr.ifr_name, drv->iface, sizeof(iwr.ifr_name)); in atheros_set_qos_map()
844 if (ioctl(drv->ioctl_sock, IEEE80211_IOCTL_DBGREQ, &iwr) < 0) { in atheros_set_qos_map()
847 __func__, drv->iface, strerror(errno)); in atheros_set_qos_map()
859 struct atheros_driver_data *drv = ctx; in atheros_raw_receive() local
891 wpa_supplicant_event(drv->hapd, EVENT_RX_PROBE_REQ, &event); in atheros_raw_receive()
896 (os_memcmp(drv->own_addr, mgmt->bssid, ETH_ALEN) == 0 || in atheros_raw_receive()
901 wpa_supplicant_event(drv->hapd, EVENT_RX_MGMT, &event); in atheros_raw_receive()
905 if (os_memcmp(drv->own_addr, mgmt->bssid, ETH_ALEN) != 0) { in atheros_raw_receive()
917 drv_event_assoc(drv->hapd, mgmt->sa, iebuf, ielen, 0); in atheros_raw_receive()
924 drv_event_assoc(drv->hapd, mgmt->sa, iebuf, ielen, 1); in atheros_raw_receive()
933 wpa_supplicant_event(drv->hapd, EVENT_RX_MGMT, &event); in atheros_raw_receive()
946 wpa_supplicant_event(drv->hapd, EVENT_AUTH, &event); in atheros_raw_receive()
954 static int atheros_receive_pkt(struct atheros_driver_data *drv) in atheros_receive_pkt() argument
974 ret = set80211priv(drv, IEEE80211_IOCTL_FILTERFRAME, &filt, in atheros_receive_pkt()
981 drv->sock_raw = l2_packet_init(drv->iface, NULL, ETH_P_80211_RAW, in atheros_receive_pkt()
982 atheros_raw_receive, drv, 1); in atheros_receive_pkt()
983 if (drv->sock_raw == NULL) in atheros_receive_pkt()
989 static int atheros_reset_appfilter(struct atheros_driver_data *drv) in atheros_reset_appfilter() argument
993 return set80211priv(drv, IEEE80211_IOCTL_FILTERFRAME, &filt, in atheros_reset_appfilter()
1001 struct atheros_driver_data *drv = priv; in atheros_set_wps_ie() local
1018 (drv->wpa_ie != NULL)) { in atheros_set_wps_ie()
1020 drv->wpa_ie); in atheros_set_wps_ie()
1021 os_memcpy(&(beac_ie->app_buf[len]), wpabuf_head(drv->wpa_ie), in atheros_set_wps_ie()
1022 wpabuf_len(drv->wpa_ie)); in atheros_set_wps_ie()
1023 beac_ie->app_buflen += wpabuf_len(drv->wpa_ie); in atheros_set_wps_ie()
1028 return set80211priv(drv, IEEE80211_IOCTL_SET_APPIEBUF, beac_ie, in atheros_set_wps_ie()
1038 struct atheros_driver_data *drv = priv; in atheros_set_ap_wps_ie() local
1045 wpabuf_free(drv->wps_beacon_ie); in atheros_set_ap_wps_ie()
1046 drv->wps_beacon_ie = beacon ? wpabuf_dup(beacon) : NULL; in atheros_set_ap_wps_ie()
1047 wpabuf_free(drv->wps_probe_resp_ie); in atheros_set_ap_wps_ie()
1048 drv->wps_probe_resp_ie = proberesp ? wpabuf_dup(proberesp) : NULL; in atheros_set_ap_wps_ie()
1069 struct atheros_driver_data *drv = priv; in atheros_sta_auth() local
1078 if (params->fils_auth && drv->fils_en) { in atheros_sta_auth()
1118 ret = set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme)); in atheros_sta_auth()
1131 struct atheros_driver_data *drv = priv; in atheros_sta_assoc() local
1157 ret = set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme)); in atheros_sta_assoc()
1168 atheros_new_sta(struct atheros_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN]) in atheros_new_sta() argument
1170 struct hostapd_data *hapd = drv->hapd; in atheros_new_sta()
1180 if (set80211priv(drv, IEEE80211_IOCTL_GETWPAIE, &ie, sizeof(ie))) { in atheros_new_sta()
1228 if (os_memcmp(addr, drv->acct_mac, ETH_ALEN) == 0) { in atheros_new_sta()
1230 os_memset(drv->acct_mac, 0, ETH_ALEN); in atheros_new_sta()
1231 os_memset(&drv->acct_data, 0, sizeof(drv->acct_data)); in atheros_new_sta()
1236 atheros_wireless_event_wireless_custom(struct atheros_driver_data *drv, in atheros_wireless_event_wireless_custom() argument
1258 wpa_supplicant_event(drv->hapd, in atheros_wireless_event_wireless_custom()
1277 hwaddr_aton(value, drv->acct_mac); in atheros_wireless_event_wireless_custom()
1279 drv->acct_data.rx_packets = val; in atheros_wireless_event_wireless_custom()
1281 drv->acct_data.tx_packets = val; in atheros_wireless_event_wireless_custom()
1283 drv->acct_data.rx_bytes = val; in atheros_wireless_event_wireless_custom()
1285 drv->acct_data.tx_bytes = val; in atheros_wireless_event_wireless_custom()
1294 wpa_supplicant_event(drv->hapd, EVENT_WPS_BUTTON_PUSHED, NULL); in atheros_wireless_event_wireless_custom()
1308 atheros_raw_receive(drv, NULL, in atheros_wireless_event_wireless_custom()
1321 atheros_raw_receive(drv, NULL, in atheros_wireless_event_wireless_custom()
1332 atheros_raw_receive(drv, NULL, in atheros_wireless_event_wireless_custom()
1344 atheros_raw_receive(drv, NULL, in atheros_wireless_event_wireless_custom()
1350 static void send_action_cb_event(struct atheros_driver_data *drv, in send_action_cb_event() argument
1379 wpa_supplicant_event(drv->hapd, EVENT_TX_STATUS, &event); in send_action_cb_event()
1389 static void fetch_pending_big_events(struct atheros_driver_data *drv) in fetch_pending_big_events() argument
1401 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); in fetch_pending_big_events()
1407 if (ioctl(drv->ioctl_sock, IEEE80211_IOCTL_P2P_BIG_PARAM, &iwr) in fetch_pending_big_events()
1443 wpa_supplicant_event(drv->hapd, EVENT_RX_MGMT, in fetch_pending_big_events()
1451 send_action_cb_event(drv, (void *) mgmt, data_len); in fetch_pending_big_events()
1461 atheros_wireless_event_atheros_custom(struct atheros_driver_data *drv, in atheros_wireless_event_atheros_custom() argument
1467 fetch_pending_big_events(drv); in atheros_wireless_event_atheros_custom()
1471 fetch_pending_big_events(drv); in atheros_wireless_event_atheros_custom()
1479 atheros_wireless_event_wireless(struct atheros_driver_data *drv, in atheros_wireless_event_wireless() argument
1498 if (drv->we_version > 18 && in atheros_wireless_event_wireless()
1514 drv_event_disassoc(drv->hapd, in atheros_wireless_event_wireless()
1518 atheros_new_sta(drv, (u8 *) iwe->u.addr.sa_data); in atheros_wireless_event_wireless()
1536 drv, (int) iwe->u.data.flags, in atheros_wireless_event_wireless()
1540 drv, buf, buf + iwe->u.data.length); in atheros_wireless_event_wireless()
1555 struct atheros_driver_data *drv = ctx; in atheros_wireless_event_rtm_newlink() local
1559 if (ifi->ifi_index != drv->ifindex) in atheros_wireless_event_rtm_newlink()
1569 drv, ((char *) attr) + rta_len, in atheros_wireless_event_rtm_newlink()
1578 atheros_get_we_version(struct atheros_driver_data *drv) in atheros_get_we_version() argument
1585 drv->we_version = 0; in atheros_get_we_version()
1597 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); in atheros_get_we_version()
1604 if (ioctl(drv->ioctl_sock, SIOCGIWRANGE, &iwr) < 0) { in atheros_get_we_version()
1616 drv->we_version = range->we_version_compiled; in atheros_get_we_version()
1625 atheros_wireless_event_init(struct atheros_driver_data *drv) in atheros_wireless_event_init() argument
1629 atheros_get_we_version(drv); in atheros_wireless_event_init()
1634 cfg->ctx = drv; in atheros_wireless_event_init()
1636 drv->netlink = netlink_init(cfg); in atheros_wireless_event_init()
1637 if (drv->netlink == NULL) { in atheros_wireless_event_init()
1650 struct atheros_driver_data *drv = priv; in atheros_send_eapol() local
1681 status = l2_packet_send(drv->sock_xmit, addr, ETH_P_EAPOL, bp, len); in atheros_send_eapol()
1691 struct atheros_driver_data *drv = ctx; in handle_read() local
1692 drv_event_eapol_rx(drv->hapd, src_addr, buf + sizeof(struct l2_ethhdr), in handle_read()
1697 static void atheros_read_fils_cap(struct atheros_driver_data *drv) in atheros_read_fils_cap() argument
1704 if (get80211param(drv, IEEE80211_PARAM_ENABLE_FILS, &fils) < 0) { in atheros_read_fils_cap()
1712 drv->fils_en = fils; in atheros_read_fils_cap()
1713 wpa_printf(MSG_DEBUG, "atheros: fils_en=%d", drv->fils_en); in atheros_read_fils_cap()
1720 struct atheros_driver_data *drv; in atheros_init() local
1725 drv = os_zalloc(sizeof(struct atheros_driver_data)); in atheros_init()
1726 if (drv == NULL) { in atheros_init()
1732 drv->hapd = hapd; in atheros_init()
1733 drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0); in atheros_init()
1734 if (drv->ioctl_sock < 0) { in atheros_init()
1739 os_memcpy(drv->iface, params->ifname, sizeof(drv->iface)); in atheros_init()
1742 os_strlcpy(ifr.ifr_name, drv->iface, sizeof(ifr.ifr_name)); in atheros_init()
1743 if (ioctl(drv->ioctl_sock, SIOCGIFINDEX, &ifr) != 0) { in atheros_init()
1748 drv->ifindex = ifr.ifr_ifindex; in atheros_init()
1750 drv->sock_xmit = l2_packet_init(drv->iface, NULL, ETH_P_EAPOL, in atheros_init()
1751 handle_read, drv, 1); in atheros_init()
1752 if (drv->sock_xmit == NULL) in atheros_init()
1754 if (l2_packet_get_own_addr(drv->sock_xmit, params->own_addr)) in atheros_init()
1756 os_memcpy(drv->own_addr, params->own_addr, ETH_ALEN); in atheros_init()
1760 drv->sock_recv = l2_packet_init(params->bridge[0], NULL, in atheros_init()
1761 ETH_P_EAPOL, handle_read, drv, in atheros_init()
1763 if (drv->sock_recv == NULL) in atheros_init()
1765 } else if (linux_br_get(brname, drv->iface) == 0) { in atheros_init()
1768 drv->sock_recv = l2_packet_init(brname, NULL, ETH_P_EAPOL, in atheros_init()
1769 handle_read, drv, 1); in atheros_init()
1770 if (drv->sock_recv == NULL) in atheros_init()
1773 drv->sock_recv = drv->sock_xmit; in atheros_init()
1776 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); in atheros_init()
1780 if (ioctl(drv->ioctl_sock, SIOCSIWMODE, &iwr) < 0) { in atheros_init()
1788 linux_set_iface_flags(drv->ioctl_sock, drv->iface, 0); in atheros_init()
1789 atheros_set_privacy(drv, 0); /* default to no privacy */ in atheros_init()
1791 if (atheros_receive_pkt(drv)) in atheros_init()
1794 if (atheros_wireless_event_init(drv)) in atheros_init()
1798 atheros_read_fils_cap(drv); in atheros_init()
1800 return drv; in atheros_init()
1802 atheros_reset_appfilter(drv); in atheros_init()
1803 if (drv->sock_raw) in atheros_init()
1804 l2_packet_deinit(drv->sock_raw); in atheros_init()
1805 if (drv->sock_recv != NULL && drv->sock_recv != drv->sock_xmit) in atheros_init()
1806 l2_packet_deinit(drv->sock_recv); in atheros_init()
1807 if (drv->sock_xmit != NULL) in atheros_init()
1808 l2_packet_deinit(drv->sock_xmit); in atheros_init()
1809 if (drv->ioctl_sock >= 0) in atheros_init()
1810 close(drv->ioctl_sock); in atheros_init()
1811 os_free(drv); in atheros_init()
1819 struct atheros_driver_data *drv = priv; in atheros_deinit() local
1821 atheros_reset_appfilter(drv); in atheros_deinit()
1823 if (drv->wpa_ie || drv->wps_beacon_ie || drv->wps_probe_resp_ie) { in atheros_deinit()
1825 wpabuf_free(drv->wpa_ie); in atheros_deinit()
1826 wpabuf_free(drv->wps_beacon_ie); in atheros_deinit()
1827 wpabuf_free(drv->wps_probe_resp_ie); in atheros_deinit()
1829 netlink_deinit(drv->netlink); in atheros_deinit()
1830 (void) linux_set_iface_flags(drv->ioctl_sock, drv->iface, 0); in atheros_deinit()
1831 if (drv->ioctl_sock >= 0) in atheros_deinit()
1832 close(drv->ioctl_sock); in atheros_deinit()
1833 if (drv->sock_recv != NULL && drv->sock_recv != drv->sock_xmit) in atheros_deinit()
1834 l2_packet_deinit(drv->sock_recv); in atheros_deinit()
1835 if (drv->sock_xmit != NULL) in atheros_deinit()
1836 l2_packet_deinit(drv->sock_xmit); in atheros_deinit()
1837 if (drv->sock_raw) in atheros_deinit()
1838 l2_packet_deinit(drv->sock_raw); in atheros_deinit()
1839 os_free(drv); in atheros_deinit()
1845 struct atheros_driver_data *drv = priv; in atheros_set_ssid() local
1849 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); in atheros_set_ssid()
1854 if (ioctl(drv->ioctl_sock, SIOCSIWESSID, &iwr) < 0) { in atheros_set_ssid()
1865 struct atheros_driver_data *drv = priv; in atheros_get_ssid() local
1870 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); in atheros_get_ssid()
1875 if (ioctl(drv->ioctl_sock, SIOCGIWESSID, &iwr) < 0) { in atheros_get_ssid()
1888 struct atheros_driver_data *drv = priv; in atheros_set_countermeasures() local
1890 return set80211param(drv, IEEE80211_PARAM_COUNTERMEASURES, enabled); in atheros_set_countermeasures()
1896 struct atheros_driver_data *drv = priv; in atheros_commit() local
1897 return linux_set_iface_flags(drv->ioctl_sock, drv->iface, 1); in atheros_commit()
1970 struct atheros_driver_data *drv = priv; in atheros_send_mgmt() local
1987 return set80211priv(drv, IEEE80211_IOCTL_SEND_MGMT, mgmt_frm, in atheros_send_mgmt()
1997 struct atheros_driver_data *drv = priv; in atheros_add_tspec() local
2006 retv = set80211priv(drv, IEEE80211_IOCTL_RES_REQ, &req, in atheros_add_tspec()
2020 struct atheros_driver_data *drv = priv; in atheros_add_sta_node() local
2028 return set80211priv(drv, IEEE80211_IOCTL_RES_REQ, &req, in atheros_add_sta_node()
2037 set80211big(struct atheros_driver_data *drv, int op, const void *data, int len) in set80211big() argument
2042 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); in set80211big()
2050 if (ioctl(drv->ioctl_sock, IEEE80211_IOCTL_P2P_BIG_PARAM, &iwr) < 0) { in set80211big()
2068 struct atheros_driver_data *drv = priv; in atheros_send_action() local
2087 res = set80211big(drv, IEEE80211_IOC_P2P_SEND_ACTION, in atheros_send_action()
2095 static int athr_wnm_tfs(struct atheros_driver_data *drv, const u8* peer, in athr_wnm_tfs() argument
2104 drv->iface, oper, MAC2STR(peer)); in athr_wnm_tfs()
2127 if (set80211priv(drv, IEEE80211_IOCTL_SET_APPIEBUF, tfs_ie, in athr_wnm_tfs()
2146 if (set80211priv(drv, IEEE80211_IOCTL_GET_APPIEBUF, tfs_ie, in athr_wnm_tfs()
2173 if (set80211priv(drv, IEEE80211_IOCTL_SET_APPIEBUF, tfs_ie, in athr_wnm_tfs()
2189 static int atheros_wnm_sleep(struct atheros_driver_data *drv, in atheros_wnm_sleep() argument
2217 ret = atheros_set_wps_ie(drv, data, dlen, IEEE80211_APPIE_FRAME_WNM); in atheros_wnm_sleep()
2228 struct atheros_driver_data *drv = priv; in atheros_wnm_oper() local
2235 return atheros_wnm_sleep(drv, peer, oper); in atheros_wnm_oper()
2240 return athr_wnm_tfs(drv, peer, buf, buf_len, oper); in atheros_wnm_oper()