Add full VNET support to the inet_get_local_port_range() function in

the LinuxKPI.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2017-03-22 15:46:31 +00:00
parent 303bd80ad5
commit 82d0140707
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=315714
2 changed files with 4 additions and 3 deletions

View File

@ -43,10 +43,11 @@
#include <netinet/in.h>
#include <netinet/in_pcb.h>
static inline void inet_get_local_port_range(int *low, int *high)
static inline void
inet_get_local_port_range(struct vnet *vnet, int *low, int *high)
{
#ifdef INET
CURVNET_SET_QUIET(TD_TO_VNET(curthread));
CURVNET_SET_QUIET(vnet);
*low = V_ipport_firstauto;
*high = V_ipport_lastauto;
CURVNET_RESTORE();

View File

@ -2503,7 +2503,7 @@ static int cma_alloc_any_port(struct idr *ps, struct rdma_id_private *id_priv)
int low, high, remaining;
unsigned int rover;
inet_get_local_port_range(&low, &high);
inet_get_local_port_range(&init_net, &low, &high);
remaining = (high - low) + 1;
rover = random() % remaining + low;
retry: