diff options
| -rw-r--r-- | bgpd/bgp_nexthop.c | 42 | ||||
| -rw-r--r-- | bgpd/bgp_nexthop.h | 2 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 13 | ||||
| -rw-r--r-- | lib/thread.c | 1 | ||||
| -rw-r--r-- | zebra/zebra_ns.c | 2 |
5 files changed, 50 insertions, 10 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 2d05a9e194..870da22d20 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -430,6 +430,48 @@ int bgp_multiaccess_check_v4(struct in_addr nexthop, struct peer *peer) return (ret); } +int bgp_subgrp_multiaccess_check_v4(struct in_addr nexthop, + struct update_subgroup *subgrp) +{ + struct bgp_node *rn1, *rn2; + struct peer_af *paf; + struct prefix p, np; + struct bgp *bgp = NULL; + + np.family = AF_INET; + np.prefixlen = IPV4_MAX_BITLEN; + np.u.prefix4 = nexthop; + + p.family = AF_INET; + p.prefixlen = IPV4_MAX_BITLEN; + + rn1 = rn2 = NULL; + + bgp = SUBGRP_INST(subgrp); + rn1 = bgp_node_match(bgp->connected_table[AFI_IP], + &np); + if (!rn1) + return 0; + + SUBGRP_FOREACH_PEER(subgrp, paf) { + p.u.prefix4 = paf->peer->su.sin.sin_addr; + + rn2 = bgp_node_match(bgp->connected_table[AFI_IP], + &p); + if (rn1 == rn2) { + bgp_unlock_node(rn1); + bgp_unlock_node(rn2); + return 1; + } + + if (rn2) + bgp_unlock_node(rn2); + } + + bgp_unlock_node(rn1); + return 0; +} + static void bgp_show_nexthops_detail(struct vty *vty, struct bgp *bgp, struct bgp_nexthop_cache *bnc) diff --git a/bgpd/bgp_nexthop.h b/bgpd/bgp_nexthop.h index b482778fdf..2c5b2ab118 100644 --- a/bgpd/bgp_nexthop.h +++ b/bgpd/bgp_nexthop.h @@ -82,6 +82,8 @@ extern int bgp_nexthop_lookup(afi_t, struct peer *peer, struct bgp_info *, int *, int *); extern void bgp_connected_add(struct bgp *bgp, struct connected *c); extern void bgp_connected_delete(struct bgp *bgp, struct connected *c); +extern int bgp_subgrp_multiaccess_check_v4(struct in_addr nexthop, + struct update_subgroup *subgrp); extern int bgp_multiaccess_check_v4(struct in_addr, struct peer *); extern int bgp_config_write_scan_time(struct vty *); extern int bgp_nexthop_self(struct bgp *, struct in_addr); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 5e51418165..44b3c5c348 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1319,7 +1319,6 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri, struct peer *onlypeer; struct bgp *bgp; struct attr *riattr; - struct peer_af *paf; char buf[PREFIX_STRLEN]; int ret; int transparent; @@ -1710,16 +1709,12 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri, * Note: 3rd party nexthop currently implemented for * IPv4 only. */ - SUBGRP_FOREACH_PEER (subgrp, paf) { - if (bgp_multiaccess_check_v4(riattr->nexthop, - paf->peer)) - break; - } - if (!paf) + if (!bgp_subgrp_multiaccess_check_v4(riattr->nexthop, + subgrp)) subgroup_announce_reset_nhop( (peer_cap_enhe(peer, afi, safi) - ? AF_INET6 - : p->family), + ? AF_INET6 + : p->family), attr); } /* If IPv6/MP and nexthop does not have any override and happens diff --git a/lib/thread.c b/lib/thread.c index d8be32e2bd..621eed0ff0 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -567,6 +567,7 @@ void thread_master_free(struct thread_master *m) thread_list_free(m, &m->ready); thread_list_free(m, &m->unuse); pthread_mutex_destroy(&m->mtx); + pthread_cond_destroy(&m->cancel_cond); close(m->io_pipe[0]); close(m->io_pipe[1]); list_delete(m->cancel_req); diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c index 7014731e04..78072f43bb 100644 --- a/zebra/zebra_ns.c +++ b/zebra/zebra_ns.c @@ -32,7 +32,7 @@ DEFINE_MTYPE(ZEBRA, ZEBRA_NS, "Zebra Name Space") -struct zebra_ns *dzns; +static struct zebra_ns *dzns; struct zebra_ns *zebra_ns_lookup(ns_id_t ns_id) { |
