• Home
  • Raw
  • Download

Lines Matching refs:iface

50 static void wpa_priv_cmd_register(struct wpa_priv_interface *iface,  in wpa_priv_cmd_register()  argument
53 if (iface->drv_priv) { in wpa_priv_cmd_register()
55 if (iface->driver->deinit) in wpa_priv_cmd_register()
56 iface->driver->deinit(iface->drv_priv); in wpa_priv_cmd_register()
57 iface->drv_priv = NULL; in wpa_priv_cmd_register()
58 if (iface->drv_global_priv) { in wpa_priv_cmd_register()
59 iface->driver->global_deinit(iface->drv_global_priv); in wpa_priv_cmd_register()
60 iface->drv_global_priv = NULL; in wpa_priv_cmd_register()
62 iface->wpas_registered = 0; in wpa_priv_cmd_register()
65 if (iface->l2) { in wpa_priv_cmd_register()
68 l2_packet_deinit(iface->l2); in wpa_priv_cmd_register()
69 iface->l2 = NULL; in wpa_priv_cmd_register()
72 if (iface->driver->init2) { in wpa_priv_cmd_register()
73 if (iface->driver->global_init) { in wpa_priv_cmd_register()
74 iface->drv_global_priv = in wpa_priv_cmd_register()
75 iface->driver->global_init(iface->ctx); in wpa_priv_cmd_register()
76 if (!iface->drv_global_priv) { in wpa_priv_cmd_register()
82 iface->drv_global_priv = NULL; in wpa_priv_cmd_register()
84 iface->drv_priv = iface->driver->init2(iface, iface->ifname, in wpa_priv_cmd_register()
85 iface->drv_global_priv); in wpa_priv_cmd_register()
86 } else if (iface->driver->init) { in wpa_priv_cmd_register()
87 iface->drv_priv = iface->driver->init(iface, iface->ifname); in wpa_priv_cmd_register()
91 if (iface->drv_priv == NULL) { in wpa_priv_cmd_register()
97 "'%s'", iface->driver_name, iface->ifname); in wpa_priv_cmd_register()
99 os_memcpy(&iface->drv_addr, from, sizeof(iface->drv_addr)); in wpa_priv_cmd_register()
100 iface->wpas_registered = 1; in wpa_priv_cmd_register()
102 if (iface->driver->set_param && in wpa_priv_cmd_register()
103 iface->driver->set_param(iface->drv_priv, NULL) < 0) { in wpa_priv_cmd_register()
109 static void wpa_priv_cmd_unregister(struct wpa_priv_interface *iface, in wpa_priv_cmd_unregister() argument
112 if (iface->drv_priv) { in wpa_priv_cmd_unregister()
113 if (iface->driver->deinit) in wpa_priv_cmd_unregister()
114 iface->driver->deinit(iface->drv_priv); in wpa_priv_cmd_unregister()
115 iface->drv_priv = NULL; in wpa_priv_cmd_unregister()
116 if (iface->drv_global_priv) { in wpa_priv_cmd_unregister()
117 iface->driver->global_deinit(iface->drv_global_priv); in wpa_priv_cmd_unregister()
118 iface->drv_global_priv = NULL; in wpa_priv_cmd_unregister()
120 iface->wpas_registered = 0; in wpa_priv_cmd_unregister()
125 static void wpa_priv_cmd_scan(struct wpa_priv_interface *iface, in wpa_priv_cmd_scan() argument
130 if (iface->drv_priv == NULL) in wpa_priv_cmd_scan()
140 if (iface->driver->scan2) in wpa_priv_cmd_scan()
141 iface->driver->scan2(iface->drv_priv, &params); in wpa_priv_cmd_scan()
145 static void wpa_priv_get_scan_results2(struct wpa_priv_interface *iface, in wpa_priv_get_scan_results2() argument
153 res = iface->driver->get_scan_results2(iface->drv_priv); in wpa_priv_get_scan_results2()
177 sendto(iface->fd, buf, pos - buf, 0, (struct sockaddr *) from, in wpa_priv_get_scan_results2()
187 sendto(iface->fd, "", 0, 0, (struct sockaddr *) from, sizeof(*from)); in wpa_priv_get_scan_results2()
191 static void wpa_priv_cmd_get_scan_results(struct wpa_priv_interface *iface, in wpa_priv_cmd_get_scan_results() argument
194 if (iface->drv_priv == NULL) in wpa_priv_cmd_get_scan_results()
197 if (iface->driver->get_scan_results2) in wpa_priv_cmd_get_scan_results()
198 wpa_priv_get_scan_results2(iface, from); in wpa_priv_cmd_get_scan_results()
200 sendto(iface->fd, "", 0, 0, (struct sockaddr *) from, in wpa_priv_cmd_get_scan_results()
205 static void wpa_priv_cmd_authenticate(struct wpa_priv_interface *iface, in wpa_priv_cmd_authenticate() argument
212 if (iface->drv_priv == NULL || iface->driver->authenticate == NULL) in wpa_priv_cmd_authenticate()
252 res = iface->driver->authenticate(iface->drv_priv, &params); in wpa_priv_cmd_authenticate()
257 static void wpa_priv_cmd_associate(struct wpa_priv_interface *iface, in wpa_priv_cmd_associate() argument
265 if (iface->drv_priv == NULL || iface->driver->associate == NULL) in wpa_priv_cmd_associate()
300 res = iface->driver->associate(iface->drv_priv, &params); in wpa_priv_cmd_associate()
305 static void wpa_priv_cmd_get_bssid(struct wpa_priv_interface *iface, in wpa_priv_cmd_get_bssid() argument
310 if (iface->drv_priv == NULL) in wpa_priv_cmd_get_bssid()
313 if (iface->driver->get_bssid == NULL || in wpa_priv_cmd_get_bssid()
314 iface->driver->get_bssid(iface->drv_priv, bssid) < 0) in wpa_priv_cmd_get_bssid()
317 sendto(iface->fd, bssid, ETH_ALEN, 0, (struct sockaddr *) from, in wpa_priv_cmd_get_bssid()
322 sendto(iface->fd, "", 0, 0, (struct sockaddr *) from, sizeof(*from)); in wpa_priv_cmd_get_bssid()
326 static void wpa_priv_cmd_get_ssid(struct wpa_priv_interface *iface, in wpa_priv_cmd_get_ssid() argument
332 if (iface->drv_priv == NULL) in wpa_priv_cmd_get_ssid()
335 if (iface->driver->get_ssid == NULL) in wpa_priv_cmd_get_ssid()
338 res = iface->driver->get_ssid(iface->drv_priv, &ssid[sizeof(int)]); in wpa_priv_cmd_get_ssid()
343 sendto(iface->fd, ssid, sizeof(ssid), 0, (struct sockaddr *) from, in wpa_priv_cmd_get_ssid()
348 sendto(iface->fd, "", 0, 0, (struct sockaddr *) from, sizeof(*from)); in wpa_priv_cmd_get_ssid()
352 static void wpa_priv_cmd_set_key(struct wpa_priv_interface *iface, in wpa_priv_cmd_set_key() argument
358 if (iface->drv_priv == NULL || iface->driver->set_key == NULL) in wpa_priv_cmd_set_key()
368 res = iface->driver->set_key(iface->ifname, iface->drv_priv, in wpa_priv_cmd_set_key()
380 static void wpa_priv_cmd_get_capa(struct wpa_priv_interface *iface, in wpa_priv_cmd_get_capa() argument
385 if (iface->drv_priv == NULL) in wpa_priv_cmd_get_capa()
388 if (iface->driver->get_capa == NULL || in wpa_priv_cmd_get_capa()
389 iface->driver->get_capa(iface->drv_priv, &capa) < 0) in wpa_priv_cmd_get_capa()
396 sendto(iface->fd, &capa, sizeof(capa), 0, (struct sockaddr *) from, in wpa_priv_cmd_get_capa()
401 sendto(iface->fd, "", 0, 0, (struct sockaddr *) from, sizeof(*from)); in wpa_priv_cmd_get_capa()
408 struct wpa_priv_interface *iface = ctx; in wpa_priv_l2_rx() local
420 msg.msg_name = &iface->l2_addr; in wpa_priv_l2_rx()
421 msg.msg_namelen = sizeof(iface->l2_addr); in wpa_priv_l2_rx()
423 if (sendmsg(iface->fd, &msg, 0) < 0) { in wpa_priv_l2_rx()
429 static void wpa_priv_cmd_l2_register(struct wpa_priv_interface *iface, in wpa_priv_cmd_l2_register() argument
452 if (iface->l2) { in wpa_priv_cmd_l2_register()
455 l2_packet_deinit(iface->l2); in wpa_priv_cmd_l2_register()
456 iface->l2 = NULL; in wpa_priv_cmd_l2_register()
459 os_memcpy(&iface->l2_addr, from, sizeof(iface->l2_addr)); in wpa_priv_cmd_l2_register()
461 iface->l2 = l2_packet_init(iface->ifname, NULL, proto, in wpa_priv_cmd_l2_register()
462 wpa_priv_l2_rx, iface, reg_cmd[1]); in wpa_priv_cmd_l2_register()
463 if (iface->l2 == NULL) { in wpa_priv_cmd_l2_register()
469 if (l2_packet_get_own_addr(iface->l2, own_addr) < 0) { in wpa_priv_cmd_l2_register()
472 l2_packet_deinit(iface->l2); in wpa_priv_cmd_l2_register()
473 iface->l2 = NULL; in wpa_priv_cmd_l2_register()
477 res = sendto(iface->fd, own_addr, ETH_ALEN, 0, in wpa_priv_cmd_l2_register()
483 static void wpa_priv_cmd_l2_unregister(struct wpa_priv_interface *iface, in wpa_priv_cmd_l2_unregister() argument
486 if (iface->l2) { in wpa_priv_cmd_l2_unregister()
487 l2_packet_deinit(iface->l2); in wpa_priv_cmd_l2_unregister()
488 iface->l2 = NULL; in wpa_priv_cmd_l2_unregister()
493 static void wpa_priv_cmd_l2_notify_auth_start(struct wpa_priv_interface *iface, in wpa_priv_cmd_l2_notify_auth_start() argument
496 if (iface->l2) in wpa_priv_cmd_l2_notify_auth_start()
497 l2_packet_notify_auth_start(iface->l2); in wpa_priv_cmd_l2_notify_auth_start()
501 static void wpa_priv_cmd_l2_send(struct wpa_priv_interface *iface, in wpa_priv_cmd_l2_send() argument
509 if (iface->l2 == NULL) in wpa_priv_cmd_l2_send()
527 res = l2_packet_send(iface->l2, dst_addr, proto, buf + ETH_ALEN + 2, in wpa_priv_cmd_l2_send()
533 static void wpa_priv_cmd_set_country(struct wpa_priv_interface *iface, in wpa_priv_cmd_set_country() argument
536 if (iface->drv_priv == NULL || iface->driver->set_country == NULL || in wpa_priv_cmd_set_country()
540 iface->driver->set_country(iface->drv_priv, buf); in wpa_priv_cmd_set_country()
546 struct wpa_priv_interface *iface = eloop_ctx; in wpa_priv_receive() local
568 cmd, iface->ifname); in wpa_priv_receive()
574 wpa_priv_cmd_register(iface, &from); in wpa_priv_receive()
577 wpa_priv_cmd_unregister(iface, &from); in wpa_priv_receive()
580 wpa_priv_cmd_scan(iface, cmd_buf, cmd_len); in wpa_priv_receive()
583 wpa_priv_cmd_get_scan_results(iface, &from); in wpa_priv_receive()
586 wpa_priv_cmd_associate(iface, cmd_buf, cmd_len); in wpa_priv_receive()
589 wpa_priv_cmd_get_bssid(iface, &from); in wpa_priv_receive()
592 wpa_priv_cmd_get_ssid(iface, &from); in wpa_priv_receive()
595 wpa_priv_cmd_set_key(iface, cmd_buf, cmd_len); in wpa_priv_receive()
598 wpa_priv_cmd_get_capa(iface, &from); in wpa_priv_receive()
601 wpa_priv_cmd_l2_register(iface, &from, cmd_buf, cmd_len); in wpa_priv_receive()
604 wpa_priv_cmd_l2_unregister(iface, &from); in wpa_priv_receive()
607 wpa_priv_cmd_l2_notify_auth_start(iface, &from); in wpa_priv_receive()
610 wpa_priv_cmd_l2_send(iface, &from, cmd_buf, cmd_len); in wpa_priv_receive()
617 wpa_priv_cmd_set_country(iface, pos); in wpa_priv_receive()
620 wpa_priv_cmd_authenticate(iface, cmd_buf, cmd_len); in wpa_priv_receive()
626 static void wpa_priv_interface_deinit(struct wpa_priv_interface *iface) in wpa_priv_interface_deinit() argument
628 if (iface->drv_priv && iface->driver->deinit) in wpa_priv_interface_deinit()
629 iface->driver->deinit(iface->drv_priv); in wpa_priv_interface_deinit()
631 if (iface->fd >= 0) { in wpa_priv_interface_deinit()
632 eloop_unregister_read_sock(iface->fd); in wpa_priv_interface_deinit()
633 close(iface->fd); in wpa_priv_interface_deinit()
634 unlink(iface->sock_name); in wpa_priv_interface_deinit()
637 if (iface->l2) in wpa_priv_interface_deinit()
638 l2_packet_deinit(iface->l2); in wpa_priv_interface_deinit()
640 os_free(iface->ifname); in wpa_priv_interface_deinit()
641 os_free(iface->driver_name); in wpa_priv_interface_deinit()
642 os_free(iface->sock_name); in wpa_priv_interface_deinit()
643 os_free(iface); in wpa_priv_interface_deinit()
650 struct wpa_priv_interface *iface; in wpa_priv_interface_init() local
660 iface = os_zalloc(sizeof(*iface)); in wpa_priv_interface_init()
661 if (iface == NULL) in wpa_priv_interface_init()
663 iface->fd = -1; in wpa_priv_interface_init()
664 iface->ctx = ctx; in wpa_priv_interface_init()
667 iface->driver_name = dup_binstr(params, len); in wpa_priv_interface_init()
668 if (iface->driver_name == NULL) { in wpa_priv_interface_init()
669 wpa_priv_interface_deinit(iface); in wpa_priv_interface_init()
674 if (os_strcmp(iface->driver_name, in wpa_priv_interface_init()
676 iface->driver = wpa_drivers[i]; in wpa_priv_interface_init()
680 if (iface->driver == NULL) { in wpa_priv_interface_init()
682 iface->driver_name); in wpa_priv_interface_init()
683 wpa_priv_interface_deinit(iface); in wpa_priv_interface_init()
688 iface->ifname = os_strdup(pos); in wpa_priv_interface_init()
689 if (iface->ifname == NULL) { in wpa_priv_interface_init()
690 wpa_priv_interface_deinit(iface); in wpa_priv_interface_init()
694 len = os_strlen(dir) + 1 + os_strlen(iface->ifname); in wpa_priv_interface_init()
695 iface->sock_name = os_malloc(len + 1); in wpa_priv_interface_init()
696 if (iface->sock_name == NULL) { in wpa_priv_interface_init()
697 wpa_priv_interface_deinit(iface); in wpa_priv_interface_init()
701 os_snprintf(iface->sock_name, len + 1, "%s/%s", dir, iface->ifname); in wpa_priv_interface_init()
702 if (os_strlen(iface->sock_name) >= sizeof(addr.sun_path)) { in wpa_priv_interface_init()
703 wpa_priv_interface_deinit(iface); in wpa_priv_interface_init()
707 iface->fd = socket(PF_UNIX, SOCK_DGRAM, 0); in wpa_priv_interface_init()
708 if (iface->fd < 0) { in wpa_priv_interface_init()
710 wpa_priv_interface_deinit(iface); in wpa_priv_interface_init()
716 os_strlcpy(addr.sun_path, iface->sock_name, sizeof(addr.sun_path)); in wpa_priv_interface_init()
718 if (bind(iface->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { in wpa_priv_interface_init()
721 if (connect(iface->fd, (struct sockaddr *) &addr, in wpa_priv_interface_init()
726 if (unlink(iface->sock_name) < 0) { in wpa_priv_interface_init()
729 iface->sock_name, strerror(errno)); in wpa_priv_interface_init()
732 if (bind(iface->fd, (struct sockaddr *) &addr, in wpa_priv_interface_init()
740 "socket '%s'", iface->sock_name); in wpa_priv_interface_init()
745 "not used anymore", iface->sock_name); in wpa_priv_interface_init()
750 if (chmod(iface->sock_name, S_IRWXU | S_IRWXG | S_IRWXO) < 0) { in wpa_priv_interface_init()
755 eloop_register_read_sock(iface->fd, wpa_priv_receive, iface, NULL); in wpa_priv_interface_init()
757 return iface; in wpa_priv_interface_init()
760 wpa_priv_interface_deinit(iface); in wpa_priv_interface_init()
765 static int wpa_priv_send_event(struct wpa_priv_interface *iface, int event, in wpa_priv_send_event() argument
779 msg.msg_name = &iface->drv_addr; in wpa_priv_send_event()
780 msg.msg_namelen = sizeof(iface->drv_addr); in wpa_priv_send_event()
782 if (sendmsg(iface->fd, &msg, 0) < 0) { in wpa_priv_send_event()
792 static void wpa_priv_send_auth(struct wpa_priv_interface *iface, in wpa_priv_send_auth() argument
816 wpa_priv_send_event(iface, PRIVSEP_EVENT_AUTH, buf, buflen); in wpa_priv_send_auth()
822 static void wpa_priv_send_assoc(struct wpa_priv_interface *iface, int event, in wpa_priv_send_assoc() argument
877 wpa_priv_send_event(iface, event, buf, buflen); in wpa_priv_send_assoc()
883 static void wpa_priv_send_interface_status(struct wpa_priv_interface *iface, in wpa_priv_send_interface_status() argument
907 wpa_priv_send_event(iface, PRIVSEP_EVENT_INTERFACE_STATUS, in wpa_priv_send_interface_status()
915 static void wpa_priv_send_ft_response(struct wpa_priv_interface *iface, in wpa_priv_send_ft_response() argument
936 wpa_priv_send_event(iface, PRIVSEP_EVENT_FT_RESPONSE, buf, len); in wpa_priv_send_ft_response()
946 struct wpa_priv_interface *iface = ctx; in wpa_supplicant_event() local
950 if (!iface->wpas_registered) { in wpa_supplicant_event()
958 wpa_priv_send_assoc(iface, PRIVSEP_EVENT_ASSOC, data); in wpa_supplicant_event()
961 wpa_priv_send_event(iface, PRIVSEP_EVENT_DISASSOC, NULL, 0); in wpa_supplicant_event()
966 wpa_priv_send_assoc(iface, PRIVSEP_EVENT_ASSOCINFO, data); in wpa_supplicant_event()
971 wpa_priv_send_event(iface, PRIVSEP_EVENT_MICHAEL_MIC_FAILURE, in wpa_supplicant_event()
976 wpa_priv_send_event(iface, PRIVSEP_EVENT_SCAN_STARTED, NULL, in wpa_supplicant_event()
980 wpa_priv_send_event(iface, PRIVSEP_EVENT_SCAN_RESULTS, NULL, in wpa_supplicant_event()
984 wpa_priv_send_interface_status(iface, data); in wpa_supplicant_event()
989 wpa_priv_send_event(iface, PRIVSEP_EVENT_PMKID_CANDIDATE, in wpa_supplicant_event()
996 wpa_priv_send_event(iface, PRIVSEP_EVENT_STKSTART, in wpa_supplicant_event()
1000 wpa_priv_send_ft_response(iface, data); in wpa_supplicant_event()
1003 wpa_priv_send_auth(iface, data); in wpa_supplicant_event()
1017 struct wpa_priv_interface *iface; in wpa_supplicant_event_global() local
1022 for (iface = global->interfaces; iface; iface = iface->next) { in wpa_supplicant_event_global()
1023 if (os_strcmp(iface->ifname, data->interface_status.ifname) == in wpa_supplicant_event_global()
1027 if (iface && iface->driver->get_ifindex) { in wpa_supplicant_event_global()
1030 ifindex = iface->driver->get_ifindex(iface->drv_priv); in wpa_supplicant_event_global()
1034 iface->ifname, ifindex, in wpa_supplicant_event_global()
1039 if (iface) in wpa_supplicant_event_global()
1040 wpa_supplicant_event(iface, event, data); in wpa_supplicant_event_global()
1047 struct wpa_priv_interface *iface = ctx; in wpa_supplicant_rx_eapol() local
1063 msg.msg_name = &iface->drv_addr; in wpa_supplicant_rx_eapol()
1064 msg.msg_namelen = sizeof(iface->drv_addr); in wpa_supplicant_rx_eapol()
1066 if (sendmsg(iface->fd, &msg, 0) < 0) in wpa_supplicant_rx_eapol()
1120 struct wpa_priv_interface *iface; in main() local
1167 iface = wpa_priv_interface_init(&global, ctrl_dir, argv[i]); in main()
1168 if (iface == NULL) in main()
1170 iface->next = global.interfaces; in main()
1171 global.interfaces = iface; in main()
1183 iface = global.interfaces; in main()
1184 while (iface) { in main()
1185 struct wpa_priv_interface *prev = iface; in main()
1186 iface = iface->next; in main()