]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Don't spam on startup about unsupported interfaces if quiet.
authorRoy Marples <roy@marples.name>
Fri, 5 Sep 2008 15:46:02 +0000 (15:46 +0000)
committerRoy Marples <roy@marples.name>
Fri, 5 Sep 2008 15:46:02 +0000 (15:46 +0000)
dhcpcd.c
if-options.c
if-options.h
net.c

index 84468dd5f0da4d60580cf6064634f1c63c17708b..1b3719e8910f65f935013b40906822b8616cc0cc 100644 (file)
--- 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");
                }
        }
index 6cb3bcb400064fb959caa372d6adb6cca4bc862f..848c86601e2c04bebf4c503cacc0664071683e07 100644 (file)
@@ -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;
index 6f67f41fd83b0ef06b279754093b6c10b4212798..7358bd64c25a30f0509584dc0295a31559f6d2c8 100644 (file)
@@ -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 81e2eee4570aeded340825dc996032e12d90106c..d67d64687207179e87102a919e3d98332a00da4a 100644 (file)
--- 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);