Skip to contentSkip to conversation

periodically rehash table, why?

NETLINK Holger Eitzenberger 2 participants 2 messages Mar 14, 2007 – Mar 15, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

in nl_pid_hash_dilute() there is:

   if (unlikely(avg > 1) && nl_pid_hash_rehash(hash, 1))
      return 1;
      if (unlikely(len > avg) && time_after(jiffies, hash->rehash_time)) {
         nl_pid_hash_rehash(hash, 0);
         return 1;
      }

I don't see a reason why periodically rehashing might help in any way (without resizing). Is there a reason for that?

Thanks. /holger

#1 lore raw
Quoted 6 lines · Holger Eitzenberger

in nl_pid_hash_dilute() there is:

  if (unlikely(avg > 1) && nl_pid_hash_rehash(hash, 1))
     return 1;
Quoted 7 lines
     if (unlikely(len > avg) && time_after(jiffies, hash->rehash_time)) {
        nl_pid_hash_rehash(hash, 0);
        return 1;
     }

I don't see a reason why periodically rehashing might help in any way (without resizing). Is there a reason for that?

It's to prevent attackers from guessing the hash secret and causing hash chains to grow excessively.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt