diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2017-07-14 13:08:42 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2017-07-14 13:08:42 +0000 |
commit | cf5aec75b9650933be22a9f8120aa631181f772e (patch) | |
tree | 15109a7c9328cd13e0ae1f7bd8637bb7044376b7 /sbin | |
parent | 4a231c2567883dd84f2b20e9fb968d5707e32afe (diff) |
bpf(4) *may* deliver more than one captured packet at a time. So when
the bpf socket signals that it has data, call packethandler() in a
loop until no more bpf packets are available.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dhclient/dispatch.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index b3afeff1e7c..43ab9708c8e 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.132 2017/07/07 14:53:07 krw Exp $ */ +/* $OpenBSD: dispatch.c,v 1.133 2017/07/14 13:08:41 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -181,8 +181,11 @@ dispatch(struct interface_info *ifi, int routefd) } } - if ((fds[0].revents & (POLLIN | POLLHUP))) - packethandler(ifi); + if ((fds[0].revents & (POLLIN | POLLHUP))) { + do { + packethandler(ifi); + } while (ifi->rbuf_offset < ifi->rbuf_len); + } if ((fds[1].revents & (POLLIN | POLLHUP))) routehandler(ifi, routefd); if (fds[2].revents & POLLOUT) |