Merge pull request #1188 from opensourcerouting/foreach_indentation

*: use clang's 'ForEachMacros' format style option
This commit is contained in:
Quentin Young 2017-09-17 19:23:16 -04:00 committed by GitHub
commit a7dd519b58
42 changed files with 487 additions and 548 deletions

View file

@ -23,3 +23,35 @@ IncludeCategories:
Priority: 0 Priority: 0
CommentPragmas: '\$(FRR|clippy)' CommentPragmas: '\$(FRR|clippy)'
ContinuationIndentWidth: 8 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

View file

@ -155,22 +155,24 @@ int bgp_adj_out_lookup(struct peer *peer, struct bgp_node *rn,
int addpath_capable; int addpath_capable;
for (adj = rn->adj_out; adj; adj = adj->next) for (adj = rn->adj_out; adj; adj = adj->next)
SUBGRP_FOREACH_PEER(adj->subgroup, paf) SUBGRP_FOREACH_PEER (adj->subgroup, paf)
if (paf->peer == peer) { if (paf->peer == peer) {
afi = SUBGRP_AFI(adj->subgroup); afi = SUBGRP_AFI(adj->subgroup);
safi = SUBGRP_SAFI(adj->subgroup); safi = SUBGRP_SAFI(adj->subgroup);
addpath_capable = bgp_addpath_encode_tx(peer, afi, safi); addpath_capable =
bgp_addpath_encode_tx(peer, afi, safi);
/* Match on a specific addpath_tx_id if we are using addpath for /* Match on a specific addpath_tx_id if we are
* this * using addpath for
* peer and if an addpath_tx_id was specified */ * this
if (addpath_capable && addpath_tx_id * peer and if an addpath_tx_id was specified */
&& adj->addpath_tx_id != addpath_tx_id) if (addpath_capable && addpath_tx_id
continue; && adj->addpath_tx_id != addpath_tx_id)
continue;
return (adj->adv ? (adj->adv->baa ? 1 : 0) return (adj->adv ? (adj->adv->baa ? 1 : 0)
: (adj->attr ? 1 : 0)); : (adj->attr ? 1 : 0));
} }
return 0; return 0;
} }

View file

@ -687,8 +687,7 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
buf, bnc->flags, bnc->change_flags); 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 if (!(path->type == ZEBRA_ROUTE_BGP
&& ((path->sub_type == BGP_ROUTE_NORMAL) && ((path->sub_type == BGP_ROUTE_NORMAL)
|| (path->sub_type == BGP_ROUTE_STATIC)))) || (path->sub_type == BGP_ROUTE_STATIC))))

View file

