[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.
This commit is contained in:
Adrian Chadd 2017-04-26 01:08:25 +00:00
parent cae0551ba3
commit 9673a6bb13

View File

@ -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 <set_scriptname>] [ifnet0 ... | any]\n",
fprintf(stderr, "usage: %s [-efjtv] [-P pidfile] [-s <set_scriptname>] [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 (;;) {