Netfilter-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Edward Cree <ecree@solarflare.com>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH v2 nf-next] netfilter: add and use nf_hook_slow_list()
Date: Fri, 11 Oct 2019 00:54:33 +0200
Message-ID: <20191010225433.GK25052@breakpoint.cc> (raw)
In-Reply-To: <2d9864c9-95d2-02c2-b256-85a07c2b2232@solarflare.com>

Edward Cree <ecree@solarflare.com> 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.

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 22:30 Florian Westphal
2019-10-10 22:41 ` Edward Cree
2019-10-10 22:54   ` Florian Westphal [this message]
2019-10-14 11:02     ` Pablo Neira Ayuso
2019-10-14 13:56       ` Edward Cree

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191010225433.GK25052@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=ecree@solarflare.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Netfilter-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netfilter-devel/0 netfilter-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netfilter-devel netfilter-devel/ https://lore.kernel.org/netfilter-devel \
		netfilter-devel@vger.kernel.org netfilter-devel@archiver.kernel.org
	public-inbox-index netfilter-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netfilter-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox