From: Vincent Bernat Date: Thu, 15 May 2014 23:39:52 +0000 (+0200) Subject: bsd: ensure proper alignment of BPF header X-Git-Tag: 0.7.9~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eeb66a08bdb703c8b82123cb331a1b33e73adb29;p=thirdparty%2Flldpd.git bsd: ensure proper alignment of BPF header This is required as per bpf(4). --- diff --git a/src/daemon/interfaces-bpf.c b/src/daemon/interfaces-bpf.c index 024e13c4..a56d47f4 100644 --- a/src/daemon/interfaces-bpf.c +++ b/src/daemon/interfaces-bpf.c @@ -21,7 +21,7 @@ struct bpf_buffer { size_t len; /* Total length of the buffer */ - char data[0]; /* Data */ + struct bpf_hdr data[0]; }; int @@ -96,7 +96,7 @@ ifbpf_eth_recv(struct lldpd *cfg, bh = (struct bpf_hdr*)bpfbuf->data; if (bh->bh_caplen < size) size = bh->bh_caplen; - memcpy(buffer, bpfbuf->data + bh->bh_hdrlen, size); + memcpy(buffer, (char *)bpfbuf->data + bh->bh_hdrlen, size); return size; }