void iapp_deinit(struct iapp_data *iapp) { struct ip_mreqn mreq; if (iapp == NULL) return; if (iapp->udp_sock >= 0) { os_memset(&mreq, 0, sizeof(mreq)); mreq.imr_multiaddr = iapp->multicast; mreq.imr_address.s_addr = INADDR_ANY; mreq.imr_ifindex = 0; if (setsockopt(iapp->udp_sock, SOL_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) { perror("setsockopt[UDP,IP_DEL_MEMBERSHIP]"); } eloop_unregister_read_sock(iapp->udp_sock); close(iapp->udp_sock); } if (iapp->packet_sock >= 0) { eloop_unregister_read_sock(iapp->packet_sock); close(iapp->packet_sock); } os_free(iapp); }
static void wpa_driver_privsep_deinit(void *priv) { struct wpa_driver_privsep_data *drv = priv; if (drv->priv_socket >= 0) { wpa_priv_reg_cmd(drv, PRIVSEP_CMD_UNREGISTER); eloop_unregister_read_sock(drv->priv_socket); close(drv->priv_socket); } if (drv->own_socket_path) { unlink(drv->own_socket_path); os_free(drv->own_socket_path); } if (drv->cmd_socket >= 0) { eloop_unregister_read_sock(drv->cmd_socket); close(drv->cmd_socket); } if (drv->own_cmd_path) { unlink(drv->own_cmd_path); os_free(drv->own_cmd_path); } os_free(drv); }
void monitor_deinit(struct wlantest *wt) { if (wt->monitor_sock >= 0) { eloop_unregister_read_sock(wt->monitor_sock); close(wt->monitor_sock); wt->monitor_sock = -1; } if (wt->monitor_wired >= 0) { eloop_unregister_read_sock(wt->monitor_wired); close(wt->monitor_wired); wt->monitor_wired = -1; } }
void wpa_supplicant_ctrl_iface_deinit(struct ctrl_iface_priv *priv) { struct wpa_ctrl_dst *dst, *prev; if (priv->sock > -1) { eloop_unregister_read_sock(priv->sock); if (priv->ctrl_dst) { /* * Wait a second before closing the control socket if * there are any attached monitors in order to allow * them to receive any pending messages. */ wpa_printf(MSG_DEBUG, "CTRL_IFACE wait for attached " "monitors to receive messages"); os_sleep(1, 0); } close(priv->sock); priv->sock = -1; } dst = priv->ctrl_dst; while (dst) { prev = dst; dst = dst->next; os_free(prev); } os_free(priv); }
void edit_deinit(const char *history_file, int (*filter_cb)(void *ctx, const char *cmd)) { rl_callback_handler_remove(); readline_free_completions(); eloop_unregister_read_sock(STDIN_FILENO); if (history_file) { /* Save command history, excluding lines that may contain * passwords. */ HIST_ENTRY *h; history_set_pos(0); while ((h = current_history())) { char *p = h->line; while (*p == ' ' || *p == '\t') p++; if (filter_cb && filter_cb(edit_cb_ctx, p)) { h = remove_history(where_history()); if (h) { os_free(h->line); free(h->data); os_free(h); } else next_history(); } else next_history(); } write_history(history_file); } }
static void wired_driver_hapd_deinit(void *priv) { struct wpa_driver_wired_data *drv = priv; if (drv->sock >= 0) { eloop_unregister_read_sock(drv->sock); close(drv->sock); } if (drv->dhcp_sock >= 0) { eloop_unregister_read_sock(drv->dhcp_sock); close(drv->dhcp_sock); } os_free(drv); }
void wpa_supplicant_ctrl_iface_deinit(struct ctrl_iface_priv *priv) { struct wpa_ctrl_dst *dst, *prev; if (priv->sock > -1) { char *fname; char *buf, *dir = NULL, *gid_str = NULL; eloop_unregister_read_sock(priv->sock); if (priv->ctrl_dst) { /* * Wait a second before closing the control socket if * there are any attached monitors in order to allow * them to receive any pending messages. */ wpa_printf(MSG_DEBUG, "CTRL_IFACE wait for attached " "monitors to receive messages"); os_sleep(1, 0); } close(priv->sock); priv->sock = -1; fname = wpa_supplicant_ctrl_iface_path(priv->wpa_s); if (fname) { unlink(fname); os_free(fname); } buf = os_strdup(priv->wpa_s->conf->ctrl_interface); if (buf == NULL) goto free_dst; if (os_strncmp(buf, "DIR=", 4) == 0) { dir = buf + 4; gid_str = os_strstr(dir, " GROUP="); if (gid_str) { *gid_str = '\0'; gid_str += 7; } } else dir = buf; if (rmdir(dir) < 0) { if (errno == ENOTEMPTY) { wpa_printf(MSG_DEBUG, "Control interface " "directory not empty - leaving it " "behind"); } else { perror("rmdir[ctrl_interface]"); } } os_free(buf); } free_dst: dst = priv->ctrl_dst; while (dst) { prev = dst; dst = dst->next; os_free(prev); } os_free(priv); }
static int wpas_ctrl_iface_reinit(struct wpa_supplicant *wpa_s, struct ctrl_iface_priv *priv) { int res; if (priv->sock <= 0) return -1; /* * On Android, the control socket being used may be the socket * that is created when wpa_supplicant is started as a /init.*.rc * service. Such a socket is maintained as a key-value pair in * Android's environment. Closing this control socket would leave us * in a bad state with an invalid socket descriptor. */ if (priv->android_control_socket) return priv->sock; eloop_unregister_read_sock(priv->sock); close(priv->sock); priv->sock = -1; res = wpas_ctrl_iface_open_sock(wpa_s, priv); if (res < 0) return -1; return priv->sock; }
int32 WPASupplicantApp::_SupplicantThread(void *data) { WPASupplicantApp *app = (WPASupplicantApp *)data; // Register our notify socket with the polling event loop. if (eloop_register_read_sock(app->fNotifySockets[0], _EventLoopProcessEvents, app->fWPAGlobal, app) != 0) { return B_ERROR; } wpa_supplicant_run(app->fWPAGlobal); eloop_unregister_read_sock(app->fNotifySockets[0]); // There are two reasons why the supplicant thread quit: // 1. The event loop was terminated because of a signal or error and the // application is still there and running. // 2. The app has quit and stopped the event loop. // // In case of 2. we're done, but in case of 1. we need to quit the still // running application. We use the app messenger to reach the app if it is // still running. If it already quit the SendMessage() will simply fail. be_app_messenger.SendMessage(B_QUIT_REQUESTED); return B_OK; }
static void test_driver_deinit(void *priv) { struct test_driver_data *drv = priv; struct test_client_socket *cli, *prev; cli = drv->cli; while (cli) { prev = cli; cli = cli->next; free(prev); } if (drv->test_socket >= 0) { eloop_unregister_read_sock(drv->test_socket); close(drv->test_socket); if (drv->own_socket_path) unlink(drv->own_socket_path); } /* There should be only one BSS remaining at this point. */ if (drv->bss == NULL) wpa_printf(MSG_ERROR, "%s: drv->bss == NULL", __func__); else if (drv->bss->next) wpa_printf(MSG_ERROR, "%s: drv->bss->next != NULL", __func__); test_driver_free_priv(drv); }
void hostapd_ctrl_iface_deinit(struct hostapd_data *hapd) { struct wpa_ctrl_dst *dst, *prev; if (hapd->ctrl_sock > -1) { char *fname; eloop_unregister_read_sock(hapd->ctrl_sock); close(hapd->ctrl_sock); hapd->ctrl_sock = -1; fname = hostapd_ctrl_iface_path(hapd); if (fname) unlink(fname); free(fname); if (hapd->conf->ctrl_interface && rmdir(hapd->conf->ctrl_interface) < 0) { if (errno == ENOTEMPTY) { wpa_printf(MSG_DEBUG, "Control interface " "directory not empty - leaving it " "behind"); } else { perror("rmdir[ctrl_interface]"); } } } dst = hapd->ctrl_dst; while (dst) { prev = dst; dst = dst->next; free(prev); } }
static void full_dynamic_vlan_deinit(struct full_dynamic_vlan *priv) { if (priv == NULL) return; eloop_unregister_read_sock(priv->s); close(priv->s); os_free(priv); }
void wpa_supplicant_global_ctrl_iface_deinit(struct ctrl_iface_global_priv *priv) { if (priv->sock >= 0) { eloop_unregister_read_sock(priv->sock); close(priv->sock); } os_free(priv); }
void radius_client_deinit(struct radius_client_data *radius) { if (!radius) return; if (radius->auth_serv_sock >= 0) eloop_unregister_read_sock(radius->auth_serv_sock); if (radius->acct_serv_sock >= 0) eloop_unregister_read_sock(radius->acct_serv_sock); eloop_cancel_timeout(radius_retry_primary_timer, radius, NULL); radius_client_flush(radius, 0); os_free(radius->auth_handlers); os_free(radius->acct_handlers); os_free(radius); }
static void hostap_wireless_event_deinit(void *priv) { struct hostap_driver_data *drv = priv; if (drv->wext_sock < 0) return; eloop_unregister_read_sock(drv->wext_sock); close(drv->wext_sock); }
static void radius_close_acct_sockets(struct radius_client_data *radius) { radius->acct_sock = -1; if (radius->acct_serv_sock >= 0) { eloop_unregister_read_sock(radius->acct_serv_sock); close(radius->acct_serv_sock); radius->acct_serv_sock = -1; } #ifdef CONFIG_IPV6 if (radius->acct_serv_sock6 >= 0) { eloop_unregister_read_sock(radius->acct_serv_sock6); close(radius->acct_serv_sock6); radius->acct_serv_sock6 = -1; } #endif /* CONFIG_IPV6 */ }
static void wpa_driver_broadcom_deinit(void *priv) { struct wpa_driver_broadcom_data *drv = priv; eloop_cancel_timeout(wpa_driver_broadcom_scan_timeout, drv, drv->ctx); eloop_unregister_read_sock(drv->event_sock); close(drv->event_sock); close(drv->ioctl_sock); os_free(drv); }
void wpas_binder_deinit(struct wpas_binder_priv *priv) { if (!priv) return; wpa_supplicant_binder::BinderManager::destroyInstance(); eloop_unregister_read_sock(priv->binder_fd); android::IPCThreadState::shutdown(); }
static void unregister_event_handler(struct wpa_ctrl *ctrl) { if (!ctrl_conn) return; if (interactive && event_handler_registered) { eloop_unregister_read_sock(wpa_ctrl_get_fd(ctrl)); event_handler_registered = 0; } }
void ctrl_deinit(struct wlantest *wt) { int i; if (wt->ctrl_sock < 0) return; for (i = 0; i < MAX_CTRL_CONNECTIONS; i++) { if (wt->ctrl_socks[i] >= 0) { close(wt->ctrl_socks[i]); eloop_unregister_read_sock(wt->ctrl_socks[i]); wt->ctrl_socks[i] = -1; } } eloop_unregister_read_sock(wt->ctrl_sock); close(wt->ctrl_sock); wt->ctrl_sock = -1; }
static void apac_ctrl_detach(apacHyfi20IF_t *pIF) { if (apac_ctrl_cmd(pIF, "DETACH", 6) < 0) { dprintf(MSG_INFO, "Failed to detach CTRL connection[%s]\n", pIF->ifName); } eloop_unregister_read_sock(pIF->ctrlSock); apac_ctrl_close(pIF); }
void netlink_deinit(struct netlink_data *netlink) { if (netlink == NULL) return; if (netlink->sock >= 0) { eloop_unregister_read_sock(netlink->sock); close(netlink->sock); } os_free(netlink->cfg); os_free(netlink); }
void wpa_supplicant_global_ctrl_iface_deinit(struct ctrl_iface_global_priv *priv) { if (priv->sock >= 0) { eloop_unregister_read_sock(priv->sock); close(priv->sock); } if (priv->global->params.ctrl_interface) unlink(priv->global->params.ctrl_interface); os_free(priv); }
void l2_packet_deinit(struct l2_packet_data *l2) { if (l2 != NULL) { if (l2->pcap) { eloop_unregister_read_sock( pcap_get_selectable_fd(l2->pcap)); pcap_close(l2->pcap); } os_free(l2); } }
void l2_packet_deinit(struct l2_packet_data *l2) { if (l2 == NULL) return; if (l2->fd >= 0) { eloop_unregister_read_sock(l2->fd); close(l2->fd); } os_free(l2); }
static void madwifi_wireless_event_deinit(void *priv) { struct madwifi_driver_data *drv = priv; if (drv != NULL) { if (drv->wext_sock < 0) return; eloop_unregister_read_sock(drv->wext_sock); close(drv->wext_sock); } }
void nl80211_remove_monitor_interface(struct nl80211_data* ctx) { if (ctx->monitor_ifidx >= 0) { nl80211_remove_iface(ctx, ctx->monitor_ifidx); ctx->monitor_ifidx = -1; } if (ctx->monitor_sock >= 0) { eloop_unregister_read_sock(ctx->monitor_sock); close(ctx->monitor_sock); ctx->monitor_sock = -1; } }
void radius_das_deinit(struct radius_das_data *das) { if (das == NULL) return; if (das->sock >= 0) { eloop_unregister_read_sock(das->sock); close(das->sock); } os_free(das->shared_secret); os_free(das); }
static void eap_sim_db_close_socket(struct eap_sim_db_data *data) { if (data->sock >= 0) { eloop_unregister_read_sock(data->sock); close(data->sock); data->sock = -1; } if (data->local_sock) { unlink(data->local_sock); VM_FREE(data->local_sock); data->local_sock = NULL; } }
void l2_packet_deinit(struct l2_packet_data *l2) { if (l2 == NULL) { return; } if (l2->fd >= 0) { eloop_unregister_read_sock(l2->fd); /* TODO: close connection */ } os_free(l2); }