From 41ae1e20e6cc768e5562ad89d1f35c63d471b9b9 Mon Sep 17 00:00:00 2001 From: Steven Luong <sluong@cisco.com> Date: Thu, 14 Nov 2024 14:28:34 -0800 Subject: [PATCH] session: clean up session table when re-adding an existing application namespace The app ns semantics allows the same app ns to be re-added with different interface. For example, app ns add id blue secret 1 if tap0 app ns add id blue secret 1 if tap1 If tap0 is bound to table 0 and tap1 is bound to tap1, we need to clean up the existing session table and possibly allocate a new session table for the app ns. Type: fix Change-Id: I566d621081b7cdbd7d0c481fda53953b39c26001 Signed-off-by: Steven Luong <sluong@cisco.com> --- src/vnet/session/application_namespace.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/vnet/session/application_namespace.c b/src/vnet/session/application_namespace.c index f5b70a9c4cf..5930c34dce5 100644 --- a/src/vnet/session/application_namespace.c +++ b/src/vnet/session/application_namespace.c @@ -152,6 +152,19 @@ vnet_app_namespace_add_del (vnet_app_namespace_add_del_args_t *a) return rv; } } + else + { + /* + * Not creating a new app_ns. We are just changing the binding of an + * existing app_ns to different fib tables. Clean up the old session + * table that was bound to these fib indices. + */ + ns_index = app_namespace_index (app_ns); + session_lookup_table_cleanup (FIB_PROTOCOL_IP4, + app_ns->ip4_fib_index, ns_index); + session_lookup_table_cleanup (FIB_PROTOCOL_IP6, + app_ns->ip6_fib_index, ns_index); + } app_ns->ns_secret = a->secret; app_ns->sw_if_index = a->sw_if_index;