From: Roy Marples Date: Fri, 5 Sep 2008 15:46:02 +0000 (+0000) Subject: Don't spam on startup about unsupported interfaces if quiet. X-Git-Tag: v5.0.0~285 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f25f3fb214d3106bb12fdaa0b67eeabd3dadbb0a;p=thirdparty%2Fdhcpcd.git Don't spam on startup about unsupported interfaces if quiet. --- diff --git a/dhcpcd.c b/dhcpcd.c index 84468dd5..1b3719e8 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -1004,6 +1004,10 @@ main(int argc, char **argv) case 'n': sig = SIGALRM; break; + case 'q': + setloglevel(LOG_WARNING); + options |= DHCPCD_QUIET; + break; case 'x': sig = SIGTERM; break; @@ -1062,7 +1066,7 @@ main(int argc, char **argv) exit(EXIT_FAILURE); } } else { - if (errno != EEXIST) + if (errno != ENOENT) logger(LOG_ERR, "open_control: %m"); } } diff --git a/if-options.c b/if-options.c index 6cb3bcb4..848c8660 100644 --- a/if-options.c +++ b/if-options.c @@ -261,6 +261,7 @@ parse_option(struct if_options *ifo, int opt, const char *arg) case 'd': /* FALLTHROUGH */ case 'k': /* FALLTHROUGH */ case 'n': /* FALLTHROUGH */ + case 'q': /* FALLTHROUGH */ case 'x': /* FALLTHROUGH */ case 'B': /* FALLTHROUGH */ case 'T': /* We need to handle non interface options */ @@ -325,9 +326,6 @@ parse_option(struct if_options *ifo, int opt, const char *arg) case 'p': ifo->options |= DHCPCD_PERSISTENT; break; - case 'q': - setloglevel(LOG_WARNING); - break; case 's': ifo->options |= DHCPCD_INFORM; ifo->options |= DHCPCD_PERSISTENT; diff --git a/if-options.h b/if-options.h index 6f67f41f..7358bd64 100644 --- a/if-options.h +++ b/if-options.h @@ -64,7 +64,8 @@ #define DHCPCD_HOSTNAME (1 << 18) #define DHCPCD_CLIENTID (1 << 19) #define DHCPCD_LINK (1 << 20) -#define DHCPCD_BACKGROUND (1 << 21) +#define DHCPCD_QUIET (1 << 21) +#define DHCPCD_BACKGROUND (1 << 22) extern const struct option cf_options[]; diff --git a/net.c b/net.c index 81e2eee4..d67d6468 100644 --- a/net.c +++ b/net.c @@ -234,7 +234,11 @@ init_interface(const char *ifname) iface->hwlen = INFINIBAND_ADDR_LEN; break; default: - logger(LOG_ERR, "%s: unsupported media family", iface->name); + /* Don't needlessly spam console on startup */ + if (!(options & DHCPCD_MASTER && + !(options & DHCPCD_DAEMONISED) && + options & DHCPCD_QUIET)) + logger(LOG_ERR, "%s: unsupported media family", iface->name); goto eexit; } memcpy(iface->hwaddr, ifr.ifr_hwaddr.sa_data, iface->hwlen);