From 8e688dbd58fe13ff5b9f444d02b2aa3f046b4d01 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=9Fingen?= Date: Mon, 10 Jul 2017 21:14:59 +0200 Subject: [PATCH] Rename ALL_NEXTHOPS_RO to ALL_NEXTHOPS --- tests/lib/test_nexthop_iter.c | 8 ++++---- zebra/rib.h | 2 +- zebra/rt_netlink.c | 8 ++++---- zebra/rt_socket.c | 6 +++--- zebra/zebra_fpm_netlink.c | 2 +- zebra/zebra_fpm_protobuf.c | 2 +- zebra/zebra_rib.c | 28 ++++++++++++++-------------- zebra/zebra_rnh.c | 2 +- zebra/zebra_vty.c | 6 +++--- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/lib/test_nexthop_iter.c b/tests/lib/test_nexthop_iter.c index 5c5550a644..156249a1cb 100644 --- a/tests/lib/test_nexthop_iter.c +++ b/tests/lib/test_nexthop_iter.c @@ -1,6 +1,6 @@ /* * Recursive Nexthop Iterator test. - * This tests the ALL_NEXTHOPS_RO macro. + * This tests the ALL_NEXTHOPS macro. * * Copyright (C) 2012 by Open Source Routing. * Copyright (C) 2012 by Internet Systems Consortium, Inc. ("ISC") @@ -204,8 +204,8 @@ nexthop_chain_free(struct nexthop_chain *nc) } /* This function builds a string representation of - * the nexthop chain using the ALL_NEXTHOPS_RO macro. - * It verifies that the ALL_NEXTHOPS_RO macro iterated + * the nexthop chain using the ALL_NEXTHOPS macro. + * It verifies that the ALL_NEXTHOPS macro iterated * correctly over the nexthop chain by comparing the * generated representation with the expected representation. */ @@ -215,7 +215,7 @@ nexthop_chain_verify_iter(struct nexthop_chain *nc) struct nexthop *nh; char *repr = NULL; - for (ALL_NEXTHOPS_RO(nc->head, nh)) + for (ALL_NEXTHOPS(nc->head, nh)) add_string_representation (&repr, nh); if (repr && verbose) diff --git a/zebra/rib.h b/zebra/rib.h index e4e2c45486..177054af49 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -208,7 +208,7 @@ typedef struct rib_dest_t_ * left branch is 'resolved' and right branch is 'next': * https://en.wikipedia.org/wiki/Tree_traversal#/media/File:Sorted_binary_tree_preorder.svg */ -#define ALL_NEXTHOPS_RO(head, nexthop) \ +#define ALL_NEXTHOPS(head, nexthop) \ (nexthop) = (head); \ (nexthop); \ (nexthop) = CHECK_FLAG((nexthop)->flags, NEXTHOP_FLAG_RECURSIVE) \ diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 87ead20e86..e09f81ba22 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1282,7 +1282,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p, if (discard) { if (cmd == RTM_NEWROUTE) - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { /* We shouldn't encounter recursive nexthops on discard routes, * but it is probably better to handle that case correctly anyway. @@ -1296,7 +1296,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p, /* Count overall nexthops so we can decide whether to use singlepath * or multipath case. */ nexthop_num = 0; - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) continue; @@ -1312,7 +1312,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p, if (nexthop_num == 1 || multipath_num == 1) { nexthop_num = 0; - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) { @@ -1383,7 +1383,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p, rtnh = RTA_DATA (rta); nexthop_num = 0; - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { if (nexthop_num >= multipath_num) break; diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index caf4da2579..3ae09945b2 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -105,7 +105,7 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct route_entry *re) #endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ /* Make gateway. */ - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) continue; @@ -225,7 +225,7 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct route_entry *re) if (IS_ZEBRA_DEBUG_RIB) zlog_debug ("%s: odd command %s for flags %d", __func__, lookup_msg(rtm_type_str, cmd, NULL), nexthop->flags); - } /* for (ALL_NEXTHOPS_RO(...))*/ + } /* for (ALL_NEXTHOPS(...))*/ /* If there was no useful nexthop, then complain. */ if (nexthop_num == 0 && IS_ZEBRA_DEBUG_KERNEL) @@ -287,7 +287,7 @@ kernel_rtm_ipv6 (int cmd, struct prefix *p, struct route_entry *re) #endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ /* Make gateway. */ - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) continue; diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index a6c526ee6c..7ecde52e63 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -285,7 +285,7 @@ netlink_route_info_fill (netlink_route_info_t *ri, int cmd, if (discard) return 1; - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { if (ri->num_nhs >= multipath_num) break; diff --git a/zebra/zebra_fpm_protobuf.c b/zebra/zebra_fpm_protobuf.c index bb09aeece6..1e8af19ea7 100644 --- a/zebra/zebra_fpm_protobuf.c +++ b/zebra/zebra_fpm_protobuf.c @@ -194,7 +194,7 @@ create_add_route_message (qpb_allocator_t *allocator, rib_dest_t *dest, * Figure out the set of nexthops to be added to the message. */ num_nhs = 0; - for (ALL_NEXTHOPS_RO (re->nexthop, nexthop)) + for (ALL_NEXTHOPS (re->nexthop, nexthop)) { if (num_nhs >= multipath_num) break; diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index eed2125483..7016292ac0 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -529,7 +529,7 @@ nexthop_active (afi_t afi, struct route_entry *re, struct nexthop *nexthop, int else if (CHECK_FLAG (re->flags, ZEBRA_FLAG_INTERNAL)) { resolved = 0; - for (ALL_NEXTHOPS_RO(match->nexthop, newhop)) + for (ALL_NEXTHOPS(match->nexthop, newhop)) if (CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_FIB) && ! CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_RECURSIVE)) { @@ -547,7 +547,7 @@ nexthop_active (afi_t afi, struct route_entry *re, struct nexthop *nexthop, int else if (re->type == ZEBRA_ROUTE_STATIC) { resolved = 0; - for (ALL_NEXTHOPS_RO(match->nexthop, newhop)) + for (ALL_NEXTHOPS(match->nexthop, newhop)) if (CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_FIB)) { if (set) @@ -628,7 +628,7 @@ rib_match (afi_t afi, safi_t safi, vrf_id_t vrf_id, if (match->type != ZEBRA_ROUTE_CONNECT) { int found = 0; - for (ALL_NEXTHOPS_RO(match->nexthop, newhop)) + for (ALL_NEXTHOPS(match->nexthop, newhop)) if (CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_FIB)) { found = 1; @@ -754,7 +754,7 @@ rib_lookup_ipv4 (struct prefix_ipv4 *p, vrf_id_t vrf_id) if (match->type == ZEBRA_ROUTE_CONNECT) return match; - for (ALL_NEXTHOPS_RO(match->nexthop, nexthop)) + for (ALL_NEXTHOPS(match->nexthop, nexthop)) if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) return match; @@ -816,7 +816,7 @@ rib_lookup_ipv4_route (struct prefix_ipv4 *p, union sockunion * qgate, /* Ok, we have a cood candidate, let's check it's nexthop list... */ nexthops_active = 0; - for (ALL_NEXTHOPS_RO(match->nexthop, nexthop)) + for (ALL_NEXTHOPS(match->nexthop, nexthop)) if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) { nexthops_active = 1; @@ -1028,7 +1028,7 @@ zebra_rib_labeled_unicast (struct route_entry *re) if (re->type != ZEBRA_ROUTE_BGP) return 0; - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) if (!nexthop->nh_label || !nexthop->nh_label->num_labels) return 0; @@ -1051,7 +1051,7 @@ rib_install_kernel (struct route_node *rn, struct route_entry *re, struct route_ if (info->safi != SAFI_UNICAST) { - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) SET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB); return ret; } @@ -1067,7 +1067,7 @@ rib_install_kernel (struct route_node *rn, struct route_entry *re, struct route_ /* If install succeeds, update FIB flag for nexthops. */ if (!ret) { - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) continue; @@ -1096,7 +1096,7 @@ rib_uninstall_kernel (struct route_node *rn, struct route_entry *re) if (info->safi != SAFI_UNICAST) { - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) SET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB); return ret; } @@ -1109,7 +1109,7 @@ rib_uninstall_kernel (struct route_node *rn, struct route_entry *re) ret = kernel_route_rib (p, src_p, re, NULL); zvrf->removals++; - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB); return ret; @@ -1397,7 +1397,7 @@ rib_process_update_fib (struct zebra_vrf *zvrf, struct route_node *rn, { int in_fib = 0; - for (ALL_NEXTHOPS_RO(new->nexthop, nexthop)) + for (ALL_NEXTHOPS(new->nexthop, nexthop)) if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) { in_fib = 1; @@ -1632,7 +1632,7 @@ rib_process (struct route_node *rn) /* Check if we have a FIB route for the destination, otherwise, * don't redistribute it */ - for (ALL_NEXTHOPS_RO(new_fib ? new_fib->nexthop : NULL, nexthop)) + for (ALL_NEXTHOPS(new_fib ? new_fib->nexthop : NULL, nexthop)) { if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB)) { @@ -2168,7 +2168,7 @@ void _route_entry_dump (const char * func, re->nexthop_active_num ); - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { inet_ntop (p->family, &nexthop->gate, straddr, INET6_ADDRSTRLEN); zlog_debug @@ -2453,7 +2453,7 @@ rib_delete (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance, same = re; break; } - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) if (IPV4_ADDR_SAME (&nexthop->gate.ipv4, gate) || IPV6_ADDR_SAME (&nexthop->gate.ipv6, gate)) { diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 352ac4f4cf..880002b2d0 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -424,7 +424,7 @@ zebra_rnh_eval_import_check_entry (vrf_id_t vrfid, int family, int force, if (re && (rnh->state == NULL)) { - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) { state_changed = 1; diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index a19859440a..182223b058 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -719,7 +719,7 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast) vty_out (vty, " ago%s", VTY_NEWLINE); } - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { char addrstr[32]; @@ -866,7 +866,7 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct route_entry *r json_object_string_add(json_route, "uptime", buf); } - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { json_nexthop = json_object_new_object(); @@ -960,7 +960,7 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct route_entry *r } /* Nexthop information. */ - for (ALL_NEXTHOPS_RO(re->nexthop, nexthop)) + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { if (nexthop == re->nexthop) { -- 2.39.5