session: improve enable and disable handling
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I3c79d16f6a19767d990e8a4683c296219b559ccd
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 9c1121f..8deeb9e 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -590,6 +590,9 @@
{
udp_main_t *um = &udp_main;
+ if (!is_en || um->is_init)
+ return 0;
+
/* Not ideal. The sparse vector used to map ports to next nodes assumes
* only a few ports are ever used. When udp transport is enabled this does
* not hold and, to make matters worse, ports are consumed in a random
@@ -610,6 +613,7 @@
vec_validate (um->transport_ports_refcnt[0], 65535);
vec_validate (um->transport_ports_refcnt[1], 65535);
+ um->is_init = 1;
return 0;
}