]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Work around PCC not supporting the __packed__ attribute on structures. dhcpcd now...
authorRoy Marples <roy@marples.name>
Thu, 3 Jul 2008 00:12:57 +0000 (00:12 +0000)
committerRoy Marples <roy@marples.name>
Thu, 3 Jul 2008 00:12:57 +0000 (00:12 +0000)
bpf.c

diff --git a/bpf.c b/bpf.c
index 097555aaf75b0990f202ccee09b357c7a1e05b73..18dfca51069953a1f91765697c266ca8417b49b4 100644 (file)
--- a/bpf.c
+++ b/bpf.c
@@ -151,6 +151,11 @@ send_raw_packet(const struct interface *iface, int protocol,
        iov[1].iov_base = UNCONST(data);
        iov[1].iov_len = len;
 
+#ifdef __PCC__
+       /* Work around PCC not respecting the packed ether_header */
+       iov[0].iov_len = 14;
+#endif
+       
        return writev(iface->fd, iov, 2);
 }
 
@@ -193,6 +198,11 @@ get_raw_packet(struct interface *iface, int protocol,
                        goto next; /* Packet beyond buffer, drop. */
                payload = iface->buffer + packet.bh_hdrlen + sizeof(hw);
                bytes = packet.bh_caplen - sizeof(hw);
+#ifdef __PCC__
+               /* Work around PCC not respecting the packed ether_header */
+               payload -= sizeof(hw) - 14;
+               bytes += sizeof(hw) - 14;
+#endif
                if (bytes > len)
                        bytes = len;
                memcpy(data, payload, bytes);