On Thu, Oct 27, 2016 at 02:27:51PM -0400, Aaron Conole wrote:
> This allows easier future refactoring.
> 
> Signed-off-by: Aaron Conole <[email protected]>
> ---
>  include/linux/netfilter.h       | 35 ++++++++++++++++++++++++++++++++++-
>  net/bridge/br_netfilter_hooks.c |  2 +-
>  net/netfilter/core.c            |  8 +++-----
>  net/netfilter/nf_queue.c        |  8 ++++----
>  4 files changed, 42 insertions(+), 11 deletions(-)
> 
> diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
> index d0beb607..b25386b 100644
> --- a/include/linux/netfilter.h
> +++ b/include/linux/netfilter.h
> @@ -80,6 +80,38 @@ struct nf_hook_entry {
>       const struct nf_hook_ops        *orig_ops;
>  };
>  
> +static inline void
> +nf_hook_entry_init(struct nf_hook_entry *entry,      const struct 
> nf_hook_ops *ops)
> +{
> +     entry->next = NULL;
> +     entry->ops = *ops;
> +     entry->orig_ops = ops;
> +}
> +
> +static inline int
> +nf_hook_entry_priority(const struct nf_hook_entry *entry)
> +{
> +     return entry->ops.priority;
> +}
> +
> +static inline nf_hookfn *
> +nf_hook_entry_hookfn(const struct nf_hook_entry *entry)
> +{
> +     return entry->ops.hook;
> +}

I'd suggest something like:

static inline int
nf_entry_hookfn(const struct nf_hook_entry *entry,
                struct sk_buff *skb, struct nf_hook_state *state)
{
        return entry->ops.hook(entry, nf_hook_entry_priv(entry), skb, state);
}

So you can avoid this:

                verdict = nf_hook_entry_hookfn(*entryp)
                        (nf_hook_entry_priv(*entryp), skb, state);
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to