Commit e8d225b6 authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso
Browse files

netfilter: arp_tables: allow use of arpt_do_table as hookfn



This is possible now that the xt_table structure is passed in via *priv.

Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 8844e010
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -54,9 +54,8 @@ int arpt_register_table(struct net *net, const struct xt_table *table,
			const struct nf_hook_ops *ops);
			const struct nf_hook_ops *ops);
void arpt_unregister_table(struct net *net, const char *name);
void arpt_unregister_table(struct net *net, const char *name);
void arpt_unregister_table_pre_exit(struct net *net, const char *name);
void arpt_unregister_table_pre_exit(struct net *net, const char *name);
extern unsigned int arpt_do_table(struct sk_buff *skb,
extern unsigned int arpt_do_table(void *priv, struct sk_buff *skb,
				  const struct nf_hook_state *state,
				  const struct nf_hook_state *state);
				  struct xt_table *table);


#ifdef CONFIG_NETFILTER_XTABLES_COMPAT
#ifdef CONFIG_NETFILTER_XTABLES_COMPAT
#include <net/compat.h>
#include <net/compat.h>
+4 −3
Original line number Original line Diff line number Diff line
@@ -179,10 +179,11 @@ struct arpt_entry *arpt_next_entry(const struct arpt_entry *entry)
	return (void *)entry + entry->next_offset;
	return (void *)entry + entry->next_offset;
}
}


unsigned int arpt_do_table(struct sk_buff *skb,
unsigned int arpt_do_table(void *priv,
			   const struct nf_hook_state *state,
			   struct sk_buff *skb,
			   struct xt_table *table)
			   const struct nf_hook_state *state)
{
{
	const struct xt_table *table = priv;
	unsigned int hook = state->hook;
	unsigned int hook = state->hook;
	static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long))));
	static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long))));
	unsigned int verdict = NF_DROP;
	unsigned int verdict = NF_DROP;
+1 −9
Original line number Original line Diff line number Diff line
@@ -26,14 +26,6 @@ static const struct xt_table packet_filter = {
	.priority	= NF_IP_PRI_FILTER,
	.priority	= NF_IP_PRI_FILTER,
};
};


/* The work comes in here from netfilter.c */
static unsigned int
arptable_filter_hook(void *priv, struct sk_buff *skb,
		     const struct nf_hook_state *state)
{
	return arpt_do_table(skb, state, priv);
}

static struct nf_hook_ops *arpfilter_ops __read_mostly;
static struct nf_hook_ops *arpfilter_ops __read_mostly;


static int arptable_filter_table_init(struct net *net)
static int arptable_filter_table_init(struct net *net)
@@ -72,7 +64,7 @@ static int __init arptable_filter_init(void)
	if (ret < 0)
	if (ret < 0)
		return ret;
		return ret;


	arpfilter_ops = xt_hook_ops_alloc(&packet_filter, arptable_filter_hook);
	arpfilter_ops = xt_hook_ops_alloc(&packet_filter, arpt_do_table);
	if (IS_ERR(arpfilter_ops)) {
	if (IS_ERR(arpfilter_ops)) {
		xt_unregister_template(&packet_filter);
		xt_unregister_template(&packet_filter);
		return PTR_ERR(arpfilter_ops);
		return PTR_ERR(arpfilter_ops);