aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dhcp
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/dhcp
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/dhcp')
-rw-r--r--src/plugins/dhcp/client.c18
-rw-r--r--src/plugins/dhcp/dhcp6_client_common_dp.c6
-rw-r--r--src/plugins/dhcp/dhcp6_ia_na_client_cp.c30
-rw-r--r--src/plugins/dhcp/dhcp6_pd_client_cp.c36
-rw-r--r--src/plugins/dhcp/dhcp_api.c12
5 files changed, 51 insertions, 51 deletions
diff --git a/src/plugins/dhcp/client.c b/src/plugins/dhcp/client.c
index 575f8b82625..e15b6cb69f8 100644
--- a/src/plugins/dhcp/client.c
+++ b/src/plugins/dhcp/client.c
@@ -867,13 +867,13 @@ dhcp_client_process (vlib_main_t * vm,
{
/* *INDENT-OFF* */
next_expire_time = 1e70;
- pool_foreach (c, dcm->clients,
- ({
+ pool_foreach (c, dcm->clients)
+ {
this_next_expire_time = dhcp_client_sm
(now, timeout, (uword) (c - dcm->clients));
next_expire_time = this_next_expire_time < next_expire_time ?
this_next_expire_time : next_expire_time;
- }));
+ }
if (next_expire_time > now)
timeout = next_expire_time - now;
else
@@ -939,12 +939,12 @@ show_dhcp_client_command_fn (vlib_main_t * vm,
}
/* *INDENT-OFF* */
- pool_foreach (c, dcm->clients,
- ({
+ pool_foreach (c, dcm->clients)
+ {
vlib_cli_output (vm, "%U",
format_dhcp_client, dcm,
c, verbose);
- }));
+ }
/* *INDENT-ON* */
return 0;
@@ -1114,11 +1114,11 @@ dhcp_client_walk (dhcp_client_walk_cb_t cb, void *ctx)
dhcp_client_t *c;
/* *INDENT-OFF* */
- pool_foreach (c, dcm->clients,
- ({
+ pool_foreach (c, dcm->clients)
+ {
if (!cb(c, ctx))
break;
- }));
+ }
/* *INDENT-ON* */
}
diff --git a/src/plugins/dhcp/dhcp6_client_common_dp.c b/src/plugins/dhcp/dhcp6_client_common_dp.c
index 2acd2f6ab90..da6f61aa2d5 100644
--- a/src/plugins/dhcp/dhcp6_client_common_dp.c
+++ b/src/plugins/dhcp/dhcp6_client_common_dp.c
@@ -62,12 +62,12 @@ generate_client_duid (void)
ethernet_interface_t *eth_if = 0;
/* *INDENT-OFF* */
- pool_foreach (hi, im->hw_interfaces,
- ({
+ pool_foreach (hi, im->hw_interfaces)
+ {
eth_if = ethernet_get_interface (&ethernet_main, hi->hw_if_index);
if (eth_if)
break;
- }));
+ }
/* *INDENT-ON* */
if (eth_if)
diff --git a/src/plugins/dhcp/dhcp6_ia_na_client_cp.c b/src/plugins/dhcp/dhcp6_ia_na_client_cp.c
index 975a7e09eed..edc6f49768e 100644
--- a/src/plugins/dhcp/dhcp6_ia_na_client_cp.c
+++ b/src/plugins/dhcp/dhcp6_ia_na_client_cp.c
@@ -273,8 +273,8 @@ dhcp6_reply_event_handler (vl_api_dhcp6_reply_event_t * mp)
u8 address_already_present = 0;
/* *INDENT-OFF* */
- pool_foreach (address_info, rm->address_pool,
- ({
+ pool_foreach (address_info, rm->address_pool)
+ {
if (address_info->sw_if_index != sw_if_index)
;
else if (!ip6_addresses_equal (&address_info->address, address))
@@ -284,7 +284,7 @@ dhcp6_reply_event_handler (vl_api_dhcp6_reply_event_t * mp)
address_already_present = 1;
goto address_pool_foreach_out;
}
- }));
+ }
/* *INDENT-ON* */
address_pool_foreach_out:
@@ -346,15 +346,15 @@ create_address_list (u32 sw_if_index)
address_info_t *address_info, *address_list = 0;;
/* *INDENT-OFF* */
- pool_foreach (address_info, rm->address_pool,
- ({
+ pool_foreach (address_info, rm->address_pool)
+ {
if (address_info->sw_if_index == sw_if_index)
{
u32 pos = vec_len (address_list);
vec_validate (address_list, pos);
clib_memcpy (&address_list[pos], address_info, sizeof (*address_info));
}
- }));
+ }
/* *INDENT-ON* */
return address_list;
@@ -395,8 +395,8 @@ dhcp6_client_cp_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
{
due_time = current_time + 1e9;
/* *INDENT-OFF* */
- pool_foreach (address_info, rm->address_pool,
- ({
+ pool_foreach (address_info, rm->address_pool)
+ {
if (address_info->due_time > current_time)
{
if (address_info->due_time < due_time)
@@ -423,7 +423,7 @@ dhcp6_client_cp_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
0, 1);
}
}
- }));
+ }
/* *INDENT-ON* */
for (i = 0; i < vec_len (rm->client_state_by_sw_if_index); i++)
{
@@ -526,15 +526,15 @@ dhcp6_addresses_show_command_function (vlib_main_t * vm,
f64 current_time = vlib_time_now (vm);
/* *INDENT-OFF* */
- pool_foreach (address_info, dm->address_pool,
- ({
+ pool_foreach (address_info, dm->address_pool)
+ {
vlib_cli_output (vm, "address: %U, "
"preferred lifetime: %u, valid lifetime: %u "
"(%f remaining)",
format_ip6_address, &address_info->address,
address_info->preferred_lt, address_info->valid_lt,
address_info->due_time - current_time);
- }));
+ }
/* *INDENT-ON* */
return error;
@@ -661,8 +661,8 @@ dhcp6_client_enable_disable (u32 sw_if_index, u8 enable)
}
/* *INDENT-OFF* */
- pool_foreach (address_info, rm->address_pool,
- ({
+ pool_foreach (address_info, rm->address_pool)
+ {
if (address_info->sw_if_index == sw_if_index)
{
ASSERT (sw_if_index < vec_len (rm->client_state_by_sw_if_index) &&
@@ -680,7 +680,7 @@ dhcp6_client_enable_disable (u32 sw_if_index, u8 enable)
clib_warning ("Failed to delete interface address");
pool_put (rm->address_pool, address_info);
}
- }));
+ }
/* *INDENT-ON* */
}
diff --git a/src/plugins/dhcp/dhcp6_pd_client_cp.c b/src/plugins/dhcp/dhcp6_pd_client_cp.c
index 2328dfda3f5..f6d30fa0c7d 100644
--- a/src/plugins/dhcp/dhcp6_pd_client_cp.c
+++ b/src/plugins/dhcp/dhcp6_pd_client_cp.c
@@ -372,10 +372,10 @@ dhcp6_pd_reply_event_handler (vl_api_dhcp6_pd_reply_event_t * mp)
* so collect active indices.
*/
/* *INDENT-OFF* */
- pool_foreach (prefix_info, pm->prefix_pool,
- ({
+ pool_foreach (prefix_info, pm->prefix_pool)
+ {
vec_add1 (pm->indices, prefix_info - pm->prefix_pool);
- }));
+ }
/* *INDENT-ON* */
for (i = 0; i < n_prefixes; i++)
@@ -481,8 +481,8 @@ create_prefix_list (u32 sw_if_index)
prefix_info_t *prefix_info, *prefix_list = 0;;
/* *INDENT-OFF* */
- pool_foreach (prefix_info, pm->prefix_pool,
- ({
+ pool_foreach (prefix_info, pm->prefix_pool)
+ {
if (is_dhcpv6_pd_prefix (prefix_info) &&
prefix_info->opaque_data == sw_if_index)
{
@@ -490,7 +490,7 @@ create_prefix_list (u32 sw_if_index)
vec_validate (prefix_list, pos);
clib_memcpy (&prefix_list[pos], prefix_info, sizeof (*prefix_info));
}
- }));
+ }
/* *INDENT-ON* */
return prefix_list;
@@ -531,8 +531,8 @@ dhcp6_pd_client_cp_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
{
due_time = current_time + 1e9;
/* *INDENT-OFF* */
- pool_foreach (prefix_info, pm->prefix_pool,
- ({
+ pool_foreach (prefix_info, pm->prefix_pool)
+ {
if (is_dhcpv6_pd_prefix (prefix_info))
{
if (prefix_info->due_time > current_time)
@@ -558,7 +558,7 @@ dhcp6_pd_client_cp_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
}
}
}
- }));
+ }
/* *INDENT-ON* */
for (i = 0; i < vec_len (rm->client_state_by_sw_if_index); i++)
{
@@ -788,12 +788,12 @@ cp_ip6_address_find_new_active_prefix (u32 prefix_group_index,
prefix_info_t *prefix_info;
/* *INDENT-OFF* */
- pool_foreach (prefix_info, pm->prefix_pool,
- ({
+ pool_foreach (prefix_info, pm->prefix_pool)
+ {
if (prefix_info->prefix_group_index == prefix_group_index &&
prefix_info - pm->prefix_pool != ignore_prefix_index)
return prefix_info - pm->prefix_pool;
- }));
+ }
/* *INDENT-ON* */
return ~0;
}
@@ -1139,8 +1139,8 @@ cp_ip6_prefixes_show_command_function (vlib_main_t * vm,
f64 current_time = vlib_time_now (vm);
/* *INDENT-OFF* */
- pool_foreach (prefix_info, pm->prefix_pool,
- ({
+ pool_foreach (prefix_info, pm->prefix_pool)
+ {
prefix_group =
pm->prefix_group_name_by_index[prefix_info->prefix_group_index];
vlib_cli_output (vm, "opaque_data: %lu, prefix: %U/%d, prefix group: %s, "
@@ -1151,7 +1151,7 @@ cp_ip6_prefixes_show_command_function (vlib_main_t * vm,
prefix_group,
prefix_info->preferred_lt, prefix_info->valid_lt,
prefix_info->due_time - current_time);
- }));
+ }
/* *INDENT-ON* */
return error;
@@ -1305,8 +1305,8 @@ dhcp6_pd_client_enable_disable (u32 sw_if_index,
vec_validate (prefix_list, 0);
/* *INDENT-OFF* */
- pool_foreach (prefix_info, pm->prefix_pool,
- ({
+ pool_foreach (prefix_info, pm->prefix_pool)
+ {
if (is_dhcpv6_pd_prefix (prefix_info) &&
prefix_info->opaque_data == sw_if_index)
{
@@ -1324,7 +1324,7 @@ dhcp6_pd_client_enable_disable (u32 sw_if_index,
set_is_dhcpv6_pd_prefix (prefix_info, 0);
pool_put (pm->prefix_pool, prefix_info);
}
- }));
+ }
/* *INDENT-ON* */
vec_free (prefix_list);
diff --git a/src/plugins/dhcp/dhcp_api.c b/src/plugins/dhcp/dhcp_api.c
index c5c7a82f3c3..2b8d41a10c1 100644
--- a/src/plugins/dhcp/dhcp_api.c
+++ b/src/plugins/dhcp/dhcp_api.c
@@ -700,8 +700,8 @@ dhcp6_reply_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
vpe_client_registration_t *reg;
/* *INDENT-OFF* */
- pool_foreach(reg, vpe_api_main.dhcp6_reply_events_registrations,
- ({
+ pool_foreach (reg, vpe_api_main.dhcp6_reply_events_registrations)
+ {
vl_api_registration_t *vl_reg;
vl_reg =
vl_api_client_index_to_registration (reg->client_index);
@@ -715,7 +715,7 @@ dhcp6_reply_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
msg->pid = reg->client_pid;
vl_api_send_msg (vl_reg, (u8 *) msg);
}
- }));
+ }
/* *INDENT-ON* */
clib_mem_free (event);
@@ -812,8 +812,8 @@ dhcp6_pd_reply_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
vpe_client_registration_t *reg;
/* *INDENT-OFF* */
- pool_foreach(reg, vpe_api_main.dhcp6_pd_reply_events_registrations,
- ({
+ pool_foreach (reg, vpe_api_main.dhcp6_pd_reply_events_registrations)
+ {
vl_api_registration_t *vl_reg;
vl_reg =
vl_api_client_index_to_registration (reg->client_index);
@@ -827,7 +827,7 @@ dhcp6_pd_reply_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
msg->pid = reg->client_pid;
vl_api_send_msg (vl_reg, (u8 *) msg);
}
- }));
+ }
/* *INDENT-ON* */
clib_mem_free (event);