nf_nat_fullcone.c: fix missing prandom_u32() with Linux >= 6.1.0
prandom_u32() previously was only calling get_random_u32() so it's been dropped with Linux 6.1.0. So let's directly call get_random_u32() if Linux version >= 6.1.0. Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
This commit is contained in:
parent
0d3e2bedf9
commit
95ad79bc6d
@ -854,7 +854,11 @@ static uint16_t find_appropriate_port6(struct net *net, const u16 zone,
|
||||
/* for now we do the same thing for both --random and --random-fully */
|
||||
|
||||
/* select a random starting point */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
|
||||
start = (uint16_t) (get_random_u32() % (u32) range_size);
|
||||
#else
|
||||
start = (uint16_t) (prandom_u32() % (u32) range_size);
|
||||
#endif
|
||||
} else {
|
||||
|
||||
if ((original_port >= min && original_port <= min + range_size - 1)
|
||||
@ -927,7 +931,11 @@ static uint16_t find_appropriate_port(struct net *net, const u16 zone,
|
||||
/* for now we do the same thing for both --random and --random-fully */
|
||||
|
||||
/* select a random starting point */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
|
||||
start = (uint16_t) (get_random_u32() % (u32) range_size);
|
||||
#else
|
||||
start = (uint16_t) (prandom_u32() % (u32) range_size);
|
||||
#endif
|
||||
} else {
|
||||
|
||||
if ((original_port >= min && original_port <= min + range_size - 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user