From: Roy Marples Date: Mon, 23 Feb 2009 23:52:21 +0000 (+0000) Subject: Fix debug working in dhcpcd.conf X-Git-Tag: v5.0.0~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acb1cf88cf6a35c5156908349c31de634f107141;p=thirdparty%2Fdhcpcd.git Fix debug working in dhcpcd.conf --- diff --git a/dhcpcd.c b/dhcpcd.c index 41fc36f5..7f0071d0 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -1281,9 +1281,6 @@ main(int argc, char **argv) while ((opt = getopt_long(argc, argv, IF_OPTS, cf_options, &oi)) != -1) { switch (opt) { - case 'd': - setlogmask(LOG_UPTO(LOG_DEBUG)); - break; case 'f': cffile = optarg; break; @@ -1325,7 +1322,9 @@ main(int argc, char **argv) options &= ~DHCPCD_DAEMONISE; #endif - if (options & DHCPCD_QUIET) + if (options & DHCPCD_DEBUG) + setlogmask(LOG_UPTO(LOG_DEBUG)); + else if (options & DHCPCD_QUIET) setlogmask(LOG_UPTO(LOG_WARNING)); /* If we have any other args, we should run as a single dhcpcd instance diff --git a/if-options.c b/if-options.c index da6f8208..119d6dea 100644 --- a/if-options.c +++ b/if-options.c @@ -300,7 +300,6 @@ parse_option(struct if_options *ifo, int opt, const char *arg) struct rt *rt; switch(opt) { - case 'd': /* FALLTHROUGH */ case 'n': /* FALLTHROUGH */ case 'x': /* FALLTHROUGH */ case 'T': /* We need to handle non interface options */ @@ -311,6 +310,9 @@ parse_option(struct if_options *ifo, int opt, const char *arg) case 'c': strlcpy(ifo->script, arg, sizeof(ifo->script)); break; + case 'd': + ifo->options |= DHCPCD_DEBUG; + break; case 'h': if (arg) { s = parse_string(ifo->hostname, diff --git a/if-options.h b/if-options.h index 02f5f2dc..9b75f68e 100644 --- a/if-options.h +++ b/if-options.h @@ -53,6 +53,7 @@ #define DHCPCD_DOMAIN (1 << 2) #define DHCPCD_GATEWAY (1 << 3) #define DHCPCD_STATIC (1 << 4) +#define DHCPCD_DEBUG (1 << 5) #define DHCPCD_LASTLEASE (1 << 7) #define DHCPCD_INFORM (1 << 8) #define DHCPCD_REQUEST (1 << 9)