From b2c31b685fd2cf28436ca32bc93e23eb24c74878 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Sun, 13 Dec 2020 21:47:40 +0100 Subject: misc: move to new pool_foreach macros Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion --- src/vnet/ip6-nd/ip6_mld.c | 18 +++++++++--------- src/vnet/ip6-nd/ip6_nd_api.c | 12 ++++++------ src/vnet/ip6-nd/ip6_ra.c | 42 +++++++++++++++++++++--------------------- src/vnet/ip6-nd/rd_cp.c | 36 ++++++++++++++++++------------------ 4 files changed, 54 insertions(+), 54 deletions(-) (limited to 'src/vnet/ip6-nd') diff --git a/src/vnet/ip6-nd/ip6_mld.c b/src/vnet/ip6-nd/ip6_mld.c index 2a95c84eb0b..ea70bcc5d19 100644 --- a/src/vnet/ip6-nd/ip6_mld.c +++ b/src/vnet/ip6-nd/ip6_mld.c @@ -327,8 +327,8 @@ ip6_neighbor_send_mldpv2_report (u32 sw_if_index) rh0->icmp.checksum = 0; /* *INDENT-OFF* */ - pool_foreach (m, imd->mldp_group_pool, - ({ + pool_foreach (m, imd->mldp_group_pool) + { rr.type = m->type; rr.aux_data_len_u32s = 0; rr.num_sources = clib_host_to_net_u16 (m->num_sources); @@ -344,7 +344,7 @@ ip6_neighbor_send_mldpv2_report (u32 sw_if_index) } payload_length += sizeof( icmp6_multicast_address_record_t); - })); + } /* *INDENT-ON* */ rh0->rsvd = 0; @@ -389,8 +389,8 @@ ip6_mld_timer_event (vlib_main_t * vm, /* Interface ip6 radv info list */ /* *INDENT-OFF* */ - pool_foreach (imd, ip6_mld_pool, - ({ + pool_foreach (imd, ip6_mld_pool) + { if (!vnet_sw_interface_is_admin_up (vnm, imd->sw_if_index)) { imd->all_routers_mcast = 0; @@ -404,7 +404,7 @@ ip6_mld_timer_event (vlib_main_t * vm, ip6_neighbor_send_mldpv2_report(imd->sw_if_index); imd->all_routers_mcast = 1; } - })); + } /* *INDENT-ON* */ return 0; @@ -454,13 +454,13 @@ format_ip6_mld (u8 * s, va_list * args) s = format (s, "%UJoined group address(es):\n", format_white_space, indent); /* *INDENT-OFF* */ - pool_foreach (m, imd->mldp_group_pool, - ({ + pool_foreach (m, imd->mldp_group_pool) + { s = format (s, "%U%U\n", format_white_space, indent+2, format_ip6_address, &m->mcast_address); - })); + } /* *INDENT-ON* */ return (s); diff --git a/src/vnet/ip6-nd/ip6_nd_api.c b/src/vnet/ip6-nd/ip6_nd_api.c index 65b3ee381b3..9e4024670e6 100644 --- a/src/vnet/ip6-nd/ip6_nd_api.c +++ b/src/vnet/ip6-nd/ip6_nd_api.c @@ -96,13 +96,13 @@ vl_api_ip6nd_proxy_dump_t_handler (vl_api_ip6nd_proxy_dump_t * mp) return; /* *INDENT-OFF* */ - pool_foreach (fib_table, im6->fibs, - ({ + pool_foreach (fib_table, im6->fibs) + { fib_table_walk(fib_table->ft_index, FIB_PROTOCOL_IP6, api_ip6nd_proxy_fib_table_walk, &ctx); - })); + } /* *INDENT-ON* */ vec_sort_with_function (ctx.indices, fib_entry_cmp_for_sort); @@ -237,8 +237,8 @@ ip6_ra_handle_report (const ip6_ra_report_t * rap) /* *INDENT-OFF* */ vpe_client_registration_t *rp; - pool_foreach(rp, vpe_api_main.ip6_ra_events_registrations, - ({ + pool_foreach (rp, vpe_api_main.ip6_ra_events_registrations) + { vl_api_registration_t *vl_reg; vl_reg = vl_api_client_index_to_registration (rp->client_index); @@ -287,7 +287,7 @@ ip6_ra_handle_report (const ip6_ra_report_t * rap) vl_api_send_msg (vl_reg, (u8 *) event); } - })); + } /* *INDENT-ON* */ } diff --git a/src/vnet/ip6-nd/ip6_ra.c b/src/vnet/ip6-nd/ip6_ra.c index 97c5b4a2837..a3d95eee9fb 100644 --- a/src/vnet/ip6-nd/ip6_ra.c +++ b/src/vnet/ip6-nd/ip6_ra.c @@ -525,8 +525,8 @@ icmp6_router_solicitation (vlib_main_t * vm, ip6_radv_prefix_t *pr_info; /* *INDENT-OFF* */ - pool_foreach (pr_info, radv_info->adv_prefixes_pool, - ({ + pool_foreach (pr_info, radv_info->adv_prefixes_pool) + { if(pr_info->enabled && (!pr_info->decrement_lifetime_flag || (pr_info->pref_lifetime_expires >0))) @@ -589,7 +589,7 @@ icmp6_router_solicitation (vlib_main_t * vm, } } - })); + } /* *INDENT-ON* */ /* add additional options before here */ @@ -1007,8 +1007,8 @@ icmp6_router_advertisement (vlib_main_t * vm, /* look for matching prefix - if we our advertising it, it better be consistant */ /* *INDENT-OFF* */ - pool_foreach (pr_info, radv_info->adv_prefixes_pool, - ({ + pool_foreach (pr_info, radv_info->adv_prefixes_pool) + { ip6_address_t mask; ip6_address_mask_from_width(&mask, pr_info->prefix_len); @@ -1036,7 +1036,7 @@ icmp6_router_advertisement (vlib_main_t * vm, } } break; - })); + } /* *INDENT-ON* */ break; } @@ -1278,12 +1278,12 @@ send_rs_process (vlib_main_t * vm, vlib_node_runtime_t * rt, { due_time = current_time + 1e9; /* *INDENT-OFF* */ - pool_foreach (radv_info, ip6_ra_pool, - ({ + pool_foreach (radv_info, ip6_ra_pool) + { if (check_send_rs (vm, radv_info, current_time, &dt) && (dt < due_time)) due_time = dt; - })); + } /* *INDENT-ON* */ current_time = vlib_time_now (vm); } @@ -1440,10 +1440,10 @@ ip6_ra_update_secondary_radv_info (ip6_address_t * address, u8 prefix_len, vec_reset_length (radv_indices); /* *INDENT-OFF* */ - pool_foreach (radv_info, ip6_ra_pool, - ({ + pool_foreach (radv_info, ip6_ra_pool) + { vec_add1 (radv_indices, radv_info - ip6_ra_pool); - })); + } /* *INDENT-ON* */ /* @@ -1460,8 +1460,8 @@ ip6_ra_update_secondary_radv_info (ip6_address_t * address, u8 prefix_len, continue; /* *INDENT-OFF* */ - pool_foreach (this_prefix, radv_info->adv_prefixes_pool, - ({ + pool_foreach (this_prefix, radv_info->adv_prefixes_pool) + { if (this_prefix->prefix_len == prefix_len && ip6_address_is_equal_masked (&this_prefix->prefix, address, &mask)) @@ -1481,7 +1481,7 @@ ip6_ra_update_secondary_radv_info (ip6_address_t * address, u8 prefix_len, if (rv != 0) clib_warning ("ip6_neighbor_ra_prefix returned %d", rv); } - })); + } /* *INDENT-ON*/ } } @@ -1504,8 +1504,8 @@ ip6_ra_process_timer_event (vlib_main_t * vm, /* Interface ip6 radv info list */ /* *INDENT-OFF* */ - pool_foreach (radv_info, ip6_ra_pool, - ({ + pool_foreach (radv_info, ip6_ra_pool) + { if( !vnet_sw_interface_is_admin_up (vnm, radv_info->sw_if_index)) { radv_info->initial_adverts_sent = radv_info->initial_adverts_count-1; @@ -1592,7 +1592,7 @@ ip6_ra_process_timer_event (vlib_main_t * vm, f = 0; } } - })); + } /* *INDENT-ON* */ if (f) @@ -2118,12 +2118,12 @@ format_ip6_ra (u8 * s, va_list * args) indent += 2; /* *INDENT-OFF* */ - pool_foreach (p, radv_info->adv_prefixes_pool, - ({ + pool_foreach (p, radv_info->adv_prefixes_pool) + { s = format (s, "%Uprefix %U, length %d\n", format_white_space, indent+2, format_ip6_address, &p->prefix, p->prefix_len); - })); + } /* *INDENT-ON* */ s = format (s, "%UMTU is %d\n", diff --git a/src/vnet/ip6-nd/rd_cp.c b/src/vnet/ip6-nd/rd_cp.c index bab1b6520a4..13fd90db288 100644 --- a/src/vnet/ip6-nd/rd_cp.c +++ b/src/vnet/ip6-nd/rd_cp.c @@ -263,8 +263,8 @@ ip6_ra_report_handler (const ip6_ra_report_t * r) router_lifetime_in_sec = r->router_lifetime_in_sec; u8 route_already_present = 0; /* *INDENT-OFF* */ - pool_foreach (default_route, rm->default_route_pool, - ({ + pool_foreach (default_route, rm->default_route_pool) + { if (default_route->sw_if_index != sw_if_index) ; else if (0 != memcmp (&default_route->router_address, @@ -275,7 +275,7 @@ ip6_ra_report_handler (const ip6_ra_report_t * r) route_already_present = 1; goto default_route_pool_foreach_out; } - })); + } /* *INDENT-ON* */ default_route_pool_foreach_out: @@ -334,8 +334,8 @@ ip6_ra_report_handler (const ip6_ra_report_t * r) u8 address_already_present = 0; /* *INDENT-OFF* */ - pool_foreach (slaac_address, rm->slaac_address_pool, - ({ + pool_foreach (slaac_address, rm->slaac_address_pool) + { if (slaac_address->sw_if_index != sw_if_index) ; else if (slaac_address->address_length != prefix_length) @@ -348,7 +348,7 @@ ip6_ra_report_handler (const ip6_ra_report_t * r) address_already_present = 1; goto slaac_address_pool_foreach_out; } - })); + } /* *INDENT-ON* */ slaac_address_pool_foreach_out: @@ -415,8 +415,8 @@ rd_cp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) * as we are removing elements inside the loop body */ /* *INDENT-OFF* */ - pool_foreach_index (index, rm->slaac_address_pool, - ({ + pool_foreach_index (index, rm->slaac_address_pool) + { slaac_address = pool_elt_at_index(rm->slaac_address_pool, index); if (slaac_address->due_time > current_time) { @@ -430,9 +430,9 @@ rd_cp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) /* make sure ip6 stays enabled */ ip6_link_enable (sw_if_index, NULL); } - })); - pool_foreach_index (index, rm->default_route_pool, - ({ + } + pool_foreach_index (index, rm->default_route_pool) + { default_route = pool_elt_at_index(rm->default_route_pool, index); if (default_route->due_time > current_time) { @@ -441,7 +441,7 @@ rd_cp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) } else remove_default_route (vm, default_route); - })); + } /* *INDENT-ON* */ current_time = vlib_time_now (vm); } @@ -515,19 +515,19 @@ rd_cp_set_address_autoconfig (u32 sw_if_index, if (if_config->enabled && !enable) { /* *INDENT-OFF* */ - pool_foreach (slaac_address, rm->slaac_address_pool, - ({ + pool_foreach (slaac_address, rm->slaac_address_pool) + { remove_slaac_address (vm, slaac_address); - })); + } /* *INDENT-ON* */ } if (if_config->install_default_routes && !install_default_routes) { /* *INDENT-OFF* */ - pool_foreach (default_route, rm->default_route_pool, - ({ + pool_foreach (default_route, rm->default_route_pool) + { remove_default_route (vm, default_route); - })); + } /* *INDENT-ON* */ } -- cgit 1.2.3-korg