Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6cb8ff3f authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Pablo Neira Ayuso
Browse files

inet netfilter: Remove hook from ip6t_do_table, arp_do_table, ipt_do_table



The values of ops->hooknum and state->hook are guaraneted to be equal
making the hook argument to ip6t_do_table, arp_do_table, and
ipt_do_table is unnecessary. Remove the unnecessary hook argument.

In the callers use state->hook instead of ops->hooknum for clarity and
to reduce the number of cachelines the callers touch.

Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 97b59c3a
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ extern struct xt_table *arpt_register_table(struct net *net,
					    const struct arpt_replace *repl);
extern void arpt_unregister_table(struct xt_table *table);
extern unsigned int arpt_do_table(struct sk_buff *skb,
				  unsigned int hook,
				  const struct nf_hook_state *state,
				  struct xt_table *table);

+0 −1
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ struct ipt_error {

extern void *ipt_alloc_initial_table(const struct xt_table *);
extern unsigned int ipt_do_table(struct sk_buff *skb,
				 unsigned int hook,
				 const struct nf_hook_state *state,
				 struct xt_table *table);

+0 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ extern struct xt_table *ip6t_register_table(struct net *net,
					    const struct ip6t_replace *repl);
extern void ip6t_unregister_table(struct net *net, struct xt_table *table);
extern unsigned int ip6t_do_table(struct sk_buff *skb,
				  unsigned int hook,
				  const struct nf_hook_state *state,
				  struct xt_table *table);

+1 −1
Original line number Diff line number Diff line
@@ -247,10 +247,10 @@ struct arpt_entry *arpt_next_entry(const struct arpt_entry *entry)
}

unsigned int arpt_do_table(struct sk_buff *skb,
			   unsigned int hook,
			   const struct nf_hook_state *state,
			   struct xt_table *table)
{
	unsigned int hook = state->hook;
	static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long))));
	unsigned int verdict = NF_DROP;
	const struct arphdr *arp;
+1 −2
Original line number Diff line number Diff line
@@ -30,8 +30,7 @@ static unsigned int
arptable_filter_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
		     const struct nf_hook_state *state)
{
	return arpt_do_table(skb, ops->hooknum, state,
			     state->net->ipv4.arptable_filter);
	return arpt_do_table(skb, state, state->net->ipv4.arptable_filter);
}

static struct nf_hook_ops *arpfilter_ops __read_mostly;
Loading