diff options
Diffstat (limited to 'sbin/dhclient/dispatch.c')
-rw-r--r-- | sbin/dhclient/dispatch.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index ee6d83a0765..c6a0981eb6f 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.112 2017/01/23 04:45:59 deraadt Exp $ */ +/* $OpenBSD: dispatch.c,v 1.113 2017/02/12 13:15:50 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -66,6 +66,7 @@ #include "dhcp.h" #include "dhcpd.h" +#include "log.h" #include "privsep.h" @@ -81,7 +82,7 @@ get_hw_address(struct interface_info *ifi) int found; if (getifaddrs(&ifap) != 0) - error("getifaddrs failed"); + fatalx("getifaddrs failed"); found = 0; for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) { @@ -107,7 +108,7 @@ get_hw_address(struct interface_info *ifi) } if (!found) - error("%s: no such interface", ifi->name); + fatalx("%s: no such interface", ifi->name); freeifaddrs(ifap); } @@ -168,7 +169,7 @@ dispatch(struct interface_info *ifi) if (errno == EAGAIN || errno == EINTR) { continue; } else { - warning("poll: %s", strerror(errno)); + log_warnx("poll: %s", strerror(errno)); quit = INTERNALSIG; continue; } @@ -189,10 +190,10 @@ dispatch(struct interface_info *ifi) if (quit == SIGHUP) { /* Tell [priv] process that HUP has occurred. */ sendhup(client->active); - warning("%s; restarting", strsignal(quit)); + log_warnx("%s; restarting", strsignal(quit)); exit (0); } else if (quit != INTERNALSIG) { - warning("%s; exiting", strsignal(quit)); + log_warnx("%s; exiting", strsignal(quit)); exit(1); } } @@ -206,11 +207,11 @@ packethandler(struct interface_info *ifi) ssize_t result; if ((result = receive_packet(ifi, &from, &hfrom)) == -1) { - warning("%s receive_packet failed: %s", ifi->name, + log_warnx("%s receive_packet failed: %s", ifi->name, strerror(errno)); ifi->errors++; if (ifi->errors > 20) { - error("%s too many receive_packet failures; exiting", + fatalx("%s too many receive_packet failures; exiting", ifi->name); } return; @@ -234,7 +235,7 @@ interface_link_forceup(char *ifname) memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(sock, SIOCGIFFLAGS, (caddr_t)&ifr) == -1) { - note("interface_link_forceup: SIOCGIFFLAGS failed (%s)", + log_info("interface_link_forceup: SIOCGIFFLAGS failed (%s)", strerror(errno)); return; } @@ -242,14 +243,14 @@ interface_link_forceup(char *ifname) /* Force it down and up so others notice link state change. */ ifr.ifr_flags &= ~IFF_UP; if (ioctl(sock, SIOCSIFFLAGS, (caddr_t)&ifr) == -1) { - note("interface_link_forceup: SIOCSIFFLAGS DOWN failed (%s)", + log_info("interface_link_forceup: SIOCSIFFLAGS DOWN failed (%s)", strerror(errno)); return; } ifr.ifr_flags |= IFF_UP; if (ioctl(sock, SIOCSIFFLAGS, (caddr_t)&ifr) == -1) { - note("interface_link_forceup: SIOCSIFFLAGS UP failed (%s)", + log_info("interface_link_forceup: SIOCSIFFLAGS UP failed (%s)", strerror(errno)); return; } @@ -266,7 +267,7 @@ interface_status(struct interface_info *ifi) memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, ifi->name, sizeof(ifr.ifr_name)); if (ioctl(sock, SIOCGIFFLAGS, &ifr) == -1) { - error("ioctl(SIOCGIFFLAGS) on %s: %s", ifi->name, + fatalx("ioctl(SIOCGIFFLAGS) on %s: %s", ifi->name, strerror(errno)); } @@ -285,7 +286,7 @@ interface_status(struct interface_info *ifi) */ #ifdef DEBUG if (errno != EINVAL && errno != ENOTTY) - debug("ioctl(SIOCGIFMEDIA) on %s: %s", ifi->name, + log_debug("ioctl(SIOCGIFMEDIA) on %s: %s", ifi->name, strerror(errno)); #endif @@ -338,7 +339,7 @@ get_rdomain(char *name) struct ifreq ifr; if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) - error("get_rdomain socket: %s", strerror(errno)); + fatalx("get_rdomain socket: %s", strerror(errno)); memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); |