summaryrefslogtreecommitdiffstats
path: root/bpf.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-05-15 12:32:27 +0000
committerRoy Marples <roy@marples.name>2008-05-15 12:32:27 +0000
commitfe965fea17d9bb66994df6c10785b3f3d148d270 (patch)
tree80819189846589a453a423a494509ceeccfba1b9 /bpf.c
parent2eebbca565e80370d617f7c325510f7c29811693 (diff)
downloaddhcpcd-fe965fea17d9bb66994df6c10785b3f3d148d270.tar.xz
Fix bpf for the correct position on new buffers.
Diffstat (limited to 'bpf.c')
-rw-r--r--bpf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bpf.c b/bpf.c
index a674069e..f39a7470 100644
--- a/bpf.c
+++ b/bpf.c
@@ -92,7 +92,7 @@ open_socket(struct interface *iface, int protocol)
/* Get the required BPF buffer length from the kernel. */
if (ioctl(fd, BIOCGBLEN, &buf_len) == -1)
goto eexit;
- if (iface->buffer_size != buf_len) {
+ if (iface->buffer_size != (size_t)buf_len) {
free(iface->buffer);
iface->buffer_size = buf_len;
iface->buffer = xmalloc(buf_len);
@@ -172,6 +172,7 @@ get_packet(struct interface *iface, void *data, ssize_t len)
else if ((size_t)bytes < sizeof(packet))
return -1;
iface->buffer_len = bytes;
+ iface->buffer_pos = 0;
}
bytes = -1;
memcpy(&packet, iface->buffer + iface->buffer_pos,