All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] libnfnetlink byte alignment
@ 2008-06-03 10:20 Fabian Hugelshofer
  2008-06-03 13:06 ` Patrick McHardy
  2008-06-18 12:39 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 8+ messages in thread
From: Fabian Hugelshofer @ 2008-06-03 10:20 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.

Signed-off-by: Fabian Hugelshofer <hugelshofer2006@gmx.ch>


--- libnetfilter_log-0.0.13.orig/src/libnetfilter_log.c	2008-06-02 09:50:47.000000000 +0100
+++ libnetfilter_log-0.0.13/src/libnetfilter_log.c	2008-06-02 18:22:14.000000000 +0100
@@ -107,7 +107,8 @@
 		     u_int16_t queuenum, u_int8_t pf)
 {
 	char buf[NFNL_HEADER_LEN
-		+NFA_LENGTH(sizeof(struct nfulnl_msg_config_cmd))];
+		+NFA_LENGTH(sizeof(struct nfulnl_msg_config_cmd))]
+		__attribute__ ((aligned));
 	struct nfulnl_msg_config_cmd cmd;
 	struct nlmsghdr *nmh = (struct nlmsghdr *) buf;
 
@@ -292,7 +293,8 @@
 		   u_int8_t mode, u_int32_t range)
 {
 	char buf[NFNL_HEADER_LEN
-		+NFA_LENGTH(sizeof(struct nfulnl_msg_config_mode))];
+		+NFA_LENGTH(sizeof(struct nfulnl_msg_config_mode))]
+		__attribute__ ((aligned));
 	struct nfulnl_msg_config_mode params;
 	struct nlmsghdr *nmh = (struct nlmsghdr *) buf;
 
@@ -309,7 +311,8 @@
 
 int nflog_set_timeout(struct nflog_g_handle *gh, u_int32_t timeout)
 {
-	char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int32_t))];
+	char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int32_t))]
+		__attribute__ ((aligned));
 	struct nlmsghdr *nmh = (struct nlmsghdr *) buf;
 
 	nfnl_fill_hdr(gh->h->nfnlssh, nmh, 0, AF_UNSPEC, gh->id,
@@ -322,7 +325,8 @@
 
 int nflog_set_qthresh(struct nflog_g_handle *gh, u_int32_t qthresh)
 {
-	char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int32_t))];
+	char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int32_t))]
+		__attribute__ ((aligned));
 	struct nlmsghdr *nmh = (struct nlmsghdr *) buf;
 
 	nfnl_fill_hdr(gh->h->nfnlssh, nmh, 0, AF_UNSPEC, gh->id,
@@ -335,7 +339,8 @@
 
 int nflog_set_nlbufsiz(struct nflog_g_handle *gh, u_int32_t nlbufsiz)
 {
-	char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int32_t))];
+	char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int32_t))]
+		__attribute__ ((aligned));
 	struct nlmsghdr *nmh = (struct nlmsghdr *) buf;
 	int status;
 
@@ -355,7 +360,8 @@
 
 int nflog_set_flags(struct nflog_g_handle *gh, u_int16_t flags)
 {
-	char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int16_t))];
+	char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int16_t))]
+		__attribute__ ((aligned));
 	struct nlmsghdr *nmh = (struct nlmsghdr *) buf;
 
 	nfnl_fill_hdr(gh->h->nfnlssh, nmh, 0, AF_UNSPEC, gh->id,



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

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

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-03 10:20 [PATCH 1/3] libnfnetlink byte alignment Fabian Hugelshofer
2008-06-03 13:06 ` Patrick McHardy
2008-06-04  8:53   ` Fabian Hugelshofer
2008-06-04 14:35     ` Patrick McHardy
2008-06-04 21:42     ` Pablo Neira Ayuso
2008-06-05 12:55       ` Fabian Hugelshofer
2008-06-05 13:31         ` Pablo Neira Ayuso
2008-06-18 12:39 ` Pablo Neira Ayuso

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.