From: Vincent Bernat Date: Thu, 15 May 2014 23:18:07 +0000 (+0200) Subject: bsd: ensure we also have space for the BPF header X-Git-Tag: 0.7.9~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=986effcb7a97a38f2af744e54462b13c09ea7e95;p=thirdparty%2Flldpd.git bsd: ensure we also have space for the BPF header --- diff --git a/src/daemon/interfaces-bpf.c b/src/daemon/interfaces-bpf.c index a03a11bc..024e13c4 100644 --- a/src/daemon/interfaces-bpf.c +++ b/src/daemon/interfaces-bpf.c @@ -38,14 +38,14 @@ ifbpf_phys_init(struct lldpd *cfg, /* Allocate receive buffer */ hardware->h_data = buffer = - malloc(ETHER_MAX_LEN + sizeof(struct bpf_buffer)); + malloc(ETHER_MAX_LEN + sizeof(struct bpf_hdr) + sizeof(struct bpf_buffer)); if (buffer == NULL) { log_warn("interfaces", "unable to allocate buffer space for BPF on %s", hardware->h_ifname); goto end; } - buffer->len = ETHER_MAX_LEN; + buffer->len = ETHER_MAX_LEN + sizeof(struct bpf_hdr); /* Setup multicast */ interfaces_setup_multicast(cfg, hardware->h_ifname, 0); diff --git a/src/daemon/priv-bsd.c b/src/daemon/priv-bsd.c index 3a61b2d1..abcd1030 100644 --- a/src/daemon/priv-bsd.c +++ b/src/daemon/priv-bsd.c @@ -54,7 +54,7 @@ asroot_iface_init_os(int ifindex, char *name, int *fd) } /* Set buffer size */ - required = ETHER_MAX_LEN; + required = ETHER_MAX_LEN + sizeof(struct bpf_hdr); if (ioctl(*fd, BIOCSBLEN, (caddr_t)&required) < 0) { rc = errno; log_warn("privsep",