From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: netfilter-devel@lists.netfilter.org, Patrick McHardy <kaber@trash.net>
Subject: [NETFILTER 01/6]: nf_queue: don't copy registered rerouter data
Date: Sat, 25 Feb 2006 14:17:41 +0100 (MET) [thread overview]
Message-ID: <20060225131559.7400.41473.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20060225131547.7400.12127.sendpatchset@localhost.localdomain>
[NETFILTER]: nf_queue: don't copy registered rerouter data
Use the registered data structure instead of copying it.
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 139a39bf3a1cc347d77582bea8cdabe7d3a25021
tree fa64e102124cf15c9df8672ac15342464882cea2
parent 5c1ca65c93503b2c94359ba39640f9687bd192a3
author Patrick McHardy <kaber@trash.net> Sat, 25 Feb 2006 13:43:04 +0100
committer Patrick McHardy <kaber@trash.net> Sat, 25 Feb 2006 13:43:04 +0100
net/netfilter/nf_queue.c | 28 +++++++++-------------------
1 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index d3a4f30..24ad41e 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -16,7 +16,7 @@
* for queueing and must reinject all packets it receives, no matter what.
*/
static struct nf_queue_handler *queue_handler[NPROTO];
-static struct nf_queue_rerouter *queue_rerouter;
+static struct nf_queue_rerouter *queue_rerouter[NPROTO];
static DEFINE_RWLOCK(queue_handler_lock);
@@ -64,7 +64,7 @@ int nf_register_queue_rerouter(int pf, s
return -EINVAL;
write_lock_bh(&queue_handler_lock);
- memcpy(&queue_rerouter[pf], rer, sizeof(queue_rerouter[pf]));
+ queue_rerouter[pf] = rer;
write_unlock_bh(&queue_handler_lock);
return 0;
@@ -77,7 +77,7 @@ int nf_unregister_queue_rerouter(int pf)
return -EINVAL;
write_lock_bh(&queue_handler_lock);
- memset(&queue_rerouter[pf], 0, sizeof(queue_rerouter[pf]));
+ queue_rerouter[pf] = NULL;
write_unlock_bh(&queue_handler_lock);
return 0;
}
@@ -123,7 +123,7 @@ int nf_queue(struct sk_buff **skb,
return 1;
}
- info = kmalloc(sizeof(*info)+queue_rerouter[pf].rer_size, GFP_ATOMIC);
+ info = kmalloc(sizeof(*info)+queue_rerouter[pf]->rer_size, GFP_ATOMIC);
if (!info) {
if (net_ratelimit())
printk(KERN_ERR "OOM queueing packet %p\n",
@@ -155,14 +155,14 @@ int nf_queue(struct sk_buff **skb,
if (physoutdev) dev_hold(physoutdev);
}
#endif
- if (queue_rerouter[pf].save)
- queue_rerouter[pf].save(*skb, info);
+ if (queue_rerouter[pf]->save)
+ queue_rerouter[pf]->save(*skb, info);
status = queue_handler[pf]->outfn(*skb, info, queuenum,
queue_handler[pf]->data);
- if (status >= 0 && queue_rerouter[pf].reroute)
- status = queue_rerouter[pf].reroute(skb, info);
+ if (status >= 0 && queue_rerouter[pf]->reroute)
+ status = queue_rerouter[pf]->reroute(skb, info);
read_unlock(&queue_handler_lock);
@@ -322,22 +322,12 @@ int __init netfilter_queue_init(void)
{
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *pde;
-#endif
- queue_rerouter = kmalloc(NPROTO * sizeof(struct nf_queue_rerouter),
- GFP_KERNEL);
- if (!queue_rerouter)
- return -ENOMEM;
-#ifdef CONFIG_PROC_FS
pde = create_proc_entry("nf_queue", S_IRUGO, proc_net_netfilter);
- if (!pde) {
- kfree(queue_rerouter);
+ if (!pde)
return -1;
- }
pde->proc_fops = &nfqueue_file_ops;
#endif
- memset(queue_rerouter, 0, NPROTO * sizeof(struct nf_queue_rerouter));
-
return 0;
}
next prev parent reply other threads:[~2006-02-25 13:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-25 13:17 [00/06]: Netfilter fixes for 2.6.16 Patrick McHardy
2006-02-25 13:17 ` Patrick McHardy [this message]
2006-02-25 13:17 ` [NETFILTER 02/6]: nf_queue: check if rerouter is present before using it Patrick McHardy
2006-02-25 13:18 ` [NETFILTER 03/6]: nf_queue: fix rerouting after packet mangling Patrick McHardy
2006-02-25 13:18 ` [NETFILTER 04/6]: nf_queue: remove unnecessary check for outfn Patrick McHardy
2006-02-25 13:18 ` [NETFILTER 05/6]: nf_queue: fix end-of-list check Patrick McHardy
2006-02-25 13:18 ` [NETFILTER 06/6]: Restore {ipt,ip6t,ebt}_LOG compatibility Patrick McHardy
2006-02-25 14:13 ` Gregor Maier
2006-02-25 18:48 ` Patrick McHardy
2006-02-27 21:04 ` [00/06]: Netfilter fixes for 2.6.16 David S. Miller
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=20060225131559.7400.41473.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.