From 6ea730b9d9d1d066c4cb028879131e26d90479d1 Mon Sep 17 00:00:00 2001 From: Fabian Hugelshofer Date: Wed, 18 Jun 2008 14:38:10 +0200 Subject: Aligns buffers to maximum alignment of architecture Aligns buffer to maximum aligment of architecture to make the cast of char pointers to struct pointers more portable. Packet decoding is still broken on particular platforms. Signed-off-by: Fabian Hugelshofer --- src/libnfnetlink.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libnfnetlink.c b/src/libnfnetlink.c index 58d989f..d4212f9 100644 --- a/src/libnfnetlink.c +++ b/src/libnfnetlink.c @@ -528,7 +528,7 @@ int nfnl_listen(struct nfnl_handle *nfnlh, void *), void *jarg) { struct sockaddr_nl nladdr; - char buf[NFNL_BUFFSIZE]; + char buf[NFNL_BUFFSIZE] __attribute__ ((aligned)); struct iovec iov; int remain; struct nlmsghdr *h; @@ -637,7 +637,7 @@ int nfnl_talk(struct nfnl_handle *nfnlh, struct nlmsghdr *n, pid_t peer, int (*junk)(struct sockaddr_nl *, struct nlmsghdr *n, void *), void *jarg) { - char buf[NFNL_BUFFSIZE]; + char buf[NFNL_BUFFSIZE] __attribute__ ((aligned)); struct sockaddr_nl nladdr; struct nlmsghdr *h; unsigned int seq; @@ -1474,7 +1474,8 @@ int nfnl_catch(struct nfnl_handle *h) assert(h); while (1) { - unsigned char buf[h->rcv_buffer_size]; + unsigned char buf[h->rcv_buffer_size] + __attribute__ ((aligned)); ret = nfnl_recv(h, buf, sizeof(buf)); if (ret == -1) { -- cgit v1.2.3