1 /* BGP routing information
2 Copyright (C) 1996, 97, 98, 99 Kunihiro Ishiguro
4 This file is part of GNU Zebra.
6 GNU Zebra is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 GNU Zebra is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Zebra; see the file COPYING. If not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
33 #include "sockunion.h"
36 #include "workqueue.h"
38 #include "bgpd/bgpd.h"
39 #include "bgpd/bgp_table.h"
40 #include "bgpd/bgp_route.h"
41 #include "bgpd/bgp_attr.h"
42 #include "bgpd/bgp_debug.h"
43 #include "bgpd/bgp_aspath.h"
44 #include "bgpd/bgp_regex.h"
45 #include "bgpd/bgp_community.h"
46 #include "bgpd/bgp_ecommunity.h"
47 #include "bgpd/bgp_clist.h"
48 #include "bgpd/bgp_packet.h"
49 #include "bgpd/bgp_filter.h"
50 #include "bgpd/bgp_fsm.h"
51 #include "bgpd/bgp_mplsvpn.h"
52 #include "bgpd/bgp_nexthop.h"
53 #include "bgpd/bgp_damp.h"
54 #include "bgpd/bgp_advertise.h"
55 #include "bgpd/bgp_zebra.h"
56 #include "bgpd/bgp_vty.h"
57 #include "bgpd/bgp_mpath.h"
58 #include "bgpd/bgp_nht.h"
60 /* Extern from bgp_dump.c */
61 extern const char *bgp_origin_str
[];
62 extern const char *bgp_origin_long_str
[];
65 static struct bgp_node
*
66 bgp_afi_node_get (struct bgp_table
*table
, afi_t afi
, safi_t safi
, struct prefix
*p
,
67 struct prefix_rd
*prd
)
70 struct bgp_node
*prn
= NULL
;
76 if (safi
== SAFI_MPLS_VPN
)
78 prn
= bgp_node_get (table
, (struct prefix
*) prd
);
80 if (prn
->info
== NULL
)
81 prn
->info
= bgp_table_init (afi
, safi
);
83 bgp_unlock_node (prn
);
87 rn
= bgp_node_get (table
, p
);
89 if (safi
== SAFI_MPLS_VPN
)
95 /* Allocate bgp_info_extra */
96 static struct bgp_info_extra
*
97 bgp_info_extra_new (void)
99 struct bgp_info_extra
*new;
100 new = XCALLOC (MTYPE_BGP_ROUTE_EXTRA
, sizeof (struct bgp_info_extra
));
105 bgp_info_extra_free (struct bgp_info_extra
**extra
)
109 if ((*extra
)->damp_info
)
110 bgp_damp_info_free ((*extra
)->damp_info
, 0);
112 (*extra
)->damp_info
= NULL
;
114 XFREE (MTYPE_BGP_ROUTE_EXTRA
, *extra
);
120 /* Get bgp_info extra information for the given bgp_info, lazy allocated
123 struct bgp_info_extra
*
124 bgp_info_extra_get (struct bgp_info
*ri
)
127 ri
->extra
= bgp_info_extra_new();
131 /* Free bgp route information. */
133 bgp_info_free (struct bgp_info
*binfo
)
136 bgp_attr_unintern (&binfo
->attr
);
138 bgp_unlink_nexthop(binfo
);
139 bgp_info_extra_free (&binfo
->extra
);
140 bgp_info_mpath_free (&binfo
->mpath
);
142 peer_unlock (binfo
->peer
); /* bgp_info peer reference */
144 XFREE (MTYPE_BGP_ROUTE
, binfo
);
148 bgp_info_lock (struct bgp_info
*binfo
)
155 bgp_info_unlock (struct bgp_info
*binfo
)
157 assert (binfo
&& binfo
->lock
> 0);
160 if (binfo
->lock
== 0)
163 zlog_debug ("%s: unlocked and freeing", __func__
);
164 zlog_backtrace (LOG_DEBUG
);
166 bgp_info_free (binfo
);
171 if (binfo
->lock
== 1)
173 zlog_debug ("%s: unlocked to 1", __func__
);
174 zlog_backtrace (LOG_DEBUG
);
182 bgp_info_add (struct bgp_node
*rn
, struct bgp_info
*ri
)
184 struct bgp_info
*top
;
196 peer_lock (ri
->peer
); /* bgp_info peer reference */
199 /* Do the actual removal of info from RIB, for use by bgp_process
200 completion callback *only* */
202 bgp_info_reap (struct bgp_node
*rn
, struct bgp_info
*ri
)
205 ri
->next
->prev
= ri
->prev
;
207 ri
->prev
->next
= ri
->next
;
211 bgp_info_mpath_dequeue (ri
);
212 bgp_info_unlock (ri
);
213 bgp_unlock_node (rn
);
217 bgp_info_delete (struct bgp_node
*rn
, struct bgp_info
*ri
)
219 bgp_info_set_flag (rn
, ri
, BGP_INFO_REMOVED
);
220 /* set of previous already took care of pcount */
221 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
224 /* undo the effects of a previous call to bgp_info_delete; typically
225 called when a route is deleted and then quickly re-added before the
226 deletion has been processed */
228 bgp_info_restore (struct bgp_node
*rn
, struct bgp_info
*ri
)
230 bgp_info_unset_flag (rn
, ri
, BGP_INFO_REMOVED
);
231 /* unset of previous already took care of pcount */
232 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
235 /* Adjust pcount as required */
237 bgp_pcount_adjust (struct bgp_node
*rn
, struct bgp_info
*ri
)
239 struct bgp_table
*table
;
241 assert (rn
&& bgp_node_table (rn
));
242 assert (ri
&& ri
->peer
&& ri
->peer
->bgp
);
244 table
= bgp_node_table (rn
);
246 /* Ignore 'pcount' for RS-client tables */
247 if (table
->type
!= BGP_TABLE_MAIN
248 || ri
->peer
== ri
->peer
->bgp
->peer_self
)
251 if (!BGP_INFO_COUNTABLE (ri
)
252 && CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
255 UNSET_FLAG (ri
->flags
, BGP_INFO_COUNTED
);
257 /* slight hack, but more robust against errors. */
258 if (ri
->peer
->pcount
[table
->afi
][table
->safi
])
259 ri
->peer
->pcount
[table
->afi
][table
->safi
]--;
262 zlog_warn ("%s: Asked to decrement 0 prefix count for peer %s",
263 __func__
, ri
->peer
->host
);
264 zlog_backtrace (LOG_WARNING
);
265 zlog_warn ("%s: Please report to Quagga bugzilla", __func__
);
268 else if (BGP_INFO_COUNTABLE (ri
)
269 && !CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
271 SET_FLAG (ri
->flags
, BGP_INFO_COUNTED
);
272 ri
->peer
->pcount
[table
->afi
][table
->safi
]++;
277 /* Set/unset bgp_info flags, adjusting any other state as needed.
278 * This is here primarily to keep prefix-count in check.
281 bgp_info_set_flag (struct bgp_node
*rn
, struct bgp_info
*ri
, u_int32_t flag
)
283 SET_FLAG (ri
->flags
, flag
);
285 /* early bath if we know it's not a flag that changes countability state */
286 if (!CHECK_FLAG (flag
, BGP_INFO_VALID
|BGP_INFO_HISTORY
|BGP_INFO_REMOVED
))
289 bgp_pcount_adjust (rn
, ri
);
293 bgp_info_unset_flag (struct bgp_node
*rn
, struct bgp_info
*ri
, u_int32_t flag
)
295 UNSET_FLAG (ri
->flags
, flag
);
297 /* early bath if we know it's not a flag that changes countability state */
298 if (!CHECK_FLAG (flag
, BGP_INFO_VALID
|BGP_INFO_HISTORY
|BGP_INFO_REMOVED
))
301 bgp_pcount_adjust (rn
, ri
);
304 /* Get MED value. If MED value is missing and "bgp bestpath
305 missing-as-worst" is specified, treat it as the worst value. */
307 bgp_med_value (struct attr
*attr
, struct bgp
*bgp
)
309 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
313 if (bgp_flag_check (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
))
320 /* Compare two bgp route entity. br is preferable then return 1. */
322 bgp_info_cmp (struct bgp
*bgp
, struct bgp_info
*new, struct bgp_info
*exist
,
323 int *paths_eq
, struct bgp_maxpaths_cfg
*mpath_cfg
)
325 struct attr
*newattr
, *existattr
;
326 struct attr_extra
*newattre
, *existattre
;
327 bgp_peer_sort_t new_sort
;
328 bgp_peer_sort_t exist_sort
;
330 u_int32_t exist_pref
;
333 u_int32_t new_weight
;
334 u_int32_t exist_weight
;
335 uint32_t newm
, existm
;
336 struct in_addr new_id
;
337 struct in_addr exist_id
;
340 int internal_as_route
;
353 existattr
= exist
->attr
;
354 newattre
= newattr
->extra
;
355 existattre
= existattr
->extra
;
357 /* 1. Weight check. */
358 new_weight
= exist_weight
= 0;
361 new_weight
= newattre
->weight
;
363 exist_weight
= existattre
->weight
;
365 if (new_weight
> exist_weight
)
367 if (new_weight
< exist_weight
)
370 /* 2. Local preference check. */
371 new_pref
= exist_pref
= bgp
->default_local_pref
;
373 if (newattr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
374 new_pref
= newattr
->local_pref
;
375 if (existattr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
376 exist_pref
= existattr
->local_pref
;
378 if (new_pref
> exist_pref
)
380 if (new_pref
< exist_pref
)
383 /* 3. Local route check. We prefer:
385 * - BGP_ROUTE_AGGREGATE
386 * - BGP_ROUTE_REDISTRIBUTE
388 if (! (new->sub_type
== BGP_ROUTE_NORMAL
))
390 if (! (exist
->sub_type
== BGP_ROUTE_NORMAL
))
393 /* 4. AS path length check. */
394 if (! bgp_flag_check (bgp
, BGP_FLAG_ASPATH_IGNORE
))
396 int exist_hops
= aspath_count_hops (existattr
->aspath
);
397 int exist_confeds
= aspath_count_confeds (existattr
->aspath
);
399 if (bgp_flag_check (bgp
, BGP_FLAG_ASPATH_CONFED
))
403 aspath_hops
= aspath_count_hops (newattr
->aspath
);
404 aspath_hops
+= aspath_count_confeds (newattr
->aspath
);
406 if ( aspath_hops
< (exist_hops
+ exist_confeds
))
408 if ( aspath_hops
> (exist_hops
+ exist_confeds
))
413 int newhops
= aspath_count_hops (newattr
->aspath
);
415 if (newhops
< exist_hops
)
417 if (newhops
> exist_hops
)
422 /* 5. Origin check. */
423 if (newattr
->origin
< existattr
->origin
)
425 if (newattr
->origin
> existattr
->origin
)
429 internal_as_route
= (aspath_count_hops (newattr
->aspath
) == 0
430 && aspath_count_hops (existattr
->aspath
) == 0);
431 confed_as_route
= (aspath_count_confeds (newattr
->aspath
) > 0
432 && aspath_count_confeds (existattr
->aspath
) > 0
433 && aspath_count_hops (newattr
->aspath
) == 0
434 && aspath_count_hops (existattr
->aspath
) == 0);
436 if (bgp_flag_check (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
)
437 || (bgp_flag_check (bgp
, BGP_FLAG_MED_CONFED
)
439 || aspath_cmp_left (newattr
->aspath
, existattr
->aspath
)
440 || aspath_cmp_left_confed (newattr
->aspath
, existattr
->aspath
)
441 || internal_as_route
)
443 new_med
= bgp_med_value (new->attr
, bgp
);
444 exist_med
= bgp_med_value (exist
->attr
, bgp
);
446 if (new_med
< exist_med
)
448 if (new_med
> exist_med
)
452 /* 7. Peer type check. */
453 new_sort
= new->peer
->sort
;
454 exist_sort
= exist
->peer
->sort
;
456 if (new_sort
== BGP_PEER_EBGP
457 && (exist_sort
== BGP_PEER_IBGP
|| exist_sort
== BGP_PEER_CONFED
))
459 if (exist_sort
== BGP_PEER_EBGP
460 && (new_sort
== BGP_PEER_IBGP
|| new_sort
== BGP_PEER_CONFED
))
463 /* 8. IGP metric check. */
467 newm
= new->extra
->igpmetric
;
469 existm
= exist
->extra
->igpmetric
;
476 /* 8.1. Same IGP metric. Compare the cluster list length as
477 representative of IGP hops metric. Rewrite the metric value
478 pair (newm, existm) with the cluster list length. Prefer the
479 path with smaller cluster list length. */
482 if (peer_sort (new->peer
) == BGP_PEER_IBGP
483 && peer_sort (exist
->peer
) == BGP_PEER_IBGP
484 && CHECK_FLAG (mpath_cfg
->ibgp_flags
,
485 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
))
487 newm
= BGP_CLUSTER_LIST_LENGTH(new->attr
);
488 existm
= BGP_CLUSTER_LIST_LENGTH(exist
->attr
);
496 /* 9. Maximum path check. */
499 if (bgp_flag_check(bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
))
503 * For the two paths, all comparison steps till IGP metric
504 * have succeeded - including AS_PATH hop count. Since 'bgp
505 * bestpath as-path multipath-relax' knob is on, we don't need
506 * an exact match of AS_PATH. Thus, mark the paths are equal.
507 * That will trigger both these paths to get into the multipath
512 else if (new->peer
->sort
== BGP_PEER_IBGP
)
514 if (aspath_cmp (new->attr
->aspath
, exist
->attr
->aspath
))
517 else if (new->peer
->as
== exist
->peer
->as
)
523 * TODO: If unequal cost ibgp multipath is enabled we can
524 * mark the paths as equal here instead of returning
529 /* 10. If both paths are external, prefer the path that was received
530 first (the oldest one). This step minimizes route-flap, since a
531 newer path won't displace an older one, even if it was the
532 preferred route based on the additional decision criteria below. */
533 if (! bgp_flag_check (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
)
534 && new_sort
== BGP_PEER_EBGP
535 && exist_sort
== BGP_PEER_EBGP
)
537 if (CHECK_FLAG (new->flags
, BGP_INFO_SELECTED
))
539 if (CHECK_FLAG (exist
->flags
, BGP_INFO_SELECTED
))
543 /* 11. Rourter-ID comparision. */
544 if (newattr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
545 new_id
.s_addr
= newattre
->originator_id
.s_addr
;
547 new_id
.s_addr
= new->peer
->remote_id
.s_addr
;
548 if (existattr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
549 exist_id
.s_addr
= existattre
->originator_id
.s_addr
;
551 exist_id
.s_addr
= exist
->peer
->remote_id
.s_addr
;
553 if (ntohl (new_id
.s_addr
) < ntohl (exist_id
.s_addr
))
555 if (ntohl (new_id
.s_addr
) > ntohl (exist_id
.s_addr
))
558 /* 12. Cluster length comparision. */
559 new_cluster
= BGP_CLUSTER_LIST_LENGTH(new->attr
);
560 exist_cluster
= BGP_CLUSTER_LIST_LENGTH(exist
->attr
);
562 if (new_cluster
< exist_cluster
)
564 if (new_cluster
> exist_cluster
)
567 /* 13. Neighbor address comparision. */
568 ret
= sockunion_cmp (new->peer
->su_remote
, exist
->peer
->su_remote
);
578 static enum filter_type
579 bgp_input_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
580 afi_t afi
, safi_t safi
)
582 struct bgp_filter
*filter
;
584 filter
= &peer
->filter
[afi
][safi
];
586 #define FILTER_EXIST_WARN(F,f,filter) \
587 if (BGP_DEBUG (update, UPDATE_IN) \
588 && !(F ## _IN (filter))) \
589 plog_warn (peer->log, "%s: Could not find configured input %s-list %s!", \
590 peer->host, #f, F ## _IN_NAME(filter));
592 if (DISTRIBUTE_IN_NAME (filter
)) {
593 FILTER_EXIST_WARN(DISTRIBUTE
, distribute
, filter
);
595 if (access_list_apply (DISTRIBUTE_IN (filter
), p
) == FILTER_DENY
)
599 if (PREFIX_LIST_IN_NAME (filter
)) {
600 FILTER_EXIST_WARN(PREFIX_LIST
, prefix
, filter
);
602 if (prefix_list_apply (PREFIX_LIST_IN (filter
), p
) == PREFIX_DENY
)
606 if (FILTER_LIST_IN_NAME (filter
)) {
607 FILTER_EXIST_WARN(FILTER_LIST
, as
, filter
);
609 if (as_list_apply (FILTER_LIST_IN (filter
), attr
->aspath
)== AS_FILTER_DENY
)
613 return FILTER_PERMIT
;
614 #undef FILTER_EXIST_WARN
617 static enum filter_type
618 bgp_output_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
619 afi_t afi
, safi_t safi
)
621 struct bgp_filter
*filter
;
623 filter
= &peer
->filter
[afi
][safi
];
625 #define FILTER_EXIST_WARN(F,f,filter) \
626 if (BGP_DEBUG (update, UPDATE_OUT) \
627 && !(F ## _OUT (filter))) \
628 plog_warn (peer->log, "%s: Could not find configured output %s-list %s!", \
629 peer->host, #f, F ## _OUT_NAME(filter));
631 if (DISTRIBUTE_OUT_NAME (filter
)) {
632 FILTER_EXIST_WARN(DISTRIBUTE
, distribute
, filter
);
634 if (access_list_apply (DISTRIBUTE_OUT (filter
), p
) == FILTER_DENY
)
638 if (PREFIX_LIST_OUT_NAME (filter
)) {
639 FILTER_EXIST_WARN(PREFIX_LIST
, prefix
, filter
);
641 if (prefix_list_apply (PREFIX_LIST_OUT (filter
), p
) == PREFIX_DENY
)
645 if (FILTER_LIST_OUT_NAME (filter
)) {
646 FILTER_EXIST_WARN(FILTER_LIST
, as
, filter
);
648 if (as_list_apply (FILTER_LIST_OUT (filter
), attr
->aspath
) == AS_FILTER_DENY
)
652 return FILTER_PERMIT
;
653 #undef FILTER_EXIST_WARN
656 /* If community attribute includes no_export then return 1. */
658 bgp_community_filter (struct peer
*peer
, struct attr
*attr
)
662 /* NO_ADVERTISE check. */
663 if (community_include (attr
->community
, COMMUNITY_NO_ADVERTISE
))
666 /* NO_EXPORT check. */
667 if (peer
->sort
== BGP_PEER_EBGP
&&
668 community_include (attr
->community
, COMMUNITY_NO_EXPORT
))
671 /* NO_EXPORT_SUBCONFED check. */
672 if (peer
->sort
== BGP_PEER_EBGP
673 || peer
->sort
== BGP_PEER_CONFED
)
674 if (community_include (attr
->community
, COMMUNITY_NO_EXPORT_SUBCONFED
))
680 /* Route reflection loop check. */
682 bgp_cluster_filter (struct peer
*peer
, struct attr
*attr
)
684 struct in_addr cluster_id
;
686 if (attr
->extra
&& attr
->extra
->cluster
)
688 if (peer
->bgp
->config
& BGP_CONFIG_CLUSTER_ID
)
689 cluster_id
= peer
->bgp
->cluster_id
;
691 cluster_id
= peer
->bgp
->router_id
;
693 if (cluster_loop_check (attr
->extra
->cluster
, cluster_id
))
700 bgp_input_modifier (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
701 afi_t afi
, safi_t safi
, char *rmap_name
)
703 struct bgp_filter
*filter
;
704 struct bgp_info info
;
705 route_map_result_t ret
;
706 struct route_map
*rmap
= NULL
;
708 filter
= &peer
->filter
[afi
][safi
];
710 /* Apply default weight value. */
712 (bgp_attr_extra_get (attr
))->weight
= peer
->weight
;
716 rmap
= route_map_lookup_by_name(rmap_name
);
720 if (ROUTE_MAP_IN_NAME(filter
))
721 rmap
= ROUTE_MAP_IN (filter
);
724 /* Route map apply. */
727 /* Duplicate current value to new strucutre for modification. */
731 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IN
);
733 /* Apply BGP route map to the attribute. */
734 ret
= route_map_apply (rmap
, p
, RMAP_BGP
, &info
);
738 if (ret
== RMAP_DENYMATCH
)
740 /* Free newly generated AS path and community by route-map. */
741 bgp_attr_flush (attr
);
749 bgp_output_modifier (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
750 afi_t afi
, safi_t safi
, char *rmap_name
)
752 struct bgp_filter
*filter
;
753 struct bgp_info info
;
754 route_map_result_t ret
;
755 struct route_map
*rmap
= NULL
;
757 filter
= &peer
->filter
[afi
][safi
];
759 /* Apply default weight value. */
761 (bgp_attr_extra_get (attr
))->weight
= peer
->weight
;
765 rmap
= route_map_lookup_by_name(rmap_name
);
769 if (ROUTE_MAP_OUT_NAME(filter
))
770 rmap
= ROUTE_MAP_OUT (filter
);
773 /* Route map apply. */
776 /* Duplicate current value to new strucutre for modification. */
780 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_OUT
);
782 /* Apply BGP route map to the attribute. */
783 ret
= route_map_apply (rmap
, p
, RMAP_BGP
, &info
);
787 if (ret
== RMAP_DENYMATCH
)
788 /* caller has multiple error paths with bgp_attr_flush() */
795 bgp_export_modifier (struct peer
*rsclient
, struct peer
*peer
,
796 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
798 struct bgp_filter
*filter
;
799 struct bgp_info info
;
800 route_map_result_t ret
;
802 filter
= &peer
->filter
[afi
][safi
];
804 /* Route map apply. */
805 if (ROUTE_MAP_EXPORT_NAME (filter
))
807 /* Duplicate current value to new strucutre for modification. */
808 info
.peer
= rsclient
;
811 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
813 /* Apply BGP route map to the attribute. */
814 ret
= route_map_apply (ROUTE_MAP_EXPORT (filter
), p
, RMAP_BGP
, &info
);
816 rsclient
->rmap_type
= 0;
818 if (ret
== RMAP_DENYMATCH
)
820 /* Free newly generated AS path and community by route-map. */
821 bgp_attr_flush (attr
);
829 bgp_import_modifier (struct peer
*rsclient
, struct peer
*peer
,
830 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
832 struct bgp_filter
*filter
;
833 struct bgp_info info
;
834 route_map_result_t ret
;
836 filter
= &rsclient
->filter
[afi
][safi
];
838 /* Apply default weight value. */
840 (bgp_attr_extra_get (attr
))->weight
= peer
->weight
;
842 /* Route map apply. */
843 if (ROUTE_MAP_IMPORT_NAME (filter
))
845 /* Duplicate current value to new strucutre for modification. */
849 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IMPORT
);
851 /* Apply BGP route map to the attribute. */
852 ret
= route_map_apply (ROUTE_MAP_IMPORT (filter
), p
, RMAP_BGP
, &info
);
856 if (ret
== RMAP_DENYMATCH
)
858 /* Free newly generated AS path and community by route-map. */
859 bgp_attr_flush (attr
);
867 /* If this is an EBGP peer with remove-private-AS */
869 bgp_peer_remove_private_as(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
870 struct peer
*peer
, struct attr
*attr
)
872 if (peer
->sort
== BGP_PEER_EBGP
&&
873 peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
))
875 // Take action on the entire aspath
876 if (peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
878 if (peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
879 attr
->aspath
= aspath_replace_private_asns (attr
->aspath
, bgp
->as
);
881 // The entire aspath consists of private ASNs so create an empty aspath
882 else if (aspath_private_as_check (attr
->aspath
))
883 attr
->aspath
= aspath_empty_get ();
885 // There are some public and some private ASNs, remove the private ASNs
887 attr
->aspath
= aspath_remove_private_asns (attr
->aspath
);
890 // 'all' was not specified so the entire aspath must be private ASNs
891 // for us to do anything
892 else if (aspath_private_as_check (attr
->aspath
))
894 if (peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
895 attr
->aspath
= aspath_replace_private_asns (attr
->aspath
, bgp
->as
);
897 attr
->aspath
= aspath_empty_get ();
903 bgp_announce_check (struct bgp_info
*ri
, struct peer
*peer
, struct prefix
*p
,
904 struct attr
*attr
, afi_t afi
, safi_t safi
)
907 char buf
[SU_ADDRSTRLEN
];
908 struct bgp_filter
*filter
;
916 filter
= &peer
->filter
[afi
][safi
];
918 riattr
= bgp_info_mpath_count (ri
) ? bgp_info_mpath_attr (ri
) : ri
->attr
;
920 if (DISABLE_BGP_ANNOUNCE
)
923 /* Do not send announces to RS-clients from the 'normal' bgp_table. */
924 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
927 /* Do not send back route to sender. */
931 /* Aggregate-address suppress check. */
932 if (ri
->extra
&& ri
->extra
->suppress
)
933 if (! UNSUPPRESS_MAP_NAME (filter
))
936 /* Default route check. */
937 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
939 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
942 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
944 #endif /* HAVE_IPV6 */
947 /* Transparency check. */
948 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
)
949 && CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
954 /* If community is not disabled check the no-export and local. */
955 if (! transparent
&& bgp_community_filter (peer
, riattr
))
958 /* If the attribute has originator-id and it is same as remote
960 if (riattr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
962 if (IPV4_ADDR_SAME (&peer
->remote_id
, &riattr
->extra
->originator_id
))
964 if (BGP_DEBUG (filter
, FILTER
))
965 zlog (peer
->log
, LOG_DEBUG
,
966 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
968 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
974 /* ORF prefix-list filter check */
975 if (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
976 && (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
977 || CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
978 if (peer
->orf_plist
[afi
][safi
])
980 if (prefix_list_apply (peer
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
984 /* Output filter check. */
985 if (bgp_output_filter (peer
, p
, riattr
, afi
, safi
) == FILTER_DENY
)
987 if (BGP_DEBUG (filter
, FILTER
))
988 zlog (peer
->log
, LOG_DEBUG
,
989 "%s [Update:SEND] %s/%d is filtered",
991 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
996 #ifdef BGP_SEND_ASPATH_CHECK
997 /* AS path loop check. */
998 if (aspath_loop_check (riattr
->aspath
, peer
->as
))
1000 if (BGP_DEBUG (filter
, FILTER
))
1001 zlog (peer
->log
, LOG_DEBUG
,
1002 "%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
1003 peer
->host
, peer
->as
);
1006 #endif /* BGP_SEND_ASPATH_CHECK */
1008 /* If we're a CONFED we need to loop check the CONFED ID too */
1009 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
1011 if (aspath_loop_check(riattr
->aspath
, bgp
->confed_id
))
1013 if (BGP_DEBUG (filter
, FILTER
))
1014 zlog (peer
->log
, LOG_DEBUG
,
1015 "%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
1022 /* Route-Reflect check. */
1023 if (from
->sort
== BGP_PEER_IBGP
&& peer
->sort
== BGP_PEER_IBGP
)
1028 /* IBGP reflection check. */
1031 /* A route from a Client peer. */
1032 if (CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
1034 /* Reflect to all the Non-Client peers and also to the
1035 Client peers other than the originator. Originator check
1036 is already done. So there is noting to do. */
1037 /* no bgp client-to-client reflection check. */
1038 if (bgp_flag_check (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
))
1039 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
1044 /* A route from a Non-client peer. Reflect to all other
1046 if (! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
1051 /* For modify attribute, copy it to temporary structure. */
1052 bgp_attr_dup (attr
, riattr
);
1054 /* If local-preference is not set. */
1055 if ((peer
->sort
== BGP_PEER_IBGP
1056 || peer
->sort
== BGP_PEER_CONFED
)
1057 && (! (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))))
1059 attr
->flag
|= ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
);
1060 attr
->local_pref
= bgp
->default_local_pref
;
1063 /* If originator-id is not set and the route is to be reflected,
1064 set the originator id */
1065 if (peer
&& from
&& peer
->sort
== BGP_PEER_IBGP
&&
1066 from
->sort
== BGP_PEER_IBGP
&&
1067 (! (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))))
1069 attr
->extra
= bgp_attr_extra_get(attr
);
1070 IPV4_ADDR_COPY(&(attr
->extra
->originator_id
), &(from
->remote_id
));
1071 SET_FLAG(attr
->flag
, BGP_ATTR_ORIGINATOR_ID
);
1074 /* Remove MED if its an EBGP peer - will get overwritten by route-maps */
1075 if (peer
->sort
== BGP_PEER_EBGP
1076 && attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
1078 if (ri
->peer
!= bgp
->peer_self
&& ! transparent
1079 && ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
1080 attr
->flag
&= ~(ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
));
1085 || (reflect
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF_ALL
))
1086 || (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
)
1087 && ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
)
1089 || (p
->family
== AF_INET6
&&
1090 ! IN6_IS_ADDR_UNSPECIFIED(&attr
->extra
->mp_nexthop_global
))
1091 #endif /* HAVE_IPV6 */
1094 /* NEXT-HOP Unchanged. */
1096 else if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
1097 || (p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
1099 || (p
->family
== AF_INET6
&&
1100 IN6_IS_ADDR_UNSPECIFIED(&attr
->extra
->mp_nexthop_global
))
1101 #endif /* HAVE_IPV6 */
1102 || (peer
->sort
== BGP_PEER_EBGP
1103 && (bgp_multiaccess_check_v4 (attr
->nexthop
, peer
) == 0)))
1105 /* Set IPv4 nexthop. */
1106 if (p
->family
== AF_INET
)
1108 if (safi
== SAFI_MPLS_VPN
)
1109 memcpy (&attr
->extra
->mp_nexthop_global_in
, &peer
->nexthop
.v4
,
1112 memcpy (&attr
->nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
1115 /* Set IPv6 nexthop. */
1116 if (p
->family
== AF_INET6
)
1118 /* IPv6 global nexthop must be included. */
1119 memcpy (&attr
->extra
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
1121 attr
->extra
->mp_nexthop_len
= 16;
1123 #endif /* HAVE_IPV6 */
1127 if (p
->family
== AF_INET6
)
1129 /* Left nexthop_local unchanged if so configured. */
1130 if ( CHECK_FLAG (peer
->af_flags
[afi
][safi
],
1131 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
1133 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->extra
->mp_nexthop_local
) )
1134 attr
->extra
->mp_nexthop_len
=32;
1136 attr
->extra
->mp_nexthop_len
=16;
1139 /* Default nexthop_local treatment for non-RS-Clients */
1142 /* Link-local address should not be transit to different peer. */
1143 attr
->extra
->mp_nexthop_len
= 16;
1145 /* Set link-local address for shared network peer. */
1146 if (peer
->shared_network
1147 && ! IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
1149 memcpy (&attr
->extra
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
1151 attr
->extra
->mp_nexthop_len
= 32;
1154 /* If bgpd act as BGP-4+ route-reflector, do not send link-local
1157 attr
->extra
->mp_nexthop_len
= 16;
1159 /* If BGP-4+ link-local nexthop is not link-local nexthop. */
1160 if (! IN6_IS_ADDR_LINKLOCAL (&peer
->nexthop
.v6_local
))
1161 attr
->extra
->mp_nexthop_len
= 16;
1165 #endif /* HAVE_IPV6 */
1167 bgp_peer_remove_private_as(bgp
, afi
, safi
, peer
, attr
);
1169 /* Route map & unsuppress-map apply. */
1170 if (ROUTE_MAP_OUT_NAME (filter
)
1171 || (ri
->extra
&& ri
->extra
->suppress
) )
1173 struct bgp_info info
;
1174 struct attr dummy_attr
;
1175 struct attr_extra dummy_extra
;
1177 dummy_attr
.extra
= &dummy_extra
;
1182 /* The route reflector is not allowed to modify the attributes
1183 of the reflected IBGP routes. */
1184 if ((from
->sort
== BGP_PEER_IBGP
&& peer
->sort
== BGP_PEER_IBGP
) &&
1185 !bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
1187 bgp_attr_dup (&dummy_attr
, attr
);
1188 info
.attr
= &dummy_attr
;
1191 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_OUT
);
1193 if (ri
->extra
&& ri
->extra
->suppress
)
1194 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
1196 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
1198 peer
->rmap_type
= 0;
1200 if (ret
== RMAP_DENYMATCH
)
1202 bgp_attr_flush (attr
);
1210 bgp_announce_check_rsclient (struct bgp_info
*ri
, struct peer
*rsclient
,
1211 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
1214 char buf
[SU_ADDRSTRLEN
];
1215 struct bgp_filter
*filter
;
1216 struct bgp_info info
;
1218 struct attr
*riattr
;
1222 filter
= &rsclient
->filter
[afi
][safi
];
1223 bgp
= rsclient
->bgp
;
1224 riattr
= bgp_info_mpath_count (ri
) ? bgp_info_mpath_attr (ri
) : ri
->attr
;
1226 if (DISABLE_BGP_ANNOUNCE
)
1229 /* Do not send back route to sender. */
1230 if (from
== rsclient
)
1233 /* Aggregate-address suppress check. */
1234 if (ri
->extra
&& ri
->extra
->suppress
)
1235 if (! UNSUPPRESS_MAP_NAME (filter
))
1238 /* Default route check. */
1239 if (CHECK_FLAG (rsclient
->af_sflags
[afi
][safi
],
1240 PEER_STATUS_DEFAULT_ORIGINATE
))
1242 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
1245 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
1247 #endif /* HAVE_IPV6 */
1250 /* If the attribute has originator-id and it is same as remote
1252 if (riattr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
1254 if (IPV4_ADDR_SAME (&rsclient
->remote_id
,
1255 &riattr
->extra
->originator_id
))
1257 if (BGP_DEBUG (filter
, FILTER
))
1258 zlog (rsclient
->log
, LOG_DEBUG
,
1259 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
1261 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1267 /* ORF prefix-list filter check */
1268 if (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
1269 && (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
1270 || CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
1271 if (rsclient
->orf_plist
[afi
][safi
])
1273 if (prefix_list_apply (rsclient
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
1277 /* Output filter check. */
1278 if (bgp_output_filter (rsclient
, p
, riattr
, afi
, safi
) == FILTER_DENY
)
1280 if (BGP_DEBUG (filter
, FILTER
))
1281 zlog (rsclient
->log
, LOG_DEBUG
,
1282 "%s [Update:SEND] %s/%d is filtered",
1284 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1289 #ifdef BGP_SEND_ASPATH_CHECK
1290 /* AS path loop check. */
1291 if (aspath_loop_check (riattr
->aspath
, rsclient
->as
))
1293 if (BGP_DEBUG (filter
, FILTER
))
1294 zlog (rsclient
->log
, LOG_DEBUG
,
1295 "%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
1296 rsclient
->host
, rsclient
->as
);
1299 #endif /* BGP_SEND_ASPATH_CHECK */
1301 /* For modify attribute, copy it to temporary structure. */
1302 bgp_attr_dup (attr
, riattr
);
1305 if ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
1307 || (p
->family
== AF_INET6
&&
1308 IN6_IS_ADDR_UNSPECIFIED(&attr
->extra
->mp_nexthop_global
))
1309 #endif /* HAVE_IPV6 */
1312 /* Set IPv4 nexthop. */
1313 if (p
->family
== AF_INET
)
1315 if (safi
== SAFI_MPLS_VPN
)
1316 memcpy (&attr
->extra
->mp_nexthop_global_in
, &rsclient
->nexthop
.v4
,
1319 memcpy (&attr
->nexthop
, &rsclient
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
1322 /* Set IPv6 nexthop. */
1323 if (p
->family
== AF_INET6
)
1325 /* IPv6 global nexthop must be included. */
1326 memcpy (&attr
->extra
->mp_nexthop_global
, &rsclient
->nexthop
.v6_global
,
1328 attr
->extra
->mp_nexthop_len
= 16;
1330 #endif /* HAVE_IPV6 */
1334 if (p
->family
== AF_INET6
)
1336 struct attr_extra
*attre
= attr
->extra
;
1338 /* Left nexthop_local unchanged if so configured. */
1339 if ( CHECK_FLAG (rsclient
->af_flags
[afi
][safi
],
1340 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
1342 if ( IN6_IS_ADDR_LINKLOCAL (&attre
->mp_nexthop_local
) )
1343 attre
->mp_nexthop_len
=32;
1345 attre
->mp_nexthop_len
=16;
1348 /* Default nexthop_local treatment for RS-Clients */
1351 /* Announcer and RS-Client are both in the same network */
1352 if (rsclient
->shared_network
&& from
->shared_network
&&
1353 (rsclient
->ifindex
== from
->ifindex
))
1355 if ( IN6_IS_ADDR_LINKLOCAL (&attre
->mp_nexthop_local
) )
1356 attre
->mp_nexthop_len
=32;
1358 attre
->mp_nexthop_len
=16;
1361 /* Set link-local address for shared network peer. */
1362 else if (rsclient
->shared_network
1363 && IN6_IS_ADDR_LINKLOCAL (&rsclient
->nexthop
.v6_local
))
1365 memcpy (&attre
->mp_nexthop_local
, &rsclient
->nexthop
.v6_local
,
1367 attre
->mp_nexthop_len
= 32;
1371 attre
->mp_nexthop_len
= 16;
1375 #endif /* HAVE_IPV6 */
1377 bgp_peer_remove_private_as(bgp
, afi
, safi
, rsclient
, attr
);
1379 /* Route map & unsuppress-map apply. */
1380 if (ROUTE_MAP_OUT_NAME (filter
) || (ri
->extra
&& ri
->extra
->suppress
) )
1382 info
.peer
= rsclient
;
1385 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_OUT
);
1387 if (ri
->extra
&& ri
->extra
->suppress
)
1388 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
1390 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
1392 rsclient
->rmap_type
= 0;
1394 if (ret
== RMAP_DENYMATCH
)
1396 bgp_attr_flush (attr
);
1404 struct bgp_info_pair
1406 struct bgp_info
*old
;
1407 struct bgp_info
*new;
1411 bgp_best_selection (struct bgp
*bgp
, struct bgp_node
*rn
,
1412 struct bgp_maxpaths_cfg
*mpath_cfg
,
1413 struct bgp_info_pair
*result
)
1415 struct bgp_info
*new_select
;
1416 struct bgp_info
*old_select
;
1417 struct bgp_info
*ri
;
1418 struct bgp_info
*ri1
;
1419 struct bgp_info
*ri2
;
1420 struct bgp_info
*nextri
= NULL
;
1421 int paths_eq
, do_mpath
;
1422 struct list mp_list
;
1423 char buf
[INET6_BUFSIZ
];
1425 bgp_mp_list_init (&mp_list
);
1426 do_mpath
= (mpath_cfg
->maxpaths_ebgp
!= BGP_DEFAULT_MAXPATHS
||
1427 mpath_cfg
->maxpaths_ibgp
!= BGP_DEFAULT_MAXPATHS
);
1429 /* bgp deterministic-med */
1431 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1432 for (ri1
= rn
->info
; ri1
; ri1
= ri1
->next
)
1434 if (CHECK_FLAG (ri1
->flags
, BGP_INFO_DMED_CHECK
))
1436 if (BGP_INFO_HOLDDOWN (ri1
))
1441 bgp_mp_list_add (&mp_list
, ri1
);
1442 old_select
= CHECK_FLAG (ri1
->flags
, BGP_INFO_SELECTED
) ? ri1
: NULL
;
1444 for (ri2
= ri1
->next
; ri2
; ri2
= ri2
->next
)
1446 if (CHECK_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
))
1448 if (BGP_INFO_HOLDDOWN (ri2
))
1451 if (aspath_cmp_left (ri1
->attr
->aspath
, ri2
->attr
->aspath
)
1452 || aspath_cmp_left_confed (ri1
->attr
->aspath
,
1455 if (CHECK_FLAG (ri2
->flags
, BGP_INFO_SELECTED
))
1457 if (bgp_info_cmp (bgp
, ri2
, new_select
, &paths_eq
,
1460 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_DMED_SELECTED
);
1462 if (do_mpath
&& !paths_eq
)
1464 bgp_mp_list_clear (&mp_list
);
1465 bgp_mp_list_add (&mp_list
, ri2
);
1469 if (do_mpath
&& paths_eq
)
1470 bgp_mp_list_add (&mp_list
, ri2
);
1472 bgp_info_set_flag (rn
, ri2
, BGP_INFO_DMED_CHECK
);
1475 bgp_info_set_flag (rn
, new_select
, BGP_INFO_DMED_CHECK
);
1476 bgp_info_set_flag (rn
, new_select
, BGP_INFO_DMED_SELECTED
);
1478 bgp_info_mpath_update (rn
, new_select
, old_select
, &mp_list
, mpath_cfg
);
1479 bgp_mp_list_clear (&mp_list
);
1482 /* Check old selected route and new selected route. */
1485 for (ri
= rn
->info
; (ri
!= NULL
) && (nextri
= ri
->next
, 1); ri
= nextri
)
1487 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
1490 if (BGP_INFO_HOLDDOWN (ri
))
1492 /* reap REMOVED routes, if needs be
1493 * selected route must stay for a while longer though
1495 if (CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
)
1496 && (ri
!= old_select
))
1497 bgp_info_reap (rn
, ri
);
1502 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
)
1503 && (! CHECK_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
)))
1505 bgp_info_unset_flag (rn
, ri
, BGP_INFO_DMED_CHECK
);
1508 bgp_info_unset_flag (rn
, ri
, BGP_INFO_DMED_CHECK
);
1509 bgp_info_unset_flag (rn
, ri
, BGP_INFO_DMED_SELECTED
);
1511 if (bgp_info_cmp (bgp
, ri
, new_select
, &paths_eq
, mpath_cfg
))
1513 if (do_mpath
&& bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1514 bgp_mp_dmed_deselect (new_select
);
1518 if (do_mpath
&& !paths_eq
)
1520 bgp_mp_list_clear (&mp_list
);
1521 bgp_mp_list_add (&mp_list
, ri
);
1524 else if (do_mpath
&& bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1525 bgp_mp_dmed_deselect (ri
);
1527 if (do_mpath
&& paths_eq
)
1528 bgp_mp_list_add (&mp_list
, ri
);
1532 if (!bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1533 bgp_info_mpath_update (rn
, new_select
, old_select
, &mp_list
, mpath_cfg
);
1535 bgp_info_mpath_aggregate_update (new_select
, old_select
);
1536 bgp_mp_list_clear (&mp_list
);
1538 result
->old
= old_select
;
1539 result
->new = new_select
;
1545 bgp_process_announce_selected (struct peer
*peer
, struct bgp_info
*selected
,
1546 struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
1550 struct attr_extra extra
;
1554 /* Announce route to Established peer. */
1555 if (peer
->status
!= Established
)
1558 /* Address family configuration check. */
1559 if (! peer
->afc_nego
[afi
][safi
])
1562 /* First update is deferred until ORF or ROUTE-REFRESH is received */
1563 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
1564 PEER_STATUS_ORF_WAIT_REFRESH
))
1567 /* It's initialized in bgp_announce_[check|check_rsclient]() */
1568 attr
.extra
= &extra
;
1570 switch (bgp_node_table (rn
)->type
)
1572 case BGP_TABLE_MAIN
:
1573 /* Announcement to peer->conf. If the route is filtered,
1575 if (selected
&& bgp_announce_check (selected
, peer
, p
, &attr
, afi
, safi
))
1576 bgp_adj_out_set (rn
, peer
, p
, &attr
, afi
, safi
, selected
);
1578 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1580 case BGP_TABLE_RSCLIENT
:
1581 /* Announcement to peer->conf. If the route is filtered,
1584 bgp_announce_check_rsclient (selected
, peer
, p
, &attr
, afi
, safi
))
1585 bgp_adj_out_set (rn
, peer
, p
, &attr
, afi
, safi
, selected
);
1587 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1594 struct bgp_process_queue
1597 struct bgp_node
*rn
;
1602 static wq_item_status
1603 bgp_process_rsclient (struct work_queue
*wq
, void *data
)
1605 struct bgp_process_queue
*pq
= data
;
1606 struct bgp
*bgp
= pq
->bgp
;
1607 struct bgp_node
*rn
= pq
->rn
;
1608 afi_t afi
= pq
->afi
;
1609 safi_t safi
= pq
->safi
;
1610 struct bgp_info
*new_select
;
1611 struct bgp_info
*old_select
;
1612 struct bgp_info_pair old_and_new
;
1613 struct listnode
*node
, *nnode
;
1614 struct peer
*rsclient
;
1616 /* Is it end of initial update? (after startup) */
1619 /* This is just to keep the display sane in case all the peers are
1621 quagga_timestamp(3, bgp
->update_delay_zebra_resume_time
,
1622 sizeof(bgp
->update_delay_zebra_resume_time
));
1624 bgp
->rsclient_peers_update_hold
= 0;
1625 bgp_start_routeadv(bgp
);
1629 rsclient
= bgp_node_table (rn
)->owner
;
1631 /* Best path selection. */
1632 bgp_best_selection (bgp
, rn
, &bgp
->maxpaths
[afi
][safi
], &old_and_new
);
1633 new_select
= old_and_new
.new;
1634 old_select
= old_and_new
.old
;
1636 if (CHECK_FLAG (rsclient
->sflags
, PEER_STATUS_GROUP
))
1638 if (rsclient
->group
)
1639 for (ALL_LIST_ELEMENTS (rsclient
->group
->peer
, node
, nnode
, rsclient
))
1641 /* Nothing to do. */
1642 if (old_select
&& old_select
== new_select
)
1643 if (!CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1647 bgp_info_unset_flag (rn
, old_select
, BGP_INFO_SELECTED
);
1650 bgp_info_set_flag (rn
, new_select
, BGP_INFO_SELECTED
);
1651 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_ATTR_CHANGED
);
1652 UNSET_FLAG (new_select
->flags
, BGP_INFO_MULTIPATH_CHG
);
1655 bgp_process_announce_selected (rsclient
, new_select
, rn
,
1662 bgp_info_unset_flag (rn
, old_select
, BGP_INFO_SELECTED
);
1665 bgp_info_set_flag (rn
, new_select
, BGP_INFO_SELECTED
);
1666 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_ATTR_CHANGED
);
1667 UNSET_FLAG (new_select
->flags
, BGP_INFO_MULTIPATH_CHG
);
1669 bgp_process_announce_selected (rsclient
, new_select
, rn
, afi
, safi
);
1672 if (old_select
&& CHECK_FLAG (old_select
->flags
, BGP_INFO_REMOVED
))
1673 bgp_info_reap (rn
, old_select
);
1675 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1679 static wq_item_status
1680 bgp_process_main (struct work_queue
*wq
, void *data
)
1682 struct bgp_process_queue
*pq
= data
;
1683 struct bgp
*bgp
= pq
->bgp
;
1684 struct bgp_node
*rn
= pq
->rn
;
1685 afi_t afi
= pq
->afi
;
1686 safi_t safi
= pq
->safi
;
1687 struct prefix
*p
= &rn
->p
;
1688 struct bgp_info
*new_select
;
1689 struct bgp_info
*old_select
;
1690 struct bgp_info_pair old_and_new
;
1691 struct listnode
*node
, *nnode
;
1694 /* Is it end of initial update? (after startup) */
1697 quagga_timestamp(3, bgp
->update_delay_zebra_resume_time
,
1698 sizeof(bgp
->update_delay_zebra_resume_time
));
1700 bgp
->main_zebra_update_hold
= 0;
1701 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1702 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1704 bgp_zebra_announce_table(bgp
, afi
, safi
);
1706 bgp
->main_peers_update_hold
= 0;
1708 bgp_start_routeadv(bgp
);
1712 /* Best path selection. */
1713 bgp_best_selection (bgp
, rn
, &bgp
->maxpaths
[afi
][safi
], &old_and_new
);
1714 old_select
= old_and_new
.old
;
1715 new_select
= old_and_new
.new;
1717 /* Nothing to do. */
1718 if (old_select
&& old_select
== new_select
&& !CHECK_FLAG(rn
->flags
, BGP_NODE_USER_CLEAR
))
1720 if (! CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1722 if (CHECK_FLAG (old_select
->flags
, BGP_INFO_IGP_CHANGED
) ||
1723 CHECK_FLAG (old_select
->flags
, BGP_INFO_MULTIPATH_CHG
))
1724 bgp_zebra_announce (p
, old_select
, bgp
, afi
, safi
);
1726 UNSET_FLAG (old_select
->flags
, BGP_INFO_MULTIPATH_CHG
);
1727 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1732 /* If the user did "clear ip bgp prefix x.x.x.x" this flag will be set */
1733 UNSET_FLAG(rn
->flags
, BGP_NODE_USER_CLEAR
);
1736 bgp_info_unset_flag (rn
, old_select
, BGP_INFO_SELECTED
);
1739 bgp_info_set_flag (rn
, new_select
, BGP_INFO_SELECTED
);
1740 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_ATTR_CHANGED
);
1741 UNSET_FLAG (new_select
->flags
, BGP_INFO_MULTIPATH_CHG
);
1745 /* Check each BGP peer. */
1746 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1748 bgp_process_announce_selected (peer
, new_select
, rn
, afi
, safi
);
1752 if ((safi
== SAFI_UNICAST
|| safi
== SAFI_MULTICAST
) && (! bgp
->name
&&
1753 ! bgp_option_check (BGP_OPT_NO_FIB
)))
1756 && new_select
->type
== ZEBRA_ROUTE_BGP
1757 && new_select
->sub_type
== BGP_ROUTE_NORMAL
)
1758 bgp_zebra_announce (p
, new_select
, bgp
, afi
, safi
);
1761 /* Withdraw the route from the kernel. */
1763 && old_select
->type
== ZEBRA_ROUTE_BGP
1764 && old_select
->sub_type
== BGP_ROUTE_NORMAL
)
1765 bgp_zebra_withdraw (p
, old_select
, safi
);
1769 /* Reap old select bgp_info, it it has been removed */
1770 if (old_select
&& CHECK_FLAG (old_select
->flags
, BGP_INFO_REMOVED
))
1771 bgp_info_reap (rn
, old_select
);
1773 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1778 bgp_processq_del (struct work_queue
*wq
, void *data
)
1780 struct bgp_process_queue
*pq
= data
;
1781 struct bgp_table
*table
;
1783 bgp_unlock (pq
->bgp
);
1786 table
= bgp_node_table (pq
->rn
);
1787 bgp_unlock_node (pq
->rn
);
1788 bgp_table_unlock (table
);
1790 XFREE (MTYPE_BGP_PROCESS_QUEUE
, pq
);
1794 bgp_process_queue_complete (struct work_queue
*wq
)
1798 struct listnode
*node
, *nnode
;
1800 /* Schedule write thread either directly or through the MRAI timer
1803 bgp
= bgp_get_default ();
1807 if (BGP_ROUTE_ADV_HOLD(bgp
))
1810 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1811 bgp_peer_schedule_updates(peer
);
1815 bgp_process_queue_init (void)
1817 bm
->process_main_queue
1818 = work_queue_new (bm
->master
, "process_main_queue");
1819 bm
->process_rsclient_queue
1820 = work_queue_new (bm
->master
, "process_rsclient_queue");
1822 if ( !(bm
->process_main_queue
&& bm
->process_rsclient_queue
) )
1824 zlog_err ("%s: Failed to allocate work queue", __func__
);
1828 bm
->process_main_queue
->spec
.workfunc
= &bgp_process_main
;
1829 bm
->process_main_queue
->spec
.del_item_data
= &bgp_processq_del
;
1830 bm
->process_main_queue
->spec
.completion_func
= &bgp_process_queue_complete
;
1831 bm
->process_main_queue
->spec
.max_retries
= 0;
1832 bm
->process_main_queue
->spec
.hold
= 50;
1833 /* Use a higher yield value of 50ms for main queue processing */
1834 bm
->process_main_queue
->spec
.yield
= 50 * 1000L;
1836 memcpy (bm
->process_rsclient_queue
, bm
->process_main_queue
,
1837 sizeof (struct work_queue
*));
1838 bm
->process_rsclient_queue
->spec
.workfunc
= &bgp_process_rsclient
;
1842 bgp_process (struct bgp
*bgp
, struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
1844 struct bgp_process_queue
*pqnode
;
1846 /* already scheduled for processing? */
1847 if (CHECK_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
))
1850 if ( (bm
->process_main_queue
== NULL
) ||
1851 (bm
->process_rsclient_queue
== NULL
) )
1852 bgp_process_queue_init ();
1854 pqnode
= XCALLOC (MTYPE_BGP_PROCESS_QUEUE
,
1855 sizeof (struct bgp_process_queue
));
1859 /* all unlocked in bgp_processq_del */
1860 bgp_table_lock (bgp_node_table (rn
));
1861 pqnode
->rn
= bgp_lock_node (rn
);
1865 pqnode
->safi
= safi
;
1867 switch (bgp_node_table (rn
)->type
)
1869 case BGP_TABLE_MAIN
:
1870 work_queue_add (bm
->process_main_queue
, pqnode
);
1872 case BGP_TABLE_RSCLIENT
:
1873 work_queue_add (bm
->process_rsclient_queue
, pqnode
);
1877 SET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1882 bgp_add_eoiu_mark (struct bgp
*bgp
, bgp_table_t type
)
1884 struct bgp_process_queue
*pqnode
;
1886 if ( (bm
->process_main_queue
== NULL
) ||
1887 (bm
->process_rsclient_queue
== NULL
) )
1888 bgp_process_queue_init ();
1890 pqnode
= XCALLOC (MTYPE_BGP_PROCESS_QUEUE
,
1891 sizeof (struct bgp_process_queue
));
1900 case BGP_TABLE_MAIN
:
1901 work_queue_add (bm
->process_main_queue
, pqnode
);
1903 case BGP_TABLE_RSCLIENT
:
1904 work_queue_add (bm
->process_rsclient_queue
, pqnode
);
1912 bgp_maximum_prefix_restart_timer (struct thread
*thread
)
1916 peer
= THREAD_ARG (thread
);
1917 peer
->t_pmax_restart
= NULL
;
1919 if (BGP_DEBUG (events
, EVENTS
))
1920 zlog_debug ("%s Maximum-prefix restart timer expired, restore peering",
1923 peer_clear (peer
, NULL
);
1929 bgp_maximum_prefix_overflow (struct peer
*peer
, afi_t afi
,
1930 safi_t safi
, int always
)
1932 if (!CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
1935 if (peer
->pcount
[afi
][safi
] > peer
->pmax
[afi
][safi
])
1937 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
)
1941 zlog (peer
->log
, LOG_INFO
,
1942 "%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, "
1943 "limit %ld", afi_safi_print (afi
, safi
), peer
->host
,
1944 peer
->pcount
[afi
][safi
], peer
->pmax
[afi
][safi
]);
1945 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1947 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
1953 if (safi
== SAFI_MPLS_VPN
)
1954 safi
= SAFI_MPLS_LABELED_VPN
;
1956 ndata
[0] = (afi
>> 8);
1959 ndata
[3] = (peer
->pmax
[afi
][safi
] >> 24);
1960 ndata
[4] = (peer
->pmax
[afi
][safi
] >> 16);
1961 ndata
[5] = (peer
->pmax
[afi
][safi
] >> 8);
1962 ndata
[6] = (peer
->pmax
[afi
][safi
]);
1964 SET_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
);
1965 bgp_notify_send_with_data (peer
, BGP_NOTIFY_CEASE
,
1966 BGP_NOTIFY_CEASE_MAX_PREFIX
, ndata
, 7);
1969 /* restart timer start */
1970 if (peer
->pmax_restart
[afi
][safi
])
1972 peer
->v_pmax_restart
= peer
->pmax_restart
[afi
][safi
] * 60;
1974 if (BGP_DEBUG (events
, EVENTS
))
1975 zlog_debug ("%s Maximum-prefix restart timer started for %d secs",
1976 peer
->host
, peer
->v_pmax_restart
);
1978 BGP_TIMER_ON (peer
->t_pmax_restart
, bgp_maximum_prefix_restart_timer
,
1979 peer
->v_pmax_restart
);
1985 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1987 if (peer
->pcount
[afi
][safi
] > (peer
->pmax
[afi
][safi
] * peer
->pmax_threshold
[afi
][safi
] / 100))
1989 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
)
1993 zlog (peer
->log
, LOG_INFO
,
1994 "%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld",
1995 afi_safi_print (afi
, safi
), peer
->host
, peer
->pcount
[afi
][safi
],
1996 peer
->pmax
[afi
][safi
]);
1997 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
2000 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
2004 /* Unconditionally remove the route from the RIB, without taking
2005 * damping into consideration (eg, because the session went down)
2008 bgp_rib_remove (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
2009 afi_t afi
, safi_t safi
)
2011 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
2013 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2014 bgp_info_delete (rn
, ri
); /* keep historical info */
2016 bgp_process (peer
->bgp
, rn
, afi
, safi
);
2020 bgp_rib_withdraw (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
2021 afi_t afi
, safi_t safi
)
2023 int status
= BGP_DAMP_NONE
;
2025 /* apply dampening, if result is suppressed, we'll be retaining
2026 * the bgp_info in the RIB for historical reference.
2028 if (CHECK_FLAG (peer
->bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2029 && peer
->sort
== BGP_PEER_EBGP
)
2030 if ( (status
= bgp_damp_withdraw (ri
, rn
, afi
, safi
, 0))
2031 == BGP_DAMP_SUPPRESSED
)
2033 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
2037 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2040 static struct bgp_info
*
2041 info_make (int type
, int sub_type
, struct peer
*peer
, struct attr
*attr
,
2042 struct bgp_node
*rn
)
2044 struct bgp_info
*new;
2046 /* Make new BGP info. */
2047 new = XCALLOC (MTYPE_BGP_ROUTE
, sizeof (struct bgp_info
));
2049 new->sub_type
= sub_type
;
2052 new->uptime
= bgp_clock ();
2058 bgp_update_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
2059 struct attr
*attr
, struct peer
*peer
, struct prefix
*p
, int type
,
2060 int sub_type
, struct prefix_rd
*prd
, u_char
*tag
)
2062 struct bgp_node
*rn
;
2064 struct attr new_attr
;
2065 struct attr_extra new_extra
;
2066 struct attr
*attr_new
;
2067 struct attr
*attr_new2
;
2068 struct bgp_info
*ri
;
2069 struct bgp_info
*new;
2071 char buf
[SU_ADDRSTRLEN
];
2073 /* Do not insert announces from a rsclient into its own 'bgp_table'. */
2074 if (peer
== rsclient
)
2078 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2080 /* Check previously received route. */
2081 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2082 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2085 /* AS path loop check. */
2086 if (aspath_loop_check (attr
->aspath
, rsclient
->as
) > rsclient
->allowas_in
[afi
][safi
])
2088 reason
= "as-path contains our own AS;";
2092 /* Route reflector originator ID check. */
2093 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
2094 && IPV4_ADDR_SAME (&rsclient
->remote_id
, &attr
->extra
->originator_id
))
2096 reason
= "originator is us;";
2100 new_attr
.extra
= &new_extra
;
2101 bgp_attr_dup (&new_attr
, attr
);
2103 /* Apply export policy. */
2104 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
) &&
2105 bgp_export_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
2107 reason
= "export-policy;";
2111 attr_new2
= bgp_attr_intern (&new_attr
);
2113 /* Apply import policy. */
2114 if (bgp_import_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
2116 bgp_attr_unintern (&attr_new2
);
2118 reason
= "import-policy;";
2122 attr_new
= bgp_attr_intern (&new_attr
);
2123 bgp_attr_unintern (&attr_new2
);
2125 /* IPv4 unicast next hop check. */
2126 if ((afi
== AFI_IP
) && ((safi
== SAFI_UNICAST
) || safi
== SAFI_MULTICAST
))
2128 /* Next hop must not be 0.0.0.0 nor Class D/E address. */
2129 if (new_attr
.nexthop
.s_addr
== 0
2130 || IPV4_CLASS_DE (ntohl (new_attr
.nexthop
.s_addr
)))
2132 bgp_attr_unintern (&attr_new
);
2134 reason
= "martian next-hop;";
2139 /* If the update is implicit withdraw. */
2142 ri
->uptime
= bgp_clock ();
2144 /* Same attribute comes in. */
2145 if (!CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
)
2146 && attrhash_cmp (ri
->attr
, attr_new
))
2149 bgp_info_unset_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
2151 if (BGP_DEBUG (update
, UPDATE_IN
))
2152 zlog (peer
->log
, LOG_DEBUG
,
2153 "%s rcvd %s/%d for RS-client %s...duplicate ignored",
2155 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2156 p
->prefixlen
, rsclient
->host
);
2158 bgp_unlock_node (rn
);
2159 bgp_attr_unintern (&attr_new
);
2164 /* Withdraw/Announce before we fully processed the withdraw */
2165 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
2166 bgp_info_restore (rn
, ri
);
2168 /* Received Logging. */
2169 if (BGP_DEBUG (update
, UPDATE_IN
))
2170 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
2172 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2173 p
->prefixlen
, rsclient
->host
);
2175 /* The attribute is changed. */
2176 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
2178 /* Update to new attribute. */
2179 bgp_attr_unintern (&ri
->attr
);
2180 ri
->attr
= attr_new
;
2182 /* Update MPLS tag. */
2183 if (safi
== SAFI_MPLS_VPN
)
2184 memcpy ((bgp_info_extra_get (ri
))->tag
, tag
, 3);
2186 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
2188 /* Process change. */
2189 bgp_process (bgp
, rn
, afi
, safi
);
2190 bgp_unlock_node (rn
);
2195 /* Received Logging. */
2196 if (BGP_DEBUG (update
, UPDATE_IN
))
2198 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
2200 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2201 p
->prefixlen
, rsclient
->host
);
2204 new = info_make(type
, sub_type
, peer
, attr_new
, rn
);
2206 /* Update MPLS tag. */
2207 if (safi
== SAFI_MPLS_VPN
)
2208 memcpy ((bgp_info_extra_get (new))->tag
, tag
, 3);
2210 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2212 /* Register new BGP information. */
2213 bgp_info_add (rn
, new);
2215 /* route_node_get lock */
2216 bgp_unlock_node (rn
);
2218 /* Process change. */
2219 bgp_process (bgp
, rn
, afi
, safi
);
2225 /* This BGP update is filtered. Log the reason then update BGP entry. */
2226 if (BGP_DEBUG (update
, UPDATE_IN
))
2227 zlog (peer
->log
, LOG_DEBUG
,
2228 "%s rcvd UPDATE about %s/%d -- DENIED for RS-client %s due to: %s",
2230 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2231 p
->prefixlen
, rsclient
->host
, reason
);
2234 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2236 bgp_unlock_node (rn
);
2242 bgp_withdraw_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
2243 struct peer
*peer
, struct prefix
*p
, int type
, int sub_type
,
2244 struct prefix_rd
*prd
, u_char
*tag
)
2246 struct bgp_node
*rn
;
2247 struct bgp_info
*ri
;
2248 char buf
[SU_ADDRSTRLEN
];
2250 if (rsclient
== peer
)
2253 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2255 /* Lookup withdrawn route. */
2256 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2257 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2260 /* Withdraw specified route from routing table. */
2261 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2262 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
2263 else if (BGP_DEBUG (update
, UPDATE_IN
))
2264 zlog (peer
->log
, LOG_DEBUG
,
2265 "%s Can't find the route %s/%d", peer
->host
,
2266 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2269 /* Unlock bgp_node_get() lock. */
2270 bgp_unlock_node (rn
);
2274 bgp_update_main (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2275 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2276 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
2279 int aspath_loop_count
= 0;
2280 struct bgp_node
*rn
;
2282 struct attr new_attr
;
2283 struct attr_extra new_extra
;
2284 struct attr
*attr_new
;
2285 struct bgp_info
*ri
;
2286 struct bgp_info
*new;
2288 char buf
[SU_ADDRSTRLEN
];
2292 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2294 /* When peer's soft reconfiguration enabled. Record input packet in
2296 if (! soft_reconfig
&& CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2297 && peer
!= bgp
->peer_self
)
2298 bgp_adj_in_set (rn
, peer
, attr
);
2300 /* Check previously received route. */
2301 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2302 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2305 /* AS path local-as loop check. */
2306 if (peer
->change_local_as
)
2308 if (! CHECK_FLAG (peer
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
2309 aspath_loop_count
= 1;
2311 if (aspath_loop_check (attr
->aspath
, peer
->change_local_as
) > aspath_loop_count
)
2313 reason
= "as-path contains our own AS;";
2318 /* AS path loop check. */
2319 if (aspath_loop_check (attr
->aspath
, bgp
->as
) > peer
->allowas_in
[afi
][safi
]
2320 || (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
2321 && aspath_loop_check(attr
->aspath
, bgp
->confed_id
)
2322 > peer
->allowas_in
[afi
][safi
]))
2324 reason
= "as-path contains our own AS;";
2328 /* Route reflector originator ID check. */
2329 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
2330 && IPV4_ADDR_SAME (&bgp
->router_id
, &attr
->extra
->originator_id
))
2332 reason
= "originator is us;";
2336 /* Route reflector cluster ID check. */
2337 if (bgp_cluster_filter (peer
, attr
))
2339 reason
= "reflected from the same cluster;";
2343 /* Apply incoming filter. */
2344 if (bgp_input_filter (peer
, p
, attr
, afi
, safi
) == FILTER_DENY
)
2350 new_attr
.extra
= &new_extra
;
2351 bgp_attr_dup (&new_attr
, attr
);
2353 /* Apply incoming route-map.
2354 * NB: new_attr may now contain newly allocated values from route-map "set"
2355 * commands, so we need bgp_attr_flush in the error paths, until we intern
2356 * the attr (which takes over the memory references) */
2357 if (bgp_input_modifier (peer
, p
, &new_attr
, afi
, safi
, NULL
) == RMAP_DENY
)
2359 reason
= "route-map;";
2360 bgp_attr_flush (&new_attr
);
2364 /* IPv4 unicast next hop check. */
2365 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2367 /* Next hop must not be 0.0.0.0 nor Class D/E address. Next hop
2368 must not be my own address. */
2369 if (new_attr
.nexthop
.s_addr
== 0
2370 || IPV4_CLASS_DE (ntohl (new_attr
.nexthop
.s_addr
))
2371 || bgp_nexthop_self (&new_attr
))
2373 reason
= "martian next-hop;";
2374 bgp_attr_flush (&new_attr
);
2379 attr_new
= bgp_attr_intern (&new_attr
);
2381 /* If the update is implicit withdraw. */
2384 ri
->uptime
= bgp_clock ();
2386 /* Same attribute comes in. */
2387 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
)
2388 && attrhash_cmp (ri
->attr
, attr_new
))
2390 bgp_info_unset_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
2392 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2393 && peer
->sort
== BGP_PEER_EBGP
2394 && CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2396 if (BGP_DEBUG (update
, UPDATE_IN
))
2397 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2399 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2402 if (bgp_damp_update (ri
, rn
, afi
, safi
) != BGP_DAMP_SUPPRESSED
)
2404 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2405 bgp_process (bgp
, rn
, afi
, safi
);
2408 else /* Duplicate - odd */
2410 if (BGP_DEBUG (update
, UPDATE_IN
))
2411 zlog (peer
->log
, LOG_DEBUG
,
2412 "%s rcvd %s/%d...duplicate ignored",
2414 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2417 /* graceful restart STALE flag unset. */
2418 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2420 bgp_info_unset_flag (rn
, ri
, BGP_INFO_STALE
);
2421 bgp_process (bgp
, rn
, afi
, safi
);
2425 bgp_unlock_node (rn
);
2426 bgp_attr_unintern (&attr_new
);
2431 /* Withdraw/Announce before we fully processed the withdraw */
2432 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
2434 if (BGP_DEBUG (update
, UPDATE_IN
))
2435 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d, flapped quicker than processing",
2437 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2439 bgp_info_restore (rn
, ri
);
2442 /* Received Logging. */
2443 if (BGP_DEBUG (update
, UPDATE_IN
))
2444 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2446 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2449 /* graceful restart STALE flag unset. */
2450 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2451 bgp_info_unset_flag (rn
, ri
, BGP_INFO_STALE
);
2453 /* The attribute is changed. */
2454 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
2456 /* implicit withdraw, decrement aggregate and pcount here.
2457 * only if update is accepted, they'll increment below.
2459 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
2461 /* Update bgp route dampening information. */
2462 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2463 && peer
->sort
== BGP_PEER_EBGP
)
2465 /* This is implicit withdraw so we should update dampening
2467 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2468 bgp_damp_withdraw (ri
, rn
, afi
, safi
, 1);
2471 /* Update to new attribute. */
2472 bgp_attr_unintern (&ri
->attr
);
2473 ri
->attr
= attr_new
;
2475 /* Update MPLS tag. */
2476 if (safi
== SAFI_MPLS_VPN
)
2477 memcpy ((bgp_info_extra_get (ri
))->tag
, tag
, 3);
2479 /* Update bgp route dampening information. */
2480 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2481 && peer
->sort
== BGP_PEER_EBGP
)
2483 /* Now we do normal update dampening. */
2484 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
2485 if (ret
== BGP_DAMP_SUPPRESSED
)
2487 bgp_unlock_node (rn
);
2492 /* Nexthop reachability check. */
2493 if ((afi
== AFI_IP
|| afi
== AFI_IP6
) && safi
== SAFI_UNICAST
)
2495 if (peer
->sort
== BGP_PEER_EBGP
&& peer
->ttl
== 1 &&
2496 ! CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
))
2501 if (bgp_find_or_add_nexthop (afi
, ri
, NULL
, connected
))
2502 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
2505 if (BGP_DEBUG(nht
, NHT
))
2507 char buf1
[INET6_ADDRSTRLEN
];
2508 inet_ntop(AF_INET
, (const void *)&attr_new
->nexthop
, buf1
, INET6_ADDRSTRLEN
);
2509 zlog_debug("%s(%s): NH unresolved", __FUNCTION__
, buf1
);
2511 bgp_info_unset_flag (rn
, ri
, BGP_INFO_VALID
);
2515 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
2517 /* Process change. */
2518 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2520 bgp_process (bgp
, rn
, afi
, safi
);
2521 bgp_unlock_node (rn
);
2526 /* Received Logging. */
2527 if (BGP_DEBUG (update
, UPDATE_IN
))
2529 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2531 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2535 /* Make new BGP info. */
2536 new = info_make(type
, sub_type
, peer
, attr_new
, rn
);
2538 /* Update MPLS tag. */
2539 if (safi
== SAFI_MPLS_VPN
)
2540 memcpy ((bgp_info_extra_get (new))->tag
, tag
, 3);
2542 /* Nexthop reachability check. */
2543 if ((afi
== AFI_IP
|| afi
== AFI_IP6
) && safi
== SAFI_UNICAST
)
2545 if (peer
->sort
== BGP_PEER_EBGP
&& peer
->ttl
== 1 &&
2546 ! CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
))
2551 if (bgp_find_or_add_nexthop (afi
, new, NULL
, connected
))
2552 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2555 if (BGP_DEBUG(nht
, NHT
))
2557 char buf1
[INET6_ADDRSTRLEN
];
2558 inet_ntop(AF_INET
, (const void *)&attr_new
->nexthop
, buf1
, INET6_ADDRSTRLEN
);
2559 zlog_debug("%s(%s): NH unresolved", __FUNCTION__
, buf1
);
2561 bgp_info_unset_flag (rn
, new, BGP_INFO_VALID
);
2565 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2567 /* Increment prefix */
2568 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
2570 /* Register new BGP information. */
2571 bgp_info_add (rn
, new);
2573 /* route_node_get lock */
2574 bgp_unlock_node (rn
);
2576 /* If maximum prefix count is configured and current prefix
2578 if (bgp_maximum_prefix_overflow (peer
, afi
, safi
, 0))
2581 /* Process change. */
2582 bgp_process (bgp
, rn
, afi
, safi
);
2586 /* This BGP update is filtered. Log the reason then update BGP
2589 if (BGP_DEBUG (update
, UPDATE_IN
))
2590 zlog (peer
->log
, LOG_DEBUG
,
2591 "%s rcvd UPDATE about %s/%d -- DENIED due to: %s",
2593 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2594 p
->prefixlen
, reason
);
2597 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2599 bgp_unlock_node (rn
);
2605 bgp_update (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2606 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2607 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
2609 struct peer
*rsclient
;
2610 struct listnode
*node
, *nnode
;
2614 ret
= bgp_update_main (peer
, p
, attr
, afi
, safi
, type
, sub_type
, prd
, tag
,
2619 /* Process the update for each RS-client. */
2620 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2622 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2623 bgp_update_rsclient (rsclient
, afi
, safi
, attr
, peer
, p
, type
,
2624 sub_type
, prd
, tag
);
2631 bgp_withdraw (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2632 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2633 struct prefix_rd
*prd
, u_char
*tag
)
2636 char buf
[SU_ADDRSTRLEN
];
2637 struct bgp_node
*rn
;
2638 struct bgp_info
*ri
;
2639 struct peer
*rsclient
;
2640 struct listnode
*node
, *nnode
;
2644 /* Process the withdraw for each RS-client. */
2645 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2647 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2648 bgp_withdraw_rsclient (rsclient
, afi
, safi
, peer
, p
, type
, sub_type
, prd
, tag
);
2652 if (BGP_DEBUG (update
, UPDATE_IN
))
2653 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd UPDATE about %s/%d -- withdrawn",
2655 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2659 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2661 /* If peer is soft reconfiguration enabled. Record input packet for
2662 further calculation. */
2663 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2664 && peer
!= bgp
->peer_self
)
2665 bgp_adj_in_unset (rn
, peer
);
2667 /* Lookup withdrawn route. */
2668 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2669 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2672 /* Withdraw specified route from routing table. */
2673 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2674 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
2675 else if (BGP_DEBUG (update
, UPDATE_IN
))
2676 zlog (peer
->log
, LOG_DEBUG
,
2677 "%s Can't find the route %s/%d", peer
->host
,
2678 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2681 /* Unlock bgp_node_get() lock. */
2682 bgp_unlock_node (rn
);
2688 bgp_default_originate (struct peer
*peer
, afi_t afi
, safi_t safi
, int withdraw
)
2692 struct aspath
*aspath
;
2695 struct bgp_node
*rn
;
2696 struct bgp_info
*ri
;
2697 int ret
= RMAP_DENYMATCH
;
2699 if (!(afi
== AFI_IP
|| afi
== AFI_IP6
))
2703 from
= bgp
->peer_self
;
2705 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
2706 aspath
= attr
.aspath
;
2707 attr
.local_pref
= bgp
->default_local_pref
;
2708 memcpy (&attr
.nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
2711 str2prefix ("0.0.0.0/0", &p
);
2713 else if (afi
== AFI_IP6
)
2715 struct attr_extra
*ae
= attr
.extra
;
2717 str2prefix ("::/0", &p
);
2719 /* IPv6 global nexthop must be included. */
2720 memcpy (&ae
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
2722 ae
->mp_nexthop_len
= 16;
2724 /* If the peer is on shared nextwork and we have link-local
2726 if (peer
->shared_network
2727 && !IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
2729 memcpy (&ae
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
2731 ae
->mp_nexthop_len
= 32;
2734 #endif /* HAVE_IPV6 */
2736 if (peer
->default_rmap
[afi
][safi
].name
)
2738 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_DEFAULT
);
2739 for (rn
= bgp_table_top(bgp
->rib
[afi
][safi
]); rn
; rn
= bgp_route_next(rn
))
2741 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2743 struct attr dummy_attr
;
2744 struct attr_extra dummy_extra
;
2745 struct bgp_info info
;
2747 /* Provide dummy so the route-map can't modify the attributes */
2748 dummy_attr
.extra
= &dummy_extra
;
2749 bgp_attr_dup(&dummy_attr
, ri
->attr
);
2750 info
.peer
= ri
->peer
;
2751 info
.attr
= &dummy_attr
;
2753 ret
= route_map_apply(peer
->default_rmap
[afi
][safi
].map
, &rn
->p
,
2756 /* The route map might have set attributes. If we don't flush them
2757 * here, they will be leaked. */
2758 bgp_attr_flush(&dummy_attr
);
2759 if (ret
!= RMAP_DENYMATCH
)
2762 if (ret
!= RMAP_DENYMATCH
)
2765 bgp
->peer_self
->rmap_type
= 0;
2767 if (ret
== RMAP_DENYMATCH
)
2773 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
2774 bgp_default_withdraw_send (peer
, afi
, safi
);
2775 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2779 if (! CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
2781 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2782 bgp_default_update_send (peer
, &attr
, afi
, safi
, from
);
2786 bgp_attr_extra_free (&attr
);
2787 aspath_unintern (&aspath
);
2791 bgp_announce_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2792 struct bgp_table
*table
, int rsclient
)
2794 struct bgp_node
*rn
;
2795 struct bgp_info
*ri
;
2797 struct attr_extra extra
;
2800 table
= (rsclient
) ? peer
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2802 if (safi
!= SAFI_MPLS_VPN
2803 && CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
2804 bgp_default_originate (peer
, afi
, safi
, 0);
2806 /* It's initialized in bgp_announce_[check|check_rsclient]() */
2807 attr
.extra
= &extra
;
2809 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next(rn
))
2810 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2811 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
) && ri
->peer
!= peer
)
2814 (bgp_announce_check_rsclient (ri
, peer
, &rn
->p
, &attr
, afi
, safi
))
2815 : (bgp_announce_check (ri
, peer
, &rn
->p
, &attr
, afi
, safi
)))
2816 bgp_adj_out_set (rn
, peer
, &rn
->p
, &attr
, afi
, safi
, ri
);
2818 bgp_adj_out_unset (rn
, peer
, &rn
->p
, afi
, safi
);
2823 bgp_announce_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2825 struct bgp_node
*rn
;
2826 struct bgp_table
*table
;
2828 if (peer
->status
!= Established
)
2831 if (! peer
->afc_nego
[afi
][safi
])
2834 /* First update is deferred until ORF or ROUTE-REFRESH is received */
2835 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
2838 if (safi
!= SAFI_MPLS_VPN
)
2839 bgp_announce_table (peer
, afi
, safi
, NULL
, 0);
2841 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2842 rn
= bgp_route_next(rn
))
2843 if ((table
= (rn
->info
)) != NULL
)
2844 bgp_announce_table (peer
, afi
, safi
, table
, 0);
2846 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2847 bgp_announce_table (peer
, afi
, safi
, NULL
, 1);
2850 * The write thread needs to be scheduled since it may not be done as
2851 * part of building adj_out.
2853 bgp_peer_schedule_updates(peer
);
2857 bgp_announce_route_all (struct peer
*peer
)
2862 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2863 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2864 bgp_announce_route (peer
, afi
, safi
);
2868 bgp_soft_reconfig_table_rsclient (struct peer
*rsclient
, afi_t afi
,
2869 safi_t safi
, struct bgp_table
*table
, struct prefix_rd
*prd
)
2871 struct bgp_node
*rn
;
2872 struct bgp_adj_in
*ain
;
2875 table
= rsclient
->bgp
->rib
[afi
][safi
];
2877 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2878 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2880 struct bgp_info
*ri
= rn
->info
;
2881 u_char
*tag
= (ri
&& ri
->extra
) ? ri
->extra
->tag
: NULL
;
2883 bgp_update_rsclient (rsclient
, afi
, safi
, ain
->attr
, ain
->peer
,
2884 &rn
->p
, ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, prd
, tag
);
2889 bgp_soft_reconfig_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
2891 struct bgp_table
*table
;
2892 struct bgp_node
*rn
;
2894 if (safi
!= SAFI_MPLS_VPN
)
2895 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, NULL
, NULL
);
2898 for (rn
= bgp_table_top (rsclient
->bgp
->rib
[afi
][safi
]); rn
;
2899 rn
= bgp_route_next (rn
))
2900 if ((table
= rn
->info
) != NULL
)
2902 struct prefix_rd prd
;
2903 prd
.family
= AF_UNSPEC
;
2905 memcpy(&prd
.val
, rn
->p
.u
.val
, 8);
2907 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, table
, &prd
);
2912 bgp_soft_reconfig_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2913 struct bgp_table
*table
, struct prefix_rd
*prd
)
2916 struct bgp_node
*rn
;
2917 struct bgp_adj_in
*ain
;
2920 table
= peer
->bgp
->rib
[afi
][safi
];
2922 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2923 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2925 if (ain
->peer
== peer
)
2927 struct bgp_info
*ri
= rn
->info
;
2928 u_char
*tag
= (ri
&& ri
->extra
) ? ri
->extra
->tag
: NULL
;
2930 ret
= bgp_update (peer
, &rn
->p
, ain
->attr
, afi
, safi
,
2931 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
,
2936 bgp_unlock_node (rn
);
2945 bgp_soft_reconfig_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2947 struct bgp_node
*rn
;
2948 struct bgp_table
*table
;
2950 if (peer
->status
!= Established
)
2953 if (safi
!= SAFI_MPLS_VPN
)
2954 bgp_soft_reconfig_table (peer
, afi
, safi
, NULL
, NULL
);
2956 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2957 rn
= bgp_route_next (rn
))
2958 if ((table
= rn
->info
) != NULL
)
2960 struct prefix_rd prd
;
2961 prd
.family
= AF_UNSPEC
;
2963 memcpy(&prd
.val
, rn
->p
.u
.val
, 8);
2965 bgp_soft_reconfig_table (peer
, afi
, safi
, table
, &prd
);
2970 struct bgp_clear_node_queue
2972 struct bgp_node
*rn
;
2973 enum bgp_clear_route_type purpose
;
2976 static wq_item_status
2977 bgp_clear_route_node (struct work_queue
*wq
, void *data
)
2979 struct bgp_clear_node_queue
*cnq
= data
;
2980 struct bgp_node
*rn
= cnq
->rn
;
2981 struct peer
*peer
= wq
->spec
.data
;
2982 struct bgp_info
*ri
;
2983 afi_t afi
= bgp_node_table (rn
)->afi
;
2984 safi_t safi
= bgp_node_table (rn
)->safi
;
2986 assert (rn
&& peer
);
2988 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2989 if (ri
->peer
== peer
|| cnq
->purpose
== BGP_CLEAR_ROUTE_MY_RSCLIENT
)
2991 /* graceful restart STALE flag set. */
2992 if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_NSF_WAIT
)
2993 && peer
->nsf
[afi
][safi
]
2994 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
)
2995 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
2996 bgp_info_set_flag (rn
, ri
, BGP_INFO_STALE
);
2998 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
3005 bgp_clear_node_queue_del (struct work_queue
*wq
, void *data
)
3007 struct bgp_clear_node_queue
*cnq
= data
;
3008 struct bgp_node
*rn
= cnq
->rn
;
3009 struct bgp_table
*table
= bgp_node_table (rn
);
3011 bgp_unlock_node (rn
);
3012 bgp_table_unlock (table
);
3013 XFREE (MTYPE_BGP_CLEAR_NODE_QUEUE
, cnq
);
3017 bgp_clear_node_complete (struct work_queue
*wq
)
3019 struct peer
*peer
= wq
->spec
.data
;
3021 /* Tickle FSM to start moving again */
3022 BGP_EVENT_ADD (peer
, Clearing_Completed
);
3024 peer_unlock (peer
); /* bgp_clear_route */
3028 bgp_clear_node_queue_init (struct peer
*peer
)
3030 char wname
[sizeof("clear xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx")];
3032 snprintf (wname
, sizeof(wname
), "clear %s", peer
->host
);
3033 #undef CLEAR_QUEUE_NAME_LEN
3035 if ( (peer
->clear_node_queue
= work_queue_new (bm
->master
, wname
)) == NULL
)
3037 zlog_err ("%s: Failed to allocate work queue", __func__
);
3040 peer
->clear_node_queue
->spec
.hold
= 10;
3041 peer
->clear_node_queue
->spec
.workfunc
= &bgp_clear_route_node
;
3042 peer
->clear_node_queue
->spec
.del_item_data
= &bgp_clear_node_queue_del
;
3043 peer
->clear_node_queue
->spec
.completion_func
= &bgp_clear_node_complete
;
3044 peer
->clear_node_queue
->spec
.max_retries
= 0;
3046 /* we only 'lock' this peer reference when the queue is actually active */
3047 peer
->clear_node_queue
->spec
.data
= peer
;
3051 bgp_clear_route_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
3052 struct bgp_table
*table
, struct peer
*rsclient
,
3053 enum bgp_clear_route_type purpose
)
3055 struct bgp_node
*rn
;
3059 table
= (rsclient
) ? rsclient
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
3061 /* If still no table => afi/safi isn't configured at all or smth. */
3065 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3067 struct bgp_info
*ri
;
3068 struct bgp_adj_in
*ain
;
3069 struct bgp_adj_out
*aout
;
3071 /* XXX:TODO: This is suboptimal, every non-empty route_node is
3072 * queued for every clearing peer, regardless of whether it is
3073 * relevant to the peer at hand.
3075 * Overview: There are 3 different indices which need to be
3076 * scrubbed, potentially, when a peer is removed:
3078 * 1 peer's routes visible via the RIB (ie accepted routes)
3079 * 2 peer's routes visible by the (optional) peer's adj-in index
3080 * 3 other routes visible by the peer's adj-out index
3082 * 3 there is no hurry in scrubbing, once the struct peer is
3083 * removed from bgp->peer, we could just GC such deleted peer's
3084 * adj-outs at our leisure.
3086 * 1 and 2 must be 'scrubbed' in some way, at least made
3087 * invisible via RIB index before peer session is allowed to be
3088 * brought back up. So one needs to know when such a 'search' is
3093 * - there'd be a single global queue or a single RIB walker
3094 * - rather than tracking which route_nodes still need to be
3095 * examined on a peer basis, we'd track which peers still
3098 * Given that our per-peer prefix-counts now should be reliable,
3099 * this may actually be achievable. It doesn't seem to be a huge
3100 * problem at this time,
3102 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
3103 if (ain
->peer
== peer
|| purpose
== BGP_CLEAR_ROUTE_MY_RSCLIENT
)
3105 bgp_adj_in_remove (rn
, ain
);
3106 bgp_unlock_node (rn
);
3109 for (aout
= rn
->adj_out
; aout
; aout
= aout
->next
)
3110 if (aout
->peer
== peer
|| purpose
== BGP_CLEAR_ROUTE_MY_RSCLIENT
)
3112 bgp_adj_out_remove (rn
, aout
, peer
, afi
, safi
);
3113 bgp_unlock_node (rn
);
3117 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3118 if (ri
->peer
== peer
|| purpose
== BGP_CLEAR_ROUTE_MY_RSCLIENT
)
3120 struct bgp_clear_node_queue
*cnq
;
3122 /* both unlocked in bgp_clear_node_queue_del */
3123 bgp_table_lock (bgp_node_table (rn
));
3125 cnq
= XCALLOC (MTYPE_BGP_CLEAR_NODE_QUEUE
,
3126 sizeof (struct bgp_clear_node_queue
));
3128 cnq
->purpose
= purpose
;
3129 work_queue_add (peer
->clear_node_queue
, cnq
);
3137 bgp_clear_route (struct peer
*peer
, afi_t afi
, safi_t safi
,
3138 enum bgp_clear_route_type purpose
)
3140 struct bgp_node
*rn
;
3141 struct bgp_table
*table
;
3142 struct peer
*rsclient
;
3143 struct listnode
*node
, *nnode
;
3145 if (peer
->clear_node_queue
== NULL
)
3146 bgp_clear_node_queue_init (peer
);
3148 /* bgp_fsm.c keeps sessions in state Clearing, not transitioning to
3149 * Idle until it receives a Clearing_Completed event. This protects
3150 * against peers which flap faster than we can we clear, which could
3153 * a) race with routes from the new session being installed before
3154 * clear_route_node visits the node (to delete the route of that
3156 * b) resource exhaustion, clear_route_node likely leads to an entry
3157 * on the process_main queue. Fast-flapping could cause that queue
3160 if (!peer
->clear_node_queue
->thread
)
3161 peer_lock (peer
); /* bgp_clear_node_complete */
3165 case BGP_CLEAR_ROUTE_NORMAL
:
3166 if (safi
!= SAFI_MPLS_VPN
)
3167 bgp_clear_route_table (peer
, afi
, safi
, NULL
, NULL
, purpose
);
3169 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
3170 rn
= bgp_route_next (rn
))
3171 if ((table
= rn
->info
) != NULL
)
3172 bgp_clear_route_table (peer
, afi
, safi
, table
, NULL
, purpose
);
3174 for (ALL_LIST_ELEMENTS (peer
->bgp
->rsclient
, node
, nnode
, rsclient
))
3175 if (CHECK_FLAG(rsclient
->af_flags
[afi
][safi
],
3176 PEER_FLAG_RSERVER_CLIENT
))
3177 bgp_clear_route_table (peer
, afi
, safi
, NULL
, rsclient
, purpose
);
3180 case BGP_CLEAR_ROUTE_MY_RSCLIENT
:
3181 bgp_clear_route_table (peer
, afi
, safi
, NULL
, peer
, purpose
);
3189 /* If no routes were cleared, nothing was added to workqueue, the
3190 * completion function won't be run by workqueue code - call it here.
3191 * XXX: Actually, this assumption doesn't hold, see
3192 * bgp_clear_route_table(), we queue all non-empty nodes.
3194 * Additionally, there is a presumption in FSM that clearing is only
3195 * really needed if peer state is Established - peers in
3196 * pre-Established states shouldn't have any route-update state
3197 * associated with them (in or out).
3199 * We still can get here in pre-Established though, through
3200 * peer_delete -> bgp_fsm_change_status, so this is a useful sanity
3201 * check to ensure the assumption above holds.
3203 * At some future point, this check could be move to the top of the
3204 * function, and do a quick early-return when state is
3205 * pre-Established, avoiding above list and table scans. Once we're
3208 if (!peer
->clear_node_queue
->thread
)
3209 bgp_clear_node_complete (peer
->clear_node_queue
);
3213 bgp_clear_route_all (struct peer
*peer
)
3218 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
3219 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
3220 bgp_clear_route (peer
, afi
, safi
, BGP_CLEAR_ROUTE_NORMAL
);
3224 bgp_clear_adj_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
3226 struct bgp_table
*table
;
3227 struct bgp_node
*rn
;
3228 struct bgp_adj_in
*ain
;
3230 table
= peer
->bgp
->rib
[afi
][safi
];
3232 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3233 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
3234 if (ain
->peer
== peer
)
3236 bgp_adj_in_remove (rn
, ain
);
3237 bgp_unlock_node (rn
);
3243 bgp_clear_stale_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
3245 struct bgp_node
*rn
;
3246 struct bgp_info
*ri
;
3247 struct bgp_table
*table
;
3249 table
= peer
->bgp
->rib
[afi
][safi
];
3251 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3253 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3254 if (ri
->peer
== peer
)
3256 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
3257 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
3263 /* Delete all kernel routes. */
3265 bgp_cleanup_routes (void)
3268 struct listnode
*node
, *nnode
;
3269 struct bgp_node
*rn
;
3270 struct bgp_table
*table
;
3271 struct bgp_info
*ri
;
3273 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
3275 table
= bgp
->rib
[AFI_IP
][SAFI_UNICAST
];
3277 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3278 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3279 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
3280 && ri
->type
== ZEBRA_ROUTE_BGP
3281 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
3282 bgp_zebra_withdraw (&rn
->p
, ri
,SAFI_UNICAST
);
3284 table
= bgp
->rib
[AFI_IP6
][SAFI_UNICAST
];
3286 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3287 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3288 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
3289 && ri
->type
== ZEBRA_ROUTE_BGP
3290 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
3291 bgp_zebra_withdraw (&rn
->p
, ri
,SAFI_UNICAST
);
3299 bgp_zclient_reset ();
3300 access_list_reset ();
3301 prefix_list_reset ();
3304 /* Parse NLRI stream. Withdraw NLRI is recognized by NULL attr
3307 bgp_nlri_parse (struct peer
*peer
, struct attr
*attr
, struct bgp_nlri
*packet
)
3315 /* Check peer status. */
3316 if (peer
->status
!= Established
)
3320 lim
= pnt
+ packet
->length
;
3322 for (; pnt
< lim
; pnt
+= psize
)
3324 /* Clear prefix structure. */
3325 memset (&p
, 0, sizeof (struct prefix
));
3327 /* Fetch prefix length. */
3328 p
.prefixlen
= *pnt
++;
3329 p
.family
= afi2family (packet
->afi
);
3331 /* Already checked in nlri_sanity_check(). We do double check
3333 if ((packet
->afi
== AFI_IP
&& p
.prefixlen
> 32)
3334 || (packet
->afi
== AFI_IP6
&& p
.prefixlen
> 128))
3337 /* Packet size overflow check. */
3338 psize
= PSIZE (p
.prefixlen
);
3340 /* When packet overflow occur return immediately. */
3341 if (pnt
+ psize
> lim
)
3344 /* Fetch prefix from NLRI packet. */
3345 memcpy (&p
.u
.prefix
, pnt
, psize
);
3347 /* Check address. */
3348 if (packet
->afi
== AFI_IP
&& packet
->safi
== SAFI_UNICAST
)
3350 if (IN_CLASSD (ntohl (p
.u
.prefix4
.s_addr
)))
3353 * From draft-ietf-idr-bgp4-22, Section 6.3:
3354 * If a BGP router receives an UPDATE message with a
3355 * semantically incorrect NLRI field, in which a prefix is
3356 * semantically incorrect (eg. an unexpected multicast IP
3357 * address), it should ignore the prefix.
3359 zlog (peer
->log
, LOG_ERR
,
3360 "IPv4 unicast NLRI is multicast address %s",
3361 inet_ntoa (p
.u
.prefix4
));
3368 /* Check address. */
3369 if (packet
->afi
== AFI_IP6
&& packet
->safi
== SAFI_UNICAST
)
3371 if (IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3375 zlog (peer
->log
, LOG_WARNING
,
3376 "IPv6 link-local NLRI received %s ignore this NLRI",
3377 inet_ntop (AF_INET6
, &p
.u
.prefix6
, buf
, BUFSIZ
));
3382 #endif /* HAVE_IPV6 */
3384 /* Normal process. */
3386 ret
= bgp_update (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
3387 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
, 0);
3389 ret
= bgp_withdraw (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
3390 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
3392 /* Address family configuration mismatch or maximum-prefix count
3398 /* Packet length consistency check. */
3405 /* NLRI encode syntax check routine. */
3407 bgp_nlri_sanity_check (struct peer
*peer
, int afi
, u_char
*pnt
,
3408 bgp_size_t length
, int *numpfx
)
3417 /* RFC1771 6.3 The NLRI field in the UPDATE message is checked for
3418 syntactic validity. If the field is syntactically incorrect,
3419 then the Error Subcode is set to Invalid Network Field. */
3425 /* Prefix length check. */
3426 if ((afi
== AFI_IP
&& prefixlen
> 32)
3427 || (afi
== AFI_IP6
&& prefixlen
> 128))
3429 plog_err (peer
->log
,
3430 "%s [Error] Update packet error (wrong prefix length %d)",
3431 peer
->host
, prefixlen
);
3432 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3433 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3437 /* Packet size overflow check. */
3438 psize
= PSIZE (prefixlen
);
3440 if (pnt
+ psize
> end
)
3442 plog_err (peer
->log
,
3443 "%s [Error] Update packet error"
3444 " (prefix data overflow prefix size is %d)",
3446 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3447 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3455 /* Packet length consistency check. */
3458 plog_err (peer
->log
,
3459 "%s [Error] Update packet error"
3460 " (prefix length mismatch with total length)",
3462 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3463 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3469 static struct bgp_static
*
3470 bgp_static_new (void)
3472 return XCALLOC (MTYPE_BGP_STATIC
, sizeof (struct bgp_static
));
3476 bgp_static_free (struct bgp_static
*bgp_static
)
3478 if (bgp_static
->rmap
.name
)
3479 free (bgp_static
->rmap
.name
);
3480 XFREE (MTYPE_BGP_STATIC
, bgp_static
);
3484 bgp_static_withdraw_rsclient (struct bgp
*bgp
, struct peer
*rsclient
,
3485 struct prefix
*p
, afi_t afi
, safi_t safi
)
3487 struct bgp_node
*rn
;
3488 struct bgp_info
*ri
;
3490 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3492 /* Check selected route and self inserted route. */
3493 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3494 if (ri
->peer
== bgp
->peer_self
3495 && ri
->type
== ZEBRA_ROUTE_BGP
3496 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3499 /* Withdraw static BGP route from routing table. */
3502 bgp_info_delete (rn
, ri
);
3503 bgp_process (bgp
, rn
, afi
, safi
);
3506 /* Unlock bgp_node_lookup. */
3507 bgp_unlock_node (rn
);
3511 bgp_static_update_rsclient (struct peer
*rsclient
, struct prefix
*p
,
3512 struct bgp_static
*bgp_static
,
3513 afi_t afi
, safi_t safi
)
3515 struct bgp_node
*rn
;
3516 struct bgp_info
*ri
;
3517 struct bgp_info
*new;
3518 struct bgp_info info
;
3519 struct attr
*attr_new
;
3521 struct attr new_attr
;
3522 struct attr_extra new_extra
;
3525 char buf
[SU_ADDRSTRLEN
];
3527 bgp
= rsclient
->bgp
;
3529 assert (bgp_static
);
3533 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3535 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3537 attr
.nexthop
= bgp_static
->igpnexthop
;
3538 attr
.med
= bgp_static
->igpmetric
;
3539 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3541 if (bgp_static
->atomic
)
3542 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3544 /* Apply network route-map for export to this rsclient. */
3545 if (bgp_static
->rmap
.name
)
3547 struct attr attr_tmp
= attr
;
3548 info
.peer
= rsclient
;
3549 info
.attr
= &attr_tmp
;
3551 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
3552 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3554 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3556 rsclient
->rmap_type
= 0;
3558 if (ret
== RMAP_DENYMATCH
)
3560 /* Free uninterned attribute. */
3561 bgp_attr_flush (&attr_tmp
);
3563 /* Unintern original. */
3564 aspath_unintern (&attr
.aspath
);
3565 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
3566 bgp_attr_extra_free (&attr
);
3570 attr_new
= bgp_attr_intern (&attr_tmp
);
3573 attr_new
= bgp_attr_intern (&attr
);
3575 new_attr
.extra
= &new_extra
;
3576 bgp_attr_dup(&new_attr
, attr_new
);
3578 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3580 if (bgp_import_modifier (rsclient
, bgp
->peer_self
, p
, &new_attr
, afi
, safi
)
3583 /* This BGP update is filtered. Log the reason then update BGP entry. */
3584 if (BGP_DEBUG (update
, UPDATE_IN
))
3585 zlog (rsclient
->log
, LOG_DEBUG
,
3586 "Static UPDATE about %s/%d -- DENIED for RS-client %s due to: import-policy",
3587 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
3588 p
->prefixlen
, rsclient
->host
);
3590 bgp
->peer_self
->rmap_type
= 0;
3592 bgp_attr_unintern (&attr_new
);
3593 aspath_unintern (&attr
.aspath
);
3594 bgp_attr_extra_free (&attr
);
3596 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
3601 bgp
->peer_self
->rmap_type
= 0;
3603 bgp_attr_unintern (&attr_new
);
3604 attr_new
= bgp_attr_intern (&new_attr
);
3606 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3607 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3608 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3613 if (attrhash_cmp (ri
->attr
, attr_new
) &&
3614 !CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3616 bgp_unlock_node (rn
);
3617 bgp_attr_unintern (&attr_new
);
3618 aspath_unintern (&attr
.aspath
);
3619 bgp_attr_extra_free (&attr
);
3624 /* The attribute is changed. */
3625 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
3627 /* Rewrite BGP route information. */
3628 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3629 bgp_info_restore(rn
, ri
);
3630 bgp_attr_unintern (&ri
->attr
);
3631 ri
->attr
= attr_new
;
3632 ri
->uptime
= bgp_clock ();
3634 /* Nexthop reachability check. */
3635 if (bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3637 if (bgp_find_or_add_nexthop (afi
, ri
, NULL
, 0))
3638 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
3641 if (BGP_DEBUG(nht
, NHT
))
3643 char buf1
[INET6_ADDRSTRLEN
];
3644 inet_ntop(AF_INET
, (const void *)&attr_new
->nexthop
,
3645 buf1
, INET6_ADDRSTRLEN
);
3646 zlog_debug("%s(%s): NH unresolved", __FUNCTION__
, buf1
);
3648 bgp_info_unset_flag (rn
, ri
, BGP_INFO_VALID
);
3651 /* Process change. */
3652 bgp_process (bgp
, rn
, afi
, safi
);
3653 bgp_unlock_node (rn
);
3654 aspath_unintern (&attr
.aspath
);
3655 bgp_attr_extra_free (&attr
);
3660 /* Make new BGP info. */
3661 new = info_make(ZEBRA_ROUTE_BGP
, BGP_ROUTE_STATIC
, bgp
->peer_self
,
3663 /* Nexthop reachability check. */
3664 if (bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3666 if (bgp_find_or_add_nexthop (afi
, new, NULL
, 0))
3667 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
3670 if (BGP_DEBUG(nht
, NHT
))
3672 char buf1
[INET6_ADDRSTRLEN
];
3673 inet_ntop(AF_INET
, (const void *)&attr_new
->nexthop
,
3674 buf1
, INET6_ADDRSTRLEN
);
3675 zlog_debug("%s(%s): NH unresolved", __FUNCTION__
, buf1
);
3677 bgp_info_unset_flag (rn
, new, BGP_INFO_VALID
);
3681 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
3683 /* Register new BGP information. */
3684 bgp_info_add (rn
, new);
3686 /* route_node_get lock */
3687 bgp_unlock_node (rn
);
3689 /* Process change. */
3690 bgp_process (bgp
, rn
, afi
, safi
);
3692 /* Unintern original. */
3693 aspath_unintern (&attr
.aspath
);
3694 bgp_attr_extra_free (&attr
);
3698 bgp_static_update_main (struct bgp
*bgp
, struct prefix
*p
,
3699 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3701 struct bgp_node
*rn
;
3702 struct bgp_info
*ri
;
3703 struct bgp_info
*new;
3704 struct bgp_info info
;
3706 struct attr
*attr_new
;
3709 assert (bgp_static
);
3713 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3715 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3717 attr
.nexthop
= bgp_static
->igpnexthop
;
3718 attr
.med
= bgp_static
->igpmetric
;
3719 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3721 if (bgp_static
->atomic
)
3722 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3724 /* Apply route-map. */
3725 if (bgp_static
->rmap
.name
)
3727 struct attr attr_tmp
= attr
;
3728 info
.peer
= bgp
->peer_self
;
3729 info
.attr
= &attr_tmp
;
3731 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3733 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3735 bgp
->peer_self
->rmap_type
= 0;
3737 if (ret
== RMAP_DENYMATCH
)
3739 /* Free uninterned attribute. */
3740 bgp_attr_flush (&attr_tmp
);
3742 /* Unintern original. */
3743 aspath_unintern (&attr
.aspath
);
3744 bgp_attr_extra_free (&attr
);
3745 bgp_static_withdraw (bgp
, p
, afi
, safi
);
3748 attr_new
= bgp_attr_intern (&attr_tmp
);
3751 attr_new
= bgp_attr_intern (&attr
);
3753 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3754 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3755 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3760 if (attrhash_cmp (ri
->attr
, attr_new
) &&
3761 !CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3763 bgp_unlock_node (rn
);
3764 bgp_attr_unintern (&attr_new
);
3765 aspath_unintern (&attr
.aspath
);
3766 bgp_attr_extra_free (&attr
);
3771 /* The attribute is changed. */
3772 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
3774 /* Rewrite BGP route information. */
3775 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3776 bgp_info_restore(rn
, ri
);
3778 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3779 bgp_attr_unintern (&ri
->attr
);
3780 ri
->attr
= attr_new
;
3781 ri
->uptime
= bgp_clock ();
3783 /* Nexthop reachability check. */
3784 if (bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3786 if (bgp_find_or_add_nexthop (afi
, ri
, NULL
, 0))
3787 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
3790 if (BGP_DEBUG(nht
, NHT
))
3792 char buf1
[INET6_ADDRSTRLEN
];
3793 inet_ntop(AF_INET
, (const void *)&attr_new
->nexthop
,
3794 buf1
, INET6_ADDRSTRLEN
);
3795 zlog_debug("%s(%s): NH unresolved", __FUNCTION__
, buf1
);
3797 bgp_info_unset_flag (rn
, ri
, BGP_INFO_VALID
);
3800 /* Process change. */
3801 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
3802 bgp_process (bgp
, rn
, afi
, safi
);
3803 bgp_unlock_node (rn
);
3804 aspath_unintern (&attr
.aspath
);
3805 bgp_attr_extra_free (&attr
);
3810 /* Make new BGP info. */
3811 new = info_make(ZEBRA_ROUTE_BGP
, BGP_ROUTE_STATIC
, bgp
->peer_self
, attr_new
,
3813 /* Nexthop reachability check. */
3814 if (bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3816 if (bgp_find_or_add_nexthop (afi
, new, NULL
, 0))
3817 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
3820 if (BGP_DEBUG(nht
, NHT
))
3822 char buf1
[INET6_ADDRSTRLEN
];
3823 inet_ntop(AF_INET
, (const void *)&attr_new
->nexthop
, buf1
,
3825 zlog_debug("%s(%s): NH unresolved", __FUNCTION__
, buf1
);
3827 bgp_info_unset_flag (rn
, new, BGP_INFO_VALID
);
3831 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
3833 /* Aggregate address increment. */
3834 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3836 /* Register new BGP information. */
3837 bgp_info_add (rn
, new);
3839 /* route_node_get lock */
3840 bgp_unlock_node (rn
);
3842 /* Process change. */
3843 bgp_process (bgp
, rn
, afi
, safi
);
3845 /* Unintern original. */
3846 aspath_unintern (&attr
.aspath
);
3847 bgp_attr_extra_free (&attr
);
3851 bgp_static_update (struct bgp
*bgp
, struct prefix
*p
,
3852 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3854 struct peer
*rsclient
;
3855 struct listnode
*node
, *nnode
;
3857 bgp_static_update_main (bgp
, p
, bgp_static
, afi
, safi
);
3859 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
3861 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
3862 bgp_static_update_rsclient (rsclient
, p
, bgp_static
, afi
, safi
);
3867 bgp_static_update_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3868 safi_t safi
, struct prefix_rd
*prd
, u_char
*tag
)
3870 struct bgp_node
*rn
;
3871 struct bgp_info
*new;
3873 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3875 /* Make new BGP info. */
3876 new = info_make(ZEBRA_ROUTE_BGP
, BGP_ROUTE_STATIC
, bgp
->peer_self
,
3877 bgp_attr_default_intern(BGP_ORIGIN_IGP
), rn
);
3879 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3880 new->extra
= bgp_info_extra_new();
3881 memcpy (new->extra
->tag
, tag
, 3);
3883 /* Aggregate address increment. */
3884 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3886 /* Register new BGP information. */
3887 bgp_info_add (rn
, new);
3889 /* route_node_get lock */
3890 bgp_unlock_node (rn
);
3892 /* Process change. */
3893 bgp_process (bgp
, rn
, afi
, safi
);
3897 bgp_static_withdraw (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3900 struct bgp_node
*rn
;
3901 struct bgp_info
*ri
;
3903 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3905 /* Check selected route and self inserted route. */
3906 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3907 if (ri
->peer
== bgp
->peer_self
3908 && ri
->type
== ZEBRA_ROUTE_BGP
3909 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3912 /* Withdraw static BGP route from routing table. */
3915 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3916 bgp_unlink_nexthop(ri
);
3917 bgp_info_delete (rn
, ri
);
3918 bgp_process (bgp
, rn
, afi
, safi
);
3921 /* Unlock bgp_node_lookup. */
3922 bgp_unlock_node (rn
);
3926 bgp_check_local_routes_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
3928 struct bgp_static
*bgp_static
;
3930 struct bgp_node
*rn
;
3933 bgp
= rsclient
->bgp
;
3935 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3936 if ((bgp_static
= rn
->info
) != NULL
)
3940 bgp_static_update_rsclient (rsclient
, p
, bgp_static
,
3946 bgp_static_withdraw_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3947 safi_t safi
, struct prefix_rd
*prd
, u_char
*tag
)
3949 struct bgp_node
*rn
;
3950 struct bgp_info
*ri
;
3952 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3954 /* Check selected route and self inserted route. */
3955 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3956 if (ri
->peer
== bgp
->peer_self
3957 && ri
->type
== ZEBRA_ROUTE_BGP
3958 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3961 /* Withdraw static BGP route from routing table. */
3964 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3965 bgp_info_delete (rn
, ri
);
3966 bgp_process (bgp
, rn
, afi
, safi
);
3969 /* Unlock bgp_node_lookup. */
3970 bgp_unlock_node (rn
);
3973 /* Configure static BGP network. When user don't run zebra, static
3974 route should be installed as valid. */
3976 bgp_static_set (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3977 afi_t afi
, safi_t safi
, const char *rmap
, int backdoor
)
3981 struct bgp_static
*bgp_static
;
3982 struct bgp_node
*rn
;
3983 u_char need_update
= 0;
3985 /* Convert IP prefix string to struct prefix. */
3986 ret
= str2prefix (ip_str
, &p
);
3989 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3993 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3995 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3999 #endif /* HAVE_IPV6 */
4003 /* Set BGP static route configuration. */
4004 rn
= bgp_node_get (bgp
->route
[afi
][safi
], &p
);
4008 /* Configuration change. */
4009 bgp_static
= rn
->info
;
4011 /* Check previous routes are installed into BGP. */
4012 if (bgp_static
->valid
&& bgp_static
->backdoor
!= backdoor
)
4015 bgp_static
->backdoor
= backdoor
;
4019 if (bgp_static
->rmap
.name
)
4020 free (bgp_static
->rmap
.name
);
4021 bgp_static
->rmap
.name
= strdup (rmap
);
4022 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
4026 if (bgp_static
->rmap
.name
)
4027 free (bgp_static
->rmap
.name
);
4028 bgp_static
->rmap
.name
= NULL
;
4029 bgp_static
->rmap
.map
= NULL
;
4030 bgp_static
->valid
= 0;
4032 bgp_unlock_node (rn
);
4036 /* New configuration. */
4037 bgp_static
= bgp_static_new ();
4038 bgp_static
->backdoor
= backdoor
;
4039 bgp_static
->valid
= 0;
4040 bgp_static
->igpmetric
= 0;
4041 bgp_static
->igpnexthop
.s_addr
= 0;
4045 if (bgp_static
->rmap
.name
)
4046 free (bgp_static
->rmap
.name
);
4047 bgp_static
->rmap
.name
= strdup (rmap
);
4048 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
4050 rn
->info
= bgp_static
;
4053 bgp_static
->valid
= 1;
4055 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
4057 if (! bgp_static
->backdoor
)
4058 bgp_static_update (bgp
, &p
, bgp_static
, afi
, safi
);
4063 /* Configure static BGP network. */
4065 bgp_static_unset (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
4066 afi_t afi
, safi_t safi
)
4070 struct bgp_static
*bgp_static
;
4071 struct bgp_node
*rn
;
4073 /* Convert IP prefix string to struct prefix. */
4074 ret
= str2prefix (ip_str
, &p
);
4077 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
4081 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
4083 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
4087 #endif /* HAVE_IPV6 */
4091 rn
= bgp_node_lookup (bgp
->route
[afi
][safi
], &p
);
4094 vty_out (vty
, "%% Can't find specified static route configuration.%s",
4099 bgp_static
= rn
->info
;
4101 /* Update BGP RIB. */
4102 if (! bgp_static
->backdoor
)
4103 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
4105 /* Clear configuration. */
4106 bgp_unlink_nexthop(bgp_static
);
4107 bgp_static_free (bgp_static
);
4109 bgp_unlock_node (rn
);
4110 bgp_unlock_node (rn
);
4115 /* Called from bgp_delete(). Delete all static routes from the BGP
4118 bgp_static_delete (struct bgp
*bgp
)
4122 struct bgp_node
*rn
;
4123 struct bgp_node
*rm
;
4124 struct bgp_table
*table
;
4125 struct bgp_static
*bgp_static
;
4127 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
4128 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
4129 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
4130 if (rn
->info
!= NULL
)
4132 if (safi
== SAFI_MPLS_VPN
)
4136 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
4138 bgp_static
= rn
->info
;
4139 bgp_static_withdraw_vpnv4 (bgp
, &rm
->p
,
4140 AFI_IP
, SAFI_MPLS_VPN
,
4141 (struct prefix_rd
*)&rn
->p
,
4143 bgp_static_free (bgp_static
);
4145 bgp_unlock_node (rn
);
4150 bgp_static
= rn
->info
;
4151 bgp_static_withdraw (bgp
, &rn
->p
, afi
, safi
);
4152 bgp_static_free (bgp_static
);
4154 bgp_unlock_node (rn
);
4160 bgp_static_set_vpnv4 (struct vty
*vty
, const char *ip_str
, const char *rd_str
,
4161 const char *tag_str
)
4165 struct prefix_rd prd
;
4167 struct bgp_node
*prn
;
4168 struct bgp_node
*rn
;
4169 struct bgp_table
*table
;
4170 struct bgp_static
*bgp_static
;
4175 ret
= str2prefix (ip_str
, &p
);
4178 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
4183 ret
= str2prefix_rd (rd_str
, &prd
);
4186 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
4190 ret
= str2tag (tag_str
, tag
);
4193 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
4197 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
4198 (struct prefix
*)&prd
);
4199 if (prn
->info
== NULL
)
4200 prn
->info
= bgp_table_init (AFI_IP
, SAFI_MPLS_VPN
);
4202 bgp_unlock_node (prn
);
4205 rn
= bgp_node_get (table
, &p
);
4209 vty_out (vty
, "%% Same network configuration exists%s", VTY_NEWLINE
);
4210 bgp_unlock_node (rn
);
4214 /* New configuration. */
4215 bgp_static
= bgp_static_new ();
4216 bgp_static
->valid
= 1;
4217 memcpy (bgp_static
->tag
, tag
, 3);
4218 rn
->info
= bgp_static
;
4220 bgp_static_update_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
4226 /* Configure static BGP network. */
4228 bgp_static_unset_vpnv4 (struct vty
*vty
, const char *ip_str
,
4229 const char *rd_str
, const char *tag_str
)
4234 struct prefix_rd prd
;
4235 struct bgp_node
*prn
;
4236 struct bgp_node
*rn
;
4237 struct bgp_table
*table
;
4238 struct bgp_static
*bgp_static
;
4243 /* Convert IP prefix string to struct prefix. */
4244 ret
= str2prefix (ip_str
, &p
);
4247 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
4252 ret
= str2prefix_rd (rd_str
, &prd
);
4255 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
4259 ret
= str2tag (tag_str
, tag
);
4262 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
4266 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
4267 (struct prefix
*)&prd
);
4268 if (prn
->info
== NULL
)
4269 prn
->info
= bgp_table_init (AFI_IP
, SAFI_MPLS_VPN
);
4271 bgp_unlock_node (prn
);
4274 rn
= bgp_node_lookup (table
, &p
);
4278 bgp_static_withdraw_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
4280 bgp_static
= rn
->info
;
4281 bgp_static_free (bgp_static
);
4283 bgp_unlock_node (rn
);
4284 bgp_unlock_node (rn
);
4287 vty_out (vty
, "%% Can't find the route%s", VTY_NEWLINE
);
4293 bgp_table_map_set (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
4294 const char *rmap_name
)
4296 struct bgp_rmap
*rmap
;
4298 rmap
= &bgp
->table_map
[afi
][safi
];
4303 rmap
->name
= strdup (rmap_name
);
4304 rmap
->map
= route_map_lookup_by_name (rmap_name
);
4314 bgp_zebra_announce_table(bgp
, afi
, safi
);
4320 bgp_table_map_unset (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
4321 const char *rmap_name
)
4323 struct bgp_rmap
*rmap
;
4325 rmap
= &bgp
->table_map
[afi
][safi
];
4331 bgp_zebra_announce_table(bgp
, afi
, safi
);
4337 bgp_config_write_table_map (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
4338 safi_t safi
, int *write
)
4340 if (bgp
->table_map
[afi
][safi
].name
)
4342 bgp_config_write_family_header (vty
, afi
, safi
, write
);
4343 vty_out (vty
, " table-map %s%s",
4344 bgp
->table_map
[afi
][safi
].name
, VTY_NEWLINE
);
4351 DEFUN (bgp_table_map
,
4354 "BGP table to RIB route download filter\n"
4355 "Name of the route map\n")
4357 return bgp_table_map_set (vty
, vty
->index
,
4358 bgp_node_afi (vty
), bgp_node_safi (vty
), argv
[0]);
4360 DEFUN (no_bgp_table_map
,
4361 no_bgp_table_map_cmd
,
4362 "no table-map WORD",
4363 "BGP table to RIB route download filter\n"
4364 "Name of the route map\n")
4366 return bgp_table_map_unset (vty
, vty
->index
,
4367 bgp_node_afi (vty
), bgp_node_safi (vty
), argv
[0]);
4372 "network A.B.C.D/M",
4373 "Specify a network to announce via BGP\n"
4374 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
4376 return bgp_static_set (vty
, vty
->index
, argv
[0],
4377 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
4380 DEFUN (bgp_network_route_map
,
4381 bgp_network_route_map_cmd
,
4382 "network A.B.C.D/M route-map WORD",
4383 "Specify a network to announce via BGP\n"
4384 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4385 "Route-map to modify the attributes\n"
4386 "Name of the route map\n")
4388 return bgp_static_set (vty
, vty
->index
, argv
[0],
4389 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
4392 DEFUN (bgp_network_backdoor
,
4393 bgp_network_backdoor_cmd
,
4394 "network A.B.C.D/M backdoor",
4395 "Specify a network to announce via BGP\n"
4396 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4397 "Specify a BGP backdoor route\n")
4399 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP
, SAFI_UNICAST
,
4403 DEFUN (bgp_network_mask
,
4404 bgp_network_mask_cmd
,
4405 "network A.B.C.D mask A.B.C.D",
4406 "Specify a network to announce via BGP\n"
4412 char prefix_str
[BUFSIZ
];
4414 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4417 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4421 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4422 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
4425 DEFUN (bgp_network_mask_route_map
,
4426 bgp_network_mask_route_map_cmd
,
4427 "network A.B.C.D mask A.B.C.D route-map WORD",
4428 "Specify a network to announce via BGP\n"
4432 "Route-map to modify the attributes\n"
4433 "Name of the route map\n")
4436 char prefix_str
[BUFSIZ
];
4438 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4441 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4445 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4446 AFI_IP
, bgp_node_safi (vty
), argv
[2], 0);
4449 DEFUN (bgp_network_mask_backdoor
,
4450 bgp_network_mask_backdoor_cmd
,
4451 "network A.B.C.D mask A.B.C.D backdoor",
4452 "Specify a network to announce via BGP\n"
4456 "Specify a BGP backdoor route\n")
4459 char prefix_str
[BUFSIZ
];
4461 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4464 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4468 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
,
4472 DEFUN (bgp_network_mask_natural
,
4473 bgp_network_mask_natural_cmd
,
4475 "Specify a network to announce via BGP\n"
4479 char prefix_str
[BUFSIZ
];
4481 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4484 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4488 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4489 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
4492 DEFUN (bgp_network_mask_natural_route_map
,
4493 bgp_network_mask_natural_route_map_cmd
,
4494 "network A.B.C.D route-map WORD",
4495 "Specify a network to announce via BGP\n"
4497 "Route-map to modify the attributes\n"
4498 "Name of the route map\n")
4501 char prefix_str
[BUFSIZ
];
4503 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4506 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4510 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4511 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
4514 DEFUN (bgp_network_mask_natural_backdoor
,
4515 bgp_network_mask_natural_backdoor_cmd
,
4516 "network A.B.C.D backdoor",
4517 "Specify a network to announce via BGP\n"
4519 "Specify a BGP backdoor route\n")
4522 char prefix_str
[BUFSIZ
];
4524 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4527 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4531 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
,
4535 DEFUN (no_bgp_network
,
4537 "no network A.B.C.D/M",
4539 "Specify a network to announce via BGP\n"
4540 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
4542 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP
,
4543 bgp_node_safi (vty
));
4546 ALIAS (no_bgp_network
,
4547 no_bgp_network_route_map_cmd
,
4548 "no network A.B.C.D/M route-map WORD",
4550 "Specify a network to announce via BGP\n"
4551 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4552 "Route-map to modify the attributes\n"
4553 "Name of the route map\n")
4555 ALIAS (no_bgp_network
,
4556 no_bgp_network_backdoor_cmd
,
4557 "no network A.B.C.D/M backdoor",
4559 "Specify a network to announce via BGP\n"
4560 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4561 "Specify a BGP backdoor route\n")
4563 DEFUN (no_bgp_network_mask
,
4564 no_bgp_network_mask_cmd
,
4565 "no network A.B.C.D mask A.B.C.D",
4567 "Specify a network to announce via BGP\n"
4573 char prefix_str
[BUFSIZ
];
4575 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4578 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4582 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
4583 bgp_node_safi (vty
));
4586 ALIAS (no_bgp_network_mask
,
4587 no_bgp_network_mask_route_map_cmd
,
4588 "no network A.B.C.D mask A.B.C.D route-map WORD",
4590 "Specify a network to announce via BGP\n"
4594 "Route-map to modify the attributes\n"
4595 "Name of the route map\n")
4597 ALIAS (no_bgp_network_mask
,
4598 no_bgp_network_mask_backdoor_cmd
,
4599 "no network A.B.C.D mask A.B.C.D backdoor",
4601 "Specify a network to announce via BGP\n"
4605 "Specify a BGP backdoor route\n")
4607 DEFUN (no_bgp_network_mask_natural
,
4608 no_bgp_network_mask_natural_cmd
,
4609 "no network A.B.C.D",
4611 "Specify a network to announce via BGP\n"
4615 char prefix_str
[BUFSIZ
];
4617 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4620 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4624 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
4625 bgp_node_safi (vty
));
4628 ALIAS (no_bgp_network_mask_natural
,
4629 no_bgp_network_mask_natural_route_map_cmd
,
4630 "no network A.B.C.D route-map WORD",
4632 "Specify a network to announce via BGP\n"
4634 "Route-map to modify the attributes\n"
4635 "Name of the route map\n")
4637 ALIAS (no_bgp_network_mask_natural
,
4638 no_bgp_network_mask_natural_backdoor_cmd
,
4639 "no network A.B.C.D backdoor",
4641 "Specify a network to announce via BGP\n"
4643 "Specify a BGP backdoor route\n")
4646 DEFUN (ipv6_bgp_network
,
4647 ipv6_bgp_network_cmd
,
4648 "network X:X::X:X/M",
4649 "Specify a network to announce via BGP\n"
4650 "IPv6 prefix <network>/<length>\n")
4652 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
, bgp_node_safi(vty
),
4656 DEFUN (ipv6_bgp_network_route_map
,
4657 ipv6_bgp_network_route_map_cmd
,
4658 "network X:X::X:X/M route-map WORD",
4659 "Specify a network to announce via BGP\n"
4660 "IPv6 prefix <network>/<length>\n"
4661 "Route-map to modify the attributes\n"
4662 "Name of the route map\n")
4664 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
,
4665 bgp_node_safi (vty
), argv
[1], 0);
4668 DEFUN (no_ipv6_bgp_network
,
4669 no_ipv6_bgp_network_cmd
,
4670 "no network X:X::X:X/M",
4672 "Specify a network to announce via BGP\n"
4673 "IPv6 prefix <network>/<length>\n")
4675 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP6
, bgp_node_safi(vty
));
4678 ALIAS (no_ipv6_bgp_network
,
4679 no_ipv6_bgp_network_route_map_cmd
,
4680 "no network X:X::X:X/M route-map WORD",
4682 "Specify a network to announce via BGP\n"
4683 "IPv6 prefix <network>/<length>\n"
4684 "Route-map to modify the attributes\n"
4685 "Name of the route map\n")
4687 ALIAS (ipv6_bgp_network
,
4688 old_ipv6_bgp_network_cmd
,
4689 "ipv6 bgp network X:X::X:X/M",
4692 "Specify a network to announce via BGP\n"
4693 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
4695 ALIAS (no_ipv6_bgp_network
,
4696 old_no_ipv6_bgp_network_cmd
,
4697 "no ipv6 bgp network X:X::X:X/M",
4701 "Specify a network to announce via BGP\n"
4702 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
4703 #endif /* HAVE_IPV6 */
4705 /* stubs for removed AS-Pathlimit commands, kept for config compatibility */
4706 ALIAS_DEPRECATED (bgp_network
,
4707 bgp_network_ttl_cmd
,
4708 "network A.B.C.D/M pathlimit <0-255>",
4709 "Specify a network to announce via BGP\n"
4710 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4711 "AS-Path hopcount limit attribute\n"
4712 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4713 ALIAS_DEPRECATED (bgp_network_backdoor
,
4714 bgp_network_backdoor_ttl_cmd
,
4715 "network A.B.C.D/M backdoor pathlimit <0-255>",
4716 "Specify a network to announce via BGP\n"
4717 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4718 "Specify a BGP backdoor route\n"
4719 "AS-Path hopcount limit attribute\n"
4720 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4721 ALIAS_DEPRECATED (bgp_network_mask
,
4722 bgp_network_mask_ttl_cmd
,
4723 "network A.B.C.D mask A.B.C.D pathlimit <0-255>",
4724 "Specify a network to announce via BGP\n"
4728 "AS-Path hopcount limit attribute\n"
4729 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4730 ALIAS_DEPRECATED (bgp_network_mask_backdoor
,
4731 bgp_network_mask_backdoor_ttl_cmd
,
4732 "network A.B.C.D mask A.B.C.D backdoor pathlimit <0-255>",
4733 "Specify a network to announce via BGP\n"
4737 "Specify a BGP backdoor route\n"
4738 "AS-Path hopcount limit attribute\n"
4739 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4740 ALIAS_DEPRECATED (bgp_network_mask_natural
,
4741 bgp_network_mask_natural_ttl_cmd
,
4742 "network A.B.C.D pathlimit <0-255>",
4743 "Specify a network to announce via BGP\n"
4745 "AS-Path hopcount limit attribute\n"
4746 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4747 ALIAS_DEPRECATED (bgp_network_mask_natural_backdoor
,
4748 bgp_network_mask_natural_backdoor_ttl_cmd
,
4749 "network A.B.C.D backdoor pathlimit <1-255>",
4750 "Specify a network to announce via BGP\n"
4752 "Specify a BGP backdoor route\n"
4753 "AS-Path hopcount limit attribute\n"
4754 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4755 ALIAS_DEPRECATED (no_bgp_network
,
4756 no_bgp_network_ttl_cmd
,
4757 "no network A.B.C.D/M pathlimit <0-255>",
4759 "Specify a network to announce via BGP\n"
4760 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4761 "AS-Path hopcount limit attribute\n"
4762 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4763 ALIAS_DEPRECATED (no_bgp_network
,
4764 no_bgp_network_backdoor_ttl_cmd
,
4765 "no network A.B.C.D/M backdoor pathlimit <0-255>",
4767 "Specify a network to announce via BGP\n"
4768 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4769 "Specify a BGP backdoor route\n"
4770 "AS-Path hopcount limit attribute\n"
4771 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4772 ALIAS_DEPRECATED (no_bgp_network
,
4773 no_bgp_network_mask_ttl_cmd
,
4774 "no network A.B.C.D mask A.B.C.D pathlimit <0-255>",
4776 "Specify a network to announce via BGP\n"
4780 "AS-Path hopcount limit attribute\n"
4781 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4782 ALIAS_DEPRECATED (no_bgp_network_mask
,
4783 no_bgp_network_mask_backdoor_ttl_cmd
,
4784 "no network A.B.C.D mask A.B.C.D backdoor pathlimit <0-255>",
4786 "Specify a network to announce via BGP\n"
4790 "Specify a BGP backdoor route\n"
4791 "AS-Path hopcount limit attribute\n"
4792 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4793 ALIAS_DEPRECATED (no_bgp_network_mask_natural
,
4794 no_bgp_network_mask_natural_ttl_cmd
,
4795 "no network A.B.C.D pathlimit <0-255>",
4797 "Specify a network to announce via BGP\n"
4799 "AS-Path hopcount limit attribute\n"
4800 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4801 ALIAS_DEPRECATED (no_bgp_network_mask_natural
,
4802 no_bgp_network_mask_natural_backdoor_ttl_cmd
,
4803 "no network A.B.C.D backdoor pathlimit <0-255>",
4805 "Specify a network to announce via BGP\n"
4807 "Specify a BGP backdoor route\n"
4808 "AS-Path hopcount limit attribute\n"
4809 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4811 ALIAS_DEPRECATED (ipv6_bgp_network
,
4812 ipv6_bgp_network_ttl_cmd
,
4813 "network X:X::X:X/M pathlimit <0-255>",
4814 "Specify a network to announce via BGP\n"
4815 "IPv6 prefix <network>/<length>\n"
4816 "AS-Path hopcount limit attribute\n"
4817 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4818 ALIAS_DEPRECATED (no_ipv6_bgp_network
,
4819 no_ipv6_bgp_network_ttl_cmd
,
4820 "no network X:X::X:X/M pathlimit <0-255>",
4822 "Specify a network to announce via BGP\n"
4823 "IPv6 prefix <network>/<length>\n"
4824 "AS-Path hopcount limit attribute\n"
4825 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4826 #endif /* HAVE_IPV6 */
4828 /* Aggreagete address:
4830 advertise-map Set condition to advertise attribute
4831 as-set Generate AS set path information
4832 attribute-map Set attributes of aggregate
4833 route-map Set parameters of aggregate
4834 summary-only Filter more specific routes from updates
4835 suppress-map Conditionally filter more specific routes from updates
4838 struct bgp_aggregate
4840 /* Summary-only flag. */
4841 u_char summary_only
;
4843 /* AS set generation. */
4846 /* Route-map for aggregated route. */
4847 struct route_map
*map
;
4849 /* Suppress-count. */
4850 unsigned long count
;
4852 /* SAFI configuration. */
4856 static struct bgp_aggregate
*
4857 bgp_aggregate_new (void)
4859 return XCALLOC (MTYPE_BGP_AGGREGATE
, sizeof (struct bgp_aggregate
));
4863 bgp_aggregate_free (struct bgp_aggregate
*aggregate
)
4865 XFREE (MTYPE_BGP_AGGREGATE
, aggregate
);
4868 /* Update an aggregate as routes are added/removed from the BGP table */
4870 bgp_aggregate_route (struct bgp
*bgp
, struct prefix
*p
, struct bgp_info
*rinew
,
4871 afi_t afi
, safi_t safi
, struct bgp_info
*del
,
4872 struct bgp_aggregate
*aggregate
)
4874 struct bgp_table
*table
;
4875 struct bgp_node
*top
;
4876 struct bgp_node
*rn
;
4878 struct aspath
*aspath
= NULL
;
4879 struct aspath
*asmerge
= NULL
;
4880 struct community
*community
= NULL
;
4881 struct community
*commerge
= NULL
;
4882 struct in_addr nexthop
;
4884 struct bgp_info
*ri
;
4885 struct bgp_info
*new;
4887 unsigned long match
= 0;
4888 u_char atomic_aggregate
= 0;
4890 /* Record adding route's nexthop and med. */
4893 nexthop
= rinew
->attr
->nexthop
;
4894 med
= rinew
->attr
->med
;
4897 /* ORIGIN attribute: If at least one route among routes that are
4898 aggregated has ORIGIN with the value INCOMPLETE, then the
4899 aggregated route must have the ORIGIN attribute with the value
4900 INCOMPLETE. Otherwise, if at least one route among routes that
4901 are aggregated has ORIGIN with the value EGP, then the aggregated
4902 route must have the origin attribute with the value EGP. In all
4903 other case the value of the ORIGIN attribute of the aggregated
4904 route is INTERNAL. */
4905 origin
= BGP_ORIGIN_IGP
;
4907 table
= bgp
->rib
[afi
][safi
];
4909 top
= bgp_node_get (table
, p
);
4910 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4911 if (rn
->p
.prefixlen
> p
->prefixlen
)
4915 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4917 if (BGP_INFO_HOLDDOWN (ri
))
4920 if (del
&& ri
== del
)
4923 if (! rinew
&& first
)
4925 nexthop
= ri
->attr
->nexthop
;
4926 med
= ri
->attr
->med
;
4930 #ifdef AGGREGATE_NEXTHOP_CHECK
4931 if (! IPV4_ADDR_SAME (&ri
->attr
->nexthop
, &nexthop
)
4932 || ri
->attr
->med
!= med
)
4935 aspath_free (aspath
);
4937 community_free (community
);
4938 bgp_unlock_node (rn
);
4939 bgp_unlock_node (top
);
4942 #endif /* AGGREGATE_NEXTHOP_CHECK */
4944 if (ri
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
4945 atomic_aggregate
= 1;
4947 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4949 if (aggregate
->summary_only
)
4951 (bgp_info_extra_get (ri
))->suppress
++;
4952 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
4958 if (origin
< ri
->attr
->origin
)
4959 origin
= ri
->attr
->origin
;
4961 if (aggregate
->as_set
)
4965 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4966 aspath_free (aspath
);
4970 aspath
= aspath_dup (ri
->attr
->aspath
);
4972 if (ri
->attr
->community
)
4976 commerge
= community_merge (community
,
4977 ri
->attr
->community
);
4978 community
= community_uniq_sort (commerge
);
4979 community_free (commerge
);
4982 community
= community_dup (ri
->attr
->community
);
4988 bgp_process (bgp
, rn
, afi
, safi
);
4990 bgp_unlock_node (top
);
4996 if (aggregate
->summary_only
)
4997 (bgp_info_extra_get (rinew
))->suppress
++;
4999 if (origin
< rinew
->attr
->origin
)
5000 origin
= rinew
->attr
->origin
;
5002 if (aggregate
->as_set
)
5006 asmerge
= aspath_aggregate (aspath
, rinew
->attr
->aspath
);
5007 aspath_free (aspath
);
5011 aspath
= aspath_dup (rinew
->attr
->aspath
);
5013 if (rinew
->attr
->community
)
5017 commerge
= community_merge (community
,
5018 rinew
->attr
->community
);
5019 community
= community_uniq_sort (commerge
);
5020 community_free (commerge
);
5023 community
= community_dup (rinew
->attr
->community
);
5028 if (aggregate
->count
> 0)
5030 rn
= bgp_node_get (table
, p
);
5031 new = info_make(ZEBRA_ROUTE_BGP
, BGP_ROUTE_AGGREGATE
, bgp
->peer_self
,
5032 bgp_attr_aggregate_intern(bgp
, origin
, aspath
, community
,
5034 atomic_aggregate
), rn
);
5035 SET_FLAG (new->flags
, BGP_INFO_VALID
);
5037 bgp_info_add (rn
, new);
5038 bgp_unlock_node (rn
);
5039 bgp_process (bgp
, rn
, afi
, safi
);
5044 aspath_free (aspath
);
5046 community_free (community
);
5050 void bgp_aggregate_delete (struct bgp
*, struct prefix
*, afi_t
, safi_t
,
5051 struct bgp_aggregate
*);
5054 bgp_aggregate_increment (struct bgp
*bgp
, struct prefix
*p
,
5055 struct bgp_info
*ri
, afi_t afi
, safi_t safi
)
5057 struct bgp_node
*child
;
5058 struct bgp_node
*rn
;
5059 struct bgp_aggregate
*aggregate
;
5060 struct bgp_table
*table
;
5062 /* MPLS-VPN aggregation is not yet supported. */
5063 if (safi
== SAFI_MPLS_VPN
)
5066 table
= bgp
->aggregate
[afi
][safi
];
5068 /* No aggregates configured. */
5069 if (bgp_table_top_nolock (table
) == NULL
)
5072 if (p
->prefixlen
== 0)
5075 if (BGP_INFO_HOLDDOWN (ri
))
5078 child
= bgp_node_get (table
, p
);
5080 /* Aggregate address configuration check. */
5081 for (rn
= child
; rn
; rn
= bgp_node_parent_nolock (rn
))
5082 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
5084 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
5085 bgp_aggregate_route (bgp
, &rn
->p
, ri
, afi
, safi
, NULL
, aggregate
);
5087 bgp_unlock_node (child
);
5091 bgp_aggregate_decrement (struct bgp
*bgp
, struct prefix
*p
,
5092 struct bgp_info
*del
, afi_t afi
, safi_t safi
)
5094 struct bgp_node
*child
;
5095 struct bgp_node
*rn
;
5096 struct bgp_aggregate
*aggregate
;
5097 struct bgp_table
*table
;
5099 /* MPLS-VPN aggregation is not yet supported. */
5100 if (safi
== SAFI_MPLS_VPN
)
5103 table
= bgp
->aggregate
[afi
][safi
];
5105 /* No aggregates configured. */
5106 if (bgp_table_top_nolock (table
) == NULL
)
5109 if (p
->prefixlen
== 0)
5112 child
= bgp_node_get (table
, p
);
5114 /* Aggregate address configuration check. */
5115 for (rn
= child
; rn
; rn
= bgp_node_parent_nolock (rn
))
5116 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
5118 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
5119 bgp_aggregate_route (bgp
, &rn
->p
, NULL
, afi
, safi
, del
, aggregate
);
5121 bgp_unlock_node (child
);
5124 /* Called via bgp_aggregate_set when the user configures aggregate-address */
5126 bgp_aggregate_add (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
, safi_t safi
,
5127 struct bgp_aggregate
*aggregate
)
5129 struct bgp_table
*table
;
5130 struct bgp_node
*top
;
5131 struct bgp_node
*rn
;
5132 struct bgp_info
*new;
5133 struct bgp_info
*ri
;
5134 unsigned long match
;
5135 u_char origin
= BGP_ORIGIN_IGP
;
5136 struct aspath
*aspath
= NULL
;
5137 struct aspath
*asmerge
= NULL
;
5138 struct community
*community
= NULL
;
5139 struct community
*commerge
= NULL
;
5140 u_char atomic_aggregate
= 0;
5142 table
= bgp
->rib
[afi
][safi
];
5145 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
5147 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
5150 /* If routes exists below this node, generate aggregate routes. */
5151 top
= bgp_node_get (table
, p
);
5152 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
5153 if (rn
->p
.prefixlen
> p
->prefixlen
)
5157 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5159 if (BGP_INFO_HOLDDOWN (ri
))
5162 if (ri
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
5163 atomic_aggregate
= 1;
5165 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
5167 /* summary-only aggregate route suppress aggregated
5168 route announcement. */
5169 if (aggregate
->summary_only
)
5171 (bgp_info_extra_get (ri
))->suppress
++;
5172 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
5176 /* If at least one route among routes that are aggregated has
5177 * ORIGIN with the value INCOMPLETE, then the aggregated route
5178 * MUST have the ORIGIN attribute with the value INCOMPLETE.
5179 * Otherwise, if at least one route among routes that are
5180 * aggregated has ORIGIN with the value EGP, then the aggregated
5181 * route MUST have the ORIGIN attribute with the value EGP.
5183 if (origin
< ri
->attr
->origin
)
5184 origin
= ri
->attr
->origin
;
5186 /* as-set aggregate route generate origin, as path,
5187 community aggregation. */
5188 if (aggregate
->as_set
)
5192 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
5193 aspath_free (aspath
);
5197 aspath
= aspath_dup (ri
->attr
->aspath
);
5199 if (ri
->attr
->community
)
5203 commerge
= community_merge (community
,
5204 ri
->attr
->community
);
5205 community
= community_uniq_sort (commerge
);
5206 community_free (commerge
);
5209 community
= community_dup (ri
->attr
->community
);
5216 /* If this node is suppressed, process the change. */
5218 bgp_process (bgp
, rn
, afi
, safi
);
5220 bgp_unlock_node (top
);
5222 /* Add aggregate route to BGP table. */
5223 if (aggregate
->count
)
5225 rn
= bgp_node_get (table
, p
);
5226 new = info_make(ZEBRA_ROUTE_BGP
, BGP_ROUTE_AGGREGATE
, bgp
->peer_self
,
5227 bgp_attr_aggregate_intern(bgp
, origin
, aspath
, community
,
5229 atomic_aggregate
), rn
);
5230 SET_FLAG (new->flags
, BGP_INFO_VALID
);
5232 bgp_info_add (rn
, new);
5233 bgp_unlock_node (rn
);
5235 /* Process change. */
5236 bgp_process (bgp
, rn
, afi
, safi
);
5241 bgp_aggregate_delete (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
5242 safi_t safi
, struct bgp_aggregate
*aggregate
)
5244 struct bgp_table
*table
;
5245 struct bgp_node
*top
;
5246 struct bgp_node
*rn
;
5247 struct bgp_info
*ri
;
5248 unsigned long match
;
5250 table
= bgp
->rib
[afi
][safi
];
5252 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
5254 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
5257 /* If routes exists below this node, generate aggregate routes. */
5258 top
= bgp_node_get (table
, p
);
5259 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
5260 if (rn
->p
.prefixlen
> p
->prefixlen
)
5264 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5266 if (BGP_INFO_HOLDDOWN (ri
))
5269 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
5271 if (aggregate
->summary_only
&& ri
->extra
)
5273 ri
->extra
->suppress
--;
5275 if (ri
->extra
->suppress
== 0)
5277 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
5285 /* If this node was suppressed, process the change. */
5287 bgp_process (bgp
, rn
, afi
, safi
);
5289 bgp_unlock_node (top
);
5291 /* Delete aggregate route from BGP table. */
5292 rn
= bgp_node_get (table
, p
);
5294 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5295 if (ri
->peer
== bgp
->peer_self
5296 && ri
->type
== ZEBRA_ROUTE_BGP
5297 && ri
->sub_type
== BGP_ROUTE_AGGREGATE
)
5300 /* Withdraw static BGP route from routing table. */
5303 bgp_info_delete (rn
, ri
);
5304 bgp_process (bgp
, rn
, afi
, safi
);
5307 /* Unlock bgp_node_lookup. */
5308 bgp_unlock_node (rn
);
5311 /* Aggregate route attribute. */
5312 #define AGGREGATE_SUMMARY_ONLY 1
5313 #define AGGREGATE_AS_SET 1
5316 bgp_aggregate_unset (struct vty
*vty
, const char *prefix_str
,
5317 afi_t afi
, safi_t safi
)
5321 struct bgp_node
*rn
;
5323 struct bgp_aggregate
*aggregate
;
5325 /* Convert string to prefix structure. */
5326 ret
= str2prefix (prefix_str
, &p
);
5329 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
5334 /* Get BGP structure. */
5337 /* Old configuration check. */
5338 rn
= bgp_node_lookup (bgp
->aggregate
[afi
][safi
], &p
);
5341 vty_out (vty
, "%% There is no aggregate-address configuration.%s",
5346 aggregate
= rn
->info
;
5347 if (aggregate
->safi
& SAFI_UNICAST
)
5348 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
5349 if (aggregate
->safi
& SAFI_MULTICAST
)
5350 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
5352 /* Unlock aggregate address configuration. */
5354 bgp_aggregate_free (aggregate
);
5355 bgp_unlock_node (rn
);
5356 bgp_unlock_node (rn
);
5362 bgp_aggregate_set (struct vty
*vty
, const char *prefix_str
,
5363 afi_t afi
, safi_t safi
,
5364 u_char summary_only
, u_char as_set
)
5368 struct bgp_node
*rn
;
5370 struct bgp_aggregate
*aggregate
;
5372 /* Convert string to prefix structure. */
5373 ret
= str2prefix (prefix_str
, &p
);
5376 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
5381 /* Get BGP structure. */
5384 /* Old configuration check. */
5385 rn
= bgp_node_get (bgp
->aggregate
[afi
][safi
], &p
);
5389 vty_out (vty
, "There is already same aggregate network.%s", VTY_NEWLINE
);
5390 /* try to remove the old entry */
5391 ret
= bgp_aggregate_unset (vty
, prefix_str
, afi
, safi
);
5394 vty_out (vty
, "Error deleting aggregate.%s", VTY_NEWLINE
);
5395 bgp_unlock_node (rn
);
5400 /* Make aggregate address structure. */
5401 aggregate
= bgp_aggregate_new ();
5402 aggregate
->summary_only
= summary_only
;
5403 aggregate
->as_set
= as_set
;
5404 aggregate
->safi
= safi
;
5405 rn
->info
= aggregate
;
5407 /* Aggregate address insert into BGP routing table. */
5408 if (safi
& SAFI_UNICAST
)
5409 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
5410 if (safi
& SAFI_MULTICAST
)
5411 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
5416 DEFUN (aggregate_address
,
5417 aggregate_address_cmd
,
5418 "aggregate-address A.B.C.D/M",
5419 "Configure BGP aggregate entries\n"
5420 "Aggregate prefix\n")
5422 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
), 0, 0);
5425 DEFUN (aggregate_address_mask
,
5426 aggregate_address_mask_cmd
,
5427 "aggregate-address A.B.C.D A.B.C.D",
5428 "Configure BGP aggregate entries\n"
5429 "Aggregate address\n"
5433 char prefix_str
[BUFSIZ
];
5435 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5439 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5443 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5447 DEFUN (aggregate_address_summary_only
,
5448 aggregate_address_summary_only_cmd
,
5449 "aggregate-address A.B.C.D/M summary-only",
5450 "Configure BGP aggregate entries\n"
5451 "Aggregate prefix\n"
5452 "Filter more specific routes from updates\n")
5454 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5455 AGGREGATE_SUMMARY_ONLY
, 0);
5458 DEFUN (aggregate_address_mask_summary_only
,
5459 aggregate_address_mask_summary_only_cmd
,
5460 "aggregate-address A.B.C.D A.B.C.D summary-only",
5461 "Configure BGP aggregate entries\n"
5462 "Aggregate address\n"
5464 "Filter more specific routes from updates\n")
5467 char prefix_str
[BUFSIZ
];
5469 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5473 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5477 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5478 AGGREGATE_SUMMARY_ONLY
, 0);
5481 DEFUN (aggregate_address_as_set
,
5482 aggregate_address_as_set_cmd
,
5483 "aggregate-address A.B.C.D/M as-set",
5484 "Configure BGP aggregate entries\n"
5485 "Aggregate prefix\n"
5486 "Generate AS set path information\n")
5488 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5489 0, AGGREGATE_AS_SET
);
5492 DEFUN (aggregate_address_mask_as_set
,
5493 aggregate_address_mask_as_set_cmd
,
5494 "aggregate-address A.B.C.D A.B.C.D as-set",
5495 "Configure BGP aggregate entries\n"
5496 "Aggregate address\n"
5498 "Generate AS set path information\n")
5501 char prefix_str
[BUFSIZ
];
5503 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5507 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5511 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5512 0, AGGREGATE_AS_SET
);
5516 DEFUN (aggregate_address_as_set_summary
,
5517 aggregate_address_as_set_summary_cmd
,
5518 "aggregate-address A.B.C.D/M as-set summary-only",
5519 "Configure BGP aggregate entries\n"
5520 "Aggregate prefix\n"
5521 "Generate AS set path information\n"
5522 "Filter more specific routes from updates\n")
5524 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5525 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
5528 ALIAS (aggregate_address_as_set_summary
,
5529 aggregate_address_summary_as_set_cmd
,
5530 "aggregate-address A.B.C.D/M summary-only as-set",
5531 "Configure BGP aggregate entries\n"
5532 "Aggregate prefix\n"
5533 "Filter more specific routes from updates\n"
5534 "Generate AS set path information\n")
5536 DEFUN (aggregate_address_mask_as_set_summary
,
5537 aggregate_address_mask_as_set_summary_cmd
,
5538 "aggregate-address A.B.C.D A.B.C.D as-set summary-only",
5539 "Configure BGP aggregate entries\n"
5540 "Aggregate address\n"
5542 "Generate AS set path information\n"
5543 "Filter more specific routes from updates\n")
5546 char prefix_str
[BUFSIZ
];
5548 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5552 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5556 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5557 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
5560 ALIAS (aggregate_address_mask_as_set_summary
,
5561 aggregate_address_mask_summary_as_set_cmd
,
5562 "aggregate-address A.B.C.D A.B.C.D summary-only as-set",
5563 "Configure BGP aggregate entries\n"
5564 "Aggregate address\n"
5566 "Filter more specific routes from updates\n"
5567 "Generate AS set path information\n")
5569 DEFUN (no_aggregate_address
,
5570 no_aggregate_address_cmd
,
5571 "no aggregate-address A.B.C.D/M",
5573 "Configure BGP aggregate entries\n"
5574 "Aggregate prefix\n")
5576 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
));
5579 ALIAS (no_aggregate_address
,
5580 no_aggregate_address_summary_only_cmd
,
5581 "no aggregate-address A.B.C.D/M summary-only",
5583 "Configure BGP aggregate entries\n"
5584 "Aggregate prefix\n"
5585 "Filter more specific routes from updates\n")
5587 ALIAS (no_aggregate_address
,
5588 no_aggregate_address_as_set_cmd
,
5589 "no aggregate-address A.B.C.D/M as-set",
5591 "Configure BGP aggregate entries\n"
5592 "Aggregate prefix\n"
5593 "Generate AS set path information\n")
5595 ALIAS (no_aggregate_address
,
5596 no_aggregate_address_as_set_summary_cmd
,
5597 "no aggregate-address A.B.C.D/M as-set summary-only",
5599 "Configure BGP aggregate entries\n"
5600 "Aggregate prefix\n"
5601 "Generate AS set path information\n"
5602 "Filter more specific routes from updates\n")
5604 ALIAS (no_aggregate_address
,
5605 no_aggregate_address_summary_as_set_cmd
,
5606 "no aggregate-address A.B.C.D/M summary-only as-set",
5608 "Configure BGP aggregate entries\n"
5609 "Aggregate prefix\n"
5610 "Filter more specific routes from updates\n"
5611 "Generate AS set path information\n")
5613 DEFUN (no_aggregate_address_mask
,
5614 no_aggregate_address_mask_cmd
,
5615 "no aggregate-address A.B.C.D A.B.C.D",
5617 "Configure BGP aggregate entries\n"
5618 "Aggregate address\n"
5622 char prefix_str
[BUFSIZ
];
5624 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5628 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5632 return bgp_aggregate_unset (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
));
5635 ALIAS (no_aggregate_address_mask
,
5636 no_aggregate_address_mask_summary_only_cmd
,
5637 "no aggregate-address A.B.C.D A.B.C.D summary-only",
5639 "Configure BGP aggregate entries\n"
5640 "Aggregate address\n"
5642 "Filter more specific routes from updates\n")
5644 ALIAS (no_aggregate_address_mask
,
5645 no_aggregate_address_mask_as_set_cmd
,
5646 "no aggregate-address A.B.C.D A.B.C.D as-set",
5648 "Configure BGP aggregate entries\n"
5649 "Aggregate address\n"
5651 "Generate AS set path information\n")
5653 ALIAS (no_aggregate_address_mask
,
5654 no_aggregate_address_mask_as_set_summary_cmd
,
5655 "no aggregate-address A.B.C.D A.B.C.D as-set summary-only",
5657 "Configure BGP aggregate entries\n"
5658 "Aggregate address\n"
5660 "Generate AS set path information\n"
5661 "Filter more specific routes from updates\n")
5663 ALIAS (no_aggregate_address_mask
,
5664 no_aggregate_address_mask_summary_as_set_cmd
,
5665 "no aggregate-address A.B.C.D A.B.C.D summary-only as-set",
5667 "Configure BGP aggregate entries\n"
5668 "Aggregate address\n"
5670 "Filter more specific routes from updates\n"
5671 "Generate AS set path information\n")
5674 DEFUN (ipv6_aggregate_address
,
5675 ipv6_aggregate_address_cmd
,
5676 "aggregate-address X:X::X:X/M",
5677 "Configure BGP aggregate entries\n"
5678 "Aggregate prefix\n")
5680 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0, 0);
5683 DEFUN (ipv6_aggregate_address_summary_only
,
5684 ipv6_aggregate_address_summary_only_cmd
,
5685 "aggregate-address X:X::X:X/M summary-only",
5686 "Configure BGP aggregate entries\n"
5687 "Aggregate prefix\n"
5688 "Filter more specific routes from updates\n")
5690 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5691 AGGREGATE_SUMMARY_ONLY
, 0);
5694 DEFUN (no_ipv6_aggregate_address
,
5695 no_ipv6_aggregate_address_cmd
,
5696 "no aggregate-address X:X::X:X/M",
5698 "Configure BGP aggregate entries\n"
5699 "Aggregate prefix\n")
5701 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
5704 DEFUN (no_ipv6_aggregate_address_summary_only
,
5705 no_ipv6_aggregate_address_summary_only_cmd
,
5706 "no aggregate-address X:X::X:X/M summary-only",
5708 "Configure BGP aggregate entries\n"
5709 "Aggregate prefix\n"
5710 "Filter more specific routes from updates\n")
5712 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
5715 ALIAS (ipv6_aggregate_address
,
5716 old_ipv6_aggregate_address_cmd
,
5717 "ipv6 bgp aggregate-address X:X::X:X/M",
5720 "Configure BGP aggregate entries\n"
5721 "Aggregate prefix\n")
5723 ALIAS (ipv6_aggregate_address_summary_only
,
5724 old_ipv6_aggregate_address_summary_only_cmd
,
5725 "ipv6 bgp aggregate-address X:X::X:X/M summary-only",
5728 "Configure BGP aggregate entries\n"
5729 "Aggregate prefix\n"
5730 "Filter more specific routes from updates\n")
5732 ALIAS (no_ipv6_aggregate_address
,
5733 old_no_ipv6_aggregate_address_cmd
,
5734 "no ipv6 bgp aggregate-address X:X::X:X/M",
5738 "Configure BGP aggregate entries\n"
5739 "Aggregate prefix\n")
5741 ALIAS (no_ipv6_aggregate_address_summary_only
,
5742 old_no_ipv6_aggregate_address_summary_only_cmd
,
5743 "no ipv6 bgp aggregate-address X:X::X:X/M summary-only",
5747 "Configure BGP aggregate entries\n"
5748 "Aggregate prefix\n"
5749 "Filter more specific routes from updates\n")
5750 #endif /* HAVE_IPV6 */
5752 /* Redistribute route treatment. */
5754 bgp_redistribute_add (struct prefix
*p
, const struct in_addr
*nexthop
,
5755 const struct in6_addr
*nexthop6
, unsigned int ifindex
,
5756 u_int32_t metric
, u_char type
, u_short tag
)
5759 struct listnode
*node
, *nnode
;
5760 struct bgp_info
*new;
5761 struct bgp_info
*bi
;
5762 struct bgp_info info
;
5763 struct bgp_node
*bn
;
5765 struct attr
*new_attr
;
5769 /* Make default attribute. */
5770 bgp_attr_default_set (&attr
, BGP_ORIGIN_INCOMPLETE
);
5772 attr
.nexthop
= *nexthop
;
5773 attr
.nh_ifindex
= ifindex
;
5778 struct attr_extra
*extra
= bgp_attr_extra_get(&attr
);
5779 extra
->mp_nexthop_global
= *nexthop6
;
5780 extra
->mp_nexthop_len
= 16;
5785 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
5786 attr
.extra
->tag
= tag
;
5788 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
5790 afi
= family2afi (p
->family
);
5792 if (bgp
->redist
[afi
][type
])
5794 struct attr attr_new
;
5795 struct attr_extra extra_new
;
5797 /* Copy attribute for modification. */
5798 attr_new
.extra
= &extra_new
;
5799 bgp_attr_dup (&attr_new
, &attr
);
5801 if (bgp
->redist_metric_flag
[afi
][type
])
5802 attr_new
.med
= bgp
->redist_metric
[afi
][type
];
5804 /* Apply route-map. */
5805 if (bgp
->rmap
[afi
][type
].map
)
5807 info
.peer
= bgp
->peer_self
;
5808 info
.attr
= &attr_new
;
5810 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_REDISTRIBUTE
);
5812 ret
= route_map_apply (bgp
->rmap
[afi
][type
].map
, p
, RMAP_BGP
,
5815 bgp
->peer_self
->rmap_type
= 0;
5817 if (ret
== RMAP_DENYMATCH
)
5819 /* Free uninterned attribute. */
5820 bgp_attr_flush (&attr_new
);
5822 /* Unintern original. */
5823 aspath_unintern (&attr
.aspath
);
5824 bgp_attr_extra_free (&attr
);
5825 bgp_redistribute_delete (p
, type
);
5830 bn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
],
5831 afi
, SAFI_UNICAST
, p
, NULL
);
5833 new_attr
= bgp_attr_intern (&attr_new
);
5835 for (bi
= bn
->info
; bi
; bi
= bi
->next
)
5836 if (bi
->peer
== bgp
->peer_self
5837 && bi
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
5842 if (attrhash_cmp (bi
->attr
, new_attr
) &&
5843 !CHECK_FLAG(bi
->flags
, BGP_INFO_REMOVED
))
5845 bgp_attr_unintern (&new_attr
);
5846 aspath_unintern (&attr
.aspath
);
5847 bgp_attr_extra_free (&attr
);
5848 bgp_unlock_node (bn
);
5853 /* The attribute is changed. */
5854 bgp_info_set_flag (bn
, bi
, BGP_INFO_ATTR_CHANGED
);
5856 /* Rewrite BGP route information. */
5857 if (CHECK_FLAG(bi
->flags
, BGP_INFO_REMOVED
))
5858 bgp_info_restore(bn
, bi
);
5860 bgp_aggregate_decrement (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
5861 bgp_attr_unintern (&bi
->attr
);
5862 bi
->attr
= new_attr
;
5863 bi
->uptime
= bgp_clock ();
5865 /* Process change. */
5866 bgp_aggregate_increment (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
5867 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
5868 bgp_unlock_node (bn
);
5869 aspath_unintern (&attr
.aspath
);
5870 bgp_attr_extra_free (&attr
);
5875 new = info_make(type
, BGP_ROUTE_REDISTRIBUTE
, bgp
->peer_self
,
5877 SET_FLAG (new->flags
, BGP_INFO_VALID
);
5879 bgp_aggregate_increment (bgp
, p
, new, afi
, SAFI_UNICAST
);
5880 bgp_info_add (bn
, new);
5881 bgp_unlock_node (bn
);
5882 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
5886 /* Unintern original. */
5887 aspath_unintern (&attr
.aspath
);
5888 bgp_attr_extra_free (&attr
);
5892 bgp_redistribute_delete (struct prefix
*p
, u_char type
)
5895 struct listnode
*node
, *nnode
;
5897 struct bgp_node
*rn
;
5898 struct bgp_info
*ri
;
5900 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
5902 afi
= family2afi (p
->family
);
5904 if (bgp
->redist
[afi
][type
])
5906 rn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
], afi
, SAFI_UNICAST
, p
, NULL
);
5908 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5909 if (ri
->peer
== bgp
->peer_self
5910 && ri
->type
== type
)
5915 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, SAFI_UNICAST
);
5916 bgp_info_delete (rn
, ri
);
5917 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
5919 bgp_unlock_node (rn
);
5924 /* Withdraw specified route type's route. */
5926 bgp_redistribute_withdraw (struct bgp
*bgp
, afi_t afi
, int type
)
5928 struct bgp_node
*rn
;
5929 struct bgp_info
*ri
;
5930 struct bgp_table
*table
;
5932 table
= bgp
->rib
[afi
][SAFI_UNICAST
];
5934 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
5936 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5937 if (ri
->peer
== bgp
->peer_self
5938 && ri
->type
== type
)
5943 bgp_aggregate_decrement (bgp
, &rn
->p
, ri
, afi
, SAFI_UNICAST
);
5944 bgp_info_delete (rn
, ri
);
5945 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
5950 /* Static function to display route. */
5952 route_vty_out_route (struct prefix
*p
, struct vty
*vty
)
5955 u_int32_t destination
;
5958 if (p
->family
== AF_INET
)
5960 len
= vty_out (vty
, "%s", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
));
5961 destination
= ntohl (p
->u
.prefix4
.s_addr
);
5963 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
5964 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
5965 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
5966 || p
->u
.prefix4
.s_addr
== 0)
5968 /* When mask is natural, mask is not displayed. */
5971 len
+= vty_out (vty
, "/%d", p
->prefixlen
);
5974 len
= vty_out (vty
, "%s/%d", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
),
5979 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 20, " ");
5981 vty_out (vty
, "%*s", len
, " ");
5984 enum bgp_display_type
5989 /* Print the short form route status for a bgp_info */
5991 route_vty_short_status_out (struct vty
*vty
, struct bgp_info
*binfo
)
5993 /* Route status display. */
5994 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
5996 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
5998 else if (binfo
->extra
&& binfo
->extra
->suppress
)
6000 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6006 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6008 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
6010 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
6012 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_MULTIPATH
))
6017 /* Internal route. */
6018 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
6024 /* called from terminal list command */
6026 route_vty_out (struct vty
*vty
, struct prefix
*p
,
6027 struct bgp_info
*binfo
, int display
, safi_t safi
, char *delim
)
6031 /* short status lead text */
6032 route_vty_short_status_out (vty
, binfo
);
6035 vty_out (vty
, "%c", *delim
);
6037 /* print prefix and mask */
6039 route_vty_out_route (p
, vty
);
6041 vty_out (vty
, "%*s", 17, " ");
6044 vty_out (vty
, "%c", *delim
);
6046 /* Print attribute */
6050 if (p
->family
== AF_INET
)
6052 if (safi
== SAFI_MPLS_VPN
)
6053 vty_out (vty
, "%-16s",
6054 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
6056 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
6059 else if (p
->family
== AF_INET6
)
6064 len
= vty_out (vty
, "%s",
6065 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
6069 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
6071 vty_out (vty
, "%*s", len
, " ");
6073 #endif /* HAVE_IPV6 */
6076 vty_out (vty
, "%c", *delim
);
6078 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
6079 vty_out (vty
, "%10u", attr
->med
);
6084 vty_out (vty
, "%c", *delim
);
6086 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
6087 vty_out (vty
, "%7u", attr
->local_pref
);
6092 vty_out (vty
, "%c", *delim
);
6094 vty_out (vty
, "%7u ", (attr
->extra
? attr
->extra
->weight
: 0));
6097 vty_out (vty
, "%c", *delim
);
6101 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
6104 vty_out (vty
, "%c", *delim
);
6107 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
6109 vty_out (vty
, "%s", VTY_NEWLINE
);
6112 /* called from terminal list command */
6114 route_vty_out_tmp (struct vty
*vty
, struct prefix
*p
,
6115 struct attr
*attr
, safi_t safi
, char *delim
)
6117 /* Route status display. */
6123 vty_out (vty
, "%c", *delim
);
6125 /* print prefix and mask */
6126 route_vty_out_route (p
, vty
);
6129 vty_out (vty
, "%c", *delim
);
6131 /* Print attribute */
6134 if (p
->family
== AF_INET
)
6136 if (safi
== SAFI_MPLS_VPN
)
6137 vty_out (vty
, "%-16s",
6138 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
6140 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
6143 else if (p
->family
== AF_INET6
)
6148 assert (attr
->extra
);
6150 len
= vty_out (vty
, "%s",
6151 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
6155 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
6157 vty_out (vty
, "%*s", len
, " ");
6159 #endif /* HAVE_IPV6 */
6162 vty_out (vty
, "%c", *delim
);
6164 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
6165 vty_out (vty
, "%10u", attr
->med
);
6170 vty_out (vty
, "%c", *delim
);
6172 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
6173 vty_out (vty
, "%7u", attr
->local_pref
);
6178 vty_out (vty
, "%c", *delim
);
6180 vty_out (vty
, "%7u ", (attr
->extra
? attr
->extra
->weight
: 0));
6183 vty_out (vty
, "%c", *delim
);
6187 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
6190 vty_out (vty
, "%c", *delim
);
6193 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
6196 vty_out (vty
, "%s", VTY_NEWLINE
);
6200 route_vty_out_tag (struct vty
*vty
, struct prefix
*p
,
6201 struct bgp_info
*binfo
, int display
, safi_t safi
)
6204 u_int32_t label
= 0;
6209 /* short status lead text */
6210 route_vty_short_status_out (vty
, binfo
);
6212 /* print prefix and mask */
6214 route_vty_out_route (p
, vty
);
6216 vty_out (vty
, "%*s", 17, " ");
6218 /* Print attribute */
6222 if (p
->family
== AF_INET
)
6224 if (safi
== SAFI_MPLS_VPN
)
6225 vty_out (vty
, "%-16s",
6226 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
6228 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
6231 else if (p
->family
== AF_INET6
)
6233 assert (attr
->extra
);
6236 if (attr
->extra
->mp_nexthop_len
== 16)
6238 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
6240 else if (attr
->extra
->mp_nexthop_len
== 32)
6241 vty_out (vty
, "%s(%s)",
6242 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
6244 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_local
,
6248 #endif /* HAVE_IPV6 */
6251 label
= decode_label (binfo
->extra
->tag
);
6253 vty_out (vty
, "notag/%d", label
);
6255 vty_out (vty
, "%s", VTY_NEWLINE
);
6258 /* dampening route */
6260 damp_route_vty_out (struct vty
*vty
, struct prefix
*p
,
6261 struct bgp_info
*binfo
, int display
, safi_t safi
)
6265 char timebuf
[BGP_UPTIME_LEN
];
6267 /* short status lead text */
6268 route_vty_short_status_out (vty
, binfo
);
6270 /* print prefix and mask */
6272 route_vty_out_route (p
, vty
);
6274 vty_out (vty
, "%*s", 17, " ");
6276 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
6279 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 34, " ");
6281 vty_out (vty
, "%*s", len
, " ");
6283 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
, timebuf
, BGP_UPTIME_LEN
));
6285 /* Print attribute */
6291 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
6294 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
6296 vty_out (vty
, "%s", VTY_NEWLINE
);
6301 flap_route_vty_out (struct vty
*vty
, struct prefix
*p
,
6302 struct bgp_info
*binfo
, int display
, safi_t safi
)
6305 struct bgp_damp_info
*bdi
;
6306 char timebuf
[BGP_UPTIME_LEN
];
6312 bdi
= binfo
->extra
->damp_info
;
6314 /* short status lead text */
6315 route_vty_short_status_out (vty
, binfo
);
6317 /* print prefix and mask */
6319 route_vty_out_route (p
, vty
);
6321 vty_out (vty
, "%*s", 17, " ");
6323 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
6326 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 33, " ");
6328 vty_out (vty
, "%*s", len
, " ");
6330 len
= vty_out (vty
, "%d", bdi
->flap
);
6335 vty_out (vty
, "%*s ", len
, " ");
6337 vty_out (vty
, "%s ", peer_uptime (bdi
->start_time
,
6338 timebuf
, BGP_UPTIME_LEN
));
6340 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
)
6341 && ! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6342 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
, timebuf
, BGP_UPTIME_LEN
));
6344 vty_out (vty
, "%*s ", 8, " ");
6346 /* Print attribute */
6352 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
6355 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
6357 vty_out (vty
, "%s", VTY_NEWLINE
);
6361 route_vty_out_detail (struct vty
*vty
, struct bgp
*bgp
, struct prefix
*p
,
6362 struct bgp_info
*binfo
, afi_t afi
, safi_t safi
)
6364 char buf
[INET6_ADDRSTRLEN
];
6367 int sockunion_vty_out (struct vty
*, union sockunion
*);
6368 #ifdef HAVE_CLOCK_MONOTONIC
6376 /* Line1 display AS-path, Aggregator */
6380 if (aspath_count_hops (attr
->aspath
) == 0)
6381 vty_out (vty
, "Local");
6383 aspath_print_vty (vty
, "%s", attr
->aspath
, "");
6386 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
6387 vty_out (vty
, ", (removed)");
6388 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
6389 vty_out (vty
, ", (stale)");
6390 if (CHECK_FLAG (attr
->flag
, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR
)))
6391 vty_out (vty
, ", (aggregated by %u %s)",
6392 attr
->extra
->aggregator_as
,
6393 inet_ntoa (attr
->extra
->aggregator_addr
));
6394 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
6395 vty_out (vty
, ", (Received from a RR-client)");
6396 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
6397 vty_out (vty
, ", (Received from a RS-client)");
6398 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6399 vty_out (vty
, ", (history entry)");
6400 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
6401 vty_out (vty
, ", (suppressed due to dampening)");
6402 vty_out (vty
, "%s", VTY_NEWLINE
);
6404 /* Line2 display Next-hop, Neighbor, Router-id */
6405 if (p
->family
== AF_INET
)
6407 vty_out (vty
, " %s", safi
== SAFI_MPLS_VPN
?
6408 inet_ntoa (attr
->extra
->mp_nexthop_global_in
) :
6409 inet_ntoa (attr
->nexthop
));
6414 assert (attr
->extra
);
6415 vty_out (vty
, " %s",
6416 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
6417 buf
, INET6_ADDRSTRLEN
));
6419 #endif /* HAVE_IPV6 */
6421 if (binfo
->peer
== bgp
->peer_self
)
6423 vty_out (vty
, " from %s ",
6424 p
->family
== AF_INET
? "0.0.0.0" : "::");
6425 vty_out (vty
, "(%s)", inet_ntoa(bgp
->router_id
));
6429 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_VALID
))
6430 vty_out (vty
, " (inaccessible)");
6431 else if (binfo
->extra
&& binfo
->extra
->igpmetric
)
6432 vty_out (vty
, " (metric %u)", binfo
->extra
->igpmetric
);
6433 vty_out (vty
, " from %s", sockunion2str (&binfo
->peer
->su
, buf
, SU_ADDRSTRLEN
));
6434 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
6435 vty_out (vty
, " (%s)", inet_ntoa (attr
->extra
->originator_id
));
6437 vty_out (vty
, " (%s)", inet_ntop (AF_INET
, &binfo
->peer
->remote_id
, buf1
, BUFSIZ
));
6439 vty_out (vty
, "%s", VTY_NEWLINE
);
6442 /* display nexthop local */
6443 if (attr
->extra
&& attr
->extra
->mp_nexthop_len
== 32)
6445 vty_out (vty
, " (%s)%s",
6446 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_local
,
6447 buf
, INET6_ADDRSTRLEN
),
6450 #endif /* HAVE_IPV6 */
6452 /* Line 3 display Origin, Med, Locpref, Weight, Tag, valid, Int/Ext/Local, Atomic, best */
6453 vty_out (vty
, " Origin %s", bgp_origin_long_str
[attr
->origin
]);
6455 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
))
6456 vty_out (vty
, ", metric %u", attr
->med
);
6458 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
))
6459 vty_out (vty
, ", localpref %u", attr
->local_pref
);
6461 vty_out (vty
, ", localpref %u", bgp
->default_local_pref
);
6463 if (attr
->extra
&& attr
->extra
->weight
!= 0)
6464 vty_out (vty
, ", weight %u", attr
->extra
->weight
);
6466 if (attr
->extra
&& attr
->extra
->tag
!= 0)
6467 vty_out (vty
, ", tag %d", attr
->extra
->tag
);
6469 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6470 vty_out (vty
, ", valid");
6472 if (binfo
->peer
!= bgp
->peer_self
)
6474 if (binfo
->peer
->as
== binfo
->peer
->local_as
)
6475 vty_out (vty
, ", internal");
6477 vty_out (vty
, ", %s",
6478 (bgp_confederation_peers_check(bgp
, binfo
->peer
->as
) ? "confed-external" : "external"));
6480 else if (binfo
->sub_type
== BGP_ROUTE_AGGREGATE
)
6481 vty_out (vty
, ", aggregated, local");
6482 else if (binfo
->type
!= ZEBRA_ROUTE_BGP
)
6483 vty_out (vty
, ", sourced");
6485 vty_out (vty
, ", sourced, local");
6487 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
6488 vty_out (vty
, ", atomic-aggregate");
6490 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_MULTIPATH
) ||
6491 (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
) &&
6492 bgp_info_mpath_count (binfo
)))
6493 vty_out (vty
, ", multipath");
6495 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
6496 vty_out (vty
, ", best");
6498 vty_out (vty
, "%s", VTY_NEWLINE
);
6500 /* Line 4 display Community */
6501 if (attr
->community
)
6502 vty_out (vty
, " Community: %s%s", attr
->community
->str
,
6505 /* Line 5 display Extended-community */
6506 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
))
6507 vty_out (vty
, " Extended Community: %s%s",
6508 attr
->extra
->ecommunity
->str
, VTY_NEWLINE
);
6510 /* Line 6 display Originator, Cluster-id */
6511 if ((attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)) ||
6512 (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
)))
6514 assert (attr
->extra
);
6515 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
6516 vty_out (vty
, " Originator: %s",
6517 inet_ntoa (attr
->extra
->originator_id
));
6519 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
6522 vty_out (vty
, ", Cluster list: ");
6523 for (i
= 0; i
< attr
->extra
->cluster
->length
/ 4; i
++)
6524 vty_out (vty
, "%s ",
6525 inet_ntoa (attr
->extra
->cluster
->list
[i
]));
6527 vty_out (vty
, "%s", VTY_NEWLINE
);
6530 if (binfo
->extra
&& binfo
->extra
->damp_info
)
6531 bgp_damp_info_vty (vty
, binfo
);
6533 /* Line 7 display Uptime */
6534 #ifdef HAVE_CLOCK_MONOTONIC
6535 tbuf
= time(NULL
) - (bgp_clock() - binfo
->uptime
);
6536 vty_out (vty
, " Last update: %s", ctime(&tbuf
));
6538 vty_out (vty
, " Last update: %s", ctime(&binfo
->uptime
));
6539 #endif /* HAVE_CLOCK_MONOTONIC */
6541 vty_out (vty
, "%s", VTY_NEWLINE
);
6544 #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, "\
6545 "h history, * valid, > best, = multipath,%s"\
6546 " i internal, r RIB-failure, S Stale, R Removed%s"
6547 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s"
6548 #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s"
6549 #define BGP_SHOW_HEADER_CSV "Flags, Network, Next Hop, Metric, LocPrf, Weight, Path%s"
6550 #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s"
6551 #define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path%s"
6555 bgp_show_type_normal
,
6556 bgp_show_type_regexp
,
6557 bgp_show_type_prefix_list
,
6558 bgp_show_type_filter_list
,
6559 bgp_show_type_route_map
,
6560 bgp_show_type_neighbor
,
6561 bgp_show_type_cidr_only
,
6562 bgp_show_type_prefix_longer
,
6563 bgp_show_type_community_all
,
6564 bgp_show_type_community
,
6565 bgp_show_type_community_exact
,
6566 bgp_show_type_community_list
,
6567 bgp_show_type_community_list_exact
,
6568 bgp_show_type_flap_statistics
,
6569 bgp_show_type_flap_address
,
6570 bgp_show_type_flap_prefix
,
6571 bgp_show_type_flap_cidr_only
,
6572 bgp_show_type_flap_regexp
,
6573 bgp_show_type_flap_filter_list
,
6574 bgp_show_type_flap_prefix_list
,
6575 bgp_show_type_flap_prefix_longer
,
6576 bgp_show_type_flap_route_map
,
6577 bgp_show_type_flap_neighbor
,
6578 bgp_show_type_dampend_paths
,
6579 bgp_show_type_damp_neighbor
6583 bgp_show_table (struct vty
*vty
, struct bgp_table
*table
, struct in_addr
*router_id
,
6584 enum bgp_show_type type
, void *output_arg
, char *delim
)
6586 struct bgp_info
*ri
;
6587 struct bgp_node
*rn
;
6590 unsigned long output_count
;
6592 /* This is first entry point, so reset total line. */
6595 /* Start processing of routes. */
6596 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
6597 if (rn
->info
!= NULL
)
6601 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6603 if (type
== bgp_show_type_flap_statistics
6604 || type
== bgp_show_type_flap_address
6605 || type
== bgp_show_type_flap_prefix
6606 || type
== bgp_show_type_flap_cidr_only
6607 || type
== bgp_show_type_flap_regexp
6608 || type
== bgp_show_type_flap_filter_list
6609 || type
== bgp_show_type_flap_prefix_list
6610 || type
== bgp_show_type_flap_prefix_longer
6611 || type
== bgp_show_type_flap_route_map
6612 || type
== bgp_show_type_flap_neighbor
6613 || type
== bgp_show_type_dampend_paths
6614 || type
== bgp_show_type_damp_neighbor
)
6616 if (!(ri
->extra
&& ri
->extra
->damp_info
))
6619 if (type
== bgp_show_type_regexp
6620 || type
== bgp_show_type_flap_regexp
)
6622 regex_t
*regex
= output_arg
;
6624 if (bgp_regexec (regex
, ri
->attr
->aspath
) == REG_NOMATCH
)
6627 if (type
== bgp_show_type_prefix_list
6628 || type
== bgp_show_type_flap_prefix_list
)
6630 struct prefix_list
*plist
= output_arg
;
6632 if (prefix_list_apply (plist
, &rn
->p
) != PREFIX_PERMIT
)
6635 if (type
== bgp_show_type_filter_list
6636 || type
== bgp_show_type_flap_filter_list
)
6638 struct as_list
*as_list
= output_arg
;
6640 if (as_list_apply (as_list
, ri
->attr
->aspath
) != AS_FILTER_PERMIT
)
6643 if (type
== bgp_show_type_route_map
6644 || type
== bgp_show_type_flap_route_map
)
6646 struct route_map
*rmap
= output_arg
;
6647 struct bgp_info binfo
;
6648 struct attr dummy_attr
;
6649 struct attr_extra dummy_extra
;
6652 dummy_attr
.extra
= &dummy_extra
;
6653 bgp_attr_dup (&dummy_attr
, ri
->attr
);
6655 binfo
.peer
= ri
->peer
;
6656 binfo
.attr
= &dummy_attr
;
6658 ret
= route_map_apply (rmap
, &rn
->p
, RMAP_BGP
, &binfo
);
6659 if (ret
== RMAP_DENYMATCH
)
6662 if (type
== bgp_show_type_neighbor
6663 || type
== bgp_show_type_flap_neighbor
6664 || type
== bgp_show_type_damp_neighbor
)
6666 union sockunion
*su
= output_arg
;
6668 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
6671 if (type
== bgp_show_type_cidr_only
6672 || type
== bgp_show_type_flap_cidr_only
)
6674 u_int32_t destination
;
6676 destination
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
6677 if (IN_CLASSC (destination
) && rn
->p
.prefixlen
== 24)
6679 if (IN_CLASSB (destination
) && rn
->p
.prefixlen
== 16)
6681 if (IN_CLASSA (destination
) && rn
->p
.prefixlen
== 8)
6684 if (type
== bgp_show_type_prefix_longer
6685 || type
== bgp_show_type_flap_prefix_longer
)
6687 struct prefix
*p
= output_arg
;
6689 if (! prefix_match (p
, &rn
->p
))
6692 if (type
== bgp_show_type_community_all
)
6694 if (! ri
->attr
->community
)
6697 if (type
== bgp_show_type_community
)
6699 struct community
*com
= output_arg
;
6701 if (! ri
->attr
->community
||
6702 ! community_match (ri
->attr
->community
, com
))
6705 if (type
== bgp_show_type_community_exact
)
6707 struct community
*com
= output_arg
;
6709 if (! ri
->attr
->community
||
6710 ! community_cmp (ri
->attr
->community
, com
))
6713 if (type
== bgp_show_type_community_list
)
6715 struct community_list
*list
= output_arg
;
6717 if (! community_list_match (ri
->attr
->community
, list
))
6720 if (type
== bgp_show_type_community_list_exact
)
6722 struct community_list
*list
= output_arg
;
6724 if (! community_list_exact_match (ri
->attr
->community
, list
))
6727 if (type
== bgp_show_type_flap_address
6728 || type
== bgp_show_type_flap_prefix
)
6730 struct prefix
*p
= output_arg
;
6732 if (! prefix_match (&rn
->p
, p
))
6735 if (type
== bgp_show_type_flap_prefix
)
6736 if (p
->prefixlen
!= rn
->p
.prefixlen
)
6739 if (type
== bgp_show_type_dampend_paths
6740 || type
== bgp_show_type_damp_neighbor
)
6742 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
6743 || CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
6751 vty_out (vty
, BGP_SHOW_HEADER_CSV
, VTY_NEWLINE
);
6757 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id
), VTY_NEWLINE
);
6758 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
6759 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
6760 if (type
== bgp_show_type_dampend_paths
6761 || type
== bgp_show_type_damp_neighbor
)
6762 vty_out (vty
, BGP_SHOW_DAMP_HEADER
, VTY_NEWLINE
);
6763 else if (type
== bgp_show_type_flap_statistics
6764 || type
== bgp_show_type_flap_address
6765 || type
== bgp_show_type_flap_prefix
6766 || type
== bgp_show_type_flap_cidr_only
6767 || type
== bgp_show_type_flap_regexp
6768 || type
== bgp_show_type_flap_filter_list
6769 || type
== bgp_show_type_flap_prefix_list
6770 || type
== bgp_show_type_flap_prefix_longer
6771 || type
== bgp_show_type_flap_route_map
6772 || type
== bgp_show_type_flap_neighbor
)
6773 vty_out (vty
, BGP_SHOW_FLAP_HEADER
, VTY_NEWLINE
);
6775 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
6779 if (type
== bgp_show_type_dampend_paths
6780 || type
== bgp_show_type_damp_neighbor
)
6781 damp_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6782 else if (type
== bgp_show_type_flap_statistics
6783 || type
== bgp_show_type_flap_address
6784 || type
== bgp_show_type_flap_prefix
6785 || type
== bgp_show_type_flap_cidr_only
6786 || type
== bgp_show_type_flap_regexp
6787 || type
== bgp_show_type_flap_filter_list
6788 || type
== bgp_show_type_flap_prefix_list
6789 || type
== bgp_show_type_flap_prefix_longer
6790 || type
== bgp_show_type_flap_route_map
6791 || type
== bgp_show_type_flap_neighbor
)
6792 flap_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6794 route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
, delim
);
6801 /* No route is displayed */
6802 if (output_count
== 0)
6804 if (type
== bgp_show_type_normal
)
6805 vty_out (vty
, "No BGP network exists%s", VTY_NEWLINE
);
6808 vty_out (vty
, "%sTotal number of prefixes %ld%s",
6809 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
6815 bgp_show (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
6816 enum bgp_show_type type
, void *output_arg
, char *delim
)
6818 struct bgp_table
*table
;
6821 bgp
= bgp_get_default ();
6826 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
6831 table
= bgp
->rib
[afi
][safi
];
6833 return bgp_show_table (vty
, table
, &bgp
->router_id
, type
, output_arg
, delim
);
6836 /* Header of detailed BGP route information */
6838 route_vty_out_detail_header (struct vty
*vty
, struct bgp
*bgp
,
6839 struct bgp_node
*rn
,
6840 struct prefix_rd
*prd
, afi_t afi
, safi_t safi
)
6842 struct bgp_info
*ri
;
6845 struct listnode
*node
, *nnode
;
6846 char buf1
[INET6_ADDRSTRLEN
];
6847 char buf2
[INET6_ADDRSTRLEN
];
6852 int no_advertise
= 0;
6857 vty_out (vty
, "BGP routing table entry for %s%s%s/%d%s",
6858 (safi
== SAFI_MPLS_VPN
?
6859 prefix_rd2str (prd
, buf1
, RD_ADDRSTRLEN
) : ""),
6860 safi
== SAFI_MPLS_VPN
? ":" : "",
6861 inet_ntop (p
->family
, &p
->u
.prefix
, buf2
, INET6_ADDRSTRLEN
),
6862 p
->prefixlen
, VTY_NEWLINE
);
6864 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6867 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
6870 if (ri
->extra
&& ri
->extra
->suppress
)
6872 if (ri
->attr
->community
!= NULL
)
6874 if (community_include (ri
->attr
->community
, COMMUNITY_NO_ADVERTISE
))
6876 if (community_include (ri
->attr
->community
, COMMUNITY_NO_EXPORT
))
6878 if (community_include (ri
->attr
->community
, COMMUNITY_LOCAL_AS
))
6884 vty_out (vty
, "Paths: (%d available", count
);
6887 vty_out (vty
, ", best #%d", best
);
6888 if (safi
== SAFI_UNICAST
)
6889 vty_out (vty
, ", table Default-IP-Routing-Table");
6892 vty_out (vty
, ", no best path");
6894 vty_out (vty
, ", not advertised to any peer");
6896 vty_out (vty
, ", not advertised to EBGP peer");
6898 vty_out (vty
, ", not advertised outside local AS");
6900 vty_out (vty
, ", Advertisements suppressed by an aggregate.");
6901 vty_out (vty
, ")%s", VTY_NEWLINE
);
6903 /* advertised peer */
6904 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6906 if (bgp_adj_out_lookup (peer
, p
, afi
, safi
, rn
))
6909 vty_out (vty
, " Advertised to non peer-group peers:%s ", VTY_NEWLINE
);
6910 vty_out (vty
, " %s", sockunion2str (&peer
->su
, buf1
, SU_ADDRSTRLEN
));
6915 vty_out (vty
, " Not advertised to any peer");
6916 vty_out (vty
, "%s", VTY_NEWLINE
);
6919 /* Display specified route of BGP table. */
6921 bgp_show_route_in_table (struct vty
*vty
, struct bgp
*bgp
,
6922 struct bgp_table
*rib
, const char *ip_str
,
6923 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
6924 int prefix_check
, enum bgp_path_type pathtype
)
6929 struct prefix match
;
6930 struct bgp_node
*rn
;
6931 struct bgp_node
*rm
;
6932 struct bgp_info
*ri
;
6933 struct bgp_table
*table
;
6935 /* Check IP address argument. */
6936 ret
= str2prefix (ip_str
, &match
);
6939 vty_out (vty
, "address is malformed%s", VTY_NEWLINE
);
6943 match
.family
= afi2family (afi
);
6945 if (safi
== SAFI_MPLS_VPN
)
6947 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
6949 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
6952 if ((table
= rn
->info
) != NULL
)
6956 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
6958 if (prefix_check
&& rm
->p
.prefixlen
!= match
.prefixlen
)
6960 bgp_unlock_node (rm
);
6964 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
6968 route_vty_out_detail_header (vty
, bgp
, rm
, (struct prefix_rd
*)&rn
->p
,
6969 AFI_IP
, SAFI_MPLS_VPN
);
6975 if (pathtype
== BGP_PATH_ALL
||
6976 (pathtype
== BGP_PATH_BESTPATH
&& CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)) ||
6977 (pathtype
== BGP_PATH_MULTIPATH
&&
6978 (CHECK_FLAG (ri
->flags
, BGP_INFO_MULTIPATH
) || CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))))
6979 route_vty_out_detail (vty
, bgp
, &rm
->p
, ri
, AFI_IP
, SAFI_MPLS_VPN
);
6982 bgp_unlock_node (rm
);
6991 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
6993 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
6995 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6999 route_vty_out_detail_header (vty
, bgp
, rn
, NULL
, afi
, safi
);
7004 if (pathtype
== BGP_PATH_ALL
||
7005 (pathtype
== BGP_PATH_BESTPATH
&& CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)) ||
7006 (pathtype
== BGP_PATH_MULTIPATH
&&
7007 (CHECK_FLAG (ri
->flags
, BGP_INFO_MULTIPATH
) || CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))))
7008 route_vty_out_detail (vty
, bgp
, &rn
->p
, ri
, afi
, safi
);
7012 bgp_unlock_node (rn
);
7018 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
7025 /* Display specified route of Main RIB */
7027 bgp_show_route (struct vty
*vty
, const char *view_name
, const char *ip_str
,
7028 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
7029 int prefix_check
, enum bgp_path_type pathtype
)
7033 /* BGP structure lookup. */
7036 bgp
= bgp_lookup_by_name (view_name
);
7039 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
7045 bgp
= bgp_get_default ();
7048 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
7053 return bgp_show_route_in_table (vty
, bgp
, bgp
->rib
[afi
][safi
], ip_str
,
7054 afi
, safi
, prd
, prefix_check
, pathtype
);
7057 /* BGP route print out function. */
7065 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, NULL
);
7068 DEFUN (show_ip_bgp_csv
,
7069 show_ip_bgp_csv_cmd
,
7075 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, &csv
);
7078 DEFUN (show_ip_bgp_ipv4
,
7079 show_ip_bgp_ipv4_cmd
,
7080 "show ip bgp ipv4 (unicast|multicast)",
7085 "Address Family modifier\n"
7086 "Address Family modifier\n")
7088 if (strncmp (argv
[0], "m", 1) == 0)
7089 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, bgp_show_type_normal
,
7092 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, NULL
);
7095 ALIAS (show_ip_bgp_ipv4
,
7096 show_bgp_ipv4_safi_cmd
,
7097 "show bgp ipv4 (unicast|multicast)",
7101 "Address Family modifier\n"
7102 "Address Family modifier\n")
7104 DEFUN (show_ip_bgp_ipv4_csv
,
7105 show_bgp_ipv4_safi_csv_cmd
,
7106 "show bgp ipv4 (unicast|multicast) csv",
7110 "Address Family modifier\n"
7111 "Address Family modifier\n")
7113 if (strncmp (argv
[0], "m", 1) == 0)
7114 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, bgp_show_type_normal
,
7117 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, &csv
);
7120 DEFUN (show_ip_bgp_route
,
7121 show_ip_bgp_route_cmd
,
7122 "show ip bgp A.B.C.D",
7126 "Network in the BGP routing table to display\n")
7128 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7131 DEFUN (show_ip_bgp_route_pathtype
,
7132 show_ip_bgp_route_pathtype_cmd
,
7133 "show ip bgp A.B.C.D (bestpath|multipath)",
7137 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7138 "Display only the bestpath\n"
7139 "Display only multipaths\n")
7141 if (strncmp (argv
[1], "b", 1) == 0)
7142 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_BESTPATH
);
7144 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_MULTIPATH
);
7147 DEFUN (show_bgp_ipv4_safi_route_pathtype
,
7148 show_bgp_ipv4_safi_route_pathtype_cmd
,
7149 "show bgp ipv4 (unicast|multicast) A.B.C.D (bestpath|multipath)",
7153 "Address Family modifier\n"
7154 "Address Family modifier\n"
7155 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7156 "Display only the bestpath\n"
7157 "Display only multipaths\n")
7159 if (strncmp (argv
[0], "m", 1) == 0)
7160 if (strncmp (argv
[2], "b", 1) == 0)
7161 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_BESTPATH
);
7163 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_MULTIPATH
);
7165 if (strncmp (argv
[2], "b", 1) == 0)
7166 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_BESTPATH
);
7168 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_MULTIPATH
);
7171 DEFUN (show_ip_bgp_ipv4_route
,
7172 show_ip_bgp_ipv4_route_cmd
,
7173 "show ip bgp ipv4 (unicast|multicast) A.B.C.D",
7178 "Address Family modifier\n"
7179 "Address Family modifier\n"
7180 "Network in the BGP routing table to display\n")
7182 if (strncmp (argv
[0], "m", 1) == 0)
7183 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_ALL
);
7185 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7188 ALIAS (show_ip_bgp_ipv4_route
,
7189 show_bgp_ipv4_safi_route_cmd
,
7190 "show bgp ipv4 (unicast|multicast) A.B.C.D",
7194 "Address Family modifier\n"
7195 "Address Family modifier\n"
7196 "Network in the BGP routing table to display\n")
7198 DEFUN (show_ip_bgp_vpnv4_all_route
,
7199 show_ip_bgp_vpnv4_all_route_cmd
,
7200 "show ip bgp vpnv4 all A.B.C.D",
7204 "Display VPNv4 NLRI specific information\n"
7205 "Display information about all VPNv4 NLRIs\n"
7206 "Network in the BGP routing table to display\n")
7208 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 0, BGP_PATH_ALL
);
7212 DEFUN (show_ip_bgp_vpnv4_rd_route
,
7213 show_ip_bgp_vpnv4_rd_route_cmd
,
7214 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D",
7218 "Display VPNv4 NLRI specific information\n"
7219 "Display information for a route distinguisher\n"
7220 "VPN Route Distinguisher\n"
7221 "Network in the BGP routing table to display\n")
7224 struct prefix_rd prd
;
7226 ret
= str2prefix_rd (argv
[0], &prd
);
7229 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
7232 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 0, BGP_PATH_ALL
);
7235 DEFUN (show_ip_bgp_prefix
,
7236 show_ip_bgp_prefix_cmd
,
7237 "show ip bgp A.B.C.D/M",
7241 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7243 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7246 DEFUN (show_ip_bgp_prefix_pathtype
,
7247 show_ip_bgp_prefix_pathtype_cmd
,
7248 "show ip bgp A.B.C.D/M (bestpath|multipath)",
7252 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7253 "Display only the bestpath\n"
7254 "Display only multipaths\n")
7256 if (strncmp (argv
[1], "b", 1) == 0)
7257 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_BESTPATH
);
7259 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_MULTIPATH
);
7262 DEFUN (show_ip_bgp_ipv4_prefix
,
7263 show_ip_bgp_ipv4_prefix_cmd
,
7264 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M",
7269 "Address Family modifier\n"
7270 "Address Family modifier\n"
7271 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7273 if (strncmp (argv
[0], "m", 1) == 0)
7274 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_ALL
);
7276 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7279 ALIAS (show_ip_bgp_ipv4_prefix
,
7280 show_bgp_ipv4_safi_prefix_cmd
,
7281 "show bgp ipv4 (unicast|multicast) A.B.C.D/M",
7285 "Address Family modifier\n"
7286 "Address Family modifier\n"
7287 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7289 DEFUN (show_ip_bgp_ipv4_prefix_pathtype
,
7290 show_ip_bgp_ipv4_prefix_pathtype_cmd
,
7291 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath)",
7296 "Address Family modifier\n"
7297 "Address Family modifier\n"
7298 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7299 "Display only the bestpath\n"
7300 "Display only multipaths\n")
7302 if (strncmp (argv
[0], "m", 1) == 0)
7303 if (strncmp (argv
[2], "b", 1) == 0)
7304 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_BESTPATH
);
7306 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_MULTIPATH
);
7308 if (strncmp (argv
[2], "b", 1) == 0)
7309 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_BESTPATH
);
7311 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_MULTIPATH
);
7314 ALIAS (show_ip_bgp_ipv4_prefix_pathtype
,
7315 show_bgp_ipv4_safi_prefix_pathtype_cmd
,
7316 "show bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath)",
7320 "Address Family modifier\n"
7321 "Address Family modifier\n"
7322 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7323 "Display only the bestpath\n"
7324 "Display only multipaths\n")
7326 DEFUN (show_ip_bgp_vpnv4_all_prefix
,
7327 show_ip_bgp_vpnv4_all_prefix_cmd
,
7328 "show ip bgp vpnv4 all A.B.C.D/M",
7332 "Display VPNv4 NLRI specific information\n"
7333 "Display information about all VPNv4 NLRIs\n"
7334 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7336 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 1, BGP_PATH_ALL
);
7339 DEFUN (show_ip_bgp_vpnv4_rd_prefix
,
7340 show_ip_bgp_vpnv4_rd_prefix_cmd
,
7341 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M",
7345 "Display VPNv4 NLRI specific information\n"
7346 "Display information for a route distinguisher\n"
7347 "VPN Route Distinguisher\n"
7348 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7351 struct prefix_rd prd
;
7353 ret
= str2prefix_rd (argv
[0], &prd
);
7356 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
7359 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 1, BGP_PATH_ALL
);
7362 DEFUN (show_ip_bgp_view
,
7363 show_ip_bgp_view_cmd
,
7364 "show ip bgp view WORD",
7373 /* BGP structure lookup. */
7374 bgp
= bgp_lookup_by_name (argv
[0]);
7377 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
7381 return bgp_show (vty
, bgp
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, NULL
);
7384 DEFUN (show_ip_bgp_view_route
,
7385 show_ip_bgp_view_route_cmd
,
7386 "show ip bgp view WORD A.B.C.D",
7392 "Network in the BGP routing table to display\n")
7394 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7397 DEFUN (show_ip_bgp_view_prefix
,
7398 show_ip_bgp_view_prefix_cmd
,
7399 "show ip bgp view WORD A.B.C.D/M",
7405 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7407 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7417 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
7428 DEFUN (show_bgp_ipv6_safi
,
7429 show_bgp_ipv6_safi_cmd
,
7430 "show bgp ipv6 (unicast|multicast)",
7434 "Address Family modifier\n"
7435 "Address Family modifier\n")
7437 if (strncmp (argv
[0], "m", 1) == 0)
7438 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
7441 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, NULL
);
7444 DEFUN (show_bgp_ipv6_safi_csv
,
7445 show_bgp_ipv6_safi_csv_cmd
,
7446 "show bgp ipv6 (unicast|multicast) csv",
7450 "Address Family modifier\n"
7451 "Address Family modifier\n")
7453 if (strncmp (argv
[0], "m", 1) == 0)
7454 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
7457 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, &csv
);
7461 DEFUN (show_ipv6_bgp
,
7468 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
7472 DEFUN (show_bgp_route
,
7474 "show bgp X:X::X:X",
7477 "Network in the BGP routing table to display\n")
7479 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7482 ALIAS (show_bgp_route
,
7483 show_bgp_ipv6_route_cmd
,
7484 "show bgp ipv6 X:X::X:X",
7488 "Network in the BGP routing table to display\n")
7490 DEFUN (show_bgp_ipv6_safi_route
,
7491 show_bgp_ipv6_safi_route_cmd
,
7492 "show bgp ipv6 (unicast|multicast) X:X::X:X",
7496 "Address Family modifier\n"
7497 "Address Family modifier\n"
7498 "Network in the BGP routing table to display\n")
7500 if (strncmp (argv
[0], "m", 1) == 0)
7501 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_ALL
);
7503 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7506 DEFUN (show_bgp_route_pathtype
,
7507 show_bgp_route_pathtype_cmd
,
7508 "show bgp X:X::X:X (bestpath|multipath)",
7511 "Network in the BGP routing table to display\n"
7512 "Display only the bestpath\n"
7513 "Display only multipaths\n")
7515 if (strncmp (argv
[1], "b", 1) == 0)
7516 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_BESTPATH
);
7518 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_MULTIPATH
);
7521 ALIAS (show_bgp_route_pathtype
,
7522 show_bgp_ipv6_route_pathtype_cmd
,
7523 "show bgp ipv6 X:X::X:X (bestpath|multipath)",
7527 "Network in the BGP routing table to display\n"
7528 "Display only the bestpath\n"
7529 "Display only multipaths\n")
7531 DEFUN (show_bgp_ipv6_safi_route_pathtype
,
7532 show_bgp_ipv6_safi_route_pathtype_cmd
,
7533 "show bgp ipv6 (unicast|multicast) X:X::X:X (bestpath|multipath)",
7537 "Address Family modifier\n"
7538 "Address Family modifier\n"
7539 "Network in the BGP routing table to display\n"
7540 "Display only the bestpath\n"
7541 "Display only multipaths\n")
7543 if (strncmp (argv
[0], "m", 1) == 0)
7544 if (strncmp (argv
[2], "b", 1) == 0)
7545 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_BESTPATH
);
7547 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_MULTIPATH
);
7549 if (strncmp (argv
[2], "b", 1) == 0)
7550 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_BESTPATH
);
7552 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_MULTIPATH
);
7556 DEFUN (show_ipv6_bgp_route
,
7557 show_ipv6_bgp_route_cmd
,
7558 "show ipv6 bgp X:X::X:X",
7562 "Network in the BGP routing table to display\n")
7564 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7567 DEFUN (show_bgp_prefix
,
7568 show_bgp_prefix_cmd
,
7569 "show bgp X:X::X:X/M",
7572 "IPv6 prefix <network>/<length>\n")
7574 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7577 ALIAS (show_bgp_prefix
,
7578 show_bgp_ipv6_prefix_cmd
,
7579 "show bgp ipv6 X:X::X:X/M",
7583 "IPv6 prefix <network>/<length>\n")
7585 DEFUN (show_bgp_ipv6_safi_prefix
,
7586 show_bgp_ipv6_safi_prefix_cmd
,
7587 "show bgp ipv6 (unicast|multicast) X:X::X:X/M",
7591 "Address Family modifier\n"
7592 "Address Family modifier\n"
7593 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
7595 if (strncmp (argv
[0], "m", 1) == 0)
7596 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_ALL
);
7598 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7601 DEFUN (show_bgp_prefix_pathtype
,
7602 show_bgp_prefix_pathtype_cmd
,
7603 "show bgp X:X::X:X/M (bestpath|multipath)",
7606 "IPv6 prefix <network>/<length>\n"
7607 "Display only the bestpath\n"
7608 "Display only multipaths\n")
7610 if (strncmp (argv
[1], "b", 1) == 0)
7611 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_BESTPATH
);
7613 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_MULTIPATH
);
7616 ALIAS (show_bgp_prefix_pathtype
,
7617 show_bgp_ipv6_prefix_pathtype_cmd
,
7618 "show bgp ipv6 X:X::X:X/M (bestpath|multipath)",
7622 "IPv6 prefix <network>/<length>\n"
7623 "Display only the bestpath\n"
7624 "Display only multipaths\n")
7626 DEFUN (show_bgp_ipv6_safi_prefix_pathtype
,
7627 show_bgp_ipv6_safi_prefix_pathtype_cmd
,
7628 "show bgp ipv6 (unicast|multicast) X:X::X:X/M (bestpath|multipath)",
7632 "Address Family modifier\n"
7633 "Address Family modifier\n"
7634 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
7635 "Display only the bestpath\n"
7636 "Display only multipaths\n")
7638 if (strncmp (argv
[0], "m", 1) == 0)
7639 if (strncmp (argv
[2], "b", 1) == 0)
7640 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_BESTPATH
);
7642 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_MULTIPATH
);
7644 if (strncmp (argv
[2], "b", 1) == 0)
7645 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_BESTPATH
);
7647 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_MULTIPATH
);
7651 DEFUN (show_ipv6_bgp_prefix
,
7652 show_ipv6_bgp_prefix_cmd
,
7653 "show ipv6 bgp X:X::X:X/M",
7657 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
7659 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7662 DEFUN (show_bgp_view
,
7664 "show bgp view WORD",
7672 /* BGP structure lookup. */
7673 bgp
= bgp_lookup_by_name (argv
[0]);
7676 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
7680 return bgp_show (vty
, bgp
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, NULL
);
7683 ALIAS (show_bgp_view
,
7684 show_bgp_view_ipv6_cmd
,
7685 "show bgp view WORD ipv6",
7692 DEFUN (show_bgp_view_route
,
7693 show_bgp_view_route_cmd
,
7694 "show bgp view WORD X:X::X:X",
7699 "Network in the BGP routing table to display\n")
7701 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7704 ALIAS (show_bgp_view_route
,
7705 show_bgp_view_ipv6_route_cmd
,
7706 "show bgp view WORD ipv6 X:X::X:X",
7712 "Network in the BGP routing table to display\n")
7714 DEFUN (show_bgp_view_prefix
,
7715 show_bgp_view_prefix_cmd
,
7716 "show bgp view WORD X:X::X:X/M",
7721 "IPv6 prefix <network>/<length>\n")
7723 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7726 ALIAS (show_bgp_view_prefix
,
7727 show_bgp_view_ipv6_prefix_cmd
,
7728 "show bgp view WORD ipv6 X:X::X:X/M",
7734 "IPv6 prefix <network>/<length>\n")
7737 DEFUN (show_ipv6_mbgp
,
7744 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
7749 DEFUN (show_ipv6_mbgp_route
,
7750 show_ipv6_mbgp_route_cmd
,
7751 "show ipv6 mbgp X:X::X:X",
7755 "Network in the MBGP routing table to display\n")
7757 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_ALL
);
7761 DEFUN (show_ipv6_mbgp_prefix
,
7762 show_ipv6_mbgp_prefix_cmd
,
7763 "show ipv6 mbgp X:X::X:X/M",
7767 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
7769 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_ALL
);
7775 bgp_show_regexp (struct vty
*vty
, int argc
, const char **argv
, afi_t afi
,
7776 safi_t safi
, enum bgp_show_type type
)
7786 b
= buffer_new (1024);
7787 for (i
= 0; i
< argc
; i
++)
7790 buffer_putc (b
, ' ');
7793 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
7798 buffer_putstr (b
, argv
[i
]);
7800 buffer_putc (b
, '\0');
7802 regstr
= buffer_getstr (b
);
7805 regex
= bgp_regcomp (regstr
);
7806 XFREE(MTYPE_TMP
, regstr
);
7809 vty_out (vty
, "Can't compile regexp %s%s", argv
[0],
7814 rc
= bgp_show (vty
, NULL
, afi
, safi
, type
, regex
, NULL
);
7815 bgp_regex_free (regex
);
7819 DEFUN (show_ip_bgp_regexp
,
7820 show_ip_bgp_regexp_cmd
,
7821 "show ip bgp regexp .LINE",
7825 "Display routes matching the AS path regular expression\n"
7826 "A regular-expression to match the BGP AS paths\n")
7828 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7829 bgp_show_type_regexp
);
7832 DEFUN (show_ip_bgp_flap_regexp
,
7833 show_ip_bgp_flap_regexp_cmd
,
7834 "show ip bgp flap-statistics regexp .LINE",
7838 "Display flap statistics of routes\n"
7839 "Display routes matching the AS path regular expression\n"
7840 "A regular-expression to match the BGP AS paths\n")
7842 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7843 bgp_show_type_flap_regexp
);
7846 DEFUN (show_ip_bgp_ipv4_regexp
,
7847 show_ip_bgp_ipv4_regexp_cmd
,
7848 "show ip bgp ipv4 (unicast|multicast) regexp .LINE",
7853 "Address Family modifier\n"
7854 "Address Family modifier\n"
7855 "Display routes matching the AS path regular expression\n"
7856 "A regular-expression to match the BGP AS paths\n")
7858 if (strncmp (argv
[0], "m", 1) == 0)
7859 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_MULTICAST
,
7860 bgp_show_type_regexp
);
7862 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7863 bgp_show_type_regexp
);
7867 DEFUN (show_bgp_regexp
,
7868 show_bgp_regexp_cmd
,
7869 "show bgp regexp .LINE",
7872 "Display routes matching the AS path regular expression\n"
7873 "A regular-expression to match the BGP AS paths\n")
7875 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
7876 bgp_show_type_regexp
);
7879 ALIAS (show_bgp_regexp
,
7880 show_bgp_ipv6_regexp_cmd
,
7881 "show bgp ipv6 regexp .LINE",
7885 "Display routes matching the AS path regular expression\n"
7886 "A regular-expression to match the BGP AS paths\n")
7889 DEFUN (show_ipv6_bgp_regexp
,
7890 show_ipv6_bgp_regexp_cmd
,
7891 "show ipv6 bgp regexp .LINE",
7895 "Display routes matching the AS path regular expression\n"
7896 "A regular-expression to match the BGP AS paths\n")
7898 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
7899 bgp_show_type_regexp
);
7903 DEFUN (show_ipv6_mbgp_regexp
,
7904 show_ipv6_mbgp_regexp_cmd
,
7905 "show ipv6 mbgp regexp .LINE",
7909 "Display routes matching the AS path regular expression\n"
7910 "A regular-expression to match the MBGP AS paths\n")
7912 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_MULTICAST
,
7913 bgp_show_type_regexp
);
7915 #endif /* HAVE_IPV6 */
7918 bgp_show_prefix_list (struct vty
*vty
, const char *prefix_list_str
, afi_t afi
,
7919 safi_t safi
, enum bgp_show_type type
)
7921 struct prefix_list
*plist
;
7923 plist
= prefix_list_lookup (afi
, prefix_list_str
);
7926 vty_out (vty
, "%% %s is not a valid prefix-list name%s",
7927 prefix_list_str
, VTY_NEWLINE
);
7931 return bgp_show (vty
, NULL
, afi
, safi
, type
, plist
, NULL
);
7934 DEFUN (show_ip_bgp_prefix_list
,
7935 show_ip_bgp_prefix_list_cmd
,
7936 "show ip bgp prefix-list WORD",
7940 "Display routes conforming to the prefix-list\n"
7941 "IP prefix-list name\n")
7943 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7944 bgp_show_type_prefix_list
);
7947 DEFUN (show_ip_bgp_flap_prefix_list
,
7948 show_ip_bgp_flap_prefix_list_cmd
,
7949 "show ip bgp flap-statistics prefix-list WORD",
7953 "Display flap statistics of routes\n"
7954 "Display routes conforming to the prefix-list\n"
7955 "IP prefix-list name\n")
7957 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7958 bgp_show_type_flap_prefix_list
);
7961 DEFUN (show_ip_bgp_ipv4_prefix_list
,
7962 show_ip_bgp_ipv4_prefix_list_cmd
,
7963 "show ip bgp ipv4 (unicast|multicast) prefix-list WORD",
7968 "Address Family modifier\n"
7969 "Address Family modifier\n"
7970 "Display routes conforming to the prefix-list\n"
7971 "IP prefix-list name\n")
7973 if (strncmp (argv
[0], "m", 1) == 0)
7974 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7975 bgp_show_type_prefix_list
);
7977 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7978 bgp_show_type_prefix_list
);
7982 DEFUN (show_bgp_prefix_list
,
7983 show_bgp_prefix_list_cmd
,
7984 "show bgp prefix-list WORD",
7987 "Display routes conforming to the prefix-list\n"
7988 "IPv6 prefix-list name\n")
7990 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7991 bgp_show_type_prefix_list
);
7994 ALIAS (show_bgp_prefix_list
,
7995 show_bgp_ipv6_prefix_list_cmd
,
7996 "show bgp ipv6 prefix-list WORD",
8000 "Display routes conforming to the prefix-list\n"
8001 "IPv6 prefix-list name\n")
8004 DEFUN (show_ipv6_bgp_prefix_list
,
8005 show_ipv6_bgp_prefix_list_cmd
,
8006 "show ipv6 bgp prefix-list WORD",
8010 "Display routes matching the prefix-list\n"
8011 "IPv6 prefix-list name\n")
8013 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8014 bgp_show_type_prefix_list
);
8018 DEFUN (show_ipv6_mbgp_prefix_list
,
8019 show_ipv6_mbgp_prefix_list_cmd
,
8020 "show ipv6 mbgp prefix-list WORD",
8024 "Display routes matching the prefix-list\n"
8025 "IPv6 prefix-list name\n")
8027 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
8028 bgp_show_type_prefix_list
);
8030 #endif /* HAVE_IPV6 */
8033 bgp_show_filter_list (struct vty
*vty
, const char *filter
, afi_t afi
,
8034 safi_t safi
, enum bgp_show_type type
)
8036 struct as_list
*as_list
;
8038 as_list
= as_list_lookup (filter
);
8039 if (as_list
== NULL
)
8041 vty_out (vty
, "%% %s is not a valid AS-path access-list name%s", filter
, VTY_NEWLINE
);
8045 return bgp_show (vty
, NULL
, afi
, safi
, type
, as_list
, NULL
);
8048 DEFUN (show_ip_bgp_filter_list
,
8049 show_ip_bgp_filter_list_cmd
,
8050 "show ip bgp filter-list WORD",
8054 "Display routes conforming to the filter-list\n"
8055 "Regular expression access list name\n")
8057 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8058 bgp_show_type_filter_list
);
8061 DEFUN (show_ip_bgp_flap_filter_list
,
8062 show_ip_bgp_flap_filter_list_cmd
,
8063 "show ip bgp flap-statistics filter-list WORD",
8067 "Display flap statistics of routes\n"
8068 "Display routes conforming to the filter-list\n"
8069 "Regular expression access list name\n")
8071 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8072 bgp_show_type_flap_filter_list
);
8075 DEFUN (show_ip_bgp_ipv4_filter_list
,
8076 show_ip_bgp_ipv4_filter_list_cmd
,
8077 "show ip bgp ipv4 (unicast|multicast) filter-list WORD",
8082 "Address Family modifier\n"
8083 "Address Family modifier\n"
8084 "Display routes conforming to the filter-list\n"
8085 "Regular expression access list name\n")
8087 if (strncmp (argv
[0], "m", 1) == 0)
8088 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
8089 bgp_show_type_filter_list
);
8091 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
8092 bgp_show_type_filter_list
);
8096 DEFUN (show_bgp_filter_list
,
8097 show_bgp_filter_list_cmd
,
8098 "show bgp filter-list WORD",
8101 "Display routes conforming to the filter-list\n"
8102 "Regular expression access list name\n")
8104 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8105 bgp_show_type_filter_list
);
8108 ALIAS (show_bgp_filter_list
,
8109 show_bgp_ipv6_filter_list_cmd
,
8110 "show bgp ipv6 filter-list WORD",
8114 "Display routes conforming to the filter-list\n"
8115 "Regular expression access list name\n")
8118 DEFUN (show_ipv6_bgp_filter_list
,
8119 show_ipv6_bgp_filter_list_cmd
,
8120 "show ipv6 bgp filter-list WORD",
8124 "Display routes conforming to the filter-list\n"
8125 "Regular expression access list name\n")
8127 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8128 bgp_show_type_filter_list
);
8132 DEFUN (show_ipv6_mbgp_filter_list
,
8133 show_ipv6_mbgp_filter_list_cmd
,
8134 "show ipv6 mbgp filter-list WORD",
8138 "Display routes conforming to the filter-list\n"
8139 "Regular expression access list name\n")
8141 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
8142 bgp_show_type_filter_list
);
8144 #endif /* HAVE_IPV6 */
8147 bgp_show_route_map (struct vty
*vty
, const char *rmap_str
, afi_t afi
,
8148 safi_t safi
, enum bgp_show_type type
)
8150 struct route_map
*rmap
;
8152 rmap
= route_map_lookup_by_name (rmap_str
);
8155 vty_out (vty
, "%% %s is not a valid route-map name%s",
8156 rmap_str
, VTY_NEWLINE
);
8160 return bgp_show (vty
, NULL
, afi
, safi
, type
, rmap
, NULL
);
8163 DEFUN (show_ip_bgp_route_map
,
8164 show_ip_bgp_route_map_cmd
,
8165 "show ip bgp route-map WORD",
8169 "Display routes matching the route-map\n"
8170 "A route-map to match on\n")
8172 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8173 bgp_show_type_route_map
);
8176 DEFUN (show_ip_bgp_flap_route_map
,
8177 show_ip_bgp_flap_route_map_cmd
,
8178 "show ip bgp flap-statistics route-map WORD",
8182 "Display flap statistics of routes\n"
8183 "Display routes matching the route-map\n"
8184 "A route-map to match on\n")
8186 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8187 bgp_show_type_flap_route_map
);
8190 DEFUN (show_ip_bgp_ipv4_route_map
,
8191 show_ip_bgp_ipv4_route_map_cmd
,
8192 "show ip bgp ipv4 (unicast|multicast) route-map WORD",
8197 "Address Family modifier\n"
8198 "Address Family modifier\n"
8199 "Display routes matching the route-map\n"
8200 "A route-map to match on\n")
8202 if (strncmp (argv
[0], "m", 1) == 0)
8203 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
8204 bgp_show_type_route_map
);
8206 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
8207 bgp_show_type_route_map
);
8210 DEFUN (show_bgp_route_map
,
8211 show_bgp_route_map_cmd
,
8212 "show bgp route-map WORD",
8215 "Display routes matching the route-map\n"
8216 "A route-map to match on\n")
8218 return bgp_show_route_map (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8219 bgp_show_type_route_map
);
8222 ALIAS (show_bgp_route_map
,
8223 show_bgp_ipv6_route_map_cmd
,
8224 "show bgp ipv6 route-map WORD",
8228 "Display routes matching the route-map\n"
8229 "A route-map to match on\n")
8231 DEFUN (show_ip_bgp_cidr_only
,
8232 show_ip_bgp_cidr_only_cmd
,
8233 "show ip bgp cidr-only",
8237 "Display only routes with non-natural netmasks\n")
8239 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
8240 bgp_show_type_cidr_only
, NULL
, NULL
);
8243 DEFUN (show_ip_bgp_flap_cidr_only
,
8244 show_ip_bgp_flap_cidr_only_cmd
,
8245 "show ip bgp flap-statistics cidr-only",
8249 "Display flap statistics of routes\n"
8250 "Display only routes with non-natural netmasks\n")
8252 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
8253 bgp_show_type_flap_cidr_only
, NULL
, NULL
);
8256 DEFUN (show_ip_bgp_ipv4_cidr_only
,
8257 show_ip_bgp_ipv4_cidr_only_cmd
,
8258 "show ip bgp ipv4 (unicast|multicast) cidr-only",
8263 "Address Family modifier\n"
8264 "Address Family modifier\n"
8265 "Display only routes with non-natural netmasks\n")
8267 if (strncmp (argv
[0], "m", 1) == 0)
8268 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
8269 bgp_show_type_cidr_only
, NULL
, NULL
);
8271 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
8272 bgp_show_type_cidr_only
, NULL
, NULL
);
8275 DEFUN (show_ip_bgp_community_all
,
8276 show_ip_bgp_community_all_cmd
,
8277 "show ip bgp community",
8281 "Display routes matching the communities\n")
8283 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
8284 bgp_show_type_community_all
, NULL
, NULL
);
8287 DEFUN (show_ip_bgp_ipv4_community_all
,
8288 show_ip_bgp_ipv4_community_all_cmd
,
8289 "show ip bgp ipv4 (unicast|multicast) community",
8294 "Address Family modifier\n"
8295 "Address Family modifier\n"
8296 "Display routes matching the communities\n")
8298 if (strncmp (argv
[0], "m", 1) == 0)
8299 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
8300 bgp_show_type_community_all
, NULL
, NULL
);
8302 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
8303 bgp_show_type_community_all
, NULL
, NULL
);
8307 DEFUN (show_bgp_community_all
,
8308 show_bgp_community_all_cmd
,
8309 "show bgp community",
8312 "Display routes matching the communities\n")
8314 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
8315 bgp_show_type_community_all
, NULL
, NULL
);
8318 ALIAS (show_bgp_community_all
,
8319 show_bgp_ipv6_community_all_cmd
,
8320 "show bgp ipv6 community",
8324 "Display routes matching the communities\n")
8327 DEFUN (show_ipv6_bgp_community_all
,
8328 show_ipv6_bgp_community_all_cmd
,
8329 "show ipv6 bgp community",
8333 "Display routes matching the communities\n")
8335 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
8336 bgp_show_type_community_all
, NULL
, NULL
);
8340 DEFUN (show_ipv6_mbgp_community_all
,
8341 show_ipv6_mbgp_community_all_cmd
,
8342 "show ipv6 mbgp community",
8346 "Display routes matching the communities\n")
8348 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
,
8349 bgp_show_type_community_all
, NULL
, NULL
);
8351 #endif /* HAVE_IPV6 */
8354 bgp_show_community (struct vty
*vty
, const char *view_name
, int argc
,
8355 const char **argv
, int exact
, afi_t afi
, safi_t safi
)
8357 struct community
*com
;
8364 /* BGP structure lookup */
8367 bgp
= bgp_lookup_by_name (view_name
);
8370 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
8376 bgp
= bgp_get_default ();
8379 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
8384 b
= buffer_new (1024);
8385 for (i
= 0; i
< argc
; i
++)
8388 buffer_putc (b
, ' ');
8391 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
8396 buffer_putstr (b
, argv
[i
]);
8398 buffer_putc (b
, '\0');
8400 str
= buffer_getstr (b
);
8403 com
= community_str2com (str
);
8404 XFREE (MTYPE_TMP
, str
);
8407 vty_out (vty
, "%% Community malformed: %s", VTY_NEWLINE
);
8411 return bgp_show (vty
, bgp
, afi
, safi
,
8412 (exact
? bgp_show_type_community_exact
:
8413 bgp_show_type_community
), com
, NULL
);
8416 DEFUN (show_ip_bgp_community
,
8417 show_ip_bgp_community_cmd
,
8418 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export)",
8422 "Display routes matching the communities\n"
8423 "community number\n"
8424 "Do not send outside local AS (well-known community)\n"
8425 "Do not advertise to any peer (well-known community)\n"
8426 "Do not export to next AS (well-known community)\n")
8428 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
8431 ALIAS (show_ip_bgp_community
,
8432 show_ip_bgp_community2_cmd
,
8433 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8437 "Display routes matching the communities\n"
8438 "community number\n"
8439 "Do not send outside local AS (well-known community)\n"
8440 "Do not advertise to any peer (well-known community)\n"
8441 "Do not export to next AS (well-known community)\n"
8442 "community number\n"
8443 "Do not send outside local AS (well-known community)\n"
8444 "Do not advertise to any peer (well-known community)\n"
8445 "Do not export to next AS (well-known community)\n")
8447 ALIAS (show_ip_bgp_community
,
8448 show_ip_bgp_community3_cmd
,
8449 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8453 "Display routes matching the communities\n"
8454 "community number\n"
8455 "Do not send outside local AS (well-known community)\n"
8456 "Do not advertise to any peer (well-known community)\n"
8457 "Do not export to next AS (well-known community)\n"
8458 "community number\n"
8459 "Do not send outside local AS (well-known community)\n"
8460 "Do not advertise to any peer (well-known community)\n"
8461 "Do not export to next AS (well-known community)\n"
8462 "community number\n"
8463 "Do not send outside local AS (well-known community)\n"
8464 "Do not advertise to any peer (well-known community)\n"
8465 "Do not export to next AS (well-known community)\n")
8467 ALIAS (show_ip_bgp_community
,
8468 show_ip_bgp_community4_cmd
,
8469 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8473 "Display routes matching the communities\n"
8474 "community number\n"
8475 "Do not send outside local AS (well-known community)\n"
8476 "Do not advertise to any peer (well-known community)\n"
8477 "Do not export to next AS (well-known community)\n"
8478 "community number\n"
8479 "Do not send outside local AS (well-known community)\n"
8480 "Do not advertise to any peer (well-known community)\n"
8481 "Do not export to next AS (well-known community)\n"
8482 "community number\n"
8483 "Do not send outside local AS (well-known community)\n"
8484 "Do not advertise to any peer (well-known community)\n"
8485 "Do not export to next AS (well-known community)\n"
8486 "community number\n"
8487 "Do not send outside local AS (well-known community)\n"
8488 "Do not advertise to any peer (well-known community)\n"
8489 "Do not export to next AS (well-known community)\n")
8491 DEFUN (show_ip_bgp_ipv4_community
,
8492 show_ip_bgp_ipv4_community_cmd
,
8493 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
8498 "Address Family modifier\n"
8499 "Address Family modifier\n"
8500 "Display routes matching the communities\n"
8501 "community number\n"
8502 "Do not send outside local AS (well-known community)\n"
8503 "Do not advertise to any peer (well-known community)\n"
8504 "Do not export to next AS (well-known community)\n")
8506 if (strncmp (argv
[0], "m", 1) == 0)
8507 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP
, SAFI_MULTICAST
);
8509 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
8512 ALIAS (show_ip_bgp_ipv4_community
,
8513 show_ip_bgp_ipv4_community2_cmd
,
8514 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8519 "Address Family modifier\n"
8520 "Address Family modifier\n"
8521 "Display routes matching the communities\n"
8522 "community number\n"
8523 "Do not send outside local AS (well-known community)\n"
8524 "Do not advertise to any peer (well-known community)\n"
8525 "Do not export to next AS (well-known community)\n"
8526 "community number\n"
8527 "Do not send outside local AS (well-known community)\n"
8528 "Do not advertise to any peer (well-known community)\n"
8529 "Do not export to next AS (well-known community)\n")
8531 ALIAS (show_ip_bgp_ipv4_community
,
8532 show_ip_bgp_ipv4_community3_cmd
,
8533 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8538 "Address Family modifier\n"
8539 "Address Family modifier\n"
8540 "Display routes matching the communities\n"
8541 "community number\n"
8542 "Do not send outside local AS (well-known community)\n"
8543 "Do not advertise to any peer (well-known community)\n"
8544 "Do not export to next AS (well-known community)\n"
8545 "community number\n"
8546 "Do not send outside local AS (well-known community)\n"
8547 "Do not advertise to any peer (well-known community)\n"
8548 "Do not export to next AS (well-known community)\n"
8549 "community number\n"
8550 "Do not send outside local AS (well-known community)\n"
8551 "Do not advertise to any peer (well-known community)\n"
8552 "Do not export to next AS (well-known community)\n")
8554 ALIAS (show_ip_bgp_ipv4_community
,
8555 show_ip_bgp_ipv4_community4_cmd
,
8556 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8561 "Address Family modifier\n"
8562 "Address Family modifier\n"
8563 "Display routes matching the communities\n"
8564 "community number\n"
8565 "Do not send outside local AS (well-known community)\n"
8566 "Do not advertise to any peer (well-known community)\n"
8567 "Do not export to next AS (well-known community)\n"
8568 "community number\n"
8569 "Do not send outside local AS (well-known community)\n"
8570 "Do not advertise to any peer (well-known community)\n"
8571 "Do not export to next AS (well-known community)\n"
8572 "community number\n"
8573 "Do not send outside local AS (well-known community)\n"
8574 "Do not advertise to any peer (well-known community)\n"
8575 "Do not export to next AS (well-known community)\n"
8576 "community number\n"
8577 "Do not send outside local AS (well-known community)\n"
8578 "Do not advertise to any peer (well-known community)\n"
8579 "Do not export to next AS (well-known community)\n")
8581 DEFUN (show_bgp_view_afi_safi_community_all
,
8582 show_bgp_view_afi_safi_community_all_cmd
,
8584 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community",
8586 "show bgp view WORD ipv4 (unicast|multicast) community",
8596 "Address Family modifier\n"
8597 "Address Family modifier\n"
8598 "Display routes matching the communities\n")
8604 /* BGP structure lookup. */
8605 bgp
= bgp_lookup_by_name (argv
[0]);
8608 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
8613 afi
= (strncmp (argv
[1], "ipv6", 4) == 0) ? AFI_IP6
: AFI_IP
;
8614 safi
= (strncmp (argv
[2], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
8617 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
8619 return bgp_show (vty
, bgp
, afi
, safi
, bgp_show_type_community_all
, NULL
, NULL
);
8622 DEFUN (show_bgp_view_afi_safi_community
,
8623 show_bgp_view_afi_safi_community_cmd
,
8625 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
8627 "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
8637 "Address family modifier\n"
8638 "Address family modifier\n"
8639 "Display routes matching the communities\n"
8640 "community number\n"
8641 "Do not send outside local AS (well-known community)\n"
8642 "Do not advertise to any peer (well-known community)\n"
8643 "Do not export to next AS (well-known community)\n")
8649 afi
= (strncmp (argv
[1], "ipv6", 4) == 0) ? AFI_IP6
: AFI_IP
;
8650 safi
= (strncmp (argv
[2], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
8651 return bgp_show_community (vty
, argv
[0], argc
-3, &argv
[3], 0, afi
, safi
);
8654 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
8655 return bgp_show_community (vty
, argv
[0], argc
-2, &argv
[2], 0, afi
, safi
);
8659 ALIAS (show_bgp_view_afi_safi_community
,
8660 show_bgp_view_afi_safi_community2_cmd
,
8662 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8664 "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8674 "Address family modifier\n"
8675 "Address family modifier\n"
8676 "Display routes matching the communities\n"
8677 "community number\n"
8678 "Do not send outside local AS (well-known community)\n"
8679 "Do not advertise to any peer (well-known community)\n"
8680 "Do not export to next AS (well-known community)\n"
8681 "community number\n"
8682 "Do not send outside local AS (well-known community)\n"
8683 "Do not advertise to any peer (well-known community)\n"
8684 "Do not export to next AS (well-known community)\n")
8686 ALIAS (show_bgp_view_afi_safi_community
,
8687 show_bgp_view_afi_safi_community3_cmd
,
8689 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8691 "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8701 "Address family modifier\n"
8702 "Address family modifier\n"
8703 "Display routes matching the communities\n"
8704 "community number\n"
8705 "Do not send outside local AS (well-known community)\n"
8706 "Do not advertise to any peer (well-known community)\n"
8707 "Do not export to next AS (well-known community)\n"
8708 "community number\n"
8709 "Do not send outside local AS (well-known community)\n"
8710 "Do not advertise to any peer (well-known community)\n"
8711 "Do not export to next AS (well-known community)\n"
8712 "community number\n"
8713 "Do not send outside local AS (well-known community)\n"
8714 "Do not advertise to any peer (well-known community)\n"
8715 "Do not export to next AS (well-known community)\n")
8717 ALIAS (show_bgp_view_afi_safi_community
,
8718 show_bgp_view_afi_safi_community4_cmd
,
8720 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8722 "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8732 "Address family modifier\n"
8733 "Address family modifier\n"
8734 "Display routes matching the communities\n"
8735 "community number\n"
8736 "Do not send outside local AS (well-known community)\n"
8737 "Do not advertise to any peer (well-known community)\n"
8738 "Do not export to next AS (well-known community)\n"
8739 "community number\n"
8740 "Do not send outside local AS (well-known community)\n"
8741 "Do not advertise to any peer (well-known community)\n"
8742 "Do not export to next AS (well-known community)\n"
8743 "community number\n"
8744 "Do not send outside local AS (well-known community)\n"
8745 "Do not advertise to any peer (well-known community)\n"
8746 "Do not export to next AS (well-known community)\n"
8747 "community number\n"
8748 "Do not send outside local AS (well-known community)\n"
8749 "Do not advertise to any peer (well-known community)\n"
8750 "Do not export to next AS (well-known community)\n")
8752 DEFUN (show_ip_bgp_community_exact
,
8753 show_ip_bgp_community_exact_cmd
,
8754 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8758 "Display routes matching the communities\n"
8759 "community number\n"
8760 "Do not send outside local AS (well-known community)\n"
8761 "Do not advertise to any peer (well-known community)\n"
8762 "Do not export to next AS (well-known community)\n"
8763 "Exact match of the communities")
8765 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
8768 ALIAS (show_ip_bgp_community_exact
,
8769 show_ip_bgp_community2_exact_cmd
,
8770 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8774 "Display routes matching the communities\n"
8775 "community number\n"
8776 "Do not send outside local AS (well-known community)\n"
8777 "Do not advertise to any peer (well-known community)\n"
8778 "Do not export to next AS (well-known community)\n"
8779 "community number\n"
8780 "Do not send outside local AS (well-known community)\n"
8781 "Do not advertise to any peer (well-known community)\n"
8782 "Do not export to next AS (well-known community)\n"
8783 "Exact match of the communities")
8785 ALIAS (show_ip_bgp_community_exact
,
8786 show_ip_bgp_community3_exact_cmd
,
8787 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8791 "Display routes matching the communities\n"
8792 "community number\n"
8793 "Do not send outside local AS (well-known community)\n"
8794 "Do not advertise to any peer (well-known community)\n"
8795 "Do not export to next AS (well-known community)\n"
8796 "community number\n"
8797 "Do not send outside local AS (well-known community)\n"
8798 "Do not advertise to any peer (well-known community)\n"
8799 "Do not export to next AS (well-known community)\n"
8800 "community number\n"
8801 "Do not send outside local AS (well-known community)\n"
8802 "Do not advertise to any peer (well-known community)\n"
8803 "Do not export to next AS (well-known community)\n"
8804 "Exact match of the communities")
8806 ALIAS (show_ip_bgp_community_exact
,
8807 show_ip_bgp_community4_exact_cmd
,
8808 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8812 "Display routes matching the communities\n"
8813 "community number\n"
8814 "Do not send outside local AS (well-known community)\n"
8815 "Do not advertise to any peer (well-known community)\n"
8816 "Do not export to next AS (well-known community)\n"
8817 "community number\n"
8818 "Do not send outside local AS (well-known community)\n"
8819 "Do not advertise to any peer (well-known community)\n"
8820 "Do not export to next AS (well-known community)\n"
8821 "community number\n"
8822 "Do not send outside local AS (well-known community)\n"
8823 "Do not advertise to any peer (well-known community)\n"
8824 "Do not export to next AS (well-known community)\n"
8825 "community number\n"
8826 "Do not send outside local AS (well-known community)\n"
8827 "Do not advertise to any peer (well-known community)\n"
8828 "Do not export to next AS (well-known community)\n"
8829 "Exact match of the communities")
8831 DEFUN (show_ip_bgp_ipv4_community_exact
,
8832 show_ip_bgp_ipv4_community_exact_cmd
,
8833 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8838 "Address Family modifier\n"
8839 "Address Family modifier\n"
8840 "Display routes matching the communities\n"
8841 "community number\n"
8842 "Do not send outside local AS (well-known community)\n"
8843 "Do not advertise to any peer (well-known community)\n"
8844 "Do not export to next AS (well-known community)\n"
8845 "Exact match of the communities")
8847 if (strncmp (argv
[0], "m", 1) == 0)
8848 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP
, SAFI_MULTICAST
);
8850 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
8853 ALIAS (show_ip_bgp_ipv4_community_exact
,
8854 show_ip_bgp_ipv4_community2_exact_cmd
,
8855 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8860 "Address Family modifier\n"
8861 "Address Family modifier\n"
8862 "Display routes matching the communities\n"
8863 "community number\n"
8864 "Do not send outside local AS (well-known community)\n"
8865 "Do not advertise to any peer (well-known community)\n"
8866 "Do not export to next AS (well-known community)\n"
8867 "community number\n"
8868 "Do not send outside local AS (well-known community)\n"
8869 "Do not advertise to any peer (well-known community)\n"
8870 "Do not export to next AS (well-known community)\n"
8871 "Exact match of the communities")
8873 ALIAS (show_ip_bgp_ipv4_community_exact
,
8874 show_ip_bgp_ipv4_community3_exact_cmd
,
8875 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8880 "Address Family modifier\n"
8881 "Address Family modifier\n"
8882 "Display routes matching the communities\n"
8883 "community number\n"
8884 "Do not send outside local AS (well-known community)\n"
8885 "Do not advertise to any peer (well-known community)\n"
8886 "Do not export to next AS (well-known community)\n"
8887 "community number\n"
8888 "Do not send outside local AS (well-known community)\n"
8889 "Do not advertise to any peer (well-known community)\n"
8890 "Do not export to next AS (well-known community)\n"
8891 "community number\n"
8892 "Do not send outside local AS (well-known community)\n"
8893 "Do not advertise to any peer (well-known community)\n"
8894 "Do not export to next AS (well-known community)\n"
8895 "Exact match of the communities")
8897 ALIAS (show_ip_bgp_ipv4_community_exact
,
8898 show_ip_bgp_ipv4_community4_exact_cmd
,
8899 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8904 "Address Family modifier\n"
8905 "Address Family modifier\n"
8906 "Display routes matching the communities\n"
8907 "community number\n"
8908 "Do not send outside local AS (well-known community)\n"
8909 "Do not advertise to any peer (well-known community)\n"
8910 "Do not export to next AS (well-known community)\n"
8911 "community number\n"
8912 "Do not send outside local AS (well-known community)\n"
8913 "Do not advertise to any peer (well-known community)\n"
8914 "Do not export to next AS (well-known community)\n"
8915 "community number\n"
8916 "Do not send outside local AS (well-known community)\n"
8917 "Do not advertise to any peer (well-known community)\n"
8918 "Do not export to next AS (well-known community)\n"
8919 "community number\n"
8920 "Do not send outside local AS (well-known community)\n"
8921 "Do not advertise to any peer (well-known community)\n"
8922 "Do not export to next AS (well-known community)\n"
8923 "Exact match of the communities")
8926 DEFUN (show_bgp_community
,
8927 show_bgp_community_cmd
,
8928 "show bgp community (AA:NN|local-AS|no-advertise|no-export)",
8931 "Display routes matching the communities\n"
8932 "community number\n"
8933 "Do not send outside local AS (well-known community)\n"
8934 "Do not advertise to any peer (well-known community)\n"
8935 "Do not export to next AS (well-known community)\n")
8937 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
8940 ALIAS (show_bgp_community
,
8941 show_bgp_ipv6_community_cmd
,
8942 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)",
8946 "Display routes matching the communities\n"
8947 "community number\n"
8948 "Do not send outside local AS (well-known community)\n"
8949 "Do not advertise to any peer (well-known community)\n"
8950 "Do not export to next AS (well-known community)\n")
8952 ALIAS (show_bgp_community
,
8953 show_bgp_community2_cmd
,
8954 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8957 "Display routes matching the communities\n"
8958 "community number\n"
8959 "Do not send outside local AS (well-known community)\n"
8960 "Do not advertise to any peer (well-known community)\n"
8961 "Do not export to next AS (well-known community)\n"
8962 "community number\n"
8963 "Do not send outside local AS (well-known community)\n"
8964 "Do not advertise to any peer (well-known community)\n"
8965 "Do not export to next AS (well-known community)\n")
8967 ALIAS (show_bgp_community
,
8968 show_bgp_ipv6_community2_cmd
,
8969 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8973 "Display routes matching the communities\n"
8974 "community number\n"
8975 "Do not send outside local AS (well-known community)\n"
8976 "Do not advertise to any peer (well-known community)\n"
8977 "Do not export to next AS (well-known community)\n"
8978 "community number\n"
8979 "Do not send outside local AS (well-known community)\n"
8980 "Do not advertise to any peer (well-known community)\n"
8981 "Do not export to next AS (well-known community)\n")
8983 ALIAS (show_bgp_community
,
8984 show_bgp_community3_cmd
,
8985 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8988 "Display routes matching the communities\n"
8989 "community number\n"
8990 "Do not send outside local AS (well-known community)\n"
8991 "Do not advertise to any peer (well-known community)\n"
8992 "Do not export to next AS (well-known community)\n"
8993 "community number\n"
8994 "Do not send outside local AS (well-known community)\n"
8995 "Do not advertise to any peer (well-known community)\n"
8996 "Do not export to next AS (well-known community)\n"
8997 "community number\n"
8998 "Do not send outside local AS (well-known community)\n"
8999 "Do not advertise to any peer (well-known community)\n"
9000 "Do not export to next AS (well-known community)\n")
9002 ALIAS (show_bgp_community
,
9003 show_bgp_ipv6_community3_cmd
,
9004 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9008 "Display routes matching the communities\n"
9009 "community number\n"
9010 "Do not send outside local AS (well-known community)\n"
9011 "Do not advertise to any peer (well-known community)\n"
9012 "Do not export to next AS (well-known community)\n"
9013 "community number\n"
9014 "Do not send outside local AS (well-known community)\n"
9015 "Do not advertise to any peer (well-known community)\n"
9016 "Do not export to next AS (well-known community)\n"
9017 "community number\n"
9018 "Do not send outside local AS (well-known community)\n"
9019 "Do not advertise to any peer (well-known community)\n"
9020 "Do not export to next AS (well-known community)\n")
9022 ALIAS (show_bgp_community
,
9023 show_bgp_community4_cmd
,
9024 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9027 "Display routes matching the communities\n"
9028 "community number\n"
9029 "Do not send outside local AS (well-known community)\n"
9030 "Do not advertise to any peer (well-known community)\n"
9031 "Do not export to next AS (well-known community)\n"
9032 "community number\n"
9033 "Do not send outside local AS (well-known community)\n"
9034 "Do not advertise to any peer (well-known community)\n"
9035 "Do not export to next AS (well-known community)\n"
9036 "community number\n"
9037 "Do not send outside local AS (well-known community)\n"
9038 "Do not advertise to any peer (well-known community)\n"
9039 "Do not export to next AS (well-known community)\n"
9040 "community number\n"
9041 "Do not send outside local AS (well-known community)\n"
9042 "Do not advertise to any peer (well-known community)\n"
9043 "Do not export to next AS (well-known community)\n")
9045 ALIAS (show_bgp_community
,
9046 show_bgp_ipv6_community4_cmd
,
9047 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9051 "Display routes matching the communities\n"
9052 "community number\n"
9053 "Do not send outside local AS (well-known community)\n"
9054 "Do not advertise to any peer (well-known community)\n"
9055 "Do not export to next AS (well-known community)\n"
9056 "community number\n"
9057 "Do not send outside local AS (well-known community)\n"
9058 "Do not advertise to any peer (well-known community)\n"
9059 "Do not export to next AS (well-known community)\n"
9060 "community number\n"
9061 "Do not send outside local AS (well-known community)\n"
9062 "Do not advertise to any peer (well-known community)\n"
9063 "Do not export to next AS (well-known community)\n"
9064 "community number\n"
9065 "Do not send outside local AS (well-known community)\n"
9066 "Do not advertise to any peer (well-known community)\n"
9067 "Do not export to next AS (well-known community)\n")
9070 DEFUN (show_ipv6_bgp_community
,
9071 show_ipv6_bgp_community_cmd
,
9072 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export)",
9076 "Display routes matching the communities\n"
9077 "community number\n"
9078 "Do not send outside local AS (well-known community)\n"
9079 "Do not advertise to any peer (well-known community)\n"
9080 "Do not export to next AS (well-known community)\n")
9082 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
9086 ALIAS (show_ipv6_bgp_community
,
9087 show_ipv6_bgp_community2_cmd
,
9088 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9092 "Display routes matching the communities\n"
9093 "community number\n"
9094 "Do not send outside local AS (well-known community)\n"
9095 "Do not advertise to any peer (well-known community)\n"
9096 "Do not export to next AS (well-known community)\n"
9097 "community number\n"
9098 "Do not send outside local AS (well-known community)\n"
9099 "Do not advertise to any peer (well-known community)\n"
9100 "Do not export to next AS (well-known community)\n")
9103 ALIAS (show_ipv6_bgp_community
,
9104 show_ipv6_bgp_community3_cmd
,
9105 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9109 "Display routes matching the communities\n"
9110 "community number\n"
9111 "Do not send outside local AS (well-known community)\n"
9112 "Do not advertise to any peer (well-known community)\n"
9113 "Do not export to next AS (well-known community)\n"
9114 "community number\n"
9115 "Do not send outside local AS (well-known community)\n"
9116 "Do not advertise to any peer (well-known community)\n"
9117 "Do not export to next AS (well-known community)\n"
9118 "community number\n"
9119 "Do not send outside local AS (well-known community)\n"
9120 "Do not advertise to any peer (well-known community)\n"
9121 "Do not export to next AS (well-known community)\n")
9124 ALIAS (show_ipv6_bgp_community
,
9125 show_ipv6_bgp_community4_cmd
,
9126 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9130 "Display routes matching the communities\n"
9131 "community number\n"
9132 "Do not send outside local AS (well-known community)\n"
9133 "Do not advertise to any peer (well-known community)\n"
9134 "Do not export to next AS (well-known community)\n"
9135 "community number\n"
9136 "Do not send outside local AS (well-known community)\n"
9137 "Do not advertise to any peer (well-known community)\n"
9138 "Do not export to next AS (well-known community)\n"
9139 "community number\n"
9140 "Do not send outside local AS (well-known community)\n"
9141 "Do not advertise to any peer (well-known community)\n"
9142 "Do not export to next AS (well-known community)\n"
9143 "community number\n"
9144 "Do not send outside local AS (well-known community)\n"
9145 "Do not advertise to any peer (well-known community)\n"
9146 "Do not export to next AS (well-known community)\n")
9148 DEFUN (show_bgp_community_exact
,
9149 show_bgp_community_exact_cmd
,
9150 "show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
9153 "Display routes matching the communities\n"
9154 "community number\n"
9155 "Do not send outside local AS (well-known community)\n"
9156 "Do not advertise to any peer (well-known community)\n"
9157 "Do not export to next AS (well-known community)\n"
9158 "Exact match of the communities")
9160 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
9163 ALIAS (show_bgp_community_exact
,
9164 show_bgp_ipv6_community_exact_cmd
,
9165 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match",
9169 "Display routes matching the communities\n"
9170 "community number\n"
9171 "Do not send outside local AS (well-known community)\n"
9172 "Do not advertise to any peer (well-known community)\n"
9173 "Do not export to next AS (well-known community)\n"
9174 "Exact match of the communities")
9176 ALIAS (show_bgp_community_exact
,
9177 show_bgp_community2_exact_cmd
,
9178 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9181 "Display routes matching the communities\n"
9182 "community number\n"
9183 "Do not send outside local AS (well-known community)\n"
9184 "Do not advertise to any peer (well-known community)\n"
9185 "Do not export to next AS (well-known community)\n"
9186 "community number\n"
9187 "Do not send outside local AS (well-known community)\n"
9188 "Do not advertise to any peer (well-known community)\n"
9189 "Do not export to next AS (well-known community)\n"
9190 "Exact match of the communities")
9192 ALIAS (show_bgp_community_exact
,
9193 show_bgp_ipv6_community2_exact_cmd
,
9194 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9198 "Display routes matching the communities\n"
9199 "community number\n"
9200 "Do not send outside local AS (well-known community)\n"
9201 "Do not advertise to any peer (well-known community)\n"
9202 "Do not export to next AS (well-known community)\n"
9203 "community number\n"
9204 "Do not send outside local AS (well-known community)\n"
9205 "Do not advertise to any peer (well-known community)\n"
9206 "Do not export to next AS (well-known community)\n"
9207 "Exact match of the communities")
9209 ALIAS (show_bgp_community_exact
,
9210 show_bgp_community3_exact_cmd
,
9211 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9214 "Display routes matching the communities\n"
9215 "community number\n"
9216 "Do not send outside local AS (well-known community)\n"
9217 "Do not advertise to any peer (well-known community)\n"
9218 "Do not export to next AS (well-known community)\n"
9219 "community number\n"
9220 "Do not send outside local AS (well-known community)\n"
9221 "Do not advertise to any peer (well-known community)\n"
9222 "Do not export to next AS (well-known community)\n"
9223 "community number\n"
9224 "Do not send outside local AS (well-known community)\n"
9225 "Do not advertise to any peer (well-known community)\n"
9226 "Do not export to next AS (well-known community)\n"
9227 "Exact match of the communities")
9229 ALIAS (show_bgp_community_exact
,
9230 show_bgp_ipv6_community3_exact_cmd
,
9231 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9235 "Display routes matching the communities\n"
9236 "community number\n"
9237 "Do not send outside local AS (well-known community)\n"
9238 "Do not advertise to any peer (well-known community)\n"
9239 "Do not export to next AS (well-known community)\n"
9240 "community number\n"
9241 "Do not send outside local AS (well-known community)\n"
9242 "Do not advertise to any peer (well-known community)\n"
9243 "Do not export to next AS (well-known community)\n"
9244 "community number\n"
9245 "Do not send outside local AS (well-known community)\n"
9246 "Do not advertise to any peer (well-known community)\n"
9247 "Do not export to next AS (well-known community)\n"
9248 "Exact match of the communities")
9250 ALIAS (show_bgp_community_exact
,
9251 show_bgp_community4_exact_cmd
,
9252 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9255 "Display routes matching the communities\n"
9256 "community number\n"
9257 "Do not send outside local AS (well-known community)\n"
9258 "Do not advertise to any peer (well-known community)\n"
9259 "Do not export to next AS (well-known community)\n"
9260 "community number\n"
9261 "Do not send outside local AS (well-known community)\n"
9262 "Do not advertise to any peer (well-known community)\n"
9263 "Do not export to next AS (well-known community)\n"
9264 "community number\n"
9265 "Do not send outside local AS (well-known community)\n"
9266 "Do not advertise to any peer (well-known community)\n"
9267 "Do not export to next AS (well-known community)\n"
9268 "community number\n"
9269 "Do not send outside local AS (well-known community)\n"
9270 "Do not advertise to any peer (well-known community)\n"
9271 "Do not export to next AS (well-known community)\n"
9272 "Exact match of the communities")
9274 ALIAS (show_bgp_community_exact
,
9275 show_bgp_ipv6_community4_exact_cmd
,
9276 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9280 "Display routes matching the communities\n"
9281 "community number\n"
9282 "Do not send outside local AS (well-known community)\n"
9283 "Do not advertise to any peer (well-known community)\n"
9284 "Do not export to next AS (well-known community)\n"
9285 "community number\n"
9286 "Do not send outside local AS (well-known community)\n"
9287 "Do not advertise to any peer (well-known community)\n"
9288 "Do not export to next AS (well-known community)\n"
9289 "community number\n"
9290 "Do not send outside local AS (well-known community)\n"
9291 "Do not advertise to any peer (well-known community)\n"
9292 "Do not export to next AS (well-known community)\n"
9293 "community number\n"
9294 "Do not send outside local AS (well-known community)\n"
9295 "Do not advertise to any peer (well-known community)\n"
9296 "Do not export to next AS (well-known community)\n"
9297 "Exact match of the communities")
9300 DEFUN (show_ipv6_bgp_community_exact
,
9301 show_ipv6_bgp_community_exact_cmd
,
9302 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
9306 "Display routes matching the communities\n"
9307 "community number\n"
9308 "Do not send outside local AS (well-known community)\n"
9309 "Do not advertise to any peer (well-known community)\n"
9310 "Do not export to next AS (well-known community)\n"
9311 "Exact match of the communities")
9313 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
9317 ALIAS (show_ipv6_bgp_community_exact
,
9318 show_ipv6_bgp_community2_exact_cmd
,
9319 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9323 "Display routes matching the communities\n"
9324 "community number\n"
9325 "Do not send outside local AS (well-known community)\n"
9326 "Do not advertise to any peer (well-known community)\n"
9327 "Do not export to next AS (well-known community)\n"
9328 "community number\n"
9329 "Do not send outside local AS (well-known community)\n"
9330 "Do not advertise to any peer (well-known community)\n"
9331 "Do not export to next AS (well-known community)\n"
9332 "Exact match of the communities")
9335 ALIAS (show_ipv6_bgp_community_exact
,
9336 show_ipv6_bgp_community3_exact_cmd
,
9337 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9341 "Display routes matching the communities\n"
9342 "community number\n"
9343 "Do not send outside local AS (well-known community)\n"
9344 "Do not advertise to any peer (well-known community)\n"
9345 "Do not export to next AS (well-known community)\n"
9346 "community number\n"
9347 "Do not send outside local AS (well-known community)\n"
9348 "Do not advertise to any peer (well-known community)\n"
9349 "Do not export to next AS (well-known community)\n"
9350 "community number\n"
9351 "Do not send outside local AS (well-known community)\n"
9352 "Do not advertise to any peer (well-known community)\n"
9353 "Do not export to next AS (well-known community)\n"
9354 "Exact match of the communities")
9357 ALIAS (show_ipv6_bgp_community_exact
,
9358 show_ipv6_bgp_community4_exact_cmd
,
9359 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9363 "Display routes matching the communities\n"
9364 "community number\n"
9365 "Do not send outside local AS (well-known community)\n"
9366 "Do not advertise to any peer (well-known community)\n"
9367 "Do not export to next AS (well-known community)\n"
9368 "community number\n"
9369 "Do not send outside local AS (well-known community)\n"
9370 "Do not advertise to any peer (well-known community)\n"
9371 "Do not export to next AS (well-known community)\n"
9372 "community number\n"
9373 "Do not send outside local AS (well-known community)\n"
9374 "Do not advertise to any peer (well-known community)\n"
9375 "Do not export to next AS (well-known community)\n"
9376 "community number\n"
9377 "Do not send outside local AS (well-known community)\n"
9378 "Do not advertise to any peer (well-known community)\n"
9379 "Do not export to next AS (well-known community)\n"
9380 "Exact match of the communities")
9383 DEFUN (show_ipv6_mbgp_community
,
9384 show_ipv6_mbgp_community_cmd
,
9385 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export)",
9389 "Display routes matching the communities\n"
9390 "community number\n"
9391 "Do not send outside local AS (well-known community)\n"
9392 "Do not advertise to any peer (well-known community)\n"
9393 "Do not export to next AS (well-known community)\n")
9395 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP6
, SAFI_MULTICAST
);
9399 ALIAS (show_ipv6_mbgp_community
,
9400 show_ipv6_mbgp_community2_cmd
,
9401 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9405 "Display routes matching the communities\n"
9406 "community number\n"
9407 "Do not send outside local AS (well-known community)\n"
9408 "Do not advertise to any peer (well-known community)\n"
9409 "Do not export to next AS (well-known community)\n"
9410 "community number\n"
9411 "Do not send outside local AS (well-known community)\n"
9412 "Do not advertise to any peer (well-known community)\n"
9413 "Do not export to next AS (well-known community)\n")
9416 ALIAS (show_ipv6_mbgp_community
,
9417 show_ipv6_mbgp_community3_cmd
,
9418 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9422 "Display routes matching the communities\n"
9423 "community number\n"
9424 "Do not send outside local AS (well-known community)\n"
9425 "Do not advertise to any peer (well-known community)\n"
9426 "Do not export to next AS (well-known community)\n"
9427 "community number\n"
9428 "Do not send outside local AS (well-known community)\n"
9429 "Do not advertise to any peer (well-known community)\n"
9430 "Do not export to next AS (well-known community)\n"
9431 "community number\n"
9432 "Do not send outside local AS (well-known community)\n"
9433 "Do not advertise to any peer (well-known community)\n"
9434 "Do not export to next AS (well-known community)\n")
9437 ALIAS (show_ipv6_mbgp_community
,
9438 show_ipv6_mbgp_community4_cmd
,
9439 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9443 "Display routes matching the communities\n"
9444 "community number\n"
9445 "Do not send outside local AS (well-known community)\n"
9446 "Do not advertise to any peer (well-known community)\n"
9447 "Do not export to next AS (well-known community)\n"
9448 "community number\n"
9449 "Do not send outside local AS (well-known community)\n"
9450 "Do not advertise to any peer (well-known community)\n"
9451 "Do not export to next AS (well-known community)\n"
9452 "community number\n"
9453 "Do not send outside local AS (well-known community)\n"
9454 "Do not advertise to any peer (well-known community)\n"
9455 "Do not export to next AS (well-known community)\n"
9456 "community number\n"
9457 "Do not send outside local AS (well-known community)\n"
9458 "Do not advertise to any peer (well-known community)\n"
9459 "Do not export to next AS (well-known community)\n")
9462 DEFUN (show_ipv6_mbgp_community_exact
,
9463 show_ipv6_mbgp_community_exact_cmd
,
9464 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
9468 "Display routes matching the communities\n"
9469 "community number\n"
9470 "Do not send outside local AS (well-known community)\n"
9471 "Do not advertise to any peer (well-known community)\n"
9472 "Do not export to next AS (well-known community)\n"
9473 "Exact match of the communities")
9475 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP6
, SAFI_MULTICAST
);
9479 ALIAS (show_ipv6_mbgp_community_exact
,
9480 show_ipv6_mbgp_community2_exact_cmd
,
9481 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9485 "Display routes matching the communities\n"
9486 "community number\n"
9487 "Do not send outside local AS (well-known community)\n"
9488 "Do not advertise to any peer (well-known community)\n"
9489 "Do not export to next AS (well-known community)\n"
9490 "community number\n"
9491 "Do not send outside local AS (well-known community)\n"
9492 "Do not advertise to any peer (well-known community)\n"
9493 "Do not export to next AS (well-known community)\n"
9494 "Exact match of the communities")
9497 ALIAS (show_ipv6_mbgp_community_exact
,
9498 show_ipv6_mbgp_community3_exact_cmd
,
9499 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9503 "Display routes matching the communities\n"
9504 "community number\n"
9505 "Do not send outside local AS (well-known community)\n"
9506 "Do not advertise to any peer (well-known community)\n"
9507 "Do not export to next AS (well-known community)\n"
9508 "community number\n"
9509 "Do not send outside local AS (well-known community)\n"
9510 "Do not advertise to any peer (well-known community)\n"
9511 "Do not export to next AS (well-known community)\n"
9512 "community number\n"
9513 "Do not send outside local AS (well-known community)\n"
9514 "Do not advertise to any peer (well-known community)\n"
9515 "Do not export to next AS (well-known community)\n"
9516 "Exact match of the communities")
9519 ALIAS (show_ipv6_mbgp_community_exact
,
9520 show_ipv6_mbgp_community4_exact_cmd
,
9521 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9525 "Display routes matching the communities\n"
9526 "community number\n"
9527 "Do not send outside local AS (well-known community)\n"
9528 "Do not advertise to any peer (well-known community)\n"
9529 "Do not export to next AS (well-known community)\n"
9530 "community number\n"
9531 "Do not send outside local AS (well-known community)\n"
9532 "Do not advertise to any peer (well-known community)\n"
9533 "Do not export to next AS (well-known community)\n"
9534 "community number\n"
9535 "Do not send outside local AS (well-known community)\n"
9536 "Do not advertise to any peer (well-known community)\n"
9537 "Do not export to next AS (well-known community)\n"
9538 "community number\n"
9539 "Do not send outside local AS (well-known community)\n"
9540 "Do not advertise to any peer (well-known community)\n"
9541 "Do not export to next AS (well-known community)\n"
9542 "Exact match of the communities")
9543 #endif /* HAVE_IPV6 */
9546 bgp_show_community_list (struct vty
*vty
, const char *com
, int exact
,
9547 afi_t afi
, safi_t safi
)
9549 struct community_list
*list
;
9551 list
= community_list_lookup (bgp_clist
, com
, COMMUNITY_LIST_MASTER
);
9554 vty_out (vty
, "%% %s is not a valid community-list name%s", com
,
9559 return bgp_show (vty
, NULL
, afi
, safi
,
9560 (exact
? bgp_show_type_community_list_exact
:
9561 bgp_show_type_community_list
), list
, NULL
);
9564 DEFUN (show_ip_bgp_community_list
,
9565 show_ip_bgp_community_list_cmd
,
9566 "show ip bgp community-list (<1-500>|WORD)",
9570 "Display routes matching the community-list\n"
9571 "community-list number\n"
9572 "community-list name\n")
9574 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP
, SAFI_UNICAST
);
9577 DEFUN (show_ip_bgp_ipv4_community_list
,
9578 show_ip_bgp_ipv4_community_list_cmd
,
9579 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)",
9584 "Address Family modifier\n"
9585 "Address Family modifier\n"
9586 "Display routes matching the community-list\n"
9587 "community-list number\n"
9588 "community-list name\n")
9590 if (strncmp (argv
[0], "m", 1) == 0)
9591 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_MULTICAST
);
9593 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_UNICAST
);
9596 DEFUN (show_ip_bgp_community_list_exact
,
9597 show_ip_bgp_community_list_exact_cmd
,
9598 "show ip bgp community-list (<1-500>|WORD) exact-match",
9602 "Display routes matching the community-list\n"
9603 "community-list number\n"
9604 "community-list name\n"
9605 "Exact match of the communities\n")
9607 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP
, SAFI_UNICAST
);
9610 DEFUN (show_ip_bgp_ipv4_community_list_exact
,
9611 show_ip_bgp_ipv4_community_list_exact_cmd
,
9612 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match",
9617 "Address Family modifier\n"
9618 "Address Family modifier\n"
9619 "Display routes matching the community-list\n"
9620 "community-list number\n"
9621 "community-list name\n"
9622 "Exact match of the communities\n")
9624 if (strncmp (argv
[0], "m", 1) == 0)
9625 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_MULTICAST
);
9627 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_UNICAST
);
9631 DEFUN (show_bgp_community_list
,
9632 show_bgp_community_list_cmd
,
9633 "show bgp community-list (<1-500>|WORD)",
9636 "Display routes matching the community-list\n"
9637 "community-list number\n"
9638 "community-list name\n")
9640 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
9643 ALIAS (show_bgp_community_list
,
9644 show_bgp_ipv6_community_list_cmd
,
9645 "show bgp ipv6 community-list (<1-500>|WORD)",
9649 "Display routes matching the community-list\n"
9650 "community-list number\n"
9651 "community-list name\n")
9654 DEFUN (show_ipv6_bgp_community_list
,
9655 show_ipv6_bgp_community_list_cmd
,
9656 "show ipv6 bgp community-list WORD",
9660 "Display routes matching the community-list\n"
9661 "community-list name\n")
9663 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
9667 DEFUN (show_ipv6_mbgp_community_list
,
9668 show_ipv6_mbgp_community_list_cmd
,
9669 "show ipv6 mbgp community-list WORD",
9673 "Display routes matching the community-list\n"
9674 "community-list name\n")
9676 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_MULTICAST
);
9679 DEFUN (show_bgp_community_list_exact
,
9680 show_bgp_community_list_exact_cmd
,
9681 "show bgp community-list (<1-500>|WORD) exact-match",
9684 "Display routes matching the community-list\n"
9685 "community-list number\n"
9686 "community-list name\n"
9687 "Exact match of the communities\n")
9689 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
9692 ALIAS (show_bgp_community_list_exact
,
9693 show_bgp_ipv6_community_list_exact_cmd
,
9694 "show bgp ipv6 community-list (<1-500>|WORD) exact-match",
9698 "Display routes matching the community-list\n"
9699 "community-list number\n"
9700 "community-list name\n"
9701 "Exact match of the communities\n")
9704 DEFUN (show_ipv6_bgp_community_list_exact
,
9705 show_ipv6_bgp_community_list_exact_cmd
,
9706 "show ipv6 bgp community-list WORD exact-match",
9710 "Display routes matching the community-list\n"
9711 "community-list name\n"
9712 "Exact match of the communities\n")
9714 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
9718 DEFUN (show_ipv6_mbgp_community_list_exact
,
9719 show_ipv6_mbgp_community_list_exact_cmd
,
9720 "show ipv6 mbgp community-list WORD exact-match",
9724 "Display routes matching the community-list\n"
9725 "community-list name\n"
9726 "Exact match of the communities\n")
9728 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_MULTICAST
);
9730 #endif /* HAVE_IPV6 */
9733 bgp_show_prefix_longer (struct vty
*vty
, const char *prefix
, afi_t afi
,
9734 safi_t safi
, enum bgp_show_type type
)
9741 ret
= str2prefix (prefix
, p
);
9744 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
9748 ret
= bgp_show (vty
, NULL
, afi
, safi
, type
, p
, NULL
);
9753 DEFUN (show_ip_bgp_prefix_longer
,
9754 show_ip_bgp_prefix_longer_cmd
,
9755 "show ip bgp A.B.C.D/M longer-prefixes",
9759 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
9760 "Display route and more specific routes\n")
9762 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
9763 bgp_show_type_prefix_longer
);
9766 DEFUN (show_ip_bgp_flap_prefix_longer
,
9767 show_ip_bgp_flap_prefix_longer_cmd
,
9768 "show ip bgp flap-statistics A.B.C.D/M longer-prefixes",
9772 "Display flap statistics of routes\n"
9773 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
9774 "Display route and more specific routes\n")
9776 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
9777 bgp_show_type_flap_prefix_longer
);
9780 DEFUN (show_ip_bgp_ipv4_prefix_longer
,
9781 show_ip_bgp_ipv4_prefix_longer_cmd
,
9782 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes",
9787 "Address Family modifier\n"
9788 "Address Family modifier\n"
9789 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
9790 "Display route and more specific routes\n")
9792 if (strncmp (argv
[0], "m", 1) == 0)
9793 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
9794 bgp_show_type_prefix_longer
);
9796 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
9797 bgp_show_type_prefix_longer
);
9800 DEFUN (show_ip_bgp_flap_address
,
9801 show_ip_bgp_flap_address_cmd
,
9802 "show ip bgp flap-statistics A.B.C.D",
9806 "Display flap statistics of routes\n"
9807 "Network in the BGP routing table to display\n")
9809 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
9810 bgp_show_type_flap_address
);
9813 DEFUN (show_ip_bgp_flap_prefix
,
9814 show_ip_bgp_flap_prefix_cmd
,
9815 "show ip bgp flap-statistics A.B.C.D/M",
9819 "Display flap statistics of routes\n"
9820 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
9822 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
9823 bgp_show_type_flap_prefix
);
9826 DEFUN (show_bgp_prefix_longer
,
9827 show_bgp_prefix_longer_cmd
,
9828 "show bgp X:X::X:X/M longer-prefixes",
9831 "IPv6 prefix <network>/<length>\n"
9832 "Display route and more specific routes\n")
9834 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
9835 bgp_show_type_prefix_longer
);
9838 ALIAS (show_bgp_prefix_longer
,
9839 show_bgp_ipv6_prefix_longer_cmd
,
9840 "show bgp ipv6 X:X::X:X/M longer-prefixes",
9844 "IPv6 prefix <network>/<length>\n"
9845 "Display route and more specific routes\n")
9848 DEFUN (show_ipv6_bgp_prefix_longer
,
9849 show_ipv6_bgp_prefix_longer_cmd
,
9850 "show ipv6 bgp X:X::X:X/M longer-prefixes",
9854 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
9855 "Display route and more specific routes\n")
9857 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
9858 bgp_show_type_prefix_longer
);
9862 DEFUN (show_ipv6_mbgp_prefix_longer
,
9863 show_ipv6_mbgp_prefix_longer_cmd
,
9864 "show ipv6 mbgp X:X::X:X/M longer-prefixes",
9868 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
9869 "Display route and more specific routes\n")
9871 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
9872 bgp_show_type_prefix_longer
);
9874 #endif /* HAVE_IPV6 */
9876 static struct peer
*
9877 peer_lookup_in_view (struct vty
*vty
, const char *view_name
,
9885 /* BGP structure lookup. */
9888 bgp
= bgp_lookup_by_name (view_name
);
9891 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
9897 bgp
= bgp_get_default ();
9900 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9905 /* Get peer sockunion. */
9906 ret
= str2sockunion (ip_str
, &su
);
9909 peer
= peer_lookup_by_conf_if (bgp
, ip_str
);
9912 vty_out (vty
, "%% Malformed address or name: %s%s", ip_str
, VTY_NEWLINE
);
9918 /* Peer structure lookup. */
9919 peer
= peer_lookup (bgp
, &su
);
9922 vty_out (vty
, "No such neighbor%s", VTY_NEWLINE
);
9931 BGP_STATS_MAXBITLEN
= 0,
9935 BGP_STATS_UNAGGREGATEABLE
,
9936 BGP_STATS_MAX_AGGREGATEABLE
,
9937 BGP_STATS_AGGREGATES
,
9939 BGP_STATS_ASPATH_COUNT
,
9940 BGP_STATS_ASPATH_MAXHOPS
,
9941 BGP_STATS_ASPATH_TOTHOPS
,
9942 BGP_STATS_ASPATH_MAXSIZE
,
9943 BGP_STATS_ASPATH_TOTSIZE
,
9944 BGP_STATS_ASN_HIGHEST
,
9948 static const char *table_stats_strs
[] =
9950 [BGP_STATS_PREFIXES
] = "Total Prefixes",
9951 [BGP_STATS_TOTPLEN
] = "Average prefix length",
9952 [BGP_STATS_RIB
] = "Total Advertisements",
9953 [BGP_STATS_UNAGGREGATEABLE
] = "Unaggregateable prefixes",
9954 [BGP_STATS_MAX_AGGREGATEABLE
] = "Maximum aggregateable prefixes",
9955 [BGP_STATS_AGGREGATES
] = "BGP Aggregate advertisements",
9956 [BGP_STATS_SPACE
] = "Address space advertised",
9957 [BGP_STATS_ASPATH_COUNT
] = "Advertisements with paths",
9958 [BGP_STATS_ASPATH_MAXHOPS
] = "Longest AS-Path (hops)",
9959 [BGP_STATS_ASPATH_MAXSIZE
] = "Largest AS-Path (bytes)",
9960 [BGP_STATS_ASPATH_TOTHOPS
] = "Average AS-Path length (hops)",
9961 [BGP_STATS_ASPATH_TOTSIZE
] = "Average AS-Path size (bytes)",
9962 [BGP_STATS_ASN_HIGHEST
] = "Highest public ASN",
9963 [BGP_STATS_MAX
] = NULL
,
9966 struct bgp_table_stats
9968 struct bgp_table
*table
;
9969 unsigned long long counts
[BGP_STATS_MAX
];
9973 #define TALLY_SIGFIG 100000
9974 static unsigned long
9975 ravg_tally (unsigned long count
, unsigned long oldavg
, unsigned long newval
)
9977 unsigned long newtot
= (count
-1) * oldavg
+ (newval
* TALLY_SIGFIG
);
9978 unsigned long res
= (newtot
* TALLY_SIGFIG
) / count
;
9979 unsigned long ret
= newtot
/ count
;
9981 if ((res
% TALLY_SIGFIG
) > (TALLY_SIGFIG
/2))
9989 bgp_table_stats_walker (struct thread
*t
)
9991 struct bgp_node
*rn
;
9992 struct bgp_node
*top
;
9993 struct bgp_table_stats
*ts
= THREAD_ARG (t
);
9994 unsigned int space
= 0;
9996 if (!(top
= bgp_table_top (ts
->table
)))
9999 switch (top
->p
.family
)
10002 space
= IPV4_MAX_BITLEN
;
10005 space
= IPV6_MAX_BITLEN
;
10009 ts
->counts
[BGP_STATS_MAXBITLEN
] = space
;
10011 for (rn
= top
; rn
; rn
= bgp_route_next (rn
))
10013 struct bgp_info
*ri
;
10014 struct bgp_node
*prn
= bgp_node_parent_nolock (rn
);
10015 unsigned int rinum
= 0;
10023 ts
->counts
[BGP_STATS_PREFIXES
]++;
10024 ts
->counts
[BGP_STATS_TOTPLEN
] += rn
->p
.prefixlen
;
10027 ts
->counts
[BGP_STATS_AVGPLEN
]
10028 = ravg_tally (ts
->counts
[BGP_STATS_PREFIXES
],
10029 ts
->counts
[BGP_STATS_AVGPLEN
],
10033 /* check if the prefix is included by any other announcements */
10034 while (prn
&& !prn
->info
)
10035 prn
= bgp_node_parent_nolock (prn
);
10037 if (prn
== NULL
|| prn
== top
)
10039 ts
->counts
[BGP_STATS_UNAGGREGATEABLE
]++;
10040 /* announced address space */
10042 ts
->counts
[BGP_STATS_SPACE
] += 1 << (space
- rn
->p
.prefixlen
);
10044 else if (prn
->info
)
10045 ts
->counts
[BGP_STATS_MAX_AGGREGATEABLE
]++;
10047 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
10050 ts
->counts
[BGP_STATS_RIB
]++;
10053 (CHECK_FLAG (ri
->attr
->flag
,
10054 ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
))))
10055 ts
->counts
[BGP_STATS_AGGREGATES
]++;
10057 /* as-path stats */
10058 if (ri
->attr
&& ri
->attr
->aspath
)
10060 unsigned int hops
= aspath_count_hops (ri
->attr
->aspath
);
10061 unsigned int size
= aspath_size (ri
->attr
->aspath
);
10062 as_t highest
= aspath_highest (ri
->attr
->aspath
);
10064 ts
->counts
[BGP_STATS_ASPATH_COUNT
]++;
10066 if (hops
> ts
->counts
[BGP_STATS_ASPATH_MAXHOPS
])
10067 ts
->counts
[BGP_STATS_ASPATH_MAXHOPS
] = hops
;
10069 if (size
> ts
->counts
[BGP_STATS_ASPATH_MAXSIZE
])
10070 ts
->counts
[BGP_STATS_ASPATH_MAXSIZE
] = size
;
10072 ts
->counts
[BGP_STATS_ASPATH_TOTHOPS
] += hops
;
10073 ts
->counts
[BGP_STATS_ASPATH_TOTSIZE
] += size
;
10075 ts
->counts
[BGP_STATS_ASPATH_AVGHOPS
]
10076 = ravg_tally (ts
->counts
[BGP_STATS_ASPATH_COUNT
],
10077 ts
->counts
[BGP_STATS_ASPATH_AVGHOPS
],
10079 ts
->counts
[BGP_STATS_ASPATH_AVGSIZE
]
10080 = ravg_tally (ts
->counts
[BGP_STATS_ASPATH_COUNT
],
10081 ts
->counts
[BGP_STATS_ASPATH_AVGSIZE
],
10084 if (highest
> ts
->counts
[BGP_STATS_ASN_HIGHEST
])
10085 ts
->counts
[BGP_STATS_ASN_HIGHEST
] = highest
;
10093 bgp_table_stats (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
)
10095 struct bgp_table_stats ts
;
10098 if (!bgp
->rib
[afi
][safi
])
10100 vty_out (vty
, "%% No RIB exist for the AFI/SAFI%s", VTY_NEWLINE
);
10101 return CMD_WARNING
;
10104 memset (&ts
, 0, sizeof (ts
));
10105 ts
.table
= bgp
->rib
[afi
][safi
];
10106 thread_execute (bm
->master
, bgp_table_stats_walker
, &ts
, 0);
10108 vty_out (vty
, "BGP %s RIB statistics%s%s",
10109 afi_safi_print (afi
, safi
), VTY_NEWLINE
, VTY_NEWLINE
);
10111 for (i
= 0; i
< BGP_STATS_MAX
; i
++)
10113 if (!table_stats_strs
[i
])
10119 case BGP_STATS_ASPATH_AVGHOPS
:
10120 case BGP_STATS_ASPATH_AVGSIZE
:
10121 case BGP_STATS_AVGPLEN
:
10122 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
10123 vty_out (vty
, "%12.2f",
10124 (float)ts
.counts
[i
] / (float)TALLY_SIGFIG
);
10127 case BGP_STATS_ASPATH_TOTHOPS
:
10128 case BGP_STATS_ASPATH_TOTSIZE
:
10129 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
10130 vty_out (vty
, "%12.2f",
10132 (float)ts
.counts
[i
] /
10133 (float)ts
.counts
[BGP_STATS_ASPATH_COUNT
]
10136 case BGP_STATS_TOTPLEN
:
10137 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
10138 vty_out (vty
, "%12.2f",
10140 (float)ts
.counts
[i
] /
10141 (float)ts
.counts
[BGP_STATS_PREFIXES
]
10144 case BGP_STATS_SPACE
:
10145 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
10146 vty_out (vty
, "%12llu%s", ts
.counts
[i
], VTY_NEWLINE
);
10147 if (ts
.counts
[BGP_STATS_MAXBITLEN
] < 9)
10149 vty_out (vty
, "%30s: ", "%% announced ");
10150 vty_out (vty
, "%12.2f%s",
10151 100 * (float)ts
.counts
[BGP_STATS_SPACE
] /
10152 (float)((uint64_t)1UL << ts
.counts
[BGP_STATS_MAXBITLEN
]),
10154 vty_out (vty
, "%30s: ", "/8 equivalent ");
10155 vty_out (vty
, "%12.2f%s",
10156 (float)ts
.counts
[BGP_STATS_SPACE
] /
10157 (float)(1UL << (ts
.counts
[BGP_STATS_MAXBITLEN
] - 8)),
10159 if (ts
.counts
[BGP_STATS_MAXBITLEN
] < 25)
10161 vty_out (vty
, "%30s: ", "/24 equivalent ");
10162 vty_out (vty
, "%12.2f",
10163 (float)ts
.counts
[BGP_STATS_SPACE
] /
10164 (float)(1UL << (ts
.counts
[BGP_STATS_MAXBITLEN
] - 24)));
10167 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
10168 vty_out (vty
, "%12llu", ts
.counts
[i
]);
10171 vty_out (vty
, "%s", VTY_NEWLINE
);
10173 return CMD_SUCCESS
;
10177 bgp_table_stats_vty (struct vty
*vty
, const char *name
,
10178 const char *afi_str
, const char *safi_str
)
10185 bgp
= bgp_lookup_by_name (name
);
10187 bgp
= bgp_get_default ();
10191 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
10192 return CMD_WARNING
;
10194 if (strncmp (afi_str
, "ipv", 3) == 0)
10196 if (strncmp (afi_str
, "ipv4", 4) == 0)
10198 else if (strncmp (afi_str
, "ipv6", 4) == 0)
10202 vty_out (vty
, "%% Invalid address family %s%s",
10203 afi_str
, VTY_NEWLINE
);
10204 return CMD_WARNING
;
10206 if (strncmp (safi_str
, "m", 1) == 0)
10207 safi
= SAFI_MULTICAST
;
10208 else if (strncmp (safi_str
, "u", 1) == 0)
10209 safi
= SAFI_UNICAST
;
10210 else if (strncmp (safi_str
, "vpnv4", 5) == 0 || strncmp (safi_str
, "vpnv6", 5) == 0)
10211 safi
= SAFI_MPLS_LABELED_VPN
;
10214 vty_out (vty
, "%% Invalid subsequent address family %s%s",
10215 safi_str
, VTY_NEWLINE
);
10216 return CMD_WARNING
;
10221 vty_out (vty
, "%% Invalid address family %s%s",
10222 afi_str
, VTY_NEWLINE
);
10223 return CMD_WARNING
;
10226 return bgp_table_stats (vty
, bgp
, afi
, safi
);
10229 DEFUN (show_bgp_statistics
,
10230 show_bgp_statistics_cmd
,
10231 "show bgp (ipv4|ipv6) (unicast|multicast) statistics",
10236 "Address Family modifier\n"
10237 "Address Family modifier\n"
10238 "BGP RIB advertisement statistics\n")
10240 return bgp_table_stats_vty (vty
, NULL
, argv
[0], argv
[1]);
10243 ALIAS (show_bgp_statistics
,
10244 show_bgp_statistics_vpnv4_cmd
,
10245 "show bgp (ipv4) (vpnv4) statistics",
10249 "Address Family modifier\n"
10250 "BGP RIB advertisement statistics\n")
10252 DEFUN (show_bgp_statistics_view
,
10253 show_bgp_statistics_view_cmd
,
10254 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) statistics",
10260 "Address Family modifier\n"
10261 "Address Family modifier\n"
10262 "BGP RIB advertisement statistics\n")
10264 return bgp_table_stats_vty (vty
, NULL
, argv
[0], argv
[1]);
10267 ALIAS (show_bgp_statistics_view
,
10268 show_bgp_statistics_view_vpnv4_cmd
,
10269 "show bgp view WORD (ipv4) (vpnv4) statistics",
10274 "Address Family modifier\n"
10275 "BGP RIB advertisement statistics\n")
10287 PCOUNT_PFCNT
, /* the figure we display to users */
10291 static const char *pcount_strs
[] =
10293 [PCOUNT_ADJ_IN
] = "Adj-in",
10294 [PCOUNT_DAMPED
] = "Damped",
10295 [PCOUNT_REMOVED
] = "Removed",
10296 [PCOUNT_HISTORY
] = "History",
10297 [PCOUNT_STALE
] = "Stale",
10298 [PCOUNT_VALID
] = "Valid",
10299 [PCOUNT_ALL
] = "All RIB",
10300 [PCOUNT_COUNTED
] = "PfxCt counted",
10301 [PCOUNT_PFCNT
] = "Useable",
10302 [PCOUNT_MAX
] = NULL
,
10305 struct peer_pcounts
10307 unsigned int count
[PCOUNT_MAX
];
10308 const struct peer
*peer
;
10309 const struct bgp_table
*table
;
10313 bgp_peer_count_walker (struct thread
*t
)
10315 struct bgp_node
*rn
;
10316 struct peer_pcounts
*pc
= THREAD_ARG (t
);
10317 const struct peer
*peer
= pc
->peer
;
10319 for (rn
= bgp_table_top (pc
->table
); rn
; rn
= bgp_route_next (rn
))
10321 struct bgp_adj_in
*ain
;
10322 struct bgp_info
*ri
;
10324 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
10325 if (ain
->peer
== peer
)
10326 pc
->count
[PCOUNT_ADJ_IN
]++;
10328 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
10330 char buf
[SU_ADDRSTRLEN
];
10332 if (ri
->peer
!= peer
)
10335 pc
->count
[PCOUNT_ALL
]++;
10337 if (CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
))
10338 pc
->count
[PCOUNT_DAMPED
]++;
10339 if (CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
10340 pc
->count
[PCOUNT_HISTORY
]++;
10341 if (CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
))
10342 pc
->count
[PCOUNT_REMOVED
]++;
10343 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
10344 pc
->count
[PCOUNT_STALE
]++;
10345 if (CHECK_FLAG (ri
->flags
, BGP_INFO_VALID
))
10346 pc
->count
[PCOUNT_VALID
]++;
10347 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
10348 pc
->count
[PCOUNT_PFCNT
]++;
10350 if (CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
10352 pc
->count
[PCOUNT_COUNTED
]++;
10353 if (CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
10354 plog_warn (peer
->log
,
10355 "%s [pcount] %s/%d is counted but flags 0x%x",
10357 inet_ntop(rn
->p
.family
, &rn
->p
.u
.prefix
,
10358 buf
, SU_ADDRSTRLEN
),
10364 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
10365 plog_warn (peer
->log
,
10366 "%s [pcount] %s/%d not counted but flags 0x%x",
10368 inet_ntop(rn
->p
.family
, &rn
->p
.u
.prefix
,
10369 buf
, SU_ADDRSTRLEN
),
10379 bgp_peer_counts (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
)
10381 struct peer_pcounts pcounts
= { .peer
= peer
};
10384 if (!peer
|| !peer
->bgp
|| !peer
->afc
[afi
][safi
]
10385 || !peer
->bgp
->rib
[afi
][safi
])
10387 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
10388 return CMD_WARNING
;
10391 memset (&pcounts
, 0, sizeof(pcounts
));
10392 pcounts
.peer
= peer
;
10393 pcounts
.table
= peer
->bgp
->rib
[afi
][safi
];
10395 /* in-place call via thread subsystem so as to record execution time
10396 * stats for the thread-walk (i.e. ensure this can't be blamed on
10397 * on just vty_read()).
10399 thread_execute (bm
->master
, bgp_peer_count_walker
, &pcounts
, 0);
10401 vty_out (vty
, "Prefix counts for %s, %s%s",
10402 peer
->host
, afi_safi_print (afi
, safi
), VTY_NEWLINE
);
10403 vty_out (vty
, "PfxCt: %ld%s", peer
->pcount
[afi
][safi
], VTY_NEWLINE
);
10404 vty_out (vty
, "%sCounts from RIB table walk:%s%s",
10405 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
10407 for (i
= 0; i
< PCOUNT_MAX
; i
++)
10408 vty_out (vty
, "%20s: %-10d%s",
10409 pcount_strs
[i
], pcounts
.count
[i
], VTY_NEWLINE
);
10411 if (pcounts
.count
[PCOUNT_PFCNT
] != peer
->pcount
[afi
][safi
])
10413 vty_out (vty
, "%s [pcount] PfxCt drift!%s",
10414 peer
->host
, VTY_NEWLINE
);
10415 vty_out (vty
, "Please report this bug, with the above command output%s",
10419 return CMD_SUCCESS
;
10422 DEFUN (show_ip_bgp_neighbor_prefix_counts
,
10423 show_ip_bgp_neighbor_prefix_counts_cmd
,
10424 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts",
10428 "Detailed information on TCP and BGP neighbor connections\n"
10429 "Neighbor to display information about\n"
10430 "Neighbor to display information about\n"
10431 "Neighbor on bgp configured interface\n"
10432 "Display detailed prefix count information\n")
10436 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10438 return CMD_WARNING
;
10440 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_UNICAST
);
10443 DEFUN (show_bgp_ipv6_neighbor_prefix_counts
,
10444 show_bgp_ipv6_neighbor_prefix_counts_cmd
,
10445 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts",
10449 "Detailed information on TCP and BGP neighbor connections\n"
10450 "Neighbor to display information about\n"
10451 "Neighbor to display information about\n"
10452 "Neighbor on bgp configured interface\n"
10453 "Display detailed prefix count information\n")
10457 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10459 return CMD_WARNING
;
10461 return bgp_peer_counts (vty
, peer
, AFI_IP6
, SAFI_UNICAST
);
10464 DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts
,
10465 show_ip_bgp_ipv4_neighbor_prefix_counts_cmd
,
10466 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts",
10471 "Address Family modifier\n"
10472 "Address Family modifier\n"
10473 "Detailed information on TCP and BGP neighbor connections\n"
10474 "Neighbor to display information about\n"
10475 "Neighbor to display information about\n"
10476 "Neighbor on bgp configured interface\n"
10477 "Display detailed prefix count information\n")
10481 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
10483 return CMD_WARNING
;
10485 if (strncmp (argv
[0], "m", 1) == 0)
10486 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_MULTICAST
);
10488 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_UNICAST
);
10491 DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts
,
10492 show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd
,
10493 "show ip bgp vpnv4 all neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts",
10498 "Address Family modifier\n"
10499 "Address Family modifier\n"
10500 "Detailed information on TCP and BGP neighbor connections\n"
10501 "Neighbor to display information about\n"
10502 "Neighbor to display information about\n"
10503 "Neighbor on bgp configured interface\n"
10504 "Display detailed prefix count information\n")
10508 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10510 return CMD_WARNING
;
10512 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_MPLS_VPN
);
10516 show_adj_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
,
10517 int in
, char *delim
, char *rmap_name
)
10519 struct bgp_table
*table
;
10520 struct bgp_adj_in
*ain
;
10521 struct bgp_adj_out
*adj
;
10522 unsigned long output_count
;
10523 unsigned long filtered_count
;
10524 struct bgp_node
*rn
;
10529 struct attr_extra extra
;
10540 table
= bgp
->rib
[afi
][safi
];
10542 output_count
= filtered_count
= 0;
10544 if (! in
&& CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
10545 PEER_STATUS_DEFAULT_ORIGINATE
))
10547 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
10548 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
10549 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
10551 vty_out (vty
, "Originating default network 0.0.0.0%s%s",
10552 VTY_NEWLINE
, VTY_NEWLINE
);
10556 attr
.extra
= &extra
;
10557 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
10560 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
10561 if (ain
->peer
== peer
)
10565 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
10566 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
10567 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
10573 vty_out (vty
, BGP_SHOW_HEADER_CSV
, VTY_NEWLINE
);
10575 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
10580 bgp_attr_dup(&attr
, ain
->attr
);
10581 if (bgp_input_modifier(peer
, &rn
->p
, &attr
, afi
,
10582 safi
, rmap_name
) != RMAP_DENY
)
10584 route_vty_out_tmp (vty
, &rn
->p
, &attr
, safi
, delim
);
10594 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
)
10595 if (adj
->peer
== peer
)
10599 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
10600 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
10601 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
10607 vty_out (vty
, BGP_SHOW_HEADER_CSV
, VTY_NEWLINE
);
10609 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
10614 if (!CHECK_FLAG(peer
->af_flags
[afi
][safi
],
10615 PEER_FLAG_REFLECTOR_CLIENT
)
10616 || bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
10619 bgp_attr_dup(&attr
, adj
->attr
);
10620 ret
= bgp_output_modifier(peer
, &rn
->p
, &attr
, afi
,
10626 if (ret
!= RMAP_DENY
)
10628 route_vty_out_tmp (vty
, &rn
->p
, &attr
, safi
, delim
);
10637 if (output_count
!= 0)
10638 vty_out (vty
, "%sTotal number of prefixes %ld%s",
10639 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
10643 peer_adj_routes (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
,
10644 int in
, char *delim
, char *rmap_name
)
10646 if (! peer
|| ! peer
->afc
[afi
][safi
])
10648 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
10649 return CMD_WARNING
;
10652 if (in
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
10654 vty_out (vty
, "%% Inbound soft reconfiguration not enabled%s",
10656 return CMD_WARNING
;
10659 if (!in
&& (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
)
10660 && !bgp_flag_check(peer
->bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
)))
10662 vty_out (vty
, "%% Cannot apply outgoing route-map on route-reflector clients%s",
10664 vty_out (vty
, "%% Enable bgp route-reflector allow-outbound-policy flag%s",
10666 return CMD_WARNING
;
10669 show_adj_route (vty
, peer
, afi
, safi
, in
, delim
, rmap_name
);
10671 return CMD_SUCCESS
;
10674 DEFUN (show_ip_bgp_view_neighbor_advertised_route
,
10675 show_ip_bgp_view_neighbor_advertised_route_cmd
,
10676 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10682 "Detailed information on TCP and BGP neighbor connections\n"
10683 "Neighbor to display information about\n"
10684 "Neighbor to display information about\n"
10685 "Display the routes advertised to a BGP neighbor\n")
10690 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10692 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10695 return CMD_WARNING
;
10697 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0, NULL
, NULL
);
10700 DEFUN (show_ip_bgp_neighbor_advertised_route
,
10701 show_ip_bgp_neighbor_advertised_route_cmd
,
10702 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10706 "Detailed information on TCP and BGP neighbor connections\n"
10707 "Neighbor to display information about\n"
10708 "Neighbor to display information about\n"
10709 "Neighbor on bgp configured interface\n"
10710 "Display the routes advertised to a BGP neighbor\n")
10714 char *rmap_name
= NULL
;
10716 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10719 return CMD_WARNING
;
10722 rmap_name
= argv
[1];
10724 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0, NULL
, rmap_name
);
10727 ALIAS (show_ip_bgp_neighbor_advertised_route
,
10728 show_ip_bgp_neighbor_advertised_route_rmap_cmd
,
10729 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD",
10733 "Detailed information on TCP and BGP neighbor connections\n"
10734 "Neighbor to display information about\n"
10735 "Neighbor to display information about\n"
10736 "Neighbor on bgp configured interface\n"
10737 "Display the routes advertised to a BGP neighbor\n")
10739 DEFUN (show_ip_bgp_neighbor_advertised_route_csv
,
10740 show_ip_bgp_neighbor_advertised_route_csv_cmd
,
10741 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
10747 "Detailed information on TCP and BGP neighbor connections\n"
10748 "Neighbor to display information about\n"
10749 "Neighbor to display information about\n"
10750 "Neighbor on bgp configured interface\n"
10751 "Display the routes advertised to a BGP neighbor\n")
10754 char *rmap_name
= NULL
;
10756 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10759 return CMD_WARNING
;
10762 rmap_name
= argv
[1];
10764 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0, &csv
, rmap_name
);
10767 ALIAS (show_ip_bgp_neighbor_advertised_route_csv
,
10768 show_ip_bgp_neighbor_advertised_route_csv_rmap_cmd
,
10769 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv route-map WORD",
10775 "Detailed information on TCP and BGP neighbor connections\n"
10776 "Neighbor to display information about\n"
10777 "Neighbor to display information about\n"
10778 "Neighbor on bgp configured interface\n"
10779 "Display the routes advertised to a BGP neighbor\n"
10780 "Apply this route-map to display what would've been advertised\n")
10782 DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route
,
10783 show_ip_bgp_ipv4_neighbor_advertised_route_cmd
,
10784 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10789 "Address Family modifier\n"
10790 "Address Family modifier\n"
10791 "Detailed information on TCP and BGP neighbor connections\n"
10792 "Neighbor to display information about\n"
10793 "Neighbor to display information about\n"
10794 "Neighbor on bgp configured interface\n"
10795 "Display the routes advertised to a BGP neighbor\n")
10798 char *rmap_name
= NULL
;
10800 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
10802 return CMD_WARNING
;
10805 rmap_name
= argv
[2];
10807 if (strncmp (argv
[0], "m", 1) == 0)
10808 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 0, NULL
, rmap_name
);
10810 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0, NULL
, rmap_name
);
10813 ALIAS (show_ip_bgp_ipv4_neighbor_advertised_route
,
10814 show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd
,
10815 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD",
10820 "Address Family modifier\n"
10821 "Address Family modifier\n"
10822 "Detailed information on TCP and BGP neighbor connections\n"
10823 "Neighbor to display information about\n"
10824 "Neighbor to display information about\n"
10825 "Neighbor on bgp configured interface\n"
10826 "Display the routes advertised to a BGP neighbor\n"
10827 "Route-map to control what is displayed\n")
10830 DEFUN (show_bgp_view_neighbor_advertised_route
,
10831 show_bgp_view_neighbor_advertised_route_cmd
,
10832 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10837 "Detailed information on TCP and BGP neighbor connections\n"
10838 "Neighbor to display information about\n"
10839 "Neighbor to display information about\n"
10840 "Neighbor on bgp configured interface\n"
10841 "Display the routes advertised to a BGP neighbor\n")
10846 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10848 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10851 return CMD_WARNING
;
10853 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0, NULL
, NULL
);
10856 ALIAS (show_bgp_view_neighbor_advertised_route
,
10857 show_bgp_view_ipv6_neighbor_advertised_route_cmd
,
10858 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10864 "Detailed information on TCP and BGP neighbor connections\n"
10865 "Neighbor to display information about\n"
10866 "Neighbor to display information about\n"
10867 "Neighbor on bgp configured interface\n"
10868 "Display the routes advertised to a BGP neighbor\n")
10870 DEFUN (show_bgp_view_neighbor_advertised_route_csv
,
10871 show_bgp_view_neighbor_advertised_route_csv_cmd
,
10872 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
10877 "Detailed information on TCP and BGP neighbor connections\n"
10878 "Neighbor to display information about\n"
10879 "Neighbor to display information about\n"
10880 "Neighbor on bgp configured interface\n"
10881 "Display the routes advertised to a BGP neighbor\n")
10886 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10888 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10891 return CMD_WARNING
;
10893 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0, &csv
, NULL
);
10896 ALIAS (show_bgp_view_neighbor_advertised_route_csv
,
10897 show_bgp_view_ipv6_neighbor_advertised_route_csv_cmd
,
10898 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
10904 "Detailed information on TCP and BGP neighbor connections\n"
10905 "Neighbor to display information about\n"
10906 "Neighbor to display information about\n"
10907 "Neighbor on bgp configured interface\n"
10908 "Display the routes advertised to a BGP neighbor\n")
10910 DEFUN (show_bgp_neighbor_advertised_route
,
10911 show_bgp_neighbor_advertised_route_cmd
,
10912 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10915 "Detailed information on TCP and BGP neighbor connections\n"
10916 "Neighbor to display information about\n"
10917 "Neighbor to display information about\n"
10918 "Neighbor on bgp configured interface\n"
10919 "Display the routes advertised to a BGP neighbor\n")
10923 char *rmap_name
= NULL
;
10925 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10928 return CMD_WARNING
;
10931 rmap_name
= argv
[1];
10933 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0, NULL
, rmap_name
);
10936 ALIAS (show_bgp_neighbor_advertised_route
,
10937 show_bgp_neighbor_advertised_route_rmap_cmd
,
10938 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD",
10941 "Detailed information on TCP and BGP neighbor connections\n"
10942 "Neighbor to display information about\n"
10943 "Neighbor to display information about\n"
10944 "Neighbor on bgp configured interface\n"
10945 "Display the routes advertised to a BGP neighbor\n")
10947 ALIAS (show_bgp_neighbor_advertised_route
,
10948 show_bgp_ipv6_neighbor_advertised_route_cmd
,
10949 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10953 "Detailed information on TCP and BGP neighbor connections\n"
10954 "Neighbor to display information about\n"
10955 "Neighbor to display information about\n"
10956 "Neighbor on bgp configured interface\n"
10957 "Display the routes advertised to a BGP neighbor\n")
10959 ALIAS (show_bgp_neighbor_advertised_route
,
10960 show_bgp_ipv6_neighbor_advertised_route_rmap_cmd
,
10961 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD",
10965 "Detailed information on TCP and BGP neighbor connections\n"
10966 "Neighbor to display information about\n"
10967 "Neighbor to display information about\n"
10968 "Neighbor on bgp configured interface\n"
10969 "Display the routes advertised to a BGP neighbor\n")
10971 DEFUN (show_bgp_neighbor_advertised_route_csv
,
10972 show_bgp_neighbor_advertised_route_csv_cmd
,
10973 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
10976 "Detailed information on TCP and BGP neighbor connections\n"
10977 "Neighbor to display information about\n"
10978 "Neighbor to display information about\n"
10979 "Neighbor on bgp configured interface\n"
10980 "Display the routes advertised to a BGP neighbor\n")
10983 char *rmap_name
= NULL
;
10985 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10988 return CMD_WARNING
;
10991 rmap_name
= argv
[1];
10993 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0, &csv
, rmap_name
);
10996 ALIAS (show_bgp_neighbor_advertised_route_csv
,
10997 show_bgp_neighbor_advertised_route_csv_rmap_cmd
,
10998 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv route-map WORD",
11001 "Detailed information on TCP and BGP neighbor connections\n"
11002 "Neighbor to display information about\n"
11003 "Neighbor to display information about\n"
11004 "Neighbor on bgp configured interface\n"
11005 "Display the routes advertised to a BGP neighbor\n")
11007 ALIAS (show_bgp_neighbor_advertised_route_csv
,
11008 show_bgp_ipv6_neighbor_advertised_route_csv_cmd
,
11009 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
11013 "Detailed information on TCP and BGP neighbor connections\n"
11014 "Neighbor to display information about\n"
11015 "Neighbor to display information about\n"
11016 "Neighbor on bgp configured interface\n"
11017 "Display the routes advertised to a BGP neighbor\n")
11019 ALIAS (show_bgp_neighbor_advertised_route_csv
,
11020 show_bgp_ipv6_neighbor_advertised_route_csv_rmap_cmd
,
11021 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv route-map WORD",
11025 "Detailed information on TCP and BGP neighbor connections\n"
11026 "Neighbor to display information about\n"
11027 "Neighbor to display information about\n"
11028 "Neighbor on bgp configured interface\n"
11029 "Display the routes advertised to a BGP neighbor\n")
11032 ALIAS (show_bgp_neighbor_advertised_route
,
11033 ipv6_bgp_neighbor_advertised_route_cmd
,
11034 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
11038 "Detailed information on TCP and BGP neighbor connections\n"
11039 "Neighbor to display information about\n"
11040 "Neighbor to display information about\n"
11041 "Neighbor on bgp configured interface\n"
11042 "Display the routes advertised to a BGP neighbor\n")
11045 DEFUN (ipv6_mbgp_neighbor_advertised_route
,
11046 ipv6_mbgp_neighbor_advertised_route_cmd
,
11047 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
11051 "Detailed information on TCP and BGP neighbor connections\n"
11052 "Neighbor to display information about\n"
11053 "Neighbor to display information about\n"
11054 "Neighbor on bgp configured interface\n"
11055 "Neighbor on bgp configured interface\n"
11056 "Display the routes advertised to a BGP neighbor\n")
11060 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11062 return CMD_WARNING
;
11064 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 0, NULL
, NULL
);
11066 #endif /* HAVE_IPV6 */
11068 DEFUN (show_bgp_view_neighbor_received_routes
,
11069 show_bgp_view_neighbor_received_routes_cmd
,
11070 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11075 "Detailed information on TCP and BGP neighbor connections\n"
11076 "Neighbor to display information about\n"
11077 "Neighbor to display information about\n"
11078 "Neighbor on bgp configured interface\n"
11079 "Display the received routes from neighbor\n")
11084 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11086 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11089 return CMD_WARNING
;
11091 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 1, NULL
, NULL
);
11094 DEFUN (show_ip_bgp_view_neighbor_received_routes
,
11095 show_ip_bgp_view_neighbor_received_routes_cmd
,
11096 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11102 "Detailed information on TCP and BGP neighbor connections\n"
11103 "Neighbor to display information about\n"
11104 "Neighbor to display information about\n"
11105 "Neighbor on bgp configured interface\n"
11106 "Display the received routes from neighbor\n")
11111 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11113 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11116 return CMD_WARNING
;
11118 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1, NULL
, NULL
);
11121 ALIAS (show_bgp_view_neighbor_received_routes
,
11122 show_bgp_view_ipv6_neighbor_received_routes_cmd
,
11123 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11129 "Detailed information on TCP and BGP neighbor connections\n"
11130 "Neighbor to display information about\n"
11131 "Neighbor to display information about\n"
11132 "Neighbor on bgp configured interface\n"
11133 "Display the received routes from neighbor\n")
11135 DEFUN (show_ip_bgp_neighbor_received_routes
,
11136 show_ip_bgp_neighbor_received_routes_cmd
,
11137 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11141 "Detailed information on TCP and BGP neighbor connections\n"
11142 "Neighbor to display information about\n"
11143 "Neighbor to display information about\n"
11144 "Neighbor on bgp configured interface\n"
11145 "Display the received routes from neighbor\n")
11149 char *rmap_name
= NULL
;
11151 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11154 return CMD_WARNING
;
11157 rmap_name
= argv
[1];
11159 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1, NULL
, rmap_name
);
11162 ALIAS (show_ip_bgp_neighbor_received_routes
,
11163 show_ip_bgp_neighbor_received_routes_rmap_cmd
,
11164 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD",
11168 "Detailed information on TCP and BGP neighbor connections\n"
11169 "Neighbor to display information about\n"
11170 "Neighbor to display information about\n"
11171 "Neighbor on bgp configured interface\n"
11172 "Display the received routes from neighbor\n")
11174 DEFUN (show_ip_bgp_ipv4_neighbor_received_routes
,
11175 show_ip_bgp_ipv4_neighbor_received_routes_cmd
,
11176 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11181 "Address Family modifier\n"
11182 "Address Family modifier\n"
11183 "Detailed information on TCP and BGP neighbor connections\n"
11184 "Neighbor to display information about\n"
11185 "Neighbor to display information about\n"
11186 "Neighbor on bgp configured interface\n"
11187 "Display the received routes from neighbor\n")
11190 char *rmap_name
= NULL
;
11192 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
11194 return CMD_WARNING
;
11197 rmap_name
= argv
[2];
11199 if (strncmp (argv
[0], "m", 1) == 0)
11200 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 1, NULL
, rmap_name
);
11202 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1, NULL
, rmap_name
);
11205 ALIAS (show_ip_bgp_ipv4_neighbor_received_routes
,
11206 show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd
,
11207 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD",
11212 "Address Family modifier\n"
11213 "Address Family modifier\n"
11214 "Detailed information on TCP and BGP neighbor connections\n"
11215 "Neighbor to display information about\n"
11216 "Neighbor to display information about\n"
11217 "Neighbor on bgp configured interface\n"
11218 "Display the received routes from neighbor\n")
11220 DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes
,
11221 show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd
,
11223 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes)",
11225 "show bgp view WORD ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes)",
11235 "Address family modifier\n"
11236 "Address family modifier\n"
11237 "Detailed information on TCP and BGP neighbor connections\n"
11238 "Neighbor to display information about\n"
11239 "Neighbor to display information about\n"
11240 "Neighbor on bgp configured interface\n"
11241 "Display the advertised routes to neighbor\n"
11242 "Display the received routes from neighbor\n")
11250 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[3]);
11252 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
11256 return CMD_WARNING
;
11259 afi
= (strncmp (argv
[1], "ipv6", 4) == 0) ? AFI_IP6
: AFI_IP
;
11260 safi
= (strncmp (argv
[2], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11261 in
= (strncmp (argv
[4], "r", 1) == 0) ? 1 : 0;
11264 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11265 in
= (strncmp (argv
[3], "r", 1) == 0) ? 1 : 0;
11268 return peer_adj_routes (vty
, peer
, afi
, safi
, in
, NULL
, NULL
);
11271 DEFUN (show_ip_bgp_neighbor_received_prefix_filter
,
11272 show_ip_bgp_neighbor_received_prefix_filter_cmd
,
11273 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
11277 "Detailed information on TCP and BGP neighbor connections\n"
11278 "Neighbor to display information about\n"
11279 "Neighbor to display information about\n"
11280 "Neighbor on bgp configured interface\n"
11281 "Display information received from a BGP neighbor\n"
11282 "Display the prefixlist filter\n")
11285 union sockunion su
;
11289 ret
= str2sockunion (argv
[0], &su
);
11292 peer
= peer_lookup_by_conf_if (NULL
, argv
[0]);
11295 vty_out (vty
, "Malformed address or name: %s%s", argv
[0], VTY_NEWLINE
);
11296 return CMD_WARNING
;
11301 peer
= peer_lookup (NULL
, &su
);
11303 return CMD_WARNING
;
11306 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
11307 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
11310 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
11311 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
11314 return CMD_SUCCESS
;
11317 DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter
,
11318 show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
,
11319 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
11324 "Address Family modifier\n"
11325 "Address Family modifier\n"
11326 "Detailed information on TCP and BGP neighbor connections\n"
11327 "Neighbor to display information about\n"
11328 "Neighbor to display information about\n"
11329 "Neighbor on bgp configured interface\n"
11330 "Display information received from a BGP neighbor\n"
11331 "Display the prefixlist filter\n")
11334 union sockunion su
;
11338 ret
= str2sockunion (argv
[1], &su
);
11341 peer
= peer_lookup_by_conf_if (NULL
, argv
[1]);
11344 vty_out (vty
, "Malformed address or name: %s%s", argv
[1], VTY_NEWLINE
);
11345 return CMD_WARNING
;
11350 peer
= peer_lookup (NULL
, &su
);
11352 return CMD_WARNING
;
11355 if (strncmp (argv
[0], "m", 1) == 0)
11357 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_MULTICAST
);
11358 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
11361 vty_out (vty
, "Address family: IPv4 Multicast%s", VTY_NEWLINE
);
11362 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
11367 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
11368 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
11371 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
11372 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
11376 return CMD_SUCCESS
;
11381 ALIAS (show_bgp_view_neighbor_received_routes
,
11382 show_bgp_neighbor_received_routes_cmd
,
11383 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11386 "Detailed information on TCP and BGP neighbor connections\n"
11387 "Neighbor to display information about\n"
11388 "Neighbor to display information about\n"
11389 "Neighbor on bgp configured interface\n"
11390 "Display the received routes from neighbor\n")
11392 ALIAS (show_bgp_view_neighbor_received_routes
,
11393 show_bgp_ipv6_neighbor_received_routes_cmd
,
11394 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11398 "Detailed information on TCP and BGP neighbor connections\n"
11399 "Neighbor to display information about\n"
11400 "Neighbor to display information about\n"
11401 "Neighbor on bgp configured interface\n"
11402 "Display the received routes from neighbor\n")
11404 ALIAS (show_bgp_view_neighbor_received_routes
,
11405 show_bgp_neighbor_received_routes_rmap_cmd
,
11406 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD",
11409 "Detailed information on TCP and BGP neighbor connections\n"
11410 "Neighbor to display information about\n"
11411 "Neighbor to display information about\n"
11412 "Neighbor on bgp configured interface\n"
11413 "Display the received routes from neighbor\n")
11415 ALIAS (show_bgp_view_neighbor_received_routes
,
11416 show_bgp_ipv6_neighbor_received_routes_rmap_cmd
,
11417 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD",
11421 "Detailed information on TCP and BGP neighbor connections\n"
11422 "Neighbor to display information about\n"
11423 "Neighbor to display information about\n"
11424 "Neighbor on bgp configured interface\n"
11425 "Display the received routes from neighbor\n")
11427 DEFUN (show_bgp_neighbor_received_prefix_filter
,
11428 show_bgp_neighbor_received_prefix_filter_cmd
,
11429 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
11432 "Detailed information on TCP and BGP neighbor connections\n"
11433 "Neighbor to display information about\n"
11434 "Neighbor to display information about\n"
11435 "Neighbor on bgp configured interface\n"
11436 "Display information received from a BGP neighbor\n"
11437 "Display the prefixlist filter\n")
11440 union sockunion su
;
11444 ret
= str2sockunion (argv
[0], &su
);
11447 peer
= peer_lookup_by_conf_if (NULL
, argv
[0]);
11450 vty_out (vty
, "Malformed address or name: %s%s", argv
[0], VTY_NEWLINE
);
11451 return CMD_WARNING
;
11456 peer
= peer_lookup (NULL
, &su
);
11458 return CMD_WARNING
;
11461 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
11462 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
11465 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
11466 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
11469 return CMD_SUCCESS
;
11472 ALIAS (show_bgp_neighbor_received_prefix_filter
,
11473 show_bgp_ipv6_neighbor_received_prefix_filter_cmd
,
11474 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
11478 "Detailed information on TCP and BGP neighbor connections\n"
11479 "Neighbor to display information about\n"
11480 "Neighbor to display information about\n"
11481 "Neighbor on bgp configured interface\n"
11482 "Display information received from a BGP neighbor\n"
11483 "Display the prefixlist filter\n")
11486 ALIAS (show_bgp_view_neighbor_received_routes
,
11487 ipv6_bgp_neighbor_received_routes_cmd
,
11488 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11492 "Detailed information on TCP and BGP neighbor connections\n"
11493 "Neighbor to display information about\n"
11494 "Neighbor to display information about\n"
11495 "Neighbor on bgp configured interface\n"
11496 "Display the received routes from neighbor\n")
11499 DEFUN (ipv6_mbgp_neighbor_received_routes
,
11500 ipv6_mbgp_neighbor_received_routes_cmd
,
11501 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11505 "Detailed information on TCP and BGP neighbor connections\n"
11506 "Neighbor to display information about\n"
11507 "Neighbor to display information about\n"
11508 "Neighbor on bgp configured interface\n"
11509 "Display the received routes from neighbor\n")
11513 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11515 return CMD_WARNING
;
11517 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 1, NULL
, NULL
);
11520 DEFUN (show_bgp_view_neighbor_received_prefix_filter
,
11521 show_bgp_view_neighbor_received_prefix_filter_cmd
,
11522 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
11527 "Detailed information on TCP and BGP neighbor connections\n"
11528 "Neighbor to display information about\n"
11529 "Neighbor to display information about\n"
11530 "Neighbor on bgp configured interface\n"
11531 "Display information received from a BGP neighbor\n"
11532 "Display the prefixlist filter\n")
11535 union sockunion su
;
11540 /* BGP structure lookup. */
11541 bgp
= bgp_lookup_by_name (argv
[0]);
11544 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
11545 return CMD_WARNING
;
11548 ret
= str2sockunion (argv
[1], &su
);
11551 peer
= peer_lookup_by_conf_if (bgp
, argv
[1]);
11554 vty_out (vty
, "%% Malformed address or name: %s%s", argv
[1], VTY_NEWLINE
);
11555 return CMD_WARNING
;
11560 peer
= peer_lookup (bgp
, &su
);
11562 return CMD_WARNING
;
11565 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
11566 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
11569 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
11570 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
11573 return CMD_SUCCESS
;
11576 ALIAS (show_bgp_view_neighbor_received_prefix_filter
,
11577 show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
,
11578 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
11584 "Detailed information on TCP and BGP neighbor connections\n"
11585 "Neighbor to display information about\n"
11586 "Neighbor to display information about\n"
11587 "Neighbor on bgp configured interface\n"
11588 "Display information received from a BGP neighbor\n"
11589 "Display the prefixlist filter\n")
11590 #endif /* HAVE_IPV6 */
11593 bgp_show_neighbor_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
11594 safi_t safi
, enum bgp_show_type type
, char *delim
)
11596 if (! peer
|| ! peer
->afc
[afi
][safi
])
11598 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
11599 return CMD_WARNING
;
11602 return bgp_show (vty
, peer
->bgp
, afi
, safi
, type
, &peer
->su
, delim
);
11605 DEFUN (show_ip_bgp_neighbor_routes
,
11606 show_ip_bgp_neighbor_routes_cmd
,
11607 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes",
11611 "Detailed information on TCP and BGP neighbor connections\n"
11612 "Neighbor to display information about\n"
11613 "Neighbor to display information about\n"
11614 "Neighbor on bgp configured interface\n"
11615 "Display routes learned from neighbor\n")
11619 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11621 return CMD_WARNING
;
11623 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
11624 bgp_show_type_neighbor
, NULL
);
11627 DEFUN (show_ip_bgp_neighbor_routes_csv
,
11628 show_ip_bgp_neighbor_routes_csv_cmd
,
11629 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes csv",
11633 "Detailed information on TCP and BGP neighbor connections\n"
11634 "Neighbor to display information about\n"
11635 "Neighbor to display information about\n"
11636 "Neighbor on bgp configured interface\n"
11637 "Display routes learned from neighbor\n")
11641 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11643 return CMD_WARNING
;
11645 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
11646 bgp_show_type_neighbor
, &csv
);
11649 DEFUN (show_ip_bgp_neighbor_flap
,
11650 show_ip_bgp_neighbor_flap_cmd
,
11651 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics",
11655 "Detailed information on TCP and BGP neighbor connections\n"
11656 "Neighbor to display information about\n"
11657 "Neighbor to display information about\n"
11658 "Neighbor on bgp configured interface\n"
11659 "Display flap statistics of the routes learned from neighbor\n")
11663 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11665 return CMD_WARNING
;
11667 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
11668 bgp_show_type_flap_neighbor
, NULL
);
11671 DEFUN (show_ip_bgp_neighbor_damp
,
11672 show_ip_bgp_neighbor_damp_cmd
,
11673 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes",
11677 "Detailed information on TCP and BGP neighbor connections\n"
11678 "Neighbor to display information about\n"
11679 "Neighbor to display information about\n"
11680 "Neighbor on bgp configured interface\n"
11681 "Display the dampened routes received from neighbor\n")
11685 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11687 return CMD_WARNING
;
11689 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
11690 bgp_show_type_damp_neighbor
, NULL
);
11693 DEFUN (show_ip_bgp_ipv4_neighbor_routes
,
11694 show_ip_bgp_ipv4_neighbor_routes_cmd
,
11695 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) routes",
11700 "Address Family modifier\n"
11701 "Address Family modifier\n"
11702 "Detailed information on TCP and BGP neighbor connections\n"
11703 "Neighbor to display information about\n"
11704 "Neighbor to display information about\n"
11705 "Neighbor on bgp configured interface\n"
11706 "Display routes learned from neighbor\n")
11710 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
11712 return CMD_WARNING
;
11714 if (strncmp (argv
[0], "m", 1) == 0)
11715 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_MULTICAST
,
11716 bgp_show_type_neighbor
, NULL
);
11718 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
11719 bgp_show_type_neighbor
, NULL
);
11722 DEFUN (show_ip_bgp_view_rsclient
,
11723 show_ip_bgp_view_rsclient_cmd
,
11724 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD)",
11730 "Information about Route Server Client\n"
11731 NEIGHBOR_ADDR_STR3
)
11733 struct bgp_table
*table
;
11737 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11739 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11742 return CMD_WARNING
;
11744 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
11746 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11748 return CMD_WARNING
;
11751 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
11752 PEER_FLAG_RSERVER_CLIENT
))
11754 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11756 return CMD_WARNING
;
11759 table
= peer
->rib
[AFI_IP
][SAFI_UNICAST
];
11761 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
,
11765 ALIAS (show_ip_bgp_view_rsclient
,
11766 show_ip_bgp_rsclient_cmd
,
11767 "show ip bgp rsclient (A.B.C.D|X:X::X:X|WORD)",
11771 "Information about Route Server Client\n"
11772 NEIGHBOR_ADDR_STR3
)
11774 DEFUN (show_bgp_view_ipv4_safi_rsclient
,
11775 show_bgp_view_ipv4_safi_rsclient_cmd
,
11776 "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)",
11782 "Address Family modifier\n"
11783 "Address Family modifier\n"
11784 "Information about Route Server Client\n"
11785 NEIGHBOR_ADDR_STR3
)
11787 struct bgp_table
*table
;
11792 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
11793 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11795 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
11796 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11800 return CMD_WARNING
;
11802 if (! peer
->afc
[AFI_IP
][safi
])
11804 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11806 return CMD_WARNING
;
11809 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][safi
],
11810 PEER_FLAG_RSERVER_CLIENT
))
11812 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11814 return CMD_WARNING
;
11817 table
= peer
->rib
[AFI_IP
][safi
];
11819 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
,
11823 ALIAS (show_bgp_view_ipv4_safi_rsclient
,
11824 show_bgp_ipv4_safi_rsclient_cmd
,
11825 "show bgp ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)",
11829 "Address Family modifier\n"
11830 "Address Family modifier\n"
11831 "Information about Route Server Client\n"
11832 NEIGHBOR_ADDR_STR3
)
11834 DEFUN (show_ip_bgp_view_rsclient_route
,
11835 show_ip_bgp_view_rsclient_route_cmd
,
11836 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D",
11842 "Information about Route Server Client\n"
11844 "Network in the BGP routing table to display\n")
11849 /* BGP structure lookup. */
11852 bgp
= bgp_lookup_by_name (argv
[0]);
11855 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
11856 return CMD_WARNING
;
11861 bgp
= bgp_get_default ();
11864 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
11865 return CMD_WARNING
;
11870 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11872 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11875 return CMD_WARNING
;
11877 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
11879 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11881 return CMD_WARNING
;
11884 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
11885 PEER_FLAG_RSERVER_CLIENT
))
11887 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11889 return CMD_WARNING
;
11892 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
11893 (argc
== 3) ? argv
[2] : argv
[1],
11894 AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
11897 ALIAS (show_ip_bgp_view_rsclient_route
,
11898 show_ip_bgp_rsclient_route_cmd
,
11899 "show ip bgp rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D",
11903 "Information about Route Server Client\n"
11905 "Network in the BGP routing table to display\n")
11907 DEFUN (show_bgp_view_ipv4_safi_rsclient_route
,
11908 show_bgp_view_ipv4_safi_rsclient_route_cmd
,
11909 "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D",
11915 "Address Family modifier\n"
11916 "Address Family modifier\n"
11917 "Information about Route Server Client\n"
11919 "Network in the BGP routing table to display\n")
11925 /* BGP structure lookup. */
11928 bgp
= bgp_lookup_by_name (argv
[0]);
11931 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
11932 return CMD_WARNING
;
11937 bgp
= bgp_get_default ();
11940 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
11941 return CMD_WARNING
;
11946 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
11947 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11949 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
11950 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11954 return CMD_WARNING
;
11956 if (! peer
->afc
[AFI_IP
][safi
])
11958 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11960 return CMD_WARNING
;
11963 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][safi
],
11964 PEER_FLAG_RSERVER_CLIENT
))
11966 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11968 return CMD_WARNING
;
11971 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][safi
],
11972 (argc
== 4) ? argv
[3] : argv
[2],
11973 AFI_IP
, safi
, NULL
, 0, BGP_PATH_ALL
);
11976 ALIAS (show_bgp_view_ipv4_safi_rsclient_route
,
11977 show_bgp_ipv4_safi_rsclient_route_cmd
,
11978 "show bgp ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D",
11982 "Address Family modifier\n"
11983 "Address Family modifier\n"
11984 "Information about Route Server Client\n"
11986 "Network in the BGP routing table to display\n")
11988 DEFUN (show_ip_bgp_view_rsclient_prefix
,
11989 show_ip_bgp_view_rsclient_prefix_cmd
,
11990 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D/M",
11996 "Information about Route Server Client\n"
11998 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
12003 /* BGP structure lookup. */
12006 bgp
= bgp_lookup_by_name (argv
[0]);
12009 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12010 return CMD_WARNING
;
12015 bgp
= bgp_get_default ();
12018 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12019 return CMD_WARNING
;
12024 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12026 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12029 return CMD_WARNING
;
12031 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
12033 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12035 return CMD_WARNING
;
12038 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
12039 PEER_FLAG_RSERVER_CLIENT
))
12041 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12043 return CMD_WARNING
;
12046 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
12047 (argc
== 3) ? argv
[2] : argv
[1],
12048 AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
12051 ALIAS (show_ip_bgp_view_rsclient_prefix
,
12052 show_ip_bgp_rsclient_prefix_cmd
,
12053 "show ip bgp rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D/M",
12057 "Information about Route Server Client\n"
12059 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
12061 DEFUN (show_bgp_view_ipv4_safi_rsclient_prefix
,
12062 show_bgp_view_ipv4_safi_rsclient_prefix_cmd
,
12063 "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D/M",
12069 "Address Family modifier\n"
12070 "Address Family modifier\n"
12071 "Information about Route Server Client\n"
12073 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
12079 /* BGP structure lookup. */
12082 bgp
= bgp_lookup_by_name (argv
[0]);
12085 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12086 return CMD_WARNING
;
12091 bgp
= bgp_get_default ();
12094 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12095 return CMD_WARNING
;
12100 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
12101 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12103 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
12104 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12108 return CMD_WARNING
;
12110 if (! peer
->afc
[AFI_IP
][safi
])
12112 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12114 return CMD_WARNING
;
12117 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][safi
],
12118 PEER_FLAG_RSERVER_CLIENT
))
12120 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12122 return CMD_WARNING
;
12125 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][safi
],
12126 (argc
== 4) ? argv
[3] : argv
[2],
12127 AFI_IP
, safi
, NULL
, 1, BGP_PATH_ALL
);
12130 ALIAS (show_bgp_view_ipv4_safi_rsclient_prefix
,
12131 show_bgp_ipv4_safi_rsclient_prefix_cmd
,
12132 "show bgp ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D/M",
12136 "Address Family modifier\n"
12137 "Address Family modifier\n"
12138 "Information about Route Server Client\n"
12140 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
12143 DEFUN (show_bgp_view_neighbor_routes
,
12144 show_bgp_view_neighbor_routes_cmd
,
12145 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) routes",
12150 "Detailed information on TCP and BGP neighbor connections\n"
12151 "Neighbor to display information about\n"
12152 "Neighbor to display information about\n"
12153 "Neighbor on bgp configured interface\n"
12154 "Display routes learned from neighbor\n")
12159 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12161 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12164 return CMD_WARNING
;
12166 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
12167 bgp_show_type_neighbor
, NULL
);
12170 DEFUN (show_bgp_view_neighbor_routes_csv
,
12171 show_bgp_view_neighbor_routes_csv_cmd
,
12172 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) routes csv",
12177 "Detailed information on TCP and BGP neighbor connections\n"
12178 "Neighbor to display information about\n"
12179 "Neighbor to display information about\n"
12180 "Neighbor on bgp configured interface\n"
12181 "Display routes learned from neighbor\n")
12186 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12188 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12191 return CMD_WARNING
;
12193 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
12194 bgp_show_type_neighbor
, &csv
);
12197 ALIAS (show_bgp_view_neighbor_routes
,
12198 show_bgp_view_ipv6_neighbor_routes_cmd
,
12199 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes",
12205 "Detailed information on TCP and BGP neighbor connections\n"
12206 "Neighbor to display information about\n"
12207 "Neighbor to display information about\n"
12208 "Neighbor on bgp configured interface\n"
12209 "Display routes learned from neighbor\n")
12211 DEFUN (show_bgp_view_neighbor_damp
,
12212 show_bgp_view_neighbor_damp_cmd
,
12213 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes",
12218 "Detailed information on TCP and BGP neighbor connections\n"
12219 "Neighbor to display information about\n"
12220 "Neighbor to display information about\n"
12221 "Neighbor on bgp configured interface\n"
12222 "Display the dampened routes received from neighbor\n")
12227 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12229 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12232 return CMD_WARNING
;
12234 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
12235 bgp_show_type_damp_neighbor
, NULL
);
12238 ALIAS (show_bgp_view_neighbor_damp
,
12239 show_bgp_view_ipv6_neighbor_damp_cmd
,
12240 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes",
12246 "Detailed information on TCP and BGP neighbor connections\n"
12247 "Neighbor to display information about\n"
12248 "Neighbor to display information about\n"
12249 "Neighbor on bgp configured interface\n"
12250 "Display the dampened routes received from neighbor\n")
12252 DEFUN (show_bgp_view_neighbor_flap
,
12253 show_bgp_view_neighbor_flap_cmd
,
12254 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics",
12259 "Detailed information on TCP and BGP neighbor connections\n"
12260 "Neighbor to display information about\n"
12261 "Neighbor to display information about\n"
12262 "Neighbor on bgp configured interface\n"
12263 "Display flap statistics of the routes learned from neighbor\n")
12268 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12270 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12273 return CMD_WARNING
;
12275 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
12276 bgp_show_type_flap_neighbor
, NULL
);
12279 ALIAS (show_bgp_view_neighbor_flap
,
12280 show_bgp_view_ipv6_neighbor_flap_cmd
,
12281 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics",
12287 "Detailed information on TCP and BGP neighbor connections\n"
12288 "Neighbor to display information about\n"
12289 "Neighbor to display information about\n"
12290 "Neighbor on bgp configured interface\n"
12291 "Display flap statistics of the routes learned from neighbor\n")
12293 ALIAS (show_bgp_view_neighbor_routes
,
12294 show_bgp_neighbor_routes_cmd
,
12295 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes",
12298 "Detailed information on TCP and BGP neighbor connections\n"
12299 "Neighbor to display information about\n"
12300 "Neighbor to display information about\n"
12301 "Neighbor on bgp configured interface\n"
12302 "Display routes learned from neighbor\n")
12305 ALIAS (show_bgp_view_neighbor_routes
,
12306 show_bgp_ipv6_neighbor_routes_cmd
,
12307 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes",
12311 "Detailed information on TCP and BGP neighbor connections\n"
12312 "Neighbor to display information about\n"
12313 "Neighbor to display information about\n"
12314 "Neighbor on bgp configured interface\n"
12315 "Display routes learned from neighbor\n")
12318 ALIAS (show_bgp_view_neighbor_routes
,
12319 ipv6_bgp_neighbor_routes_cmd
,
12320 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes",
12324 "Detailed information on TCP and BGP neighbor connections\n"
12325 "Neighbor to display information about\n"
12326 "Neighbor to display information about\n"
12327 "Neighbor on bgp configured interface\n"
12328 "Display routes learned from neighbor\n")
12330 ALIAS (show_bgp_view_neighbor_routes_csv
,
12331 show_bgp_neighbor_routes_csv_cmd
,
12332 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes csv",
12335 "Detailed information on TCP and BGP neighbor connections\n"
12336 "Neighbor to display information about\n"
12337 "Neighbor to display information about\n"
12338 "Neighbor on bgp configured interface\n"
12339 "Display routes learned from neighbor\n")
12342 ALIAS (show_bgp_view_neighbor_routes_csv
,
12343 show_bgp_ipv6_neighbor_routes_csv_cmd
,
12344 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes csv",
12348 "Detailed information on TCP and BGP neighbor connections\n"
12349 "Neighbor to display information about\n"
12350 "Neighbor to display information about\n"
12351 "Neighbor on bgp configured interface\n"
12352 "Display routes learned from neighbor\n")
12355 ALIAS (show_bgp_view_neighbor_routes_csv
,
12356 ipv6_bgp_neighbor_routes_csv_cmd
,
12357 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes csv",
12361 "Detailed information on TCP and BGP neighbor connections\n"
12362 "Neighbor to display information about\n"
12363 "Neighbor to display information about\n"
12364 "Neighbor on bgp configured interface\n"
12365 "Display routes learned from neighbor\n")
12368 DEFUN (ipv6_mbgp_neighbor_routes
,
12369 ipv6_mbgp_neighbor_routes_cmd
,
12370 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) routes",
12374 "Detailed information on TCP and BGP neighbor connections\n"
12375 "Neighbor to display information about\n"
12376 "Neighbor to display information about\n"
12377 "Neighbor on bgp configured interface\n"
12378 "Display routes learned from neighbor\n")
12382 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12384 return CMD_WARNING
;
12386 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
,
12387 bgp_show_type_neighbor
, NULL
);
12390 ALIAS (show_bgp_view_neighbor_flap
,
12391 show_bgp_neighbor_flap_cmd
,
12392 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics",
12395 "Detailed information on TCP and BGP neighbor connections\n"
12396 "Neighbor to display information about\n"
12397 "Neighbor to display information about\n"
12398 "Neighbor on bgp configured interface\n"
12399 "Display flap statistics of the routes learned from neighbor\n")
12401 ALIAS (show_bgp_view_neighbor_flap
,
12402 show_bgp_ipv6_neighbor_flap_cmd
,
12403 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics",
12407 "Detailed information on TCP and BGP neighbor connections\n"
12408 "Neighbor to display information about\n"
12409 "Neighbor to display information about\n"
12410 "Neighbor on bgp configured interface\n"
12411 "Display flap statistics of the routes learned from neighbor\n")
12413 ALIAS (show_bgp_view_neighbor_damp
,
12414 show_bgp_neighbor_damp_cmd
,
12415 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes",
12418 "Detailed information on TCP and BGP neighbor connections\n"
12419 "Neighbor to display information about\n"
12420 "Neighbor to display information about\n"
12421 "Neighbor on bgp configured interface\n"
12422 "Display the dampened routes received from neighbor\n")
12424 ALIAS (show_bgp_view_neighbor_damp
,
12425 show_bgp_ipv6_neighbor_damp_cmd
,
12426 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes",
12430 "Detailed information on TCP and BGP neighbor connections\n"
12431 "Neighbor to display information about\n"
12432 "Neighbor to display information about\n"
12433 "Neighbor on bgp configured interface\n"
12434 "Display the dampened routes received from neighbor\n")
12436 DEFUN (show_bgp_view_rsclient
,
12437 show_bgp_view_rsclient_cmd
,
12438 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD)",
12443 "Information about Route Server Client\n"
12444 NEIGHBOR_ADDR_STR3
)
12446 struct bgp_table
*table
;
12450 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12452 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12455 return CMD_WARNING
;
12457 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
12459 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12461 return CMD_WARNING
;
12464 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
12465 PEER_FLAG_RSERVER_CLIENT
))
12467 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12469 return CMD_WARNING
;
12472 table
= peer
->rib
[AFI_IP6
][SAFI_UNICAST
];
12474 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
,
12478 ALIAS (show_bgp_view_rsclient
,
12479 show_bgp_rsclient_cmd
,
12480 "show bgp rsclient (A.B.C.D|X:X::X:X|WORD)",
12483 "Information about Route Server Client\n"
12484 NEIGHBOR_ADDR_STR3
)
12486 DEFUN (show_bgp_view_ipv6_safi_rsclient
,
12487 show_bgp_view_ipv6_safi_rsclient_cmd
,
12488 "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)",
12494 "Address Family modifier\n"
12495 "Address Family modifier\n"
12496 "Information about Route Server Client\n"
12497 NEIGHBOR_ADDR_STR3
)
12499 struct bgp_table
*table
;
12504 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
12505 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12507 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
12508 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12512 return CMD_WARNING
;
12514 if (! peer
->afc
[AFI_IP6
][safi
])
12516 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12518 return CMD_WARNING
;
12521 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][safi
],
12522 PEER_FLAG_RSERVER_CLIENT
))
12524 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12526 return CMD_WARNING
;
12529 table
= peer
->rib
[AFI_IP6
][safi
];
12531 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
,
12535 ALIAS (show_bgp_view_ipv6_safi_rsclient
,
12536 show_bgp_ipv6_safi_rsclient_cmd
,
12537 "show bgp ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)",
12541 "Address Family modifier\n"
12542 "Address Family modifier\n"
12543 "Information about Route Server Client\n"
12544 NEIGHBOR_ADDR_STR3
)
12546 DEFUN (show_bgp_view_rsclient_route
,
12547 show_bgp_view_rsclient_route_cmd
,
12548 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X",
12553 "Information about Route Server Client\n"
12555 "Network in the BGP routing table to display\n")
12560 /* BGP structure lookup. */
12563 bgp
= bgp_lookup_by_name (argv
[0]);
12566 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12567 return CMD_WARNING
;
12572 bgp
= bgp_get_default ();
12575 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12576 return CMD_WARNING
;
12581 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12583 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12586 return CMD_WARNING
;
12588 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
12590 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12592 return CMD_WARNING
;
12595 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
12596 PEER_FLAG_RSERVER_CLIENT
))
12598 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12600 return CMD_WARNING
;
12603 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
12604 (argc
== 3) ? argv
[2] : argv
[1],
12605 AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
12608 ALIAS (show_bgp_view_rsclient_route
,
12609 show_bgp_rsclient_route_cmd
,
12610 "show bgp rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X",
12613 "Information about Route Server Client\n"
12615 "Network in the BGP routing table to display\n")
12617 DEFUN (show_bgp_view_ipv6_safi_rsclient_route
,
12618 show_bgp_view_ipv6_safi_rsclient_route_cmd
,
12619 "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X",
12625 "Address Family modifier\n"
12626 "Address Family modifier\n"
12627 "Information about Route Server Client\n"
12629 "Network in the BGP routing table to display\n")
12635 /* BGP structure lookup. */
12638 bgp
= bgp_lookup_by_name (argv
[0]);
12641 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12642 return CMD_WARNING
;
12647 bgp
= bgp_get_default ();
12650 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12651 return CMD_WARNING
;
12656 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
12657 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12659 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
12660 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12664 return CMD_WARNING
;
12666 if (! peer
->afc
[AFI_IP6
][safi
])
12668 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12670 return CMD_WARNING
;
12673 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][safi
],
12674 PEER_FLAG_RSERVER_CLIENT
))
12676 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12678 return CMD_WARNING
;
12681 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][safi
],
12682 (argc
== 4) ? argv
[3] : argv
[2],
12683 AFI_IP6
, safi
, NULL
, 0, BGP_PATH_ALL
);
12686 ALIAS (show_bgp_view_ipv6_safi_rsclient_route
,
12687 show_bgp_ipv6_safi_rsclient_route_cmd
,
12688 "show bgp ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X",
12692 "Address Family modifier\n"
12693 "Address Family modifier\n"
12694 "Information about Route Server Client\n"
12696 "Network in the BGP routing table to display\n")
12698 DEFUN (show_bgp_view_rsclient_prefix
,
12699 show_bgp_view_rsclient_prefix_cmd
,
12700 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M",
12705 "Information about Route Server Client\n"
12707 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
12712 /* BGP structure lookup. */
12715 bgp
= bgp_lookup_by_name (argv
[0]);
12718 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12719 return CMD_WARNING
;
12724 bgp
= bgp_get_default ();
12727 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12728 return CMD_WARNING
;
12733 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12735 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12738 return CMD_WARNING
;
12740 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
12742 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12744 return CMD_WARNING
;
12747 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
12748 PEER_FLAG_RSERVER_CLIENT
))
12750 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12752 return CMD_WARNING
;
12755 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
12756 (argc
== 3) ? argv
[2] : argv
[1],
12757 AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
12760 ALIAS (show_bgp_view_rsclient_prefix
,
12761 show_bgp_rsclient_prefix_cmd
,
12762 "show bgp rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M",
12765 "Information about Route Server Client\n"
12767 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
12769 DEFUN (show_bgp_view_ipv6_safi_rsclient_prefix
,
12770 show_bgp_view_ipv6_safi_rsclient_prefix_cmd
,
12771 "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M",
12777 "Address Family modifier\n"
12778 "Address Family modifier\n"
12779 "Information about Route Server Client\n"
12781 "IP prefix <network>/<length>, e.g., 3ffe::/16\n")
12787 /* BGP structure lookup. */
12790 bgp
= bgp_lookup_by_name (argv
[0]);
12793 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12794 return CMD_WARNING
;
12799 bgp
= bgp_get_default ();
12802 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12803 return CMD_WARNING
;
12808 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
12809 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12811 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
12812 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12816 return CMD_WARNING
;
12818 if (! peer
->afc
[AFI_IP6
][safi
])
12820 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12822 return CMD_WARNING
;
12825 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][safi
],
12826 PEER_FLAG_RSERVER_CLIENT
))
12828 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12830 return CMD_WARNING
;
12833 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][safi
],
12834 (argc
== 4) ? argv
[3] : argv
[2],
12835 AFI_IP6
, safi
, NULL
, 1, BGP_PATH_ALL
);
12838 ALIAS (show_bgp_view_ipv6_safi_rsclient_prefix
,
12839 show_bgp_ipv6_safi_rsclient_prefix_cmd
,
12840 "show bgp ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M",
12844 "Address Family modifier\n"
12845 "Address Family modifier\n"
12846 "Information about Route Server Client\n"
12848 "IP prefix <network>/<length>, e.g., 3ffe::/16\n")
12850 #endif /* HAVE_IPV6 */
12852 struct bgp_table
*bgp_distance_table
;
12854 struct bgp_distance
12856 /* Distance value for the IP source prefix. */
12859 /* Name of the access-list to be matched. */
12863 static struct bgp_distance
*
12864 bgp_distance_new (void)
12866 return XCALLOC (MTYPE_BGP_DISTANCE
, sizeof (struct bgp_distance
));
12870 bgp_distance_free (struct bgp_distance
*bdistance
)
12872 XFREE (MTYPE_BGP_DISTANCE
, bdistance
);
12876 bgp_distance_set (struct vty
*vty
, const char *distance_str
,
12877 const char *ip_str
, const char *access_list_str
)
12880 struct prefix_ipv4 p
;
12882 struct bgp_node
*rn
;
12883 struct bgp_distance
*bdistance
;
12885 ret
= str2prefix_ipv4 (ip_str
, &p
);
12888 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
12889 return CMD_WARNING
;
12892 distance
= atoi (distance_str
);
12894 /* Get BGP distance node. */
12895 rn
= bgp_node_get (bgp_distance_table
, (struct prefix
*) &p
);
12898 bdistance
= rn
->info
;
12899 bgp_unlock_node (rn
);
12903 bdistance
= bgp_distance_new ();
12904 rn
->info
= bdistance
;
12907 /* Set distance value. */
12908 bdistance
->distance
= distance
;
12910 /* Reset access-list configuration. */
12911 if (bdistance
->access_list
)
12913 free (bdistance
->access_list
);
12914 bdistance
->access_list
= NULL
;
12916 if (access_list_str
)
12917 bdistance
->access_list
= strdup (access_list_str
);
12919 return CMD_SUCCESS
;
12923 bgp_distance_unset (struct vty
*vty
, const char *distance_str
,
12924 const char *ip_str
, const char *access_list_str
)
12927 struct prefix_ipv4 p
;
12929 struct bgp_node
*rn
;
12930 struct bgp_distance
*bdistance
;
12932 ret
= str2prefix_ipv4 (ip_str
, &p
);
12935 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
12936 return CMD_WARNING
;
12939 distance
= atoi (distance_str
);
12941 rn
= bgp_node_lookup (bgp_distance_table
, (struct prefix
*)&p
);
12944 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
12945 return CMD_WARNING
;
12948 bdistance
= rn
->info
;
12950 if (bdistance
->access_list
)
12951 free (bdistance
->access_list
);
12952 bgp_distance_free (bdistance
);
12955 bgp_unlock_node (rn
);
12956 bgp_unlock_node (rn
);
12958 return CMD_SUCCESS
;
12961 /* Apply BGP information to distance method. */
12963 bgp_distance_apply (struct prefix
*p
, struct bgp_info
*rinfo
, struct bgp
*bgp
)
12965 struct bgp_node
*rn
;
12966 struct prefix_ipv4 q
;
12968 struct bgp_distance
*bdistance
;
12969 struct access_list
*alist
;
12970 struct bgp_static
*bgp_static
;
12975 if (p
->family
!= AF_INET
)
12978 peer
= rinfo
->peer
;
12980 if (peer
->su
.sa
.sa_family
!= AF_INET
)
12983 memset (&q
, 0, sizeof (struct prefix_ipv4
));
12984 q
.family
= AF_INET
;
12985 q
.prefix
= peer
->su
.sin
.sin_addr
;
12986 q
.prefixlen
= IPV4_MAX_BITLEN
;
12988 /* Check source address. */
12989 rn
= bgp_node_match (bgp_distance_table
, (struct prefix
*) &q
);
12992 bdistance
= rn
->info
;
12993 bgp_unlock_node (rn
);
12995 if (bdistance
->access_list
)
12997 alist
= access_list_lookup (AFI_IP
, bdistance
->access_list
);
12998 if (alist
&& access_list_apply (alist
, p
) == FILTER_PERMIT
)
12999 return bdistance
->distance
;
13002 return bdistance
->distance
;
13005 /* Backdoor check. */
13006 rn
= bgp_node_lookup (bgp
->route
[AFI_IP
][SAFI_UNICAST
], p
);
13009 bgp_static
= rn
->info
;
13010 bgp_unlock_node (rn
);
13012 if (bgp_static
->backdoor
)
13014 if (bgp
->distance_local
)
13015 return bgp
->distance_local
;
13017 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
13021 if (peer
->sort
== BGP_PEER_EBGP
)
13023 if (bgp
->distance_ebgp
)
13024 return bgp
->distance_ebgp
;
13025 return ZEBRA_EBGP_DISTANCE_DEFAULT
;
13029 if (bgp
->distance_ibgp
)
13030 return bgp
->distance_ibgp
;
13031 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
13035 DEFUN (bgp_distance
,
13037 "distance bgp <1-255> <1-255> <1-255>",
13038 "Define an administrative distance\n"
13040 "Distance for routes external to the AS\n"
13041 "Distance for routes internal to the AS\n"
13042 "Distance for local routes\n")
13048 bgp
->distance_ebgp
= atoi (argv
[0]);
13049 bgp
->distance_ibgp
= atoi (argv
[1]);
13050 bgp
->distance_local
= atoi (argv
[2]);
13051 return CMD_SUCCESS
;
13054 DEFUN (no_bgp_distance
,
13055 no_bgp_distance_cmd
,
13056 "no distance bgp <1-255> <1-255> <1-255>",
13058 "Define an administrative distance\n"
13060 "Distance for routes external to the AS\n"
13061 "Distance for routes internal to the AS\n"
13062 "Distance for local routes\n")
13068 bgp
->distance_ebgp
= 0;
13069 bgp
->distance_ibgp
= 0;
13070 bgp
->distance_local
= 0;
13071 return CMD_SUCCESS
;
13074 ALIAS (no_bgp_distance
,
13075 no_bgp_distance2_cmd
,
13078 "Define an administrative distance\n"
13081 DEFUN (bgp_distance_source
,
13082 bgp_distance_source_cmd
,
13083 "distance <1-255> A.B.C.D/M",
13084 "Define an administrative distance\n"
13085 "Administrative distance\n"
13086 "IP source prefix\n")
13088 bgp_distance_set (vty
, argv
[0], argv
[1], NULL
);
13089 return CMD_SUCCESS
;
13092 DEFUN (no_bgp_distance_source
,
13093 no_bgp_distance_source_cmd
,
13094 "no distance <1-255> A.B.C.D/M",
13096 "Define an administrative distance\n"
13097 "Administrative distance\n"
13098 "IP source prefix\n")
13100 bgp_distance_unset (vty
, argv
[0], argv
[1], NULL
);
13101 return CMD_SUCCESS
;
13104 DEFUN (bgp_distance_source_access_list
,
13105 bgp_distance_source_access_list_cmd
,
13106 "distance <1-255> A.B.C.D/M WORD",
13107 "Define an administrative distance\n"
13108 "Administrative distance\n"
13109 "IP source prefix\n"
13110 "Access list name\n")
13112 bgp_distance_set (vty
, argv
[0], argv
[1], argv
[2]);
13113 return CMD_SUCCESS
;
13116 DEFUN (no_bgp_distance_source_access_list
,
13117 no_bgp_distance_source_access_list_cmd
,
13118 "no distance <1-255> A.B.C.D/M WORD",
13120 "Define an administrative distance\n"
13121 "Administrative distance\n"
13122 "IP source prefix\n"
13123 "Access list name\n")
13125 bgp_distance_unset (vty
, argv
[0], argv
[1], argv
[2]);
13126 return CMD_SUCCESS
;
13129 DEFUN (bgp_damp_set
,
13131 "bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
13132 "BGP Specific commands\n"
13133 "Enable route-flap dampening\n"
13134 "Half-life time for the penalty\n"
13135 "Value to start reusing a route\n"
13136 "Value to start suppressing a route\n"
13137 "Maximum duration to suppress a stable route\n")
13140 int half
= DEFAULT_HALF_LIFE
* 60;
13141 int reuse
= DEFAULT_REUSE
;
13142 int suppress
= DEFAULT_SUPPRESS
;
13143 int max
= 4 * half
;
13147 half
= atoi (argv
[0]) * 60;
13148 reuse
= atoi (argv
[1]);
13149 suppress
= atoi (argv
[2]);
13150 max
= atoi (argv
[3]) * 60;
13152 else if (argc
== 1)
13154 half
= atoi (argv
[0]) * 60;
13159 return bgp_damp_enable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
),
13160 half
, reuse
, suppress
, max
);
13163 ALIAS (bgp_damp_set
,
13165 "bgp dampening <1-45>",
13166 "BGP Specific commands\n"
13167 "Enable route-flap dampening\n"
13168 "Half-life time for the penalty\n")
13170 ALIAS (bgp_damp_set
,
13173 "BGP Specific commands\n"
13174 "Enable route-flap dampening\n")
13176 DEFUN (bgp_damp_unset
,
13177 bgp_damp_unset_cmd
,
13178 "no bgp dampening",
13180 "BGP Specific commands\n"
13181 "Enable route-flap dampening\n")
13186 return bgp_damp_disable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
));
13189 ALIAS (bgp_damp_unset
,
13190 bgp_damp_unset2_cmd
,
13191 "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
13193 "BGP Specific commands\n"
13194 "Enable route-flap dampening\n"
13195 "Half-life time for the penalty\n"
13196 "Value to start reusing a route\n"
13197 "Value to start suppressing a route\n"
13198 "Maximum duration to suppress a stable route\n")
13200 DEFUN (show_ip_bgp_dampened_paths
,
13201 show_ip_bgp_dampened_paths_cmd
,
13202 "show ip bgp dampened-paths",
13206 "Display paths suppressed due to dampening\n")
13208 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_dampend_paths
,
13212 DEFUN (show_ip_bgp_flap_statistics
,
13213 show_ip_bgp_flap_statistics_cmd
,
13214 "show ip bgp flap-statistics",
13218 "Display flap statistics of routes\n")
13220 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
13221 bgp_show_type_flap_statistics
, NULL
, NULL
);
13224 /* Display specified route of BGP table. */
13226 bgp_clear_damp_route (struct vty
*vty
, const char *view_name
,
13227 const char *ip_str
, afi_t afi
, safi_t safi
,
13228 struct prefix_rd
*prd
, int prefix_check
)
13231 struct prefix match
;
13232 struct bgp_node
*rn
;
13233 struct bgp_node
*rm
;
13234 struct bgp_info
*ri
;
13235 struct bgp_info
*ri_temp
;
13237 struct bgp_table
*table
;
13239 /* BGP structure lookup. */
13242 bgp
= bgp_lookup_by_name (view_name
);
13245 vty_out (vty
, "%% Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
13246 return CMD_WARNING
;
13251 bgp
= bgp_get_default ();
13254 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
13255 return CMD_WARNING
;
13259 /* Check IP address argument. */
13260 ret
= str2prefix (ip_str
, &match
);
13263 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
13264 return CMD_WARNING
;
13267 match
.family
= afi2family (afi
);
13269 if (safi
== SAFI_MPLS_VPN
)
13271 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= bgp_route_next (rn
))
13273 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
13276 if ((table
= rn
->info
) != NULL
)
13277 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
13279 if (! prefix_check
|| rm
->p
.prefixlen
== match
.prefixlen
)
13284 if (ri
->extra
&& ri
->extra
->damp_info
)
13286 ri_temp
= ri
->next
;
13287 bgp_damp_info_free (ri
->extra
->damp_info
, 1);
13295 bgp_unlock_node (rm
);
13301 if ((rn
= bgp_node_match (bgp
->rib
[afi
][safi
], &match
)) != NULL
)
13303 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
13308 if (ri
->extra
&& ri
->extra
->damp_info
)
13310 ri_temp
= ri
->next
;
13311 bgp_damp_info_free (ri
->extra
->damp_info
, 1);
13319 bgp_unlock_node (rn
);
13323 return CMD_SUCCESS
;
13326 DEFUN (clear_ip_bgp_dampening
,
13327 clear_ip_bgp_dampening_cmd
,
13328 "clear ip bgp dampening",
13332 "Clear route flap dampening information\n")
13334 bgp_damp_info_clean ();
13335 return CMD_SUCCESS
;
13338 DEFUN (clear_ip_bgp_dampening_prefix
,
13339 clear_ip_bgp_dampening_prefix_cmd
,
13340 "clear ip bgp dampening A.B.C.D/M",
13344 "Clear route flap dampening information\n"
13345 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
13347 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
13348 SAFI_UNICAST
, NULL
, 1);
13351 DEFUN (clear_ip_bgp_dampening_address
,
13352 clear_ip_bgp_dampening_address_cmd
,
13353 "clear ip bgp dampening A.B.C.D",
13357 "Clear route flap dampening information\n"
13358 "Network to clear damping information\n")
13360 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
13361 SAFI_UNICAST
, NULL
, 0);
13364 DEFUN (clear_ip_bgp_dampening_address_mask
,
13365 clear_ip_bgp_dampening_address_mask_cmd
,
13366 "clear ip bgp dampening A.B.C.D A.B.C.D",
13370 "Clear route flap dampening information\n"
13371 "Network to clear damping information\n"
13375 char prefix_str
[BUFSIZ
];
13377 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
13380 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
13381 return CMD_WARNING
;
13384 return bgp_clear_damp_route (vty
, NULL
, prefix_str
, AFI_IP
,
13385 SAFI_UNICAST
, NULL
, 0);
13389 bgp_config_write_network_vpnv4 (struct vty
*vty
, struct bgp
*bgp
,
13390 afi_t afi
, safi_t safi
, int *write
)
13392 struct bgp_node
*prn
;
13393 struct bgp_node
*rn
;
13394 struct bgp_table
*table
;
13396 struct prefix_rd
*prd
;
13397 struct bgp_static
*bgp_static
;
13399 char buf
[SU_ADDRSTRLEN
];
13400 char rdbuf
[RD_ADDRSTRLEN
];
13402 /* Network configuration. */
13403 for (prn
= bgp_table_top (bgp
->route
[afi
][safi
]); prn
; prn
= bgp_route_next (prn
))
13404 if ((table
= prn
->info
) != NULL
)
13405 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
13406 if ((bgp_static
= rn
->info
) != NULL
)
13409 prd
= (struct prefix_rd
*) &prn
->p
;
13411 /* "address-family" display. */
13412 bgp_config_write_family_header (vty
, afi
, safi
, write
);
13414 /* "network" configuration display. */
13415 prefix_rd2str (prd
, rdbuf
, RD_ADDRSTRLEN
);
13416 label
= decode_label (bgp_static
->tag
);
13418 vty_out (vty
, " network %s/%d rd %s tag %d",
13419 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
13422 vty_out (vty
, "%s", VTY_NEWLINE
);
13427 /* Configuration of static route announcement and aggregate
13430 bgp_config_write_network (struct vty
*vty
, struct bgp
*bgp
,
13431 afi_t afi
, safi_t safi
, int *write
)
13433 struct bgp_node
*rn
;
13435 struct bgp_static
*bgp_static
;
13436 struct bgp_aggregate
*bgp_aggregate
;
13437 char buf
[SU_ADDRSTRLEN
];
13439 if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
13440 return bgp_config_write_network_vpnv4 (vty
, bgp
, afi
, safi
, write
);
13442 /* Network configuration. */
13443 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
13444 if ((bgp_static
= rn
->info
) != NULL
)
13448 /* "address-family" display. */
13449 bgp_config_write_family_header (vty
, afi
, safi
, write
);
13451 /* "network" configuration display. */
13452 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
13454 u_int32_t destination
;
13455 struct in_addr netmask
;
13457 destination
= ntohl (p
->u
.prefix4
.s_addr
);
13458 masklen2ip (p
->prefixlen
, &netmask
);
13459 vty_out (vty
, " network %s",
13460 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
));
13462 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
13463 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
13464 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
13465 || p
->u
.prefix4
.s_addr
== 0)
13467 /* Natural mask is not display. */
13470 vty_out (vty
, " mask %s", inet_ntoa (netmask
));
13474 vty_out (vty
, " network %s/%d",
13475 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
13479 if (bgp_static
->rmap
.name
)
13480 vty_out (vty
, " route-map %s", bgp_static
->rmap
.name
);
13483 if (bgp_static
->backdoor
)
13484 vty_out (vty
, " backdoor");
13487 vty_out (vty
, "%s", VTY_NEWLINE
);
13490 /* Aggregate-address configuration. */
13491 for (rn
= bgp_table_top (bgp
->aggregate
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
13492 if ((bgp_aggregate
= rn
->info
) != NULL
)
13496 /* "address-family" display. */
13497 bgp_config_write_family_header (vty
, afi
, safi
, write
);
13499 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
13501 struct in_addr netmask
;
13503 masklen2ip (p
->prefixlen
, &netmask
);
13504 vty_out (vty
, " aggregate-address %s %s",
13505 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
13506 inet_ntoa (netmask
));
13510 vty_out (vty
, " aggregate-address %s/%d",
13511 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
13515 if (bgp_aggregate
->as_set
)
13516 vty_out (vty
, " as-set");
13518 if (bgp_aggregate
->summary_only
)
13519 vty_out (vty
, " summary-only");
13521 vty_out (vty
, "%s", VTY_NEWLINE
);
13528 bgp_config_write_distance (struct vty
*vty
, struct bgp
*bgp
)
13530 struct bgp_node
*rn
;
13531 struct bgp_distance
*bdistance
;
13533 /* Distance configuration. */
13534 if (bgp
->distance_ebgp
13535 && bgp
->distance_ibgp
13536 && bgp
->distance_local
13537 && (bgp
->distance_ebgp
!= ZEBRA_EBGP_DISTANCE_DEFAULT
13538 || bgp
->distance_ibgp
!= ZEBRA_IBGP_DISTANCE_DEFAULT
13539 || bgp
->distance_local
!= ZEBRA_IBGP_DISTANCE_DEFAULT
))
13540 vty_out (vty
, " distance bgp %d %d %d%s",
13541 bgp
->distance_ebgp
, bgp
->distance_ibgp
, bgp
->distance_local
,
13544 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
13545 if ((bdistance
= rn
->info
) != NULL
)
13547 vty_out (vty
, " distance %d %s/%d %s%s", bdistance
->distance
,
13548 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
13549 bdistance
->access_list
? bdistance
->access_list
: "",
13556 /* Allocate routing table structure and install commands. */
13558 bgp_route_init (void)
13560 /* Init BGP distance table. */
13561 bgp_distance_table
= bgp_table_init (AFI_IP
, SAFI_UNICAST
);
13563 /* IPv4 BGP commands. */
13564 install_element (BGP_NODE
, &bgp_table_map_cmd
);
13565 install_element (BGP_NODE
, &bgp_network_cmd
);
13566 install_element (BGP_NODE
, &bgp_network_mask_cmd
);
13567 install_element (BGP_NODE
, &bgp_network_mask_natural_cmd
);
13568 install_element (BGP_NODE
, &bgp_network_route_map_cmd
);
13569 install_element (BGP_NODE
, &bgp_network_mask_route_map_cmd
);
13570 install_element (BGP_NODE
, &bgp_network_mask_natural_route_map_cmd
);
13571 install_element (BGP_NODE
, &bgp_network_backdoor_cmd
);
13572 install_element (BGP_NODE
, &bgp_network_mask_backdoor_cmd
);
13573 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_cmd
);
13574 install_element (BGP_NODE
, &no_bgp_table_map_cmd
);
13575 install_element (BGP_NODE
, &no_bgp_network_cmd
);
13576 install_element (BGP_NODE
, &no_bgp_network_mask_cmd
);
13577 install_element (BGP_NODE
, &no_bgp_network_mask_natural_cmd
);
13578 install_element (BGP_NODE
, &no_bgp_network_route_map_cmd
);
13579 install_element (BGP_NODE
, &no_bgp_network_mask_route_map_cmd
);
13580 install_element (BGP_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
13581 install_element (BGP_NODE
, &no_bgp_network_backdoor_cmd
);
13582 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_cmd
);
13583 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_cmd
);
13585 install_element (BGP_NODE
, &aggregate_address_cmd
);
13586 install_element (BGP_NODE
, &aggregate_address_mask_cmd
);
13587 install_element (BGP_NODE
, &aggregate_address_summary_only_cmd
);
13588 install_element (BGP_NODE
, &aggregate_address_mask_summary_only_cmd
);
13589 install_element (BGP_NODE
, &aggregate_address_as_set_cmd
);
13590 install_element (BGP_NODE
, &aggregate_address_mask_as_set_cmd
);
13591 install_element (BGP_NODE
, &aggregate_address_as_set_summary_cmd
);
13592 install_element (BGP_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
13593 install_element (BGP_NODE
, &aggregate_address_summary_as_set_cmd
);
13594 install_element (BGP_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
13595 install_element (BGP_NODE
, &no_aggregate_address_cmd
);
13596 install_element (BGP_NODE
, &no_aggregate_address_summary_only_cmd
);
13597 install_element (BGP_NODE
, &no_aggregate_address_as_set_cmd
);
13598 install_element (BGP_NODE
, &no_aggregate_address_as_set_summary_cmd
);
13599 install_element (BGP_NODE
, &no_aggregate_address_summary_as_set_cmd
);
13600 install_element (BGP_NODE
, &no_aggregate_address_mask_cmd
);
13601 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
13602 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_cmd
);
13603 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
13604 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
13606 /* IPv4 unicast configuration. */
13607 install_element (BGP_IPV4_NODE
, &bgp_table_map_cmd
);
13608 install_element (BGP_IPV4_NODE
, &bgp_network_cmd
);
13609 install_element (BGP_IPV4_NODE
, &bgp_network_mask_cmd
);
13610 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_cmd
);
13611 install_element (BGP_IPV4_NODE
, &bgp_network_route_map_cmd
);
13612 install_element (BGP_IPV4_NODE
, &bgp_network_mask_route_map_cmd
);
13613 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_route_map_cmd
);
13614 install_element (BGP_IPV4_NODE
, &no_bgp_table_map_cmd
);
13615 install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
13616 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_cmd
);
13617 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_cmd
);
13618 install_element (BGP_IPV4_NODE
, &no_bgp_network_route_map_cmd
);
13619 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_route_map_cmd
);
13620 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
13622 install_element (BGP_IPV4_NODE
, &aggregate_address_cmd
);
13623 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_cmd
);
13624 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_only_cmd
);
13625 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_only_cmd
);
13626 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_cmd
);
13627 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_cmd
);
13628 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_summary_cmd
);
13629 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
13630 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_as_set_cmd
);
13631 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
13632 install_element (BGP_IPV4_NODE
, &no_aggregate_address_cmd
);
13633 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_only_cmd
);
13634 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_cmd
);
13635 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_summary_cmd
);
13636 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_as_set_cmd
);
13637 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_cmd
);
13638 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
13639 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_cmd
);
13640 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
13641 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
13643 /* IPv4 multicast configuration. */
13644 install_element (BGP_IPV4M_NODE
, &bgp_table_map_cmd
);
13645 install_element (BGP_IPV4M_NODE
, &bgp_network_cmd
);
13646 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_cmd
);
13647 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_cmd
);
13648 install_element (BGP_IPV4M_NODE
, &bgp_network_route_map_cmd
);
13649 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_route_map_cmd
);
13650 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_route_map_cmd
);
13651 install_element (BGP_IPV4M_NODE
, &no_bgp_table_map_cmd
);
13652 install_element (BGP_IPV4M_NODE
, &no_bgp_network_cmd
);
13653 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_cmd
);
13654 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_cmd
);
13655 install_element (BGP_IPV4M_NODE
, &no_bgp_network_route_map_cmd
);
13656 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_route_map_cmd
);
13657 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
13658 install_element (BGP_IPV4M_NODE
, &aggregate_address_cmd
);
13659 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_cmd
);
13660 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_only_cmd
);
13661 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_only_cmd
);
13662 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_cmd
);
13663 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_cmd
);
13664 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_summary_cmd
);
13665 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
13666 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_as_set_cmd
);
13667 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
13668 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_cmd
);
13669 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_only_cmd
);
13670 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_cmd
);
13671 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_summary_cmd
);
13672 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_as_set_cmd
);
13673 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_cmd
);
13674 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
13675 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_cmd
);
13676 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
13677 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
13679 install_element (VIEW_NODE
, &show_ip_bgp_cmd
);
13680 install_element (VIEW_NODE
, &show_ip_bgp_csv_cmd
);
13681 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cmd
);
13682 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_cmd
);
13683 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_csv_cmd
);
13684 install_element (VIEW_NODE
, &show_ip_bgp_route_cmd
);
13685 install_element (VIEW_NODE
, &show_ip_bgp_route_pathtype_cmd
);
13686 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_route_pathtype_cmd
);
13687 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_cmd
);
13688 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_route_cmd
);
13689 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
13690 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
13691 install_element (VIEW_NODE
, &show_ip_bgp_prefix_cmd
);
13692 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
13693 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_pathtype_cmd
);
13694 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_prefix_pathtype_cmd
);
13695 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_prefix_cmd
);
13696 install_element (VIEW_NODE
, &show_ip_bgp_prefix_pathtype_cmd
);
13697 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
13698 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
13699 install_element (VIEW_NODE
, &show_ip_bgp_view_cmd
);
13700 install_element (VIEW_NODE
, &show_ip_bgp_view_route_cmd
);
13701 install_element (VIEW_NODE
, &show_ip_bgp_view_prefix_cmd
);
13702 install_element (VIEW_NODE
, &show_ip_bgp_regexp_cmd
);
13703 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
13704 install_element (VIEW_NODE
, &show_ip_bgp_prefix_list_cmd
);
13705 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
13706 install_element (VIEW_NODE
, &show_ip_bgp_filter_list_cmd
);
13707 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
13708 install_element (VIEW_NODE
, &show_ip_bgp_route_map_cmd
);
13709 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
13710 install_element (VIEW_NODE
, &show_ip_bgp_cidr_only_cmd
);
13711 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
13712 install_element (VIEW_NODE
, &show_ip_bgp_community_all_cmd
);
13713 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
13714 install_element (VIEW_NODE
, &show_ip_bgp_community_cmd
);
13715 install_element (VIEW_NODE
, &show_ip_bgp_community2_cmd
);
13716 install_element (VIEW_NODE
, &show_ip_bgp_community3_cmd
);
13717 install_element (VIEW_NODE
, &show_ip_bgp_community4_cmd
);
13718 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_cmd
);
13719 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
13720 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
13721 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
13722 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community_all_cmd
);
13723 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community_cmd
);
13724 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community2_cmd
);
13725 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community3_cmd
);
13726 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community4_cmd
);
13727 install_element (VIEW_NODE
, &show_ip_bgp_community_exact_cmd
);
13728 install_element (VIEW_NODE
, &show_ip_bgp_community2_exact_cmd
);
13729 install_element (VIEW_NODE
, &show_ip_bgp_community3_exact_cmd
);
13730 install_element (VIEW_NODE
, &show_ip_bgp_community4_exact_cmd
);
13731 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
13732 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
13733 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
13734 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
13735 install_element (VIEW_NODE
, &show_ip_bgp_community_list_cmd
);
13736 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
13737 install_element (VIEW_NODE
, &show_ip_bgp_community_list_exact_cmd
);
13738 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
13739 install_element (VIEW_NODE
, &show_ip_bgp_prefix_longer_cmd
);
13740 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
13741 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
13742 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_rmap_cmd
);
13743 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_csv_cmd
);
13744 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_csv_rmap_cmd
);
13745 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
13746 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd
);
13747 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
13748 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_routes_rmap_cmd
);
13749 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
13750 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd
);
13751 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd
);
13752 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
13753 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_routes_csv_cmd
);
13754 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
13755 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
13756 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
13757 install_element (VIEW_NODE
, &show_ip_bgp_dampened_paths_cmd
);
13758 install_element (VIEW_NODE
, &show_ip_bgp_flap_statistics_cmd
);
13759 install_element (VIEW_NODE
, &show_ip_bgp_flap_address_cmd
);
13760 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_cmd
);
13761 install_element (VIEW_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
13762 install_element (VIEW_NODE
, &show_ip_bgp_flap_regexp_cmd
);
13763 install_element (VIEW_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
13764 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
13765 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
13766 install_element (VIEW_NODE
, &show_ip_bgp_flap_route_map_cmd
);
13767 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
13768 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
13769 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_cmd
);
13770 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_rsclient_cmd
);
13771 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_route_cmd
);
13772 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_rsclient_route_cmd
);
13773 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
13774 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_rsclient_prefix_cmd
);
13775 install_element (VIEW_NODE
, &show_ip_bgp_view_neighbor_advertised_route_cmd
);
13776 install_element (VIEW_NODE
, &show_ip_bgp_view_neighbor_received_routes_cmd
);
13777 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_cmd
);
13778 install_element (VIEW_NODE
, &show_bgp_view_ipv4_safi_rsclient_cmd
);
13779 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
13780 install_element (VIEW_NODE
, &show_bgp_view_ipv4_safi_rsclient_route_cmd
);
13781 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
13782 install_element (VIEW_NODE
, &show_bgp_view_ipv4_safi_rsclient_prefix_cmd
);
13784 /* Restricted node: VIEW_NODE - (set of dangerous commands) */
13785 install_element (RESTRICTED_NODE
, &show_ip_bgp_route_cmd
);
13786 install_element (RESTRICTED_NODE
, &show_ip_bgp_route_pathtype_cmd
);
13787 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_route_pathtype_cmd
);
13788 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_route_cmd
);
13789 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_route_cmd
);
13790 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
13791 install_element (RESTRICTED_NODE
, &show_ip_bgp_prefix_cmd
);
13792 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
13793 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_prefix_pathtype_cmd
);
13794 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_prefix_pathtype_cmd
);
13795 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_prefix_cmd
);
13796 install_element (RESTRICTED_NODE
, &show_ip_bgp_prefix_pathtype_cmd
);
13797 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
13798 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
13799 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_route_cmd
);
13800 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_prefix_cmd
);
13801 install_element (RESTRICTED_NODE
, &show_ip_bgp_community_cmd
);
13802 install_element (RESTRICTED_NODE
, &show_ip_bgp_community2_cmd
);
13803 install_element (RESTRICTED_NODE
, &show_ip_bgp_community3_cmd
);
13804 install_element (RESTRICTED_NODE
, &show_ip_bgp_community4_cmd
);
13805 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community_cmd
);
13806 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
13807 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
13808 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
13809 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community_all_cmd
);
13810 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community_cmd
);
13811 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community2_cmd
);
13812 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community3_cmd
);
13813 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community4_cmd
);
13814 install_element (RESTRICTED_NODE
, &show_ip_bgp_community_exact_cmd
);
13815 install_element (RESTRICTED_NODE
, &show_ip_bgp_community2_exact_cmd
);
13816 install_element (RESTRICTED_NODE
, &show_ip_bgp_community3_exact_cmd
);
13817 install_element (RESTRICTED_NODE
, &show_ip_bgp_community4_exact_cmd
);
13818 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
13819 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
13820 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
13821 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
13822 install_element (RESTRICTED_NODE
, &show_ip_bgp_rsclient_route_cmd
);
13823 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_rsclient_route_cmd
);
13824 install_element (RESTRICTED_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
13825 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_rsclient_prefix_cmd
);
13826 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
13827 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv4_safi_rsclient_route_cmd
);
13828 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
13829 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv4_safi_rsclient_prefix_cmd
);
13831 install_element (ENABLE_NODE
, &show_ip_bgp_cmd
);
13832 install_element (ENABLE_NODE
, &show_ip_bgp_csv_cmd
);
13833 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cmd
);
13834 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_cmd
);
13835 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_csv_cmd
);
13836 install_element (ENABLE_NODE
, &show_ip_bgp_route_cmd
);
13837 install_element (ENABLE_NODE
, &show_ip_bgp_route_pathtype_cmd
);
13838 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_route_pathtype_cmd
);
13839 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_cmd
);
13840 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_route_cmd
);
13841 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
13842 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
13843 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_cmd
);
13844 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
13845 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_pathtype_cmd
);
13846 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_prefix_pathtype_cmd
);
13847 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_prefix_cmd
);
13848 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_pathtype_cmd
);
13849 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
13850 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
13851 install_element (ENABLE_NODE
, &show_ip_bgp_view_cmd
);
13852 install_element (ENABLE_NODE
, &show_ip_bgp_view_route_cmd
);
13853 install_element (ENABLE_NODE
, &show_ip_bgp_view_prefix_cmd
);
13854 install_element (ENABLE_NODE
, &show_ip_bgp_regexp_cmd
);
13855 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
13856 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_list_cmd
);
13857 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
13858 install_element (ENABLE_NODE
, &show_ip_bgp_filter_list_cmd
);
13859 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
13860 install_element (ENABLE_NODE
, &show_ip_bgp_route_map_cmd
);
13861 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
13862 install_element (ENABLE_NODE
, &show_ip_bgp_cidr_only_cmd
);
13863 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
13864 install_element (ENABLE_NODE
, &show_ip_bgp_community_all_cmd
);
13865 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
13866 install_element (ENABLE_NODE
, &show_ip_bgp_community_cmd
);
13867 install_element (ENABLE_NODE
, &show_ip_bgp_community2_cmd
);
13868 install_element (ENABLE_NODE
, &show_ip_bgp_community3_cmd
);
13869 install_element (ENABLE_NODE
, &show_ip_bgp_community4_cmd
);
13870 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_cmd
);
13871 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
13872 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
13873 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
13874 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community_all_cmd
);
13875 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community_cmd
);
13876 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community2_cmd
);
13877 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community3_cmd
);
13878 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community4_cmd
);
13879 install_element (ENABLE_NODE
, &show_ip_bgp_community_exact_cmd
);
13880 install_element (ENABLE_NODE
, &show_ip_bgp_community2_exact_cmd
);
13881 install_element (ENABLE_NODE
, &show_ip_bgp_community3_exact_cmd
);
13882 install_element (ENABLE_NODE
, &show_ip_bgp_community4_exact_cmd
);
13883 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
13884 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
13885 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
13886 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
13887 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_cmd
);
13888 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
13889 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_exact_cmd
);
13890 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
13891 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_longer_cmd
);
13892 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
13893 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
13894 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_csv_cmd
);
13895 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_rmap_cmd
);
13896 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_csv_rmap_cmd
);
13897 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
13898 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd
);
13899 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
13900 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_routes_rmap_cmd
);
13901 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
13902 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd
);
13903 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd
);
13904 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
13905 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_routes_csv_cmd
);
13906 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
13907 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
13908 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
13909 install_element (ENABLE_NODE
, &show_ip_bgp_dampened_paths_cmd
);
13910 install_element (ENABLE_NODE
, &show_ip_bgp_flap_statistics_cmd
);
13911 install_element (ENABLE_NODE
, &show_ip_bgp_flap_address_cmd
);
13912 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_cmd
);
13913 install_element (ENABLE_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
13914 install_element (ENABLE_NODE
, &show_ip_bgp_flap_regexp_cmd
);
13915 install_element (ENABLE_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
13916 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
13917 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
13918 install_element (ENABLE_NODE
, &show_ip_bgp_flap_route_map_cmd
);
13919 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
13920 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
13921 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_cmd
);
13922 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_rsclient_cmd
);
13923 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_route_cmd
);
13924 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_rsclient_route_cmd
);
13925 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
13926 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_rsclient_prefix_cmd
);
13927 install_element (ENABLE_NODE
, &show_ip_bgp_view_neighbor_advertised_route_cmd
);
13928 install_element (ENABLE_NODE
, &show_ip_bgp_view_neighbor_received_routes_cmd
);
13929 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_cmd
);
13930 install_element (ENABLE_NODE
, &show_bgp_view_ipv4_safi_rsclient_cmd
);
13931 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
13932 install_element (ENABLE_NODE
, &show_bgp_view_ipv4_safi_rsclient_route_cmd
);
13933 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
13934 install_element (ENABLE_NODE
, &show_bgp_view_ipv4_safi_rsclient_prefix_cmd
);
13936 /* BGP dampening clear commands */
13937 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_cmd
);
13938 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_prefix_cmd
);
13939 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_cmd
);
13940 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_mask_cmd
);
13943 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_prefix_counts_cmd
);
13944 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_prefix_counts_cmd
);
13945 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd
);
13947 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_prefix_counts_cmd
);
13949 /* New config IPv6 BGP commands. */
13950 install_element (BGP_IPV6_NODE
, &bgp_table_map_cmd
);
13951 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_cmd
);
13952 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_route_map_cmd
);
13953 install_element (BGP_IPV6_NODE
, &no_bgp_table_map_cmd
);
13954 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_cmd
);
13955 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_route_map_cmd
);
13957 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_cmd
);
13958 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_summary_only_cmd
);
13959 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_cmd
);
13960 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_summary_only_cmd
);
13962 install_element (BGP_IPV6M_NODE
, &ipv6_bgp_network_cmd
);
13963 install_element (BGP_IPV6M_NODE
, &no_ipv6_bgp_network_cmd
);
13965 /* Old config IPv6 BGP commands. */
13966 install_element (BGP_NODE
, &old_ipv6_bgp_network_cmd
);
13967 install_element (BGP_NODE
, &old_no_ipv6_bgp_network_cmd
);
13969 install_element (BGP_NODE
, &old_ipv6_aggregate_address_cmd
);
13970 install_element (BGP_NODE
, &old_ipv6_aggregate_address_summary_only_cmd
);
13971 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_cmd
);
13972 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_summary_only_cmd
);
13974 install_element (VIEW_NODE
, &show_bgp_cmd
);
13975 install_element (VIEW_NODE
, &show_bgp_ipv6_cmd
);
13976 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_cmd
);
13977 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_csv_cmd
);
13978 install_element (VIEW_NODE
, &show_bgp_route_cmd
);
13979 install_element (VIEW_NODE
, &show_bgp_ipv6_route_cmd
);
13980 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_route_cmd
);
13981 install_element (VIEW_NODE
, &show_bgp_route_pathtype_cmd
);
13982 install_element (VIEW_NODE
, &show_bgp_ipv6_route_pathtype_cmd
);
13983 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_route_pathtype_cmd
);
13984 install_element (VIEW_NODE
, &show_bgp_prefix_cmd
);
13985 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_cmd
);
13986 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_prefix_cmd
);
13987 install_element (VIEW_NODE
, &show_bgp_prefix_pathtype_cmd
);
13988 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_pathtype_cmd
);
13989 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_prefix_pathtype_cmd
);
13990 install_element (VIEW_NODE
, &show_bgp_regexp_cmd
);
13991 install_element (VIEW_NODE
, &show_bgp_ipv6_regexp_cmd
);
13992 install_element (VIEW_NODE
, &show_bgp_prefix_list_cmd
);
13993 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
13994 install_element (VIEW_NODE
, &show_bgp_filter_list_cmd
);
13995 install_element (VIEW_NODE
, &show_bgp_ipv6_filter_list_cmd
);
13996 install_element (VIEW_NODE
, &show_bgp_route_map_cmd
);
13997 install_element (VIEW_NODE
, &show_bgp_ipv6_route_map_cmd
);
13998 install_element (VIEW_NODE
, &show_bgp_community_all_cmd
);
13999 install_element (VIEW_NODE
, &show_bgp_ipv6_community_all_cmd
);
14000 install_element (VIEW_NODE
, &show_bgp_community_cmd
);
14001 install_element (VIEW_NODE
, &show_bgp_ipv6_community_cmd
);
14002 install_element (VIEW_NODE
, &show_bgp_community2_cmd
);
14003 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_cmd
);
14004 install_element (VIEW_NODE
, &show_bgp_community3_cmd
);
14005 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_cmd
);
14006 install_element (VIEW_NODE
, &show_bgp_community4_cmd
);
14007 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_cmd
);
14008 install_element (VIEW_NODE
, &show_bgp_community_exact_cmd
);
14009 install_element (VIEW_NODE
, &show_bgp_ipv6_community_exact_cmd
);
14010 install_element (VIEW_NODE
, &show_bgp_community2_exact_cmd
);
14011 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
14012 install_element (VIEW_NODE
, &show_bgp_community3_exact_cmd
);
14013 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
14014 install_element (VIEW_NODE
, &show_bgp_community4_exact_cmd
);
14015 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
14016 install_element (VIEW_NODE
, &show_bgp_community_list_cmd
);
14017 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_cmd
);
14018 install_element (VIEW_NODE
, &show_bgp_community_list_exact_cmd
);
14019 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
14020 install_element (VIEW_NODE
, &show_bgp_prefix_longer_cmd
);
14021 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
14022 install_element (VIEW_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
14023 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
14024 install_element (VIEW_NODE
, &show_bgp_neighbor_advertised_route_csv_cmd
);
14025 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_advertised_route_csv_cmd
);
14026 install_element (VIEW_NODE
, &show_bgp_neighbor_received_routes_cmd
);
14027 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
14028 install_element (VIEW_NODE
, &show_bgp_neighbor_routes_cmd
);
14029 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
14030 install_element (VIEW_NODE
, &show_bgp_neighbor_routes_csv_cmd
);
14031 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_routes_csv_cmd
);
14032 install_element (VIEW_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
14033 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
14034 install_element (VIEW_NODE
, &show_bgp_neighbor_flap_cmd
);
14035 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
14036 install_element (VIEW_NODE
, &show_bgp_neighbor_damp_cmd
);
14037 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
14038 install_element (VIEW_NODE
, &show_bgp_rsclient_cmd
);
14039 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_rsclient_cmd
);
14040 install_element (VIEW_NODE
, &show_bgp_rsclient_route_cmd
);
14041 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_rsclient_route_cmd
);
14042 install_element (VIEW_NODE
, &show_bgp_rsclient_prefix_cmd
);
14043 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_rsclient_prefix_cmd
);
14044 install_element (VIEW_NODE
, &show_bgp_view_cmd
);
14045 install_element (VIEW_NODE
, &show_bgp_view_ipv6_cmd
);
14046 install_element (VIEW_NODE
, &show_bgp_view_route_cmd
);
14047 install_element (VIEW_NODE
, &show_bgp_view_ipv6_route_cmd
);
14048 install_element (VIEW_NODE
, &show_bgp_view_prefix_cmd
);
14049 install_element (VIEW_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
14050 install_element (VIEW_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
14051 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
14052 install_element (VIEW_NODE
, &show_bgp_view_neighbor_advertised_route_csv_cmd
);
14053 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_csv_cmd
);
14054 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
14055 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
14056 install_element (VIEW_NODE
, &show_bgp_view_neighbor_routes_cmd
);
14057 install_element (VIEW_NODE
, &show_bgp_view_neighbor_routes_csv_cmd
);
14058 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
14059 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
14060 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
14061 install_element (VIEW_NODE
, &show_bgp_view_neighbor_flap_cmd
);
14062 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
14063 install_element (VIEW_NODE
, &show_bgp_view_neighbor_damp_cmd
);
14064 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
14065 install_element (VIEW_NODE
, &show_bgp_view_rsclient_cmd
);
14066 install_element (VIEW_NODE
, &show_bgp_view_ipv6_safi_rsclient_cmd
);
14067 install_element (VIEW_NODE
, &show_bgp_view_rsclient_route_cmd
);
14068 install_element (VIEW_NODE
, &show_bgp_view_ipv6_safi_rsclient_route_cmd
);
14069 install_element (VIEW_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
14070 install_element (VIEW_NODE
, &show_bgp_view_ipv6_safi_rsclient_prefix_cmd
);
14073 * VIEW_NODE - (set of dangerous commands) - (commands dependent on prev)
14075 install_element (RESTRICTED_NODE
, &show_bgp_route_cmd
);
14076 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_route_cmd
);
14077 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_route_cmd
);
14078 install_element (RESTRICTED_NODE
, &show_bgp_route_pathtype_cmd
);
14079 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_route_pathtype_cmd
);
14080 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_route_pathtype_cmd
);
14081 install_element (RESTRICTED_NODE
, &show_bgp_prefix_cmd
);
14082 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_prefix_cmd
);
14083 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_prefix_cmd
);
14084 install_element (RESTRICTED_NODE
, &show_bgp_prefix_pathtype_cmd
);
14085 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_prefix_pathtype_cmd
);
14086 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_prefix_pathtype_cmd
);
14087 install_element (RESTRICTED_NODE
, &show_bgp_community_cmd
);
14088 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community_cmd
);
14089 install_element (RESTRICTED_NODE
, &show_bgp_community2_cmd
);
14090 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community2_cmd
);
14091 install_element (RESTRICTED_NODE
, &show_bgp_community3_cmd
);
14092 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community3_cmd
);
14093 install_element (RESTRICTED_NODE
, &show_bgp_community4_cmd
);
14094 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community4_cmd
);
14095 install_element (RESTRICTED_NODE
, &show_bgp_community_exact_cmd
);
14096 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community_exact_cmd
);
14097 install_element (RESTRICTED_NODE
, &show_bgp_community2_exact_cmd
);
14098 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
14099 install_element (RESTRICTED_NODE
, &show_bgp_community3_exact_cmd
);
14100 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
14101 install_element (RESTRICTED_NODE
, &show_bgp_community4_exact_cmd
);
14102 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
14103 install_element (RESTRICTED_NODE
, &show_bgp_rsclient_route_cmd
);
14104 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_rsclient_route_cmd
);
14105 install_element (RESTRICTED_NODE
, &show_bgp_rsclient_prefix_cmd
);
14106 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_rsclient_prefix_cmd
);
14107 install_element (RESTRICTED_NODE
, &show_bgp_view_route_cmd
);
14108 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_route_cmd
);
14109 install_element (RESTRICTED_NODE
, &show_bgp_view_prefix_cmd
);
14110 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
14111 install_element (RESTRICTED_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
14112 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
14113 install_element (RESTRICTED_NODE
, &show_bgp_view_rsclient_route_cmd
);
14114 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_safi_rsclient_route_cmd
);
14115 install_element (RESTRICTED_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
14116 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_safi_rsclient_prefix_cmd
);
14118 install_element (ENABLE_NODE
, &show_bgp_cmd
);
14119 install_element (ENABLE_NODE
, &show_bgp_ipv6_cmd
);
14120 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_cmd
);
14121 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_csv_cmd
);
14122 install_element (ENABLE_NODE
, &show_bgp_route_cmd
);
14123 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_cmd
);
14124 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_route_cmd
);
14125 install_element (ENABLE_NODE
, &show_bgp_route_pathtype_cmd
);
14126 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_pathtype_cmd
);
14127 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_route_pathtype_cmd
);
14128 install_element (ENABLE_NODE
, &show_bgp_prefix_cmd
);
14129 install_element (ENABLE_NODE
, &show_bgp_prefix_pathtype_cmd
);
14130 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_pathtype_cmd
);
14131 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_prefix_pathtype_cmd
);
14132 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_cmd
);
14133 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_prefix_cmd
);
14134 install_element (ENABLE_NODE
, &show_bgp_regexp_cmd
);
14135 install_element (ENABLE_NODE
, &show_bgp_ipv6_regexp_cmd
);
14136 install_element (ENABLE_NODE
, &show_bgp_prefix_list_cmd
);
14137 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
14138 install_element (ENABLE_NODE
, &show_bgp_filter_list_cmd
);
14139 install_element (ENABLE_NODE
, &show_bgp_ipv6_filter_list_cmd
);
14140 install_element (ENABLE_NODE
, &show_bgp_route_map_cmd
);
14141 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_map_cmd
);
14142 install_element (ENABLE_NODE
, &show_bgp_community_all_cmd
);
14143 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_all_cmd
);
14144 install_element (ENABLE_NODE
, &show_bgp_community_cmd
);
14145 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_cmd
);
14146 install_element (ENABLE_NODE
, &show_bgp_community2_cmd
);
14147 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_cmd
);
14148 install_element (ENABLE_NODE
, &show_bgp_community3_cmd
);
14149 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_cmd
);
14150 install_element (ENABLE_NODE
, &show_bgp_community4_cmd
);
14151 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_cmd
);
14152 install_element (ENABLE_NODE
, &show_bgp_community_exact_cmd
);
14153 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_exact_cmd
);
14154 install_element (ENABLE_NODE
, &show_bgp_community2_exact_cmd
);
14155 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
14156 install_element (ENABLE_NODE
, &show_bgp_community3_exact_cmd
);
14157 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
14158 install_element (ENABLE_NODE
, &show_bgp_community4_exact_cmd
);
14159 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
14160 install_element (ENABLE_NODE
, &show_bgp_community_list_cmd
);
14161 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_cmd
);
14162 install_element (ENABLE_NODE
, &show_bgp_community_list_exact_cmd
);
14163 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
14164 install_element (ENABLE_NODE
, &show_bgp_prefix_longer_cmd
);
14165 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
14166 install_element (ENABLE_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
14167 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
14168 install_element (ENABLE_NODE
, &show_bgp_neighbor_advertised_route_csv_cmd
);
14169 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_advertised_route_csv_cmd
);
14170 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_routes_cmd
);
14171 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
14172 install_element (ENABLE_NODE
, &show_bgp_neighbor_routes_cmd
);
14173 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
14174 install_element (ENABLE_NODE
, &show_bgp_neighbor_routes_csv_cmd
);
14175 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_routes_csv_cmd
);
14176 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
14177 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
14178 install_element (ENABLE_NODE
, &show_bgp_neighbor_flap_cmd
);
14179 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
14180 install_element (ENABLE_NODE
, &show_bgp_neighbor_damp_cmd
);
14181 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
14182 install_element (ENABLE_NODE
, &show_bgp_rsclient_cmd
);
14183 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_rsclient_cmd
);
14184 install_element (ENABLE_NODE
, &show_bgp_rsclient_route_cmd
);
14185 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_rsclient_route_cmd
);
14186 install_element (ENABLE_NODE
, &show_bgp_rsclient_prefix_cmd
);
14187 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_rsclient_prefix_cmd
);
14188 install_element (ENABLE_NODE
, &show_bgp_view_cmd
);
14189 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_cmd
);
14190 install_element (ENABLE_NODE
, &show_bgp_view_route_cmd
);
14191 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_route_cmd
);
14192 install_element (ENABLE_NODE
, &show_bgp_view_prefix_cmd
);
14193 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
14194 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
14195 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
14196 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_advertised_route_csv_cmd
);
14197 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_csv_cmd
);
14198 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
14199 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
14200 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_routes_cmd
);
14201 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_routes_csv_cmd
);
14202 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
14203 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
14204 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
14205 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_flap_cmd
);
14206 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
14207 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_damp_cmd
);
14208 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
14209 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_cmd
);
14210 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_safi_rsclient_cmd
);
14211 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_route_cmd
);
14212 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_safi_rsclient_route_cmd
);
14213 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
14214 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_safi_rsclient_prefix_cmd
);
14217 install_element (ENABLE_NODE
, &show_bgp_statistics_cmd
);
14218 install_element (ENABLE_NODE
, &show_bgp_statistics_vpnv4_cmd
);
14219 install_element (ENABLE_NODE
, &show_bgp_statistics_view_cmd
);
14220 install_element (ENABLE_NODE
, &show_bgp_statistics_view_vpnv4_cmd
);
14223 install_element (VIEW_NODE
, &show_ipv6_bgp_cmd
);
14224 install_element (VIEW_NODE
, &show_ipv6_bgp_route_cmd
);
14225 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_cmd
);
14226 install_element (VIEW_NODE
, &show_ipv6_bgp_regexp_cmd
);
14227 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
14228 install_element (VIEW_NODE
, &show_ipv6_bgp_filter_list_cmd
);
14229 install_element (VIEW_NODE
, &show_ipv6_bgp_community_all_cmd
);
14230 install_element (VIEW_NODE
, &show_ipv6_bgp_community_cmd
);
14231 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_cmd
);
14232 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_cmd
);
14233 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_cmd
);
14234 install_element (VIEW_NODE
, &show_ipv6_bgp_community_exact_cmd
);
14235 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
14236 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
14237 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
14238 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_cmd
);
14239 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
14240 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
14241 install_element (VIEW_NODE
, &show_ipv6_mbgp_cmd
);
14242 install_element (VIEW_NODE
, &show_ipv6_mbgp_route_cmd
);
14243 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_cmd
);
14244 install_element (VIEW_NODE
, &show_ipv6_mbgp_regexp_cmd
);
14245 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
14246 install_element (VIEW_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
14247 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_all_cmd
);
14248 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_cmd
);
14249 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_cmd
);
14250 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_cmd
);
14251 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_cmd
);
14252 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
14253 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
14254 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
14255 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
14256 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_cmd
);
14257 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
14258 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
14261 install_element (ENABLE_NODE
, &show_ipv6_bgp_cmd
);
14262 install_element (ENABLE_NODE
, &show_ipv6_bgp_route_cmd
);
14263 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_cmd
);
14264 install_element (ENABLE_NODE
, &show_ipv6_bgp_regexp_cmd
);
14265 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
14266 install_element (ENABLE_NODE
, &show_ipv6_bgp_filter_list_cmd
);
14267 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_all_cmd
);
14268 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_cmd
);
14269 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_cmd
);
14270 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_cmd
);
14271 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_cmd
);
14272 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_exact_cmd
);
14273 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
14274 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
14275 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
14276 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_cmd
);
14277 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
14278 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
14279 install_element (ENABLE_NODE
, &show_ipv6_mbgp_cmd
);
14280 install_element (ENABLE_NODE
, &show_ipv6_mbgp_route_cmd
);
14281 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_cmd
);
14282 install_element (ENABLE_NODE
, &show_ipv6_mbgp_regexp_cmd
);
14283 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
14284 install_element (ENABLE_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
14285 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_all_cmd
);
14286 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_cmd
);
14287 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_cmd
);
14288 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_cmd
);
14289 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_cmd
);
14290 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
14291 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
14292 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
14293 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
14294 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_cmd
);
14295 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
14296 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
14299 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
14300 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
14301 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
14302 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
14305 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
14306 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
14307 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
14308 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
14311 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
14312 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
14313 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
14314 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
14315 #endif /* HAVE_IPV6 */
14317 install_element (BGP_NODE
, &bgp_distance_cmd
);
14318 install_element (BGP_NODE
, &no_bgp_distance_cmd
);
14319 install_element (BGP_NODE
, &no_bgp_distance2_cmd
);
14320 install_element (BGP_NODE
, &bgp_distance_source_cmd
);
14321 install_element (BGP_NODE
, &no_bgp_distance_source_cmd
);
14322 install_element (BGP_NODE
, &bgp_distance_source_access_list_cmd
);
14323 install_element (BGP_NODE
, &no_bgp_distance_source_access_list_cmd
);
14325 install_element (BGP_NODE
, &bgp_damp_set_cmd
);
14326 install_element (BGP_NODE
, &bgp_damp_set2_cmd
);
14327 install_element (BGP_NODE
, &bgp_damp_set3_cmd
);
14328 install_element (BGP_NODE
, &bgp_damp_unset_cmd
);
14329 install_element (BGP_NODE
, &bgp_damp_unset2_cmd
);
14330 install_element (BGP_IPV4_NODE
, &bgp_damp_set_cmd
);
14331 install_element (BGP_IPV4_NODE
, &bgp_damp_set2_cmd
);
14332 install_element (BGP_IPV4_NODE
, &bgp_damp_set3_cmd
);
14333 install_element (BGP_IPV4_NODE
, &bgp_damp_unset_cmd
);
14334 install_element (BGP_IPV4_NODE
, &bgp_damp_unset2_cmd
);
14336 /* Deprecated AS-Pathlimit commands */
14337 install_element (BGP_NODE
, &bgp_network_ttl_cmd
);
14338 install_element (BGP_NODE
, &bgp_network_mask_ttl_cmd
);
14339 install_element (BGP_NODE
, &bgp_network_mask_natural_ttl_cmd
);
14340 install_element (BGP_NODE
, &bgp_network_backdoor_ttl_cmd
);
14341 install_element (BGP_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
14342 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
);
14344 install_element (BGP_NODE
, &no_bgp_network_ttl_cmd
);
14345 install_element (BGP_NODE
, &no_bgp_network_mask_ttl_cmd
);
14346 install_element (BGP_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
14347 install_element (BGP_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
14348 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
14349 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
);
14351 install_element (BGP_IPV4_NODE
, &bgp_network_ttl_cmd
);
14352 install_element (BGP_IPV4_NODE
, &bgp_network_mask_ttl_cmd
);
14353 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_ttl_cmd
);
14354 install_element (BGP_IPV4_NODE
, &bgp_network_backdoor_ttl_cmd
);
14355 install_element (BGP_IPV4_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
14356 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
);
14358 install_element (BGP_IPV4_NODE
, &no_bgp_network_ttl_cmd
);
14359 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_ttl_cmd
);
14360 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
14361 install_element (BGP_IPV4_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
14362 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
14363 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
);
14365 install_element (BGP_IPV4M_NODE
, &bgp_network_ttl_cmd
);
14366 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_ttl_cmd
);
14367 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_ttl_cmd
);
14368 install_element (BGP_IPV4M_NODE
, &bgp_network_backdoor_ttl_cmd
);
14369 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
14370 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
);
14372 install_element (BGP_IPV4M_NODE
, &no_bgp_network_ttl_cmd
);
14373 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_ttl_cmd
);
14374 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
14375 install_element (BGP_IPV4M_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
14376 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
14377 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
);
14380 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_ttl_cmd
);
14381 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_ttl_cmd
);
14386 bgp_route_finish (void)
14388 bgp_table_unlock (bgp_distance_table
);
14389 bgp_distance_table
= NULL
;