dhclient - Silence dhclient by immediately exiting if the interface doesn't exist.
authorAntonio Huete Jimenez <tuxillo@quantumachine.net>
Wed, 1 Aug 2012 19:25:29 +0000 (21:25 +0200)
committerAntonio Huete Jimenez <tuxillo@quantumachine.net>
Wed, 15 Aug 2012 01:22:13 +0000 (03:22 +0200)
Taken-from: OpenBSD

sbin/dhclient/dispatch.c
sbin/dhclient/errwarn.c

index 5350265..e342036 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: src/sbin/dhclient/dispatch.c,v 1.44 2009/06/06 04:02:42 krw Exp $     */
+/*     $OpenBSD: src/sbin/dhclient/dispatch.c,v 1.45 2009/11/26 23:14:29 krw Exp $     */
 
 /*
  * Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -210,11 +210,8 @@ got_one(void)
                if ((!interface_status(ifi->name)) ||
                    (ifi->noifmedia && ifi->errors > 20)) {
                        /* our interface has gone away. */
-                       warning("Interface %s no longer appears valid.",
+                       error("Interface %s no longer appears valid.",
                            ifi->name);
-                       interfaces_invalidated = 1;
-                       close(ifi->rfdesc);
-                       ifi->rfdesc = -1;
                }
                return;
        }
@@ -297,8 +294,7 @@ interface_status(char *ifname)
        memset(&ifr, 0, sizeof(ifr));
        strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
        if (ioctl(sock, SIOCGIFFLAGS, &ifr) < 0) {
-               warning("ioctl(SIOCGIFFLAGS) on %s: %m", ifname);
-               goto inactive;
+               error("ioctl(SIOCGIFFLAGS) on %s: %m", ifname);
        }
 
        /*
index bbbcaf2..100727b 100644 (file)
@@ -1,5 +1,4 @@
-/*     $OpenBSD: errwarn.c,v 1.15 2007/03/02 11:31:17 henning Exp $    */
-/*     $DragonFly: src/sbin/dhclient/errwarn.c,v 1.1 2008/08/30 16:07:58 hasso Exp $   */
+/*     $OpenBSD: src/sbin/dhclient/errwarn.c,v 1.17 2009/11/26 23:14:29 krw Exp $      */
 
 /* Errors and warnings... */
 
@@ -80,9 +79,7 @@ error(char *fmt, ...)
                write(STDERR_FILENO, "\n", 1);
        }
 
-       syslog(LOG_CRIT, "exiting.");
        if (log_perror) {
-               fprintf(stderr, "exiting.\n");
                fflush(stderr);
        }
        exit(1);