Issue with wpa_cli and 'PING' check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While debugging some strange issues, I noticed that my wpa_cli
in monitor mode was disconnecting because the PING failed.

It looks like the reason it fails goes something like this:

wpa_cli: ping
wpa_supplicant:  do things, post logging message to wpa-cli
wpa_supplicant:  read ping & reply with pong
wpa_cli:  reads 'logging message', decides PONG fails, and disconnects.

So, nasty race I guess?

static void wpa_cli_action_ping(void *eloop_ctx, void *timeout_ctx)
{
	struct wpa_ctrl *ctrl = eloop_ctx;
	char buf[256] = {0};
	size_t len;

	/* verify that connection is still working */
	len = sizeof(buf) - 1;
	if (wpa_ctrl_request(ctrl, "PING", 4, buf, &len,
			     wpa_cli_action_cb) < 0 ||
	    len < 4 || os_memcmp(buf, "PONG", 4) != 0) {
		fprintf(stderr, "wpa-cli: wpa_supplicant did not reply to PING command, len: %d buf: %s - exiting\n",
			(int)len, buf);
		eloop_terminate();
		return;
	}
	eloop_register_timeout(ping_interval, 0, wpa_cli_action_ping,
			       ctrl, NULL);
}

Thanks,
Ben

--
Ben Greear <greearb@xxxxxxxxxxxxxxx>
Candela Technologies Inc  http://www.candelatech.com


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux