Lines Matching refs: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)
181 handle_tx_callback(drv, buf, data_len, ver == 2 ? 1 : 0);
193 wpa_supplicant_event(drv->hapd, EVENT_RX_MGMT, &event);
200 handle_data(drv, buf, data_len, stype);
211 struct hostap_driver_data *drv = eloop_ctx;
221 handle_frame(drv, buf, len);
225 static int hostap_init_sockets(struct hostap_driver_data *drv, u8 *own_addr)
230 drv->sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
231 if (drv->sock < 0) {
236 if (eloop_register_read_sock(drv->sock, handle_read, drv, NULL)) {
242 snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%sap", drv->iface);
243 if (ioctl(drv->sock, SIOCGIFINDEX, &ifr) != 0) {
248 if (hostap_set_iface_flags(drv, 1)) {
258 if (bind(drv->sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
263 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);
331 struct hostap_driver_data *drv = priv;
345 return hostapd_ioctl(drv, &param, sizeof(param));
351 struct hostap_driver_data *drv = priv;
355 os_snprintf(ifname, IFNAMSIZ, "%sap", drv->iface);
356 if (linux_set_iface_flags(drv->ioctl_sock, ifname, dev_up) < 0)
363 if (ioctl(drv->ioctl_sock, SIOCSIFMTU, &ifr) != 0) {
377 struct hostap_driver_data *drv = priv;
381 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
385 if (ioctl(drv->ioctl_sock, PRISM2_IOCTL_HOSTAPD, &iwr) < 0) {
400 struct hostap_driver_data *drv = priv;
443 if (hostapd_ioctl(drv, param, blen)) {
456 struct hostap_driver_data *drv = priv;
475 if (hostapd_ioctl(drv, param, blen)) {
489 struct hostap_driver_data *drv = priv;
494 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
499 if (ioctl(drv->ioctl_sock, PRISM2_IOCTL_PRISM2_PARAM, &iwr) < 0) {
510 struct hostap_driver_data *drv = priv;
514 if (hostap_ioctl_prism2param(drv, PRISM2_PARAM_IEEE_802_1X, enabled)) {
525 if (hostap_ioctl_prism2param(drv, PRISM2_PARAM_HOST_DECRYPT, 1) ||
526 hostap_ioctl_prism2param(drv, PRISM2_PARAM_HOST_ENCRYPT, 1)) {
538 struct hostap_drvier_data *drv = priv;
540 return hostap_ioctl_prism2param(drv, PRISM2_PARAM_PRIVACY_INVOKED,
547 struct hostap_driver_data *drv = priv;
551 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
556 if (ioctl(drv->ioctl_sock, SIOCSIWESSID, &iwr) < 0) {
568 struct hostap_driver_data *drv = priv;
573 return hostapd_ioctl(drv, &param, sizeof(param));
581 struct hostap_driver_data *drv = priv;
588 drv->iface, MAC2STR(addr));
621 struct hostap_driver_data *drv = priv;
648 return hostapd_ioctl(drv, &param, sizeof(param));
654 struct hostap_driver_data *drv = priv;
657 hostap_sta_set_flags(drv, addr, 0, 0, ~WPA_STA_AUTHORIZED);
662 if (hostapd_ioctl(drv, &param, sizeof(param))) {
672 struct hostap_driver_data *drv = priv;
678 if (hostapd_ioctl(drv, &param, sizeof(param))) {
688 struct hostap_driver_data *drv = priv;
694 if (hostapd_ioctl(drv, &param, sizeof(param))) {
702 static int hostapd_ioctl_set_generic_elem(struct hostap_driver_data *drv)
708 elem_len = drv->generic_ie_len + drv->wps_ie_len;
719 if (drv->generic_ie) {
720 os_memcpy(param->u.generic_elem.data, drv->generic_ie,
721 drv->generic_ie_len);
723 if (drv->wps_ie) {
724 os_memcpy(&param->u.generic_elem.data[drv->generic_ie_len],
725 drv->wps_ie, drv->wps_ie_len);
729 res = hostapd_ioctl(drv, param, blen);
740 struct hostap_driver_data *drv = priv;
742 os_free(drv->generic_ie);
743 drv->generic_ie = NULL;
744 drv->generic_ie_len = 0;
746 drv->generic_ie = os_malloc(elem_len);
747 if (drv->generic_ie == NULL)
749 os_memcpy(drv->generic_ie, elem, elem_len);
750 drv->generic_ie_len = elem_len;
753 return hostapd_ioctl_set_generic_elem(drv);
761 struct hostap_driver_data *drv = priv;
769 os_free(drv->wps_ie);
770 drv->wps_ie = NULL;
771 drv->wps_ie_len = 0;
773 drv->wps_ie = os_malloc(wpabuf_len(proberesp));
774 if (drv->wps_ie == NULL)
776 os_memcpy(drv->wps_ie, wpabuf_head(proberesp),
778 drv->wps_ie_len = wpabuf_len(proberesp);
781 return hostapd_ioctl_set_generic_elem(drv);
786 hostapd_wireless_event_wireless_custom(struct hostap_driver_data *drv,
807 wpa_supplicant_event(drv->hapd,
818 static void hostapd_wireless_event_wireless(struct hostap_driver_data *drv,
837 if (drv->we_version > 18 &&
859 hostapd_wireless_event_wireless_custom(drv, buf);
873 struct hostap_driver_data *drv = ctx;
887 drv, ((char *) attr) + rta_len,
895 static int hostap_get_we_version(struct hostap_driver_data *drv)
902 drv->we_version = 0;
914 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
921 if (ioctl(drv->ioctl_sock, SIOCGIWRANGE, &iwr) < 0) {
932 drv->we_version = range->we_version_compiled;
940 static int hostap_wireless_event_init(struct hostap_driver_data *drv)
944 hostap_get_we_version(drv);
949 cfg->ctx = drv;
951 drv->netlink = netlink_init(cfg);
952 if (drv->netlink == NULL) {
964 struct hostap_driver_data *drv;
966 drv = os_zalloc(sizeof(struct hostap_driver_data));
967 if (drv == NULL) {
972 drv->hapd = hapd;
973 drv->ioctl_sock = drv->sock = -1;
974 memcpy(drv->iface, params->ifname, sizeof(drv->iface));
976 drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0);
977 if (drv->ioctl_sock < 0) {
979 free(drv);
983 if (hostap_ioctl_prism2param(drv, PRISM2_PARAM_HOSTAPD, 1)) {
985 drv->iface);
986 close(drv->ioctl_sock);
987 free(drv);
991 if (hostap_init_sockets(drv, params->own_addr) ||
992 hostap_wireless_event_init(drv)) {
993 close(drv->ioctl_sock);
994 free(drv);
998 return drv;
1004 struct hostap_driver_data *drv = priv;
1006 netlink_deinit(drv->netlink);
1007 (void) hostap_set_iface_flags(drv, 0);
1008 (void) hostap_ioctl_prism2param(drv, PRISM2_PARAM_HOSTAPD, 0);
1009 (void) hostap_ioctl_prism2param(drv, PRISM2_PARAM_HOSTAPD_STA, 0);
1011 if (drv->ioctl_sock >= 0)
1012 close(drv->ioctl_sock);
1014 if (drv->sock >= 0)
1015 close(drv->sock);
1017 os_free(drv->generic_ie);
1018 os_free(drv->wps_ie);
1020 free(drv);
1027 struct hostap_driver_data *drv = priv;
1047 return hostap_send_mlme(drv, (u8 *) &mgmt, IEEE80211_HDRLEN +
1054 struct hostap_driver_data *drv = priv;
1058 os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
1062 if (ioctl(drv->ioctl_sock, SIOCSIWFREQ, &iwr) < 0) {
1074 struct hostap_driver_data *drv = priv;
1084 return hostap_send_mlme(drv, (u8 *) &mgmt, IEEE80211_HDRLEN +