netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libnetfilter_queue: align the buffer passed to nfnl_fill_hdr
@ 2008-01-27 21:37 Silvester Erdeg
  2008-02-19 12:17 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Silvester Erdeg @ 2008-01-27 21:37 UTC (permalink / raw)
  To: netfilter-devel

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@gmail.com>

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];

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

* Re: [PATCH] libnetfilter_queue: align the buffer passed to nfnl_fill_hdr
  2008-01-27 21:37 [PATCH] libnetfilter_queue: align the buffer passed to nfnl_fill_hdr Silvester Erdeg
@ 2008-02-19 12:17 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2008-02-19 12:17 UTC (permalink / raw)
  To: Silvester Erdeg; +Cc: netfilter-devel

Silvester Erdeg wrote:
> 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.


This does not apply cleanly because your mailer seems to
have wrapped long lines. Could you resend as attachment?

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

end of thread, other threads:[~2008-02-19 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-27 21:37 [PATCH] libnetfilter_queue: align the buffer passed to nfnl_fill_hdr Silvester Erdeg
2008-02-19 12:17 ` Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).