]> git.proxmox.com Git - mirror_frr.git/commitdiff
*: use clang's 'ForEachMacros' format style option
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 15 Sep 2017 15:47:35 +0000 (12:47 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 15 Sep 2017 17:53:46 +0000 (14:53 -0300)
This fixes the broken indentation of several foreach loops throughout
the code.

From clang's documentation[1]:
  ForEachMacros: A vector of macros that should be interpreted as foreach
  loops instead of as function calls.

[1] http://clang.llvm.org/docs/ClangFormatStyleOptions.html

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
42 files changed:
.clang-format
bgpd/bgp_advertise.c
bgpd/bgp_nht.c
bgpd/bgp_route.c
bgpd/bgp_updgrp.c
bgpd/bgp_updgrp_adv.c
bgpd/bgp_updgrp_packet.c
bgpd/bgpd.c
isisd/isis_tlvs.c
lib/if.c
lib/ns.c
lib/vrf.c
lib/workqueue.c
pimd/pim_bfd.c
pimd/pim_cmd.c
pimd/pim_iface.c
pimd/pim_ifchannel.c
pimd/pim_instance.c
pimd/pim_vty.c
pimd/pim_zebra.c
pimd/pimd.c
tools/start-stop-daemon.c
zebra/interface.c
zebra/irdp_main.c
zebra/main.c
zebra/redistribute.c
zebra/router-id.c
zebra/rt_netlink.c
zebra/rtadv.c
zebra/zebra_fpm.c
zebra/zebra_l2.c
zebra/zebra_mpls.c
zebra/zebra_ptm.c
zebra/zebra_pw.c
zebra/zebra_rib.c
zebra/zebra_rnh.c
zebra/zebra_routemap.c
zebra/zebra_snmp.c
zebra/zebra_static.c
zebra/zebra_vrf.c
zebra/zebra_vty.c
zebra/zserv.c

index 07f558d924295d8b755e6e6423df11753dd8cb5b..2710d844e9c85ff1291d801fb3d978d2297419a0 100644 (file)
@@ -23,3 +23,35 @@ IncludeCategories:
     Priority:        0
 CommentPragmas: '\$(FRR|clippy)'
 ContinuationIndentWidth: 8
+ForEachMacros:
+  # lib
+  - LIST_FOREACH
+  - LIST_FOREACH_SAFE
+  - SLIST_FOREACH
+  - SLIST_FOREACH_SAFE
+  - SLIST_FOREACH_PREVPTR
+  - STAILQ_FOREACH
+  - STAILQ_FOREACH_SAFE
+  - TAILQ_FOREACH
+  - TAILQ_FOREACH_SAFE
+  - TAILQ_FOREACH_REVERSE
+  - TAILQ_FOREACH_REVERSE_SAFE
+  - RB_FOREACH
+  - RB_FOREACH_SAFE
+  - RB_FOREACH_REVERSE
+  - RB_FOREACH_REVERSE_SAFE
+  - SPLAY_FOREACH
+  # zebra
+  - RE_DEST_FOREACH_ROUTE
+  - RE_DEST_FOREACH_ROUTE_SAFE
+  - RNODE_FOREACH_RE
+  - RNODE_FOREACH_RE_SAFE
+  # bgpd
+  - UPDGRP_FOREACH_SUBGRP
+  - UPDGRP_FOREACH_SUBGRP_SAFE
+  - SUBGRP_FOREACH_PEER
+  - SUBGRP_FOREACH_PEER_SAFE
+  - SUBGRP_FOREACH_ADJ
+  - SUBGRP_FOREACH_ADJ_SAFE
+  - AF_FOREACH
+  - FOREACH_AFI_SAFI
index a7f72974cab4d2cf4d4e4102eea8f02a6532128d..2c83de89e06f378144eee957e43777c67cf67dd5 100644 (file)
@@ -155,22 +155,24 @@ int bgp_adj_out_lookup(struct peer *peer, struct bgp_node *rn,
        int addpath_capable;
 
        for (adj = rn->adj_out; adj; adj = adj->next)
-               SUBGRP_FOREACH_PEER(adj->subgroup, paf)
-       if (paf->peer == peer) {
-               afi = SUBGRP_AFI(adj->subgroup);
-               safi = SUBGRP_SAFI(adj->subgroup);
-               addpath_capable = bgp_addpath_encode_tx(peer, afi, safi);
-
-               /* Match on a specific addpath_tx_id if we are using addpath for
-                * this
-                * peer and if an addpath_tx_id was specified */
-               if (addpath_capable && addpath_tx_id
-                   && adj->addpath_tx_id != addpath_tx_id)
-                       continue;
-
-               return (adj->adv ? (adj->adv->baa ? 1 : 0)
-                                : (adj->attr ? 1 : 0));
-       }
+               SUBGRP_FOREACH_PEER (adj->subgroup, paf)
+                       if (paf->peer == peer) {
+                               afi = SUBGRP_AFI(adj->subgroup);
+                               safi = SUBGRP_SAFI(adj->subgroup);
+                               addpath_capable =
+                                       bgp_addpath_encode_tx(peer, afi, safi);
+
+                               /* Match on a specific addpath_tx_id if we are
+                                * using addpath for
+                                * this
+                                * peer and if an addpath_tx_id was specified */
+                               if (addpath_capable && addpath_tx_id
+                                   && adj->addpath_tx_id != addpath_tx_id)
+                                       continue;
+
+                               return (adj->adv ? (adj->adv->baa ? 1 : 0)
+                                                : (adj->attr ? 1 : 0));
+                       }
 
        return 0;
 }
index a0fc10c745bbb6846f4ef1fd9770aa3339109ee2..fc44e5e9b27cae2c5787d84a82bbf96d53a41ecf 100644 (file)
@@ -687,8 +687,7 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
                        buf, bnc->flags, bnc->change_flags);
        }
 
