summaryrefslogtreecommitdiffstats
path: root/bpf.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-05-15 13:34:31 +0000
committerRoy Marples <roy@marples.name>2008-05-15 13:34:31 +0000
commit57220ee0629f8c1ad3aad80aa43cf2b8878e1fbc (patch)
treebe6ca53e2a43ec71234d6a3158d913febc9ab053 /bpf.c
parent0f1f396ae21a88beb53cc5c9dc37267ab3aa9108 (diff)
downloaddhcpcd-57220ee0629f8c1ad3aad80aa43cf2b8878e1fbc.tar.xz
get_packet 0 means no more buffer, so loops don't need to know the bpf/socket buffering.
Diffstat (limited to 'bpf.c')
-rw-r--r--bpf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bpf.c b/bpf.c
index f39a7470..bce877d7 100644
--- a/bpf.c
+++ b/bpf.c
@@ -159,10 +159,11 @@ get_packet(struct interface *iface, void *data, ssize_t len)
ssize_t bytes;
const unsigned char *payload, *d;
- if ((size_t)len > iface->buffer_size) {
- errno = ENOBUFS;
- return -1;
+ if (iface->buffer_pos > iface->buffer_len) {
+ iface->buffer_len = iface->buffer_pos = 0;
+ return 0;
}
+
for (;;) {
if (iface->buffer_len == 0) {
bytes = read(iface->fd, iface->buffer,