diff --git a/zebra/redistribute.c b/zebra/redistribute.c index ce86b6c1e3..93bfc0c031 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -84,11 +84,13 @@ static void zebra_redistribute_default(struct zserv *client, vrf_id_t vrf_id) if (!rn) continue; - 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); + 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); + } route_unlock_node(rn); } diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 273945778a..e3ce414127 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -2392,15 +2392,20 @@ 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; nexthop = nexthop->next) - if (nexthop->nh_label_type == ZEBRA_LSP_LDP) { + RNODE_FOREACH_RE(rn, re) { + for (nexthop = re->nexthop; + nexthop; + nexthop = nexthop->next) { + if (nexthop->nh_label_type != ZEBRA_LSP_LDP) + continue; + nexthop_del_labels(nexthop); SET_FLAG(re->status, ROUTE_ENTRY_CHANGED); SET_FLAG(re->status, ROUTE_ENTRY_LABELS_CHANGED); update = 1; } + } if (update) rib_queue_add(rn); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index c4c80b156b..376425329b 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1118,7 +1118,6 @@ static int rib_can_delete_dest(rib_dest_t *dest) int rib_gc_dest(struct route_node *rn) { rib_dest_t *dest; - struct zebra_vrf *zvrf; dest = rib_dest_from_rnode(rn); if (!dest) @@ -1127,9 +1126,12 @@ int rib_gc_dest(struct route_node *rn) if (!rib_can_delete_dest(dest)) return 0; - zvrf = rib_dest_vrf(dest); - if (IS_ZEBRA_DEBUG_RIB) + if (IS_ZEBRA_DEBUG_RIB) { + struct zebra_vrf *zvrf; + + zvrf = rib_dest_vrf(dest); rnode_debug(rn, zvrf_id(zvrf), "removing dest from table"); + } dest->rnode = NULL; XFREE(MTYPE_RIB_DEST, dest); @@ -2551,27 +2553,29 @@ static void rib_update_table(struct route_table *table, */ RNODE_FOREACH_RE_SAFE(rn, re, next) { - if (re->type == ZEBRA_ROUTE_OSPF - || re->type == ZEBRA_ROUTE_OSPF6 - || re->type == ZEBRA_ROUTE_BGP) - continue; /* protocol will handle. */ - else if (re->type == ZEBRA_ROUTE_STATIC) { - struct nexthop *nh; - for (nh = re->nexthop; nh; - nh = nh->next) - if (!(nh->type - == NEXTHOP_TYPE_IPV4 - || nh->type - == NEXTHOP_TYPE_IPV6)) - break; + struct nexthop *nh; - /* If we only have nexthops to a - * gateway, NHT will - * take care. - */ - if (nh) - rib_queue_add(rn); - } else + if (re->type != ZEBRA_ROUTE_SYSTEM && + re->type != ZEBRA_ROUTE_KERNEL && + re->type != ZEBRA_ROUTE_CONNECT && + re->type != ZEBRA_ROUTE_STATIC) + continue; + + if (re->type != ZEBRA_ROUTE_STATIC) { + rib_queue_add(rn); + continue; + } + + for (nh = re->nexthop; nh; nh = nh->next) + if (!(nh->type == NEXTHOP_TYPE_IPV4 + || nh->type == NEXTHOP_TYPE_IPV6)) + break; + + /* If we only have nexthops to a + * gateway, NHT will + * take care. + */ + if (nh) rib_queue_add(rn); } break; diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c index 4d6ba566ca..9ac24c53ed 100644 --- a/zebra/zebra_snmp.c +++ b/zebra/zebra_snmp.c @@ -155,8 +155,9 @@ 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) - result++; + RNODE_FOREACH_RE(rn, re) { + result++; + } return (u_char *)&result; } @@ -182,8 +183,9 @@ 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) - result++; + RNODE_FOREACH_RE(rn, re) { + result++; + } return (u_char *)&result; } @@ -388,8 +390,9 @@ 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) - check_replace(np2, re2, np, re); + 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 */ diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index 0a26ac6ad7..62c7d020bc 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -290,8 +290,9 @@ static void zebra_rtable_node_cleanup(struct route_table *table, { struct route_entry *re, *next; - RNODE_FOREACH_RE_SAFE(node, re, next) - rib_unlink(node, re); + RNODE_FOREACH_RE_SAFE(node, re, next) { + rib_unlink(node, re); + } if (node->info) XFREE(MTYPE_RIB_DEST, node->info);