changeset 949:6faf186aaa97 draft

Remove logger and exclusively uses syslog instead. This saves almost 2K on NetBSD/amd64 from before changing strerror to %m.
author Roy Marples <roy@marples.name>
date Fri, 05 Sep 2008 18:24:34 +0000
parents 4a8387866485
children c2d7dbd4c893
files Makefile arp.c bind.c bpf.c common.c configure.c dhcpcd.c eloop.c if-options.c ipv4ll.c logger.c logger.h net.c
diffstat 13 files changed, 140 insertions(+), 307 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Sep 05 15:46:02 2008 +0000
+++ b/Makefile	Fri Sep 05 18:24:34 2008 +0000
@@ -4,7 +4,7 @@
 
 PROG=		dhcpcd
 SRCS=		arp.c bind.c common.c control.c dhcp.c dhcpcd.c duid.c eloop.c
-SRCS+=		if-options.c ipv4ll.c logger.c net.c signals.c
+SRCS+=		if-options.c ipv4ll.c net.c signals.c
 SRCS+=		configure.c
 SRCS+=		${SRC_IF} ${SRC_PF}
 
--- a/arp.c	Fri Sep 05 15:46:02 2008 +0000
+++ b/arp.c	Fri Sep 05 18:24:34 2008 +0000
@@ -28,6 +28,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <syslog.h>
 #include <unistd.h>
 
 #include "arp.h"
@@ -37,7 +38,6 @@
 #include "eloop.h"
 #include "if-options.h"
 #include "ipv4ll.h"
-#include "logger.h"
 #include "net.h"
 
 #define ARP_LEN \
