aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/det44
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-12-13 21:47:40 +0100
committerDave Barach <openvpp@barachs.net>2020-12-14 12:14:21 +0000
commitb2c31b685fd2cf28436ca32bc93e23eb24c74878 (patch)
treedc0a1b1ff784445b2cbb0f9b2c07b5bcb4f5a5d0 /src/plugins/nat/det44
parent62c25abaa3e93be5815172d391295a6ab0390122 (diff)
misc: move to new pool_foreach macros
Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/nat/det44')
-rw-r--r--src/plugins/nat/det44/det44.c28
-rw-r--r--src/plugins/nat/det44/det44.h12
-rw-r--r--src/plugins/nat/det44/det44_api.c6
-rw-r--r--src/plugins/nat/det44/det44_cli.c18
-rw-r--r--src/plugins/nat/det44/det44_inlines.h4
5 files changed, 34 insertions, 34 deletions
diff --git a/src/plugins/nat/det44/det44.c b/src/plugins/nat/det44/det44.c
index 582fd20cd5d..1dbbfdfdebe 100644
--- a/src/plugins/nat/det44/det44.c
+++ b/src/plugins/nat/det44/det44.c
@@ -151,12 +151,12 @@ snat_det_add_map (ip4_address_t * in_addr, u8 in_plen,
/* Add/del external address range to FIB */
/* *INDENT-OFF* */
- pool_foreach (i, dm->interfaces, ({
+ pool_foreach (i, dm->interfaces) {
if (det44_interface_is_inside(i))
continue;
det44_add_del_addr_to_fib(out_addr, out_plen, i->sw_if_index, is_add);
goto out;
- }));
+ }
/* *INDENT-ON* */
out:
return 0;
@@ -204,13 +204,13 @@ det44_interface_add_del (u32 sw_if_index, u8 is_inside, int is_del)
// then register nodes
/* *INDENT-OFF* */
- pool_foreach (tmp, dm->interfaces, ({
+ pool_foreach (tmp, dm->interfaces) {
if (tmp->sw_if_index == sw_if_index)
{
i = tmp;
goto out;
}
- }));
+ }
/* *INDENT-ON* */
out:
@@ -302,10 +302,10 @@ out:
// add/del outside address to FIB
snat_det_map_t *mp;
/* *INDENT-OFF* */
- pool_foreach (mp, dm->det_maps, ({
+ pool_foreach (mp, dm->det_maps) {
det44_add_del_addr_to_fib(&mp->out_addr,
mp->out_plen, sw_if_index, !is_del);
- }));
+ }
/* *INDENT-ON* */
}
return 0;
@@ -328,14 +328,14 @@ det44_expire_walk_fn (vlib_main_t * vm, vlib_node_runtime_t * rt,
vlib_process_get_events (vm, NULL);
u32 now = (u32) vlib_time_now (vm);
/* *INDENT-OFF* */
- pool_foreach (mp, dm->det_maps, ({
+ pool_foreach (mp, dm->det_maps) {
vec_foreach(ses, mp->sessions)
{
/* Delete if session expired */
if (ses->in_port && (ses->expire < now))
snat_det_ses_close (mp, ses);
}
- }));
+ }
/* *INDENT-ON* */
return 0;
}
@@ -429,10 +429,10 @@ det44_plugin_disable ()
vec_free (interfaces);
/* *INDENT-OFF* */
- pool_foreach (mp, dm->det_maps,
- ({
+ pool_foreach (mp, dm->det_maps)
+ {
vec_free (mp->sessions);
- }));
+ }
/* *INDENT-ON* */
det44_reset_timeouts ();
@@ -468,15 +468,15 @@ det44_update_outside_fib (ip4_main_t * im,
return;
/* *INDENT-OFF* */
- pool_foreach (i, dm->interfaces,
- ({
+ pool_foreach (i, dm->interfaces)
+ {
if (i->sw_if_index == sw_if_index)
{
if (!(det44_interface_is_outside (i)))
return;
match = 1;
}
- }));
+ }
/* *INDENT-ON* */
if (!match)
diff --git a/src/plugins/nat/det44/det44.h b/src/plugins/nat/det44/det44.h
index 84d570bfd56..02b0fa7e81d 100644
--- a/src/plugins/nat/det44/det44.h
+++ b/src/plugins/nat/det44/det44.h
@@ -279,11 +279,11 @@ snat_det_map_by_user (ip4_address_t * user_addr)
det44_main_t *dm = &det44_main;
snat_det_map_t *mp;
/* *INDENT-OFF* */
- pool_foreach (mp, dm->det_maps,
- ({
+ pool_foreach (mp, dm->det_maps)
+ {
if (is_addr_in_net(user_addr, &mp->in_addr, mp->in_plen))
return mp;
- }));
+ }
/* *INDENT-ON* */
return 0;
}
@@ -294,11 +294,11 @@ snat_det_map_by_out (ip4_address_t * out_addr)
det44_main_t *dm = &det44_main;
snat_det_map_t *mp;
/* *INDENT-OFF* */
- pool_foreach (mp, dm->det_maps,
- ({
+ pool_foreach (mp, dm->det_maps)
+ {
if (is_addr_in_net(out_addr, &mp->out_addr, mp->out_plen))
return mp;
- }));
+ }
/* *INDENT-ON* */
return 0;
}
diff --git a/src/plugins/nat/det44/det44_api.c b/src/plugins/nat/det44/det44_api.c
index 7c7b1788009..1486180aa99 100644
--- a/src/plugins/nat/det44/det44_api.c
+++ b/src/plugins/nat/det44/det44_api.c
@@ -329,10 +329,10 @@ vl_api_det44_interface_dump_t_handler (vl_api_det44_interface_dump_t * mp)
return;
/* *INDENT-OFF* */
- pool_foreach (i, dm->interfaces,
- ({
+ pool_foreach (i, dm->interfaces)
+ {
det44_send_interface_details(i, reg, mp->context);
- }));
+ }
/* *INDENT-ON* */
}
diff --git a/src/plugins/nat/det44/det44_cli.c b/src/plugins/nat/det44/det44_cli.c
index 933784f17c6..28569c7b82d 100644
--- a/src/plugins/nat/det44/det44_cli.c
+++ b/src/plugins/nat/det44/det44_cli.c
@@ -75,8 +75,8 @@ det44_show_mappings_command_fn (vlib_main_t * vm,
snat_det_map_t *mp;
vlib_cli_output (vm, "NAT44 deterministic mappings:");
/* *INDENT-OFF* */
- pool_foreach (mp, dm->det_maps,
- ({
+ pool_foreach (mp, dm->det_maps)
+ {
vlib_cli_output (vm, " in %U/%d out %U/%d\n",
format_ip4_address, &mp->in_addr, mp->in_plen,
format_ip4_address, &mp->out_addr, mp->out_plen);
@@ -85,7 +85,7 @@ det44_show_mappings_command_fn (vlib_main_t * vm,
vlib_cli_output (vm, " number of ports per inside host: %d\n",
mp->ports_per_host);
vlib_cli_output (vm, " sessions number: %d\n", mp->ses_num);
- }));
+ }
/* *INDENT-ON* */
return 0;
}
@@ -188,8 +188,8 @@ det44_show_sessions_command_fn (vlib_main_t * vm,
snat_det_map_t *mp;
vlib_cli_output (vm, "NAT44 deterministic sessions:");
/* *INDENT-OFF* */
- pool_foreach (mp, dm->det_maps,
- ({
+ pool_foreach (mp, dm->det_maps)
+ {
int i;
vec_foreach_index (i, mp->sessions)
{
@@ -197,7 +197,7 @@ det44_show_sessions_command_fn (vlib_main_t * vm,
if (ses->in_port)
vlib_cli_output (vm, " %U", format_det_map_ses, mp, ses, &i);
}
- }));
+ }
/* *INDENT-ON* */
return 0;
}
@@ -487,14 +487,14 @@ det44_show_interfaces_command_fn (vlib_main_t * vm, unformat_input_t * input,
det44_interface_t *i;
vlib_cli_output (vm, "DET44 interfaces:");
/* *INDENT-OFF* */
- pool_foreach (i, dm->interfaces,
- ({
+ pool_foreach (i, dm->interfaces)
+ {
vlib_cli_output (vm, " %U %s", format_vnet_sw_if_index_name, vnm,
i->sw_if_index,
(det44_interface_is_inside(i) &&
det44_interface_is_outside(i)) ? "in out" :
(det44_interface_is_inside(i) ? "in" : "out"));
- }));
+ }
/* *INDENT-ON* */
return 0;
}
diff --git a/src/plugins/nat/det44/det44_inlines.h b/src/plugins/nat/det44/det44_inlines.h
index e4be469562c..aeb55b385d3 100644
--- a/src/plugins/nat/det44/det44_inlines.h
+++ b/src/plugins/nat/det44/det44_inlines.h
@@ -108,11 +108,11 @@ det44_translate (vlib_node_runtime_t * node, u32 sw_if_index0,
{
det44_interface_t *i;
/* *INDENT-OFF* */
- pool_foreach (i, dm->interfaces, ({
+ pool_foreach (i, dm->interfaces) {
/* NAT packet aimed at outside interface */
if ((det44_interface_is_outside (i)) && (sw_if_index == i->sw_if_index))
return 0;
- }));
+ }
/* *INDENT-ON* */
}
}