All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: netfilter-devel@lists.netfilter.org, Patrick McHardy <kaber@trash.net>
Subject: [NETFILTER 03/09]: nfnetlink_queue: fix nfnetlink message size
Date: Tue, 21 Mar 2006 02:55:53 +0100 (MET)	[thread overview]
Message-ID: <20060321015553.11977.21959.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20060321015549.11977.45799.sendpatchset@localhost.localdomain>

[NETFILTER]: nfnetlink_queue: fix nfnetlink message size

Fix oversized message, use NLMSG_SPACE just one since it reserves space
for the netlink header and NFA_SPACE for every attribute.

Thanks to Harald Welte for the feedback

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 443b1bf80678fcd789ce5c984a3240108bec4736
tree e73cbb17af7e245958829d4583564c7aa9552cb8
parent daab7149ce33d1782bb37355aea08993219bac99
author Pablo Neira Ayuso <pablo@netfilter.org> Mon, 20 Mar 2006 14:06:17 +0100
committer Patrick McHardy <kaber@trash.net> Mon, 20 Mar 2006 14:06:17 +0100

 net/netfilter/nfnetlink_queue.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 2cf5fb8..b570166 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -354,16 +354,17 @@ nfqnl_build_packet_message(struct nfqnl_
 	QDEBUG("entered\n");
 
 	/* all macros expand to constant values at compile time */
-	size =    NLMSG_SPACE(sizeof(struct nfqnl_msg_packet_hdr))
-		+ NLMSG_SPACE(sizeof(u_int32_t))	/* ifindex */
-		+ NLMSG_SPACE(sizeof(u_int32_t))	/* ifindex */
+	size =    NLMSG_SPACE(sizeof(struct nfgenmsg)) +
+		+ NFA_SPACE(sizeof(struct nfqnl_msg_packet_hdr))
+		+ NFA_SPACE(sizeof(u_int32_t))	/* ifindex */
+		+ NFA_SPACE(sizeof(u_int32_t))	/* ifindex */
 #ifdef CONFIG_BRIDGE_NETFILTER
-		+ NLMSG_SPACE(sizeof(u_int32_t))	/* ifindex */
-		+ NLMSG_SPACE(sizeof(u_int32_t))	/* ifindex */
+		+ NFA_SPACE(sizeof(u_int32_t))	/* ifindex */
+		+ NFA_SPACE(sizeof(u_int32_t))	/* ifindex */
 #endif
-		+ NLMSG_SPACE(sizeof(u_int32_t))	/* mark */
-		+ NLMSG_SPACE(sizeof(struct nfqnl_msg_packet_hw))
-		+ NLMSG_SPACE(sizeof(struct nfqnl_msg_packet_timestamp));
+		+ NFA_SPACE(sizeof(u_int32_t))	/* mark */
+		+ NFA_SPACE(sizeof(struct nfqnl_msg_packet_hw))
+		+ NFA_SPACE(sizeof(struct nfqnl_msg_packet_timestamp));
 
 	outdev = entinf->outdev;
 
@@ -388,7 +389,7 @@ nfqnl_build_packet_message(struct nfqnl_
 		else
 			data_len = queue->copy_range;
 		
-		size += NLMSG_SPACE(data_len);
+		size += NFA_SPACE(data_len);
 		break;
 	
 	default:

  parent reply	other threads:[~2006-03-21  1:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-21  1:55 [NETFILTER 00/09]: Netfilter update Patrick McHardy
2006-03-21  1:55 ` [NETFILTER 01/09]: Fix Kconfig typos Patrick McHardy
2006-03-21  1:55 ` [NETFILTER 02/09]: ctnetlink: Fix expectaction mask dumping Patrick McHardy
2006-03-21  1:55 ` Patrick McHardy [this message]
2006-03-21  1:55 ` [NETFILTER 04/09]: conntrack: cleanup the conntrack ID initialization Patrick McHardy
2006-03-21  1:55 ` [NETFILTER 05/09]: x_tables: set the protocol family in x_tables targets/matches Patrick McHardy
2006-03-21  1:55 ` [NETFILTER 06/09]: nf_conntrack: support for layer 3 protocol load on demand Patrick McHardy
2006-03-21  1:55 ` [NETFILTER 07/09]: Fix xt_policy address matching Patrick McHardy
2006-03-21  1:56 ` [NETFILTER 08/09]: Add H.323 conntrack/NAT helper Patrick McHardy
2006-03-21  2:03   ` Patrick McHardy
2006-03-21  1:56 ` [NETFILTER 09/09]: futher {ip,ip6,arp}_tables unification Patrick McHardy
2006-03-21  2:11   ` Patrick McHardy
     [not found]     ` <200603211056.02339.dim@sw.ru>
2006-03-21  8:59       ` Patrick McHardy
2006-03-21  9:21         ` Dmitry Mishin
2006-03-21 13:12           ` Patrick McHardy
2006-03-21  2:18 ` [NETFILTER 00/09]: Netfilter update Patrick McHardy
2006-03-21  7:42   ` David S. Miller
2006-03-21  8:56     ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060321015553.11977.21959.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.