aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-01-20 19:12:00 (GMT)
committerJouni Malinen <j@w1.fi>2009-02-08 09:59:47 (GMT)
commit614983ede82244fde3562820c6dce8958d861c30 (patch)
treedb4c31bfada9b9267a39b0051bb283616f218e69
parentecb6ad2789145ac2b3d4d916e98546cf64826872 (diff)
downloadhostap-06-614983ede82244fde3562820c6dce8958d861c30.zip
hostap-06-614983ede82244fde3562820c6dce8958d861c30.tar.gz
hostap-06-614983ede82244fde3562820c6dce8958d861c30.tar.bz2
Increased wpa_cli/hostapd_cli ping interval and made it configurable
The default interval is now 5 seconds (used to be 1 second for interactive mode and 2 seconds for wpa_cli -a). The interval can be changed with -G<seconds> command line option. (cherry picked from commit 1cc84c1c6b702898fcf1a9b19fb060f88fba9245)
-rw-r--r--hostapd/ChangeLog4
-rw-r--r--hostapd/hostapd_cli.c13
-rw-r--r--wpa_supplicant/ChangeLog4
-rw-r--r--wpa_supplicant/wpa_cli.c15
4 files changed, 27 insertions, 9 deletions
diff --git a/hostapd/ChangeLog b/hostapd/ChangeLog
index f85a4fb..86d4fb6 100644
--- a/hostapd/ChangeLog
+++ b/hostapd/ChangeLog
@@ -1,5 +1,9 @@
ChangeLog for hostapd
+????-??-?? - v0.6.8
+ * increased hostapd_cli ping interval to 5 seconds and made this
+ configurable with a new command line options (-G<seconds>)
+
2009-01-06 - v0.6.7
* added support for Wi-Fi Protected Setup (WPS)
(hostapd can now be configured to act as an integrated WPS Registrar
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index 9c3e65b..2614113 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -101,6 +101,7 @@ static int hostapd_cli_quit = 0;
static int hostapd_cli_attached = 0;
static const char *ctrl_iface_dir = "/var/run/hostapd";
static char *ctrl_ifname = NULL;
+static int ping_interval = 5;
static void usage(void)
@@ -109,7 +110,8 @@ static void usage(void)
fprintf(stderr,
"\n"
"usage: hostapd_cli [-p<path>] [-i<ifname>] [-hv] "
- "[command..]\n"
+ "[-G<ping interval>] \\\n"
+ " [command..]\n"
"\n"
"Options:\n"
" -h help (show this usage text)\n"
@@ -507,7 +509,7 @@ static void hostapd_cli_interactive(void)
do {
hostapd_cli_recv_pending(ctrl_conn, 0);
printf("> ");
- alarm(1);
+ alarm(ping_interval);
res = fgets(cmd, sizeof(cmd), stdin);
alarm(0);
if (res == NULL)
@@ -569,7 +571,7 @@ static void hostapd_cli_alarm(int sig)
}
if (ctrl_conn)
hostapd_cli_recv_pending(ctrl_conn, 1);
- alarm(1);
+ alarm(ping_interval);
}
@@ -580,10 +582,13 @@ int main(int argc, char *argv[])
int c;
for (;;) {
- c = getopt(argc, argv, "hi:p:v");
+ c = getopt(argc, argv, "hG:i:p:v");
if (c < 0)
break;
switch (c) {
+ case 'G':
+ ping_interval = atoi(optarg);
+ break;
case 'h':
usage();
return 0;
diff --git a/wpa_supplicant/ChangeLog b/wpa_supplicant/ChangeLog
index 37ab722..3756149 100644
--- a/wpa_supplicant/ChangeLog
+++ b/wpa_supplicant/ChangeLog
@@ -1,5 +1,9 @@
ChangeLog for wpa_supplicant
+????-??-?? - v0.6.8
+ * increased wpa_cli ping interval to 5 seconds and made this
+ configurable with a new command line options (-G<seconds>)
+
2009-01-06 - v0.6.7
* added support for Wi-Fi Protected Setup (WPS)
(wpa_supplicant can now be configured to act as a WPS Enrollee to
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index c49b674..7de6534 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -95,6 +95,7 @@ static const char *ctrl_iface_dir = "/var/run/wpa_supplicant";
static char *ctrl_ifname = NULL;
static const char *pid_file = NULL;
static const char *action_file = NULL;
+static int ping_interval = 5;
static void print_help();
@@ -104,7 +105,8 @@ static void usage(void)
{
printf("wpa_cli [-p<path to ctrl sockets>] [-i<ifname>] [-hvB] "
"[-a<action file>] \\\n"
- " [-P<pid file>] [-g<global ctrl>] [command..]\n"
+ " [-P<pid file>] [-g<global ctrl>] [-G<ping interval>] "
+ "[command..]\n"
" -h = help (show this usage text)\n"
" -v = shown version information\n"
" -a = run in daemon mode executing the action file based on "
@@ -1563,7 +1565,7 @@ static void wpa_cli_interactive(void)
do {
wpa_cli_recv_pending(ctrl_conn, 0, 0);
#ifndef CONFIG_NATIVE_WINDOWS
- alarm(1);
+ alarm(ping_interval);
#endif /* CONFIG_NATIVE_WINDOWS */
#ifdef CONFIG_READLINE
cmd = readline("> ");
@@ -1667,7 +1669,7 @@ static void wpa_cli_action(struct wpa_ctrl *ctrl)
while (!wpa_cli_quit) {
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
- tv.tv_sec = 2;
+ tv.tv_sec = ping_interval;
tv.tv_usec = 0;
res = select(fd + 1, &rfds, NULL, NULL, &tv);
if (res < 0 && errno != EINTR) {
@@ -1721,7 +1723,7 @@ static void wpa_cli_alarm(int sig)
wpa_cli_reconnect();
if (ctrl_conn)
wpa_cli_recv_pending(ctrl_conn, 1, 0);
- alarm(1);
+ alarm(ping_interval);
}
#endif /* CONFIG_NATIVE_WINDOWS */
@@ -1794,7 +1796,7 @@ int main(int argc, char *argv[])
return -1;
for (;;) {
- c = getopt(argc, argv, "a:Bg:hi:p:P:v");
+ c = getopt(argc, argv, "a:Bg:G:hi:p:P:v");
if (c < 0)
break;
switch (c) {
@@ -1807,6 +1809,9 @@ int main(int argc, char *argv[])
case 'g':
global = optarg;
break;
+ case 'G':
+ ping_interval = atoi(optarg);
+ break;
case 'h':
usage();
return 0;