diff options
author | 2024-07-02 04:34:54 -0700 | |
---|---|---|
committer | 2024-07-08 16:27:06 +0000 | |
commit | 75e8e1e948da182dbf4f6b3394f1b7fc44c1403a (patch) | |
tree | f35ad5134743fda3ac732bb5f7d3945e5005ac28 /src/vnet/udp | |
parent | 6df9f442277603d3ebd3bcf950f7dd0d28fb42f5 (diff) |
session: improve enable and disable handling
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I3c79d16f6a19767d990e8a4683c296219b559ccd
Diffstat (limited to 'src/vnet/udp')
-rw-r--r-- | src/vnet/udp/udp.c | 4 | ||||
-rw-r--r-- | src/vnet/udp/udp.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c index 9c1121f7cfb..8deeb9e41ee 100644 --- a/src/vnet/udp/udp.c +++ b/src/vnet/udp/udp.c @@ -590,6 +590,9 @@ udp_enable_disable (vlib_main_t *vm, u8 is_en) { 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 @@ udp_enable_disable (vlib_main_t *vm, u8 is_en) vec_validate (um->transport_ports_refcnt[0], 65535); vec_validate (um->transport_ports_refcnt[1], 65535); + um->is_init = 1; return 0; } diff --git a/src/vnet/udp/udp.h b/src/vnet/udp/udp.h index 8e4e87f85a8..c6f867500e0 100644 --- a/src/vnet/udp/udp.h +++ b/src/vnet/udp/udp.h @@ -154,6 +154,7 @@ typedef struct u16 default_mtu; u16 msg_id_base; u8 csum_offload; + u8 is_init; u8 icmp_send_unreachable_disabled; } udp_main_t; |