Commit f0d6764f authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: ebtables: allow use of ebt_do_table as hookfn

This is possible now that the xt_table structure is passed via *priv.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 44b5990e
...@@ -112,9 +112,8 @@ extern int ebt_register_table(struct net *net, ...@@ -112,9 +112,8 @@ extern int ebt_register_table(struct net *net,
const struct nf_hook_ops *ops); const struct nf_hook_ops *ops);
extern void ebt_unregister_table(struct net *net, const char *tablename); extern void ebt_unregister_table(struct net *net, const char *tablename);
void ebt_unregister_table_pre_exit(struct net *net, const char *tablename); void ebt_unregister_table_pre_exit(struct net *net, const char *tablename);
extern unsigned int ebt_do_table(struct sk_buff *skb, extern unsigned int ebt_do_table(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state, const struct nf_hook_state *state);
struct ebt_table *table);
/* True if the hook mask denotes that the rule is in a base chain, /* True if the hook mask denotes that the rule is in a base chain,
* used in the check() functions */ * used in the check() functions */
......
...@@ -66,7 +66,7 @@ static unsigned int ebt_broute(void *priv, struct sk_buff *skb, ...@@ -66,7 +66,7 @@ static unsigned int ebt_broute(void *priv, struct sk_buff *skb,
NFPROTO_BRIDGE, s->in, NULL, NULL, NFPROTO_BRIDGE, s->in, NULL, NULL,
s->net, NULL); s->net, NULL);
ret = ebt_do_table(skb, &state, priv); ret = ebt_do_table(priv, skb, &state);
if (ret != NF_DROP) if (ret != NF_DROP)
return ret; return ret;
......
...@@ -58,28 +58,21 @@ static const struct ebt_table frame_filter = { ...@@ -58,28 +58,21 @@ static const struct ebt_table frame_filter = {
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static unsigned int
ebt_filter_hook(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state)
{
return ebt_do_table(skb, state, priv);
}
static const struct nf_hook_ops ebt_ops_filter[] = { static const struct nf_hook_ops ebt_ops_filter[] = {
{ {
.hook = ebt_filter_hook, .hook = ebt_do_table,
.pf = NFPROTO_BRIDGE, .pf = NFPROTO_BRIDGE,
.hooknum = NF_BR_LOCAL_IN, .hooknum = NF_BR_LOCAL_IN,
.priority = NF_BR_PRI_FILTER_BRIDGED, .priority = NF_BR_PRI_FILTER_BRIDGED,
}, },
{ {
.hook = ebt_filter_hook, .hook = ebt_do_table,
.pf = NFPROTO_BRIDGE, .pf = NFPROTO_BRIDGE,
.hooknum = NF_BR_FORWARD, .hooknum = NF_BR_FORWARD,
.priority = NF_BR_PRI_FILTER_BRIDGED, .priority = NF_BR_PRI_FILTER_BRIDGED,
}, },
{ {
.hook = ebt_filter_hook, .hook = ebt_do_table,
.pf = NFPROTO_BRIDGE, .pf = NFPROTO_BRIDGE,
.hooknum = NF_BR_LOCAL_OUT, .hooknum = NF_BR_LOCAL_OUT,
.priority = NF_BR_PRI_FILTER_OTHER, .priority = NF_BR_PRI_FILTER_OTHER,
......
...@@ -58,27 +58,21 @@ static const struct ebt_table frame_nat = { ...@@ -58,27 +58,21 @@ static const struct ebt_table frame_nat = {
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static unsigned int ebt_nat_hook(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state)
{
return ebt_do_table(skb, state, priv);
}
static const struct nf_hook_ops ebt_ops_nat[] = { static const struct nf_hook_ops ebt_ops_nat[] = {
{ {
.hook = ebt_nat_hook, .hook = ebt_do_table,
.pf = NFPROTO_BRIDGE, .pf = NFPROTO_BRIDGE,
.hooknum = NF_BR_LOCAL_OUT, .hooknum = NF_BR_LOCAL_OUT,
.priority = NF_BR_PRI_NAT_DST_OTHER, .priority = NF_BR_PRI_NAT_DST_OTHER,
}, },
{ {
.hook = ebt_nat_hook, .hook = ebt_do_table,
.pf = NFPROTO_BRIDGE, .pf = NFPROTO_BRIDGE,
.hooknum = NF_BR_POST_ROUTING, .hooknum = NF_BR_POST_ROUTING,
.priority = NF_BR_PRI_NAT_SRC, .priority = NF_BR_PRI_NAT_SRC,
}, },
{ {
.hook = ebt_nat_hook, .hook = ebt_do_table,
.pf = NFPROTO_BRIDGE, .pf = NFPROTO_BRIDGE,
.hooknum = NF_BR_PRE_ROUTING, .hooknum = NF_BR_PRE_ROUTING,
.priority = NF_BR_PRI_NAT_DST_BRIDGED, .priority = NF_BR_PRI_NAT_DST_BRIDGED,
......
...@@ -189,10 +189,10 @@ ebt_get_target_c(const struct ebt_entry *e) ...@@ -189,10 +189,10 @@ ebt_get_target_c(const struct ebt_entry *e)
} }
/* Do some firewalling */ /* Do some firewalling */
unsigned int ebt_do_table(struct sk_buff *skb, unsigned int ebt_do_table(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state, const struct nf_hook_state *state)
struct ebt_table *table)
{ {
struct ebt_table *table = priv;
unsigned int hook = state->hook; unsigned int hook = state->hook;
int i, nentries; int i, nentries;
struct ebt_entry *point; struct ebt_entry *point;
......
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