[TCP/DCCP]: Randomize port selection

This patch randomizes the port selected on bind() for connections
to help with possible security attacks. It should also be faster
in most cases because there is no need for a global lock.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
Stephen Hemminger
2005-11-03 16:33:23 -08:00
committed by Arnaldo Carvalho de Melo
parent 6151b31c96
commit 6df716340d
6 changed files with 10 additions and 56 deletions

View File

@@ -125,9 +125,7 @@ struct inet_hashinfo {
rwlock_t lhash_lock ____cacheline_aligned;
atomic_t lhash_users;
wait_queue_head_t lhash_wait;
spinlock_t portalloc_lock;
kmem_cache_t *bind_bucket_cachep;
int port_rover;
};
static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,