]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
bsd: ensure proper alignment of BPF header
authorVincent Bernat <vincent@bernat.im>
Thu, 15 May 2014 23:39:52 +0000 (01:39 +0200)
committerVincent Bernat <vincent@bernat.im>
Thu, 15 May 2014 23:39:52 +0000 (01:39 +0200)
This is required as per bpf(4).

src/daemon/interfaces-bpf.c

index 024e13c42b0f15a4dcb0a157b5de7109ddda9b7f..a56d47f4f00c5ede384a3e8aa32b0ec95638cdef 100644 (file)
@@ -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;
 }