Lines Matching defs:drv
58 static void handle_data(struct hostap_driver_data *drv, u8 *buf, size_t len,
82 wpa_supplicant_event(drv->hapd, EVENT_RX_FROM_UNKNOWN, &event);
109 drv_event_eapol_rx(drv->hapd, sa, pos, left);
119 static void handle_tx_callback(struct hostap_driver_data *drv, u8 *buf,
136 wpa_supplicant_event(drv->hapd, EVENT_TX_STATUS, &event);
140 static void handle_frame(struct hostap_driver_data *drv, u8 *buf, size_t len)
172 handle_tx_callback(drv, buf, data_len, ver == 2 ? 1 : 0);
184 wpa_supplicant_event(drv->hapd, EVENT_RX_MGMT, &event);
191 handle_data(drv, buf, data_len, stype);
202 struct hostap_driver_data *drv = eloop_ctx;
212 handle_frame(drv, buf, len);
216 static int hostap_init_sockets(struct hostap_driver_data *drv, u8 *own_addr)
221 drv->sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
222 if (drv->sock < 0) {
228 if (eloop_register_read_sock(drv->sock, handle_read, drv, NULL)) {
235 drv->iface) >= (int) sizeof(ifr.ifr_name)) {
239 if (ioctl(drv->sock, SIOCGIFINDEX, &ifr) != 0) {
245 if (hostap_set_iface_flags(drv, 1)) {
255 if (bind(drv->sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
260 return linux_get_ifhwaddr(drv->sock, drv->iface, own_addr);
269 struct hostap_driver_data *drv = priv;
275 res = send(drv->sock, msg, len, 0);
286 struct hostap_driver_data *drv = priv;
316 res = hostap_send_mlme(drv, (u8 *) hdr, len, 0, 0, NULL, 0, 0, 0, -1);
332 struct hostap_driver_data *drv = priv;
346 return hostapd_ioctl(drv, ¶m, sizeof(param));
352 struct hostap_driver_data *drv = priv;
356 if (os_snprintf(ifname, IFNAMSIZ, "%sap", drv->iface) >= IFNAMSIZ) {
360 if (linux_set_iface_flags(drv->ioctl_sock, ifname, dev_up) < 0)
367 if (ioctl(drv->ioctl_sock, SIOCSIFMTU, &ifr) != 0) {
381 struct hostap_driver_data *drv = priv;
385 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
389 if (ioctl(drv->ioctl_sock, PRISM2_IOCTL_HOSTAPD, &iwr) < 0) {
402 struct hostap_driver_data *drv = priv;
451 if (hostapd_ioctl(drv, param, blen)) {
464 struct hostap_driver_data *drv = priv;
483 if (hostapd_ioctl(drv, param, blen)) {
497 struct hostap_driver_data *drv = priv;
502 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
507 if (ioctl(drv->ioctl_sock, PRISM2_IOCTL_PRISM2_PARAM, &iwr) < 0) {
519 struct hostap_driver_data *drv = priv;
523 if (hostap_ioctl_prism2param(drv, PRISM2_PARAM_IEEE_802_1X, enabled)) {
534 if (hostap_ioctl_prism2param(drv, PRISM2_PARAM_HOST_DECRYPT, 1) ||
535 hostap_ioctl_prism2param(drv, PRISM2_PARAM_HOST_ENCRYPT, 1)) {
547 struct hostap_drvier_data *drv = priv;
549 return hostap_ioctl_prism2param(drv, PRISM2_PARAM_PRIVACY_INVOKED,
556 struct hostap_driver_data *drv = priv;
560 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
565 if (ioctl(drv->ioctl_sock, SIOCSIWESSID, &iwr) < 0) {
577 struct hostap_driver_data *drv = priv;
582 return hostapd_ioctl(drv, ¶m, sizeof(param));
590 struct hostap_driver_data *drv = priv;
597 drv->iface, MAC2STR(addr));
630 struct hostap_driver_data *drv = priv;
657 return hostapd_ioctl(drv, ¶m, sizeof(param));
663 struct hostap_driver_data *drv = priv;
666 hostap_sta_set_flags(drv, addr, 0, 0, ~WPA_STA_AUTHORIZED);
671 if (hostapd_ioctl(drv, ¶m, sizeof(param))) {
681 struct hostap_driver_data *drv = priv;
687 if (hostapd_ioctl(drv, ¶m, sizeof(param))) {
697 struct hostap_driver_data *drv = priv;
703 if (hostapd_ioctl(drv, ¶m, sizeof(param))) {
711 static int hostapd_ioctl_set_generic_elem(struct hostap_driver_data *drv)
717 elem_len = drv->generic_ie_len + drv->wps_ie_len;
728 if (drv->generic_ie) {
729 os_memcpy(param->u.generic_elem.data, drv->generic_ie,
730 drv->generic_ie_len);
732 if (drv->wps_ie) {
733 os_memcpy(¶m->u.generic_elem.data[drv->generic_ie_len],
734 drv->wps_ie, drv->wps_ie_len);
738 res = hostapd_ioctl(drv, param, blen);
749 struct hostap_driver_data *drv = priv;
751 os_free(drv->generic_ie);
752 drv->generic_ie = NULL;
753 drv->generic_ie_len = 0;
755 drv->generic_ie = os_memdup(elem, elem_len);
756 if (drv->generic_ie == NULL)
758 drv->generic_ie_len = elem_len;
761 return hostapd_ioctl_set_generic_elem(drv);
769 struct hostap_driver_data *drv = priv;
777 os_free(drv->wps_ie);
778 drv->wps_ie = NULL;
779 drv->wps_ie_len = 0;
781 drv->wps_ie = os_memdup(wpabuf_head(proberesp),
783 if (drv->wps_ie == NULL)
785 drv->wps_ie_len = wpabuf_len(proberesp);
788 return hostapd_ioctl_set_generic_elem(drv);
793 hostapd_wireless_event_wireless_custom(struct hostap_driver_data *drv,
814 wpa_supplicant_event(drv->hapd,
825 static void hostapd_wireless_event_wireless(struct hostap_driver_data *drv,
844 if (drv->we_version > 18 &&
866 hostapd_wireless_event_wireless_custom(drv, buf);
880 struct hostap_driver_data *drv = ctx;
894 drv, ((char *) attr) + rta_len,
902 static int hostap_get_we_version(struct hostap_driver_data *drv)
909 drv->we_version = 0;
921 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
928 if (ioctl(drv->ioctl_sock, SIOCGIWRANGE, &iwr) < 0) {
940 drv->we_version = range->we_version_compiled;
948 static int hostap_wireless_event_init(struct hostap_driver_data *drv)
952 hostap_get_we_version(drv);
957 cfg->ctx = drv;
959 drv->netlink = netlink_init(cfg);
960 if (drv->netlink == NULL) {
972 struct hostap_driver_data *drv;
974 drv = os_zalloc(sizeof(struct hostap_driver_data));
975 if (drv == NULL) {
980 drv->hapd = hapd;
981 drv->ioctl_sock = drv->sock = -1;
982 memcpy(drv->iface, params->ifname, sizeof(drv->iface));
984 drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0);
985 if (drv->ioctl_sock < 0) {
988 os_free(drv);
992 if (hostap_ioctl_prism2param(drv, PRISM2_PARAM_HOSTAPD, 1)) {
995 drv->iface);
996 close(drv->ioctl_sock);
997 os_free(drv);
1001 if (hostap_init_sockets(drv, params->own_addr) ||
1002 hostap_wireless_event_init(drv)) {
1003 close(drv->ioctl_sock);
1004 os_free(drv);
1008 return drv;
1014 struct hostap_driver_data *drv = priv;
1016 netlink_deinit(drv->netlink);
1017 (void) hostap_set_iface_flags(drv, 0);
1018 (void) hostap_ioctl_prism2param(drv, PRISM2_PARAM_HOSTAPD, 0);
1019 (void) hostap_ioctl_prism2param(drv, PRISM2_PARAM_HOSTAPD_STA, 0);
1021 if (drv->ioctl_sock >= 0)
1022 close(drv->ioctl_sock);
1024 if (drv->sock >= 0)
1025 close(drv->sock);
1027 os_free(drv->generic_ie);
1028 os_free(drv->wps_ie);
1030 free(drv);
1037 struct hostap_driver_data *drv = priv;
1057 return hostap_send_mlme(drv, (u8 *) &mgmt, IEEE80211_HDRLEN +
1064 struct hostap_driver_data *drv = priv;
1068 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
1072 if (ioctl(drv->ioctl_sock, SIOCSIWFREQ, &iwr) < 0) {
1085 struct hostap_driver_data *drv = priv;
1095 return hostap_send_mlme(drv, (u8 *) &mgmt, IEEE80211_HDRLEN +