diff options
author | Fabian Hugelshofer <hugelshofer2006@gmx.ch> | 2008-06-18 14:38:10 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-06-18 14:38:10 +0200 |
commit | 6ea730b9d9d1d066c4cb028879131e26d90479d1 (patch) | |
tree | 61c63e547c6e01830c9fbe4414e37bf869c719ce | |
parent | 879a8177fca94a98a69a7c2f899d09a3c9843c5b (diff) |
Aligns buffers to maximum alignment of architecturelibnfnetlink-0.0.39
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 <hugelshofer2006@gmx.ch>
-rw-r--r-- | src/libnfnetlink.c | 7 |
1 files changed, 4 insertions, 3 deletions
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) { |