@@ -145,7 +145,7 @@
 			state->fail.s_addr = iface->addr.s_addr;
 
 		if (state->fail.s_addr) {
-			logger(LOG_ERR, "%s: hardware address %s claims %s",
+			syslog(LOG_ERR, "%s: hardware address %s claims %s",
 			       iface->name,
 			       hwaddr_ntoa((unsigned char *)hw_s,
 					   (size_t)ar.ar_hln),
@@ -169,17 +169,17 @@
 		add_event(iface->arp_fd, handle_arp_packet, iface);
 	}
 	if (++state->claims < ANNOUNCE_NUM)	
-		logger(LOG_DEBUG,
+		syslog(LOG_DEBUG,
 		       "%s: sending ARP announce (%d of %d), "
 		       "next in %d.00 seconds",
 		       iface->name, state->claims, ANNOUNCE_NUM, ANNOUNCE_WAIT);
 	else
-		logger(LOG_DEBUG,
+		syslog(LOG_DEBUG,
 		       "%s: sending ARP announce (%d of %d)",
 		       iface->name, state->claims, ANNOUNCE_NUM);
 	if (send_arp(iface, ARPOP_REQUEST,
 		     state->new->yiaddr, state->new->yiaddr) == -1)
-		logger(LOG_ERR, "send_arp: %m");
+		syslog(LOG_ERR, "send_arp: %m");
 	if (state->claims < ANNOUNCE_NUM) {
 		add_timeout_sec(ANNOUNCE_WAIT, send_arp_announce, iface);
 		return;
@@ -216,9 +216,9 @@
 	}
 	if (state->probes == 0) {
 		addr.s_addr = state->offer->yiaddr;
-		logger(LOG_INFO, "%s: checking %s is available"
-				" on attached networks",
-				iface->name, inet_ntoa(addr));
+		syslog(LOG_INFO, "%s: checking %s is available"
+		       " on attached networks",
+		       iface->name, inet_ntoa(addr));
 	}
 	if (++state->probes < PROBE_NUM) {
 		tv.tv_sec = PROBE_MIN;
@@ -233,10 +233,9 @@
 		else
 			add_timeout_tv(&tv, send_request, iface);
 	}
-	logger(LOG_DEBUG,
-		"%s: sending ARP probe (%d of %d), next in %0.2f seconds",
-		iface->name, state->probes, PROBE_NUM,  timeval_to_double(&tv));
+	syslog(LOG_DEBUG,
+	       "%s: sending ARP probe (%d of %d), next in %0.2f seconds",
+	       iface->name, state->probes, PROBE_NUM,  timeval_to_double(&tv));
 	if (send_arp(iface, ARPOP_REQUEST, 0, state->offer->yiaddr) == -1)
-		logger(LOG_ERR, "send_arp: %m");
+		syslog(LOG_ERR, "send_arp: %m");
 }
-
--- a/bind.c	Fri Sep 05 15:46:02 2008 +0000
+++ b/bind.c	Fri Sep 05 18:24:34 2008 +0000
@@ -27,6 +27,7 @@
 
 #include <signal.h>
 #include <stdlib.h>
+#include <syslog.h>
 #include <unistd.h>
 
 #include "arp.h"
@@ -37,7 +38,6 @@
 #include "dhcpf.h"
 #include "eloop.h"
 #include "if-options.h"
-#include "logger.h"
 #include "net.h"
 #include "signals.h"
 
@@ -57,13 +57,13 @@
 	sigprocmask(SIG_SETMASK, &full, &old);
 	/* Setup a signal pipe so parent knows when to exit. */
 	if (pipe(sidpipe) == -1) {
-		logger(LOG_ERR, "pipe: %m");
+		syslog(LOG_ERR, "pipe: %m");
 		return -1;
 	}
-	logger(LOG_INFO, "forking to background");
+	syslog(LOG_INFO, "forking to background");
 	switch (pid = fork()) {
 		case -1:
-			logger(LOG_ERR, "fork: %m");
+			syslog(LOG_ERR, "fork: %m");
 			exit(EXIT_FAILURE);
 			/* NOTREACHED */
 		case 0:
@@ -116,7 +116,7 @@
 	state->offer = NULL;
 	get_lease(lease, state->new);
 	if (IN_LINKLOCAL(htonl(state->new->yiaddr))) {
-		logger(LOG_INFO, "%s: using IPv4LL address %s",
+		syslog(LOG_INFO, "%s: using IPv4LL address %s",
 		       iface->name, inet_ntoa(lease->addr));
 		lease->leasetime = ~0U;
 		reason = "IPV4LL";
@@ -125,7 +125,7 @@
 			lease->addr.s_addr = ifo->request_address.s_addr;
 		else
 			lease->addr.s_addr = iface->addr.s_addr;
-		logger(LOG_INFO, "%s: received approval for %s", iface->name,
+		syslog(LOG_INFO, "%s: received approval for %s", iface->name,
 		       inet_ntoa(lease->addr));
 		lease->leasetime = ~0U;
 		reason = "INFORM";
@@ -136,19 +136,19 @@
 			reason = "TIMEOUT";
 		if (lease->leasetime == ~0U) {
 			lease->renewaltime = lease->rebindtime = lease->leasetime;
-			logger(LOG_INFO, "%s: leased %s for infinity",
+			syslog(LOG_INFO, "%s: leased %s for infinity",
 			       iface->name, inet_ntoa(lease->addr));
 		} else {
 			if (lease->rebindtime >= lease->leasetime) {
 				lease->rebindtime = lease->leasetime * T2;
-				logger(LOG_ERR,
+				syslog(LOG_ERR,
 				       "%s: rebind time greater than lease "
 				       "time, forcing to %u seconds",
 				       iface->name, lease->rebindtime);
 			}
 			if (lease->renewaltime > lease->rebindtime) {
 				lease->renewaltime = lease->leasetime * T1;
-				logger(LOG_ERR,
+				syslog(LOG_ERR,
 				       "%s: renewal time greater than rebind "
 				       "time, forcing to %u seconds",
 				       iface->name, lease->renewaltime);
@@ -157,7 +157,7 @@
 				lease->renewaltime = lease->leasetime * T1;
 			if (!lease->rebindtime)
 				lease->rebindtime = lease->leasetime * T2;
-			logger(LOG_INFO,
+			syslog(LOG_INFO,
 			       "%s: leased %s for %u seconds", iface->name,
 			       inet_ntoa(lease->addr), lease->leasetime);
 		}
--- a/bpf.c	Fri Sep 05 15:46:02 2008 +0000
+++ b/bpf.c	Fri Sep 05 18:24:34 2008 +0000
@@ -39,12 +39,12 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <syslog.h>
 #include <unistd.h>
 
 #include "config.h"
 #include "common.h"
 #include "dhcp.h"
-#include "logger.h"
 #include "net.h"
 #include "bpf-filter.h"
 
@@ -81,7 +81,7 @@
 		goto eexit;
 	if (pv.bv_major != BPF_MAJOR_VERSION ||
 	    pv.bv_minor < BPF_MINOR_VERSION) {
-		logger(LOG_ERR, "BPF version mismatch - recompile " PACKAGE);
+		syslog(LOG_ERR, "BPF version mismatch - recompile");
 		goto eexit;
 	}
 
--- a/common.c	Fri Sep 05 15:46:02 2008 +0000
+++ b/common.c	Fri Sep 05 18:24:34 2008 +0000
@@ -41,11 +41,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <syslog.h>
 #include <time.h>
 #include <unistd.h>
 
 #include "common.h"
-#include "logger.h"
 
 #ifndef _PATH_DEVNULL
 #  define _PATH_DEVNULL "/dev/null"
@@ -163,7 +163,7 @@
 	if ((flags = fcntl(fd, F_GETFD, 0)) == -1
 	    || fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1)
 	{
-		logger(LOG_ERR, "fcntl: %m");
+		syslog(LOG_ERR, "fcntl: %m");
 		return -1;
 	}
 	return 0;
@@ -177,7 +177,7 @@
 	if ((flags = fcntl(fd, F_GETFL, 0)) == -1
 	    || fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1)
 	{
-		logger(LOG_ERR, "fcntl: %m");
+		syslog(LOG_ERR, "fcntl: %m");
 		return -1;
 	}
 	return 0;
@@ -245,7 +245,7 @@
 
 	/* Something above failed, so fall back to gettimeofday */
 	if (!posix_clock_set) {
-		logger(LOG_WARNING, NO_MONOTONIC);
+		syslog(LOG_WARNING, NO_MONOTONIC);
 		posix_clock_set = 1;
 	}
 	return gettimeofday(tp, NULL);
@@ -283,7 +283,7 @@
 
 	if (value)
 		return value;
-	logger(LOG_ERR, "memory exhausted (xalloc %zu bytes)", s);
+	syslog(LOG_ERR, "memory exhausted (xalloc %zu bytes)", s);
 	exit (EXIT_FAILURE);
 	/* NOTREACHED */
 }
@@ -304,7 +304,7 @@
 
 	if (value)
 		return (value);
-	logger(LOG_ERR, "memory exhausted (xrealloc %zu bytes)", s);
+	syslog(LOG_ERR, "memory exhausted (xrealloc %zu bytes)", s);
 	exit(EXIT_FAILURE);
 	/* NOTREACHED */
 }
@@ -320,7 +320,7 @@
 	if ((value = strdup(str)))
 		return value;
 
-	logger(LOG_ERR, "memory exhausted (xstrdup)");
+	syslog(LOG_ERR, "memory exhausted (xstrdup)");
 	exit(EXIT_FAILURE);
 	/* NOTREACHED */
 }
--- a/configure.c	Fri Sep 05 15:46:02 2008 +0000
+++ b/configure.c	Fri Sep 05 18:24:34 2008 +0000
@@ -35,6 +35,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <syslog.h>
 #include <unistd.h>
 
 #include "config.h"
@@ -42,7 +43,6 @@
 #include "configure.h"
 #include "dhcpf.h"
 #include "if-options.h"
-#include "logger.h"
 #include "net.h"
 #include "signals.h"
 
@@ -62,12 +62,12 @@
 
 	switch (pid = vfork()) {
 	case -1:
-		logger(LOG_ERR, "vfork: %m");
+		syslog(LOG_ERR, "vfork: %m");
 		break;
 	case 0:
 		sigprocmask(SIG_SETMASK, &old, NULL);
 		execve(argv[0], argv, env);
-		logger(LOG_ERR, "%s: %m", argv[0]);
+		syslog(LOG_ERR, "%s: %m", argv[0]);
 		_exit(127);
 		/* NOTREACHED */
 	}
@@ -89,7 +89,7 @@
 	int status = 0;
 	const struct if_options *ifo = iface->state->options;
 
-	logger(LOG_DEBUG, "%s: executing `%s', reason %s",
+	syslog(LOG_DEBUG, "%s: executing `%s', reason %s",
 	       iface->name, argv[0], reason);
 
 	/* Make our env */
@@ -151,7 +151,7 @@
 		/* Wait for the script to finish */
 		while (waitpid(pid, &status, 0) == -1) {
 			if (errno != EINTR) {
-				logger(LOG_ERR, "waitpid: %m");
+				syslog(LOG_ERR, "waitpid: %m");
 				status = -1;
 				break;
 			}
@@ -173,12 +173,12 @@
 	int retval;
 
 	addr = xstrdup(inet_ntoa(rt->dest));
-	logger(LOG_DEBUG, "%s: deleting route %s/%d via %s", iface->name,
+	syslog(LOG_DEBUG, "%s: deleting route %s/%d via %s", iface->name,
 	       addr, inet_ntocidr(rt->net), inet_ntoa(rt->gate));
 	free(addr);
 	retval = del_route(iface, &rt->dest, &rt->net, &rt->gate, metric);
 	if (retval != 0 && errno != ENOENT && errno != ESRCH)
-		logger(LOG_ERR," del_route: %m");
+		syslog(LOG_ERR," del_route: %m");
 	return retval;
 }
 
@@ -266,7 +266,7 @@
 			continue;
 
 		addr = xstrdup(inet_ntoa(rt->dest));
-		logger(LOG_DEBUG, "%s: adding route to %s/%d via %s",
+		syslog(LOG_DEBUG, "%s: adding route to %s/%d via %s",
 		       iface->name, addr,
 		       inet_ntocidr(rt->net), inet_ntoa(rt->gate));
 		free(addr);
@@ -278,7 +278,7 @@
 		   ourselves. If so, remember it again. */
 		if (remember < 0) {
 			if (errno != EEXIST)
-				logger(LOG_ERR, "add_route: %m");
+				syslog(LOG_ERR, "add_route: %m");
 			if (in_routes(iface->routes, rt) == 0)
 				remember = 1;
 		}
@@ -301,13 +301,13 @@
 delete_address(struct interface *iface)
 {
 	int retval;
-	logger(LOG_DEBUG, "%s: deleting IP address %s/%d",
+	syslog(LOG_DEBUG, "%s: deleting IP address %s/%d",
 	       iface->name,
 	       inet_ntoa(iface->addr),
 	       inet_ntocidr(iface->net));
 	retval = del_address(iface, &iface->addr, &iface->net);
 	if (retval == -1 && errno != EADDRNOTAVAIL) 
-		logger(LOG_ERR, "del_address: %m");
+		syslog(LOG_ERR, "del_address: %m");
 	iface->addr.s_addr = 0;
 	iface->net.s_addr = 0;
 	return retval;
@@ -350,12 +350,12 @@
 	/* This also changes netmask */
 	if (!(iface->state->options->options & DHCPCD_INFORM) ||
 	    !has_address(iface->name, &addr, &net)) {
-		logger(LOG_DEBUG, "%s: adding IP address %s/%d",
+		syslog(LOG_DEBUG, "%s: adding IP address %s/%d",
 		       iface->name, inet_ntoa(addr), inet_ntocidr(net));
 		if (add_address(iface, &addr, &net, &brd) == -1 &&
 		    errno != EEXIST)
 		{
-			logger(LOG_ERR, "add_address: %m");
+			syslog(LOG_ERR, "add_address: %m");
 			return -1;
 		}
 	}
@@ -395,7 +395,7 @@
 
 	if (!iface->state->lease.frominfo)
 		if (write_lease(iface, dhcp) == -1)
-			logger(LOG_ERR, "write_lease: %m");
+			syslog(LOG_ERR, "write_lease: %m");
 
 	run_script(iface, reason);
 	return 0;
--- a/dhcpcd.c	Fri Sep 05 15:46:02 2008 +0000
+++ b/dhcpcd.c	Fri Sep 05 18:24:34 2008 +0000
@@ -42,6 +42,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <syslog.h>
 #include <unistd.h>
 #include <time.h>
 
@@ -57,7 +58,6 @@
 #include "eloop.h"
 #include "if-options.h"
 #include "ipv4ll.h"
-#include "logger.h"
 #include "net.h"
 #include "signals.h"
 
@@ -145,7 +145,7 @@
 	if (pidfd > -1) {
 		if (options & DHCPCD_MASTER) {
 			if (stop_control() == -1)
-				logger(LOG_ERR, "stop_control: %m");
+				syslog(LOG_ERR, "stop_control: %m");
 		}
 		close(pidfd);
 		unlink(pidfile);
@@ -158,7 +158,7 @@
 _noreturn void
 handle_exit_timeout(_unused void *arg)
 {
-	logger(LOG_ERR, "timed out");
+	syslog(LOG_ERR, "timed out");
 	exit(EXIT_FAILURE);
 }
 
@@ -199,7 +199,7 @@
 {
 	struct interface *ifp, *ifl = NULL;
 
-	logger(LOG_INFO, "%s: removing interface", iface->name);
+	syslog(LOG_INFO, "%s: removing interface", iface->name);
 	drop_config(iface, "STOP");
 	close_sockets(iface);
 	delete_timeout(NULL, iface);
@@ -230,7 +230,7 @@
 	struct timeval tv;
 
 	if (!callback)
-		logger(LOG_DEBUG, "%s: sending %s with xid 0x%x",
+		syslog(LOG_DEBUG, "%s: sending %s with xid 0x%x",
 		       iface->name, get_dhcp_op(type), state->xid);
 	else {
 		if (state->interval == 0)
@@ -242,7 +242,7 @@
 		}
 		tv.tv_sec = state->interval + DHCP_RAND_MIN;
 		tv.tv_usec = arc4random() % (DHCP_RAND_MAX_U - DHCP_RAND_MIN_U);
-		logger(LOG_DEBUG,
+		syslog(LOG_DEBUG,
 		       "%s: sending %s with xid 0x%x, next in %0.2f seconds",
 		       iface->name, get_dhcp_op(type), state->xid,
 		       timeval_to_double(&tv));
@@ -265,13 +265,13 @@
 	if (to.s_addr && to.s_addr != INADDR_BROADCAST) {
 		r = send_packet(iface, to, (uint8_t *)dhcp, len);
 		if (r == -1)
-			logger(LOG_ERR, "%s: send_packet: %m", iface->name);
+			syslog(LOG_ERR, "%s: send_packet: %m", iface->name);
 	} else {
 		len = make_udp_packet(&udp, (uint8_t *)dhcp, len, from, to);
 		r = send_raw_packet(iface, ETHERTYPE_IP, udp, len);
 		free(udp);
 		if (r == -1)
-			logger(LOG_ERR, "%s: send_raw_packet: %m", iface->name);
+			syslog(LOG_ERR, "%s: send_raw_packet: %m", iface->name);
 	}
 	free(dhcp);
 	if (r == -1) {
@@ -305,8 +305,8 @@
 {
 	struct interface *iface = arg;
 
-	logger(LOG_INFO, "%s: renewing lease of %s",
-			iface->name, inet_ntoa(iface->state->lease.addr));
+	syslog(LOG_INFO, "%s: renewing lease of %s",
+	       iface->name, inet_ntoa(iface->state->lease.addr));
 	iface->state->state = DHS_RENEWING;
 	iface->state->xid = arc4random();
 	send_renew(iface);
@@ -323,8 +323,8 @@
 {
 	struct interface *iface = arg;
 
-	logger(LOG_ERR, "%s: failed to renew, attmepting to rebind",
-			iface->name);
+	syslog(LOG_ERR, "%s: failed to renew, attmepting to rebind",
+	       iface->name);
 	iface->state->state = DHS_REBINDING;
 	delete_timeout(send_renew, iface);
 	iface->state->lease.server.s_addr = 0;
@@ -337,7 +337,7 @@
 	struct interface *iface = arg;
 	int ll = IN_LINKLOCAL(htonl(iface->state->lease.addr.s_addr));
 
-	logger(LOG_ERR, "%s: lease expired", iface->name);
+	syslog(LOG_ERR, "%s: lease expired", iface->name);
 	delete_timeout(NULL, iface);
 	drop_config(iface, "EXPIRE");
 	iface->state->interval = 0;
@@ -371,13 +371,13 @@
 	}
 	r = get_option_addr(&addr.s_addr, dhcp, DHO_SERVERID);
 	if (dhcp->servername[0] && r == 0)
-		logger(lvl, "%s: %s %s from %s `%s'", iface->name, msg, a,
+		syslog(lvl, "%s: %s %s from %s `%s'", iface->name, msg, a,
 		       inet_ntoa(addr), dhcp->servername);
 	else if (r == 0)
-		logger(lvl, "%s: %s %s from %s",
+		syslog(lvl, "%s: %s %s from %s",
 		       iface->name, msg, a, inet_ntoa(addr));
 	else
-		logger(lvl, "%s: %s %s", iface->name, msg, a);
+		syslog(lvl, "%s: %s %s", iface->name, msg, a);
 	free(a);
 }
 
@@ -411,12 +411,12 @@
 			if (ifo->blacklist[i] != addr.s_addr)
 				continue;
 			if (dhcp->servername[0])
-				logger(LOG_WARNING,
+				syslog(LOG_WARNING,
 				       "%s: ignoring blacklisted server %s `%s'",
-					iface->name,
-					inet_ntoa(addr), dhcp->servername);
+				       iface->name,
+				       inet_ntoa(addr), dhcp->servername);
 			else
-				logger(LOG_WARNING,
+				syslog(LOG_WARNING,
 				       "%s: ignoring blacklisted server %s",
 				       iface->name, inet_ntoa(addr));
 			return;
@@ -534,7 +534,7 @@
 			continue;
 		bytes = get_udp_data(&pp, packet);
 		if ((size_t)bytes > sizeof(*dhcp)) {
-			logger(LOG_ERR, "%s: packet greater than DHCP size",
+			syslog(LOG_ERR, "%s: packet greater than DHCP size",
 			       iface->name);
 			continue;
 		}
@@ -542,13 +542,13 @@
 			dhcp = xmalloc(sizeof(*dhcp));
 		memcpy(dhcp, pp, bytes);
 		if (dhcp->cookie != htonl(MAGIC_COOKIE)) {
-			logger(LOG_DEBUG, "%s: bogus cookie, ignoring",
+			syslog(LOG_DEBUG, "%s: bogus cookie, ignoring",
 			       iface->name);
 			continue;
 		}
 		/* Ensure it's the right transaction */
 		if (iface->state->xid != dhcp->xid) {
-			logger(LOG_DEBUG,
+			syslog(LOG_DEBUG,
 			       "%s: ignoring packet with xid 0x%x as"
 			       " it's not ours (0x%x)",
 			       iface->name, dhcp->xid, iface->state->xid);
@@ -558,7 +558,7 @@
 		if (iface->hwlen <= sizeof(dhcp->chaddr) &&
 		    memcmp(dhcp->chaddr, iface->hwaddr, iface->hwlen))
 		{
-			logger(LOG_DEBUG, "%s: xid 0x%x is not for our hwaddr %s",
+			syslog(LOG_DEBUG, "%s: xid 0x%x is not for our hwaddr %s",
 			       iface->name, dhcp->xid,
 			       hwaddr_ntoa(dhcp->chaddr, sizeof(dhcp->chaddr)));
 			continue;
@@ -587,11 +587,11 @@
 		close(iface->udp_fd);
 	if (open_udp_socket(iface) == -1 &&
 	    (errno != EADDRINUSE || iface->addr.s_addr != 0))
-		logger(LOG_ERR, "%s: open_udp_socket: %m", iface->name);
+		syslog(LOG_ERR, "%s: open_udp_socket: %m", iface->name);
 	if (iface->raw_fd != -1)
 		delete_event(iface->raw_fd);
 	if (open_socket(iface, ETHERTYPE_IP) == -1)
-		logger(LOG_ERR, "%s: open_socket: %m", iface->name);
+		syslog(LOG_ERR, "%s: open_socket: %m", iface->name);
 	if (iface->raw_fd != -1)
 		add_event(iface->raw_fd, handle_dhcp_packet, iface);
 }
@@ -608,12 +608,12 @@
 		return;
 	switch (carrier_status(iface->name)) {
 	case -1:
-		logger(LOG_ERR, "carrier_status: %m");
+		syslog(LOG_ERR, "carrier_status: %m");
 		break;
 	case 0:
 		if (iface->state->carrier != LINK_DOWN) {
 			iface->state->carrier = LINK_DOWN;
-			logger(LOG_INFO, "%s: carrier lost", iface->name);
+			syslog(LOG_INFO, "%s: carrier lost", iface->name);
 			close_sockets(iface);
 			delete_timeouts(iface, start_expire, NULL);
 		}
@@ -621,7 +621,7 @@
 	default:
 		if (iface->state->carrier != LINK_UP) {
 			iface->state->carrier = LINK_UP;
-			logger(LOG_INFO, "%s: carrier acquired", iface->name);
+			syslog(LOG_INFO, "%s: carrier acquired", iface->name);
 			start_interface(iface);
 		}
 		break;
@@ -646,7 +646,7 @@
 		else
 			add_timeout_sec(ifo->timeout, start_ipv4ll, iface);
 	}
-	logger(LOG_INFO, "%s: broadcasting for a lease", iface->name);
+	syslog(LOG_INFO, "%s: broadcasting for a lease", iface->name);
 	send_discover(iface);
 }
 
@@ -656,8 +656,8 @@
 {
 	struct if_options *ifo = iface->state->options;
 
-	logger(LOG_INFO, "%s: rebinding lease of %s",
-			iface->name, inet_ntoa(iface->state->lease.addr));
+	syslog(LOG_INFO, "%s: rebinding lease of %s",
+	       iface->name, inet_ntoa(iface->state->lease.addr));
 	iface->state->state = DHS_REBINDING;
 	iface->state->xid = arc4random();
 	iface->state->lease.server.s_addr = 0;
@@ -673,8 +673,8 @@
 	if (iface->state->lease.addr.s_addr &&
 	    !IN_LINKLOCAL(htonl(iface->state->lease.addr.s_addr)))
 	{
-		logger(LOG_INFO, "%s: releasing lease of %s",
-				iface->name, inet_ntoa(iface->state->lease.addr));
+		syslog(LOG_INFO, "%s: releasing lease of %s",
+		       iface->name, inet_ntoa(iface->state->lease.addr));
 		open_sockets(iface);
 		send_message(iface, DHCP_RELEASE, NULL);
 	}
@@ -717,7 +717,7 @@
 		if (ifo->options & DHCPCD_DUID) {
 			duid = xmalloc(DUID_LEN);
 			if ((len = get_duid(duid, iface)) == 0)
-				logger(LOG_ERR, "get_duid: %m");
+				syslog(LOG_ERR, "get_duid: %m");
 		}
 		if (len > 0) {
 			iface->clientid = xmalloc(len + 6);
@@ -775,7 +775,7 @@
 	}
 
 	if (ifs->carrier == LINK_DOWN)
-		logger(LOG_INFO, "%s: waiting for carrier", iface->name);
+		syslog(LOG_INFO, "%s: waiting for carrier", iface->name);
 	else
 		start_interface(iface);
 }
@@ -834,7 +834,7 @@
 			handle_carrier,
 			handle_new_interface,
 			handle_remove_interface) == -1)
-		logger(LOG_ERR, "manage_link: %m");
+		syslog(LOG_ERR, "manage_link: %m");
 }
 
 static void
@@ -846,21 +846,21 @@
 
 	switch (sig) {
 	case SIGINT:
-		logger(LOG_INFO, "received SIGINT, stopping");
+		syslog(LOG_INFO, "received SIGINT, stopping");
 		break;
 	case SIGTERM:
-		logger(LOG_INFO, "received SIGTERM, stopping");
+		syslog(LOG_INFO, "received SIGTERM, stopping");
 		break;
 	case SIGALRM:
-		logger(LOG_INFO, "received SIGALRM, rebinding lease");
+		syslog(LOG_INFO, "received SIGALRM, rebinding lease");
 		do_reboot = 1;
 		break;
 	case SIGHUP:
-		logger(LOG_INFO, "received SIGHUP, releasing lease");
+		syslog(LOG_INFO, "received SIGHUP, releasing lease");
 		do_release = 1;
 		break;
 	default:
-		logger (LOG_ERR,
+		syslog (LOG_ERR,
 			"received signal %d, but don't know what to do with it",
 			sig);
 		return;
@@ -905,7 +905,7 @@
 
 	/* We only deal with one interface here */
 	if (optind == argc) {
-		logger(LOG_ERR, "handle_args: no interface");
+		syslog(LOG_ERR, "handle_args: no interface");
 		return -1;
 	}
 
@@ -921,7 +921,7 @@
 			if (do_release)
 				send_release(ifp);
 			if (do_exit || do_release) {
-				logger(LOG_INFO, "%s: removing interface", ifp->name);
+				syslog(LOG_INFO, "%s: removing interface", ifp->name);
 				drop_config(ifp, do_release ? "RELEASE" : "STOP");
 				close_sockets(ifp);
 				delete_timeout(NULL, ifp);
@@ -970,9 +970,8 @@
 	struct timespec ts;
 
 	closefrom(3);
-	/* Saves calling fflush(stream) in the logger */
-	setlinebuf(stdout);
-	openlog(PACKAGE, LOG_PID, LOG_LOCAL0);
+	openlog(PACKAGE, LOG_PERROR, LOG_LOCAL0);
+	setlogmask(LOG_UPTO(LOG_INFO));
 	options = DHCPCD_DAEMONISE;
 
 	/* Test for --help and --version */
@@ -993,7 +992,7 @@
 			options |= DHCPCD_BACKGROUND;
 			break;
 		case 'd':
-			setloglevel(LOG_DEBUG);
+			setlogmask(LOG_UPTO(LOG_DEBUG));
 			break;
 		case 'f':
 			cffile = optarg;
@@ -1005,7 +1004,7 @@
 			sig = SIGALRM;
 			break;
 		case 'q':
-			setloglevel(LOG_WARNING);
+			setlogmask(LOG_UPTO(LOG_WARNING));
 			options |= DHCPCD_QUIET;
 			break;
 		case 'x':
@@ -1056,40 +1055,40 @@
 	if (!(options & DHCPCD_MASTER)) {
 		control_fd = open_control();
 		if (control_fd != -1) {
-			logger(LOG_INFO, "sending commands to master dhcpcd process");
+			syslog(LOG_INFO, "sending commands to master dhcpcd process");
 			i = send_control(argc, argv);
 			if (i > 0) {
-				logger(LOG_DEBUG, "send OK");
+				syslog(LOG_DEBUG, "send OK");
 				exit(EXIT_SUCCESS);
 			} else {
-				logger(LOG_ERR, "failed to send commands");
+				syslog(LOG_ERR, "failed to send commands");
 				exit(EXIT_FAILURE);
 			}
 		} else {
 			if (errno != ENOENT)
-				logger(LOG_ERR, "open_control: %m");
+				syslog(LOG_ERR, "open_control: %m");
 		}
 	}
 
 	if (geteuid())
-		logger(LOG_WARNING, PACKAGE " will not work correctly unless"
+		syslog(LOG_WARNING, PACKAGE " will not work correctly unless"
 		       " run as root");
 
 	if (sig != 0) {
 		i = -1;
 		pid = read_pid();
 		if (pid != 0)
-			logger(LOG_INFO, "sending signal %d to pid %d",
+			syslog(LOG_INFO, "sending signal %d to pid %d",
 			       sig, pid);
 
 		if (!pid || (i = kill(pid, sig))) {
 			if (sig != SIGALRM)
-				logger(LOG_ERR, ""PACKAGE" not running");
+				syslog(LOG_ERR, ""PACKAGE" not running");
 			unlink(pidfile);
 			exit(EXIT_FAILURE);
 		}
 		/* Spin until it exits */
-		logger(LOG_INFO, "waiting for pid %d to exit", pid);
+		syslog(LOG_INFO, "waiting for pid %d to exit", pid);
 		ts.tv_sec = 0;
 		ts.tv_nsec = 100000000; /* 10th of a second */
 		for(i = 0; i < 100; i++) {
@@ -1097,7 +1096,7 @@
 			if (read_pid() == 0)
 				exit(EXIT_SUCCESS);
 		}
-		logger(LOG_ERR, "pid %d failed to exit", pid);
+		syslog(LOG_ERR, "pid %d failed to exit", pid);
 		exit(EXIT_FAILURE);
 	}
 
@@ -1105,7 +1104,7 @@
 		if ((pid = read_pid()) > 0 &&
 		    kill(pid, 0) == 0)
 		{
-			logger(LOG_ERR, ""PACKAGE
+			syslog(LOG_ERR, ""PACKAGE
 			       " already running on pid %d (%s)",
 			       pid, pidfile);
 			exit(EXIT_FAILURE);
@@ -1113,13 +1112,13 @@
 
 		pidfd = open(pidfile, O_WRONLY | O_CREAT | O_NONBLOCK, 0664);
 		if (pidfd == -1) {
-			logger(LOG_ERR, "open `%s': %m", pidfile);
+			syslog(LOG_ERR, "open `%s': %m", pidfile);
 			exit(EXIT_FAILURE);
 		}
 		/* Lock the file so that only one instance of dhcpcd runs
 		 * on an interface */
 		if (flock(pidfd, LOCK_EX | LOCK_NB) == -1) {
-			logger(LOG_ERR, "flock `%s': %m", pidfile);
+			syslog(LOG_ERR, "flock `%s': %m", pidfile);
 			exit(EXIT_FAILURE);
 		}
 		if (set_cloexec(pidfd) == -1)
@@ -1127,7 +1126,7 @@
 		writepid(pidfd, getpid());
 	}
 
-	logger(LOG_INFO, PACKAGE " " VERSION " starting");
+	syslog(LOG_INFO, "version " VERSION " starting");
 
 	if ((signal_fd =signal_init()) == -1)
 		exit(EXIT_FAILURE);
@@ -1137,7 +1136,7 @@
 
 	if (options & DHCPCD_MASTER) {
 		if (start_control() == -1) {
-			logger(LOG_ERR, "start_control: %m");
+			syslog(LOG_ERR, "start_control: %m");
 			exit(EXIT_FAILURE);
 		}
 	}
@@ -1145,7 +1144,7 @@
 	if (ifo->options & DHCPCD_LINK) {
 		linkfd = open_link_socket();
 		if (linkfd == -1)
-			logger(LOG_ERR, "open_link_socket: %m");
+			syslog(LOG_ERR, "open_link_socket: %m");
 		else
 			add_event(linkfd, handle_link, NULL);
 	}
@@ -1164,7 +1163,7 @@
 	for (iface = ifaces; iface; iface = iface->next)
 		init_state(iface, argc, argv);
 	if (!ifaces && ifc == 1) {
-		logger(LOG_ERR, "interface `%s' does not exist", ifv[0]);
+		syslog(LOG_ERR, "interface `%s' does not exist", ifv[0]);
 		exit(EXIT_FAILURE);
 	}
 	if (options & DHCPCD_BACKGROUND)
--- a/eloop.c	Fri Sep 05 15:46:02 2008 +0000
+++ b/eloop.c	Fri Sep 05 18:24:34 2008 +0000
@@ -26,16 +26,16 @@
  */
 
 #include <sys/time.h>
+
 #include <errno.h>
 #include <limits.h>
 #include <poll.h>
 #include <stdarg.h>
 #include <stdlib.h>
+#include <syslog.h>
 
 #include "common.h"
 #include "eloop.h"
-#include "logger.h"
-#include "net.h"
 
 static struct timeval now = {0, 0};
 
@@ -305,7 +305,7 @@
 		for (e = events; e; e = e->next)
 			nfds++;
 		if (msecs == -1 && nfds == 0) {
-			logger(LOG_ERR, "nothing to do");
+			syslog(LOG_ERR, "nothing to do");
 			exit(EXIT_FAILURE);
 		}
 		if (nfds > fds_len) {
@@ -326,7 +326,7 @@
 				get_monotonic(&now);
 				continue;
 			}
-			logger(LOG_ERR, "poll: %m");
+			syslog(LOG_ERR, "poll: %m");
 			exit(EXIT_FAILURE);
 		}
 
--- a/if-options.c	Fri Sep 05 15:46:02 2008 +0000
+++ b/if-options.c	Fri Sep 05 18:24:34 2008 +0000
@@ -36,6 +36,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <syslog.h>
 #include <unistd.h>
 #include <time.h>
 
@@ -43,7 +44,6 @@
 #include "common.h"
 #include "dhcpf.h"
 #include "if-options.h"
-#include "logger.h"
 #include "net.h"
 
 /* Don't set any optional arguments here so we retain POSIX
@@ -99,7 +99,7 @@
 	if ((errno != 0 && n == 0) || s == t ||
 	    (errno == ERANGE && (n == LONG_MAX || n == LONG_MIN)))
 	{
-		logger(LOG_ERR, "`%s' out of range", s);
+		syslog(LOG_ERR, "`%s' out of range", s);
 		return -1;
 	}
 
@@ -276,11 +276,11 @@
 		else
 			s = 0;
 		if (s == -1) {
-			logger(LOG_ERR, "hostname: %m");
+			syslog(LOG_ERR, "hostname: %m");
 			return -1;
 		}
 		if (s != 0 && ifo->hostname[1] == '.') {
-			logger(LOG_ERR, "hostname cannot begin with a .");
+			syslog(LOG_ERR, "hostname cannot begin with a .");
 			return -1;
 		}
 		ifo->hostname[0] = (uint8_t)s;
@@ -292,34 +292,34 @@
 		else
 			s = 0;
 		if (s == -1) {
-			logger(LOG_ERR, "vendorclassid: %m");
+			syslog(LOG_ERR, "vendorclassid: %m");
 			return -1;
 		}
 		*ifo->vendorclassid = (uint8_t)s;
 		break;
 	case 'l':
 		if (*arg == '-') {
-			logger(LOG_ERR,
+			syslog(LOG_ERR,
 			       "leasetime must be a positive value");
 			return -1;
 		}
 		errno = 0;
 		ifo->leasetime = (uint32_t)strtol(arg, NULL, 0);
 		if (errno == EINVAL || errno == ERANGE) {
-			logger(LOG_ERR, "`%s' out of range", arg);
+			syslog(LOG_ERR, "`%s' out of range", arg);
 			return -1;
 		}
 		break;
 	case 'm':
 		ifo->metric = atoint(arg);
 		if (ifo->metric < 0) {
-			logger(LOG_ERR, "metric must be a positive value");
+			syslog(LOG_ERR, "metric must be a positive value");
 			return -1;
 		}
 		break;
 	case 'o':
 		if (make_option_mask(ifo->requestmask, arg, 1) != 0) {
-			logger(LOG_ERR, "unknown option `%s'", arg);
+			syslog(LOG_ERR, "unknown option `%s'", arg);
 			return -1;
 		}
 		break;
@@ -341,7 +341,7 @@
 				if (sscanf(p, "%d", &i) != 1 ||
 				    inet_cidrtoaddr(i, &ifo->request_netmask) != 0)
 				{
-					logger(LOG_ERR,
+					syslog(LOG_ERR,
 					       "`%s' is not a valid CIDR",
 					       p);
 					return -1;
@@ -353,7 +353,7 @@
 		if (!(ifo->options & DHCPCD_INFORM))
 			ifo->options |= DHCPCD_REQUEST;
 		if (arg && !inet_aton(arg, &ifo->request_address)) {
-			logger(LOG_ERR, "`%s' is not a valid IP address",
+			syslog(LOG_ERR, "`%s' is not a valid IP address",
 			       arg);
 			return -1;
 		}
@@ -361,7 +361,7 @@
 	case 't':
 		ifo->timeout = atoint(arg);
 		if (ifo->timeout < 0) {
-			logger (LOG_ERR, "timeout must be a positive value");
+			syslog (LOG_ERR, "timeout must be a positive value");
 			return -1;
 		}
 		break;
@@ -370,7 +370,7 @@
 		s = parse_string((char *)ifo->userclass + ifo->userclass[0] + 2,
 				 s, arg);
 		if (s == -1) {
-			logger(LOG_ERR, "userclass: %m");
+			syslog(LOG_ERR, "userclass: %m");
 			return -1;
 		}
 		if (s != 0) {
@@ -381,14 +381,14 @@
 	case 'v':
 		p = strchr(arg, ',');
 		if (!p || !p[1]) {
-			logger(LOG_ERR, "invalid vendor format");
+			syslog(LOG_ERR, "invalid vendor format");
 			return -1;
 		}
 		*p = '\0';
 		i = atoint(arg);
 		arg = p + 1;
 		if (i < 1 || i > 254) {
-			logger(LOG_ERR, "vendor option should be between"
+			syslog(LOG_ERR, "vendor option should be between"
 					" 1 and 254 inclusive");
 			return -1;
 		}
@@ -405,7 +405,7 @@
 					 s, arg);
 		}
 		if (s == -1) {
-			logger(LOG_ERR, "vendor: %m");
+			syslog(LOG_ERR, "vendor: %m");
 			return -1;
 		}
 		if (s != 0) {
@@ -449,7 +449,7 @@
 		else if (strcmp(arg, "disable") == 0)
 			ifo->fqdn = FQDN_DISABLE;
 		else {
-			logger(LOG_ERR, "invalid value `%s' for FQDN", arg);
+			syslog(LOG_ERR, "invalid value `%s' for FQDN", arg);
 			return -1;
 		}
 		break;
@@ -465,7 +465,7 @@
 		else
 			s = 0;
 		if (s == -1) {
-			logger(LOG_ERR, "clientid: %m");
+			syslog(LOG_ERR, "clientid: %m");
 			return -1;
 		}
 		ifo->clientid[0] = (uint8_t)s;
@@ -485,7 +485,7 @@
 		    make_option_mask(ifo->requiremask, arg, -1) != 0 ||
 		    make_option_mask(ifo->nomask, arg, 1) != 0)
 		{
-			logger(LOG_ERR, "unknown option `%s'", arg);
+			syslog(LOG_ERR, "unknown option `%s'", arg);
 			return -1;
 		}
 		break;
@@ -493,13 +493,13 @@
 		if (make_option_mask(ifo->requiremask, arg, 1) != 0 ||
 		    make_option_mask(ifo->requestmask, arg, 1) != 0)
 		{
-			logger(LOG_ERR, "unknown option `%s'", arg);
+			syslog(LOG_ERR, "unknown option `%s'", arg);
 			return -1;
 		}
 		break;
 	case 'X':
 		if (!inet_aton(arg, &addr)) {
-			logger(LOG_ERR, "`%s' is not a valid IP address",
+			syslog(LOG_ERR, "`%s' is not a valid IP address",
 			       arg);
 			return -1;
 		}
--- a/ipv4ll.c	Fri Sep 05 15:46:02 2008 +0000
+++ b/ipv4ll.c	Fri Sep 05 18:24:34 2008 +0000
@@ -28,6 +28,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <syslog.h>
 #include <unistd.h>
 
 #include "arp.h"
@@ -36,7 +37,6 @@
 #include "eloop.h"
 #include "if-options.h"
 #include "ipv4ll.h"
-#include "logger.h"
 #include "net.h"
 
 static struct dhcp_message*
@@ -87,7 +87,7 @@
 		}
 	}
 
-	logger(LOG_INFO, "%s: probing for an IPv4LL address", iface->name);
+	syslog(LOG_INFO, "%s: probing for an IPv4LL address", iface->name);
 	delete_timeout(NULL, iface);
 	iface->state->state = DHS_PROBING;
 	free(iface->state->offer);
@@ -118,7 +118,7 @@
 
 	close_sockets(iface);
 	if (++iface->state->conflicts > MAX_CONFLICTS) {
-		logger(LOG_ERR, "%s: failed to acquire an IPv4LL address",
+		syslog(LOG_ERR, "%s: failed to acquire an IPv4LL address",
 				iface->name);
 		iface->state->interval = RATE_LIMIT_INTERVAL / 2;
 		start_discover(iface);
--- a/logger.c	Fri Sep 05 15:46:02 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/* 
- * dhcpcd - DHCP client daemon
- * Copyright 2006-2008 Roy Marples <roy@marples.name>
- * All rights reserved
-
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <ctype.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <syslog.h>
-
-#include "common.h"
-#include "dhcpcd.h"
-#include "if-options.h"
-#include "logger.h"
-
-/* For printf implementation that lack %m conversion in printf.
- * uClibc does support it, but it's not enabled by default. */
-#ifndef HAVE_PRINTF_M
-# ifdef __GLIBC__
-#  define HAVE_PRINTF_M 1
-# endif
-# ifndef HAVE_PRINTF_M
-#  define HAVE_PRINTF_M 0
-# endif
-#endif
-
-/* Mac length of format string when we don't have printf with %m */
-#define FMT_LEN 1024
-
-static int loglevel = LOG_INFO;
-
-void
-setloglevel(int level)
-{
-	loglevel = level;
-}
-
-void
-logger(int level, const char *fmt, ...)
-{
-	va_list va1, va2;
-	FILE *f = stderr;
-#if HAVE_PRINTF_M
-#else
-	char fm[FMT_LEN];
-	char *fp, *e = NULL, *ep;
-	const char *p;
-	size_t el = 0, fl = sizeof(fm);
-#endif
-
-	va_start(va1, fmt);
-	va_copy(va2, va1);
-	if (!(options & DHCPCD_DAEMONISED) &&
-	    (level <= LOG_ERR || level <= loglevel))
-	{
-#if HAVE_PRINTF_M
-		vfprintf(f, fmt, va1);
-#else
-		for (p = fmt, fp = fm; *p; p++) {
-			if (*p == '%' && p[1] == 'm') {
-				if (!e) {
-					e = strerror(errno);
-					el = strlen(e);
-				}
-				ep = e;
-				while (fl && *ep) {
-					*fp++ = *ep++;
-					fl--;
-				}
-				p++;
-			} else if (*p == '%' && p[1] == '%' && fl > 2) {
-				*fp++ = '%';
-				*fp++ = '%';
-				p++;
-				fl -= 2;
-			} else {
-				if (fl > 1) {
-					*fp++ = *p;
-					fl--;
-				}
-			}
-		}
-		*fp = '\0';
-		vfprintf(f, fm, va1);
-#endif
-		fputc('\n', f);
-	}
-	if (level < LOG_DEBUG || level <= loglevel)
-		vsyslog(level, fmt, va2);
-	va_end(va2);
-	va_end(va1);
-}
--- a/logger.h	Fri Sep 05 15:46:02 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* 
- * dhcpcd - DHCP client daemon
- * Copyright 2006-2008 Roy Marples <roy@marples.name>
- * All rights reserved
-
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef LOGGER_H
-#define LOGGER_H
-
-/* We use %m in our logger strings to signal error message.
- * POSIX allows this in the syslog function.
- * We also use this GCC attribute to ensure parameters match the format.
- * However, printf POSIX does not define %m (only glibc does).
- * This state of affairs will give you a big warning about this if
- * you use the -pedantic GCC option. It is safe to ignore it. */
-#if defined(__GNUC__)
-#  define _printf_like(_one, _two) __attribute__((__format__(__printf__, _one, _two)))
-#else
-#  define _printf_like(_one, _two)
-#endif
-
-#include <syslog.h>
-
-void setloglevel(int);
-void logger(int, const char *, ...) _printf_like(2, 3);
-
-#endif
--- a/net.c	Fri Sep 05 15:46:02 2008 +0000
+++ b/net.c	Fri Sep 05 18:24:34 2008 +0000
@@ -65,12 +65,12 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <syslog.h>
 #include <unistd.h>
 
 #include "config.h"
 #include "common.h"
 #include "dhcp.h"
-#include "logger.h"
 #include "if-options.h"
 #include "net.h"
 #include "signals.h"
@@ -238,7 +238,7 @@
 		if (!(options & DHCPCD_MASTER &&
 		    !(options & DHCPCD_DAEMONISED) &&
 		    options & DHCPCD_QUIET))
-			logger(LOG_ERR, "%s: unsupported media family", iface->name);
+			syslog(LOG_ERR, "%s: unsupported media family", iface->name);
 		goto eexit;
 	}
 	memcpy(iface->hwaddr, ifr.ifr_hwaddr.sa_data, iface->hwlen);