summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcp/common
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2001-06-25 03:04:27 +0000
committerBob Beck <beck@cvs.openbsd.org>2001-06-25 03:04:27 +0000
commit369a37b75747bedc8d5c0ff9ae2394066663aa24 (patch)
tree539369c4879694c85dd1387eb8d1615482d7f515 /usr.sbin/dhcp/common
parentd67fa24a6eb45d8a72a2ec3ebfe54d38e6965885 (diff)
fix nasty little bug in the identifaction of dead interfaces - make sure
we only care about stuff associated with an interface.
Diffstat (limited to 'usr.sbin/dhcp/common')
-rw-r--r--usr.sbin/dhcp/common/dispatch.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/dhcp/common/dispatch.c b/usr.sbin/dhcp/common/dispatch.c
index 3e1aff476e1..96ce31a8543 100644
--- a/usr.sbin/dhcp/common/dispatch.c
+++ b/usr.sbin/dhcp/common/dispatch.c
@@ -165,9 +165,10 @@ void discover_interfaces (state)
if (!tmp)
error ("Insufficient memory to %s %s",
"record interface", ifp -> ifr_name);
- strlcpy (tmp -> name, ifp -> ifr_name, IFNAMSIZ);
+ strlcpy (tmp -> name, ifp -> ifr_name, sizeof(tmp->name));
tmp -> next = interfaces;
tmp -> flags = ir;
+ tmp -> noifmedia = tmp -> dead = tmp->errors = 0;
interfaces = tmp;
}
@@ -318,8 +319,9 @@ void discover_interfaces (state)
}
/* Now register all the remaining interfaces as protocols. */
- for (tmp = interfaces; tmp; tmp = tmp -> next)
+ for (tmp = interfaces; tmp; tmp = tmp -> next) {
add_protocol (tmp -> name, tmp -> rfdesc, got_one, tmp);
+ }
close (sock);
@@ -414,9 +416,10 @@ void dispatch ()
/* Set up the descriptors to be polled. */
i = 0;
+
for (l = protocols; l; l = l -> next) {
struct interface_info *ip = l -> local;
- if (ip && !ip->dead) {
+ if (ip && (l->handler != got_one || !ip->dead)) {
fds [i].fd = l -> fd;
fds [i].events = POLLIN;
fds [i].revents = 0;
@@ -445,9 +448,12 @@ void dispatch ()
i = 0;
for (l = protocols; l; l = l -> next) {
+ struct interface_info *ip;
+ ip = l->local;
if ((fds [i].revents & POLLIN)) {
fds [i].revents = 0;
- if (l -> handler)
+ if (ip && (l->handler != got_one ||
+ !ip->dead))
(*(l -> handler)) (l);
if (interfaces_invalidated)
break;