Re: [PATCH v2 nf-next] netfilter: add and use nf_hook_slow_list()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Edward Cree <ecree@xxxxxxxxxxxxxx> wrote:
> On 10/10/2019 23:30, Florian Westphal wrote:
> > NF_HOOK_LIST now only works for ipv4 and ipv6, as those are the only
> > callers.
> ...
> > +
> > +     rcu_read_lock();
> > +     switch (pf) {
> > +     case NFPROTO_IPV4:
> > +             hook_head = rcu_dereference(net->nf.hooks_ipv4[hook]);
> > +             break;
> > +     case NFPROTO_IPV6:
> > +             hook_head = rcu_dereference(net->nf.hooks_ipv6[hook]);
> > +             break;
> > +     default:
> > +             WARN_ON_ONCE(1);
> > +             break;
> >       }
> Would it not make sense instead to abstract out the switch in nf_hook()
>  into, say, an inline function that could be called from here?  That
>  would satisfy SPOT and also save updating this code if new callers of
>  NF_HOOK_LIST are added in the future.

Its a matter of taste I guess.  I don't really like having all these
inline wrappers for wrappers wrapped in wrappers.

Pablo, its up to you.  I could add __nf_hook_get_hook_head() or similar
and use that instead of open-coding.



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux