gtp: initial random seed for the hash tables

I think it's very hard to deploy any hashbomb attack since the
entries are created via netlink, but let's just avoid that someone
generates traffic to spend cycles on a busy hashtable chain.
This commit is contained in:
Pablo Neira Ayuso 2014-02-10 18:23:43 +01:00
parent bb8c47d957
commit 268455a2ae
1 changed files with 2 additions and 3 deletions

5
gtp.c
View File

@ -27,9 +27,6 @@
#include "gtp.h"
#include "gtp_nl.h"
/* implementation-specific definitions */
/* FIXME: initialize this !! */
static uint32_t gtp_h_initval;
struct gsn {
@ -1196,6 +1193,8 @@ static int __init gtp_init(void)
{
int err;
get_random_bytes(&gtp_h_initval, sizeof(gtp_h_initval));
err = genl_register_family_with_ops(&gtp_genl_family, gtp_genl_ops);
if (err < 0)
return err;