diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2020-03-28 22:07:00 +0000 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2020-03-28 22:18:56 +0000 |
commit | 7ffa5f8d889e8107fd97fcc5628f87e6ef2f4b91 (patch) | |
tree | 63553960b912c0628e91bf850be2769b17074bcd | |
parent | d8e32d95a1bff2639f9ede9eae9b07b53f37bdac (diff) | |
download | klibc-7ffa5f8d889e8107fd97fcc5628f87e6ef2f4b91.tar.gz |
[klibc] ipconfig: Fix alignment of packet structure
This structure should have alignment of exactly 4, since we want the
16-bit and 32-bit fields in it to have natural alignment but we don't
want extra padding that would violate the wire protocols.
This should be what happens by default, but for some reason it's
declared with the "packed" attribute. gcc is now warning about using
potentially misaligned pointers to its members.
Add the attribute "aligned(4)" so that it is definitely exactly 4-byte
aligned.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | usr/kinit/ipconfig/packet.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr/kinit/ipconfig/packet.c b/usr/kinit/ipconfig/packet.c index 200180109f2d15..2e1487d2594bb4 100644 --- a/usr/kinit/ipconfig/packet.c +++ b/usr/kinit/ipconfig/packet.c @@ -86,7 +86,7 @@ static unsigned int ip_checksum(uint16_t *hdr, int len) struct header { struct iphdr ip; struct udphdr udp; -} __attribute__ ((packed)); +} __attribute__ ((packed, aligned(4))); static struct header ipudp_hdrs = { .ip = { |