[libnfnetlink] Aligns buffers to maximum alignment of architecture

Pablo Neira netfilter-cvslog-bounces at lists.netfilter.org
Wed Jun 18 14:50:58 CEST 2008


Gitweb:		http://git.netfilter.org/cgi-bin/gitweb.cgi?p=libnfnetlink.git;a=commit;h=6ea730b9d9d1d066c4cb028879131e26d90479d1
commit 6ea730b9d9d1d066c4cb028879131e26d90479d1
Author:     Fabian Hugelshofer <hugelshofer2006 at gmx.ch>
AuthorDate: Wed Jun 18 14:38:10 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Wed Jun 18 14:38:10 2008 +0200

    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 <hugelshofer2006 at gmx.ch>
       via  6ea730b9d9d1d066c4cb028879131e26d90479d1 (commit)
      from  879a8177fca94a98a69a7c2f899d09a3c9843c5b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6ea730b9d9d1d066c4cb028879131e26d90479d1
Author: Fabian Hugelshofer <hugelshofer2006 at gmx.ch>
Date:   Wed Jun 18 14:38:10 2008 +0200

    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 <hugelshofer2006 at gmx.ch>

-----------------------------------------------------------------------

 src/libnfnetlink.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
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 at gmx.ch>

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) {



More information about the netfilter-cvslog mailing list