@ -1710,8 +1710,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
* Note: 3rd party nexthop currently implemented for * Note: 3rd party nexthop currently implemented for
* IPv4 only. * IPv4 only.
*/ */
SUBGRP_FOREACH_PEER(subgrp, paf) SUBGRP_FOREACH_PEER (subgrp, paf) {
{
if (bgp_multiaccess_check_v4(riattr->nexthop, if (bgp_multiaccess_check_v4(riattr->nexthop,
paf->peer)) paf->peer))
break; break;
@ -10110,60 +10109,70 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
} }
} else { } else {
for (adj = rn->adj_out; adj; adj = adj->next) for (adj = rn->adj_out; adj; adj = adj->next)
SUBGRP_FOREACH_PEER(adj->subgroup, paf) SUBGRP_FOREACH_PEER (adj->subgroup, paf)
if (paf->peer == peer) { if (paf->peer == peer) {
if (header1) { if (header1) {
if (use_json) { if (use_json) {
json_object_int_add( json_object_int_add(
json, "bgpTableVersion", json,
table->version); "bgpTableVersion",
json_object_string_add( table->version);
json, json_object_string_add(
"bgpLocalRouterId", json,
inet_ntoa( "bgpLocalRouterId",
bgp->router_id)); inet_ntoa(
json_object_object_add( bgp->router_id));
json, "bgpStatusCodes", json_object_object_add(
json_scode); json,
json_object_object_add( "bgpStatusCodes",
json, "bgpOriginCodes", json_scode);
json_ocode); json_object_object_add(
} else { json,
vty_out(vty, "bgpOriginCodes",
"BGP table version is %" PRIu64 json_ocode);
", local router ID is %s\n", } else {
table->version, vty_out(vty,
inet_ntoa( "BGP table version is %" PRIu64
bgp->router_id)); ", local router ID is %s\n",
vty_out(vty, table->version,
BGP_SHOW_SCODE_HEADER); inet_ntoa(
vty_out(vty, bgp->router_id));
BGP_SHOW_OCODE_HEADER); 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 (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++;
}
} }
header1 = 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 (use_json) if (use_json)

View file

@ -549,8 +549,7 @@ static int update_group_show_walkcb(struct update_group *updgrp, void *arg)
return CMD_SUCCESS; return CMD_SUCCESS;
if (ctx->subgrp_id) { if (ctx->subgrp_id) {
UPDGRP_FOREACH_SUBGRP(updgrp, subgrp) UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
{
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id)) if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
continue; continue;
else { else {
@ -591,8 +590,7 @@ static int update_group_show_walkcb(struct update_group *updgrp, void *arg)
? " replace-as" ? " replace-as"
: ""); : "");
UPDGRP_FOREACH_SUBGRP(updgrp, subgrp) UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
{
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id)) if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
continue; continue;
vty_out(vty, "\n"); 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) { if (subgrp->peer_count > 0) {
vty_out(vty, " Peers:\n"); vty_out(vty, " Peers:\n");
SUBGRP_FOREACH_PEER(subgrp, paf) SUBGRP_FOREACH_PEER (subgrp, paf)
vty_out(vty, " - %s\n", paf->peer->host); vty_out(vty, " - %s\n", paf->peer->host);
} }
} }
return UPDWALK_CONTINUE; return UPDWALK_CONTINUE;
@ -655,8 +653,7 @@ static int updgrp_show_packet_queue_walkcb(struct update_group *updgrp,
struct vty *vty; struct vty *vty;
vty = ctx->vty; vty = ctx->vty;
UPDGRP_FOREACH_SUBGRP(updgrp, subgrp) UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
{
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id)) if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
continue; continue;
vty_out(vty, "update group %" PRIu64 ", subgroup %" PRIu64 "\n", 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))) if (!peer_established(PAF_PEER(paf)))
return NULL; return NULL;
UPDGRP_FOREACH_SUBGRP(updgrp, subgrp) UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
{
if (subgrp->version != version if (subgrp->version != version
|| CHECK_FLAG(subgrp->sflags, || CHECK_FLAG(subgrp->sflags,
SUBGRP_STATUS_DEFAULT_ORIGINATE)) SUBGRP_STATUS_DEFAULT_ORIGINATE))
@ -1109,8 +1105,7 @@ int update_subgroup_check_merge(struct update_subgroup *subgrp,
/* /*
* Look for a subgroup to merge into. * 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)) if (update_subgroup_can_merge_into(subgrp, target))
break; break;
} }
@ -1177,8 +1172,7 @@ static void update_subgroup_copy_adj_out(struct update_subgroup *source,
{ {
struct bgp_adj_out *aout, *aout_copy; struct bgp_adj_out *aout, *aout_copy;
SUBGRP_FOREACH_ADJ(source, aout) SUBGRP_FOREACH_ADJ (source, aout) {
{
/* /*
* Copy the adj out. * Copy the adj out.
*/ */
@ -1361,15 +1355,13 @@ static int updgrp_policy_update_walkcb(struct update_group *updgrp, void *arg)
* refresh. * refresh.
*/ */
if (ctx->policy_event_start_flag) { if (ctx->policy_event_start_flag) {
UPDGRP_FOREACH_SUBGRP(updgrp, subgrp) UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
{
update_subgroup_set_needs_refresh(subgrp, 1); update_subgroup_set_needs_refresh(subgrp, 1);
} }
return UPDWALK_CONTINUE; return UPDWALK_CONTINUE;
} }
UPDGRP_FOREACH_SUBGRP(updgrp, subgrp) UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
{
if (changed) { if (changed) {
if (bgp_debug_update(NULL, NULL, updgrp, 0)) if (bgp_debug_update(NULL, NULL, updgrp, 0))
zlog_debug( zlog_debug(
@ -1408,8 +1400,8 @@ static int update_group_periodic_merge_walkcb(struct update_group *updgrp,
struct update_subgroup *tmp_subgrp; struct update_subgroup *tmp_subgrp;
const char *reason = arg; const char *reason = arg;
UPDGRP_FOREACH_SUBGRP_SAFE(updgrp, subgrp, tmp_subgrp) UPDGRP_FOREACH_SUBGRP_SAFE (updgrp, subgrp, tmp_subgrp)
update_subgroup_check_merge(subgrp, reason); update_subgroup_check_merge(subgrp, reason);
return UPDWALK_CONTINUE; return UPDWALK_CONTINUE;
} }
@ -1550,7 +1542,7 @@ void update_bgp_group_init(struct bgp *bgp)
{ {
int afid; int afid;
AF_FOREACH(afid) AF_FOREACH (afid)
bgp->update_groups[afid] = bgp->update_groups[afid] =
hash_create(updgrp_hash_key_make, hash_create(updgrp_hash_key_make,
updgrp_hash_cmp, updgrp_hash_cmp,
@ -1561,8 +1553,7 @@ void update_bgp_group_free(struct bgp *bgp)
{ {
int afid; int afid;
AF_FOREACH(afid) AF_FOREACH (afid) {
{
if (bgp->update_groups[afid]) { if (bgp->update_groups[afid]) {
hash_free(bgp->update_groups[afid]); hash_free(bgp->update_groups[afid]);
bgp->update_groups[afid] = NULL; bgp->update_groups[afid] = NULL;
@ -1740,8 +1731,7 @@ void update_group_walk(struct bgp *bgp, updgrp_walkcb cb, void *ctx)
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
FOREACH_AFI_SAFI(afi, safi) FOREACH_AFI_SAFI (afi, safi) {
{
update_group_af_walk(bgp, afi, safi, cb, ctx); 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; afi_t afi;
safi_t safi; safi_t safi;
UPDGRP_FOREACH_SUBGRP(updgrp, subgrp) UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
{
peer = SUBGRP_PEER(subgrp); peer = SUBGRP_PEER(subgrp);
afi = SUBGRP_AFI(subgrp); afi = SUBGRP_AFI(subgrp);
safi = SUBGRP_SAFI(subgrp); safi = SUBGRP_SAFI(subgrp);
@ -1824,8 +1813,7 @@ void peer_af_announce_route(struct peer_af *paf, int combine)
*/ */
all_pending = 1; all_pending = 1;
SUBGRP_FOREACH_PEER(subgrp, cur_paf) SUBGRP_FOREACH_PEER (subgrp, cur_paf) {
{
if (cur_paf == paf) if (cur_paf == paf)
continue; 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. * 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) if (cur_paf == paf)
continue; continue;
@ -1889,8 +1876,7 @@ void subgroup_trigger_write(struct update_subgroup *subgrp)
zlog_debug("u%llu:s%llu scheduling write thread for peers", zlog_debug("u%llu:s%llu scheduling write thread for peers",
subgrp->update_group->id, subgrp->id); subgrp->update_group->id, subgrp->id);
#endif #endif
SUBGRP_FOREACH_PEER(subgrp, paf) SUBGRP_FOREACH_PEER (subgrp, paf) {
{
if (paf->peer->status == Established) { if (paf->peer->status == Established) {
BGP_PEER_WRITE_ON(paf->peer->t_write, bgp_write, BGP_PEER_WRITE_ON(paf->peer->t_write, bgp_write,
paf->peer->fd, paf->peer); paf->peer->fd, paf->peer);

View file

@ -113,8 +113,7 @@ static int group_announce_route_walkcb(struct update_group *updgrp, void *arg)
peer = UPDGRP_PEER(updgrp); peer = UPDGRP_PEER(updgrp);
addpath_capable = bgp_addpath_encode_tx(peer, afi, safi); 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 * 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; struct vty *vty;
vty = ctx->vty; vty = ctx->vty;
UPDGRP_FOREACH_SUBGRP(updgrp, subgrp) UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
{
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id)) if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
continue; continue;
vty_out(vty, "update group %" PRIu64 ", subgroup %" PRIu64 "\n", 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_af *paf;
struct peer *peer; struct peer *peer;
SUBGRP_FOREACH_PEER(subgrp, paf) SUBGRP_FOREACH_PEER (subgrp, paf) {
{
peer = PAF_PEER(paf); peer = PAF_PEER(paf);
BGP_TIMER_OFF(peer->t_routeadv); BGP_TIMER_OFF(peer->t_routeadv);
BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0); 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; struct update_subgroup *subgrp;
UPDGRP_FOREACH_SUBGRP(updgrp, subgrp) UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
{
subgroup_announce_all(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 */ /* Only announce if this is a group of route-reflector-clients */
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) { 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); 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)) { if (BGP_ADV_FIFO_EMPTY(&subgrp->sync->update)) {
struct peer_af *paf; struct peer_af *paf;
SUBGRP_FOREACH_PEER(subgrp, paf) SUBGRP_FOREACH_PEER (subgrp, paf) {
{
bgp_adjust_routeadv(PAF_PEER(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; 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; struct bgp_node *rn = aout->rn;
bgp_adj_out_remove_subgroup(rn, aout, subgrp); bgp_adj_out_remove_subgroup(rn, aout, subgrp);
bgp_unlock_node(rn); bgp_unlock_node(rn);

View 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, vty_out(vty, " Packet %p ver %u buffer %p\n", pkt, pkt->ver,
pkt->buffer); pkt->buffer);
LIST_FOREACH(paf, &(pkt->peers), pkt_train) LIST_FOREACH (paf, &(pkt->peers), pkt_train) {
{
vty_out(vty, " - %s\n", paf->peer->host); vty_out(vty, " - %s\n", paf->peer->host);
} }
pkt = bpacket_next(pkt); pkt = bpacket_next(pkt);

View file

@ -2078,8 +2078,8 @@ int peer_delete(struct peer *peer)
} }
} }
FOREACH_AFI_SAFI(afi, safi) FOREACH_AFI_SAFI (afi, safi)
peer_af_delete(peer, afi, safi); peer_af_delete(peer, afi, safi);
if (peer->hostname) { if (peer->hostname) {
XFREE(MTYPE_BGP_PEER_HOST, 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 listnode *next;
struct bgp *bgp; 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) if (vrf->vrf_id != VRF_DEFAULT)
vector_set(comps, XSTRDUP(MTYPE_COMPLETION, vrf->name)); vector_set(comps, XSTRDUP(MTYPE_COMPLETION, vrf->name));
} }

View file

@ -1921,8 +1921,7 @@ static void free_mt_items(enum isis_tlv_context context,
{ {
struct isis_item_list *n, *nnext; 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); free_items(context, type, n);
RB_REMOVE(isis_mt_item_list, m, n); RB_REMOVE(isis_mt_item_list, m, n);
XFREE(MTYPE_ISIS_MT_ITEM_LIST, 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; 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); 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; struct isis_item_list *n;
RB_FOREACH(n, isis_mt_item_list, m) RB_FOREACH (n, isis_mt_item_list, m) {
{
int rv; int rv;
rv = pack_items_(n->mtid, context, type, n, s, fragment_tlvs, 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_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)); copy_items(context, type, n, isis_get_mt_items(dest, n->mtid));
} }
} }

View file

@ -249,8 +249,7 @@ struct interface *if_lookup_by_name_all_vrf(const char *name)
struct vrf *vrf; struct vrf *vrf;
struct interface *ifp; 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); ifp = if_lookup_by_name(name, vrf->vrf_id);
if (ifp) if (ifp)
return ifp; return ifp;
@ -386,8 +385,7 @@ struct interface *if_get_by_name_len(const char *name, size_t namelen,
return ifp; return ifp;
/* Didn't find the interface on that vrf. Defined on a different one? */ /* 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)) { for (ALL_LIST_ELEMENTS_RO(vrf_iflist(vrf->vrf_id), node, ifp)) {
if (!memcmp(name, ifp->name, namelen) if (!memcmp(name, ifp->name, namelen)
&& (ifp->name[namelen] == '\0')) { && (ifp->name[namelen] == '\0')) {
@ -541,10 +539,10 @@ void if_dump_all(void)
struct listnode *node; struct listnode *node;
void *p; void *p;
RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id) RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
if (vrf->iflist != NULL) if (vrf->iflist != NULL)
for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, p)) for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, p))
if_dump(p); if_dump(p);
} }
DEFUN (interface_desc, DEFUN (interface_desc,
@ -1053,8 +1051,7 @@ static void if_autocomplete(vector comps, struct cmd_token *token)
struct listnode *ln; struct listnode *ln;
struct vrf *vrf = NULL; 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)) for (ALL_LIST_ELEMENTS_RO(vrf->iflist, ln, ifp))
vector_set(comps, XSTRDUP(MTYPE_COMPLETION, ifp->name)); vector_set(comps, XSTRDUP(MTYPE_COMPLETION, ifp->name));
} }

View file

@ -378,8 +378,7 @@ static int ns_config_write(struct vty *vty)
struct ns *ns; struct ns *ns;
int write = 0; 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) if (ns->ns_id == NS_DEFAULT || ns->name == NULL)
continue; continue;

View file

@ -356,8 +356,7 @@ static void vrf_autocomplete(vector comps, struct cmd_token *token)
{ {
struct vrf *vrf = NULL; 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) if (vrf->vrf_id != 0)
vector_set(comps, XSTRDUP(MTYPE_COMPLETION, vrf->name)); vector_set(comps, XSTRDUP(MTYPE_COMPLETION, vrf->name));
} }

View file

@ -258,7 +258,7 @@ int work_queue_run(struct thread *thread)
if (wq->cycles.granularity == 0) if (wq->cycles.granularity == 0)
wq->cycles.granularity = WORK_QUEUE_MIN_GRANULARITY; 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); assert(item && item->data);
/* dont run items which are past their allowed retries */ /* dont run items which are past their allowed retries */

View file

@ -300,7 +300,7 @@ static int pim_bfd_nbr_replay(int command, struct zclient *zclient,
/* Send the client registration */ /* Send the client registration */
bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); 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)) { for (ALL_LIST_ELEMENTS_RO(vrf_iflist(vrf->vrf_id), node, ifp)) {
pim_ifp = ifp->info; pim_ifp = ifp->info;

View file

@ -228,7 +228,7 @@ static void pim_show_assert(struct pim_instance *pim, struct vty *vty)
if (!pim_ifp) if (!pim_ifp)
continue; 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); pim_show_assert_helper(vty, pim_ifp, ch, now);
} /* scan interface channels */ } /* scan interface channels */
} }
@ -280,7 +280,7 @@ static void pim_show_assert_internal(struct pim_instance *pim, struct vty *vty)
if (!pim_ifp) if (!pim_ifp)
continue; 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); pim_show_assert_internal_helper(vty, pim_ifp, ch);
} /* scan interface channels */ } /* scan interface channels */
} }
@ -329,7 +329,7 @@ static void pim_show_assert_metric(struct pim_instance *pim, struct vty *vty)
if (!pim_ifp) if (!pim_ifp)
continue; 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); pim_show_assert_metric_helper(vty, pim_ifp, ch);
} /* scan interface channels */ } /* scan interface channels */
} }
@ -392,7 +392,7 @@ static void pim_show_assert_winner_metric(struct pim_instance *pim,
if (!pim_ifp) if (!pim_ifp)
continue; 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); pim_show_assert_winner_metric_helper(vty, pim_ifp, ch);
} /* scan interface channels */ } /* scan interface channels */
} }
@ -482,7 +482,7 @@ static void pim_show_membership(struct pim_instance *pim, struct vty *vty,
if (!pim_ifp) if (!pim_ifp)
continue; 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); pim_show_membership_helper(vty, pim_ifp, ch, json);
} /* scan interface channels */ } /* 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) if (!pim_ifp)
continue; continue;
RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) { RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
pim_show_join_helper(vty, pim_ifp, pim_show_join_helper(vty, pim_ifp, ch, json, now, uj);
ch, json, now, uj);
} /* scan interface channels */ } /* scan interface channels */
} }
@ -2528,7 +2527,7 @@ static void pim_show_join_desired(struct pim_instance *pim, struct vty *vty,
continue; continue;
RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) { RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
/* scan all interfaces */ /* scan all interfaces */
pim_show_join_desired_helper(pim, vty, pim_show_join_desired_helper(pim, vty,
pim_ifp, ch, pim_ifp, ch,
@ -3393,8 +3392,7 @@ DEFUN (show_ip_igmp_interface_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -3450,8 +3448,7 @@ DEFUN (show_ip_igmp_join_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -3505,8 +3502,7 @@ DEFUN (show_ip_igmp_groups_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -3711,8 +3707,7 @@ DEFUN (show_ip_pim_interface_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -3771,8 +3766,7 @@ DEFUN (show_ip_pim_join_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -3857,8 +3851,7 @@ DEFUN (show_ip_pim_neighbor_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -3964,8 +3957,7 @@ DEFUN (show_ip_pim_state_vrf_all,
group = argv[idx + 1]->arg; 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 (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -4019,8 +4011,7 @@ DEFUN (show_ip_pim_upstream_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -4116,8 +4107,7 @@ DEFUN (show_ip_pim_rp_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -4171,8 +4161,7 @@ DEFUN (show_ip_pim_rpf_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -4438,8 +4427,7 @@ DEFUN (show_ip_multicast_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -4814,8 +4802,7 @@ DEFUN (show_ip_mroute_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -4918,8 +4905,7 @@ DEFUN (show_ip_mroute_count_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -7854,8 +7840,7 @@ DEFUN (show_ip_msdp_mesh_group_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -8083,8 +8068,7 @@ DEFUN (show_ip_msdp_peer_detail_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -8313,8 +8297,7 @@ DEFUN (show_ip_msdp_sa_detail_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");
@ -8450,7 +8433,7 @@ DEFUN (show_ip_msdp_sa_sg_vrf_all,
if (uj) if (uj)
vty_out(vty, "{ "); vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) { RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) { if (uj) {
if (!first) if (!first)
vty_out(vty, ", "); vty_out(vty, ", ");

View file

@ -263,7 +263,7 @@ void pim_if_update_could_assert(struct interface *ifp)
pim_ifp = ifp->info; pim_ifp = ifp->info;
zassert(pim_ifp); 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); 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; pim_ifp = ifp->info;
zassert(pim_ifp); 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); 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; pim_ifp = ifp->info;
zassert(pim_ifp); 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 ? */ /* Is (S,G,I) assert loser ? */
if (ch->ifassert_state != PIM_IFASSERT_I_AM_LOSER) if (ch->ifassert_state != PIM_IFASSERT_I_AM_LOSER)
continue; continue;
@ -1443,13 +1443,13 @@ void pim_if_update_join_desired(struct pim_interface *pim_ifp)
struct pim_ifchannel *ch; struct pim_ifchannel *ch;
/* clear off flag from interface's upstreams */ /* 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( PIM_UPSTREAM_FLAG_UNSET_DR_JOIN_DESIRED_UPDATED(
ch->upstream->flags); ch->upstream->flags);
} }
/* scan per-interface (S,G,I) state on this I interface */ /* 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; struct pim_upstream *up = ch->upstream;
if (PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED_UPDATED(up->flags)) 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) if (!pim_ifp)
return; 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); pim_ifchannel_update_assert_tracking_desired(ch);
} }
} }
@ -1537,8 +1537,7 @@ int pim_if_is_vrf_device(struct interface *ifp)
{ {
struct vrf *vrf; 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) if (strncmp(ifp->name, vrf->name, strlen(ifp->name)) == 0)
return 1; return 1;
} }
@ -1551,7 +1550,7 @@ int pim_if_ifchannel_count(struct pim_interface *pim_ifp)
struct pim_ifchannel *ch; struct pim_ifchannel *ch;
int count = 0; int count = 0;
RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) { RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
count++; count++;
} }

View file

@ -115,7 +115,7 @@ static void pim_ifchannel_find_new_children(struct pim_ifchannel *ch)
&& (ch->sg.grp.s_addr == INADDR_ANY)) && (ch->sg.grp.s_addr == INADDR_ANY))
return; 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) if ((ch->sg.grp.s_addr != INADDR_ANY)
&& (child->sg.grp.s_addr == ch->sg.grp.s_addr) && (child->sg.grp.s_addr == ch->sg.grp.s_addr)
&& (child != ch)) { && (child != ch)) {
@ -469,7 +469,7 @@ void pim_ifchannel_membership_clear(struct interface *ifp)
pim_ifp = ifp->info; pim_ifp = ifp->info;
zassert(pim_ifp); 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); ifmembership_set(ch, PIM_IFMEMBERSHIP_NOINFO);
} }
@ -481,7 +481,7 @@ void pim_ifchannel_delete_on_noinfo(struct interface *ifp)
pim_ifp = ifp->info; pim_ifp = ifp->info;
zassert(pim_ifp); 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); 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) if (new_pim_ifp == loop_pim_ifp)
continue; 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) { if (ch->ifjoin_state == PIM_IFJOIN_JOIN) {
struct pim_upstream *up = ch->upstream; struct pim_upstream *up = ch->upstream;
if ((!up->channel_oil) if ((!up->channel_oil)

View file

@ -192,8 +192,7 @@ static int pim_vrf_config_write(struct vty *vty)
struct vrf *vrf; struct vrf *vrf;
struct pim_instance *pim; 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; pim = vrf->info;
if (!pim) if (!pim)

View file

@ -245,8 +245,7 @@ int pim_interface_config_write(struct vty *vty)
struct vrf *vrf; struct vrf *vrf;
int writes = 0; int writes = 0;
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
pim = vrf->info; pim = vrf->info;
if (!pim) if (!pim)
continue; continue;

View 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) { if (sscanf(ifp->name, "pimreg%d", &table_id) == 1) {
struct vrf *vrf; 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) if ((table_id == vrf->data.l.table_id)
&& (ifp->vrf_id != vrf->vrf_id)) { && (ifp->vrf_id != vrf->vrf_id)) {
struct interface *master = if_lookup_by_name( struct interface *master = if_lookup_by_name(
@ -401,8 +400,7 @@ static void scan_upstream_rpf_cache()
struct vrf *vrf; struct vrf *vrf;
struct pim_instance *pim; 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; pim = vrf->info;
if (!pim) if (!pim)
continue; continue;
@ -498,8 +496,7 @@ static void scan_upstream_rpf_cache()
} /* for (qpim_upstream_list) */ } /* 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; pim = vrf->info;
if (!pim) if (!pim)
continue; 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_last = pim_time_monotonic_sec();
++qpim_scan_oil_events; ++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; pim = vrf->info;
if (!pim) if (!pim)
continue; continue;
@ -870,8 +866,7 @@ void igmp_source_forward_reevaluate_all(void)
struct vrf *vrf; struct vrf *vrf;
struct pim_instance *pim; 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; pim = vrf->info;
if (!pim) if (!pim)
continue; continue;

View file

@ -72,8 +72,7 @@ void pim_prefix_list_update(struct prefix_list *plist)
struct pim_instance *pim; struct pim_instance *pim;
struct vrf *vrf; struct vrf *vrf;
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
pim = vrf->info; pim = vrf->info;
if (!pim) if (!pim)
continue; continue;

View file

@ -280,8 +280,7 @@ static void set_namespaces()
struct namespace *namespace; struct namespace *namespace;
int fd; int fd;
LIST_FOREACH(namespace, &namespace_head, list) LIST_FOREACH (namespace, &namespace_head, list) {
{
if ((fd = open(namespace->path, O_RDONLY)) == -1) if ((fd = open(namespace->path, O_RDONLY)) == -1)
fatal("open namespace %s: %s", namespace->path, fatal("open namespace %s: %s", namespace->path,
strerror(errno)); strerror(errno));

View file

@ -1349,9 +1349,9 @@ DEFUN (show_interface_vrf_all,
interface_update_stats(); interface_update_stats();
/* All interface print. */ /* All interface print. */
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)) for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp))
if_dump_vty(vty, ifp); if_dump_vty(vty, ifp);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -1404,8 +1404,7 @@ DEFUN (show_interface_name_vrf_all,
interface_update_stats(); interface_update_stats();
/* All interface print. */ /* All interface print. */
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
/* Specified interface print. */ /* Specified interface print. */
ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf->vrf_id); ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf->vrf_id);
if (ifp) { if (ifp) {
@ -1486,11 +1485,11 @@ DEFUN (show_interface_desc_vrf_all,
{ {
struct vrf *vrf; struct vrf *vrf;
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
if (!list_isempty(vrf->iflist)) { if (!list_isempty(vrf->iflist)) {
vty_out(vty, "\n\tVRF %u\n\n", vrf->vrf_id); vty_out(vty, "\n\tVRF %u\n\n", vrf->vrf_id);
if_show_description(vty, vrf->vrf_id); if_show_description(vty, vrf->vrf_id);
} }
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -2836,80 +2835,89 @@ static int if_config_write(struct vty *vty)
zebra_ptm_write(vty); zebra_ptm_write(vty);
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)) { for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp)) {
struct zebra_if *if_data; struct zebra_if *if_data;
struct listnode *addrnode; struct listnode *addrnode;
struct connected *ifc; struct connected *ifc;
struct prefix *p; struct prefix *p;
struct vrf *vrf; struct vrf *vrf;
if_data = ifp->info; if_data = ifp->info;
vrf = vrf_lookup_by_id(ifp->vrf_id); vrf = vrf_lookup_by_id(ifp->vrf_id);
if (ifp->vrf_id == VRF_DEFAULT) if (ifp->vrf_id == VRF_DEFAULT)
vty_frame(vty, "interface %s\n", ifp->name); vty_frame(vty, "interface %s\n", ifp->name);
else else
vty_frame(vty, "interface %s vrf %s\n", ifp->name, vty_frame(vty, "interface %s vrf %s\n",
vrf->name); ifp->name, vrf->name);
if (if_data) { if (if_data) {
if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)
vty_out(vty, " shutdown\n"); vty_out(vty, " shutdown\n");
zebra_ptm_if_write(vty, if_data); zebra_ptm_if_write(vty, if_data);
} }
if (ifp->desc) if (ifp->desc)
vty_out(vty, " description %s\n", ifp->desc); vty_out(vty, " description %s\n", ifp->desc);
/* Assign bandwidth here to avoid unnecessary interface flap /* Assign bandwidth here to avoid unnecessary interface
while processing config script */ flap
if (ifp->bandwidth != 0) while processing config script */
vty_out(vty, " bandwidth %u\n", ifp->bandwidth); if (ifp->bandwidth != 0)
vty_out(vty, " bandwidth %u\n", ifp->bandwidth);
if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION)) if (!CHECK_FLAG(ifp->status,
vty_out(vty, " no link-detect\n"); ZEBRA_INTERFACE_LINKDETECTION))
vty_out(vty, " no link-detect\n");
for (ALL_LIST_ELEMENTS_RO(ifp->connected, addrnode, ifc)) { for (ALL_LIST_ELEMENTS_RO(ifp->connected, addrnode,
if (CHECK_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED)) { ifc)) {
char buf[INET6_ADDRSTRLEN]; if (CHECK_FLAG(ifc->conf,
p = ifc->address; ZEBRA_IFC_CONFIGURED)) {
vty_out(vty, " ip%s address %s", char buf[INET6_ADDRSTRLEN];
p->family == AF_INET ? "" : "v6", p = ifc->address;
inet_ntop(p->family, &p->u.prefix, buf, vty_out(vty, " ip%s address %s",
sizeof(buf))); p->family == AF_INET ? ""
if (CONNECTED_PEER(ifc)) { : "v6",
p = ifc->destination;
vty_out(vty, " peer %s",
inet_ntop(p->family, inet_ntop(p->family,
&p->u.prefix, buf, &p->u.prefix, buf,
sizeof(buf))); sizeof(buf)));
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);
vty_out(vty, "\n");
} }
vty_out(vty, "/%d", p->prefixlen);
if (ifc->label)
vty_out(vty, " label %s", ifc->label);
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 ");
}
hook_call(zebra_if_config_wr, vty, ifp);
link_params_config_write(vty, ifp);
vty_endframe(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 ");
}
hook_call(zebra_if_config_wr, vty, ifp);
link_params_config_write(vty, ifp);
vty_endframe(vty, "!\n");
}
return 0; return 0;
} }

View file

@ -322,21 +322,21 @@ static int irdp_finish(void)
zlog_info("IRDP: Received shutdown notification."); zlog_info("IRDP: Received shutdown notification.");
RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id) RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) { for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) {
zi = ifp->info; zi = ifp->info;
if (!zi) if (!zi)
continue; continue;
irdp = zi->irdp; irdp = zi->irdp;
if (!irdp) if (!irdp)
continue; continue;
if (irdp->flags & IF_ACTIVE) { if (irdp->flags & IF_ACTIVE) {
irdp->flags |= IF_SHUTDOWN; irdp->flags |= IF_SHUTDOWN;
irdp_advert_off(ifp); irdp_advert_off(ifp);
}
} }
}
return 0; return 0;
} }

View file

@ -131,8 +131,7 @@ static void sigint(void)
list_delete_all_node(zebrad.client_list); list_delete_all_node(zebrad.client_list);
if (retain_mode) if (retain_mode)
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
{
zvrf = vrf->info; zvrf = vrf->info;
if (zvrf) if (zvrf)
SET_FLAG(zvrf->flags, ZEBRA_VRF_RETAIN); SET_FLAG(zvrf->flags, ZEBRA_VRF_RETAIN);

View file

@ -84,12 +84,12 @@ static void zebra_redistribute_default(struct zserv *client, vrf_id_t vrf_id)
if (!rn) if (!rn)
continue; continue;
RNODE_FOREACH_RE(rn, newre) { RNODE_FOREACH_RE (rn, newre) {
if (CHECK_FLAG(newre->flags, ZEBRA_FLAG_SELECTED) if (CHECK_FLAG(newre->flags, ZEBRA_FLAG_SELECTED)
&& newre->distance != DISTANCE_INFINITY) && newre->distance != DISTANCE_INFINITY)
zsend_redistribute_route( zsend_redistribute_route(
ZEBRA_REDISTRIBUTE_ROUTE_ADD, ZEBRA_REDISTRIBUTE_ROUTE_ADD, client,
client, &rn->p, NULL, newre); &rn->p, NULL, newre);
} }
route_unlock_node(rn); route_unlock_node(rn);
@ -109,8 +109,7 @@ static void zebra_redistribute(struct zserv *client, int type, u_short instance,
return; return;
for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) 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; struct prefix *dst_p, *src_p;
srcdest_rnode_prefixes(rn, &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); prefix_copy(&p, &rn->p);
RNODE_FOREACH_RE(rn, same) RNODE_FOREACH_RE (rn, same) {
{ if (CHECK_FLAG(same->status, ROUTE_ENTRY_REMOVED))
if (CHECK_FLAG(same->status,
ROUTE_ENTRY_REMOVED))
continue; continue;
if (same->type == re->type 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) if (!rn->info)
continue; continue;
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue; continue;
break; break;
@ -708,11 +704,9 @@ void zebra_import_table_rm_update()
if (!rn->info) if (!rn->info)
continue; continue;
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{ if (CHECK_FLAG(re->status,
if (CHECK_FLAG( ROUTE_ENTRY_REMOVED))
re->status,
ROUTE_ENTRY_REMOVED))
continue; continue;
break; break;
} }

View file

@ -187,19 +187,21 @@ void router_id_write(struct vty *vty)
struct vrf *vrf; struct vrf *vrf;
struct zebra_vrf *zvrf; 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) != NULL) if ((zvrf = vrf->info) != NULL)
if (zvrf->rid_user_assigned.u.prefix4.s_addr) { if (zvrf->rid_user_assigned.u.prefix4.s_addr) {
if (zvrf_id(zvrf) == VRF_DEFAULT) if (zvrf_id(zvrf) == VRF_DEFAULT)
vty_out(vty, "router-id %s\n", vty_out(vty, "router-id %s\n",
inet_ntoa(zvrf->rid_user_assigned.u inet_ntoa(
.prefix4)); zvrf->rid_user_assigned
else .u.prefix4));
vty_out(vty, "router-id %s vrf %s\n", else
inet_ntoa(zvrf->rid_user_assigned.u vty_out(vty, "router-id %s vrf %s\n",
.prefix4), inet_ntoa(
zvrf_name(zvrf)); zvrf->rid_user_assigned
} .u.prefix4),
zvrf_name(zvrf));
}
} }
DEFUN (router_id, DEFUN (router_id,

View file

@ -247,8 +247,7 @@ static vrf_id_t vrf_lookup_by_table(u_int32_t table_id)
struct vrf *vrf; struct vrf *vrf;
struct zebra_vrf *zvrf; 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)) if ((zvrf = vrf->info) == NULL || (zvrf->table_id != table_id))
continue; continue;

View file

@ -395,41 +395,48 @@ static int rtadv_timer(struct thread *thread)
rtadv_event(zns, RTADV_TIMER_MSEC, 10 /* 10 ms */); rtadv_event(zns, RTADV_TIMER_MSEC, 10 /* 10 ms */);
} }
RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id) RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) { for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) {
if (if_is_loopback(ifp) if (if_is_loopback(ifp)
|| CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK) || CHECK_FLAG(ifp->status,
|| !if_is_operative(ifp)) ZEBRA_INTERFACE_VRF_LOOPBACK)
continue; || !if_is_operative(ifp))
continue;
zif = ifp->info; zif = ifp->info;
if (zif->rtadv.AdvSendAdvertisements) { if (zif->rtadv.AdvSendAdvertisements) {
if (zif->rtadv.inFastRexmit) { if (zif->rtadv.inFastRexmit) {
/* We assume we fast rexmit every sec so no /* We assume we fast rexmit every sec so
* additional vars */ * no
if (--zif->rtadv.NumFastReXmitsRemain <= 0) * additional vars */
zif->rtadv.inFastRexmit = 0; if (--zif->rtadv.NumFastReXmitsRemain
<= 0)
zif->rtadv.inFastRexmit = 0;
if (IS_ZEBRA_DEBUG_SEND) if (IS_ZEBRA_DEBUG_SEND)
zlog_debug( zlog_debug(
"Fast RA Rexmit on interface %s", "Fast RA Rexmit on interface %s",
ifp->name); 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); 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; return 0;
} }

View file

@ -873,8 +873,7 @@ struct route_entry *zfpm_route_for_update(rib_dest_t *dest)
{ {
struct route_entry *re; 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)) if (!CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
continue; continue;

View file

@ -55,8 +55,7 @@ static void map_slaves_to_bridge(struct interface *br_if, int link)
struct listnode *node; struct listnode *node;
struct interface *ifp; 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)) { for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp)) {
struct zebra_if *zif; struct zebra_if *zif;
struct zebra_l2info_brslave *br_slave; struct zebra_l2info_brslave *br_slave;

View file

@ -411,8 +411,7 @@ static int fec_change_update_lsp(struct zebra_vrf *zvrf, zebra_fec_t *fec,
if (!rn) if (!rn)
return 0; return 0;
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED)) if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
break; break;
} }
@ -614,8 +613,7 @@ static int nhlfe_nexthop_active_ipv4(zebra_nhlfe_t *nhlfe,
route_unlock_node(rn); route_unlock_node(rn);
/* Locate a valid connected route. */ /* Locate a valid connected route. */
RNODE_FOREACH_RE(rn, match) RNODE_FOREACH_RE (rn, match) {
{
if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED) if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED)
|| !CHECK_FLAG(match->flags, ZEBRA_FLAG_SELECTED)) || !CHECK_FLAG(match->flags, ZEBRA_FLAG_SELECTED))
continue; continue;
@ -664,8 +662,7 @@ static int nhlfe_nexthop_active_ipv6(zebra_nhlfe_t *nhlfe,
route_unlock_node(rn); route_unlock_node(rn);
/* Locate a valid connected route. */ /* Locate a valid connected route. */
RNODE_FOREACH_RE(rn, match) RNODE_FOREACH_RE (rn, match) {
{
if ((match->type == ZEBRA_ROUTE_CONNECT) if ((match->type == ZEBRA_ROUTE_CONNECT)
&& !CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED) && !CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED)
&& CHECK_FLAG(match->flags, ZEBRA_FLAG_SELECTED)) && 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 */ /* Lookup existing route */
rn = route_node_get(table, prefix); rn = route_node_get(table, prefix);
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue; continue;
if (re->distance == distance) 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)) { for (rn = route_top(table); rn; rn = route_next(rn)) {
update = 0; update = 0;
RNODE_FOREACH_RE(rn, re) { RNODE_FOREACH_RE (rn, re) {
for (nexthop = re->nexthop; for (nexthop = re->nexthop; nexthop;
nexthop;
nexthop = nexthop->next) { nexthop = nexthop->next) {
if (nexthop->nh_label_type != ZEBRA_LSP_LDP) if (nexthop->nh_label_type != ZEBRA_LSP_LDP)
continue; continue;

View file

@ -263,17 +263,19 @@ DEFUN (zebra_ptm_enable,
ptm_cb.ptm_enable = ZEBRA_IF_PTM_ENABLE_ON; ptm_cb.ptm_enable = ZEBRA_IF_PTM_ENABLE_ON;
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, i, ifp)) for (ALL_LIST_ELEMENTS_RO(vrf->iflist, i, ifp))
if (!ifp->ptm_enable) { if (!ifp->ptm_enable) {
if_data = (struct zebra_if *)ifp->info; if_data = (struct zebra_if *)ifp->info;
if (if_data && (if_data->ptm_enable if (if_data
&& (if_data->ptm_enable
== ZEBRA_IF_PTM_ENABLE_UNSPEC)) { == 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); zebra_ptm_connect(NULL);
@ -1090,26 +1092,27 @@ void zebra_ptm_reset_status(int ptm_disable)
struct interface *ifp; struct interface *ifp;
int send_linkup; int send_linkup;
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, i, ifp)) { for (ALL_LIST_ELEMENTS_RO(vrf->iflist, i, ifp)) {
send_linkup = 0; send_linkup = 0;
if (ifp->ptm_enable) { if (ifp->ptm_enable) {
if (!if_is_operative(ifp)) if (!if_is_operative(ifp))
send_linkup = 1; send_linkup = 1;
if (ptm_disable) if (ptm_disable)
ifp->ptm_enable = ZEBRA_IF_PTM_ENABLE_OFF; ifp->ptm_enable =
ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN; ZEBRA_IF_PTM_ENABLE_OFF;
ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
if (if_is_operative(ifp) && send_linkup) { if (if_is_operative(ifp) && send_linkup) {
if (IS_ZEBRA_DEBUG_EVENT) if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug( zlog_debug(
"%s: Bringing up interface %s", "%s: Bringing up interface %s",
__func__, ifp->name); __func__, ifp->name);
if_up(ifp); if_up(ifp);
}
} }
} }
}
} }
void zebra_ptm_if_init(struct zebra_if *zebra_ifp) void zebra_ptm_if_init(struct zebra_if *zebra_ifp)

View file

@ -274,11 +274,9 @@ void zebra_pw_client_close(struct zserv *client)
struct zebra_vrf *zvrf; struct zebra_vrf *zvrf;
struct zebra_pw *pw, *tmp; 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; 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) if (pw->client != client)
continue; continue;
zebra_pw_del(zvrf, pw); zebra_pw_del(zvrf, pw);
@ -450,8 +448,7 @@ DEFUN (show_pseudowires,
vty_out(vty, "%-16s %-24s %-12s %-8s %-10s\n", "Interface", "Neighbor", vty_out(vty, "%-16s %-24s %-12s %-8s %-10s\n", "Interface", "Neighbor",
"Labels", "Protocol", "Status"); "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_nbr[INET6_ADDRSTRLEN];
char buf_labels[64]; char buf_labels[64];
@ -486,8 +483,7 @@ static int zebra_pw_config(struct vty *vty)
if (!zvrf) if (!zvrf)
return 0; 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); vty_out(vty, "pseudowire %s\n", pw->ifname);
if (pw->local_label != MPLS_NO_LABEL if (pw->local_label != MPLS_NO_LABEL
&& pw->remote_label != MPLS_NO_LABEL) && pw->remote_label != MPLS_NO_LABEL)

View file

@ -447,8 +447,7 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
&& !nh_resolve_via_default(p.family)) && !nh_resolve_via_default(p.family))
return 0; return 0;
RNODE_FOREACH_RE(rn, match) RNODE_FOREACH_RE (rn, match) {
{
if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED)) if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
continue; 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); route_unlock_node(rn);
/* Pick up selected route. */ /* Pick up selected route. */
RNODE_FOREACH_RE(rn, match) RNODE_FOREACH_RE (rn, match) {
{
if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED)) if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
continue; continue;
if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB)) 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. */ /* Unlock node. */
route_unlock_node(rn); route_unlock_node(rn);
RNODE_FOREACH_RE(rn, match) RNODE_FOREACH_RE (rn, match) {
{
if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED)) if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
continue; continue;
if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB)) 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. /* 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)) if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
continue; continue;
if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB)) 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) if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug("%u:%s: Processing rn %p", vrf_id, buf, rn); 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) if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug( zlog_debug(
"%u:%s: Examine re %p (type %d) status %x flags %x " "%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 */ /* 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 (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) {
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
rnode_debug(rn, vrf_id, "rn %p, removing re %p", 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 * should limit the evaluation to the necessary VRFs in most common
* situations. * situations.
*/ */
RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id) RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
{
zvrf = vrf->info; zvrf = vrf->info;
if (zvrf == NULL || !(zvrf->flags & ZEBRA_VRF_RIB_SCHEDULED)) if (zvrf == NULL || !(zvrf->flags & ZEBRA_VRF_RIB_SCHEDULED))
continue; continue;
@ -1778,8 +1771,7 @@ static void rib_meta_queue_add(struct meta_queue *mq, struct route_node *rn)
{ {
struct route_entry *re; struct route_entry *re;
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{
u_char qindex = meta_queue_map[re->type]; u_char qindex = meta_queue_map[re->type];
struct zebra_vrf *zvrf; 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); route_unlock_node(rn);
/* let's go */ /* 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, zlog_debug("%s: rn %p, re %p: %s, %s", __func__, (void *)rn,
(void *)re, (void *)re,
(CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED) (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 * revalidation
* of the rest of the RE. * 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) if (CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB)
&& !RIB_SYSTEM_ROUTE(re)) { && !RIB_SYSTEM_ROUTE(re)) {
changed = 1; 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 /* If same type of route are installed, treat it as a implicit
withdraw. */ withdraw. */
RNODE_FOREACH_RE(rn, same) RNODE_FOREACH_RE (rn, same) {
{
if (CHECK_FLAG(same->status, ROUTE_ENTRY_REMOVED)) if (CHECK_FLAG(same->status, ROUTE_ENTRY_REMOVED))
continue; 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. */ /* Lookup same type route. */
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue; 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 /* If same type of route are installed, treat it as a implicit
withdraw. */ withdraw. */
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue; continue;
@ -2567,8 +2554,7 @@ static void rib_update_table(struct route_table *table,
* always * always
* get queued for processing. * get queued for processing.
*/ */
RNODE_FOREACH_RE_SAFE(rn, re, next) RNODE_FOREACH_RE_SAFE (rn, re, next) {
{
struct nexthop *nh; struct nexthop *nh;
if (re->type != ZEBRA_ROUTE_SYSTEM && if (re->type != ZEBRA_ROUTE_SYSTEM &&
@ -2636,8 +2622,7 @@ static void rib_weed_table(struct route_table *table)
if (table) if (table)
for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) 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)) if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue; continue;
@ -2653,11 +2638,11 @@ void rib_weed_tables(void)
struct vrf *vrf; struct vrf *vrf;
struct zebra_vrf *zvrf; 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) { if ((zvrf = vrf->info) != NULL) {
rib_weed_table(zvrf->table[AFI_IP][SAFI_UNICAST]); rib_weed_table(zvrf->table[AFI_IP][SAFI_UNICAST]);
rib_weed_table(zvrf->table[AFI_IP6][SAFI_UNICAST]); rib_weed_table(zvrf->table[AFI_IP6][SAFI_UNICAST]);
} }
} }
/* Delete self installed routes after zebra is relaunched. */ /* Delete self installed routes after zebra is relaunched. */
@ -2673,8 +2658,7 @@ static void rib_sweep_table(struct route_table *table)
return; return;
for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) { 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) if (IS_ZEBRA_DEBUG_RIB)
route_entry_dump(&rn->p, NULL, re); route_entry_dump(&rn->p, NULL, re);
@ -2718,7 +2702,7 @@ void rib_sweep_route(void)
struct vrf *vrf; struct vrf *vrf;
struct zebra_vrf *zvrf; 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) if ((zvrf = vrf->info) == NULL)
continue; continue;
@ -2738,8 +2722,7 @@ static unsigned long rib_score_proto_table(u_char proto, u_short instance,
if (table) if (table)
for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) 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)) if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue; continue;
if (re->type == proto if (re->type == proto
@ -2758,13 +2741,14 @@ unsigned long rib_score_proto(u_char proto, u_short instance)
struct zebra_vrf *zvrf; struct zebra_vrf *zvrf;
unsigned long cnt = 0; unsigned long cnt = 0;
RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id) RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
if ((zvrf = vrf->info) != NULL) if ((zvrf = vrf->info) != NULL)
cnt += rib_score_proto_table(proto, instance, cnt += rib_score_proto_table(
zvrf->table[AFI_IP][SAFI_UNICAST]) proto, instance,
+ rib_score_proto_table( zvrf->table[AFI_IP][SAFI_UNICAST])
proto, instance, + rib_score_proto_table(
zvrf->table[AFI_IP6][SAFI_UNICAST]); proto, instance,
zvrf->table[AFI_IP6][SAFI_UNICAST]);
return cnt; return cnt;
} }
@ -2782,10 +2766,8 @@ void rib_close_table(struct route_table *table)
info = table->info; info = table->info;
for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{ if (!CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
if (!CHECK_FLAG(re->status,
ROUTE_ENTRY_SELECTED_FIB))
continue; continue;
if (info->safi == SAFI_UNICAST) if (info->safi == SAFI_UNICAST)

View file

@ -405,8 +405,7 @@ static struct route_entry *zebra_rnh_resolve_entry(vrf_id_t vrfid, int family,
re = NULL; re = NULL;
else { else {
/* Identify appropriate route entry. */ /* Identify appropriate route entry. */
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue; continue;
if (!CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB)) 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. */ /* Evaluate each static route associated with this nexthop. */
for (ALL_LIST_ELEMENTS_RO(rnh->zebra_static_route_list, node, for (ALL_LIST_ELEMENTS_RO(rnh->zebra_static_route_list, node,
static_rn)) { static_rn)) {
RNODE_FOREACH_RE(static_rn, sre) RNODE_FOREACH_RE (static_rn, sre) {
{
if (sre->type != ZEBRA_ROUTE_STATIC) if (sre->type != ZEBRA_ROUTE_STATIC)
continue; continue;

View file

@ -354,8 +354,7 @@ DEFUN (set_src,
return CMD_WARNING_CONFIG_FAILED; 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) if (family == AF_INET)
pif = if_lookup_exact_address((void *)&src.ipv4, pif = if_lookup_exact_address((void *)&src.ipv4,
AF_INET, vrf->vrf_id); AF_INET, vrf->vrf_id);

View file

@ -155,7 +155,7 @@ static u_char *ipFwNumber(struct variable *v, oid objid[], size_t *objid_len,
/* Return number of routing entries. */ /* Return number of routing entries. */
result = 0; result = 0;
for (rn = route_top(table); rn; rn = route_next(rn)) for (rn = route_top(table); rn; rn = route_next(rn))
RNODE_FOREACH_RE(rn, re) { RNODE_FOREACH_RE (rn, re) {
result++; result++;
} }
@ -183,7 +183,7 @@ static u_char *ipCidrNumber(struct variable *v, oid objid[], size_t *objid_len,
/* Return number of routing entries. */ /* Return number of routing entries. */
result = 0; result = 0;
for (rn = route_top(table); rn; rn = route_next(rn)) for (rn = route_top(table); rn; rn = route_next(rn))
RNODE_FOREACH_RE(rn, re) { RNODE_FOREACH_RE (rn, re) {
result++; result++;
} }
@ -369,8 +369,7 @@ static void get_fwtable_route_node(struct variable *v, oid objid[],
return; return;
for (*np = route_top(table); *np; *np = route_next(*np)) { for (*np = route_top(table); *np; *np = route_next(*np)) {
if (!in_addr_cmp(&(*np)->p.u.prefix, (u_char *)&dest)) { 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) if (!in_addr_cmp((u_char *)&(*re)
->nexthop->gate ->nexthop->gate
.ipv4, .ipv4,
@ -390,14 +389,13 @@ static void get_fwtable_route_node(struct variable *v, oid objid[],
/* Check destination first */ /* Check destination first */
if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest) > 0) 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); check_replace(np2, re2, np, re);
} }
if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest) if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest)
== 0) { /* have to look at each re individually */ == 0) { /* have to look at each re individually */
RNODE_FOREACH_RE(np2, re2) RNODE_FOREACH_RE (np2, re2) {
{
int proto2, policy2; int proto2, policy2;
proto2 = proto_trans(re2->type); proto2 = proto_trans(re2->type);

View file

@ -67,8 +67,7 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p,
/* Lookup existing route */ /* Lookup existing route */
rn = srcdest_rnode_get(table, p, src_p); 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)) if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue; continue;
@ -281,8 +280,7 @@ void static_uninstall_route(afi_t afi, safi_t safi, struct prefix *p,
if (!rn) if (!rn)
return; return;
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue; continue;

View file

@ -70,8 +70,7 @@ void zebra_vrf_update_all(struct zserv *client)
{ {
struct vrf *vrf; 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) if (vrf->vrf_id)
zsend_vrf_add(client, vrf_info_lookup(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; struct route_entry *re, *next;
RNODE_FOREACH_RE_SAFE(node, re, next) { RNODE_FOREACH_RE_SAFE (node, re, next) {
rib_unlink(node, re); rib_unlink(node, re);
} }
@ -468,8 +467,7 @@ static int vrf_config_write(struct vty *vty)
struct vrf *vrf; struct vrf *vrf;
struct zebra_vrf *zvrf; 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; zvrf = vrf->info;
if (!zvrf) if (!zvrf)

View file

@ -378,8 +378,7 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
char buf[SRCDEST2STR_BUFFER]; char buf[SRCDEST2STR_BUFFER];
struct zebra_vrf *zvrf; struct zebra_vrf *zvrf;
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{
const char *mcast_info = ""; const char *mcast_info = "";
if (mcast) { if (mcast) {
rib_table_info_t *info = srcdest_rnode_table_info(rn); 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. */ /* Show all routes. */
for (rn = route_top(table); rn; rn = route_next(rn)) { for (rn = route_top(table); rn; rn = route_next(rn)) {
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{
if (use_fib if (use_fib
&& !CHECK_FLAG(re->status, && !CHECK_FLAG(re->status,
ROUTE_ENTRY_SELECTED_FIB)) ROUTE_ENTRY_SELECTED_FIB))
@ -1031,12 +1029,12 @@ DEFUN (show_ip_nht_vrf_all,
struct vrf *vrf; struct vrf *vrf;
struct zebra_vrf *zvrf; 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) != NULL) { if ((zvrf = vrf->info) != NULL) {
vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf)); vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
zebra_print_rnh_table(zvrf_id(zvrf), AF_INET, vty, zebra_print_rnh_table(zvrf_id(zvrf), AF_INET, vty,
RNH_NEXTHOP_TYPE); RNH_NEXTHOP_TYPE);
} }
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -1071,12 +1069,12 @@ DEFUN (show_ipv6_nht_vrf_all,
struct vrf *vrf; struct vrf *vrf;
struct zebra_vrf *zvrf; 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) != NULL) { if ((zvrf = vrf->info) != NULL) {
vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf)); vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
zebra_print_rnh_table(zvrf_id(zvrf), AF_INET6, vty, zebra_print_rnh_table(zvrf_id(zvrf), AF_INET6, vty,
RNH_NEXTHOP_TYPE); RNH_NEXTHOP_TYPE);
} }
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -1235,8 +1233,7 @@ DEFUN (show_ip_route,
} }
if (vrf_all) { 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 if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP][SAFI_UNICAST]) || (table = zvrf->table[AFI_IP][SAFI_UNICAST])
== NULL) == NULL)
@ -1360,8 +1357,7 @@ static void vty_show_ip_route_summary(struct vty *vty,
memset(&rib_cnt, 0, sizeof(rib_cnt)); memset(&rib_cnt, 0, sizeof(rib_cnt));
memset(&fib_cnt, 0, sizeof(fib_cnt)); memset(&fib_cnt, 0, sizeof(fib_cnt));
for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) 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 is_ibgp = (re->type == ZEBRA_ROUTE_BGP
&& CHECK_FLAG(re->flags, ZEBRA_FLAG_IBGP)); && 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(&rib_cnt, 0, sizeof(rib_cnt));
memset(&fib_cnt, 0, sizeof(fib_cnt)); memset(&fib_cnt, 0, sizeof(fib_cnt));
for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) 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. * In case of ECMP, count only once.
@ -1560,8 +1555,7 @@ DEFUN (show_ip_route_vrf_all_addr,
return CMD_WARNING; 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 if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) || (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
continue; continue;
@ -1601,8 +1595,7 @@ DEFUN (show_ip_route_vrf_all_prefix,
return CMD_WARNING; 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 if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) || (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
continue; continue;
@ -1635,10 +1628,10 @@ DEFUN (show_ip_route_vrf_all_summary,
struct vrf *vrf; struct vrf *vrf;
struct zebra_vrf *zvrf; 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) != NULL) if ((zvrf = vrf->info) != NULL)
vty_show_ip_route_summary(vty, vty_show_ip_route_summary(
zvrf->table[AFI_IP][SAFI_UNICAST]); vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -1656,10 +1649,10 @@ DEFUN (show_ip_route_vrf_all_summary_prefix,
struct vrf *vrf; struct vrf *vrf;
struct zebra_vrf *zvrf; 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) != NULL) if ((zvrf = vrf->info) != NULL)
vty_show_ip_route_summary_prefix( vty_show_ip_route_summary_prefix(
vty, zvrf->table[AFI_IP][SAFI_UNICAST]); vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -1676,8 +1669,7 @@ static int static_config(struct vty *vty, afi_t afi, safi_t safi,
char buf[SRCDEST2STR_BUFFER]; char buf[SRCDEST2STR_BUFFER];
int write = 0; 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)) if (!(zvrf = vrf->info))
continue; continue;
if ((stable = zvrf->stable[afi][safi]) == NULL) if ((stable = zvrf->stable[afi][safi]) == NULL)
@ -1874,8 +1866,7 @@ DEFUN (show_ipv6_route,
} }
if (vrf_all) { 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 if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) || (table = zvrf->table[AFI_IP6][SAFI_UNICAST])
== NULL) == NULL)
@ -2063,8 +2054,7 @@ DEFUN (show_ipv6_mroute,
/* Show all IPv6 route. */ /* Show all IPv6 route. */
for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{
if (first) { if (first) {
vty_out(vty, SHOW_ROUTE_V6_HEADER); vty_out(vty, SHOW_ROUTE_V6_HEADER);
first = 0; first = 0;
@ -2097,8 +2087,7 @@ DEFUN (show_ipv6_route_vrf_all_addr,
return CMD_WARNING; 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 if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) || (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
continue; continue;
@ -2138,8 +2127,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix,
return CMD_WARNING; 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 if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) || (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
continue; continue;
@ -2172,10 +2160,10 @@ DEFUN (show_ipv6_route_vrf_all_summary,
struct vrf *vrf; struct vrf *vrf;
struct zebra_vrf *zvrf; 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) != NULL) if ((zvrf = vrf->info) != NULL)
vty_show_ip_route_summary(vty, vty_show_ip_route_summary(
zvrf->table[AFI_IP6][SAFI_UNICAST]); vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -2195,16 +2183,14 @@ DEFUN (show_ipv6_mroute_vrf_all,
struct zebra_vrf *zvrf; struct zebra_vrf *zvrf;
int first = 1; 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 if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP6][SAFI_MULTICAST]) == NULL) || (table = zvrf->table[AFI_IP6][SAFI_MULTICAST]) == NULL)
continue; continue;
/* Show all IPv6 route. */ /* Show all IPv6 route. */
for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
RNODE_FOREACH_RE(rn, re) RNODE_FOREACH_RE (rn, re) {
{
if (first) { if (first) {
vty_out(vty, SHOW_ROUTE_V6_HEADER); vty_out(vty, SHOW_ROUTE_V6_HEADER);
first = 0; first = 0;
@ -2228,10 +2214,10 @@ DEFUN (show_ipv6_route_vrf_all_summary_prefix,
struct vrf *vrf; struct vrf *vrf;
struct zebra_vrf *zvrf; 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) != NULL) if ((zvrf = vrf->info) != NULL)
vty_show_ip_route_summary_prefix( vty_show_ip_route_summary_prefix(
vty, zvrf->table[AFI_IP6][SAFI_UNICAST]); vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -2267,8 +2253,7 @@ DEFUN (show_vrf,
struct vrf *vrf; struct vrf *vrf;
struct zebra_vrf *zvrf; 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)) if (!(zvrf = vrf->info))
continue; continue;
if (!zvrf_id(zvrf)) if (!zvrf_id(zvrf))

View file

@ -1004,8 +1004,7 @@ static int zread_interface_add(struct zserv *client, u_short length,
/* Interface information is needed. */ /* Interface information is needed. */
vrf_bitmap_set(client->ifinfo, zvrf_id(zvrf)); 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)) { for (ALL_LIST_ELEMENTS(vrf->iflist, ifnode, ifnnode, ifp)) {
/* Skip pseudo interface. */ /* Skip pseudo interface. */
if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE)) 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 vrf *vrf;
struct zebra_vrf *zvrf; 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) { if ((zvrf = vrf->info) != NULL) {
zebra_cleanup_rnh_client(zvrf_id(zvrf), AF_INET, client, zebra_cleanup_rnh_client(zvrf_id(zvrf), AF_INET, client,
RNH_NEXTHOP_TYPE); RNH_NEXTHOP_TYPE);
@ -2832,8 +2830,7 @@ DEFUN (show_zebra,
" Route Route Neighbor LSP LSP\n"); " Route Route Neighbor LSP LSP\n");
vty_out(vty, vty_out(vty,
"VRF Installs Removals Updates Installs Removals\n"); "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; struct zebra_vrf *zvrf = vrf->info;
vty_out(vty, "%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64 vty_out(vty, "%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64
" %10" PRIu64 " %10" PRIu64 "\n", " %10" PRIu64 " %10" PRIu64 "\n",