From 2a3d57318c315aca75d54f93037e2fe52de30569 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 10 Nov 2015 15:29:12 +0000 Subject: [PATCH] BGP: route-server will now use addpath...chop the _rsclient code Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Ticket: CM-8122 per draft-ietf-idr-ix-bgp-route-server-09: 2.3.2.2.2. BGP ADD-PATH Approach The [I-D.ietf-idr-add-paths] Internet draft proposes a different approach to multiple path propagation, by allowing a BGP speaker to forward multiple paths for the same prefix on a single BGP session. As [RFC4271] specifies that a BGP listener must implement an implicit withdraw when it receives an UPDATE message for a prefix which already exists in its Adj-RIB-In, this approach requires explicit support for the feature both on the route server and on its clients. If the ADD-PATH capability is negotiated bidirectionally between the route server and a route server client, and the route server client propagates multiple paths for the same prefix to the route server, then this could potentially cause the propagation of inactive, invalid or suboptimal paths to the route server, thereby causing loss of reachability to other route server clients. For this reason, ADD- PATH implementations on a route server should enforce send-only mode with the route server clients, which would result in negotiating receive-only mode from the client to the route server. This allows us to delete all of the following code: - All XXXX_rsclient() functions - peer->rib - BGP_TABLE_MAIN and BGP_TABLE_RSCLIENT - RMAP_IMPORT and RMAP_EXPORT --- bgpd/bgp_fsm.c | 12 +- bgpd/bgp_packet.c | 5 +- bgpd/bgp_route.c | 2087 ++--------------------------------------- bgpd/bgp_route.h | 18 +- bgpd/bgp_routemap.c | 17 +- bgpd/bgp_table.c | 1 - bgpd/bgp_table.h | 8 - bgpd/bgp_updgrp.c | 7 +- bgpd/bgp_updgrp.h | 3 +- bgpd/bgp_updgrp_adv.c | 25 +- bgpd/bgp_vty.c | 764 +-------------- bgpd/bgpd.c | 176 +--- bgpd/bgpd.h | 23 +- 13 files changed, 134 insertions(+), 3012 deletions(-) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 5586be710f..791064aca8 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -590,16 +590,13 @@ bgp_update_delay_end (struct bgp *bgp) * 3. Unblock the peer update writes. With that peer update packing with * the prefixes should be at its maximum. */ - bgp_add_eoiu_mark(bgp, BGP_TABLE_MAIN); - bgp_add_eoiu_mark(bgp, BGP_TABLE_RSCLIENT); + bgp_add_eoiu_mark(bgp); bgp->main_zebra_update_hold = 1; bgp->main_peers_update_hold = 1; - bgp->rsclient_peers_update_hold = 1; /* Resume the queue processing. This should trigger the event that would take care of processing any work that was queued during the read-only mode. */ work_queue_unplug(bm->process_main_queue); - work_queue_unplug(bm->process_rsclient_queue); } /** @@ -611,10 +608,10 @@ bgp_start_routeadv (struct bgp *bgp) struct listnode *node, *nnode; struct peer *peer; - zlog_info("bgp_start_routeadv(), update hold status - main: %d, rsclient: %d", - bgp->main_peers_update_hold, bgp->rsclient_peers_update_hold); + zlog_info("bgp_start_routeadv(), update hold status %d", + bgp->main_peers_update_hold); - if (bgp->main_peers_update_hold || bgp->rsclient_peers_update_hold) + if (bgp->main_peers_update_hold) return; quagga_timestamp(3, bgp->update_delay_peers_resume_time, @@ -856,7 +853,6 @@ bgp_update_delay_begin (struct bgp *bgp) /* Stop the processing of queued work. Enqueue shall continue */ work_queue_plug(bm->process_main_queue); - work_queue_plug(bm->process_rsclient_queue); for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) peer->update_delay_over = 0; diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 4a99ad4c6c..7f4611c2d0 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -202,8 +202,7 @@ bgp_write_packet (struct peer *peer) if (peer->status != Established) return NULL; - if (peer->bgp && (peer->bgp->main_peers_update_hold || - peer->bgp->rsclient_peers_update_hold)) + if (peer->bgp && peer->bgp->main_peers_update_hold) return NULL; for (afi = AFI_IP; afi < AFI_MAX; afi++) @@ -2084,7 +2083,7 @@ bgp_capability_msg_parse (struct peer *peer, u_char *pnt, bgp_size_t length) peer->afc_nego[afi][safi] = 0; if (peer_active_nego (peer)) - bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_NORMAL); + bgp_clear_route (peer, afi, safi); else BGP_EVENT_ADD (peer, BGP_Stop); } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index bb40b4ed47..eae8f61645 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -246,9 +246,7 @@ bgp_pcount_adjust (struct bgp_node *rn, struct bgp_info *ri) table = bgp_node_table (rn); - /* Ignore 'pcount' for RS-client tables */ - if (table->type != BGP_TABLE_MAIN - || ri->peer == ri->peer->bgp->peer_self) + if (ri->peer == ri->peer->bgp->peer_self) return; if (!BGP_INFO_COUNTABLE (ri) @@ -1057,79 +1055,6 @@ bgp_output_modifier (struct peer *peer, struct prefix *p, struct attr *attr, return RMAP_PERMIT; } -static int -bgp_export_modifier (struct peer *rsclient, struct peer *peer, - struct prefix *p, struct attr *attr, afi_t afi, safi_t safi) -{ - struct bgp_filter *filter; - struct bgp_info info; - route_map_result_t ret; - - filter = &peer->filter[afi][safi]; - - /* Route map apply. */ - if (ROUTE_MAP_EXPORT_NAME (filter)) - { - /* Duplicate current value to new strucutre for modification. */ - info.peer = rsclient; - info.attr = attr; - - SET_FLAG (rsclient->rmap_type, PEER_RMAP_TYPE_EXPORT); - - /* Apply BGP route map to the attribute. */ - ret = route_map_apply (ROUTE_MAP_EXPORT (filter), p, RMAP_BGP, &info); - - rsclient->rmap_type = 0; - - if (ret == RMAP_DENYMATCH) - { - /* Free newly generated AS path and community by route-map. */ - bgp_attr_flush (attr); - return RMAP_DENY; - } - } - return RMAP_PERMIT; -} - -static int -bgp_import_modifier (struct peer *rsclient, struct peer *peer, - struct prefix *p, struct attr *attr, afi_t afi, safi_t safi) -{ - struct bgp_filter *filter; - struct bgp_info info; - route_map_result_t ret; - - filter = &rsclient->filter[afi][safi]; - - /* Apply default weight value. */ - if (peer->weight) - (bgp_attr_extra_get (attr))->weight = peer->weight; - - /* Route map apply. */ - if (ROUTE_MAP_IMPORT_NAME (filter)) - { - /* Duplicate current value to new strucutre for modification. */ - info.peer = peer; - info.attr = attr; - - SET_FLAG (peer->rmap_type, PEER_RMAP_TYPE_IMPORT); - - /* Apply BGP route map to the attribute. */ - ret = route_map_apply (ROUTE_MAP_IMPORT (filter), p, RMAP_BGP, &info); - - peer->rmap_type = 0; - - if (ret == RMAP_DENYMATCH) - { - /* Free newly generated AS path and community by route-map. */ - bgp_attr_flush (attr); - return RMAP_DENY; - } - } - return RMAP_PERMIT; -} - - /* If this is an EBGP peer with remove-private-AS */ static void bgp_peer_remove_private_as(struct bgp *bgp, afi_t afi, safi_t safi, @@ -1252,12 +1177,6 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp, return 0; } - /* Do not send announces to RS-clients from the 'normal' bgp_table. */ - if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) - { - return 0; - } - /* Do not send back route to sender. */ if (onlypeer && from == onlypeer) { @@ -1556,209 +1475,6 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp, return 1; } -static int -subgroup_announce_check_rsclient (struct bgp_info *ri, - struct update_subgroup *subgrp, - struct prefix *p, struct attr *attr) -{ - int ret; - char buf[SU_ADDRSTRLEN]; - struct bgp_filter *filter; - struct bgp_info info; - struct peer *from; - struct peer *rsclient; - struct peer *onlypeer; - struct attr *riattr; - struct bgp *bgp; - afi_t afi; - safi_t safi; - - if (DISABLE_BGP_ANNOUNCE) - return 0; - - afi = SUBGRP_AFI(subgrp); - safi = SUBGRP_SAFI(subgrp); - rsclient = SUBGRP_PEER(subgrp); - onlypeer = ((SUBGRP_PCOUNT(subgrp) == 1) ? - (SUBGRP_PFIRST(subgrp))->peer : NULL); - from = ri->peer; - filter = &rsclient->filter[afi][safi]; - bgp = rsclient->bgp; - riattr = bgp_info_mpath_count (ri) ? bgp_info_mpath_attr (ri) : ri->attr; - - /* Do not send back route to sender. */ - if (onlypeer && (from == onlypeer)) - return 0; - - /* Aggregate-address suppress check. */ - if (ri->extra && ri->extra->suppress) - if (! UNSUPPRESS_MAP_NAME (filter)) - return 0; - - /* Default route check. */ - if (subgrp && CHECK_FLAG (subgrp->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) - { - if (p->family == AF_INET && p->u.prefix4.s_addr == INADDR_ANY) - return 0; -#ifdef HAVE_IPV6 - else if (p->family == AF_INET6 && p->prefixlen == 0) - return 0; -#endif /* HAVE_IPV6 */ - } - - /* If the attribute has originator-id and it is same as remote - peer's id. */ - if (onlypeer && riattr->flag & ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID)) - { - if (IPV4_ADDR_SAME (&onlypeer->remote_id, - &riattr->extra->originator_id)) - { - if (bgp_debug_update(rsclient, p, subgrp->update_group, 0)) - zlog_debug ("%s [Update:SEND] %s/%d originator-id is same as remote router-id", - onlypeer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); - return 0; - } - } - - /* ORF prefix-list filter check */ - if (CHECK_FLAG (rsclient->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) - && (CHECK_FLAG (rsclient->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) - || CHECK_FLAG (rsclient->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV))) - if (rsclient->orf_plist[afi][safi]) - { - if (prefix_list_apply (rsclient->orf_plist[afi][safi], p) == PREFIX_DENY) - return 0; - } - - /* Output filter check. */ - if (bgp_output_filter (rsclient, p, riattr, afi, safi) == FILTER_DENY) - { - if (bgp_debug_update(rsclient, p, subgrp->update_group, 0)) - zlog_debug ("%s [Update:SEND] %s/%d is filtered", - rsclient->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); - return 0; - } - -#ifdef BGP_SEND_ASPATH_CHECK - /* AS path loop check. */ - if (onlypeer && aspath_loop_check (riattr->aspath, onlypeer->as)) - { - if (bgp_debug_update(rsclient, p, subgrp->update_group, 0)) - zlog_debug ("%s [Update:SEND] suppress announcement to peer AS %u is AS path.", - onlypeer->host, onlypeer->as); - return 0; - } -#endif /* BGP_SEND_ASPATH_CHECK */ - - /* For modify attribute, copy it to temporary structure. */ - bgp_attr_dup (attr, riattr); - - /* next-hop-set */ - if ((p->family == AF_INET && !peer_cap_enhe(rsclient) - && attr->nexthop.s_addr == 0) -#ifdef HAVE_IPV6 - || ((p->family == AF_INET6 || peer_cap_enhe(rsclient)) && - IN6_IS_ADDR_UNSPECIFIED(&attr->extra->mp_nexthop_global)) -#endif /* HAVE_IPV6 */ - ) - { - /* Set IPv4 nexthop. */ - if (p->family == AF_INET) - { - if (safi == SAFI_MPLS_VPN) - memcpy (&attr->extra->mp_nexthop_global_in, &rsclient->nexthop.v4, - IPV4_MAX_BYTELEN); - else if (!peer_cap_enhe(rsclient)) - memcpy (&attr->nexthop, &rsclient->nexthop.v4, IPV4_MAX_BYTELEN); - } -#ifdef HAVE_IPV6 - /* Set IPv6 nexthop. */ - if (p->family == AF_INET6 || peer_cap_enhe(rsclient)) - { - /* IPv6 global nexthop must be included. */ - memcpy (&attr->extra->mp_nexthop_global, &rsclient->nexthop.v6_global, - IPV6_MAX_BYTELEN); - attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL; - } -#endif /* HAVE_IPV6 */ - } - -#ifdef HAVE_IPV6 - if (p->family == AF_INET6 || peer_cap_enhe(rsclient)) - { - struct attr_extra *attre = attr->extra; - - /* Left nexthop_local unchanged if so configured. */ - if ( CHECK_FLAG (rsclient->af_flags[afi][safi], - PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED) ) - { - if ( IN6_IS_ADDR_LINKLOCAL (&attre->mp_nexthop_local) ) - attre->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL; - else - attre->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL; - } - - /* Default nexthop_local treatment for RS-Clients */ - else - { - /* Announcer and RS-Client are both in the same network */ - if (rsclient->shared_network && from->shared_network && - (rsclient->ifindex == from->ifindex)) - { - if ( IN6_IS_ADDR_LINKLOCAL (&attre->mp_nexthop_local) ) - attre->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL; - else - attre->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL; - } - - /* Set link-local address for shared network peer. */ - else if (rsclient->shared_network - && IN6_IS_ADDR_LINKLOCAL (&rsclient->nexthop.v6_local)) - { - memcpy (&attre->mp_nexthop_local, &rsclient->nexthop.v6_local, - IPV6_MAX_BYTELEN); - attre->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL; - } - - else - attre->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL; - } - - } -#endif /* HAVE_IPV6 */ - - bgp_peer_remove_private_as(bgp, afi, safi, rsclient, attr); - bgp_peer_as_override(bgp, afi, safi, rsclient, attr); - - /* Route map & unsuppress-map apply. */ - if (ROUTE_MAP_OUT_NAME (filter) || (ri->extra && ri->extra->suppress) ) - { - info.peer = rsclient; - info.attr = attr; - - SET_FLAG (rsclient->rmap_type, PEER_RMAP_TYPE_OUT); - - if (ri->extra && ri->extra->suppress) - ret = route_map_apply (UNSUPPRESS_MAP (filter), p, RMAP_BGP, &info); - else - ret = route_map_apply (ROUTE_MAP_OUT (filter), p, RMAP_BGP, &info); - - rsclient->rmap_type = 0; - - if (ret == RMAP_DENYMATCH) - { - bgp_attr_flush (attr); - return 0; - } - } - - return 1; -} - struct bgp_info_pair { struct bgp_info *old; @@ -1971,46 +1687,22 @@ subgroup_process_announce_selected (struct update_subgroup *subgrp, PEER_STATUS_ORF_WAIT_REFRESH)) return 0; - /* It's initialized in bgp_announce_[check|check_rsclient]() */ + /* It's initialized in bgp_announce_check() */ attr.extra = &extra; - switch (bgp_node_table (rn)->type) + /* Announcement to the subgroup. If the route is filtered withdraw it. */ + if (selected) { - case BGP_TABLE_MAIN: - /* Announcement to the subgroup. If the route is filtered, - withdraw it. */ - if (selected) - { - if (subgroup_announce_check(selected, subgrp, p, &attr)) - bgp_adj_out_set_subgroup(rn, subgrp, &attr, selected); - else - bgp_adj_out_unset_subgroup(rn, subgrp, 1, selected->addpath_tx_id); - } - - /* If selected is NULL we must withdraw the path using addpath_tx_id */ - else - { - bgp_adj_out_unset_subgroup(rn, subgrp, 1, addpath_tx_id); - } - break; - - case BGP_TABLE_RSCLIENT: - /* Announcement to peer->conf. If the route is filtered, - withdraw it. */ - if (selected) - { - if (subgroup_announce_check_rsclient(selected, subgrp, p, &attr)) - bgp_adj_out_set_subgroup(rn, subgrp, &attr, selected); - else - bgp_adj_out_unset_subgroup(rn, subgrp, 1, selected->addpath_tx_id); - } + if (subgroup_announce_check(selected, subgrp, p, &attr)) + bgp_adj_out_set_subgroup(rn, subgrp, &attr, selected); + else + bgp_adj_out_unset_subgroup(rn, subgrp, 1, selected->addpath_tx_id); + } - /* If selected is NULL we must withdraw the path using addpath_tx_id */ - else - { - bgp_adj_out_unset_subgroup(rn, subgrp, 1, addpath_tx_id); - } - break; + /* If selected is NULL we must withdraw the path using addpath_tx_id */ + else + { + bgp_adj_out_unset_subgroup(rn, subgrp, 1, addpath_tx_id); } return 0; @@ -2024,91 +1716,6 @@ struct bgp_process_queue safi_t safi; }; -static wq_item_status -bgp_process_rsclient (struct work_queue *wq, void *data) -{ - struct bgp_process_queue *pq = data; - struct bgp *bgp = pq->bgp; - struct bgp_node *rn = pq->rn; - afi_t afi = pq->afi; - safi_t safi = pq->safi; - struct bgp_info *new_select; - struct bgp_info *old_select; - struct bgp_info_pair old_and_new; - struct listnode *node, *nnode; - struct peer *rsclient; - struct peer_af *paf; - struct update_subgroup *subgrp; - - /* Is it end of initial update? (after startup) */ - if (!rn) - { - /* This is just to keep the display sane in case all the peers are - rsclients only */ - quagga_timestamp(3, bgp->update_delay_zebra_resume_time, - sizeof(bgp->update_delay_zebra_resume_time)); - - bgp->rsclient_peers_update_hold = 0; - bgp_start_routeadv(bgp); - return WQ_SUCCESS; - } - - rsclient = bgp_node_table (rn)->owner; - - /* Best path selection. */ - bgp_best_selection (bgp, rn, &bgp->maxpaths[afi][safi], &old_and_new); - new_select = old_and_new.new; - old_select = old_and_new.old; - - if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) - { - if (rsclient->group) - for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, rsclient)) - { - /* Nothing to do. */ - if (old_select && old_select == new_select) - if (!CHECK_FLAG (old_select->flags, BGP_INFO_ATTR_CHANGED)) - continue; - - if (old_select) - bgp_info_unset_flag (rn, old_select, BGP_INFO_SELECTED); - if (new_select) - { - bgp_info_set_flag (rn, new_select, BGP_INFO_SELECTED); - bgp_info_unset_flag (rn, new_select, BGP_INFO_ATTR_CHANGED); - UNSET_FLAG (new_select->flags, BGP_INFO_MULTIPATH_CHG); - } - - paf = peer_af_find(rsclient, afi, safi); - assert(paf); - subgrp = PAF_SUBGRP(paf); - if (!subgrp) /* not an established session */ - continue; - subgroup_process_announce_selected (subgrp, new_select, rn, new_select->addpath_tx_id); - } - } - else - { - if (old_select) - bgp_info_unset_flag (rn, old_select, BGP_INFO_SELECTED); - if (new_select) - { - bgp_info_set_flag (rn, new_select, BGP_INFO_SELECTED); - bgp_info_unset_flag (rn, new_select, BGP_INFO_ATTR_CHANGED); - UNSET_FLAG (new_select->flags, BGP_INFO_MULTIPATH_CHG); - } - paf = peer_af_find(rsclient, afi, safi); - if (paf && (subgrp = PAF_SUBGRP(paf))) /* if an established session */ - subgroup_process_announce_selected (subgrp, new_select, rn, new_select->addpath_tx_id); - } - - if (old_select && CHECK_FLAG (old_select->flags, BGP_INFO_REMOVED)) - bgp_info_reap (rn, old_select); - - UNSET_FLAG (rn->flags, BGP_NODE_PROCESS_SCHEDULED); - return WQ_SUCCESS; -} - static wq_item_status bgp_process_main (struct work_queue *wq, void *data) { @@ -2239,18 +1846,12 @@ bgp_process_queue_init (void) { bm->process_main_queue = work_queue_new (bm->master, "process_main_queue"); - } - - if (!bm->process_rsclient_queue) - { - bm->process_rsclient_queue - = work_queue_new (bm->master, "process_rsclient_queue"); - } - if ( !(bm->process_main_queue && bm->process_rsclient_queue) ) - { - zlog_err ("%s: Failed to allocate work queue", __func__); - exit (1); + if ( !bm->process_main_queue) + { + zlog_err ("%s: Failed to allocate work queue", __func__); + exit (1); + } } bm->process_main_queue->spec.workfunc = &bgp_process_main; @@ -2259,13 +1860,6 @@ bgp_process_queue_init (void) bm->process_main_queue->spec.hold = 50; /* Use a higher yield value of 50ms for main queue processing */ bm->process_main_queue->spec.yield = 50 * 1000L; - - bm->process_rsclient_queue->spec.workfunc = &bgp_process_rsclient; - bm->process_rsclient_queue->spec.del_item_data = &bgp_processq_del; - bm->process_rsclient_queue->spec.max_retries = 0; - bm->process_rsclient_queue->spec.hold = 50; - /* Use a higher yield value of 50ms for main queue processing */ - bm->process_rsclient_queue->spec.yield = 50 * 1000L; } void @@ -2277,8 +1871,7 @@ bgp_process (struct bgp *bgp, struct bgp_node *rn, afi_t afi, safi_t safi) if (CHECK_FLAG (rn->flags, BGP_NODE_PROCESS_SCHEDULED)) return; - if ( (bm->process_main_queue == NULL) || - (bm->process_rsclient_queue == NULL) ) + if (bm->process_main_queue == NULL) bgp_process_queue_init (); pqnode = XCALLOC (MTYPE_BGP_PROCESS_QUEUE, @@ -2293,28 +1886,17 @@ bgp_process (struct bgp *bgp, struct bgp_node *rn, afi_t afi, safi_t safi) bgp_lock (bgp); pqnode->afi = afi; pqnode->safi = safi; - - switch (bgp_node_table (rn)->type) - { - case BGP_TABLE_MAIN: - work_queue_add (bm->process_main_queue, pqnode); - break; - case BGP_TABLE_RSCLIENT: - work_queue_add (bm->process_rsclient_queue, pqnode); - break; - } - + work_queue_add (bm->process_main_queue, pqnode); SET_FLAG (rn->flags, BGP_NODE_PROCESS_SCHEDULED); return; } void -bgp_add_eoiu_mark (struct bgp *bgp, bgp_table_t type) +bgp_add_eoiu_mark (struct bgp *bgp) { struct bgp_process_queue *pqnode; - if ( (bm->process_main_queue == NULL) || - (bm->process_rsclient_queue == NULL) ) + if (bm->process_main_queue == NULL) bgp_process_queue_init (); pqnode = XCALLOC (MTYPE_BGP_PROCESS_QUEUE, @@ -2325,17 +1907,7 @@ bgp_add_eoiu_mark (struct bgp *bgp, bgp_table_t type) pqnode->rn = NULL; pqnode->bgp = bgp; bgp_lock (bgp); - switch (type) - { - case BGP_TABLE_MAIN: - work_queue_add (bm->process_main_queue, pqnode); - break; - case BGP_TABLE_RSCLIENT: - work_queue_add (bm->process_rsclient_queue, pqnode); - break; - } - - return; + work_queue_add (bm->process_main_queue, pqnode); } static int @@ -2548,226 +2120,6 @@ bgp_update_martian_nexthop (afi_t afi, safi_t safi, struct attr *attr) return ret; } -static void -bgp_update_rsclient (struct peer *rsclient, u_int32_t addpath_id, - afi_t afi, safi_t safi, struct attr *attr, - struct peer *peer, struct prefix *p, int type, - int sub_type, struct prefix_rd *prd, u_char *tag) -{ - struct bgp_node *rn; - struct bgp *bgp; - struct attr new_attr; - struct attr_extra new_extra; - struct attr *attr_new; - struct attr *attr_new2; - struct bgp_info *ri; - struct bgp_info *new; - const char *reason; - char buf[SU_ADDRSTRLEN]; - char buf2[30]; - - /* Do not insert announces from a rsclient into its own 'bgp_table'. */ - if (peer == rsclient) - return; - - bgp = peer->bgp; - rn = bgp_afi_node_get (rsclient->rib[afi][safi], afi, safi, p, prd); - - /* Check previously received route. */ - for (ri = rn->info; ri; ri = ri->next) - if (ri->peer == peer && ri->type == type && ri->sub_type == sub_type && - ri->addpath_rx_id == addpath_id) - break; - - /* AS path loop check. */ - if (aspath_loop_check (attr->aspath, rsclient->as) > rsclient->allowas_in[afi][safi]) - { - reason = "as-path contains our own AS;"; - goto filtered; - } - - /* Route reflector originator ID check. */ - if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID) - && IPV4_ADDR_SAME (&rsclient->remote_id, &attr->extra->originator_id)) - { - reason = "originator is us;"; - goto filtered; - } - - new_attr.extra = &new_extra; - bgp_attr_dup (&new_attr, attr); - - /* Apply export policy. */ - if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) && - bgp_export_modifier (rsclient, peer, p, &new_attr, afi, safi) == RMAP_DENY) - { - reason = "export-policy;"; - goto filtered; - } - - attr_new2 = bgp_attr_intern (&new_attr); - - /* Apply import policy. */ - if (bgp_import_modifier (rsclient, peer, p, &new_attr, afi, safi) == RMAP_DENY) - { - bgp_attr_unintern (&attr_new2); - - reason = "import-policy;"; - goto filtered; - } - - attr_new = bgp_attr_intern (&new_attr); - bgp_attr_unintern (&attr_new2); - - /* next hop check. */ - if (bgp_update_martian_nexthop (afi, safi, &new_attr)) - { - bgp_attr_unintern (&attr_new); - reason = "martian next-hop;"; - goto filtered; - } - - /* If the update is implicit withdraw. */ - if (ri) - { - ri->uptime = bgp_clock (); - - /* Same attribute comes in. */ - if (!CHECK_FLAG(ri->flags, BGP_INFO_REMOVED) - && attrhash_cmp (ri->attr, attr_new)) - { - - if (bgp_debug_update(peer, p, NULL, 1)) - { - bgp_info_addpath_rx_str(ri, buf2); - zlog_debug ("%s rcvd %s/%d%s for RS-client %s...duplicate ignored", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, buf2, rsclient->host); - } - - bgp_unlock_node (rn); - bgp_attr_unintern (&attr_new); - - return; - } - - /* Withdraw/Announce before we fully processed the withdraw */ - if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) - bgp_info_restore (rn, ri); - - /* Received Logging. */ - if (bgp_debug_update(peer, p, NULL, 1)) - { - bgp_info_addpath_rx_str(ri, buf2); - zlog_debug ("%s rcvd %s/%d%s for RS-client %s", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, buf2, rsclient->host); - } - - /* The attribute is changed. */ - bgp_info_set_flag (rn, ri, BGP_INFO_ATTR_CHANGED); - - /* Update to new attribute. */ - bgp_attr_unintern (&ri->attr); - ri->attr = attr_new; - - /* Update MPLS tag. */ - if (safi == SAFI_MPLS_VPN) - memcpy ((bgp_info_extra_get (ri))->tag, tag, 3); - - bgp_info_set_flag (rn, ri, BGP_INFO_VALID); - - /* Process change. */ - bgp_process (bgp, rn, afi, safi); - bgp_unlock_node (rn); - - return; - } - - /* Received Logging. */ - if (bgp_debug_update(peer, p, NULL, 1)) - { - bgp_info_addpath_rx_str(ri, buf2); - zlog_debug ("%s rcvd %s/%d%s for RS-client %s", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, buf2, rsclient->host); - } - - new = info_make(type, sub_type, 0, peer, attr_new, rn); - - /* Update MPLS tag. */ - if (safi == SAFI_MPLS_VPN) - memcpy ((bgp_info_extra_get (new))->tag, tag, 3); - - bgp_info_set_flag (rn, new, BGP_INFO_VALID); - - /* Register new BGP information. */ - bgp_info_add (rn, new); - - /* route_node_get lock */ - bgp_unlock_node (rn); - - /* Process change. */ - bgp_process (bgp, rn, afi, safi); - - return; - - filtered: - - /* This BGP update is filtered. Log the reason then update BGP entry. */ - if (bgp_debug_update(peer, p, NULL, 1)) - { - bgp_info_addpath_rx_str(ri, buf2); - zlog_debug ("%s rcvd UPDATE about %s/%d%s -- DENIED for RS-client %s due to: %s", - peer->host, - inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, buf2, rsclient->host, reason); - } - - if (ri) - bgp_rib_remove (rn, ri, peer, afi, safi); - - bgp_unlock_node (rn); - - return; -} - -static void -bgp_withdraw_rsclient (struct peer *rsclient, u_int32_t addpath_id, - afi_t afi, safi_t safi, struct peer *peer, - struct prefix *p, int type, int sub_type, - struct prefix_rd *prd, u_char *tag) -{ - struct bgp_node *rn; - struct bgp_info *ri; - char buf[SU_ADDRSTRLEN]; - - if (rsclient == peer) - return; - - rn = bgp_afi_node_get (rsclient->rib[afi][safi], afi, safi, p, prd); - - /* Lookup withdrawn route. */ - for (ri = rn->info; ri; ri = ri->next) - if (ri->peer == peer && ri->type == type && ri->sub_type == sub_type && - ri->addpath_rx_id == addpath_id) - break; - - /* Withdraw specified route from routing table. */ - if (ri && ! CHECK_FLAG (ri->flags, BGP_INFO_HISTORY)) - bgp_rib_withdraw (rn, ri, peer, afi, safi); - else if (bgp_debug_update(peer, p, NULL, 1)) - zlog_debug ("%s Can't find the route %s/%d", peer->host, - inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); - - /* Unlock bgp_node_get() lock. */ - bgp_unlock_node (rn); -} - static int bgp_update_main (struct peer *peer, struct prefix *p, u_int32_t addpath_id, struct attr *attr, afi_t afi, safi_t safi, int type, @@ -3135,25 +2487,8 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id, struct attr *attr, afi_t afi, safi_t safi, int type, int sub_type, struct prefix_rd *prd, u_char *tag, int soft_reconfig) { - struct peer *rsclient; - struct listnode *node, *nnode; - struct bgp *bgp; - int ret; - - ret = bgp_update_main (peer, p, addpath_id, attr, afi, safi, type, sub_type, - prd, tag, soft_reconfig); - - bgp = peer->bgp; - - /* Process the update for each RS-client. */ - for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, rsclient)) - { - if (CHECK_FLAG (rsclient->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) - bgp_update_rsclient (rsclient, addpath_id, afi, safi, attr, peer, p, - type, sub_type, prd, tag); - } - - return ret; + return bgp_update_main (peer, p, addpath_id, attr, afi, safi, type, sub_type, + prd, tag, soft_reconfig); } int @@ -3166,19 +2501,9 @@ bgp_withdraw (struct peer *peer, struct prefix *p, u_int32_t addpath_id, char buf2[30]; struct bgp_node *rn; struct bgp_info *ri; - struct peer *rsclient; - struct listnode *node, *nnode; bgp = peer->bgp; - /* Process the withdraw for each RS-client. */ - for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, rsclient)) - { - if (CHECK_FLAG (rsclient->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) - bgp_withdraw_rsclient (rsclient, addpath_id, afi, safi, peer, p, type, - sub_type, prd, tag); - } - /* Lookup node. */ rn = bgp_afi_node_get (bgp->rib[afi][safi], afi, safi, p, prd); @@ -3324,51 +2649,6 @@ bgp_announce_route_all (struct peer *peer) bgp_announce_route (peer, afi, safi); } -static void -bgp_soft_reconfig_table_rsclient (struct peer *rsclient, afi_t afi, - safi_t safi, struct bgp_table *table, struct prefix_rd *prd) -{ - struct bgp_node *rn; - struct bgp_adj_in *ain; - - if (! table) - table = rsclient->bgp->rib[afi][safi]; - - for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn)) - for (ain = rn->adj_in; ain; ain = ain->next) - { - struct bgp_info *ri = rn->info; - u_char *tag = (ri && ri->extra) ? ri->extra->tag : NULL; - - bgp_update_rsclient (rsclient, ri->addpath_rx_id, afi, safi, ain->attr, - ain->peer, &rn->p, ZEBRA_ROUTE_BGP, - BGP_ROUTE_NORMAL, prd, tag); - } -} - -void -bgp_soft_reconfig_rsclient (struct peer *rsclient, afi_t afi, safi_t safi) -{ - struct bgp_table *table; - struct bgp_node *rn; - - if (safi != SAFI_MPLS_VPN) - bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, NULL, NULL); - - else - for (rn = bgp_table_top (rsclient->bgp->rib[afi][safi]); rn; - rn = bgp_route_next (rn)) - if ((table = rn->info) != NULL) - { - struct prefix_rd prd; - prd.family = AF_UNSPEC; - prd.prefixlen = 64; - memcpy(&prd.val, rn->p.u.val, 8); - - bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, table, &prd); - } -} - static void bgp_soft_reconfig_table (struct peer *peer, afi_t afi, safi_t safi, struct bgp_table *table, struct prefix_rd *prd) @@ -3430,7 +2710,6 @@ bgp_soft_reconfig_in (struct peer *peer, afi_t afi, safi_t safi) struct bgp_clear_node_queue { struct bgp_node *rn; - enum bgp_clear_route_type purpose; }; static wq_item_status @@ -3449,7 +2728,7 @@ bgp_clear_route_node (struct work_queue *wq, void *data) * if that peer is using AddPath. */ for (ri = rn->info; ri; ri = ri->next) - if (ri->peer == peer || cnq->purpose == BGP_CLEAR_ROUTE_MY_RSCLIENT) + if (ri->peer == peer) { /* graceful restart STALE flag set. */ if (CHECK_FLAG (peer->sflags, PEER_STATUS_NSF_WAIT) @@ -3511,14 +2790,13 @@ bgp_clear_node_queue_init (struct peer *peer) static void bgp_clear_route_table (struct peer *peer, afi_t afi, safi_t safi, - struct bgp_table *table, struct peer *rsclient, - enum bgp_clear_route_type purpose) + struct bgp_table *table) { struct bgp_node *rn; if (! table) - table = (rsclient) ? rsclient->rib[afi][safi] : peer->bgp->rib[afi][safi]; + table = peer->bgp->rib[afi][safi]; /* If still no table => afi/safi isn't configured at all or smth. */ if (! table) @@ -3569,7 +2847,7 @@ bgp_clear_route_table (struct peer *peer, afi_t afi, safi_t safi, { ain_next = ain->next; - if (ain->peer == peer || purpose == BGP_CLEAR_ROUTE_MY_RSCLIENT) + if (ain->peer == peer) { bgp_adj_in_remove (rn, ain); bgp_unlock_node (rn); @@ -3579,7 +2857,7 @@ bgp_clear_route_table (struct peer *peer, afi_t afi, safi_t safi, } for (ri = rn->info; ri; ri = ri->next) - if (ri->peer == peer || purpose == BGP_CLEAR_ROUTE_MY_RSCLIENT) + if (ri->peer == peer) { struct bgp_clear_node_queue *cnq; @@ -3589,7 +2867,6 @@ bgp_clear_route_table (struct peer *peer, afi_t afi, safi_t safi, cnq = XCALLOC (MTYPE_BGP_CLEAR_NODE_QUEUE, sizeof (struct bgp_clear_node_queue)); cnq->rn = rn; - cnq->purpose = purpose; work_queue_add (peer->clear_node_queue, cnq); break; } @@ -3598,13 +2875,10 @@ bgp_clear_route_table (struct peer *peer, afi_t afi, safi_t safi, } void -bgp_clear_route (struct peer *peer, afi_t afi, safi_t safi, - enum bgp_clear_route_type purpose) +bgp_clear_route (struct peer *peer, afi_t afi, safi_t safi) { struct bgp_node *rn; struct bgp_table *table; - struct peer *rsclient; - struct listnode *node, *nnode; if (peer->clear_node_queue == NULL) bgp_clear_node_queue_init (peer); @@ -3629,31 +2903,13 @@ bgp_clear_route (struct peer *peer, afi_t afi, safi_t safi, if (!peer->clear_node_queue->thread) peer_lock (peer); - switch (purpose) - { - case BGP_CLEAR_ROUTE_NORMAL: - if (safi != SAFI_MPLS_VPN) - bgp_clear_route_table (peer, afi, safi, NULL, NULL, purpose); - else - for (rn = bgp_table_top (peer->bgp->rib[afi][safi]); rn; - rn = bgp_route_next (rn)) - if ((table = rn->info) != NULL) - bgp_clear_route_table (peer, afi, safi, table, NULL, purpose); - - for (ALL_LIST_ELEMENTS (peer->bgp->rsclient, node, nnode, rsclient)) - if (CHECK_FLAG(rsclient->af_flags[afi][safi], - PEER_FLAG_RSERVER_CLIENT)) - bgp_clear_route_table (peer, afi, safi, NULL, rsclient, purpose); - break; - - case BGP_CLEAR_ROUTE_MY_RSCLIENT: - bgp_clear_route_table (peer, afi, safi, NULL, peer, purpose); - break; - - default: - assert (0); - break; - } + if (safi != SAFI_MPLS_VPN) + bgp_clear_route_table (peer, afi, safi, NULL); + else + for (rn = bgp_table_top (peer->bgp->rib[afi][safi]); rn; + rn = bgp_route_next (rn)) + if ((table = rn->info) != NULL) + bgp_clear_route_table (peer, afi, safi, table); /* unlock if no nodes got added to the clear-node-queue. */ if (!peer->clear_node_queue->thread) @@ -3669,7 +2925,7 @@ bgp_clear_route_all (struct peer *peer) for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) - bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_NORMAL); + bgp_clear_route (peer, afi, safi); } void @@ -3988,252 +3244,20 @@ bgp_static_free (struct bgp_static *bgp_static) } static void -bgp_static_withdraw_rsclient (struct bgp *bgp, struct peer *rsclient, - struct prefix *p, afi_t afi, safi_t safi) +bgp_static_update_main (struct bgp *bgp, struct prefix *p, + struct bgp_static *bgp_static, afi_t afi, safi_t safi) { struct bgp_node *rn; struct bgp_info *ri; + struct bgp_info *new; + struct bgp_info info; + struct attr attr; + struct attr *attr_new; + int ret; - rn = bgp_afi_node_get (rsclient->rib[afi][safi], afi, safi, p, NULL); - - /* Check selected route and self inserted route. */ - for (ri = rn->info; ri; ri = ri->next) - if (ri->peer == bgp->peer_self - && ri->type == ZEBRA_ROUTE_BGP - && ri->sub_type == BGP_ROUTE_STATIC) - break; - - /* Withdraw static BGP route from routing table. */ - if (ri) - { - bgp_info_delete (rn, ri); - bgp_process (bgp, rn, afi, safi); - } - - /* Unlock bgp_node_lookup. */ - bgp_unlock_node (rn); -} - -static void -bgp_static_update_rsclient (struct peer *rsclient, struct prefix *p, - struct bgp_static *bgp_static, - afi_t afi, safi_t safi) -{ - struct bgp_node *rn; - struct bgp_info *ri; - struct bgp_info *new; - struct bgp_info info; - struct attr *attr_new; - struct attr attr; - struct attr new_attr; - struct attr_extra new_extra; - struct bgp *bgp; - int ret; - char buf[SU_ADDRSTRLEN]; - - bgp = rsclient->bgp; - - assert (bgp_static); - if (!bgp_static) - return; - - rn = bgp_afi_node_get (rsclient->rib[afi][safi], afi, safi, p, NULL); - - bgp_attr_default_set (&attr, BGP_ORIGIN_IGP); - - attr.nexthop = bgp_static->igpnexthop; - attr.med = bgp_static->igpmetric; - attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC); - - if (bgp_static->atomic) - attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE); - - /* Apply network route-map for export to this rsclient. */ - if (bgp_static->rmap.name) - { - struct attr attr_tmp = attr; - info.peer = rsclient; - info.attr = &attr_tmp; - - SET_FLAG (rsclient->rmap_type, PEER_RMAP_TYPE_EXPORT); - SET_FLAG (rsclient->rmap_type, PEER_RMAP_TYPE_NETWORK); - - ret = route_map_apply (bgp_static->rmap.map, p, RMAP_BGP, &info); - - rsclient->rmap_type = 0; - - if (ret == RMAP_DENYMATCH) - { - /* Free uninterned attribute. */ - bgp_attr_flush (&attr_tmp); - - /* Unintern original. */ - aspath_unintern (&attr.aspath); - bgp_static_withdraw_rsclient (bgp, rsclient, p, afi, safi); - bgp_attr_extra_free (&attr); - - return; - } - attr_new = bgp_attr_intern (&attr_tmp); - } - else - attr_new = bgp_attr_intern (&attr); - - new_attr.extra = &new_extra; - bgp_attr_dup(&new_attr, attr_new); - - SET_FLAG (bgp->peer_self->rmap_type, PEER_RMAP_TYPE_NETWORK); - - if (bgp_import_modifier (rsclient, bgp->peer_self, p, &new_attr, afi, safi) - == RMAP_DENY) - { - /* This BGP update is filtered. Log the reason then update BGP entry. */ - if (bgp_debug_update(rsclient, p, NULL, 1)) - zlog_debug ("Static UPDATE about %s/%d -- DENIED for RS-client %s due to: import-policy", - inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, rsclient->host); - - bgp->peer_self->rmap_type = 0; - - bgp_attr_unintern (&attr_new); - aspath_unintern (&attr.aspath); - bgp_attr_extra_free (&attr); - - bgp_static_withdraw_rsclient (bgp, rsclient, p, afi, safi); - - return; - } - - bgp->peer_self->rmap_type = 0; - - bgp_attr_unintern (&attr_new); - attr_new = bgp_attr_intern (&new_attr); - - for (ri = rn->info; ri; ri = ri->next) - if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP - && ri->sub_type == BGP_ROUTE_STATIC) - break; - - if (ri) - { - if (attrhash_cmp (ri->attr, attr_new) && - !CHECK_FLAG(ri->flags, BGP_INFO_REMOVED) && - !bgp_flag_check(bgp, BGP_FLAG_FORCE_STATIC_PROCESS)) - { - bgp_unlock_node (rn); - bgp_attr_unintern (&attr_new); - aspath_unintern (&attr.aspath); - bgp_attr_extra_free (&attr); - return; - } - else - { - /* The attribute is changed. */ - bgp_info_set_flag (rn, ri, BGP_INFO_ATTR_CHANGED); - - /* Rewrite BGP route information. */ - if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) - bgp_info_restore(rn, ri); - bgp_attr_unintern (&ri->attr); - ri->attr = attr_new; - ri->uptime = bgp_clock (); - - /* Nexthop reachability check. */ - if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK)) - { - if (bgp_find_or_add_nexthop (bgp, afi, ri, NULL, 0)) - bgp_info_set_flag (rn, ri, BGP_INFO_VALID); - else - { - if (BGP_DEBUG(nht, NHT)) - { - char buf1[INET6_ADDRSTRLEN]; - inet_ntop (p->family, &p->u.prefix, buf1, - INET6_ADDRSTRLEN); - zlog_debug("%s(%s): Route not in table, not advertising", - __FUNCTION__, buf1); - } - bgp_info_unset_flag (rn, ri, BGP_INFO_VALID); - } - } - else - { - /* Delete the NHT structure if any, if we're toggling between - * enabling/disabling import check. We deregister the route - * from NHT to avoid overloading NHT and the process interaction - */ - bgp_unlink_nexthop(ri); - bgp_info_set_flag (rn, ri, BGP_INFO_VALID); - } - /* Process change. */ - bgp_process (bgp, rn, afi, safi); - bgp_unlock_node (rn); - aspath_unintern (&attr.aspath); - bgp_attr_extra_free (&attr); - return; - } - } - - /* Make new BGP info. */ - new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0, bgp->peer_self, - attr_new, rn); - /* Nexthop reachability check. */ - if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK)) - { - if (bgp_find_or_add_nexthop (bgp, afi, new, NULL, 0)) - bgp_info_set_flag (rn, new, BGP_INFO_VALID); - else - { - if (BGP_DEBUG(nht, NHT)) - { - char buf1[INET6_ADDRSTRLEN]; - inet_ntop(p->family, &p->u.prefix, buf1, - INET6_ADDRSTRLEN); - zlog_debug("%s(%s): Route not in table, not advertising", __FUNCTION__, - buf1); - } - bgp_info_unset_flag (rn, new, BGP_INFO_VALID); - } - } - else - { - /* Delete the NHT structure if any, if we're toggling between - * enabling/disabling import check. We deregister the route - * from NHT to avoid overloading NHT and the process interaction - */ - bgp_unlink_nexthop(new); - bgp_info_set_flag (rn, new, BGP_INFO_VALID); - } - - /* Register new BGP information. */ - bgp_info_add (rn, new); - - /* route_node_get lock */ - bgp_unlock_node (rn); - - /* Process change. */ - bgp_process (bgp, rn, afi, safi); - - /* Unintern original. */ - aspath_unintern (&attr.aspath); - bgp_attr_extra_free (&attr); -} - -static void -bgp_static_update_main (struct bgp *bgp, struct prefix *p, - struct bgp_static *bgp_static, afi_t afi, safi_t safi) -{ - struct bgp_node *rn; - struct bgp_info *ri; - struct bgp_info *new; - struct bgp_info info; - struct attr attr; - struct attr *attr_new; - int ret; - - assert (bgp_static); - if (!bgp_static) - return; + assert (bgp_static); + if (!bgp_static) + return; rn = bgp_afi_node_get (bgp->rib[afi][safi], afi, safi, p, NULL); @@ -4396,16 +3420,7 @@ void bgp_static_update (struct bgp *bgp, struct prefix *p, struct bgp_static *bgp_static, afi_t afi, safi_t safi) { - struct peer *rsclient; - struct listnode *node, *nnode; - bgp_static_update_main (bgp, p, bgp_static, afi, safi); - - for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, rsclient)) - { - if (CHECK_FLAG (rsclient->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) - bgp_static_update_rsclient (rsclient, p, bgp_static, afi, safi); - } } static void @@ -4467,26 +3482,6 @@ bgp_static_withdraw (struct bgp *bgp, struct prefix *p, afi_t afi, bgp_unlock_node (rn); } -void -bgp_check_local_routes_rsclient (struct peer *rsclient, afi_t afi, safi_t safi) -{ - struct bgp_static *bgp_static; - struct bgp *bgp; - struct bgp_node *rn; - struct prefix *p; - - bgp = rsclient->bgp; - - for (rn = bgp_table_top (bgp->route[afi][safi]); rn; rn = bgp_route_next (rn)) - if ((bgp_static = rn->info) != NULL) - { - p = &rn->p; - - bgp_static_update_rsclient (rsclient, p, bgp_static, - afi, safi); - } -} - static void bgp_static_withdraw_vpnv4 (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi, struct prefix_rd *prd, u_char *tag) @@ -13618,490 +12613,70 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes, bgp_show_type_neighbor, use_json); } -DEFUN (show_ip_bgp_view_rsclient, - show_ip_bgp_view_rsclient_cmd, - "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD)", +#ifdef HAVE_IPV6 +DEFUN (show_bgp_view_neighbor_routes, + show_bgp_view_neighbor_routes_cmd, + "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", SHOW_STR - IP_STR BGP_STR "BGP view\n" "View name\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3) + "Detailed information on TCP and BGP neighbor connections\n" + "Neighbor to display information about\n" + "Neighbor to display information about\n" + "Neighbor on bgp configured interface\n" + "Display routes learned from neighbor\n" + "JavaScript Object Notation\n") { - struct bgp_table *table; struct peer *peer; + u_char use_json; - if (argc == 2) - peer = peer_lookup_in_view (vty, argv[0], argv[1], 0); + if (argv[argc - 1] && strcmp(argv[argc - 1], "json") == 0) + use_json = 1; else - peer = peer_lookup_in_view (vty, NULL, argv[0], 0); + use_json = 0; + if ((argc == 3 && argv[2] && strcmp(argv[2], "json") == 0) + || (argc == 2 && argv[1] && strcmp(argv[1], "json") != 0)) + peer = peer_lookup_in_view (vty, argv[0], argv[1], use_json); + else + peer = peer_lookup_in_view (vty, NULL, argv[0], use_json); + if (! peer) return CMD_WARNING; - if (! peer->afc[AFI_IP][SAFI_UNICAST]) - { - vty_out (vty, "%% Activate the neighbor for the address family first%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - if ( ! CHECK_FLAG (peer->af_flags[AFI_IP][SAFI_UNICAST], - PEER_FLAG_RSERVER_CLIENT)) - { - vty_out (vty, "%% Neighbor is not a Route-Server client%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - table = peer->rib[AFI_IP][SAFI_UNICAST]; - - return bgp_show_table (vty, table, &peer->remote_id, bgp_show_type_normal, - NULL, 0); + return bgp_show_neighbor_route (vty, peer, AFI_IP6, SAFI_UNICAST, + bgp_show_type_neighbor, use_json); } -ALIAS (show_ip_bgp_view_rsclient, - show_ip_bgp_rsclient_cmd, - "show ip bgp rsclient (A.B.C.D|X:X::X:X|WORD)", +ALIAS (show_bgp_view_neighbor_routes, + show_bgp_view_ipv6_neighbor_routes_cmd, + "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", SHOW_STR - IP_STR BGP_STR - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3) + "BGP view\n" + "View name\n" + "Address family\n" + "Detailed information on TCP and BGP neighbor connections\n" + "Neighbor to display information about\n" + "Neighbor to display information about\n" + "Neighbor on bgp configured interface\n" + "Display routes learned from neighbor\n" + "JavaScript Object Notation\n") -DEFUN (show_bgp_view_ipv4_safi_rsclient, - show_bgp_view_ipv4_safi_rsclient_cmd, - "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)", +DEFUN (show_bgp_view_neighbor_damp, + show_bgp_view_neighbor_damp_cmd, + "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", SHOW_STR BGP_STR "BGP view\n" "View name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3) -{ - struct bgp_table *table; - struct peer *peer; - safi_t safi; - - if (argc == 3) { - peer = peer_lookup_in_view (vty, argv[0], argv[2], 0); - safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - } else { - peer = peer_lookup_in_view (vty, NULL, argv[1], 0); - safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - } - - if (! peer) - return CMD_WARNING; - - if (! peer->afc[AFI_IP][safi]) - { - vty_out (vty, "%% Activate the neighbor for the address family first%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - if ( ! CHECK_FLAG (peer->af_flags[AFI_IP][safi], - PEER_FLAG_RSERVER_CLIENT)) - { - vty_out (vty, "%% Neighbor is not a Route-Server client%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - table = peer->rib[AFI_IP][safi]; - - return bgp_show_table (vty, table, &peer->remote_id, bgp_show_type_normal, - NULL, 0); -} - -ALIAS (show_bgp_view_ipv4_safi_rsclient, - show_bgp_ipv4_safi_rsclient_cmd, - "show bgp ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3) - -DEFUN (show_ip_bgp_view_rsclient_route, - show_ip_bgp_view_rsclient_route_cmd, - "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D", - SHOW_STR - IP_STR - BGP_STR - "BGP view\n" - "View name\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "Network in the BGP routing table to display\n") -{ - struct bgp *bgp; - struct peer *peer; - - /* BGP structure lookup. */ - if (argc == 3) - { - bgp = bgp_lookup_by_name (argv[0]); - if (bgp == NULL) - { - vty_out (vty, "Can't find BGP view %s%s", argv[0], VTY_NEWLINE); - return CMD_WARNING; - } - } - else - { - bgp = bgp_get_default (); - if (bgp == NULL) - { - vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - if (argc == 3) - peer = peer_lookup_in_view (vty, argv[0], argv[1], 0); - else - peer = peer_lookup_in_view (vty, NULL, argv[0], 0); - - if (! peer) - return CMD_WARNING; - - if (! peer->afc[AFI_IP][SAFI_UNICAST]) - { - vty_out (vty, "%% Activate the neighbor for the address family first%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - if ( ! CHECK_FLAG (peer->af_flags[AFI_IP][SAFI_UNICAST], - PEER_FLAG_RSERVER_CLIENT)) - { - vty_out (vty, "%% Neighbor is not a Route-Server client%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP][SAFI_UNICAST], - (argc == 3) ? argv[2] : argv[1], - AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, 0); -} - -ALIAS (show_ip_bgp_view_rsclient_route, - show_ip_bgp_rsclient_route_cmd, - "show ip bgp rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D", - SHOW_STR - IP_STR - BGP_STR - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "Network in the BGP routing table to display\n") - -DEFUN (show_bgp_view_ipv4_safi_rsclient_route, - show_bgp_view_ipv4_safi_rsclient_route_cmd, - "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "Network in the BGP routing table to display\n") -{ - struct bgp *bgp; - struct peer *peer; - safi_t safi; - - /* BGP structure lookup. */ - if (argc == 4) - { - bgp = bgp_lookup_by_name (argv[0]); - if (bgp == NULL) - { - vty_out (vty, "Can't find BGP view %s%s", argv[0], VTY_NEWLINE); - return CMD_WARNING; - } - } - else - { - bgp = bgp_get_default (); - if (bgp == NULL) - { - vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - if (argc == 4) { - peer = peer_lookup_in_view (vty, argv[0], argv[2], 0); - safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - } else { - peer = peer_lookup_in_view (vty, NULL, argv[1], 0); - safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - } - - if (! peer) - return CMD_WARNING; - - if (! peer->afc[AFI_IP][safi]) - { - vty_out (vty, "%% Activate the neighbor for the address family first%s", - VTY_NEWLINE); - return CMD_WARNING; -} - - if ( ! CHECK_FLAG (peer->af_flags[AFI_IP][safi], - PEER_FLAG_RSERVER_CLIENT)) - { - vty_out (vty, "%% Neighbor is not a Route-Server client%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP][safi], - (argc == 4) ? argv[3] : argv[2], - AFI_IP, safi, NULL, 0, BGP_PATH_ALL, 0); -} - -ALIAS (show_bgp_view_ipv4_safi_rsclient_route, - show_bgp_ipv4_safi_rsclient_route_cmd, - "show bgp ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "Network in the BGP routing table to display\n") - -DEFUN (show_ip_bgp_view_rsclient_prefix, - show_ip_bgp_view_rsclient_prefix_cmd, - "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D/M", - SHOW_STR - IP_STR - BGP_STR - "BGP view\n" - "View name\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "IP prefix /, e.g., 35.0.0.0/8\n") -{ - struct bgp *bgp; - struct peer *peer; - - /* BGP structure lookup. */ - if (argc == 3) - { - bgp = bgp_lookup_by_name (argv[0]); - if (bgp == NULL) - { - vty_out (vty, "Can't find BGP view %s%s", argv[0], VTY_NEWLINE); - return CMD_WARNING; - } - } - else - { - bgp = bgp_get_default (); - if (bgp == NULL) - { - vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - if (argc == 3) - peer = peer_lookup_in_view (vty, argv[0], argv[1], 0); - else - peer = peer_lookup_in_view (vty, NULL, argv[0], 0); - - if (! peer) - return CMD_WARNING; - - if (! peer->afc[AFI_IP][SAFI_UNICAST]) - { - vty_out (vty, "%% Activate the neighbor for the address family first%s", - VTY_NEWLINE); - return CMD_WARNING; -} - - if ( ! CHECK_FLAG (peer->af_flags[AFI_IP][SAFI_UNICAST], - PEER_FLAG_RSERVER_CLIENT)) -{ - vty_out (vty, "%% Neighbor is not a Route-Server client%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP][SAFI_UNICAST], - (argc == 3) ? argv[2] : argv[1], - AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, 0); -} - -ALIAS (show_ip_bgp_view_rsclient_prefix, - show_ip_bgp_rsclient_prefix_cmd, - "show ip bgp rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D/M", - SHOW_STR - IP_STR - BGP_STR - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "IP prefix /, e.g., 35.0.0.0/8\n") - -DEFUN (show_bgp_view_ipv4_safi_rsclient_prefix, - show_bgp_view_ipv4_safi_rsclient_prefix_cmd, - "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D/M", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "IP prefix /, e.g., 35.0.0.0/8\n") -{ - struct bgp *bgp; - struct peer *peer; - safi_t safi; - - /* BGP structure lookup. */ - if (argc == 4) - { - bgp = bgp_lookup_by_name (argv[0]); - if (bgp == NULL) - { - vty_out (vty, "Can't find BGP view %s%s", argv[0], VTY_NEWLINE); - return CMD_WARNING; - } - } - else - { - bgp = bgp_get_default (); - if (bgp == NULL) - { - vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - if (argc == 4) { - peer = peer_lookup_in_view (vty, argv[0], argv[2], 0); - safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - } else { - peer = peer_lookup_in_view (vty, NULL, argv[1], 0); - safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - } - - if (! peer) - return CMD_WARNING; - - if (! peer->afc[AFI_IP][safi]) - { - vty_out (vty, "%% Activate the neighbor for the address family first%s", - VTY_NEWLINE); - return CMD_WARNING; -} - - if ( ! CHECK_FLAG (peer->af_flags[AFI_IP][safi], - PEER_FLAG_RSERVER_CLIENT)) -{ - vty_out (vty, "%% Neighbor is not a Route-Server client%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP][safi], - (argc == 4) ? argv[3] : argv[2], - AFI_IP, safi, NULL, 1, BGP_PATH_ALL, 0); -} - -ALIAS (show_bgp_view_ipv4_safi_rsclient_prefix, - show_bgp_ipv4_safi_rsclient_prefix_cmd, - "show bgp ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D/M", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "IP prefix /, e.g., 35.0.0.0/8\n") - -#ifdef HAVE_IPV6 -DEFUN (show_bgp_view_neighbor_routes, - show_bgp_view_neighbor_routes_cmd, - "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") -{ - struct peer *peer; - u_char use_json; - - if (argv[argc - 1] && strcmp(argv[argc - 1], "json") == 0) - use_json = 1; - else - use_json = 0; - - if ((argc == 3 && argv[2] && strcmp(argv[2], "json") == 0) - || (argc == 2 && argv[1] && strcmp(argv[1], "json") != 0)) - peer = peer_lookup_in_view (vty, argv[0], argv[1], use_json); - else - peer = peer_lookup_in_view (vty, NULL, argv[0], use_json); - - if (! peer) - return CMD_WARNING; - - return bgp_show_neighbor_route (vty, peer, AFI_IP6, SAFI_UNICAST, - bgp_show_type_neighbor, use_json); -} - -ALIAS (show_bgp_view_neighbor_routes, - show_bgp_view_ipv6_neighbor_routes_cmd, - "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") - -DEFUN (show_bgp_view_neighbor_damp, - show_bgp_view_neighbor_damp_cmd, - "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the dampened routes received from neighbor\n" - "JavaScript Object Notation\n") + "Detailed information on TCP and BGP neighbor connections\n" + "Neighbor to display information about\n" + "Neighbor to display information about\n" + "Neighbor on bgp configured interface\n" + "Display the dampened routes received from neighbor\n" + "JavaScript Object Notation\n") { struct peer *peer; u_char use_json; @@ -14309,420 +12884,6 @@ ALIAS (show_bgp_view_neighbor_damp, "Display the dampened routes received from neighbor\n" "JavaScript Object Notation\n") -DEFUN (show_bgp_view_rsclient, - show_bgp_view_rsclient_cmd, - "show bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD)", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3) -{ - struct bgp_table *table; - struct peer *peer; - - if (argc == 2) - peer = peer_lookup_in_view (vty, argv[0], argv[1], 0); - else - peer = peer_lookup_in_view (vty, NULL, argv[0], 0); - - if (! peer) - return CMD_WARNING; - - if (! peer->afc[AFI_IP6][SAFI_UNICAST]) - { - vty_out (vty, "%% Activate the neighbor for the address family first%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - if ( ! CHECK_FLAG (peer->af_flags[AFI_IP6][SAFI_UNICAST], - PEER_FLAG_RSERVER_CLIENT)) - { - vty_out (vty, "%% Neighbor is not a Route-Server client%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - table = peer->rib[AFI_IP6][SAFI_UNICAST]; - - return bgp_show_table (vty, table, &peer->remote_id, bgp_show_type_normal, - NULL, 0); -} - -ALIAS (show_bgp_view_rsclient, - show_bgp_rsclient_cmd, - "show bgp rsclient (A.B.C.D|X:X::X:X|WORD)", - SHOW_STR - BGP_STR - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3) - -DEFUN (show_bgp_view_ipv6_safi_rsclient, - show_bgp_view_ipv6_safi_rsclient_cmd, - "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3) -{ - struct bgp_table *table; - struct peer *peer; - safi_t safi; - - if (argc == 3) { - peer = peer_lookup_in_view (vty, argv[0], argv[2], 0); - safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - } else { - peer = peer_lookup_in_view (vty, NULL, argv[1], 0); - safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - } - - if (! peer) - return CMD_WARNING; - - if (! peer->afc[AFI_IP6][safi]) - { - vty_out (vty, "%% Activate the neighbor for the address family first%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - if ( ! CHECK_FLAG (peer->af_flags[AFI_IP6][safi], - PEER_FLAG_RSERVER_CLIENT)) - { - vty_out (vty, "%% Neighbor is not a Route-Server client%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - table = peer->rib[AFI_IP6][safi]; - - return bgp_show_table (vty, table, &peer->remote_id, bgp_show_type_normal, - NULL, 0); -} - -ALIAS (show_bgp_view_ipv6_safi_rsclient, - show_bgp_ipv6_safi_rsclient_cmd, - "show bgp ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3) - -DEFUN (show_bgp_view_rsclient_route, - show_bgp_view_rsclient_route_cmd, - "show bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "Network in the BGP routing table to display\n") -{ - struct bgp *bgp; - struct peer *peer; - - /* BGP structure lookup. */ - if (argc == 3) - { - bgp = bgp_lookup_by_name (argv[0]); - if (bgp == NULL) - { - vty_out (vty, "Can't find BGP view %s%s", argv[0], VTY_NEWLINE); - return CMD_WARNING; - } - } - else - { - bgp = bgp_get_default (); - if (bgp == NULL) - { - vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - if (argc == 3) - peer = peer_lookup_in_view (vty, argv[0], argv[1], 0); - else - peer = peer_lookup_in_view (vty, NULL, argv[0], 0); - - if (! peer) - return CMD_WARNING; - - if (! peer->afc[AFI_IP6][SAFI_UNICAST]) - { - vty_out (vty, "%% Activate the neighbor for the address family first%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - if ( ! CHECK_FLAG (peer->af_flags[AFI_IP6][SAFI_UNICAST], - PEER_FLAG_RSERVER_CLIENT)) - { - vty_out (vty, "%% Neighbor is not a Route-Server client%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP6][SAFI_UNICAST], - (argc == 3) ? argv[2] : argv[1], - AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, 0); -} - -ALIAS (show_bgp_view_rsclient_route, - show_bgp_rsclient_route_cmd, - "show bgp rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X", - SHOW_STR - BGP_STR - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "Network in the BGP routing table to display\n") - -DEFUN (show_bgp_view_ipv6_safi_rsclient_route, - show_bgp_view_ipv6_safi_rsclient_route_cmd, - "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "Network in the BGP routing table to display\n") -{ - struct bgp *bgp; - struct peer *peer; - safi_t safi; - - /* BGP structure lookup. */ - if (argc == 4) - { - bgp = bgp_lookup_by_name (argv[0]); - if (bgp == NULL) - { - vty_out (vty, "Can't find BGP view %s%s", argv[0], VTY_NEWLINE); - return CMD_WARNING; - } - } - else - { - bgp = bgp_get_default (); - if (bgp == NULL) - { - vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - if (argc == 4) { - peer = peer_lookup_in_view (vty, argv[0], argv[2], 0); - safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - } else { - peer = peer_lookup_in_view (vty, NULL, argv[1], 0); - safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - } - - if (! peer) - return CMD_WARNING; - - if (! peer->afc[AFI_IP6][safi]) - { - vty_out (vty, "%% Activate the neighbor for the address family first%s", - VTY_NEWLINE); - return CMD_WARNING; -} - - if ( ! CHECK_FLAG (peer->af_flags[AFI_IP6][safi], - PEER_FLAG_RSERVER_CLIENT)) - { - vty_out (vty, "%% Neighbor is not a Route-Server client%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP6][safi], - (argc == 4) ? argv[3] : argv[2], - AFI_IP6, safi, NULL, 0, BGP_PATH_ALL, 0); -} - -ALIAS (show_bgp_view_ipv6_safi_rsclient_route, - show_bgp_ipv6_safi_rsclient_route_cmd, - "show bgp ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "Network in the BGP routing table to display\n") - -DEFUN (show_bgp_view_rsclient_prefix, - show_bgp_view_rsclient_prefix_cmd, - "show bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "IPv6 prefix /, e.g., 3ffe::/16\n") -{ - struct bgp *bgp; - struct peer *peer; - - /* BGP structure lookup. */ - if (argc == 3) - { - bgp = bgp_lookup_by_name (argv[0]); - if (bgp == NULL) - { - vty_out (vty, "Can't find BGP view %s%s", argv[0], VTY_NEWLINE); - return CMD_WARNING; - } - } - else - { - bgp = bgp_get_default (); - if (bgp == NULL) - { - vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - if (argc == 3) - peer = peer_lookup_in_view (vty, argv[0], argv[1], 0); - else - peer = peer_lookup_in_view (vty, NULL, argv[0], 0); - - if (! peer) - return CMD_WARNING; - - if (! peer->afc[AFI_IP6][SAFI_UNICAST]) - { - vty_out (vty, "%% Activate the neighbor for the address family first%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - if ( ! CHECK_FLAG (peer->af_flags[AFI_IP6][SAFI_UNICAST], - PEER_FLAG_RSERVER_CLIENT)) - { - vty_out (vty, "%% Neighbor is not a Route-Server client%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP6][SAFI_UNICAST], - (argc == 3) ? argv[2] : argv[1], - AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, 0); -} - -ALIAS (show_bgp_view_rsclient_prefix, - show_bgp_rsclient_prefix_cmd, - "show bgp rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M", - SHOW_STR - BGP_STR - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "IPv6 prefix /, e.g., 3ffe::/16\n") - -DEFUN (show_bgp_view_ipv6_safi_rsclient_prefix, - show_bgp_view_ipv6_safi_rsclient_prefix_cmd, - "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "IP prefix /, e.g., 3ffe::/16\n") -{ - struct bgp *bgp; - struct peer *peer; - safi_t safi; - - /* BGP structure lookup. */ - if (argc == 4) - { - bgp = bgp_lookup_by_name (argv[0]); - if (bgp == NULL) - { - vty_out (vty, "Can't find BGP view %s%s", argv[0], VTY_NEWLINE); - return CMD_WARNING; - } - } - else - { - bgp = bgp_get_default (); - if (bgp == NULL) - { - vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - if (argc == 4) { - peer = peer_lookup_in_view (vty, argv[0], argv[2], 0); - safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - } else { - peer = peer_lookup_in_view (vty, NULL, argv[1], 0); - safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - } - - if (! peer) - return CMD_WARNING; - - if (! peer->afc[AFI_IP6][safi]) - { - vty_out (vty, "%% Activate the neighbor for the address family first%s", - VTY_NEWLINE); - return CMD_WARNING; -} - - if ( ! CHECK_FLAG (peer->af_flags[AFI_IP6][safi], - PEER_FLAG_RSERVER_CLIENT)) -{ - vty_out (vty, "%% Neighbor is not a Route-Server client%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP6][safi], - (argc == 4) ? argv[3] : argv[2], - AFI_IP6, safi, NULL, 1, BGP_PATH_ALL, 0); -} - -ALIAS (show_bgp_view_ipv6_safi_rsclient_prefix, - show_bgp_ipv6_safi_rsclient_prefix_cmd, - "show bgp ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR3 - "IP prefix /, e.g., 3ffe::/16\n") - #endif /* HAVE_IPV6 */ struct bgp_table *bgp_distance_table; @@ -15634,20 +13795,8 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_flap_route_map_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_flap_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_damp_cmd); - install_element (VIEW_NODE, &show_ip_bgp_rsclient_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_cmd); - install_element (VIEW_NODE, &show_ip_bgp_rsclient_route_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_rsclient_prefix_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_prefix_cmd); install_element (VIEW_NODE, &show_ip_bgp_view_neighbor_advertised_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_view_neighbor_received_routes_cmd); - install_element (VIEW_NODE, &show_ip_bgp_view_rsclient_cmd); - install_element (VIEW_NODE, &show_bgp_view_ipv4_safi_rsclient_cmd); - install_element (VIEW_NODE, &show_ip_bgp_view_rsclient_route_cmd); - install_element (VIEW_NODE, &show_bgp_view_ipv4_safi_rsclient_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_view_rsclient_prefix_cmd); - install_element (VIEW_NODE, &show_bgp_view_ipv4_safi_rsclient_prefix_cmd); /* Restricted node: VIEW_NODE - (set of dangerous commands) */ install_element (RESTRICTED_NODE, &show_ip_bgp_route_cmd); @@ -15687,14 +13836,6 @@ bgp_route_init (void) install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community2_exact_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community3_exact_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community4_exact_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_route_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_route_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_prefix_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_prefix_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_view_rsclient_route_cmd); - install_element (RESTRICTED_NODE, &show_bgp_view_ipv4_safi_rsclient_route_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_view_rsclient_prefix_cmd); - install_element (RESTRICTED_NODE, &show_bgp_view_ipv4_safi_rsclient_prefix_cmd); install_element (ENABLE_NODE, &show_ip_bgp_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_cmd); @@ -15781,20 +13922,8 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_flap_route_map_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_flap_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_damp_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_rsclient_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_rsclient_route_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_route_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_rsclient_prefix_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_prefix_cmd); install_element (ENABLE_NODE, &show_ip_bgp_view_neighbor_advertised_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_view_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_view_rsclient_cmd); - install_element (ENABLE_NODE, &show_bgp_view_ipv4_safi_rsclient_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_view_rsclient_route_cmd); - install_element (ENABLE_NODE, &show_bgp_view_ipv4_safi_rsclient_route_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_view_rsclient_prefix_cmd); - install_element (ENABLE_NODE, &show_bgp_view_ipv4_safi_rsclient_prefix_cmd); /* BGP dampening clear commands */ install_element (ENABLE_NODE, &clear_ip_bgp_dampening_cmd); @@ -15893,12 +14022,6 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_flap_cmd); install_element (VIEW_NODE, &show_bgp_neighbor_damp_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_damp_cmd); - install_element (VIEW_NODE, &show_bgp_rsclient_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_cmd); - install_element (VIEW_NODE, &show_bgp_rsclient_route_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_route_cmd); - install_element (VIEW_NODE, &show_bgp_rsclient_prefix_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_prefix_cmd); install_element (VIEW_NODE, &show_bgp_view_cmd); install_element (VIEW_NODE, &show_bgp_view_ipv6_cmd); install_element (VIEW_NODE, &show_bgp_view_route_cmd); @@ -15917,12 +14040,6 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_bgp_view_ipv6_neighbor_flap_cmd); install_element (VIEW_NODE, &show_bgp_view_neighbor_damp_cmd); install_element (VIEW_NODE, &show_bgp_view_ipv6_neighbor_damp_cmd); - install_element (VIEW_NODE, &show_bgp_view_rsclient_cmd); - install_element (VIEW_NODE, &show_bgp_view_ipv6_safi_rsclient_cmd); - install_element (VIEW_NODE, &show_bgp_view_rsclient_route_cmd); - install_element (VIEW_NODE, &show_bgp_view_ipv6_safi_rsclient_route_cmd); - install_element (VIEW_NODE, &show_bgp_view_rsclient_prefix_cmd); - install_element (VIEW_NODE, &show_bgp_view_ipv6_safi_rsclient_prefix_cmd); /* Restricted: * VIEW_NODE - (set of dangerous commands) - (commands dependent on prev) @@ -15955,20 +14072,12 @@ bgp_route_init (void) install_element (RESTRICTED_NODE, &show_bgp_ipv6_community3_exact_cmd); install_element (RESTRICTED_NODE, &show_bgp_community4_exact_cmd); install_element (RESTRICTED_NODE, &show_bgp_ipv6_community4_exact_cmd); - install_element (RESTRICTED_NODE, &show_bgp_rsclient_route_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_route_cmd); - install_element (RESTRICTED_NODE, &show_bgp_rsclient_prefix_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_prefix_cmd); install_element (RESTRICTED_NODE, &show_bgp_view_route_cmd); install_element (RESTRICTED_NODE, &show_bgp_view_ipv6_route_cmd); install_element (RESTRICTED_NODE, &show_bgp_view_prefix_cmd); install_element (RESTRICTED_NODE, &show_bgp_view_ipv6_prefix_cmd); install_element (RESTRICTED_NODE, &show_bgp_view_neighbor_received_prefix_filter_cmd); install_element (RESTRICTED_NODE, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd); - install_element (RESTRICTED_NODE, &show_bgp_view_rsclient_route_cmd); - install_element (RESTRICTED_NODE, &show_bgp_view_ipv6_safi_rsclient_route_cmd); - install_element (RESTRICTED_NODE, &show_bgp_view_rsclient_prefix_cmd); - install_element (RESTRICTED_NODE, &show_bgp_view_ipv6_safi_rsclient_prefix_cmd); install_element (ENABLE_NODE, &show_bgp_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_cmd); @@ -16029,12 +14138,6 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_flap_cmd); install_element (ENABLE_NODE, &show_bgp_neighbor_damp_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_damp_cmd); - install_element (ENABLE_NODE, &show_bgp_rsclient_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_cmd); - install_element (ENABLE_NODE, &show_bgp_rsclient_route_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_route_cmd); - install_element (ENABLE_NODE, &show_bgp_rsclient_prefix_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_prefix_cmd); install_element (ENABLE_NODE, &show_bgp_view_cmd); install_element (ENABLE_NODE, &show_bgp_view_ipv6_cmd); install_element (ENABLE_NODE, &show_bgp_view_route_cmd); @@ -16053,12 +14156,6 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_bgp_view_ipv6_neighbor_flap_cmd); install_element (ENABLE_NODE, &show_bgp_view_neighbor_damp_cmd); install_element (ENABLE_NODE, &show_bgp_view_ipv6_neighbor_damp_cmd); - install_element (ENABLE_NODE, &show_bgp_view_rsclient_cmd); - install_element (ENABLE_NODE, &show_bgp_view_ipv6_safi_rsclient_cmd); - install_element (ENABLE_NODE, &show_bgp_view_rsclient_route_cmd); - install_element (ENABLE_NODE, &show_bgp_view_ipv6_safi_rsclient_route_cmd); - install_element (ENABLE_NODE, &show_bgp_view_rsclient_prefix_cmd); - install_element (ENABLE_NODE, &show_bgp_view_ipv6_safi_rsclient_prefix_cmd); /* Statistics */ install_element (ENABLE_NODE, &show_bgp_statistics_cmd); diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index 0d2134e99c..60152e9470 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -188,20 +188,9 @@ struct bgp_static #define ROUTE_MAP_OUT_NAME(F) ((F)->map[RMAP_OUT].name) #define ROUTE_MAP_OUT(F) ((F)->map[RMAP_OUT].map) -#define ROUTE_MAP_IMPORT_NAME(F) ((F)->map[RMAP_IMPORT].name) -#define ROUTE_MAP_IMPORT(F) ((F)->map[RMAP_IMPORT].map) -#define ROUTE_MAP_EXPORT_NAME(F) ((F)->map[RMAP_EXPORT].name) -#define ROUTE_MAP_EXPORT(F) ((F)->map[RMAP_EXPORT].map) - #define UNSUPPRESS_MAP_NAME(F) ((F)->usmap.name) #define UNSUPPRESS_MAP(F) ((F)->usmap.map) -enum bgp_clear_route_type -{ - BGP_CLEAR_ROUTE_NORMAL, - BGP_CLEAR_ROUTE_MY_RSCLIENT -}; - enum bgp_path_type { BGP_PATH_ALL, @@ -225,10 +214,7 @@ extern void bgp_stop_announce_route_timer(struct peer_af *paf); extern void bgp_announce_route_all (struct peer *); extern void bgp_default_originate (struct peer *, afi_t, safi_t, int); extern void bgp_soft_reconfig_in (struct peer *, afi_t, safi_t); -extern void bgp_soft_reconfig_rsclient (struct peer *, afi_t, safi_t); -extern void bgp_check_local_routes_rsclient (struct peer *rsclient, afi_t afi, safi_t safi); -extern void bgp_clear_route (struct peer *, afi_t, safi_t, - enum bgp_clear_route_type); +extern void bgp_clear_route (struct peer *, afi_t, safi_t); extern void bgp_clear_route_all (struct peer *); extern void bgp_clear_adj_in (struct peer *, afi_t, safi_t); extern void bgp_clear_stale_route (struct peer *, afi_t, safi_t); @@ -281,7 +267,7 @@ extern void bgp_process (struct bgp *, struct bgp_node *, afi_t, safi_t); * Add an end-of-initial-update marker to the process queue. This is just a * queue element with NULL bgp node. */ -extern void bgp_add_eoiu_mark (struct bgp *, bgp_table_t); +extern void bgp_add_eoiu_mark (struct bgp *); extern int bgp_config_write_table_map (struct vty *, struct bgp *, afi_t, safi_t, int *); extern int bgp_config_write_network (struct vty *, struct bgp *, afi_t, safi_t, int *); diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index a3eb24b3e3..d402e60ab6 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -2662,7 +2662,7 @@ bgp_route_set_delete (struct vty *vty, struct route_map_index *index, } /* - * This is the workhorse routine for processing in/out/import/export routemap + * This is the workhorse routine for processing in/out routemap * modifications. */ static void @@ -2680,7 +2680,6 @@ bgp_route_map_process_peer (const char *rmap_name, struct route_map *map, filter = &peer->filter[afi][safi]; /* * in is for non-route-server clients, - * import/export is for route-server clients, * out is for all peers */ if (!CHECK_FLAG(peer->flags, PEER_FLAG_RSERVER_CLIENT)) @@ -2720,20 +2719,6 @@ bgp_route_map_process_peer (const char *rmap_name, struct route_map *map, { update = 0; - if (filter->map[RMAP_IMPORT].name && - (strcmp(rmap_name, filter->map[RMAP_IMPORT].name) == 0)) - { - filter->map[RMAP_IMPORT].map = map; - update = 1; - } - - if (filter->map[RMAP_EXPORT].name && - (strcmp(rmap_name, filter->map[RMAP_EXPORT].name) == 0)) - { - filter->map[RMAP_EXPORT].map = map; - update = 1; - } - if (update && route_update && peer->status == Established) { if (CHECK_FLAG (peer->af_flags[afi][safi], diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index 45d5a9eb71..1df24859f5 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -118,7 +118,6 @@ bgp_table_init (afi_t afi, safi_t safi) rt->route_table->info = rt; bgp_table_lock (rt); - rt->type = BGP_TABLE_MAIN; rt->afi = afi; rt->safi = safi; diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index ce9b9fac0e..770f62a961 100644 --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h @@ -23,16 +23,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "table.h" -typedef enum -{ - BGP_TABLE_MAIN, - BGP_TABLE_RSCLIENT, -} bgp_table_t; - struct bgp_table { - bgp_table_t type; - /* afi/safi of this table */ afi_t afi; safi_t safi; diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index cfb3c79767..a250a7d4bd 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -375,13 +375,11 @@ updgrp_hash_key_make (void *p) /* * There are certain peers that must get their own update-group: * - lonesoul peers - * - route server clients * - peers that negotiated ORF */ if (CHECK_FLAG (peer->flags, PEER_FLAG_LONESOUL) || CHECK_FLAG (peer->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) || - CHECK_FLAG (peer->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) || - CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) + CHECK_FLAG (peer->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)) key = jhash_1word (jhash (peer->host, strlen (peer->host), SEED2), key); return key; @@ -492,8 +490,7 @@ updgrp_hash_cmp (const void *p1, const void *p2) if ((CHECK_FLAG (pe1->flags, PEER_FLAG_LONESOUL) || CHECK_FLAG (pe1->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) || - CHECK_FLAG (pe1->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) || - CHECK_FLAG (pe1->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) && + CHECK_FLAG (pe1->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)) && !sockunion_same (&pe1->su, &pe2->su)) return 0; diff --git a/bgpd/bgp_updgrp.h b/bgpd/bgp_updgrp.h index 427168db5a..cbaf65ed4c 100644 --- a/bgpd/bgp_updgrp.h +++ b/bgpd/bgp_updgrp.h @@ -39,6 +39,7 @@ PEER_FLAG_SEND_EXT_COMMUNITY | \ PEER_FLAG_DEFAULT_ORIGINATE | \ PEER_FLAG_REFLECTOR_CLIENT | \ + PEER_FLAG_RSERVER_CLIENT | \ PEER_FLAG_NEXTHOP_SELF | \ PEER_FLAG_NEXTHOP_UNCHANGED | \ PEER_FLAG_FORCE_NEXTHOP_SELF | \ @@ -472,7 +473,7 @@ bgp_adj_out_unset_subgroup (struct bgp_node *rn, u_int32_t addpath_tx_id); void subgroup_announce_table (struct update_subgroup *subgrp, - struct bgp_table *table, int rsclient); + struct bgp_table *table); extern void subgroup_trigger_write (struct update_subgroup *subgrp); diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index cc2fb8afd5..eeb6643573 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -578,14 +578,13 @@ subgroup_clear_table (struct update_subgroup *subgrp) */ void subgroup_announce_table (struct update_subgroup *subgrp, - struct bgp_table *table, int rsclient) + struct bgp_table *table) { struct bgp_node *rn; struct bgp_info *ri; struct attr attr; struct attr_extra extra; struct peer *peer; - struct peer *onlypeer; afi_t afi; safi_t safi; int addpath_capable; @@ -595,19 +594,14 @@ subgroup_announce_table (struct update_subgroup *subgrp, safi = SUBGRP_SAFI (subgrp); addpath_capable = bgp_addpath_encode_tx (peer, afi, safi); - onlypeer = ((SUBGRP_PCOUNT (subgrp) == 1) ? - (SUBGRP_PFIRST (subgrp))->peer : NULL); - if (rsclient) - assert(onlypeer); - if (!table) - table = (rsclient) ? onlypeer->rib[afi][safi] : peer->bgp->rib[afi][safi]; + table = peer->bgp->rib[afi][safi]; if (safi != SAFI_MPLS_VPN && CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) subgroup_default_originate (subgrp, 0); - /* It's initialized in bgp_announce_[check|check_rsclient]() */ + /* It's initialized in bgp_announce_check() */ attr.extra = &extra; for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn)) @@ -616,8 +610,7 @@ subgroup_announce_table (struct update_subgroup *subgrp, if (CHECK_FLAG (ri->flags, BGP_INFO_SELECTED) || (addpath_capable && bgp_addpath_tx_path(peer, afi, safi, ri))) { - if (!rsclient - && subgroup_announce_check (ri, subgrp, &rn->p, &attr)) + if (subgroup_announce_check (ri, subgrp, &rn->p, &attr)) bgp_adj_out_set_subgroup (rn, subgrp, &attr, ri); else bgp_adj_out_unset_subgroup (rn, subgrp, 1, ri->addpath_tx_id); @@ -650,7 +643,6 @@ subgroup_announce_route (struct update_subgroup *subgrp) struct bgp_node *rn; struct bgp_table *table; struct peer *onlypeer; - struct peer *peer; if (update_subgroup_needs_refresh (subgrp)) { @@ -669,17 +661,12 @@ subgroup_announce_route (struct update_subgroup *subgrp) return; if (SUBGRP_SAFI (subgrp) != SAFI_MPLS_VPN) - subgroup_announce_table (subgrp, NULL, 0); + subgroup_announce_table (subgrp, NULL); else for (rn = bgp_table_top (update_subgroup_rib (subgrp)); rn; rn = bgp_route_next (rn)) if ((table = (rn->info)) != NULL) - subgroup_announce_table (subgrp, table, 0); - - peer = SUBGRP_PEER(subgrp); - if (CHECK_FLAG(peer->af_flags[SUBGRP_AFI(subgrp)][SUBGRP_SAFI(subgrp)], - PEER_FLAG_RSERVER_CLIENT)) - subgroup_announce_table (subgrp, NULL, 1); + subgroup_announce_table (subgrp, table); } void diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 753f529aad..c71baa2a1e 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -3794,156 +3794,6 @@ DEFUN (no_neighbor_route_reflector_client, PEER_FLAG_REFLECTOR_CLIENT); } -static int -peer_rsclient_set_vty (struct vty *vty, const char *peer_str, - int afi, int safi) -{ - int ret; - struct bgp *bgp; - struct peer *peer; - struct peer_group *group; - struct listnode *node, *nnode; - struct bgp_filter *pfilter; - struct bgp_filter *gfilter; - int locked_and_added = 0; - - bgp = vty->index; - - peer = peer_and_group_lookup_vty (vty, peer_str); - if ( ! peer ) - return CMD_WARNING; - - /* If it is already a RS-Client, don't do anything. */ - if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) - return CMD_SUCCESS; - - if ( ! peer_rsclient_active (peer) ) - { - peer = peer_lock (peer); /* rsclient peer list reference */ - listnode_add_sort (bgp->rsclient, peer); - locked_and_added = 1; - } - - ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); - if (ret < 0) - { - if (locked_and_added) - { - listnode_delete (bgp->rsclient, peer); - peer_unlock (peer); /* rsclient peer list reference */ - } - - return bgp_vty_return (vty, ret); - } - - peer->rib[afi][safi] = bgp_table_init (afi, safi); - peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; - /* RIB peer reference. Released when table is free'd in bgp_table_free. */ - peer->rib[afi][safi]->owner = peer_lock (peer); - - /* Check for existing 'network' and 'redistribute' routes. */ - bgp_check_local_routes_rsclient (peer, afi, safi); - - /* Check for routes for peers configured with 'soft-reconfiguration'. */ - bgp_soft_reconfig_rsclient (peer, afi, safi); - - if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) - { - group = peer->group; - gfilter = &peer->filter[afi][safi]; - - for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) - { - pfilter = &peer->filter[afi][safi]; - - /* Members of a non-RS-Client group should not be RS-Clients, as that - is checked when the become part of the peer-group */ - ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); - if (ret < 0) - return bgp_vty_return (vty, ret); - - /* Make peer's RIB point to group's RIB. */ - peer->rib[afi][safi] = group->conf->rib[afi][safi]; - - /* Import policy. */ - if (pfilter->map[RMAP_IMPORT].name) - XFREE(MTYPE_BGP_FILTER_NAME, pfilter->map[RMAP_IMPORT].name); - if (gfilter->map[RMAP_IMPORT].name) - { - pfilter->map[RMAP_IMPORT].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, - gfilter->map[RMAP_IMPORT].name); - pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; - } - else - { - pfilter->map[RMAP_IMPORT].name = NULL; - pfilter->map[RMAP_IMPORT].map = NULL; - } - - /* Export policy. */ - if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) - { - pfilter->map[RMAP_EXPORT].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, - gfilter->map[RMAP_EXPORT].name); - pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; - } - } - } - return CMD_SUCCESS; -} - -static int -peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, - int afi, int safi) -{ - int ret; - struct bgp *bgp; - struct peer *peer; - struct peer_group *group; - struct listnode *node, *nnode; - - bgp = vty->index; - - peer = peer_and_group_lookup_vty (vty, peer_str); - if ( ! peer ) - return CMD_WARNING; - - /* If it is not a RS-Client, don't do anything. */ - if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) - return CMD_SUCCESS; - - if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) - { - group = peer->group; - - for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) - { - ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); - if (ret < 0) - return bgp_vty_return (vty, ret); - - peer->rib[afi][safi] = NULL; - } - - peer = group->conf; - } - - ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); - if (ret < 0) - return bgp_vty_return (vty, ret); - - if ( ! peer_rsclient_active (peer) ) - { - bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); - listnode_delete (bgp->rsclient, peer); - peer_unlock (peer); /* peer bgp rsclient reference */ - } - - bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); - - return CMD_SUCCESS; -} - /* neighbor route-server-client. */ DEFUN (neighbor_route_server_client, neighbor_route_server_client_cmd, @@ -3952,8 +3802,14 @@ DEFUN (neighbor_route_server_client, NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Server client\n") { - return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), - bgp_node_safi(vty)); + struct peer *peer; + + peer = peer_and_group_lookup_vty (vty, argv[0]); + if (! peer) + return CMD_WARNING; + return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + bgp_node_safi (vty), + PEER_FLAG_RSERVER_CLIENT); } DEFUN (no_neighbor_route_server_client, @@ -3964,8 +3820,9 @@ DEFUN (no_neighbor_route_server_client, NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Server client\n") { - return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), - bgp_node_safi(vty)); + return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + bgp_node_safi (vty), + PEER_FLAG_RSERVER_CLIENT); } DEFUN (neighbor_nexthop_local_unchanged, @@ -5349,10 +5206,6 @@ peer_route_map_set_vty (struct vty *vty, const char *ip_str, direct = RMAP_IN; else if (strncmp (direct_str, "o", 1) == 0) direct = RMAP_OUT; - else if (strncmp (direct_str, "im", 2) == 0) - direct = RMAP_IMPORT; - else if (strncmp (direct_str, "e", 1) == 0) - direct = RMAP_EXPORT; ret = peer_route_map_set (peer, afi, safi, direct, name_str); @@ -5376,10 +5229,6 @@ peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, direct = RMAP_IN; else if (strncmp (direct_str, "o", 1) == 0) direct = RMAP_OUT; - else if (strncmp (direct_str, "im", 2) == 0) - direct = RMAP_IMPORT; - else if (strncmp (direct_str, "e", 1) == 0) - direct = RMAP_EXPORT; ret = peer_route_map_unset (peer, afi, safi, direct); @@ -5388,15 +5237,13 @@ peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, DEFUN (neighbor_route_map, neighbor_route_map_cmd, - NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", + NEIGHBOR_CMD2 "route-map WORD (in|out)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Apply route map to neighbor\n" "Name of route map\n" "Apply map to incoming routes\n" - "Apply map to outbound routes\n" - "Apply map to routes going into a Route-Server client's table\n" - "Apply map to routes coming from a Route-Server client") + "Apply map to outbound routes\n") { return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), bgp_node_safi (vty), argv[1], argv[2]); @@ -5404,16 +5251,14 @@ DEFUN (neighbor_route_map, DEFUN (no_neighbor_route_map, no_neighbor_route_map_cmd, - NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", + NO_NEIGHBOR_CMD2 "route-map WORD (in|out)", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Apply route map to neighbor\n" "Name of route map\n" "Apply map to incoming routes\n" - "Apply map to outbound routes\n" - "Apply map to routes going into a Route-Server client's table\n" - "Apply map to routes coming from a Route-Server client") + "Apply map to outbound routes\n") { return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), bgp_node_safi (vty), argv[2]); @@ -5788,7 +5633,6 @@ DEFUN (neighbor_addpath_tx_all_paths, { struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[0]); if (! peer) return CMD_WARNING; @@ -8199,171 +8043,6 @@ ALIAS (clear_bgp_as_soft, "Clear peers with the AS number\n" BGP_SOFT_STR) -/* RS-client soft reconfiguration. */ -#ifdef HAVE_IPV6 -DEFUN (clear_bgp_all_rsclient, - clear_bgp_all_rsclient_cmd, - "clear bgp * rsclient", - CLEAR_STR - BGP_STR - "Clear all peers\n" - BGP_SOFT_RSCLIENT_RIB_STR) -{ - if (argc == 1) - return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_RSCLIENT, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_RSCLIENT, NULL); -} - -ALIAS (clear_bgp_all_rsclient, - clear_bgp_ipv6_all_rsclient_cmd, - "clear bgp ipv6 * rsclient", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all peers\n" - BGP_SOFT_RSCLIENT_RIB_STR) - -ALIAS (clear_bgp_all_rsclient, - clear_bgp_instance_all_rsclient_cmd, - "clear bgp view WORD * rsclient", - CLEAR_STR - BGP_STR - "BGP view\n" - "view name\n" - "Clear all peers\n" - BGP_SOFT_RSCLIENT_RIB_STR) - -ALIAS (clear_bgp_all_rsclient, - clear_bgp_ipv6_instance_all_rsclient_cmd, - "clear bgp ipv6 view WORD * rsclient", - CLEAR_STR - BGP_STR - "Address family\n" - "BGP view\n" - "view name\n" - "Clear all peers\n" - BGP_SOFT_RSCLIENT_RIB_STR) -#endif /* HAVE_IPV6 */ - -DEFUN (clear_ip_bgp_all_rsclient, - clear_ip_bgp_all_rsclient_cmd, - "clear ip bgp * rsclient", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - BGP_SOFT_RSCLIENT_RIB_STR) -{ - if (argc == 1) - return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_RSCLIENT, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_RSCLIENT, NULL); -} - -ALIAS (clear_ip_bgp_all_rsclient, - clear_ip_bgp_instance_all_rsclient_cmd, - "clear ip bgp view WORD * rsclient", - CLEAR_STR - IP_STR - BGP_STR - "BGP view\n" - "view name\n" - "Clear all peers\n" - BGP_SOFT_RSCLIENT_RIB_STR) - -#ifdef HAVE_IPV6 -DEFUN (clear_bgp_peer_rsclient, - clear_bgp_peer_rsclient_cmd, - "clear bgp (A.B.C.D|X:X::X:X|WORD) rsclient", - CLEAR_STR - BGP_STR - "BGP neighbor IP address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_RSCLIENT_RIB_STR) -{ - if (argc == 2) - return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_RSCLIENT, argv[1]); - - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_RSCLIENT, argv[0]); -} - -ALIAS (clear_bgp_peer_rsclient, - clear_bgp_ipv6_peer_rsclient_cmd, - "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) rsclient", - CLEAR_STR - BGP_STR - "Address family\n" - "BGP neighbor IP address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_RSCLIENT_RIB_STR) - -ALIAS (clear_bgp_peer_rsclient, - clear_bgp_instance_peer_rsclient_cmd, - "clear bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", - CLEAR_STR - BGP_STR - "BGP view\n" - "view name\n" - "BGP neighbor IP address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_RSCLIENT_RIB_STR) - -ALIAS (clear_bgp_peer_rsclient, - clear_bgp_ipv6_instance_peer_rsclient_cmd, - "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", - CLEAR_STR - BGP_STR - "Address family\n" - "BGP view\n" - "view name\n" - "BGP neighbor IP address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_RSCLIENT_RIB_STR) -#endif /* HAVE_IPV6 */ - -DEFUN (clear_ip_bgp_peer_rsclient, - clear_ip_bgp_peer_rsclient_cmd, - "clear ip bgp (A.B.C.D|X:X::X:X|WORD) rsclient", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor IP address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_RSCLIENT_RIB_STR) -{ - if (argc == 2) - return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_RSCLIENT, argv[1]); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_RSCLIENT, argv[0]); -} - -ALIAS (clear_ip_bgp_peer_rsclient, - clear_ip_bgp_instance_peer_rsclient_cmd, - "clear ip bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", - CLEAR_STR - IP_STR - BGP_STR - "BGP view\n" - "view name\n" - "BGP neighbor IP address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_RSCLIENT_RIB_STR) - DEFUN (show_bgp_views, show_bgp_views_cmd, "show bgp views", @@ -8674,12 +8353,6 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, json_object_int_add(json, "peerCount", ents); json_object_int_add(json, "peerMemory", ents * sizeof (struct peer)); - if ((ents = listcount (bgp->rsclient))) - { - json_object_int_add(json, "rsclientCount", ents); - json_object_int_add(json, "rsclientMemory", ents * sizeof (struct peer)); - } - if ((ents = listcount (bgp->group))) { json_object_int_add(json, "peerGroupCount", ents); @@ -8713,13 +8386,6 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, ents * sizeof (struct peer)), VTY_NEWLINE); - if ((ents = listcount (bgp->rsclient))) - vty_out (vty, "RS-Client peers %ld, using %s of memory%s", - ents, - mtype_memstr (memstrbuf, sizeof (memstrbuf), - ents * sizeof (struct peer)), - VTY_NEWLINE); - if ((ents = listcount (bgp->group))) vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, mtype_memstr (memstrbuf, sizeof (memstrbuf), @@ -9370,10 +9036,6 @@ bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, || filter->map[RMAP_OUT].name || filter->usmap.name) json_object_boolean_true_add(json_addr, "outboundPathPolicyConfig"); - if (filter->map[RMAP_IMPORT].name) - json_object_boolean_true_add(json_addr, "importPolicyRsClientConfig"); - if (filter->map[RMAP_EXPORT].name) - json_object_boolean_true_add(json_addr, "exportPolicyRsClientConfig"); /* prefix-list */ if (filter->plist[FILTER_IN].name) @@ -9398,10 +9060,6 @@ bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, json_object_string_add(json_addr, "routeMapForIncomingAdvertisements", filter->map[RMAP_IN].name); if (filter->map[RMAP_OUT].name) json_object_string_add(json_addr, "routeMapForOutgoingAdvertisements", filter->map[RMAP_OUT].name); - if (filter->map[RMAP_IMPORT].name) - json_object_string_add(json_addr, "routeMapForAdvertisementsIntoRsClient", filter->map[RMAP_IMPORT].name); - if (filter->map[RMAP_EXPORT].name) - json_object_string_add(json_addr, "routeMapForAdvertisementsFromRsClient", filter->map[RMAP_EXPORT].name); /* unsuppress-map */ if (filter->usmap.name) @@ -9567,10 +9225,6 @@ bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, || filter->map[RMAP_OUT].name || filter->usmap.name) vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); - if (filter->map[RMAP_IMPORT].name) - vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); - if (filter->map[RMAP_EXPORT].name) - vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); /* prefix-list */ if (filter->plist[FILTER_IN].name) @@ -9619,16 +9273,6 @@ bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, filter->map[RMAP_OUT].map ? "*" : "", filter->map[RMAP_OUT].name, VTY_NEWLINE); - if (filter->map[RMAP_IMPORT].name) - vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", - filter->map[RMAP_IMPORT].map ? "*" : "", - filter->map[RMAP_IMPORT].name, - VTY_NEWLINE); - if (filter->map[RMAP_EXPORT].name) - vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", - filter->map[RMAP_EXPORT].map ? "*" : "", - filter->map[RMAP_EXPORT].name, - VTY_NEWLINE); /* unsuppress-map */ if (filter->usmap.name) @@ -11225,327 +10869,6 @@ DEFUN (show_ip_bgp_attr_info, return CMD_SUCCESS; } -static int -bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, - afi_t afi, safi_t safi) -{ - char timebuf[BGP_UPTIME_LEN]; - char rmbuf[14]; - const char *rmname; - struct peer *peer; - struct listnode *node, *nnode; - int len; - int count = 0; - - if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) - { - for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) - { - count++; - bgp_write_rsclient_summary (vty, peer, afi, safi); - } - return count; - } - - len = vty_out (vty, "%s", rsclient->host); - len = 16 - len; - - if (len < 1) - vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); - else - vty_out (vty, "%*s", len, " "); - - vty_out (vty, "4 "); - - vty_out (vty, "%11d ", rsclient->as); - - rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); - if ( rmname && strlen (rmname) > 13 ) - { - sprintf (rmbuf, "%13s", "..."); - rmname = strncpy (rmbuf, rmname, 10); - } - else if (! rmname) - rmname = ""; - vty_out (vty, " %13s ", rmname); - - rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); - if ( rmname && strlen (rmname) > 13 ) - { - sprintf (rmbuf, "%13s", "..."); - rmname = strncpy (rmbuf, rmname, 10); - } - else if (! rmname) - rmname = ""; - vty_out (vty, " %13s ", rmname); - - vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); - - if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) - vty_out (vty, " Idle (Admin)"); - else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) - vty_out (vty, " Idle (PfxCt)"); - else - vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); - - vty_out (vty, "%s", VTY_NEWLINE); - - return 1; -} - -static int -bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, - afi_t afi, safi_t safi) -{ - struct peer *peer; - struct listnode *node, *nnode; - int count = 0; - - /* Header string for each address family. */ - static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; - - for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) - { - if (peer->afc[afi][safi] && - CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) - { - if (! count) - { - vty_out (vty, - "Route Server's BGP router identifier %s%s", - inet_ntoa (bgp->router_id), VTY_NEWLINE); - vty_out (vty, - "Route Server's local AS number %u%s", bgp->as, - VTY_NEWLINE); - - vty_out (vty, "%s", VTY_NEWLINE); - vty_out (vty, "%s%s", header, VTY_NEWLINE); - } - - count += bgp_write_rsclient_summary (vty, peer, afi, safi); - } - } - - if (count) - vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, - count, VTY_NEWLINE); - else - vty_out (vty, "No %s Route Server Client is configured%s", - afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); - - return CMD_SUCCESS; -} - -static int -bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, - afi_t afi, safi_t safi) -{ - struct bgp *bgp; - - if (name) - { - bgp = bgp_lookup_by_name (name); - - if (! bgp) - { - vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); - return CMD_WARNING; - } - - bgp_show_rsclient_summary (vty, bgp, afi, safi); - return CMD_SUCCESS; - } - - bgp = bgp_get_default (); - - if (bgp) - bgp_show_rsclient_summary (vty, bgp, afi, safi); - - return CMD_SUCCESS; -} - -/* 'show bgp rsclient' commands. */ -DEFUN (show_ip_bgp_rsclient_summary, - show_ip_bgp_rsclient_summary_cmd, - "show ip bgp rsclient summary", - SHOW_STR - IP_STR - BGP_STR - "Information about Route Server Clients\n" - "Summary of all Route Server Clients\n") -{ - return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); -} - -DEFUN (show_ip_bgp_instance_rsclient_summary, - show_ip_bgp_instance_rsclient_summary_cmd, - "show ip bgp view WORD rsclient summary", - SHOW_STR - IP_STR - BGP_STR - "BGP view\n" - "View name\n" - "Information about Route Server Clients\n" - "Summary of all Route Server Clients\n") -{ - return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); -} - -DEFUN (show_ip_bgp_ipv4_rsclient_summary, - show_ip_bgp_ipv4_rsclient_summary_cmd, - "show ip bgp ipv4 (unicast|multicast) rsclient summary", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Clients\n" - "Summary of all Route Server Clients\n") -{ - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); - - return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); -} - -DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, - show_ip_bgp_instance_ipv4_rsclient_summary_cmd, - "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", - SHOW_STR - IP_STR - BGP_STR - "BGP view\n" - "View name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Clients\n" - "Summary of all Route Server Clients\n") -{ - if (strncmp (argv[1], "m", 1) == 0) - return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); - - return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); -} - -DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, - show_bgp_instance_ipv4_safi_rsclient_summary_cmd, - "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Clients\n" - "Summary of all Route Server Clients\n") -{ - safi_t safi; - - if (argc == 2) { - safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); - } else { - safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); - } -} - -ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, - show_bgp_ipv4_safi_rsclient_summary_cmd, - "show bgp ipv4 (unicast|multicast) rsclient summary", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Clients\n" - "Summary of all Route Server Clients\n") - -#ifdef HAVE_IPV6 -DEFUN (show_bgp_rsclient_summary, - show_bgp_rsclient_summary_cmd, - "show bgp rsclient summary", - SHOW_STR - BGP_STR - "Information about Route Server Clients\n" - "Summary of all Route Server Clients\n") -{ - return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); -} - -DEFUN (show_bgp_instance_rsclient_summary, - show_bgp_instance_rsclient_summary_cmd, - "show bgp view WORD rsclient summary", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Information about Route Server Clients\n" - "Summary of all Route Server Clients\n") -{ - return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); -} - -ALIAS (show_bgp_rsclient_summary, - show_bgp_ipv6_rsclient_summary_cmd, - "show bgp ipv6 rsclient summary", - SHOW_STR - BGP_STR - "Address family\n" - "Information about Route Server Clients\n" - "Summary of all Route Server Clients\n") - -ALIAS (show_bgp_instance_rsclient_summary, - show_bgp_instance_ipv6_rsclient_summary_cmd, - "show bgp view WORD ipv6 rsclient summary", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Address family\n" - "Information about Route Server Clients\n" - "Summary of all Route Server Clients\n") - -DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, - show_bgp_instance_ipv6_safi_rsclient_summary_cmd, - "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Clients\n" - "Summary of all Route Server Clients\n") -{ - safi_t safi; - - if (argc == 2) { - safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); - } else { - safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); - } -} - -ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, - show_bgp_ipv6_safi_rsclient_summary_cmd, - "show bgp ipv6 (unicast|multicast) rsclient summary", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Information about Route Server Clients\n" - "Summary of all Route Server Clients\n") - -#endif /* HAVE IPV6 */ - static int bgp_show_update_groups(int afi, int safi, struct vty *vty, u_int64_t subgrp_id) { @@ -13772,22 +13095,6 @@ bgp_vty_init (void) install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); #endif /* HAVE_IPV6 */ - /* "clear ip bgp neighbor rsclient" */ - install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); -#ifdef HAVE_IPV6 - install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); -#endif /* HAVE_IPV6 */ - /* "show ip bgp summary" commands. */ install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); @@ -13940,47 +13247,6 @@ bgp_vty_init (void) install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd); - /* "show ip bgp rsclient" commands. */ - install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); - -#ifdef HAVE_IPV6 - install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); - install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); -#endif /* HAVE_IPV6 */ - /* "show ip bgp paths" commands. */ install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 4e026d8d45..51712cee3b 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -675,24 +675,6 @@ peer_af_delete (struct peer *peer, afi_t afi, safi_t safi) return 0; } - -/* If peer is RSERVER_CLIENT in at least one address family and is not member - of a peer_group for that family, return 1. - Used to check wether the peer is included in list bgp->rsclient. */ -int -peer_rsclient_active (struct peer *peer) -{ - int i; - int j; - - for (i=AFI_IP; i < AFI_MAX; i++) - for (j=SAFI_UNICAST; j < SAFI_MAX; j++) - if (CHECK_FLAG(peer->af_flags[i][j], PEER_FLAG_RSERVER_CLIENT) - && ! peer->af_group[i][j]) - return 1; - return 0; -} - /* Peer comparison function for sorting. */ int peer_cmp (struct peer *p1, struct peer *p2) @@ -1765,7 +1747,7 @@ peer_deactivate (struct peer *peer, afi_t afi, safi_t safi) bgp_capability_send (peer, afi, safi, CAPABILITY_CODE_MP, CAPABILITY_ACTION_UNSET); - bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_NORMAL); + bgp_clear_route (peer, afi, safi); peer->pcount[afi][safi] = 0; } else @@ -1901,30 +1883,6 @@ peer_delete (struct peer *peer) hash_release(bgp->peerhash, peer); } - if (peer_rsclient_active (peer) - && (pn = listnode_lookup (bgp->rsclient, peer))) - { - peer_unlock (peer); /* rsclient list reference */ - list_delete_node (bgp->rsclient, pn); - - if (CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) - { - /* Clear our own rsclient ribs. */ - for (afi = AFI_IP; afi < AFI_MAX; afi++) - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) - if (CHECK_FLAG(peer->af_flags[afi][safi], - PEER_FLAG_RSERVER_CLIENT)) - bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); - } - } - - /* Free RIB for any family in which peer is RSERVER_CLIENT, and is not - member of a peer_group. */ - for (afi = AFI_IP; afi < AFI_MAX; afi++) - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) - if (peer->rib[afi][safi] && ! peer->af_group[afi][safi]) - bgp_table_finish (&peer->rib[afi][safi]); - /* Buffers. */ if (peer->ibuf) { @@ -2185,34 +2143,6 @@ peer_group2peer_config_copy (struct peer_group *group, struct peer *peer, /* allowas-in */ peer->allowas_in[afi][safi] = conf->allowas_in[afi][safi]; - /* route-server-client */ - if (CHECK_FLAG(conf->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) - { - /* Make peer's RIB point to group's RIB. */ - peer->rib[afi][safi] = group->conf->rib[afi][safi]; - - /* Import policy. */ - if (pfilter->map[RMAP_IMPORT].name) - XFREE(MTYPE_BGP_FILTER_NAME, pfilter->map[RMAP_IMPORT].name); - if (gfilter->map[RMAP_IMPORT].name) - { - pfilter->map[RMAP_IMPORT].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, gfilter->map[RMAP_IMPORT].name); - pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; - } - else - { - pfilter->map[RMAP_IMPORT].name = NULL; - pfilter->map[RMAP_IMPORT].map = NULL; - } - - /* Export policy. */ - if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) - { - pfilter->map[RMAP_EXPORT].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, gfilter->map[RMAP_EXPORT].name); - pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; - } - } - /* default-originate route-map */ if (conf->default_rmap[afi][safi].name) { @@ -2334,29 +2264,6 @@ peer_group2peer_config_copy (struct peer_group *group, struct peer *peer, pfilter->map[RMAP_OUT].map = NULL; } - /* RS-client's import/export route-maps. */ - if (gfilter->map[RMAP_IMPORT].name) - { - if (pfilter->map[RMAP_IMPORT].name) - XFREE(MTYPE_BGP_FILTER_NAME, pfilter->map[RMAP_IMPORT].name); - pfilter->map[RMAP_IMPORT].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, gfilter->map[RMAP_IMPORT].name); - pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; - } - else - { - if (pfilter->map[RMAP_IMPORT].name) - XFREE(MTYPE_BGP_FILTER_NAME, pfilter->map[RMAP_IMPORT].name); - pfilter->map[RMAP_IMPORT].name = NULL; - pfilter->map[RMAP_IMPORT].map = NULL; - } - if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) - { - if (pfilter->map[RMAP_EXPORT].name) - XFREE(MTYPE_BGP_FILTER_NAME, pfilter->map[RMAP_EXPORT].name); - pfilter->map[RMAP_EXPORT].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, gfilter->map[RMAP_EXPORT].name); - pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; - } - if (gfilter->usmap.name) { if (pfilter->usmap.name) @@ -2665,43 +2572,6 @@ peer_group_bind (struct bgp *bgp, union sockunion *su, struct peer *peer, } } - if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) - { - struct listnode *pn; - - /* If it's not configured as RSERVER_CLIENT in any other address - family, without being member of a peer_group, remove it from - list bgp->rsclient.*/ - if (! peer_rsclient_active (peer) - && (pn = listnode_lookup (bgp->rsclient, peer))) - { - peer_unlock (peer); /* peer rsclient reference */ - list_delete_node (bgp->rsclient, pn); - - /* Clear our own rsclient rib for this afi/safi. */ - bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); - } - - bgp_table_finish (&peer->rib[afi][safi]); - - /* Import policy. */ - if (peer->filter[afi][safi].map[RMAP_IMPORT].name) - { - XFREE(MTYPE_BGP_FILTER_NAME, peer->filter[afi][safi].map[RMAP_IMPORT].name); - peer->filter[afi][safi].map[RMAP_IMPORT].name = NULL; - peer->filter[afi][safi].map[RMAP_IMPORT].map = NULL; - } - - /* Export policy. */ - if (! CHECK_FLAG(group->conf->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) - && peer->filter[afi][safi].map[RMAP_EXPORT].name) - { - XFREE(MTYPE_BGP_FILTER_NAME, peer->filter[afi][safi].map[RMAP_EXPORT].name); - peer->filter[afi][safi].map[RMAP_EXPORT].name = NULL; - peer->filter[afi][safi].map[RMAP_EXPORT].map = NULL; - } - } - peer_group2peer_config_copy (group, peer, afi, safi); SET_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE); @@ -2737,9 +2607,6 @@ peer_group_unbind (struct bgp *bgp, struct peer *peer, zlog_err("couldn't delete af structure for peer %s", peer->host); } - if (peer->rib[afi][safi]) - peer->rib[afi][safi] = NULL; - if (! peer_group_active (peer)) { assert (listnode_lookup (group->peer, peer)); @@ -2813,9 +2680,6 @@ bgp_create (as_t *as, const char *name) bgp->group = list_new (); bgp->group->cmp = (int (*)(void *, void *)) peer_group_cmp; - bgp->rsclient = list_new (); - bgp->rsclient->cmp = (int (*)(void*, void*)) peer_cmp; - for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { @@ -3022,8 +2886,6 @@ bgp_delete (struct bgp *bgp) peer_delete (peer); } - assert (listcount (bgp->rsclient) == 0); - if (bgp->peer_self) { peer_delete(bgp->peer_self); bgp->peer_self = NULL; @@ -3073,7 +2935,6 @@ bgp_free (struct bgp *bgp) list_delete (bgp->group); list_delete (bgp->peer); - list_delete (bgp->rsclient); hash_free(bgp->peerhash); bgp->peerhash = NULL; @@ -5436,8 +5297,7 @@ peer_route_map_set (struct peer *peer, afi_t afi, safi_t safi, int direct, struct peer_group *group; struct listnode *node, *nnode; - if (direct != RMAP_IN && direct != RMAP_OUT && - direct != RMAP_IMPORT && direct != RMAP_EXPORT) + if (direct != RMAP_IN && direct != RMAP_OUT) return BGP_ERR_INVALID_VALUE; filter = &peer->filter[afi][safi]; @@ -5482,8 +5342,7 @@ peer_route_map_unset (struct peer *peer, afi_t afi, safi_t safi, int direct) struct peer_group *group; struct listnode *node, *nnode; - if (direct != RMAP_IN && direct != RMAP_OUT && - direct != RMAP_IMPORT && direct != RMAP_EXPORT) + if (direct != RMAP_IN && direct != RMAP_OUT) return BGP_ERR_INVALID_VALUE; filter = &peer->filter[afi][safi]; @@ -5942,14 +5801,6 @@ peer_clear_soft (struct peer *peer, afi_t afi, safi_t safi, if (! peer->afc[afi][safi]) return BGP_ERR_AF_UNCONFIGURED; - if (stype == BGP_CLEAR_SOFT_RSCLIENT) - { - if (! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) - return 0; - bgp_check_local_routes_rsclient (peer, afi, safi); - bgp_soft_reconfig_rsclient (peer, afi, safi); - } - if (stype == BGP_CLEAR_SOFT_OUT || stype == BGP_CLEAR_SOFT_BOTH) { /* Clear the "neighbor x.x.x.x default-originate" flag */ @@ -6192,22 +6043,6 @@ bgp_config_write_filter (struct vty *vty, struct peer *peer, addr, filter->map[RMAP_OUT].name, VTY_NEWLINE); } - if (filter->map[RMAP_IMPORT].name && ! gfilter) - { - afi_header_vty_out (vty, afi, safi, write, - " neighbor %s route-map %s import%s", - addr, filter->map[RMAP_IMPORT].name, VTY_NEWLINE); - } - - if (filter->map[RMAP_EXPORT].name) - if (! gfilter || ! gfilter->map[RMAP_EXPORT].name - || strcmp (filter->map[RMAP_EXPORT].name, gfilter->map[RMAP_EXPORT].name) != 0) - { - afi_header_vty_out (vty, afi, safi, write, - " neighbor %s route-map %s export%s", - addr, filter->map[RMAP_EXPORT].name, VTY_NEWLINE); - } - /* unsuppress-map */ if (filter->usmap.name && ! gfilter) { @@ -7240,9 +7075,4 @@ bgp_terminate (void) work_queue_free (bm->process_main_queue); bm->process_main_queue = NULL; } - if (bm->process_rsclient_queue) - { - work_queue_free (bm->process_rsclient_queue); - bm->process_rsclient_queue = NULL; - } } diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 851527b3bd..24b39dd7f5 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -84,7 +84,6 @@ struct bgp_master /* work queues */ struct work_queue *process_main_queue; - struct work_queue *process_rsclient_queue; /* Listening sockets */ struct list *listen_sockets; @@ -156,9 +155,6 @@ struct bgp /* The current number of BGP dynamic neighbors */ int dynamic_neighbors_count; - /* BGP route-server-clients. */ - struct list *rsclient; - struct hash *update_groups[BGP_AF_MAX]; /* @@ -220,7 +216,6 @@ struct bgp u_char update_delay_over; u_char main_zebra_update_hold; u_char main_peers_update_hold; - u_char rsclient_peers_update_hold; u_int16_t v_update_delay; u_int16_t v_establish_wait; char update_delay_begin_time[64]; @@ -320,8 +315,7 @@ struct bgp int addpath_tx_used[AFI_MAX][SAFI_MAX]; }; -#define BGP_ROUTE_ADV_HOLD(bgp) \ - (bgp->main_peers_update_hold || bgp->rsclient_peers_update_hold) +#define BGP_ROUTE_ADV_HOLD(bgp) (bgp->main_peers_update_hold) /* BGP peer-group support. */ struct peer_group @@ -377,11 +371,9 @@ struct bgp_rd u_char val[BGP_RD_SIZE]; }; -#define RMAP_IN 0 -#define RMAP_OUT 1 -#define RMAP_IMPORT 2 -#define RMAP_EXPORT 3 -#define RMAP_MAX 4 +#define RMAP_IN 0 +#define RMAP_OUT 1 +#define RMAP_MAX 2 /* BGP filter structure. */ struct bgp_filter @@ -509,9 +501,6 @@ struct peer /* Local router ID. */ struct in_addr local_id; - /* Peer specific RIB when configured as route-server-client. */ - struct bgp_table *rib[AFI_MAX][SAFI_MAX]; - /* Packet receive and send buffer. */ struct stream *ibuf; struct stream_fifo *obuf; @@ -1046,8 +1035,7 @@ enum bgp_clear_type BGP_CLEAR_SOFT_OUT, BGP_CLEAR_SOFT_IN, BGP_CLEAR_SOFT_BOTH, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, - BGP_CLEAR_SOFT_RSCLIENT + BGP_CLEAR_SOFT_IN_ORF_PREFIX }; /* Macros. */ @@ -1208,7 +1196,6 @@ extern int bgp_listen_limit_unset (struct bgp *); extern int bgp_update_delay_active (struct bgp *); extern int bgp_update_delay_configured (struct bgp *); -extern int peer_rsclient_active (struct peer *); extern void peer_as_change (struct peer *, as_t, int); extern int peer_remote_as (struct bgp *, union sockunion *,const char *, as_t *, int, afi_t, safi_t); -- 2.39.5