#include <vnet/plugin/plugin.h>
#include <vpp/app/version.h>
+#include <nat/lib/ipfix_logging.h>
#include <nat/nat64/nat64.h>
nat64_main_t nat64_main;
bitmap = clib_bitmap_set (bitmap, i, 1);
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, bitmap,
- ({
+ clib_bitmap_foreach (i, bitmap)
+ {
vec_add1(nm->workers, i);
- }));
+ }
/* *INDENT-ON* */
clib_bitmap_free (bitmap);
nm->port_per_thread = (0xffff - 1024) / _vec_len (nm->workers);
}
- // TODO: ipfix needs to be separated from NAT base plugin
/* Init IPFIX logging */
- //snat_ipfix_logging_init (vm);
+ nat_ipfix_logging_init (vm);
#define _(x) \
nm->counters.in2out.x.name = #x; \
/* Add/del external address to FIB */
/* *INDENT-OFF* */
- pool_foreach (interface, nm->interfaces,
- ({
+ pool_foreach (interface, nm->interfaces)
+ {
if (nat64_interface_is_inside(interface))
continue;
nat64_add_del_addr_to_fib (addr, 32, interface->sw_if_index, is_add);
break;
- }));
+ }
/* *INDENT-ON* */
return 0;
/* Check if interface already exists */
/* *INDENT-OFF* */
- pool_foreach (i, nm->interfaces,
- ({
+ pool_foreach (i, nm->interfaces)
+ {
if (i->sw_if_index == sw_if_index)
{
interface = i;
break;
}
- }));
+ }
/* *INDENT-ON* */
if (is_add)
nat64_interface_t *i = 0;
/* *INDENT-OFF* */
- pool_foreach (i, nm->interfaces,
- ({
+ pool_foreach (i, nm->interfaces)
+ {
if (fn (i, ctx))
break;
- }));
+ }
/* *INDENT-ON* */
}
}
/* Totally out of translations to use... */
- //snat_ipfix_logging_addresses_exhausted (thread_index, 0);
+ nat_ipfix_logging_addresses_exhausted (thread_index, 0);
return 1;
}
ip46_address_t addr;
/* *INDENT-OFF* */
- pool_foreach (static_bib, nm->static_bibs,
- ({
+ pool_foreach (static_bib, nm->static_bibs)
+ {
if ((static_bib->thread_index != thread_index) || (static_bib->done))
continue;
}
static_bib->done = 1;
- }));
+ }
/* *INDENT-ON* */
return 0;
if (nm->num_workers)
{
/* *INDENT-OFF* */
- pool_foreach (static_bib, nm->static_bibs,
- ({
+ pool_foreach (static_bib, nm->static_bibs)
+ {
if (static_bib->done)
vec_add1 (to_be_free, static_bib - nm->static_bibs);
- }));
+ }
vec_foreach (index, to_be_free)
pool_put_index (nm->static_bibs, index[0]);
/* *INDENT-ON* */
int rv = 0;
nat64_address_t *a;
- nat64_interface_t *i, *interfaces;
+ nat64_interface_t *i, *interfaces = 0;
if (plugin_enabled () == 0)
{
}
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);