diff options
| -rw-r--r-- | bgpd/bgp_addpath.c | 83 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 5 | ||||
| -rw-r--r-- | isisd/isis_cli.c | 23 | ||||
| -rw-r--r-- | pbrd/pbr_nht.c | 4 | ||||
| -rw-r--r-- | pbrd/pbr_vty.c | 2 |
5 files changed, 79 insertions, 38 deletions
diff --git a/bgpd/bgp_addpath.c b/bgpd/bgp_addpath.c index 55a86f99fc..c7fd1ba0e2 100644 --- a/bgpd/bgp_addpath.c +++ b/bgpd/bgp_addpath.c @@ -175,6 +175,28 @@ int bgp_addpath_tx_path(enum bgp_addpath_strat strat, } } +static void bgp_addpath_flush_type_rn(struct bgp *bgp, afi_t afi, safi_t safi, + enum bgp_addpath_strat addpath_type, + struct bgp_node *rn) +{ + struct bgp_path_info *pi; + + idalloc_drain_pool( + bgp->tx_addpath.id_allocators[afi][safi][addpath_type], + &(rn->tx_addpath.free_ids[addpath_type])); + for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) { + if (pi->tx_addpath.addpath_tx_id[addpath_type] + != IDALLOC_INVALID) { + idalloc_free( + bgp->tx_addpath + .id_allocators[afi][safi][addpath_type], + pi->tx_addpath.addpath_tx_id[addpath_type]); + pi->tx_addpath.addpath_tx_id[addpath_type] = + IDALLOC_INVALID; + } + } +} + /* * Purge all addpath ID's on a BGP instance associated with the addpath * strategy, and afi/safi combination. This lets us let go of all memory held to @@ -185,26 +207,24 @@ int bgp_addpath_tx_path(enum bgp_addpath_strat strat, static void bgp_addpath_flush_type(struct bgp *bgp, afi_t afi, safi_t safi, enum bgp_addpath_strat addpath_type) { - struct bgp_node *rn; - struct bgp_path_info *pi; + struct bgp_node *rn, *nrn; for (rn = bgp_table_top(bgp->rib[afi][safi]); rn; rn = bgp_route_next(rn)) { - idalloc_drain_pool( - bgp->tx_addpath.id_allocators[afi][safi][addpath_type], - &(rn->tx_addpath.free_ids[addpath_type])); - for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) { - if (pi->tx_addpath.addpath_tx_id[addpath_type] - != IDALLOC_INVALID) { - idalloc_free( - bgp->tx_addpath - .id_allocators[afi][safi] - [addpath_type], - pi->tx_addpath - .addpath_tx_id[addpath_type]); - pi->tx_addpath.addpath_tx_id[addpath_type] = - IDALLOC_INVALID; - } + if (safi == SAFI_MPLS_VPN) { + struct bgp_table *table; + + table = bgp_node_get_bgp_table_info(rn); + if (!table) + continue; + + for (nrn = bgp_table_top(table); nrn; + nrn = bgp_route_next(nrn)) + bgp_addpath_flush_type_rn(bgp, afi, safi, + addpath_type, nrn); + } else { + bgp_addpath_flush_type_rn(bgp, afi, safi, addpath_type, + rn); } } @@ -234,8 +254,7 @@ static void bgp_addpath_populate_path(struct id_alloc *allocator, static void bgp_addpath_populate_type(struct bgp *bgp, afi_t afi, safi_t safi, enum bgp_addpath_strat addpath_type) { - struct bgp_node *rn; - struct bgp_path_info *bi; + struct bgp_node *rn, *nrn; char buf[200]; struct id_alloc *allocator; @@ -255,9 +274,29 @@ static void bgp_addpath_populate_type(struct bgp *bgp, afi_t afi, safi_t safi, allocator = bgp->tx_addpath.id_allocators[afi][safi][addpath_type]; for (rn = bgp_table_top(bgp->rib[afi][safi]); rn; - rn = bgp_route_next(rn)) - for (bi = bgp_node_get_bgp_path_info(rn); bi; bi = bi->next) - bgp_addpath_populate_path(allocator, bi, addpath_type); + rn = bgp_route_next(rn)) { + struct bgp_path_info *bi; + + if (safi == SAFI_MPLS_VPN) { + struct bgp_table *table; + + table = bgp_node_get_bgp_table_info(rn); + if (!table) + continue; + + for (nrn = bgp_table_top(table); nrn; + nrn = bgp_route_next(nrn)) + for (bi = bgp_node_get_bgp_path_info(nrn); bi; + bi = bi->next) + bgp_addpath_populate_path(allocator, bi, + addpath_type); + } else { + for (bi = bgp_node_get_bgp_path_info(rn); bi; + bi = bi->next) + bgp_addpath_populate_path(allocator, bi, + addpath_type); + } + } } /* diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 8e72b742a3..230df715de 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -254,8 +254,9 @@ static void bgp_path_info_free(struct bgp_path_info *path) bgp_unlink_nexthop(path); bgp_path_info_extra_free(&path->extra); bgp_path_info_mpath_free(&path->mpath); - bgp_addpath_free_info_data(&path->tx_addpath, - path->net ? &path->net->tx_addpath : NULL); + if (path->net) + bgp_addpath_free_info_data(&path->tx_addpath, + &path->net->tx_addpath); peer_unlock(path->peer); /* bgp_path_info peer reference */ diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index bd8b58e8f0..ab5faf76b6 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -279,25 +279,26 @@ DEFPY(no_ip_router_isis, no_ip_router_isis_cmd, "IS-IS routing protocol\n" "Routing process tag\n") { - const struct lyd_node *dnode = - yang_dnode_get(running_config->dnode, VTY_CURR_XPATH); + const struct lyd_node *dnode; - /* if both ipv4 and ipv6 are off delete the interface isis container too + dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/frr-isisd:isis", VTY_CURR_XPATH); + if (!dnode) + return CMD_SUCCESS; + + /* + * If both ipv4 and ipv6 are off delete the interface isis container. */ - if (!strncmp(ip, "ipv6", strlen("ipv6"))) { - if (dnode - && !yang_dnode_get_bool(dnode, - "./frr-isisd:isis/ipv4-routing")) + if (strmatch(ip, "ipv6")) { + if (!yang_dnode_get_bool(dnode, "./ipv4-routing")) nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_DESTROY, NULL); else nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv6-routing", NB_OP_MODIFY, "false"); - } else { /* no ipv4 */ - if (dnode - && !yang_dnode_get_bool(dnode, - "./frr-isisd:isis/ipv6-routing")) + } else { + if (!yang_dnode_get_bool(dnode, "./ipv6-routing")) nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_DESTROY, NULL); else diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c index 6103bd7db5..f3bfad3190 100644 --- a/pbrd/pbr_nht.c +++ b/pbrd/pbr_nht.c @@ -164,8 +164,8 @@ static bool pbr_nh_hash_equal(const void *arg1, const void *arg2) == pbrnc2->nexthop->gate.ipv4.s_addr; case NEXTHOP_TYPE_IPV6_IFINDEX: case NEXTHOP_TYPE_IPV6: - return !!memcmp(&pbrnc1->nexthop->gate.ipv6, - &pbrnc2->nexthop->gate.ipv6, 16); + return !memcmp(&pbrnc1->nexthop->gate.ipv6, + &pbrnc2->nexthop->gate.ipv6, 16); case NEXTHOP_TYPE_BLACKHOLE: return pbrnc1->nexthop->bh_type == pbrnc2->nexthop->bh_type; } diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c index 2b6c38593b..f8232c9581 100644 --- a/pbrd/pbr_vty.c +++ b/pbrd/pbr_vty.c @@ -300,7 +300,7 @@ DEFPY(pbr_map_nexthop, pbr_map_nexthop_cmd, char buf[PBR_NHC_NAMELEN]; if (no) { - vty_out(vty, "No nexthops to delete"); + vty_out(vty, "No nexthops to delete\n"); return CMD_WARNING_CONFIG_FAILED; } |