-       LIST_FOREACH(path, &(bnc->paths), nh_thread)
-       {
+       LIST_FOREACH (path, &(bnc->paths), nh_thread) {
                if (!(path->type == ZEBRA_ROUTE_BGP
                      && ((path->sub_type == BGP_ROUTE_NORMAL)
                          || (path->sub_type == BGP_ROUTE_STATIC))))
index fabe4483e50cc77909889bdd0a01509156731668..e3f63f11b6a4e8a5ddd045136b1c3e33b9870451 100644 (file)
@@ -1710,8 +1710,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
                         * Note: 3rd party nexthop currently implemented for
                         * IPv4 only.
                         */
-                       SUBGRP_FOREACH_PEER(subgrp, paf)
-                       {
+                       SUBGRP_FOREACH_PEER (subgrp, paf) {
                                if (bgp_multiaccess_check_v4(riattr->nexthop,
                                                             paf->peer))
                                        break;
@@ -10110,60 +10109,70 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
                        }
                } else {
                        for (adj = rn->adj_out; adj; adj = adj->next)
-                               SUBGRP_FOREACH_PEER(adj->subgroup, paf)
-                       if (paf->peer == peer) {
-                               if (header1) {
-                                       if (use_json) {
-                                               json_object_int_add(
-                                                       json, "bgpTableVersion",
-                                                       table->version);
-                                               json_object_string_add(
-                                                       json,
-                                                       "bgpLocalRouterId",
-                                                       inet_ntoa(
-                                                               bgp->router_id));
-                                               json_object_object_add(
-                                                       json, "bgpStatusCodes",
-                                                       json_scode);
-                                               json_object_object_add(
-                                                       json, "bgpOriginCodes",
-                                                       json_ocode);
-                                       } else {
-                                               vty_out(vty,
-                                                       "BGP table version is %" PRIu64
-                                                       ", local router ID is %s\n",
-                                                       table->version,
-                                                       inet_ntoa(
-                                                               bgp->router_id));
-                                               vty_out(vty,
-                                                       BGP_SHOW_SCODE_HEADER);
-                                               vty_out(vty,
-                                                       BGP_SHOW_OCODE_HEADER);
-                                       }
-                                       header1 = 0;
-                               }
+                               SUBGRP_FOREACH_PEER (adj->subgroup, paf)
+                                       if (paf->peer == peer) {
+                                               if (header1) {
+                                                       if (use_json) {
+                                                               json_object_int_add(
+                                                                       json,
+                                                                       "bgpTableVersion",
+                                                                       table->version);
+                                                               json_object_string_add(
+                                                                       json,
+                                                                       "bgpLocalRouterId",
+                                                                       inet_ntoa(
+                                                                               bgp->router_id));
+                                                               json_object_object_add(
+                                                                       json,
+                                                                       "bgpStatusCodes",
+                                                                       json_scode);
+                                                               json_object_object_add(
+                                                                       json,
+                                                                       "bgpOriginCodes",
+                                                                       json_ocode);
+                                                       } else {
+                                                               vty_out(vty,
+                                                                       "BGP table version is %" PRIu64
+                                                                       ", local router ID is %s\n",
+                                                                       table->version,
+                                                                       inet_ntoa(
+                                                                               bgp->router_id));
+                                                               vty_out(vty,
+                                                                       BGP_SHOW_SCODE_HEADER);
+                                                               vty_out(vty,
+                                                                       BGP_SHOW_OCODE_HEADER);
+                                                       }
+                                                       header1 = 0;
+                                               }
 
-                               if (header2) {
-                                       if (!use_json)
-                                               vty_out(vty, BGP_SHOW_HEADER);
-                                       header2 = 0;
-                               }
+                                               if (header2) {
+                                                       if (!use_json)
+                                                               vty_out(vty,
+                                                                       BGP_SHOW_HEADER);
+                                                       header2 = 0;
+                                               }
 
-                               if (adj->attr) {
-                                       bgp_attr_dup(&attr, adj->attr);
-                                       ret = bgp_output_modifier(
-                                               peer, &rn->p, &attr, afi, safi,
-                                               rmap_name);
-                                       if (ret != RMAP_DENY) {
-                                               route_vty_out_tmp(vty, &rn->p,
-                                                                 &attr, safi,
-                                                                 use_json,
-                                                                 json_ar);
-                                               output_count++;
-                                       } else
-                                               filtered_count++;
-                               }
-                       }
+                                               if (adj->attr) {
+                                                       bgp_attr_dup(&attr,
+                                                                    adj->attr);
+                                                       ret = bgp_output_modifier(
+                                                               peer, &rn->p,
+                                                               &attr, afi,
+                                                               safi,
+                                                               rmap_name);
+                                                       if (ret != RMAP_DENY) {
+                                                               route_vty_out_tmp(
+                                                                       vty,
+                                                                       &rn->p,
+                                                                       &attr,
+                                                                       safi,
+                                                                       use_json,
+                                                                       json_ar);
+                                                               output_count++;
+                                                       } else
+                                                               filtered_count++;
+                                               }
+                                       }
                }
        }
        if (use_json)
index 05395a583af346359f2ceed24841256080883991..8f6729060098032e7100ff74b8c070cd6672477a 100644 (file)
@@ -549,8 +549,7 @@ static int update_group_show_walkcb(struct update_group *updgrp, void *arg)
                return CMD_SUCCESS;
 
        if (ctx->subgrp_id) {
-               UPDGRP_FOREACH_SUBGRP(updgrp, subgrp)
-               {
+               UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
                        if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
                                continue;
                        else {
@@ -591,8 +590,7 @@ static int update_group_show_walkcb(struct update_group *updgrp, void *arg)
                                ? " replace-as"
                                : "");
 
-       UPDGRP_FOREACH_SUBGRP(updgrp, subgrp)
-       {
+       UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
                if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
                        continue;
                vty_out(vty, "\n");
@@ -636,8 +634,8 @@ static int update_group_show_walkcb(struct update_group *updgrp, void *arg)
                                : "");
                if (subgrp->peer_count > 0) {
                        vty_out(vty, "    Peers:\n");
-                       SUBGRP_FOREACH_PEER(subgrp, paf)
-                       vty_out(vty, "      - %s\n", paf->peer->host);
+                       SUBGRP_FOREACH_PEER (subgrp, paf)
+                               vty_out(vty, "      - %s\n", paf->peer->host);
                }
        }
        return UPDWALK_CONTINUE;
@@ -655,8 +653,7 @@ static int updgrp_show_packet_queue_walkcb(struct update_group *updgrp,
        struct vty *vty;
 
        vty = ctx->vty;
-       UPDGRP_FOREACH_SUBGRP(updgrp, subgrp)
-       {
+       UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
                if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
                        continue;
                vty_out(vty, "update group %" PRIu64 ", subgroup %" PRIu64 "\n",
@@ -959,8 +956,7 @@ static struct update_subgroup *update_subgroup_find(struct update_group *updgrp,
        if (!peer_established(PAF_PEER(paf)))
                return NULL;
 
-       UPDGRP_FOREACH_SUBGRP(updgrp, subgrp)
-       {
+       UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
                if (subgrp->version != version
                    || CHECK_FLAG(subgrp->sflags,
                                  SUBGRP_STATUS_DEFAULT_ORIGINATE))
@@ -1109,8 +1105,7 @@ int update_subgroup_check_merge(struct update_subgroup *subgrp,
        /*
         * Look for a subgroup to merge into.
         */
-       UPDGRP_FOREACH_SUBGRP(subgrp->update_group, target)
-       {
+       UPDGRP_FOREACH_SUBGRP (subgrp->update_group, target) {
                if (update_subgroup_can_merge_into(subgrp, target))
                        break;
        }
@@ -1177,8 +1172,7 @@ static void update_subgroup_copy_adj_out(struct update_subgroup *source,
 {
        struct bgp_adj_out *aout, *aout_copy;
 
-       SUBGRP_FOREACH_ADJ(source, aout)
-       {
+       SUBGRP_FOREACH_ADJ (source, aout) {
                /*
                 * Copy the adj out.
                 */
@@ -1361,15 +1355,13 @@ static int updgrp_policy_update_walkcb(struct update_group *updgrp, void *arg)
         * refresh.
         */
        if (ctx->policy_event_start_flag) {
-               UPDGRP_FOREACH_SUBGRP(updgrp, subgrp)
-               {
+               UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
                        update_subgroup_set_needs_refresh(subgrp, 1);
                }
                return UPDWALK_CONTINUE;
        }
 
-       UPDGRP_FOREACH_SUBGRP(updgrp, subgrp)
-       {
+       UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
                if (changed) {
                        if (bgp_debug_update(NULL, NULL, updgrp, 0))
                                zlog_debug(
@@ -1408,8 +1400,8 @@ static int update_group_periodic_merge_walkcb(struct update_group *updgrp,
        struct update_subgroup *tmp_subgrp;
        const char *reason = arg;
 
-       UPDGRP_FOREACH_SUBGRP_SAFE(updgrp, subgrp, tmp_subgrp)
-       update_subgroup_check_merge(subgrp, reason);
+       UPDGRP_FOREACH_SUBGRP_SAFE (updgrp, subgrp, tmp_subgrp)
+               update_subgroup_check_merge(subgrp, reason);
        return UPDWALK_CONTINUE;
 }
 
@@ -1550,7 +1542,7 @@ void update_bgp_group_init(struct bgp *bgp)
 {
        int afid;
 
-       AF_FOREACH(afid)
+       AF_FOREACH (afid)
                bgp->update_groups[afid] =
                        hash_create(updgrp_hash_key_make,
                                    updgrp_hash_cmp,
@@ -1561,8 +1553,7 @@ void update_bgp_group_free(struct bgp *bgp)
 {
        int afid;
 
-       AF_FOREACH(afid)
-       {
+       AF_FOREACH (afid) {
                if (bgp->update_groups[afid]) {
                        hash_free(bgp->update_groups[afid]);
                        bgp->update_groups[afid] = NULL;
@@ -1740,8 +1731,7 @@ void update_group_walk(struct bgp *bgp, updgrp_walkcb cb, void *ctx)
        afi_t afi;
        safi_t safi;
 
-       FOREACH_AFI_SAFI(afi, safi)
-       {
+       FOREACH_AFI_SAFI (afi, safi) {
                update_group_af_walk(bgp, afi, safi, cb, ctx);
        }
 }
@@ -1763,8 +1753,7 @@ update_group_default_originate_route_map_walkcb(struct update_group *updgrp,
        afi_t afi;
        safi_t safi;
 
-       UPDGRP_FOREACH_SUBGRP(updgrp, subgrp)
-       {
+       UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
                peer = SUBGRP_PEER(subgrp);
                afi = SUBGRP_AFI(subgrp);
                safi = SUBGRP_SAFI(subgrp);
@@ -1824,8 +1813,7 @@ void peer_af_announce_route(struct peer_af *paf, int combine)
                 */
                all_pending = 1;
 
-               SUBGRP_FOREACH_PEER(subgrp, cur_paf)
-               {
+               SUBGRP_FOREACH_PEER (subgrp, cur_paf) {
                        if (cur_paf == paf)
                                continue;
 
@@ -1860,8 +1848,7 @@ void peer_af_announce_route(struct peer_af *paf, int combine)
         *
         * First stop refresh timers on all the other peers.
         */
-       SUBGRP_FOREACH_PEER(subgrp, cur_paf)
-       {
+       SUBGRP_FOREACH_PEER (subgrp, cur_paf) {
                if (cur_paf == paf)
                        continue;
 
@@ -1889,8 +1876,7 @@ void subgroup_trigger_write(struct update_subgroup *subgrp)
     zlog_debug("u%llu:s%llu scheduling write thread for peers",
                subgrp->update_group->id, subgrp->id);
 #endif
-       SUBGRP_FOREACH_PEER(subgrp, paf)
-       {
+       SUBGRP_FOREACH_PEER (subgrp, paf) {
                if (paf->peer->status == Established) {
                        BGP_PEER_WRITE_ON(paf->peer->t_write, bgp_write,
                                          paf->peer->fd, paf->peer);
index 1bd6fb8b3d57421101c2d816795b1513435c3b9d..fbbeaee9b252ff24eee1d3cbb71cdf697ab2afd8 100644 (file)
@@ -113,8 +113,7 @@ static int group_announce_route_walkcb(struct update_group *updgrp, void *arg)
        peer = UPDGRP_PEER(updgrp);
        addpath_capable = bgp_addpath_encode_tx(peer, afi, safi);
 
-       UPDGRP_FOREACH_SUBGRP(updgrp, subgrp)
-       {
+       UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
 
                /*
                 * Skip the subgroups that have coalesce timer running. We will
@@ -262,8 +261,7 @@ static int updgrp_show_adj_walkcb(struct update_group *updgrp, void *arg)
        struct vty *vty;
 
        vty = ctx->vty;
-       UPDGRP_FOREACH_SUBGRP(updgrp, subgrp)
-       {
+       UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
                if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
                        continue;
                vty_out(vty, "update group %" PRIu64 ", subgroup %" PRIu64 "\n",
@@ -311,8 +309,7 @@ static int subgroup_coalesce_timer(struct thread *thread)
                struct peer_af *paf;
                struct peer *peer;
 
-               SUBGRP_FOREACH_PEER(subgrp, paf)
-               {
+               SUBGRP_FOREACH_PEER (subgrp, paf) {
                        peer = PAF_PEER(paf);
                        BGP_TIMER_OFF(peer->t_routeadv);
                        BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0);
@@ -326,8 +323,7 @@ static int update_group_announce_walkcb(struct update_group *updgrp, void *arg)
 {
        struct update_subgroup *subgrp;
 
-       UPDGRP_FOREACH_SUBGRP(updgrp, subgrp)
-       {
+       UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
                subgroup_announce_all(subgrp);
        }
 
@@ -348,8 +344,7 @@ static int update_group_announce_rrc_walkcb(struct update_group *updgrp,
 
        /* Only announce if this is a group of route-reflector-clients */
        if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) {
-               UPDGRP_FOREACH_SUBGRP(updgrp, subgrp)
-               {
+               UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
                        subgroup_announce_all(subgrp);
                }
        }
@@ -468,8 +463,7 @@ void bgp_adj_out_set_subgroup(struct bgp_node *rn,
        if (BGP_ADV_FIFO_EMPTY(&subgrp->sync->update)) {
                struct peer_af *paf;
 
-               SUBGRP_FOREACH_PEER(subgrp, paf)
-               {
+               SUBGRP_FOREACH_PEER (subgrp, paf) {
                        bgp_adjust_routeadv(PAF_PEER(paf));
                }
        }
@@ -556,8 +550,7 @@ void subgroup_clear_table(struct update_subgroup *subgrp)
 {
        struct bgp_adj_out *aout, *taout;
 
-       SUBGRP_FOREACH_ADJ_SAFE(subgrp, aout, taout)
-       {
+       SUBGRP_FOREACH_ADJ_SAFE (subgrp, aout, taout) {
                struct bgp_node *rn = aout->rn;
                bgp_adj_out_remove_subgroup(rn, aout, subgrp);
                bgp_unlock_node(rn);
index 692db32fa41463d9ce7989d5d7d7967bdbcdab41..433c5ce512d9eee07c985d0e4dd5e8e20e6d8be0 100644 (file)
@@ -374,8 +374,7 @@ void bpacket_queue_show_vty(struct bpacket_queue *q, struct vty *vty)
                vty_out(vty, "  Packet %p ver %u buffer %p\n", pkt, pkt->ver,
                        pkt->buffer);
 
-               LIST_FOREACH(paf, &(pkt->peers), pkt_train)
-               {
+               LIST_FOREACH (paf, &(pkt->peers), pkt_train) {
                        vty_out(vty, "      - %s\n", paf->peer->host);
                }
                pkt = bpacket_next(pkt);
index 0d600475626961cc126dad69e7acdb6de910ab20..54155290d6412d7fc17b4e71bc270dabe395453f 100644 (file)
@@ -2078,8 +2078,8 @@ int peer_delete(struct peer *peer)
                        }
                }
 
-       FOREACH_AFI_SAFI(afi, safi)
-       peer_af_delete(peer, afi, safi);
+       FOREACH_AFI_SAFI (afi, safi)
+               peer_af_delete(peer, afi, safi);
 
        if (peer->hostname) {
                XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
@@ -7365,8 +7365,7 @@ static void bgp_viewvrf_autocomplete(vector comps, struct cmd_token *token)
        struct listnode *next;
        struct bgp *bgp;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (vrf->vrf_id != VRF_DEFAULT)
                        vector_set(comps, XSTRDUP(MTYPE_COMPLETION, vrf->name));
        }
index 8efbcd28113d2ffa0d641196a0ce6faee59aee28..25a10e91e6d5960496906e6eabf8ecebb6f7cd66 100644 (file)
@@ -1921,8 +1921,7 @@ static void free_mt_items(enum isis_tlv_context context,
 {
        struct isis_item_list *n, *nnext;
 
-       RB_FOREACH_SAFE(n, isis_mt_item_list, m, nnext)
-       {
+       RB_FOREACH_SAFE (n, isis_mt_item_list, m, nnext) {
                free_items(context, type, n);
                RB_REMOVE(isis_mt_item_list, m, n);
                XFREE(MTYPE_ISIS_MT_ITEM_LIST, n);
@@ -1936,8 +1935,7 @@ static void format_mt_items(enum isis_tlv_context context,
 {
        struct isis_item_list *n;
 
-       RB_FOREACH(n, isis_mt_item_list, m)
-       {
+       RB_FOREACH (n, isis_mt_item_list, m) {
                format_items_(n->mtid, context, type, n, buf, indent);
        }
 }
@@ -1951,8 +1949,7 @@ static int pack_mt_items(enum isis_tlv_context context, enum isis_tlv_type type,
 {
        struct isis_item_list *n;
 
-       RB_FOREACH(n, isis_mt_item_list, m)
-       {
+       RB_FOREACH (n, isis_mt_item_list, m) {
                int rv;
 
                rv = pack_items_(n->mtid, context, type, n, s, fragment_tlvs,
@@ -1973,8 +1970,7 @@ static void copy_mt_items(enum isis_tlv_context context,
 
        RB_INIT(isis_mt_item_list, dest);
 
-       RB_FOREACH(n, isis_mt_item_list, src)
-       {
+       RB_FOREACH (n, isis_mt_item_list, src) {
                copy_items(context, type, n, isis_get_mt_items(dest, n->mtid));
        }
 }
index 43c382beaaa4cb7107720553d5a19b3acc066463..7d27229656e2ec22f0dc2c9c40c9fe7f7dce5591 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -249,8 +249,7 @@ struct interface *if_lookup_by_name_all_vrf(const char *name)
        struct vrf *vrf;
        struct interface *ifp;
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       {
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
                ifp = if_lookup_by_name(name, vrf->vrf_id);
                if (ifp)
                        return ifp;
@@ -386,8 +385,7 @@ struct interface *if_get_by_name_len(const char *name, size_t namelen,
                return ifp;
 
        /* Didn't find the interface on that vrf. Defined on a different one? */
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       {
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
                for (ALL_LIST_ELEMENTS_RO(vrf_iflist(vrf->vrf_id), node, ifp)) {
                        if (!memcmp(name, ifp->name, namelen)
                            && (ifp->name[namelen] == '\0')) {
@@ -541,10 +539,10 @@ void if_dump_all(void)
        struct listnode *node;
        void *p;
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       if (vrf->iflist != NULL)
-               for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, p))
-                       if_dump(p);
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
+               if (vrf->iflist != NULL)
+                       for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, p))
+                               if_dump(p);
 }
 
 DEFUN (interface_desc,
@@ -1053,8 +1051,7 @@ static void if_autocomplete(vector comps, struct cmd_token *token)
        struct listnode *ln;
        struct vrf *vrf = NULL;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                for (ALL_LIST_ELEMENTS_RO(vrf->iflist, ln, ifp))
                        vector_set(comps, XSTRDUP(MTYPE_COMPLETION, ifp->name));
        }
index ba920e31b9078827eda1b8424f33ac9996689a8d..fdf93d074291b9413633a7c9dd5607b1c6d49a39 100644 (file)
--- a/lib/ns.c
+++ b/lib/ns.c
@@ -378,8 +378,7 @@ static int ns_config_write(struct vty *vty)
        struct ns *ns;
        int write = 0;
 
-       RB_FOREACH(ns, ns_head, &ns_tree)
-       {
+       RB_FOREACH (ns, ns_head, &ns_tree) {
                if (ns->ns_id == NS_DEFAULT || ns->name == NULL)
                        continue;
 
index 6e70609b78bca160dfdfe39a580185e45db475b9..0a4969dfac851fb5647bb05da277b0033cece334 100644 (file)
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -356,8 +356,7 @@ static void vrf_autocomplete(vector comps, struct cmd_token *token)
 {
        struct vrf *vrf = NULL;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (vrf->vrf_id != 0)
                        vector_set(comps, XSTRDUP(MTYPE_COMPLETION, vrf->name));
        }
index b76b73b367b5484379f0be7fa4b60fa53f576b01..643ed2d2b895938b109763e893b080201aba74e2 100644 (file)
@@ -258,7 +258,7 @@ int work_queue_run(struct thread *thread)
        if (wq->cycles.granularity == 0)
                wq->cycles.granularity = WORK_QUEUE_MIN_GRANULARITY;
 
-       STAILQ_FOREACH_SAFE(item, &wq->items, wq, titem) {
+       STAILQ_FOREACH_SAFE (item, &wq->items, wq, titem) {
                assert(item && item->data);
 
                /* dont run items which are past their allowed retries */
index bba26662bdab4b08b644162e65f8477ca28b4e88..314162c78b031f174a4461f872459fc61c7b0e27 100644 (file)
@@ -300,7 +300,7 @@ static int pim_bfd_nbr_replay(int command, struct zclient *zclient,
        /* Send the client registration */
        bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER);
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                for (ALL_LIST_ELEMENTS_RO(vrf_iflist(vrf->vrf_id), node, ifp)) {
                        pim_ifp = ifp->info;
 
index 4066614f4b893d215dca1ce45a76d6957c51a87a..1885d5a61a9e104ef3905ddd6dbfd847e43cdf34 100644 (file)
@@ -228,7 +228,7 @@ static void pim_show_assert(struct pim_instance *pim, struct vty *vty)
                if (!pim_ifp)
                        continue;
 
-               RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+               RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                        pim_show_assert_helper(vty, pim_ifp, ch, now);
                } /* scan interface channels */
        }
@@ -280,7 +280,7 @@ static void pim_show_assert_internal(struct pim_instance *pim, struct vty *vty)
                if (!pim_ifp)
                        continue;
 
-               RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+               RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                        pim_show_assert_internal_helper(vty, pim_ifp, ch);
                } /* scan interface channels */
        }
@@ -329,7 +329,7 @@ static void pim_show_assert_metric(struct pim_instance *pim, struct vty *vty)
                if (!pim_ifp)
                        continue;
 
-               RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+               RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                        pim_show_assert_metric_helper(vty, pim_ifp, ch);
                } /* scan interface channels */
        }
@@ -392,7 +392,7 @@ static void pim_show_assert_winner_metric(struct pim_instance *pim,
                if (!pim_ifp)
                        continue;
 
-               RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+               RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                        pim_show_assert_winner_metric_helper(vty, pim_ifp, ch);
                } /* scan interface channels */
        }
@@ -482,7 +482,7 @@ static void pim_show_membership(struct pim_instance *pim, struct vty *vty,
                if (!pim_ifp)
                        continue;
 
-               RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+               RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                        pim_show_membership_helper(vty, pim_ifp, ch, json);
                } /* scan interface channels */
        }
@@ -1698,9 +1698,8 @@ static void pim_show_join(struct pim_instance *pim, struct vty *vty, u_char uj)
                if (!pim_ifp)
                        continue;
 
-               RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
-                       pim_show_join_helper(vty, pim_ifp,
-                                            ch, json, now, uj);
+               RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+                       pim_show_join_helper(vty, pim_ifp, ch, json, now, uj);
                } /* scan interface channels */
        }
 
@@ -2528,7 +2527,7 @@ static void pim_show_join_desired(struct pim_instance *pim, struct vty *vty,
                        continue;
 
 
-               RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+               RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                        /* scan all interfaces */
                        pim_show_join_desired_helper(pim, vty,
                                                     pim_ifp, ch,
@@ -3393,8 +3392,7 @@ DEFUN (show_ip_igmp_interface_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -3450,8 +3448,7 @@ DEFUN (show_ip_igmp_join_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -3505,8 +3502,7 @@ DEFUN (show_ip_igmp_groups_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -3711,8 +3707,7 @@ DEFUN (show_ip_pim_interface_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -3771,8 +3766,7 @@ DEFUN (show_ip_pim_join_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -3857,8 +3851,7 @@ DEFUN (show_ip_pim_neighbor_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -3964,8 +3957,7 @@ DEFUN (show_ip_pim_state_vrf_all,
                        group = argv[idx + 1]->arg;
        }
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -4019,8 +4011,7 @@ DEFUN (show_ip_pim_upstream_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -4116,8 +4107,7 @@ DEFUN (show_ip_pim_rp_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -4171,8 +4161,7 @@ DEFUN (show_ip_pim_rpf_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -4438,8 +4427,7 @@ DEFUN (show_ip_multicast_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -4814,8 +4802,7 @@ DEFUN (show_ip_mroute_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -4918,8 +4905,7 @@ DEFUN (show_ip_mroute_count_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -7854,8 +7840,7 @@ DEFUN (show_ip_msdp_mesh_group_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -8083,8 +8068,7 @@ DEFUN (show_ip_msdp_peer_detail_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -8313,8 +8297,7 @@ DEFUN (show_ip_msdp_sa_detail_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
@@ -8450,7 +8433,7 @@ DEFUN (show_ip_msdp_sa_sg_vrf_all,
 
        if (uj)
                vty_out(vty, "{ ");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (uj) {
                        if (!first)
                                vty_out(vty, ", ");
index 6cf18d08e44671f81898a509181c9ee35074e82e..f0b89396b34e3a8ea9d728fa963ab9cb7aaf985b 100644 (file)
@@ -263,7 +263,7 @@ void pim_if_update_could_assert(struct interface *ifp)
        pim_ifp = ifp->info;
        zassert(pim_ifp);
 
-       RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+       RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                pim_ifchannel_update_could_assert(ch);
        }
 }
@@ -276,7 +276,7 @@ static void pim_if_update_my_assert_metric(struct interface *ifp)
        pim_ifp = ifp->info;
        zassert(pim_ifp);
 
-       RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+       RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                pim_ifchannel_update_my_assert_metric(ch);
        }
 }
@@ -1426,7 +1426,7 @@ void pim_if_assert_on_neighbor_down(struct interface *ifp,
        pim_ifp = ifp->info;
        zassert(pim_ifp);
 
-       RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+       RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                /* Is (S,G,I) assert loser ? */
                if (ch->ifassert_state != PIM_IFASSERT_I_AM_LOSER)
                        continue;
@@ -1443,13 +1443,13 @@ void pim_if_update_join_desired(struct pim_interface *pim_ifp)
        struct pim_ifchannel *ch;
 
        /* clear off flag from interface's upstreams */
-       RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+       RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                PIM_UPSTREAM_FLAG_UNSET_DR_JOIN_DESIRED_UPDATED(
                        ch->upstream->flags);
        }
 
        /* scan per-interface (S,G,I) state on this I interface */
-       RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+       RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                struct pim_upstream *up = ch->upstream;
 
                if (PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED_UPDATED(up->flags))
@@ -1470,7 +1470,7 @@ void pim_if_update_assert_tracking_desired(struct interface *ifp)
        if (!pim_ifp)
                return;
 
-       RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+       RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                pim_ifchannel_update_assert_tracking_desired(ch);
        }
 }
@@ -1537,8 +1537,7 @@ int pim_if_is_vrf_device(struct interface *ifp)
 {
        struct vrf *vrf;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (strncmp(ifp->name, vrf->name, strlen(ifp->name)) == 0)
                        return 1;
        }
@@ -1551,7 +1550,7 @@ int pim_if_ifchannel_count(struct pim_interface *pim_ifp)
        struct pim_ifchannel *ch;
        int count = 0;
 
-       RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+       RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                count++;
        }
 
index e0d2c78fe4de6bac893f323bd0546538e29ed769..bcf7d2318dd740be525c351d14d8e0cc01bf940e 100644 (file)
@@ -115,7 +115,7 @@ static void pim_ifchannel_find_new_children(struct pim_ifchannel *ch)
            && (ch->sg.grp.s_addr == INADDR_ANY))
                return;
 
-       RB_FOREACH(child, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+       RB_FOREACH (child, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
                if ((ch->sg.grp.s_addr != INADDR_ANY)
                    && (child->sg.grp.s_addr == ch->sg.grp.s_addr)
                    && (child != ch)) {
@@ -469,7 +469,7 @@ void pim_ifchannel_membership_clear(struct interface *ifp)
        pim_ifp = ifp->info;
        zassert(pim_ifp);
 
-       RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb)
+       RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb)
                ifmembership_set(ch, PIM_IFMEMBERSHIP_NOINFO);
 }
 
@@ -481,7 +481,7 @@ void pim_ifchannel_delete_on_noinfo(struct interface *ifp)
        pim_ifp = ifp->info;
        zassert(pim_ifp);
 
-       RB_FOREACH_SAFE(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb, ch_tmp)
+       RB_FOREACH_SAFE (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb, ch_tmp)
                delete_on_noinfo(ch);
 }
 
@@ -1304,7 +1304,7 @@ void pim_ifchannel_scan_forward_start(struct interface *new_ifp)
                if (new_pim_ifp == loop_pim_ifp)
                        continue;
 
-               RB_FOREACH(ch, pim_ifchannel_rb, &loop_pim_ifp->ifchannel_rb) {
+               RB_FOREACH (ch, pim_ifchannel_rb, &loop_pim_ifp->ifchannel_rb) {
                        if (ch->ifjoin_state == PIM_IFJOIN_JOIN) {
                                struct pim_upstream *up = ch->upstream;
                                if ((!up->channel_oil)
index 5a59342947f08c839d04b714115a9ed52e70f38f..42feae3361c728b533c3980e9b7fce6832b0ca72 100644 (file)
@@ -192,8 +192,7 @@ static int pim_vrf_config_write(struct vty *vty)
        struct vrf *vrf;
        struct pim_instance *pim;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                pim = vrf->info;
 
                if (!pim)
index 7607bdf13b2d6ba81d23da114258c407de14f67f..3da092541dd838f40799507e9050ea005752d060 100644 (file)
@@ -245,8 +245,7 @@ int pim_interface_config_write(struct vty *vty)
        struct vrf *vrf;
        int writes = 0;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                pim = vrf->info;
                if (!pim)
                        continue;
index a1107e2424886628f97b9aed4aa3572a06ab7fb6..df70e9dd5e10de9e0ffa8fb4167218626df9608e 100644 (file)
@@ -178,8 +178,7 @@ static int pim_zebra_if_state_up(int command, struct zclient *zclient,
         */
        if (sscanf(ifp->name, "pimreg%d", &table_id) == 1) {
                struct vrf *vrf;
-               RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-               {
+               RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                        if ((table_id == vrf->data.l.table_id)
                            && (ifp->vrf_id != vrf->vrf_id)) {
                                struct interface *master = if_lookup_by_name(
@@ -401,8 +400,7 @@ static void scan_upstream_rpf_cache()
        struct vrf *vrf;
        struct pim_instance *pim;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                pim = vrf->info;
                if (!pim)
                        continue;
@@ -498,8 +496,7 @@ static void scan_upstream_rpf_cache()
                } /* for (qpim_upstream_list) */
        }
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                pim = vrf->info;
                if (!pim)
                        continue;
@@ -666,8 +663,7 @@ void pim_scan_oil(struct pim_instance *pim_matcher)
        qpim_scan_oil_last = pim_time_monotonic_sec();
        ++qpim_scan_oil_events;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                pim = vrf->info;
                if (!pim)
                        continue;
@@ -870,8 +866,7 @@ void igmp_source_forward_reevaluate_all(void)
        struct vrf *vrf;
        struct pim_instance *pim;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                pim = vrf->info;
                if (!pim)
                        continue;
index 37c79d45548f216c93b4a48bcd3a82a3ac20e182..52e0920f1f9199c37ff8ccd6a2e9565b158837e1 100644 (file)
@@ -72,8 +72,7 @@ void pim_prefix_list_update(struct prefix_list *plist)
        struct pim_instance *pim;
        struct vrf *vrf;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                pim = vrf->info;
                if (!pim)
                        continue;
index 39527eca777b8490beeca981ca8b21c832d4f881..30dc6484ae181a96b07054394a71cd40e9d763d7 100644 (file)
@@ -280,8 +280,7 @@ static void set_namespaces()
        struct namespace *namespace;
        int fd;
 
-       LIST_FOREACH(namespace, &namespace_head, list)
-       {
+       LIST_FOREACH (namespace, &namespace_head, list) {
                if ((fd = open(namespace->path, O_RDONLY)) == -1)
                        fatal("open namespace %s: %s", namespace->path,
                              strerror(errno));
index 358f940c525069ed7c63dc01885dabd20eb96e02..664e493d84f157a0417972241ee59d3e7c48e953 100644 (file)
@@ -1349,9 +1349,9 @@ DEFUN (show_interface_vrf_all,
        interface_update_stats();
 
        /* All interface print. */
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp))
-               if_dump_vty(vty, ifp);
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+               for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp))
+                       if_dump_vty(vty, ifp);
 
        return CMD_SUCCESS;
 }
@@ -1404,8 +1404,7 @@ DEFUN (show_interface_name_vrf_all,
        interface_update_stats();
 
        /* All interface print. */
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                /* Specified interface print. */
                ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf->vrf_id);
                if (ifp) {
@@ -1486,11 +1485,11 @@ DEFUN (show_interface_desc_vrf_all,
 {
        struct vrf *vrf;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       if (!list_isempty(vrf->iflist)) {
-               vty_out(vty, "\n\tVRF %u\n\n", vrf->vrf_id);
-               if_show_description(vty, vrf->vrf_id);
-       }
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+               if (!list_isempty(vrf->iflist)) {
+                       vty_out(vty, "\n\tVRF %u\n\n", vrf->vrf_id);
+                       if_show_description(vty, vrf->vrf_id);
+               }
 
        return CMD_SUCCESS;
 }
@@ -2836,80 +2835,89 @@ static int if_config_write(struct vty *vty)
 
        zebra_ptm_write(vty);
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp)) {
-               struct zebra_if *if_data;
-               struct listnode *addrnode;
-               struct connected *ifc;
-               struct prefix *p;
-               struct vrf *vrf;
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+               for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp)) {
+                       struct zebra_if *if_data;
+                       struct listnode *addrnode;
+                       struct connected *ifc;
+                       struct prefix *p;
+                       struct vrf *vrf;
 
-               if_data = ifp->info;
-               vrf = vrf_lookup_by_id(ifp->vrf_id);
+                       if_data = ifp->info;
+                       vrf = vrf_lookup_by_id(ifp->vrf_id);
 
-               if (ifp->vrf_id == VRF_DEFAULT)
-                       vty_frame(vty, "interface %s\n", ifp->name);
-               else
-                       vty_frame(vty, "interface %s vrf %s\n", ifp->name,
-                                 vrf->name);
+                       if (ifp->vrf_id == VRF_DEFAULT)
+                               vty_frame(vty, "interface %s\n", ifp->name);
+                       else
+                               vty_frame(vty, "interface %s vrf %s\n",
+                                         ifp->name, vrf->name);
 
-               if (if_data) {
-                       if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)
-                               vty_out(vty, " shutdown\n");
+                       if (if_data) {
+                               if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)
+                                       vty_out(vty, " shutdown\n");
 
-                       zebra_ptm_if_write(vty, if_data);
-               }
+                               zebra_ptm_if_write(vty, if_data);
+                       }
 
-               if (ifp->desc)
-                       vty_out(vty, " description %s\n", ifp->desc);
-
-               /* Assign bandwidth here to avoid unnecessary interface flap
-                  while processing config script */
-               if (ifp->bandwidth != 0)
-                       vty_out(vty, " bandwidth %u\n", ifp->bandwidth);
-
-               if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION))
-                       vty_out(vty, " no link-detect\n");
-
-               for (ALL_LIST_ELEMENTS_RO(ifp->connected, addrnode, ifc)) {
-                       if (CHECK_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED)) {
-                               char buf[INET6_ADDRSTRLEN];
-                               p = ifc->address;
-                               vty_out(vty, " ip%s address %s",
-                                       p->family == AF_INET ? "" : "v6",
-                                       inet_ntop(p->family, &p->u.prefix, buf,
-                                                 sizeof(buf)));
-                               if (CONNECTED_PEER(ifc)) {
-                                       p = ifc->destination;
-                                       vty_out(vty, " peer %s",
+                       if (ifp->desc)
+                               vty_out(vty, " description %s\n", ifp->desc);
+
+                       /* Assign bandwidth here to avoid unnecessary interface
+                          flap
+                          while processing config script */
+                       if (ifp->bandwidth != 0)
+                               vty_out(vty, " bandwidth %u\n", ifp->bandwidth);
+
+                       if (!CHECK_FLAG(ifp->status,
+                                       ZEBRA_INTERFACE_LINKDETECTION))
+                               vty_out(vty, " no link-detect\n");
+
+                       for (ALL_LIST_ELEMENTS_RO(ifp->connected, addrnode,
+                                                 ifc)) {
+                               if (CHECK_FLAG(ifc->conf,
+                                              ZEBRA_IFC_CONFIGURED)) {
+                                       char buf[INET6_ADDRSTRLEN];
+                                       p = ifc->address;
+                                       vty_out(vty, " ip%s address %s",
+                                               p->family == AF_INET ? ""
+                                                                    : "v6",
                                                inet_ntop(p->family,
                                                          &p->u.prefix, buf,
                                                          sizeof(buf)));
-                               }
-                               vty_out(vty, "/%d", p->prefixlen);
+                                       if (CONNECTED_PEER(ifc)) {
+                                               p = ifc->destination;
+                                               vty_out(vty, " peer %s",
+                                                       inet_ntop(p->family,
+                                                                 &p->u.prefix,
+                                                                 buf,
+                                                                 sizeof(buf)));
+                                       }
+                                       vty_out(vty, "/%d", p->prefixlen);
 
-                               if (ifc->label)
-                                       vty_out(vty, " label %s", ifc->label);
+                                       if (ifc->label)
+                                               vty_out(vty, " label %s",
+                                                       ifc->label);
 
-                               vty_out(vty, "\n");
+                                       vty_out(vty, "\n");
+                               }
                        }
-               }
 
-               if (if_data) {
-                       if (if_data->multicast != IF_ZEBRA_MULTICAST_UNSPEC)
-                               vty_out(vty, " %smulticast\n",
-                                       if_data->multicast
-                                                       == IF_ZEBRA_MULTICAST_ON
-                                               ? ""
-                                               : "no ");
-               }
+                       if (if_data) {
+                               if (if_data->multicast
+                                   != IF_ZEBRA_MULTICAST_UNSPEC)
+                                       vty_out(vty, " %smulticast\n",
+                                               if_data->multicast
+                                                               == IF_ZEBRA_MULTICAST_ON
+                                                       ? ""
+                                                       : "no ");
+                       }
 
-               hook_call(zebra_if_config_wr, vty, ifp);
+                       hook_call(zebra_if_config_wr, vty, ifp);
 
-               link_params_config_write(vty, ifp);
+                       link_params_config_write(vty, ifp);
 
-               vty_endframe(vty, "!\n");
-       }
+                       vty_endframe(vty, "!\n");
+               }
        return 0;
 }
 
index 9dfa854725318a97a9849683d0ba798945cae6fd..bc85e983e7518d7691460f166cef06d8a3fcc21a 100644 (file)
@@ -322,21 +322,21 @@ static int irdp_finish(void)
 
        zlog_info("IRDP: Received shutdown notification.");
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) {
-               zi = ifp->info;
-
-               if (!zi)
-                       continue;
-               irdp = zi->irdp;
-               if (!irdp)
-                       continue;
-
-               if (irdp->flags & IF_ACTIVE) {
-                       irdp->flags |= IF_SHUTDOWN;
-                       irdp_advert_off(ifp);
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
+               for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) {
+                       zi = ifp->info;
+
+                       if (!zi)
+                               continue;
+                       irdp = zi->irdp;
+                       if (!irdp)
+                               continue;
+
+                       if (irdp->flags & IF_ACTIVE) {
+                               irdp->flags |= IF_SHUTDOWN;
+                               irdp_advert_off(ifp);
+                       }
                }
-       }
        return 0;
 }
 
index bc7276817d560e5c08020979345e310553cece97..4864b4961d0892a00b2f8646954f7b51fa380d74 100644 (file)
@@ -131,8 +131,7 @@ static void sigint(void)
        list_delete_all_node(zebrad.client_list);
 
        if (retain_mode)
-               RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-               {
+               RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                        zvrf = vrf->info;
                        if (zvrf)
                                SET_FLAG(zvrf->flags, ZEBRA_VRF_RETAIN);
index 93bfc0c031d3cdfff332657524e0195ac8e76ad0..76e0df40b9aea5f1a958a339c4a4853c3c7b2cb8 100644 (file)
@@ -84,12 +84,12 @@ static void zebra_redistribute_default(struct zserv *client, vrf_id_t vrf_id)
                if (!rn)
                        continue;
 
-               RNODE_FOREACH_RE(rn, newre) {
+               RNODE_FOREACH_RE (rn, newre) {
                        if (CHECK_FLAG(newre->flags, ZEBRA_FLAG_SELECTED)
                            && newre->distance != DISTANCE_INFINITY)
                                zsend_redistribute_route(
-                                       ZEBRA_REDISTRIBUTE_ROUTE_ADD,
-                                       client, &rn->p, NULL, newre);
+                                       ZEBRA_REDISTRIBUTE_ROUTE_ADD, client,
+                                       &rn->p, NULL, newre);
                }
 
                route_unlock_node(rn);
@@ -109,8 +109,7 @@ static void zebra_redistribute(struct zserv *client, int type, u_short instance,
                return;
 
        for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
-               RNODE_FOREACH_RE(rn, newre)
-               {
+               RNODE_FOREACH_RE (rn, newre) {
                        struct prefix *dst_p, *src_p;
                        srcdest_rnode_prefixes(rn, &dst_p, &src_p);
 
@@ -506,10 +505,8 @@ int zebra_add_import_table_entry(struct route_node *rn, struct route_entry *re,
 
        prefix_copy(&p, &rn->p);
 
-       RNODE_FOREACH_RE(rn, same)
-       {
-               if (CHECK_FLAG(same->status,
-                              ROUTE_ENTRY_REMOVED))
+       RNODE_FOREACH_RE (rn, same) {
+               if (CHECK_FLAG(same->status, ROUTE_ENTRY_REMOVED))
                        continue;
 
                if (same->type == re->type
@@ -620,8 +617,7 @@ int zebra_import_table(afi_t afi, u_int32_t table_id, u_int32_t distance,
                if (!rn->info)
                        continue;
 
-               RNODE_FOREACH_RE(rn, re)
-               {
+               RNODE_FOREACH_RE (rn, re) {
                        if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
                                continue;
                        break;
@@ -708,11 +704,9 @@ void zebra_import_table_rm_update()
                                if (!rn->info)
                                        continue;
 
-                               RNODE_FOREACH_RE(rn, re)
-                               {
-                                       if (CHECK_FLAG(
-                                                   re->status,
-                                                   ROUTE_ENTRY_REMOVED))
+                               RNODE_FOREACH_RE (rn, re) {
+                                       if (CHECK_FLAG(re->status,
+                                                      ROUTE_ENTRY_REMOVED))
                                                continue;
                                        break;
                                }
index 383f21864bde47cb9e98b8b78a8bfd8c905188da..f6c88a2162bc8641d1b03d11dd5c8feb3693ccef 100644 (file)
@@ -187,19 +187,21 @@ void router_id_write(struct vty *vty)
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       if ((zvrf = vrf->info) != NULL)
-               if (zvrf->rid_user_assigned.u.prefix4.s_addr) {
-                       if (zvrf_id(zvrf) == VRF_DEFAULT)
-                               vty_out(vty, "router-id %s\n",
-                                       inet_ntoa(zvrf->rid_user_assigned.u
-                                                         .prefix4));
-                       else
-                               vty_out(vty, "router-id %s vrf %s\n",
-                                       inet_ntoa(zvrf->rid_user_assigned.u
-                                                         .prefix4),
-                                       zvrf_name(zvrf));
-               }
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+               if ((zvrf = vrf->info) != NULL)
+                       if (zvrf->rid_user_assigned.u.prefix4.s_addr) {
+                               if (zvrf_id(zvrf) == VRF_DEFAULT)
+                                       vty_out(vty, "router-id %s\n",
+                                               inet_ntoa(
+                                                       zvrf->rid_user_assigned
+                                                               .u.prefix4));
+                               else
+                                       vty_out(vty, "router-id %s vrf %s\n",
+                                               inet_ntoa(
+                                                       zvrf->rid_user_assigned
+                                                               .u.prefix4),
+                                               zvrf_name(zvrf));
+                       }
 }
 
 DEFUN (router_id,
index e59d5f00fbb917f1821eab68ec30af0e0f83eedc..bf1042a7249ec10de0852c58655f3ebf5137fad0 100644 (file)
@@ -247,8 +247,7 @@ static vrf_id_t vrf_lookup_by_table(u_int32_t table_id)
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       {
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
                if ((zvrf = vrf->info) == NULL || (zvrf->table_id != table_id))
                        continue;
 
index 88836af72e4480abfc166222c48fcca421628e6f..6091c75e50c5daef8662dd3f0e298b50062aa5f5 100644 (file)
@@ -395,41 +395,48 @@ static int rtadv_timer(struct thread *thread)
                rtadv_event(zns, RTADV_TIMER_MSEC, 10 /* 10 ms */);
        }
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) {
-               if (if_is_loopback(ifp)
-                   || CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK)
-                   || !if_is_operative(ifp))
-                       continue;
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
+               for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) {
+                       if (if_is_loopback(ifp)
+                           || CHECK_FLAG(ifp->status,
+                                         ZEBRA_INTERFACE_VRF_LOOPBACK)
+                           || !if_is_operative(ifp))
+                               continue;
+
+                       zif = ifp->info;
+
+                       if (zif->rtadv.AdvSendAdvertisements) {
+                               if (zif->rtadv.inFastRexmit) {
+                                       /* We assume we fast rexmit every sec so
+                                        * no
+                                        * additional vars */
+                                       if (--zif->rtadv.NumFastReXmitsRemain
+                                           <= 0)
+                                               zif->rtadv.inFastRexmit = 0;
+
+                                       if (IS_ZEBRA_DEBUG_SEND)
+                                               zlog_debug(
+                                                       "Fast RA Rexmit on interface %s",
+                                                       ifp->name);
 
-               zif = ifp->info;
-
-               if (zif->rtadv.AdvSendAdvertisements) {
-                       if (zif->rtadv.inFastRexmit) {
-                               /* We assume we fast rexmit every sec so no
-                                * additional vars */
-                               if (--zif->rtadv.NumFastReXmitsRemain <= 0)
-                                       zif->rtadv.inFastRexmit = 0;
-
-                               if (IS_ZEBRA_DEBUG_SEND)
-                                       zlog_debug(
-                                               "Fast RA Rexmit on interface %s",
-                                               ifp->name);
-
-                               rtadv_send_packet(zns->rtadv.sock, ifp);
-                       } else {
-                               zif->rtadv.AdvIntervalTimer -= period;
-                               if (zif->rtadv.AdvIntervalTimer <= 0) {
-                                       /* FIXME: using MaxRtrAdvInterval each
-                                          time isn't what section
-                                          6.2.4 of RFC4861 tells to do. */
-                                       zif->rtadv.AdvIntervalTimer =
-                                               zif->rtadv.MaxRtrAdvInterval;
                                        rtadv_send_packet(zns->rtadv.sock, ifp);
+                               } else {
+                                       zif->rtadv.AdvIntervalTimer -= period;
+                                       if (zif->rtadv.AdvIntervalTimer <= 0) {
+                                               /* FIXME: using
+                                                  MaxRtrAdvInterval each
+                                                  time isn't what section
+                                                  6.2.4 of RFC4861 tells to do.
+                                                  */
+                                               zif->rtadv.AdvIntervalTimer =
+                                                       zif->rtadv
+                                                               .MaxRtrAdvInterval;
+                                               rtadv_send_packet(
+                                                       zns->rtadv.sock, ifp);
+                                       }
                                }
                        }
                }
-       }
 
        return 0;
 }
index 8c0700ac8b13a5152406b6a7c5a02409994991e6..6d3a8de8c9691f90a2e8cf5c60c34a79ca990694 100644 (file)
@@ -873,8 +873,7 @@ struct route_entry *zfpm_route_for_update(rib_dest_t *dest)
 {
        struct route_entry *re;
 
-       RE_DEST_FOREACH_ROUTE(dest, re)
-       {
+       RE_DEST_FOREACH_ROUTE (dest, re) {
                if (!CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
                        continue;
 
index 3d505857c271dc0a1c8165afaa2261c5ed41ff89..345637c0440b1e2ce063c91fdbfd28c3e3f36e60 100644 (file)
@@ -55,8 +55,7 @@ static void map_slaves_to_bridge(struct interface *br_if, int link)
        struct listnode *node;
        struct interface *ifp;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp)) {
                        struct zebra_if *zif;
                        struct zebra_l2info_brslave *br_slave;
index e3ce414127d77934ba2742bfd35dd027611bfa30..3c7319f35de3ef83ab96acbc730fccbf36afcec0 100644 (file)
@@ -411,8 +411,7 @@ static int fec_change_update_lsp(struct zebra_vrf *zvrf, zebra_fec_t *fec,
        if (!rn)
                return 0;
 
-       RNODE_FOREACH_RE(rn, re)
-       {
+       RNODE_FOREACH_RE (rn, re) {
                if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
                        break;
        }
@@ -614,8 +613,7 @@ static int nhlfe_nexthop_active_ipv4(zebra_nhlfe_t *nhlfe,
        route_unlock_node(rn);
 
        /* Locate a valid connected route. */
-       RNODE_FOREACH_RE(rn, match)
-       {
+       RNODE_FOREACH_RE (rn, match) {
                if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED)
                    || !CHECK_FLAG(match->flags, ZEBRA_FLAG_SELECTED))
                        continue;
@@ -664,8 +662,7 @@ static int nhlfe_nexthop_active_ipv6(zebra_nhlfe_t *nhlfe,
        route_unlock_node(rn);
 
        /* Locate a valid connected route. */
-       RNODE_FOREACH_RE(rn, match)
-       {
+       RNODE_FOREACH_RE (rn, match) {
                if ((match->type == ZEBRA_ROUTE_CONNECT)
                    && !CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED)
                    && CHECK_FLAG(match->flags, ZEBRA_FLAG_SELECTED))
@@ -2164,8 +2161,7 @@ int mpls_ftn_update(int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
 
        /* Lookup existing route */
        rn = route_node_get(table, prefix);
-       RNODE_FOREACH_RE(rn, re)
-       {
+       RNODE_FOREACH_RE (rn, re) {
                if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
                        continue;
                if (re->distance == distance)
@@ -2392,9 +2388,8 @@ void mpls_ldp_ftn_uninstall_all(struct zebra_vrf *zvrf, int afi)
 
        for (rn = route_top(table); rn; rn = route_next(rn)) {
                update = 0;
-               RNODE_FOREACH_RE(rn, re) {
-                       for (nexthop = re->nexthop;
-                            nexthop;
+               RNODE_FOREACH_RE (rn, re) {
+                       for (nexthop = re->nexthop; nexthop;
                             nexthop = nexthop->next) {
                                if (nexthop->nh_label_type != ZEBRA_LSP_LDP)
                                        continue;
index b18b3e74293e2fc455985b615f4f2116fcab4f4e..a42e6680e8a2c185476baf13d27b44d1537cca58 100644 (file)
@@ -263,17 +263,19 @@ DEFUN (zebra_ptm_enable,
 
        ptm_cb.ptm_enable = ZEBRA_IF_PTM_ENABLE_ON;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       for (ALL_LIST_ELEMENTS_RO(vrf->iflist, i, ifp))
-               if (!ifp->ptm_enable) {
-                       if_data = (struct zebra_if *)ifp->info;
-                       if (if_data && (if_data->ptm_enable
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+               for (ALL_LIST_ELEMENTS_RO(vrf->iflist, i, ifp))
+                       if (!ifp->ptm_enable) {
+                               if_data = (struct zebra_if *)ifp->info;
+                               if (if_data
+                                   && (if_data->ptm_enable
                                        == ZEBRA_IF_PTM_ENABLE_UNSPEC)) {
-                               ifp->ptm_enable = ZEBRA_IF_PTM_ENABLE_ON;
+                                       ifp->ptm_enable =
+                                               ZEBRA_IF_PTM_ENABLE_ON;
+                               }
+                               /* Assign a default unknown status */
+                               ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
                        }
-                       /* Assign a default unknown status */
-                       ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
-               }
 
        zebra_ptm_connect(NULL);
 
@@ -1090,26 +1092,27 @@ void zebra_ptm_reset_status(int ptm_disable)
        struct interface *ifp;
        int send_linkup;
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       for (ALL_LIST_ELEMENTS_RO(vrf->iflist, i, ifp)) {
-               send_linkup = 0;
-               if (ifp->ptm_enable) {
-                       if (!if_is_operative(ifp))
-                               send_linkup = 1;
-
-                       if (ptm_disable)
-                               ifp->ptm_enable = ZEBRA_IF_PTM_ENABLE_OFF;
-                       ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
-
-                       if (if_is_operative(ifp) && send_linkup) {
-                               if (IS_ZEBRA_DEBUG_EVENT)
-                                       zlog_debug(
-                                               "%s: Bringing up interface %s",
-                                               __func__, ifp->name);
-                               if_up(ifp);
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
+               for (ALL_LIST_ELEMENTS_RO(vrf->iflist, i, ifp)) {
+                       send_linkup = 0;
+                       if (ifp->ptm_enable) {
+                               if (!if_is_operative(ifp))
+                                       send_linkup = 1;
+
+                               if (ptm_disable)
+                                       ifp->ptm_enable =
+                                               ZEBRA_IF_PTM_ENABLE_OFF;
+                               ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
+
+                               if (if_is_operative(ifp) && send_linkup) {
+                                       if (IS_ZEBRA_DEBUG_EVENT)
+                                               zlog_debug(
+                                                       "%s: Bringing up interface %s",
+                                                       __func__, ifp->name);
+                                       if_up(ifp);
+                               }
                        }
                }
-       }
 }
 
 void zebra_ptm_if_init(struct zebra_if *zebra_ifp)
index ce9f19c3cc22f26b471a9eacdb28c64bbbbb9c2d..0ca7e34b238ba0f148fc46bcc084601ec9c767ad 100644 (file)
@@ -274,11 +274,9 @@ void zebra_pw_client_close(struct zserv *client)
        struct zebra_vrf *zvrf;
        struct zebra_pw *pw, *tmp;
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       {
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
                zvrf = vrf->info;
-               RB_FOREACH_SAFE(pw, zebra_pw_head, &zvrf->pseudowires, tmp)
-               {
+               RB_FOREACH_SAFE (pw, zebra_pw_head, &zvrf->pseudowires, tmp) {
                        if (pw->client != client)
                                continue;
                        zebra_pw_del(zvrf, pw);
@@ -450,8 +448,7 @@ DEFUN (show_pseudowires,
        vty_out(vty, "%-16s %-24s %-12s %-8s %-10s\n", "Interface", "Neighbor",
                "Labels", "Protocol", "Status");
 
-       RB_FOREACH(pw, zebra_pw_head, &zvrf->pseudowires)
-       {
+       RB_FOREACH (pw, zebra_pw_head, &zvrf->pseudowires) {
                char buf_nbr[INET6_ADDRSTRLEN];
                char buf_labels[64];
 
@@ -486,8 +483,7 @@ static int zebra_pw_config(struct vty *vty)
        if (!zvrf)
                return 0;
 
-       RB_FOREACH(pw, zebra_static_pw_head, &zvrf->static_pseudowires)
-       {
+       RB_FOREACH (pw, zebra_static_pw_head, &zvrf->static_pseudowires) {
                vty_out(vty, "pseudowire %s\n", pw->ifname);
                if (pw->local_label != MPLS_NO_LABEL
                    && pw->remote_label != MPLS_NO_LABEL)
index d04b64b19ccac0dbbba649f0287cdebf30581255..b1c2ae25c0da65b31ac9150e72ba17716aa23a7d 100644 (file)
@@ -447,8 +447,7 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
                    && !nh_resolve_via_default(p.family))
                        return 0;
 
-               RNODE_FOREACH_RE(rn, match)
-               {
+               RNODE_FOREACH_RE (rn, match) {
                        if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
                                continue;
 
@@ -563,8 +562,7 @@ struct route_entry *rib_match(afi_t afi, safi_t safi, vrf_id_t vrf_id,
                route_unlock_node(rn);
 
                /* Pick up selected route. */
-               RNODE_FOREACH_RE(rn, match)
-               {
+               RNODE_FOREACH_RE (rn, match) {
                        if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
                                continue;
                        if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB))
@@ -693,8 +691,7 @@ struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p, vrf_id_t vrf_id)
        /* Unlock node. */
        route_unlock_node(rn);
 
-       RNODE_FOREACH_RE(rn, match)
-       {
+       RNODE_FOREACH_RE (rn, match) {
                if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
                        continue;
                if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB))
@@ -752,8 +749,7 @@ int rib_lookup_ipv4_route(struct prefix_ipv4 *p, union sockunion *qgate,
 
        /* Find out if a "selected" RR for the discovered RIB entry exists ever.
         */
-       RNODE_FOREACH_RE(rn, match)
-       {
+       RNODE_FOREACH_RE (rn, match) {
                if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
                        continue;
                if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB))
@@ -1449,8 +1445,7 @@ static void rib_process(struct route_node *rn)
        if (IS_ZEBRA_DEBUG_RIB_DETAILED)
                zlog_debug("%u:%s: Processing rn %p", vrf_id, buf, rn);
 
-       RNODE_FOREACH_RE_SAFE(rn, re, next)
-       {
+       RNODE_FOREACH_RE_SAFE (rn, re, next) {
                if (IS_ZEBRA_DEBUG_RIB_DETAILED)
                        zlog_debug(
                                "%u:%s: Examine re %p (type %d) status %x flags %x "
@@ -1619,8 +1614,7 @@ static void rib_process(struct route_node *rn)
        }
 
        /* Remove all RE entries queued for removal */
-       RNODE_FOREACH_RE_SAFE(rn, re, next)
-       {
+       RNODE_FOREACH_RE_SAFE (rn, re, next) {
                if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) {
                        if (IS_ZEBRA_DEBUG_RIB) {
                                rnode_debug(rn, vrf_id, "rn %p, removing re %p",
@@ -1694,8 +1688,7 @@ static void meta_queue_process_complete(struct work_queue *dummy)
         * should limit the evaluation to the necessary VRFs in most common
         * situations.
         */
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       {
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
                zvrf = vrf->info;
                if (zvrf == NULL || !(zvrf->flags & ZEBRA_VRF_RIB_SCHEDULED))
                        continue;
@@ -1778,8 +1771,7 @@ static void rib_meta_queue_add(struct meta_queue *mq, struct route_node *rn)
 {
        struct route_entry *re;
 
-       RNODE_FOREACH_RE(rn, re)
-       {
+       RNODE_FOREACH_RE (rn, re) {
                u_char qindex = meta_queue_map[re->type];
                struct zebra_vrf *zvrf;
 
@@ -2139,8 +2131,7 @@ void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id)
        route_unlock_node(rn);
 
        /* let's go */
-       RNODE_FOREACH_RE(rn, re)
-       {
+       RNODE_FOREACH_RE (rn, re) {
                zlog_debug("%s: rn %p, re %p: %s, %s", __func__, (void *)rn,
                           (void *)re,
                           (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)
@@ -2185,8 +2176,7 @@ void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id)
         * revalidation
         * of the rest of the RE.
         */
-       RNODE_FOREACH_RE(rn, re)
-       {
+       RNODE_FOREACH_RE (rn, re) {
                if (CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB)
                    && !RIB_SYSTEM_ROUTE(re)) {
                        changed = 1;
@@ -2251,8 +2241,7 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
 
        /* If same type of route are installed, treat it as a implicit
           withdraw. */
-       RNODE_FOREACH_RE(rn, same)
-       {
+       RNODE_FOREACH_RE (rn, same) {
                if (CHECK_FLAG(same->status, ROUTE_ENTRY_REMOVED))
                        continue;
 
@@ -2334,8 +2323,7 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
        }
 
        /* Lookup same type route. */
-       RNODE_FOREACH_RE(rn, re)
-       {
+       RNODE_FOREACH_RE (rn, re) {
                if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
                        continue;
 
@@ -2471,8 +2459,7 @@ int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
 
        /* If same type of route are installed, treat it as a implicit
           withdraw. */
-       RNODE_FOREACH_RE(rn, re)
-       {
+       RNODE_FOREACH_RE (rn, re) {
                if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
                        continue;
 
@@ -2567,8 +2554,7 @@ static void rib_update_table(struct route_table *table,
                         * always
                         * get queued for processing.
                         */
-                       RNODE_FOREACH_RE_SAFE(rn, re, next)
-                       {
+                       RNODE_FOREACH_RE_SAFE (rn, re, next) {
                                struct nexthop *nh;
 
                                if (re->type != ZEBRA_ROUTE_SYSTEM &&
@@ -2636,8 +2622,7 @@ static void rib_weed_table(struct route_table *table)
 
        if (table)
                for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
-                       RNODE_FOREACH_RE_SAFE(rn, re, next)
-                       {
+                       RNODE_FOREACH_RE_SAFE (rn, re, next) {
                                if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
                                        continue;
 
@@ -2653,11 +2638,11 @@ void rib_weed_tables(void)
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       if ((zvrf = vrf->info) != NULL) {
-               rib_weed_table(zvrf->table[AFI_IP][SAFI_UNICAST]);
-               rib_weed_table(zvrf->table[AFI_IP6][SAFI_UNICAST]);
-       }
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
+               if ((zvrf = vrf->info) != NULL) {
+                       rib_weed_table(zvrf->table[AFI_IP][SAFI_UNICAST]);
+                       rib_weed_table(zvrf->table[AFI_IP6][SAFI_UNICAST]);
+               }
 }
 
 /* Delete self installed routes after zebra is relaunched.  */
@@ -2673,8 +2658,7 @@ static void rib_sweep_table(struct route_table *table)
                return;
 
        for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) {
-               RNODE_FOREACH_RE_SAFE(rn, re, next)
-               {
+               RNODE_FOREACH_RE_SAFE (rn, re, next) {
                        if (IS_ZEBRA_DEBUG_RIB)
                                route_entry_dump(&rn->p, NULL, re);
 
@@ -2718,7 +2702,7 @@ void rib_sweep_route(void)
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id) {
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
                if ((zvrf = vrf->info) == NULL)
                        continue;
 
@@ -2738,8 +2722,7 @@ static unsigned long rib_score_proto_table(u_char proto, u_short instance,
 
        if (table)
                for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
-                       RNODE_FOREACH_RE_SAFE(rn, re, next)
-                       {
+                       RNODE_FOREACH_RE_SAFE (rn, re, next) {
                                if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
                                        continue;
                                if (re->type == proto
@@ -2758,13 +2741,14 @@ unsigned long rib_score_proto(u_char proto, u_short instance)
        struct zebra_vrf *zvrf;
        unsigned long cnt = 0;
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       if ((zvrf = vrf->info) != NULL)
-               cnt += rib_score_proto_table(proto, instance,
-                                            zvrf->table[AFI_IP][SAFI_UNICAST])
-                      + rib_score_proto_table(
-                                proto, instance,
-                                zvrf->table[AFI_IP6][SAFI_UNICAST]);
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
+               if ((zvrf = vrf->info) != NULL)
+                       cnt += rib_score_proto_table(
+                                      proto, instance,
+                                      zvrf->table[AFI_IP][SAFI_UNICAST])
+                              + rib_score_proto_table(
+                                        proto, instance,
+                                        zvrf->table[AFI_IP6][SAFI_UNICAST]);
 
        return cnt;
 }
@@ -2782,10 +2766,8 @@ void rib_close_table(struct route_table *table)
        info = table->info;
 
        for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
-               RNODE_FOREACH_RE(rn, re)
-               {
-                       if (!CHECK_FLAG(re->status,
-                                       ROUTE_ENTRY_SELECTED_FIB))
+               RNODE_FOREACH_RE (rn, re) {
+                       if (!CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
                                continue;
 
                        if (info->safi == SAFI_UNICAST)
index 77cfa9860fc48bda68c6be9ad4cbc5a22e3317e0..4bc9caca5d0768060101e57becd03a4e565a332c 100644 (file)
@@ -405,8 +405,7 @@ static struct route_entry *zebra_rnh_resolve_entry(vrf_id_t vrfid, int family,
                re = NULL;
        else {
                /* Identify appropriate route entry. */
-               RNODE_FOREACH_RE(rn, re)
-               {
+               RNODE_FOREACH_RE (rn, re) {
                        if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
                                continue;
                        if (!CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
@@ -578,8 +577,7 @@ static void zebra_rnh_process_static_routes(vrf_id_t vrfid, int family,
        /* Evaluate each static route associated with this nexthop. */
        for (ALL_LIST_ELEMENTS_RO(rnh->zebra_static_route_list, node,
                                  static_rn)) {
-               RNODE_FOREACH_RE(static_rn, sre)
-               {
+               RNODE_FOREACH_RE (static_rn, sre) {
                        if (sre->type != ZEBRA_ROUTE_STATIC)
                                continue;
 
index 0fa616bef9b2ec75193b6b8e1cd9fa0703fb6280..dd0189666e8ae2d94de77bbfd93f29d993acbd3c 100644 (file)
@@ -354,8 +354,7 @@ DEFUN (set_src,
                return CMD_WARNING_CONFIG_FAILED;
        }
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       {
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
                if (family == AF_INET)
                        pif = if_lookup_exact_address((void *)&src.ipv4,
                                                      AF_INET, vrf->vrf_id);
index 9ac24c53ed572d5312e89f7e9819ec6955f44916..48218effd1090283aea0c2fd96db4827e7f68494 100644 (file)
@@ -155,7 +155,7 @@ static u_char *ipFwNumber(struct variable *v, oid objid[], size_t *objid_len,
        /* Return number of routing entries. */
        result = 0;
        for (rn = route_top(table); rn; rn = route_next(rn))
-               RNODE_FOREACH_RE(rn, re) {
+               RNODE_FOREACH_RE (rn, re) {
                        result++;
                }
 
@@ -183,7 +183,7 @@ static u_char *ipCidrNumber(struct variable *v, oid objid[], size_t *objid_len,
        /* Return number of routing entries. */
        result = 0;
        for (rn = route_top(table); rn; rn = route_next(rn))
-               RNODE_FOREACH_RE(rn, re) {
+               RNODE_FOREACH_RE (rn, re) {
                        result++;
                }
 
@@ -369,8 +369,7 @@ static void get_fwtable_route_node(struct variable *v, oid objid[],
                        return;
                for (*np = route_top(table); *np; *np = route_next(*np)) {
                        if (!in_addr_cmp(&(*np)->p.u.prefix, (u_char *)&dest)) {
-                               RNODE_FOREACH_RE(*np, *re)
-                               {
+                               RNODE_FOREACH_RE (*np, *re) {
                                        if (!in_addr_cmp((u_char *)&(*re)
                                                                 ->nexthop->gate
                                                                 .ipv4,
@@ -390,14 +389,13 @@ static void get_fwtable_route_node(struct variable *v, oid objid[],
 
                /* Check destination first */
                if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest) > 0)
-                       RNODE_FOREACH_RE(np2, re2) {
+                       RNODE_FOREACH_RE (np2, re2) {
                                check_replace(np2, re2, np, re);
                        }
 
                if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest)
                    == 0) { /* have to look at each re individually */
-                       RNODE_FOREACH_RE(np2, re2)
-                       {
+                       RNODE_FOREACH_RE (np2, re2) {
                                int proto2, policy2;
 
                                proto2 = proto_trans(re2->type);
index 658f060fff39d16a241b7cdffa2869341de7bcd3..836a2aa6a572e04a439fec1babbe456b857939a6 100644 (file)
@@ -67,8 +67,7 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p,
 
        /* Lookup existing route */
        rn = srcdest_rnode_get(table, p, src_p);
-       RNODE_FOREACH_RE(rn, re)
-       {
+       RNODE_FOREACH_RE (rn, re) {
                if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
                        continue;
 
@@ -281,8 +280,7 @@ void static_uninstall_route(afi_t afi, safi_t safi, struct prefix *p,
        if (!rn)
                return;
 
-       RNODE_FOREACH_RE(rn, re)
-       {
+       RNODE_FOREACH_RE (rn, re) {
                if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
                        continue;
 
index 62c7d020bc2a239adb6d2dad514ec47133bcf45f..bf8a17c3ef1b1ebc0b3d080d9acc143a558a3aea 100644 (file)
@@ -70,8 +70,7 @@ void zebra_vrf_update_all(struct zserv *client)
 {
        struct vrf *vrf;
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       {
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
                if (vrf->vrf_id)
                        zsend_vrf_add(client, vrf_info_lookup(vrf->vrf_id));
        }
@@ -290,7 +289,7 @@ static void zebra_rtable_node_cleanup(struct route_table *table,
 {
        struct route_entry *re, *next;
 
-       RNODE_FOREACH_RE_SAFE(node, re, next) {
+       RNODE_FOREACH_RE_SAFE (node, re, next) {
                rib_unlink(node, re);
        }
 
@@ -468,8 +467,7 @@ static int vrf_config_write(struct vty *vty)
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                zvrf = vrf->info;
 
                if (!zvrf)
index 1ce4f66b16387e169109936755a0d12cdd322050..df1eef119ac8dc44adc71adff2e367dcb248fa29 100644 (file)
@@ -378,8 +378,7 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
        char buf[SRCDEST2STR_BUFFER];
        struct zebra_vrf *zvrf;
 
-       RNODE_FOREACH_RE(rn, re)
-       {
+       RNODE_FOREACH_RE (rn, re) {
                const char *mcast_info = "";
                if (mcast) {
                        rib_table_info_t *info = srcdest_rnode_table_info(rn);
@@ -926,8 +925,7 @@ static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi,
 
        /* Show all routes. */
        for (rn = route_top(table); rn; rn = route_next(rn)) {
-               RNODE_FOREACH_RE(rn, re)
-               {
+               RNODE_FOREACH_RE (rn, re) {
                        if (use_fib
                            && !CHECK_FLAG(re->status,
                                           ROUTE_ENTRY_SELECTED_FIB))
@@ -1031,12 +1029,12 @@ DEFUN (show_ip_nht_vrf_all,
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       if ((zvrf = vrf->info) != NULL) {
-               vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
-               zebra_print_rnh_table(zvrf_id(zvrf), AF_INET, vty,
-                                     RNH_NEXTHOP_TYPE);
-       }
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+               if ((zvrf = vrf->info) != NULL) {
+                       vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
+                       zebra_print_rnh_table(zvrf_id(zvrf), AF_INET, vty,
+                                             RNH_NEXTHOP_TYPE);
+               }
 
        return CMD_SUCCESS;
 }
@@ -1071,12 +1069,12 @@ DEFUN (show_ipv6_nht_vrf_all,
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       if ((zvrf = vrf->info) != NULL) {
-               vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
-               zebra_print_rnh_table(zvrf_id(zvrf), AF_INET6, vty,
-                                     RNH_NEXTHOP_TYPE);
-       }
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+               if ((zvrf = vrf->info) != NULL) {
+                       vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
+                       zebra_print_rnh_table(zvrf_id(zvrf), AF_INET6, vty,
+                                             RNH_NEXTHOP_TYPE);
+               }
 
        return CMD_SUCCESS;
 }
@@ -1235,8 +1233,7 @@ DEFUN (show_ip_route,
        }
 
        if (vrf_all) {
-               RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-               {
+               RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                        if ((zvrf = vrf->info) == NULL
                            || (table = zvrf->table[AFI_IP][SAFI_UNICAST])
                                       == NULL)
@@ -1360,8 +1357,7 @@ static void vty_show_ip_route_summary(struct vty *vty,
        memset(&rib_cnt, 0, sizeof(rib_cnt));
        memset(&fib_cnt, 0, sizeof(fib_cnt));
        for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
-               RNODE_FOREACH_RE(rn, re)
-               {
+               RNODE_FOREACH_RE (rn, re) {
                        is_ibgp = (re->type == ZEBRA_ROUTE_BGP
                                   && CHECK_FLAG(re->flags, ZEBRA_FLAG_IBGP));
 
@@ -1430,8 +1426,7 @@ static void vty_show_ip_route_summary_prefix(struct vty *vty,
        memset(&rib_cnt, 0, sizeof(rib_cnt));
        memset(&fib_cnt, 0, sizeof(fib_cnt));
        for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
-               RNODE_FOREACH_RE(rn, re)
-               {
+               RNODE_FOREACH_RE (rn, re) {
 
                        /*
                         * In case of ECMP, count only once.
@@ -1560,8 +1555,7 @@ DEFUN (show_ip_route_vrf_all_addr,
                return CMD_WARNING;
        }
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if ((zvrf = vrf->info) == NULL
                    || (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
                        continue;
@@ -1601,8 +1595,7 @@ DEFUN (show_ip_route_vrf_all_prefix,
                return CMD_WARNING;
        }
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if ((zvrf = vrf->info) == NULL
                    || (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
                        continue;
@@ -1635,10 +1628,10 @@ DEFUN (show_ip_route_vrf_all_summary,
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       if ((zvrf = vrf->info) != NULL)
-               vty_show_ip_route_summary(vty,
-                                         zvrf->table[AFI_IP][SAFI_UNICAST]);
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+               if ((zvrf = vrf->info) != NULL)
+                       vty_show_ip_route_summary(
+                               vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
 
        return CMD_SUCCESS;
 }
@@ -1656,10 +1649,10 @@ DEFUN (show_ip_route_vrf_all_summary_prefix,
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       if ((zvrf = vrf->info) != NULL)
-               vty_show_ip_route_summary_prefix(
-                       vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+               if ((zvrf = vrf->info) != NULL)
+                       vty_show_ip_route_summary_prefix(
+                               vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
 
        return CMD_SUCCESS;
 }
@@ -1676,8 +1669,7 @@ static int static_config(struct vty *vty, afi_t afi, safi_t safi,
        char buf[SRCDEST2STR_BUFFER];
        int write = 0;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (!(zvrf = vrf->info))
                        continue;
                if ((stable = zvrf->stable[afi][safi]) == NULL)
@@ -1874,8 +1866,7 @@ DEFUN (show_ipv6_route,
        }
 
        if (vrf_all) {
-               RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-               {
+               RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                        if ((zvrf = vrf->info) == NULL
                            || (table = zvrf->table[AFI_IP6][SAFI_UNICAST])
                                       == NULL)
@@ -2063,8 +2054,7 @@ DEFUN (show_ipv6_mroute,
 
        /* Show all IPv6 route. */
        for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
-               RNODE_FOREACH_RE(rn, re)
-               {
+               RNODE_FOREACH_RE (rn, re) {
                        if (first) {
                                vty_out(vty, SHOW_ROUTE_V6_HEADER);
                                first = 0;
@@ -2097,8 +2087,7 @@ DEFUN (show_ipv6_route_vrf_all_addr,
                return CMD_WARNING;
        }
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if ((zvrf = vrf->info) == NULL
                    || (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
                        continue;
@@ -2138,8 +2127,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix,
                return CMD_WARNING;
        }
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if ((zvrf = vrf->info) == NULL
                    || (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
                        continue;
@@ -2172,10 +2160,10 @@ DEFUN (show_ipv6_route_vrf_all_summary,
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       if ((zvrf = vrf->info) != NULL)
-               vty_show_ip_route_summary(vty,
-                                         zvrf->table[AFI_IP6][SAFI_UNICAST]);
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+               if ((zvrf = vrf->info) != NULL)
+                       vty_show_ip_route_summary(
+                               vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
 
        return CMD_SUCCESS;
 }
@@ -2195,16 +2183,14 @@ DEFUN (show_ipv6_mroute_vrf_all,
        struct zebra_vrf *zvrf;
        int first = 1;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if ((zvrf = vrf->info) == NULL
                    || (table = zvrf->table[AFI_IP6][SAFI_MULTICAST]) == NULL)
                        continue;
 
                /* Show all IPv6 route. */
                for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
-                       RNODE_FOREACH_RE(rn, re)
-                       {
+                       RNODE_FOREACH_RE (rn, re) {
                                if (first) {
                                        vty_out(vty, SHOW_ROUTE_V6_HEADER);
                                        first = 0;
@@ -2228,10 +2214,10 @@ DEFUN (show_ipv6_route_vrf_all_summary_prefix,
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       if ((zvrf = vrf->info) != NULL)
-               vty_show_ip_route_summary_prefix(
-                       vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+               if ((zvrf = vrf->info) != NULL)
+                       vty_show_ip_route_summary_prefix(
+                               vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
 
        return CMD_SUCCESS;
 }
@@ -2267,8 +2253,7 @@ DEFUN (show_vrf,
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                if (!(zvrf = vrf->info))
                        continue;
                if (!zvrf_id(zvrf))
index 61a75e156ce4657ada7deabceed12bd16d55c552..55d006a035758ab8e9018e9e7e38532c2cb5ece7 100644 (file)
@@ -1004,8 +1004,7 @@ static int zread_interface_add(struct zserv *client, u_short length,
        /* Interface information is needed. */
        vrf_bitmap_set(client->ifinfo, zvrf_id(zvrf));
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       {
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
                for (ALL_LIST_ELEMENTS(vrf->iflist, ifnode, ifnnode, ifp)) {
                        /* Skip pseudo interface. */
                        if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE))
@@ -2084,8 +2083,7 @@ static void zebra_client_close_cleanup_rnh(struct zserv *client)
        struct vrf *vrf;
        struct zebra_vrf *zvrf;
 
-       RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
-       {
+       RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
                if ((zvrf = vrf->info) != NULL) {
                        zebra_cleanup_rnh_client(zvrf_id(zvrf), AF_INET, client,
                                                 RNH_NEXTHOP_TYPE);
@@ -2832,8 +2830,7 @@ DEFUN (show_zebra,
                "                            Route      Route      Neighbor   LSP        LSP\n");
        vty_out(vty,
                "VRF                         Installs   Removals    Updates   Installs   Removals\n");
-       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
-       {
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
                struct zebra_vrf *zvrf = vrf->info;
                vty_out(vty, "%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64
                             " %10" PRIu64 " %10" PRIu64 "\n",