diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-06-06 04:02:43 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-06-06 04:02:43 +0000 |
commit | 6ab1d49e9d67904695f4398a2d1b6aa1d86de58d (patch) | |
tree | 66380185d1c248a386a1002ec4efd0ca652c06b4 /sbin | |
parent | 007d82e7701a10af43df89aaf33bf1a4e951a00a (diff) |
Nuke debug() unless DEBUG is defined. Elminates debug output from
normal operations.
Prodded by deraadt@ a while ago.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dhclient/dhclient.c | 6 | ||||
-rw-r--r-- | sbin/dhclient/dhcpd.h | 4 | ||||
-rw-r--r-- | sbin/dhclient/dispatch.c | 6 | ||||
-rw-r--r-- | sbin/dhclient/errwarn.c | 6 | ||||
-rw-r--r-- | sbin/dhclient/packet.c | 6 | ||||
-rw-r--r-- | sbin/dhclient/privsep.c | 4 |
6 files changed, 24 insertions, 8 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 2e15b7141ec..9c96272943d 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.128 2009/06/03 02:05:34 stevesk Exp $ */ +/* $OpenBSD: dhclient.c,v 1.129 2009/06/06 04:02:42 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -232,9 +232,11 @@ routehandler(void) linkstat = LINK_STATE_IS_UP(ifm->ifm_data.ifi_link_state) ? 1 : 0; if (linkstat != ifi->linkstat) { +#ifdef DEBUG debug("link state %s -> %s", ifi->linkstat ? "up" : "down", linkstat ? "up" : "down"); +#endif ifi->linkstat = interface_link_status(ifi->name); if (ifi->linkstat) { client->state = S_INIT; @@ -762,7 +764,9 @@ dhcpoffer(struct iaddr client_addr, struct option_data *options) if (lease->address.len == sizeof(client->packet.yiaddr) && !memcmp(lease->address.iabuf, &client->packet.yiaddr, lease->address.len)) { +#ifdef DEBUG debug("%s already seen.", name); +#endif return; } } diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 0111f2f27e9..bbcd1dd513f 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.68 2009/03/10 23:19:36 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.69 2009/06/06 04:02:42 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer <henning@openbsd.org> @@ -220,7 +220,9 @@ extern int warnings_occurred; void error(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); int warning(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); int note(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +#ifdef DEBUG int debug(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +#endif int parse_warn(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); /* conflex.c */ diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index 744fc1e96cc..f01d914e151 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.43 2009/02/19 03:29:21 krw Exp $ */ +/* $OpenBSD: dispatch.c,v 1.44 2009/06/06 04:02:42 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -317,8 +317,10 @@ interface_status(char *ifname) * EINVAL or ENOTTY simply means that the interface * does not support the SIOCGIFMEDIA ioctl. We regard it alive. */ +#ifdef DEBUG if (errno != EINVAL && errno != ENOTTY) debug("ioctl(SIOCGIFMEDIA) on %s: %m", ifname); +#endif ifi->noifmedia = 1; goto active; @@ -433,8 +435,10 @@ interface_link_status(char *ifname) strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name)); if (ioctl(sock, SIOCGIFMEDIA, (caddr_t)&ifmr) == -1) { /* EINVAL/ENOTTY -> link state unknown. treat as active */ +#ifdef DEBUG if (errno != EINVAL && errno != ENOTTY) debug("ioctl(SIOCGIFMEDIA) on %s: %m", ifname); +#endif close(sock); return (1); } diff --git a/sbin/dhclient/errwarn.c b/sbin/dhclient/errwarn.c index b5a4335bac7..ac777f1194b 100644 --- a/sbin/dhclient/errwarn.c +++ b/sbin/dhclient/errwarn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: errwarn.c,v 1.15 2007/03/02 11:31:17 henning Exp $ */ +/* $OpenBSD: errwarn.c,v 1.16 2009/06/06 04:02:42 krw Exp $ */ /* Errors and warnings... */ @@ -138,6 +138,7 @@ note(char *fmt, ...) return (0); } +#ifdef DEBUG /* * Log a debug message... */ @@ -152,9 +153,7 @@ debug(char *fmt, ...) vsnprintf(mbuf, sizeof(mbuf), fbuf, list); va_end(list); -#ifndef DEBUG syslog(LOG_DEBUG, "%s", mbuf); -#endif if (log_perror) { write(STDERR_FILENO, mbuf, strlen(mbuf)); @@ -163,6 +162,7 @@ debug(char *fmt, ...) return (0); } +#endif /* * Find %m in the input string and substitute an error message string. diff --git a/sbin/dhclient/packet.c b/sbin/dhclient/packet.c index 815ef411ed4..65662b9ed64 100644 --- a/sbin/dhclient/packet.c +++ b/sbin/dhclient/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.12 2006/12/28 01:10:46 stevesk Exp $ */ +/* $OpenBSD: packet.c,v 1.13 2009/06/06 04:02:42 krw Exp $ */ /* Packet assembly code, originally contributed by Archie Cobbs. */ @@ -189,9 +189,11 @@ decode_udp_ip_header(unsigned char *buf, int bufix, struct sockaddr_in *from, return (-1); } +#ifdef DEBUG if (ntohs(ip->ip_len) != buflen) debug("ip length %d disagrees with bytes received %d.", ntohs(ip->ip_len), buflen); +#endif memcpy(&from->sin_addr, &ip->ip_src, 4); @@ -217,8 +219,10 @@ decode_udp_ip_header(unsigned char *buf, int bufix, struct sockaddr_in *from, } return (-1); } +#ifdef DEBUG if (len + data != buf + bufix + buflen) debug("accepting packet with data after udp payload."); +#endif } usum = udp->uh_sum; diff --git a/sbin/dhclient/privsep.c b/sbin/dhclient/privsep.c index 9c58f2915d6..c5feb4f26d1 100644 --- a/sbin/dhclient/privsep.c +++ b/sbin/dhclient/privsep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep.c,v 1.14 2007/02/15 15:22:27 stevesk Exp $ */ +/* $OpenBSD: privsep.c,v 1.15 2009/06/06 04:02:42 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer <henning@openbsd.org> @@ -77,7 +77,9 @@ buf_read(int sock, void *buf, size_t nbytes) do { n = read(sock, buf, nbytes); if (n == 0) { /* connection closed */ +#ifdef DEBUG debug("buf_read (connection closed)"); +#endif exit(1); } if (n != -1 && n < nbytes) |