Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org,
	kaber@trash.net
Subject: Re: [PATCH] ipv4: remove ip_rt_secret timer (v2)
Date: Thu, 06 May 2010 23:08:05 +0200	[thread overview]
Message-ID: <1273180085.2222.33.camel@edumazet-laptop> (raw)
In-Reply-To: <20100506202957.GE5063@hmsreliant.think-freely.org>

Le jeudi 06 mai 2010 à 16:29 -0400, Neil Horman a écrit :
> Version 2 of this patch, taking Erics comment about making the rt_genid non-zero
> when a netns is created.  This makes sense, and helps prevent attackers from
> guessing our initial secret value
> 
> 
> 
> A while back there was a discussion regarding the rt_secret_interval timer.
> Given that we've had the ability to do emergency route cache rebuilds for awhile
> now, based on a statistical analysis of the various hash chain lengths in the
> cache, the use of the flush timer is somewhat redundant.  This patch removes the
> rt_secret_interval sysctl, allowing us to rely solely on the statistical
> analysis mechanism to determine the need for route cache flushes.
> 
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> 

> -
> -static __net_init int rt_secret_timer_init(struct net *net)
> +static __net_init int rt_genid_init(struct net *net)
>  {
> -	atomic_set(&net->ipv4.rt_genid,
> -			(int) ((num_physpages ^ (num_physpages>>8)) ^
> -			(jiffies ^ (jiffies >> 7))));
> -


> +	/*
> +	 * This just serves to start off each new net namespace
> +	 * with a non-zero rt_genid value, making it harder to guess
> +	 */
> +	rt_cache_invalidate(net);
>  	return 0;
>  }
>  

I am _sorry_ to be such a paranoiac guy.

Could you please feed more than 8 bits here ?

like :

get_random_bytes(&net->ipv4.rt_genid, sizeof(net->ipv4.rt_genid));

There is no need to comment this in the code, this kind of rnd init is
very common in net tree.






  reply	other threads:[~2010-05-06 21:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-06 17:16 [PATCH] ipv4: remove ip_rt_secret timer Neil Horman
2010-05-06 17:32 ` Eric Dumazet
2010-05-06 18:02   ` Neil Horman
2010-05-06 18:33     ` Eric Dumazet
2010-05-06 19:54       ` Neil Horman
2010-05-06 20:10         ` Eric Dumazet
2010-05-06 20:25           ` Neil Horman
2010-05-06 20:29 ` [PATCH] ipv4: remove ip_rt_secret timer (v2) Neil Horman
2010-05-06 21:08   ` Eric Dumazet [this message]
2010-05-07  0:02     ` nhorman
2010-05-07 19:55 ` [PATCH] ipv4: remove ip_rt_secret timer (v3) Neil Horman
2010-05-07 21:04   ` Eric Dumazet
2010-05-07 23:15     ` Neil Horman
2010-05-08  1:01 ` [PATCH] ipv4: remove ip_rt_secret timer (v4) Neil Horman
2010-05-08  6:36   ` Eric Dumazet
2010-05-08  8:58     ` David Miller
2010-05-08 12:54     ` Neil Horman

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=1273180085.2222.33.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=yoshfuji@linux-ipv6.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