diff options
author | Timo Teräs <timo.teras@iki.fi> | 2016-03-30 13:44:03 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2016-03-30 14:29:40 +0300 |
commit | 8cb40c91cdfb00ddf04e88d3ecd40403890d90f7 (patch) | |
tree | 6d6a3de27525820abb740f1fa8347b6f03986bad /bgpd/bgp_route.c | |
parent | 86c5d2ee68f7b9c00ae4aeb5c8b3c5d82c5ebffc (diff) | |
download | quagga-8cb40c91cdfb00ddf04e88d3ecd40403890d90f7.tar.bz2 quagga-8cb40c91cdfb00ddf04e88d3ecd40403890d90f7.tar.xz |
cumulus take-3cumulus-take-3
Diffstat (limited to 'bgpd/bgp_route.c')
-rw-r--r-- | bgpd/bgp_route.c | 2528 |
1 files changed, 1837 insertions, 691 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index c364372f..4bd6b842 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -55,6 +55,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgp_zebra.h" #include "bgpd/bgp_vty.h" #include "bgpd/bgp_mpath.h" +#include "bgpd/bgp_nht.h" /* Extern from bgp_dump.c */ extern const char *bgp_origin_str[]; @@ -126,20 +127,14 @@ bgp_info_extra_get (struct bgp_info *ri) return ri->extra; } -/* Allocate new bgp info structure. */ -static struct bgp_info * -bgp_info_new (void) -{ - return XCALLOC (MTYPE_BGP_ROUTE, sizeof (struct bgp_info)); -} - /* Free bgp route information. */ static void bgp_info_free (struct bgp_info *binfo) { if (binfo->attr) bgp_attr_unintern (&binfo->attr); - + + bgp_unlink_nexthop(binfo); bgp_info_extra_free (&binfo->extra); bgp_info_mpath_free (&binfo->mpath); @@ -252,7 +247,7 @@ bgp_pcount_adjust (struct bgp_node *rn, struct bgp_info *ri) || ri->peer == ri->peer->bgp->peer_self) return; - if (BGP_INFO_HOLDDOWN (ri) + if (!BGP_INFO_COUNTABLE (ri) && CHECK_FLAG (ri->flags, BGP_INFO_COUNTED)) { @@ -269,7 +264,7 @@ bgp_pcount_adjust (struct bgp_node *rn, struct bgp_info *ri) zlog_warn ("%s: Please report to Quagga bugzilla", __func__); } } - else if (!BGP_INFO_HOLDDOWN (ri) + else if (BGP_INFO_COUNTABLE (ri) && !CHECK_FLAG (ri->flags, BGP_INFO_COUNTED)) { SET_FLAG (ri->flags, BGP_INFO_COUNTED); @@ -286,8 +281,8 @@ bgp_info_set_flag (struct bgp_node *rn, struct bgp_info *ri, u_int32_t flag) { SET_FLAG (ri->flags, flag); - /* early bath if we know it's not a flag that changes useability state */ - if (!CHECK_FLAG (flag, BGP_INFO_VALID|BGP_INFO_UNUSEABLE)) + /* early bath if we know it's not a flag that changes countability state */ + if (!CHECK_FLAG (flag, BGP_INFO_VALID|BGP_INFO_HISTORY|BGP_INFO_REMOVED)) return; bgp_pcount_adjust (rn, ri); @@ -298,8 +293,8 @@ bgp_info_unset_flag (struct bgp_node *rn, struct bgp_info *ri, u_int32_t flag) { UNSET_FLAG (ri->flags, flag); - /* early bath if we know it's not a flag that changes useability state */ - if (!CHECK_FLAG (flag, BGP_INFO_VALID|BGP_INFO_UNUSEABLE)) + /* early bath if we know it's not a flag that changes countability state */ + if (!CHECK_FLAG (flag, BGP_INFO_VALID|BGP_INFO_HISTORY|BGP_INFO_REMOVED)) return; bgp_pcount_adjust (rn, ri); @@ -477,6 +472,27 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist, if (newm > existm) return 1; + /* 8.1. Same IGP metric. Compare the cluster list length as + representative of IGP hops metric. Rewrite the metric value + pair (newm, existm) with the cluster list length. Prefer the + path with smaller cluster list length. */ + if (newm == existm) + { + struct bgp_maxpaths_cfg *mpath_cfg = &bgp->maxpaths[afi][safi]; + if (peer_sort (new->peer) == BGP_PEER_IBGP + && peer_sort (exist->peer) == BGP_PEER_IBGP + && CHECK_FLAG (mpath_cfg->ibgp_flags, + BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) + { + newm = BGP_CLUSTER_LIST_LENGTH(new->attr); + existm = BGP_CLUSTER_LIST_LENGTH(exist->attr); + if (newm < existm) + ret = 1; + if (newm > existm) + ret = 0; + } + } + /* 9. Maximum path check. */ if (bgp_mpath_is_configured (bgp, afi, safi)) { @@ -535,12 +551,8 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist, return 1; /* 12. Cluster length comparision. */ - new_cluster = exist_cluster = 0; - - if (newattr->flag & ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST)) - new_cluster = newattre->cluster->length; - if (existattr->flag & ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST)) - exist_cluster = existattre->cluster->length; + new_cluster = BGP_CLUSTER_LIST_LENGTH(new->attr); + exist_cluster = BGP_CLUSTER_LIST_LENGTH(exist->attr); if (new_cluster < exist_cluster) return -1; @@ -582,7 +594,7 @@ bgp_input_filter (struct peer *peer, struct prefix *p, struct attr *attr, #define FILTER_EXIST_WARN(F,f,filter) \ if (BGP_DEBUG (update, UPDATE_IN) \ && !(F ## _IN (filter))) \ - plog_warn (peer->log, "%s: Could not find configured input %s-list %s!", \ + zlog_warn ("%s: Could not find configured input %s-list %s!", \ peer->host, #f, F ## _IN_NAME(filter)); if (DISTRIBUTE_IN_NAME (filter)) { @@ -621,7 +633,7 @@ bgp_output_filter (struct peer *peer, struct prefix *p, struct attr *attr, #define FILTER_EXIST_WARN(F,f,filter) \ if (BGP_DEBUG (update, UPDATE_OUT) \ && !(F ## _OUT (filter))) \ - plog_warn (peer->log, "%s: Could not find configured output %s-list %s!", \ + zlog_warn ("%s: Could not find configured output %s-list %s!", \ peer->host, #f, F ## _OUT_NAME(filter)); if (DISTRIBUTE_OUT_NAME (filter)) { @@ -694,11 +706,12 @@ bgp_cluster_filter (struct peer *peer, struct attr *attr) static int bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr, - afi_t afi, safi_t safi) + afi_t afi, safi_t safi, const char *rmap_name) { struct bgp_filter *filter; struct bgp_info info; route_map_result_t ret; + struct route_map *rmap = NULL; filter = &peer->filter[afi][safi]; @@ -706,8 +719,18 @@ bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr, if (peer->weight) (bgp_attr_extra_get (attr))->weight = peer->weight; + if (rmap_name) + { + rmap = route_map_lookup_by_name(rmap_name); + } + else + { + if (ROUTE_MAP_IN_NAME(filter)) + rmap = ROUTE_MAP_IN (filter); + } + /* Route map apply. */ - if (ROUTE_MAP_IN_NAME (filter)) + if (rmap) { /* Duplicate current value to new strucutre for modification. */ info.peer = peer; @@ -716,7 +739,56 @@ bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr, SET_FLAG (peer->rmap_type, PEER_RMAP_TYPE_IN); /* Apply BGP route map to the attribute. */ - ret = route_map_apply (ROUTE_MAP_IN (filter), p, RMAP_BGP, &info); + ret = route_map_apply (rmap, 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; +} + +static int +bgp_output_modifier (struct peer *peer, struct prefix *p, struct attr *attr, + afi_t afi, safi_t safi, const char *rmap_name) +{ + struct bgp_filter *filter; + struct bgp_info info; + route_map_result_t ret; + struct route_map *rmap = NULL; + + filter = &peer->filter[afi][safi]; + + /* Apply default weight value. */ + if (peer->weight) + (bgp_attr_extra_get (attr))->weight = peer->weight; + + if (rmap_name) + { + rmap = route_map_lookup_by_name(rmap_name); + } + else + { + if (ROUTE_MAP_OUT_NAME(filter)) + rmap = ROUTE_MAP_OUT (filter); + } + + /* Route map apply. */ + if (rmap) + { + /* Duplicate current value to new strucutre for modification. */ + info.peer = peer; + info.attr = attr; + + SET_FLAG (peer->rmap_type, PEER_RMAP_TYPE_OUT); + + /* Apply BGP route map to the attribute. */ + ret = route_map_apply (rmap, p, RMAP_BGP, &info); peer->rmap_type = 0; @@ -799,6 +871,55 @@ bgp_import_modifier (struct peer *rsclient, struct peer *peer, 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, + struct peer *peer, struct attr *attr) +{ + if (peer->sort == BGP_PEER_EBGP && + peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS)) + { + // Take action on the entire aspath + if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) + { + if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) + attr->aspath = aspath_replace_private_asns (attr->aspath, bgp->as); + + // The entire aspath consists of private ASNs so create an empty aspath + else if (aspath_private_as_check (attr->aspath)) + attr->aspath = aspath_empty_get (); + + // There are some public and some private ASNs, remove the private ASNs + else + attr->aspath = aspath_remove_private_asns (attr->aspath); + } + + // 'all' was not specified so the entire aspath must be private ASNs + // for us to do anything + else if (aspath_private_as_check (attr->aspath)) + { + if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) + attr->aspath = aspath_replace_private_asns (attr->aspath, bgp->as); + else + attr->aspath = aspath_empty_get (); + } + } +} + +/* If this is an EBGP peer with as-override */ +static void +bgp_peer_as_override(struct bgp *bgp, afi_t afi, safi_t safi, + struct peer *peer, struct attr *attr) +{ + if (peer->sort == BGP_PEER_EBGP && + peer_af_flag_check (peer, afi, safi, PEER_FLAG_AS_OVERRIDE)) + { + if (aspath_single_asn_check (attr->aspath, peer->as)) + attr->aspath = aspath_replace_specific_asn (attr->aspath, peer->as, bgp->as); + } +} + static int bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p, struct attr *attr, afi_t afi, safi_t safi) @@ -859,12 +980,11 @@ bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p, { if (IPV4_ADDR_SAME (&peer->remote_id, &riattr->extra->originator_id)) { - if (BGP_DEBUG (filter, FILTER)) - zlog (peer->log, LOG_DEBUG, - "%s [Update:SEND] %s/%d originator-id is same as remote router-id", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + if (bgp_debug_update(peer, p, 0)) + zlog_debug("%s [Update:SEND] %s/%d originator-id is same as remote router-id", + peer->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen); return 0; } } @@ -882,12 +1002,11 @@ bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p, /* Output filter check. */ if (bgp_output_filter (peer, p, riattr, afi, safi) == FILTER_DENY) { - if (BGP_DEBUG (filter, FILTER)) - zlog (peer->log, LOG_DEBUG, - "%s [Update:SEND] %s/%d is filtered", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + if (bgp_debug_update(peer, p, 0)) + zlog_debug("%s [Update:SEND] %s/%d is filtered", + peer->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen); return 0; } @@ -895,10 +1014,9 @@ bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p, /* AS path loop check. */ if (aspath_loop_check (riattr->aspath, peer->as)) { - if (BGP_DEBUG (filter, FILTER)) - zlog (peer->log, LOG_DEBUG, - "%s [Update:SEND] suppress announcement to peer AS %u is AS path.", - peer->host, peer->as); + if (bgp_debug_update(peer, p, 0)) + zlog_debug("%s [Update:SEND] suppress announcement to peer AS %u is AS path.", + peer->host, peer->as); return 0; } #endif /* BGP_SEND_ASPATH_CHECK */ @@ -908,11 +1026,10 @@ bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p, { if (aspath_loop_check(riattr->aspath, bgp->confed_id)) { - if (BGP_DEBUG (filter, FILTER)) - zlog (peer->log, LOG_DEBUG, - "%s [Update:SEND] suppress announcement to peer AS %u is AS path.", - peer->host, - bgp->confed_id); + if (bgp_debug_update(peer, p, 0)) + zlog_debug("%s [Update:SEND] suppress announcement to peer AS %u is AS path.", + peer->host, + bgp->confed_id); return 0; } } @@ -1003,7 +1120,7 @@ bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p, || (NEXTHOP_IS_V6 && IN6_IS_ADDR_UNSPECIFIED(&attr->extra->mp_nexthop_global)) || (peer->sort == BGP_PEER_EBGP - && bgp_multiaccess_check_v4 (attr->nexthop, peer->host) == 0)) + && (bgp_multiaccess_check_v4 (attr->nexthop, peer) == 0))) { /* Set IPv4 nexthop. */ if (NEXTHOP_IS_V4) @@ -1063,11 +1180,8 @@ bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p, } - /* If this is EBGP peer and remove-private-AS is set. */ - if (peer->sort == BGP_PEER_EBGP - && peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS) - && aspath_private_as_check (attr->aspath)) - attr->aspath = aspath_empty_get (); + bgp_peer_remove_private_as(bgp, afi, safi, peer, attr); + bgp_peer_as_override(bgp, afi, safi, peer, attr); /* Route map & unsuppress-map apply. */ if (ROUTE_MAP_OUT_NAME (filter) @@ -1084,8 +1198,8 @@ bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p, /* The route reflector is not allowed to modify the attributes of the reflected IBGP routes. */ - if (from->sort == BGP_PEER_IBGP - && peer->sort == BGP_PEER_IBGP) + if ((from->sort == BGP_PEER_IBGP && peer->sort == BGP_PEER_IBGP) && + !bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) { bgp_attr_dup (&dummy_attr, attr); info.attr = &dummy_attr; @@ -1119,9 +1233,11 @@ bgp_announce_check_rsclient (struct bgp_info *ri, struct peer *rsclient, struct bgp_info info; struct peer *from; struct attr *riattr; + struct bgp *bgp; from = ri->peer; filter = &rsclient->filter[afi][safi]; + bgp = rsclient->bgp; riattr = bgp_info_mpath_count (ri) ? bgp_info_mpath_attr (ri) : ri->attr; if (DISABLE_BGP_ANNOUNCE) @@ -1153,12 +1269,11 @@ bgp_announce_check_rsclient (struct bgp_info *ri, struct peer *rsclient, if (IPV4_ADDR_SAME (&rsclient->remote_id, &riattr->extra->originator_id)) { - if (BGP_DEBUG (filter, FILTER)) - zlog (rsclient->log, LOG_DEBUG, - "%s [Update:SEND] %s/%d originator-id is same as remote router-id", - rsclient->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + if (bgp_debug_update(rsclient, p, 0)) + zlog_debug ("%s [Update:SEND] %s/%d originator-id is same as remote router-id", + rsclient->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen); return 0; } } @@ -1176,12 +1291,11 @@ bgp_announce_check_rsclient (struct bgp_info *ri, struct peer *rsclient, /* Output filter check. */ if (bgp_output_filter (rsclient, p, riattr, afi, safi) == FILTER_DENY) { - if (BGP_DEBUG (filter, FILTER)) - zlog (rsclient->log, LOG_DEBUG, - "%s [Update:SEND] %s/%d is filtered", - rsclient->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + if (bgp_debug_update(rsclient, p, 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; } @@ -1189,10 +1303,9 @@ bgp_announce_check_rsclient (struct bgp_info *ri, struct peer *rsclient, /* AS path loop check. */ if (aspath_loop_check (riattr->aspath, rsclient->as)) { - if (BGP_DEBUG (filter, FILTER)) - zlog (rsclient->log, LOG_DEBUG, - "%s [Update:SEND] suppress announcement to peer AS %u is AS path.", - rsclient->host, rsclient->as); + if (bgp_debug_update(rsclient, p, 0)) + zlog_debug ("%s [Update:SEND] suppress announcement to peer AS %u is AS path.", + rsclient->host, rsclient->as); return 0; } #endif /* BGP_SEND_ASPATH_CHECK */ @@ -1267,11 +1380,8 @@ bgp_announce_check_rsclient (struct bgp_info *ri, struct peer *rsclient, } - /* If this is EBGP peer and remove-private-AS is set. */ - if (rsclient->sort == BGP_PEER_EBGP - && peer_af_flag_check (rsclient, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS) - && aspath_private_as_check (attr->aspath)) - attr->aspath = aspath_empty_get (); + 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) ) @@ -1536,8 +1646,23 @@ bgp_process_rsclient (struct work_queue *wq, void *data) struct bgp_info *old_select; struct bgp_info_pair old_and_new; struct listnode *node, *nnode; - struct peer *rsclient = bgp_node_table (rn)->owner; - + struct peer *rsclient; + + /* 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, &old_and_new, afi, safi); new_select = old_and_new.new; @@ -1600,20 +1725,38 @@ bgp_process_main (struct work_queue *wq, void *data) struct bgp_info_pair old_and_new; struct listnode *node, *nnode; struct peer *peer; - + + /* Is it end of initial update? (after startup) */ + if (!rn) + { + quagga_timestamp(3, bgp->update_delay_zebra_resume_time, + sizeof(bgp->update_delay_zebra_resume_time)); + + bgp->main_zebra_update_hold = 0; + for (afi = AFI_IP; afi < AFI_MAX; afi++) + for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) + { + bgp_zebra_announce_table(bgp, afi, safi); + } + bgp->main_peers_update_hold = 0; + + bgp_start_routeadv(bgp); + return WQ_SUCCESS; + } + /* Best path selection. */ bgp_best_selection (bgp, rn, &old_and_new, afi, safi); old_select = old_and_new.old; new_select = old_and_new.new; /* Nothing to do. */ - if (old_select && old_select == new_select) + if (old_select && old_select == new_select && !CHECK_FLAG(rn->flags, BGP_NODE_USER_CLEAR)) { if (! CHECK_FLAG (old_select->flags, BGP_INFO_ATTR_CHANGED)) { if (CHECK_FLAG (old_select->flags, BGP_INFO_IGP_CHANGED) || CHECK_FLAG (old_select->flags, BGP_INFO_MULTIPATH_CHG)) - bgp_zebra_announce (p, old_select, bgp, safi); + bgp_zebra_announce (p, old_select, bgp, afi, safi); UNSET_FLAG (old_select->flags, BGP_INFO_MULTIPATH_CHG); UNSET_FLAG (rn->flags, BGP_NODE_PROCESS_SCHEDULED); @@ -1621,6 +1764,9 @@ bgp_process_main (struct work_queue *wq, void *data) } } + /* If the user did "clear ip bgp prefix x.x.x.x" this flag will be set */ + UNSET_FLAG(rn->flags, BGP_NODE_USER_CLEAR); + if (old_select) bgp_info_unset_flag (rn, old_select, BGP_INFO_SELECTED); if (new_select) @@ -1644,7 +1790,7 @@ bgp_process_main (struct work_queue *wq, void *data) if (new_select && new_select->type == ZEBRA_ROUTE_BGP && new_select->sub_type == BGP_ROUTE_NORMAL) - bgp_zebra_announce (p, new_select, bgp, safi); + bgp_zebra_announce (p, new_select, bgp, afi, safi); else { /* Withdraw the route from the kernel. */ @@ -1667,15 +1813,40 @@ static void bgp_processq_del (struct work_queue *wq, void *data) { struct bgp_process_queue *pq = data; - struct bgp_table *table = bgp_node_table (pq->rn); - + struct bgp_table *table; + bgp_unlock (pq->bgp); - bgp_unlock_node (pq->rn); - bgp_table_unlock (table); + if (pq->rn) + { + table = bgp_node_table (pq->rn); + bgp_unlock_node (pq->rn); + bgp_table_unlock (table); + } XFREE (MTYPE_BGP_PROCESS_QUEUE, pq); } static void +bgp_process_queue_complete (struct work_queue *wq) +{ + struct bgp *bgp; + struct peer *peer; + struct listnode *node, *nnode; + + /* Schedule write thread either directly or through the MRAI timer + * if needed. + */ + bgp = bgp_get_default (); + if (!bgp) + return; + + if (BGP_ROUTE_ADV_HOLD(bgp)) + return; + + for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) + bgp_peer_schedule_updates(peer); +} + +void bgp_process_queue_init (void) { bm->process_main_queue @@ -1691,8 +1862,11 @@ bgp_process_queue_init (void) bm->process_main_queue->spec.workfunc = &bgp_process_main; bm->process_main_queue->spec.del_item_data = &bgp_processq_del; + bm->process_main_queue->spec.completion_func = &bgp_process_queue_complete; bm->process_main_queue->spec.max_retries = 0; 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; @@ -1753,6 +1927,36 @@ bgp_process (struct bgp *bgp, struct bgp_node *rn, afi_t afi, safi_t safi) return; } +void +bgp_add_eoiu_mark (struct bgp *bgp, bgp_table_t type) +{ + struct bgp_process_queue *pqnode; + + if ( (bm->process_main_queue == NULL) || + (bm->process_rsclient_queue == NULL) ) + bgp_process_queue_init (); + + pqnode = XCALLOC (MTYPE_BGP_PROCESS_QUEUE, + sizeof (struct bgp_process_queue)); + if (!pqnode) + return; + + 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; +} + static int bgp_maximum_prefix_restart_timer (struct thread *thread) { @@ -1761,11 +1965,11 @@ bgp_maximum_prefix_restart_timer (struct thread *thread) peer = THREAD_ARG (thread); peer->t_pmax_restart = NULL; - if (BGP_DEBUG (events, EVENTS)) + if (bgp_debug_neighbor_events(peer)) zlog_debug ("%s Maximum-prefix restart timer expired, restore peering", peer->host); - peer_clear (peer); + peer_clear (peer, NULL); return 0; } @@ -1783,10 +1987,9 @@ bgp_maximum_prefix_overflow (struct peer *peer, afi_t afi, && ! always) return 0; - zlog (peer->log, LOG_INFO, - "%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, " - "limit %ld", afi_safi_print (afi, safi), peer->host, - peer->pcount[afi][safi], peer->pmax[afi][safi]); + zlog_info ("%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, " + "limit %ld", afi_safi_print (afi, safi), peer->host, + peer->pcount[afi][safi], peer->pmax[afi][safi]); SET_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_PREFIX_LIMIT); if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) @@ -1816,7 +2019,7 @@ bgp_maximum_prefix_overflow (struct peer *peer, afi_t afi, { peer->v_pmax_restart = peer->pmax_restart[afi][safi] * 60; - if (BGP_DEBUG (events, EVENTS)) + if (bgp_debug_neighbor_events(peer)) zlog_debug ("%s Maximum-prefix restart timer started for %d secs", peer->host, peer->v_pmax_restart); @@ -1835,10 +2038,9 @@ bgp_maximum_prefix_overflow (struct peer *peer, afi_t afi, && ! always) return 0; - zlog (peer->log, LOG_INFO, - "%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld", - afi_safi_print (afi, safi), peer->host, peer->pcount[afi][safi], - peer->pmax[afi][safi]); + zlog_info ("%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld", + afi_safi_print (afi, safi), peer->host, peer->pcount[afi][safi], + peer->pmax[afi][safi]); SET_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_PREFIX_THRESHOLD); } else @@ -1882,6 +2084,23 @@ bgp_rib_withdraw (struct bgp_node *rn, struct bgp_info *ri, struct peer *peer, bgp_rib_remove (rn, ri, peer, afi, safi); } +static struct bgp_info * +info_make (int type, int sub_type, struct peer *peer, struct attr *attr, + struct bgp_node *rn) +{ + struct bgp_info *new; + + /* Make new BGP info. */ + new = XCALLOC (MTYPE_BGP_ROUTE, sizeof (struct bgp_info)); + new->type = type; + new->sub_type = sub_type; + new->peer = peer; + new->attr = attr; + new->uptime = bgp_clock (); + new->net = rn; + return new; +} + static void bgp_update_rsclient (struct peer *rsclient, afi_t afi, safi_t safi, struct attr *attr, struct peer *peer, struct prefix *p, int type, @@ -1974,14 +2193,12 @@ bgp_update_rsclient (struct peer *rsclient, afi_t afi, safi_t safi, && attrhash_cmp (ri->attr, attr_new)) { - bgp_info_unset_flag (rn, ri, BGP_INFO_ATTR_CHANGED); + if (bgp_debug_update(peer, p, 1)) + zlog_debug ("%s rcvd %s/%d for RS-client %s...duplicate ignored", + peer->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen, rsclient->host); - if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, - "%s rcvd %s/%d for RS-client %s...duplicate ignored", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, rsclient->host); bgp_unlock_node (rn); bgp_attr_unintern (&attr_new); @@ -1994,11 +2211,11 @@ bgp_update_rsclient (struct peer *rsclient, afi_t afi, safi_t safi, bgp_info_restore (rn, ri); /* Received Logging. */ - if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d for RS-client %s", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, rsclient->host); + if (bgp_debug_update(peer, p, 1)) + zlog_debug ("%s rcvd %s/%d for RS-client %s", + peer->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen, rsclient->host); /* The attribute is changed. */ bgp_info_set_flag (rn, ri, BGP_INFO_ATTR_CHANGED); @@ -2021,21 +2238,15 @@ bgp_update_rsclient (struct peer *rsclient, afi_t afi, safi_t safi, } /* Received Logging. */ - if (BGP_DEBUG (update, UPDATE_IN)) + if (bgp_debug_update(peer, p, 1)) { - zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d for RS-client %s", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, rsclient->host); + zlog_debug ("%s rcvd %s/%d for RS-client %s", + peer->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen, rsclient->host); } - /* Make new BGP info. */ - new = bgp_info_new (); - new->type = type; - new->sub_type = sub_type; - new->peer = peer; - new->attr = attr_new; - new->uptime = bgp_clock (); + new = info_make(type, sub_type, peer, attr_new, rn); /* Update MPLS tag. */ if (safi == SAFI_MPLS_VPN) @@ -2057,12 +2268,11 @@ bgp_update_rsclient (struct peer *rsclient, afi_t afi, safi_t safi, filtered: /* This BGP update is filtered. Log the reason then update BGP entry. */ - if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, - "%s rcvd UPDATE about %s/%d -- DENIED for RS-client %s due to: %s", - peer->host, - inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, rsclient->host, reason); + if (bgp_debug_update(peer, p, 1)) + zlog_debug ("%s rcvd UPDATE about %s/%d -- DENIED for RS-client %s due to: %s", + peer->host, + inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen, rsclient->host, reason); if (ri) bgp_rib_remove (rn, ri, peer, afi, safi); @@ -2094,11 +2304,10 @@ bgp_withdraw_rsclient (struct peer *rsclient, afi_t afi, safi_t safi, /* Withdraw specified route from routing table. */ if (ri && ! CHECK_FLAG (ri->flags, BGP_INFO_HISTORY)) bgp_rib_withdraw (rn, ri, peer, afi, safi, prd); - else if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, - "%s Can't find the route %s/%d", peer->host, - inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + else if (bgp_debug_update(peer, p, 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); @@ -2120,6 +2329,7 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr, struct bgp_info *new; const char *reason; char buf[SU_ADDRSTRLEN]; + int connected = 0; memset (&new_attr, 0, sizeof(struct attr)); memset (&new_extra, 0, sizeof(struct attr_extra)); @@ -2190,7 +2400,7 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr, * NB: new_attr may now contain newly allocated values from route-map "set" * commands, so we need bgp_attr_flush in the error paths, until we intern * the attr (which takes over the memory references) */ - if (bgp_input_modifier (peer, p, &new_attr, afi, safi) == RMAP_DENY) + if (bgp_input_modifier (peer, p, &new_attr, afi, safi, NULL) == RMAP_DENY) { reason = "route-map;"; bgp_attr_flush (&new_attr); @@ -2200,17 +2410,6 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr, /* IPv4 unicast next hop check. */ if (afi == AFI_IP && safi == SAFI_UNICAST) { - /* If the peer is EBGP and nexthop is not on connected route, - discard it. */ - if (peer->sort == BGP_PEER_EBGP && peer->ttl == 1 - && ! bgp_nexthop_onlink (afi, &new_attr) - && ! CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK)) - { - reason = "non-connected next-hop;"; - bgp_attr_flush (&new_attr); - goto filtered; - } - /* Next hop must not be 0.0.0.0 nor Class D/E address. Next hop must not be my own address. */ if (new_attr.nexthop.s_addr == 0 @@ -2234,17 +2433,15 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr, if (!CHECK_FLAG (ri->flags, BGP_INFO_REMOVED) && attrhash_cmp (ri->attr, attr_new)) { - bgp_info_unset_flag (rn, ri, BGP_INFO_ATTR_CHANGED); - if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING) && peer->sort == BGP_PEER_EBGP && CHECK_FLAG (ri->flags, BGP_INFO_HISTORY)) { - if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + if (bgp_debug_update(peer, p, 1)) + zlog_debug ("%s rcvd %s/%d", + peer->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen); if (bgp_damp_update (ri, rn, afi, safi) != BGP_DAMP_SUPPRESSED) { @@ -2254,12 +2451,19 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr, } else /* Duplicate - odd */ { - if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, - "%s rcvd %s/%d...duplicate ignored", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + if (bgp_debug_update(peer, p, 1)) + { + if (!peer->rcvd_attr_printed) + { + zlog_debug ("%s rcvd UPDATE w/ attr: %s", peer->host, peer->rcvd_attr_str); + peer->rcvd_attr_printed = 1; + } + + zlog_debug ("%s rcvd %s/%d...duplicate ignored", + peer->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen); + } /* graceful restart STALE flag unset. */ if (CHECK_FLAG (ri->flags, BGP_INFO_STALE)) @@ -2279,20 +2483,20 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr, /* Withdraw/Announce before we fully processed the withdraw */ if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) { - if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d, flapped quicker than processing", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + if (bgp_debug_update(peer, p, 1)) + zlog_debug ("%s rcvd %s/%d, flapped quicker than processing", + peer->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen); bgp_info_restore (rn, ri); } /* Received Logging. */ - if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + if (bgp_debug_update(peer, p, 1)) + zlog_debug ("%s rcvd %s/%d", + peer->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen); /* graceful restart STALE flag unset. */ if (CHECK_FLAG (ri->flags, BGP_INFO_STALE)) @@ -2340,20 +2544,29 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr, } /* Nexthop reachability check. */ - if ((afi == AFI_IP || afi == AFI_IP6) - && safi == SAFI_UNICAST - && (peer->sort == BGP_PEER_IBGP - || peer->sort == BGP_PEER_CONFED - || (peer->sort == BGP_PEER_EBGP && peer->ttl != 1) - || CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))) + if ((afi == AFI_IP || afi == AFI_IP6) && safi == SAFI_UNICAST) { - if (bgp_nexthop_lookup (afi, peer, ri, NULL, NULL)) + if (peer->sort == BGP_PEER_EBGP && peer->ttl == 1 && + ! CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK)) + connected = 1; + else + connected = 0; + + if (bgp_find_or_add_nexthop (afi, ri, NULL, connected)) bgp_info_set_flag (rn, ri, BGP_INFO_VALID); else - bgp_info_unset_flag (rn, ri, BGP_INFO_VALID); + { + if (BGP_DEBUG(nht, NHT)) + { + char buf1[INET6_ADDRSTRLEN]; + inet_ntop(AF_INET, (const void *)&attr_new->nexthop, buf1, INET6_ADDRSTRLEN); + zlog_debug("%s(%s): NH unresolved", __FUNCTION__, buf1); + } + bgp_info_unset_flag (rn, ri, BGP_INFO_VALID); + } } else - bgp_info_set_flag (rn, ri, BGP_INFO_VALID); + bgp_info_set_flag (rn, ri, BGP_INFO_VALID); bgp_attr_flush (&new_attr); @@ -2367,38 +2580,48 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr, } /* Received Logging. */ - if (BGP_DEBUG (update, UPDATE_IN)) + if (bgp_debug_update(peer, p, 1)) { - zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + if (!peer->rcvd_attr_printed) + { + zlog_debug ("%s rcvd UPDATE w/ attr: %s", peer->host, peer->rcvd_attr_str); + peer->rcvd_attr_printed = 1; + } + + zlog_debug ("%s rcvd %s/%d", + peer->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen); } /* Make new BGP info. */ - new = bgp_info_new (); - new->type = type; - new->sub_type = sub_type; - new->peer = peer; - new->attr = attr_new; - new->uptime = bgp_clock (); + new = info_make(type, sub_type, peer, attr_new, rn); /* Update MPLS tag. */ if (safi == SAFI_MPLS_VPN) memcpy ((bgp_info_extra_get (new))->tag, tag, 3); /* Nexthop reachability check. */ - if ((afi == AFI_IP || afi == AFI_IP6) - && safi == SAFI_UNICAST - && (peer->sort == BGP_PEER_IBGP - || peer->sort == BGP_PEER_CONFED - || (peer->sort == BGP_PEER_EBGP && peer->ttl != 1) - || CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))) - { - if (bgp_nexthop_lookup (afi, peer, new, NULL, NULL)) + if ((afi == AFI_IP || afi == AFI_IP6) && safi == SAFI_UNICAST) + { + if (peer->sort == BGP_PEER_EBGP && peer->ttl == 1 && + ! CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK)) + connected = 1; + else + connected = 0; + + if (bgp_find_or_add_nexthop (afi, new, NULL, connected)) bgp_info_set_flag (rn, new, BGP_INFO_VALID); else - bgp_info_unset_flag (rn, new, BGP_INFO_VALID); + { + if (BGP_DEBUG(nht, NHT)) + { + char buf1[INET6_ADDRSTRLEN]; + inet_ntop(AF_INET, (const void *)&attr_new->nexthop, buf1, INET6_ADDRSTRLEN); + zlog_debug("%s(%s): NH unresolved", __FUNCTION__, buf1); + } + bgp_info_unset_flag (rn, new, BGP_INFO_VALID); + } } else bgp_info_set_flag (rn, new, BGP_INFO_VALID); @@ -2427,12 +2650,19 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr, /* This BGP update is filtered. Log the reason then update BGP entry. */ filtered: - if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, - "%s rcvd UPDATE about %s/%d -- DENIED due to: %s", - peer->host, - inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, reason); + if (bgp_debug_update(peer, p, 1)) + { + if (!peer->rcvd_attr_printed) + { + zlog_debug ("%s rcvd UPDATE w/ attr: %s", peer->host, peer->rcvd_attr_str); + peer->rcvd_attr_printed = 1; + } + + zlog_debug ("%s rcvd UPDATE about %s/%d -- DENIED due to: %s", + peer->host, + inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen, reason); + } if (ri) bgp_rib_remove (rn, ri, peer, afi, safi); @@ -2495,11 +2725,11 @@ bgp_withdraw (struct peer *peer, struct prefix *p, struct attr *attr, && peer != bgp->peer_self) if (!bgp_adj_in_unset (rn, peer)) { - if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, "%s withdrawing route %s/%d " - "not in adj-in", peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + if (bgp_debug_update (peer, p, 1)) + zlog_debug ("%s withdrawing route %s/%d " + "not in adj-in", peer->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen); bgp_unlock_node (rn); return 0; } @@ -2512,11 +2742,11 @@ bgp_withdraw (struct peer *peer, struct prefix *p, struct attr *attr, } /* Logging. */ - if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, "%s rcvd UPDATE about %s/%d -- withdrawn", - peer->host, - inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + if (bgp_debug_update(peer, p, 1)) + zlog_debug ("%s rcvd UPDATE about %s/%d -- withdrawn", + peer->host, + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen); /* Lookup withdrawn route. */ for (ri = rn->info; ri; ri = ri->next) @@ -2526,11 +2756,10 @@ bgp_withdraw (struct peer *peer, struct prefix *p, struct attr *attr, /* Withdraw specified route from routing table. */ if (ri && ! CHECK_FLAG (ri->flags, BGP_INFO_HISTORY)) bgp_rib_withdraw (rn, ri, peer, afi, safi, prd); - else if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, - "%s Can't find the route %s/%d", peer->host, - inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen); + else if (bgp_debug_update(peer, p, 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); @@ -2701,6 +2930,12 @@ bgp_announce_route (struct peer *peer, afi_t afi, safi_t safi) if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) bgp_announce_table (peer, afi, safi, NULL, 1); + + /* + * The write thread needs to be scheduled since it may not be done as + * part of building adj_out. + */ + bgp_peer_schedule_updates(peer); } void @@ -3261,8 +3496,7 @@ bgp_nlri_parse_ip (struct peer *peer, struct attr *attr, /* Prefix length check. */ if (p.prefixlen > prefix_blen (&p) * 8) { - plog_err (peer->log, - "%s [Error] Update packet error" + zlog_err ("%s [Error] Update packet error" " (wrong prefix length %u for afi %u)", peer->host, p.prefixlen, packet->afi); return -1; @@ -3274,8 +3508,7 @@ bgp_nlri_parse_ip (struct peer *peer, struct attr *attr, /* When packet overflow occur return immediately. */ if (pnt + psize > lim) { - plog_err (peer->log, - "%s [Error] Update packet error" + zlog_err ("%s [Error] Update packet error" " (prefix length %u overflows packet)", peer->host, p.prefixlen); return -1; @@ -3284,8 +3517,7 @@ bgp_nlri_parse_ip (struct peer *peer, struct attr *attr, /* Defensive coding, double-check the psize fits in a struct prefix */ if (psize > (ssize_t) sizeof(p.u)) { - plog_err (peer->log, - "%s [Error] Update packet error" + zlog_err ("%s [Error] Update packet error" " (prefix length %u too large for prefix storage %zu!?!!", peer->host, p.prefixlen, sizeof(p.u)); return -1; @@ -3306,9 +3538,8 @@ bgp_nlri_parse_ip (struct peer *peer, struct attr *attr, * (e.g., an unexpected multicast IP address), an error SHOULD * be logged locally, and the prefix SHOULD be ignored. */ - zlog (peer->log, LOG_ERR, - "%s: IPv4 unicast NLRI is multicast address %s, ignoring", - peer->host, inet_ntoa (p.u.prefix4)); + zlog_err ("IPv4 unicast NLRI is multicast address %s", + inet_ntoa (p.u.prefix4)); continue; } } @@ -3320,18 +3551,15 @@ bgp_nlri_parse_ip (struct peer *peer, struct attr *attr, { char buf[BUFSIZ]; - zlog (peer->log, LOG_ERR, - "%s: IPv6 unicast NLRI is link-local address %s, ignoring", - peer->host, - inet_ntop (AF_INET6, &p.u.prefix6, buf, BUFSIZ)); + zlog_warn ("IPv6 link-local NLRI received %s ignore this NLRI", + inet_ntop (AF_INET6, &p.u.prefix6, buf, BUFSIZ)); continue; } if (IN6_IS_ADDR_MULTICAST (&p.u.prefix6)) { char buf[BUFSIZ]; - zlog (peer->log, LOG_ERR, - "%s: IPv6 unicast NLRI is multicast address %s, ignoring", + zlog_err ("%s: IPv6 unicast NLRI is multicast address %s, ignoring", peer->host, inet_ntop (AF_INET6, &p.u.prefix6, buf, BUFSIZ)); continue; @@ -3355,8 +3583,7 @@ bgp_nlri_parse_ip (struct peer *peer, struct attr *attr, /* Packet length consistency check. */ if (pnt != lim) { - plog_err (peer->log, - "%s [Error] Update packet error" + zlog_err ("%s [Error] Update packet error" " (prefix length mismatch with total length)", peer->host); return -1; @@ -3480,11 +3707,10 @@ bgp_static_update_rsclient (struct peer *rsclient, struct prefix *p, == RMAP_DENY) { /* This BGP update is filtered. Log the reason then update BGP entry. */ - if (BGP_DEBUG (update, UPDATE_IN)) - zlog (rsclient->log, LOG_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); + if (bgp_debug_update(rsclient, p, 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; @@ -3530,6 +3756,23 @@ bgp_static_update_rsclient (struct peer *rsclient, struct prefix *p, 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 (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(AF_INET, (const void *)&attr_new->nexthop, + buf1, INET6_ADDRSTRLEN); + zlog_debug("%s(%s): NH unresolved", __FUNCTION__, buf1); + } + bgp_info_unset_flag (rn, ri, BGP_INFO_VALID); + } + } /* Process change. */ bgp_process (bgp, rn, afi, safi); bgp_unlock_node (rn); @@ -3538,15 +3781,29 @@ bgp_static_update_rsclient (struct peer *rsclient, struct prefix *p, return; } } - + /* Make new BGP info. */ - new = bgp_info_new (); - new->type = ZEBRA_ROUTE_BGP; - new->sub_type = BGP_ROUTE_STATIC; - new->peer = bgp->peer_self; - SET_FLAG (new->flags, BGP_INFO_VALID); - new->attr = attr_new; - new->uptime = bgp_clock (); + new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, bgp->peer_self, + attr_new, rn); + /* Nexthop reachability check. */ + if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK)) + { + if (bgp_find_or_add_nexthop (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(AF_INET, (const void *)&attr_new->nexthop, + buf1, INET6_ADDRSTRLEN); + zlog_debug("%s(%s): NH unresolved", __FUNCTION__, buf1); + } + bgp_info_unset_flag (rn, new, BGP_INFO_VALID); + } + } + else + bgp_info_set_flag (rn, new, BGP_INFO_VALID); /* Register new BGP information. */ bgp_info_add (rn, new); @@ -3564,7 +3821,7 @@ bgp_static_update_rsclient (struct peer *rsclient, struct prefix *p, 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_static *bgp_static, afi_t afi, safi_t safi) { struct bgp_node *rn; struct bgp_info *ri; @@ -3648,6 +3905,23 @@ bgp_static_update_main (struct bgp *bgp, struct prefix *p, 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 (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(AF_INET, (const void *)&attr_new->nexthop, + buf1, INET6_ADDRSTRLEN); + zlog_debug("%s(%s): NH unresolved", __FUNCTION__, buf1); + } + bgp_info_unset_flag (rn, ri, BGP_INFO_VALID); + } + } /* Process change. */ bgp_aggregate_increment (bgp, p, ri, afi, safi); bgp_process (bgp, rn, afi, safi); @@ -3659,13 +3933,27 @@ bgp_static_update_main (struct bgp *bgp, struct prefix *p, } /* Make new BGP info. */ - new = bgp_info_new (); - new->type = ZEBRA_ROUTE_BGP; - new->sub_type = BGP_ROUTE_STATIC; - new->peer = bgp->peer_self; - SET_FLAG (new->flags, BGP_INFO_VALID); - new->attr = attr_new; - new->uptime = bgp_clock (); + new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, bgp->peer_self, attr_new, + rn); + /* Nexthop reachability check. */ + if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK)) + { + if (bgp_find_or_add_nexthop (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(AF_INET, (const void *)&attr_new->nexthop, buf1, + INET6_ADDRSTRLEN); + zlog_debug("%s(%s): NH unresolved", __FUNCTION__, buf1); + } + bgp_info_unset_flag (rn, new, BGP_INFO_VALID); + } + } + else + bgp_info_set_flag (rn, new, BGP_INFO_VALID); /* Aggregate address increment. */ bgp_aggregate_increment (bgp, p, new, afi, safi); @@ -3706,8 +3994,14 @@ bgp_static_withdraw (struct bgp *bgp, struct prefix *p, afi_t afi, { struct bgp_node *rn; struct bgp_info *ri; + struct bgp_info *new; - rn = bgp_afi_node_get (bgp->rib[afi][safi], afi, safi, p, NULL); + /* Make new BGP info. */ + rn = bgp_node_get (bgp->rib[afi][safi], p); + new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, bgp->peer_self, + bgp_attr_default_intern(BGP_ORIGIN_IGP), rn); + + SET_FLAG (new->flags, BGP_INFO_VALID); /* Check selected route and self inserted route. */ for (ri = rn->info; ri; ri = ri->next) @@ -3720,6 +4014,7 @@ bgp_static_withdraw (struct bgp *bgp, struct prefix *p, afi_t afi, if (ri) { bgp_aggregate_decrement (bgp, p, ri, afi, safi); + bgp_unlink_nexthop(ri); bgp_info_delete (rn, ri); bgp_process (bgp, rn, afi, safi); } @@ -3877,13 +4172,9 @@ bgp_static_update_safi (struct bgp *bgp, struct prefix *p, /* Make new BGP info. */ - new = bgp_info_new (); - new->type = ZEBRA_ROUTE_BGP; - new->sub_type = BGP_ROUTE_STATIC; - new->peer = bgp->peer_self; - new->attr = attr_new; + new = info_make (ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, bgp->peer_self, + attr_new, rn); SET_FLAG (new->flags, BGP_INFO_VALID); - new->uptime = bgp_clock (); new->extra = bgp_info_extra_new(); memcpy (new->extra->tag, bgp_static->tag, 3); @@ -3982,17 +4273,12 @@ bgp_static_set (struct vty *vty, struct bgp *bgp, const char *ip_str, rn->info = bgp_static; } - /* If BGP scan is not enabled, we should install this route here. */ - if (! bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK)) - { - bgp_static->valid = 1; - - if (need_update) - bgp_static_withdraw (bgp, &p, afi, safi); + bgp_static->valid = 1; + if (need_update) + bgp_static_withdraw (bgp, &p, afi, safi); - if (! bgp_static->backdoor) - bgp_static_update (bgp, &p, bgp_static, afi, safi); - } + if (! bgp_static->backdoor) + bgp_static_update (bgp, &p, bgp_static, afi, safi); return CMD_SUCCESS; } @@ -4242,6 +4528,84 @@ bgp_static_unset_safi(safi_t safi, struct vty *vty, const char *ip_str, return CMD_SUCCESS; } +static int +bgp_table_map_set (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, + const char *rmap_name) +{ + struct bgp_rmap *rmap; + + rmap = &bgp->table_map[afi][safi]; + if (rmap_name) + { + if (rmap->name) + free (rmap->name); + rmap->name = strdup (rmap_name); + rmap->map = route_map_lookup_by_name (rmap_name); + } + else + { + if (rmap->name) + free (rmap->name); + rmap->name = NULL; + rmap->map = NULL; + } + + bgp_zebra_announce_table(bgp, afi, safi); + + return CMD_SUCCESS; +} + +static int +bgp_table_map_unset (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, + const char *rmap_name) +{ + struct bgp_rmap *rmap; + + rmap = &bgp->table_map[afi][safi]; + if (rmap->name) + free (rmap->name); + rmap->name = NULL; + rmap->map = NULL; + + bgp_zebra_announce_table(bgp, afi, safi); + + return CMD_SUCCESS; +} + +int +bgp_config_write_table_map (struct vty *vty, struct bgp *bgp, afi_t afi, + safi_t safi, int *write) +{ + if (bgp->table_map[afi][safi].name) + { + bgp_config_write_family_header (vty, afi, safi, write); + vty_out (vty, " table-map %s%s", + bgp->table_map[afi][safi].name, VTY_NEWLINE); + } + + return 0; +} + + +DEFUN (bgp_table_map, + bgp_table_map_cmd, + "table-map WORD", + "BGP table to RIB route download filter\n" + "Name of the route map\n") +{ + return bgp_table_map_set (vty, vty->index, + bgp_node_afi (vty), bgp_node_safi (vty), argv[0]); +} +DEFUN (no_bgp_table_map, + no_bgp_table_map_cmd, + "no table-map WORD", + "BGP table to RIB route download filter\n" + "Name of the route map\n") +{ + return bgp_table_map_unset (vty, vty->index, + bgp_node_afi (vty), bgp_node_safi (vty), argv[0]); +} + DEFUN (bgp_network, bgp_network_cmd, "network A.B.C.D/M", @@ -4736,6 +5100,7 @@ bgp_aggregate_free (struct bgp_aggregate *aggregate) XFREE (MTYPE_BGP_AGGREGATE, aggregate); } +/* Update an aggregate as routes are added/removed from the BGP table */ static void bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew, afi_t afi, safi_t safi, struct bgp_info *del, @@ -4753,6 +5118,7 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew, struct bgp_info *new; int first = 1; unsigned long match = 0; + u_char atomic_aggregate = 0; /* ORIGIN attribute: If at least one route among routes that are aggregated has ORIGIN with the value INCOMPLETE, then the @@ -4797,6 +5163,9 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew, } #endif /* AGGREGATE_NEXTHOP_CHECK */ + if (ri->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE)) + atomic_aggregate = 1; + if (ri->sub_type != BGP_ROUTE_AGGREGATE) { if (aggregate->summary_only) @@ -4808,11 +5177,11 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew, aggregate->count++; + if (origin < ri->attr->origin) + origin = ri->attr->origin; + if (aggregate->as_set) { - if (origin < ri->attr->origin) - origin = ri->attr->origin; - if (aspath) { asmerge = aspath_aggregate (aspath, ri->attr->aspath); @@ -4849,11 +5218,11 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew, if (aggregate->summary_only) (bgp_info_extra_get (rinew))->suppress++; + if (origin < rinew->attr->origin) + origin = rinew->attr->origin; + if (aggregate->as_set) { - if (origin < rinew->attr->origin) - origin = rinew->attr->origin; - if (aspath) { asmerge = aspath_aggregate (aspath, rinew->attr->aspath); @@ -4881,13 +5250,11 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew, if (aggregate->count > 0) { rn = bgp_node_get (table, p); - new = bgp_info_new (); - new->type = ZEBRA_ROUTE_BGP; - new->sub_type = BGP_ROUTE_AGGREGATE; - new->peer = bgp->peer_self; + new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_AGGREGATE, bgp->peer_self, + bgp_attr_aggregate_intern(bgp, origin, aspath, community, + aggregate->as_set, + atomic_aggregate), rn); SET_FLAG (new->flags, BGP_INFO_VALID); - new->attr = bgp_attr_aggregate_intern (bgp, origin, aspath, community, aggregate->as_set); - new->uptime = bgp_clock (); bgp_info_add (rn, new); bgp_unlock_node (rn); @@ -4976,6 +5343,7 @@ bgp_aggregate_decrement (struct bgp *bgp, struct prefix *p, bgp_unlock_node (child); } +/* Called via bgp_aggregate_set when the user configures aggregate-address */ static void bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi, struct bgp_aggregate *aggregate) @@ -4991,6 +5359,7 @@ bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi, struct aspath *asmerge = NULL; struct community *community = NULL; struct community *commerge = NULL; + u_char atomic_aggregate = 0; table = bgp->rib[afi][safi]; @@ -5012,6 +5381,9 @@ bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi, if (BGP_INFO_HOLDDOWN (ri)) continue; + if (ri->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE)) + atomic_aggregate = 1; + if (ri->sub_type != BGP_ROUTE_AGGREGATE) { /* summary-only aggregate route suppress aggregated @@ -5022,13 +5394,21 @@ bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi, bgp_info_set_flag (rn, ri, BGP_INFO_ATTR_CHANGED); match++; } + + /* If at least one route among routes that are aggregated has + * ORIGIN with the value INCOMPLETE, then the aggregated route + * MUST have the ORIGIN attribute with the value INCOMPLETE. + * Otherwise, if at least one route among routes that are + * aggregated has ORIGIN with the value EGP, then the aggregated + * route MUST have the ORIGIN attribute with the value EGP. + */ + if (origin < ri->attr->origin) + origin = ri->attr->origin; + /* as-set aggregate route generate origin, as path, community aggregation. */ if (aggregate->as_set) { - if (origin < ri->attr->origin) - origin = ri->attr->origin; - if (aspath) { asmerge = aspath_aggregate (aspath, ri->attr->aspath); @@ -5065,14 +5445,11 @@ bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi, if (aggregate->count) { rn = bgp_node_get (table, p); - - new = bgp_info_new (); - new->type = ZEBRA_ROUTE_BGP; - new->sub_type = BGP_ROUTE_AGGREGATE; - new->peer = bgp->peer_self; + new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_AGGREGATE, bgp->peer_self, + bgp_attr_aggregate_intern(bgp, origin, aspath, community, + aggregate->as_set, + atomic_aggregate), rn); SET_FLAG (new->flags, BGP_INFO_VALID); - new->attr = bgp_attr_aggregate_intern (bgp, origin, aspath, community, aggregate->as_set); - new->uptime = bgp_clock (); bgp_info_add (rn, new); bgp_unlock_node (rn); @@ -5602,8 +5979,8 @@ ALIAS (no_ipv6_aggregate_address_summary_only, /* Redistribute route treatment. */ void bgp_redistribute_add (struct prefix *p, const struct in_addr *nexthop, - const struct in6_addr *nexthop6, - u_int32_t metric, u_char type) + const struct in6_addr *nexthop6, unsigned int ifindex, + u_int32_t metric, u_char type, u_short tag) { struct bgp *bgp; struct listnode *node, *nnode; @@ -5620,6 +5997,7 @@ bgp_redistribute_add (struct prefix *p, const struct in_addr *nexthop, bgp_attr_default_set (&attr, BGP_ORIGIN_INCOMPLETE); if (nexthop) attr.nexthop = *nexthop; + attr.nh_ifindex = ifindex; if (nexthop6) { @@ -5630,6 +6008,7 @@ bgp_redistribute_add (struct prefix *p, const struct in_addr *nexthop, attr.med = metric; attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC); + attr.extra->tag = tag; for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) { @@ -5715,16 +6094,12 @@ bgp_redistribute_add (struct prefix *p, const struct in_addr *nexthop, aspath_unintern (&attr.aspath); bgp_attr_extra_free (&attr); return; - } + } } - new = bgp_info_new (); - new->type = type; - new->sub_type = BGP_ROUTE_REDISTRIBUTE; - new->peer = bgp->peer_self; + new = info_make(type, BGP_ROUTE_REDISTRIBUTE, bgp->peer_self, + new_attr, bn); SET_FLAG (new->flags, BGP_INFO_VALID); - new->attr = new_attr; - new->uptime = bgp_clock (); bgp_aggregate_increment (bgp, p, new, afi, SAFI_UNICAST); bgp_info_add (bn, new); @@ -5847,7 +6222,8 @@ route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo) vty_out (vty, "S"); else if (binfo->extra && binfo->extra->suppress) vty_out (vty, "s"); - else if (! CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY)) + else if (CHECK_FLAG (binfo->flags, BGP_INFO_VALID) && + ! CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY)) vty_out (vty, "*"); else vty_out (vty, " "); @@ -6293,7 +6669,7 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p, VTY_NEWLINE); } - /* Line 3 display Origin, Med, Locpref, Weight, valid, Int/Ext/Local, Atomic, best */ + /* Line 3 display Origin, Med, Locpref, Weight, Tag, valid, Int/Ext/Local, Atomic, best */ vty_out (vty, " Origin %s", bgp_origin_long_str[attr->origin]); if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC)) @@ -6306,8 +6682,13 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p, if (attr->extra && attr->extra->weight != 0) vty_out (vty, ", weight %u", attr->extra->weight); + + if (attr->extra && attr->extra->tag != 0) + vty_out (vty, ", tag %d", attr->extra->tag); - if (! CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY)) + if (! CHECK_FLAG (binfo->flags, BGP_INFO_VALID)) + vty_out (vty, ", invalid"); + else if (! CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY)) vty_out (vty, ", valid"); if (binfo->peer != bgp->peer_self) @@ -6756,7 +7137,7 @@ static int bgp_show_route_in_table (struct vty *vty, struct bgp *bgp, struct bgp_table *rib, const char *ip_str, afi_t afi, safi_t safi, struct prefix_rd *prd, - int prefix_check) + int prefix_check, enum bgp_path_type pathtype) { int ret; int header; @@ -6807,7 +7188,12 @@ bgp_show_route_in_table (struct vty *vty, struct bgp *bgp, header = 0; } display++; - route_vty_out_detail (vty, bgp, &rm->p, ri, AFI_IP, safi); + + if (pathtype == BGP_PATH_ALL || + (pathtype == BGP_PATH_BESTPATH && CHECK_FLAG (ri->flags, BGP_INFO_SELECTED)) || + (pathtype == BGP_PATH_MULTIPATH && + (CHECK_FLAG (ri->flags, BGP_INFO_MULTIPATH) || CHECK_FLAG (ri->flags, BGP_INFO_SELECTED)))) + route_vty_out_detail (vty, bgp, &rm->p, ri, AFI_IP, safi); } bgp_unlock_node (rm); @@ -6831,7 +7217,12 @@ bgp_show_route_in_table (struct vty *vty, struct bgp *bgp, header = 0; } display++; - route_vty_out_detail (vty, bgp, &rn->p, ri, afi, safi); + + if (pathtype == BGP_PATH_ALL || + (pathtype == BGP_PATH_BESTPATH && CHECK_FLAG (ri->flags, BGP_INFO_SELECTED)) || + (pathtype == BGP_PATH_MULTIPATH && + (CHECK_FLAG (ri->flags, BGP_INFO_MULTIPATH) || CHECK_FLAG (ri->flags, BGP_INFO_SELECTED)))) + route_vty_out_detail (vty, bgp, &rn->p, ri, afi, safi); } } @@ -6852,7 +7243,7 @@ bgp_show_route_in_table (struct vty *vty, struct bgp *bgp, static int bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str, afi_t afi, safi_t safi, struct prefix_rd *prd, - int prefix_check) + int prefix_check, enum bgp_path_type pathtype) { struct bgp *bgp; @@ -6877,7 +7268,7 @@ bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str, } return bgp_show_route_in_table (vty, bgp, bgp->rib[afi][safi], ip_str, - afi, safi, prd, prefix_check); + afi, safi, prd, prefix_check, pathtype); } /* BGP route print out function. */ @@ -6916,7 +7307,47 @@ DEFUN (show_ip_bgp_route, BGP_STR "Network in the BGP routing table to display\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0); + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); +} + +DEFUN (show_ip_bgp_route_pathtype, + show_ip_bgp_route_pathtype_cmd, + "show ip bgp A.B.C.D (bestpath|multipath)", + SHOW_STR + IP_STR + BGP_STR + "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" + "Display only the bestpath\n" + "Display only multipaths\n") +{ + if (strncmp (argv[1], "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH); + else + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH); +} + +DEFUN (show_bgp_ipv4_safi_route_pathtype, + show_bgp_ipv4_safi_route_pathtype_cmd, + "show bgp ipv4 (unicast|multicast) A.B.C.D (bestpath|multipath)", + SHOW_STR + BGP_STR + "Address family\n" + "Address Family modifier\n" + "Address Family modifier\n" + "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" + "Display only the bestpath\n" + "Display only multipaths\n") +{ + if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[2], "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH); + else + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH); + else + if (strncmp (argv[2], "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH); + else + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH); } DEFUN (show_ip_bgp_ipv4_route, @@ -6931,9 +7362,9 @@ DEFUN (show_ip_bgp_ipv4_route, "Network in the BGP routing table to display\n") { if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0); + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL); - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0); + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); } DEFUN (show_ip_bgp_vpnv4_all_route, @@ -6946,9 +7377,10 @@ DEFUN (show_ip_bgp_vpnv4_all_route, "Display information about all VPNv4 NLRIs\n" "Network in the BGP routing table to display\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0); + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL); } + DEFUN (show_ip_bgp_vpnv4_rd_route, show_ip_bgp_vpnv4_rd_route_cmd, "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D", @@ -6969,7 +7401,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_route, vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0); + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL); } DEFUN (show_ip_bgp_prefix, @@ -6980,7 +7412,23 @@ DEFUN (show_ip_bgp_prefix, BGP_STR "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1); + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); +} + +DEFUN (show_ip_bgp_prefix_pathtype, + show_ip_bgp_prefix_pathtype_cmd, + "show ip bgp A.B.C.D/M (bestpath|multipath)", + SHOW_STR + IP_STR + BGP_STR + "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" + "Display only the bestpath\n" + "Display only multipaths\n") +{ + if (strncmp (argv[1], "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH); + else + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH); } DEFUN (show_ip_bgp_ipv4_prefix, @@ -6995,11 +7443,48 @@ DEFUN (show_ip_bgp_ipv4_prefix, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1); + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL); + + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); +} - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1); +DEFUN (show_ip_bgp_ipv4_prefix_pathtype, + show_ip_bgp_ipv4_prefix_pathtype_cmd, + "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath)", + SHOW_STR + IP_STR + BGP_STR + "Address family\n" + "Address Family modifier\n" + "Address Family modifier\n" + "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" + "Display only the bestpath\n" + "Display only multipaths\n") +{ + if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[2], "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH); + else + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH); + else + if (strncmp (argv[2], "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH); + else + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH); } +ALIAS (show_ip_bgp_ipv4_prefix_pathtype, + show_bgp_ipv4_safi_prefix_pathtype_cmd, + "show bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath)", + SHOW_STR + BGP_STR + "Address family\n" + "Address Family modifier\n" + "Address Family modifier\n" + "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" + "Display only the bestpath\n" + "Display only multipaths\n") + DEFUN (show_ip_bgp_vpnv4_all_prefix, show_ip_bgp_vpnv4_all_prefix_cmd, "show ip bgp vpnv4 all A.B.C.D/M", @@ -7010,7 +7495,7 @@ DEFUN (show_ip_bgp_vpnv4_all_prefix, "Display information about all VPNv4 NLRIs\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 1); + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL); } DEFUN (show_ip_bgp_vpnv4_rd_prefix, @@ -7033,7 +7518,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_prefix, vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 1); + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 1, BGP_PATH_ALL); } DEFUN (show_ip_bgp_view, @@ -7068,7 +7553,7 @@ DEFUN (show_ip_bgp_view_route, "View name\n" "Network in the BGP routing table to display\n") { - return bgp_show_route (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, NULL, 0); + return bgp_show_route (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); } DEFUN (show_ip_bgp_view_prefix, @@ -7081,7 +7566,7 @@ DEFUN (show_ip_bgp_view_prefix, "View name\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return bgp_show_route (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, NULL, 1); + return bgp_show_route (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); } DEFUN (show_bgp, @@ -7120,7 +7605,7 @@ DEFUN (show_bgp_route, BGP_STR "Network in the BGP routing table to display\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0); + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); } DEFUN (show_bgp_ipv4_safi, @@ -7150,9 +7635,58 @@ DEFUN (show_bgp_ipv4_safi_route, "Network in the BGP routing table to display\n") { if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0); + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL); + + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); +} + +DEFUN (show_bgp_route_pathtype, + show_bgp_route_pathtype_cmd, + "show bgp X:X::X:X (bestpath|multipath)", + SHOW_STR + BGP_STR + "Network in the BGP routing table to display\n" + "Display only the bestpath\n" + "Display only multipaths\n") +{ + if (strncmp (argv[1], "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH); + else + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH); +} - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0); +ALIAS (show_bgp_route_pathtype, + show_bgp_ipv6_route_pathtype_cmd, + "show bgp ipv6 X:X::X:X (bestpath|multipath)", + SHOW_STR + BGP_STR + "Address family\n" + "Network in the BGP routing table to display\n" + "Display only the bestpath\n" + "Display only multipaths\n") + +DEFUN (show_bgp_ipv6_safi_route_pathtype, + show_bgp_ipv6_safi_route_pathtype_cmd, + "show bgp ipv6 (unicast|multicast) X:X::X:X (bestpath|multipath)", + SHOW_STR + BGP_STR + "Address family\n" + "Address Family modifier\n" + "Address Family modifier\n" + "Network in the BGP routing table to display\n" + "Display only the bestpath\n" + "Display only multipaths\n") +{ + if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[2], "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH); + else + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH); + else + if (strncmp (argv[2], "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH); + else + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH); } DEFUN (show_bgp_ipv4_vpn_route, @@ -7164,7 +7698,7 @@ DEFUN (show_bgp_ipv4_vpn_route, "Display VPN NLRI specific information\n" "Network in the BGP routing table to display\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0); + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL); } DEFUN (show_bgp_ipv6_vpn_route, @@ -7176,7 +7710,7 @@ DEFUN (show_bgp_ipv6_vpn_route, "Display VPN NLRI specific information\n" "Network in the BGP routing table to display\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, NULL, 0); + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL); } DEFUN (show_bgp_ipv4_vpn_rd_route, @@ -7199,7 +7733,7 @@ DEFUN (show_bgp_ipv4_vpn_rd_route, vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0); + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL); } DEFUN (show_bgp_ipv6_vpn_rd_route, @@ -7222,7 +7756,56 @@ DEFUN (show_bgp_ipv6_vpn_rd_route, vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MPLS_VPN, &prd, 0); + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL); +} + +DEFUN (show_bgp_prefix_pathtype, + show_bgp_prefix_pathtype_cmd, + "show bgp X:X::X:X/M (bestpath|multipath)", + SHOW_STR + BGP_STR + "IPv6 prefix <network>/<length>\n" + "Display only the bestpath\n" + "Display only multipaths\n") +{ + if (strncmp (argv[1], "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH); + else + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH); +} + +ALIAS (show_bgp_prefix_pathtype, + show_bgp_ipv6_prefix_pathtype_cmd, + "show bgp ipv6 X:X::X:X/M (bestpath|multipath)", + SHOW_STR + BGP_STR + "Address family\n" + "IPv6 prefix <network>/<length>\n" + "Display only the bestpath\n" + "Display only multipaths\n") + +DEFUN (show_bgp_ipv6_safi_prefix_pathtype, + show_bgp_ipv6_safi_prefix_pathtype_cmd, + "show bgp ipv6 (unicast|multicast) X:X::X:X/M (bestpath|multipath)", + SHOW_STR + BGP_STR + "Address family\n" + "Address Family modifier\n" + "Address Family modifier\n" + "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n" + "Display only the bestpath\n" + "Display only multipaths\n") +{ + if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[2], "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH); + else + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH); + else + if (strncmp (argv[2], "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH); + else + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH); } DEFUN (show_bgp_ipv4_encap_route, @@ -7234,7 +7817,7 @@ DEFUN (show_bgp_ipv4_encap_route, "Display ENCAP NLRI specific information\n" "Network in the BGP routing table to display\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_ENCAP, NULL, 0); + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_ENCAP, NULL, 0, BGP_PATH_ALL); } DEFUN (show_bgp_ipv6_encap_route, @@ -7246,7 +7829,7 @@ DEFUN (show_bgp_ipv6_encap_route, "Display ENCAP NLRI specific information\n" "Network in the BGP routing table to display\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_ENCAP, NULL, 0); + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_ENCAP, NULL, 0, BGP_PATH_ALL); } DEFUN (show_bgp_ipv4_safi_rd_route, @@ -7275,7 +7858,7 @@ DEFUN (show_bgp_ipv4_safi_rd_route, vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[2], AFI_IP, safi, &prd, 0); + return bgp_show_route (vty, NULL, argv[2], AFI_IP, safi, &prd, 0, BGP_PATH_ALL); } DEFUN (show_bgp_ipv6_safi_rd_route, @@ -7304,7 +7887,7 @@ DEFUN (show_bgp_ipv6_safi_rd_route, vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[2], AFI_IP6, SAFI_ENCAP, &prd, 0); + return bgp_show_route (vty, NULL, argv[2], AFI_IP6, SAFI_ENCAP, &prd, 0, BGP_PATH_ALL); } DEFUN (show_bgp_ipv4_prefix, @@ -7315,7 +7898,7 @@ DEFUN (show_bgp_ipv4_prefix, IP_STR "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1); + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); } DEFUN (show_bgp_ipv4_safi_prefix, @@ -7329,9 +7912,9 @@ DEFUN (show_bgp_ipv4_safi_prefix, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1); + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL); - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1); + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); } DEFUN (show_bgp_ipv4_vpn_prefix, @@ -7343,7 +7926,7 @@ DEFUN (show_bgp_ipv4_vpn_prefix, "Display VPN NLRI specific information\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 1); + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL); } DEFUN (show_bgp_ipv6_vpn_prefix, @@ -7355,7 +7938,7 @@ DEFUN (show_bgp_ipv6_vpn_prefix, "Display VPN NLRI specific information\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, NULL, 1); + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL); } DEFUN (show_bgp_ipv4_encap_prefix, @@ -7368,7 +7951,7 @@ DEFUN (show_bgp_ipv4_encap_prefix, "Display information about ENCAP NLRIs\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_ENCAP, NULL, 1); + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_ENCAP, NULL, 1, BGP_PATH_ALL); } DEFUN (show_bgp_ipv6_encap_prefix, @@ -7381,7 +7964,7 @@ DEFUN (show_bgp_ipv6_encap_prefix, "Display information about ENCAP NLRIs\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_ENCAP, NULL, 1); + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_ENCAP, NULL, 1, BGP_PATH_ALL); } DEFUN (show_bgp_ipv4_safi_rd_prefix, @@ -7411,7 +7994,7 @@ DEFUN (show_bgp_ipv4_safi_rd_prefix, vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[2], AFI_IP, safi, &prd, 1); + return bgp_show_route (vty, NULL, argv[2], AFI_IP, safi, &prd, 1, BGP_PATH_ALL); } DEFUN (show_bgp_ipv6_safi_rd_prefix, @@ -7441,7 +8024,7 @@ DEFUN (show_bgp_ipv6_safi_rd_prefix, vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[2], AFI_IP6, safi, &prd, 1); + return bgp_show_route (vty, NULL, argv[2], AFI_IP6, safi, &prd, 1, BGP_PATH_ALL); } DEFUN (show_bgp_afi_safi_view, @@ -7509,7 +8092,7 @@ DEFUN (show_bgp_view_afi_safi_route, vty_out (vty, "Error: Bad SAFI: %s%s", argv[1], VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, argv[0], argv[3], afi, safi, NULL, 0); + return bgp_show_route (vty, argv[0], argv[3], afi, safi, NULL, 0, BGP_PATH_ALL); } DEFUN (show_bgp_view_afi_safi_prefix, @@ -7538,7 +8121,7 @@ DEFUN (show_bgp_view_afi_safi_prefix, vty_out (vty, "Error: Bad SAFI: %s%s", argv[1], VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, argv[0], argv[3], afi, safi, NULL, 1); + return bgp_show_route (vty, argv[0], argv[3], afi, safi, NULL, 1, BGP_PATH_ALL); } /* new001 */ @@ -7584,7 +8167,7 @@ DEFUN (show_bgp_ipv6_route, "Address family\n" "Network in the BGP routing table to display\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0); + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); } DEFUN (show_bgp_ipv6_safi_route, @@ -7598,9 +8181,9 @@ DEFUN (show_bgp_ipv6_safi_route, "Network in the BGP routing table to display\n") { if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0); + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL); - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0); + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); } /* old command */ @@ -7612,7 +8195,7 @@ DEFUN (show_ipv6_bgp_route, BGP_STR "Network in the BGP routing table to display\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0); + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); } DEFUN (show_bgp_prefix, @@ -7622,7 +8205,7 @@ DEFUN (show_bgp_prefix, BGP_STR "IPv6 prefix <network>/<length>\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1); + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); } @@ -7635,7 +8218,7 @@ DEFUN (show_bgp_ipv6_prefix, "Address family\n" "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1); + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); } DEFUN (show_bgp_ipv6_safi_prefix, show_bgp_ipv6_safi_prefix_cmd, @@ -7648,9 +8231,9 @@ DEFUN (show_bgp_ipv6_safi_prefix, "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") { if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1); + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL); - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1); + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); } /* old command */ @@ -7662,7 +8245,7 @@ DEFUN (show_ipv6_bgp_prefix, BGP_STR "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1); + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); } DEFUN (show_bgp_view, @@ -7717,7 +8300,7 @@ DEFUN (show_bgp_view_route, "View name\n" "Network in the BGP routing table to display\n") { - return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0); + return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); } DEFUN (show_bgp_view_ipv6_route, @@ -7730,7 +8313,7 @@ DEFUN (show_bgp_view_ipv6_route, "Address family\n" "Network in the BGP routing table to display\n") { - return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0); + return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); } /* old command */ @@ -7754,7 +8337,7 @@ DEFUN (show_ipv6_mbgp_route, MBGP_STR "Network in the MBGP routing table to display\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 0); + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL); } /* old command */ @@ -7766,7 +8349,7 @@ DEFUN (show_ipv6_mbgp_prefix, MBGP_STR "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 1); + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL); } DEFUN (show_bgp_view_prefix, @@ -7778,7 +8361,7 @@ DEFUN (show_bgp_view_prefix, "View name\n" "IPv6 prefix <network>/<length>\n") { - return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1); + return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); } DEFUN (show_bgp_view_ipv6_prefix, @@ -7791,7 +8374,7 @@ DEFUN (show_bgp_view_ipv6_prefix, "Address family\n" "IPv6 prefix <network>/<length>\n") { - return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1); + return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); } static int @@ -11548,8 +12131,13 @@ peer_lookup_in_view (struct vty *vty, const char *view_name, ret = str2sockunion (ip_str, &su); if (ret < 0) { - vty_out (vty, "Malformed address: %s%s", ip_str, VTY_NEWLINE); - return NULL; + peer = peer_lookup_by_conf_if (bgp, ip_str); + if (!peer) + { + vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE); + return NULL; + } + return peer; } /* Peer structure lookup. */ @@ -11998,8 +12586,7 @@ bgp_peer_count_walker (struct thread *t) { pc->count[PCOUNT_COUNTED]++; if (CHECK_FLAG (ri->flags, BGP_INFO_UNUSEABLE)) - plog_warn (peer->log, - "%s [pcount] %s/%d is counted but flags 0x%x", + zlog_warn ("%s [pcount] %s/%d is counted but flags 0x%x", peer->host, inet_ntop(rn->p.family, &rn->p.u.prefix, buf, SU_ADDRSTRLEN), @@ -12009,8 +12596,7 @@ bgp_peer_count_walker (struct thread *t) else { if (!CHECK_FLAG (ri->flags, BGP_INFO_UNUSEABLE)) - plog_warn (peer->log, - "%s [pcount] %s/%d not counted but flags 0x%x", + zlog_warn ("%s [pcount] %s/%d not counted but flags 0x%x", peer->host, inet_ntop(rn->p.family, &rn->p.u.prefix, buf, SU_ADDRSTRLEN), @@ -12068,13 +12654,14 @@ bgp_peer_counts (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi) DEFUN (show_ip_bgp_neighbor_prefix_counts, show_ip_bgp_neighbor_prefix_counts_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X) prefix-counts", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts", SHOW_STR IP_STR BGP_STR "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 detailed prefix count information\n") { struct peer *peer; @@ -12088,13 +12675,14 @@ DEFUN (show_ip_bgp_neighbor_prefix_counts, DEFUN (show_bgp_ipv6_neighbor_prefix_counts, show_bgp_ipv6_neighbor_prefix_counts_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) prefix-counts", + "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts", SHOW_STR BGP_STR "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 detailed prefix count information\n") { struct peer *peer; @@ -12108,7 +12696,7 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts, DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, show_ip_bgp_ipv4_neighbor_prefix_counts_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) prefix-counts", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts", SHOW_STR IP_STR BGP_STR @@ -12118,6 +12706,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, "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 detailed prefix count information\n") { struct peer *peer; @@ -12134,7 +12723,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd, - "show ip bgp vpnv4 all neighbors (A.B.C.D|X:X::X:X) prefix-counts", + "show ip bgp vpnv4 all neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts", SHOW_STR IP_STR BGP_STR @@ -12144,6 +12733,7 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, "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 detailed prefix count information\n") { struct peer *peer; @@ -12157,7 +12747,7 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, DEFUN (show_bgp_ipv4_safi_neighbor_prefix_counts, show_bgp_ipv4_safi_neighbor_prefix_counts_cmd, - "show bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) prefix-counts", + "show bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts", SHOW_STR BGP_STR "Address family\n" @@ -12168,6 +12758,7 @@ DEFUN (show_bgp_ipv4_safi_neighbor_prefix_counts, "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 detailed prefix count information\n") { struct peer *peer; @@ -12187,7 +12778,7 @@ DEFUN (show_bgp_ipv4_safi_neighbor_prefix_counts, DEFUN (show_bgp_ipv6_safi_neighbor_prefix_counts, show_bgp_ipv6_safi_neighbor_prefix_counts_cmd, - "show bgp ipv6 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) prefix-counts", + "show bgp ipv6 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts", SHOW_STR BGP_STR "Address family\n" @@ -12198,6 +12789,7 @@ DEFUN (show_bgp_ipv6_safi_neighbor_prefix_counts, "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 detailed prefix count information\n") { struct peer *peer; @@ -12217,7 +12809,7 @@ DEFUN (show_bgp_ipv6_safi_neighbor_prefix_counts, DEFUN (show_ip_bgp_encap_neighbor_prefix_counts, show_ip_bgp_encap_neighbor_prefix_counts_cmd, - "show ip bgp encap all neighbors (A.B.C.D|X:X::X:X) prefix-counts", + "show ip bgp encap all neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts", SHOW_STR IP_STR BGP_STR @@ -12227,6 +12819,7 @@ DEFUN (show_ip_bgp_encap_neighbor_prefix_counts, "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 detailed prefix count information\n") { struct peer *peer; @@ -12238,19 +12831,22 @@ DEFUN (show_ip_bgp_encap_neighbor_prefix_counts, return bgp_peer_counts (vty, peer, AFI_IP, SAFI_ENCAP); } - static void show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, - int in) + int in, const char *rmap_name) { struct bgp_table *table; struct bgp_adj_in *ain; struct bgp_adj_out *adj; unsigned long output_count; + unsigned long filtered_count; struct bgp_node *rn; int header1 = 1; struct bgp *bgp; int header2 = 1; + struct attr attr; + struct attr_extra extra; + int ret; bgp = peer->bgp; @@ -12259,8 +12855,8 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, table = bgp->rib[afi][safi]; - output_count = 0; - + output_count = filtered_count = 0; + if (! in && CHECK_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) { @@ -12273,6 +12869,7 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, header1 = 0; } + attr.extra = &extra; for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn)) if (in) { @@ -12292,9 +12889,16 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, header2 = 0; } if (ain->attr) - { - route_vty_out_tmp (vty, &rn->p, ain->attr, safi); - output_count++; + { + bgp_attr_dup(&attr, ain->attr); + if (bgp_input_modifier(peer, &rn->p, &attr, afi, + safi, rmap_name) != RMAP_DENY) + { + route_vty_out_tmp (vty, &rn->p, &attr, safi); + output_count++; + } + else + filtered_count++; } } } @@ -12316,9 +12920,26 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, header2 = 0; } if (adj->attr) - { - route_vty_out_tmp (vty, &rn->p, adj->attr, safi); - output_count++; + { + if (!CHECK_FLAG(peer->af_flags[afi][safi], + PEER_FLAG_REFLECTOR_CLIENT) + || bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) + { + + bgp_attr_dup(&attr, adj->attr); + ret = bgp_output_modifier(peer, &rn->p, &attr, afi, + safi, rmap_name); + } + else + ret = RMAP_PERMIT; + + if (ret != RMAP_DENY) + { + route_vty_out_tmp (vty, &rn->p, &attr, safi); + output_count++; + } + else + filtered_count++; } } } @@ -12329,7 +12950,8 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, } static int -peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, int in) +peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, + int in, const char *rmap_name) { if (! peer || ! peer->afc[afi][safi]) { @@ -12344,14 +12966,36 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, int return CMD_WARNING; } - show_adj_route (vty, peer, afi, safi, in); + if (!in && (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT) + && !bgp_flag_check(peer->bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))) + { + vty_out (vty, "%% Cannot apply outgoing route-map on route-reflector clients%s", + VTY_NEWLINE); + vty_out (vty, "%% Enable bgp route-reflector allow-outbound-policy flag%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + show_adj_route (vty, peer, afi, safi, in, rmap_name); return CMD_SUCCESS; } +static int +peer_adj_routes_decode (struct vty *vty, const char *view, const char *ip_str, afi_t afi, safi_t safi, int in, const char *rmap) +{ + struct peer *peer; + + peer = peer_lookup_in_view (vty, view, ip_str); + if (!peer) + return CMD_WARNING; + + return peer_adj_routes (vty, peer, afi, safi, in, rmap); +} + DEFUN (show_ip_bgp_view_neighbor_advertised_route, show_ip_bgp_view_neighbor_advertised_route_cmd, - "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes", SHOW_STR IP_STR BGP_STR @@ -12362,33 +13006,63 @@ DEFUN (show_ip_bgp_view_neighbor_advertised_route, "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n") { - struct peer *peer; - - if (argc == 2) - peer = peer_lookup_in_view (vty, argv[0], argv[1]); - else - peer = peer_lookup_in_view (vty, NULL, argv[0]); + return peer_adj_routes_decode (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, 0, NULL); +} - if (! peer) - return CMD_WARNING; - - return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0); +DEFUN (show_ip_bgp_view_neighbor_advertised_route_rmap, + show_ip_bgp_view_neighbor_advertised_route_rmap_cmd, + "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD", + SHOW_STR + IP_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 routes advertised to a BGP neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + return peer_adj_routes_decode (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, 0, argv[2]); } -ALIAS (show_ip_bgp_view_neighbor_advertised_route, +DEFUN (show_ip_bgp_neighbor_advertised_route, show_ip_bgp_neighbor_advertised_route_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes", SHOW_STR IP_STR BGP_STR "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 routes advertised to a BGP neighbor\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, 0, NULL); +} -DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, - show_ip_bgp_ipv4_neighbor_advertised_route_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) advertised-routes", +DEFUN (show_ip_bgp_neighbor_advertised_route_rmap, + show_ip_bgp_neighbor_advertised_route_rmap_cmd, + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD", + SHOW_STR + IP_STR + BGP_STR + "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 routes advertised to a BGP neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, 0, argv[1]); +} + +DEFUN (show_ip_bgp_ipv4_safi_neighbor_advertised_route, + show_ip_bgp_ipv4_safi_neighbor_advertised_route_cmd, + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes", SHOW_STR IP_STR BGP_STR @@ -12398,23 +13072,45 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, "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 routes advertised to a BGP neighbor\n") { - struct peer *peer; + safi_t safi = SAFI_UNICAST; - peer = peer_lookup_in_view (vty, NULL, argv[1]); - if (! peer) - return CMD_WARNING; + if (strncmp (argv[0], "m", 1) == 0) + safi = SAFI_MULTICAST; + + return peer_adj_routes_decode (vty, NULL, argv[1], AFI_IP, safi, 0, NULL); +} + +DEFUN (show_ip_bgp_ipv4_safi_neighbor_advertised_route_rmap, + show_ip_bgp_ipv4_safi_neighbor_advertised_route_rmap_cmd, + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD", + SHOW_STR + IP_STR + BGP_STR + "Address family\n" + "Address Family modifier\n" + "Address Family modifier\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 routes advertised to a BGP neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + safi_t safi = SAFI_UNICAST; if (strncmp (argv[0], "m", 1) == 0) - return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 0); + safi = SAFI_MULTICAST; - return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0); + return peer_adj_routes_decode (vty, NULL, argv[1], AFI_IP, safi, 0, argv[2]); } DEFUN (show_bgp_view_neighbor_advertised_route, show_bgp_view_neighbor_advertised_route_cmd, - "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes", SHOW_STR BGP_STR "BGP view\n" @@ -12422,24 +13118,15 @@ DEFUN (show_bgp_view_neighbor_advertised_route, "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 routes advertised to a BGP neighbor\n") { - struct peer *peer; - - if (argc == 2) - peer = peer_lookup_in_view (vty, argv[0], argv[1]); - else - peer = peer_lookup_in_view (vty, NULL, argv[0]); - - if (! peer) - return CMD_WARNING; - - return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0); + return peer_adj_routes_decode (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, 0, NULL); } -DEFUN (show_bgp_view_neighbor_received_routes, - show_bgp_view_neighbor_received_routes_cmd, - "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received-routes", +DEFUN (show_bgp_view_neighbor_advertised_route_rmap, + show_bgp_view_neighbor_advertised_route_rmap_cmd, + "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes", SHOW_STR BGP_STR "BGP view\n" @@ -12447,78 +13134,174 @@ DEFUN (show_bgp_view_neighbor_received_routes, "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" - "Display the received routes from neighbor\n") + "Neighbor on bgp configured interface\n" + "Display the routes advertised to a BGP neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") { - struct peer *peer; - - if (argc == 2) - peer = peer_lookup_in_view (vty, argv[0], argv[1]); - else - peer = peer_lookup_in_view (vty, NULL, argv[0]); - - if (! peer) - return CMD_WARNING; - - return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 1); + return peer_adj_routes_decode (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, 0, argv[2]); } -ALIAS (show_bgp_view_neighbor_advertised_route, +DEFUN (show_bgp_neighbor_advertised_route, show_bgp_neighbor_advertised_route_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes", SHOW_STR BGP_STR "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 routes advertised to a BGP neighbor\n") - -ALIAS (show_bgp_view_neighbor_advertised_route, +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, 0, NULL); +} + +DEFUN (show_bgp_neighbor_advertised_route_rmap, + show_bgp_neighbor_advertised_route_rmap_cmd, + "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD", + SHOW_STR + BGP_STR + "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 routes advertised to a BGP neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, 0, argv[1]); +} + +DEFUN (show_bgp_ipv6_neighbor_advertised_route, show_bgp_ipv6_neighbor_advertised_route_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes", SHOW_STR BGP_STR "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 the routes advertised to a BGP neighbor\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, 0, NULL); +} -/* old command */ -ALIAS (show_bgp_view_neighbor_advertised_route, - ipv6_bgp_neighbor_advertised_route_cmd, - "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes", +/*old command */ +ALIAS (show_bgp_ipv6_neighbor_advertised_route, + show_ipv6_bgp_neighbor_advertised_route_cmd, + "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes", SHOW_STR IPV6_STR BGP_STR "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 routes advertised to a BGP neighbor\n") + +DEFUN (show_bgp_ipv6_neighbor_advertised_route_rmap, + show_bgp_ipv6_neighbor_advertised_route_rmap_cmd, + "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD", + SHOW_STR + BGP_STR + "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 the routes advertised to a BGP neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, 0, argv[1]); +} + +/* old command */ +ALIAS (show_bgp_ipv6_neighbor_advertised_route_rmap, + show_ipv6_bgp_neighbor_advertised_route_rmap_cmd, + "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD", + SHOW_STR + IPV6_STR + BGP_STR + "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 routes advertised to a BGP neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") /* old command */ DEFUN (ipv6_mbgp_neighbor_advertised_route, ipv6_mbgp_neighbor_advertised_route_cmd, - "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes", SHOW_STR IPV6_STR MBGP_STR "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 routes advertised to a BGP neighbor\n") { - struct peer *peer; + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, 0, NULL); +} - peer = peer_lookup_in_view (vty, NULL, argv[0]); - if (! peer) - return CMD_WARNING; +DEFUN (ipv6_mbgp_neighbor_advertised_route_rmap, + ipv6_mbgp_neighbor_advertised_route_rmap_cmd, + "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD", + SHOW_STR + IPV6_STR + MBGP_STR + "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 routes advertised to a BGP neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, 0, argv[1]); +} - return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 0); +DEFUN (show_bgp_view_neighbor_received_routes, + show_bgp_view_neighbor_received_routes_cmd, + "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes", + 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 received routes from neighbor\n") +{ + return peer_adj_routes_decode (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, 1, NULL); +} + +DEFUN (show_bgp_view_neighbor_received_routes_rmap, + show_bgp_view_neighbor_received_routes_rmap_cmd, + "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD", + 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 received routes from neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + return peer_adj_routes_decode (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, 1, argv[2]); } DEFUN (show_ip_bgp_view_neighbor_received_routes, show_ip_bgp_view_neighbor_received_routes_cmd, - "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X) received-routes", + "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes", SHOW_STR IP_STR BGP_STR @@ -12527,51 +13310,189 @@ DEFUN (show_ip_bgp_view_neighbor_received_routes, "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 received routes from neighbor\n") { - struct peer *peer; + return peer_adj_routes_decode (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, 1, NULL); +} - if (argc == 2) - peer = peer_lookup_in_view (vty, argv[0], argv[1]); - else - peer = peer_lookup_in_view (vty, NULL, argv[0]); +DEFUN (show_ip_bgp_view_neighbor_received_routes_rmap, + show_ip_bgp_view_neighbor_received_routes_rmap_cmd, + "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD", + SHOW_STR + IP_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 received routes from neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + return peer_adj_routes_decode (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, 1, argv[2]); +} - if (! peer) - return CMD_WARNING; +DEFUN (show_bgp_view_ipv6_neighbor_received_routes, + show_bgp_view_ipv6_neighbor_received_routes_cmd, + "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes", + 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 the received routes from neighbor\n") +{ + return peer_adj_routes_decode (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, 1, NULL); +} - return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1); +DEFUN (show_bgp_view_ipv6_neighbor_received_routes_rmap, + show_bgp_view_ipv6_neighbor_received_routes_rmap_cmd, + "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD", + 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 the received routes from neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + return peer_adj_routes_decode (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, 1, argv[2]); } -ALIAS (show_ip_bgp_view_neighbor_received_routes, +DEFUN (show_ip_bgp_neighbor_received_routes, show_ip_bgp_neighbor_received_routes_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X) received-routes", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes", SHOW_STR IP_STR BGP_STR "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 received routes from neighbor\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, 1, NULL); +} + +DEFUN (show_ip_bgp_neighbor_received_routes_rmap, + show_ip_bgp_neighbor_received_routes_rmap_cmd, + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD", + SHOW_STR + IP_STR + BGP_STR + "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 received routes from neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, 1, argv[1]); +} -ALIAS (show_bgp_view_neighbor_received_routes, +DEFUN (show_bgp_ipv6_neighbor_received_routes, show_bgp_ipv6_neighbor_received_routes_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes", + "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes", SHOW_STR BGP_STR "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 the received routes from neighbor\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, 1, NULL); +} + +DEFUN (show_bgp_ipv6_neighbor_received_routes_rmap, + show_bgp_ipv6_neighbor_received_routes_rmap_cmd, + "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD", + SHOW_STR + BGP_STR + "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 the received routes from neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, 1, argv[1]); +} + +/* old command */ +DEFUN (show_ipv6_bgp_neighbor_received_routes, + show_ipv6_bgp_neighbor_received_routes_cmd, + "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes", + SHOW_STR + IPV6_STR + BGP_STR + "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 received routes from neighbor\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, 1, NULL); +} + +/* old command */ +DEFUN (ipv6_mbgp_neighbor_received_routes, + ipv6_mbgp_neighbor_received_routes_cmd, + "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes", + SHOW_STR + IPV6_STR + MBGP_STR + "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 received routes from neighbor\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, 1, NULL); +} + +DEFUN (ipv6_mbgp_neighbor_received_routes_rmap, + ipv6_mbgp_neighbor_received_routes_rmap_cmd, + "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD", + SHOW_STR + IPV6_STR + MBGP_STR + "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 received routes from neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, 1, argv[1]); +} DEFUN (show_bgp_neighbor_received_prefix_filter, show_bgp_neighbor_received_prefix_filter_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter", + "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter", SHOW_STR BGP_STR "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 information received from a BGP neighbor\n" "Display the prefixlist filter\n") { @@ -12602,42 +13523,11 @@ DEFUN (show_bgp_neighbor_received_prefix_filter, return CMD_SUCCESS; } -/* old command */ -ALIAS (show_bgp_view_neighbor_received_routes, - ipv6_bgp_neighbor_received_routes_cmd, - "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) received-routes", - SHOW_STR - IPV6_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Display the received routes from neighbor\n") -/* old command */ -DEFUN (ipv6_mbgp_neighbor_received_routes, - ipv6_mbgp_neighbor_received_routes_cmd, - "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) received-routes", - SHOW_STR - IPV6_STR - MBGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Display the received routes from neighbor\n") -{ - struct peer *peer; - - peer = peer_lookup_in_view (vty, NULL, argv[0]); - if (! peer) - return CMD_WARNING; - - return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 1); -} DEFUN (show_bgp_view_neighbor_received_prefix_filter, show_bgp_view_neighbor_received_prefix_filter_cmd, - "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received prefix-filter", + "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter", SHOW_STR BGP_STR "BGP view\n" @@ -12684,10 +13574,9 @@ DEFUN (show_bgp_view_neighbor_received_prefix_filter, return CMD_SUCCESS; } - -DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, - show_ip_bgp_ipv4_neighbor_received_routes_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received-routes", +DEFUN (show_ip_bgp_ipv4_safi_neighbor_received_routes, + show_ip_bgp_ipv4_safi_neighbor_received_routes_cmd, + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes", SHOW_STR IP_STR BGP_STR @@ -12697,23 +13586,49 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, "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 received routes from neighbor\n") { - struct peer *peer; + safi_t safi; - peer = peer_lookup_in_view (vty, NULL, argv[1]); - if (! peer) + if (bgp_parse_safi(argv[0], &safi)) { + vty_out (vty, "Error: Bad SAFI: %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; - - if (strncmp (argv[0], "m", 1) == 0) - return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 1); + } + + return peer_adj_routes_decode (vty, NULL, argv[1], AFI_IP, safi, 1, NULL); +} + +DEFUN (show_ip_bgp_ipv4_safi_neighbor_received_routes_rmap, + show_ip_bgp_ipv4_safi_neighbor_received_routes_rmap_cmd, + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD", + SHOW_STR + IP_STR + BGP_STR + "Address family\n" + "Address Family modifier\n" + "Address Family modifier\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 received routes from neighbor\n" + "Display routes matching the route-map\n" + "A route-map to match on\n") +{ + safi_t safi; - return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1); + if (bgp_parse_safi(argv[0], &safi)) { + vty_out (vty, "Error: Bad SAFI: %s%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } + + return peer_adj_routes_decode (vty, NULL, argv[1], AFI_IP, safi, 1, argv[1]); } DEFUN (show_bgp_ipv4_safi_neighbor_advertised_route, show_bgp_ipv4_safi_neighbor_advertised_route_cmd, - "show bgp ipv4 (multicast|unicast) neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show bgp ipv4 (multicast|unicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes", SHOW_STR BGP_STR "Address Family modifier\n" @@ -12721,9 +13636,9 @@ DEFUN (show_bgp_ipv4_safi_neighbor_advertised_route, "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 routes advertised to a BGP neighbor\n") { - struct peer *peer; safi_t safi; if (bgp_parse_safi(argv[0], &safi)) { @@ -12731,16 +13646,37 @@ DEFUN (show_bgp_ipv4_safi_neighbor_advertised_route, return CMD_WARNING; } - peer = peer_lookup_in_view (vty, NULL, argv[1]); - if (! peer) + return peer_adj_routes_decode (vty, NULL, argv[1], AFI_IP, safi, 0, NULL); +} + +DEFUN (show_bgp_ipv4_safi_neighbor_advertised_route_rmap, + show_bgp_ipv4_safi_neighbor_advertised_route_rmap_cmd, + "show bgp ipv4 (multicast|unicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD", + SHOW_STR + BGP_STR + "Address Family modifier\n" + "Address Family modifier\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 routes advertised to a BGP neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + safi_t safi; + + if (bgp_parse_safi(argv[0], &safi)) { + vty_out (vty, "Error: Bad SAFI: %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; + } - return peer_adj_routes (vty, peer, AFI_IP, safi, 0); + return peer_adj_routes_decode (vty, NULL, argv[1], AFI_IP, safi, 0, argv[2]); } DEFUN (show_bgp_ipv6_safi_neighbor_advertised_route, show_bgp_ipv6_safi_neighbor_advertised_route_cmd, - "show bgp ipv6 (multicast|unicast) neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show bgp ipv6 (multicast|unicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes", SHOW_STR BGP_STR "Address Family modifier\n" @@ -12749,9 +13685,9 @@ DEFUN (show_bgp_ipv6_safi_neighbor_advertised_route, "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 routes advertised to a BGP neighbor\n") { - struct peer *peer; safi_t safi; if (bgp_parse_safi(argv[0], &safi)) { @@ -12759,16 +13695,38 @@ DEFUN (show_bgp_ipv6_safi_neighbor_advertised_route, return CMD_WARNING; } - peer = peer_lookup_in_view (vty, NULL, argv[1]); - if (! peer) + return peer_adj_routes_decode (vty, NULL, argv[1], AFI_IP6, safi, 0, NULL); +} + +DEFUN (show_bgp_ipv6_safi_neighbor_advertised_route_rmap, + show_bgp_ipv6_safi_neighbor_advertised_route_rmap_cmd, + "show bgp ipv6 (multicast|unicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD", + SHOW_STR + BGP_STR + "Address Family modifier\n" + "Address Family modifier\n" + "Address Family modifier\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 routes advertised to a BGP neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + safi_t safi; + + if (bgp_parse_safi(argv[0], &safi)) { + vty_out (vty, "Error: Bad SAFI: %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; + } - return peer_adj_routes (vty, peer, AFI_IP6, safi, 0); + return peer_adj_routes_decode (vty, NULL, argv[1], AFI_IP6, safi, 0, argv[2]); } DEFUN (show_bgp_view_ipv6_neighbor_advertised_route, show_bgp_view_ipv6_neighbor_advertised_route_cmd, - "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes", SHOW_STR BGP_STR "BGP view\n" @@ -12777,24 +13735,15 @@ DEFUN (show_bgp_view_ipv6_neighbor_advertised_route, "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 routes advertised to a BGP neighbor\n") { - struct peer *peer; - - if (argc == 2) - peer = peer_lookup_in_view (vty, argv[0], argv[1]); - else - peer = peer_lookup_in_view (vty, NULL, argv[0]); - - if (! peer) - return CMD_WARNING; - - return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0); + return peer_adj_routes_decode (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, 0, NULL); } -DEFUN (show_bgp_view_ipv6_neighbor_received_routes, - show_bgp_view_ipv6_neighbor_received_routes_cmd, - "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes", +DEFUN (show_bgp_view_ipv6_neighbor_advertised_route_rmap, + show_bgp_view_ipv6_neighbor_advertised_route_rmap_cmd, + "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD", SHOW_STR BGP_STR "BGP view\n" @@ -12803,24 +13752,17 @@ DEFUN (show_bgp_view_ipv6_neighbor_received_routes, "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" - "Display the received routes from neighbor\n") + "Neighbor on bgp configured interface\n" + "Display the routes advertised to a BGP neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") { - struct peer *peer; - - if (argc == 2) - peer = peer_lookup_in_view (vty, argv[0], argv[1]); - else - peer = peer_lookup_in_view (vty, NULL, argv[0]); - - if (! peer) - return CMD_WARNING; - - return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 1); + return peer_adj_routes_decode (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, 0, argv[2]); } DEFUN (show_bgp_ipv4_safi_neighbor_received_routes, show_bgp_ipv4_safi_neighbor_received_routes_cmd, - "show bgp ipv4 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X) received-routes", + "show bgp ipv4 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes", SHOW_STR BGP_STR "Address family\n" @@ -12831,9 +13773,9 @@ DEFUN (show_bgp_ipv4_safi_neighbor_received_routes, "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 received routes from neighbor\n") { - struct peer *peer; safi_t safi; if (bgp_parse_safi(argv[0], &safi)) { @@ -12841,16 +13783,40 @@ DEFUN (show_bgp_ipv4_safi_neighbor_received_routes, return CMD_WARNING; } - peer = peer_lookup_in_view (vty, NULL, argv[1]); - if (! peer) + return peer_adj_routes_decode (vty, NULL, argv[1], AFI_IP, safi, 1, NULL); +} + +DEFUN (show_bgp_ipv4_safi_neighbor_received_routes_rmap, + show_bgp_ipv4_safi_neighbor_received_routes_rmap_cmd, + "show bgp ipv4 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD", + SHOW_STR + BGP_STR + "Address family\n" + "Address Family modifier\n" + "Address Family modifier\n" + "Address Family modifier\n" + "Address Family modifier\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 received routes from neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + safi_t safi; + + if (bgp_parse_safi(argv[0], &safi)) { + vty_out (vty, "Error: Bad SAFI: %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; - - return peer_adj_routes (vty, peer, AFI_IP, safi, 1); + } + + return peer_adj_routes_decode (vty, NULL, argv[1], AFI_IP, safi, 1, argv[2]); } DEFUN (show_bgp_ipv6_safi_neighbor_received_routes, show_bgp_ipv6_safi_neighbor_received_routes_cmd, - "show bgp ipv6 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X) received-routes", + "show bgp ipv6 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes", SHOW_STR BGP_STR "Address family\n" @@ -12861,9 +13827,9 @@ DEFUN (show_bgp_ipv6_safi_neighbor_received_routes, "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 received routes from neighbor\n") { - struct peer *peer; safi_t safi; if (bgp_parse_safi(argv[0], &safi)) { @@ -12871,16 +13837,40 @@ DEFUN (show_bgp_ipv6_safi_neighbor_received_routes, return CMD_WARNING; } - peer = peer_lookup_in_view (vty, NULL, argv[1]); - if (! peer) + return peer_adj_routes_decode (vty, NULL, argv[1], AFI_IP6, safi, 1, NULL); +} + +DEFUN (show_bgp_ipv6_safi_neighbor_received_routes_rmap, + show_bgp_ipv6_safi_neighbor_received_routes_rmap_cmd, + "show bgp ipv6 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD", + SHOW_STR + BGP_STR + "Address family\n" + "Address Family modifier\n" + "Address Family modifier\n" + "Address Family modifier\n" + "Address Family modifier\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 received routes from neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + safi_t safi; + + if (bgp_parse_safi(argv[0], &safi)) { + vty_out (vty, "Error: Bad SAFI: %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; - - return peer_adj_routes (vty, peer, AFI_IP6, safi, 1); + } + + return peer_adj_routes_decode (vty, NULL, argv[1], AFI_IP6, safi, 1, argv[2]); } DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes, show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd, - "show bgp view WORD (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) (advertised-routes|received-routes)", + "show bgp view WORD (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes)", SHOW_STR BGP_STR "BGP view\n" @@ -12892,35 +13882,63 @@ DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes, "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 advertised routes to neighbor\n" "Display the received routes from neighbor\n") { int afi; int safi; int in; - struct peer *peer; - peer = peer_lookup_in_view (vty, argv[0], argv[3]); + afi = (strncmp (argv[1], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; + safi = (strncmp (argv[2], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + in = (strncmp (argv[4], "r", 1) == 0) ? 1 : 0; + + return peer_adj_routes_decode (vty, argv[0], argv[3], afi, safi, in, NULL); +} - if (! peer) - return CMD_WARNING; +DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes_rmap, + show_bgp_view_afi_safi_neighbor_adv_recd_routes_rmap_cmd, + "show bgp view WORD (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes) route-map WORD", + SHOW_STR + BGP_STR + "BGP view\n" + "View name\n" + "Address family\n" + "Address family\n" + "Address family modifier\n" + "Address family modifier\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 advertised routes to neighbor\n" + "Display the received routes from neighbor\n" + "Route-map to control what is displayed\n" + "Route-map name\n") +{ + int afi; + int safi; + int in; afi = (strncmp (argv[1], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; safi = (strncmp (argv[2], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; in = (strncmp (argv[4], "r", 1) == 0) ? 1 : 0; - return peer_adj_routes (vty, peer, afi, safi, in); + return peer_adj_routes_decode (vty, argv[0], argv[3], afi, safi, in, argv[5]); } + DEFUN (show_ip_bgp_neighbor_received_prefix_filter, show_ip_bgp_neighbor_received_prefix_filter_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter", SHOW_STR IP_STR BGP_STR "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 information received from a BGP neighbor\n" "Display the prefixlist filter\n") { @@ -12932,13 +13950,19 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, ret = str2sockunion (argv[0], &su); if (ret < 0) { - vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); - return CMD_WARNING; + peer = peer_lookup_by_conf_if (NULL, argv[0]); + if (!peer) + { + vty_out (vty, "Malformed address or name: %s%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } + } + else + { + peer = peer_lookup (NULL, &su); + if (! peer) + return CMD_WARNING; } - - peer = peer_lookup (NULL, &su); - if (! peer) - return CMD_WARNING; sprintf (name, "%s.%d.%d", peer->host, AFI_IP, SAFI_UNICAST); count = prefix_bgp_show_prefix_list (NULL, AFI_IP, name); @@ -12953,7 +13977,7 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received prefix-filter", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter", SHOW_STR IP_STR BGP_STR @@ -12963,6 +13987,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, "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 information received from a BGP neighbor\n" "Display the prefixlist filter\n") { @@ -12974,13 +13999,19 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, ret = str2sockunion (argv[1], &su); if (ret < 0) { - vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE); - return CMD_WARNING; + peer = peer_lookup_by_conf_if (NULL, argv[1]); + if (!peer) + { + vty_out (vty, "Malformed address or name: %s%s", argv[1], VTY_NEWLINE); + return CMD_WARNING; + } + } + else + { + peer = peer_lookup (NULL, &su); + if (! peer) + return CMD_WARNING; } - - peer = peer_lookup (NULL, &su); - if (! peer) - return CMD_WARNING; if (strncmp (argv[0], "m", 1) == 0) { @@ -13006,19 +14037,23 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, return CMD_SUCCESS; } -ALIAS (show_bgp_view_neighbor_received_routes, +DEFUN (show_bgp_neighbor_received_routes, show_bgp_neighbor_received_routes_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X) received-routes", + "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes", SHOW_STR BGP_STR "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 received routes from neighbor\n") +{ + return peer_adj_routes_decode (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, 1, NULL); +} DEFUN (show_bgp_ipv4_safi_neighbor_received_prefix_filter, show_bgp_ipv4_safi_neighbor_received_prefix_filter_cmd, - "show bgp ipv4 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X) received prefix-filter", + "show bgp ipv4 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter", SHOW_STR BGP_STR IP_STR @@ -13066,7 +14101,7 @@ DEFUN (show_bgp_ipv4_safi_neighbor_received_prefix_filter, DEFUN (show_bgp_ipv6_safi_neighbor_received_prefix_filter, show_bgp_ipv6_safi_neighbor_received_prefix_filter_cmd, - "show bgp ipv6 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X) received prefix-filter", + "show bgp ipv6 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter", SHOW_STR BGP_STR IP_STR @@ -13114,13 +14149,14 @@ DEFUN (show_bgp_ipv6_safi_neighbor_received_prefix_filter, DEFUN (show_bgp_ipv6_neighbor_received_prefix_filter, show_bgp_ipv6_neighbor_received_prefix_filter_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter", + "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter", SHOW_STR BGP_STR "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 information received from a BGP neighbor\n" "Display the prefixlist filter\n") { @@ -13132,13 +14168,19 @@ DEFUN (show_bgp_ipv6_neighbor_received_prefix_filter, ret = str2sockunion (argv[0], &su); if (ret < 0) { - vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); - return CMD_WARNING; + peer = peer_lookup_by_conf_if (NULL, argv[0]); + if (!peer) + { + vty_out (vty, "Malformed address or name: %s%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } + } + else + { + peer = peer_lookup (NULL, &su); + if (! peer) + return CMD_WARNING; } - - peer = peer_lookup (NULL, &su); - if (! peer) - return CMD_WARNING; sprintf (name, "%s.%d.%d", peer->host, AFI_IP6, SAFI_UNICAST); count = prefix_bgp_show_prefix_list (NULL, AFI_IP6, name); @@ -13153,7 +14195,7 @@ DEFUN (show_bgp_ipv6_neighbor_received_prefix_filter, DEFUN (show_bgp_view_ipv6_neighbor_received_prefix_filter, show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd, - "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter", + "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter", SHOW_STR BGP_STR "BGP view\n" @@ -13162,6 +14204,7 @@ DEFUN (show_bgp_view_ipv6_neighbor_received_prefix_filter, "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 information received from a BGP neighbor\n" "Display the prefixlist filter\n") { @@ -13182,13 +14225,19 @@ DEFUN (show_bgp_view_ipv6_neighbor_received_prefix_filter, ret = str2sockunion (argv[1], &su); if (ret < 0) { - vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE); - return CMD_WARNING; + peer = peer_lookup_by_conf_if (bgp, argv[1]); + if (!peer) + { + vty_out (vty, "%% Malformed address or name: %s%s", argv[1], VTY_NEWLINE); + return CMD_WARNING; + } + } + else + { + peer = peer_lookup (bgp, &su); + if (! peer) + return CMD_WARNING; } - - peer = peer_lookup (bgp, &su); - if (! peer) - return CMD_WARNING; sprintf (name, "%s.%d.%d", peer->host, AFI_IP6, SAFI_UNICAST); count = prefix_bgp_show_prefix_list (NULL, AFI_IP6, name); @@ -13215,13 +14264,14 @@ bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi, } DEFUN (show_ip_bgp_neighbor_routes, show_ip_bgp_neighbor_routes_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X) routes", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes", SHOW_STR IP_STR BGP_STR "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") { struct peer *peer; @@ -13234,15 +14284,17 @@ DEFUN (show_ip_bgp_neighbor_routes, bgp_show_type_neighbor); } + DEFUN (show_ip_bgp_neighbor_flap, show_ip_bgp_neighbor_flap_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics", SHOW_STR IP_STR BGP_STR "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 flap statistics of the routes learned from neighbor\n") { struct peer *peer; @@ -13257,13 +14309,14 @@ DEFUN (show_ip_bgp_neighbor_flap, DEFUN (show_ip_bgp_neighbor_damp, show_ip_bgp_neighbor_damp_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes", SHOW_STR IP_STR BGP_STR "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") { struct peer *peer; @@ -13278,7 +14331,7 @@ DEFUN (show_ip_bgp_neighbor_damp, DEFUN (show_ip_bgp_ipv4_neighbor_routes, show_ip_bgp_ipv4_neighbor_routes_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) routes", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) routes", SHOW_STR IP_STR BGP_STR @@ -13288,6 +14341,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes, "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") { struct peer *peer; @@ -13306,14 +14360,14 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes, 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)", + "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD)", SHOW_STR IP_STR BGP_STR "BGP view\n" "View name\n" "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR) + NEIGHBOR_ADDR_STR3) { struct bgp_table *table; struct peer *peer; @@ -13348,16 +14402,16 @@ DEFUN (show_ip_bgp_view_rsclient, ALIAS (show_ip_bgp_view_rsclient, show_ip_bgp_rsclient_cmd, - "show ip bgp rsclient (A.B.C.D|X:X::X:X)", + "show ip bgp rsclient (A.B.C.D|X:X::X:X|WORD)", SHOW_STR IP_STR BGP_STR "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR) + NEIGHBOR_ADDR_STR3) 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)", + "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)", SHOW_STR BGP_STR "BGP view\n" @@ -13366,7 +14420,7 @@ DEFUN (show_bgp_view_ipv4_safi_rsclient, "Address Family modifier\n" "Address Family modifier\n" "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR) + NEIGHBOR_ADDR_STR3) { struct bgp_table *table; struct peer *peer; @@ -13405,25 +14459,25 @@ DEFUN (show_bgp_view_ipv4_safi_rsclient, 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)", + "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_STR) + 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) A.B.C.D", + "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_STR + NEIGHBOR_ADDR_STR3 "Network in the BGP routing table to display\n") { struct bgp *bgp; @@ -13474,22 +14528,22 @@ DEFUN (show_ip_bgp_view_rsclient_route, 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); + AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); } 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) A.B.C.D", + "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_STR + NEIGHBOR_ADDR_STR3 "Network in the BGP routing table to display\n") DEFUN (show_bgp_ipv4_safi_neighbor_flap, show_bgp_ipv4_safi_neighbor_flap_cmd, - "show bgp ipv4 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X) flap-statistics", + "show bgp ipv4 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics", SHOW_STR BGP_STR "Address Family Modifier\n" @@ -13519,7 +14573,7 @@ DEFUN (show_bgp_ipv4_safi_neighbor_flap, DEFUN (show_bgp_ipv6_safi_neighbor_flap, show_bgp_ipv6_safi_neighbor_flap_cmd, - "show bgp ipv6 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X) flap-statistics", + "show bgp ipv6 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics", SHOW_STR BGP_STR "Address Family Modifier\n" @@ -13549,7 +14603,7 @@ DEFUN (show_bgp_ipv6_safi_neighbor_flap, DEFUN (show_bgp_ipv4_safi_neighbor_damp, show_bgp_ipv4_safi_neighbor_damp_cmd, - "show bgp ipv4 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X) dampened-routes", + "show bgp ipv4 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes", SHOW_STR BGP_STR "Address Family Modifier\n" @@ -13579,7 +14633,7 @@ DEFUN (show_bgp_ipv4_safi_neighbor_damp, DEFUN (show_bgp_ipv6_safi_neighbor_damp, show_bgp_ipv6_safi_neighbor_damp_cmd, - "show bgp ipv6 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X) dampened-routes", + "show bgp ipv6 (encap|multicast|unicast|vpn) neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes", SHOW_STR BGP_STR "Address Family Modifier\n" @@ -13609,7 +14663,7 @@ DEFUN (show_bgp_ipv6_safi_neighbor_damp, DEFUN (show_bgp_ipv4_safi_neighbor_routes, show_bgp_ipv4_safi_neighbor_routes_cmd, - "show bgp ipv4 (multicast|unicast) neighbors (A.B.C.D|X:X::X:X) routes", + "show bgp ipv4 (multicast|unicast) neighbors (A.B.C.D|X:X::X:X|WORD) routes", SHOW_STR BGP_STR "Address family\n" @@ -13638,7 +14692,7 @@ DEFUN (show_bgp_ipv4_safi_neighbor_routes, DEFUN (show_bgp_ipv6_safi_neighbor_routes, show_bgp_ipv6_safi_neighbor_routes_cmd, - "show bgp ipv6 (multicast|unicast) neighbors (A.B.C.D|X:X::X:X) routes", + "show bgp ipv6 (multicast|unicast) neighbors (A.B.C.D|X:X::X:X|WORD) routes", SHOW_STR BGP_STR "Address family\n" @@ -13667,7 +14721,7 @@ DEFUN (show_bgp_ipv6_safi_neighbor_routes, 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) A.B.C.D", + "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" @@ -13676,7 +14730,7 @@ DEFUN (show_bgp_view_ipv4_safi_rsclient_route, "Address Family modifier\n" "Address Family modifier\n" "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR + NEIGHBOR_ADDR_STR3 "Network in the BGP routing table to display\n") { struct bgp *bgp; @@ -13731,25 +14785,25 @@ DEFUN (show_bgp_view_ipv4_safi_rsclient_route, return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP][safi], (argc == 4) ? argv[3] : argv[2], - AFI_IP, safi, NULL, 0); + AFI_IP, safi, NULL, 0, BGP_PATH_ALL); } 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) A.B.C.D", + "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_STR + NEIGHBOR_ADDR_STR3 "Network in the BGP routing table to display\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) A.B.C.D/M", + "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" @@ -13813,19 +14867,19 @@ DEFUN (show_bgp_view_ipv4_safi_rsclient_prefix, return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP][safi], (argc == 4) ? argv[3] : argv[2], - AFI_IP, safi, NULL, 1); + AFI_IP, safi, NULL, 1, BGP_PATH_ALL); } 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) A.B.C.D/M", + "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_STR + NEIGHBOR_ADDR_STR3 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { struct bgp *bgp; @@ -13876,34 +14930,34 @@ DEFUN (show_ip_bgp_view_rsclient_prefix, 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); + AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); } 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) A.B.C.D/M", + "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_STR + NEIGHBOR_ADDR_STR3 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") 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) A.B.C.D/M", + "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_STR + NEIGHBOR_ADDR_STR3 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") DEFUN (show_bgp_view_ipv6_neighbor_routes, show_bgp_view_ipv6_neighbor_routes_cmd, - "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) routes", + "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes", SHOW_STR BGP_STR "BGP view\n" @@ -13912,6 +14966,7 @@ DEFUN (show_bgp_view_ipv6_neighbor_routes, "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") { struct peer *peer; @@ -13930,7 +14985,7 @@ DEFUN (show_bgp_view_ipv6_neighbor_routes, 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) dampened-routes", + "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes", SHOW_STR BGP_STR "BGP view\n" @@ -13938,6 +14993,7 @@ DEFUN (show_bgp_view_neighbor_damp, "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") { struct peer *peer; @@ -13956,7 +15012,7 @@ DEFUN (show_bgp_view_neighbor_damp, DEFUN (show_bgp_view_ipv6_neighbor_damp, show_bgp_view_ipv6_neighbor_damp_cmd, - "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes", + "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes", SHOW_STR BGP_STR "BGP view\n" @@ -13965,6 +15021,7 @@ DEFUN (show_bgp_view_ipv6_neighbor_damp, "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") { struct peer *peer; @@ -13983,7 +15040,7 @@ DEFUN (show_bgp_view_ipv6_neighbor_damp, DEFUN (show_bgp_view_ipv6_neighbor_flap, show_bgp_view_ipv6_neighbor_flap_cmd, - "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics", + "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics", SHOW_STR BGP_STR "BGP view\n" @@ -13992,6 +15049,7 @@ DEFUN (show_bgp_view_ipv6_neighbor_flap, "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") { struct peer *peer; @@ -14010,7 +15068,7 @@ DEFUN (show_bgp_view_ipv6_neighbor_flap, DEFUN (show_bgp_view_neighbor_flap, show_bgp_view_neighbor_flap_cmd, - "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) flap-statistics", + "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics", SHOW_STR BGP_STR "BGP view\n" @@ -14018,6 +15076,7 @@ DEFUN (show_bgp_view_neighbor_flap, "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 flap statistics of the routes learned from neighbor\n") { struct peer *peer; @@ -14036,7 +15095,7 @@ DEFUN (show_bgp_view_neighbor_flap, ALIAS (show_bgp_view_neighbor_flap, show_bgp_neighbor_flap_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics", + "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics", SHOW_STR BGP_STR "Detailed information on TCP and BGP neighbor connections\n" @@ -14046,7 +15105,7 @@ ALIAS (show_bgp_view_neighbor_flap, ALIAS (show_bgp_view_neighbor_damp, show_bgp_neighbor_damp_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes", + "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes", SHOW_STR BGP_STR "Detailed information on TCP and BGP neighbor connections\n" @@ -14056,7 +15115,7 @@ ALIAS (show_bgp_view_neighbor_damp, 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) routes", + "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) routes", SHOW_STR BGP_STR "BGP view\n" @@ -14082,47 +15141,51 @@ DEFUN (show_bgp_view_neighbor_routes, ALIAS (show_bgp_view_neighbor_routes, show_bgp_neighbor_routes_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X) routes", + "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes", SHOW_STR BGP_STR "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") ALIAS (show_bgp_view_neighbor_routes, show_bgp_ipv6_neighbor_routes_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) routes", + "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes", SHOW_STR BGP_STR "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") /* old command */ ALIAS (show_bgp_view_neighbor_routes, ipv6_bgp_neighbor_routes_cmd, - "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) routes", + "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes", SHOW_STR IPV6_STR BGP_STR "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") /* old command */ DEFUN (ipv6_mbgp_neighbor_routes, ipv6_mbgp_neighbor_routes_cmd, - "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) routes", + "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) routes", SHOW_STR IPV6_STR MBGP_STR "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") { struct peer *peer; @@ -14137,29 +15200,31 @@ DEFUN (ipv6_mbgp_neighbor_routes, ALIAS (show_bgp_view_neighbor_flap, show_bgp_ipv6_neighbor_flap_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics", + "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics", SHOW_STR BGP_STR "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 flap statistics of the routes learned from neighbor\n") ALIAS (show_bgp_view_neighbor_damp, show_bgp_ipv6_neighbor_damp_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes", + "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes", SHOW_STR BGP_STR "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 the dampened routes received from neighbor\n") DEFUN (show_bgp_view_rsclient, show_bgp_view_rsclient_cmd, - "show bgp view WORD rsclient (A.B.C.D|X:X::X:X)", + "show bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD)", SHOW_STR BGP_STR "BGP view\n" @@ -14200,7 +15265,7 @@ DEFUN (show_bgp_view_rsclient, ALIAS (show_bgp_view_rsclient, show_bgp_rsclient_cmd, - "show bgp rsclient (A.B.C.D|X:X::X:X)", + "show bgp rsclient (A.B.C.D|X:X::X:X|WORD)", SHOW_STR BGP_STR "Information about Route Server Client\n" @@ -14208,7 +15273,7 @@ ALIAS (show_bgp_view_rsclient, DEFUN (show_bgp_view_ipv4_rsclient, show_bgp_view_ipv4_rsclient_cmd, - "show bgp view WORD ipv4 rsclient (A.B.C.D|X:X::X:X)", + "show bgp view WORD ipv4 rsclient (A.B.C.D|X:X::X:X|WORD)", SHOW_STR BGP_STR "BGP view\n" @@ -14249,7 +15314,7 @@ DEFUN (show_bgp_view_ipv4_rsclient, } DEFUN (show_bgp_view_ipv6_rsclient, show_bgp_view_ipv6_rsclient_cmd, - "show bgp view WORD ipv6 rsclient (A.B.C.D|X:X::X:X)", + "show bgp view WORD ipv6 rsclient (A.B.C.D|X:X::X:X|WORD)", SHOW_STR BGP_STR "BGP view\n" @@ -14291,25 +15356,25 @@ DEFUN (show_bgp_view_ipv6_rsclient, ALIAS (show_bgp_view_ipv4_rsclient, show_bgp_ipv4_rsclient_cmd, - "show bgp ipv4 rsclient (A.B.C.D|X:X::X:X)", + "show bgp ipv4 rsclient (A.B.C.D|X:X::X:X|WORD)", SHOW_STR BGP_STR "Address Family\n" "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR2) + NEIGHBOR_ADDR_STR3) ALIAS (show_bgp_view_ipv6_rsclient, show_bgp_ipv6_rsclient_cmd, - "show bgp ipv6 rsclient (A.B.C.D|X:X::X:X)", + "show bgp ipv6 rsclient (A.B.C.D|X:X::X:X|WORD)", SHOW_STR BGP_STR "Address Family\n" "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR2) + 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)", + "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)", SHOW_STR BGP_STR "BGP view\n" @@ -14318,7 +15383,7 @@ DEFUN (show_bgp_view_ipv6_safi_rsclient, "Address Family modifier\n" "Address Family modifier\n" "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR) + NEIGHBOR_ADDR_STR3) { struct bgp_table *table; struct peer *peer; @@ -14357,24 +15422,24 @@ DEFUN (show_bgp_view_ipv6_safi_rsclient, 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)", + "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_STR) + 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) X:X::X:X", + "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_STR + NEIGHBOR_ADDR_STR3 "Network in the BGP routing table to display\n") { struct bgp *bgp; @@ -14425,12 +15490,12 @@ DEFUN (show_bgp_view_rsclient_route, 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); + AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); } DEFUN (show_bgp_view_ipv6_rsclient_route, show_bgp_view_ipv6_rsclient_route_cmd, - "show bgp view WORD ipv6 rsclient (A.B.C.D|X:X::X:X) X:X::X:X", + "show bgp view WORD ipv6 rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X", SHOW_STR BGP_STR "BGP view\n" @@ -14488,21 +15553,21 @@ DEFUN (show_bgp_view_ipv6_rsclient_route, 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); + AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL); } ALIAS (show_bgp_view_ipv6_rsclient_route, show_bgp_rsclient_route_cmd, - "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X", + "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_STR + NEIGHBOR_ADDR_STR3 "Network in the BGP routing table to display\n") ALIAS (show_bgp_view_ipv6_rsclient_route, show_bgp_ipv6_rsclient_route_cmd, - "show bgp ipv6 rsclient (A.B.C.D|X:X::X:X) X:X::X:X", + "show bgp ipv6 rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X", SHOW_STR BGP_STR IP6_STR @@ -14512,7 +15577,7 @@ ALIAS (show_bgp_view_ipv6_rsclient_route, 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) X:X::X:X", + "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" @@ -14521,7 +15586,7 @@ DEFUN (show_bgp_view_ipv6_safi_rsclient_route, "Address Family modifier\n" "Address Family modifier\n" "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR + NEIGHBOR_ADDR_STR3 "Network in the BGP routing table to display\n") { struct bgp *bgp; @@ -14576,31 +15641,31 @@ DEFUN (show_bgp_view_ipv6_safi_rsclient_route, return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP6][safi], (argc == 4) ? argv[3] : argv[2], - AFI_IP6, safi, NULL, 0); + AFI_IP6, safi, NULL, 0, BGP_PATH_ALL); } 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) X:X::X:X", + "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_STR + 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) X:X::X:X/M", + "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_STR + NEIGHBOR_ADDR_STR3 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") { struct bgp *bgp; @@ -14651,12 +15716,12 @@ DEFUN (show_bgp_view_rsclient_prefix, 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); + AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); } DEFUN (show_bgp_view_ipv6_rsclient_prefix, show_bgp_view_ipv6_rsclient_prefix_cmd, - "show bgp view WORD ipv6 rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M", + "show bgp view WORD ipv6 rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M", SHOW_STR BGP_STR "BGP view\n" @@ -14714,21 +15779,21 @@ DEFUN (show_bgp_view_ipv6_rsclient_prefix, 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); + AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL); } ALIAS (show_bgp_view_ipv6_rsclient_prefix, show_bgp_rsclient_prefix_cmd, - "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M", + "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_STR + NEIGHBOR_ADDR_STR3 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") ALIAS (show_bgp_view_ipv6_rsclient_prefix, show_bgp_ipv6_rsclient_prefix_cmd, - "show bgp ipv6 rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M", + "show bgp ipv6 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" @@ -14737,7 +15802,7 @@ ALIAS (show_bgp_view_ipv6_rsclient_prefix, 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) X:X::X:X/M", + "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" @@ -14746,7 +15811,7 @@ DEFUN (show_bgp_view_ipv6_safi_rsclient_prefix, "Address Family modifier\n" "Address Family modifier\n" "Information about Route Server Client\n" - NEIGHBOR_ADDR_STR + NEIGHBOR_ADDR_STR3 "IP prefix <network>/<length>, e.g., 3ffe::/16\n") { struct bgp *bgp; @@ -14801,19 +15866,19 @@ DEFUN (show_bgp_view_ipv6_safi_rsclient_prefix, return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP6][safi], (argc == 4) ? argv[3] : argv[2], - AFI_IP6, safi, NULL, 1); + AFI_IP6, safi, NULL, 1, BGP_PATH_ALL); } 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) X:X::X:X/M", + "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_STR + NEIGHBOR_ADDR_STR3 "IP prefix <network>/<length>, e.g., 3ffe::/16\n") struct bgp_table *bgp_distance_table; @@ -15697,6 +16762,7 @@ bgp_route_init (void) bgp_distance_table = bgp_table_init (AFI_IP, SAFI_UNICAST); /* IPv4 BGP commands. */ + install_element (BGP_NODE, &bgp_table_map_cmd); install_element (BGP_NODE, &bgp_network_cmd); install_element (BGP_NODE, &bgp_network_mask_cmd); install_element (BGP_NODE, &bgp_network_mask_natural_cmd); @@ -15706,6 +16772,7 @@ bgp_route_init (void) install_element (BGP_NODE, &bgp_network_backdoor_cmd); install_element (BGP_NODE, &bgp_network_mask_backdoor_cmd); install_element (BGP_NODE, &bgp_network_mask_natural_backdoor_cmd); + install_element (BGP_NODE, &no_bgp_table_map_cmd); install_element (BGP_NODE, &no_bgp_network_cmd); install_element (BGP_NODE, &no_bgp_network_mask_cmd); install_element (BGP_NODE, &no_bgp_network_mask_natural_cmd); @@ -15867,9 +16934,13 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_bgp_ipv4_safi_prefix_longer_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_safi_prefix_longer_cmd); install_element (VIEW_NODE, &show_bgp_ipv4_safi_neighbor_advertised_route_cmd); + install_element (VIEW_NODE, &show_bgp_ipv4_safi_neighbor_advertised_route_rmap_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_safi_neighbor_advertised_route_cmd); + install_element (VIEW_NODE, &show_bgp_ipv6_safi_neighbor_advertised_route_rmap_cmd); install_element (VIEW_NODE, &show_bgp_ipv4_safi_neighbor_received_routes_cmd); + install_element (VIEW_NODE, &show_bgp_ipv4_safi_neighbor_received_routes_rmap_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_safi_neighbor_received_routes_cmd); + install_element (VIEW_NODE, &show_bgp_ipv6_safi_neighbor_received_routes_rmap_cmd); install_element (VIEW_NODE, &show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv4_safi_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_safi_neighbor_routes_cmd); @@ -16026,9 +17097,13 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_bgp_ipv4_safi_prefix_longer_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_safi_prefix_longer_cmd); install_element (ENABLE_NODE, &show_bgp_ipv4_safi_neighbor_advertised_route_cmd); + install_element (ENABLE_NODE, &show_bgp_ipv4_safi_neighbor_advertised_route_rmap_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_safi_neighbor_advertised_route_cmd); + install_element (ENABLE_NODE, &show_bgp_ipv6_safi_neighbor_advertised_route_rmap_cmd); install_element (ENABLE_NODE, &show_bgp_ipv4_safi_neighbor_received_routes_cmd); + install_element (ENABLE_NODE, &show_bgp_ipv4_safi_neighbor_received_routes_rmap_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_safi_neighbor_received_routes_cmd); + install_element (ENABLE_NODE, &show_bgp_ipv6_safi_neighbor_received_routes_rmap_cmd); install_element (ENABLE_NODE, &show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd); install_element (ENABLE_NODE, &show_bgp_ipv4_safi_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_safi_neighbor_routes_cmd); @@ -16096,8 +17171,10 @@ bgp_route_init (void) /* New config IPv6 BGP commands. */ install_element (BGP_IPV6_NODE, &ipv6_bgp_network_cmd); install_element (BGP_IPV6_NODE, &ipv6_bgp_network_route_map_cmd); + install_element (BGP_IPV6_NODE, &bgp_table_map_cmd); install_element (BGP_IPV6_NODE, &no_ipv6_bgp_network_cmd); install_element (BGP_IPV6_NODE, &no_ipv6_bgp_network_route_map_cmd); + install_element (BGP_IPV6_NODE, &no_bgp_table_map_cmd); install_element (BGP_IPV6_NODE, &ipv6_aggregate_address_cmd); install_element (BGP_IPV6_NODE, &ipv6_aggregate_address_summary_only_cmd); @@ -16136,6 +17213,8 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_bgp_community_list_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_prefix_longer_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_advertised_route_cmd); + install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_advertised_route_rmap_cmd); + install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_received_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_received_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd); @@ -16152,7 +17231,9 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_bgp_view_ipv6_route_cmd); install_element (VIEW_NODE, &show_bgp_view_ipv6_prefix_cmd); install_element (VIEW_NODE, &show_bgp_view_ipv6_neighbor_advertised_route_cmd); + install_element (VIEW_NODE, &show_bgp_view_ipv6_neighbor_advertised_route_rmap_cmd); install_element (VIEW_NODE, &show_bgp_view_ipv6_neighbor_received_routes_cmd); + install_element (VIEW_NODE, &show_bgp_view_ipv6_neighbor_received_routes_rmap_cmd); install_element (VIEW_NODE, &show_bgp_view_ipv6_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_bgp_view_ipv6_neighbor_flap_cmd); @@ -16213,7 +17294,9 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_bgp_ipv6_safi_community_list_exact_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_prefix_longer_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_advertised_route_cmd); + install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_advertised_route_rmap_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_received_routes_cmd); + install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_received_routes_rmap_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_flap_cmd); @@ -16229,7 +17312,9 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_bgp_view_ipv6_route_cmd); install_element (ENABLE_NODE, &show_bgp_view_ipv6_prefix_cmd); install_element (ENABLE_NODE, &show_bgp_view_ipv6_neighbor_advertised_route_cmd); + install_element (ENABLE_NODE, &show_bgp_view_ipv6_neighbor_advertised_route_rmap_cmd); install_element (ENABLE_NODE, &show_bgp_view_ipv6_neighbor_received_routes_cmd); + install_element (ENABLE_NODE, &show_bgp_view_ipv6_neighbor_received_routes_rmap_cmd); install_element (ENABLE_NODE, &show_bgp_view_ipv6_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_bgp_view_ipv6_neighbor_flap_cmd); @@ -16264,6 +17349,7 @@ bgp_route_init (void) install_element (BGP_IPV4_NODE, &bgp_damp_set3_cmd); install_element (BGP_IPV4_NODE, &bgp_damp_unset_cmd); install_element (BGP_IPV4_NODE, &bgp_damp_unset2_cmd); + install_element (BGP_IPV4_NODE, &bgp_table_map_cmd); /* Deprecated AS-Pathlimit commands */ install_element (BGP_NODE, &bgp_network_ttl_cmd); @@ -16293,13 +17379,15 @@ bgp_route_init (void) install_element (BGP_IPV4_NODE, &no_bgp_network_backdoor_ttl_cmd); install_element (BGP_IPV4_NODE, &no_bgp_network_mask_backdoor_ttl_cmd); install_element (BGP_IPV4_NODE, &no_bgp_network_mask_natural_backdoor_ttl_cmd); - + install_element (BGP_IPV4_NODE, &no_bgp_table_map_cmd); + install_element (BGP_IPV4M_NODE, &bgp_network_ttl_cmd); install_element (BGP_IPV4M_NODE, &bgp_network_mask_ttl_cmd); install_element (BGP_IPV4M_NODE, &bgp_network_mask_natural_ttl_cmd); install_element (BGP_IPV4M_NODE, &bgp_network_backdoor_ttl_cmd); install_element (BGP_IPV4M_NODE, &bgp_network_mask_backdoor_ttl_cmd); install_element (BGP_IPV4M_NODE, &bgp_network_mask_natural_backdoor_ttl_cmd); + install_element (BGP_IPV4M_NODE, &bgp_table_map_cmd); install_element (BGP_IPV4M_NODE, &no_bgp_network_ttl_cmd); install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_ttl_cmd); @@ -16307,6 +17395,7 @@ bgp_route_init (void) install_element (BGP_IPV4M_NODE, &no_bgp_network_backdoor_ttl_cmd); install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_backdoor_ttl_cmd); install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_natural_backdoor_ttl_cmd); + install_element (BGP_IPV4M_NODE, &no_bgp_table_map_cmd); install_element (BGP_IPV6_NODE, &ipv6_bgp_network_ttl_cmd); install_element (BGP_IPV6_NODE, &no_ipv6_bgp_network_ttl_cmd); @@ -16315,11 +17404,16 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_cmd); install_element (VIEW_NODE, &show_ip_bgp_route_cmd); + install_element (VIEW_NODE, &show_ip_bgp_route_pathtype_cmd); + install_element (VIEW_NODE, &show_bgp_ipv4_safi_route_pathtype_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_prefix_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_cmd); + install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_pathtype_cmd); + install_element (VIEW_NODE, &show_bgp_ipv4_safi_prefix_pathtype_cmd); + install_element (VIEW_NODE, &show_ip_bgp_prefix_pathtype_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_prefix_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_prefix_cmd); install_element (VIEW_NODE, &show_ip_bgp_view_cmd); @@ -16359,10 +17453,14 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_ipv4_community_list_exact_cmd); install_element (VIEW_NODE, &show_ip_bgp_prefix_longer_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_longer_cmd); + install_element (VIEW_NODE, &show_ip_bgp_ipv4_safi_neighbor_advertised_route_cmd); + install_element (VIEW_NODE, &show_ip_bgp_ipv4_safi_neighbor_advertised_route_rmap_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_advertised_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd); + install_element (VIEW_NODE, &show_ip_bgp_neighbor_advertised_route_rmap_cmd); + install_element (VIEW_NODE, &show_ip_bgp_ipv4_safi_neighbor_received_routes_cmd); + install_element (VIEW_NODE, &show_ip_bgp_ipv4_safi_neighbor_received_routes_rmap_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_routes_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_routes_cmd); + install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_routes_rmap_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); @@ -16392,15 +17490,22 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_rsclient_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_rsclient_prefix_cmd); install_element (VIEW_NODE, &show_ip_bgp_view_neighbor_advertised_route_cmd); + install_element (VIEW_NODE, &show_ip_bgp_view_neighbor_advertised_route_rmap_cmd); install_element (VIEW_NODE, &show_ip_bgp_view_neighbor_received_routes_cmd); + install_element (VIEW_NODE, &show_ip_bgp_view_neighbor_received_routes_rmap_cmd); install_element (VIEW_NODE, &show_ip_bgp_view_rsclient_cmd); install_element (VIEW_NODE, &show_ip_bgp_view_rsclient_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_view_rsclient_prefix_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_route_cmd); + install_element (RESTRICTED_NODE, &show_ip_bgp_route_pathtype_cmd); + install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_route_pathtype_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_route_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_route_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_prefix_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_prefix_cmd); + install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_prefix_pathtype_cmd); + install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_prefix_pathtype_cmd); + install_element (RESTRICTED_NODE, &show_ip_bgp_prefix_pathtype_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_prefix_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_prefix_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_view_route_cmd); @@ -16428,11 +17533,16 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_cmd); install_element (ENABLE_NODE, &show_ip_bgp_route_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_route_pathtype_cmd); + install_element (ENABLE_NODE, &show_bgp_ipv4_safi_route_pathtype_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_prefix_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_prefix_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_ipv4_prefix_pathtype_cmd); + install_element (ENABLE_NODE, &show_bgp_ipv4_safi_prefix_pathtype_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_prefix_pathtype_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_prefix_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_prefix_cmd); install_element (ENABLE_NODE, &show_ip_bgp_view_cmd); @@ -16473,10 +17583,13 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_prefix_longer_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_prefix_longer_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_advertised_route_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_neighbor_advertised_route_rmap_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_ipv4_safi_neighbor_advertised_route_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_ipv4_safi_neighbor_advertised_route_rmap_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_ipv4_safi_neighbor_received_routes_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_ipv4_safi_neighbor_received_routes_rmap_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_neighbor_routes_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_routes_rmap_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); @@ -16506,17 +17619,26 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_rsclient_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_rsclient_prefix_cmd); install_element (ENABLE_NODE, &show_ip_bgp_view_neighbor_advertised_route_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_view_neighbor_advertised_route_rmap_cmd); install_element (ENABLE_NODE, &show_ip_bgp_view_neighbor_received_routes_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_view_neighbor_received_routes_rmap_cmd); install_element (ENABLE_NODE, &show_ip_bgp_view_rsclient_cmd); install_element (ENABLE_NODE, &show_ip_bgp_view_rsclient_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_view_rsclient_prefix_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_prefix_counts_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_prefix_counts_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd); + install_element (VIEW_NODE, &show_bgp_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_cmd); install_element (VIEW_NODE, &show_bgp_route_cmd); install_element (VIEW_NODE, &show_bgp_prefix_cmd); + install_element (VIEW_NODE, &show_bgp_route_pathtype_cmd); + install_element (VIEW_NODE, &show_bgp_ipv6_route_pathtype_cmd); + install_element (VIEW_NODE, &show_bgp_ipv6_safi_route_pathtype_cmd); + install_element (VIEW_NODE, &show_bgp_prefix_pathtype_cmd); + install_element (VIEW_NODE, &show_bgp_ipv6_prefix_pathtype_cmd); + install_element (VIEW_NODE, &show_bgp_ipv6_safi_prefix_pathtype_cmd); install_element (VIEW_NODE, &show_bgp_regexp_cmd); install_element (VIEW_NODE, &show_bgp_prefix_list_cmd); install_element (VIEW_NODE, &show_bgp_filter_list_cmd); @@ -16536,6 +17658,7 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_bgp_ipv6_safi_community_list_exact_cmd); install_element (VIEW_NODE, &show_bgp_prefix_longer_cmd); install_element (VIEW_NODE, &show_bgp_neighbor_advertised_route_cmd); + install_element (VIEW_NODE, &show_bgp_neighbor_advertised_route_rmap_cmd); install_element (VIEW_NODE, &show_bgp_neighbor_received_routes_cmd); install_element (VIEW_NODE, &show_bgp_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_neighbor_received_prefix_filter_cmd); @@ -16546,7 +17669,9 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_bgp_view_route_cmd); install_element (VIEW_NODE, &show_bgp_view_prefix_cmd); install_element (VIEW_NODE, &show_bgp_view_neighbor_advertised_route_cmd); + install_element (VIEW_NODE, &show_bgp_view_neighbor_advertised_route_rmap_cmd); install_element (VIEW_NODE, &show_bgp_view_neighbor_received_routes_cmd); + install_element (VIEW_NODE, &show_bgp_view_neighbor_received_routes_rmap_cmd); install_element (VIEW_NODE, &show_bgp_view_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_view_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_bgp_view_neighbor_flap_cmd); @@ -16554,6 +17679,12 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_bgp_view_rsclient_cmd); install_element (RESTRICTED_NODE, &show_bgp_route_cmd); install_element (RESTRICTED_NODE, &show_bgp_prefix_cmd); + install_element (RESTRICTED_NODE, &show_bgp_route_pathtype_cmd); + install_element (RESTRICTED_NODE, &show_bgp_ipv6_route_pathtype_cmd); + install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_route_pathtype_cmd); + install_element (RESTRICTED_NODE, &show_bgp_prefix_pathtype_cmd); + install_element (RESTRICTED_NODE, &show_bgp_ipv6_prefix_pathtype_cmd); + install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_prefix_pathtype_cmd); install_element (RESTRICTED_NODE, &show_bgp_community_cmd); install_element (RESTRICTED_NODE, &show_bgp_community2_cmd); install_element (RESTRICTED_NODE, &show_bgp_community3_cmd); @@ -16569,6 +17700,12 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_bgp_ipv6_cmd); install_element (ENABLE_NODE, &show_bgp_route_cmd); install_element (ENABLE_NODE, &show_bgp_prefix_cmd); + install_element (ENABLE_NODE, &show_bgp_route_pathtype_cmd); + install_element (ENABLE_NODE, &show_bgp_ipv6_route_pathtype_cmd); + install_element (ENABLE_NODE, &show_bgp_ipv6_safi_route_pathtype_cmd); + install_element (ENABLE_NODE, &show_bgp_prefix_pathtype_cmd); + install_element (ENABLE_NODE, &show_bgp_ipv6_prefix_pathtype_cmd); + install_element (ENABLE_NODE, &show_bgp_ipv6_safi_prefix_pathtype_cmd); install_element (ENABLE_NODE, &show_bgp_regexp_cmd); install_element (ENABLE_NODE, &show_bgp_prefix_list_cmd); install_element (ENABLE_NODE, &show_bgp_filter_list_cmd); @@ -16587,6 +17724,7 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_bgp_community_list_exact_cmd); install_element (ENABLE_NODE, &show_bgp_prefix_longer_cmd); install_element (ENABLE_NODE, &show_bgp_neighbor_advertised_route_cmd); + install_element (ENABLE_NODE, &show_bgp_neighbor_advertised_route_rmap_cmd); install_element (ENABLE_NODE, &show_bgp_neighbor_received_routes_cmd); install_element (ENABLE_NODE, &show_bgp_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_bgp_neighbor_received_prefix_filter_cmd); @@ -16597,6 +17735,8 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_bgp_view_route_cmd); install_element (ENABLE_NODE, &show_bgp_view_prefix_cmd); install_element (ENABLE_NODE, &show_bgp_view_neighbor_advertised_route_cmd); + install_element (ENABLE_NODE, &show_bgp_view_neighbor_advertised_route_rmap_cmd); + install_element (ENABLE_NODE, &show_bgp_view_neighbor_received_routes_cmd); install_element (ENABLE_NODE, &show_bgp_view_neighbor_received_routes_cmd); install_element (ENABLE_NODE, &show_bgp_view_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_bgp_view_neighbor_received_prefix_filter_cmd); @@ -16677,14 +17817,20 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ipv6_mbgp_community_list_cmd); install_element (ENABLE_NODE, &show_ipv6_mbgp_community_list_exact_cmd); install_element (ENABLE_NODE, &show_ipv6_mbgp_prefix_longer_cmd); - install_element (VIEW_NODE, &ipv6_bgp_neighbor_advertised_route_cmd); - install_element (ENABLE_NODE, &ipv6_bgp_neighbor_advertised_route_cmd); + install_element (VIEW_NODE, &show_ipv6_bgp_neighbor_advertised_route_cmd); + install_element (ENABLE_NODE, &show_ipv6_bgp_neighbor_advertised_route_cmd); + install_element (VIEW_NODE, &show_ipv6_bgp_neighbor_advertised_route_rmap_cmd); + install_element (ENABLE_NODE, &show_ipv6_bgp_neighbor_advertised_route_rmap_cmd); install_element (VIEW_NODE, &ipv6_mbgp_neighbor_advertised_route_cmd); install_element (ENABLE_NODE, &ipv6_mbgp_neighbor_advertised_route_cmd); - install_element (VIEW_NODE, &ipv6_bgp_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &ipv6_bgp_neighbor_received_routes_cmd); + install_element (VIEW_NODE, &ipv6_mbgp_neighbor_advertised_route_rmap_cmd); + install_element (ENABLE_NODE, &ipv6_mbgp_neighbor_advertised_route_rmap_cmd); + install_element (VIEW_NODE, &show_ipv6_bgp_neighbor_received_routes_cmd); + install_element (ENABLE_NODE, &show_ipv6_bgp_neighbor_received_routes_cmd); install_element (VIEW_NODE, &ipv6_mbgp_neighbor_received_routes_cmd); install_element (ENABLE_NODE, &ipv6_mbgp_neighbor_received_routes_cmd); + install_element (VIEW_NODE, &ipv6_mbgp_neighbor_received_routes_rmap_cmd); + install_element (ENABLE_NODE, &ipv6_mbgp_neighbor_received_routes_rmap_cmd); install_element (VIEW_NODE, &ipv6_bgp_neighbor_routes_cmd); install_element (ENABLE_NODE, &ipv6_bgp_neighbor_routes_cmd); install_element (VIEW_NODE, &ipv6_mbgp_neighbor_routes_cmd); |