From: Pierre Chifflier <chifflier@edenwall.com>
To: netfilter-devel@vger.kernel.org
Cc: Pierre Chifflier <chifflier@edenwall.com>
Subject: [PATCH 1/3] Make the afinfo structure optional in nf_queue and nf_reinject
Date: Thu, 3 Feb 2011 15:32:18 +0100 [thread overview]
Message-ID: <1296743540-8148-2-git-send-email-chifflier@edenwall.com> (raw)
In-Reply-To: <4D49E1E0.50304@trash.net>
Packets coming from the bridge do not have an afinfo registered,
so make the call to get the structure optional.
Signed-off-by: Pierre Chifflier <chifflier@edenwall.com>
---
net/netfilter/nf_queue.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index 5ab22e2..a725487 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -131,8 +131,9 @@ static int __nf_queue(struct sk_buff *skb,
struct net_device *physindev;
struct net_device *physoutdev;
#endif
- const struct nf_afinfo *afinfo;
+ const struct nf_afinfo *afinfo = NULL;
const struct nf_queue_handler *qh;
+ int route_key_size = 0;
/* QUEUE == DROP if noone is waiting, to be safe. */
rcu_read_lock();
@@ -144,10 +145,10 @@ static int __nf_queue(struct sk_buff *skb,
}
afinfo = nf_get_afinfo(pf);
- if (!afinfo)
- goto err_unlock;
+ if (afinfo)
+ route_key_size = afinfo->route_key_size;
- entry = kmalloc(sizeof(*entry) + afinfo->route_key_size, GFP_ATOMIC);
+ entry = kmalloc(sizeof(*entry) + route_key_size, GFP_ATOMIC);
if (!entry) {
status = -ENOMEM;
goto err_unlock;
@@ -184,7 +185,8 @@ static int __nf_queue(struct sk_buff *skb,
}
#endif
skb_dst_force(skb);
- afinfo->saveroute(skb, entry);
+ if (afinfo)
+ afinfo->saveroute(skb, entry);
status = qh->outfn(entry, queuenum);
rcu_read_unlock();
@@ -264,7 +266,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
{
struct sk_buff *skb = entry->skb;
struct list_head *elem = &entry->elem->list;
- const struct nf_afinfo *afinfo;
+ const struct nf_afinfo *afinfo = NULL;
int err;
rcu_read_lock();
@@ -279,7 +281,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
if (verdict == NF_ACCEPT) {
afinfo = nf_get_afinfo(entry->pf);
- if (!afinfo || afinfo->reroute(skb, entry) < 0)
+ if (afinfo && afinfo->reroute(skb, entry) < 0)
verdict = NF_DROP;
}
--
1.7.2.3
next prev parent reply other threads:[~2011-02-03 15:12 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-24 20:55 ebtables_nfqueue: missing structure afinfo Pierre Chifflier
2011-01-25 10:34 ` Patrick McHardy
2011-02-02 19:22 ` Pierre Chifflier
2011-02-02 22:59 ` Patrick McHardy
2011-02-03 14:32 ` WIP/RFC: add new module ebt_NFQUEUE for ebtables Pierre Chifflier
2011-02-03 20:19 ` Bart De Schuymer
2011-02-04 10:05 ` Pierre Chifflier
2011-02-04 13:07 ` Patrick McHardy
2011-02-04 13:20 ` Pierre Chifflier
2011-02-04 13:21 ` Patrick McHardy
2011-02-03 14:32 ` Pierre Chifflier [this message]
2011-02-04 13:27 ` [PATCH 1/3] Make the afinfo structure optional in nf_queue and nf_reinject Patrick McHardy
2011-02-04 14:15 ` Pierre Chifflier
2011-02-03 14:32 ` [PATCH 2/3] bridge: add support for the EBT_QUEUE target Pierre Chifflier
2011-02-03 14:32 ` [PATCH 3/3] bridge: add new target NFQUEUE for ebtables Pierre Chifflier
2011-02-04 13:25 ` Patrick McHardy
2011-02-04 13:40 ` Pierre Chifflier
2011-02-04 13:41 ` Patrick McHardy
[not found] ` <4D5104C4.3010105@edenwall.com>
[not found] ` <4D59C047.5050404@trash.net>
2011-02-16 16:57 ` [RFH] " Pierre Chifflier
2011-02-17 10:47 ` Patrick McHardy
2011-02-17 13:37 ` Pierre Chifflier
2011-02-18 13:42 ` 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=1296743540-8148-2-git-send-email-chifflier@edenwall.com \
--to=chifflier@edenwall.com \
--cc=netfilter-devel@vger.kernel.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 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).