-/* $OpenBSD: src/sbin/dhclient/dhclient.c,v 1.128 2009/06/03 02:05:34 stevesk Exp $ */
+/* $OpenBSD: src/sbin/dhclient/dhclient.c,v 1.129 2009/06/06 04:02:42 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
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;
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;
}
}
-/* $OpenBSD: src/sbin/dhclient/dhcpd.h,v 1.68 2009/03/10 23:19:36 krw Exp $ */
+/* $OpenBSD: src/sbin/dhclient/dhcpd.h,v 1.69 2009/06/06 04:02:42 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
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 */
-/* $OpenBSD: src/sbin/dhclient/dispatch.c,v 1.43 2009/02/19 03:29:21 krw Exp $ */
+/* $OpenBSD: src/sbin/dhclient/dispatch.c,v 1.44 2009/06/06 04:02:42 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
* 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;
}
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);
}
return (0);
}
+#ifdef DEBUG
/*
* Log a debug message...
*/
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));
return (0);
}
-
+#endif
/*
* Find %m in the input string and substitute an error message string.
*/
-/* $OpenBSD: packet.c,v 1.12 2006/12/28 01:10:46 stevesk Exp $ */
-/* $DragonFly: src/sbin/dhclient/packet.c,v 1.1 2008/08/30 16:07:58 hasso Exp $ */
+/* $OpenBSD: src/sbin/dhclient/packet.c,v 1.13 2009/06/06 04:02:42 krw Exp $ */
/* Packet assembly code, originally contributed by Archie Cobbs. */
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);
/*
}
return (-1);
}
+#ifdef DEBUG
if (len + data != buf + bufix + buflen)
debug("accepting packet with data after udp payload.");
+#endif
}
usum = udp->uh_sum;
-/* $OpenBSD: privsep.c,v 1.14 2007/02/15 15:22:27 stevesk Exp $ */
-/* $DragonFly: src/sbin/dhclient/privsep.c,v 1.1 2008/08/30 16:07:58 hasso Exp $ */
+/* $OpenBSD: src/sbin/dhclient/privsep.c,v 1.15 2009/06/06 04:02:42 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
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)