All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] libnetlink-log byte alignment
@ 2008-06-03 10:21 Fabian Hugelshofer
  2008-06-16 20:32 ` Fabian Hugelshofer
  0 siblings, 1 reply; 4+ messages in thread
From: Fabian Hugelshofer @ 2008-06-03 10:21 UTC (permalink / raw)
  To: netfilter-devel

Aligns buffers to maximum alignment 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>


diff -ruN libnfnetlink-0.0.38.orig/src/libnfnetlink.c libnfnetlink-0.0.38/src/libnfnetlink.c
--- libnfnetlink-0.0.38.orig/src/libnfnetlink.c	2008-06-02 18:54:18.000000000 +0100
+++ libnfnetlink-0.0.38/src/libnfnetlink.c	2008-06-02 18:57:32.000000000 +0100
@@ -528,7 +528,7 @@
 			       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 (*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 @@
 	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) {



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-06-18 15:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-03 10:21 [PATCH 2/3] libnetlink-log byte alignment Fabian Hugelshofer
2008-06-16 20:32 ` Fabian Hugelshofer
2008-06-18 13:13   ` Pablo Neira Ayuso
2008-06-18 15:23     ` Fabian Hugelshofer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.