[PATCH] libnetfilter_queue: align the buffer passed to nfnl_fill_hdr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The buffer passed to nfnl_fill_hdr needs to aligned because some
architectures (e.g. ARM) cannot do proper 32-bit read/writes on
unaligned addresses. This patch solves this for libnetfilter_queue.

Signed-off-by: Szilveszter Ordog <slipszi@xxxxxxxxx>

diff -uNpr libnetfilter_queue-0.0.15-orig/src/libnetfilter_queue.c
libnetfilter_queue-0.0.15/src/libnetfilter_queue.c
--- libnetfilter_queue-0.0.15-orig/src/libnetfilter_queue.c	2007-03-22
00:49:46.000000000 +0100
+++ libnetfilter_queue-0.0.15/src/libnetfilter_queue.c	2008-01-08
14:50:53.000000000 +0100
@@ -98,7 +98,7 @@ __build_send_cfg_msg(struct nfq_handle *
 		u_int16_t queuenum, u_int16_t pf)
 {
 	char buf[NFNL_HEADER_LEN
-		+NFA_LENGTH(sizeof(struct nfqnl_msg_config_cmd))];
+		+NFA_LENGTH(sizeof(struct nfqnl_msg_config_cmd))] __attribute__((aligned));
 	struct nfqnl_msg_config_cmd cmd;
 	struct nlmsghdr *nmh = (struct nlmsghdr *) buf;

@@ -273,7 +273,7 @@ int nfq_set_mode(struct nfq_q_handle *qh
 		u_int8_t mode, u_int32_t range)
 {
 	char buf[NFNL_HEADER_LEN
-		+NFA_LENGTH(sizeof(struct nfqnl_msg_config_params))];
+		+NFA_LENGTH(sizeof(struct nfqnl_msg_config_params))]
__attribute__((aligned));
 	struct nfqnl_msg_config_params params;
 	struct nlmsghdr *nmh = (struct nlmsghdr *) buf;

@@ -292,7 +292,7 @@ int nfq_set_queue_maxlen(struct nfq_q_ha
 				u_int32_t queuelen)
 {
 	char buf[NFNL_HEADER_LEN
-		+NFA_LENGTH(sizeof(struct nfqnl_msg_config_params))];
+		+NFA_LENGTH(sizeof(struct nfqnl_msg_config_params))]
__attribute__((aligned));
 	u_int32_t queue_maxlen = htonl(queuelen);
 	struct nlmsghdr *nmh = (struct nlmsghdr *) buf;

@@ -312,7 +312,7 @@ static int __set_verdict(struct nfq_q_ha
 	struct nfqnl_msg_verdict_hdr vh;
 	char buf[NFNL_HEADER_LEN
 		+NFA_LENGTH(sizeof(mark))
-		+NFA_LENGTH(sizeof(vh))];
+		+NFA_LENGTH(sizeof(vh))] __attribute__((aligned));
 	struct nlmsghdr *nmh = (struct nlmsghdr *) buf;

 	struct iovec iov[3];
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux