/* Add external address to FIB */
/* *INDENT-OFF* */
- pool_foreach (i, sm->interfaces,
- ({
+ pool_foreach (i, sm->interfaces)
+ {
if (nat_interface_is_inside(i) || sm->out2in_dpo)
continue;
snat_add_del_addr_to_fib(addr, 32, i->sw_if_index, 1);
break;
- }));
- pool_foreach (i, sm->output_feature_interfaces,
- ({
+ }
+ pool_foreach (i, sm->output_feature_interfaces)
+ {
if (nat_interface_is_inside(i) || sm->out2in_dpo)
continue;
snat_add_del_addr_to_fib(addr, 32, i->sw_if_index, 1);
break;
- }));
+ }
/* *INDENT-ON* */
return 0;
{
snat_static_mapping_t *m;
/* *INDENT-OFF* */
- pool_foreach (m, sm->static_mappings,
- ({
+ pool_foreach (m, sm->static_mappings)
+ {
if (is_addr_only_static_mapping (m) ||
is_out2in_only_static_mapping (m) ||
is_identity_static_mapping (m))
continue;
if (m->external_addr.as_u32 == addr.as_u32)
return 1;
- }));
+ }
/* *INDENT-ON* */
return 0;
snat_session_t *s;
u32 *indexes_to_free = NULL;
/* *INDENT-OFF* */
- pool_foreach (s, tsm->sessions, {
+ pool_foreach (s, tsm->sessions) {
if (s->in2out.fib_index != fib_index ||
s->in2out.addr.as_u32 != l_addr.as_u32)
{
vec_add1 (indexes_to_free, s - tsm->sessions);
if (!addr_only)
break;
- });
+ }
/* *INDENT-ON* */
u32 *ses_index;
vec_foreach (ses_index, indexes_to_free)
if (is_identity_static_mapping (m))
{
/* *INDENT-OFF* */
- pool_foreach (local, m->locals,
- ({
+ pool_foreach (local, m->locals)
+ {
if (local->vrf_id == vrf_id)
return VNET_API_ERROR_VALUE_EXIST;
- }));
+ }
/* *INDENT-ON* */
pool_get (m->locals, local);
local->vrf_id = vrf_id;
vrf_id = sm->inside_vrf_id;
/* *INDENT-OFF* */
- pool_foreach (local, m->locals,
- ({
+ pool_foreach (local, m->locals)
+ {
if (local->vrf_id == vrf_id)
find = local - m->locals;
- }));
+ }
/* *INDENT-ON* */
if (find == ~0)
return VNET_API_ERROR_NO_SUCH_ENTRY;
/* Add/delete external address to FIB */
/* *INDENT-OFF* */
- pool_foreach (interface, sm->interfaces,
- ({
+ pool_foreach (interface, sm->interfaces)
+ {
if (nat_interface_is_inside(interface) || sm->out2in_dpo)
continue;
snat_add_del_addr_to_fib(&e_addr, 32, interface->sw_if_index, is_add);
break;
- }));
- pool_foreach (interface, sm->output_feature_interfaces,
- ({
+ }
+ pool_foreach (interface, sm->output_feature_interfaces)
+ {
if (nat_interface_is_inside(interface) || sm->out2in_dpo)
continue;
snat_add_del_addr_to_fib(&e_addr, 32, interface->sw_if_index, is_add);
break;
- }));
+ }
/* *INDENT-ON* */
return 0;
if (sm->num_workers > 1)
{
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, bitmap,
- ({
+ clib_bitmap_foreach (i, bitmap)
+ {
vec_add1(m->workers, i);
- }));
+ }
/* *INDENT-ON* */
}
}
}
/* *INDENT-OFF* */
- pool_foreach (local, m->locals,
- ({
+ pool_foreach (local, m->locals)
+ {
fib_table_unlock (local->fib_index, FIB_PROTOCOL_IP4,
sm->fib_src_low);
if (!out2in_only)
tsm = vec_elt_at_index (sm->per_thread_data, sm->num_workers);
/* Delete sessions */
- pool_foreach (s, tsm->sessions, {
+ pool_foreach (s, tsm->sessions) {
if (!(is_lb_session (s)))
continue;
nat_free_session_data (sm, s, tsm - sm->per_thread_data, 0);
nat_ed_session_delete (sm, s, tsm - sm->per_thread_data, 1);
- });
- }));
+ }
+ }
/* *INDENT-ON* */
if (m->affinity)
nat_affinity_flush_service (m->affinity_per_service_list_head_index);
return VNET_API_ERROR_INVALID_VALUE;
/* *INDENT-OFF* */
- pool_foreach (local, m->locals,
- ({
+ pool_foreach (local, m->locals)
+ {
if ((local->addr.as_u32 == l_addr.as_u32) && (local->port == l_port) &&
(local->vrf_id == vrf_id))
{
match_local = local;
break;
}
- }));
+ }
/* *INDENT-ON* */
if (is_add)
/* Delete sessions */
/* *INDENT-OFF* */
- pool_foreach (s, tsm->sessions, {
+ pool_foreach (s, tsm->sessions) {
if (!(is_lb_session (s)))
continue;
nat_free_session_data (sm, s, tsm - sm->per_thread_data, 0);
nat_ed_session_delete (sm, s, tsm - sm->per_thread_data, 1);
- });
+ }
/* *INDENT-ON* */
pool_put (m->locals, match_local);
vec_free (m->workers);
/* *INDENT-OFF* */
- pool_foreach (local, m->locals,
- ({
+ pool_foreach (local, m->locals)
+ {
vec_add1 (locals, local - m->locals);
if (sm->num_workers > 1)
{
sm->worker_in2out_cb (&ip, local->fib_index, 0),
1);
}
- }));
+ }
/* *INDENT-ON* */
ASSERT (vec_len (locals) > 1);
if (sm->num_workers > 1)
{
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, bitmap, ({ vec_add1(m->workers, i); }));
+ clib_bitmap_foreach (i, bitmap) { vec_add1(m->workers, i); }
/* *INDENT-ON* */
}
{
ip4_address_t pool_addr = { 0 };
/* *INDENT-OFF* */
- pool_foreach (m, sm->static_mappings,
- ({
+ pool_foreach (m, sm->static_mappings)
+ {
if (m->external_addr.as_u32 == addr.as_u32)
(void) snat_add_static_mapping (m->local_addr, m->external_addr,
m->local_port, m->external_port,
m->tag,
is_identity_static_mapping(m),
pool_addr, 0);
- }));
+ }
/* *INDENT-ON* */
}
else
vec_foreach (tsm, sm->per_thread_data)
{
/* *INDENT-OFF* */
- pool_foreach (ses, tsm->sessions, ({
+ pool_foreach (ses, tsm->sessions) {
if (ses->out2in.addr.as_u32 == addr.as_u32)
{
nat_free_session_data (sm, ses, tsm - sm->per_thread_data, 0);
vec_add1 (ses_to_be_removed, ses - tsm->sessions);
}
- }));
+ }
/* *INDENT-ON* */
if (sm->endpoint_dependent)
/* Delete external address from FIB */
/* *INDENT-OFF* */
- pool_foreach (interface, sm->interfaces,
- ({
+ pool_foreach (interface, sm->interfaces)
+ {
if (nat_interface_is_inside(interface) || sm->out2in_dpo)
continue;
snat_add_del_addr_to_fib(&addr, 32, interface->sw_if_index, 0);
break;
- }));
- pool_foreach (interface, sm->output_feature_interfaces,
- ({
+ }
+ pool_foreach (interface, sm->output_feature_interfaces)
+ {
if (nat_interface_is_inside(interface) || sm->out2in_dpo)
continue;
snat_add_del_addr_to_fib(&addr, 32, interface->sw_if_index, 0);
break;
- }));
+ }
/* *INDENT-ON* */
return 0;
}
/* *INDENT-OFF* */
- pool_foreach (i, sm->output_feature_interfaces,
- ({
+ pool_foreach (i, sm->output_feature_interfaces)
+ {
if (i->sw_if_index == sw_if_index)
{
nat_log_err ("error interface already configured");
return VNET_API_ERROR_VALUE_EXIST;
}
- }));
+ }
/* *INDENT-ON* */
if (sm->static_mapping_only && !(sm->static_mapping_connection_tracking))
feature_set:
/* *INDENT-OFF* */
- pool_foreach (i, sm->interfaces,
- ({
+ pool_foreach (i, sm->interfaces)
+ {
if (i->sw_if_index == sw_if_index)
{
if (is_del)
goto fib;
}
- }));
+ }
/* *INDENT-ON* */
if (is_del)
vec_foreach (ap, sm->addresses)
snat_add_del_addr_to_fib(&ap->addr, 32, sw_if_index, !is_del);
- pool_foreach (m, sm->static_mappings,
- ({
+ pool_foreach (m, sm->static_mappings)
+ {
if (!(is_addr_only_static_mapping(m)) || (m->local_addr.as_u32 == m->external_addr.as_u32))
continue;
snat_add_del_addr_to_fib(&m->external_addr, 32, sw_if_index, !is_del);
- }));
+ }
/* *INDENT-ON* */
return 0;
}
/* *INDENT-OFF* */
- pool_foreach (i, sm->interfaces,
- ({
+ pool_foreach (i, sm->interfaces)
+ {
if (i->sw_if_index == sw_if_index)
{
nat_log_err ("error interface already configured");
return VNET_API_ERROR_VALUE_EXIST;
}
- }));
+ }
/* *INDENT-ON* */
if (sm->endpoint_dependent)
vlib_frame_queue_main_init (sm->out2in_node_index, 0);
/* *INDENT-OFF* */
- pool_foreach (i, sm->output_feature_interfaces,
- ({
+ pool_foreach (i, sm->output_feature_interfaces)
+ {
if (i->sw_if_index == sw_if_index)
{
if (is_del)
goto fib;
}
- }));
+ }
/* *INDENT-ON* */
if (is_del)
vec_foreach (ap, sm->addresses)
snat_add_del_addr_to_fib(&ap->addr, 32, sw_if_index, !is_del);
- pool_foreach (m, sm->static_mappings,
- ({
+ pool_foreach (m, sm->static_mappings)
+ {
if (!((is_addr_only_static_mapping(m))) || (m->local_addr.as_u32 == m->external_addr.as_u32))
continue;
snat_add_del_addr_to_fib(&m->external_addr, 32, sw_if_index, !is_del);
- }));
+ }
/* *INDENT-ON* */
return 0;
vec_free (sm->workers);
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, bitmap,
- ({
+ clib_bitmap_foreach (i, bitmap)
+ {
vec_add1(sm->workers, i);
sm->per_thread_data[sm->first_worker_index + i].snat_thread_index = j;
sm->per_thread_data[sm->first_worker_index + i].thread_index = i;
j++;
- }));
+ }
/* *INDENT-ON* */
sm->port_per_thread = (0xffff - 1024) / _vec_len (sm->workers);
}
/* *INDENT-OFF* */
- pool_foreach (i, sm->interfaces,
- ({
+ pool_foreach (i, sm->interfaces)
+ {
if (i->sw_if_index == sw_if_index)
{
if (!(nat_interface_is_outside (i)))
return;
match = 1;
}
- }));
+ }
- pool_foreach (i, sm->output_feature_interfaces,
- ({
+ pool_foreach (i, sm->output_feature_interfaces)
+ {
if (i->sw_if_index == sw_if_index)
{
if (!(nat_interface_is_outside (i)))
return;
match = 1;
}
- }));
+ }
/* *INDENT-ON* */
if (!match)
{
u32 thread_index = vlib_get_thread_index ();
/* *INDENT-OFF* */
- pool_foreach_index (i, m->locals,
- ({
+ pool_foreach_index (i, m->locals)
+ {
local = pool_elt_at_index (m->locals, i);
ip4_header_t ip = {
{
vec_add1 (tmp, i);
}
- }));
+ }
/* *INDENT-ON* */
ASSERT (vec_len (tmp) != 0);
}
else
{
/* *INDENT-OFF* */
- pool_foreach_index (i, m->locals,
- ({
+ pool_foreach_index (i, m->locals)
+ {
vec_add1 (tmp, i);
- }));
+ }
/* *INDENT-ON* */
}
hi = vec_len (tmp) - 1;
[NAT_NEXT_IN2OUT_ED_OUTPUT_SLOW_PATH] = "nat44-ed-in2out-output-slowpath",
[NAT_NEXT_OUT2IN_ED_FAST_PATH] = "nat44-ed-out2in",
[NAT_NEXT_OUT2IN_ED_SLOW_PATH] = "nat44-ed-out2in-slowpath",
+ [NAT_NEXT_OUT2IN_ED_HANDOFF] = "nat44-ed-out2in-handoff",
[NAT_NEXT_IN2OUT_CLASSIFY] = "nat44-in2out-worker-handoff",
[NAT_NEXT_OUT2IN_CLASSIFY] = "nat44-out2in-worker-handoff",
},