Lines Matching refs:drv
30 static int wpa_priv_reg_cmd(struct wpa_driver_privsep_data *drv, int cmd)
34 res = sendto(drv->priv_socket, &cmd, sizeof(cmd), 0,
35 (struct sockaddr *) &drv->priv_addr,
36 sizeof(drv->priv_addr));
43 static int wpa_priv_cmd(struct wpa_driver_privsep_data *drv, int cmd,
58 msg.msg_name = &drv->priv_addr;
59 msg.msg_namelen = sizeof(drv->priv_addr);
61 if (sendmsg(drv->cmd_socket, &msg, 0) < 0) {
73 FD_SET(drv->cmd_socket, &rfds);
76 res = select(drv->cmd_socket + 1, &rfds, NULL, NULL, &tv);
82 if (FD_ISSET(drv->cmd_socket, &rfds)) {
83 res = recv(drv->cmd_socket, reply, *reply_len, 0);
104 struct wpa_driver_privsep_data *drv = priv;
124 return wpa_priv_cmd(drv, PRIVSEP_CMD_SCAN, &scan, sizeof(scan),
132 struct wpa_driver_privsep_data *drv = priv;
142 res = wpa_priv_cmd(drv, PRIVSEP_CMD_GET_SCAN_RESULTS,
215 struct wpa_driver_privsep_data *drv = priv;
238 return wpa_priv_cmd(drv, PRIVSEP_CMD_SET_KEY, &cmd, sizeof(cmd),
246 struct wpa_driver_privsep_data *drv = priv;
285 res = wpa_priv_cmd(drv, PRIVSEP_CMD_AUTHENTICATE, data, buflen,
296 struct wpa_driver_privsep_data *drv = priv;
329 res = wpa_priv_cmd(drv, PRIVSEP_CMD_ASSOCIATE, data, buflen,
339 struct wpa_driver_privsep_data *drv = priv;
343 res = wpa_priv_cmd(drv, PRIVSEP_CMD_GET_BSSID, NULL, 0, bssid, &len);
352 struct wpa_driver_privsep_data *drv = priv;
357 res = wpa_priv_cmd(drv, PRIVSEP_CMD_GET_SSID, NULL, 0, reply, &len);
374 //struct wpa_driver_privsep_data *drv = priv;
528 struct wpa_driver_privsep_data *drv = eloop_ctx;
565 wpa_supplicant_event(drv->ctx, EVENT_SCAN_RESULTS, NULL);
568 wpa_supplicant_event(drv->ctx, EVENT_SCAN_STARTED, NULL);
571 wpa_driver_privsep_event_assoc(drv->ctx, EVENT_ASSOC,
575 wpa_supplicant_event(drv->ctx, EVENT_DISASSOC, NULL);
578 wpa_driver_privsep_event_assoc(drv->ctx, EVENT_ASSOCINFO,
583 drv->ctx, event_buf, event_len);
586 wpa_driver_privsep_event_interface_status(drv->ctx, event_buf,
590 wpa_driver_privsep_event_pmkid_candidate(drv->ctx, event_buf,
594 wpa_driver_privsep_event_stkstart(drv->ctx, event_buf,
598 wpa_driver_privsep_event_ft_response(drv->ctx, event_buf,
602 wpa_driver_privsep_event_rx_eapol(drv->ctx, event_buf,
606 wpa_driver_privsep_event_auth(drv->ctx, event_buf, event_len);
616 struct wpa_driver_privsep_data *drv;
618 drv = os_zalloc(sizeof(*drv));
619 if (drv == NULL)
621 drv->ctx = ctx;
622 drv->priv_socket = -1;
623 drv->cmd_socket = -1;
624 os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname));
626 return drv;
632 struct wpa_driver_privsep_data *drv = priv;
634 if (drv->priv_socket >= 0) {
635 wpa_priv_reg_cmd(drv, PRIVSEP_CMD_UNREGISTER);
636 eloop_unregister_read_sock(drv->priv_socket);
637 close(drv->priv_socket);
640 if (drv->own_socket_path) {
641 unlink(drv->own_socket_path);
642 os_free(drv->own_socket_path);
645 if (drv->cmd_socket >= 0) {
646 eloop_unregister_read_sock(drv->cmd_socket);
647 close(drv->cmd_socket);
650 if (drv->own_cmd_path) {
651 unlink(drv->own_cmd_path);
652 os_free(drv->own_cmd_path);
655 os_free(drv);
661 struct wpa_driver_privsep_data *drv = priv;
710 drv->own_socket_path = os_malloc(len);
711 if (drv->own_socket_path == NULL) {
716 os_snprintf(drv->own_socket_path, len, "%s/wpa_privsep-%d-%d",
720 drv->own_cmd_path = os_malloc(len);
721 if (drv->own_cmd_path == NULL) {
722 os_free(drv->own_socket_path);
723 drv->own_socket_path = NULL;
728 os_snprintf(drv->own_cmd_path, len, "%s/wpa_privsep-%d-%d",
733 drv->priv_addr.sun_family = AF_UNIX;
734 os_snprintf(drv->priv_addr.sun_path, sizeof(drv->priv_addr.sun_path),
735 "%s/%s", priv_dir, drv->ifname);
738 drv->priv_socket = socket(PF_UNIX, SOCK_DGRAM, 0);
739 if (drv->priv_socket < 0) {
741 os_free(drv->own_socket_path);
742 drv->own_socket_path = NULL;
748 os_strlcpy(addr.sun_path, drv->own_socket_path, sizeof(addr.sun_path));
749 if (bind(drv->priv_socket, (struct sockaddr *) &addr, sizeof(addr)) <
754 close(drv->priv_socket);
755 drv->priv_socket = -1;
756 unlink(drv->own_socket_path);
757 os_free(drv->own_socket_path);
758 drv->own_socket_path = NULL;
762 eloop_register_read_sock(drv->priv_socket, wpa_driver_privsep_receive,
763 drv, NULL);
765 drv->cmd_socket = socket(PF_UNIX, SOCK_DGRAM, 0);
766 if (drv->cmd_socket < 0) {
768 os_free(drv->own_cmd_path);
769 drv->own_cmd_path = NULL;
775 os_strlcpy(addr.sun_path, drv->own_cmd_path, sizeof(addr.sun_path));
776 if (bind(drv->cmd_socket, (struct sockaddr *) &addr, sizeof(addr)) < 0)
781 close(drv->cmd_socket);
782 drv->cmd_socket = -1;
783 unlink(drv->own_cmd_path);
784 os_free(drv->own_cmd_path);
785 drv->own_cmd_path = NULL;
789 if (wpa_priv_reg_cmd(drv, PRIVSEP_CMD_REGISTER) < 0) {
801 struct wpa_driver_privsep_data *drv = priv;
805 res = wpa_priv_cmd(drv, PRIVSEP_CMD_GET_CAPA, NULL, 0, capa, &len);
818 struct wpa_driver_privsep_data *drv = priv;
820 return drv->own_addr;
826 struct wpa_driver_privsep_data *drv = priv;
828 return wpa_priv_cmd(drv, PRIVSEP_CMD_SET_COUNTRY, alpha2,