summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-10-20 14:07:55 +0200
committerMatthew Smith <mgsmith@netgate.com>2020-11-02 13:56:16 +0000
commit421e049bb998963b1c0e5d34b76f731db8c257ea (patch)
tree7d95a0958753ceff3dde0891d13e1de18201d578 /src/plugins/nat
parentb8bc2f1ef3332a795880f11f1c45a77b1b7851f6 (diff)
nat: fix nat64 disable
- we should not copy and iterate over the pool underlying vector, as slots can be freed (ie in the freelist). - delete interface instead of adding them again - fix the log message Type: fix Change-Id: If0a7a2f475b4f40793eb29ea80a9d29fe5d1bcb9 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/nat')
-rw-r--r--src/plugins/nat/nat64/nat64.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/nat/nat64/nat64.c b/src/plugins/nat/nat64/nat64.c
index 30142a70048..240f3ef0fba 100644
--- a/src/plugins/nat/nat64/nat64.c
+++ b/src/plugins/nat/nat64/nat64.c
@@ -1557,7 +1557,7 @@ nat64_plugin_disable ()
int rv = 0;
nat64_address_t *a;
- nat64_interface_t *i, *interfaces;
+ nat64_interface_t *i, *interfaces = 0;
if (plugin_enabled () == 0)
{
@@ -1566,16 +1566,21 @@ nat64_plugin_disable ()
}
nm->enabled = 0;
- interfaces = vec_dup (nm->interfaces);
+ /* *INDENT-OFF* */
+ pool_foreach (i, nm->interfaces,
+ ({
+ vec_add1 (interfaces, *i);
+ }));
+ /* *INDENT-ON* */
vec_foreach (i, interfaces)
{
- rv = nat64_interface_add_del (i->sw_if_index, i->flags, 1);
+ rv = nat64_interface_add_del (i->sw_if_index, i->flags, 0);
if (rv)
{
nat64_log_err ("%U %s interface del failed",
- unformat_vnet_sw_interface,
+ format_vnet_sw_if_index_name, vnm, i->sw_if_index,
i->flags & NAT64_INTERFACE_FLAG_IS_INSIDE ?
- "inside" : "outside", vnm, i->sw_if_index);
+ "inside" : "outside");
}
}
vec_free (interfaces);