diff --git a/src/nf_nat_fullcone.c b/src/nf_nat_fullcone.c index 0757ef9..0b13cbe 100644 --- a/src/nf_nat_fullcone.c +++ b/src/nf_nat_fullcone.c @@ -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)