aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/hostapd_cli.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-01-20 19:12:00 (GMT)
committerJouni Malinen <j@w1.fi>2009-01-20 19:12:00 (GMT)
commit1cc84c1c6b702898fcf1a9b19fb060f88fba9245 (patch)
treeefb7010e520401bb7f00d38d26429c8c8aa9d6f8 /hostapd/hostapd_cli.c
parent3a4606585c23d05eb07629652340c56cd6afbee0 (diff)
downloadhostap-1cc84c1c6b702898fcf1a9b19fb060f88fba9245.zip
hostap-1cc84c1c6b702898fcf1a9b19fb060f88fba9245.tar.gz
hostap-1cc84c1c6b702898fcf1a9b19fb060f88fba9245.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.
Diffstat (limited to 'hostapd/hostapd_cli.c')
-rw-r--r--hostapd/hostapd_cli.c13
1 files changed, 9 insertions, 4 deletions
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;