netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>,
	netfilter-devel@vger.kernel.org, hannes@stressinduktion.org
Subject: Re: [PATCH nf-next 2/3] netfilter: conntrack: use get_random_once for nat and expectations
Date: Sun, 24 Apr 2016 17:16:20 +0200	[thread overview]
Message-ID: <20160424151620.GA27317@breakpoint.cc> (raw)
In-Reply-To: <20160424140915.GA1141@salvia>

Pablo Neira Ayuso <pablo@netfilter.org> wrote:

[ CC Hannes ]

> On Mon, Apr 18, 2016 at 04:17:00PM +0200, Florian Westphal wrote:
> > Use a private seed and init it using get_random_once.
> > 
> > Signed-off-by: Florian Westphal <fw@strlen.de>
> > ---
> >  net/netfilter/nf_conntrack_expect.c | 7 +++----
> >  net/netfilter/nf_nat_core.c         | 6 ++++--
> >  2 files changed, 7 insertions(+), 6 deletions(-)
> > 
> > diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
> > index 278927a..c2f7c4f 100644
> > --- a/net/netfilter/nf_conntrack_expect.c
> > +++ b/net/netfilter/nf_conntrack_expect.c
> > @@ -38,6 +38,7 @@ EXPORT_SYMBOL_GPL(nf_ct_expect_hsize);
> >  unsigned int nf_ct_expect_max __read_mostly;
> >  
> >  static struct kmem_cache *nf_ct_expect_cachep __read_mostly;
> > +static unsigned int nf_ct_expect_hashrnd __read_mostly;
> >  
> >  /* nf_conntrack_expect helper functions */
> >  void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp,
> > @@ -76,13 +77,11 @@ static unsigned int nf_ct_expect_dst_hash(const struct nf_conntrack_tuple *tuple
> >  {
> >  	unsigned int hash;
> >  
> > -	if (unlikely(!nf_conntrack_hash_rnd)) {
> > -		init_nf_conntrack_hash_rnd();
> > -	}
> > +	get_random_once(&nf_ct_expect_hashrnd, sizeof(nf_ct_expect_hashrnd));
> 
> Not related to your patch, but to the underlying infrastructure: I can
> see get_random_once() implementation uses static_key_true() branch
> check.
> 
> Shouldn't this be static_key_false() instead? On architectures with
> not jump_labels support, this will translate to unlikely().

Yes, looks like it.  Hannes?

> If so, I can send a patch for this. I can see this DO_ONCE() API is
> also using the deprecated interfaces.

I think it just predates the new api.

  reply	other threads:[~2016-04-24 15:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 14:16 [PATCH nf-next 0/3] netfilter: conntrack: prepare for hashtable merge, take 1 Florian Westphal
2016-04-18 14:16 ` [PATCH nf-next 1/3] netfilter: conntrack: move generation seqcnt out of netns_ct Florian Westphal
2016-04-18 14:17 ` [PATCH nf-next 2/3] netfilter: conntrack: use get_random_once for nat and expectations Florian Westphal
2016-04-24 14:09   ` Pablo Neira Ayuso
2016-04-24 15:16     ` Florian Westphal [this message]
2016-04-24 17:50       ` Hannes Frederic Sowa
2016-04-24 18:59         ` Hannes Frederic Sowa
2016-04-18 14:17 ` [PATCH nf-next 3/3] netfilter: conntrack: use get_random_once for conntrack hash seed Florian Westphal
2016-04-25 12:26 ` [PATCH nf-next 0/3] netfilter: conntrack: prepare for hashtable merge, take 1 Pablo Neira Ayuso

Reply instructions:

You may reply publicly 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=20160424151620.GA27317@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=hannes@stressinduktion.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).