Lines Matching refs:drv

30 static int wpa_priv_reg_cmd(struct wpa_driver_privsep_data *drv, int cmd)  in wpa_priv_reg_cmd()  argument
34 res = sendto(drv->priv_socket, &cmd, sizeof(cmd), 0, in wpa_priv_reg_cmd()
35 (struct sockaddr *) &drv->priv_addr, in wpa_priv_reg_cmd()
36 sizeof(drv->priv_addr)); in wpa_priv_reg_cmd()
43 static int wpa_priv_cmd(struct wpa_driver_privsep_data *drv, int cmd, in wpa_priv_cmd() argument
58 msg.msg_name = &drv->priv_addr; in wpa_priv_cmd()
59 msg.msg_namelen = sizeof(drv->priv_addr); in wpa_priv_cmd()
61 if (sendmsg(drv->cmd_socket, &msg, 0) < 0) { in wpa_priv_cmd()
73 FD_SET(drv->cmd_socket, &rfds); in wpa_priv_cmd()
76 res = select(drv->cmd_socket + 1, &rfds, NULL, NULL, &tv); in wpa_priv_cmd()
82 if (FD_ISSET(drv->cmd_socket, &rfds)) { in wpa_priv_cmd()
83 res = recv(drv->cmd_socket, reply, *reply_len, 0); in wpa_priv_cmd()
104 struct wpa_driver_privsep_data *drv = priv; in wpa_driver_privsep_scan() local
108 return wpa_priv_cmd(drv, PRIVSEP_CMD_SCAN, ssid, ssid_len, in wpa_driver_privsep_scan()
116 struct wpa_driver_privsep_data *drv = priv; in wpa_driver_privsep_get_scan_results2() local
126 res = wpa_priv_cmd(drv, PRIVSEP_CMD_GET_SCAN_RESULTS, in wpa_driver_privsep_get_scan_results2()
195 struct wpa_driver_privsep_data *drv = priv; in wpa_driver_privsep_set_key() local
218 return wpa_priv_cmd(drv, PRIVSEP_CMD_SET_KEY, &cmd, sizeof(cmd), in wpa_driver_privsep_set_key()
226 struct wpa_driver_privsep_data *drv = priv; in wpa_driver_privsep_authenticate() local
265 res = wpa_priv_cmd(drv, PRIVSEP_CMD_AUTHENTICATE, data, buflen, in wpa_driver_privsep_authenticate()
276 struct wpa_driver_privsep_data *drv = priv; in wpa_driver_privsep_associate() local
309 res = wpa_priv_cmd(drv, PRIVSEP_CMD_ASSOCIATE, data, buflen, in wpa_driver_privsep_associate()
319 struct wpa_driver_privsep_data *drv = priv; in wpa_driver_privsep_get_bssid() local
323 res = wpa_priv_cmd(drv, PRIVSEP_CMD_GET_BSSID, NULL, 0, bssid, &len); in wpa_driver_privsep_get_bssid()
332 struct wpa_driver_privsep_data *drv = priv; in wpa_driver_privsep_get_ssid() local
337 res = wpa_priv_cmd(drv, PRIVSEP_CMD_GET_SSID, NULL, 0, reply, &len); in wpa_driver_privsep_get_ssid()
508 struct wpa_driver_privsep_data *drv = eloop_ctx; in wpa_driver_privsep_receive() local
545 wpa_supplicant_event(drv->ctx, EVENT_SCAN_RESULTS, NULL); in wpa_driver_privsep_receive()
548 wpa_supplicant_event(drv->ctx, EVENT_SCAN_STARTED, NULL); in wpa_driver_privsep_receive()
551 wpa_driver_privsep_event_assoc(drv->ctx, EVENT_ASSOC, in wpa_driver_privsep_receive()
555 wpa_supplicant_event(drv->ctx, EVENT_DISASSOC, NULL); in wpa_driver_privsep_receive()
558 wpa_driver_privsep_event_assoc(drv->ctx, EVENT_ASSOCINFO, in wpa_driver_privsep_receive()
563 drv->ctx, event_buf, event_len); in wpa_driver_privsep_receive()
566 wpa_driver_privsep_event_interface_status(drv->ctx, event_buf, in wpa_driver_privsep_receive()
570 wpa_driver_privsep_event_pmkid_candidate(drv->ctx, event_buf, in wpa_driver_privsep_receive()
574 wpa_driver_privsep_event_stkstart(drv->ctx, event_buf, in wpa_driver_privsep_receive()
578 wpa_driver_privsep_event_ft_response(drv->ctx, event_buf, in wpa_driver_privsep_receive()
582 wpa_driver_privsep_event_rx_eapol(drv->ctx, event_buf, in wpa_driver_privsep_receive()
586 wpa_driver_privsep_event_auth(drv->ctx, event_buf, event_len); in wpa_driver_privsep_receive()
596 struct wpa_driver_privsep_data *drv; in wpa_driver_privsep_init() local
598 drv = os_zalloc(sizeof(*drv)); in wpa_driver_privsep_init()
599 if (drv == NULL) in wpa_driver_privsep_init()
601 drv->ctx = ctx; in wpa_driver_privsep_init()
602 drv->priv_socket = -1; in wpa_driver_privsep_init()
603 drv->cmd_socket = -1; in wpa_driver_privsep_init()
604 os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname)); in wpa_driver_privsep_init()
606 return drv; in wpa_driver_privsep_init()
612 struct wpa_driver_privsep_data *drv = priv; in wpa_driver_privsep_deinit() local
614 if (drv->priv_socket >= 0) { in wpa_driver_privsep_deinit()
615 wpa_priv_reg_cmd(drv, PRIVSEP_CMD_UNREGISTER); in wpa_driver_privsep_deinit()
616 eloop_unregister_read_sock(drv->priv_socket); in wpa_driver_privsep_deinit()
617 close(drv->priv_socket); in wpa_driver_privsep_deinit()
620 if (drv->own_socket_path) { in wpa_driver_privsep_deinit()
621 unlink(drv->own_socket_path); in wpa_driver_privsep_deinit()
622 os_free(drv->own_socket_path); in wpa_driver_privsep_deinit()
625 if (drv->cmd_socket >= 0) { in wpa_driver_privsep_deinit()
626 eloop_unregister_read_sock(drv->cmd_socket); in wpa_driver_privsep_deinit()
627 close(drv->cmd_socket); in wpa_driver_privsep_deinit()
630 if (drv->own_cmd_path) { in wpa_driver_privsep_deinit()
631 unlink(drv->own_cmd_path); in wpa_driver_privsep_deinit()
632 os_free(drv->own_cmd_path); in wpa_driver_privsep_deinit()
635 os_free(drv); in wpa_driver_privsep_deinit()
641 struct wpa_driver_privsep_data *drv = priv; in wpa_driver_privsep_set_param() local
690 drv->own_socket_path = os_malloc(len); in wpa_driver_privsep_set_param()
691 if (drv->own_socket_path == NULL) { in wpa_driver_privsep_set_param()
696 os_snprintf(drv->own_socket_path, len, "%s/wpa_privsep-%d-%d", in wpa_driver_privsep_set_param()
700 drv->own_cmd_path = os_malloc(len); in wpa_driver_privsep_set_param()
701 if (drv->own_cmd_path == NULL) { in wpa_driver_privsep_set_param()
702 os_free(drv->own_socket_path); in wpa_driver_privsep_set_param()
703 drv->own_socket_path = NULL; in wpa_driver_privsep_set_param()
708 os_snprintf(drv->own_cmd_path, len, "%s/wpa_privsep-%d-%d", in wpa_driver_privsep_set_param()
713 drv->priv_addr.sun_family = AF_UNIX; in wpa_driver_privsep_set_param()
714 os_snprintf(drv->priv_addr.sun_path, sizeof(drv->priv_addr.sun_path), in wpa_driver_privsep_set_param()
715 "%s/%s", priv_dir, drv->ifname); in wpa_driver_privsep_set_param()
718 drv->priv_socket = socket(PF_UNIX, SOCK_DGRAM, 0); in wpa_driver_privsep_set_param()
719 if (drv->priv_socket < 0) { in wpa_driver_privsep_set_param()
721 os_free(drv->own_socket_path); in wpa_driver_privsep_set_param()
722 drv->own_socket_path = NULL; in wpa_driver_privsep_set_param()
728 os_strlcpy(addr.sun_path, drv->own_socket_path, sizeof(addr.sun_path)); in wpa_driver_privsep_set_param()
729 if (bind(drv->priv_socket, (struct sockaddr *) &addr, sizeof(addr)) < in wpa_driver_privsep_set_param()
734 close(drv->priv_socket); in wpa_driver_privsep_set_param()
735 drv->priv_socket = -1; in wpa_driver_privsep_set_param()
736 unlink(drv->own_socket_path); in wpa_driver_privsep_set_param()
737 os_free(drv->own_socket_path); in wpa_driver_privsep_set_param()
738 drv->own_socket_path = NULL; in wpa_driver_privsep_set_param()
742 eloop_register_read_sock(drv->priv_socket, wpa_driver_privsep_receive, in wpa_driver_privsep_set_param()
743 drv, NULL); in wpa_driver_privsep_set_param()
745 drv->cmd_socket = socket(PF_UNIX, SOCK_DGRAM, 0); in wpa_driver_privsep_set_param()
746 if (drv->cmd_socket < 0) { in wpa_driver_privsep_set_param()
748 os_free(drv->own_cmd_path); in wpa_driver_privsep_set_param()
749 drv->own_cmd_path = NULL; in wpa_driver_privsep_set_param()
755 os_strlcpy(addr.sun_path, drv->own_cmd_path, sizeof(addr.sun_path)); in wpa_driver_privsep_set_param()
756 if (bind(drv->cmd_socket, (struct sockaddr *) &addr, sizeof(addr)) < 0) in wpa_driver_privsep_set_param()
761 close(drv->cmd_socket); in wpa_driver_privsep_set_param()
762 drv->cmd_socket = -1; in wpa_driver_privsep_set_param()
763 unlink(drv->own_cmd_path); in wpa_driver_privsep_set_param()
764 os_free(drv->own_cmd_path); in wpa_driver_privsep_set_param()
765 drv->own_cmd_path = NULL; in wpa_driver_privsep_set_param()
769 if (wpa_priv_reg_cmd(drv, PRIVSEP_CMD_REGISTER) < 0) { in wpa_driver_privsep_set_param()
781 struct wpa_driver_privsep_data *drv = priv; in wpa_driver_privsep_get_capa() local
785 res = wpa_priv_cmd(drv, PRIVSEP_CMD_GET_CAPA, NULL, 0, capa, &len); in wpa_driver_privsep_get_capa()
798 struct wpa_driver_privsep_data *drv = priv; in wpa_driver_privsep_get_mac_addr() local
800 return drv->own_addr; in wpa_driver_privsep_get_mac_addr()
806 struct wpa_driver_privsep_data *drv = priv; in wpa_driver_privsep_set_country() local
808 return wpa_priv_cmd(drv, PRIVSEP_CMD_SET_COUNTRY, alpha2, in wpa_driver_privsep_set_country()