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"
58 /* Extern from bgp_dump.c */
59 extern char *bgp_origin_str
[];
60 extern char *bgp_origin_long_str
[];
62 static struct bgp_node
*
63 bgp_afi_node_get (struct bgp_table
*table
, afi_t afi
, safi_t safi
, struct prefix
*p
,
64 struct prefix_rd
*prd
)
67 struct bgp_node
*prn
= NULL
;
69 if (safi
== SAFI_MPLS_VPN
)
71 prn
= bgp_node_get (table
, (struct prefix
*) prd
);
73 if (prn
->info
== NULL
)
74 prn
->info
= bgp_table_init ();
76 bgp_unlock_node (prn
);
80 rn
= bgp_node_get (table
, p
);
82 if (safi
== SAFI_MPLS_VPN
)
88 /* Allocate new bgp info structure. */
89 static struct bgp_info
*
94 new = XMALLOC (MTYPE_BGP_ROUTE
, sizeof (struct bgp_info
));
95 memset (new, 0, sizeof (struct bgp_info
));
100 /* Free bgp route information. */
102 bgp_info_free (struct bgp_info
*binfo
)
105 bgp_attr_unintern (binfo
->attr
);
107 if (binfo
->damp_info
)
108 bgp_damp_info_free (binfo
->damp_info
, 0);
110 peer_unlock (binfo
->peer
); /* bgp_info peer reference */
112 XFREE (MTYPE_BGP_ROUTE
, binfo
);
116 bgp_info_lock (struct bgp_info
*binfo
)
123 bgp_info_unlock (struct bgp_info
*binfo
)
125 assert (binfo
&& binfo
->lock
> 0);
128 if (binfo
->lock
== 0)
131 zlog_debug ("%s: unlocked and freeing", __func__
);
132 zlog_backtrace (LOG_DEBUG
);
134 bgp_info_free (binfo
);
139 if (binfo
->lock
== 1)
141 zlog_debug ("%s: unlocked to 1", __func__
);
142 zlog_backtrace (LOG_DEBUG
);
150 bgp_info_add (struct bgp_node
*rn
, struct bgp_info
*ri
)
152 struct bgp_info
*top
;
164 peer_lock (ri
->peer
); /* bgp_info peer reference */
167 /* Do the actual removal of info from RIB, for use by bgp_process
168 completion callback *only* */
170 bgp_info_reap (struct bgp_node
*rn
, struct bgp_info
*ri
)
173 ri
->next
->prev
= ri
->prev
;
175 ri
->prev
->next
= ri
->next
;
179 bgp_info_unlock (ri
);
180 bgp_unlock_node (rn
);
184 bgp_info_delete (struct bgp_node
*rn
, struct bgp_info
*ri
)
186 /* leave info in place for now in place for now,
187 * bgp_process will reap it later. */
188 SET_FLAG (ri
->flags
, BGP_INFO_REMOVED
);
189 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
192 /* Get MED value. If MED value is missing and "bgp bestpath
193 missing-as-worst" is specified, treat it as the worst value. */
195 bgp_med_value (struct attr
*attr
, struct bgp
*bgp
)
197 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
201 if (bgp_flag_check (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
))
208 /* Compare two bgp route entity. br is preferable then return 1. */
210 bgp_info_cmp (struct bgp
*bgp
, struct bgp_info
*new, struct bgp_info
*exist
)
213 u_int32_t exist_pref
;
216 struct in_addr new_id
;
217 struct in_addr exist_id
;
220 int internal_as_route
= 0;
221 int confed_as_route
= 0;
230 /* 1. Weight check. */
231 if (new->attr
->weight
> exist
->attr
->weight
)
233 if (new->attr
->weight
< exist
->attr
->weight
)
236 /* 2. Local preference check. */
237 if (new->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
238 new_pref
= new->attr
->local_pref
;
240 new_pref
= bgp
->default_local_pref
;
242 if (exist
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
243 exist_pref
= exist
->attr
->local_pref
;
245 exist_pref
= bgp
->default_local_pref
;
247 if (new_pref
> exist_pref
)
249 if (new_pref
< exist_pref
)
252 /* 3. Local route check. */
253 if (new->sub_type
== BGP_ROUTE_STATIC
)
255 if (exist
->sub_type
== BGP_ROUTE_STATIC
)
258 if (new->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
260 if (exist
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
263 if (new->sub_type
== BGP_ROUTE_AGGREGATE
)
265 if (exist
->sub_type
== BGP_ROUTE_AGGREGATE
)
268 /* 4. AS path length check. */
269 if (! bgp_flag_check (bgp
, BGP_FLAG_ASPATH_IGNORE
))
271 int exist_hops
= aspath_count_hops (exist
->attr
->aspath
);
272 int exist_confeds
= aspath_count_confeds (exist
->attr
->aspath
);
274 if (bgp_flag_check (bgp
, BGP_FLAG_ASPATH_CONFED
))
278 aspath_hops
= aspath_count_hops (new->attr
->aspath
);
279 aspath_hops
+= aspath_count_confeds (new->attr
->aspath
);
281 if ( aspath_hops
< (exist_hops
+ exist_confeds
))
283 if ( aspath_hops
> (exist_hops
+ exist_confeds
))
288 int newhops
= aspath_count_hops (new->attr
->aspath
);
290 if (newhops
< exist_hops
)
292 if (newhops
> exist_hops
)
297 /* 5. Origin check. */
298 if (new->attr
->origin
< exist
->attr
->origin
)
300 if (new->attr
->origin
> exist
->attr
->origin
)
304 internal_as_route
= (aspath_count_hops (new->attr
->aspath
) == 0
305 && aspath_count_hops (exist
->attr
->aspath
) == 0);
306 confed_as_route
= (aspath_count_confeds (new->attr
->aspath
) > 0
307 && aspath_count_confeds (exist
->attr
->aspath
) > 0
308 && aspath_count_hops (new->attr
->aspath
) == 0
309 && aspath_count_hops (exist
->attr
->aspath
) == 0);
311 if (bgp_flag_check (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
)
312 || (bgp_flag_check (bgp
, BGP_FLAG_MED_CONFED
)
314 || aspath_cmp_left (new->attr
->aspath
, exist
->attr
->aspath
)
315 || aspath_cmp_left_confed (new->attr
->aspath
, exist
->attr
->aspath
)
316 || internal_as_route
)
318 new_med
= bgp_med_value (new->attr
, bgp
);
319 exist_med
= bgp_med_value (exist
->attr
, bgp
);
321 if (new_med
< exist_med
)
323 if (new_med
> exist_med
)
327 /* 7. Peer type check. */
328 if (peer_sort (new->peer
) == BGP_PEER_EBGP
329 && peer_sort (exist
->peer
) == BGP_PEER_IBGP
)
331 if (peer_sort (new->peer
) == BGP_PEER_EBGP
332 && peer_sort (exist
->peer
) == BGP_PEER_CONFED
)
334 if (peer_sort (new->peer
) == BGP_PEER_IBGP
335 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
337 if (peer_sort (new->peer
) == BGP_PEER_CONFED
338 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
341 /* 8. IGP metric check. */
342 if (new->igpmetric
< exist
->igpmetric
)
344 if (new->igpmetric
> exist
->igpmetric
)
347 /* 9. Maximum path check. */
349 /* 10. If both paths are external, prefer the path that was received
350 first (the oldest one). This step minimizes route-flap, since a
351 newer path won't displace an older one, even if it was the
352 preferred route based on the additional decision criteria below. */
353 if (! bgp_flag_check (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
)
354 && peer_sort (new->peer
) == BGP_PEER_EBGP
355 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
357 if (CHECK_FLAG (new->flags
, BGP_INFO_SELECTED
))
359 if (CHECK_FLAG (exist
->flags
, BGP_INFO_SELECTED
))
363 /* 11. Rourter-ID comparision. */
364 if (new->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
365 new_id
.s_addr
= new->attr
->originator_id
.s_addr
;
367 new_id
.s_addr
= new->peer
->remote_id
.s_addr
;
368 if (exist
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
369 exist_id
.s_addr
= exist
->attr
->originator_id
.s_addr
;
371 exist_id
.s_addr
= exist
->peer
->remote_id
.s_addr
;
373 if (ntohl (new_id
.s_addr
) < ntohl (exist_id
.s_addr
))
375 if (ntohl (new_id
.s_addr
) > ntohl (exist_id
.s_addr
))
378 /* 12. Cluster length comparision. */
379 if (new->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
380 new_cluster
= new->attr
->cluster
->length
;
383 if (exist
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
384 exist_cluster
= exist
->attr
->cluster
->length
;
388 if (new_cluster
< exist_cluster
)
390 if (new_cluster
> exist_cluster
)
393 /* 13. Neighbor address comparision. */
394 ret
= sockunion_cmp (new->peer
->su_remote
, exist
->peer
->su_remote
);
404 static enum filter_type
405 bgp_input_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
406 afi_t afi
, safi_t safi
)
408 struct bgp_filter
*filter
;
410 filter
= &peer
->filter
[afi
][safi
];
412 if (DISTRIBUTE_IN_NAME (filter
))
413 if (access_list_apply (DISTRIBUTE_IN (filter
), p
) == FILTER_DENY
)
416 if (PREFIX_LIST_IN_NAME (filter
))
417 if (prefix_list_apply (PREFIX_LIST_IN (filter
), p
) == PREFIX_DENY
)
420 if (FILTER_LIST_IN_NAME (filter
))
421 if (as_list_apply (FILTER_LIST_IN (filter
), attr
->aspath
)== AS_FILTER_DENY
)
424 return FILTER_PERMIT
;
427 static enum filter_type
428 bgp_output_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
429 afi_t afi
, safi_t safi
)
431 struct bgp_filter
*filter
;
433 filter
= &peer
->filter
[afi
][safi
];
435 if (DISTRIBUTE_OUT_NAME (filter
))
436 if (access_list_apply (DISTRIBUTE_OUT (filter
), p
) == FILTER_DENY
)
439 if (PREFIX_LIST_OUT_NAME (filter
))
440 if (prefix_list_apply (PREFIX_LIST_OUT (filter
), p
) == PREFIX_DENY
)
443 if (FILTER_LIST_OUT_NAME (filter
))
444 if (as_list_apply (FILTER_LIST_OUT (filter
), attr
->aspath
) == AS_FILTER_DENY
)
447 return FILTER_PERMIT
;
450 /* If community attribute includes no_export then return 1. */
452 bgp_community_filter (struct peer
*peer
, struct attr
*attr
)
456 /* NO_ADVERTISE check. */
457 if (community_include (attr
->community
, COMMUNITY_NO_ADVERTISE
))
460 /* NO_EXPORT check. */
461 if (peer_sort (peer
) == BGP_PEER_EBGP
&&
462 community_include (attr
->community
, COMMUNITY_NO_EXPORT
))
465 /* NO_EXPORT_SUBCONFED check. */
466 if (peer_sort (peer
) == BGP_PEER_EBGP
467 || peer_sort (peer
) == BGP_PEER_CONFED
)
468 if (community_include (attr
->community
, COMMUNITY_NO_EXPORT_SUBCONFED
))
474 /* Route reflection loop check. */
476 bgp_cluster_filter (struct peer
*peer
, struct attr
*attr
)
478 struct in_addr cluster_id
;
482 if (peer
->bgp
->config
& BGP_CONFIG_CLUSTER_ID
)
483 cluster_id
= peer
->bgp
->cluster_id
;
485 cluster_id
= peer
->bgp
->router_id
;
487 if (cluster_loop_check (attr
->cluster
, cluster_id
))
494 bgp_input_modifier (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
495 afi_t afi
, safi_t safi
)
497 struct bgp_filter
*filter
;
498 struct bgp_info info
;
499 route_map_result_t ret
;
501 filter
= &peer
->filter
[afi
][safi
];
503 /* Apply default weight value. */
504 attr
->weight
= peer
->weight
;
506 /* Route map apply. */
507 if (ROUTE_MAP_IN_NAME (filter
))
509 /* Duplicate current value to new strucutre for modification. */
513 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IN
);
515 /* Apply BGP route map to the attribute. */
516 ret
= route_map_apply (ROUTE_MAP_IN (filter
), p
, RMAP_BGP
, &info
);
520 if (ret
== RMAP_DENYMATCH
)
522 /* Free newly generated AS path and community by route-map. */
523 bgp_attr_flush (attr
);
531 bgp_export_modifier (struct peer
*rsclient
, struct peer
*peer
,
532 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
534 struct bgp_filter
*filter
;
535 struct bgp_info info
;
536 route_map_result_t ret
;
538 filter
= &peer
->filter
[afi
][safi
];
540 /* Route map apply. */
541 if (ROUTE_MAP_EXPORT_NAME (filter
))
543 /* Duplicate current value to new strucutre for modification. */
544 info
.peer
= rsclient
;
547 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
549 /* Apply BGP route map to the attribute. */
550 ret
= route_map_apply (ROUTE_MAP_EXPORT (filter
), p
, RMAP_BGP
, &info
);
552 rsclient
->rmap_type
= 0;
554 if (ret
== RMAP_DENYMATCH
)
556 /* Free newly generated AS path and community by route-map. */
557 bgp_attr_flush (attr
);
565 bgp_import_modifier (struct peer
*rsclient
, struct peer
*peer
,
566 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
568 struct bgp_filter
*filter
;
569 struct bgp_info info
;
570 route_map_result_t ret
;
572 filter
= &rsclient
->filter
[afi
][safi
];
574 /* Apply default weight value. */
575 attr
->weight
= peer
->weight
;
577 /* Route map apply. */
578 if (ROUTE_MAP_IMPORT_NAME (filter
))
580 /* Duplicate current value to new strucutre for modification. */
584 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IMPORT
);
586 /* Apply BGP route map to the attribute. */
587 ret
= route_map_apply (ROUTE_MAP_IMPORT (filter
), p
, RMAP_BGP
, &info
);
591 if (ret
== RMAP_DENYMATCH
)
593 /* Free newly generated AS path and community by route-map. */
594 bgp_attr_flush (attr
);
602 bgp_announce_check (struct bgp_info
*ri
, struct peer
*peer
, struct prefix
*p
,
603 struct attr
*attr
, afi_t afi
, safi_t safi
)
606 char buf
[SU_ADDRSTRLEN
];
607 struct bgp_filter
*filter
;
608 struct bgp_info info
;
611 struct attr dummy_attr
;
616 filter
= &peer
->filter
[afi
][safi
];
619 #ifdef DISABLE_BGP_ANNOUNCE
623 /* Do not send announces to RS-clients from the 'normal' bgp_table. */
624 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
627 /* Do not send back route to sender. */
631 /* If peer's id and route's nexthop are same. draft-ietf-idr-bgp4-23 5.1.3 */
632 if (p
->family
== AF_INET
633 && IPV4_ADDR_SAME(&peer
->remote_id
, &ri
->attr
->nexthop
))
636 if (p
->family
== AF_INET6
637 && IPV6_ADDR_SAME(&peer
->remote_id
, &ri
->attr
->nexthop
))
641 /* Aggregate-address suppress check. */
643 if (! UNSUPPRESS_MAP_NAME (filter
))
646 /* Default route check. */
647 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
649 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
652 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
654 #endif /* HAVE_IPV6 */
657 /* Transparency check. */
658 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
)
659 && CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
664 /* If community is not disabled check the no-export and local. */
665 if (! transparent
&& bgp_community_filter (peer
, ri
->attr
))
668 /* If the attribute has originator-id and it is same as remote
670 if (ri
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
672 if (IPV4_ADDR_SAME (&peer
->remote_id
, &ri
->attr
->originator_id
))
674 if (BGP_DEBUG (filter
, FILTER
))
675 zlog (peer
->log
, LOG_DEBUG
,
676 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
678 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
684 /* ORF prefix-list filter check */
685 if (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
686 && (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
687 || CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
688 if (peer
->orf_plist
[afi
][safi
])
690 if (prefix_list_apply (peer
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
694 /* Output filter check. */
695 if (bgp_output_filter (peer
, p
, ri
->attr
, afi
, safi
) == FILTER_DENY
)
697 if (BGP_DEBUG (filter
, FILTER
))
698 zlog (peer
->log
, LOG_DEBUG
,
699 "%s [Update:SEND] %s/%d is filtered",
701 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
706 #ifdef BGP_SEND_ASPATH_CHECK
707 /* AS path loop check. */
708 if (aspath_loop_check (ri
->attr
->aspath
, peer
->as
))
710 if (BGP_DEBUG (filter
, FILTER
))
711 zlog (peer
->log
, LOG_DEBUG
,
712 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
713 peer
->host
, peer
->as
);
716 #endif /* BGP_SEND_ASPATH_CHECK */
718 /* If we're a CONFED we need to loop check the CONFED ID too */
719 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
721 if (aspath_loop_check(ri
->attr
->aspath
, bgp
->confed_id
))
723 if (BGP_DEBUG (filter
, FILTER
))
724 zlog (peer
->log
, LOG_DEBUG
,
725 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
732 /* Route-Reflect check. */
733 if (peer_sort (from
) == BGP_PEER_IBGP
&& peer_sort (peer
) == BGP_PEER_IBGP
)
738 /* IBGP reflection check. */
741 /* A route from a Client peer. */
742 if (CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
744 /* Reflect to all the Non-Client peers and also to the
745 Client peers other than the originator. Originator check
746 is already done. So there is noting to do. */
747 /* no bgp client-to-client reflection check. */
748 if (bgp_flag_check (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
))
749 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
754 /* A route from a Non-client peer. Reflect to all other
756 if (! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
761 /* For modify attribute, copy it to temporary structure. */
764 /* If local-preference is not set. */
765 if ((peer_sort (peer
) == BGP_PEER_IBGP
766 || peer_sort (peer
) == BGP_PEER_CONFED
)
767 && (! (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))))
769 attr
->flag
|= ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
);
770 attr
->local_pref
= bgp
->default_local_pref
;
773 /* Remove MED if its an EBGP peer - will get overwritten by route-maps */
774 if (peer_sort (peer
) == BGP_PEER_EBGP
775 && attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
777 if (ri
->peer
!= bgp
->peer_self
&& ! transparent
778 && ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
779 attr
->flag
&= ~(ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
));
783 if (transparent
|| reflect
784 || (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
)
785 && ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
)
787 || (p
->family
== AF_INET6
&&
788 ! IN6_IS_ADDR_UNSPECIFIED(&attr
->mp_nexthop_global
))
789 #endif /* HAVE_IPV6 */
792 /* NEXT-HOP Unchanged. */
794 else if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
795 || (p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
797 || (p
->family
== AF_INET6
&&
798 IN6_IS_ADDR_UNSPECIFIED(&attr
->mp_nexthop_global
))
799 #endif /* HAVE_IPV6 */
800 || (peer_sort (peer
) == BGP_PEER_EBGP
801 && bgp_multiaccess_check_v4 (attr
->nexthop
, peer
->host
) == 0))
803 /* Set IPv4 nexthop. */
804 if (p
->family
== AF_INET
)
806 if (safi
== SAFI_MPLS_VPN
)
807 memcpy (&attr
->mp_nexthop_global_in
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
809 memcpy (&attr
->nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
812 /* Set IPv6 nexthop. */
813 if (p
->family
== AF_INET6
)
815 /* IPv6 global nexthop must be included. */
816 memcpy (&attr
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
818 attr
->mp_nexthop_len
= 16;
820 #endif /* HAVE_IPV6 */
824 if (p
->family
== AF_INET6
)
826 /* Left nexthop_local unchanged if so configured. */
827 if ( CHECK_FLAG (peer
->af_flags
[afi
][safi
],
828 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
830 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->mp_nexthop_local
) )
831 attr
->mp_nexthop_len
=32;
833 attr
->mp_nexthop_len
=16;
836 /* Default nexthop_local treatment for non-RS-Clients */
839 /* Link-local address should not be transit to different peer. */
840 attr
->mp_nexthop_len
= 16;
842 /* Set link-local address for shared network peer. */
843 if (peer
->shared_network
844 && ! IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
846 memcpy (&attr
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
848 attr
->mp_nexthop_len
= 32;
851 /* If bgpd act as BGP-4+ route-reflector, do not send link-local
854 attr
->mp_nexthop_len
= 16;
856 /* If BGP-4+ link-local nexthop is not link-local nexthop. */
857 if (! IN6_IS_ADDR_LINKLOCAL (&peer
->nexthop
.v6_local
))
858 attr
->mp_nexthop_len
= 16;
862 #endif /* HAVE_IPV6 */
864 /* If this is EBGP peer and remove-private-AS is set. */
865 if (peer_sort (peer
) == BGP_PEER_EBGP
866 && peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
)
867 && aspath_private_as_check (attr
->aspath
))
868 attr
->aspath
= aspath_empty_get ();
870 /* Route map & unsuppress-map apply. */
871 if (ROUTE_MAP_OUT_NAME (filter
)
877 /* The route reflector is not allowed to modify the attributes
878 of the reflected IBGP routes. */
879 if (peer_sort (from
) == BGP_PEER_IBGP
880 && peer_sort (peer
) == BGP_PEER_IBGP
)
883 info
.attr
= &dummy_attr
;
886 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_OUT
);
889 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
891 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
895 if (ret
== RMAP_DENYMATCH
)
897 bgp_attr_flush (attr
);
905 bgp_announce_check_rsclient (struct bgp_info
*ri
, struct peer
*rsclient
,
906 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
909 char buf
[SU_ADDRSTRLEN
];
910 struct bgp_filter
*filter
;
911 struct bgp_info info
;
916 filter
= &rsclient
->filter
[afi
][safi
];
919 #ifdef DISABLE_BGP_ANNOUNCE
923 /* Do not send back route to sender. */
924 if (from
== rsclient
)
927 /* Aggregate-address suppress check. */
929 if (! UNSUPPRESS_MAP_NAME (filter
))
932 /* Default route check. */
933 if (CHECK_FLAG (rsclient
->af_sflags
[afi
][safi
],
934 PEER_STATUS_DEFAULT_ORIGINATE
))
936 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
939 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
941 #endif /* HAVE_IPV6 */
944 /* If the attribute has originator-id and it is same as remote
946 if (ri
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
948 if (IPV4_ADDR_SAME (&rsclient
->remote_id
, &ri
->attr
->originator_id
))
950 if (BGP_DEBUG (filter
, FILTER
))
951 zlog (rsclient
->log
, LOG_DEBUG
,
952 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
954 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
960 /* ORF prefix-list filter check */
961 if (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
962 && (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
963 || CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
964 if (rsclient
->orf_plist
[afi
][safi
])
966 if (prefix_list_apply (rsclient
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
970 /* Output filter check. */
971 if (bgp_output_filter (rsclient
, p
, ri
->attr
, afi
, safi
) == FILTER_DENY
)
973 if (BGP_DEBUG (filter
, FILTER
))
974 zlog (rsclient
->log
, LOG_DEBUG
,
975 "%s [Update:SEND] %s/%d is filtered",
977 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
982 #ifdef BGP_SEND_ASPATH_CHECK
983 /* AS path loop check. */
984 if (aspath_loop_check (ri
->attr
->aspath
, rsclient
->as
))
986 if (BGP_DEBUG (filter
, FILTER
))
987 zlog (rsclient
->log
, LOG_DEBUG
,
988 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
989 rsclient
->host
, rsclient
->as
);
992 #endif /* BGP_SEND_ASPATH_CHECK */
994 /* For modify attribute, copy it to temporary structure. */
998 if ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
1000 || (p
->family
== AF_INET6
&&
1001 IN6_IS_ADDR_UNSPECIFIED(&attr
->mp_nexthop_global
))
1002 #endif /* HAVE_IPV6 */
1005 /* Set IPv4 nexthop. */
1006 if (p
->family
== AF_INET
)
1008 if (safi
== SAFI_MPLS_VPN
)
1009 memcpy (&attr
->mp_nexthop_global_in
, &rsclient
->nexthop
.v4
,
1012 memcpy (&attr
->nexthop
, &rsclient
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
1015 /* Set IPv6 nexthop. */
1016 if (p
->family
== AF_INET6
)
1018 /* IPv6 global nexthop must be included. */
1019 memcpy (&attr
->mp_nexthop_global
, &rsclient
->nexthop
.v6_global
,
1022 attr
->mp_nexthop_len
= 16;
1024 #endif /* HAVE_IPV6 */
1028 if (p
->family
== AF_INET6
)
1030 /* Left nexthop_local unchanged if so configured. */
1031 if ( CHECK_FLAG (rsclient
->af_flags
[afi
][safi
],
1032 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
1034 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->mp_nexthop_local
) )
1035 attr
->mp_nexthop_len
=32;
1037 attr
->mp_nexthop_len
=16;
1040 /* Default nexthop_local treatment for RS-Clients */
1043 /* Announcer and RS-Client are both in the same network */
1044 if (rsclient
->shared_network
&& from
->shared_network
&&
1045 (rsclient
->ifindex
== from
->ifindex
))
1047 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->mp_nexthop_local
) )
1048 attr
->mp_nexthop_len
=32;
1050 attr
->mp_nexthop_len
=16;
1053 /* Set link-local address for shared network peer. */
1054 else if (rsclient
->shared_network
1055 && IN6_IS_ADDR_LINKLOCAL (&rsclient
->nexthop
.v6_local
))
1057 memcpy (&attr
->mp_nexthop_local
, &rsclient
->nexthop
.v6_local
,
1059 attr
->mp_nexthop_len
= 32;
1063 attr
->mp_nexthop_len
= 16;
1067 #endif /* HAVE_IPV6 */
1070 /* If this is EBGP peer and remove-private-AS is set. */
1071 if (peer_sort (rsclient
) == BGP_PEER_EBGP
1072 && peer_af_flag_check (rsclient
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
)
1073 && aspath_private_as_check (attr
->aspath
))
1074 attr
->aspath
= aspath_empty_get ();
1076 /* Route map & unsuppress-map apply. */
1077 if (ROUTE_MAP_OUT_NAME (filter
) || ri
->suppress
)
1079 info
.peer
= rsclient
;
1082 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_OUT
);
1085 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
1087 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
1089 rsclient
->rmap_type
= 0;
1091 if (ret
== RMAP_DENYMATCH
)
1093 bgp_attr_flush (attr
);
1101 struct bgp_info_pair
1103 struct bgp_info
*old
;
1104 struct bgp_info
*new;
1108 bgp_best_selection (struct bgp
*bgp
, struct bgp_node
*rn
, struct bgp_info_pair
*result
)
1110 struct bgp_info
*new_select
;
1111 struct bgp_info
*old_select
;
1112 struct bgp_info
*ri
;
1113 struct bgp_info
*ri1
;
1114 struct bgp_info
*ri2
;
1115 struct bgp_info
*nextri
= NULL
;
1117 /* bgp deterministic-med */
1119 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1120 for (ri1
= rn
->info
; ri1
; ri1
= ri1
->next
)
1122 if (CHECK_FLAG (ri1
->flags
, BGP_INFO_DMED_CHECK
))
1124 if (BGP_INFO_HOLDDOWN (ri1
))
1129 for (ri2
= ri1
->next
; ri2
; ri2
= ri2
->next
)
1131 if (CHECK_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
))
1133 if (BGP_INFO_HOLDDOWN (ri2
))
1136 if (aspath_cmp_left (ri1
->attr
->aspath
, ri2
->attr
->aspath
)
1137 || aspath_cmp_left_confed (ri1
->attr
->aspath
,
1140 if (bgp_info_cmp (bgp
, ri2
, new_select
))
1142 UNSET_FLAG (new_select
->flags
, BGP_INFO_DMED_SELECTED
);
1146 SET_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
);
1149 SET_FLAG (new_select
->flags
, BGP_INFO_DMED_CHECK
);
1150 SET_FLAG (new_select
->flags
, BGP_INFO_DMED_SELECTED
);
1153 /* Check old selected route and new selected route. */
1156 for (ri
= rn
->info
; (ri
!= NULL
) && (nextri
= ri
->next
, 1); ri
= nextri
)
1158 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
1161 if (BGP_INFO_HOLDDOWN (ri
))
1163 /* reap REMOVED routes, if needs be
1164 * selected route must stay for a while longer though
1166 if (CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
)
1167 && (ri
!= old_select
))
1168 bgp_info_reap (rn
, ri
);
1173 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
)
1174 && (! CHECK_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
)))
1176 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_CHECK
);
1179 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_CHECK
);
1180 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
);
1182 if (bgp_info_cmp (bgp
, ri
, new_select
))
1186 result
->old
= old_select
;
1187 result
->new = new_select
;
1193 bgp_process_announce_selected (struct peer
*peer
, struct bgp_info
*selected
,
1194 struct bgp_node
*rn
, struct attr
*attr
, afi_t afi
, safi_t safi
)
1200 /* Announce route to Established peer. */
1201 if (peer
->status
!= Established
)
1204 /* Address family configuration check. */
1205 if (! peer
->afc_nego
[afi
][safi
])
1208 /* First update is deferred until ORF or ROUTE-REFRESH is received */
1209 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
1210 PEER_STATUS_ORF_WAIT_REFRESH
))
1213 switch (rn
->table
->type
)
1215 case BGP_TABLE_MAIN
:
1216 /* Announcement to peer->conf. If the route is filtered,
1218 if (selected
&& bgp_announce_check (selected
, peer
, p
, attr
, afi
, safi
))
1219 bgp_adj_out_set (rn
, peer
, p
, attr
, afi
, safi
, selected
);
1221 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1223 case BGP_TABLE_RSCLIENT
:
1224 /* Announcement to peer->conf. If the route is filtered,
1226 if (selected
&& bgp_announce_check_rsclient
1227 (selected
, peer
, p
, attr
, afi
, safi
))
1228 bgp_adj_out_set (rn
, peer
, p
, attr
, afi
, safi
, selected
);
1230 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1236 struct bgp_process_queue
1239 struct bgp_node
*rn
;
1244 static wq_item_status
1245 bgp_process_rsclient (struct bgp_process_queue
*pq
)
1247 struct bgp
*bgp
= pq
->bgp
;
1248 struct bgp_node
*rn
= pq
->rn
;
1249 afi_t afi
= pq
->afi
;
1250 safi_t safi
= pq
->safi
;
1251 struct bgp_info
*new_select
;
1252 struct bgp_info
*old_select
;
1253 struct bgp_info_pair old_and_new
;
1255 struct listnode
*node
, *nnode
;
1256 struct peer
*rsclient
= rn
->table
->owner
;
1258 /* we shouldn't run if the clear_route_node queue is still running
1259 * or scheduled to run, or we can race with session coming up
1260 * and adding routes back before we've cleared them
1262 if (bm
->clear_node_queue
&& bm
->clear_node_queue
->thread
)
1263 return WQ_QUEUE_BLOCKED
;
1265 /* Best path selection. */
1266 bgp_best_selection (bgp
, rn
, &old_and_new
);
1267 new_select
= old_and_new
.new;
1268 old_select
= old_and_new
.old
;
1270 if (CHECK_FLAG (rsclient
->sflags
, PEER_STATUS_GROUP
))
1272 for (ALL_LIST_ELEMENTS (rsclient
->group
->peer
, node
, nnode
, rsclient
))
1274 /* Nothing to do. */
1275 if (old_select
&& old_select
== new_select
)
1276 if (!CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1280 UNSET_FLAG (old_select
->flags
, BGP_INFO_SELECTED
);
1283 SET_FLAG (new_select
->flags
, BGP_INFO_SELECTED
);
1284 UNSET_FLAG (new_select
->flags
, BGP_INFO_ATTR_CHANGED
);
1287 bgp_process_announce_selected (rsclient
, new_select
, rn
, &attr
,
1294 UNSET_FLAG (old_select
->flags
, BGP_INFO_SELECTED
);
1297 SET_FLAG (new_select
->flags
, BGP_INFO_SELECTED
);
1298 UNSET_FLAG (new_select
->flags
, BGP_INFO_ATTR_CHANGED
);
1300 bgp_process_announce_selected (rsclient
, new_select
, rn
,
1304 if (old_select
&& CHECK_FLAG (old_select
->flags
, BGP_INFO_REMOVED
))
1305 bgp_info_reap (rn
, old_select
);
1307 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1311 static wq_item_status
1312 bgp_process_main (struct bgp_process_queue
*pq
)
1314 struct bgp
*bgp
= pq
->bgp
;
1315 struct bgp_node
*rn
= pq
->rn
;
1316 afi_t afi
= pq
->afi
;
1317 safi_t safi
= pq
->safi
;
1318 struct prefix
*p
= &rn
->p
;
1319 struct bgp_info
*new_select
;
1320 struct bgp_info
*old_select
;
1321 struct bgp_info_pair old_and_new
;
1322 struct listnode
*node
, *nnode
;
1326 /* we shouldn't run if the clear_route_node queue is still running
1327 * or scheduled to run, or we can race with session coming up
1328 * and adding routes back before we've cleared them
1330 if (bm
->clear_node_queue
&& bm
->clear_node_queue
->thread
)
1331 return WQ_QUEUE_BLOCKED
;
1333 /* Best path selection. */
1334 bgp_best_selection (bgp
, rn
, &old_and_new
);
1335 old_select
= old_and_new
.old
;
1336 new_select
= old_and_new
.new;
1338 /* Nothing to do. */
1339 if (old_select
&& old_select
== new_select
)
1341 if (! CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1343 if (CHECK_FLAG (old_select
->flags
, BGP_INFO_IGP_CHANGED
))
1344 bgp_zebra_announce (p
, old_select
, bgp
);
1346 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1352 UNSET_FLAG (old_select
->flags
, BGP_INFO_SELECTED
);
1355 SET_FLAG (new_select
->flags
, BGP_INFO_SELECTED
);
1356 UNSET_FLAG (new_select
->flags
, BGP_INFO_ATTR_CHANGED
);
1360 /* Check each BGP peer. */
1361 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1363 bgp_process_announce_selected (peer
, new_select
, rn
, &attr
, afi
, safi
);
1367 if (safi
== SAFI_UNICAST
&& ! bgp
->name
&&
1368 ! bgp_option_check (BGP_OPT_NO_FIB
))
1371 && new_select
->type
== ZEBRA_ROUTE_BGP
1372 && new_select
->sub_type
== BGP_ROUTE_NORMAL
)
1373 bgp_zebra_announce (p
, new_select
, bgp
);
1376 /* Withdraw the route from the kernel. */
1378 && old_select
->type
== ZEBRA_ROUTE_BGP
1379 && old_select
->sub_type
== BGP_ROUTE_NORMAL
)
1380 bgp_zebra_withdraw (p
, old_select
);
1384 /* Reap old select bgp_info, it it has been removed */
1385 if (old_select
&& CHECK_FLAG (old_select
->flags
, BGP_INFO_REMOVED
))
1386 bgp_info_reap (rn
, old_select
);
1388 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1393 bgp_processq_del (struct bgp_process_queue
*pq
)
1395 bgp_unlock_node (pq
->rn
);
1396 XFREE (MTYPE_BGP_PROCESS_QUEUE
, pq
);
1400 bgp_process_queue_init (void)
1402 bm
->process_main_queue
1403 = work_queue_new (bm
->master
, "process_main_queue");
1404 bm
->process_rsclient_queue
1405 = work_queue_new (bm
->master
, "process_rsclient_queue");
1407 if ( !(bm
->process_main_queue
&& bm
->process_rsclient_queue
) )
1409 zlog_err ("%s: Failed to allocate work queue", __func__
);
1413 bm
->process_main_queue
->spec
.workfunc
= &bgp_process_main
;
1414 bm
->process_rsclient_queue
->spec
.workfunc
= &bgp_process_rsclient
;
1415 bm
->process_main_queue
->spec
.del_item_data
= &bgp_processq_del
;
1416 bm
->process_rsclient_queue
->spec
.del_item_data
1417 = bm
->process_main_queue
->spec
.del_item_data
;
1418 bm
->process_main_queue
->spec
.max_retries
1419 = bm
->process_main_queue
->spec
.max_retries
= 0;
1420 bm
->process_rsclient_queue
->spec
.hold
1421 = bm
->process_main_queue
->spec
.hold
= 500;
1422 bm
->process_rsclient_queue
->spec
.delay
1423 = bm
->process_main_queue
->spec
.delay
= 10;
1427 bgp_process (struct bgp
*bgp
, struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
1429 struct bgp_process_queue
*pqnode
;
1431 /* already scheduled for processing? */
1432 if (CHECK_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
))
1435 if ( (bm
->process_main_queue
== NULL
) ||
1436 (bm
->process_rsclient_queue
== NULL
) )
1437 bgp_process_queue_init ();
1439 pqnode
= XCALLOC (MTYPE_BGP_PROCESS_QUEUE
,
1440 sizeof (struct bgp_process_queue
));
1444 pqnode
->rn
= bgp_lock_node (rn
); /* unlocked by bgp_processq_del */
1447 pqnode
->safi
= safi
;
1449 switch (rn
->table
->type
)
1451 case BGP_TABLE_MAIN
:
1452 work_queue_add (bm
->process_main_queue
, pqnode
);
1454 case BGP_TABLE_RSCLIENT
:
1455 work_queue_add (bm
->process_rsclient_queue
, pqnode
);
1463 bgp_maximum_prefix_restart_timer (struct thread
*thread
)
1467 peer
= THREAD_ARG (thread
);
1468 peer
->t_pmax_restart
= NULL
;
1470 if (BGP_DEBUG (events
, EVENTS
))
1471 zlog_debug ("%s Maximum-prefix restart timer expired, restore peering",
1480 bgp_maximum_prefix_overflow (struct peer
*peer
, afi_t afi
,
1481 safi_t safi
, int always
)
1483 if (!CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
1486 if (peer
->pcount
[afi
][safi
] > peer
->pmax
[afi
][safi
])
1488 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
)
1492 zlog (peer
->log
, LOG_INFO
,
1493 "%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, "
1494 "limit %ld", afi_safi_print (afi
, safi
), peer
->host
,
1495 peer
->pcount
[afi
][safi
], peer
->pmax
[afi
][safi
]);
1496 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1498 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
1504 if (safi
== SAFI_MPLS_VPN
)
1505 safi
= BGP_SAFI_VPNV4
;
1507 ndata
[0] = (afi
>> 8);
1510 ndata
[3] = (peer
->pmax
[afi
][safi
] >> 24);
1511 ndata
[4] = (peer
->pmax
[afi
][safi
] >> 16);
1512 ndata
[5] = (peer
->pmax
[afi
][safi
] >> 8);
1513 ndata
[6] = (peer
->pmax
[afi
][safi
]);
1515 SET_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
);
1516 bgp_notify_send_with_data (peer
, BGP_NOTIFY_CEASE
,
1517 BGP_NOTIFY_CEASE_MAX_PREFIX
, ndata
, 7);
1520 /* restart timer start */
1521 if (peer
->pmax_restart
[afi
][safi
])
1523 peer
->v_pmax_restart
= peer
->pmax_restart
[afi
][safi
] * 60;
1525 if (BGP_DEBUG (events
, EVENTS
))
1526 zlog_debug ("%s Maximum-prefix restart timer started for %d secs",
1527 peer
->host
, peer
->v_pmax_restart
);
1529 BGP_TIMER_ON (peer
->t_pmax_restart
, bgp_maximum_prefix_restart_timer
,
1530 peer
->v_pmax_restart
);
1536 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1538 if (peer
->pcount
[afi
][safi
] > (peer
->pmax
[afi
][safi
] * peer
->pmax_threshold
[afi
][safi
] / 100))
1540 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
)
1544 zlog (peer
->log
, LOG_INFO
,
1545 "%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld",
1546 afi_safi_print (afi
, safi
), peer
->host
, peer
->pcount
[afi
][safi
],
1547 peer
->pmax
[afi
][safi
]);
1548 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
1551 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
1555 /* Unconditionally remove the route from the RIB, without taking
1556 * damping into consideration (eg, because the session went down)
1559 bgp_rib_remove (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
1560 afi_t afi
, safi_t safi
)
1562 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
)
1563 && rn
->table
->type
== BGP_TABLE_MAIN
)
1565 /* Ignore 'pcount' for RS-client tables */
1566 if ( rn
->table
->type
== BGP_TABLE_MAIN
)
1568 peer
->pcount
[afi
][safi
]--;
1569 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1572 bgp_process (peer
->bgp
, rn
, afi
, safi
);
1573 bgp_info_delete (rn
, ri
);
1577 bgp_rib_withdraw (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
1578 afi_t afi
, safi_t safi
)
1580 int status
= BGP_DAMP_NONE
;
1582 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
)
1583 && rn
->table
->type
== BGP_TABLE_MAIN
)
1585 /* Ignore 'pcount' for RS-client tables */
1586 if ( rn
->table
->type
== BGP_TABLE_MAIN
)
1588 peer
->pcount
[afi
][safi
]--;
1589 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1593 /* apply dampening, if result is suppressed, we'll be retaining
1594 * the bgp_info in the RIB for historical reference.
1596 if (CHECK_FLAG (peer
->bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1597 && peer_sort (peer
) == BGP_PEER_EBGP
)
1598 if ( (status
= bgp_damp_withdraw (ri
, rn
, afi
, safi
, 0))
1599 == BGP_DAMP_SUPPRESSED
)
1602 bgp_process (peer
->bgp
, rn
, afi
, safi
);
1604 if (status
!= BGP_DAMP_USED
)
1605 bgp_info_delete (rn
, ri
);
1609 bgp_update_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
1610 struct attr
*attr
, struct peer
*peer
, struct prefix
*p
, int type
,
1611 int sub_type
, struct prefix_rd
*prd
, u_char
*tag
)
1613 struct bgp_node
*rn
;
1615 struct attr new_attr
;
1616 struct attr
*attr_new
;
1617 struct attr
*attr_new2
;
1618 struct bgp_info
*ri
;
1619 struct bgp_info
*new;
1621 char buf
[SU_ADDRSTRLEN
];
1623 /* Do not insert announces from a rsclient into its own 'bgp_table'. */
1624 if (peer
== rsclient
)
1628 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1630 /* Check previously received route. */
1631 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1632 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1635 /* AS path loop check. */
1636 if (aspath_loop_check (attr
->aspath
, rsclient
->as
) > peer
->allowas_in
[afi
][safi
])
1638 reason
= "as-path contains our own AS;";
1642 /* Route reflector originator ID check. */
1643 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
1644 && IPV4_ADDR_SAME (&rsclient
->remote_id
, &attr
->originator_id
))
1646 reason
= "originator is us;";
1652 /* Apply export policy. */
1653 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
) &&
1654 bgp_export_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1656 reason
= "export-policy;";
1660 attr_new2
= bgp_attr_intern (&new_attr
);
1662 /* Apply import policy. */
1663 if (bgp_import_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1665 bgp_attr_unintern (attr_new2
);
1667 reason
= "import-policy;";
1671 attr_new
= bgp_attr_intern (&new_attr
);
1672 bgp_attr_unintern (attr_new2
);
1674 /* IPv4 unicast next hop check. */
1675 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
1677 /* Next hop must not be 0.0.0.0 nor Class E address. */
1678 if (new_attr
.nexthop
.s_addr
== 0
1679 || ntohl (new_attr
.nexthop
.s_addr
) >= 0xe0000000)
1681 bgp_attr_unintern (attr_new
);
1683 reason
= "martian next-hop;";
1688 /* If the update is implicit withdraw. */
1691 ri
->uptime
= time (NULL
);
1693 /* Same attribute comes in. */
1694 if (attrhash_cmp (ri
->attr
, attr_new
))
1697 UNSET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1699 if (BGP_DEBUG (update
, UPDATE_IN
))
1700 zlog (peer
->log
, LOG_DEBUG
,
1701 "%s rcvd %s/%d for RS-client %s...duplicate ignored",
1703 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1704 p
->prefixlen
, rsclient
->host
);
1706 bgp_unlock_node (rn
);
1707 bgp_attr_unintern (attr_new
);
1712 /* Received Logging. */
1713 if (BGP_DEBUG (update
, UPDATE_IN
))
1714 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
1716 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1717 p
->prefixlen
, rsclient
->host
);
1719 /* The attribute is changed. */
1720 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1722 /* Update to new attribute. */
1723 bgp_attr_unintern (ri
->attr
);
1724 ri
->attr
= attr_new
;
1726 /* Update MPLS tag. */
1727 if (safi
== SAFI_MPLS_VPN
)
1728 memcpy (ri
->tag
, tag
, 3);
1730 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1732 /* Process change. */
1733 bgp_process (bgp
, rn
, afi
, safi
);
1734 bgp_unlock_node (rn
);
1739 /* Received Logging. */
1740 if (BGP_DEBUG (update
, UPDATE_IN
))
1742 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
1744 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1745 p
->prefixlen
, rsclient
->host
);
1748 /* Make new BGP info. */
1749 new = bgp_info_new ();
1751 new->sub_type
= sub_type
;
1753 new->attr
= attr_new
;
1754 new->uptime
= time (NULL
);
1756 /* Update MPLS tag. */
1757 if (safi
== SAFI_MPLS_VPN
)
1758 memcpy (new->tag
, tag
, 3);
1760 SET_FLAG (new->flags
, BGP_INFO_VALID
);
1762 /* Register new BGP information. */
1763 bgp_info_add (rn
, new);
1765 /* route_node_get lock */
1766 bgp_unlock_node (rn
);
1768 /* Process change. */
1769 bgp_process (bgp
, rn
, afi
, safi
);
1775 /* This BGP update is filtered. Log the reason then update BGP entry. */
1776 if (BGP_DEBUG (update
, UPDATE_IN
))
1777 zlog (peer
->log
, LOG_DEBUG
,
1778 "%s rcvd UPDATE about %s/%d -- DENIED for RS-client %s due to: %s",
1780 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1781 p
->prefixlen
, rsclient
->host
, reason
);
1784 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
1786 bgp_unlock_node (rn
);
1792 bgp_withdraw_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
1793 struct peer
*peer
, struct prefix
*p
, int type
, int sub_type
,
1794 struct prefix_rd
*prd
, u_char
*tag
)
1796 struct bgp_node
*rn
;
1797 struct bgp_info
*ri
;
1798 char buf
[SU_ADDRSTRLEN
];
1800 if (rsclient
== peer
)
1803 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1805 /* Lookup withdrawn route. */
1806 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1807 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1810 /* Withdraw specified route from routing table. */
1811 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1812 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
1813 else if (BGP_DEBUG (update
, UPDATE_IN
))
1814 zlog (peer
->log
, LOG_DEBUG
,
1815 "%s Can't find the route %s/%d", peer
->host
,
1816 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1819 /* Unlock bgp_node_get() lock. */
1820 bgp_unlock_node (rn
);
1824 bgp_update_main (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
1825 afi_t afi
, safi_t safi
, int type
, int sub_type
,
1826 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
1829 int aspath_loop_count
= 0;
1830 struct bgp_node
*rn
;
1832 struct attr new_attr
;
1833 struct attr
*attr_new
;
1834 struct bgp_info
*ri
;
1835 struct bgp_info
*new;
1837 char buf
[SU_ADDRSTRLEN
];
1840 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1842 /* When peer's soft reconfiguration enabled. Record input packet in
1844 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
1845 && peer
!= bgp
->peer_self
&& ! soft_reconfig
)
1846 bgp_adj_in_set (rn
, peer
, attr
);
1848 /* Check previously received route. */
1849 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1850 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1853 /* AS path local-as loop check. */
1854 if (peer
->change_local_as
)
1856 if (! CHECK_FLAG (peer
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
1857 aspath_loop_count
= 1;
1859 if (aspath_loop_check (attr
->aspath
, peer
->change_local_as
) > aspath_loop_count
)
1861 reason
= "as-path contains our own AS;";
1866 /* AS path loop check. */
1867 if (aspath_loop_check (attr
->aspath
, bgp
->as
) > peer
->allowas_in
[afi
][safi
]
1868 || (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
1869 && aspath_loop_check(attr
->aspath
, bgp
->confed_id
)
1870 > peer
->allowas_in
[afi
][safi
]))
1872 reason
= "as-path contains our own AS;";
1876 /* Route reflector originator ID check. */
1877 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
1878 && IPV4_ADDR_SAME (&bgp
->router_id
, &attr
->originator_id
))
1880 reason
= "originator is us;";
1884 /* Route reflector cluster ID check. */
1885 if (bgp_cluster_filter (peer
, attr
))
1887 reason
= "reflected from the same cluster;";
1891 /* Apply incoming filter. */
1892 if (bgp_input_filter (peer
, p
, attr
, afi
, safi
) == FILTER_DENY
)
1898 /* Apply incoming route-map. */
1901 if (bgp_input_modifier (peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1903 reason
= "route-map;";
1907 /* IPv4 unicast next hop check. */
1908 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
1910 /* If the peer is EBGP and nexthop is not on connected route,
1912 if (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
== 1
1913 && ! bgp_nexthop_check_ebgp (afi
, &new_attr
)
1914 && ! CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
))
1916 reason
= "non-connected next-hop;";
1920 /* Next hop must not be 0.0.0.0 nor Class E address. Next hop
1921 must not be my own address. */
1922 if (bgp_nexthop_self (afi
, &new_attr
)
1923 || new_attr
.nexthop
.s_addr
== 0
1924 || ntohl (new_attr
.nexthop
.s_addr
) >= 0xe0000000)
1926 reason
= "martian next-hop;";
1931 attr_new
= bgp_attr_intern (&new_attr
);
1933 /* If the update is implicit withdraw. */
1936 ri
->uptime
= time (NULL
);
1938 /* Same attribute comes in. */
1939 if (attrhash_cmp (ri
->attr
, attr_new
))
1941 UNSET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1943 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1944 && peer_sort (peer
) == BGP_PEER_EBGP
1945 && CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1947 if (BGP_DEBUG (update
, UPDATE_IN
))
1948 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
1950 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1953 peer
->pcount
[afi
][safi
]++;
1954 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
1955 if (ret
!= BGP_DAMP_SUPPRESSED
)
1957 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
1958 bgp_process (bgp
, rn
, afi
, safi
);
1963 if (BGP_DEBUG (update
, UPDATE_IN
))
1964 zlog (peer
->log
, LOG_DEBUG
,
1965 "%s rcvd %s/%d...duplicate ignored",
1967 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1970 /* graceful restart STALE flag unset. */
1971 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
1973 UNSET_FLAG (ri
->flags
, BGP_INFO_STALE
);
1974 peer
->pcount
[afi
][safi
]++;
1978 bgp_unlock_node (rn
);
1979 bgp_attr_unintern (attr_new
);
1983 /* Received Logging. */
1984 if (BGP_DEBUG (update
, UPDATE_IN
))
1985 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
1987 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1990 /* graceful restart STALE flag unset. */
1991 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
1993 UNSET_FLAG (ri
->flags
, BGP_INFO_STALE
);
1994 peer
->pcount
[afi
][safi
]++;
1997 /* The attribute is changed. */
1998 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
2000 /* Update bgp route dampening information. */
2001 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2002 && peer_sort (peer
) == BGP_PEER_EBGP
)
2004 /* This is implicit withdraw so we should update dampening
2006 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2007 bgp_damp_withdraw (ri
, rn
, afi
, safi
, 1);
2009 peer
->pcount
[afi
][safi
]++;
2012 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
2014 /* Update to new attribute. */
2015 bgp_attr_unintern (ri
->attr
);
2016 ri
->attr
= attr_new
;
2018 /* Update MPLS tag. */
2019 if (safi
== SAFI_MPLS_VPN
)
2020 memcpy (ri
->tag
, tag
, 3);
2022 /* Update bgp route dampening information. */
2023 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2024 && peer_sort (peer
) == BGP_PEER_EBGP
)
2026 /* Now we do normal update dampening. */
2027 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
2028 if (ret
== BGP_DAMP_SUPPRESSED
)
2030 bgp_unlock_node (rn
);
2035 /* Nexthop reachability check. */
2036 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
2037 && safi
== SAFI_UNICAST
2038 && (peer_sort (peer
) == BGP_PEER_IBGP
2039 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
2040 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
2042 if (bgp_nexthop_lookup (afi
, peer
, ri
, NULL
, NULL
))
2043 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2045 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2048 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2050 /* Process change. */
2051 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2053 bgp_process (bgp
, rn
, afi
, safi
);
2054 bgp_unlock_node (rn
);
2058 /* Received Logging. */
2059 if (BGP_DEBUG (update
, UPDATE_IN
))
2061 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2063 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2067 /* Increment prefix counter */
2068 peer
->pcount
[afi
][safi
]++;
2070 /* Make new BGP info. */
2071 new = bgp_info_new ();
2073 new->sub_type
= sub_type
;
2075 new->attr
= attr_new
;
2076 new->uptime
= time (NULL
);
2078 /* Update MPLS tag. */
2079 if (safi
== SAFI_MPLS_VPN
)
2080 memcpy (new->tag
, tag
, 3);
2082 /* Nexthop reachability check. */
2083 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
2084 && safi
== SAFI_UNICAST
2085 && (peer_sort (peer
) == BGP_PEER_IBGP
2086 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
2087 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
2089 if (bgp_nexthop_lookup (afi
, peer
, new, NULL
, NULL
))
2090 SET_FLAG (new->flags
, BGP_INFO_VALID
);
2092 UNSET_FLAG (new->flags
, BGP_INFO_VALID
);
2095 SET_FLAG (new->flags
, BGP_INFO_VALID
);
2097 /* Aggregate address increment. */
2098 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
2100 /* Register new BGP information. */
2101 bgp_info_add (rn
, new);
2103 /* route_node_get lock */
2104 bgp_unlock_node (rn
);
2106 /* If maximum prefix count is configured and current prefix
2108 if (bgp_maximum_prefix_overflow (peer
, afi
, safi
, 0))
2111 /* Process change. */
2112 bgp_process (bgp
, rn
, afi
, safi
);
2116 /* This BGP update is filtered. Log the reason then update BGP
2119 if (BGP_DEBUG (update
, UPDATE_IN
))
2120 zlog (peer
->log
, LOG_DEBUG
,
2121 "%s rcvd UPDATE about %s/%d -- DENIED due to: %s",
2123 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2124 p
->prefixlen
, reason
);
2127 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2129 bgp_unlock_node (rn
);
2135 bgp_update (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2136 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2137 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
2139 struct peer
*rsclient
;
2140 struct listnode
*node
, *nnode
;
2144 ret
= bgp_update_main (peer
, p
, attr
, afi
, safi
, type
, sub_type
, prd
, tag
,
2149 /* Process the update for each RS-client. */
2150 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2152 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2153 bgp_update_rsclient (rsclient
, afi
, safi
, attr
, peer
, p
, type
,
2154 sub_type
, prd
, tag
);
2161 bgp_withdraw (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2162 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2163 struct prefix_rd
*prd
, u_char
*tag
)
2166 char buf
[SU_ADDRSTRLEN
];
2167 struct bgp_node
*rn
;
2168 struct bgp_info
*ri
;
2169 struct peer
*rsclient
;
2170 struct listnode
*node
, *nnode
;
2174 /* Process the withdraw for each RS-client. */
2175 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2177 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2178 bgp_withdraw_rsclient (rsclient
, afi
, safi
, peer
, p
, type
, sub_type
, prd
, tag
);
2182 if (BGP_DEBUG (update
, UPDATE_IN
))
2183 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd UPDATE about %s/%d -- withdrawn",
2185 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2189 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2191 /* If peer is soft reconfiguration enabled. Record input packet for
2192 further calculation. */
2193 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2194 && peer
!= bgp
->peer_self
)
2195 bgp_adj_in_unset (rn
, peer
);
2197 /* Lookup withdrawn route. */
2198 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2199 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2202 /* Withdraw specified route from routing table. */
2203 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2204 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
2205 else if (BGP_DEBUG (update
, UPDATE_IN
))
2206 zlog (peer
->log
, LOG_DEBUG
,
2207 "%s Can't find the route %s/%d", peer
->host
,
2208 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2211 /* Unlock bgp_node_get() lock. */
2212 bgp_unlock_node (rn
);
2218 bgp_default_originate (struct peer
*peer
, afi_t afi
, safi_t safi
, int withdraw
)
2222 struct aspath
*aspath
;
2224 struct bgp_info binfo
;
2226 int ret
= RMAP_DENYMATCH
;
2229 from
= bgp
->peer_self
;
2231 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
2232 aspath
= attr
.aspath
;
2233 attr
.local_pref
= bgp
->default_local_pref
;
2234 memcpy (&attr
.nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
2237 str2prefix ("0.0.0.0/0", &p
);
2239 else if (afi
== AFI_IP6
)
2241 str2prefix ("::/0", &p
);
2243 /* IPv6 global nexthop must be included. */
2244 memcpy (&attr
.mp_nexthop_global
, &peer
->nexthop
.v6_global
,
2246 attr
.mp_nexthop_len
= 16;
2248 /* If the peer is on shared nextwork and we have link-local
2250 if (peer
->shared_network
2251 && !IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
2253 memcpy (&attr
.mp_nexthop_local
, &peer
->nexthop
.v6_local
,
2255 attr
.mp_nexthop_len
= 32;
2258 #endif /* HAVE_IPV6 */
2262 if (peer
->default_rmap
[afi
][safi
].name
)
2264 binfo
.peer
= bgp
->peer_self
;
2267 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_DEFAULT
);
2269 ret
= route_map_apply (peer
->default_rmap
[afi
][safi
].map
, &p
,
2272 bgp
->peer_self
->rmap_type
= 0;
2274 if (ret
== RMAP_DENYMATCH
)
2276 bgp_attr_flush (&attr
);
2283 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
2284 bgp_default_withdraw_send (peer
, afi
, safi
);
2285 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2289 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2290 bgp_default_update_send (peer
, &attr
, afi
, safi
, from
);
2293 aspath_unintern (aspath
);
2297 bgp_announce_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2298 struct bgp_table
*table
, int rsclient
)
2300 struct bgp_node
*rn
;
2301 struct bgp_info
*ri
;
2305 table
= (rsclient
) ? peer
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2307 if (safi
!= SAFI_MPLS_VPN
2308 && CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
2309 bgp_default_originate (peer
, afi
, safi
, 0);
2311 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next(rn
))
2312 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2313 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
) && ri
->peer
!= peer
)
2316 (bgp_announce_check_rsclient (ri
, peer
, &rn
->p
, &attr
, afi
, safi
))
2317 : (bgp_announce_check (ri
, peer
, &rn
->p
, &attr
, afi
, safi
)))
2318 bgp_adj_out_set (rn
, peer
, &rn
->p
, &attr
, afi
, safi
, ri
);
2320 bgp_adj_out_unset (rn
, peer
, &rn
->p
, afi
, safi
);
2325 bgp_announce_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2327 struct bgp_node
*rn
;
2328 struct bgp_table
*table
;
2330 if (peer
->status
!= Established
)
2333 if (! peer
->afc_nego
[afi
][safi
])
2336 /* First update is deferred until ORF or ROUTE-REFRESH is received */
2337 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
2340 if (safi
!= SAFI_MPLS_VPN
)
2341 bgp_announce_table (peer
, afi
, safi
, NULL
, 0);
2343 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2344 rn
= bgp_route_next(rn
))
2345 if ((table
= (rn
->info
)) != NULL
)
2346 bgp_announce_table (peer
, afi
, safi
, table
, 0);
2348 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2349 bgp_announce_table (peer
, afi
, safi
, NULL
, 1);
2353 bgp_announce_route_all (struct peer
*peer
)
2358 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2359 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2360 bgp_announce_route (peer
, afi
, safi
);
2364 bgp_soft_reconfig_table_rsclient (struct peer
*rsclient
, afi_t afi
,
2365 safi_t safi
, struct bgp_table
*table
)
2367 struct bgp_node
*rn
;
2368 struct bgp_adj_in
*ain
;
2371 table
= rsclient
->bgp
->rib
[afi
][safi
];
2373 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2374 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2376 bgp_update_rsclient (rsclient
, afi
, safi
, ain
->attr
, ain
->peer
,
2377 &rn
->p
, ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
2382 bgp_soft_reconfig_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
2384 struct bgp_table
*table
;
2385 struct bgp_node
*rn
;
2387 if (safi
!= SAFI_MPLS_VPN
)
2388 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, NULL
);
2391 for (rn
= bgp_table_top (rsclient
->bgp
->rib
[afi
][safi
]); rn
;
2392 rn
= bgp_route_next (rn
))
2393 if ((table
= rn
->info
) != NULL
)
2394 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, table
);
2398 bgp_soft_reconfig_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2399 struct bgp_table
*table
)
2402 struct bgp_node
*rn
;
2403 struct bgp_adj_in
*ain
;
2406 table
= peer
->bgp
->rib
[afi
][safi
];
2408 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2409 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2411 if (ain
->peer
== peer
)
2413 ret
= bgp_update (peer
, &rn
->p
, ain
->attr
, afi
, safi
,
2414 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
,
2418 bgp_unlock_node (rn
);
2427 bgp_soft_reconfig_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2429 struct bgp_node
*rn
;
2430 struct bgp_table
*table
;
2432 if (peer
->status
!= Established
)
2435 if (safi
!= SAFI_MPLS_VPN
)
2436 bgp_soft_reconfig_table (peer
, afi
, safi
, NULL
);
2438 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2439 rn
= bgp_route_next (rn
))
2440 if ((table
= rn
->info
) != NULL
)
2441 bgp_soft_reconfig_table (peer
, afi
, safi
, table
);
2444 struct bgp_clear_node_queue
2446 struct bgp_node
*rn
;
2452 static wq_item_status
2453 bgp_clear_route_node (struct bgp_clear_node_queue
*cq
)
2455 struct bgp_adj_in
*ain
;
2456 struct bgp_adj_out
*aout
;
2457 struct bgp_info
*ri
;
2459 assert (cq
->rn
&& cq
->peer
);
2461 for (ri
= cq
->rn
->info
; ri
; ri
= ri
->next
)
2462 if (ri
->peer
== cq
->peer
)
2464 /* graceful restart STALE flag set. */
2465 if (CHECK_FLAG (cq
->peer
->sflags
, PEER_STATUS_NSF_WAIT
)
2466 && cq
->peer
->nsf
[cq
->afi
][cq
->safi
]
2467 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
)
2468 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
)
2469 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
))
2471 SET_FLAG (ri
->flags
, BGP_INFO_STALE
);
2472 cq
->peer
->pcount
[cq
->afi
][cq
->safi
]--;
2475 bgp_rib_remove (cq
->rn
, ri
, cq
->peer
, cq
->afi
, cq
->safi
);
2478 for (ain
= cq
->rn
->adj_in
; ain
; ain
= ain
->next
)
2479 if (ain
->peer
== cq
->peer
)
2481 bgp_adj_in_remove (cq
->rn
, ain
);
2482 bgp_unlock_node (cq
->rn
);
2485 for (aout
= cq
->rn
->adj_out
; aout
; aout
= aout
->next
)
2486 if (aout
->peer
== cq
->peer
)
2488 bgp_adj_out_remove (cq
->rn
, aout
, cq
->peer
, cq
->afi
, cq
->safi
);
2489 bgp_unlock_node (cq
->rn
);
2496 bgp_clear_node_queue_del (struct bgp_clear_node_queue
*cq
)
2498 bgp_unlock_node (cq
->rn
);
2499 peer_unlock (cq
->peer
); /* bgp_clear_node_queue_del */
2500 XFREE (MTYPE_BGP_CLEAR_NODE_QUEUE
, cq
);
2504 bgp_clear_node_complete (struct work_queue
*wq
)
2506 /* unplug the 2 processing queues */
2507 if (bm
->process_main_queue
)
2508 work_queue_unplug (bm
->process_main_queue
);
2509 if (bm
->process_rsclient_queue
)
2510 work_queue_unplug (bm
->process_rsclient_queue
);
2514 bgp_clear_node_queue_init (void)
2516 if ( (bm
->clear_node_queue
2517 = work_queue_new (bm
->master
, "clear_route_node")) == NULL
)
2519 zlog_err ("%s: Failed to allocate work queue", __func__
);
2522 bm
->clear_node_queue
->spec
.hold
= 10;
2523 bm
->clear_node_queue
->spec
.delay
= 0; /* no gathering to be gained */
2524 bm
->clear_node_queue
->spec
.workfunc
= &bgp_clear_route_node
;
2525 bm
->clear_node_queue
->spec
.del_item_data
= &bgp_clear_node_queue_del
;
2526 bm
->clear_node_queue
->spec
.completion_func
= &bgp_clear_node_complete
;
2527 bm
->clear_node_queue
->spec
.max_retries
= 0;
2531 bgp_clear_route_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2532 struct bgp_table
*table
, struct peer
*rsclient
)
2534 struct bgp_clear_node_queue
*cqnode
;
2535 struct bgp_node
*rn
;
2538 table
= (rsclient
) ? rsclient
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2540 /* If still no table => afi/safi isn't configured at all or smth. */
2544 if (bm
->clear_node_queue
== NULL
)
2545 bgp_clear_node_queue_init ();
2547 /* plug the two bgp_process queues to avoid any chance of racing
2548 * with a session coming back up and adding routes before we've
2549 * cleared them all. We'll unplug them with completion callback.
2551 if (bm
->process_main_queue
)
2552 work_queue_plug (bm
->process_main_queue
);
2553 if (bm
->process_rsclient_queue
)
2554 work_queue_plug (bm
->process_rsclient_queue
);
2556 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2558 if (rn
->info
== NULL
)
2561 if ( (cqnode
= XCALLOC (MTYPE_BGP_CLEAR_NODE_QUEUE
,
2562 sizeof (struct bgp_clear_node_queue
))) == NULL
)
2565 cqnode
->rn
= bgp_lock_node (rn
); /* unlocked: bgp_clear_node_queue_del */
2567 cqnode
->safi
= safi
;
2568 cqnode
->peer
= peer_lock (peer
); /* bgp_clear_node_queue_del */
2569 work_queue_add (bm
->clear_node_queue
, cqnode
);
2575 bgp_clear_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2577 struct bgp_node
*rn
;
2578 struct bgp_table
*table
;
2579 struct peer
*rsclient
;
2580 struct listnode
*node
, *nnode
;
2582 if (safi
!= SAFI_MPLS_VPN
)
2583 bgp_clear_route_table (peer
, afi
, safi
, NULL
, NULL
);
2585 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2586 rn
= bgp_route_next (rn
))
2587 if ((table
= rn
->info
) != NULL
)
2588 bgp_clear_route_table (peer
, afi
, safi
, table
, NULL
);
2590 for (ALL_LIST_ELEMENTS (peer
->bgp
->rsclient
, node
, nnode
, rsclient
))
2592 if (CHECK_FLAG(rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2593 bgp_clear_route_table (peer
, afi
, safi
, NULL
, rsclient
);
2598 bgp_clear_route_all (struct peer
*peer
)
2603 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2604 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2605 bgp_clear_route (peer
, afi
, safi
);
2609 bgp_clear_adj_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2611 struct bgp_table
*table
;
2612 struct bgp_node
*rn
;
2613 struct bgp_adj_in
*ain
;
2615 table
= peer
->bgp
->rib
[afi
][safi
];
2617 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2618 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2619 if (ain
->peer
== peer
)
2621 bgp_adj_in_remove (rn
, ain
);
2622 bgp_unlock_node (rn
);
2628 bgp_clear_stale_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2630 struct bgp_node
*rn
;
2631 struct bgp_info
*ri
;
2632 struct bgp_table
*table
;
2634 table
= peer
->bgp
->rib
[afi
][safi
];
2636 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2638 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2639 if (ri
->peer
== peer
)
2641 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2642 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2648 /* Delete all kernel routes. */
2650 bgp_cleanup_routes ()
2653 struct listnode
*node
, *nnode
;
2654 struct bgp_node
*rn
;
2655 struct bgp_table
*table
;
2656 struct bgp_info
*ri
;
2658 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
2660 table
= bgp
->rib
[AFI_IP
][SAFI_UNICAST
];
2662 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2663 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2664 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
2665 && ri
->type
== ZEBRA_ROUTE_BGP
2666 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
2667 bgp_zebra_withdraw (&rn
->p
, ri
);
2669 table
= bgp
->rib
[AFI_IP6
][SAFI_UNICAST
];
2671 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2672 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2673 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
2674 && ri
->type
== ZEBRA_ROUTE_BGP
2675 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
2676 bgp_zebra_withdraw (&rn
->p
, ri
);
2684 bgp_zclient_reset ();
2685 access_list_reset ();
2686 prefix_list_reset ();
2689 /* Parse NLRI stream. Withdraw NLRI is recognized by NULL attr
2692 bgp_nlri_parse (struct peer
*peer
, struct attr
*attr
, struct bgp_nlri
*packet
)
2700 /* Check peer status. */
2701 if (peer
->status
!= Established
)
2705 lim
= pnt
+ packet
->length
;
2707 for (; pnt
< lim
; pnt
+= psize
)
2709 /* Clear prefix structure. */
2710 memset (&p
, 0, sizeof (struct prefix
));
2712 /* Fetch prefix length. */
2713 p
.prefixlen
= *pnt
++;
2714 p
.family
= afi2family (packet
->afi
);
2716 /* Already checked in nlri_sanity_check(). We do double check
2718 if ((packet
->afi
== AFI_IP
&& p
.prefixlen
> 32)
2719 || (packet
->afi
== AFI_IP6
&& p
.prefixlen
> 128))
2722 /* Packet size overflow check. */
2723 psize
= PSIZE (p
.prefixlen
);
2725 /* When packet overflow occur return immediately. */
2726 if (pnt
+ psize
> lim
)
2729 /* Fetch prefix from NLRI packet. */
2730 memcpy (&p
.u
.prefix
, pnt
, psize
);
2732 /* Check address. */
2733 if (packet
->afi
== AFI_IP
&& packet
->safi
== SAFI_UNICAST
)
2735 if (IN_CLASSD (ntohl (p
.u
.prefix4
.s_addr
)))
2738 * From draft-ietf-idr-bgp4-22, Section 6.3:
2739 * If a BGP router receives an UPDATE message with a
2740 * semantically incorrect NLRI field, in which a prefix is
2741 * semantically incorrect (eg. an unexpected multicast IP
2742 * address), it should ignore the prefix.
2744 zlog (peer
->log
, LOG_ERR
,
2745 "IPv4 unicast NLRI is multicast address %s",
2746 inet_ntoa (p
.u
.prefix4
));
2753 /* Check address. */
2754 if (packet
->afi
== AFI_IP6
&& packet
->safi
== SAFI_UNICAST
)
2756 if (IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
2760 zlog (peer
->log
, LOG_WARNING
,
2761 "IPv6 link-local NLRI received %s ignore this NLRI",
2762 inet_ntop (AF_INET6
, &p
.u
.prefix6
, buf
, BUFSIZ
));
2767 #endif /* HAVE_IPV6 */
2769 /* Normal process. */
2771 ret
= bgp_update (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
2772 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
, 0);
2774 ret
= bgp_withdraw (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
2775 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
2777 /* Address family configuration mismatch or maximum-prefix count
2783 /* Packet length consistency check. */
2790 /* NLRI encode syntax check routine. */
2792 bgp_nlri_sanity_check (struct peer
*peer
, int afi
, u_char
*pnt
,
2801 /* RFC1771 6.3 The NLRI field in the UPDATE message is checked for
2802 syntactic validity. If the field is syntactically incorrect,
2803 then the Error Subcode is set to Invalid Network Field. */
2809 /* Prefix length check. */
2810 if ((afi
== AFI_IP
&& prefixlen
> 32)
2811 || (afi
== AFI_IP6
&& prefixlen
> 128))
2813 plog_err (peer
->log
,
2814 "%s [Error] Update packet error (wrong prefix length %d)",
2815 peer
->host
, prefixlen
);
2816 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
2817 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
2821 /* Packet size overflow check. */
2822 psize
= PSIZE (prefixlen
);
2824 if (pnt
+ psize
> end
)
2826 plog_err (peer
->log
,
2827 "%s [Error] Update packet error"
2828 " (prefix data overflow prefix size is %d)",
2830 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
2831 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
2838 /* Packet length consistency check. */
2841 plog_err (peer
->log
,
2842 "%s [Error] Update packet error"
2843 " (prefix length mismatch with total length)",
2845 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
2846 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
2852 static struct bgp_static
*
2855 struct bgp_static
*new;
2856 new = XMALLOC (MTYPE_BGP_STATIC
, sizeof (struct bgp_static
));
2857 memset (new, 0, sizeof (struct bgp_static
));
2862 bgp_static_free (struct bgp_static
*bgp_static
)
2864 if (bgp_static
->rmap
.name
)
2865 free (bgp_static
->rmap
.name
);
2866 XFREE (MTYPE_BGP_STATIC
, bgp_static
);
2870 bgp_static_withdraw_rsclient (struct bgp
*bgp
, struct peer
*rsclient
,
2871 struct prefix
*p
, afi_t afi
, safi_t safi
)
2873 struct bgp_node
*rn
;
2874 struct bgp_info
*ri
;
2876 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
2878 /* Check selected route and self inserted route. */
2879 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2880 if (ri
->peer
== bgp
->peer_self
2881 && ri
->type
== ZEBRA_ROUTE_BGP
2882 && ri
->sub_type
== BGP_ROUTE_STATIC
)
2885 /* Withdraw static BGP route from routing table. */
2888 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2889 bgp_process (bgp
, rn
, afi
, safi
);
2890 bgp_info_delete (rn
, ri
);
2893 /* Unlock bgp_node_lookup. */
2894 bgp_unlock_node (rn
);
2898 bgp_static_update_rsclient (struct peer
*rsclient
, struct prefix
*p
,
2899 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
2901 struct bgp_node
*rn
;
2902 struct bgp_info
*ri
;
2903 struct bgp_info
*new;
2904 struct bgp_info info
;
2905 struct attr new_attr
;
2906 struct attr
*attr_new
;
2910 char buf
[SU_ADDRSTRLEN
];
2912 bgp
= rsclient
->bgp
;
2914 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
2916 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
2919 attr
.nexthop
= bgp_static
->igpnexthop
;
2920 attr
.med
= bgp_static
->igpmetric
;
2921 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
2926 /* Apply network route-map for export to this rsclient. */
2927 if (bgp_static
->rmap
.name
)
2929 info
.peer
= rsclient
;
2930 info
.attr
= &new_attr
;
2932 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
2933 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
2935 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
2937 rsclient
->rmap_type
= 0;
2939 if (ret
== RMAP_DENYMATCH
)
2941 /* Free uninterned attribute. */
2942 bgp_attr_flush (&new_attr
);
2944 /* Unintern original. */
2945 aspath_unintern (attr
.aspath
);
2946 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
2950 attr_new
= bgp_attr_intern (&new_attr
);
2953 attr_new
= bgp_attr_intern (&attr
);
2955 new_attr
= *attr_new
;
2957 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
2959 if (bgp_import_modifier (rsclient
, bgp
->peer_self
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
2961 /* This BGP update is filtered. Log the reason then update BGP entry. */
2962 if (BGP_DEBUG (update
, UPDATE_IN
))
2963 zlog (rsclient
->log
, LOG_DEBUG
,
2964 "Static UPDATE about %s/%d -- DENIED for RS-client %s due to: import-policy",
2965 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2966 p
->prefixlen
, rsclient
->host
);
2968 bgp
->peer_self
->rmap_type
= 0;
2970 bgp_attr_unintern (attr_new
);
2971 aspath_unintern (attr
.aspath
);
2973 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
2978 bgp
->peer_self
->rmap_type
= 0;
2980 bgp_attr_unintern (attr_new
);
2981 attr_new
= bgp_attr_intern (&new_attr
);
2983 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2984 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
2985 && ri
->sub_type
== BGP_ROUTE_STATIC
)
2990 if (attrhash_cmp (ri
->attr
, attr_new
))
2992 bgp_unlock_node (rn
);
2993 bgp_attr_unintern (attr_new
);
2994 aspath_unintern (attr
.aspath
);
2999 /* The attribute is changed. */
3000 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
3002 /* Rewrite BGP route information. */
3003 bgp_attr_unintern (ri
->attr
);
3004 ri
->attr
= attr_new
;
3005 ri
->uptime
= time (NULL
);
3007 /* Process change. */
3008 bgp_process (bgp
, rn
, afi
, safi
);
3009 bgp_unlock_node (rn
);
3010 aspath_unintern (attr
.aspath
);
3015 /* Make new BGP info. */
3016 new = bgp_info_new ();
3017 new->type
= ZEBRA_ROUTE_BGP
;
3018 new->sub_type
= BGP_ROUTE_STATIC
;
3019 new->peer
= bgp
->peer_self
;
3020 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3021 new->attr
= attr_new
;
3022 new->uptime
= time (NULL
);
3024 /* Register new BGP information. */
3025 bgp_info_add (rn
, new);
3027 /* route_node_get lock */
3028 bgp_unlock_node (rn
);
3030 /* Process change. */
3031 bgp_process (bgp
, rn
, afi
, safi
);
3033 /* Unintern original. */
3034 aspath_unintern (attr
.aspath
);
3038 bgp_static_update_main (struct bgp
*bgp
, struct prefix
*p
,
3039 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3041 struct bgp_node
*rn
;
3042 struct bgp_info
*ri
;
3043 struct bgp_info
*new;
3044 struct bgp_info info
;
3046 struct attr attr_tmp
;
3047 struct attr
*attr_new
;
3050 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3052 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3055 attr
.nexthop
= bgp_static
->igpnexthop
;
3056 attr
.med
= bgp_static
->igpmetric
;
3057 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3060 /* Apply route-map. */
3061 if (bgp_static
->rmap
.name
)
3064 info
.peer
= bgp
->peer_self
;
3065 info
.attr
= &attr_tmp
;
3067 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3069 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3071 bgp
->peer_self
->rmap_type
= 0;
3073 if (ret
== RMAP_DENYMATCH
)
3075 /* Free uninterned attribute. */
3076 bgp_attr_flush (&attr_tmp
);
3078 /* Unintern original. */
3079 aspath_unintern (attr
.aspath
);
3080 bgp_static_withdraw (bgp
, p
, afi
, safi
);
3083 attr_new
= bgp_attr_intern (&attr_tmp
);
3086 attr_new
= bgp_attr_intern (&attr
);
3088 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3089 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3090 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3095 if (attrhash_cmp (ri
->attr
, attr_new
))
3097 bgp_unlock_node (rn
);
3098 bgp_attr_unintern (attr_new
);
3099 aspath_unintern (attr
.aspath
);
3104 /* The attribute is changed. */
3105 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
3107 /* Rewrite BGP route information. */
3108 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3109 bgp_attr_unintern (ri
->attr
);
3110 ri
->attr
= attr_new
;
3111 ri
->uptime
= time (NULL
);
3113 /* Process change. */
3114 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
3115 bgp_process (bgp
, rn
, afi
, safi
);
3116 bgp_unlock_node (rn
);
3117 aspath_unintern (attr
.aspath
);
3122 /* Make new BGP info. */
3123 new = bgp_info_new ();
3124 new->type
= ZEBRA_ROUTE_BGP
;
3125 new->sub_type
= BGP_ROUTE_STATIC
;
3126 new->peer
= bgp
->peer_self
;
3127 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3128 new->attr
= attr_new
;
3129 new->uptime
= time (NULL
);
3131 /* Aggregate address increment. */
3132 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3134 /* Register new BGP information. */
3135 bgp_info_add (rn
, new);
3137 /* route_node_get lock */
3138 bgp_unlock_node (rn
);
3140 /* Process change. */
3141 bgp_process (bgp
, rn
, afi
, safi
);
3143 /* Unintern original. */
3144 aspath_unintern (attr
.aspath
);
3148 bgp_static_update (struct bgp
*bgp
, struct prefix
*p
,
3149 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3151 struct peer
*rsclient
;
3152 struct listnode
*node
, *nnode
;
3154 bgp_static_update_main (bgp
, p
, bgp_static
, afi
, safi
);
3156 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
3158 bgp_static_update_rsclient (rsclient
, p
, bgp_static
, afi
, safi
);
3163 bgp_static_update_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
3164 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
3166 struct bgp_node
*rn
;
3167 struct bgp_info
*new;
3169 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3171 /* Make new BGP info. */
3172 new = bgp_info_new ();
3173 new->type
= ZEBRA_ROUTE_BGP
;
3174 new->sub_type
= BGP_ROUTE_STATIC
;
3175 new->peer
= bgp
->peer_self
;
3176 new->attr
= bgp_attr_default_intern (BGP_ORIGIN_IGP
);
3177 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3178 new->uptime
= time (NULL
);
3179 memcpy (new->tag
, tag
, 3);
3181 /* Aggregate address increment. */
3182 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3184 /* Register new BGP information. */
3185 bgp_info_add (rn
, new);
3187 /* route_node_get lock */
3188 bgp_unlock_node (rn
);
3190 /* Process change. */
3191 bgp_process (bgp
, rn
, afi
, safi
);
3195 bgp_static_withdraw (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3198 struct bgp_node
*rn
;
3199 struct bgp_info
*ri
;
3201 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3203 /* Check selected route and self inserted route. */
3204 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3205 if (ri
->peer
== bgp
->peer_self
3206 && ri
->type
== ZEBRA_ROUTE_BGP
3207 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3210 /* Withdraw static BGP route from routing table. */
3213 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3214 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
3215 bgp_process (bgp
, rn
, afi
, safi
);
3216 bgp_info_delete (rn
, ri
);
3219 /* Unlock bgp_node_lookup. */
3220 bgp_unlock_node (rn
);
3224 bgp_check_local_routes_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
3226 struct bgp_static
*bgp_static
;
3228 struct bgp_node
*rn
;
3231 bgp
= rsclient
->bgp
;
3233 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3234 if ((bgp_static
= rn
->info
) != NULL
)
3238 bgp_static_update_rsclient (rsclient
, p
, bgp_static
,
3244 bgp_static_withdraw_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
3245 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
3247 struct bgp_node
*rn
;
3248 struct bgp_info
*ri
;
3250 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3252 /* Check selected route and self inserted route. */
3253 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3254 if (ri
->peer
== bgp
->peer_self
3255 && ri
->type
== ZEBRA_ROUTE_BGP
3256 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3259 /* Withdraw static BGP route from routing table. */
3262 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3263 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
3264 bgp_process (bgp
, rn
, afi
, safi
);
3265 bgp_info_delete (rn
, ri
);
3268 /* Unlock bgp_node_lookup. */
3269 bgp_unlock_node (rn
);
3272 /* Configure static BGP network. When user don't run zebra, static
3273 route should be installed as valid. */
3275 bgp_static_set (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3276 u_int16_t afi
, u_char safi
, const char *rmap
, int backdoor
)
3280 struct bgp_static
*bgp_static
;
3281 struct bgp_node
*rn
;
3282 int need_update
= 0;
3284 /* Convert IP prefix string to struct prefix. */
3285 ret
= str2prefix (ip_str
, &p
);
3288 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3292 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3294 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3298 #endif /* HAVE_IPV6 */
3302 /* Set BGP static route configuration. */
3303 rn
= bgp_node_get (bgp
->route
[afi
][safi
], &p
);
3307 /* Configuration change. */
3308 bgp_static
= rn
->info
;
3310 /* Check previous routes are installed into BGP. */
3311 if (! bgp_static
->backdoor
&& bgp_static
->valid
)
3314 bgp_static
->backdoor
= backdoor
;
3317 if (bgp_static
->rmap
.name
)
3318 free (bgp_static
->rmap
.name
);
3319 bgp_static
->rmap
.name
= strdup (rmap
);
3320 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
3324 if (bgp_static
->rmap
.name
)
3325 free (bgp_static
->rmap
.name
);
3326 bgp_static
->rmap
.name
= NULL
;
3327 bgp_static
->rmap
.map
= NULL
;
3328 bgp_static
->valid
= 0;
3330 bgp_unlock_node (rn
);
3334 /* New configuration. */
3335 bgp_static
= bgp_static_new ();
3336 bgp_static
->backdoor
= backdoor
;
3337 bgp_static
->valid
= 0;
3338 bgp_static
->igpmetric
= 0;
3339 bgp_static
->igpnexthop
.s_addr
= 0;
3342 if (bgp_static
->rmap
.name
)
3343 free (bgp_static
->rmap
.name
);
3344 bgp_static
->rmap
.name
= strdup (rmap
);
3345 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
3347 rn
->info
= bgp_static
;
3350 /* If BGP scan is not enabled, we should install this route here. */
3351 if (! bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3353 bgp_static
->valid
= 1;
3356 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
3358 if (! bgp_static
->backdoor
)
3359 bgp_static_update (bgp
, &p
, bgp_static
, afi
, safi
);
3365 /* Configure static BGP network. */
3367 bgp_static_unset (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3368 u_int16_t afi
, u_char safi
)
3372 struct bgp_static
*bgp_static
;
3373 struct bgp_node
*rn
;
3375 /* Convert IP prefix string to struct prefix. */
3376 ret
= str2prefix (ip_str
, &p
);
3379 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3383 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3385 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3389 #endif /* HAVE_IPV6 */
3393 rn
= bgp_node_lookup (bgp
->route
[afi
][safi
], &p
);
3396 vty_out (vty
, "%% Can't find specified static route configuration.%s",
3401 bgp_static
= rn
->info
;
3403 /* Update BGP RIB. */
3404 if (! bgp_static
->backdoor
)
3405 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
3407 /* Clear configuration. */
3408 bgp_static_free (bgp_static
);
3410 bgp_unlock_node (rn
);
3411 bgp_unlock_node (rn
);
3416 /* Called from bgp_delete(). Delete all static routes from the BGP
3419 bgp_static_delete (struct bgp
*bgp
)
3423 struct bgp_node
*rn
;
3424 struct bgp_node
*rm
;
3425 struct bgp_table
*table
;
3426 struct bgp_static
*bgp_static
;
3428 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
3429 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
3430 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3431 if (rn
->info
!= NULL
)
3433 if (safi
== SAFI_MPLS_VPN
)
3437 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
3439 bgp_static
= rn
->info
;
3440 bgp_static_withdraw_vpnv4 (bgp
, &rm
->p
,
3441 AFI_IP
, SAFI_MPLS_VPN
,
3442 (struct prefix_rd
*)&rn
->p
,
3444 bgp_static_free (bgp_static
);
3446 bgp_unlock_node (rn
);
3451 bgp_static
= rn
->info
;
3452 bgp_static_withdraw (bgp
, &rn
->p
, afi
, safi
);
3453 bgp_static_free (bgp_static
);
3455 bgp_unlock_node (rn
);
3461 bgp_static_set_vpnv4 (struct vty
*vty
, const char *ip_str
, const char *rd_str
,
3462 const char *tag_str
)
3466 struct prefix_rd prd
;
3468 struct bgp_node
*prn
;
3469 struct bgp_node
*rn
;
3470 struct bgp_table
*table
;
3471 struct bgp_static
*bgp_static
;
3476 ret
= str2prefix (ip_str
, &p
);
3479 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3484 ret
= str2prefix_rd (rd_str
, &prd
);
3487 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
3491 ret
= str2tag (tag_str
, tag
);
3494 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
3498 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
3499 (struct prefix
*)&prd
);
3500 if (prn
->info
== NULL
)
3501 prn
->info
= bgp_table_init ();
3503 bgp_unlock_node (prn
);
3506 rn
= bgp_node_get (table
, &p
);
3510 vty_out (vty
, "%% Same network configuration exists%s", VTY_NEWLINE
);
3511 bgp_unlock_node (rn
);
3515 /* New configuration. */
3516 bgp_static
= bgp_static_new ();
3517 bgp_static
->valid
= 1;
3518 memcpy (bgp_static
->tag
, tag
, 3);
3519 rn
->info
= bgp_static
;
3521 bgp_static_update_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
3527 /* Configure static BGP network. */
3529 bgp_static_unset_vpnv4 (struct vty
*vty
, const char *ip_str
,
3530 const char *rd_str
, const char *tag_str
)
3535 struct prefix_rd prd
;
3536 struct bgp_node
*prn
;
3537 struct bgp_node
*rn
;
3538 struct bgp_table
*table
;
3539 struct bgp_static
*bgp_static
;
3544 /* Convert IP prefix string to struct prefix. */
3545 ret
= str2prefix (ip_str
, &p
);
3548 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3553 ret
= str2prefix_rd (rd_str
, &prd
);
3556 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
3560 ret
= str2tag (tag_str
, tag
);
3563 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
3567 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
3568 (struct prefix
*)&prd
);
3569 if (prn
->info
== NULL
)
3570 prn
->info
= bgp_table_init ();
3572 bgp_unlock_node (prn
);
3575 rn
= bgp_node_lookup (table
, &p
);
3579 bgp_static_withdraw_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
3581 bgp_static
= rn
->info
;
3582 bgp_static_free (bgp_static
);
3584 bgp_unlock_node (rn
);
3585 bgp_unlock_node (rn
);
3588 vty_out (vty
, "%% Can't find the route%s", VTY_NEWLINE
);
3595 "network A.B.C.D/M",
3596 "Specify a network to announce via BGP\n"
3597 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
3599 return bgp_static_set (vty
, vty
->index
, argv
[0],
3600 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
3603 DEFUN (bgp_network_route_map
,
3604 bgp_network_route_map_cmd
,
3605 "network A.B.C.D/M route-map WORD",
3606 "Specify a network to announce via BGP\n"
3607 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3608 "Route-map to modify the attributes\n"
3609 "Name of the route map\n")
3611 return bgp_static_set (vty
, vty
->index
, argv
[0],
3612 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
3615 DEFUN (bgp_network_backdoor
,
3616 bgp_network_backdoor_cmd
,
3617 "network A.B.C.D/M backdoor",
3618 "Specify a network to announce via BGP\n"
3619 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3620 "Specify a BGP backdoor route\n")
3622 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
3625 DEFUN (bgp_network_mask
,
3626 bgp_network_mask_cmd
,
3627 "network A.B.C.D mask A.B.C.D",
3628 "Specify a network to announce via BGP\n"
3634 char prefix_str
[BUFSIZ
];
3636 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3639 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3643 return bgp_static_set (vty
, vty
->index
, prefix_str
,
3644 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
3647 DEFUN (bgp_network_mask_route_map
,
3648 bgp_network_mask_route_map_cmd
,
3649 "network A.B.C.D mask A.B.C.D route-map WORD",
3650 "Specify a network to announce via BGP\n"
3654 "Route-map to modify the attributes\n"
3655 "Name of the route map\n")
3658 char prefix_str
[BUFSIZ
];
3660 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3663 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3667 return bgp_static_set (vty
, vty
->index
, prefix_str
,
3668 AFI_IP
, bgp_node_safi (vty
), argv
[2], 0);
3671 DEFUN (bgp_network_mask_backdoor
,
3672 bgp_network_mask_backdoor_cmd
,
3673 "network A.B.C.D mask A.B.C.D backdoor",
3674 "Specify a network to announce via BGP\n"
3678 "Specify a BGP backdoor route\n")
3681 char prefix_str
[BUFSIZ
];
3683 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3686 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3690 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
, NULL
, 1);
3693 DEFUN (bgp_network_mask_natural
,
3694 bgp_network_mask_natural_cmd
,
3696 "Specify a network to announce via BGP\n"
3700 char prefix_str
[BUFSIZ
];
3702 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
3705 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3709 return bgp_static_set (vty
, vty
->index
, prefix_str
,
3710 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
3713 DEFUN (bgp_network_mask_natural_route_map
,
3714 bgp_network_mask_natural_route_map_cmd
,
3715 "network A.B.C.D route-map WORD",
3716 "Specify a network to announce via BGP\n"
3718 "Route-map to modify the attributes\n"
3719 "Name of the route map\n")
3722 char prefix_str
[BUFSIZ
];
3724 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
3727 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3731 return bgp_static_set (vty
, vty
->index
, prefix_str
,
3732 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
3735 DEFUN (bgp_network_mask_natural_backdoor
,
3736 bgp_network_mask_natural_backdoor_cmd
,
3737 "network A.B.C.D backdoor",
3738 "Specify a network to announce via BGP\n"
3740 "Specify a BGP backdoor route\n")
3743 char prefix_str
[BUFSIZ
];
3745 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
3748 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3752 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
, NULL
, 1);
3755 DEFUN (no_bgp_network
,
3757 "no network A.B.C.D/M",
3759 "Specify a network to announce via BGP\n"
3760 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
3762 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP
,
3763 bgp_node_safi (vty
));
3766 ALIAS (no_bgp_network
,
3767 no_bgp_network_route_map_cmd
,
3768 "no network A.B.C.D/M route-map WORD",
3770 "Specify a network to announce via BGP\n"
3771 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3772 "Route-map to modify the attributes\n"
3773 "Name of the route map\n")
3775 ALIAS (no_bgp_network
,
3776 no_bgp_network_backdoor_cmd
,
3777 "no network A.B.C.D/M backdoor",
3779 "Specify a network to announce via BGP\n"
3780 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3781 "Specify a BGP backdoor route\n")
3783 DEFUN (no_bgp_network_mask
,
3784 no_bgp_network_mask_cmd
,
3785 "no network A.B.C.D mask A.B.C.D",
3787 "Specify a network to announce via BGP\n"
3793 char prefix_str
[BUFSIZ
];
3795 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3798 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3802 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
3803 bgp_node_safi (vty
));
3806 ALIAS (no_bgp_network_mask
,
3807 no_bgp_network_mask_route_map_cmd
,
3808 "no network A.B.C.D mask A.B.C.D route-map WORD",
3810 "Specify a network to announce via BGP\n"
3814 "Route-map to modify the attributes\n"
3815 "Name of the route map\n")
3817 ALIAS (no_bgp_network_mask
,
3818 no_bgp_network_mask_backdoor_cmd
,
3819 "no network A.B.C.D mask A.B.C.D backdoor",
3821 "Specify a network to announce via BGP\n"
3825 "Specify a BGP backdoor route\n")
3827 DEFUN (no_bgp_network_mask_natural
,
3828 no_bgp_network_mask_natural_cmd
,
3829 "no network A.B.C.D",
3831 "Specify a network to announce via BGP\n"
3835 char prefix_str
[BUFSIZ
];
3837 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
3840 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3844 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
3845 bgp_node_safi (vty
));
3848 ALIAS (no_bgp_network_mask_natural
,
3849 no_bgp_network_mask_natural_route_map_cmd
,
3850 "no network A.B.C.D route-map WORD",
3852 "Specify a network to announce via BGP\n"
3854 "Route-map to modify the attributes\n"
3855 "Name of the route map\n")
3857 ALIAS (no_bgp_network_mask_natural
,
3858 no_bgp_network_mask_natural_backdoor_cmd
,
3859 "no network A.B.C.D backdoor",
3861 "Specify a network to announce via BGP\n"
3863 "Specify a BGP backdoor route\n")
3866 DEFUN (ipv6_bgp_network
,
3867 ipv6_bgp_network_cmd
,
3868 "network X:X::X:X/M",
3869 "Specify a network to announce via BGP\n"
3870 "IPv6 prefix <network>/<length>\n")
3872 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
3875 DEFUN (ipv6_bgp_network_route_map
,
3876 ipv6_bgp_network_route_map_cmd
,
3877 "network X:X::X:X/M route-map WORD",
3878 "Specify a network to announce via BGP\n"
3879 "IPv6 prefix <network>/<length>\n"
3880 "Route-map to modify the attributes\n"
3881 "Name of the route map\n")
3883 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
,
3884 bgp_node_safi (vty
), argv
[1], 0);
3887 DEFUN (no_ipv6_bgp_network
,
3888 no_ipv6_bgp_network_cmd
,
3889 "no network X:X::X:X/M",
3891 "Specify a network to announce via BGP\n"
3892 "IPv6 prefix <network>/<length>\n")
3894 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
3897 ALIAS (no_ipv6_bgp_network
,
3898 no_ipv6_bgp_network_route_map_cmd
,
3899 "no network X:X::X:X/M route-map WORD",
3901 "Specify a network to announce via BGP\n"
3902 "IPv6 prefix <network>/<length>\n"
3903 "Route-map to modify the attributes\n"
3904 "Name of the route map\n")
3906 ALIAS (ipv6_bgp_network
,
3907 old_ipv6_bgp_network_cmd
,
3908 "ipv6 bgp network X:X::X:X/M",
3911 "Specify a network to announce via BGP\n"
3912 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
3914 ALIAS (no_ipv6_bgp_network
,
3915 old_no_ipv6_bgp_network_cmd
,
3916 "no ipv6 bgp network X:X::X:X/M",
3920 "Specify a network to announce via BGP\n"
3921 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
3922 #endif /* HAVE_IPV6 */
3924 /* Aggreagete address:
3926 advertise-map Set condition to advertise attribute
3927 as-set Generate AS set path information
3928 attribute-map Set attributes of aggregate
3929 route-map Set parameters of aggregate
3930 summary-only Filter more specific routes from updates
3931 suppress-map Conditionally filter more specific routes from updates
3934 struct bgp_aggregate
3936 /* Summary-only flag. */
3937 u_char summary_only
;
3939 /* AS set generation. */
3942 /* Route-map for aggregated route. */
3943 struct route_map
*map
;
3945 /* Suppress-count. */
3946 unsigned long count
;
3948 /* SAFI configuration. */
3952 static struct bgp_aggregate
*
3953 bgp_aggregate_new ()
3955 struct bgp_aggregate
*new;
3956 new = XMALLOC (MTYPE_BGP_AGGREGATE
, sizeof (struct bgp_aggregate
));
3957 memset (new, 0, sizeof (struct bgp_aggregate
));
3962 bgp_aggregate_free (struct bgp_aggregate
*aggregate
)
3964 XFREE (MTYPE_BGP_AGGREGATE
, aggregate
);
3968 bgp_aggregate_route (struct bgp
*bgp
, struct prefix
*p
, struct bgp_info
*rinew
,
3969 afi_t afi
, safi_t safi
, struct bgp_info
*del
,
3970 struct bgp_aggregate
*aggregate
)
3972 struct bgp_table
*table
;
3973 struct bgp_node
*top
;
3974 struct bgp_node
*rn
;
3976 struct aspath
*aspath
= NULL
;
3977 struct aspath
*asmerge
= NULL
;
3978 struct community
*community
= NULL
;
3979 struct community
*commerge
= NULL
;
3980 struct in_addr nexthop
;
3982 struct bgp_info
*ri
;
3983 struct bgp_info
*new;
3985 unsigned long match
= 0;
3987 /* Record adding route's nexthop and med. */
3990 nexthop
= rinew
->attr
->nexthop
;
3991 med
= rinew
->attr
->med
;
3994 /* ORIGIN attribute: If at least one route among routes that are
3995 aggregated has ORIGIN with the value INCOMPLETE, then the
3996 aggregated route must have the ORIGIN attribute with the value
3997 INCOMPLETE. Otherwise, if at least one route among routes that
3998 are aggregated has ORIGIN with the value EGP, then the aggregated
3999 route must have the origin attribute with the value EGP. In all
4000 other case the value of the ORIGIN attribute of the aggregated
4001 route is INTERNAL. */
4002 origin
= BGP_ORIGIN_IGP
;
4004 table
= bgp
->rib
[afi
][safi
];
4006 top
= bgp_node_get (table
, p
);
4007 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4008 if (rn
->p
.prefixlen
> p
->prefixlen
)
4012 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4014 if (BGP_INFO_HOLDDOWN (ri
))
4017 if (del
&& ri
== del
)
4020 if (! rinew
&& first
)
4022 nexthop
= ri
->attr
->nexthop
;
4023 med
= ri
->attr
->med
;
4027 #ifdef AGGREGATE_NEXTHOP_CHECK
4028 if (! IPV4_ADDR_SAME (&ri
->attr
->nexthop
, &nexthop
)
4029 || ri
->attr
->med
!= med
)
4032 aspath_free (aspath
);
4034 community_free (community
);
4035 bgp_unlock_node (rn
);
4036 bgp_unlock_node (top
);
4039 #endif /* AGGREGATE_NEXTHOP_CHECK */
4041 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4043 if (aggregate
->summary_only
)
4046 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
4052 if (aggregate
->as_set
)
4054 if (origin
< ri
->attr
->origin
)
4055 origin
= ri
->attr
->origin
;
4059 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4060 aspath_free (aspath
);
4064 aspath
= aspath_dup (ri
->attr
->aspath
);
4066 if (ri
->attr
->community
)
4070 commerge
= community_merge (community
,
4071 ri
->attr
->community
);
4072 community
= community_uniq_sort (commerge
);
4073 community_free (commerge
);
4076 community
= community_dup (ri
->attr
->community
);
4082 bgp_process (bgp
, rn
, afi
, safi
);
4084 bgp_unlock_node (top
);
4090 if (aggregate
->summary_only
)
4093 if (aggregate
->as_set
)
4095 if (origin
< rinew
->attr
->origin
)
4096 origin
= rinew
->attr
->origin
;
4100 asmerge
= aspath_aggregate (aspath
, rinew
->attr
->aspath
);
4101 aspath_free (aspath
);
4105 aspath
= aspath_dup (rinew
->attr
->aspath
);
4107 if (rinew
->attr
->community
)
4111 commerge
= community_merge (community
,
4112 rinew
->attr
->community
);
4113 community
= community_uniq_sort (commerge
);
4114 community_free (commerge
);
4117 community
= community_dup (rinew
->attr
->community
);
4122 if (aggregate
->count
> 0)
4124 rn
= bgp_node_get (table
, p
);
4125 new = bgp_info_new ();
4126 new->type
= ZEBRA_ROUTE_BGP
;
4127 new->sub_type
= BGP_ROUTE_AGGREGATE
;
4128 new->peer
= bgp
->peer_self
;
4129 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4130 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
4131 new->uptime
= time (NULL
);
4133 bgp_info_add (rn
, new);
4134 bgp_unlock_node (rn
);
4135 bgp_process (bgp
, rn
, afi
, safi
);
4140 aspath_free (aspath
);
4142 community_free (community
);
4146 void bgp_aggregate_delete (struct bgp
*, struct prefix
*, afi_t
, safi_t
,
4147 struct bgp_aggregate
*);
4150 bgp_aggregate_increment (struct bgp
*bgp
, struct prefix
*p
,
4151 struct bgp_info
*ri
, afi_t afi
, safi_t safi
)
4153 struct bgp_node
*child
;
4154 struct bgp_node
*rn
;
4155 struct bgp_aggregate
*aggregate
;
4157 /* MPLS-VPN aggregation is not yet supported. */
4158 if (safi
== SAFI_MPLS_VPN
)
4161 if (p
->prefixlen
== 0)
4164 if (BGP_INFO_HOLDDOWN (ri
))
4167 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
4169 /* Aggregate address configuration check. */
4170 for (rn
= child
; rn
; rn
= rn
->parent
)
4171 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
4173 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
4174 bgp_aggregate_route (bgp
, &rn
->p
, ri
, afi
, safi
, NULL
, aggregate
);
4176 bgp_unlock_node (child
);
4180 bgp_aggregate_decrement (struct bgp
*bgp
, struct prefix
*p
,
4181 struct bgp_info
*del
, afi_t afi
, safi_t safi
)
4183 struct bgp_node
*child
;
4184 struct bgp_node
*rn
;
4185 struct bgp_aggregate
*aggregate
;
4187 /* MPLS-VPN aggregation is not yet supported. */
4188 if (safi
== SAFI_MPLS_VPN
)
4191 if (p
->prefixlen
== 0)
4194 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
4196 /* Aggregate address configuration check. */
4197 for (rn
= child
; rn
; rn
= rn
->parent
)
4198 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
4200 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
4201 bgp_aggregate_route (bgp
, &rn
->p
, NULL
, afi
, safi
, del
, aggregate
);
4203 bgp_unlock_node (child
);
4207 bgp_aggregate_add (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
, safi_t safi
,
4208 struct bgp_aggregate
*aggregate
)
4210 struct bgp_table
*table
;
4211 struct bgp_node
*top
;
4212 struct bgp_node
*rn
;
4213 struct bgp_info
*new;
4214 struct bgp_info
*ri
;
4215 unsigned long match
;
4216 u_char origin
= BGP_ORIGIN_IGP
;
4217 struct aspath
*aspath
= NULL
;
4218 struct aspath
*asmerge
= NULL
;
4219 struct community
*community
= NULL
;
4220 struct community
*commerge
= NULL
;
4222 table
= bgp
->rib
[afi
][safi
];
4225 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
4227 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
4230 /* If routes exists below this node, generate aggregate routes. */
4231 top
= bgp_node_get (table
, p
);
4232 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4233 if (rn
->p
.prefixlen
> p
->prefixlen
)
4237 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4239 if (BGP_INFO_HOLDDOWN (ri
))
4242 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4244 /* summary-only aggregate route suppress aggregated
4245 route announcement. */
4246 if (aggregate
->summary_only
)
4249 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
4252 /* as-set aggregate route generate origin, as path,
4253 community aggregation. */
4254 if (aggregate
->as_set
)
4256 if (origin
< ri
->attr
->origin
)
4257 origin
= ri
->attr
->origin
;
4261 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4262 aspath_free (aspath
);
4266 aspath
= aspath_dup (ri
->attr
->aspath
);
4268 if (ri
->attr
->community
)
4272 commerge
= community_merge (community
,
4273 ri
->attr
->community
);
4274 community
= community_uniq_sort (commerge
);
4275 community_free (commerge
);
4278 community
= community_dup (ri
->attr
->community
);
4285 /* If this node is suppressed, process the change. */
4287 bgp_process (bgp
, rn
, afi
, safi
);
4289 bgp_unlock_node (top
);
4291 /* Add aggregate route to BGP table. */
4292 if (aggregate
->count
)
4294 rn
= bgp_node_get (table
, p
);
4296 new = bgp_info_new ();
4297 new->type
= ZEBRA_ROUTE_BGP
;
4298 new->sub_type
= BGP_ROUTE_AGGREGATE
;
4299 new->peer
= bgp
->peer_self
;
4300 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4301 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
4302 new->uptime
= time (NULL
);
4304 bgp_info_add (rn
, new);
4305 bgp_unlock_node (rn
);
4307 /* Process change. */
4308 bgp_process (bgp
, rn
, afi
, safi
);
4313 bgp_aggregate_delete (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
4314 safi_t safi
, struct bgp_aggregate
*aggregate
)
4316 struct bgp_table
*table
;
4317 struct bgp_node
*top
;
4318 struct bgp_node
*rn
;
4319 struct bgp_info
*ri
;
4320 unsigned long match
;
4322 table
= bgp
->rib
[afi
][safi
];
4324 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
4326 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
4329 /* If routes exists below this node, generate aggregate routes. */
4330 top
= bgp_node_get (table
, p
);
4331 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4332 if (rn
->p
.prefixlen
> p
->prefixlen
)
4336 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4338 if (BGP_INFO_HOLDDOWN (ri
))
4341 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4343 if (aggregate
->summary_only
)
4347 if (ri
->suppress
== 0)
4349 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
4357 /* If this node is suppressed, process the change. */
4359 bgp_process (bgp
, rn
, afi
, safi
);
4361 bgp_unlock_node (top
);
4363 /* Delete aggregate route from BGP table. */
4364 rn
= bgp_node_get (table
, p
);
4366 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4367 if (ri
->peer
== bgp
->peer_self
4368 && ri
->type
== ZEBRA_ROUTE_BGP
4369 && ri
->sub_type
== BGP_ROUTE_AGGREGATE
)
4372 /* Withdraw static BGP route from routing table. */
4375 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
4376 bgp_process (bgp
, rn
, afi
, safi
);
4377 bgp_info_delete (rn
, ri
);
4380 /* Unlock bgp_node_lookup. */
4381 bgp_unlock_node (rn
);
4384 /* Aggregate route attribute. */
4385 #define AGGREGATE_SUMMARY_ONLY 1
4386 #define AGGREGATE_AS_SET 1
4389 bgp_aggregate_set (struct vty
*vty
, const char *prefix_str
,
4390 afi_t afi
, safi_t safi
,
4391 u_char summary_only
, u_char as_set
)
4395 struct bgp_node
*rn
;
4397 struct bgp_aggregate
*aggregate
;
4399 /* Convert string to prefix structure. */
4400 ret
= str2prefix (prefix_str
, &p
);
4403 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
4408 /* Get BGP structure. */
4411 /* Old configuration check. */
4412 rn
= bgp_node_get (bgp
->aggregate
[afi
][safi
], &p
);
4416 vty_out (vty
, "There is already same aggregate network.%s", VTY_NEWLINE
);
4417 bgp_unlock_node (rn
);
4421 /* Make aggregate address structure. */
4422 aggregate
= bgp_aggregate_new ();
4423 aggregate
->summary_only
= summary_only
;
4424 aggregate
->as_set
= as_set
;
4425 aggregate
->safi
= safi
;
4426 rn
->info
= aggregate
;
4428 /* Aggregate address insert into BGP routing table. */
4429 if (safi
& SAFI_UNICAST
)
4430 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
4431 if (safi
& SAFI_MULTICAST
)
4432 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
4438 bgp_aggregate_unset (struct vty
*vty
, const char *prefix_str
,
4439 afi_t afi
, safi_t safi
)
4443 struct bgp_node
*rn
;
4445 struct bgp_aggregate
*aggregate
;
4447 /* Convert string to prefix structure. */
4448 ret
= str2prefix (prefix_str
, &p
);
4451 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
4456 /* Get BGP structure. */
4459 /* Old configuration check. */
4460 rn
= bgp_node_lookup (bgp
->aggregate
[afi
][safi
], &p
);
4463 vty_out (vty
, "%% There is no aggregate-address configuration.%s",
4468 aggregate
= rn
->info
;
4469 if (aggregate
->safi
& SAFI_UNICAST
)
4470 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
4471 if (aggregate
->safi
& SAFI_MULTICAST
)
4472 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
4474 /* Unlock aggregate address configuration. */
4476 bgp_aggregate_free (aggregate
);
4477 bgp_unlock_node (rn
);
4478 bgp_unlock_node (rn
);
4483 DEFUN (aggregate_address
,
4484 aggregate_address_cmd
,
4485 "aggregate-address A.B.C.D/M",
4486 "Configure BGP aggregate entries\n"
4487 "Aggregate prefix\n")
4489 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
), 0, 0);
4492 DEFUN (aggregate_address_mask
,
4493 aggregate_address_mask_cmd
,
4494 "aggregate-address A.B.C.D A.B.C.D",
4495 "Configure BGP aggregate entries\n"
4496 "Aggregate address\n"
4500 char prefix_str
[BUFSIZ
];
4502 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4506 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4510 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
4514 DEFUN (aggregate_address_summary_only
,
4515 aggregate_address_summary_only_cmd
,
4516 "aggregate-address A.B.C.D/M summary-only",
4517 "Configure BGP aggregate entries\n"
4518 "Aggregate prefix\n"
4519 "Filter more specific routes from updates\n")
4521 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
4522 AGGREGATE_SUMMARY_ONLY
, 0);
4525 DEFUN (aggregate_address_mask_summary_only
,
4526 aggregate_address_mask_summary_only_cmd
,
4527 "aggregate-address A.B.C.D A.B.C.D summary-only",
4528 "Configure BGP aggregate entries\n"
4529 "Aggregate address\n"
4531 "Filter more specific routes from updates\n")
4534 char prefix_str
[BUFSIZ
];
4536 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4540 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4544 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
4545 AGGREGATE_SUMMARY_ONLY
, 0);
4548 DEFUN (aggregate_address_as_set
,
4549 aggregate_address_as_set_cmd
,
4550 "aggregate-address A.B.C.D/M as-set",
4551 "Configure BGP aggregate entries\n"
4552 "Aggregate prefix\n"
4553 "Generate AS set path information\n")
4555 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
4556 0, AGGREGATE_AS_SET
);
4559 DEFUN (aggregate_address_mask_as_set
,
4560 aggregate_address_mask_as_set_cmd
,
4561 "aggregate-address A.B.C.D A.B.C.D as-set",
4562 "Configure BGP aggregate entries\n"
4563 "Aggregate address\n"
4565 "Generate AS set path information\n")
4568 char prefix_str
[BUFSIZ
];
4570 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4574 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4578 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
4579 0, AGGREGATE_AS_SET
);
4583 DEFUN (aggregate_address_as_set_summary
,
4584 aggregate_address_as_set_summary_cmd
,
4585 "aggregate-address A.B.C.D/M as-set summary-only",
4586 "Configure BGP aggregate entries\n"
4587 "Aggregate prefix\n"
4588 "Generate AS set path information\n"
4589 "Filter more specific routes from updates\n")
4591 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
4592 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
4595 ALIAS (aggregate_address_as_set_summary
,
4596 aggregate_address_summary_as_set_cmd
,
4597 "aggregate-address A.B.C.D/M summary-only as-set",
4598 "Configure BGP aggregate entries\n"
4599 "Aggregate prefix\n"
4600 "Filter more specific routes from updates\n"
4601 "Generate AS set path information\n")
4603 DEFUN (aggregate_address_mask_as_set_summary
,
4604 aggregate_address_mask_as_set_summary_cmd
,
4605 "aggregate-address A.B.C.D A.B.C.D as-set summary-only",
4606 "Configure BGP aggregate entries\n"
4607 "Aggregate address\n"
4609 "Generate AS set path information\n"
4610 "Filter more specific routes from updates\n")
4613 char prefix_str
[BUFSIZ
];
4615 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4619 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4623 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
4624 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
4627 ALIAS (aggregate_address_mask_as_set_summary
,
4628 aggregate_address_mask_summary_as_set_cmd
,
4629 "aggregate-address A.B.C.D A.B.C.D summary-only as-set",
4630 "Configure BGP aggregate entries\n"
4631 "Aggregate address\n"
4633 "Filter more specific routes from updates\n"
4634 "Generate AS set path information\n")
4636 DEFUN (no_aggregate_address
,
4637 no_aggregate_address_cmd
,
4638 "no aggregate-address A.B.C.D/M",
4640 "Configure BGP aggregate entries\n"
4641 "Aggregate prefix\n")
4643 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
));
4646 ALIAS (no_aggregate_address
,
4647 no_aggregate_address_summary_only_cmd
,
4648 "no aggregate-address A.B.C.D/M summary-only",
4650 "Configure BGP aggregate entries\n"
4651 "Aggregate prefix\n"
4652 "Filter more specific routes from updates\n")
4654 ALIAS (no_aggregate_address
,
4655 no_aggregate_address_as_set_cmd
,
4656 "no aggregate-address A.B.C.D/M as-set",
4658 "Configure BGP aggregate entries\n"
4659 "Aggregate prefix\n"
4660 "Generate AS set path information\n")
4662 ALIAS (no_aggregate_address
,
4663 no_aggregate_address_as_set_summary_cmd
,
4664 "no aggregate-address A.B.C.D/M as-set summary-only",
4666 "Configure BGP aggregate entries\n"
4667 "Aggregate prefix\n"
4668 "Generate AS set path information\n"
4669 "Filter more specific routes from updates\n")
4671 ALIAS (no_aggregate_address
,
4672 no_aggregate_address_summary_as_set_cmd
,
4673 "no aggregate-address A.B.C.D/M summary-only as-set",
4675 "Configure BGP aggregate entries\n"
4676 "Aggregate prefix\n"
4677 "Filter more specific routes from updates\n"
4678 "Generate AS set path information\n")
4680 DEFUN (no_aggregate_address_mask
,
4681 no_aggregate_address_mask_cmd
,
4682 "no aggregate-address A.B.C.D A.B.C.D",
4684 "Configure BGP aggregate entries\n"
4685 "Aggregate address\n"
4689 char prefix_str
[BUFSIZ
];
4691 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4695 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4699 return bgp_aggregate_unset (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
));
4702 ALIAS (no_aggregate_address_mask
,
4703 no_aggregate_address_mask_summary_only_cmd
,
4704 "no aggregate-address A.B.C.D A.B.C.D summary-only",
4706 "Configure BGP aggregate entries\n"
4707 "Aggregate address\n"
4709 "Filter more specific routes from updates\n")
4711 ALIAS (no_aggregate_address_mask
,
4712 no_aggregate_address_mask_as_set_cmd
,
4713 "no aggregate-address A.B.C.D A.B.C.D as-set",
4715 "Configure BGP aggregate entries\n"
4716 "Aggregate address\n"
4718 "Generate AS set path information\n")
4720 ALIAS (no_aggregate_address_mask
,
4721 no_aggregate_address_mask_as_set_summary_cmd
,
4722 "no aggregate-address A.B.C.D A.B.C.D as-set summary-only",
4724 "Configure BGP aggregate entries\n"
4725 "Aggregate address\n"
4727 "Generate AS set path information\n"
4728 "Filter more specific routes from updates\n")
4730 ALIAS (no_aggregate_address_mask
,
4731 no_aggregate_address_mask_summary_as_set_cmd
,
4732 "no aggregate-address A.B.C.D A.B.C.D summary-only as-set",
4734 "Configure BGP aggregate entries\n"
4735 "Aggregate address\n"
4737 "Filter more specific routes from updates\n"
4738 "Generate AS set path information\n")
4741 DEFUN (ipv6_aggregate_address
,
4742 ipv6_aggregate_address_cmd
,
4743 "aggregate-address X:X::X:X/M",
4744 "Configure BGP aggregate entries\n"
4745 "Aggregate prefix\n")
4747 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0, 0);
4750 DEFUN (ipv6_aggregate_address_summary_only
,
4751 ipv6_aggregate_address_summary_only_cmd
,
4752 "aggregate-address X:X::X:X/M summary-only",
4753 "Configure BGP aggregate entries\n"
4754 "Aggregate prefix\n"
4755 "Filter more specific routes from updates\n")
4757 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
4758 AGGREGATE_SUMMARY_ONLY
, 0);
4761 DEFUN (no_ipv6_aggregate_address
,
4762 no_ipv6_aggregate_address_cmd
,
4763 "no aggregate-address X:X::X:X/M",
4765 "Configure BGP aggregate entries\n"
4766 "Aggregate prefix\n")
4768 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
4771 DEFUN (no_ipv6_aggregate_address_summary_only
,
4772 no_ipv6_aggregate_address_summary_only_cmd
,
4773 "no aggregate-address X:X::X:X/M summary-only",
4775 "Configure BGP aggregate entries\n"
4776 "Aggregate prefix\n"
4777 "Filter more specific routes from updates\n")
4779 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
4782 ALIAS (ipv6_aggregate_address
,
4783 old_ipv6_aggregate_address_cmd
,
4784 "ipv6 bgp aggregate-address X:X::X:X/M",
4787 "Configure BGP aggregate entries\n"
4788 "Aggregate prefix\n")
4790 ALIAS (ipv6_aggregate_address_summary_only
,
4791 old_ipv6_aggregate_address_summary_only_cmd
,
4792 "ipv6 bgp aggregate-address X:X::X:X/M summary-only",
4795 "Configure BGP aggregate entries\n"
4796 "Aggregate prefix\n"
4797 "Filter more specific routes from updates\n")
4799 ALIAS (no_ipv6_aggregate_address
,
4800 old_no_ipv6_aggregate_address_cmd
,
4801 "no ipv6 bgp aggregate-address X:X::X:X/M",
4805 "Configure BGP aggregate entries\n"
4806 "Aggregate prefix\n")
4808 ALIAS (no_ipv6_aggregate_address_summary_only
,
4809 old_no_ipv6_aggregate_address_summary_only_cmd
,
4810 "no ipv6 bgp aggregate-address X:X::X:X/M summary-only",
4814 "Configure BGP aggregate entries\n"
4815 "Aggregate prefix\n"
4816 "Filter more specific routes from updates\n")
4817 #endif /* HAVE_IPV6 */
4819 /* Redistribute route treatment. */
4821 bgp_redistribute_add (struct prefix
*p
, struct in_addr
*nexthop
,
4822 u_int32_t metric
, u_char type
)
4825 struct listnode
*node
, *nnode
;
4826 struct bgp_info
*new;
4827 struct bgp_info
*bi
;
4828 struct bgp_info info
;
4829 struct bgp_node
*bn
;
4831 struct attr attr_new
;
4832 struct attr
*new_attr
;
4836 /* Make default attribute. */
4837 bgp_attr_default_set (&attr
, BGP_ORIGIN_INCOMPLETE
);
4839 attr
.nexthop
= *nexthop
;
4842 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
4844 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
4846 afi
= family2afi (p
->family
);
4848 if (bgp
->redist
[afi
][type
])
4850 /* Copy attribute for modification. */
4853 if (bgp
->redist_metric_flag
[afi
][type
])
4854 attr_new
.med
= bgp
->redist_metric
[afi
][type
];
4856 /* Apply route-map. */
4857 if (bgp
->rmap
[afi
][type
].map
)
4859 info
.peer
= bgp
->peer_self
;
4860 info
.attr
= &attr_new
;
4862 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_REDISTRIBUTE
);
4864 ret
= route_map_apply (bgp
->rmap
[afi
][type
].map
, p
, RMAP_BGP
,
4867 bgp
->peer_self
->rmap_type
= 0;
4869 if (ret
== RMAP_DENYMATCH
)
4871 /* Free uninterned attribute. */
4872 bgp_attr_flush (&attr_new
);
4874 /* Unintern original. */
4875 aspath_unintern (attr
.aspath
);
4876 bgp_redistribute_delete (p
, type
);
4881 bn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
], afi
, SAFI_UNICAST
, p
, NULL
);
4882 new_attr
= bgp_attr_intern (&attr_new
);
4884 for (bi
= bn
->info
; bi
; bi
= bi
->next
)
4885 if (bi
->peer
== bgp
->peer_self
4886 && bi
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
4891 if (attrhash_cmp (bi
->attr
, new_attr
))
4893 bgp_attr_unintern (new_attr
);
4894 aspath_unintern (attr
.aspath
);
4895 bgp_unlock_node (bn
);
4900 /* The attribute is changed. */
4901 SET_FLAG (bi
->flags
, BGP_INFO_ATTR_CHANGED
);
4903 /* Rewrite BGP route information. */
4904 bgp_aggregate_decrement (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
4905 bgp_attr_unintern (bi
->attr
);
4906 bi
->attr
= new_attr
;
4907 bi
->uptime
= time (NULL
);
4909 /* Process change. */
4910 bgp_aggregate_increment (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
4911 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
4912 bgp_unlock_node (bn
);
4913 aspath_unintern (attr
.aspath
);
4918 new = bgp_info_new ();
4920 new->sub_type
= BGP_ROUTE_REDISTRIBUTE
;
4921 new->peer
= bgp
->peer_self
;
4922 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4923 new->attr
= new_attr
;
4924 new->uptime
= time (NULL
);
4926 bgp_aggregate_increment (bgp
, p
, new, afi
, SAFI_UNICAST
);
4927 bgp_info_add (bn
, new);
4928 bgp_unlock_node (bn
);
4929 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
4933 /* Unintern original. */
4934 aspath_unintern (attr
.aspath
);
4938 bgp_redistribute_delete (struct prefix
*p
, u_char type
)
4941 struct listnode
*node
, *nnode
;
4943 struct bgp_node
*rn
;
4944 struct bgp_info
*ri
;
4946 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
4948 afi
= family2afi (p
->family
);
4950 if (bgp
->redist
[afi
][type
])
4952 rn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
], afi
, SAFI_UNICAST
, p
, NULL
);
4954 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4955 if (ri
->peer
== bgp
->peer_self
4956 && ri
->type
== type
)
4961 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, SAFI_UNICAST
);
4962 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
4963 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
4964 bgp_info_delete (rn
, ri
);
4966 bgp_unlock_node (rn
);
4971 /* Withdraw specified route type's route. */
4973 bgp_redistribute_withdraw (struct bgp
*bgp
, afi_t afi
, int type
)
4975 struct bgp_node
*rn
;
4976 struct bgp_info
*ri
;
4977 struct bgp_table
*table
;
4979 table
= bgp
->rib
[afi
][SAFI_UNICAST
];
4981 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
4983 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4984 if (ri
->peer
== bgp
->peer_self
4985 && ri
->type
== type
)
4990 bgp_aggregate_decrement (bgp
, &rn
->p
, ri
, afi
, SAFI_UNICAST
);
4991 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
4992 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
4993 bgp_info_delete (rn
, ri
);
4998 /* Static function to display route. */
5000 route_vty_out_route (struct prefix
*p
, struct vty
*vty
)
5003 u_int32_t destination
;
5006 if (p
->family
== AF_INET
)
5008 len
= vty_out (vty
, "%s", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
));
5009 destination
= ntohl (p
->u
.prefix4
.s_addr
);
5011 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
5012 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
5013 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
5014 || p
->u
.prefix4
.s_addr
== 0)
5016 /* When mask is natural, mask is not displayed. */
5019 len
+= vty_out (vty
, "/%d", p
->prefixlen
);
5022 len
= vty_out (vty
, "%s/%d", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
),
5027 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 20, " ");
5029 vty_out (vty
, "%*s", len
, " ");
5032 enum bgp_display_type
5037 /* Print the short form route status for a bgp_info */
5039 route_vty_short_status_out (struct vty
*vty
, struct bgp_info
*binfo
)
5041 /* Route status display. */
5042 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
5044 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
5046 else if (binfo
->suppress
)
5048 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5054 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5056 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5058 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
5063 /* Internal route. */
5064 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
5070 /* called from terminal list command */
5072 route_vty_out (struct vty
*vty
, struct prefix
*p
,
5073 struct bgp_info
*binfo
, int display
, safi_t safi
)
5077 /* short status lead text */
5078 route_vty_short_status_out (vty
, binfo
);
5080 /* print prefix and mask */
5082 route_vty_out_route (p
, vty
);
5084 vty_out (vty
, "%*s", 17, " ");
5086 /* Print attribute */
5090 if (p
->family
== AF_INET
)
5092 if (safi
== SAFI_MPLS_VPN
)
5093 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
5095 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5098 else if (p
->family
== AF_INET6
)
5103 len
= vty_out (vty
, "%s",
5104 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
5107 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
5109 vty_out (vty
, "%*s", len
, " ");
5111 #endif /* HAVE_IPV6 */
5113 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
5114 vty_out (vty
, "%10d", attr
->med
);
5118 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
5119 vty_out (vty
, "%7d", attr
->local_pref
);
5123 vty_out (vty
, "%7u ",attr
->weight
);
5127 aspath_print_vty (vty
, attr
->aspath
);
5130 if (strlen (attr
->aspath
->str
) == 0)
5131 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5133 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
5135 vty_out (vty
, "%s", VTY_NEWLINE
);
5138 /* called from terminal list command */
5140 route_vty_out_tmp (struct vty
*vty
, struct prefix
*p
,
5141 struct attr
*attr
, safi_t safi
)
5143 /* Route status display. */
5148 /* print prefix and mask */
5149 route_vty_out_route (p
, vty
);
5151 /* Print attribute */
5154 if (p
->family
== AF_INET
)
5156 if (safi
== SAFI_MPLS_VPN
)
5157 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
5159 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5162 else if (p
->family
== AF_INET6
)
5167 len
= vty_out (vty
, "%s",
5168 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
5171 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
5173 vty_out (vty
, "%*s", len
, " ");
5175 #endif /* HAVE_IPV6 */
5177 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
5178 vty_out (vty
, "%10d", attr
->med
);
5182 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
5183 vty_out (vty
, "%7d", attr
->local_pref
);
5187 vty_out (vty
, "%7d ",attr
->weight
);
5191 aspath_print_vty (vty
, attr
->aspath
);
5194 if (strlen (attr
->aspath
->str
) == 0)
5195 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5197 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
5200 vty_out (vty
, "%s", VTY_NEWLINE
);
5204 route_vty_out_tag (struct vty
*vty
, struct prefix
*p
,
5205 struct bgp_info
*binfo
, int display
, safi_t safi
)
5208 u_int32_t label
= 0;
5210 /* short status lead text */
5211 route_vty_short_status_out (vty
, binfo
);
5213 /* print prefix and mask */
5215 route_vty_out_route (p
, vty
);
5217 vty_out (vty
, "%*s", 17, " ");
5219 /* Print attribute */
5223 if (p
->family
== AF_INET
)
5225 if (safi
== SAFI_MPLS_VPN
)
5226 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
5228 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5231 else if (p
->family
== AF_INET6
)
5235 if (attr
->mp_nexthop_len
== 16)
5237 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
5238 else if (attr
->mp_nexthop_len
== 32)
5239 vty_out (vty
, "%s(%s)",
5240 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
),
5241 inet_ntop (AF_INET6
, &attr
->mp_nexthop_local
, buf1
, BUFSIZ
));
5244 #endif /* HAVE_IPV6 */
5247 label
= decode_label (binfo
->tag
);
5249 vty_out (vty
, "notag/%d", label
);
5251 vty_out (vty
, "%s", VTY_NEWLINE
);
5254 /* dampening route */
5256 damp_route_vty_out (struct vty
*vty
, struct prefix
*p
,
5257 struct bgp_info
*binfo
, int display
, safi_t safi
)
5262 /* short status lead text */
5263 route_vty_short_status_out (vty
, binfo
);
5265 /* print prefix and mask */
5267 route_vty_out_route (p
, vty
);
5269 vty_out (vty
, "%*s", 17, " ");
5271 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
5274 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 34, " ");
5276 vty_out (vty
, "%*s", len
, " ");
5278 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
));
5280 /* Print attribute */
5286 aspath_print_vty (vty
, attr
->aspath
);
5289 if (strlen (attr
->aspath
->str
) == 0)
5290 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5292 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
5294 vty_out (vty
, "%s", VTY_NEWLINE
);
5297 #define BGP_UPTIME_LEN 25
5301 flap_route_vty_out (struct vty
*vty
, struct prefix
*p
,
5302 struct bgp_info
*binfo
, int display
, safi_t safi
)
5305 struct bgp_damp_info
*bdi
;
5306 char timebuf
[BGP_UPTIME_LEN
];
5309 bdi
= binfo
->damp_info
;
5311 /* short status lead text */
5312 route_vty_short_status_out (vty
, binfo
);
5314 /* print prefix and mask */
5316 route_vty_out_route (p
, vty
);
5318 vty_out (vty
, "%*s", 17, " ");
5320 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
5323 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 33, " ");
5325 vty_out (vty
, "%*s", len
, " ");
5327 len
= vty_out (vty
, "%d", bdi
->flap
);
5332 vty_out (vty
, "%*s ", len
, " ");
5334 vty_out (vty
, "%s ", peer_uptime (bdi
->start_time
,
5335 timebuf
, BGP_UPTIME_LEN
));
5337 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
)
5338 && ! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5339 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
));
5341 vty_out (vty
, "%*s ", 8, " ");
5343 /* Print attribute */
5349 aspath_print_vty (vty
, attr
->aspath
);
5352 if (strlen (attr
->aspath
->str
) == 0)
5353 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5355 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
5357 vty_out (vty
, "%s", VTY_NEWLINE
);
5361 route_vty_out_detail (struct vty
*vty
, struct bgp
*bgp
, struct prefix
*p
,
5362 struct bgp_info
*binfo
, afi_t afi
, safi_t safi
)
5364 char buf
[INET6_ADDRSTRLEN
];
5367 int sockunion_vty_out (struct vty
*, union sockunion
*);
5373 /* Line1 display AS-path, Aggregator */
5377 if (aspath_count_hops (attr
->aspath
) == 0)
5378 vty_out (vty
, "Local");
5380 aspath_print_vty (vty
, attr
->aspath
);
5383 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
5384 vty_out (vty
, ", (removed)");
5385 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
5386 vty_out (vty
, ", (stale)");
5387 if (CHECK_FLAG (attr
->flag
, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR
)))
5388 vty_out (vty
, ", (aggregated by %d %s)", attr
->aggregator_as
,
5389 inet_ntoa (attr
->aggregator_addr
));
5390 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
5391 vty_out (vty
, ", (Received from a RR-client)");
5392 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
5393 vty_out (vty
, ", (Received from a RS-client)");
5394 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5395 vty_out (vty
, ", (history entry)");
5396 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5397 vty_out (vty
, ", (suppressed due to dampening)");
5398 vty_out (vty
, "%s", VTY_NEWLINE
);
5400 /* Line2 display Next-hop, Neighbor, Router-id */
5401 if (p
->family
== AF_INET
)
5403 vty_out (vty
, " %s", safi
== SAFI_MPLS_VPN
?
5404 inet_ntoa (attr
->mp_nexthop_global_in
) :
5405 inet_ntoa (attr
->nexthop
));
5410 vty_out (vty
, " %s",
5411 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
,
5412 buf
, INET6_ADDRSTRLEN
));
5414 #endif /* HAVE_IPV6 */
5416 if (binfo
->peer
== bgp
->peer_self
)
5418 vty_out (vty
, " from %s ",
5419 p
->family
== AF_INET
? "0.0.0.0" : "::");
5420 vty_out (vty
, "(%s)", inet_ntoa(bgp
->router_id
));
5424 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_VALID
))
5425 vty_out (vty
, " (inaccessible)");
5426 else if (binfo
->igpmetric
)
5427 vty_out (vty
, " (metric %d)", binfo
->igpmetric
);
5428 vty_out (vty
, " from %s", sockunion2str (&binfo
->peer
->su
, buf
, SU_ADDRSTRLEN
));
5429 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
5430 vty_out (vty
, " (%s)", inet_ntoa (attr
->originator_id
));
5432 vty_out (vty
, " (%s)", inet_ntop (AF_INET
, &binfo
->peer
->remote_id
, buf1
, BUFSIZ
));
5434 vty_out (vty
, "%s", VTY_NEWLINE
);
5437 /* display nexthop local */
5438 if (attr
->mp_nexthop_len
== 32)
5440 vty_out (vty
, " (%s)%s",
5441 inet_ntop (AF_INET6
, &attr
->mp_nexthop_local
,
5442 buf
, INET6_ADDRSTRLEN
),
5445 #endif /* HAVE_IPV6 */
5447 /* Line 3 display Origin, Med, Locpref, Weight, valid, Int/Ext/Local, Atomic, best */
5448 vty_out (vty
, " Origin %s", bgp_origin_long_str
[attr
->origin
]);
5450 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
))
5451 vty_out (vty
, ", metric %d", attr
->med
);
5453 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
))
5454 vty_out (vty
, ", localpref %d", attr
->local_pref
);
5456 vty_out (vty
, ", localpref %d", bgp
->default_local_pref
);
5458 if (attr
->weight
!= 0)
5459 vty_out (vty
, ", weight %d", attr
->weight
);
5461 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5462 vty_out (vty
, ", valid");
5464 if (binfo
->peer
!= bgp
->peer_self
)
5466 if (binfo
->peer
->as
== binfo
->peer
->local_as
)
5467 vty_out (vty
, ", internal");
5469 vty_out (vty
, ", %s",
5470 (bgp_confederation_peers_check(bgp
, binfo
->peer
->as
) ? "confed-external" : "external"));
5472 else if (binfo
->sub_type
== BGP_ROUTE_AGGREGATE
)
5473 vty_out (vty
, ", aggregated, local");
5474 else if (binfo
->type
!= ZEBRA_ROUTE_BGP
)
5475 vty_out (vty
, ", sourced");
5477 vty_out (vty
, ", sourced, local");
5479 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
5480 vty_out (vty
, ", atomic-aggregate");
5482 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
5483 vty_out (vty
, ", best");
5485 vty_out (vty
, "%s", VTY_NEWLINE
);
5487 /* Line 4 display Community */
5488 if (attr
->community
)
5489 vty_out (vty
, " Community: %s%s", attr
->community
->str
,
5492 /* Line 5 display Extended-community */
5493 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
))
5494 vty_out (vty
, " Extended Community: %s%s", attr
->ecommunity
->str
,
5497 /* Line 6 display Originator, Cluster-id */
5498 if ((attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)) ||
5499 (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
)))
5501 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
5502 vty_out (vty
, " Originator: %s", inet_ntoa (attr
->originator_id
));
5504 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
5507 vty_out (vty
, ", Cluster list: ");
5508 for (i
= 0; i
< attr
->cluster
->length
/ 4; i
++)
5509 vty_out (vty
, "%s ", inet_ntoa (attr
->cluster
->list
[i
]));
5511 vty_out (vty
, "%s", VTY_NEWLINE
);
5514 if (binfo
->damp_info
)
5515 bgp_damp_info_vty (vty
, binfo
);
5517 /* Line 7 display Uptime */
5518 vty_out (vty
, " Last update: %s", ctime (&binfo
->uptime
));
5520 vty_out (vty
, "%s", VTY_NEWLINE
);
5523 #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s r RIB-failure, S Stale, R Removed%s"
5524 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s"
5525 #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s"
5526 #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s"
5527 #define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path%s"
5531 bgp_show_type_normal
,
5532 bgp_show_type_regexp
,
5533 bgp_show_type_prefix_list
,
5534 bgp_show_type_filter_list
,
5535 bgp_show_type_route_map
,
5536 bgp_show_type_neighbor
,
5537 bgp_show_type_cidr_only
,
5538 bgp_show_type_prefix_longer
,
5539 bgp_show_type_community_all
,
5540 bgp_show_type_community
,
5541 bgp_show_type_community_exact
,
5542 bgp_show_type_community_list
,
5543 bgp_show_type_community_list_exact
,
5544 bgp_show_type_flap_statistics
,
5545 bgp_show_type_flap_address
,
5546 bgp_show_type_flap_prefix
,
5547 bgp_show_type_flap_cidr_only
,
5548 bgp_show_type_flap_regexp
,
5549 bgp_show_type_flap_filter_list
,
5550 bgp_show_type_flap_prefix_list
,
5551 bgp_show_type_flap_prefix_longer
,
5552 bgp_show_type_flap_route_map
,
5553 bgp_show_type_flap_neighbor
,
5554 bgp_show_type_dampend_paths
,
5555 bgp_show_type_damp_neighbor
5559 bgp_show_table (struct vty
*vty
, struct bgp_table
*table
, struct in_addr
*router_id
,
5560 enum bgp_show_type type
, void *output_arg
)
5562 struct bgp_info
*ri
;
5563 struct bgp_node
*rn
;
5566 unsigned long output_count
;
5568 /* This is first entry point, so reset total line. */
5571 /* Start processing of routes. */
5572 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
5573 if (rn
->info
!= NULL
)
5577 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5579 if (type
== bgp_show_type_flap_statistics
5580 || type
== bgp_show_type_flap_address
5581 || type
== bgp_show_type_flap_prefix
5582 || type
== bgp_show_type_flap_cidr_only
5583 || type
== bgp_show_type_flap_regexp
5584 || type
== bgp_show_type_flap_filter_list
5585 || type
== bgp_show_type_flap_prefix_list
5586 || type
== bgp_show_type_flap_prefix_longer
5587 || type
== bgp_show_type_flap_route_map
5588 || type
== bgp_show_type_flap_neighbor
5589 || type
== bgp_show_type_dampend_paths
5590 || type
== bgp_show_type_damp_neighbor
)
5592 if (! ri
->damp_info
)
5595 if (type
== bgp_show_type_regexp
5596 || type
== bgp_show_type_flap_regexp
)
5598 regex_t
*regex
= output_arg
;
5600 if (bgp_regexec (regex
, ri
->attr
->aspath
) == REG_NOMATCH
)
5603 if (type
== bgp_show_type_prefix_list
5604 || type
== bgp_show_type_flap_prefix_list
)
5606 struct prefix_list
*plist
= output_arg
;
5608 if (prefix_list_apply (plist
, &rn
->p
) != PREFIX_PERMIT
)
5611 if (type
== bgp_show_type_filter_list
5612 || type
== bgp_show_type_flap_filter_list
)
5614 struct as_list
*as_list
= output_arg
;
5616 if (as_list_apply (as_list
, ri
->attr
->aspath
) != AS_FILTER_PERMIT
)
5619 if (type
== bgp_show_type_route_map
5620 || type
== bgp_show_type_flap_route_map
)
5622 struct route_map
*rmap
= output_arg
;
5623 struct bgp_info binfo
;
5624 struct attr dummy_attr
;
5627 dummy_attr
= *ri
->attr
;
5628 binfo
.peer
= ri
->peer
;
5629 binfo
.attr
= &dummy_attr
;
5631 ret
= route_map_apply (rmap
, &rn
->p
, RMAP_BGP
, &binfo
);
5633 if (ret
== RMAP_DENYMATCH
)
5636 if (type
== bgp_show_type_neighbor
5637 || type
== bgp_show_type_flap_neighbor
5638 || type
== bgp_show_type_damp_neighbor
)
5640 union sockunion
*su
= output_arg
;
5642 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
5645 if (type
== bgp_show_type_cidr_only
5646 || type
== bgp_show_type_flap_cidr_only
)
5648 u_int32_t destination
;
5650 destination
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
5651 if (IN_CLASSC (destination
) && rn
->p
.prefixlen
== 24)
5653 if (IN_CLASSB (destination
) && rn
->p
.prefixlen
== 16)
5655 if (IN_CLASSA (destination
) && rn
->p
.prefixlen
== 8)
5658 if (type
== bgp_show_type_prefix_longer
5659 || type
== bgp_show_type_flap_prefix_longer
)
5661 struct prefix
*p
= output_arg
;
5663 if (! prefix_match (p
, &rn
->p
))
5666 if (type
== bgp_show_type_community_all
)
5668 if (! ri
->attr
->community
)
5671 if (type
== bgp_show_type_community
)
5673 struct community
*com
= output_arg
;
5675 if (! ri
->attr
->community
||
5676 ! community_match (ri
->attr
->community
, com
))
5679 if (type
== bgp_show_type_community_exact
)
5681 struct community
*com
= output_arg
;
5683 if (! ri
->attr
->community
||
5684 ! community_cmp (ri
->attr
->community
, com
))
5687 if (type
== bgp_show_type_community_list
)
5689 struct community_list
*list
= output_arg
;
5691 if (! community_list_match (ri
->attr
->community
, list
))
5694 if (type
== bgp_show_type_community_list_exact
)
5696 struct community_list
*list
= output_arg
;
5698 if (! community_list_exact_match (ri
->attr
->community
, list
))
5701 if (type
== bgp_show_type_flap_address
5702 || type
== bgp_show_type_flap_prefix
)
5704 struct prefix
*p
= output_arg
;
5706 if (! prefix_match (&rn
->p
, p
))
5709 if (type
== bgp_show_type_flap_prefix
)
5710 if (p
->prefixlen
!= rn
->p
.prefixlen
)
5713 if (type
== bgp_show_type_dampend_paths
5714 || type
== bgp_show_type_damp_neighbor
)
5716 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
5717 || CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
5723 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id
), VTY_NEWLINE
);
5724 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
5725 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
5726 if (type
== bgp_show_type_dampend_paths
5727 || type
== bgp_show_type_damp_neighbor
)
5728 vty_out (vty
, BGP_SHOW_DAMP_HEADER
, VTY_NEWLINE
);
5729 else if (type
== bgp_show_type_flap_statistics
5730 || type
== bgp_show_type_flap_address
5731 || type
== bgp_show_type_flap_prefix
5732 || type
== bgp_show_type_flap_cidr_only
5733 || type
== bgp_show_type_flap_regexp
5734 || type
== bgp_show_type_flap_filter_list
5735 || type
== bgp_show_type_flap_prefix_list
5736 || type
== bgp_show_type_flap_prefix_longer
5737 || type
== bgp_show_type_flap_route_map
5738 || type
== bgp_show_type_flap_neighbor
)
5739 vty_out (vty
, BGP_SHOW_FLAP_HEADER
, VTY_NEWLINE
);
5741 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
5745 if (type
== bgp_show_type_dampend_paths
5746 || type
== bgp_show_type_damp_neighbor
)
5747 damp_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
5748 else if (type
== bgp_show_type_flap_statistics
5749 || type
== bgp_show_type_flap_address
5750 || type
== bgp_show_type_flap_prefix
5751 || type
== bgp_show_type_flap_cidr_only
5752 || type
== bgp_show_type_flap_regexp
5753 || type
== bgp_show_type_flap_filter_list
5754 || type
== bgp_show_type_flap_prefix_list
5755 || type
== bgp_show_type_flap_prefix_longer
5756 || type
== bgp_show_type_flap_route_map
5757 || type
== bgp_show_type_flap_neighbor
)
5758 flap_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
5760 route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
5767 /* No route is displayed */
5768 if (output_count
== 0)
5770 if (type
== bgp_show_type_normal
)
5771 vty_out (vty
, "No BGP network exists%s", VTY_NEWLINE
);
5774 vty_out (vty
, "%sTotal number of prefixes %ld%s",
5775 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
5781 bgp_show (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
5782 enum bgp_show_type type
, void *output_arg
)
5784 struct bgp_table
*table
;
5787 bgp
= bgp_get_default ();
5792 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
5797 table
= bgp
->rib
[afi
][safi
];
5799 return bgp_show_table (vty
, table
, &bgp
->router_id
, type
, output_arg
);
5802 /* Header of detailed BGP route information */
5804 route_vty_out_detail_header (struct vty
*vty
, struct bgp
*bgp
,
5805 struct bgp_node
*rn
,
5806 struct prefix_rd
*prd
, afi_t afi
, safi_t safi
)
5808 struct bgp_info
*ri
;
5811 struct listnode
*node
, *nnode
;
5812 char buf1
[INET6_ADDRSTRLEN
];
5813 char buf2
[INET6_ADDRSTRLEN
];
5818 int no_advertise
= 0;
5823 vty_out (vty
, "BGP routing table entry for %s%s%s/%d%s",
5824 (safi
== SAFI_MPLS_VPN
?
5825 prefix_rd2str (prd
, buf1
, RD_ADDRSTRLEN
) : ""),
5826 safi
== SAFI_MPLS_VPN
? ":" : "",
5827 inet_ntop (p
->family
, &p
->u
.prefix
, buf2
, INET6_ADDRSTRLEN
),
5828 p
->prefixlen
, VTY_NEWLINE
);
5830 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5833 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
5838 if (ri
->attr
->community
!= NULL
)
5840 if (community_include (ri
->attr
->community
, COMMUNITY_NO_ADVERTISE
))
5842 if (community_include (ri
->attr
->community
, COMMUNITY_NO_EXPORT
))
5844 if (community_include (ri
->attr
->community
, COMMUNITY_LOCAL_AS
))
5850 vty_out (vty
, "Paths: (%d available", count
);
5853 vty_out (vty
, ", best #%d", best
);
5854 if (safi
== SAFI_UNICAST
)
5855 vty_out (vty
, ", table Default-IP-Routing-Table");
5858 vty_out (vty
, ", no best path");
5860 vty_out (vty
, ", not advertised to any peer");
5862 vty_out (vty
, ", not advertised to EBGP peer");
5864 vty_out (vty
, ", not advertised outside local AS");
5866 vty_out (vty
, ", Advertisements suppressed by an aggregate.");
5867 vty_out (vty
, ")%s", VTY_NEWLINE
);
5869 /* advertised peer */
5870 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
5872 if (bgp_adj_out_lookup (peer
, p
, afi
, safi
, rn
))
5875 vty_out (vty
, " Advertised to non peer-group peers:%s ", VTY_NEWLINE
);
5876 vty_out (vty
, " %s", sockunion2str (&peer
->su
, buf1
, SU_ADDRSTRLEN
));
5881 vty_out (vty
, " Not advertised to any peer");
5882 vty_out (vty
, "%s", VTY_NEWLINE
);
5885 /* Display specified route of BGP table. */
5887 bgp_show_route_in_table (struct vty
*vty
, struct bgp
*bgp
,
5888 struct bgp_table
*rib
, const char *ip_str
,
5889 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
5895 struct prefix match
;
5896 struct bgp_node
*rn
;
5897 struct bgp_node
*rm
;
5898 struct bgp_info
*ri
;
5899 struct bgp_table
*table
;
5901 /* Check IP address argument. */
5902 ret
= str2prefix (ip_str
, &match
);
5905 vty_out (vty
, "address is malformed%s", VTY_NEWLINE
);
5909 match
.family
= afi2family (afi
);
5911 if (safi
== SAFI_MPLS_VPN
)
5913 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
5915 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
5918 if ((table
= rn
->info
) != NULL
)
5922 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
5924 if (prefix_check
&& rm
->p
.prefixlen
!= match
.prefixlen
)
5927 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
5931 route_vty_out_detail_header (vty
, bgp
, rm
, (struct prefix_rd
*)&rn
->p
,
5932 AFI_IP
, SAFI_MPLS_VPN
);
5937 route_vty_out_detail (vty
, bgp
, &rm
->p
, ri
, AFI_IP
, SAFI_MPLS_VPN
);
5947 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
5949 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
5951 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5955 route_vty_out_detail_header (vty
, bgp
, rn
, NULL
, afi
, safi
);
5959 route_vty_out_detail (vty
, bgp
, &rn
->p
, ri
, afi
, safi
);
5967 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
5974 /* Display specified route of Main RIB */
5976 bgp_show_route (struct vty
*vty
, const char *view_name
, const char *ip_str
,
5977 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
5982 /* BGP structure lookup. */
5985 bgp
= bgp_lookup_by_name (view_name
);
5988 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
5994 bgp
= bgp_get_default ();
5997 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
6002 return bgp_show_route_in_table (vty
, bgp
, bgp
->rib
[afi
][safi
], ip_str
,
6003 afi
, safi
, prd
, prefix_check
);
6006 /* BGP route print out function. */
6014 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6017 DEFUN (show_ip_bgp_ipv4
,
6018 show_ip_bgp_ipv4_cmd
,
6019 "show ip bgp ipv4 (unicast|multicast)",
6024 "Address Family modifier\n"
6025 "Address Family modifier\n")
6027 if (strncmp (argv
[0], "m", 1) == 0)
6028 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, bgp_show_type_normal
,
6031 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6034 DEFUN (show_ip_bgp_route
,
6035 show_ip_bgp_route_cmd
,
6036 "show ip bgp A.B.C.D",
6040 "Network in the BGP routing table to display\n")
6042 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6045 DEFUN (show_ip_bgp_ipv4_route
,
6046 show_ip_bgp_ipv4_route_cmd
,
6047 "show ip bgp ipv4 (unicast|multicast) A.B.C.D",
6052 "Address Family modifier\n"
6053 "Address Family modifier\n"
6054 "Network in the BGP routing table to display\n")
6056 if (strncmp (argv
[0], "m", 1) == 0)
6057 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0);
6059 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6062 DEFUN (show_ip_bgp_vpnv4_all_route
,
6063 show_ip_bgp_vpnv4_all_route_cmd
,
6064 "show ip bgp vpnv4 all A.B.C.D",
6068 "Display VPNv4 NLRI specific information\n"
6069 "Display information about all VPNv4 NLRIs\n"
6070 "Network in the BGP routing table to display\n")
6072 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 0);
6075 DEFUN (show_ip_bgp_vpnv4_rd_route
,
6076 show_ip_bgp_vpnv4_rd_route_cmd
,
6077 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D",
6081 "Display VPNv4 NLRI specific information\n"
6082 "Display information for a route distinguisher\n"
6083 "VPN Route Distinguisher\n"
6084 "Network in the BGP routing table to display\n")
6087 struct prefix_rd prd
;
6089 ret
= str2prefix_rd (argv
[0], &prd
);
6092 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
6095 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 0);
6098 DEFUN (show_ip_bgp_prefix
,
6099 show_ip_bgp_prefix_cmd
,
6100 "show ip bgp A.B.C.D/M",
6104 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6106 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6109 DEFUN (show_ip_bgp_ipv4_prefix
,
6110 show_ip_bgp_ipv4_prefix_cmd
,
6111 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M",
6116 "Address Family modifier\n"
6117 "Address Family modifier\n"
6118 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6120 if (strncmp (argv
[0], "m", 1) == 0)
6121 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1);
6123 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6126 DEFUN (show_ip_bgp_vpnv4_all_prefix
,
6127 show_ip_bgp_vpnv4_all_prefix_cmd
,
6128 "show ip bgp vpnv4 all A.B.C.D/M",
6132 "Display VPNv4 NLRI specific information\n"
6133 "Display information about all VPNv4 NLRIs\n"
6134 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6136 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 1);
6139 DEFUN (show_ip_bgp_vpnv4_rd_prefix
,
6140 show_ip_bgp_vpnv4_rd_prefix_cmd
,
6141 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M",
6145 "Display VPNv4 NLRI specific information\n"
6146 "Display information for a route distinguisher\n"
6147 "VPN Route Distinguisher\n"
6148 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6151 struct prefix_rd prd
;
6153 ret
= str2prefix_rd (argv
[0], &prd
);
6156 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
6159 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 1);
6162 DEFUN (show_ip_bgp_view
,
6163 show_ip_bgp_view_cmd
,
6164 "show ip bgp view WORD",
6173 /* BGP structure lookup. */
6174 bgp
= bgp_lookup_by_name (argv
[0]);
6177 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
6181 return bgp_show (vty
, bgp
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6184 DEFUN (show_ip_bgp_view_route
,
6185 show_ip_bgp_view_route_cmd
,
6186 "show ip bgp view WORD A.B.C.D",
6192 "Network in the BGP routing table to display\n")
6194 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6197 DEFUN (show_ip_bgp_view_prefix
,
6198 show_ip_bgp_view_prefix_cmd
,
6199 "show ip bgp view WORD A.B.C.D/M",
6205 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6207 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6217 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
6229 DEFUN (show_ipv6_bgp
,
6236 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
6240 DEFUN (show_bgp_route
,
6242 "show bgp X:X::X:X",
6245 "Network in the BGP routing table to display\n")
6247 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6250 ALIAS (show_bgp_route
,
6251 show_bgp_ipv6_route_cmd
,
6252 "show bgp ipv6 X:X::X:X",
6256 "Network in the BGP routing table to display\n")
6259 DEFUN (show_ipv6_bgp_route
,
6260 show_ipv6_bgp_route_cmd
,
6261 "show ipv6 bgp X:X::X:X",
6265 "Network in the BGP routing table to display\n")
6267 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6270 DEFUN (show_bgp_prefix
,
6271 show_bgp_prefix_cmd
,
6272 "show bgp X:X::X:X/M",
6275 "IPv6 prefix <network>/<length>\n")
6277 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6280 ALIAS (show_bgp_prefix
,
6281 show_bgp_ipv6_prefix_cmd
,
6282 "show bgp ipv6 X:X::X:X/M",
6286 "IPv6 prefix <network>/<length>\n")
6289 DEFUN (show_ipv6_bgp_prefix
,
6290 show_ipv6_bgp_prefix_cmd
,
6291 "show ipv6 bgp X:X::X:X/M",
6295 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6297 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6300 DEFUN (show_bgp_view
,
6302 "show bgp view WORD",
6310 /* BGP structure lookup. */
6311 bgp
= bgp_lookup_by_name (argv
[0]);
6314 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
6318 return bgp_show (vty
, bgp
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6321 ALIAS (show_bgp_view
,
6322 show_bgp_view_ipv6_cmd
,
6323 "show bgp view WORD ipv6",
6330 DEFUN (show_bgp_view_route
,
6331 show_bgp_view_route_cmd
,
6332 "show bgp view WORD X:X::X:X",
6337 "Network in the BGP routing table to display\n")
6339 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6342 ALIAS (show_bgp_view_route
,
6343 show_bgp_view_ipv6_route_cmd
,
6344 "show bgp view WORD ipv6 X:X::X:X",
6350 "Network in the BGP routing table to display\n")
6352 DEFUN (show_bgp_view_prefix
,
6353 show_bgp_view_prefix_cmd
,
6354 "show bgp view WORD X:X::X:X/M",
6359 "IPv6 prefix <network>/<length>\n")
6361 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6364 ALIAS (show_bgp_view_prefix
,
6365 show_bgp_view_ipv6_prefix_cmd
,
6366 "show bgp view WORD ipv6 X:X::X:X/M",
6372 "IPv6 prefix <network>/<length>\n")
6375 DEFUN (show_ipv6_mbgp
,
6382 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
6387 DEFUN (show_ipv6_mbgp_route
,
6388 show_ipv6_mbgp_route_cmd
,
6389 "show ipv6 mbgp X:X::X:X",
6393 "Network in the MBGP routing table to display\n")
6395 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0);
6399 DEFUN (show_ipv6_mbgp_prefix
,
6400 show_ipv6_mbgp_prefix_cmd
,
6401 "show ipv6 mbgp X:X::X:X/M",
6405 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6407 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1);
6413 bgp_show_regexp (struct vty
*vty
, int argc
, const char **argv
, afi_t afi
,
6414 safi_t safi
, enum bgp_show_type type
)
6424 b
= buffer_new (1024);
6425 for (i
= 0; i
< argc
; i
++)
6428 buffer_putc (b
, ' ');
6431 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
6436 buffer_putstr (b
, argv
[i
]);
6438 buffer_putc (b
, '\0');
6440 regstr
= buffer_getstr (b
);
6443 regex
= bgp_regcomp (regstr
);
6444 XFREE(MTYPE_TMP
, regstr
);
6447 vty_out (vty
, "Can't compile regexp %s%s", argv
[0],
6452 rc
= bgp_show (vty
, NULL
, afi
, safi
, type
, regex
);
6453 bgp_regex_free (regex
);
6457 DEFUN (show_ip_bgp_regexp
,
6458 show_ip_bgp_regexp_cmd
,
6459 "show ip bgp regexp .LINE",
6463 "Display routes matching the AS path regular expression\n"
6464 "A regular-expression to match the BGP AS paths\n")
6466 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
6467 bgp_show_type_regexp
);
6470 DEFUN (show_ip_bgp_flap_regexp
,
6471 show_ip_bgp_flap_regexp_cmd
,
6472 "show ip bgp flap-statistics regexp .LINE",
6476 "Display flap statistics of routes\n"
6477 "Display routes matching the AS path regular expression\n"
6478 "A regular-expression to match the BGP AS paths\n")
6480 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
6481 bgp_show_type_flap_regexp
);
6484 DEFUN (show_ip_bgp_ipv4_regexp
,
6485 show_ip_bgp_ipv4_regexp_cmd
,
6486 "show ip bgp ipv4 (unicast|multicast) regexp .LINE",
6491 "Address Family modifier\n"
6492 "Address Family modifier\n"
6493 "Display routes matching the AS path regular expression\n"
6494 "A regular-expression to match the BGP AS paths\n")
6496 if (strncmp (argv
[0], "m", 1) == 0)
6497 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_MULTICAST
,
6498 bgp_show_type_regexp
);
6500 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
6501 bgp_show_type_regexp
);
6505 DEFUN (show_bgp_regexp
,
6506 show_bgp_regexp_cmd
,
6507 "show bgp regexp .LINE",
6510 "Display routes matching the AS path regular expression\n"
6511 "A regular-expression to match the BGP AS paths\n")
6513 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
6514 bgp_show_type_regexp
);
6517 ALIAS (show_bgp_regexp
,
6518 show_bgp_ipv6_regexp_cmd
,
6519 "show bgp ipv6 regexp .LINE",
6523 "Display routes matching the AS path regular expression\n"
6524 "A regular-expression to match the BGP AS paths\n")
6527 DEFUN (show_ipv6_bgp_regexp
,
6528 show_ipv6_bgp_regexp_cmd
,
6529 "show ipv6 bgp regexp .LINE",
6533 "Display routes matching the AS path regular expression\n"
6534 "A regular-expression to match the BGP AS paths\n")
6536 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
6537 bgp_show_type_regexp
);
6541 DEFUN (show_ipv6_mbgp_regexp
,
6542 show_ipv6_mbgp_regexp_cmd
,
6543 "show ipv6 mbgp regexp .LINE",
6547 "Display routes matching the AS path regular expression\n"
6548 "A regular-expression to match the MBGP AS paths\n")
6550 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_MULTICAST
,
6551 bgp_show_type_regexp
);
6553 #endif /* HAVE_IPV6 */
6556 bgp_show_prefix_list (struct vty
*vty
, const char *prefix_list_str
, afi_t afi
,
6557 safi_t safi
, enum bgp_show_type type
)
6559 struct prefix_list
*plist
;
6561 plist
= prefix_list_lookup (afi
, prefix_list_str
);
6564 vty_out (vty
, "%% %s is not a valid prefix-list name%s",
6565 prefix_list_str
, VTY_NEWLINE
);
6569 return bgp_show (vty
, NULL
, afi
, safi
, type
, plist
);
6572 DEFUN (show_ip_bgp_prefix_list
,
6573 show_ip_bgp_prefix_list_cmd
,
6574 "show ip bgp prefix-list WORD",
6578 "Display routes conforming to the prefix-list\n"
6579 "IP prefix-list name\n")
6581 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6582 bgp_show_type_prefix_list
);
6585 DEFUN (show_ip_bgp_flap_prefix_list
,
6586 show_ip_bgp_flap_prefix_list_cmd
,
6587 "show ip bgp flap-statistics prefix-list WORD",
6591 "Display flap statistics of routes\n"
6592 "Display routes conforming to the prefix-list\n"
6593 "IP prefix-list name\n")
6595 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6596 bgp_show_type_flap_prefix_list
);
6599 DEFUN (show_ip_bgp_ipv4_prefix_list
,
6600 show_ip_bgp_ipv4_prefix_list_cmd
,
6601 "show ip bgp ipv4 (unicast|multicast) prefix-list WORD",
6606 "Address Family modifier\n"
6607 "Address Family modifier\n"
6608 "Display routes conforming to the prefix-list\n"
6609 "IP prefix-list name\n")
6611 if (strncmp (argv
[0], "m", 1) == 0)
6612 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
6613 bgp_show_type_prefix_list
);
6615 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
6616 bgp_show_type_prefix_list
);
6620 DEFUN (show_bgp_prefix_list
,
6621 show_bgp_prefix_list_cmd
,
6622 "show bgp prefix-list WORD",
6625 "Display routes conforming to the prefix-list\n"
6626 "IPv6 prefix-list name\n")
6628 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6629 bgp_show_type_prefix_list
);
6632 ALIAS (show_bgp_prefix_list
,
6633 show_bgp_ipv6_prefix_list_cmd
,
6634 "show bgp ipv6 prefix-list WORD",
6638 "Display routes conforming to the prefix-list\n"
6639 "IPv6 prefix-list name\n")
6642 DEFUN (show_ipv6_bgp_prefix_list
,
6643 show_ipv6_bgp_prefix_list_cmd
,
6644 "show ipv6 bgp prefix-list WORD",
6648 "Display routes matching the prefix-list\n"
6649 "IPv6 prefix-list name\n")
6651 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6652 bgp_show_type_prefix_list
);
6656 DEFUN (show_ipv6_mbgp_prefix_list
,
6657 show_ipv6_mbgp_prefix_list_cmd
,
6658 "show ipv6 mbgp prefix-list WORD",
6662 "Display routes matching the prefix-list\n"
6663 "IPv6 prefix-list name\n")
6665 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
6666 bgp_show_type_prefix_list
);
6668 #endif /* HAVE_IPV6 */
6671 bgp_show_filter_list (struct vty
*vty
, const char *filter
, afi_t afi
,
6672 safi_t safi
, enum bgp_show_type type
)
6674 struct as_list
*as_list
;
6676 as_list
= as_list_lookup (filter
);
6677 if (as_list
== NULL
)
6679 vty_out (vty
, "%% %s is not a valid AS-path access-list name%s", filter
, VTY_NEWLINE
);
6683 return bgp_show (vty
, NULL
, afi
, safi
, type
, as_list
);
6686 DEFUN (show_ip_bgp_filter_list
,
6687 show_ip_bgp_filter_list_cmd
,
6688 "show ip bgp filter-list WORD",
6692 "Display routes conforming to the filter-list\n"
6693 "Regular expression access list name\n")
6695 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6696 bgp_show_type_filter_list
);
6699 DEFUN (show_ip_bgp_flap_filter_list
,
6700 show_ip_bgp_flap_filter_list_cmd
,
6701 "show ip bgp flap-statistics filter-list WORD",
6705 "Display flap statistics of routes\n"
6706 "Display routes conforming to the filter-list\n"
6707 "Regular expression access list name\n")
6709 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6710 bgp_show_type_flap_filter_list
);
6713 DEFUN (show_ip_bgp_ipv4_filter_list
,
6714 show_ip_bgp_ipv4_filter_list_cmd
,
6715 "show ip bgp ipv4 (unicast|multicast) filter-list WORD",
6720 "Address Family modifier\n"
6721 "Address Family modifier\n"
6722 "Display routes conforming to the filter-list\n"
6723 "Regular expression access list name\n")
6725 if (strncmp (argv
[0], "m", 1) == 0)
6726 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
6727 bgp_show_type_filter_list
);
6729 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
6730 bgp_show_type_filter_list
);
6734 DEFUN (show_bgp_filter_list
,
6735 show_bgp_filter_list_cmd
,
6736 "show bgp filter-list WORD",
6739 "Display routes conforming to the filter-list\n"
6740 "Regular expression access list name\n")
6742 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6743 bgp_show_type_filter_list
);
6746 ALIAS (show_bgp_filter_list
,
6747 show_bgp_ipv6_filter_list_cmd
,
6748 "show bgp ipv6 filter-list WORD",
6752 "Display routes conforming to the filter-list\n"
6753 "Regular expression access list name\n")
6756 DEFUN (show_ipv6_bgp_filter_list
,
6757 show_ipv6_bgp_filter_list_cmd
,
6758 "show ipv6 bgp filter-list WORD",
6762 "Display routes conforming to the filter-list\n"
6763 "Regular expression access list name\n")
6765 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6766 bgp_show_type_filter_list
);
6770 DEFUN (show_ipv6_mbgp_filter_list
,
6771 show_ipv6_mbgp_filter_list_cmd
,
6772 "show ipv6 mbgp filter-list WORD",
6776 "Display routes conforming to the filter-list\n"
6777 "Regular expression access list name\n")
6779 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
6780 bgp_show_type_filter_list
);
6782 #endif /* HAVE_IPV6 */
6785 bgp_show_route_map (struct vty
*vty
, const char *rmap_str
, afi_t afi
,
6786 safi_t safi
, enum bgp_show_type type
)
6788 struct route_map
*rmap
;
6790 rmap
= route_map_lookup_by_name (rmap_str
);
6793 vty_out (vty
, "%% %s is not a valid route-map name%s",
6794 rmap_str
, VTY_NEWLINE
);
6798 return bgp_show (vty
, NULL
, afi
, safi
, type
, rmap
);
6801 DEFUN (show_ip_bgp_route_map
,
6802 show_ip_bgp_route_map_cmd
,
6803 "show ip bgp route-map WORD",
6807 "Display routes matching the route-map\n"
6808 "A route-map to match on\n")
6810 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6811 bgp_show_type_route_map
);
6814 DEFUN (show_ip_bgp_flap_route_map
,
6815 show_ip_bgp_flap_route_map_cmd
,
6816 "show ip bgp flap-statistics route-map WORD",
6820 "Display flap statistics of routes\n"
6821 "Display routes matching the route-map\n"
6822 "A route-map to match on\n")
6824 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6825 bgp_show_type_flap_route_map
);
6828 DEFUN (show_ip_bgp_ipv4_route_map
,
6829 show_ip_bgp_ipv4_route_map_cmd
,
6830 "show ip bgp ipv4 (unicast|multicast) route-map WORD",
6835 "Address Family modifier\n"
6836 "Address Family modifier\n"
6837 "Display routes matching the route-map\n"
6838 "A route-map to match on\n")
6840 if (strncmp (argv
[0], "m", 1) == 0)
6841 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
6842 bgp_show_type_route_map
);
6844 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
6845 bgp_show_type_route_map
);
6848 DEFUN (show_bgp_route_map
,
6849 show_bgp_route_map_cmd
,
6850 "show bgp route-map WORD",
6853 "Display routes matching the route-map\n"
6854 "A route-map to match on\n")
6856 return bgp_show_route_map (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6857 bgp_show_type_route_map
);
6860 ALIAS (show_bgp_route_map
,
6861 show_bgp_ipv6_route_map_cmd
,
6862 "show bgp ipv6 route-map WORD",
6866 "Display routes matching the route-map\n"
6867 "A route-map to match on\n")
6869 DEFUN (show_ip_bgp_cidr_only
,
6870 show_ip_bgp_cidr_only_cmd
,
6871 "show ip bgp cidr-only",
6875 "Display only routes with non-natural netmasks\n")
6877 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6878 bgp_show_type_cidr_only
, NULL
);
6881 DEFUN (show_ip_bgp_flap_cidr_only
,
6882 show_ip_bgp_flap_cidr_only_cmd
,
6883 "show ip bgp flap-statistics cidr-only",
6887 "Display flap statistics of routes\n"
6888 "Display only routes with non-natural netmasks\n")
6890 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6891 bgp_show_type_flap_cidr_only
, NULL
);
6894 DEFUN (show_ip_bgp_ipv4_cidr_only
,
6895 show_ip_bgp_ipv4_cidr_only_cmd
,
6896 "show ip bgp ipv4 (unicast|multicast) cidr-only",
6901 "Address Family modifier\n"
6902 "Address Family modifier\n"
6903 "Display only routes with non-natural netmasks\n")
6905 if (strncmp (argv
[0], "m", 1) == 0)
6906 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
6907 bgp_show_type_cidr_only
, NULL
);
6909 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6910 bgp_show_type_cidr_only
, NULL
);
6913 DEFUN (show_ip_bgp_community_all
,
6914 show_ip_bgp_community_all_cmd
,
6915 "show ip bgp community",
6919 "Display routes matching the communities\n")
6921 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6922 bgp_show_type_community_all
, NULL
);
6925 DEFUN (show_ip_bgp_ipv4_community_all
,
6926 show_ip_bgp_ipv4_community_all_cmd
,
6927 "show ip bgp ipv4 (unicast|multicast) community",
6932 "Address Family modifier\n"
6933 "Address Family modifier\n"
6934 "Display routes matching the communities\n")
6936 if (strncmp (argv
[0], "m", 1) == 0)
6937 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
6938 bgp_show_type_community_all
, NULL
);
6940 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6941 bgp_show_type_community_all
, NULL
);
6945 DEFUN (show_bgp_community_all
,
6946 show_bgp_community_all_cmd
,
6947 "show bgp community",
6950 "Display routes matching the communities\n")
6952 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
6953 bgp_show_type_community_all
, NULL
);
6956 ALIAS (show_bgp_community_all
,
6957 show_bgp_ipv6_community_all_cmd
,
6958 "show bgp ipv6 community",
6962 "Display routes matching the communities\n")
6965 DEFUN (show_ipv6_bgp_community_all
,
6966 show_ipv6_bgp_community_all_cmd
,
6967 "show ipv6 bgp community",
6971 "Display routes matching the communities\n")
6973 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
6974 bgp_show_type_community_all
, NULL
);
6978 DEFUN (show_ipv6_mbgp_community_all
,
6979 show_ipv6_mbgp_community_all_cmd
,
6980 "show ipv6 mbgp community",
6984 "Display routes matching the communities\n")
6986 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
,
6987 bgp_show_type_community_all
, NULL
);
6989 #endif /* HAVE_IPV6 */
6992 bgp_show_community (struct vty
*vty
, int argc
, const char **argv
, int exact
,
6993 u_int16_t afi
, u_char safi
)
6995 struct community
*com
;
7001 b
= buffer_new (1024);
7002 for (i
= 0; i
< argc
; i
++)
7005 buffer_putc (b
, ' ');
7008 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
7013 buffer_putstr (b
, argv
[i
]);
7015 buffer_putc (b
, '\0');
7017 str
= buffer_getstr (b
);
7020 com
= community_str2com (str
);
7021 XFREE (MTYPE_TMP
, str
);
7024 vty_out (vty
, "%% Community malformed: %s", VTY_NEWLINE
);
7028 return bgp_show (vty
, NULL
, afi
, safi
,
7029 (exact
? bgp_show_type_community_exact
:
7030 bgp_show_type_community
), com
);
7033 DEFUN (show_ip_bgp_community
,
7034 show_ip_bgp_community_cmd
,
7035 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export)",
7039 "Display routes matching the communities\n"
7040 "community number\n"
7041 "Do not send outside local AS (well-known community)\n"
7042 "Do not advertise to any peer (well-known community)\n"
7043 "Do not export to next AS (well-known community)\n")
7045 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
7048 ALIAS (show_ip_bgp_community
,
7049 show_ip_bgp_community2_cmd
,
7050 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7054 "Display routes matching the communities\n"
7055 "community number\n"
7056 "Do not send outside local AS (well-known community)\n"
7057 "Do not advertise to any peer (well-known community)\n"
7058 "Do not export to next AS (well-known community)\n"
7059 "community number\n"
7060 "Do not send outside local AS (well-known community)\n"
7061 "Do not advertise to any peer (well-known community)\n"
7062 "Do not export to next AS (well-known community)\n")
7064 ALIAS (show_ip_bgp_community
,
7065 show_ip_bgp_community3_cmd
,
7066 "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)",
7070 "Display routes matching the communities\n"
7071 "community number\n"
7072 "Do not send outside local AS (well-known community)\n"
7073 "Do not advertise to any peer (well-known community)\n"
7074 "Do not export to next AS (well-known community)\n"
7075 "community number\n"
7076 "Do not send outside local AS (well-known community)\n"
7077 "Do not advertise to any peer (well-known community)\n"
7078 "Do not export to next AS (well-known community)\n"
7079 "community number\n"
7080 "Do not send outside local AS (well-known community)\n"
7081 "Do not advertise to any peer (well-known community)\n"
7082 "Do not export to next AS (well-known community)\n")
7084 ALIAS (show_ip_bgp_community
,
7085 show_ip_bgp_community4_cmd
,
7086 "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)",
7090 "Display routes matching the communities\n"
7091 "community number\n"
7092 "Do not send outside local AS (well-known community)\n"
7093 "Do not advertise to any peer (well-known community)\n"
7094 "Do not export to next AS (well-known community)\n"
7095 "community number\n"
7096 "Do not send outside local AS (well-known community)\n"
7097 "Do not advertise to any peer (well-known community)\n"
7098 "Do not export to next AS (well-known community)\n"
7099 "community number\n"
7100 "Do not send outside local AS (well-known community)\n"
7101 "Do not advertise to any peer (well-known community)\n"
7102 "Do not export to next AS (well-known community)\n"
7103 "community number\n"
7104 "Do not send outside local AS (well-known community)\n"
7105 "Do not advertise to any peer (well-known community)\n"
7106 "Do not export to next AS (well-known community)\n")
7108 DEFUN (show_ip_bgp_ipv4_community
,
7109 show_ip_bgp_ipv4_community_cmd
,
7110 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
7115 "Address Family modifier\n"
7116 "Address Family modifier\n"
7117 "Display routes matching the communities\n"
7118 "community number\n"
7119 "Do not send outside local AS (well-known community)\n"
7120 "Do not advertise to any peer (well-known community)\n"
7121 "Do not export to next AS (well-known community)\n")
7123 if (strncmp (argv
[0], "m", 1) == 0)
7124 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_MULTICAST
);
7126 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
7129 ALIAS (show_ip_bgp_ipv4_community
,
7130 show_ip_bgp_ipv4_community2_cmd
,
7131 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7136 "Address Family modifier\n"
7137 "Address Family modifier\n"
7138 "Display routes matching the communities\n"
7139 "community number\n"
7140 "Do not send outside local AS (well-known community)\n"
7141 "Do not advertise to any peer (well-known community)\n"
7142 "Do not export to next AS (well-known community)\n"
7143 "community number\n"
7144 "Do not send outside local AS (well-known community)\n"
7145 "Do not advertise to any peer (well-known community)\n"
7146 "Do not export to next AS (well-known community)\n")
7148 ALIAS (show_ip_bgp_ipv4_community
,
7149 show_ip_bgp_ipv4_community3_cmd
,
7150 "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)",
7155 "Address Family modifier\n"
7156 "Address Family modifier\n"
7157 "Display routes matching the communities\n"
7158 "community number\n"
7159 "Do not send outside local AS (well-known community)\n"
7160 "Do not advertise to any peer (well-known community)\n"
7161 "Do not export to next AS (well-known community)\n"
7162 "community number\n"
7163 "Do not send outside local AS (well-known community)\n"
7164 "Do not advertise to any peer (well-known community)\n"
7165 "Do not export to next AS (well-known community)\n"
7166 "community number\n"
7167 "Do not send outside local AS (well-known community)\n"
7168 "Do not advertise to any peer (well-known community)\n"
7169 "Do not export to next AS (well-known community)\n")
7171 ALIAS (show_ip_bgp_ipv4_community
,
7172 show_ip_bgp_ipv4_community4_cmd
,
7173 "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)",
7178 "Address Family modifier\n"
7179 "Address Family modifier\n"
7180 "Display routes matching the communities\n"
7181 "community number\n"
7182 "Do not send outside local AS (well-known community)\n"
7183 "Do not advertise to any peer (well-known community)\n"
7184 "Do not export to next AS (well-known community)\n"
7185 "community number\n"
7186 "Do not send outside local AS (well-known community)\n"
7187 "Do not advertise to any peer (well-known community)\n"
7188 "Do not export to next AS (well-known community)\n"
7189 "community number\n"
7190 "Do not send outside local AS (well-known community)\n"
7191 "Do not advertise to any peer (well-known community)\n"
7192 "Do not export to next AS (well-known community)\n"
7193 "community number\n"
7194 "Do not send outside local AS (well-known community)\n"
7195 "Do not advertise to any peer (well-known community)\n"
7196 "Do not export to next AS (well-known community)\n")
7198 DEFUN (show_ip_bgp_community_exact
,
7199 show_ip_bgp_community_exact_cmd
,
7200 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7204 "Display routes matching the communities\n"
7205 "community number\n"
7206 "Do not send outside local AS (well-known community)\n"
7207 "Do not advertise to any peer (well-known community)\n"
7208 "Do not export to next AS (well-known community)\n"
7209 "Exact match of the communities")
7211 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
7214 ALIAS (show_ip_bgp_community_exact
,
7215 show_ip_bgp_community2_exact_cmd
,
7216 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7220 "Display routes matching the communities\n"
7221 "community number\n"
7222 "Do not send outside local AS (well-known community)\n"
7223 "Do not advertise to any peer (well-known community)\n"
7224 "Do not export to next AS (well-known community)\n"
7225 "community number\n"
7226 "Do not send outside local AS (well-known community)\n"
7227 "Do not advertise to any peer (well-known community)\n"
7228 "Do not export to next AS (well-known community)\n"
7229 "Exact match of the communities")
7231 ALIAS (show_ip_bgp_community_exact
,
7232 show_ip_bgp_community3_exact_cmd
,
7233 "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",
7237 "Display routes matching the communities\n"
7238 "community number\n"
7239 "Do not send outside local AS (well-known community)\n"
7240 "Do not advertise to any peer (well-known community)\n"
7241 "Do not export to next AS (well-known community)\n"
7242 "community number\n"
7243 "Do not send outside local AS (well-known community)\n"
7244 "Do not advertise to any peer (well-known community)\n"
7245 "Do not export to next AS (well-known community)\n"
7246 "community number\n"
7247 "Do not send outside local AS (well-known community)\n"
7248 "Do not advertise to any peer (well-known community)\n"
7249 "Do not export to next AS (well-known community)\n"
7250 "Exact match of the communities")
7252 ALIAS (show_ip_bgp_community_exact
,
7253 show_ip_bgp_community4_exact_cmd
,
7254 "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",
7258 "Display routes matching the communities\n"
7259 "community number\n"
7260 "Do not send outside local AS (well-known community)\n"
7261 "Do not advertise to any peer (well-known community)\n"
7262 "Do not export to next AS (well-known community)\n"
7263 "community number\n"
7264 "Do not send outside local AS (well-known community)\n"
7265 "Do not advertise to any peer (well-known community)\n"
7266 "Do not export to next AS (well-known community)\n"
7267 "community number\n"
7268 "Do not send outside local AS (well-known community)\n"
7269 "Do not advertise to any peer (well-known community)\n"
7270 "Do not export to next AS (well-known community)\n"
7271 "community number\n"
7272 "Do not send outside local AS (well-known community)\n"
7273 "Do not advertise to any peer (well-known community)\n"
7274 "Do not export to next AS (well-known community)\n"
7275 "Exact match of the communities")
7277 DEFUN (show_ip_bgp_ipv4_community_exact
,
7278 show_ip_bgp_ipv4_community_exact_cmd
,
7279 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7284 "Address Family modifier\n"
7285 "Address Family modifier\n"
7286 "Display routes matching the communities\n"
7287 "community number\n"
7288 "Do not send outside local AS (well-known community)\n"
7289 "Do not advertise to any peer (well-known community)\n"
7290 "Do not export to next AS (well-known community)\n"
7291 "Exact match of the communities")
7293 if (strncmp (argv
[0], "m", 1) == 0)
7294 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_MULTICAST
);
7296 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
7299 ALIAS (show_ip_bgp_ipv4_community_exact
,
7300 show_ip_bgp_ipv4_community2_exact_cmd
,
7301 "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",
7306 "Address Family modifier\n"
7307 "Address Family modifier\n"
7308 "Display routes matching the communities\n"
7309 "community number\n"
7310 "Do not send outside local AS (well-known community)\n"
7311 "Do not advertise to any peer (well-known community)\n"
7312 "Do not export to next AS (well-known community)\n"
7313 "community number\n"
7314 "Do not send outside local AS (well-known community)\n"
7315 "Do not advertise to any peer (well-known community)\n"
7316 "Do not export to next AS (well-known community)\n"
7317 "Exact match of the communities")
7319 ALIAS (show_ip_bgp_ipv4_community_exact
,
7320 show_ip_bgp_ipv4_community3_exact_cmd
,
7321 "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",
7326 "Address Family modifier\n"
7327 "Address Family modifier\n"
7328 "Display routes matching the communities\n"
7329 "community number\n"
7330 "Do not send outside local AS (well-known community)\n"
7331 "Do not advertise to any peer (well-known community)\n"
7332 "Do not export to next AS (well-known community)\n"
7333 "community number\n"
7334 "Do not send outside local AS (well-known community)\n"
7335 "Do not advertise to any peer (well-known community)\n"
7336 "Do not export to next AS (well-known community)\n"
7337 "community number\n"
7338 "Do not send outside local AS (well-known community)\n"
7339 "Do not advertise to any peer (well-known community)\n"
7340 "Do not export to next AS (well-known community)\n"
7341 "Exact match of the communities")
7343 ALIAS (show_ip_bgp_ipv4_community_exact
,
7344 show_ip_bgp_ipv4_community4_exact_cmd
,
7345 "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",
7350 "Address Family modifier\n"
7351 "Address Family modifier\n"
7352 "Display routes matching the communities\n"
7353 "community number\n"
7354 "Do not send outside local AS (well-known community)\n"
7355 "Do not advertise to any peer (well-known community)\n"
7356 "Do not export to next AS (well-known community)\n"
7357 "community number\n"
7358 "Do not send outside local AS (well-known community)\n"
7359 "Do not advertise to any peer (well-known community)\n"
7360 "Do not export to next AS (well-known community)\n"
7361 "community number\n"
7362 "Do not send outside local AS (well-known community)\n"
7363 "Do not advertise to any peer (well-known community)\n"
7364 "Do not export to next AS (well-known community)\n"
7365 "community number\n"
7366 "Do not send outside local AS (well-known community)\n"
7367 "Do not advertise to any peer (well-known community)\n"
7368 "Do not export to next AS (well-known community)\n"
7369 "Exact match of the communities")
7372 DEFUN (show_bgp_community
,
7373 show_bgp_community_cmd
,
7374 "show bgp community (AA:NN|local-AS|no-advertise|no-export)",
7377 "Display routes matching the communities\n"
7378 "community number\n"
7379 "Do not send outside local AS (well-known community)\n"
7380 "Do not advertise to any peer (well-known community)\n"
7381 "Do not export to next AS (well-known community)\n")
7383 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
7386 ALIAS (show_bgp_community
,
7387 show_bgp_ipv6_community_cmd
,
7388 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)",
7392 "Display routes matching the communities\n"
7393 "community number\n"
7394 "Do not send outside local AS (well-known community)\n"
7395 "Do not advertise to any peer (well-known community)\n"
7396 "Do not export to next AS (well-known community)\n")
7398 ALIAS (show_bgp_community
,
7399 show_bgp_community2_cmd
,
7400 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7403 "Display routes matching the communities\n"
7404 "community number\n"
7405 "Do not send outside local AS (well-known community)\n"
7406 "Do not advertise to any peer (well-known community)\n"
7407 "Do not export to next AS (well-known community)\n"
7408 "community number\n"
7409 "Do not send outside local AS (well-known community)\n"
7410 "Do not advertise to any peer (well-known community)\n"
7411 "Do not export to next AS (well-known community)\n")
7413 ALIAS (show_bgp_community
,
7414 show_bgp_ipv6_community2_cmd
,
7415 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7419 "Display routes matching the communities\n"
7420 "community number\n"
7421 "Do not send outside local AS (well-known community)\n"
7422 "Do not advertise to any peer (well-known community)\n"
7423 "Do not export to next AS (well-known community)\n"
7424 "community number\n"
7425 "Do not send outside local AS (well-known community)\n"
7426 "Do not advertise to any peer (well-known community)\n"
7427 "Do not export to next AS (well-known community)\n")
7429 ALIAS (show_bgp_community
,
7430 show_bgp_community3_cmd
,
7431 "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)",
7434 "Display routes matching the communities\n"
7435 "community number\n"
7436 "Do not send outside local AS (well-known community)\n"
7437 "Do not advertise to any peer (well-known community)\n"
7438 "Do not export to next AS (well-known community)\n"
7439 "community number\n"
7440 "Do not send outside local AS (well-known community)\n"
7441 "Do not advertise to any peer (well-known community)\n"
7442 "Do not export to next AS (well-known community)\n"
7443 "community number\n"
7444 "Do not send outside local AS (well-known community)\n"
7445 "Do not advertise to any peer (well-known community)\n"
7446 "Do not export to next AS (well-known community)\n")
7448 ALIAS (show_bgp_community
,
7449 show_bgp_ipv6_community3_cmd
,
7450 "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)",
7454 "Display routes matching the communities\n"
7455 "community number\n"
7456 "Do not send outside local AS (well-known community)\n"
7457 "Do not advertise to any peer (well-known community)\n"
7458 "Do not export to next AS (well-known community)\n"
7459 "community number\n"
7460 "Do not send outside local AS (well-known community)\n"
7461 "Do not advertise to any peer (well-known community)\n"
7462 "Do not export to next AS (well-known community)\n"
7463 "community number\n"
7464 "Do not send outside local AS (well-known community)\n"
7465 "Do not advertise to any peer (well-known community)\n"
7466 "Do not export to next AS (well-known community)\n")
7468 ALIAS (show_bgp_community
,
7469 show_bgp_community4_cmd
,
7470 "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)",
7473 "Display routes matching the communities\n"
7474 "community number\n"
7475 "Do not send outside local AS (well-known community)\n"
7476 "Do not advertise to any peer (well-known community)\n"
7477 "Do not export to next AS (well-known community)\n"
7478 "community number\n"
7479 "Do not send outside local AS (well-known community)\n"
7480 "Do not advertise to any peer (well-known community)\n"
7481 "Do not export to next AS (well-known community)\n"
7482 "community number\n"
7483 "Do not send outside local AS (well-known community)\n"
7484 "Do not advertise to any peer (well-known community)\n"
7485 "Do not export to next AS (well-known community)\n"
7486 "community number\n"
7487 "Do not send outside local AS (well-known community)\n"
7488 "Do not advertise to any peer (well-known community)\n"
7489 "Do not export to next AS (well-known community)\n")
7491 ALIAS (show_bgp_community
,
7492 show_bgp_ipv6_community4_cmd
,
7493 "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)",
7497 "Display routes matching the communities\n"
7498 "community number\n"
7499 "Do not send outside local AS (well-known community)\n"
7500 "Do not advertise to any peer (well-known community)\n"
7501 "Do not export to next AS (well-known community)\n"
7502 "community number\n"
7503 "Do not send outside local AS (well-known community)\n"
7504 "Do not advertise to any peer (well-known community)\n"
7505 "Do not export to next AS (well-known community)\n"
7506 "community number\n"
7507 "Do not send outside local AS (well-known community)\n"
7508 "Do not advertise to any peer (well-known community)\n"
7509 "Do not export to next AS (well-known community)\n"
7510 "community number\n"
7511 "Do not send outside local AS (well-known community)\n"
7512 "Do not advertise to any peer (well-known community)\n"
7513 "Do not export to next AS (well-known community)\n")
7516 DEFUN (show_ipv6_bgp_community
,
7517 show_ipv6_bgp_community_cmd
,
7518 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export)",
7522 "Display routes matching the communities\n"
7523 "community number\n"
7524 "Do not send outside local AS (well-known community)\n"
7525 "Do not advertise to any peer (well-known community)\n"
7526 "Do not export to next AS (well-known community)\n")
7528 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
7532 ALIAS (show_ipv6_bgp_community
,
7533 show_ipv6_bgp_community2_cmd
,
7534 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7538 "Display routes matching the communities\n"
7539 "community number\n"
7540 "Do not send outside local AS (well-known community)\n"
7541 "Do not advertise to any peer (well-known community)\n"
7542 "Do not export to next AS (well-known community)\n"
7543 "community number\n"
7544 "Do not send outside local AS (well-known community)\n"
7545 "Do not advertise to any peer (well-known community)\n"
7546 "Do not export to next AS (well-known community)\n")
7549 ALIAS (show_ipv6_bgp_community
,
7550 show_ipv6_bgp_community3_cmd
,
7551 "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)",
7555 "Display routes matching the communities\n"
7556 "community number\n"
7557 "Do not send outside local AS (well-known community)\n"
7558 "Do not advertise to any peer (well-known community)\n"
7559 "Do not export to next AS (well-known community)\n"
7560 "community number\n"
7561 "Do not send outside local AS (well-known community)\n"
7562 "Do not advertise to any peer (well-known community)\n"
7563 "Do not export to next AS (well-known community)\n"
7564 "community number\n"
7565 "Do not send outside local AS (well-known community)\n"
7566 "Do not advertise to any peer (well-known community)\n"
7567 "Do not export to next AS (well-known community)\n")
7570 ALIAS (show_ipv6_bgp_community
,
7571 show_ipv6_bgp_community4_cmd
,
7572 "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)",
7576 "Display routes matching the communities\n"
7577 "community number\n"
7578 "Do not send outside local AS (well-known community)\n"
7579 "Do not advertise to any peer (well-known community)\n"
7580 "Do not export to next AS (well-known community)\n"
7581 "community number\n"
7582 "Do not send outside local AS (well-known community)\n"
7583 "Do not advertise to any peer (well-known community)\n"
7584 "Do not export to next AS (well-known community)\n"
7585 "community number\n"
7586 "Do not send outside local AS (well-known community)\n"
7587 "Do not advertise to any peer (well-known community)\n"
7588 "Do not export to next AS (well-known community)\n"
7589 "community number\n"
7590 "Do not send outside local AS (well-known community)\n"
7591 "Do not advertise to any peer (well-known community)\n"
7592 "Do not export to next AS (well-known community)\n")
7594 DEFUN (show_bgp_community_exact
,
7595 show_bgp_community_exact_cmd
,
7596 "show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7599 "Display routes matching the communities\n"
7600 "community number\n"
7601 "Do not send outside local AS (well-known community)\n"
7602 "Do not advertise to any peer (well-known community)\n"
7603 "Do not export to next AS (well-known community)\n"
7604 "Exact match of the communities")
7606 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
7609 ALIAS (show_bgp_community_exact
,
7610 show_bgp_ipv6_community_exact_cmd
,
7611 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7615 "Display routes matching the communities\n"
7616 "community number\n"
7617 "Do not send outside local AS (well-known community)\n"
7618 "Do not advertise to any peer (well-known community)\n"
7619 "Do not export to next AS (well-known community)\n"
7620 "Exact match of the communities")
7622 ALIAS (show_bgp_community_exact
,
7623 show_bgp_community2_exact_cmd
,
7624 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7627 "Display routes matching the communities\n"
7628 "community number\n"
7629 "Do not send outside local AS (well-known community)\n"
7630 "Do not advertise to any peer (well-known community)\n"
7631 "Do not export to next AS (well-known community)\n"
7632 "community number\n"
7633 "Do not send outside local AS (well-known community)\n"
7634 "Do not advertise to any peer (well-known community)\n"
7635 "Do not export to next AS (well-known community)\n"
7636 "Exact match of the communities")
7638 ALIAS (show_bgp_community_exact
,
7639 show_bgp_ipv6_community2_exact_cmd
,
7640 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7644 "Display routes matching the communities\n"
7645 "community number\n"
7646 "Do not send outside local AS (well-known community)\n"
7647 "Do not advertise to any peer (well-known community)\n"
7648 "Do not export to next AS (well-known community)\n"
7649 "community number\n"
7650 "Do not send outside local AS (well-known community)\n"
7651 "Do not advertise to any peer (well-known community)\n"
7652 "Do not export to next AS (well-known community)\n"
7653 "Exact match of the communities")
7655 ALIAS (show_bgp_community_exact
,
7656 show_bgp_community3_exact_cmd
,
7657 "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",
7660 "Display routes matching the communities\n"
7661 "community number\n"
7662 "Do not send outside local AS (well-known community)\n"
7663 "Do not advertise to any peer (well-known community)\n"
7664 "Do not export to next AS (well-known community)\n"
7665 "community number\n"
7666 "Do not send outside local AS (well-known community)\n"
7667 "Do not advertise to any peer (well-known community)\n"
7668 "Do not export to next AS (well-known community)\n"
7669 "community number\n"
7670 "Do not send outside local AS (well-known community)\n"
7671 "Do not advertise to any peer (well-known community)\n"
7672 "Do not export to next AS (well-known community)\n"
7673 "Exact match of the communities")
7675 ALIAS (show_bgp_community_exact
,
7676 show_bgp_ipv6_community3_exact_cmd
,
7677 "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",
7681 "Display routes matching the communities\n"
7682 "community number\n"
7683 "Do not send outside local AS (well-known community)\n"
7684 "Do not advertise to any peer (well-known community)\n"
7685 "Do not export to next AS (well-known community)\n"
7686 "community number\n"
7687 "Do not send outside local AS (well-known community)\n"
7688 "Do not advertise to any peer (well-known community)\n"
7689 "Do not export to next AS (well-known community)\n"
7690 "community number\n"
7691 "Do not send outside local AS (well-known community)\n"
7692 "Do not advertise to any peer (well-known community)\n"
7693 "Do not export to next AS (well-known community)\n"
7694 "Exact match of the communities")
7696 ALIAS (show_bgp_community_exact
,
7697 show_bgp_community4_exact_cmd
,
7698 "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",
7701 "Display routes matching the communities\n"
7702 "community number\n"
7703 "Do not send outside local AS (well-known community)\n"
7704 "Do not advertise to any peer (well-known community)\n"
7705 "Do not export to next AS (well-known community)\n"
7706 "community number\n"
7707 "Do not send outside local AS (well-known community)\n"
7708 "Do not advertise to any peer (well-known community)\n"
7709 "Do not export to next AS (well-known community)\n"
7710 "community number\n"
7711 "Do not send outside local AS (well-known community)\n"
7712 "Do not advertise to any peer (well-known community)\n"
7713 "Do not export to next AS (well-known community)\n"
7714 "community number\n"
7715 "Do not send outside local AS (well-known community)\n"
7716 "Do not advertise to any peer (well-known community)\n"
7717 "Do not export to next AS (well-known community)\n"
7718 "Exact match of the communities")
7720 ALIAS (show_bgp_community_exact
,
7721 show_bgp_ipv6_community4_exact_cmd
,
7722 "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",
7726 "Display routes matching the communities\n"
7727 "community number\n"
7728 "Do not send outside local AS (well-known community)\n"
7729 "Do not advertise to any peer (well-known community)\n"
7730 "Do not export to next AS (well-known community)\n"
7731 "community number\n"
7732 "Do not send outside local AS (well-known community)\n"
7733 "Do not advertise to any peer (well-known community)\n"
7734 "Do not export to next AS (well-known community)\n"
7735 "community number\n"
7736 "Do not send outside local AS (well-known community)\n"
7737 "Do not advertise to any peer (well-known community)\n"
7738 "Do not export to next AS (well-known community)\n"
7739 "community number\n"
7740 "Do not send outside local AS (well-known community)\n"
7741 "Do not advertise to any peer (well-known community)\n"
7742 "Do not export to next AS (well-known community)\n"
7743 "Exact match of the communities")
7746 DEFUN (show_ipv6_bgp_community_exact
,
7747 show_ipv6_bgp_community_exact_cmd
,
7748 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7752 "Display routes matching the communities\n"
7753 "community number\n"
7754 "Do not send outside local AS (well-known community)\n"
7755 "Do not advertise to any peer (well-known community)\n"
7756 "Do not export to next AS (well-known community)\n"
7757 "Exact match of the communities")
7759 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
7763 ALIAS (show_ipv6_bgp_community_exact
,
7764 show_ipv6_bgp_community2_exact_cmd
,
7765 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7769 "Display routes matching the communities\n"
7770 "community number\n"
7771 "Do not send outside local AS (well-known community)\n"
7772 "Do not advertise to any peer (well-known community)\n"
7773 "Do not export to next AS (well-known community)\n"
7774 "community number\n"
7775 "Do not send outside local AS (well-known community)\n"
7776 "Do not advertise to any peer (well-known community)\n"
7777 "Do not export to next AS (well-known community)\n"
7778 "Exact match of the communities")
7781 ALIAS (show_ipv6_bgp_community_exact
,
7782 show_ipv6_bgp_community3_exact_cmd
,
7783 "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",
7787 "Display routes matching the communities\n"
7788 "community number\n"
7789 "Do not send outside local AS (well-known community)\n"
7790 "Do not advertise to any peer (well-known community)\n"
7791 "Do not export to next AS (well-known community)\n"
7792 "community number\n"
7793 "Do not send outside local AS (well-known community)\n"
7794 "Do not advertise to any peer (well-known community)\n"
7795 "Do not export to next AS (well-known community)\n"
7796 "community number\n"
7797 "Do not send outside local AS (well-known community)\n"
7798 "Do not advertise to any peer (well-known community)\n"
7799 "Do not export to next AS (well-known community)\n"
7800 "Exact match of the communities")
7803 ALIAS (show_ipv6_bgp_community_exact
,
7804 show_ipv6_bgp_community4_exact_cmd
,
7805 "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",
7809 "Display routes matching the communities\n"
7810 "community number\n"
7811 "Do not send outside local AS (well-known community)\n"
7812 "Do not advertise to any peer (well-known community)\n"
7813 "Do not export to next AS (well-known community)\n"
7814 "community number\n"
7815 "Do not send outside local AS (well-known community)\n"
7816 "Do not advertise to any peer (well-known community)\n"
7817 "Do not export to next AS (well-known community)\n"
7818 "community number\n"
7819 "Do not send outside local AS (well-known community)\n"
7820 "Do not advertise to any peer (well-known community)\n"
7821 "Do not export to next AS (well-known community)\n"
7822 "community number\n"
7823 "Do not send outside local AS (well-known community)\n"
7824 "Do not advertise to any peer (well-known community)\n"
7825 "Do not export to next AS (well-known community)\n"
7826 "Exact match of the communities")
7829 DEFUN (show_ipv6_mbgp_community
,
7830 show_ipv6_mbgp_community_cmd
,
7831 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export)",
7835 "Display routes matching the communities\n"
7836 "community number\n"
7837 "Do not send outside local AS (well-known community)\n"
7838 "Do not advertise to any peer (well-known community)\n"
7839 "Do not export to next AS (well-known community)\n")
7841 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_MULTICAST
);
7845 ALIAS (show_ipv6_mbgp_community
,
7846 show_ipv6_mbgp_community2_cmd
,
7847 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7851 "Display routes matching the communities\n"
7852 "community number\n"
7853 "Do not send outside local AS (well-known community)\n"
7854 "Do not advertise to any peer (well-known community)\n"
7855 "Do not export to next AS (well-known community)\n"
7856 "community number\n"
7857 "Do not send outside local AS (well-known community)\n"
7858 "Do not advertise to any peer (well-known community)\n"
7859 "Do not export to next AS (well-known community)\n")
7862 ALIAS (show_ipv6_mbgp_community
,
7863 show_ipv6_mbgp_community3_cmd
,
7864 "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)",
7868 "Display routes matching the communities\n"
7869 "community number\n"
7870 "Do not send outside local AS (well-known community)\n"
7871 "Do not advertise to any peer (well-known community)\n"
7872 "Do not export to next AS (well-known community)\n"
7873 "community number\n"
7874 "Do not send outside local AS (well-known community)\n"
7875 "Do not advertise to any peer (well-known community)\n"
7876 "Do not export to next AS (well-known community)\n"
7877 "community number\n"
7878 "Do not send outside local AS (well-known community)\n"
7879 "Do not advertise to any peer (well-known community)\n"
7880 "Do not export to next AS (well-known community)\n")
7883 ALIAS (show_ipv6_mbgp_community
,
7884 show_ipv6_mbgp_community4_cmd
,
7885 "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)",
7889 "Display routes matching the communities\n"
7890 "community number\n"
7891 "Do not send outside local AS (well-known community)\n"
7892 "Do not advertise to any peer (well-known community)\n"
7893 "Do not export to next AS (well-known community)\n"
7894 "community number\n"
7895 "Do not send outside local AS (well-known community)\n"
7896 "Do not advertise to any peer (well-known community)\n"
7897 "Do not export to next AS (well-known community)\n"
7898 "community number\n"
7899 "Do not send outside local AS (well-known community)\n"
7900 "Do not advertise to any peer (well-known community)\n"
7901 "Do not export to next AS (well-known community)\n"
7902 "community number\n"
7903 "Do not send outside local AS (well-known community)\n"
7904 "Do not advertise to any peer (well-known community)\n"
7905 "Do not export to next AS (well-known community)\n")
7908 DEFUN (show_ipv6_mbgp_community_exact
,
7909 show_ipv6_mbgp_community_exact_cmd
,
7910 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7914 "Display routes matching the communities\n"
7915 "community number\n"
7916 "Do not send outside local AS (well-known community)\n"
7917 "Do not advertise to any peer (well-known community)\n"
7918 "Do not export to next AS (well-known community)\n"
7919 "Exact match of the communities")
7921 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_MULTICAST
);
7925 ALIAS (show_ipv6_mbgp_community_exact
,
7926 show_ipv6_mbgp_community2_exact_cmd
,
7927 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7931 "Display routes matching the communities\n"
7932 "community number\n"
7933 "Do not send outside local AS (well-known community)\n"
7934 "Do not advertise to any peer (well-known community)\n"
7935 "Do not export to next AS (well-known community)\n"
7936 "community number\n"
7937 "Do not send outside local AS (well-known community)\n"
7938 "Do not advertise to any peer (well-known community)\n"
7939 "Do not export to next AS (well-known community)\n"
7940 "Exact match of the communities")
7943 ALIAS (show_ipv6_mbgp_community_exact
,
7944 show_ipv6_mbgp_community3_exact_cmd
,
7945 "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",
7949 "Display routes matching the communities\n"
7950 "community number\n"
7951 "Do not send outside local AS (well-known community)\n"
7952 "Do not advertise to any peer (well-known community)\n"
7953 "Do not export to next AS (well-known community)\n"
7954 "community number\n"
7955 "Do not send outside local AS (well-known community)\n"
7956 "Do not advertise to any peer (well-known community)\n"
7957 "Do not export to next AS (well-known community)\n"
7958 "community number\n"
7959 "Do not send outside local AS (well-known community)\n"
7960 "Do not advertise to any peer (well-known community)\n"
7961 "Do not export to next AS (well-known community)\n"
7962 "Exact match of the communities")
7965 ALIAS (show_ipv6_mbgp_community_exact
,
7966 show_ipv6_mbgp_community4_exact_cmd
,
7967 "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",
7971 "Display routes matching the communities\n"
7972 "community number\n"
7973 "Do not send outside local AS (well-known community)\n"
7974 "Do not advertise to any peer (well-known community)\n"
7975 "Do not export to next AS (well-known community)\n"
7976 "community number\n"
7977 "Do not send outside local AS (well-known community)\n"
7978 "Do not advertise to any peer (well-known community)\n"
7979 "Do not export to next AS (well-known community)\n"
7980 "community number\n"
7981 "Do not send outside local AS (well-known community)\n"
7982 "Do not advertise to any peer (well-known community)\n"
7983 "Do not export to next AS (well-known community)\n"
7984 "community number\n"
7985 "Do not send outside local AS (well-known community)\n"
7986 "Do not advertise to any peer (well-known community)\n"
7987 "Do not export to next AS (well-known community)\n"
7988 "Exact match of the communities")
7989 #endif /* HAVE_IPV6 */
7992 bgp_show_community_list (struct vty
*vty
, const char *com
, int exact
,
7993 u_int16_t afi
, u_char safi
)
7995 struct community_list
*list
;
7997 list
= community_list_lookup (bgp_clist
, com
, COMMUNITY_LIST_MASTER
);
8000 vty_out (vty
, "%% %s is not a valid community-list name%s", com
,
8005 return bgp_show (vty
, NULL
, afi
, safi
,
8006 (exact
? bgp_show_type_community_list_exact
:
8007 bgp_show_type_community_list
), list
);
8010 DEFUN (show_ip_bgp_community_list
,
8011 show_ip_bgp_community_list_cmd
,
8012 "show ip bgp community-list (<1-500>|WORD)",
8016 "Display routes matching the community-list\n"
8017 "community-list number\n"
8018 "community-list name\n")
8020 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP
, SAFI_UNICAST
);
8023 DEFUN (show_ip_bgp_ipv4_community_list
,
8024 show_ip_bgp_ipv4_community_list_cmd
,
8025 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)",
8030 "Address Family modifier\n"
8031 "Address Family modifier\n"
8032 "Display routes matching the community-list\n"
8033 "community-list number\n"
8034 "community-list name\n")
8036 if (strncmp (argv
[0], "m", 1) == 0)
8037 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_MULTICAST
);
8039 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_UNICAST
);
8042 DEFUN (show_ip_bgp_community_list_exact
,
8043 show_ip_bgp_community_list_exact_cmd
,
8044 "show ip bgp community-list (<1-500>|WORD) exact-match",
8048 "Display routes matching the community-list\n"
8049 "community-list number\n"
8050 "community-list name\n"
8051 "Exact match of the communities\n")
8053 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP
, SAFI_UNICAST
);
8056 DEFUN (show_ip_bgp_ipv4_community_list_exact
,
8057 show_ip_bgp_ipv4_community_list_exact_cmd
,
8058 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match",
8063 "Address Family modifier\n"
8064 "Address Family modifier\n"
8065 "Display routes matching the community-list\n"
8066 "community-list number\n"
8067 "community-list name\n"
8068 "Exact match of the communities\n")
8070 if (strncmp (argv
[0], "m", 1) == 0)
8071 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_MULTICAST
);
8073 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_UNICAST
);
8077 DEFUN (show_bgp_community_list
,
8078 show_bgp_community_list_cmd
,
8079 "show bgp community-list (<1-500>|WORD)",
8082 "Display routes matching the community-list\n"
8083 "community-list number\n"
8084 "community-list name\n")
8086 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
8089 ALIAS (show_bgp_community_list
,
8090 show_bgp_ipv6_community_list_cmd
,
8091 "show bgp ipv6 community-list (<1-500>|WORD)",
8095 "Display routes matching the community-list\n"
8096 "community-list number\n"
8097 "community-list name\n");
8100 DEFUN (show_ipv6_bgp_community_list
,
8101 show_ipv6_bgp_community_list_cmd
,
8102 "show ipv6 bgp community-list WORD",
8106 "Display routes matching the community-list\n"
8107 "community-list name\n")
8109 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
8113 DEFUN (show_ipv6_mbgp_community_list
,
8114 show_ipv6_mbgp_community_list_cmd
,
8115 "show ipv6 mbgp community-list WORD",
8119 "Display routes matching the community-list\n"
8120 "community-list name\n")
8122 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_MULTICAST
);
8125 DEFUN (show_bgp_community_list_exact
,
8126 show_bgp_community_list_exact_cmd
,
8127 "show bgp community-list (<1-500>|WORD) exact-match",
8130 "Display routes matching the community-list\n"
8131 "community-list number\n"
8132 "community-list name\n"
8133 "Exact match of the communities\n")
8135 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
8138 ALIAS (show_bgp_community_list_exact
,
8139 show_bgp_ipv6_community_list_exact_cmd
,
8140 "show bgp ipv6 community-list (<1-500>|WORD) exact-match",
8144 "Display routes matching the community-list\n"
8145 "community-list number\n"
8146 "community-list name\n"
8147 "Exact match of the communities\n")
8150 DEFUN (show_ipv6_bgp_community_list_exact
,
8151 show_ipv6_bgp_community_list_exact_cmd
,
8152 "show ipv6 bgp community-list WORD exact-match",
8156 "Display routes matching the community-list\n"
8157 "community-list name\n"
8158 "Exact match of the communities\n")
8160 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
8164 DEFUN (show_ipv6_mbgp_community_list_exact
,
8165 show_ipv6_mbgp_community_list_exact_cmd
,
8166 "show ipv6 mbgp community-list WORD exact-match",
8170 "Display routes matching the community-list\n"
8171 "community-list name\n"
8172 "Exact match of the communities\n")
8174 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_MULTICAST
);
8176 #endif /* HAVE_IPV6 */
8179 bgp_show_prefix_longer (struct vty
*vty
, const char *prefix
, afi_t afi
,
8180 safi_t safi
, enum bgp_show_type type
)
8187 ret
= str2prefix (prefix
, p
);
8190 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
8194 ret
= bgp_show (vty
, NULL
, afi
, safi
, type
, p
);
8199 DEFUN (show_ip_bgp_prefix_longer
,
8200 show_ip_bgp_prefix_longer_cmd
,
8201 "show ip bgp A.B.C.D/M longer-prefixes",
8205 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8206 "Display route and more specific routes\n")
8208 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8209 bgp_show_type_prefix_longer
);
8212 DEFUN (show_ip_bgp_flap_prefix_longer
,
8213 show_ip_bgp_flap_prefix_longer_cmd
,
8214 "show ip bgp flap-statistics A.B.C.D/M longer-prefixes",
8218 "Display flap statistics of routes\n"
8219 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8220 "Display route and more specific routes\n")
8222 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8223 bgp_show_type_flap_prefix_longer
);
8226 DEFUN (show_ip_bgp_ipv4_prefix_longer
,
8227 show_ip_bgp_ipv4_prefix_longer_cmd
,
8228 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes",
8233 "Address Family modifier\n"
8234 "Address Family modifier\n"
8235 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8236 "Display route and more specific routes\n")
8238 if (strncmp (argv
[0], "m", 1) == 0)
8239 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
8240 bgp_show_type_prefix_longer
);
8242 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
8243 bgp_show_type_prefix_longer
);
8246 DEFUN (show_ip_bgp_flap_address
,
8247 show_ip_bgp_flap_address_cmd
,
8248 "show ip bgp flap-statistics A.B.C.D",
8252 "Display flap statistics of routes\n"
8253 "Network in the BGP routing table to display\n")
8255 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8256 bgp_show_type_flap_address
);
8259 DEFUN (show_ip_bgp_flap_prefix
,
8260 show_ip_bgp_flap_prefix_cmd
,
8261 "show ip bgp flap-statistics A.B.C.D/M",
8265 "Display flap statistics of routes\n"
8266 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
8268 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8269 bgp_show_type_flap_prefix
);
8272 DEFUN (show_bgp_prefix_longer
,
8273 show_bgp_prefix_longer_cmd
,
8274 "show bgp X:X::X:X/M longer-prefixes",
8277 "IPv6 prefix <network>/<length>\n"
8278 "Display route and more specific routes\n")
8280 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8281 bgp_show_type_prefix_longer
);
8284 ALIAS (show_bgp_prefix_longer
,
8285 show_bgp_ipv6_prefix_longer_cmd
,
8286 "show bgp ipv6 X:X::X:X/M longer-prefixes",
8290 "IPv6 prefix <network>/<length>\n"
8291 "Display route and more specific routes\n")
8294 DEFUN (show_ipv6_bgp_prefix_longer
,
8295 show_ipv6_bgp_prefix_longer_cmd
,
8296 "show ipv6 bgp X:X::X:X/M longer-prefixes",
8300 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
8301 "Display route and more specific routes\n")
8303 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8304 bgp_show_type_prefix_longer
);
8308 DEFUN (show_ipv6_mbgp_prefix_longer
,
8309 show_ipv6_mbgp_prefix_longer_cmd
,
8310 "show ipv6 mbgp X:X::X:X/M longer-prefixes",
8314 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
8315 "Display route and more specific routes\n")
8317 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
8318 bgp_show_type_prefix_longer
);
8320 #endif /* HAVE_IPV6 */
8322 static struct peer
*
8323 peer_lookup_in_view (struct vty
*vty
, const char *view_name
,
8331 /* BGP structure lookup. */
8334 bgp
= bgp_lookup_by_name (view_name
);
8337 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
8343 bgp
= bgp_get_default ();
8346 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
8351 /* Get peer sockunion. */
8352 ret
= str2sockunion (ip_str
, &su
);
8355 vty_out (vty
, "Malformed address: %s%s", ip_str
, VTY_NEWLINE
);
8359 /* Peer structure lookup. */
8360 peer
= peer_lookup (bgp
, &su
);
8363 vty_out (vty
, "No such neighbor%s", VTY_NEWLINE
);
8371 show_adj_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
,
8374 struct bgp_table
*table
;
8375 struct bgp_adj_in
*ain
;
8376 struct bgp_adj_out
*adj
;
8377 unsigned long output_count
;
8378 struct bgp_node
*rn
;
8388 table
= bgp
->rib
[afi
][safi
];
8392 if (! in
&& CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
8393 PEER_STATUS_DEFAULT_ORIGINATE
))
8395 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
8396 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8397 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8399 vty_out (vty
, "Originating default network 0.0.0.0%s%s",
8400 VTY_NEWLINE
, VTY_NEWLINE
);
8404 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
8407 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
8408 if (ain
->peer
== peer
)
8412 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
8413 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8414 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8419 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
8424 route_vty_out_tmp (vty
, &rn
->p
, ain
->attr
, safi
);
8431 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
)
8432 if (adj
->peer
== peer
)
8436 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
8437 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8438 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8443 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
8448 route_vty_out_tmp (vty
, &rn
->p
, adj
->attr
, safi
);
8454 if (output_count
!= 0)
8455 vty_out (vty
, "%sTotal number of prefixes %ld%s",
8456 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
8460 peer_adj_routes (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
, int in
)
8462 if (! peer
|| ! peer
->afc
[afi
][safi
])
8464 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
8468 if (in
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
8470 vty_out (vty
, "%% Inbound soft reconfiguration not enabled%s",
8475 show_adj_route (vty
, peer
, afi
, safi
, in
);
8480 DEFUN (show_ip_bgp_neighbor_advertised_route
,
8481 show_ip_bgp_neighbor_advertised_route_cmd
,
8482 "show ip bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8486 "Detailed information on TCP and BGP neighbor connections\n"
8487 "Neighbor to display information about\n"
8488 "Neighbor to display information about\n"
8489 "Display the routes advertised to a BGP neighbor\n")
8493 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8497 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0);
8500 DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route
,
8501 show_ip_bgp_ipv4_neighbor_advertised_route_cmd
,
8502 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8507 "Address Family modifier\n"
8508 "Address Family modifier\n"
8509 "Detailed information on TCP and BGP neighbor connections\n"
8510 "Neighbor to display information about\n"
8511 "Neighbor to display information about\n"
8512 "Display the routes advertised to a BGP neighbor\n")
8516 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
8520 if (strncmp (argv
[0], "m", 1) == 0)
8521 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 0);
8523 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0);
8527 DEFUN (show_bgp_view_neighbor_advertised_route
,
8528 show_bgp_view_neighbor_advertised_route_cmd
,
8529 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8534 "Detailed information on TCP and BGP neighbor connections\n"
8535 "Neighbor to display information about\n"
8536 "Neighbor to display information about\n"
8537 "Display the routes advertised to a BGP neighbor\n")
8542 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
8544 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8549 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0);
8552 ALIAS (show_bgp_view_neighbor_advertised_route
,
8553 show_bgp_view_ipv6_neighbor_advertised_route_cmd
,
8554 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8560 "Detailed information on TCP and BGP neighbor connections\n"
8561 "Neighbor to display information about\n"
8562 "Neighbor to display information about\n"
8563 "Display the routes advertised to a BGP neighbor\n")
8565 DEFUN (show_bgp_view_neighbor_received_routes
,
8566 show_bgp_view_neighbor_received_routes_cmd
,
8567 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received-routes",
8572 "Detailed information on TCP and BGP neighbor connections\n"
8573 "Neighbor to display information about\n"
8574 "Neighbor to display information about\n"
8575 "Display the received routes from neighbor\n")
8580 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
8582 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8587 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 1);
8590 ALIAS (show_bgp_view_neighbor_received_routes
,
8591 show_bgp_view_ipv6_neighbor_received_routes_cmd
,
8592 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
8598 "Detailed information on TCP and BGP neighbor connections\n"
8599 "Neighbor to display information about\n"
8600 "Neighbor to display information about\n"
8601 "Display the received routes from neighbor\n")
8603 ALIAS (show_bgp_view_neighbor_advertised_route
,
8604 show_bgp_neighbor_advertised_route_cmd
,
8605 "show bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8608 "Detailed information on TCP and BGP neighbor connections\n"
8609 "Neighbor to display information about\n"
8610 "Neighbor to display information about\n"
8611 "Display the routes advertised to a BGP neighbor\n")
8613 ALIAS (show_bgp_view_neighbor_advertised_route
,
8614 show_bgp_ipv6_neighbor_advertised_route_cmd
,
8615 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8619 "Detailed information on TCP and BGP neighbor connections\n"
8620 "Neighbor to display information about\n"
8621 "Neighbor to display information about\n"
8622 "Display the routes advertised to a BGP neighbor\n")
8625 ALIAS (show_bgp_view_neighbor_advertised_route
,
8626 ipv6_bgp_neighbor_advertised_route_cmd
,
8627 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8631 "Detailed information on TCP and BGP neighbor connections\n"
8632 "Neighbor to display information about\n"
8633 "Neighbor to display information about\n"
8634 "Display the routes advertised to a BGP neighbor\n")
8637 DEFUN (ipv6_mbgp_neighbor_advertised_route
,
8638 ipv6_mbgp_neighbor_advertised_route_cmd
,
8639 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8643 "Detailed information on TCP and BGP neighbor connections\n"
8644 "Neighbor to display information about\n"
8645 "Neighbor to display information about\n"
8646 "Display the routes advertised to a BGP neighbor\n")
8650 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8654 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 0);
8656 #endif /* HAVE_IPV6 */
8658 DEFUN (show_ip_bgp_neighbor_received_routes
,
8659 show_ip_bgp_neighbor_received_routes_cmd
,
8660 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
8664 "Detailed information on TCP and BGP neighbor connections\n"
8665 "Neighbor to display information about\n"
8666 "Neighbor to display information about\n"
8667 "Display the received routes from neighbor\n")
8671 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8675 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1);
8678 DEFUN (show_ip_bgp_ipv4_neighbor_received_routes
,
8679 show_ip_bgp_ipv4_neighbor_received_routes_cmd
,
8680 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received-routes",
8685 "Address Family modifier\n"
8686 "Address Family modifier\n"
8687 "Detailed information on TCP and BGP neighbor connections\n"
8688 "Neighbor to display information about\n"
8689 "Neighbor to display information about\n"
8690 "Display the received routes from neighbor\n")
8694 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
8698 if (strncmp (argv
[0], "m", 1) == 0)
8699 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 1);
8701 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1);
8704 DEFUN (show_ip_bgp_neighbor_received_prefix_filter
,
8705 show_ip_bgp_neighbor_received_prefix_filter_cmd
,
8706 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8710 "Detailed information on TCP and BGP neighbor connections\n"
8711 "Neighbor to display information about\n"
8712 "Neighbor to display information about\n"
8713 "Display information received from a BGP neighbor\n"
8714 "Display the prefixlist filter\n")
8717 union sockunion
*su
;
8721 su
= sockunion_str2su (argv
[0]);
8725 peer
= peer_lookup (NULL
, su
);
8729 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
8730 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
8733 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
8734 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
8740 DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter
,
8741 show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
,
8742 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8747 "Address Family modifier\n"
8748 "Address Family modifier\n"
8749 "Detailed information on TCP and BGP neighbor connections\n"
8750 "Neighbor to display information about\n"
8751 "Neighbor to display information about\n"
8752 "Display information received from a BGP neighbor\n"
8753 "Display the prefixlist filter\n")
8756 union sockunion
*su
;
8760 su
= sockunion_str2su (argv
[1]);
8764 peer
= peer_lookup (NULL
, su
);
8768 if (strncmp (argv
[0], "m", 1) == 0)
8770 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_MULTICAST
);
8771 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
8774 vty_out (vty
, "Address family: IPv4 Multicast%s", VTY_NEWLINE
);
8775 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
8780 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
8781 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
8784 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
8785 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
8794 ALIAS (show_bgp_view_neighbor_received_routes
,
8795 show_bgp_neighbor_received_routes_cmd
,
8796 "show bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
8799 "Detailed information on TCP and BGP neighbor connections\n"
8800 "Neighbor to display information about\n"
8801 "Neighbor to display information about\n"
8802 "Display the received routes from neighbor\n")
8804 ALIAS (show_bgp_view_neighbor_received_routes
,
8805 show_bgp_ipv6_neighbor_received_routes_cmd
,
8806 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
8810 "Detailed information on TCP and BGP neighbor connections\n"
8811 "Neighbor to display information about\n"
8812 "Neighbor to display information about\n"
8813 "Display the received routes from neighbor\n")
8815 DEFUN (show_bgp_neighbor_received_prefix_filter
,
8816 show_bgp_neighbor_received_prefix_filter_cmd
,
8817 "show bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8820 "Detailed information on TCP and BGP neighbor connections\n"
8821 "Neighbor to display information about\n"
8822 "Neighbor to display information about\n"
8823 "Display information received from a BGP neighbor\n"
8824 "Display the prefixlist filter\n")
8827 union sockunion
*su
;
8831 su
= sockunion_str2su (argv
[0]);
8835 peer
= peer_lookup (NULL
, su
);
8839 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
8840 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
8843 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
8844 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
8850 ALIAS (show_bgp_neighbor_received_prefix_filter
,
8851 show_bgp_ipv6_neighbor_received_prefix_filter_cmd
,
8852 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8856 "Detailed information on TCP and BGP neighbor connections\n"
8857 "Neighbor to display information about\n"
8858 "Neighbor to display information about\n"
8859 "Display information received from a BGP neighbor\n"
8860 "Display the prefixlist filter\n")
8863 ALIAS (show_bgp_view_neighbor_received_routes
,
8864 ipv6_bgp_neighbor_received_routes_cmd
,
8865 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
8869 "Detailed information on TCP and BGP neighbor connections\n"
8870 "Neighbor to display information about\n"
8871 "Neighbor to display information about\n"
8872 "Display the received routes from neighbor\n")
8875 DEFUN (ipv6_mbgp_neighbor_received_routes
,
8876 ipv6_mbgp_neighbor_received_routes_cmd
,
8877 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) received-routes",
8881 "Detailed information on TCP and BGP neighbor connections\n"
8882 "Neighbor to display information about\n"
8883 "Neighbor to display information about\n"
8884 "Display the received routes from neighbor\n")
8888 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8892 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 1);
8895 DEFUN (show_bgp_view_neighbor_received_prefix_filter
,
8896 show_bgp_view_neighbor_received_prefix_filter_cmd
,
8897 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8902 "Detailed information on TCP and BGP neighbor connections\n"
8903 "Neighbor to display information about\n"
8904 "Neighbor to display information about\n"
8905 "Display information received from a BGP neighbor\n"
8906 "Display the prefixlist filter\n")
8909 union sockunion
*su
;
8914 /* BGP structure lookup. */
8915 bgp
= bgp_lookup_by_name (argv
[0]);
8918 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
8922 su
= sockunion_str2su (argv
[1]);
8926 peer
= peer_lookup (bgp
, su
);
8930 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
8931 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
8934 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
8935 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
8941 ALIAS (show_bgp_view_neighbor_received_prefix_filter
,
8942 show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
,
8943 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8949 "Detailed information on TCP and BGP neighbor connections\n"
8950 "Neighbor to display information about\n"
8951 "Neighbor to display information about\n"
8952 "Display information received from a BGP neighbor\n"
8953 "Display the prefixlist filter\n")
8954 #endif /* HAVE_IPV6 */
8957 bgp_show_neighbor_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
8958 safi_t safi
, enum bgp_show_type type
)
8960 if (! peer
|| ! peer
->afc
[afi
][safi
])
8962 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
8966 return bgp_show (vty
, peer
->bgp
, afi
, safi
, type
, &peer
->su
);
8969 DEFUN (show_ip_bgp_neighbor_routes
,
8970 show_ip_bgp_neighbor_routes_cmd
,
8971 "show ip bgp neighbors (A.B.C.D|X:X::X:X) routes",
8975 "Detailed information on TCP and BGP neighbor connections\n"
8976 "Neighbor to display information about\n"
8977 "Neighbor to display information about\n"
8978 "Display routes learned from neighbor\n")
8982 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8986 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
8987 bgp_show_type_neighbor
);
8990 DEFUN (show_ip_bgp_neighbor_flap
,
8991 show_ip_bgp_neighbor_flap_cmd
,
8992 "show ip bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
8996 "Detailed information on TCP and BGP neighbor connections\n"
8997 "Neighbor to display information about\n"
8998 "Neighbor to display information about\n"
8999 "Display flap statistics of the routes learned from neighbor\n")
9003 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9007 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
9008 bgp_show_type_flap_neighbor
);
9011 DEFUN (show_ip_bgp_neighbor_damp
,
9012 show_ip_bgp_neighbor_damp_cmd
,
9013 "show ip bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9017 "Detailed information on TCP and BGP neighbor connections\n"
9018 "Neighbor to display information about\n"
9019 "Neighbor to display information about\n"
9020 "Display the dampened routes received from neighbor\n")
9024 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9028 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
9029 bgp_show_type_damp_neighbor
);
9032 DEFUN (show_ip_bgp_ipv4_neighbor_routes
,
9033 show_ip_bgp_ipv4_neighbor_routes_cmd
,
9034 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) routes",
9039 "Address Family modifier\n"
9040 "Address Family modifier\n"
9041 "Detailed information on TCP and BGP neighbor connections\n"
9042 "Neighbor to display information about\n"
9043 "Neighbor to display information about\n"
9044 "Display routes learned from neighbor\n")
9048 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
9052 if (strncmp (argv
[0], "m", 1) == 0)
9053 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_MULTICAST
,
9054 bgp_show_type_neighbor
);
9056 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
9057 bgp_show_type_neighbor
);
9060 DEFUN (show_ip_bgp_view_rsclient
,
9061 show_ip_bgp_view_rsclient_cmd
,
9062 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X)",
9068 "Information about Route Server Client\n"
9071 struct bgp_table
*table
;
9075 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9077 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9082 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
9084 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9089 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
9090 PEER_FLAG_RSERVER_CLIENT
))
9092 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9097 table
= peer
->rib
[AFI_IP
][SAFI_UNICAST
];
9099 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
9102 ALIAS (show_ip_bgp_view_rsclient
,
9103 show_ip_bgp_rsclient_cmd
,
9104 "show ip bgp rsclient (A.B.C.D|X:X::X:X)",
9108 "Information about Route Server Client\n"
9111 DEFUN (show_ip_bgp_view_rsclient_route
,
9112 show_ip_bgp_view_rsclient_route_cmd
,
9113 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
9119 "Information about Route Server Client\n"
9121 "Network in the BGP routing table to display\n")
9126 /* BGP structure lookup. */
9129 bgp
= bgp_lookup_by_name (argv
[0]);
9132 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
9138 bgp
= bgp_get_default ();
9141 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9147 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9149 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9154 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
9156 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9161 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
9162 PEER_FLAG_RSERVER_CLIENT
))
9164 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9169 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
9170 (argc
== 3) ? argv
[2] : argv
[1],
9171 AFI_IP
, SAFI_UNICAST
, NULL
, 0);
9174 ALIAS (show_ip_bgp_view_rsclient_route
,
9175 show_ip_bgp_rsclient_route_cmd
,
9176 "show ip bgp rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
9180 "Information about Route Server Client\n"
9182 "Network in the BGP routing table to display\n")
9184 DEFUN (show_ip_bgp_view_rsclient_prefix
,
9185 show_ip_bgp_view_rsclient_prefix_cmd
,
9186 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
9192 "Information about Route Server Client\n"
9194 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
9199 /* BGP structure lookup. */
9202 bgp
= bgp_lookup_by_name (argv
[0]);
9205 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
9211 bgp
= bgp_get_default ();
9214 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9220 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9222 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9227 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
9229 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9234 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
9235 PEER_FLAG_RSERVER_CLIENT
))
9237 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9242 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
9243 (argc
== 3) ? argv
[2] : argv
[1],
9244 AFI_IP
, SAFI_UNICAST
, NULL
, 1);
9247 ALIAS (show_ip_bgp_view_rsclient_prefix
,
9248 show_ip_bgp_rsclient_prefix_cmd
,
9249 "show ip bgp rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
9253 "Information about Route Server Client\n"
9255 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
9259 DEFUN (show_bgp_view_neighbor_routes
,
9260 show_bgp_view_neighbor_routes_cmd
,
9261 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) routes",
9266 "Detailed information on TCP and BGP neighbor connections\n"
9267 "Neighbor to display information about\n"
9268 "Neighbor to display information about\n"
9269 "Display routes learned from neighbor\n")
9274 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9276 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9281 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
9282 bgp_show_type_neighbor
);
9285 ALIAS (show_bgp_view_neighbor_routes
,
9286 show_bgp_view_ipv6_neighbor_routes_cmd
,
9287 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) routes",
9293 "Detailed information on TCP and BGP neighbor connections\n"
9294 "Neighbor to display information about\n"
9295 "Neighbor to display information about\n"
9296 "Display routes learned from neighbor\n")
9298 DEFUN (show_bgp_view_neighbor_damp
,
9299 show_bgp_view_neighbor_damp_cmd
,
9300 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9305 "Detailed information on TCP and BGP neighbor connections\n"
9306 "Neighbor to display information about\n"
9307 "Neighbor to display information about\n"
9308 "Display the dampened routes received from neighbor\n")
9313 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9315 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9320 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
9321 bgp_show_type_damp_neighbor
);
9324 ALIAS (show_bgp_view_neighbor_damp
,
9325 show_bgp_view_ipv6_neighbor_damp_cmd
,
9326 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9332 "Detailed information on TCP and BGP neighbor connections\n"
9333 "Neighbor to display information about\n"
9334 "Neighbor to display information about\n"
9335 "Display the dampened routes received from neighbor\n")
9337 DEFUN (show_bgp_view_neighbor_flap
,
9338 show_bgp_view_neighbor_flap_cmd
,
9339 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9344 "Detailed information on TCP and BGP neighbor connections\n"
9345 "Neighbor to display information about\n"
9346 "Neighbor to display information about\n"
9347 "Display flap statistics of the routes learned from neighbor\n")
9352 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9354 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9359 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
9360 bgp_show_type_flap_neighbor
);
9363 ALIAS (show_bgp_view_neighbor_flap
,
9364 show_bgp_view_ipv6_neighbor_flap_cmd
,
9365 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9371 "Detailed information on TCP and BGP neighbor connections\n"
9372 "Neighbor to display information about\n"
9373 "Neighbor to display information about\n"
9374 "Display flap statistics of the routes learned from neighbor\n")
9376 ALIAS (show_bgp_view_neighbor_routes
,
9377 show_bgp_neighbor_routes_cmd
,
9378 "show bgp neighbors (A.B.C.D|X:X::X:X) routes",
9381 "Detailed information on TCP and BGP neighbor connections\n"
9382 "Neighbor to display information about\n"
9383 "Neighbor to display information about\n"
9384 "Display routes learned from neighbor\n")
9387 ALIAS (show_bgp_view_neighbor_routes
,
9388 show_bgp_ipv6_neighbor_routes_cmd
,
9389 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) routes",
9393 "Detailed information on TCP and BGP neighbor connections\n"
9394 "Neighbor to display information about\n"
9395 "Neighbor to display information about\n"
9396 "Display routes learned from neighbor\n")
9399 ALIAS (show_bgp_view_neighbor_routes
,
9400 ipv6_bgp_neighbor_routes_cmd
,
9401 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) routes",
9405 "Detailed information on TCP and BGP neighbor connections\n"
9406 "Neighbor to display information about\n"
9407 "Neighbor to display information about\n"
9408 "Display routes learned from neighbor\n")
9411 DEFUN (ipv6_mbgp_neighbor_routes
,
9412 ipv6_mbgp_neighbor_routes_cmd
,
9413 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) routes",
9417 "Detailed information on TCP and BGP neighbor connections\n"
9418 "Neighbor to display information about\n"
9419 "Neighbor to display information about\n"
9420 "Display routes learned from neighbor\n")
9424 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9428 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
,
9429 bgp_show_type_neighbor
);
9432 ALIAS (show_bgp_view_neighbor_flap
,
9433 show_bgp_neighbor_flap_cmd
,
9434 "show bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9437 "Detailed information on TCP and BGP neighbor connections\n"
9438 "Neighbor to display information about\n"
9439 "Neighbor to display information about\n"
9440 "Display flap statistics of the routes learned from neighbor\n")
9442 ALIAS (show_bgp_view_neighbor_flap
,
9443 show_bgp_ipv6_neighbor_flap_cmd
,
9444 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9448 "Detailed information on TCP and BGP neighbor connections\n"
9449 "Neighbor to display information about\n"
9450 "Neighbor to display information about\n"
9451 "Display flap statistics of the routes learned from neighbor\n")
9453 ALIAS (show_bgp_view_neighbor_damp
,
9454 show_bgp_neighbor_damp_cmd
,
9455 "show bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9458 "Detailed information on TCP and BGP neighbor connections\n"
9459 "Neighbor to display information about\n"
9460 "Neighbor to display information about\n"
9461 "Display the dampened routes received from neighbor\n")
9463 ALIAS (show_bgp_view_neighbor_damp
,
9464 show_bgp_ipv6_neighbor_damp_cmd
,
9465 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9469 "Detailed information on TCP and BGP neighbor connections\n"
9470 "Neighbor to display information about\n"
9471 "Neighbor to display information about\n"
9472 "Display the dampened routes received from neighbor\n")
9474 DEFUN (show_bgp_view_rsclient
,
9475 show_bgp_view_rsclient_cmd
,
9476 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X)",
9481 "Information about Route Server Client\n"
9484 struct bgp_table
*table
;
9488 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9490 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9495 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
9497 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9502 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
9503 PEER_FLAG_RSERVER_CLIENT
))
9505 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9510 table
= peer
->rib
[AFI_IP6
][SAFI_UNICAST
];
9512 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
9515 ALIAS (show_bgp_view_rsclient
,
9516 show_bgp_rsclient_cmd
,
9517 "show bgp rsclient (A.B.C.D|X:X::X:X)",
9520 "Information about Route Server Client\n"
9523 DEFUN (show_bgp_view_rsclient_route
,
9524 show_bgp_view_rsclient_route_cmd
,
9525 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
9530 "Information about Route Server Client\n"
9532 "Network in the BGP routing table to display\n")
9537 /* BGP structure lookup. */
9540 bgp
= bgp_lookup_by_name (argv
[0]);
9543 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
9549 bgp
= bgp_get_default ();
9552 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9558 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9560 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9565 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
9567 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9572 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
9573 PEER_FLAG_RSERVER_CLIENT
))
9575 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9580 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
9581 (argc
== 3) ? argv
[2] : argv
[1],
9582 AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
9585 ALIAS (show_bgp_view_rsclient_route
,
9586 show_bgp_rsclient_route_cmd
,
9587 "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
9590 "Information about Route Server Client\n"
9592 "Network in the BGP routing table to display\n")
9594 DEFUN (show_bgp_view_rsclient_prefix
,
9595 show_bgp_view_rsclient_prefix_cmd
,
9596 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
9601 "Information about Route Server Client\n"
9603 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
9608 /* BGP structure lookup. */
9611 bgp
= bgp_lookup_by_name (argv
[0]);
9614 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
9620 bgp
= bgp_get_default ();
9623 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9629 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9631 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9636 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
9638 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9643 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
9644 PEER_FLAG_RSERVER_CLIENT
))
9646 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9651 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
9652 (argc
== 3) ? argv
[2] : argv
[1],
9653 AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
9656 ALIAS (show_bgp_view_rsclient_prefix
,
9657 show_bgp_rsclient_prefix_cmd
,
9658 "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
9661 "Information about Route Server Client\n"
9663 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
9665 #endif /* HAVE_IPV6 */
9667 struct bgp_table
*bgp_distance_table
;
9671 /* Distance value for the IP source prefix. */
9674 /* Name of the access-list to be matched. */
9678 static struct bgp_distance
*
9681 struct bgp_distance
*new;
9682 new = XMALLOC (MTYPE_BGP_DISTANCE
, sizeof (struct bgp_distance
));
9683 memset (new, 0, sizeof (struct bgp_distance
));
9688 bgp_distance_free (struct bgp_distance
*bdistance
)
9690 XFREE (MTYPE_BGP_DISTANCE
, bdistance
);
9694 bgp_distance_set (struct vty
*vty
, const char *distance_str
,
9695 const char *ip_str
, const char *access_list_str
)
9698 struct prefix_ipv4 p
;
9700 struct bgp_node
*rn
;
9701 struct bgp_distance
*bdistance
;
9703 ret
= str2prefix_ipv4 (ip_str
, &p
);
9706 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
9710 distance
= atoi (distance_str
);
9712 /* Get BGP distance node. */
9713 rn
= bgp_node_get (bgp_distance_table
, (struct prefix
*) &p
);
9716 bdistance
= rn
->info
;
9717 bgp_unlock_node (rn
);
9721 bdistance
= bgp_distance_new ();
9722 rn
->info
= bdistance
;
9725 /* Set distance value. */
9726 bdistance
->distance
= distance
;
9728 /* Reset access-list configuration. */
9729 if (bdistance
->access_list
)
9731 free (bdistance
->access_list
);
9732 bdistance
->access_list
= NULL
;
9734 if (access_list_str
)
9735 bdistance
->access_list
= strdup (access_list_str
);
9741 bgp_distance_unset (struct vty
*vty
, const char *distance_str
,
9742 const char *ip_str
, const char *access_list_str
)
9745 struct prefix_ipv4 p
;
9747 struct bgp_node
*rn
;
9748 struct bgp_distance
*bdistance
;
9750 ret
= str2prefix_ipv4 (ip_str
, &p
);
9753 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
9757 distance
= atoi (distance_str
);
9759 rn
= bgp_node_lookup (bgp_distance_table
, (struct prefix
*)&p
);
9762 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
9766 bdistance
= rn
->info
;
9768 if (bdistance
->access_list
)
9769 free (bdistance
->access_list
);
9770 bgp_distance_free (bdistance
);
9773 bgp_unlock_node (rn
);
9774 bgp_unlock_node (rn
);
9780 bgp_distance_reset ()
9782 struct bgp_node
*rn
;
9783 struct bgp_distance
*bdistance
;
9785 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
9786 if ((bdistance
= rn
->info
) != NULL
)
9788 if (bdistance
->access_list
)
9789 free (bdistance
->access_list
);
9790 bgp_distance_free (bdistance
);
9792 bgp_unlock_node (rn
);
9796 /* Apply BGP information to distance method. */
9798 bgp_distance_apply (struct prefix
*p
, struct bgp_info
*rinfo
, struct bgp
*bgp
)
9800 struct bgp_node
*rn
;
9801 struct prefix_ipv4 q
;
9803 struct bgp_distance
*bdistance
;
9804 struct access_list
*alist
;
9805 struct bgp_static
*bgp_static
;
9810 if (p
->family
!= AF_INET
)
9815 if (peer
->su
.sa
.sa_family
!= AF_INET
)
9818 memset (&q
, 0, sizeof (struct prefix_ipv4
));
9820 q
.prefix
= peer
->su
.sin
.sin_addr
;
9821 q
.prefixlen
= IPV4_MAX_BITLEN
;
9823 /* Check source address. */
9824 rn
= bgp_node_match (bgp_distance_table
, (struct prefix
*) &q
);
9827 bdistance
= rn
->info
;
9828 bgp_unlock_node (rn
);
9830 if (bdistance
->access_list
)
9832 alist
= access_list_lookup (AFI_IP
, bdistance
->access_list
);
9833 if (alist
&& access_list_apply (alist
, p
) == FILTER_PERMIT
)
9834 return bdistance
->distance
;
9837 return bdistance
->distance
;
9840 /* Backdoor check. */
9841 rn
= bgp_node_lookup (bgp
->route
[AFI_IP
][SAFI_UNICAST
], p
);
9844 bgp_static
= rn
->info
;
9845 bgp_unlock_node (rn
);
9847 if (bgp_static
->backdoor
)
9849 if (bgp
->distance_local
)
9850 return bgp
->distance_local
;
9852 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
9856 if (peer_sort (peer
) == BGP_PEER_EBGP
)
9858 if (bgp
->distance_ebgp
)
9859 return bgp
->distance_ebgp
;
9860 return ZEBRA_EBGP_DISTANCE_DEFAULT
;
9864 if (bgp
->distance_ibgp
)
9865 return bgp
->distance_ibgp
;
9866 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
9870 DEFUN (bgp_distance
,
9872 "distance bgp <1-255> <1-255> <1-255>",
9873 "Define an administrative distance\n"
9875 "Distance for routes external to the AS\n"
9876 "Distance for routes internal to the AS\n"
9877 "Distance for local routes\n")
9883 bgp
->distance_ebgp
= atoi (argv
[0]);
9884 bgp
->distance_ibgp
= atoi (argv
[1]);
9885 bgp
->distance_local
= atoi (argv
[2]);
9889 DEFUN (no_bgp_distance
,
9890 no_bgp_distance_cmd
,
9891 "no distance bgp <1-255> <1-255> <1-255>",
9893 "Define an administrative distance\n"
9895 "Distance for routes external to the AS\n"
9896 "Distance for routes internal to the AS\n"
9897 "Distance for local routes\n")
9903 bgp
->distance_ebgp
= 0;
9904 bgp
->distance_ibgp
= 0;
9905 bgp
->distance_local
= 0;
9909 ALIAS (no_bgp_distance
,
9910 no_bgp_distance2_cmd
,
9913 "Define an administrative distance\n"
9916 DEFUN (bgp_distance_source
,
9917 bgp_distance_source_cmd
,
9918 "distance <1-255> A.B.C.D/M",
9919 "Define an administrative distance\n"
9920 "Administrative distance\n"
9921 "IP source prefix\n")
9923 bgp_distance_set (vty
, argv
[0], argv
[1], NULL
);
9927 DEFUN (no_bgp_distance_source
,
9928 no_bgp_distance_source_cmd
,
9929 "no distance <1-255> A.B.C.D/M",
9931 "Define an administrative distance\n"
9932 "Administrative distance\n"
9933 "IP source prefix\n")
9935 bgp_distance_unset (vty
, argv
[0], argv
[1], NULL
);
9939 DEFUN (bgp_distance_source_access_list
,
9940 bgp_distance_source_access_list_cmd
,
9941 "distance <1-255> A.B.C.D/M WORD",
9942 "Define an administrative distance\n"
9943 "Administrative distance\n"
9944 "IP source prefix\n"
9945 "Access list name\n")
9947 bgp_distance_set (vty
, argv
[0], argv
[1], argv
[2]);
9951 DEFUN (no_bgp_distance_source_access_list
,
9952 no_bgp_distance_source_access_list_cmd
,
9953 "no distance <1-255> A.B.C.D/M WORD",
9955 "Define an administrative distance\n"
9956 "Administrative distance\n"
9957 "IP source prefix\n"
9958 "Access list name\n")
9960 bgp_distance_unset (vty
, argv
[0], argv
[1], argv
[2]);
9964 DEFUN (bgp_damp_set
,
9966 "bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
9967 "BGP Specific commands\n"
9968 "Enable route-flap dampening\n"
9969 "Half-life time for the penalty\n"
9970 "Value to start reusing a route\n"
9971 "Value to start suppressing a route\n"
9972 "Maximum duration to suppress a stable route\n")
9975 int half
= DEFAULT_HALF_LIFE
* 60;
9976 int reuse
= DEFAULT_REUSE
;
9977 int suppress
= DEFAULT_SUPPRESS
;
9982 half
= atoi (argv
[0]) * 60;
9983 reuse
= atoi (argv
[1]);
9984 suppress
= atoi (argv
[2]);
9985 max
= atoi (argv
[3]) * 60;
9989 half
= atoi (argv
[0]) * 60;
9994 return bgp_damp_enable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
),
9995 half
, reuse
, suppress
, max
);
9998 ALIAS (bgp_damp_set
,
10000 "bgp dampening <1-45>",
10001 "BGP Specific commands\n"
10002 "Enable route-flap dampening\n"
10003 "Half-life time for the penalty\n")
10005 ALIAS (bgp_damp_set
,
10008 "BGP Specific commands\n"
10009 "Enable route-flap dampening\n")
10011 DEFUN (bgp_damp_unset
,
10012 bgp_damp_unset_cmd
,
10013 "no bgp dampening",
10015 "BGP Specific commands\n"
10016 "Enable route-flap dampening\n")
10021 return bgp_damp_disable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
));
10024 ALIAS (bgp_damp_unset
,
10025 bgp_damp_unset2_cmd
,
10026 "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
10028 "BGP Specific commands\n"
10029 "Enable route-flap dampening\n"
10030 "Half-life time for the penalty\n"
10031 "Value to start reusing a route\n"
10032 "Value to start suppressing a route\n"
10033 "Maximum duration to suppress a stable route\n")
10035 DEFUN (show_ip_bgp_dampened_paths
,
10036 show_ip_bgp_dampened_paths_cmd
,
10037 "show ip bgp dampened-paths",
10041 "Display paths suppressed due to dampening\n")
10043 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_dampend_paths
,
10047 DEFUN (show_ip_bgp_flap_statistics
,
10048 show_ip_bgp_flap_statistics_cmd
,
10049 "show ip bgp flap-statistics",
10053 "Display flap statistics of routes\n")
10055 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
10056 bgp_show_type_flap_statistics
, NULL
);
10059 /* Display specified route of BGP table. */
10061 bgp_clear_damp_route (struct vty
*vty
, const char *view_name
,
10062 const char *ip_str
, afi_t afi
, safi_t safi
,
10063 struct prefix_rd
*prd
, int prefix_check
)
10066 struct prefix match
;
10067 struct bgp_node
*rn
;
10068 struct bgp_node
*rm
;
10069 struct bgp_info
*ri
;
10070 struct bgp_info
*ri_temp
;
10072 struct bgp_table
*table
;
10074 /* BGP structure lookup. */
10077 bgp
= bgp_lookup_by_name (view_name
);
10080 vty_out (vty
, "%% Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
10081 return CMD_WARNING
;
10086 bgp
= bgp_get_default ();
10089 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
10090 return CMD_WARNING
;
10094 /* Check IP address argument. */
10095 ret
= str2prefix (ip_str
, &match
);
10098 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
10099 return CMD_WARNING
;
10102 match
.family
= afi2family (afi
);
10104 if (safi
== SAFI_MPLS_VPN
)
10106 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= bgp_route_next (rn
))
10108 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
10111 if ((table
= rn
->info
) != NULL
)
10112 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
10113 if (! prefix_check
|| rm
->p
.prefixlen
== match
.prefixlen
)
10120 ri_temp
= ri
->next
;
10121 bgp_damp_info_free (ri
->damp_info
, 1);
10132 if ((rn
= bgp_node_match (bgp
->rib
[afi
][safi
], &match
)) != NULL
)
10133 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
10140 ri_temp
= ri
->next
;
10141 bgp_damp_info_free (ri
->damp_info
, 1);
10150 return CMD_SUCCESS
;
10153 DEFUN (clear_ip_bgp_dampening
,
10154 clear_ip_bgp_dampening_cmd
,
10155 "clear ip bgp dampening",
10159 "Clear route flap dampening information\n")
10161 bgp_damp_info_clean ();
10162 return CMD_SUCCESS
;
10165 DEFUN (clear_ip_bgp_dampening_prefix
,
10166 clear_ip_bgp_dampening_prefix_cmd
,
10167 "clear ip bgp dampening A.B.C.D/M",
10171 "Clear route flap dampening information\n"
10172 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
10174 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
10175 SAFI_UNICAST
, NULL
, 1);
10178 DEFUN (clear_ip_bgp_dampening_address
,
10179 clear_ip_bgp_dampening_address_cmd
,
10180 "clear ip bgp dampening A.B.C.D",
10184 "Clear route flap dampening information\n"
10185 "Network to clear damping information\n")
10187 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
10188 SAFI_UNICAST
, NULL
, 0);
10191 DEFUN (clear_ip_bgp_dampening_address_mask
,
10192 clear_ip_bgp_dampening_address_mask_cmd
,
10193 "clear ip bgp dampening A.B.C.D A.B.C.D",
10197 "Clear route flap dampening information\n"
10198 "Network to clear damping information\n"
10202 char prefix_str
[BUFSIZ
];
10204 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
10207 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
10208 return CMD_WARNING
;
10211 return bgp_clear_damp_route (vty
, NULL
, prefix_str
, AFI_IP
,
10212 SAFI_UNICAST
, NULL
, 0);
10216 bgp_config_write_network_vpnv4 (struct vty
*vty
, struct bgp
*bgp
,
10217 afi_t afi
, safi_t safi
, int *write
)
10219 struct bgp_node
*prn
;
10220 struct bgp_node
*rn
;
10221 struct bgp_table
*table
;
10223 struct prefix_rd
*prd
;
10224 struct bgp_static
*bgp_static
;
10226 char buf
[SU_ADDRSTRLEN
];
10227 char rdbuf
[RD_ADDRSTRLEN
];
10229 /* Network configuration. */
10230 for (prn
= bgp_table_top (bgp
->route
[afi
][safi
]); prn
; prn
= bgp_route_next (prn
))
10231 if ((table
= prn
->info
) != NULL
)
10232 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
10233 if ((bgp_static
= rn
->info
) != NULL
)
10236 prd
= (struct prefix_rd
*) &prn
->p
;
10238 /* "address-family" display. */
10239 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10241 /* "network" configuration display. */
10242 prefix_rd2str (prd
, rdbuf
, RD_ADDRSTRLEN
);
10243 label
= decode_label (bgp_static
->tag
);
10245 vty_out (vty
, " network %s/%d rd %s tag %d",
10246 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
10249 vty_out (vty
, "%s", VTY_NEWLINE
);
10254 /* Configuration of static route announcement and aggregate
10257 bgp_config_write_network (struct vty
*vty
, struct bgp
*bgp
,
10258 afi_t afi
, safi_t safi
, int *write
)
10260 struct bgp_node
*rn
;
10262 struct bgp_static
*bgp_static
;
10263 struct bgp_aggregate
*bgp_aggregate
;
10264 char buf
[SU_ADDRSTRLEN
];
10266 if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
10267 return bgp_config_write_network_vpnv4 (vty
, bgp
, afi
, safi
, write
);
10269 /* Network configuration. */
10270 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
10271 if ((bgp_static
= rn
->info
) != NULL
)
10275 /* "address-family" display. */
10276 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10278 /* "network" configuration display. */
10279 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
10281 u_int32_t destination
;
10282 struct in_addr netmask
;
10284 destination
= ntohl (p
->u
.prefix4
.s_addr
);
10285 masklen2ip (p
->prefixlen
, &netmask
);
10286 vty_out (vty
, " network %s",
10287 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
));
10289 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
10290 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
10291 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
10292 || p
->u
.prefix4
.s_addr
== 0)
10294 /* Natural mask is not display. */
10297 vty_out (vty
, " mask %s", inet_ntoa (netmask
));
10301 vty_out (vty
, " network %s/%d",
10302 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
10306 if (bgp_static
->rmap
.name
)
10307 vty_out (vty
, " route-map %s", bgp_static
->rmap
.name
);
10308 else if (bgp_static
->backdoor
)
10309 vty_out (vty
, " backdoor");
10311 vty_out (vty
, "%s", VTY_NEWLINE
);
10314 /* Aggregate-address configuration. */
10315 for (rn
= bgp_table_top (bgp
->aggregate
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
10316 if ((bgp_aggregate
= rn
->info
) != NULL
)
10320 /* "address-family" display. */
10321 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10323 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
10325 struct in_addr netmask
;
10327 masklen2ip (p
->prefixlen
, &netmask
);
10328 vty_out (vty
, " aggregate-address %s %s",
10329 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
10330 inet_ntoa (netmask
));
10334 vty_out (vty
, " aggregate-address %s/%d",
10335 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
10339 if (bgp_aggregate
->as_set
)
10340 vty_out (vty
, " as-set");
10342 if (bgp_aggregate
->summary_only
)
10343 vty_out (vty
, " summary-only");
10345 vty_out (vty
, "%s", VTY_NEWLINE
);
10352 bgp_config_write_distance (struct vty
*vty
, struct bgp
*bgp
)
10354 struct bgp_node
*rn
;
10355 struct bgp_distance
*bdistance
;
10357 /* Distance configuration. */
10358 if (bgp
->distance_ebgp
10359 && bgp
->distance_ibgp
10360 && bgp
->distance_local
10361 && (bgp
->distance_ebgp
!= ZEBRA_EBGP_DISTANCE_DEFAULT
10362 || bgp
->distance_ibgp
!= ZEBRA_IBGP_DISTANCE_DEFAULT
10363 || bgp
->distance_local
!= ZEBRA_IBGP_DISTANCE_DEFAULT
))
10364 vty_out (vty
, " distance bgp %d %d %d%s",
10365 bgp
->distance_ebgp
, bgp
->distance_ibgp
, bgp
->distance_local
,
10368 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
10369 if ((bdistance
= rn
->info
) != NULL
)
10371 vty_out (vty
, " distance %d %s/%d %s%s", bdistance
->distance
,
10372 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
10373 bdistance
->access_list
? bdistance
->access_list
: "",
10380 /* Allocate routing table structure and install commands. */
10384 /* Init BGP distance table. */
10385 bgp_distance_table
= bgp_table_init ();
10387 /* IPv4 BGP commands. */
10388 install_element (BGP_NODE
, &bgp_network_cmd
);
10389 install_element (BGP_NODE
, &bgp_network_mask_cmd
);
10390 install_element (BGP_NODE
, &bgp_network_mask_natural_cmd
);
10391 install_element (BGP_NODE
, &bgp_network_route_map_cmd
);
10392 install_element (BGP_NODE
, &bgp_network_mask_route_map_cmd
);
10393 install_element (BGP_NODE
, &bgp_network_mask_natural_route_map_cmd
);
10394 install_element (BGP_NODE
, &bgp_network_backdoor_cmd
);
10395 install_element (BGP_NODE
, &bgp_network_mask_backdoor_cmd
);
10396 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_cmd
);
10397 install_element (BGP_NODE
, &no_bgp_network_cmd
);
10398 install_element (BGP_NODE
, &no_bgp_network_mask_cmd
);
10399 install_element (BGP_NODE
, &no_bgp_network_mask_natural_cmd
);
10400 install_element (BGP_NODE
, &no_bgp_network_route_map_cmd
);
10401 install_element (BGP_NODE
, &no_bgp_network_mask_route_map_cmd
);
10402 install_element (BGP_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
10403 install_element (BGP_NODE
, &no_bgp_network_backdoor_cmd
);
10404 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_cmd
);
10405 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_cmd
);
10407 install_element (BGP_NODE
, &aggregate_address_cmd
);
10408 install_element (BGP_NODE
, &aggregate_address_mask_cmd
);
10409 install_element (BGP_NODE
, &aggregate_address_summary_only_cmd
);
10410 install_element (BGP_NODE
, &aggregate_address_mask_summary_only_cmd
);
10411 install_element (BGP_NODE
, &aggregate_address_as_set_cmd
);
10412 install_element (BGP_NODE
, &aggregate_address_mask_as_set_cmd
);
10413 install_element (BGP_NODE
, &aggregate_address_as_set_summary_cmd
);
10414 install_element (BGP_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
10415 install_element (BGP_NODE
, &aggregate_address_summary_as_set_cmd
);
10416 install_element (BGP_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
10417 install_element (BGP_NODE
, &no_aggregate_address_cmd
);
10418 install_element (BGP_NODE
, &no_aggregate_address_summary_only_cmd
);
10419 install_element (BGP_NODE
, &no_aggregate_address_as_set_cmd
);
10420 install_element (BGP_NODE
, &no_aggregate_address_as_set_summary_cmd
);
10421 install_element (BGP_NODE
, &no_aggregate_address_summary_as_set_cmd
);
10422 install_element (BGP_NODE
, &no_aggregate_address_mask_cmd
);
10423 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
10424 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_cmd
);
10425 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
10426 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
10428 /* IPv4 unicast configuration. */
10429 install_element (BGP_IPV4_NODE
, &bgp_network_cmd
);
10430 install_element (BGP_IPV4_NODE
, &bgp_network_mask_cmd
);
10431 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_cmd
);
10432 install_element (BGP_IPV4_NODE
, &bgp_network_route_map_cmd
);
10433 install_element (BGP_IPV4_NODE
, &bgp_network_mask_route_map_cmd
);
10434 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_route_map_cmd
);
10435 install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
10436 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_cmd
);
10437 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_cmd
);
10438 install_element (BGP_IPV4_NODE
, &no_bgp_network_route_map_cmd
);
10439 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_route_map_cmd
);
10440 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
10441 install_element (BGP_IPV4_NODE
, &aggregate_address_cmd
);
10442 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_cmd
);
10443 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_only_cmd
);
10444 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_only_cmd
);
10445 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_cmd
);
10446 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_cmd
);
10447 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_summary_cmd
);
10448 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
10449 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_as_set_cmd
);
10450 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
10451 install_element (BGP_IPV4_NODE
, &no_aggregate_address_cmd
);
10452 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_only_cmd
);
10453 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_cmd
);
10454 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_summary_cmd
);
10455 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_as_set_cmd
);
10456 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_cmd
);
10457 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
10458 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_cmd
);
10459 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
10460 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
10462 /* IPv4 multicast configuration. */
10463 install_element (BGP_IPV4M_NODE
, &bgp_network_cmd
);
10464 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_cmd
);
10465 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_cmd
);
10466 install_element (BGP_IPV4M_NODE
, &bgp_network_route_map_cmd
);
10467 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_route_map_cmd
);
10468 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_route_map_cmd
);
10469 install_element (BGP_IPV4M_NODE
, &no_bgp_network_cmd
);
10470 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_cmd
);
10471 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_cmd
);
10472 install_element (BGP_IPV4M_NODE
, &no_bgp_network_route_map_cmd
);
10473 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_route_map_cmd
);
10474 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
10475 install_element (BGP_IPV4M_NODE
, &aggregate_address_cmd
);
10476 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_cmd
);
10477 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_only_cmd
);
10478 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_only_cmd
);
10479 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_cmd
);
10480 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_cmd
);
10481 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_summary_cmd
);
10482 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
10483 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_as_set_cmd
);
10484 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
10485 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_cmd
);
10486 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_only_cmd
);
10487 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_cmd
);
10488 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_summary_cmd
);
10489 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_as_set_cmd
);
10490 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_cmd
);
10491 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
10492 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_cmd
);
10493 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
10494 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
10496 install_element (VIEW_NODE
, &show_ip_bgp_cmd
);
10497 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cmd
);
10498 install_element (VIEW_NODE
, &show_ip_bgp_route_cmd
);
10499 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_cmd
);
10500 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
10501 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
10502 install_element (VIEW_NODE
, &show_ip_bgp_prefix_cmd
);
10503 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
10504 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
10505 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
10506 install_element (VIEW_NODE
, &show_ip_bgp_view_cmd
);
10507 install_element (VIEW_NODE
, &show_ip_bgp_view_route_cmd
);
10508 install_element (VIEW_NODE
, &show_ip_bgp_view_prefix_cmd
);
10509 install_element (VIEW_NODE
, &show_ip_bgp_regexp_cmd
);
10510 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
10511 install_element (VIEW_NODE
, &show_ip_bgp_prefix_list_cmd
);
10512 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
10513 install_element (VIEW_NODE
, &show_ip_bgp_filter_list_cmd
);
10514 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
10515 install_element (VIEW_NODE
, &show_ip_bgp_route_map_cmd
);
10516 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
10517 install_element (VIEW_NODE
, &show_ip_bgp_cidr_only_cmd
);
10518 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
10519 install_element (VIEW_NODE
, &show_ip_bgp_community_all_cmd
);
10520 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
10521 install_element (VIEW_NODE
, &show_ip_bgp_community_cmd
);
10522 install_element (VIEW_NODE
, &show_ip_bgp_community2_cmd
);
10523 install_element (VIEW_NODE
, &show_ip_bgp_community3_cmd
);
10524 install_element (VIEW_NODE
, &show_ip_bgp_community4_cmd
);
10525 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_cmd
);
10526 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
10527 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
10528 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
10529 install_element (VIEW_NODE
, &show_ip_bgp_community_exact_cmd
);
10530 install_element (VIEW_NODE
, &show_ip_bgp_community2_exact_cmd
);
10531 install_element (VIEW_NODE
, &show_ip_bgp_community3_exact_cmd
);
10532 install_element (VIEW_NODE
, &show_ip_bgp_community4_exact_cmd
);
10533 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
10534 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
10535 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
10536 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
10537 install_element (VIEW_NODE
, &show_ip_bgp_community_list_cmd
);
10538 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
10539 install_element (VIEW_NODE
, &show_ip_bgp_community_list_exact_cmd
);
10540 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
10541 install_element (VIEW_NODE
, &show_ip_bgp_prefix_longer_cmd
);
10542 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
10543 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
10544 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
10545 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
10546 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
10547 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
10548 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
10549 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
10550 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
10551 install_element (VIEW_NODE
, &show_ip_bgp_dampened_paths_cmd
);
10552 install_element (VIEW_NODE
, &show_ip_bgp_flap_statistics_cmd
);
10553 install_element (VIEW_NODE
, &show_ip_bgp_flap_address_cmd
);
10554 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_cmd
);
10555 install_element (VIEW_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
10556 install_element (VIEW_NODE
, &show_ip_bgp_flap_regexp_cmd
);
10557 install_element (VIEW_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
10558 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
10559 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
10560 install_element (VIEW_NODE
, &show_ip_bgp_flap_route_map_cmd
);
10561 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
10562 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
10563 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_cmd
);
10564 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_route_cmd
);
10565 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
10566 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_cmd
);
10567 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
10568 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
10570 install_element (ENABLE_NODE
, &show_ip_bgp_cmd
);
10571 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cmd
);
10572 install_element (ENABLE_NODE
, &show_ip_bgp_route_cmd
);
10573 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_cmd
);
10574 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
10575 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
10576 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_cmd
);
10577 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
10578 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
10579 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
10580 install_element (ENABLE_NODE
, &show_ip_bgp_view_cmd
);
10581 install_element (ENABLE_NODE
, &show_ip_bgp_view_route_cmd
);
10582 install_element (ENABLE_NODE
, &show_ip_bgp_view_prefix_cmd
);
10583 install_element (ENABLE_NODE
, &show_ip_bgp_regexp_cmd
);
10584 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
10585 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_list_cmd
);
10586 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
10587 install_element (ENABLE_NODE
, &show_ip_bgp_filter_list_cmd
);
10588 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
10589 install_element (ENABLE_NODE
, &show_ip_bgp_route_map_cmd
);
10590 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
10591 install_element (ENABLE_NODE
, &show_ip_bgp_cidr_only_cmd
);
10592 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
10593 install_element (ENABLE_NODE
, &show_ip_bgp_community_all_cmd
);
10594 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
10595 install_element (ENABLE_NODE
, &show_ip_bgp_community_cmd
);
10596 install_element (ENABLE_NODE
, &show_ip_bgp_community2_cmd
);
10597 install_element (ENABLE_NODE
, &show_ip_bgp_community3_cmd
);
10598 install_element (ENABLE_NODE
, &show_ip_bgp_community4_cmd
);
10599 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_cmd
);
10600 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
10601 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
10602 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
10603 install_element (ENABLE_NODE
, &show_ip_bgp_community_exact_cmd
);
10604 install_element (ENABLE_NODE
, &show_ip_bgp_community2_exact_cmd
);
10605 install_element (ENABLE_NODE
, &show_ip_bgp_community3_exact_cmd
);
10606 install_element (ENABLE_NODE
, &show_ip_bgp_community4_exact_cmd
);
10607 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
10608 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
10609 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
10610 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
10611 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_cmd
);
10612 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
10613 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_exact_cmd
);
10614 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
10615 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_longer_cmd
);
10616 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
10617 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
10618 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
10619 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
10620 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
10621 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
10622 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
10623 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
10624 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
10625 install_element (ENABLE_NODE
, &show_ip_bgp_dampened_paths_cmd
);
10626 install_element (ENABLE_NODE
, &show_ip_bgp_flap_statistics_cmd
);
10627 install_element (ENABLE_NODE
, &show_ip_bgp_flap_address_cmd
);
10628 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_cmd
);
10629 install_element (ENABLE_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
10630 install_element (ENABLE_NODE
, &show_ip_bgp_flap_regexp_cmd
);
10631 install_element (ENABLE_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
10632 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
10633 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
10634 install_element (ENABLE_NODE
, &show_ip_bgp_flap_route_map_cmd
);
10635 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
10636 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
10637 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_cmd
);
10638 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_route_cmd
);
10639 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
10640 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_cmd
);
10641 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
10642 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
10644 /* BGP dampening clear commands */
10645 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_cmd
);
10646 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_prefix_cmd
);
10647 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_cmd
);
10648 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_mask_cmd
);
10651 /* New config IPv6 BGP commands. */
10652 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_cmd
);
10653 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_route_map_cmd
);
10654 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_cmd
);
10655 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_route_map_cmd
);
10657 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_cmd
);
10658 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_summary_only_cmd
);
10659 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_cmd
);
10660 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_summary_only_cmd
);
10662 /* Old config IPv6 BGP commands. */
10663 install_element (BGP_NODE
, &old_ipv6_bgp_network_cmd
);
10664 install_element (BGP_NODE
, &old_no_ipv6_bgp_network_cmd
);
10666 install_element (BGP_NODE
, &old_ipv6_aggregate_address_cmd
);
10667 install_element (BGP_NODE
, &old_ipv6_aggregate_address_summary_only_cmd
);
10668 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_cmd
);
10669 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_summary_only_cmd
);
10671 install_element (VIEW_NODE
, &show_bgp_cmd
);
10672 install_element (VIEW_NODE
, &show_bgp_ipv6_cmd
);
10673 install_element (VIEW_NODE
, &show_bgp_route_cmd
);
10674 install_element (VIEW_NODE
, &show_bgp_ipv6_route_cmd
);
10675 install_element (VIEW_NODE
, &show_bgp_prefix_cmd
);
10676 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_cmd
);
10677 install_element (VIEW_NODE
, &show_bgp_regexp_cmd
);
10678 install_element (VIEW_NODE
, &show_bgp_ipv6_regexp_cmd
);
10679 install_element (VIEW_NODE
, &show_bgp_prefix_list_cmd
);
10680 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
10681 install_element (VIEW_NODE
, &show_bgp_filter_list_cmd
);
10682 install_element (VIEW_NODE
, &show_bgp_ipv6_filter_list_cmd
);
10683 install_element (VIEW_NODE
, &show_bgp_route_map_cmd
);
10684 install_element (VIEW_NODE
, &show_bgp_ipv6_route_map_cmd
);
10685 install_element (VIEW_NODE
, &show_bgp_community_all_cmd
);
10686 install_element (VIEW_NODE
, &show_bgp_ipv6_community_all_cmd
);
10687 install_element (VIEW_NODE
, &show_bgp_community_cmd
);
10688 install_element (VIEW_NODE
, &show_bgp_ipv6_community_cmd
);
10689 install_element (VIEW_NODE
, &show_bgp_community2_cmd
);
10690 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_cmd
);
10691 install_element (VIEW_NODE
, &show_bgp_community3_cmd
);
10692 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_cmd
);
10693 install_element (VIEW_NODE
, &show_bgp_community4_cmd
);
10694 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_cmd
);
10695 install_element (VIEW_NODE
, &show_bgp_community_exact_cmd
);
10696 install_element (VIEW_NODE
, &show_bgp_ipv6_community_exact_cmd
);
10697 install_element (VIEW_NODE
, &show_bgp_community2_exact_cmd
);
10698 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
10699 install_element (VIEW_NODE
, &show_bgp_community3_exact_cmd
);
10700 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
10701 install_element (VIEW_NODE
, &show_bgp_community4_exact_cmd
);
10702 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
10703 install_element (VIEW_NODE
, &show_bgp_community_list_cmd
);
10704 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_cmd
);
10705 install_element (VIEW_NODE
, &show_bgp_community_list_exact_cmd
);
10706 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
10707 install_element (VIEW_NODE
, &show_bgp_prefix_longer_cmd
);
10708 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
10709 install_element (VIEW_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
10710 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
10711 install_element (VIEW_NODE
, &show_bgp_neighbor_received_routes_cmd
);
10712 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
10713 install_element (VIEW_NODE
, &show_bgp_neighbor_routes_cmd
);
10714 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
10715 install_element (VIEW_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
10716 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
10717 install_element (VIEW_NODE
, &show_bgp_neighbor_flap_cmd
);
10718 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
10719 install_element (VIEW_NODE
, &show_bgp_neighbor_damp_cmd
);
10720 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
10721 install_element (VIEW_NODE
, &show_bgp_rsclient_cmd
);
10722 install_element (VIEW_NODE
, &show_bgp_rsclient_route_cmd
);
10723 install_element (VIEW_NODE
, &show_bgp_rsclient_prefix_cmd
);
10724 install_element (VIEW_NODE
, &show_bgp_view_cmd
);
10725 install_element (VIEW_NODE
, &show_bgp_view_ipv6_cmd
);
10726 install_element (VIEW_NODE
, &show_bgp_view_route_cmd
);
10727 install_element (VIEW_NODE
, &show_bgp_view_ipv6_route_cmd
);
10728 install_element (VIEW_NODE
, &show_bgp_view_prefix_cmd
);
10729 install_element (VIEW_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
10730 install_element (VIEW_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
10731 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
10732 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
10733 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
10734 install_element (VIEW_NODE
, &show_bgp_view_neighbor_routes_cmd
);
10735 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
10736 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
10737 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
10738 install_element (VIEW_NODE
, &show_bgp_view_neighbor_flap_cmd
);
10739 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
10740 install_element (VIEW_NODE
, &show_bgp_view_neighbor_damp_cmd
);
10741 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
10742 install_element (VIEW_NODE
, &show_bgp_view_rsclient_cmd
);
10743 install_element (VIEW_NODE
, &show_bgp_view_rsclient_route_cmd
);
10744 install_element (VIEW_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
10746 install_element (ENABLE_NODE
, &show_bgp_cmd
);
10747 install_element (ENABLE_NODE
, &show_bgp_ipv6_cmd
);
10748 install_element (ENABLE_NODE
, &show_bgp_route_cmd
);
10749 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_cmd
);
10750 install_element (ENABLE_NODE
, &show_bgp_prefix_cmd
);
10751 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_cmd
);
10752 install_element (ENABLE_NODE
, &show_bgp_regexp_cmd
);
10753 install_element (ENABLE_NODE
, &show_bgp_ipv6_regexp_cmd
);
10754 install_element (ENABLE_NODE
, &show_bgp_prefix_list_cmd
);
10755 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
10756 install_element (ENABLE_NODE
, &show_bgp_filter_list_cmd
);
10757 install_element (ENABLE_NODE
, &show_bgp_ipv6_filter_list_cmd
);
10758 install_element (ENABLE_NODE
, &show_bgp_route_map_cmd
);
10759 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_map_cmd
);
10760 install_element (ENABLE_NODE
, &show_bgp_community_all_cmd
);
10761 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_all_cmd
);
10762 install_element (ENABLE_NODE
, &show_bgp_community_cmd
);
10763 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_cmd
);
10764 install_element (ENABLE_NODE
, &show_bgp_community2_cmd
);
10765 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_cmd
);
10766 install_element (ENABLE_NODE
, &show_bgp_community3_cmd
);
10767 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_cmd
);
10768 install_element (ENABLE_NODE
, &show_bgp_community4_cmd
);
10769 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_cmd
);
10770 install_element (ENABLE_NODE
, &show_bgp_community_exact_cmd
);
10771 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_exact_cmd
);
10772 install_element (ENABLE_NODE
, &show_bgp_community2_exact_cmd
);
10773 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
10774 install_element (ENABLE_NODE
, &show_bgp_community3_exact_cmd
);
10775 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
10776 install_element (ENABLE_NODE
, &show_bgp_community4_exact_cmd
);
10777 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
10778 install_element (ENABLE_NODE
, &show_bgp_community_list_cmd
);
10779 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_cmd
);
10780 install_element (ENABLE_NODE
, &show_bgp_community_list_exact_cmd
);
10781 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
10782 install_element (ENABLE_NODE
, &show_bgp_prefix_longer_cmd
);
10783 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
10784 install_element (ENABLE_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
10785 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
10786 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_routes_cmd
);
10787 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
10788 install_element (ENABLE_NODE
, &show_bgp_neighbor_routes_cmd
);
10789 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
10790 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
10791 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
10792 install_element (ENABLE_NODE
, &show_bgp_neighbor_flap_cmd
);
10793 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
10794 install_element (ENABLE_NODE
, &show_bgp_neighbor_damp_cmd
);
10795 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
10796 install_element (ENABLE_NODE
, &show_bgp_rsclient_cmd
);
10797 install_element (ENABLE_NODE
, &show_bgp_rsclient_route_cmd
);
10798 install_element (ENABLE_NODE
, &show_bgp_rsclient_prefix_cmd
);
10799 install_element (ENABLE_NODE
, &show_bgp_view_cmd
);
10800 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_cmd
);
10801 install_element (ENABLE_NODE
, &show_bgp_view_route_cmd
);
10802 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_route_cmd
);
10803 install_element (ENABLE_NODE
, &show_bgp_view_prefix_cmd
);
10804 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
10805 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
10806 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
10807 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
10808 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
10809 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_routes_cmd
);
10810 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
10811 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
10812 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
10813 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_flap_cmd
);
10814 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
10815 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_damp_cmd
);
10816 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
10817 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_cmd
);
10818 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_route_cmd
);
10819 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
10822 install_element (VIEW_NODE
, &show_ipv6_bgp_cmd
);
10823 install_element (VIEW_NODE
, &show_ipv6_bgp_route_cmd
);
10824 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_cmd
);
10825 install_element (VIEW_NODE
, &show_ipv6_bgp_regexp_cmd
);
10826 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
10827 install_element (VIEW_NODE
, &show_ipv6_bgp_filter_list_cmd
);
10828 install_element (VIEW_NODE
, &show_ipv6_bgp_community_all_cmd
);
10829 install_element (VIEW_NODE
, &show_ipv6_bgp_community_cmd
);
10830 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_cmd
);
10831 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_cmd
);
10832 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_cmd
);
10833 install_element (VIEW_NODE
, &show_ipv6_bgp_community_exact_cmd
);
10834 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
10835 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
10836 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
10837 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_cmd
);
10838 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
10839 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
10840 install_element (VIEW_NODE
, &show_ipv6_mbgp_cmd
);
10841 install_element (VIEW_NODE
, &show_ipv6_mbgp_route_cmd
);
10842 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_cmd
);
10843 install_element (VIEW_NODE
, &show_ipv6_mbgp_regexp_cmd
);
10844 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
10845 install_element (VIEW_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
10846 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_all_cmd
);
10847 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_cmd
);
10848 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_cmd
);
10849 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_cmd
);
10850 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_cmd
);
10851 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
10852 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
10853 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
10854 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
10855 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_cmd
);
10856 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
10857 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
10860 install_element (ENABLE_NODE
, &show_ipv6_bgp_cmd
);
10861 install_element (ENABLE_NODE
, &show_ipv6_bgp_route_cmd
);
10862 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_cmd
);
10863 install_element (ENABLE_NODE
, &show_ipv6_bgp_regexp_cmd
);
10864 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
10865 install_element (ENABLE_NODE
, &show_ipv6_bgp_filter_list_cmd
);
10866 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_all_cmd
);
10867 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_cmd
);
10868 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_cmd
);
10869 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_cmd
);
10870 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_cmd
);
10871 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_exact_cmd
);
10872 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
10873 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
10874 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
10875 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_cmd
);
10876 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
10877 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
10878 install_element (ENABLE_NODE
, &show_ipv6_mbgp_cmd
);
10879 install_element (ENABLE_NODE
, &show_ipv6_mbgp_route_cmd
);
10880 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_cmd
);
10881 install_element (ENABLE_NODE
, &show_ipv6_mbgp_regexp_cmd
);
10882 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
10883 install_element (ENABLE_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
10884 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_all_cmd
);
10885 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_cmd
);
10886 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_cmd
);
10887 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_cmd
);
10888 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_cmd
);
10889 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
10890 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
10891 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
10892 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
10893 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_cmd
);
10894 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
10895 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
10898 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
10899 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
10900 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
10901 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
10904 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
10905 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
10906 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
10907 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
10910 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
10911 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
10912 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
10913 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
10914 #endif /* HAVE_IPV6 */
10916 install_element (BGP_NODE
, &bgp_distance_cmd
);
10917 install_element (BGP_NODE
, &no_bgp_distance_cmd
);
10918 install_element (BGP_NODE
, &no_bgp_distance2_cmd
);
10919 install_element (BGP_NODE
, &bgp_distance_source_cmd
);
10920 install_element (BGP_NODE
, &no_bgp_distance_source_cmd
);
10921 install_element (BGP_NODE
, &bgp_distance_source_access_list_cmd
);
10922 install_element (BGP_NODE
, &no_bgp_distance_source_access_list_cmd
);
10924 install_element (BGP_NODE
, &bgp_damp_set_cmd
);
10925 install_element (BGP_NODE
, &bgp_damp_set2_cmd
);
10926 install_element (BGP_NODE
, &bgp_damp_set3_cmd
);
10927 install_element (BGP_NODE
, &bgp_damp_unset_cmd
);
10928 install_element (BGP_NODE
, &bgp_damp_unset2_cmd
);
10929 install_element (BGP_IPV4_NODE
, &bgp_damp_set_cmd
);
10930 install_element (BGP_IPV4_NODE
, &bgp_damp_set2_cmd
);
10931 install_element (BGP_IPV4_NODE
, &bgp_damp_set3_cmd
);
10932 install_element (BGP_IPV4_NODE
, &bgp_damp_unset_cmd
);
10933 install_element (BGP_IPV4_NODE
, &bgp_damp_unset2_cmd
);