From 9673a6bb13ac348ef7ec2a1005da8c2456459c46 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Wed, 26 Apr 2017 01:08:25 +0000 Subject: [PATCH] [net80211] [wlanwds] allow logging to stderr as well as syslog. By default this logs to syslog only, not stderr. It makes it difficult to debug exactly what's going on. So allow '-e' to log to stderr so I have a chance of actually debugging wlanwds /dynamic WDS (DWDS) issues. --- tools/tools/net80211/wlanwds/wlanwds.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/tools/net80211/wlanwds/wlanwds.c b/tools/tools/net80211/wlanwds/wlanwds.c index 1bae345ae41c..177f92a6d2ac 100644 --- a/tools/tools/net80211/wlanwds/wlanwds.c +++ b/tools/tools/net80211/wlanwds/wlanwds.c @@ -96,7 +96,7 @@ static int wds_vap_destroy(const char *ifname); static void usage(const char *progname) { - fprintf(stderr, "usage: %s [-fjtv] [-P pidfile] [-s ] [ifnet0 ... | any]\n", + fprintf(stderr, "usage: %s [-efjtv] [-P pidfile] [-s ] [ifnet0 ... | any]\n", progname); exit(-1); } @@ -108,10 +108,14 @@ main(int argc, char *argv[]) const char *pidfile = NULL; int s, c, logmask, bg = 1; char msg[2048]; + int log_stderr = 0; logmask = LOG_UPTO(LOG_INFO); - while ((c = getopt(argc, argv, "fjP:s:tv")) != -1) + while ((c = getopt(argc, argv, "efjP:s:tv")) != -1) switch (c) { + case 'e': + log_stderr = LOG_PERROR; + break; case 'f': bg = 0; break; @@ -155,7 +159,7 @@ main(int argc, char *argv[]) if (bg && daemon(0, 0) < 0) err(EX_OSERR, "daemon"); - openlog("wlanwds", LOG_PID | LOG_CONS, LOG_DAEMON); + openlog("wlanwds", log_stderr | LOG_PID | LOG_CONS, LOG_DAEMON); setlogmask(logmask); for (;;) {