summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2006-05-27 19:52:24 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2006-05-27 19:52:24 +0000
commitdb5a8b4313b6bccc6a3e85797eac7c38739ebf64 (patch)
tree02294e32c0a0ea37ecc767d81c71072669393cff /usr.sbin
parent61fd7a52fd58b1fe43116a9a91fb6c7b43ee1e2b (diff)
Don't exit just because an interface has no subnet configured in
dhcpd.conf. Just don't listen on that interface. Make warning messages textually consistant. tested & ok beck@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/dhcpd/dispatch.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/usr.sbin/dhcpd/dispatch.c b/usr.sbin/dhcpd/dispatch.c
index 021b7bb2985..c2311dd0db6 100644
--- a/usr.sbin/dhcpd/dispatch.c
+++ b/usr.sbin/dhcpd/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.19 2006/05/27 04:01:04 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.20 2006/05/27 19:52:23 krw Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@@ -202,15 +202,13 @@ discover_interfaces(void)
}
}
- /* Now cycle through all the interfaces we found, looking for
- hardware addresses. */
-
- /* Weed out the interfaces that did not have IP addresses. */
+ /* Discard interfaces we can't listen on. */
last = NULL;
for (tmp = interfaces; tmp; tmp = next) {
next = tmp->next;
+
if (!tmp->ifp) {
- warning("%s: no IP address found, can't listen.",
+ warning("Can't listen on %s - it has no IP address.",
tmp->name);
/* Remove tmp from the list of interfaces. */
if (!last)
@@ -219,22 +217,24 @@ discover_interfaces(void)
last->next = tmp->next;
continue;
}
- last = tmp;
memcpy(&foo, &tmp->ifp->ifr_addr, sizeof tmp->ifp->ifr_addr);
- /* We must have a subnet declaration for each interface. */
if (!tmp->shared_network) {
- warning("No subnet declaration for %s (%s).",
- tmp->name, inet_ntoa(foo.sin_addr));
- warning("Please write a subnet declaration in your %s",
- "dhcpd.conf file for the");
- error("network segment to which interface %s %s",
- tmp->name, "is attached.");
+ warning("Can't listen on %s - dhcpd.conf has no subnet "
+ "declaration for %s.", tmp->name,
+ inet_ntoa(foo.sin_addr));
+ /* Remove tmp from the list of interfaces. */
+ if (!last)
+ interfaces = interfaces->next;
+ else
+ last->next = tmp->next;
+ continue;
}
- /* Find subnets that don't have valid interface
- addresses... */
+ last = tmp;
+
+ /* Find subnets that don't have valid interface addresses. */
for (subnet = (tmp->shared_network ? tmp->shared_network->subnets :
NULL); subnet; subnet = subnet->next_sibling) {
if (!subnet->interface_address.len) {