summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-09-15 17:47:35 +0200
committerRenato Westphal <renato@opensourcerouting.org>2017-09-15 19:53:46 +0200
commita2addae8fe172f04f4d8ac99aa123a7d2dd64604 (patch)
treec58663b6654a9bec64ac4c26e11d158fd48b34ad
parentMerge pull request #1178 from donaldsharp/pim_obfuscation (diff)
downloadfrr-a2addae8fe172f04f4d8ac99aa123a7d2dd64604.tar.xz
frr-a2addae8fe172f04f4d8ac99aa123a7d2dd64604.zip
*: use clang's 'ForEachMacros' format style option
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>
-rw-r--r--.clang-format32
-rw-r--r--bgpd/bgp_advertise.c34
-rw-r--r--bgpd/bgp_nht.c3
-rw-r--r--bgpd/bgp_route.c117
-rw-r--r--bgpd/bgp_updgrp.c52
-rw-r--r--bgpd/bgp_updgrp_adv.c21
-rw-r--r--bgpd/bgp_updgrp_packet.c3
-rw-r--r--bgpd/bgpd.c7
-rw-r--r--isisd/isis_tlvs.c12
-rw-r--r--lib/if.c17
-rw-r--r--lib/ns.c3
-rw-r--r--lib/vrf.c3
-rw-r--r--lib/workqueue.c2
-rw-r--r--pimd/pim_bfd.c2
-rw-r--r--pimd/pim_cmd.c67
-rw-r--r--pimd/pim_iface.c17
-rw-r--r--pimd/pim_ifchannel.c8
-rw-r--r--pimd/pim_instance.c3
-rw-r--r--pimd/pim_vty.c3
-rw-r--r--pimd/pim_zebra.c15
-rw-r--r--pimd/pimd.c3
-rw-r--r--tools/start-stop-daemon.c3
-rw-r--r--zebra/interface.c146
-rw-r--r--zebra/irdp_main.c28
-rw-r--r--zebra/main.c3
-rw-r--r--zebra/redistribute.c26
-rw-r--r--zebra/router-id.c28
-rw-r--r--zebra/rt_netlink.c3
-rw-r--r--zebra/rtadv.c67
-rw-r--r--zebra/zebra_fpm.c3
-rw-r--r--zebra/zebra_l2.c3
-rw-r--r--zebra/zebra_mpls.c17
-rw-r--r--zebra/zebra_ptm.c57
-rw-r--r--zebra/zebra_pw.c12
-rw-r--r--zebra/zebra_rib.c84
-rw-r--r--zebra/zebra_rnh.c6
-rw-r--r--zebra/zebra_routemap.c3
-rw-r--r--zebra/zebra_snmp.c12
-rw-r--r--zebra/zebra_static.c6
-rw-r--r--zebra/zebra_vrf.c8
-rw-r--r--zebra/zebra_vty.c101
-rw-r--r--zebra/zserv.c9
42 files changed, 494 insertions, 555 deletions
diff --git a/.clang-format b/.clang-format
index 07f558d92..2710d844e 100644
--- a/.clang-format
+++ b/.clang-format
@@ -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
diff --git a/bgpd/bgp_advertise.c b/bgpd/bgp_advertise.c
index a7f72974c..2c83de89e 100644
--- a/bgpd/bgp_advertise.c
+++ b/bgpd/bgp_advertise.c
@@ -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;
}
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index a0fc10c74..fc44e5e9b 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -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))))
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index fabe4483e..e3f63f11b 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -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)
diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c
index 05395a583..8f6729060 100644
--- a/bgpd/bgp_updgrp.c
+++ b/bgpd/bgp_updgrp.c
@@ -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);
diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index 1bd6fb8b3..fbbeaee9b 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -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);
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c
index 692db32fa..433c5ce51 100644
--- a/bgpd/bgp_updgrp_packet.c
+++ b/bgpd/bgp_updgrp_packet.c
@@ -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);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 0d6004756..54155290d 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -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));
}
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c
index 8efbcd281..25a10e91e 100644
--- a/isisd/isis_tlvs.c
+++ b/isisd/isis_tlvs.c
@@ -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));
}
}
diff --git a/lib/if.c b/lib/if.c
index 43c382bea..7d2722965 100644
--- 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));
}
diff --git a/lib/ns.c b/lib/ns.c
index ba920e31b..fdf93d074 100644
--- 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;
diff --git a/lib/vrf.c b/lib/vrf.c
index 6e70609b7..0a4969dfa 100644
--- 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));
}
diff --git a/lib/workqueue.c b/lib/workqueue.c
index b76b73b36..643ed2d2b 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -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 */
diff --git a/pimd/pim_bfd.c b/pimd/pim_bfd.c
index bba26662b..314162c78 100644
--- a/pimd/pim_bfd.c
+++ b/pimd/pim_bfd.c
@@ -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;
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 4066614f4..1885d5a61 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -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, ", ");
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 6cf18d08e..f0b89396b 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -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++;
}
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index e0d2c78fe..bcf7d2318 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -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)
diff --git a/pimd/pim_instance.c b/pimd/pim_instance.c
index 5a5934294..42feae336 100644
--- a/pimd/pim_instance.c
+++ b/pimd/pim_instance.c
@@ -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)
diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c
index 7607bdf13..3da092541 100644
--- a/pimd/pim_vty.c
+++ b/pimd/pim_vty.c
@@ -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;
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index a1107e242..df70e9dd5 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -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;
diff --git a/pimd/pimd.c b/pimd/pimd.c
index 37c79d455..52e0920f1 100644
--- a/pimd/pimd.c
+++ b/pimd/pimd.c
@@ -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;
diff --git a/tools/start-stop-daemon.c b/tools/start-stop-daemon.c
index 39527eca7..30dc6484a 100644
--- a/tools/start-stop-daemon.c
+++ b/tools/start-stop-daemon.c
@@ -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));
diff --git a/zebra/interface.c b/zebra/interface.c
index 358f940c5..664e493d8 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -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;
}
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index 9dfa85472..bc85e983e 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -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;
}
diff --git a/zebra/main.c b/zebra/main.c
index bc7276817..4864b4961 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -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);
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index 93bfc0c03..76e0df40b 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -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;
}
diff --git a/zebra/router-id.c b/zebra/router-id.c
index 383f21864..f6c88a216 100644
--- a/zebra/router-id.c
+++ b/zebra/router-id.c
@@ -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,
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index e59d5f00f..bf1042a72 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -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;
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 88836af72..6091c75e5 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -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;
}
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 8c0700ac8..6d3a8de8c 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -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;
diff --git a/zebra/zebra_l2.c b/zebra/zebra_l2.c
index 3d505857c..345637c04 100644
--- a/zebra/zebra_l2.c
+++ b/zebra/zebra_l2.c
@@ -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;
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index e3ce41412..3c7319f35 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -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;
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index b18b3e742..a42e6680e 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -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)
diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c
index ce9f19c3c..0ca7e34b2 100644
--- a/zebra/zebra_pw.c
+++ b/zebra/zebra_pw.c
@@ -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)
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index d04b64b19..b1c2ae25c 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -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)
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index 77cfa9860..4bc9caca5 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -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;
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 0fa616bef..dd0189666 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -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);
diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c
index 9ac24c53e..48218effd 100644
--- a/zebra/zebra_snmp.c
+++ b/zebra/zebra_snmp.c
@@ -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);
diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c
index 658f060ff..836a2aa6a 100644
--- a/zebra/zebra_static.c
+++ b/zebra/zebra_static.c
@@ -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;
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index 62c7d020b..bf8a17c3e 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -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)
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 1ce4f66b1..df1eef119 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -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))
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 61a75e156..55d006a03 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -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",