summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Skorichenko <askorichenko@netgate.com>2021-07-02 13:10:52 -0400
committerMatthew Smith <mgsmith@netgate.com>2021-08-12 16:26:03 +0000
commitc06d660aba34fc9c309af3204fe2cf2fa6619134 (patch)
tree3016c5b02d7160c94edd04b06a96b860184d4904
parente191d76d248ebbb022533d518b447b7df4efd371 (diff)
nat: correct pool ops when disable nat44 plugin
Type: fix Replace vec ops with pool ops when iterating over pool of interfaces in plugin_disable() functions. With this change plugin disabling function and interface role disabling functions iterate over identical sets of registered interfaces, preventing 'interface couldn't be found' errors. Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com> Change-Id: I4e191bcc5322ff1f9f7730c6fda5e6af86a8eec9
-rw-r--r--src/plugins/nat/nat44-ei/nat44_ei.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/nat/nat44-ei/nat44_ei.c b/src/plugins/nat/nat44-ei/nat44_ei.c
index 3c9a9a85346..2dbef8e34df 100644
--- a/src/plugins/nat/nat44-ei/nat44_ei.c
+++ b/src/plugins/nat/nat44-ei/nat44_ei.c
@@ -920,12 +920,12 @@ int
nat44_ei_plugin_disable ()
{
nat44_ei_main_t *nm = &nat44_ei_main;
- nat44_ei_interface_t *i, *vec;
+ nat44_ei_interface_t *i, *pool;
int error = 0;
// first unregister all nodes from interfaces
- vec = vec_dup (nm->interfaces);
- vec_foreach (i, vec)
+ pool = pool_dup (nm->interfaces);
+ pool_foreach (i, pool)
{
if (nat44_ei_interface_is_inside (i))
error = nat44_ei_interface_add_del (i->sw_if_index, 1, 1);
@@ -938,11 +938,11 @@ nat44_ei_plugin_disable ()
i->sw_if_index);
}
}
- vec_free (vec);
- nm->interfaces = 0;
+ pool_free (pool);
+ pool_free (nm->interfaces);
- vec = vec_dup (nm->output_feature_interfaces);
- vec_foreach (i, vec)
+ pool = pool_dup (nm->output_feature_interfaces);
+ pool_foreach (i, pool)
{
if (nat44_ei_interface_is_inside (i))
error =
@@ -957,8 +957,8 @@ nat44_ei_plugin_disable ()
i->sw_if_index);
}
}
- vec_free (vec);
- nm->output_feature_interfaces = 0;
+ pool_free (pool);
+ pool_free (nm->output_feature_interfaces);
nat_ha_disable ();
nat44_ei_db_free ();
@@ -976,7 +976,7 @@ nat44_ei_plugin_disable ()
nm->enabled = 0;
clib_memset (&nm->rconfig, 0, sizeof (nm->rconfig));
- return error;
+ return 0;
}
int