static void wlantest_deinit(struct wlantest *wt)
{
	struct wlantest_passphrase *p, *pn;
	struct wlantest_radius_secret *s, *sn;
	struct wlantest_radius *r, *rn;
	struct wlantest_pmk *pmk, *np;
	struct wlantest_wep *wep, *nw;

	if (wt->ctrl_sock >= 0)
		ctrl_deinit(wt);
	if (wt->monitor_sock >= 0)
		monitor_deinit(wt);
	bss_flush(wt);
	dl_list_for_each_safe(p, pn, &wt->passphrase,
			      struct wlantest_passphrase, list)
		passphrase_deinit(p);
	dl_list_for_each_safe(s, sn, &wt->secret,
			      struct wlantest_radius_secret, list)
		secret_deinit(s);
	dl_list_for_each_safe(r, rn, &wt->radius, struct wlantest_radius, list)
		radius_deinit(r);
	dl_list_for_each_safe(pmk, np, &wt->pmk, struct wlantest_pmk, list)
		pmk_deinit(pmk);
	dl_list_for_each_safe(wep, nw, &wt->wep, struct wlantest_wep, list)
		os_free(wep);
	write_pcap_deinit(wt);
}
Exemple #2
0
int wlantest_relog(struct wlantest *wt)
{
	int ret = 0;

	wpa_printf(MSG_INFO, "Re-open log/capture files");
	if (wpa_debug_reopen_file())
		ret = -1;

	if (wt->write_file) {
		write_pcap_deinit(wt);
		if (write_pcap_init(wt, wt->write_file) < 0)
			ret = -1;
	}

	if (wt->pcapng_file) {
		write_pcapng_deinit(wt);
		if (write_pcapng_init(wt, wt->pcapng_file) < 0)
			ret = -1;
	}

	return ret;
}