diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2016-01-22 20:57:34 +0000 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2016-01-28 15:48:06 +0000 |
commit | 687b3c65c0460dd8c4ba7e63e3ae0ab20836e6e8 (patch) | |
tree | 2b54573e649124945a74665cd3b9c38dd5d052a3 /src/ra.c | |
parent | 8a8005f7ca8973702b36e711993bfff89ca9600c (diff) | |
download | odhcp6c-687b3c65c0460dd8c4ba7e63e3ae0ab20836e6e8.tar.gz |
Fix alignment of buffers in ra_process and dhcpv6_request
The packet buffer needs to be 32-bit aligned to ensure that the various
32-bit fields we pick out are naturally aligned.
The control message buffers needs to be naturally aligned for struct
cmsghdr.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'src/ra.c')
-rw-r--r-- | src/ra.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -274,7 +274,8 @@ bool ra_process(void) { bool found = false; bool changed = false; - uint8_t buf[1500], cmsg_buf[128]; + uint8_t buf[1500] __aligned(4); + uint8_t cmsg_buf[128] __aligned(__alignof__(struct cmsghdr)); struct nd_router_advert *adv = (struct nd_router_advert*)buf; struct odhcp6c_entry *entry = alloca(sizeof(*entry) + 256); const struct in6_addr any = IN6ADDR_ANY_INIT; |