Commit 1c15b677 authored by Michael Wang's avatar Michael Wang Committed by Pablo Neira Ayuso
Browse files

netfilter: pass 'nf_hook_ops' instead of 'list_head' to nf_queue()



Since 'list_for_each_continue_rcu' has already been replaced by
'list_for_each_entry_continue_rcu', pass 'list_head' to nf_queue() as a
parameter can not benefit us any more.

This patch will replace 'list_head' with 'nf_hook_ops' as the parameter of
nf_queue() and __nf_queue() to save code.
Signed-off-by: default avatarMichael Wang <wangyun@linux.vnet.ibm.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 2a6decfd
...@@ -189,8 +189,8 @@ next_hook: ...@@ -189,8 +189,8 @@ next_hook:
if (ret == 0) if (ret == 0)
ret = -EPERM; ret = -EPERM;
} else if ((verdict & NF_VERDICT_MASK) == NF_QUEUE) { } else if ((verdict & NF_VERDICT_MASK) == NF_QUEUE) {
int err = nf_queue(skb, &elem->list, pf, hook, indev, outdev, int err = nf_queue(skb, elem, pf, hook, indev, outdev, okfn,
okfn, verdict >> NF_VERDICT_QBITS); verdict >> NF_VERDICT_QBITS);
if (err < 0) { if (err < 0) {
if (err == -ECANCELED) if (err == -ECANCELED)
goto next_hook; goto next_hook;
......
...@@ -24,7 +24,7 @@ extern unsigned int nf_iterate(struct list_head *head, ...@@ -24,7 +24,7 @@ extern unsigned int nf_iterate(struct list_head *head,
/* nf_queue.c */ /* nf_queue.c */
extern int nf_queue(struct sk_buff *skb, extern int nf_queue(struct sk_buff *skb,
struct list_head *elem, struct nf_hook_ops *elem,
u_int8_t pf, unsigned int hook, u_int8_t pf, unsigned int hook,
struct net_device *indev, struct net_device *indev,
struct net_device *outdev, struct net_device *outdev,
......
...@@ -118,7 +118,7 @@ static void nf_queue_entry_release_refs(struct nf_queue_entry *entry) ...@@ -118,7 +118,7 @@ static void nf_queue_entry_release_refs(struct nf_queue_entry *entry)
* through nf_reinject(). * through nf_reinject().
*/ */
static int __nf_queue(struct sk_buff *skb, static int __nf_queue(struct sk_buff *skb,
struct list_head *elem, struct nf_hook_ops *elem,
u_int8_t pf, unsigned int hook, u_int8_t pf, unsigned int hook,
struct net_device *indev, struct net_device *indev,
struct net_device *outdev, struct net_device *outdev,
...@@ -155,7 +155,7 @@ static int __nf_queue(struct sk_buff *skb, ...@@ -155,7 +155,7 @@ static int __nf_queue(struct sk_buff *skb,
*entry = (struct nf_queue_entry) { *entry = (struct nf_queue_entry) {
.skb = skb, .skb = skb,
.elem = list_entry(elem, struct nf_hook_ops, list), .elem = elem,
.pf = pf, .pf = pf,
.hook = hook, .hook = hook,
.indev = indev, .indev = indev,
...@@ -225,7 +225,7 @@ static void nf_bridge_adjust_segmented_data(struct sk_buff *skb) ...@@ -225,7 +225,7 @@ static void nf_bridge_adjust_segmented_data(struct sk_buff *skb)
#endif #endif
int nf_queue(struct sk_buff *skb, int nf_queue(struct sk_buff *skb,
struct list_head *elem, struct nf_hook_ops *elem,
u_int8_t pf, unsigned int hook, u_int8_t pf, unsigned int hook,
struct net_device *indev, struct net_device *indev,
struct net_device *outdev, struct net_device *outdev,
...@@ -323,7 +323,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict) ...@@ -323,7 +323,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
local_bh_enable(); local_bh_enable();
break; break;
case NF_QUEUE: case NF_QUEUE:
err = __nf_queue(skb, &elem->list, entry->pf, entry->hook, err = __nf_queue(skb, elem, entry->pf, entry->hook,
entry->indev, entry->outdev, entry->okfn, entry->indev, entry->outdev, entry->okfn,
verdict >> NF_VERDICT_QBITS); verdict >> NF_VERDICT_QBITS);
if (err < 0) { if (err < 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment