/*
* 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")
}
/* 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.
*/
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)
* 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) \
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.
/* 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;
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))
{
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;
#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;
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)
#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;
if (discard)
return 1;
- for (ALL_NEXTHOPS_RO(re->nexthop, nexthop))
+ for (ALL_NEXTHOPS(re->nexthop, nexthop))
{
if (ri->num_nhs >= multipath_num)
break;
* 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;
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))
{
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)
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;
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;
/* 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;
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;
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;
}
/* 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;
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;
}
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;
{
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;
/* 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))
{
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
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))
{
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;
vty_out (vty, " ago%s", VTY_NEWLINE);
}
- for (ALL_NEXTHOPS_RO(re->nexthop, nexthop))
+ for (ALL_NEXTHOPS(re->nexthop, nexthop))
{
char addrstr[32];
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();
}
/* Nexthop information. */
- for (ALL_NEXTHOPS_RO(re->nexthop, nexthop))
+ for (ALL_NEXTHOPS(re->nexthop, nexthop))
{
if (nexthop == re->nexthop)
{