From c87bdd2b0fe1d2411bde512151373193b7b1e063 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 7 Jun 2017 07:39:35 -0400 Subject: [PATCH] zebra: Clean up indentation level in nexthop_active Clean up the while loop indentation level to be a bit more readable. Signed-off-by: Donald Sharp --- zebra/zebra_rib.c | 104 +++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 194425d506..8773744e2c 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -503,67 +503,67 @@ nexthop_active (afi_t afi, struct route_entry *re, struct nexthop *nexthop, int } while (rn && rn->info == NULL); if (rn) route_lock_node (rn); + + continue; } - else - { - /* If the longest prefix match for the nexthop yields - * a blackhole, mark it as inactive. */ - if (CHECK_FLAG (match->flags, ZEBRA_FLAG_BLACKHOLE) - || CHECK_FLAG (match->flags, ZEBRA_FLAG_REJECT)) - return 0; - if (match->type == ZEBRA_ROUTE_CONNECT) + /* If the longest prefix match for the nexthop yields + * a blackhole, mark it as inactive. */ + if (CHECK_FLAG (match->flags, ZEBRA_FLAG_BLACKHOLE) + || CHECK_FLAG (match->flags, ZEBRA_FLAG_REJECT)) + return 0; + + if (match->type == ZEBRA_ROUTE_CONNECT) + { + /* Directly point connected route. */ + newhop = match->nexthop; + if (newhop) { - /* Directly point connected route. */ - newhop = match->nexthop; - if (newhop) - { - if (nexthop->type == NEXTHOP_TYPE_IPV4 || - nexthop->type == NEXTHOP_TYPE_IPV6) - nexthop->ifindex = newhop->ifindex; - } - return 1; + if (nexthop->type == NEXTHOP_TYPE_IPV4 || + nexthop->type == NEXTHOP_TYPE_IPV6) + nexthop->ifindex = newhop->ifindex; } - else if (CHECK_FLAG (re->flags, ZEBRA_FLAG_INTERNAL)) - { - resolved = 0; - for (newhop = match->nexthop; newhop; newhop = newhop->next) - if (CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_FIB) - && ! CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_RECURSIVE)) + return 1; + } + else if (CHECK_FLAG (re->flags, ZEBRA_FLAG_INTERNAL)) + { + resolved = 0; + for (newhop = match->nexthop; newhop; newhop = newhop->next) + if (CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_FIB) + && ! CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_RECURSIVE)) + { + if (set) { - if (set) - { - SET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE); - SET_FLAG(re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED); - - nexthop_set_resolved(afi, newhop, nexthop); - } - resolved = 1; + SET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE); + SET_FLAG(re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED); + + nexthop_set_resolved(afi, newhop, nexthop); } - return resolved; - } - else if (re->type == ZEBRA_ROUTE_STATIC) - { - resolved = 0; - for (ALL_NEXTHOPS_RO(match->nexthop, newhop, tnewhop, recursing)) - if (CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_FIB)) + resolved = 1; + } + return resolved; + } + else if (re->type == ZEBRA_ROUTE_STATIC) + { + resolved = 0; + for (ALL_NEXTHOPS_RO(match->nexthop, newhop, tnewhop, recursing)) + if (CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_FIB)) + { + if (set) { - if (set) - { - SET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE); + SET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE); - nexthop_set_resolved(afi, newhop, nexthop); - } - resolved = 1; + nexthop_set_resolved(afi, newhop, nexthop); } - if (resolved && set) - re->nexthop_mtu = match->mtu; - return resolved; - } - else - { - return 0; - } + resolved = 1; + } + if (resolved && set) + re->nexthop_mtu = match->mtu; + return resolved; + } + else + { + return 0; } } return 0; -- 2.39.5