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 (afi
, safi
);
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
;
614 filter
= &peer
->filter
[afi
][safi
];
617 #ifdef DISABLE_BGP_ANNOUNCE
621 /* Do not send announces to RS-clients from the 'normal' bgp_table. */
622 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
625 /* Do not send back route to sender. */
629 /* If peer's id and route's nexthop are same. draft-ietf-idr-bgp4-23 5.1.3 */
630 if (p
->family
== AF_INET
631 && IPV4_ADDR_SAME(&peer
->remote_id
, &ri
->attr
->nexthop
))
634 if (p
->family
== AF_INET6
635 && IPV6_ADDR_SAME(&peer
->remote_id
, &ri
->attr
->nexthop
))
639 /* Aggregate-address suppress check. */
641 if (! UNSUPPRESS_MAP_NAME (filter
))
644 /* Default route check. */
645 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
647 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
650 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
652 #endif /* HAVE_IPV6 */
655 /* Transparency check. */
656 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
)
657 && CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
662 /* If community is not disabled check the no-export and local. */
663 if (! transparent
&& bgp_community_filter (peer
, ri
->attr
))
666 /* If the attribute has originator-id and it is same as remote
668 if (ri
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
670 if (IPV4_ADDR_SAME (&peer
->remote_id
, &ri
->attr
->originator_id
))
672 if (BGP_DEBUG (filter
, FILTER
))
673 zlog (peer
->log
, LOG_DEBUG
,
674 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
676 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
682 /* ORF prefix-list filter check */
683 if (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
684 && (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
685 || CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
686 if (peer
->orf_plist
[afi
][safi
])
688 if (prefix_list_apply (peer
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
692 /* Output filter check. */
693 if (bgp_output_filter (peer
, p
, ri
->attr
, afi
, safi
) == FILTER_DENY
)
695 if (BGP_DEBUG (filter
, FILTER
))
696 zlog (peer
->log
, LOG_DEBUG
,
697 "%s [Update:SEND] %s/%d is filtered",
699 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
704 #ifdef BGP_SEND_ASPATH_CHECK
705 /* AS path loop check. */
706 if (aspath_loop_check (ri
->attr
->aspath
, peer
->as
))
708 if (BGP_DEBUG (filter
, FILTER
))
709 zlog (peer
->log
, LOG_DEBUG
,
710 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
711 peer
->host
, peer
->as
);
714 #endif /* BGP_SEND_ASPATH_CHECK */
716 /* If we're a CONFED we need to loop check the CONFED ID too */
717 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
719 if (aspath_loop_check(ri
->attr
->aspath
, bgp
->confed_id
))
721 if (BGP_DEBUG (filter
, FILTER
))
722 zlog (peer
->log
, LOG_DEBUG
,
723 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
730 /* Route-Reflect check. */
731 if (peer_sort (from
) == BGP_PEER_IBGP
&& peer_sort (peer
) == BGP_PEER_IBGP
)
736 /* IBGP reflection check. */
739 /* A route from a Client peer. */
740 if (CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
742 /* Reflect to all the Non-Client peers and also to the
743 Client peers other than the originator. Originator check
744 is already done. So there is noting to do. */
745 /* no bgp client-to-client reflection check. */
746 if (bgp_flag_check (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
))
747 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
752 /* A route from a Non-client peer. Reflect to all other
754 if (! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
759 /* For modify attribute, copy it to temporary structure. */
762 /* If local-preference is not set. */
763 if ((peer_sort (peer
) == BGP_PEER_IBGP
764 || peer_sort (peer
) == BGP_PEER_CONFED
)
765 && (! (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))))
767 attr
->flag
|= ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
);
768 attr
->local_pref
= bgp
->default_local_pref
;
771 /* Remove MED if its an EBGP peer - will get overwritten by route-maps */
772 if (peer_sort (peer
) == BGP_PEER_EBGP
773 && attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
775 if (ri
->peer
!= bgp
->peer_self
&& ! transparent
776 && ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
777 attr
->flag
&= ~(ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
));
781 if (transparent
|| reflect
782 || (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
)
783 && ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
)
785 || (p
->family
== AF_INET6
&&
786 ! IN6_IS_ADDR_UNSPECIFIED(&attr
->mp_nexthop_global
))
787 #endif /* HAVE_IPV6 */
790 /* NEXT-HOP Unchanged. */
792 else if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
793 || (p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
795 || (p
->family
== AF_INET6
&&
796 IN6_IS_ADDR_UNSPECIFIED(&attr
->mp_nexthop_global
))
797 #endif /* HAVE_IPV6 */
798 || (peer_sort (peer
) == BGP_PEER_EBGP
799 && bgp_multiaccess_check_v4 (attr
->nexthop
, peer
->host
) == 0))
801 /* Set IPv4 nexthop. */
802 if (p
->family
== AF_INET
)
804 if (safi
== SAFI_MPLS_VPN
)
805 memcpy (&attr
->mp_nexthop_global_in
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
807 memcpy (&attr
->nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
810 /* Set IPv6 nexthop. */
811 if (p
->family
== AF_INET6
)
813 /* IPv6 global nexthop must be included. */
814 memcpy (&attr
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
816 attr
->mp_nexthop_len
= 16;
818 #endif /* HAVE_IPV6 */
822 if (p
->family
== AF_INET6
)
824 /* Left nexthop_local unchanged if so configured. */
825 if ( CHECK_FLAG (peer
->af_flags
[afi
][safi
],
826 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
828 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->mp_nexthop_local
) )
829 attr
->mp_nexthop_len
=32;
831 attr
->mp_nexthop_len
=16;
834 /* Default nexthop_local treatment for non-RS-Clients */
837 /* Link-local address should not be transit to different peer. */
838 attr
->mp_nexthop_len
= 16;
840 /* Set link-local address for shared network peer. */
841 if (peer
->shared_network
842 && ! IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
844 memcpy (&attr
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
846 attr
->mp_nexthop_len
= 32;
849 /* If bgpd act as BGP-4+ route-reflector, do not send link-local
852 attr
->mp_nexthop_len
= 16;
854 /* If BGP-4+ link-local nexthop is not link-local nexthop. */
855 if (! IN6_IS_ADDR_LINKLOCAL (&peer
->nexthop
.v6_local
))
856 attr
->mp_nexthop_len
= 16;
860 #endif /* HAVE_IPV6 */
862 /* If this is EBGP peer and remove-private-AS is set. */
863 if (peer_sort (peer
) == BGP_PEER_EBGP
864 && peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
)
865 && aspath_private_as_check (attr
->aspath
))
866 attr
->aspath
= aspath_empty_get ();
868 /* Route map & unsuppress-map apply. */
869 if (ROUTE_MAP_OUT_NAME (filter
)
872 struct bgp_info info
;
873 struct attr dummy_attr
;
878 /* The route reflector is not allowed to modify the attributes
879 of the reflected IBGP routes. */
880 if (peer_sort (from
) == BGP_PEER_IBGP
881 && peer_sort (peer
) == BGP_PEER_IBGP
)
884 info
.attr
= &dummy_attr
;
887 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_OUT
);
890 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
892 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
896 if (ret
== RMAP_DENYMATCH
)
898 bgp_attr_flush (attr
);
906 bgp_announce_check_rsclient (struct bgp_info
*ri
, struct peer
*rsclient
,
907 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
910 char buf
[SU_ADDRSTRLEN
];
911 struct bgp_filter
*filter
;
912 struct bgp_info info
;
917 filter
= &rsclient
->filter
[afi
][safi
];
920 #ifdef DISABLE_BGP_ANNOUNCE
924 /* Do not send back route to sender. */
925 if (from
== rsclient
)
928 /* Aggregate-address suppress check. */
930 if (! UNSUPPRESS_MAP_NAME (filter
))
933 /* Default route check. */
934 if (CHECK_FLAG (rsclient
->af_sflags
[afi
][safi
],
935 PEER_STATUS_DEFAULT_ORIGINATE
))
937 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
940 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
942 #endif /* HAVE_IPV6 */
945 /* If the attribute has originator-id and it is same as remote
947 if (ri
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
949 if (IPV4_ADDR_SAME (&rsclient
->remote_id
, &ri
->attr
->originator_id
))
951 if (BGP_DEBUG (filter
, FILTER
))
952 zlog (rsclient
->log
, LOG_DEBUG
,
953 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
955 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
961 /* ORF prefix-list filter check */
962 if (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
963 && (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
964 || CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
965 if (rsclient
->orf_plist
[afi
][safi
])
967 if (prefix_list_apply (rsclient
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
971 /* Output filter check. */
972 if (bgp_output_filter (rsclient
, p
, ri
->attr
, afi
, safi
) == FILTER_DENY
)
974 if (BGP_DEBUG (filter
, FILTER
))
975 zlog (rsclient
->log
, LOG_DEBUG
,
976 "%s [Update:SEND] %s/%d is filtered",
978 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
983 #ifdef BGP_SEND_ASPATH_CHECK
984 /* AS path loop check. */
985 if (aspath_loop_check (ri
->attr
->aspath
, rsclient
->as
))
987 if (BGP_DEBUG (filter
, FILTER
))
988 zlog (rsclient
->log
, LOG_DEBUG
,
989 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
990 rsclient
->host
, rsclient
->as
);
993 #endif /* BGP_SEND_ASPATH_CHECK */
995 /* For modify attribute, copy it to temporary structure. */
999 if ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
1001 || (p
->family
== AF_INET6
&&
1002 IN6_IS_ADDR_UNSPECIFIED(&attr
->mp_nexthop_global
))
1003 #endif /* HAVE_IPV6 */
1006 /* Set IPv4 nexthop. */
1007 if (p
->family
== AF_INET
)
1009 if (safi
== SAFI_MPLS_VPN
)
1010 memcpy (&attr
->mp_nexthop_global_in
, &rsclient
->nexthop
.v4
,
1013 memcpy (&attr
->nexthop
, &rsclient
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
1016 /* Set IPv6 nexthop. */
1017 if (p
->family
== AF_INET6
)
1019 /* IPv6 global nexthop must be included. */
1020 memcpy (&attr
->mp_nexthop_global
, &rsclient
->nexthop
.v6_global
,
1023 attr
->mp_nexthop_len
= 16;
1025 #endif /* HAVE_IPV6 */
1029 if (p
->family
== AF_INET6
)
1031 /* Left nexthop_local unchanged if so configured. */
1032 if ( CHECK_FLAG (rsclient
->af_flags
[afi
][safi
],
1033 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
1035 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->mp_nexthop_local
) )
1036 attr
->mp_nexthop_len
=32;
1038 attr
->mp_nexthop_len
=16;
1041 /* Default nexthop_local treatment for RS-Clients */
1044 /* Announcer and RS-Client are both in the same network */
1045 if (rsclient
->shared_network
&& from
->shared_network
&&
1046 (rsclient
->ifindex
== from
->ifindex
))
1048 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->mp_nexthop_local
) )
1049 attr
->mp_nexthop_len
=32;
1051 attr
->mp_nexthop_len
=16;
1054 /* Set link-local address for shared network peer. */
1055 else if (rsclient
->shared_network
1056 && IN6_IS_ADDR_LINKLOCAL (&rsclient
->nexthop
.v6_local
))
1058 memcpy (&attr
->mp_nexthop_local
, &rsclient
->nexthop
.v6_local
,
1060 attr
->mp_nexthop_len
= 32;
1064 attr
->mp_nexthop_len
= 16;
1068 #endif /* HAVE_IPV6 */
1071 /* If this is EBGP peer and remove-private-AS is set. */
1072 if (peer_sort (rsclient
) == BGP_PEER_EBGP
1073 && peer_af_flag_check (rsclient
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
)
1074 && aspath_private_as_check (attr
->aspath
))
1075 attr
->aspath
= aspath_empty_get ();
1077 /* Route map & unsuppress-map apply. */
1078 if (ROUTE_MAP_OUT_NAME (filter
) || ri
->suppress
)
1080 info
.peer
= rsclient
;
1083 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_OUT
);
1086 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
1088 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
1090 rsclient
->rmap_type
= 0;
1092 if (ret
== RMAP_DENYMATCH
)
1094 bgp_attr_flush (attr
);
1102 struct bgp_info_pair
1104 struct bgp_info
*old
;
1105 struct bgp_info
*new;
1109 bgp_best_selection (struct bgp
*bgp
, struct bgp_node
*rn
, struct bgp_info_pair
*result
)
1111 struct bgp_info
*new_select
;
1112 struct bgp_info
*old_select
;
1113 struct bgp_info
*ri
;
1114 struct bgp_info
*ri1
;
1115 struct bgp_info
*ri2
;
1116 struct bgp_info
*nextri
= NULL
;
1118 /* bgp deterministic-med */
1120 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1121 for (ri1
= rn
->info
; ri1
; ri1
= ri1
->next
)
1123 if (CHECK_FLAG (ri1
->flags
, BGP_INFO_DMED_CHECK
))
1125 if (BGP_INFO_HOLDDOWN (ri1
))
1130 for (ri2
= ri1
->next
; ri2
; ri2
= ri2
->next
)
1132 if (CHECK_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
))
1134 if (BGP_INFO_HOLDDOWN (ri2
))
1137 if (aspath_cmp_left (ri1
->attr
->aspath
, ri2
->attr
->aspath
)
1138 || aspath_cmp_left_confed (ri1
->attr
->aspath
,
1141 if (bgp_info_cmp (bgp
, ri2
, new_select
))
1143 UNSET_FLAG (new_select
->flags
, BGP_INFO_DMED_SELECTED
);
1147 SET_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
);
1150 SET_FLAG (new_select
->flags
, BGP_INFO_DMED_CHECK
);
1151 SET_FLAG (new_select
->flags
, BGP_INFO_DMED_SELECTED
);
1154 /* Check old selected route and new selected route. */
1157 for (ri
= rn
->info
; (ri
!= NULL
) && (nextri
= ri
->next
, 1); ri
= nextri
)
1159 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
1162 if (BGP_INFO_HOLDDOWN (ri
))
1164 /* reap REMOVED routes, if needs be
1165 * selected route must stay for a while longer though
1167 if (CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
)
1168 && (ri
!= old_select
))
1169 bgp_info_reap (rn
, ri
);
1174 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
)
1175 && (! CHECK_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
)))
1177 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_CHECK
);
1180 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_CHECK
);
1181 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
);
1183 if (bgp_info_cmp (bgp
, ri
, new_select
))
1187 result
->old
= old_select
;
1188 result
->new = new_select
;
1194 bgp_process_announce_selected (struct peer
*peer
, struct bgp_info
*selected
,
1195 struct bgp_node
*rn
, struct attr
*attr
, afi_t afi
, safi_t safi
)
1201 /* Announce route to Established peer. */
1202 if (peer
->status
!= Established
)
1205 /* Address family configuration check. */
1206 if (! peer
->afc_nego
[afi
][safi
])
1209 /* First update is deferred until ORF or ROUTE-REFRESH is received */
1210 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
1211 PEER_STATUS_ORF_WAIT_REFRESH
))
1214 switch (rn
->table
->type
)
1216 case BGP_TABLE_MAIN
:
1217 /* Announcement to peer->conf. If the route is filtered,
1219 if (selected
&& bgp_announce_check (selected
, peer
, p
, attr
, afi
, safi
))
1220 bgp_adj_out_set (rn
, peer
, p
, attr
, afi
, safi
, selected
);
1222 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1224 case BGP_TABLE_RSCLIENT
:
1225 /* Announcement to peer->conf. If the route is filtered,
1227 if (selected
&& bgp_announce_check_rsclient
1228 (selected
, peer
, p
, attr
, afi
, safi
))
1229 bgp_adj_out_set (rn
, peer
, p
, attr
, afi
, safi
, selected
);
1231 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1237 struct bgp_process_queue
1240 struct bgp_node
*rn
;
1245 static wq_item_status
1246 bgp_process_rsclient (struct work_queue
*wq
, void *data
)
1248 struct bgp_process_queue
*pq
= data
;
1249 struct bgp
*bgp
= pq
->bgp
;
1250 struct bgp_node
*rn
= pq
->rn
;
1251 afi_t afi
= pq
->afi
;
1252 safi_t safi
= pq
->safi
;
1253 struct bgp_info
*new_select
;
1254 struct bgp_info
*old_select
;
1255 struct bgp_info_pair old_and_new
;
1257 struct listnode
*node
, *nnode
;
1258 struct peer
*rsclient
= rn
->table
->owner
;
1260 /* Best path selection. */
1261 bgp_best_selection (bgp
, rn
, &old_and_new
);
1262 new_select
= old_and_new
.new;
1263 old_select
= old_and_new
.old
;
1265 if (CHECK_FLAG (rsclient
->sflags
, PEER_STATUS_GROUP
))
1267 for (ALL_LIST_ELEMENTS (rsclient
->group
->peer
, node
, nnode
, rsclient
))
1269 /* Nothing to do. */
1270 if (old_select
&& old_select
== new_select
)
1271 if (!CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1275 UNSET_FLAG (old_select
->flags
, BGP_INFO_SELECTED
);
1278 SET_FLAG (new_select
->flags
, BGP_INFO_SELECTED
);
1279 UNSET_FLAG (new_select
->flags
, BGP_INFO_ATTR_CHANGED
);
1282 bgp_process_announce_selected (rsclient
, new_select
, rn
, &attr
,
1289 UNSET_FLAG (old_select
->flags
, BGP_INFO_SELECTED
);
1292 SET_FLAG (new_select
->flags
, BGP_INFO_SELECTED
);
1293 UNSET_FLAG (new_select
->flags
, BGP_INFO_ATTR_CHANGED
);
1295 bgp_process_announce_selected (rsclient
, new_select
, rn
,
1299 if (old_select
&& CHECK_FLAG (old_select
->flags
, BGP_INFO_REMOVED
))
1300 bgp_info_reap (rn
, old_select
);
1302 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1306 static wq_item_status
1307 bgp_process_main (struct work_queue
*wq
, void *data
)
1309 struct bgp_process_queue
*pq
= data
;
1310 struct bgp
*bgp
= pq
->bgp
;
1311 struct bgp_node
*rn
= pq
->rn
;
1312 afi_t afi
= pq
->afi
;
1313 safi_t safi
= pq
->safi
;
1314 struct prefix
*p
= &rn
->p
;
1315 struct bgp_info
*new_select
;
1316 struct bgp_info
*old_select
;
1317 struct bgp_info_pair old_and_new
;
1318 struct listnode
*node
, *nnode
;
1322 /* Best path selection. */
1323 bgp_best_selection (bgp
, rn
, &old_and_new
);
1324 old_select
= old_and_new
.old
;
1325 new_select
= old_and_new
.new;
1327 /* Nothing to do. */
1328 if (old_select
&& old_select
== new_select
)
1330 if (! CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1332 if (CHECK_FLAG (old_select
->flags
, BGP_INFO_IGP_CHANGED
))
1333 bgp_zebra_announce (p
, old_select
, bgp
);
1335 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1341 UNSET_FLAG (old_select
->flags
, BGP_INFO_SELECTED
);
1344 SET_FLAG (new_select
->flags
, BGP_INFO_SELECTED
);
1345 UNSET_FLAG (new_select
->flags
, BGP_INFO_ATTR_CHANGED
);
1349 /* Check each BGP peer. */
1350 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1352 bgp_process_announce_selected (peer
, new_select
, rn
, &attr
, afi
, safi
);
1356 if (safi
== SAFI_UNICAST
&& ! bgp
->name
&&
1357 ! bgp_option_check (BGP_OPT_NO_FIB
))
1360 && new_select
->type
== ZEBRA_ROUTE_BGP
1361 && new_select
->sub_type
== BGP_ROUTE_NORMAL
)
1362 bgp_zebra_announce (p
, new_select
, bgp
);
1365 /* Withdraw the route from the kernel. */
1367 && old_select
->type
== ZEBRA_ROUTE_BGP
1368 && old_select
->sub_type
== BGP_ROUTE_NORMAL
)
1369 bgp_zebra_withdraw (p
, old_select
);
1373 /* Reap old select bgp_info, it it has been removed */
1374 if (old_select
&& CHECK_FLAG (old_select
->flags
, BGP_INFO_REMOVED
))
1375 bgp_info_reap (rn
, old_select
);
1377 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1382 bgp_processq_del (struct work_queue
*wq
, void *data
)
1384 struct bgp_process_queue
*pq
= data
;
1386 bgp_unlock_node (pq
->rn
);
1387 XFREE (MTYPE_BGP_PROCESS_QUEUE
, pq
);
1391 bgp_process_queue_init (void)
1393 bm
->process_main_queue
1394 = work_queue_new (bm
->master
, "process_main_queue");
1395 bm
->process_rsclient_queue
1396 = work_queue_new (bm
->master
, "process_rsclient_queue");
1398 if ( !(bm
->process_main_queue
&& bm
->process_rsclient_queue
) )
1400 zlog_err ("%s: Failed to allocate work queue", __func__
);
1404 bm
->process_main_queue
->spec
.workfunc
= &bgp_process_main
;
1405 bm
->process_rsclient_queue
->spec
.workfunc
= &bgp_process_rsclient
;
1406 bm
->process_main_queue
->spec
.del_item_data
= &bgp_processq_del
;
1407 bm
->process_rsclient_queue
->spec
.del_item_data
1408 = bm
->process_main_queue
->spec
.del_item_data
;
1409 bm
->process_main_queue
->spec
.max_retries
1410 = bm
->process_main_queue
->spec
.max_retries
= 0;
1411 bm
->process_rsclient_queue
->spec
.hold
1412 = bm
->process_main_queue
->spec
.hold
= 500;
1416 bgp_process (struct bgp
*bgp
, struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
1418 struct bgp_process_queue
*pqnode
;
1420 /* already scheduled for processing? */
1421 if (CHECK_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
))
1424 if ( (bm
->process_main_queue
== NULL
) ||
1425 (bm
->process_rsclient_queue
== NULL
) )
1426 bgp_process_queue_init ();
1428 pqnode
= XCALLOC (MTYPE_BGP_PROCESS_QUEUE
,
1429 sizeof (struct bgp_process_queue
));
1433 pqnode
->rn
= bgp_lock_node (rn
); /* unlocked by bgp_processq_del */
1436 pqnode
->safi
= safi
;
1438 switch (rn
->table
->type
)
1440 case BGP_TABLE_MAIN
:
1441 work_queue_add (bm
->process_main_queue
, pqnode
);
1443 case BGP_TABLE_RSCLIENT
:
1444 work_queue_add (bm
->process_rsclient_queue
, pqnode
);
1452 bgp_maximum_prefix_restart_timer (struct thread
*thread
)
1456 peer
= THREAD_ARG (thread
);
1457 peer
->t_pmax_restart
= NULL
;
1459 if (BGP_DEBUG (events
, EVENTS
))
1460 zlog_debug ("%s Maximum-prefix restart timer expired, restore peering",
1469 bgp_maximum_prefix_overflow (struct peer
*peer
, afi_t afi
,
1470 safi_t safi
, int always
)
1472 if (!CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
1475 if (peer
->pcount
[afi
][safi
] > peer
->pmax
[afi
][safi
])
1477 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
)
1481 zlog (peer
->log
, LOG_INFO
,
1482 "%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, "
1483 "limit %ld", afi_safi_print (afi
, safi
), peer
->host
,
1484 peer
->pcount
[afi
][safi
], peer
->pmax
[afi
][safi
]);
1485 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1487 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
1493 if (safi
== SAFI_MPLS_VPN
)
1494 safi
= BGP_SAFI_VPNV4
;
1496 ndata
[0] = (afi
>> 8);
1499 ndata
[3] = (peer
->pmax
[afi
][safi
] >> 24);
1500 ndata
[4] = (peer
->pmax
[afi
][safi
] >> 16);
1501 ndata
[5] = (peer
->pmax
[afi
][safi
] >> 8);
1502 ndata
[6] = (peer
->pmax
[afi
][safi
]);
1504 SET_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
);
1505 bgp_notify_send_with_data (peer
, BGP_NOTIFY_CEASE
,
1506 BGP_NOTIFY_CEASE_MAX_PREFIX
, ndata
, 7);
1509 /* restart timer start */
1510 if (peer
->pmax_restart
[afi
][safi
])
1512 peer
->v_pmax_restart
= peer
->pmax_restart
[afi
][safi
] * 60;
1514 if (BGP_DEBUG (events
, EVENTS
))
1515 zlog_debug ("%s Maximum-prefix restart timer started for %d secs",
1516 peer
->host
, peer
->v_pmax_restart
);
1518 BGP_TIMER_ON (peer
->t_pmax_restart
, bgp_maximum_prefix_restart_timer
,
1519 peer
->v_pmax_restart
);
1525 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1527 if (peer
->pcount
[afi
][safi
] > (peer
->pmax
[afi
][safi
] * peer
->pmax_threshold
[afi
][safi
] / 100))
1529 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
)
1533 zlog (peer
->log
, LOG_INFO
,
1534 "%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld",
1535 afi_safi_print (afi
, safi
), peer
->host
, peer
->pcount
[afi
][safi
],
1536 peer
->pmax
[afi
][safi
]);
1537 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
1540 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
1545 bgp_pcount_increment (struct bgp_node
*rn
, struct bgp_info
*ri
,
1546 afi_t afi
, safi_t safi
)
1550 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
)
1551 && rn
->table
->type
== BGP_TABLE_MAIN
)
1553 SET_FLAG (ri
->flags
, BGP_INFO_COUNTED
);
1554 ri
->peer
->pcount
[afi
][safi
]++;
1559 bgp_pcount_decrement (struct bgp_node
*rn
, struct bgp_info
*ri
,
1560 afi_t afi
, safi_t safi
)
1562 /* Ignore 'pcount' for RS-client tables */
1563 if (CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
)
1564 && rn
->table
->type
== BGP_TABLE_MAIN
)
1566 UNSET_FLAG (ri
->flags
, BGP_INFO_COUNTED
);
1568 /* slight hack, but more robust against errors. */
1569 if (ri
->peer
->pcount
[afi
][safi
])
1570 ri
->peer
->pcount
[afi
][safi
]--;
1573 zlog_warn ("%s: Asked to decrement 0 prefix count for peer %s",
1574 __func__
, ri
->peer
->host
);
1575 zlog_backtrace (LOG_WARNING
);
1576 zlog_warn ("%s: Please report to Quagga bugzilla", __func__
);
1581 /* Unconditionally remove the route from the RIB, without taking
1582 * damping into consideration (eg, because the session went down)
1585 bgp_rib_remove (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
1586 afi_t afi
, safi_t safi
)
1588 bgp_pcount_decrement (rn
, ri
, afi
, safi
);
1589 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1591 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1592 bgp_info_delete (rn
, ri
); /* keep historical info */
1594 bgp_process (peer
->bgp
, rn
, afi
, safi
);
1598 bgp_rib_withdraw (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
1599 afi_t afi
, safi_t safi
)
1601 int status
= BGP_DAMP_NONE
;
1603 /* apply dampening, if result is suppressed, we'll be retaining
1604 * the bgp_info in the RIB for historical reference.
1606 if (CHECK_FLAG (peer
->bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1607 && peer_sort (peer
) == BGP_PEER_EBGP
)
1608 if ( (status
= bgp_damp_withdraw (ri
, rn
, afi
, safi
, 0))
1609 == BGP_DAMP_SUPPRESSED
)
1611 bgp_pcount_decrement (rn
, ri
, afi
, safi
);
1612 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1616 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
1620 bgp_update_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
1621 struct attr
*attr
, struct peer
*peer
, struct prefix
*p
, int type
,
1622 int sub_type
, struct prefix_rd
*prd
, u_char
*tag
)
1624 struct bgp_node
*rn
;
1626 struct attr new_attr
;
1627 struct attr
*attr_new
;
1628 struct attr
*attr_new2
;
1629 struct bgp_info
*ri
;
1630 struct bgp_info
*new;
1632 char buf
[SU_ADDRSTRLEN
];
1634 /* Do not insert announces from a rsclient into its own 'bgp_table'. */
1635 if (peer
== rsclient
)
1639 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1641 /* Check previously received route. */
1642 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1643 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1646 /* AS path loop check. */
1647 if (aspath_loop_check (attr
->aspath
, rsclient
->as
) > peer
->allowas_in
[afi
][safi
])
1649 reason
= "as-path contains our own AS;";
1653 /* Route reflector originator ID check. */
1654 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
1655 && IPV4_ADDR_SAME (&rsclient
->remote_id
, &attr
->originator_id
))
1657 reason
= "originator is us;";
1663 /* Apply export policy. */
1664 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
) &&
1665 bgp_export_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1667 reason
= "export-policy;";
1671 attr_new2
= bgp_attr_intern (&new_attr
);
1673 /* Apply import policy. */
1674 if (bgp_import_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1676 bgp_attr_unintern (attr_new2
);
1678 reason
= "import-policy;";
1682 attr_new
= bgp_attr_intern (&new_attr
);
1683 bgp_attr_unintern (attr_new2
);
1685 /* IPv4 unicast next hop check. */
1686 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
1688 /* Next hop must not be 0.0.0.0 nor Class E address. */
1689 if (new_attr
.nexthop
.s_addr
== 0
1690 || ntohl (new_attr
.nexthop
.s_addr
) >= 0xe0000000)
1692 bgp_attr_unintern (attr_new
);
1694 reason
= "martian next-hop;";
1699 /* If the update is implicit withdraw. */
1702 ri
->uptime
= time (NULL
);
1704 /* Same attribute comes in. */
1705 if (attrhash_cmp (ri
->attr
, attr_new
))
1708 UNSET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1710 if (BGP_DEBUG (update
, UPDATE_IN
))
1711 zlog (peer
->log
, LOG_DEBUG
,
1712 "%s rcvd %s/%d for RS-client %s...duplicate ignored",
1714 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1715 p
->prefixlen
, rsclient
->host
);
1717 bgp_unlock_node (rn
);
1718 bgp_attr_unintern (attr_new
);
1723 /* Received Logging. */
1724 if (BGP_DEBUG (update
, UPDATE_IN
))
1725 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
1727 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1728 p
->prefixlen
, rsclient
->host
);
1730 /* The attribute is changed. */
1731 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1733 /* Update to new attribute. */
1734 bgp_attr_unintern (ri
->attr
);
1735 ri
->attr
= attr_new
;
1737 /* Update MPLS tag. */
1738 if (safi
== SAFI_MPLS_VPN
)
1739 memcpy (ri
->tag
, tag
, 3);
1741 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1743 /* Process change. */
1744 bgp_process (bgp
, rn
, afi
, safi
);
1745 bgp_unlock_node (rn
);
1750 /* Received Logging. */
1751 if (BGP_DEBUG (update
, UPDATE_IN
))
1753 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
1755 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1756 p
->prefixlen
, rsclient
->host
);
1759 /* Make new BGP info. */
1760 new = bgp_info_new ();
1762 new->sub_type
= sub_type
;
1764 new->attr
= attr_new
;
1765 new->uptime
= time (NULL
);
1767 /* Update MPLS tag. */
1768 if (safi
== SAFI_MPLS_VPN
)
1769 memcpy (new->tag
, tag
, 3);
1771 SET_FLAG (new->flags
, BGP_INFO_VALID
);
1773 /* Register new BGP information. */
1774 bgp_info_add (rn
, new);
1776 /* route_node_get lock */
1777 bgp_unlock_node (rn
);
1779 /* Process change. */
1780 bgp_process (bgp
, rn
, afi
, safi
);
1786 /* This BGP update is filtered. Log the reason then update BGP entry. */
1787 if (BGP_DEBUG (update
, UPDATE_IN
))
1788 zlog (peer
->log
, LOG_DEBUG
,
1789 "%s rcvd UPDATE about %s/%d -- DENIED for RS-client %s due to: %s",
1791 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1792 p
->prefixlen
, rsclient
->host
, reason
);
1795 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
1797 bgp_unlock_node (rn
);
1803 bgp_withdraw_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
1804 struct peer
*peer
, struct prefix
*p
, int type
, int sub_type
,
1805 struct prefix_rd
*prd
, u_char
*tag
)
1807 struct bgp_node
*rn
;
1808 struct bgp_info
*ri
;
1809 char buf
[SU_ADDRSTRLEN
];
1811 if (rsclient
== peer
)
1814 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1816 /* Lookup withdrawn route. */
1817 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1818 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1821 /* Withdraw specified route from routing table. */
1822 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1823 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
1824 else if (BGP_DEBUG (update
, UPDATE_IN
))
1825 zlog (peer
->log
, LOG_DEBUG
,
1826 "%s Can't find the route %s/%d", peer
->host
,
1827 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1830 /* Unlock bgp_node_get() lock. */
1831 bgp_unlock_node (rn
);
1835 bgp_update_main (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
1836 afi_t afi
, safi_t safi
, int type
, int sub_type
,
1837 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
1840 int aspath_loop_count
= 0;
1841 struct bgp_node
*rn
;
1843 struct attr new_attr
;
1844 struct attr
*attr_new
;
1845 struct bgp_info
*ri
;
1846 struct bgp_info
*new;
1848 char buf
[SU_ADDRSTRLEN
];
1851 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1853 /* When peer's soft reconfiguration enabled. Record input packet in
1855 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
1856 && peer
!= bgp
->peer_self
&& ! soft_reconfig
)
1857 bgp_adj_in_set (rn
, peer
, attr
);
1859 /* Check previously received route. */
1860 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1861 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1864 /* AS path local-as loop check. */
1865 if (peer
->change_local_as
)
1867 if (! CHECK_FLAG (peer
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
1868 aspath_loop_count
= 1;
1870 if (aspath_loop_check (attr
->aspath
, peer
->change_local_as
) > aspath_loop_count
)
1872 reason
= "as-path contains our own AS;";
1877 /* AS path loop check. */
1878 if (aspath_loop_check (attr
->aspath
, bgp
->as
) > peer
->allowas_in
[afi
][safi
]
1879 || (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
1880 && aspath_loop_check(attr
->aspath
, bgp
->confed_id
)
1881 > peer
->allowas_in
[afi
][safi
]))
1883 reason
= "as-path contains our own AS;";
1887 /* Route reflector originator ID check. */
1888 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
1889 && IPV4_ADDR_SAME (&bgp
->router_id
, &attr
->originator_id
))
1891 reason
= "originator is us;";
1895 /* Route reflector cluster ID check. */
1896 if (bgp_cluster_filter (peer
, attr
))
1898 reason
= "reflected from the same cluster;";
1902 /* Apply incoming filter. */
1903 if (bgp_input_filter (peer
, p
, attr
, afi
, safi
) == FILTER_DENY
)
1909 /* Apply incoming route-map. */
1912 if (bgp_input_modifier (peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1914 reason
= "route-map;";
1918 /* IPv4 unicast next hop check. */
1919 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
1921 /* If the peer is EBGP and nexthop is not on connected route,
1923 if (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
== 1
1924 && ! bgp_nexthop_check_ebgp (afi
, &new_attr
)
1925 && ! CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
))
1927 reason
= "non-connected next-hop;";
1931 /* Next hop must not be 0.0.0.0 nor Class E address. Next hop
1932 must not be my own address. */
1933 if (bgp_nexthop_self (afi
, &new_attr
)
1934 || new_attr
.nexthop
.s_addr
== 0
1935 || ntohl (new_attr
.nexthop
.s_addr
) >= 0xe0000000)
1937 reason
= "martian next-hop;";
1942 attr_new
= bgp_attr_intern (&new_attr
);
1944 /* If the update is implicit withdraw. */
1947 ri
->uptime
= time (NULL
);
1949 /* Same attribute comes in. */
1950 if (attrhash_cmp (ri
->attr
, attr_new
))
1952 UNSET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1954 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1955 && peer_sort (peer
) == BGP_PEER_EBGP
1956 && CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1958 if (BGP_DEBUG (update
, UPDATE_IN
))
1959 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
1961 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1964 bgp_pcount_increment (rn
, ri
, afi
, safi
);
1966 if (bgp_damp_update (ri
, rn
, afi
, safi
) != BGP_DAMP_SUPPRESSED
)
1968 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
1969 bgp_process (bgp
, rn
, afi
, safi
);
1974 if (BGP_DEBUG (update
, UPDATE_IN
))
1975 zlog (peer
->log
, LOG_DEBUG
,
1976 "%s rcvd %s/%d...duplicate ignored",
1978 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1981 /* graceful restart STALE flag unset. */
1982 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
1984 UNSET_FLAG (ri
->flags
, BGP_INFO_STALE
);
1985 bgp_pcount_increment (rn
, ri
, afi
, safi
);
1986 bgp_process (bgp
, rn
, afi
, safi
);
1990 bgp_unlock_node (rn
);
1991 bgp_attr_unintern (attr_new
);
1995 /* Received Logging. */
1996 if (BGP_DEBUG (update
, UPDATE_IN
))
1997 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
1999 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2002 /* graceful restart STALE flag unset. */
2003 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2004 UNSET_FLAG (ri
->flags
, BGP_INFO_STALE
);
2006 /* The attribute is changed. */
2007 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
2009 /* implicit withdraw, decrement aggregate and pcount here.
2010 * only if update is accepted, they'll increment below.
2012 bgp_pcount_decrement (rn
, ri
, afi
, safi
);
2013 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
2015 /* Update bgp route dampening information. */
2016 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2017 && peer_sort (peer
) == BGP_PEER_EBGP
)
2019 /* This is implicit withdraw so we should update dampening
2021 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2022 bgp_damp_withdraw (ri
, rn
, afi
, safi
, 1);
2025 /* Update to new attribute. */
2026 bgp_attr_unintern (ri
->attr
);
2027 ri
->attr
= attr_new
;
2029 /* Update MPLS tag. */
2030 if (safi
== SAFI_MPLS_VPN
)
2031 memcpy (ri
->tag
, tag
, 3);
2033 /* Update bgp route dampening information. */
2034 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2035 && peer_sort (peer
) == BGP_PEER_EBGP
)
2037 /* Now we do normal update dampening. */
2038 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
2039 if (ret
== BGP_DAMP_SUPPRESSED
)
2041 bgp_unlock_node (rn
);
2046 /* Nexthop reachability check. */
2047 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
2048 && safi
== SAFI_UNICAST
2049 && (peer_sort (peer
) == BGP_PEER_IBGP
2050 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
2051 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
2053 if (bgp_nexthop_lookup (afi
, peer
, ri
, NULL
, NULL
))
2054 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2056 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2059 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2061 /* Process change. */
2062 bgp_pcount_increment (rn
, ri
, afi
, safi
);
2063 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2065 bgp_process (bgp
, rn
, afi
, safi
);
2066 bgp_unlock_node (rn
);
2070 /* Received Logging. */
2071 if (BGP_DEBUG (update
, UPDATE_IN
))
2073 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2075 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2079 /* Make new BGP info. */
2080 new = bgp_info_new ();
2082 new->sub_type
= sub_type
;
2084 new->attr
= attr_new
;
2085 new->uptime
= time (NULL
);
2087 /* Update MPLS tag. */
2088 if (safi
== SAFI_MPLS_VPN
)
2089 memcpy (new->tag
, tag
, 3);
2091 /* Nexthop reachability check. */
2092 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
2093 && safi
== SAFI_UNICAST
2094 && (peer_sort (peer
) == BGP_PEER_IBGP
2095 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
2096 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
2098 if (bgp_nexthop_lookup (afi
, peer
, new, NULL
, NULL
))
2099 SET_FLAG (new->flags
, BGP_INFO_VALID
);
2101 UNSET_FLAG (new->flags
, BGP_INFO_VALID
);
2104 SET_FLAG (new->flags
, BGP_INFO_VALID
);
2106 /* Increment prefix */
2107 bgp_pcount_increment (rn
, new, afi
, safi
);
2108 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
2110 /* Register new BGP information. */
2111 bgp_info_add (rn
, new);
2113 /* route_node_get lock */
2114 bgp_unlock_node (rn
);
2116 /* If maximum prefix count is configured and current prefix
2118 if (bgp_maximum_prefix_overflow (peer
, afi
, safi
, 0))
2121 /* Process change. */
2122 bgp_process (bgp
, rn
, afi
, safi
);
2126 /* This BGP update is filtered. Log the reason then update BGP
2129 if (BGP_DEBUG (update
, UPDATE_IN
))
2130 zlog (peer
->log
, LOG_DEBUG
,
2131 "%s rcvd UPDATE about %s/%d -- DENIED due to: %s",
2133 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2134 p
->prefixlen
, reason
);
2137 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2139 bgp_unlock_node (rn
);
2145 bgp_update (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2146 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2147 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
2149 struct peer
*rsclient
;
2150 struct listnode
*node
, *nnode
;
2154 ret
= bgp_update_main (peer
, p
, attr
, afi
, safi
, type
, sub_type
, prd
, tag
,
2159 /* Process the update for each RS-client. */
2160 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2162 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2163 bgp_update_rsclient (rsclient
, afi
, safi
, attr
, peer
, p
, type
,
2164 sub_type
, prd
, tag
);
2171 bgp_withdraw (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2172 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2173 struct prefix_rd
*prd
, u_char
*tag
)
2176 char buf
[SU_ADDRSTRLEN
];
2177 struct bgp_node
*rn
;
2178 struct bgp_info
*ri
;
2179 struct peer
*rsclient
;
2180 struct listnode
*node
, *nnode
;
2184 /* Process the withdraw for each RS-client. */
2185 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2187 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2188 bgp_withdraw_rsclient (rsclient
, afi
, safi
, peer
, p
, type
, sub_type
, prd
, tag
);
2192 if (BGP_DEBUG (update
, UPDATE_IN
))
2193 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd UPDATE about %s/%d -- withdrawn",
2195 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2199 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2201 /* If peer is soft reconfiguration enabled. Record input packet for
2202 further calculation. */
2203 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2204 && peer
!= bgp
->peer_self
)
2205 bgp_adj_in_unset (rn
, peer
);
2207 /* Lookup withdrawn route. */
2208 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2209 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2212 /* Withdraw specified route from routing table. */
2213 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2214 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
2215 else if (BGP_DEBUG (update
, UPDATE_IN
))
2216 zlog (peer
->log
, LOG_DEBUG
,
2217 "%s Can't find the route %s/%d", peer
->host
,
2218 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2221 /* Unlock bgp_node_get() lock. */
2222 bgp_unlock_node (rn
);
2228 bgp_default_originate (struct peer
*peer
, afi_t afi
, safi_t safi
, int withdraw
)
2232 struct aspath
*aspath
;
2234 struct bgp_info binfo
;
2236 int ret
= RMAP_DENYMATCH
;
2239 from
= bgp
->peer_self
;
2241 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
2242 aspath
= attr
.aspath
;
2243 attr
.local_pref
= bgp
->default_local_pref
;
2244 memcpy (&attr
.nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
2247 str2prefix ("0.0.0.0/0", &p
);
2249 else if (afi
== AFI_IP6
)
2251 str2prefix ("::/0", &p
);
2253 /* IPv6 global nexthop must be included. */
2254 memcpy (&attr
.mp_nexthop_global
, &peer
->nexthop
.v6_global
,
2256 attr
.mp_nexthop_len
= 16;
2258 /* If the peer is on shared nextwork and we have link-local
2260 if (peer
->shared_network
2261 && !IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
2263 memcpy (&attr
.mp_nexthop_local
, &peer
->nexthop
.v6_local
,
2265 attr
.mp_nexthop_len
= 32;
2268 #endif /* HAVE_IPV6 */
2272 if (peer
->default_rmap
[afi
][safi
].name
)
2274 binfo
.peer
= bgp
->peer_self
;
2277 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_DEFAULT
);
2279 ret
= route_map_apply (peer
->default_rmap
[afi
][safi
].map
, &p
,
2282 bgp
->peer_self
->rmap_type
= 0;
2284 if (ret
== RMAP_DENYMATCH
)
2286 bgp_attr_flush (&attr
);
2293 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
2294 bgp_default_withdraw_send (peer
, afi
, safi
);
2295 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2299 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2300 bgp_default_update_send (peer
, &attr
, afi
, safi
, from
);
2303 aspath_unintern (aspath
);
2307 bgp_announce_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2308 struct bgp_table
*table
, int rsclient
)
2310 struct bgp_node
*rn
;
2311 struct bgp_info
*ri
;
2315 table
= (rsclient
) ? peer
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2317 if (safi
!= SAFI_MPLS_VPN
2318 && CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
2319 bgp_default_originate (peer
, afi
, safi
, 0);
2321 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next(rn
))
2322 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2323 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
) && ri
->peer
!= peer
)
2326 (bgp_announce_check_rsclient (ri
, peer
, &rn
->p
, &attr
, afi
, safi
))
2327 : (bgp_announce_check (ri
, peer
, &rn
->p
, &attr
, afi
, safi
)))
2328 bgp_adj_out_set (rn
, peer
, &rn
->p
, &attr
, afi
, safi
, ri
);
2330 bgp_adj_out_unset (rn
, peer
, &rn
->p
, afi
, safi
);
2335 bgp_announce_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2337 struct bgp_node
*rn
;
2338 struct bgp_table
*table
;
2340 if (peer
->status
!= Established
)
2343 if (! peer
->afc_nego
[afi
][safi
])
2346 /* First update is deferred until ORF or ROUTE-REFRESH is received */
2347 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
2350 if (safi
!= SAFI_MPLS_VPN
)
2351 bgp_announce_table (peer
, afi
, safi
, NULL
, 0);
2353 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2354 rn
= bgp_route_next(rn
))
2355 if ((table
= (rn
->info
)) != NULL
)
2356 bgp_announce_table (peer
, afi
, safi
, table
, 0);
2358 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2359 bgp_announce_table (peer
, afi
, safi
, NULL
, 1);
2363 bgp_announce_route_all (struct peer
*peer
)
2368 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2369 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2370 bgp_announce_route (peer
, afi
, safi
);
2374 bgp_soft_reconfig_table_rsclient (struct peer
*rsclient
, afi_t afi
,
2375 safi_t safi
, struct bgp_table
*table
)
2377 struct bgp_node
*rn
;
2378 struct bgp_adj_in
*ain
;
2381 table
= rsclient
->bgp
->rib
[afi
][safi
];
2383 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2384 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2386 bgp_update_rsclient (rsclient
, afi
, safi
, ain
->attr
, ain
->peer
,
2387 &rn
->p
, ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
2392 bgp_soft_reconfig_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
2394 struct bgp_table
*table
;
2395 struct bgp_node
*rn
;
2397 if (safi
!= SAFI_MPLS_VPN
)
2398 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, NULL
);
2401 for (rn
= bgp_table_top (rsclient
->bgp
->rib
[afi
][safi
]); rn
;
2402 rn
= bgp_route_next (rn
))
2403 if ((table
= rn
->info
) != NULL
)
2404 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, table
);
2408 bgp_soft_reconfig_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2409 struct bgp_table
*table
)
2412 struct bgp_node
*rn
;
2413 struct bgp_adj_in
*ain
;
2416 table
= peer
->bgp
->rib
[afi
][safi
];
2418 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2419 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2421 if (ain
->peer
== peer
)
2423 ret
= bgp_update (peer
, &rn
->p
, ain
->attr
, afi
, safi
,
2424 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
,
2428 bgp_unlock_node (rn
);
2437 bgp_soft_reconfig_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2439 struct bgp_node
*rn
;
2440 struct bgp_table
*table
;
2442 if (peer
->status
!= Established
)
2445 if (safi
!= SAFI_MPLS_VPN
)
2446 bgp_soft_reconfig_table (peer
, afi
, safi
, NULL
);
2448 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2449 rn
= bgp_route_next (rn
))
2450 if ((table
= rn
->info
) != NULL
)
2451 bgp_soft_reconfig_table (peer
, afi
, safi
, table
);
2454 static wq_item_status
2455 bgp_clear_route_node (struct work_queue
*wq
, void *data
)
2457 struct bgp_node
*rn
= data
;
2458 struct peer
*peer
= wq
->spec
.data
;
2459 struct bgp_adj_in
*ain
;
2460 struct bgp_adj_out
*aout
;
2461 struct bgp_info
*ri
;
2462 afi_t afi
= rn
->table
->afi
;
2463 safi_t safi
= rn
->table
->safi
;
2465 assert (rn
&& peer
);
2467 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2468 if (ri
->peer
== peer
)
2470 /* graceful restart STALE flag set. */
2471 if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_NSF_WAIT
)
2472 && peer
->nsf
[afi
][safi
]
2473 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
)
2474 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
)
2475 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
2476 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
))
2478 bgp_pcount_decrement (rn
, ri
, afi
, safi
);
2479 SET_FLAG (ri
->flags
, BGP_INFO_STALE
);
2482 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2485 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2486 if (ain
->peer
== peer
)
2488 bgp_adj_in_remove (rn
, ain
);
2489 bgp_unlock_node (rn
);
2492 for (aout
= rn
->adj_out
; aout
; aout
= aout
->next
)
2493 if (aout
->peer
== peer
)
2495 bgp_adj_out_remove (rn
, aout
, peer
, afi
, safi
);
2496 bgp_unlock_node (rn
);
2503 bgp_clear_node_queue_del (struct work_queue
*wq
, void *data
)
2505 struct bgp_node
*rn
= data
;
2507 bgp_unlock_node (rn
);
2511 bgp_clear_node_complete (struct work_queue
*wq
)
2513 struct peer
*peer
= wq
->spec
.data
;
2515 UNSET_FLAG (peer
->sflags
, PEER_STATUS_CLEARING
);
2516 peer_unlock (peer
); /* bgp_clear_node_complete */
2518 /* Tickle FSM to start moving again */
2519 BGP_EVENT_ADD (peer
, BGP_Start
);
2523 bgp_clear_node_queue_init (struct peer
*peer
)
2525 #define CLEAR_QUEUE_NAME_LEN 26 /* "clear 2001:123:123:123::1" */
2526 char wname
[CLEAR_QUEUE_NAME_LEN
];
2528 snprintf (wname
, CLEAR_QUEUE_NAME_LEN
, "clear %s", peer
->host
);
2529 #undef CLEAR_QUEUE_NAME_LEN
2531 if ( (peer
->clear_node_queue
= work_queue_new (bm
->master
, wname
)) == NULL
)
2533 zlog_err ("%s: Failed to allocate work queue", __func__
);
2536 peer
->clear_node_queue
->spec
.hold
= 10;
2537 peer
->clear_node_queue
->spec
.workfunc
= &bgp_clear_route_node
;
2538 peer
->clear_node_queue
->spec
.del_item_data
= &bgp_clear_node_queue_del
;
2539 peer
->clear_node_queue
->spec
.completion_func
= &bgp_clear_node_complete
;
2540 peer
->clear_node_queue
->spec
.max_retries
= 0;
2542 /* we only 'lock' this peer reference when the queue is actually active */
2543 peer
->clear_node_queue
->spec
.data
= peer
;
2547 bgp_clear_route_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2548 struct bgp_table
*table
, struct peer
*rsclient
)
2550 struct bgp_node
*rn
;
2553 table
= (rsclient
) ? rsclient
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2555 /* If still no table => afi/safi isn't configured at all or smth. */
2559 if (peer
->clear_node_queue
== NULL
)
2560 bgp_clear_node_queue_init (peer
);
2562 /* bgp_fsm.c will not bring CLEARING sessions out of Idle this
2563 * protects against peers which flap faster than we can we clear,
2564 * which could lead to:
2566 * a) race with routes from the new session being installed before
2567 * clear_route_node visits the node (to delete the route of that
2569 * b) resource exhaustion, clear_route_node likely leads to an entry
2570 * on the process_main queue. Fast-flapping could cause that queue
2573 if (!CHECK_FLAG (peer
->sflags
, PEER_STATUS_CLEARING
))
2575 SET_FLAG (peer
->sflags
, PEER_STATUS_CLEARING
);
2576 peer_lock (peer
); /* bgp_clear_node_complete */
2579 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2581 if (rn
->info
== NULL
)
2584 bgp_lock_node (rn
); /* unlocked: bgp_clear_node_queue_del */
2585 work_queue_add (peer
->clear_node_queue
, rn
);
2591 bgp_clear_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2593 struct bgp_node
*rn
;
2594 struct bgp_table
*table
;
2595 struct peer
*rsclient
;
2596 struct listnode
*node
, *nnode
;
2598 if (safi
!= SAFI_MPLS_VPN
)
2599 bgp_clear_route_table (peer
, afi
, safi
, NULL
, NULL
);
2601 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2602 rn
= bgp_route_next (rn
))
2603 if ((table
= rn
->info
) != NULL
)
2604 bgp_clear_route_table (peer
, afi
, safi
, table
, NULL
);
2606 for (ALL_LIST_ELEMENTS (peer
->bgp
->rsclient
, node
, nnode
, rsclient
))
2608 if (CHECK_FLAG(rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2609 bgp_clear_route_table (peer
, afi
, safi
, NULL
, rsclient
);
2614 bgp_clear_route_all (struct peer
*peer
)
2619 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2620 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2621 bgp_clear_route (peer
, afi
, safi
);
2625 bgp_clear_adj_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2627 struct bgp_table
*table
;
2628 struct bgp_node
*rn
;
2629 struct bgp_adj_in
*ain
;
2631 table
= peer
->bgp
->rib
[afi
][safi
];
2633 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2634 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2635 if (ain
->peer
== peer
)
2637 bgp_adj_in_remove (rn
, ain
);
2638 bgp_unlock_node (rn
);
2644 bgp_clear_stale_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2646 struct bgp_node
*rn
;
2647 struct bgp_info
*ri
;
2648 struct bgp_table
*table
;
2650 table
= peer
->bgp
->rib
[afi
][safi
];
2652 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2654 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2655 if (ri
->peer
== peer
)
2657 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2658 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2664 /* Delete all kernel routes. */
2666 bgp_cleanup_routes ()
2669 struct listnode
*node
, *nnode
;
2670 struct bgp_node
*rn
;
2671 struct bgp_table
*table
;
2672 struct bgp_info
*ri
;
2674 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
2676 table
= bgp
->rib
[AFI_IP
][SAFI_UNICAST
];
2678 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2679 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2680 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
2681 && ri
->type
== ZEBRA_ROUTE_BGP
2682 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
2683 bgp_zebra_withdraw (&rn
->p
, ri
);
2685 table
= bgp
->rib
[AFI_IP6
][SAFI_UNICAST
];
2687 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2688 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2689 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
2690 && ri
->type
== ZEBRA_ROUTE_BGP
2691 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
2692 bgp_zebra_withdraw (&rn
->p
, ri
);
2700 bgp_zclient_reset ();
2701 access_list_reset ();
2702 prefix_list_reset ();
2705 /* Parse NLRI stream. Withdraw NLRI is recognized by NULL attr
2708 bgp_nlri_parse (struct peer
*peer
, struct attr
*attr
, struct bgp_nlri
*packet
)
2716 /* Check peer status. */
2717 if (peer
->status
!= Established
)
2721 lim
= pnt
+ packet
->length
;
2723 for (; pnt
< lim
; pnt
+= psize
)
2725 /* Clear prefix structure. */
2726 memset (&p
, 0, sizeof (struct prefix
));
2728 /* Fetch prefix length. */
2729 p
.prefixlen
= *pnt
++;
2730 p
.family
= afi2family (packet
->afi
);
2732 /* Already checked in nlri_sanity_check(). We do double check
2734 if ((packet
->afi
== AFI_IP
&& p
.prefixlen
> 32)
2735 || (packet
->afi
== AFI_IP6
&& p
.prefixlen
> 128))
2738 /* Packet size overflow check. */
2739 psize
= PSIZE (p
.prefixlen
);
2741 /* When packet overflow occur return immediately. */
2742 if (pnt
+ psize
> lim
)
2745 /* Fetch prefix from NLRI packet. */
2746 memcpy (&p
.u
.prefix
, pnt
, psize
);
2748 /* Check address. */
2749 if (packet
->afi
== AFI_IP
&& packet
->safi
== SAFI_UNICAST
)
2751 if (IN_CLASSD (ntohl (p
.u
.prefix4
.s_addr
)))
2754 * From draft-ietf-idr-bgp4-22, Section 6.3:
2755 * If a BGP router receives an UPDATE message with a
2756 * semantically incorrect NLRI field, in which a prefix is
2757 * semantically incorrect (eg. an unexpected multicast IP
2758 * address), it should ignore the prefix.
2760 zlog (peer
->log
, LOG_ERR
,
2761 "IPv4 unicast NLRI is multicast address %s",
2762 inet_ntoa (p
.u
.prefix4
));
2769 /* Check address. */
2770 if (packet
->afi
== AFI_IP6
&& packet
->safi
== SAFI_UNICAST
)
2772 if (IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
2776 zlog (peer
->log
, LOG_WARNING
,
2777 "IPv6 link-local NLRI received %s ignore this NLRI",
2778 inet_ntop (AF_INET6
, &p
.u
.prefix6
, buf
, BUFSIZ
));
2783 #endif /* HAVE_IPV6 */
2785 /* Normal process. */
2787 ret
= bgp_update (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
2788 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
, 0);
2790 ret
= bgp_withdraw (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
2791 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
2793 /* Address family configuration mismatch or maximum-prefix count
2799 /* Packet length consistency check. */
2806 /* NLRI encode syntax check routine. */
2808 bgp_nlri_sanity_check (struct peer
*peer
, int afi
, u_char
*pnt
,
2817 /* RFC1771 6.3 The NLRI field in the UPDATE message is checked for
2818 syntactic validity. If the field is syntactically incorrect,
2819 then the Error Subcode is set to Invalid Network Field. */
2825 /* Prefix length check. */
2826 if ((afi
== AFI_IP
&& prefixlen
> 32)
2827 || (afi
== AFI_IP6
&& prefixlen
> 128))
2829 plog_err (peer
->log
,
2830 "%s [Error] Update packet error (wrong prefix length %d)",
2831 peer
->host
, prefixlen
);
2832 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
2833 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
2837 /* Packet size overflow check. */
2838 psize
= PSIZE (prefixlen
);
2840 if (pnt
+ psize
> end
)
2842 plog_err (peer
->log
,
2843 "%s [Error] Update packet error"
2844 " (prefix data overflow prefix size is %d)",
2846 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
2847 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
2854 /* Packet length consistency check. */
2857 plog_err (peer
->log
,
2858 "%s [Error] Update packet error"
2859 " (prefix length mismatch with total length)",
2861 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
2862 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
2868 static struct bgp_static
*
2871 struct bgp_static
*new;
2872 new = XMALLOC (MTYPE_BGP_STATIC
, sizeof (struct bgp_static
));
2873 memset (new, 0, sizeof (struct bgp_static
));
2878 bgp_static_free (struct bgp_static
*bgp_static
)
2880 if (bgp_static
->rmap
.name
)
2881 free (bgp_static
->rmap
.name
);
2882 XFREE (MTYPE_BGP_STATIC
, bgp_static
);
2886 bgp_static_withdraw_rsclient (struct bgp
*bgp
, struct peer
*rsclient
,
2887 struct prefix
*p
, afi_t afi
, safi_t safi
)
2889 struct bgp_node
*rn
;
2890 struct bgp_info
*ri
;
2892 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
2894 /* Check selected route and self inserted route. */
2895 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2896 if (ri
->peer
== bgp
->peer_self
2897 && ri
->type
== ZEBRA_ROUTE_BGP
2898 && ri
->sub_type
== BGP_ROUTE_STATIC
)
2901 /* Withdraw static BGP route from routing table. */
2904 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2905 bgp_process (bgp
, rn
, afi
, safi
);
2906 bgp_info_delete (rn
, ri
);
2909 /* Unlock bgp_node_lookup. */
2910 bgp_unlock_node (rn
);
2914 bgp_static_update_rsclient (struct peer
*rsclient
, struct prefix
*p
,
2915 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
2917 struct bgp_node
*rn
;
2918 struct bgp_info
*ri
;
2919 struct bgp_info
*new;
2920 struct bgp_info info
;
2921 struct attr new_attr
;
2922 struct attr
*attr_new
;
2926 char buf
[SU_ADDRSTRLEN
];
2928 bgp
= rsclient
->bgp
;
2930 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
2932 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
2935 attr
.nexthop
= bgp_static
->igpnexthop
;
2936 attr
.med
= bgp_static
->igpmetric
;
2937 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
2942 /* Apply network route-map for export to this rsclient. */
2943 if (bgp_static
->rmap
.name
)
2945 info
.peer
= rsclient
;
2946 info
.attr
= &new_attr
;
2948 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
2949 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
2951 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
2953 rsclient
->rmap_type
= 0;
2955 if (ret
== RMAP_DENYMATCH
)
2957 /* Free uninterned attribute. */
2958 bgp_attr_flush (&new_attr
);
2960 /* Unintern original. */
2961 aspath_unintern (attr
.aspath
);
2962 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
2966 attr_new
= bgp_attr_intern (&new_attr
);
2969 attr_new
= bgp_attr_intern (&attr
);
2971 new_attr
= *attr_new
;
2973 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
2975 if (bgp_import_modifier (rsclient
, bgp
->peer_self
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
2977 /* This BGP update is filtered. Log the reason then update BGP entry. */
2978 if (BGP_DEBUG (update
, UPDATE_IN
))
2979 zlog (rsclient
->log
, LOG_DEBUG
,
2980 "Static UPDATE about %s/%d -- DENIED for RS-client %s due to: import-policy",
2981 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2982 p
->prefixlen
, rsclient
->host
);
2984 bgp
->peer_self
->rmap_type
= 0;
2986 bgp_attr_unintern (attr_new
);
2987 aspath_unintern (attr
.aspath
);
2989 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
2994 bgp
->peer_self
->rmap_type
= 0;
2996 bgp_attr_unintern (attr_new
);
2997 attr_new
= bgp_attr_intern (&new_attr
);
2999 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3000 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3001 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3006 if (attrhash_cmp (ri
->attr
, attr_new
))
3008 bgp_unlock_node (rn
);
3009 bgp_attr_unintern (attr_new
);
3010 aspath_unintern (attr
.aspath
);
3015 /* The attribute is changed. */
3016 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
3018 /* Rewrite BGP route information. */
3019 bgp_attr_unintern (ri
->attr
);
3020 ri
->attr
= attr_new
;
3021 ri
->uptime
= time (NULL
);
3023 /* Process change. */
3024 bgp_process (bgp
, rn
, afi
, safi
);
3025 bgp_unlock_node (rn
);
3026 aspath_unintern (attr
.aspath
);
3031 /* Make new BGP info. */
3032 new = bgp_info_new ();
3033 new->type
= ZEBRA_ROUTE_BGP
;
3034 new->sub_type
= BGP_ROUTE_STATIC
;
3035 new->peer
= bgp
->peer_self
;
3036 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3037 new->attr
= attr_new
;
3038 new->uptime
= time (NULL
);
3040 /* Register new BGP information. */
3041 bgp_info_add (rn
, new);
3043 /* route_node_get lock */
3044 bgp_unlock_node (rn
);
3046 /* Process change. */
3047 bgp_process (bgp
, rn
, afi
, safi
);
3049 /* Unintern original. */
3050 aspath_unintern (attr
.aspath
);
3054 bgp_static_update_main (struct bgp
*bgp
, struct prefix
*p
,
3055 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3057 struct bgp_node
*rn
;
3058 struct bgp_info
*ri
;
3059 struct bgp_info
*new;
3060 struct bgp_info info
;
3062 struct attr attr_tmp
;
3063 struct attr
*attr_new
;
3066 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3068 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3071 attr
.nexthop
= bgp_static
->igpnexthop
;
3072 attr
.med
= bgp_static
->igpmetric
;
3073 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3076 /* Apply route-map. */
3077 if (bgp_static
->rmap
.name
)
3080 info
.peer
= bgp
->peer_self
;
3081 info
.attr
= &attr_tmp
;
3083 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3085 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3087 bgp
->peer_self
->rmap_type
= 0;
3089 if (ret
== RMAP_DENYMATCH
)
3091 /* Free uninterned attribute. */
3092 bgp_attr_flush (&attr_tmp
);
3094 /* Unintern original. */
3095 aspath_unintern (attr
.aspath
);
3096 bgp_static_withdraw (bgp
, p
, afi
, safi
);
3099 attr_new
= bgp_attr_intern (&attr_tmp
);
3102 attr_new
= bgp_attr_intern (&attr
);
3104 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3105 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3106 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3111 if (attrhash_cmp (ri
->attr
, attr_new
))
3113 bgp_unlock_node (rn
);
3114 bgp_attr_unintern (attr_new
);
3115 aspath_unintern (attr
.aspath
);
3120 /* The attribute is changed. */
3121 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
3123 /* Rewrite BGP route information. */
3124 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3125 bgp_attr_unintern (ri
->attr
);
3126 ri
->attr
= attr_new
;
3127 ri
->uptime
= time (NULL
);
3129 /* Process change. */
3130 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
3131 bgp_process (bgp
, rn
, afi
, safi
);
3132 bgp_unlock_node (rn
);
3133 aspath_unintern (attr
.aspath
);
3138 /* Make new BGP info. */
3139 new = bgp_info_new ();
3140 new->type
= ZEBRA_ROUTE_BGP
;
3141 new->sub_type
= BGP_ROUTE_STATIC
;
3142 new->peer
= bgp
->peer_self
;
3143 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3144 new->attr
= attr_new
;
3145 new->uptime
= time (NULL
);
3147 /* Aggregate address increment. */
3148 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3150 /* Register new BGP information. */
3151 bgp_info_add (rn
, new);
3153 /* route_node_get lock */
3154 bgp_unlock_node (rn
);
3156 /* Process change. */
3157 bgp_process (bgp
, rn
, afi
, safi
);
3159 /* Unintern original. */
3160 aspath_unintern (attr
.aspath
);
3164 bgp_static_update (struct bgp
*bgp
, struct prefix
*p
,
3165 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3167 struct peer
*rsclient
;
3168 struct listnode
*node
, *nnode
;
3170 bgp_static_update_main (bgp
, p
, bgp_static
, afi
, safi
);
3172 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
3174 bgp_static_update_rsclient (rsclient
, p
, bgp_static
, afi
, safi
);
3179 bgp_static_update_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
3180 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
3182 struct bgp_node
*rn
;
3183 struct bgp_info
*new;
3185 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3187 /* Make new BGP info. */
3188 new = bgp_info_new ();
3189 new->type
= ZEBRA_ROUTE_BGP
;
3190 new->sub_type
= BGP_ROUTE_STATIC
;
3191 new->peer
= bgp
->peer_self
;
3192 new->attr
= bgp_attr_default_intern (BGP_ORIGIN_IGP
);
3193 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3194 new->uptime
= time (NULL
);
3195 memcpy (new->tag
, tag
, 3);
3197 /* Aggregate address increment. */
3198 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3200 /* Register new BGP information. */
3201 bgp_info_add (rn
, new);
3203 /* route_node_get lock */
3204 bgp_unlock_node (rn
);
3206 /* Process change. */
3207 bgp_process (bgp
, rn
, afi
, safi
);
3211 bgp_static_withdraw (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3214 struct bgp_node
*rn
;
3215 struct bgp_info
*ri
;
3217 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3219 /* Check selected route and self inserted route. */
3220 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3221 if (ri
->peer
== bgp
->peer_self
3222 && ri
->type
== ZEBRA_ROUTE_BGP
3223 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3226 /* Withdraw static BGP route from routing table. */
3229 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3230 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
3231 bgp_process (bgp
, rn
, afi
, safi
);
3232 bgp_info_delete (rn
, ri
);
3235 /* Unlock bgp_node_lookup. */
3236 bgp_unlock_node (rn
);
3240 bgp_check_local_routes_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
3242 struct bgp_static
*bgp_static
;
3244 struct bgp_node
*rn
;
3247 bgp
= rsclient
->bgp
;
3249 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3250 if ((bgp_static
= rn
->info
) != NULL
)
3254 bgp_static_update_rsclient (rsclient
, p
, bgp_static
,
3260 bgp_static_withdraw_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
3261 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
3263 struct bgp_node
*rn
;
3264 struct bgp_info
*ri
;
3266 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3268 /* Check selected route and self inserted route. */
3269 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3270 if (ri
->peer
== bgp
->peer_self
3271 && ri
->type
== ZEBRA_ROUTE_BGP
3272 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3275 /* Withdraw static BGP route from routing table. */
3278 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3279 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
3280 bgp_process (bgp
, rn
, afi
, safi
);
3281 bgp_info_delete (rn
, ri
);
3284 /* Unlock bgp_node_lookup. */
3285 bgp_unlock_node (rn
);
3288 /* Configure static BGP network. When user don't run zebra, static
3289 route should be installed as valid. */
3291 bgp_static_set (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3292 u_int16_t afi
, u_char safi
, const char *rmap
, int backdoor
)
3296 struct bgp_static
*bgp_static
;
3297 struct bgp_node
*rn
;
3298 int need_update
= 0;
3300 /* Convert IP prefix string to struct prefix. */
3301 ret
= str2prefix (ip_str
, &p
);
3304 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3308 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3310 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3314 #endif /* HAVE_IPV6 */
3318 /* Set BGP static route configuration. */
3319 rn
= bgp_node_get (bgp
->route
[afi
][safi
], &p
);
3323 /* Configuration change. */
3324 bgp_static
= rn
->info
;
3326 /* Check previous routes are installed into BGP. */
3327 if (! bgp_static
->backdoor
&& bgp_static
->valid
)
3330 bgp_static
->backdoor
= backdoor
;
3333 if (bgp_static
->rmap
.name
)
3334 free (bgp_static
->rmap
.name
);
3335 bgp_static
->rmap
.name
= strdup (rmap
);
3336 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
3340 if (bgp_static
->rmap
.name
)
3341 free (bgp_static
->rmap
.name
);
3342 bgp_static
->rmap
.name
= NULL
;
3343 bgp_static
->rmap
.map
= NULL
;
3344 bgp_static
->valid
= 0;
3346 bgp_unlock_node (rn
);
3350 /* New configuration. */
3351 bgp_static
= bgp_static_new ();
3352 bgp_static
->backdoor
= backdoor
;
3353 bgp_static
->valid
= 0;
3354 bgp_static
->igpmetric
= 0;
3355 bgp_static
->igpnexthop
.s_addr
= 0;
3358 if (bgp_static
->rmap
.name
)
3359 free (bgp_static
->rmap
.name
);
3360 bgp_static
->rmap
.name
= strdup (rmap
);
3361 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
3363 rn
->info
= bgp_static
;
3366 /* If BGP scan is not enabled, we should install this route here. */
3367 if (! bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3369 bgp_static
->valid
= 1;
3372 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
3374 if (! bgp_static
->backdoor
)
3375 bgp_static_update (bgp
, &p
, bgp_static
, afi
, safi
);
3381 /* Configure static BGP network. */
3383 bgp_static_unset (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3384 u_int16_t afi
, u_char safi
)
3388 struct bgp_static
*bgp_static
;
3389 struct bgp_node
*rn
;
3391 /* Convert IP prefix string to struct prefix. */
3392 ret
= str2prefix (ip_str
, &p
);
3395 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3399 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3401 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3405 #endif /* HAVE_IPV6 */
3409 rn
= bgp_node_lookup (bgp
->route
[afi
][safi
], &p
);
3412 vty_out (vty
, "%% Can't find specified static route configuration.%s",
3417 bgp_static
= rn
->info
;
3419 /* Update BGP RIB. */
3420 if (! bgp_static
->backdoor
)
3421 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
3423 /* Clear configuration. */
3424 bgp_static_free (bgp_static
);
3426 bgp_unlock_node (rn
);
3427 bgp_unlock_node (rn
);
3432 /* Called from bgp_delete(). Delete all static routes from the BGP
3435 bgp_static_delete (struct bgp
*bgp
)
3439 struct bgp_node
*rn
;
3440 struct bgp_node
*rm
;
3441 struct bgp_table
*table
;
3442 struct bgp_static
*bgp_static
;
3444 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
3445 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
3446 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3447 if (rn
->info
!= NULL
)
3449 if (safi
== SAFI_MPLS_VPN
)
3453 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
3455 bgp_static
= rn
->info
;
3456 bgp_static_withdraw_vpnv4 (bgp
, &rm
->p
,
3457 AFI_IP
, SAFI_MPLS_VPN
,
3458 (struct prefix_rd
*)&rn
->p
,
3460 bgp_static_free (bgp_static
);
3462 bgp_unlock_node (rn
);
3467 bgp_static
= rn
->info
;
3468 bgp_static_withdraw (bgp
, &rn
->p
, afi
, safi
);
3469 bgp_static_free (bgp_static
);
3471 bgp_unlock_node (rn
);
3477 bgp_static_set_vpnv4 (struct vty
*vty
, const char *ip_str
, const char *rd_str
,
3478 const char *tag_str
)
3482 struct prefix_rd prd
;
3484 struct bgp_node
*prn
;
3485 struct bgp_node
*rn
;
3486 struct bgp_table
*table
;
3487 struct bgp_static
*bgp_static
;
3492 ret
= str2prefix (ip_str
, &p
);
3495 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3500 ret
= str2prefix_rd (rd_str
, &prd
);
3503 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
3507 ret
= str2tag (tag_str
, tag
);
3510 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
3514 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
3515 (struct prefix
*)&prd
);
3516 if (prn
->info
== NULL
)
3517 prn
->info
= bgp_table_init (AFI_IP
, SAFI_MPLS_VPN
);
3519 bgp_unlock_node (prn
);
3522 rn
= bgp_node_get (table
, &p
);
3526 vty_out (vty
, "%% Same network configuration exists%s", VTY_NEWLINE
);
3527 bgp_unlock_node (rn
);
3531 /* New configuration. */
3532 bgp_static
= bgp_static_new ();
3533 bgp_static
->valid
= 1;
3534 memcpy (bgp_static
->tag
, tag
, 3);
3535 rn
->info
= bgp_static
;
3537 bgp_static_update_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
3543 /* Configure static BGP network. */
3545 bgp_static_unset_vpnv4 (struct vty
*vty
, const char *ip_str
,
3546 const char *rd_str
, const char *tag_str
)
3551 struct prefix_rd prd
;
3552 struct bgp_node
*prn
;
3553 struct bgp_node
*rn
;
3554 struct bgp_table
*table
;
3555 struct bgp_static
*bgp_static
;
3560 /* Convert IP prefix string to struct prefix. */
3561 ret
= str2prefix (ip_str
, &p
);
3564 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3569 ret
= str2prefix_rd (rd_str
, &prd
);
3572 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
3576 ret
= str2tag (tag_str
, tag
);
3579 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
3583 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
3584 (struct prefix
*)&prd
);
3585 if (prn
->info
== NULL
)
3586 prn
->info
= bgp_table_init (AFI_IP
, SAFI_MPLS_VPN
);
3588 bgp_unlock_node (prn
);
3591 rn
= bgp_node_lookup (table
, &p
);
3595 bgp_static_withdraw_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
3597 bgp_static
= rn
->info
;
3598 bgp_static_free (bgp_static
);
3600 bgp_unlock_node (rn
);
3601 bgp_unlock_node (rn
);
3604 vty_out (vty
, "%% Can't find the route%s", VTY_NEWLINE
);
3611 "network A.B.C.D/M",
3612 "Specify a network to announce via BGP\n"
3613 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
3615 return bgp_static_set (vty
, vty
->index
, argv
[0],
3616 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
3619 DEFUN (bgp_network_route_map
,
3620 bgp_network_route_map_cmd
,
3621 "network A.B.C.D/M route-map WORD",
3622 "Specify a network to announce via BGP\n"
3623 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3624 "Route-map to modify the attributes\n"
3625 "Name of the route map\n")
3627 return bgp_static_set (vty
, vty
->index
, argv
[0],
3628 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
3631 DEFUN (bgp_network_backdoor
,
3632 bgp_network_backdoor_cmd
,
3633 "network A.B.C.D/M backdoor",
3634 "Specify a network to announce via BGP\n"
3635 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3636 "Specify a BGP backdoor route\n")
3638 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
3641 DEFUN (bgp_network_mask
,
3642 bgp_network_mask_cmd
,
3643 "network A.B.C.D mask A.B.C.D",
3644 "Specify a network to announce via BGP\n"
3650 char prefix_str
[BUFSIZ
];
3652 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3655 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3659 return bgp_static_set (vty
, vty
->index
, prefix_str
,
3660 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
3663 DEFUN (bgp_network_mask_route_map
,
3664 bgp_network_mask_route_map_cmd
,
3665 "network A.B.C.D mask A.B.C.D route-map WORD",
3666 "Specify a network to announce via BGP\n"
3670 "Route-map to modify the attributes\n"
3671 "Name of the route map\n")
3674 char prefix_str
[BUFSIZ
];
3676 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3679 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3683 return bgp_static_set (vty
, vty
->index
, prefix_str
,
3684 AFI_IP
, bgp_node_safi (vty
), argv
[2], 0);
3687 DEFUN (bgp_network_mask_backdoor
,
3688 bgp_network_mask_backdoor_cmd
,
3689 "network A.B.C.D mask A.B.C.D backdoor",
3690 "Specify a network to announce via BGP\n"
3694 "Specify a BGP backdoor route\n")
3697 char prefix_str
[BUFSIZ
];
3699 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3702 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3706 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
, NULL
, 1);
3709 DEFUN (bgp_network_mask_natural
,
3710 bgp_network_mask_natural_cmd
,
3712 "Specify a network to announce via BGP\n"
3716 char prefix_str
[BUFSIZ
];
3718 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
3721 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3725 return bgp_static_set (vty
, vty
->index
, prefix_str
,
3726 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
3729 DEFUN (bgp_network_mask_natural_route_map
,
3730 bgp_network_mask_natural_route_map_cmd
,
3731 "network A.B.C.D route-map WORD",
3732 "Specify a network to announce via BGP\n"
3734 "Route-map to modify the attributes\n"
3735 "Name of the route map\n")
3738 char prefix_str
[BUFSIZ
];
3740 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
3743 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3747 return bgp_static_set (vty
, vty
->index
, prefix_str
,
3748 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
3751 DEFUN (bgp_network_mask_natural_backdoor
,
3752 bgp_network_mask_natural_backdoor_cmd
,
3753 "network A.B.C.D backdoor",
3754 "Specify a network to announce via BGP\n"
3756 "Specify a BGP backdoor route\n")
3759 char prefix_str
[BUFSIZ
];
3761 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
3764 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3768 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
, NULL
, 1);
3771 DEFUN (no_bgp_network
,
3773 "no network A.B.C.D/M",
3775 "Specify a network to announce via BGP\n"
3776 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
3778 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP
,
3779 bgp_node_safi (vty
));
3782 ALIAS (no_bgp_network
,
3783 no_bgp_network_route_map_cmd
,
3784 "no network A.B.C.D/M route-map WORD",
3786 "Specify a network to announce via BGP\n"
3787 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3788 "Route-map to modify the attributes\n"
3789 "Name of the route map\n")
3791 ALIAS (no_bgp_network
,
3792 no_bgp_network_backdoor_cmd
,
3793 "no network A.B.C.D/M backdoor",
3795 "Specify a network to announce via BGP\n"
3796 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3797 "Specify a BGP backdoor route\n")
3799 DEFUN (no_bgp_network_mask
,
3800 no_bgp_network_mask_cmd
,
3801 "no network A.B.C.D mask A.B.C.D",
3803 "Specify a network to announce via BGP\n"
3809 char prefix_str
[BUFSIZ
];
3811 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3814 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3818 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
3819 bgp_node_safi (vty
));
3822 ALIAS (no_bgp_network_mask
,
3823 no_bgp_network_mask_route_map_cmd
,
3824 "no network A.B.C.D mask A.B.C.D route-map WORD",
3826 "Specify a network to announce via BGP\n"
3830 "Route-map to modify the attributes\n"
3831 "Name of the route map\n")
3833 ALIAS (no_bgp_network_mask
,
3834 no_bgp_network_mask_backdoor_cmd
,
3835 "no network A.B.C.D mask A.B.C.D backdoor",
3837 "Specify a network to announce via BGP\n"
3841 "Specify a BGP backdoor route\n")
3843 DEFUN (no_bgp_network_mask_natural
,
3844 no_bgp_network_mask_natural_cmd
,
3845 "no network A.B.C.D",
3847 "Specify a network to announce via BGP\n"
3851 char prefix_str
[BUFSIZ
];
3853 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
3856 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3860 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
3861 bgp_node_safi (vty
));
3864 ALIAS (no_bgp_network_mask_natural
,
3865 no_bgp_network_mask_natural_route_map_cmd
,
3866 "no network A.B.C.D route-map WORD",
3868 "Specify a network to announce via BGP\n"
3870 "Route-map to modify the attributes\n"
3871 "Name of the route map\n")
3873 ALIAS (no_bgp_network_mask_natural
,
3874 no_bgp_network_mask_natural_backdoor_cmd
,
3875 "no network A.B.C.D backdoor",
3877 "Specify a network to announce via BGP\n"
3879 "Specify a BGP backdoor route\n")
3882 DEFUN (ipv6_bgp_network
,
3883 ipv6_bgp_network_cmd
,
3884 "network X:X::X:X/M",
3885 "Specify a network to announce via BGP\n"
3886 "IPv6 prefix <network>/<length>\n")
3888 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
3891 DEFUN (ipv6_bgp_network_route_map
,
3892 ipv6_bgp_network_route_map_cmd
,
3893 "network X:X::X:X/M route-map WORD",
3894 "Specify a network to announce via BGP\n"
3895 "IPv6 prefix <network>/<length>\n"
3896 "Route-map to modify the attributes\n"
3897 "Name of the route map\n")
3899 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
,
3900 bgp_node_safi (vty
), argv
[1], 0);
3903 DEFUN (no_ipv6_bgp_network
,
3904 no_ipv6_bgp_network_cmd
,
3905 "no network X:X::X:X/M",
3907 "Specify a network to announce via BGP\n"
3908 "IPv6 prefix <network>/<length>\n")
3910 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
3913 ALIAS (no_ipv6_bgp_network
,
3914 no_ipv6_bgp_network_route_map_cmd
,
3915 "no network X:X::X:X/M route-map WORD",
3917 "Specify a network to announce via BGP\n"
3918 "IPv6 prefix <network>/<length>\n"
3919 "Route-map to modify the attributes\n"
3920 "Name of the route map\n")
3922 ALIAS (ipv6_bgp_network
,
3923 old_ipv6_bgp_network_cmd
,
3924 "ipv6 bgp network X:X::X:X/M",
3927 "Specify a network to announce via BGP\n"
3928 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
3930 ALIAS (no_ipv6_bgp_network
,
3931 old_no_ipv6_bgp_network_cmd
,
3932 "no ipv6 bgp network X:X::X:X/M",
3936 "Specify a network to announce via BGP\n"
3937 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
3938 #endif /* HAVE_IPV6 */
3940 /* Aggreagete address:
3942 advertise-map Set condition to advertise attribute
3943 as-set Generate AS set path information
3944 attribute-map Set attributes of aggregate
3945 route-map Set parameters of aggregate
3946 summary-only Filter more specific routes from updates
3947 suppress-map Conditionally filter more specific routes from updates
3950 struct bgp_aggregate
3952 /* Summary-only flag. */
3953 u_char summary_only
;
3955 /* AS set generation. */
3958 /* Route-map for aggregated route. */
3959 struct route_map
*map
;
3961 /* Suppress-count. */
3962 unsigned long count
;
3964 /* SAFI configuration. */
3968 static struct bgp_aggregate
*
3969 bgp_aggregate_new ()
3971 struct bgp_aggregate
*new;
3972 new = XMALLOC (MTYPE_BGP_AGGREGATE
, sizeof (struct bgp_aggregate
));
3973 memset (new, 0, sizeof (struct bgp_aggregate
));
3978 bgp_aggregate_free (struct bgp_aggregate
*aggregate
)
3980 XFREE (MTYPE_BGP_AGGREGATE
, aggregate
);
3984 bgp_aggregate_route (struct bgp
*bgp
, struct prefix
*p
, struct bgp_info
*rinew
,
3985 afi_t afi
, safi_t safi
, struct bgp_info
*del
,
3986 struct bgp_aggregate
*aggregate
)
3988 struct bgp_table
*table
;
3989 struct bgp_node
*top
;
3990 struct bgp_node
*rn
;
3992 struct aspath
*aspath
= NULL
;
3993 struct aspath
*asmerge
= NULL
;
3994 struct community
*community
= NULL
;
3995 struct community
*commerge
= NULL
;
3996 struct in_addr nexthop
;
3998 struct bgp_info
*ri
;
3999 struct bgp_info
*new;
4001 unsigned long match
= 0;
4003 /* Record adding route's nexthop and med. */
4006 nexthop
= rinew
->attr
->nexthop
;
4007 med
= rinew
->attr
->med
;
4010 /* ORIGIN attribute: If at least one route among routes that are
4011 aggregated has ORIGIN with the value INCOMPLETE, then the
4012 aggregated route must have the ORIGIN attribute with the value
4013 INCOMPLETE. Otherwise, if at least one route among routes that
4014 are aggregated has ORIGIN with the value EGP, then the aggregated
4015 route must have the origin attribute with the value EGP. In all
4016 other case the value of the ORIGIN attribute of the aggregated
4017 route is INTERNAL. */
4018 origin
= BGP_ORIGIN_IGP
;
4020 table
= bgp
->rib
[afi
][safi
];
4022 top
= bgp_node_get (table
, p
);
4023 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4024 if (rn
->p
.prefixlen
> p
->prefixlen
)
4028 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4030 if (BGP_INFO_HOLDDOWN (ri
))
4033 if (del
&& ri
== del
)
4036 if (! rinew
&& first
)
4038 nexthop
= ri
->attr
->nexthop
;
4039 med
= ri
->attr
->med
;
4043 #ifdef AGGREGATE_NEXTHOP_CHECK
4044 if (! IPV4_ADDR_SAME (&ri
->attr
->nexthop
, &nexthop
)
4045 || ri
->attr
->med
!= med
)
4048 aspath_free (aspath
);
4050 community_free (community
);
4051 bgp_unlock_node (rn
);
4052 bgp_unlock_node (top
);
4055 #endif /* AGGREGATE_NEXTHOP_CHECK */
4057 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4059 if (aggregate
->summary_only
)
4062 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
4068 if (aggregate
->as_set
)
4070 if (origin
< ri
->attr
->origin
)
4071 origin
= ri
->attr
->origin
;
4075 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4076 aspath_free (aspath
);
4080 aspath
= aspath_dup (ri
->attr
->aspath
);
4082 if (ri
->attr
->community
)
4086 commerge
= community_merge (community
,
4087 ri
->attr
->community
);
4088 community
= community_uniq_sort (commerge
);
4089 community_free (commerge
);
4092 community
= community_dup (ri
->attr
->community
);
4098 bgp_process (bgp
, rn
, afi
, safi
);
4100 bgp_unlock_node (top
);
4106 if (aggregate
->summary_only
)
4109 if (aggregate
->as_set
)
4111 if (origin
< rinew
->attr
->origin
)
4112 origin
= rinew
->attr
->origin
;
4116 asmerge
= aspath_aggregate (aspath
, rinew
->attr
->aspath
);
4117 aspath_free (aspath
);
4121 aspath
= aspath_dup (rinew
->attr
->aspath
);
4123 if (rinew
->attr
->community
)
4127 commerge
= community_merge (community
,
4128 rinew
->attr
->community
);
4129 community
= community_uniq_sort (commerge
);
4130 community_free (commerge
);
4133 community
= community_dup (rinew
->attr
->community
);
4138 if (aggregate
->count
> 0)
4140 rn
= bgp_node_get (table
, p
);
4141 new = bgp_info_new ();
4142 new->type
= ZEBRA_ROUTE_BGP
;
4143 new->sub_type
= BGP_ROUTE_AGGREGATE
;
4144 new->peer
= bgp
->peer_self
;
4145 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4146 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
4147 new->uptime
= time (NULL
);
4149 bgp_info_add (rn
, new);
4150 bgp_unlock_node (rn
);
4151 bgp_process (bgp
, rn
, afi
, safi
);
4156 aspath_free (aspath
);
4158 community_free (community
);
4162 void bgp_aggregate_delete (struct bgp
*, struct prefix
*, afi_t
, safi_t
,
4163 struct bgp_aggregate
*);
4166 bgp_aggregate_increment (struct bgp
*bgp
, struct prefix
*p
,
4167 struct bgp_info
*ri
, afi_t afi
, safi_t safi
)
4169 struct bgp_node
*child
;
4170 struct bgp_node
*rn
;
4171 struct bgp_aggregate
*aggregate
;
4173 /* MPLS-VPN aggregation is not yet supported. */
4174 if (safi
== SAFI_MPLS_VPN
)
4177 if (p
->prefixlen
== 0)
4180 if (BGP_INFO_HOLDDOWN (ri
))
4183 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
4185 /* Aggregate address configuration check. */
4186 for (rn
= child
; rn
; rn
= rn
->parent
)
4187 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
4189 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
4190 bgp_aggregate_route (bgp
, &rn
->p
, ri
, afi
, safi
, NULL
, aggregate
);
4192 bgp_unlock_node (child
);
4196 bgp_aggregate_decrement (struct bgp
*bgp
, struct prefix
*p
,
4197 struct bgp_info
*del
, afi_t afi
, safi_t safi
)
4199 struct bgp_node
*child
;
4200 struct bgp_node
*rn
;
4201 struct bgp_aggregate
*aggregate
;
4203 /* MPLS-VPN aggregation is not yet supported. */
4204 if (safi
== SAFI_MPLS_VPN
)
4207 if (p
->prefixlen
== 0)
4210 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
4212 /* Aggregate address configuration check. */
4213 for (rn
= child
; rn
; rn
= rn
->parent
)
4214 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
4216 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
4217 bgp_aggregate_route (bgp
, &rn
->p
, NULL
, afi
, safi
, del
, aggregate
);
4219 bgp_unlock_node (child
);
4223 bgp_aggregate_add (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
, safi_t safi
,
4224 struct bgp_aggregate
*aggregate
)
4226 struct bgp_table
*table
;
4227 struct bgp_node
*top
;
4228 struct bgp_node
*rn
;
4229 struct bgp_info
*new;
4230 struct bgp_info
*ri
;
4231 unsigned long match
;
4232 u_char origin
= BGP_ORIGIN_IGP
;
4233 struct aspath
*aspath
= NULL
;
4234 struct aspath
*asmerge
= NULL
;
4235 struct community
*community
= NULL
;
4236 struct community
*commerge
= NULL
;
4238 table
= bgp
->rib
[afi
][safi
];
4241 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
4243 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
4246 /* If routes exists below this node, generate aggregate routes. */
4247 top
= bgp_node_get (table
, p
);
4248 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4249 if (rn
->p
.prefixlen
> p
->prefixlen
)
4253 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4255 if (BGP_INFO_HOLDDOWN (ri
))
4258 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4260 /* summary-only aggregate route suppress aggregated
4261 route announcement. */
4262 if (aggregate
->summary_only
)
4265 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
4268 /* as-set aggregate route generate origin, as path,
4269 community aggregation. */
4270 if (aggregate
->as_set
)
4272 if (origin
< ri
->attr
->origin
)
4273 origin
= ri
->attr
->origin
;
4277 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4278 aspath_free (aspath
);
4282 aspath
= aspath_dup (ri
->attr
->aspath
);
4284 if (ri
->attr
->community
)
4288 commerge
= community_merge (community
,
4289 ri
->attr
->community
);
4290 community
= community_uniq_sort (commerge
);
4291 community_free (commerge
);
4294 community
= community_dup (ri
->attr
->community
);
4301 /* If this node is suppressed, process the change. */
4303 bgp_process (bgp
, rn
, afi
, safi
);
4305 bgp_unlock_node (top
);
4307 /* Add aggregate route to BGP table. */
4308 if (aggregate
->count
)
4310 rn
= bgp_node_get (table
, p
);
4312 new = bgp_info_new ();
4313 new->type
= ZEBRA_ROUTE_BGP
;
4314 new->sub_type
= BGP_ROUTE_AGGREGATE
;
4315 new->peer
= bgp
->peer_self
;
4316 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4317 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
4318 new->uptime
= time (NULL
);
4320 bgp_info_add (rn
, new);
4321 bgp_unlock_node (rn
);
4323 /* Process change. */
4324 bgp_process (bgp
, rn
, afi
, safi
);
4329 bgp_aggregate_delete (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
4330 safi_t safi
, struct bgp_aggregate
*aggregate
)
4332 struct bgp_table
*table
;
4333 struct bgp_node
*top
;
4334 struct bgp_node
*rn
;
4335 struct bgp_info
*ri
;
4336 unsigned long match
;
4338 table
= bgp
->rib
[afi
][safi
];
4340 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
4342 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
4345 /* If routes exists below this node, generate aggregate routes. */
4346 top
= bgp_node_get (table
, p
);
4347 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4348 if (rn
->p
.prefixlen
> p
->prefixlen
)
4352 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4354 if (BGP_INFO_HOLDDOWN (ri
))
4357 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4359 if (aggregate
->summary_only
)
4363 if (ri
->suppress
== 0)
4365 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
4373 /* If this node is suppressed, process the change. */
4375 bgp_process (bgp
, rn
, afi
, safi
);
4377 bgp_unlock_node (top
);
4379 /* Delete aggregate route from BGP table. */
4380 rn
= bgp_node_get (table
, p
);
4382 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4383 if (ri
->peer
== bgp
->peer_self
4384 && ri
->type
== ZEBRA_ROUTE_BGP
4385 && ri
->sub_type
== BGP_ROUTE_AGGREGATE
)
4388 /* Withdraw static BGP route from routing table. */
4391 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
4392 bgp_process (bgp
, rn
, afi
, safi
);
4393 bgp_info_delete (rn
, ri
);
4396 /* Unlock bgp_node_lookup. */
4397 bgp_unlock_node (rn
);
4400 /* Aggregate route attribute. */
4401 #define AGGREGATE_SUMMARY_ONLY 1
4402 #define AGGREGATE_AS_SET 1
4405 bgp_aggregate_set (struct vty
*vty
, const char *prefix_str
,
4406 afi_t afi
, safi_t safi
,
4407 u_char summary_only
, u_char as_set
)
4411 struct bgp_node
*rn
;
4413 struct bgp_aggregate
*aggregate
;
4415 /* Convert string to prefix structure. */
4416 ret
= str2prefix (prefix_str
, &p
);
4419 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
4424 /* Get BGP structure. */
4427 /* Old configuration check. */
4428 rn
= bgp_node_get (bgp
->aggregate
[afi
][safi
], &p
);
4432 vty_out (vty
, "There is already same aggregate network.%s", VTY_NEWLINE
);
4433 bgp_unlock_node (rn
);
4437 /* Make aggregate address structure. */
4438 aggregate
= bgp_aggregate_new ();
4439 aggregate
->summary_only
= summary_only
;
4440 aggregate
->as_set
= as_set
;
4441 aggregate
->safi
= safi
;
4442 rn
->info
= aggregate
;
4444 /* Aggregate address insert into BGP routing table. */
4445 if (safi
& SAFI_UNICAST
)
4446 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
4447 if (safi
& SAFI_MULTICAST
)
4448 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
4454 bgp_aggregate_unset (struct vty
*vty
, const char *prefix_str
,
4455 afi_t afi
, safi_t safi
)
4459 struct bgp_node
*rn
;
4461 struct bgp_aggregate
*aggregate
;
4463 /* Convert string to prefix structure. */
4464 ret
= str2prefix (prefix_str
, &p
);
4467 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
4472 /* Get BGP structure. */
4475 /* Old configuration check. */
4476 rn
= bgp_node_lookup (bgp
->aggregate
[afi
][safi
], &p
);
4479 vty_out (vty
, "%% There is no aggregate-address configuration.%s",
4484 aggregate
= rn
->info
;
4485 if (aggregate
->safi
& SAFI_UNICAST
)
4486 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
4487 if (aggregate
->safi
& SAFI_MULTICAST
)
4488 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
4490 /* Unlock aggregate address configuration. */
4492 bgp_aggregate_free (aggregate
);
4493 bgp_unlock_node (rn
);
4494 bgp_unlock_node (rn
);
4499 DEFUN (aggregate_address
,
4500 aggregate_address_cmd
,
4501 "aggregate-address A.B.C.D/M",
4502 "Configure BGP aggregate entries\n"
4503 "Aggregate prefix\n")
4505 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
), 0, 0);
4508 DEFUN (aggregate_address_mask
,
4509 aggregate_address_mask_cmd
,
4510 "aggregate-address A.B.C.D A.B.C.D",
4511 "Configure BGP aggregate entries\n"
4512 "Aggregate address\n"
4516 char prefix_str
[BUFSIZ
];
4518 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4522 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4526 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
4530 DEFUN (aggregate_address_summary_only
,
4531 aggregate_address_summary_only_cmd
,
4532 "aggregate-address A.B.C.D/M summary-only",
4533 "Configure BGP aggregate entries\n"
4534 "Aggregate prefix\n"
4535 "Filter more specific routes from updates\n")
4537 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
4538 AGGREGATE_SUMMARY_ONLY
, 0);
4541 DEFUN (aggregate_address_mask_summary_only
,
4542 aggregate_address_mask_summary_only_cmd
,
4543 "aggregate-address A.B.C.D A.B.C.D summary-only",
4544 "Configure BGP aggregate entries\n"
4545 "Aggregate address\n"
4547 "Filter more specific routes from updates\n")
4550 char prefix_str
[BUFSIZ
];
4552 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4556 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4560 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
4561 AGGREGATE_SUMMARY_ONLY
, 0);
4564 DEFUN (aggregate_address_as_set
,
4565 aggregate_address_as_set_cmd
,
4566 "aggregate-address A.B.C.D/M as-set",
4567 "Configure BGP aggregate entries\n"
4568 "Aggregate prefix\n"
4569 "Generate AS set path information\n")
4571 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
4572 0, AGGREGATE_AS_SET
);
4575 DEFUN (aggregate_address_mask_as_set
,
4576 aggregate_address_mask_as_set_cmd
,
4577 "aggregate-address A.B.C.D A.B.C.D as-set",
4578 "Configure BGP aggregate entries\n"
4579 "Aggregate address\n"
4581 "Generate AS set path information\n")
4584 char prefix_str
[BUFSIZ
];
4586 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4590 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4594 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
4595 0, AGGREGATE_AS_SET
);
4599 DEFUN (aggregate_address_as_set_summary
,
4600 aggregate_address_as_set_summary_cmd
,
4601 "aggregate-address A.B.C.D/M as-set summary-only",
4602 "Configure BGP aggregate entries\n"
4603 "Aggregate prefix\n"
4604 "Generate AS set path information\n"
4605 "Filter more specific routes from updates\n")
4607 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
4608 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
4611 ALIAS (aggregate_address_as_set_summary
,
4612 aggregate_address_summary_as_set_cmd
,
4613 "aggregate-address A.B.C.D/M summary-only as-set",
4614 "Configure BGP aggregate entries\n"
4615 "Aggregate prefix\n"
4616 "Filter more specific routes from updates\n"
4617 "Generate AS set path information\n")
4619 DEFUN (aggregate_address_mask_as_set_summary
,
4620 aggregate_address_mask_as_set_summary_cmd
,
4621 "aggregate-address A.B.C.D A.B.C.D as-set summary-only",
4622 "Configure BGP aggregate entries\n"
4623 "Aggregate address\n"
4625 "Generate AS set path information\n"
4626 "Filter more specific routes from updates\n")
4629 char prefix_str
[BUFSIZ
];
4631 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4635 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4639 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
4640 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
4643 ALIAS (aggregate_address_mask_as_set_summary
,
4644 aggregate_address_mask_summary_as_set_cmd
,
4645 "aggregate-address A.B.C.D A.B.C.D summary-only as-set",
4646 "Configure BGP aggregate entries\n"
4647 "Aggregate address\n"
4649 "Filter more specific routes from updates\n"
4650 "Generate AS set path information\n")
4652 DEFUN (no_aggregate_address
,
4653 no_aggregate_address_cmd
,
4654 "no aggregate-address A.B.C.D/M",
4656 "Configure BGP aggregate entries\n"
4657 "Aggregate prefix\n")
4659 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
));
4662 ALIAS (no_aggregate_address
,
4663 no_aggregate_address_summary_only_cmd
,
4664 "no aggregate-address A.B.C.D/M summary-only",
4666 "Configure BGP aggregate entries\n"
4667 "Aggregate prefix\n"
4668 "Filter more specific routes from updates\n")
4670 ALIAS (no_aggregate_address
,
4671 no_aggregate_address_as_set_cmd
,
4672 "no aggregate-address A.B.C.D/M as-set",
4674 "Configure BGP aggregate entries\n"
4675 "Aggregate prefix\n"
4676 "Generate AS set path information\n")
4678 ALIAS (no_aggregate_address
,
4679 no_aggregate_address_as_set_summary_cmd
,
4680 "no aggregate-address A.B.C.D/M as-set summary-only",
4682 "Configure BGP aggregate entries\n"
4683 "Aggregate prefix\n"
4684 "Generate AS set path information\n"
4685 "Filter more specific routes from updates\n")
4687 ALIAS (no_aggregate_address
,
4688 no_aggregate_address_summary_as_set_cmd
,
4689 "no aggregate-address A.B.C.D/M summary-only as-set",
4691 "Configure BGP aggregate entries\n"
4692 "Aggregate prefix\n"
4693 "Filter more specific routes from updates\n"
4694 "Generate AS set path information\n")
4696 DEFUN (no_aggregate_address_mask
,
4697 no_aggregate_address_mask_cmd
,
4698 "no aggregate-address A.B.C.D A.B.C.D",
4700 "Configure BGP aggregate entries\n"
4701 "Aggregate address\n"
4705 char prefix_str
[BUFSIZ
];
4707 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4711 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4715 return bgp_aggregate_unset (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
));
4718 ALIAS (no_aggregate_address_mask
,
4719 no_aggregate_address_mask_summary_only_cmd
,
4720 "no aggregate-address A.B.C.D A.B.C.D summary-only",
4722 "Configure BGP aggregate entries\n"
4723 "Aggregate address\n"
4725 "Filter more specific routes from updates\n")
4727 ALIAS (no_aggregate_address_mask
,
4728 no_aggregate_address_mask_as_set_cmd
,
4729 "no aggregate-address A.B.C.D A.B.C.D as-set",
4731 "Configure BGP aggregate entries\n"
4732 "Aggregate address\n"
4734 "Generate AS set path information\n")
4736 ALIAS (no_aggregate_address_mask
,
4737 no_aggregate_address_mask_as_set_summary_cmd
,
4738 "no aggregate-address A.B.C.D A.B.C.D as-set summary-only",
4740 "Configure BGP aggregate entries\n"
4741 "Aggregate address\n"
4743 "Generate AS set path information\n"
4744 "Filter more specific routes from updates\n")
4746 ALIAS (no_aggregate_address_mask
,
4747 no_aggregate_address_mask_summary_as_set_cmd
,
4748 "no aggregate-address A.B.C.D A.B.C.D summary-only as-set",
4750 "Configure BGP aggregate entries\n"
4751 "Aggregate address\n"
4753 "Filter more specific routes from updates\n"
4754 "Generate AS set path information\n")
4757 DEFUN (ipv6_aggregate_address
,
4758 ipv6_aggregate_address_cmd
,
4759 "aggregate-address X:X::X:X/M",
4760 "Configure BGP aggregate entries\n"
4761 "Aggregate prefix\n")
4763 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0, 0);
4766 DEFUN (ipv6_aggregate_address_summary_only
,
4767 ipv6_aggregate_address_summary_only_cmd
,
4768 "aggregate-address X:X::X:X/M summary-only",
4769 "Configure BGP aggregate entries\n"
4770 "Aggregate prefix\n"
4771 "Filter more specific routes from updates\n")
4773 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
4774 AGGREGATE_SUMMARY_ONLY
, 0);
4777 DEFUN (no_ipv6_aggregate_address
,
4778 no_ipv6_aggregate_address_cmd
,
4779 "no aggregate-address X:X::X:X/M",
4781 "Configure BGP aggregate entries\n"
4782 "Aggregate prefix\n")
4784 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
4787 DEFUN (no_ipv6_aggregate_address_summary_only
,
4788 no_ipv6_aggregate_address_summary_only_cmd
,
4789 "no aggregate-address X:X::X:X/M summary-only",
4791 "Configure BGP aggregate entries\n"
4792 "Aggregate prefix\n"
4793 "Filter more specific routes from updates\n")
4795 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
4798 ALIAS (ipv6_aggregate_address
,
4799 old_ipv6_aggregate_address_cmd
,
4800 "ipv6 bgp aggregate-address X:X::X:X/M",
4803 "Configure BGP aggregate entries\n"
4804 "Aggregate prefix\n")
4806 ALIAS (ipv6_aggregate_address_summary_only
,
4807 old_ipv6_aggregate_address_summary_only_cmd
,
4808 "ipv6 bgp aggregate-address X:X::X:X/M summary-only",
4811 "Configure BGP aggregate entries\n"
4812 "Aggregate prefix\n"
4813 "Filter more specific routes from updates\n")
4815 ALIAS (no_ipv6_aggregate_address
,
4816 old_no_ipv6_aggregate_address_cmd
,
4817 "no ipv6 bgp aggregate-address X:X::X:X/M",
4821 "Configure BGP aggregate entries\n"
4822 "Aggregate prefix\n")
4824 ALIAS (no_ipv6_aggregate_address_summary_only
,
4825 old_no_ipv6_aggregate_address_summary_only_cmd
,
4826 "no ipv6 bgp aggregate-address X:X::X:X/M summary-only",
4830 "Configure BGP aggregate entries\n"
4831 "Aggregate prefix\n"
4832 "Filter more specific routes from updates\n")
4833 #endif /* HAVE_IPV6 */
4835 /* Redistribute route treatment. */
4837 bgp_redistribute_add (struct prefix
*p
, struct in_addr
*nexthop
,
4838 u_int32_t metric
, u_char type
)
4841 struct listnode
*node
, *nnode
;
4842 struct bgp_info
*new;
4843 struct bgp_info
*bi
;
4844 struct bgp_info info
;
4845 struct bgp_node
*bn
;
4847 struct attr attr_new
;
4848 struct attr
*new_attr
;
4852 /* Make default attribute. */
4853 bgp_attr_default_set (&attr
, BGP_ORIGIN_INCOMPLETE
);
4855 attr
.nexthop
= *nexthop
;
4858 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
4860 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
4862 afi
= family2afi (p
->family
);
4864 if (bgp
->redist
[afi
][type
])
4866 /* Copy attribute for modification. */
4869 if (bgp
->redist_metric_flag
[afi
][type
])
4870 attr_new
.med
= bgp
->redist_metric
[afi
][type
];
4872 /* Apply route-map. */
4873 if (bgp
->rmap
[afi
][type
].map
)
4875 info
.peer
= bgp
->peer_self
;
4876 info
.attr
= &attr_new
;
4878 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_REDISTRIBUTE
);
4880 ret
= route_map_apply (bgp
->rmap
[afi
][type
].map
, p
, RMAP_BGP
,
4883 bgp
->peer_self
->rmap_type
= 0;
4885 if (ret
== RMAP_DENYMATCH
)
4887 /* Free uninterned attribute. */
4888 bgp_attr_flush (&attr_new
);
4890 /* Unintern original. */
4891 aspath_unintern (attr
.aspath
);
4892 bgp_redistribute_delete (p
, type
);
4897 bn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
], afi
, SAFI_UNICAST
, p
, NULL
);
4898 new_attr
= bgp_attr_intern (&attr_new
);
4900 for (bi
= bn
->info
; bi
; bi
= bi
->next
)
4901 if (bi
->peer
== bgp
->peer_self
4902 && bi
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
4907 if (attrhash_cmp (bi
->attr
, new_attr
))
4909 bgp_attr_unintern (new_attr
);
4910 aspath_unintern (attr
.aspath
);
4911 bgp_unlock_node (bn
);
4916 /* The attribute is changed. */
4917 SET_FLAG (bi
->flags
, BGP_INFO_ATTR_CHANGED
);
4919 /* Rewrite BGP route information. */
4920 bgp_aggregate_decrement (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
4921 bgp_attr_unintern (bi
->attr
);
4922 bi
->attr
= new_attr
;
4923 bi
->uptime
= time (NULL
);
4925 /* Process change. */
4926 bgp_aggregate_increment (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
4927 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
4928 bgp_unlock_node (bn
);
4929 aspath_unintern (attr
.aspath
);
4934 new = bgp_info_new ();
4936 new->sub_type
= BGP_ROUTE_REDISTRIBUTE
;
4937 new->peer
= bgp
->peer_self
;
4938 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4939 new->attr
= new_attr
;
4940 new->uptime
= time (NULL
);
4942 bgp_aggregate_increment (bgp
, p
, new, afi
, SAFI_UNICAST
);
4943 bgp_info_add (bn
, new);
4944 bgp_unlock_node (bn
);
4945 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
4949 /* Unintern original. */
4950 aspath_unintern (attr
.aspath
);
4954 bgp_redistribute_delete (struct prefix
*p
, u_char type
)
4957 struct listnode
*node
, *nnode
;
4959 struct bgp_node
*rn
;
4960 struct bgp_info
*ri
;
4962 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
4964 afi
= family2afi (p
->family
);
4966 if (bgp
->redist
[afi
][type
])
4968 rn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
], afi
, SAFI_UNICAST
, p
, NULL
);
4970 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4971 if (ri
->peer
== bgp
->peer_self
4972 && ri
->type
== type
)
4977 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, SAFI_UNICAST
);
4978 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
4979 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
4980 bgp_info_delete (rn
, ri
);
4982 bgp_unlock_node (rn
);
4987 /* Withdraw specified route type's route. */
4989 bgp_redistribute_withdraw (struct bgp
*bgp
, afi_t afi
, int type
)
4991 struct bgp_node
*rn
;
4992 struct bgp_info
*ri
;
4993 struct bgp_table
*table
;
4995 table
= bgp
->rib
[afi
][SAFI_UNICAST
];
4997 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
4999 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5000 if (ri
->peer
== bgp
->peer_self
5001 && ri
->type
== type
)
5006 bgp_aggregate_decrement (bgp
, &rn
->p
, ri
, afi
, SAFI_UNICAST
);
5007 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
5008 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
5009 bgp_info_delete (rn
, ri
);
5014 /* Static function to display route. */
5016 route_vty_out_route (struct prefix
*p
, struct vty
*vty
)
5019 u_int32_t destination
;
5022 if (p
->family
== AF_INET
)
5024 len
= vty_out (vty
, "%s", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
));
5025 destination
= ntohl (p
->u
.prefix4
.s_addr
);
5027 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
5028 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
5029 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
5030 || p
->u
.prefix4
.s_addr
== 0)
5032 /* When mask is natural, mask is not displayed. */
5035 len
+= vty_out (vty
, "/%d", p
->prefixlen
);
5038 len
= vty_out (vty
, "%s/%d", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
),
5043 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 20, " ");
5045 vty_out (vty
, "%*s", len
, " ");
5048 enum bgp_display_type
5053 /* Print the short form route status for a bgp_info */
5055 route_vty_short_status_out (struct vty
*vty
, struct bgp_info
*binfo
)
5057 /* Route status display. */
5058 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
5060 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
5062 else if (binfo
->suppress
)
5064 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5070 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5072 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5074 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
5079 /* Internal route. */
5080 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
5086 /* called from terminal list command */
5088 route_vty_out (struct vty
*vty
, struct prefix
*p
,
5089 struct bgp_info
*binfo
, int display
, safi_t safi
)
5093 /* short status lead text */
5094 route_vty_short_status_out (vty
, binfo
);
5096 /* print prefix and mask */
5098 route_vty_out_route (p
, vty
);
5100 vty_out (vty
, "%*s", 17, " ");
5102 /* Print attribute */
5106 if (p
->family
== AF_INET
)
5108 if (safi
== SAFI_MPLS_VPN
)
5109 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
5111 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5114 else if (p
->family
== AF_INET6
)
5119 len
= vty_out (vty
, "%s",
5120 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
5123 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
5125 vty_out (vty
, "%*s", len
, " ");
5127 #endif /* HAVE_IPV6 */
5129 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
5130 vty_out (vty
, "%10d", attr
->med
);
5134 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
5135 vty_out (vty
, "%7d", attr
->local_pref
);
5139 vty_out (vty
, "%7u ",attr
->weight
);
5143 aspath_print_vty (vty
, attr
->aspath
);
5146 if (strlen (attr
->aspath
->str
) == 0)
5147 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5149 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
5151 vty_out (vty
, "%s", VTY_NEWLINE
);
5154 /* called from terminal list command */
5156 route_vty_out_tmp (struct vty
*vty
, struct prefix
*p
,
5157 struct attr
*attr
, safi_t safi
)
5159 /* Route status display. */
5164 /* print prefix and mask */
5165 route_vty_out_route (p
, vty
);
5167 /* Print attribute */
5170 if (p
->family
== AF_INET
)
5172 if (safi
== SAFI_MPLS_VPN
)
5173 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
5175 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5178 else if (p
->family
== AF_INET6
)
5183 len
= vty_out (vty
, "%s",
5184 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
5187 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
5189 vty_out (vty
, "%*s", len
, " ");
5191 #endif /* HAVE_IPV6 */
5193 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
5194 vty_out (vty
, "%10d", attr
->med
);
5198 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
5199 vty_out (vty
, "%7d", attr
->local_pref
);
5203 vty_out (vty
, "%7d ",attr
->weight
);
5207 aspath_print_vty (vty
, attr
->aspath
);
5210 if (strlen (attr
->aspath
->str
) == 0)
5211 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5213 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
5216 vty_out (vty
, "%s", VTY_NEWLINE
);
5220 route_vty_out_tag (struct vty
*vty
, struct prefix
*p
,
5221 struct bgp_info
*binfo
, int display
, safi_t safi
)
5224 u_int32_t label
= 0;
5226 /* short status lead text */
5227 route_vty_short_status_out (vty
, binfo
);
5229 /* print prefix and mask */
5231 route_vty_out_route (p
, vty
);
5233 vty_out (vty
, "%*s", 17, " ");
5235 /* Print attribute */
5239 if (p
->family
== AF_INET
)
5241 if (safi
== SAFI_MPLS_VPN
)
5242 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
5244 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5247 else if (p
->family
== AF_INET6
)
5251 if (attr
->mp_nexthop_len
== 16)
5253 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
5254 else if (attr
->mp_nexthop_len
== 32)
5255 vty_out (vty
, "%s(%s)",
5256 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
),
5257 inet_ntop (AF_INET6
, &attr
->mp_nexthop_local
, buf1
, BUFSIZ
));
5260 #endif /* HAVE_IPV6 */
5263 label
= decode_label (binfo
->tag
);
5265 vty_out (vty
, "notag/%d", label
);
5267 vty_out (vty
, "%s", VTY_NEWLINE
);
5270 /* dampening route */
5272 damp_route_vty_out (struct vty
*vty
, struct prefix
*p
,
5273 struct bgp_info
*binfo
, int display
, safi_t safi
)
5278 /* short status lead text */
5279 route_vty_short_status_out (vty
, binfo
);
5281 /* print prefix and mask */
5283 route_vty_out_route (p
, vty
);
5285 vty_out (vty
, "%*s", 17, " ");
5287 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
5290 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 34, " ");
5292 vty_out (vty
, "%*s", len
, " ");
5294 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
));
5296 /* Print attribute */
5302 aspath_print_vty (vty
, attr
->aspath
);
5305 if (strlen (attr
->aspath
->str
) == 0)
5306 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5308 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
5310 vty_out (vty
, "%s", VTY_NEWLINE
);
5313 #define BGP_UPTIME_LEN 25
5317 flap_route_vty_out (struct vty
*vty
, struct prefix
*p
,
5318 struct bgp_info
*binfo
, int display
, safi_t safi
)
5321 struct bgp_damp_info
*bdi
;
5322 char timebuf
[BGP_UPTIME_LEN
];
5325 bdi
= binfo
->damp_info
;
5327 /* short status lead text */
5328 route_vty_short_status_out (vty
, binfo
);
5330 /* print prefix and mask */
5332 route_vty_out_route (p
, vty
);
5334 vty_out (vty
, "%*s", 17, " ");
5336 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
5339 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 33, " ");
5341 vty_out (vty
, "%*s", len
, " ");
5343 len
= vty_out (vty
, "%d", bdi
->flap
);
5348 vty_out (vty
, "%*s ", len
, " ");
5350 vty_out (vty
, "%s ", peer_uptime (bdi
->start_time
,
5351 timebuf
, BGP_UPTIME_LEN
));
5353 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
)
5354 && ! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5355 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
));
5357 vty_out (vty
, "%*s ", 8, " ");
5359 /* Print attribute */
5365 aspath_print_vty (vty
, attr
->aspath
);
5368 if (strlen (attr
->aspath
->str
) == 0)
5369 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5371 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
5373 vty_out (vty
, "%s", VTY_NEWLINE
);
5377 route_vty_out_detail (struct vty
*vty
, struct bgp
*bgp
, struct prefix
*p
,
5378 struct bgp_info
*binfo
, afi_t afi
, safi_t safi
)
5380 char buf
[INET6_ADDRSTRLEN
];
5383 int sockunion_vty_out (struct vty
*, union sockunion
*);
5389 /* Line1 display AS-path, Aggregator */
5393 if (aspath_count_hops (attr
->aspath
) == 0)
5394 vty_out (vty
, "Local");
5396 aspath_print_vty (vty
, attr
->aspath
);
5399 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
5400 vty_out (vty
, ", (removed)");
5401 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
5402 vty_out (vty
, ", (stale)");
5403 if (CHECK_FLAG (attr
->flag
, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR
)))
5404 vty_out (vty
, ", (aggregated by %d %s)", attr
->aggregator_as
,
5405 inet_ntoa (attr
->aggregator_addr
));
5406 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
5407 vty_out (vty
, ", (Received from a RR-client)");
5408 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
5409 vty_out (vty
, ", (Received from a RS-client)");
5410 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5411 vty_out (vty
, ", (history entry)");
5412 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5413 vty_out (vty
, ", (suppressed due to dampening)");
5414 vty_out (vty
, "%s", VTY_NEWLINE
);
5416 /* Line2 display Next-hop, Neighbor, Router-id */
5417 if (p
->family
== AF_INET
)
5419 vty_out (vty
, " %s", safi
== SAFI_MPLS_VPN
?
5420 inet_ntoa (attr
->mp_nexthop_global_in
) :
5421 inet_ntoa (attr
->nexthop
));
5426 vty_out (vty
, " %s",
5427 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
,
5428 buf
, INET6_ADDRSTRLEN
));
5430 #endif /* HAVE_IPV6 */
5432 if (binfo
->peer
== bgp
->peer_self
)
5434 vty_out (vty
, " from %s ",
5435 p
->family
== AF_INET
? "0.0.0.0" : "::");
5436 vty_out (vty
, "(%s)", inet_ntoa(bgp
->router_id
));
5440 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_VALID
))
5441 vty_out (vty
, " (inaccessible)");
5442 else if (binfo
->igpmetric
)
5443 vty_out (vty
, " (metric %d)", binfo
->igpmetric
);
5444 vty_out (vty
, " from %s", sockunion2str (&binfo
->peer
->su
, buf
, SU_ADDRSTRLEN
));
5445 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
5446 vty_out (vty
, " (%s)", inet_ntoa (attr
->originator_id
));
5448 vty_out (vty
, " (%s)", inet_ntop (AF_INET
, &binfo
->peer
->remote_id
, buf1
, BUFSIZ
));
5450 vty_out (vty
, "%s", VTY_NEWLINE
);
5453 /* display nexthop local */
5454 if (attr
->mp_nexthop_len
== 32)
5456 vty_out (vty
, " (%s)%s",
5457 inet_ntop (AF_INET6
, &attr
->mp_nexthop_local
,
5458 buf
, INET6_ADDRSTRLEN
),
5461 #endif /* HAVE_IPV6 */
5463 /* Line 3 display Origin, Med, Locpref, Weight, valid, Int/Ext/Local, Atomic, best */
5464 vty_out (vty
, " Origin %s", bgp_origin_long_str
[attr
->origin
]);
5466 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
))
5467 vty_out (vty
, ", metric %d", attr
->med
);
5469 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
))
5470 vty_out (vty
, ", localpref %d", attr
->local_pref
);
5472 vty_out (vty
, ", localpref %d", bgp
->default_local_pref
);
5474 if (attr
->weight
!= 0)
5475 vty_out (vty
, ", weight %d", attr
->weight
);
5477 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5478 vty_out (vty
, ", valid");
5480 if (binfo
->peer
!= bgp
->peer_self
)
5482 if (binfo
->peer
->as
== binfo
->peer
->local_as
)
5483 vty_out (vty
, ", internal");
5485 vty_out (vty
, ", %s",
5486 (bgp_confederation_peers_check(bgp
, binfo
->peer
->as
) ? "confed-external" : "external"));
5488 else if (binfo
->sub_type
== BGP_ROUTE_AGGREGATE
)
5489 vty_out (vty
, ", aggregated, local");
5490 else if (binfo
->type
!= ZEBRA_ROUTE_BGP
)
5491 vty_out (vty
, ", sourced");
5493 vty_out (vty
, ", sourced, local");
5495 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
5496 vty_out (vty
, ", atomic-aggregate");
5498 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
5499 vty_out (vty
, ", best");
5501 vty_out (vty
, "%s", VTY_NEWLINE
);
5503 /* Line 4 display Community */
5504 if (attr
->community
)
5505 vty_out (vty
, " Community: %s%s", attr
->community
->str
,
5508 /* Line 5 display Extended-community */
5509 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
))
5510 vty_out (vty
, " Extended Community: %s%s", attr
->ecommunity
->str
,
5513 /* Line 6 display Originator, Cluster-id */
5514 if ((attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)) ||
5515 (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
)))
5517 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
5518 vty_out (vty
, " Originator: %s", inet_ntoa (attr
->originator_id
));
5520 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
5523 vty_out (vty
, ", Cluster list: ");
5524 for (i
= 0; i
< attr
->cluster
->length
/ 4; i
++)
5525 vty_out (vty
, "%s ", inet_ntoa (attr
->cluster
->list
[i
]));
5527 vty_out (vty
, "%s", VTY_NEWLINE
);
5530 if (binfo
->damp_info
)
5531 bgp_damp_info_vty (vty
, binfo
);
5533 /* Line 7 display Uptime */
5534 vty_out (vty
, " Last update: %s", ctime (&binfo
->uptime
));
5536 vty_out (vty
, "%s", VTY_NEWLINE
);
5539 #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"
5540 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s"
5541 #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s"
5542 #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s"
5543 #define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path%s"
5547 bgp_show_type_normal
,
5548 bgp_show_type_regexp
,
5549 bgp_show_type_prefix_list
,
5550 bgp_show_type_filter_list
,
5551 bgp_show_type_route_map
,
5552 bgp_show_type_neighbor
,
5553 bgp_show_type_cidr_only
,
5554 bgp_show_type_prefix_longer
,
5555 bgp_show_type_community_all
,
5556 bgp_show_type_community
,
5557 bgp_show_type_community_exact
,
5558 bgp_show_type_community_list
,
5559 bgp_show_type_community_list_exact
,
5560 bgp_show_type_flap_statistics
,
5561 bgp_show_type_flap_address
,
5562 bgp_show_type_flap_prefix
,
5563 bgp_show_type_flap_cidr_only
,
5564 bgp_show_type_flap_regexp
,
5565 bgp_show_type_flap_filter_list
,
5566 bgp_show_type_flap_prefix_list
,
5567 bgp_show_type_flap_prefix_longer
,
5568 bgp_show_type_flap_route_map
,
5569 bgp_show_type_flap_neighbor
,
5570 bgp_show_type_dampend_paths
,
5571 bgp_show_type_damp_neighbor
5575 bgp_show_table (struct vty
*vty
, struct bgp_table
*table
, struct in_addr
*router_id
,
5576 enum bgp_show_type type
, void *output_arg
)
5578 struct bgp_info
*ri
;
5579 struct bgp_node
*rn
;
5582 unsigned long output_count
;
5584 /* This is first entry point, so reset total line. */
5587 /* Start processing of routes. */
5588 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
5589 if (rn
->info
!= NULL
)
5593 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5595 if (type
== bgp_show_type_flap_statistics
5596 || type
== bgp_show_type_flap_address
5597 || type
== bgp_show_type_flap_prefix
5598 || type
== bgp_show_type_flap_cidr_only
5599 || type
== bgp_show_type_flap_regexp
5600 || type
== bgp_show_type_flap_filter_list
5601 || type
== bgp_show_type_flap_prefix_list
5602 || type
== bgp_show_type_flap_prefix_longer
5603 || type
== bgp_show_type_flap_route_map
5604 || type
== bgp_show_type_flap_neighbor
5605 || type
== bgp_show_type_dampend_paths
5606 || type
== bgp_show_type_damp_neighbor
)
5608 if (! ri
->damp_info
)
5611 if (type
== bgp_show_type_regexp
5612 || type
== bgp_show_type_flap_regexp
)
5614 regex_t
*regex
= output_arg
;
5616 if (bgp_regexec (regex
, ri
->attr
->aspath
) == REG_NOMATCH
)
5619 if (type
== bgp_show_type_prefix_list
5620 || type
== bgp_show_type_flap_prefix_list
)
5622 struct prefix_list
*plist
= output_arg
;
5624 if (prefix_list_apply (plist
, &rn
->p
) != PREFIX_PERMIT
)
5627 if (type
== bgp_show_type_filter_list
5628 || type
== bgp_show_type_flap_filter_list
)
5630 struct as_list
*as_list
= output_arg
;
5632 if (as_list_apply (as_list
, ri
->attr
->aspath
) != AS_FILTER_PERMIT
)
5635 if (type
== bgp_show_type_route_map
5636 || type
== bgp_show_type_flap_route_map
)
5638 struct route_map
*rmap
= output_arg
;
5639 struct bgp_info binfo
;
5640 struct attr dummy_attr
;
5643 dummy_attr
= *ri
->attr
;
5644 binfo
.peer
= ri
->peer
;
5645 binfo
.attr
= &dummy_attr
;
5647 ret
= route_map_apply (rmap
, &rn
->p
, RMAP_BGP
, &binfo
);
5649 if (ret
== RMAP_DENYMATCH
)
5652 if (type
== bgp_show_type_neighbor
5653 || type
== bgp_show_type_flap_neighbor
5654 || type
== bgp_show_type_damp_neighbor
)
5656 union sockunion
*su
= output_arg
;
5658 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
5661 if (type
== bgp_show_type_cidr_only
5662 || type
== bgp_show_type_flap_cidr_only
)
5664 u_int32_t destination
;
5666 destination
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
5667 if (IN_CLASSC (destination
) && rn
->p
.prefixlen
== 24)
5669 if (IN_CLASSB (destination
) && rn
->p
.prefixlen
== 16)
5671 if (IN_CLASSA (destination
) && rn
->p
.prefixlen
== 8)
5674 if (type
== bgp_show_type_prefix_longer
5675 || type
== bgp_show_type_flap_prefix_longer
)
5677 struct prefix
*p
= output_arg
;
5679 if (! prefix_match (p
, &rn
->p
))
5682 if (type
== bgp_show_type_community_all
)
5684 if (! ri
->attr
->community
)
5687 if (type
== bgp_show_type_community
)
5689 struct community
*com
= output_arg
;
5691 if (! ri
->attr
->community
||
5692 ! community_match (ri
->attr
->community
, com
))
5695 if (type
== bgp_show_type_community_exact
)
5697 struct community
*com
= output_arg
;
5699 if (! ri
->attr
->community
||
5700 ! community_cmp (ri
->attr
->community
, com
))
5703 if (type
== bgp_show_type_community_list
)
5705 struct community_list
*list
= output_arg
;
5707 if (! community_list_match (ri
->attr
->community
, list
))
5710 if (type
== bgp_show_type_community_list_exact
)
5712 struct community_list
*list
= output_arg
;
5714 if (! community_list_exact_match (ri
->attr
->community
, list
))
5717 if (type
== bgp_show_type_flap_address
5718 || type
== bgp_show_type_flap_prefix
)
5720 struct prefix
*p
= output_arg
;
5722 if (! prefix_match (&rn
->p
, p
))
5725 if (type
== bgp_show_type_flap_prefix
)
5726 if (p
->prefixlen
!= rn
->p
.prefixlen
)
5729 if (type
== bgp_show_type_dampend_paths
5730 || type
== bgp_show_type_damp_neighbor
)
5732 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
5733 || CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
5739 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id
), VTY_NEWLINE
);
5740 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
5741 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
5742 if (type
== bgp_show_type_dampend_paths
5743 || type
== bgp_show_type_damp_neighbor
)
5744 vty_out (vty
, BGP_SHOW_DAMP_HEADER
, VTY_NEWLINE
);
5745 else if (type
== bgp_show_type_flap_statistics
5746 || type
== bgp_show_type_flap_address
5747 || type
== bgp_show_type_flap_prefix
5748 || type
== bgp_show_type_flap_cidr_only
5749 || type
== bgp_show_type_flap_regexp
5750 || type
== bgp_show_type_flap_filter_list
5751 || type
== bgp_show_type_flap_prefix_list
5752 || type
== bgp_show_type_flap_prefix_longer
5753 || type
== bgp_show_type_flap_route_map
5754 || type
== bgp_show_type_flap_neighbor
)
5755 vty_out (vty
, BGP_SHOW_FLAP_HEADER
, VTY_NEWLINE
);
5757 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
5761 if (type
== bgp_show_type_dampend_paths
5762 || type
== bgp_show_type_damp_neighbor
)
5763 damp_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
5764 else if (type
== bgp_show_type_flap_statistics
5765 || type
== bgp_show_type_flap_address
5766 || type
== bgp_show_type_flap_prefix
5767 || type
== bgp_show_type_flap_cidr_only
5768 || type
== bgp_show_type_flap_regexp
5769 || type
== bgp_show_type_flap_filter_list
5770 || type
== bgp_show_type_flap_prefix_list
5771 || type
== bgp_show_type_flap_prefix_longer
5772 || type
== bgp_show_type_flap_route_map
5773 || type
== bgp_show_type_flap_neighbor
)
5774 flap_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
5776 route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
5783 /* No route is displayed */
5784 if (output_count
== 0)
5786 if (type
== bgp_show_type_normal
)
5787 vty_out (vty
, "No BGP network exists%s", VTY_NEWLINE
);
5790 vty_out (vty
, "%sTotal number of prefixes %ld%s",
5791 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
5797 bgp_show (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
5798 enum bgp_show_type type
, void *output_arg
)
5800 struct bgp_table
*table
;
5803 bgp
= bgp_get_default ();
5808 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
5813 table
= bgp
->rib
[afi
][safi
];
5815 return bgp_show_table (vty
, table
, &bgp
->router_id
, type
, output_arg
);
5818 /* Header of detailed BGP route information */
5820 route_vty_out_detail_header (struct vty
*vty
, struct bgp
*bgp
,
5821 struct bgp_node
*rn
,
5822 struct prefix_rd
*prd
, afi_t afi
, safi_t safi
)
5824 struct bgp_info
*ri
;
5827 struct listnode
*node
, *nnode
;
5828 char buf1
[INET6_ADDRSTRLEN
];
5829 char buf2
[INET6_ADDRSTRLEN
];
5834 int no_advertise
= 0;
5839 vty_out (vty
, "BGP routing table entry for %s%s%s/%d%s",
5840 (safi
== SAFI_MPLS_VPN
?
5841 prefix_rd2str (prd
, buf1
, RD_ADDRSTRLEN
) : ""),
5842 safi
== SAFI_MPLS_VPN
? ":" : "",
5843 inet_ntop (p
->family
, &p
->u
.prefix
, buf2
, INET6_ADDRSTRLEN
),
5844 p
->prefixlen
, VTY_NEWLINE
);
5846 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5849 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
5854 if (ri
->attr
->community
!= NULL
)
5856 if (community_include (ri
->attr
->community
, COMMUNITY_NO_ADVERTISE
))
5858 if (community_include (ri
->attr
->community
, COMMUNITY_NO_EXPORT
))
5860 if (community_include (ri
->attr
->community
, COMMUNITY_LOCAL_AS
))
5866 vty_out (vty
, "Paths: (%d available", count
);
5869 vty_out (vty
, ", best #%d", best
);
5870 if (safi
== SAFI_UNICAST
)
5871 vty_out (vty
, ", table Default-IP-Routing-Table");
5874 vty_out (vty
, ", no best path");
5876 vty_out (vty
, ", not advertised to any peer");
5878 vty_out (vty
, ", not advertised to EBGP peer");
5880 vty_out (vty
, ", not advertised outside local AS");
5882 vty_out (vty
, ", Advertisements suppressed by an aggregate.");
5883 vty_out (vty
, ")%s", VTY_NEWLINE
);
5885 /* advertised peer */
5886 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
5888 if (bgp_adj_out_lookup (peer
, p
, afi
, safi
, rn
))
5891 vty_out (vty
, " Advertised to non peer-group peers:%s ", VTY_NEWLINE
);
5892 vty_out (vty
, " %s", sockunion2str (&peer
->su
, buf1
, SU_ADDRSTRLEN
));
5897 vty_out (vty
, " Not advertised to any peer");
5898 vty_out (vty
, "%s", VTY_NEWLINE
);
5901 /* Display specified route of BGP table. */
5903 bgp_show_route_in_table (struct vty
*vty
, struct bgp
*bgp
,
5904 struct bgp_table
*rib
, const char *ip_str
,
5905 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
5911 struct prefix match
;
5912 struct bgp_node
*rn
;
5913 struct bgp_node
*rm
;
5914 struct bgp_info
*ri
;
5915 struct bgp_table
*table
;
5917 /* Check IP address argument. */
5918 ret
= str2prefix (ip_str
, &match
);
5921 vty_out (vty
, "address is malformed%s", VTY_NEWLINE
);
5925 match
.family
= afi2family (afi
);
5927 if (safi
== SAFI_MPLS_VPN
)
5929 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
5931 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
5934 if ((table
= rn
->info
) != NULL
)
5938 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
5940 if (prefix_check
&& rm
->p
.prefixlen
!= match
.prefixlen
)
5943 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
5947 route_vty_out_detail_header (vty
, bgp
, rm
, (struct prefix_rd
*)&rn
->p
,
5948 AFI_IP
, SAFI_MPLS_VPN
);
5953 route_vty_out_detail (vty
, bgp
, &rm
->p
, ri
, AFI_IP
, SAFI_MPLS_VPN
);
5963 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
5965 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
5967 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5971 route_vty_out_detail_header (vty
, bgp
, rn
, NULL
, afi
, safi
);
5975 route_vty_out_detail (vty
, bgp
, &rn
->p
, ri
, afi
, safi
);
5983 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
5990 /* Display specified route of Main RIB */
5992 bgp_show_route (struct vty
*vty
, const char *view_name
, const char *ip_str
,
5993 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
5998 /* BGP structure lookup. */
6001 bgp
= bgp_lookup_by_name (view_name
);
6004 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
6010 bgp
= bgp_get_default ();
6013 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
6018 return bgp_show_route_in_table (vty
, bgp
, bgp
->rib
[afi
][safi
], ip_str
,
6019 afi
, safi
, prd
, prefix_check
);
6022 /* BGP route print out function. */
6030 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6033 DEFUN (show_ip_bgp_ipv4
,
6034 show_ip_bgp_ipv4_cmd
,
6035 "show ip bgp ipv4 (unicast|multicast)",
6040 "Address Family modifier\n"
6041 "Address Family modifier\n")
6043 if (strncmp (argv
[0], "m", 1) == 0)
6044 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, bgp_show_type_normal
,
6047 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6050 DEFUN (show_ip_bgp_route
,
6051 show_ip_bgp_route_cmd
,
6052 "show ip bgp A.B.C.D",
6056 "Network in the BGP routing table to display\n")
6058 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6061 DEFUN (show_ip_bgp_ipv4_route
,
6062 show_ip_bgp_ipv4_route_cmd
,
6063 "show ip bgp ipv4 (unicast|multicast) A.B.C.D",
6068 "Address Family modifier\n"
6069 "Address Family modifier\n"
6070 "Network in the BGP routing table to display\n")
6072 if (strncmp (argv
[0], "m", 1) == 0)
6073 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0);
6075 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6078 DEFUN (show_ip_bgp_vpnv4_all_route
,
6079 show_ip_bgp_vpnv4_all_route_cmd
,
6080 "show ip bgp vpnv4 all A.B.C.D",
6084 "Display VPNv4 NLRI specific information\n"
6085 "Display information about all VPNv4 NLRIs\n"
6086 "Network in the BGP routing table to display\n")
6088 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 0);
6091 DEFUN (show_ip_bgp_vpnv4_rd_route
,
6092 show_ip_bgp_vpnv4_rd_route_cmd
,
6093 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D",
6097 "Display VPNv4 NLRI specific information\n"
6098 "Display information for a route distinguisher\n"
6099 "VPN Route Distinguisher\n"
6100 "Network in the BGP routing table to display\n")
6103 struct prefix_rd prd
;
6105 ret
= str2prefix_rd (argv
[0], &prd
);
6108 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
6111 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 0);
6114 DEFUN (show_ip_bgp_prefix
,
6115 show_ip_bgp_prefix_cmd
,
6116 "show ip bgp A.B.C.D/M",
6120 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6122 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6125 DEFUN (show_ip_bgp_ipv4_prefix
,
6126 show_ip_bgp_ipv4_prefix_cmd
,
6127 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M",
6132 "Address Family modifier\n"
6133 "Address Family modifier\n"
6134 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6136 if (strncmp (argv
[0], "m", 1) == 0)
6137 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1);
6139 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6142 DEFUN (show_ip_bgp_vpnv4_all_prefix
,
6143 show_ip_bgp_vpnv4_all_prefix_cmd
,
6144 "show ip bgp vpnv4 all A.B.C.D/M",
6148 "Display VPNv4 NLRI specific information\n"
6149 "Display information about all VPNv4 NLRIs\n"
6150 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6152 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 1);
6155 DEFUN (show_ip_bgp_vpnv4_rd_prefix
,
6156 show_ip_bgp_vpnv4_rd_prefix_cmd
,
6157 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M",
6161 "Display VPNv4 NLRI specific information\n"
6162 "Display information for a route distinguisher\n"
6163 "VPN Route Distinguisher\n"
6164 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6167 struct prefix_rd prd
;
6169 ret
= str2prefix_rd (argv
[0], &prd
);
6172 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
6175 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 1);
6178 DEFUN (show_ip_bgp_view
,
6179 show_ip_bgp_view_cmd
,
6180 "show ip bgp view WORD",
6189 /* BGP structure lookup. */
6190 bgp
= bgp_lookup_by_name (argv
[0]);
6193 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
6197 return bgp_show (vty
, bgp
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6200 DEFUN (show_ip_bgp_view_route
,
6201 show_ip_bgp_view_route_cmd
,
6202 "show ip bgp view WORD A.B.C.D",
6208 "Network in the BGP routing table to display\n")
6210 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6213 DEFUN (show_ip_bgp_view_prefix
,
6214 show_ip_bgp_view_prefix_cmd
,
6215 "show ip bgp view WORD A.B.C.D/M",
6221 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6223 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6233 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
6245 DEFUN (show_ipv6_bgp
,
6252 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
6256 DEFUN (show_bgp_route
,
6258 "show bgp X:X::X:X",
6261 "Network in the BGP routing table to display\n")
6263 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6266 ALIAS (show_bgp_route
,
6267 show_bgp_ipv6_route_cmd
,
6268 "show bgp ipv6 X:X::X:X",
6272 "Network in the BGP routing table to display\n")
6275 DEFUN (show_ipv6_bgp_route
,
6276 show_ipv6_bgp_route_cmd
,
6277 "show ipv6 bgp X:X::X:X",
6281 "Network in the BGP routing table to display\n")
6283 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6286 DEFUN (show_bgp_prefix
,
6287 show_bgp_prefix_cmd
,
6288 "show bgp X:X::X:X/M",
6291 "IPv6 prefix <network>/<length>\n")
6293 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6296 ALIAS (show_bgp_prefix
,
6297 show_bgp_ipv6_prefix_cmd
,
6298 "show bgp ipv6 X:X::X:X/M",
6302 "IPv6 prefix <network>/<length>\n")
6305 DEFUN (show_ipv6_bgp_prefix
,
6306 show_ipv6_bgp_prefix_cmd
,
6307 "show ipv6 bgp X:X::X:X/M",
6311 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6313 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6316 DEFUN (show_bgp_view
,
6318 "show bgp view WORD",
6326 /* BGP structure lookup. */
6327 bgp
= bgp_lookup_by_name (argv
[0]);
6330 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
6334 return bgp_show (vty
, bgp
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6337 ALIAS (show_bgp_view
,
6338 show_bgp_view_ipv6_cmd
,
6339 "show bgp view WORD ipv6",
6346 DEFUN (show_bgp_view_route
,
6347 show_bgp_view_route_cmd
,
6348 "show bgp view WORD X:X::X:X",
6353 "Network in the BGP routing table to display\n")
6355 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6358 ALIAS (show_bgp_view_route
,
6359 show_bgp_view_ipv6_route_cmd
,
6360 "show bgp view WORD ipv6 X:X::X:X",
6366 "Network in the BGP routing table to display\n")
6368 DEFUN (show_bgp_view_prefix
,
6369 show_bgp_view_prefix_cmd
,
6370 "show bgp view WORD X:X::X:X/M",
6375 "IPv6 prefix <network>/<length>\n")
6377 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6380 ALIAS (show_bgp_view_prefix
,
6381 show_bgp_view_ipv6_prefix_cmd
,
6382 "show bgp view WORD ipv6 X:X::X:X/M",
6388 "IPv6 prefix <network>/<length>\n")
6391 DEFUN (show_ipv6_mbgp
,
6398 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
6403 DEFUN (show_ipv6_mbgp_route
,
6404 show_ipv6_mbgp_route_cmd
,
6405 "show ipv6 mbgp X:X::X:X",
6409 "Network in the MBGP routing table to display\n")
6411 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0);
6415 DEFUN (show_ipv6_mbgp_prefix
,
6416 show_ipv6_mbgp_prefix_cmd
,
6417 "show ipv6 mbgp X:X::X:X/M",
6421 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6423 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1);
6429 bgp_show_regexp (struct vty
*vty
, int argc
, const char **argv
, afi_t afi
,
6430 safi_t safi
, enum bgp_show_type type
)
6440 b
= buffer_new (1024);
6441 for (i
= 0; i
< argc
; i
++)
6444 buffer_putc (b
, ' ');
6447 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
6452 buffer_putstr (b
, argv
[i
]);
6454 buffer_putc (b
, '\0');
6456 regstr
= buffer_getstr (b
);
6459 regex
= bgp_regcomp (regstr
);
6460 XFREE(MTYPE_TMP
, regstr
);
6463 vty_out (vty
, "Can't compile regexp %s%s", argv
[0],
6468 rc
= bgp_show (vty
, NULL
, afi
, safi
, type
, regex
);
6469 bgp_regex_free (regex
);
6473 DEFUN (show_ip_bgp_regexp
,
6474 show_ip_bgp_regexp_cmd
,
6475 "show ip bgp regexp .LINE",
6479 "Display routes matching the AS path regular expression\n"
6480 "A regular-expression to match the BGP AS paths\n")
6482 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
6483 bgp_show_type_regexp
);
6486 DEFUN (show_ip_bgp_flap_regexp
,
6487 show_ip_bgp_flap_regexp_cmd
,
6488 "show ip bgp flap-statistics regexp .LINE",
6492 "Display flap statistics of routes\n"
6493 "Display routes matching the AS path regular expression\n"
6494 "A regular-expression to match the BGP AS paths\n")
6496 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
6497 bgp_show_type_flap_regexp
);
6500 DEFUN (show_ip_bgp_ipv4_regexp
,
6501 show_ip_bgp_ipv4_regexp_cmd
,
6502 "show ip bgp ipv4 (unicast|multicast) regexp .LINE",
6507 "Address Family modifier\n"
6508 "Address Family modifier\n"
6509 "Display routes matching the AS path regular expression\n"
6510 "A regular-expression to match the BGP AS paths\n")
6512 if (strncmp (argv
[0], "m", 1) == 0)
6513 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_MULTICAST
,
6514 bgp_show_type_regexp
);
6516 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
6517 bgp_show_type_regexp
);
6521 DEFUN (show_bgp_regexp
,
6522 show_bgp_regexp_cmd
,
6523 "show bgp regexp .LINE",
6526 "Display routes matching the AS path regular expression\n"
6527 "A regular-expression to match the BGP AS paths\n")
6529 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
6530 bgp_show_type_regexp
);
6533 ALIAS (show_bgp_regexp
,
6534 show_bgp_ipv6_regexp_cmd
,
6535 "show bgp ipv6 regexp .LINE",
6539 "Display routes matching the AS path regular expression\n"
6540 "A regular-expression to match the BGP AS paths\n")
6543 DEFUN (show_ipv6_bgp_regexp
,
6544 show_ipv6_bgp_regexp_cmd
,
6545 "show ipv6 bgp regexp .LINE",
6549 "Display routes matching the AS path regular expression\n"
6550 "A regular-expression to match the BGP AS paths\n")
6552 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
6553 bgp_show_type_regexp
);
6557 DEFUN (show_ipv6_mbgp_regexp
,
6558 show_ipv6_mbgp_regexp_cmd
,
6559 "show ipv6 mbgp regexp .LINE",
6563 "Display routes matching the AS path regular expression\n"
6564 "A regular-expression to match the MBGP AS paths\n")
6566 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_MULTICAST
,
6567 bgp_show_type_regexp
);
6569 #endif /* HAVE_IPV6 */
6572 bgp_show_prefix_list (struct vty
*vty
, const char *prefix_list_str
, afi_t afi
,
6573 safi_t safi
, enum bgp_show_type type
)
6575 struct prefix_list
*plist
;
6577 plist
= prefix_list_lookup (afi
, prefix_list_str
);
6580 vty_out (vty
, "%% %s is not a valid prefix-list name%s",
6581 prefix_list_str
, VTY_NEWLINE
);
6585 return bgp_show (vty
, NULL
, afi
, safi
, type
, plist
);
6588 DEFUN (show_ip_bgp_prefix_list
,
6589 show_ip_bgp_prefix_list_cmd
,
6590 "show ip bgp prefix-list WORD",
6594 "Display routes conforming to the prefix-list\n"
6595 "IP prefix-list name\n")
6597 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6598 bgp_show_type_prefix_list
);
6601 DEFUN (show_ip_bgp_flap_prefix_list
,
6602 show_ip_bgp_flap_prefix_list_cmd
,
6603 "show ip bgp flap-statistics prefix-list WORD",
6607 "Display flap statistics of routes\n"
6608 "Display routes conforming to the prefix-list\n"
6609 "IP prefix-list name\n")
6611 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6612 bgp_show_type_flap_prefix_list
);
6615 DEFUN (show_ip_bgp_ipv4_prefix_list
,
6616 show_ip_bgp_ipv4_prefix_list_cmd
,
6617 "show ip bgp ipv4 (unicast|multicast) prefix-list WORD",
6622 "Address Family modifier\n"
6623 "Address Family modifier\n"
6624 "Display routes conforming to the prefix-list\n"
6625 "IP prefix-list name\n")
6627 if (strncmp (argv
[0], "m", 1) == 0)
6628 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
6629 bgp_show_type_prefix_list
);
6631 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
6632 bgp_show_type_prefix_list
);
6636 DEFUN (show_bgp_prefix_list
,
6637 show_bgp_prefix_list_cmd
,
6638 "show bgp prefix-list WORD",
6641 "Display routes conforming to the prefix-list\n"
6642 "IPv6 prefix-list name\n")
6644 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6645 bgp_show_type_prefix_list
);
6648 ALIAS (show_bgp_prefix_list
,
6649 show_bgp_ipv6_prefix_list_cmd
,
6650 "show bgp ipv6 prefix-list WORD",
6654 "Display routes conforming to the prefix-list\n"
6655 "IPv6 prefix-list name\n")
6658 DEFUN (show_ipv6_bgp_prefix_list
,
6659 show_ipv6_bgp_prefix_list_cmd
,
6660 "show ipv6 bgp prefix-list WORD",
6664 "Display routes matching the prefix-list\n"
6665 "IPv6 prefix-list name\n")
6667 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6668 bgp_show_type_prefix_list
);
6672 DEFUN (show_ipv6_mbgp_prefix_list
,
6673 show_ipv6_mbgp_prefix_list_cmd
,
6674 "show ipv6 mbgp prefix-list WORD",
6678 "Display routes matching the prefix-list\n"
6679 "IPv6 prefix-list name\n")
6681 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
6682 bgp_show_type_prefix_list
);
6684 #endif /* HAVE_IPV6 */
6687 bgp_show_filter_list (struct vty
*vty
, const char *filter
, afi_t afi
,
6688 safi_t safi
, enum bgp_show_type type
)
6690 struct as_list
*as_list
;
6692 as_list
= as_list_lookup (filter
);
6693 if (as_list
== NULL
)
6695 vty_out (vty
, "%% %s is not a valid AS-path access-list name%s", filter
, VTY_NEWLINE
);
6699 return bgp_show (vty
, NULL
, afi
, safi
, type
, as_list
);
6702 DEFUN (show_ip_bgp_filter_list
,
6703 show_ip_bgp_filter_list_cmd
,
6704 "show ip bgp filter-list WORD",
6708 "Display routes conforming to the filter-list\n"
6709 "Regular expression access list name\n")
6711 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6712 bgp_show_type_filter_list
);
6715 DEFUN (show_ip_bgp_flap_filter_list
,
6716 show_ip_bgp_flap_filter_list_cmd
,
6717 "show ip bgp flap-statistics filter-list WORD",
6721 "Display flap statistics of routes\n"
6722 "Display routes conforming to the filter-list\n"
6723 "Regular expression access list name\n")
6725 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6726 bgp_show_type_flap_filter_list
);
6729 DEFUN (show_ip_bgp_ipv4_filter_list
,
6730 show_ip_bgp_ipv4_filter_list_cmd
,
6731 "show ip bgp ipv4 (unicast|multicast) filter-list WORD",
6736 "Address Family modifier\n"
6737 "Address Family modifier\n"
6738 "Display routes conforming to the filter-list\n"
6739 "Regular expression access list name\n")
6741 if (strncmp (argv
[0], "m", 1) == 0)
6742 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
6743 bgp_show_type_filter_list
);
6745 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
6746 bgp_show_type_filter_list
);
6750 DEFUN (show_bgp_filter_list
,
6751 show_bgp_filter_list_cmd
,
6752 "show bgp filter-list WORD",
6755 "Display routes conforming to the filter-list\n"
6756 "Regular expression access list name\n")
6758 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6759 bgp_show_type_filter_list
);
6762 ALIAS (show_bgp_filter_list
,
6763 show_bgp_ipv6_filter_list_cmd
,
6764 "show bgp ipv6 filter-list WORD",
6768 "Display routes conforming to the filter-list\n"
6769 "Regular expression access list name\n")
6772 DEFUN (show_ipv6_bgp_filter_list
,
6773 show_ipv6_bgp_filter_list_cmd
,
6774 "show ipv6 bgp filter-list WORD",
6778 "Display routes conforming to the filter-list\n"
6779 "Regular expression access list name\n")
6781 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6782 bgp_show_type_filter_list
);
6786 DEFUN (show_ipv6_mbgp_filter_list
,
6787 show_ipv6_mbgp_filter_list_cmd
,
6788 "show ipv6 mbgp filter-list WORD",
6792 "Display routes conforming to the filter-list\n"
6793 "Regular expression access list name\n")
6795 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
6796 bgp_show_type_filter_list
);
6798 #endif /* HAVE_IPV6 */
6801 bgp_show_route_map (struct vty
*vty
, const char *rmap_str
, afi_t afi
,
6802 safi_t safi
, enum bgp_show_type type
)
6804 struct route_map
*rmap
;
6806 rmap
= route_map_lookup_by_name (rmap_str
);
6809 vty_out (vty
, "%% %s is not a valid route-map name%s",
6810 rmap_str
, VTY_NEWLINE
);
6814 return bgp_show (vty
, NULL
, afi
, safi
, type
, rmap
);
6817 DEFUN (show_ip_bgp_route_map
,
6818 show_ip_bgp_route_map_cmd
,
6819 "show ip bgp route-map WORD",
6823 "Display routes matching the route-map\n"
6824 "A route-map to match on\n")
6826 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6827 bgp_show_type_route_map
);
6830 DEFUN (show_ip_bgp_flap_route_map
,
6831 show_ip_bgp_flap_route_map_cmd
,
6832 "show ip bgp flap-statistics route-map WORD",
6836 "Display flap statistics of routes\n"
6837 "Display routes matching the route-map\n"
6838 "A route-map to match on\n")
6840 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6841 bgp_show_type_flap_route_map
);
6844 DEFUN (show_ip_bgp_ipv4_route_map
,
6845 show_ip_bgp_ipv4_route_map_cmd
,
6846 "show ip bgp ipv4 (unicast|multicast) route-map WORD",
6851 "Address Family modifier\n"
6852 "Address Family modifier\n"
6853 "Display routes matching the route-map\n"
6854 "A route-map to match on\n")
6856 if (strncmp (argv
[0], "m", 1) == 0)
6857 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
6858 bgp_show_type_route_map
);
6860 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
6861 bgp_show_type_route_map
);
6864 DEFUN (show_bgp_route_map
,
6865 show_bgp_route_map_cmd
,
6866 "show bgp route-map WORD",
6869 "Display routes matching the route-map\n"
6870 "A route-map to match on\n")
6872 return bgp_show_route_map (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6873 bgp_show_type_route_map
);
6876 ALIAS (show_bgp_route_map
,
6877 show_bgp_ipv6_route_map_cmd
,
6878 "show bgp ipv6 route-map WORD",
6882 "Display routes matching the route-map\n"
6883 "A route-map to match on\n")
6885 DEFUN (show_ip_bgp_cidr_only
,
6886 show_ip_bgp_cidr_only_cmd
,
6887 "show ip bgp cidr-only",
6891 "Display only routes with non-natural netmasks\n")
6893 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6894 bgp_show_type_cidr_only
, NULL
);
6897 DEFUN (show_ip_bgp_flap_cidr_only
,
6898 show_ip_bgp_flap_cidr_only_cmd
,
6899 "show ip bgp flap-statistics cidr-only",
6903 "Display flap statistics of routes\n"
6904 "Display only routes with non-natural netmasks\n")
6906 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6907 bgp_show_type_flap_cidr_only
, NULL
);
6910 DEFUN (show_ip_bgp_ipv4_cidr_only
,
6911 show_ip_bgp_ipv4_cidr_only_cmd
,
6912 "show ip bgp ipv4 (unicast|multicast) cidr-only",
6917 "Address Family modifier\n"
6918 "Address Family modifier\n"
6919 "Display only routes with non-natural netmasks\n")
6921 if (strncmp (argv
[0], "m", 1) == 0)
6922 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
6923 bgp_show_type_cidr_only
, NULL
);
6925 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6926 bgp_show_type_cidr_only
, NULL
);
6929 DEFUN (show_ip_bgp_community_all
,
6930 show_ip_bgp_community_all_cmd
,
6931 "show ip bgp community",
6935 "Display routes matching the communities\n")
6937 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6938 bgp_show_type_community_all
, NULL
);
6941 DEFUN (show_ip_bgp_ipv4_community_all
,
6942 show_ip_bgp_ipv4_community_all_cmd
,
6943 "show ip bgp ipv4 (unicast|multicast) community",
6948 "Address Family modifier\n"
6949 "Address Family modifier\n"
6950 "Display routes matching the communities\n")
6952 if (strncmp (argv
[0], "m", 1) == 0)
6953 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
6954 bgp_show_type_community_all
, NULL
);
6956 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6957 bgp_show_type_community_all
, NULL
);
6961 DEFUN (show_bgp_community_all
,
6962 show_bgp_community_all_cmd
,
6963 "show bgp community",
6966 "Display routes matching the communities\n")
6968 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
6969 bgp_show_type_community_all
, NULL
);
6972 ALIAS (show_bgp_community_all
,
6973 show_bgp_ipv6_community_all_cmd
,
6974 "show bgp ipv6 community",
6978 "Display routes matching the communities\n")
6981 DEFUN (show_ipv6_bgp_community_all
,
6982 show_ipv6_bgp_community_all_cmd
,
6983 "show ipv6 bgp community",
6987 "Display routes matching the communities\n")
6989 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
6990 bgp_show_type_community_all
, NULL
);
6994 DEFUN (show_ipv6_mbgp_community_all
,
6995 show_ipv6_mbgp_community_all_cmd
,
6996 "show ipv6 mbgp community",
7000 "Display routes matching the communities\n")
7002 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
,
7003 bgp_show_type_community_all
, NULL
);
7005 #endif /* HAVE_IPV6 */
7008 bgp_show_community (struct vty
*vty
, int argc
, const char **argv
, int exact
,
7009 u_int16_t afi
, u_char safi
)
7011 struct community
*com
;
7017 b
= buffer_new (1024);
7018 for (i
= 0; i
< argc
; i
++)
7021 buffer_putc (b
, ' ');
7024 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
7029 buffer_putstr (b
, argv
[i
]);
7031 buffer_putc (b
, '\0');
7033 str
= buffer_getstr (b
);
7036 com
= community_str2com (str
);
7037 XFREE (MTYPE_TMP
, str
);
7040 vty_out (vty
, "%% Community malformed: %s", VTY_NEWLINE
);
7044 return bgp_show (vty
, NULL
, afi
, safi
,
7045 (exact
? bgp_show_type_community_exact
:
7046 bgp_show_type_community
), com
);
7049 DEFUN (show_ip_bgp_community
,
7050 show_ip_bgp_community_cmd
,
7051 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export)",
7055 "Display routes matching the communities\n"
7056 "community number\n"
7057 "Do not send outside local AS (well-known community)\n"
7058 "Do not advertise to any peer (well-known community)\n"
7059 "Do not export to next AS (well-known community)\n")
7061 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
7064 ALIAS (show_ip_bgp_community
,
7065 show_ip_bgp_community2_cmd
,
7066 "show ip bgp community (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")
7080 ALIAS (show_ip_bgp_community
,
7081 show_ip_bgp_community3_cmd
,
7082 "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)",
7086 "Display routes matching the communities\n"
7087 "community number\n"
7088 "Do not send outside local AS (well-known community)\n"
7089 "Do not advertise to any peer (well-known community)\n"
7090 "Do not export to next AS (well-known community)\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")
7100 ALIAS (show_ip_bgp_community
,
7101 show_ip_bgp_community4_cmd
,
7102 "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)",
7106 "Display routes matching the communities\n"
7107 "community number\n"
7108 "Do not send outside local AS (well-known community)\n"
7109 "Do not advertise to any peer (well-known community)\n"
7110 "Do not export to next AS (well-known community)\n"
7111 "community number\n"
7112 "Do not send outside local AS (well-known community)\n"
7113 "Do not advertise to any peer (well-known community)\n"
7114 "Do not export to next AS (well-known community)\n"
7115 "community number\n"
7116 "Do not send outside local AS (well-known community)\n"
7117 "Do not advertise to any peer (well-known community)\n"
7118 "Do not export to next AS (well-known community)\n"
7119 "community number\n"
7120 "Do not send outside local AS (well-known community)\n"
7121 "Do not advertise to any peer (well-known community)\n"
7122 "Do not export to next AS (well-known community)\n")
7124 DEFUN (show_ip_bgp_ipv4_community
,
7125 show_ip_bgp_ipv4_community_cmd
,
7126 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
7131 "Address Family modifier\n"
7132 "Address Family modifier\n"
7133 "Display routes matching the communities\n"
7134 "community number\n"
7135 "Do not send outside local AS (well-known community)\n"
7136 "Do not advertise to any peer (well-known community)\n"
7137 "Do not export to next AS (well-known community)\n")
7139 if (strncmp (argv
[0], "m", 1) == 0)
7140 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_MULTICAST
);
7142 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
7145 ALIAS (show_ip_bgp_ipv4_community
,
7146 show_ip_bgp_ipv4_community2_cmd
,
7147 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7152 "Address Family modifier\n"
7153 "Address Family modifier\n"
7154 "Display routes matching the communities\n"
7155 "community number\n"
7156 "Do not send outside local AS (well-known community)\n"
7157 "Do not advertise to any peer (well-known community)\n"
7158 "Do not export to next AS (well-known community)\n"
7159 "community number\n"
7160 "Do not send outside local AS (well-known community)\n"
7161 "Do not advertise to any peer (well-known community)\n"
7162 "Do not export to next AS (well-known community)\n")
7164 ALIAS (show_ip_bgp_ipv4_community
,
7165 show_ip_bgp_ipv4_community3_cmd
,
7166 "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)",
7171 "Address Family modifier\n"
7172 "Address Family modifier\n"
7173 "Display routes matching the communities\n"
7174 "community number\n"
7175 "Do not send outside local AS (well-known community)\n"
7176 "Do not advertise to any peer (well-known community)\n"
7177 "Do not export to next AS (well-known community)\n"
7178 "community number\n"
7179 "Do not send outside local AS (well-known community)\n"
7180 "Do not advertise to any peer (well-known community)\n"
7181 "Do not export to next AS (well-known community)\n"
7182 "community number\n"
7183 "Do not send outside local AS (well-known community)\n"
7184 "Do not advertise to any peer (well-known community)\n"
7185 "Do not export to next AS (well-known community)\n")
7187 ALIAS (show_ip_bgp_ipv4_community
,
7188 show_ip_bgp_ipv4_community4_cmd
,
7189 "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)",
7194 "Address Family modifier\n"
7195 "Address Family modifier\n"
7196 "Display routes matching the communities\n"
7197 "community number\n"
7198 "Do not send outside local AS (well-known community)\n"
7199 "Do not advertise to any peer (well-known community)\n"
7200 "Do not export to next AS (well-known community)\n"
7201 "community number\n"
7202 "Do not send outside local AS (well-known community)\n"
7203 "Do not advertise to any peer (well-known community)\n"
7204 "Do not export to next AS (well-known community)\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 "community number\n"
7210 "Do not send outside local AS (well-known community)\n"
7211 "Do not advertise to any peer (well-known community)\n"
7212 "Do not export to next AS (well-known community)\n")
7214 DEFUN (show_ip_bgp_community_exact
,
7215 show_ip_bgp_community_exact_cmd
,
7216 "show ip bgp community (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 "Exact match of the communities")
7227 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
7230 ALIAS (show_ip_bgp_community_exact
,
7231 show_ip_bgp_community2_exact_cmd
,
7232 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7236 "Display routes matching the communities\n"
7237 "community number\n"
7238 "Do not send outside local AS (well-known community)\n"
7239 "Do not advertise to any peer (well-known community)\n"
7240 "Do not export to next AS (well-known community)\n"
7241 "community number\n"
7242 "Do not send outside local AS (well-known community)\n"
7243 "Do not advertise to any peer (well-known community)\n"
7244 "Do not export to next AS (well-known community)\n"
7245 "Exact match of the communities")
7247 ALIAS (show_ip_bgp_community_exact
,
7248 show_ip_bgp_community3_exact_cmd
,
7249 "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",
7253 "Display routes matching the communities\n"
7254 "community number\n"
7255 "Do not send outside local AS (well-known community)\n"
7256 "Do not advertise to any peer (well-known community)\n"
7257 "Do not export to next AS (well-known community)\n"
7258 "community number\n"
7259 "Do not send outside local AS (well-known community)\n"
7260 "Do not advertise to any peer (well-known community)\n"
7261 "Do not export to next AS (well-known community)\n"
7262 "community number\n"
7263 "Do not send outside local AS (well-known community)\n"
7264 "Do not advertise to any peer (well-known community)\n"
7265 "Do not export to next AS (well-known community)\n"
7266 "Exact match of the communities")
7268 ALIAS (show_ip_bgp_community_exact
,
7269 show_ip_bgp_community4_exact_cmd
,
7270 "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",
7274 "Display routes matching the communities\n"
7275 "community number\n"
7276 "Do not send outside local AS (well-known community)\n"
7277 "Do not advertise to any peer (well-known community)\n"
7278 "Do not export to next AS (well-known community)\n"
7279 "community number\n"
7280 "Do not send outside local AS (well-known community)\n"
7281 "Do not advertise to any peer (well-known community)\n"
7282 "Do not export to next AS (well-known community)\n"
7283 "community number\n"
7284 "Do not send outside local AS (well-known community)\n"
7285 "Do not advertise to any peer (well-known community)\n"
7286 "Do not export to next AS (well-known community)\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 DEFUN (show_ip_bgp_ipv4_community_exact
,
7294 show_ip_bgp_ipv4_community_exact_cmd
,
7295 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7300 "Address Family modifier\n"
7301 "Address Family modifier\n"
7302 "Display routes matching the communities\n"
7303 "community number\n"
7304 "Do not send outside local AS (well-known community)\n"
7305 "Do not advertise to any peer (well-known community)\n"
7306 "Do not export to next AS (well-known community)\n"
7307 "Exact match of the communities")
7309 if (strncmp (argv
[0], "m", 1) == 0)
7310 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_MULTICAST
);
7312 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
7315 ALIAS (show_ip_bgp_ipv4_community_exact
,
7316 show_ip_bgp_ipv4_community2_exact_cmd
,
7317 "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",
7322 "Address Family modifier\n"
7323 "Address Family modifier\n"
7324 "Display routes matching the communities\n"
7325 "community number\n"
7326 "Do not send outside local AS (well-known community)\n"
7327 "Do not advertise to any peer (well-known community)\n"
7328 "Do not export to next AS (well-known community)\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 "Exact match of the communities")
7335 ALIAS (show_ip_bgp_ipv4_community_exact
,
7336 show_ip_bgp_ipv4_community3_exact_cmd
,
7337 "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",
7342 "Address Family modifier\n"
7343 "Address Family modifier\n"
7344 "Display routes matching the communities\n"
7345 "community number\n"
7346 "Do not send outside local AS (well-known community)\n"
7347 "Do not advertise to any peer (well-known community)\n"
7348 "Do not export to next AS (well-known community)\n"
7349 "community number\n"
7350 "Do not send outside local AS (well-known community)\n"
7351 "Do not advertise to any peer (well-known community)\n"
7352 "Do not export to next AS (well-known community)\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 "Exact match of the communities")
7359 ALIAS (show_ip_bgp_ipv4_community_exact
,
7360 show_ip_bgp_ipv4_community4_exact_cmd
,
7361 "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",
7366 "Address Family modifier\n"
7367 "Address Family modifier\n"
7368 "Display routes matching the communities\n"
7369 "community number\n"
7370 "Do not send outside local AS (well-known community)\n"
7371 "Do not advertise to any peer (well-known community)\n"
7372 "Do not export to next AS (well-known community)\n"
7373 "community number\n"
7374 "Do not send outside local AS (well-known community)\n"
7375 "Do not advertise to any peer (well-known community)\n"
7376 "Do not export to next AS (well-known community)\n"
7377 "community number\n"
7378 "Do not send outside local AS (well-known community)\n"
7379 "Do not advertise to any peer (well-known community)\n"
7380 "Do not export to next AS (well-known community)\n"
7381 "community number\n"
7382 "Do not send outside local AS (well-known community)\n"
7383 "Do not advertise to any peer (well-known community)\n"
7384 "Do not export to next AS (well-known community)\n"
7385 "Exact match of the communities")
7388 DEFUN (show_bgp_community
,
7389 show_bgp_community_cmd
,
7390 "show bgp community (AA:NN|local-AS|no-advertise|no-export)",
7393 "Display routes matching the communities\n"
7394 "community number\n"
7395 "Do not send outside local AS (well-known community)\n"
7396 "Do not advertise to any peer (well-known community)\n"
7397 "Do not export to next AS (well-known community)\n")
7399 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
7402 ALIAS (show_bgp_community
,
7403 show_bgp_ipv6_community_cmd
,
7404 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)",
7408 "Display routes matching the communities\n"
7409 "community number\n"
7410 "Do not send outside local AS (well-known community)\n"
7411 "Do not advertise to any peer (well-known community)\n"
7412 "Do not export to next AS (well-known community)\n")
7414 ALIAS (show_bgp_community
,
7415 show_bgp_community2_cmd
,
7416 "show bgp 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_ipv6_community2_cmd
,
7431 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7435 "Display routes matching the communities\n"
7436 "community number\n"
7437 "Do not send outside local AS (well-known community)\n"
7438 "Do not advertise to any peer (well-known community)\n"
7439 "Do not export to next AS (well-known community)\n"
7440 "community number\n"
7441 "Do not send outside local AS (well-known community)\n"
7442 "Do not advertise to any peer (well-known community)\n"
7443 "Do not export to next AS (well-known community)\n")
7445 ALIAS (show_bgp_community
,
7446 show_bgp_community3_cmd
,
7447 "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)",
7450 "Display routes matching the communities\n"
7451 "community number\n"
7452 "Do not send outside local AS (well-known community)\n"
7453 "Do not advertise to any peer (well-known community)\n"
7454 "Do not export to next AS (well-known community)\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")
7464 ALIAS (show_bgp_community
,
7465 show_bgp_ipv6_community3_cmd
,
7466 "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)",
7470 "Display routes matching the communities\n"
7471 "community number\n"
7472 "Do not send outside local AS (well-known community)\n"
7473 "Do not advertise to any peer (well-known community)\n"
7474 "Do not export to next AS (well-known community)\n"
7475 "community number\n"
7476 "Do not send outside local AS (well-known community)\n"
7477 "Do not advertise to any peer (well-known community)\n"
7478 "Do not export to next AS (well-known community)\n"
7479 "community number\n"
7480 "Do not send outside local AS (well-known community)\n"
7481 "Do not advertise to any peer (well-known community)\n"
7482 "Do not export to next AS (well-known community)\n")
7484 ALIAS (show_bgp_community
,
7485 show_bgp_community4_cmd
,
7486 "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)",
7489 "Display routes matching the communities\n"
7490 "community number\n"
7491 "Do not send outside local AS (well-known community)\n"
7492 "Do not advertise to any peer (well-known community)\n"
7493 "Do not export to next AS (well-known community)\n"
7494 "community number\n"
7495 "Do not send outside local AS (well-known community)\n"
7496 "Do not advertise to any peer (well-known community)\n"
7497 "Do not export to next AS (well-known community)\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")
7507 ALIAS (show_bgp_community
,
7508 show_bgp_ipv6_community4_cmd
,
7509 "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)",
7513 "Display routes matching the communities\n"
7514 "community number\n"
7515 "Do not send outside local AS (well-known community)\n"
7516 "Do not advertise to any peer (well-known community)\n"
7517 "Do not export to next AS (well-known community)\n"
7518 "community number\n"
7519 "Do not send outside local AS (well-known community)\n"
7520 "Do not advertise to any peer (well-known community)\n"
7521 "Do not export to next AS (well-known community)\n"
7522 "community number\n"
7523 "Do not send outside local AS (well-known community)\n"
7524 "Do not advertise to any peer (well-known community)\n"
7525 "Do not export to next AS (well-known community)\n"
7526 "community number\n"
7527 "Do not send outside local AS (well-known community)\n"
7528 "Do not advertise to any peer (well-known community)\n"
7529 "Do not export to next AS (well-known community)\n")
7532 DEFUN (show_ipv6_bgp_community
,
7533 show_ipv6_bgp_community_cmd
,
7534 "show ipv6 bgp community (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")
7544 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
7548 ALIAS (show_ipv6_bgp_community
,
7549 show_ipv6_bgp_community2_cmd
,
7550 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7554 "Display routes matching the communities\n"
7555 "community number\n"
7556 "Do not send outside local AS (well-known community)\n"
7557 "Do not advertise to any peer (well-known community)\n"
7558 "Do not export to next AS (well-known community)\n"
7559 "community number\n"
7560 "Do not send outside local AS (well-known community)\n"
7561 "Do not advertise to any peer (well-known community)\n"
7562 "Do not export to next AS (well-known community)\n")
7565 ALIAS (show_ipv6_bgp_community
,
7566 show_ipv6_bgp_community3_cmd
,
7567 "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)",
7571 "Display routes matching the communities\n"
7572 "community number\n"
7573 "Do not send outside local AS (well-known community)\n"
7574 "Do not advertise to any peer (well-known community)\n"
7575 "Do not export to next AS (well-known community)\n"
7576 "community number\n"
7577 "Do not send outside local AS (well-known community)\n"
7578 "Do not advertise to any peer (well-known community)\n"
7579 "Do not export to next AS (well-known community)\n"
7580 "community number\n"
7581 "Do not send outside local AS (well-known community)\n"
7582 "Do not advertise to any peer (well-known community)\n"
7583 "Do not export to next AS (well-known community)\n")
7586 ALIAS (show_ipv6_bgp_community
,
7587 show_ipv6_bgp_community4_cmd
,
7588 "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)",
7592 "Display routes matching the communities\n"
7593 "community number\n"
7594 "Do not send outside local AS (well-known community)\n"
7595 "Do not advertise to any peer (well-known community)\n"
7596 "Do not export to next AS (well-known community)\n"
7597 "community number\n"
7598 "Do not send outside local AS (well-known community)\n"
7599 "Do not advertise to any peer (well-known community)\n"
7600 "Do not export to next AS (well-known community)\n"
7601 "community number\n"
7602 "Do not send outside local AS (well-known community)\n"
7603 "Do not advertise to any peer (well-known community)\n"
7604 "Do not export to next AS (well-known community)\n"
7605 "community number\n"
7606 "Do not send outside local AS (well-known community)\n"
7607 "Do not advertise to any peer (well-known community)\n"
7608 "Do not export to next AS (well-known community)\n")
7610 DEFUN (show_bgp_community_exact
,
7611 show_bgp_community_exact_cmd
,
7612 "show bgp 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 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
7625 ALIAS (show_bgp_community_exact
,
7626 show_bgp_ipv6_community_exact_cmd
,
7627 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7631 "Display routes matching the communities\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_community2_exact_cmd
,
7640 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7643 "Display routes matching the communities\n"
7644 "community number\n"
7645 "Do not send outside local AS (well-known community)\n"
7646 "Do not advertise to any peer (well-known community)\n"
7647 "Do not export to next AS (well-known community)\n"
7648 "community number\n"
7649 "Do not send outside local AS (well-known community)\n"
7650 "Do not advertise to any peer (well-known community)\n"
7651 "Do not export to next AS (well-known community)\n"
7652 "Exact match of the communities")
7654 ALIAS (show_bgp_community_exact
,
7655 show_bgp_ipv6_community2_exact_cmd
,
7656 "show bgp ipv6 community (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 "Exact match of the communities")
7671 ALIAS (show_bgp_community_exact
,
7672 show_bgp_community3_exact_cmd
,
7673 "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",
7676 "Display routes matching the communities\n"
7677 "community number\n"
7678 "Do not send outside local AS (well-known community)\n"
7679 "Do not advertise to any peer (well-known community)\n"
7680 "Do not export to next AS (well-known community)\n"
7681 "community number\n"
7682 "Do not send outside local AS (well-known community)\n"
7683 "Do not advertise to any peer (well-known community)\n"
7684 "Do not export to next AS (well-known community)\n"
7685 "community number\n"
7686 "Do not send outside local AS (well-known community)\n"
7687 "Do not advertise to any peer (well-known community)\n"
7688 "Do not export to next AS (well-known community)\n"
7689 "Exact match of the communities")
7691 ALIAS (show_bgp_community_exact
,
7692 show_bgp_ipv6_community3_exact_cmd
,
7693 "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",
7697 "Display routes matching the communities\n"
7698 "community number\n"
7699 "Do not send outside local AS (well-known community)\n"
7700 "Do not advertise to any peer (well-known community)\n"
7701 "Do not export to next AS (well-known community)\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 "Exact match of the communities")
7712 ALIAS (show_bgp_community_exact
,
7713 show_bgp_community4_exact_cmd
,
7714 "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",
7717 "Display routes matching the communities\n"
7718 "community number\n"
7719 "Do not send outside local AS (well-known community)\n"
7720 "Do not advertise to any peer (well-known community)\n"
7721 "Do not export to next AS (well-known community)\n"
7722 "community number\n"
7723 "Do not send outside local AS (well-known community)\n"
7724 "Do not advertise to any peer (well-known community)\n"
7725 "Do not export to next AS (well-known community)\n"
7726 "community number\n"
7727 "Do not send outside local AS (well-known community)\n"
7728 "Do not advertise to any peer (well-known community)\n"
7729 "Do not export to next AS (well-known community)\n"
7730 "community number\n"
7731 "Do not send outside local AS (well-known community)\n"
7732 "Do not advertise to any peer (well-known community)\n"
7733 "Do not export to next AS (well-known community)\n"
7734 "Exact match of the communities")
7736 ALIAS (show_bgp_community_exact
,
7737 show_bgp_ipv6_community4_exact_cmd
,
7738 "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",
7742 "Display routes matching the communities\n"
7743 "community number\n"
7744 "Do not send outside local AS (well-known community)\n"
7745 "Do not advertise to any peer (well-known community)\n"
7746 "Do not export to next AS (well-known community)\n"
7747 "community number\n"
7748 "Do not send outside local AS (well-known community)\n"
7749 "Do not advertise to any peer (well-known community)\n"
7750 "Do not export to next AS (well-known community)\n"
7751 "community number\n"
7752 "Do not send outside local AS (well-known community)\n"
7753 "Do not advertise to any peer (well-known community)\n"
7754 "Do not export to next AS (well-known community)\n"
7755 "community number\n"
7756 "Do not send outside local AS (well-known community)\n"
7757 "Do not advertise to any peer (well-known community)\n"
7758 "Do not export to next AS (well-known community)\n"
7759 "Exact match of the communities")
7762 DEFUN (show_ipv6_bgp_community_exact
,
7763 show_ipv6_bgp_community_exact_cmd
,
7764 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7768 "Display routes matching the communities\n"
7769 "community number\n"
7770 "Do not send outside local AS (well-known community)\n"
7771 "Do not advertise to any peer (well-known community)\n"
7772 "Do not export to next AS (well-known community)\n"
7773 "Exact match of the communities")
7775 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
7779 ALIAS (show_ipv6_bgp_community_exact
,
7780 show_ipv6_bgp_community2_exact_cmd
,
7781 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7785 "Display routes matching the communities\n"
7786 "community number\n"
7787 "Do not send outside local AS (well-known community)\n"
7788 "Do not advertise to any peer (well-known community)\n"
7789 "Do not export to next AS (well-known community)\n"
7790 "community number\n"
7791 "Do not send outside local AS (well-known community)\n"
7792 "Do not advertise to any peer (well-known community)\n"
7793 "Do not export to next AS (well-known community)\n"
7794 "Exact match of the communities")
7797 ALIAS (show_ipv6_bgp_community_exact
,
7798 show_ipv6_bgp_community3_exact_cmd
,
7799 "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",
7803 "Display routes matching the communities\n"
7804 "community number\n"
7805 "Do not send outside local AS (well-known community)\n"
7806 "Do not advertise to any peer (well-known community)\n"
7807 "Do not export to next AS (well-known community)\n"
7808 "community number\n"
7809 "Do not send outside local AS (well-known community)\n"
7810 "Do not advertise to any peer (well-known community)\n"
7811 "Do not export to next AS (well-known community)\n"
7812 "community number\n"
7813 "Do not send outside local AS (well-known community)\n"
7814 "Do not advertise to any peer (well-known community)\n"
7815 "Do not export to next AS (well-known community)\n"
7816 "Exact match of the communities")
7819 ALIAS (show_ipv6_bgp_community_exact
,
7820 show_ipv6_bgp_community4_exact_cmd
,
7821 "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",
7825 "Display routes matching the communities\n"
7826 "community number\n"
7827 "Do not send outside local AS (well-known community)\n"
7828 "Do not advertise to any peer (well-known community)\n"
7829 "Do not export to next AS (well-known community)\n"
7830 "community number\n"
7831 "Do not send outside local AS (well-known community)\n"
7832 "Do not advertise to any peer (well-known community)\n"
7833 "Do not export to next AS (well-known community)\n"
7834 "community number\n"
7835 "Do not send outside local AS (well-known community)\n"
7836 "Do not advertise to any peer (well-known community)\n"
7837 "Do not export to next AS (well-known community)\n"
7838 "community number\n"
7839 "Do not send outside local AS (well-known community)\n"
7840 "Do not advertise to any peer (well-known community)\n"
7841 "Do not export to next AS (well-known community)\n"
7842 "Exact match of the communities")
7845 DEFUN (show_ipv6_mbgp_community
,
7846 show_ipv6_mbgp_community_cmd
,
7847 "show ipv6 mbgp community (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")
7857 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_MULTICAST
);
7861 ALIAS (show_ipv6_mbgp_community
,
7862 show_ipv6_mbgp_community2_cmd
,
7863 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7867 "Display routes matching the communities\n"
7868 "community number\n"
7869 "Do not send outside local AS (well-known community)\n"
7870 "Do not advertise to any peer (well-known community)\n"
7871 "Do not export to next AS (well-known community)\n"
7872 "community number\n"
7873 "Do not send outside local AS (well-known community)\n"
7874 "Do not advertise to any peer (well-known community)\n"
7875 "Do not export to next AS (well-known community)\n")
7878 ALIAS (show_ipv6_mbgp_community
,
7879 show_ipv6_mbgp_community3_cmd
,
7880 "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)",
7884 "Display routes matching the communities\n"
7885 "community number\n"
7886 "Do not send outside local AS (well-known community)\n"
7887 "Do not advertise to any peer (well-known community)\n"
7888 "Do not export to next AS (well-known community)\n"
7889 "community number\n"
7890 "Do not send outside local AS (well-known community)\n"
7891 "Do not advertise to any peer (well-known community)\n"
7892 "Do not export to next AS (well-known community)\n"
7893 "community number\n"
7894 "Do not send outside local AS (well-known community)\n"
7895 "Do not advertise to any peer (well-known community)\n"
7896 "Do not export to next AS (well-known community)\n")
7899 ALIAS (show_ipv6_mbgp_community
,
7900 show_ipv6_mbgp_community4_cmd
,
7901 "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)",
7905 "Display routes matching the communities\n"
7906 "community number\n"
7907 "Do not send outside local AS (well-known community)\n"
7908 "Do not advertise to any peer (well-known community)\n"
7909 "Do not export to next AS (well-known community)\n"
7910 "community number\n"
7911 "Do not send outside local AS (well-known community)\n"
7912 "Do not advertise to any peer (well-known community)\n"
7913 "Do not export to next AS (well-known community)\n"
7914 "community number\n"
7915 "Do not send outside local AS (well-known community)\n"
7916 "Do not advertise to any peer (well-known community)\n"
7917 "Do not export to next AS (well-known community)\n"
7918 "community number\n"
7919 "Do not send outside local AS (well-known community)\n"
7920 "Do not advertise to any peer (well-known community)\n"
7921 "Do not export to next AS (well-known community)\n")
7924 DEFUN (show_ipv6_mbgp_community_exact
,
7925 show_ipv6_mbgp_community_exact_cmd
,
7926 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7930 "Display routes matching the communities\n"
7931 "community number\n"
7932 "Do not send outside local AS (well-known community)\n"
7933 "Do not advertise to any peer (well-known community)\n"
7934 "Do not export to next AS (well-known community)\n"
7935 "Exact match of the communities")
7937 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_MULTICAST
);
7941 ALIAS (show_ipv6_mbgp_community_exact
,
7942 show_ipv6_mbgp_community2_exact_cmd
,
7943 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7947 "Display routes matching the communities\n"
7948 "community number\n"
7949 "Do not send outside local AS (well-known community)\n"
7950 "Do not advertise to any peer (well-known community)\n"
7951 "Do not export to next AS (well-known community)\n"
7952 "community number\n"
7953 "Do not send outside local AS (well-known community)\n"
7954 "Do not advertise to any peer (well-known community)\n"
7955 "Do not export to next AS (well-known community)\n"
7956 "Exact match of the communities")
7959 ALIAS (show_ipv6_mbgp_community_exact
,
7960 show_ipv6_mbgp_community3_exact_cmd
,
7961 "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",
7965 "Display routes matching the communities\n"
7966 "community number\n"
7967 "Do not send outside local AS (well-known community)\n"
7968 "Do not advertise to any peer (well-known community)\n"
7969 "Do not export to next AS (well-known community)\n"
7970 "community number\n"
7971 "Do not send outside local AS (well-known community)\n"
7972 "Do not advertise to any peer (well-known community)\n"
7973 "Do not export to next AS (well-known community)\n"
7974 "community number\n"
7975 "Do not send outside local AS (well-known community)\n"
7976 "Do not advertise to any peer (well-known community)\n"
7977 "Do not export to next AS (well-known community)\n"
7978 "Exact match of the communities")
7981 ALIAS (show_ipv6_mbgp_community_exact
,
7982 show_ipv6_mbgp_community4_exact_cmd
,
7983 "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",
7987 "Display routes matching the communities\n"
7988 "community number\n"
7989 "Do not send outside local AS (well-known community)\n"
7990 "Do not advertise to any peer (well-known community)\n"
7991 "Do not export to next AS (well-known community)\n"
7992 "community number\n"
7993 "Do not send outside local AS (well-known community)\n"
7994 "Do not advertise to any peer (well-known community)\n"
7995 "Do not export to next AS (well-known community)\n"
7996 "community number\n"
7997 "Do not send outside local AS (well-known community)\n"
7998 "Do not advertise to any peer (well-known community)\n"
7999 "Do not export to next AS (well-known community)\n"
8000 "community number\n"
8001 "Do not send outside local AS (well-known community)\n"
8002 "Do not advertise to any peer (well-known community)\n"
8003 "Do not export to next AS (well-known community)\n"
8004 "Exact match of the communities")
8005 #endif /* HAVE_IPV6 */
8008 bgp_show_community_list (struct vty
*vty
, const char *com
, int exact
,
8009 u_int16_t afi
, u_char safi
)
8011 struct community_list
*list
;
8013 list
= community_list_lookup (bgp_clist
, com
, COMMUNITY_LIST_MASTER
);
8016 vty_out (vty
, "%% %s is not a valid community-list name%s", com
,
8021 return bgp_show (vty
, NULL
, afi
, safi
,
8022 (exact
? bgp_show_type_community_list_exact
:
8023 bgp_show_type_community_list
), list
);
8026 DEFUN (show_ip_bgp_community_list
,
8027 show_ip_bgp_community_list_cmd
,
8028 "show ip bgp community-list (<1-500>|WORD)",
8032 "Display routes matching the community-list\n"
8033 "community-list number\n"
8034 "community-list name\n")
8036 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP
, SAFI_UNICAST
);
8039 DEFUN (show_ip_bgp_ipv4_community_list
,
8040 show_ip_bgp_ipv4_community_list_cmd
,
8041 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)",
8046 "Address Family modifier\n"
8047 "Address Family modifier\n"
8048 "Display routes matching the community-list\n"
8049 "community-list number\n"
8050 "community-list name\n")
8052 if (strncmp (argv
[0], "m", 1) == 0)
8053 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_MULTICAST
);
8055 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_UNICAST
);
8058 DEFUN (show_ip_bgp_community_list_exact
,
8059 show_ip_bgp_community_list_exact_cmd
,
8060 "show ip bgp community-list (<1-500>|WORD) exact-match",
8064 "Display routes matching the community-list\n"
8065 "community-list number\n"
8066 "community-list name\n"
8067 "Exact match of the communities\n")
8069 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP
, SAFI_UNICAST
);
8072 DEFUN (show_ip_bgp_ipv4_community_list_exact
,
8073 show_ip_bgp_ipv4_community_list_exact_cmd
,
8074 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match",
8079 "Address Family modifier\n"
8080 "Address Family modifier\n"
8081 "Display routes matching the community-list\n"
8082 "community-list number\n"
8083 "community-list name\n"
8084 "Exact match of the communities\n")
8086 if (strncmp (argv
[0], "m", 1) == 0)
8087 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_MULTICAST
);
8089 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_UNICAST
);
8093 DEFUN (show_bgp_community_list
,
8094 show_bgp_community_list_cmd
,
8095 "show bgp community-list (<1-500>|WORD)",
8098 "Display routes matching the community-list\n"
8099 "community-list number\n"
8100 "community-list name\n")
8102 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
8105 ALIAS (show_bgp_community_list
,
8106 show_bgp_ipv6_community_list_cmd
,
8107 "show bgp ipv6 community-list (<1-500>|WORD)",
8111 "Display routes matching the community-list\n"
8112 "community-list number\n"
8113 "community-list name\n")
8116 DEFUN (show_ipv6_bgp_community_list
,
8117 show_ipv6_bgp_community_list_cmd
,
8118 "show ipv6 bgp community-list WORD",
8122 "Display routes matching the community-list\n"
8123 "community-list name\n")
8125 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
8129 DEFUN (show_ipv6_mbgp_community_list
,
8130 show_ipv6_mbgp_community_list_cmd
,
8131 "show ipv6 mbgp community-list WORD",
8135 "Display routes matching the community-list\n"
8136 "community-list name\n")
8138 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_MULTICAST
);
8141 DEFUN (show_bgp_community_list_exact
,
8142 show_bgp_community_list_exact_cmd
,
8143 "show bgp community-list (<1-500>|WORD) exact-match",
8146 "Display routes matching the community-list\n"
8147 "community-list number\n"
8148 "community-list name\n"
8149 "Exact match of the communities\n")
8151 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
8154 ALIAS (show_bgp_community_list_exact
,
8155 show_bgp_ipv6_community_list_exact_cmd
,
8156 "show bgp ipv6 community-list (<1-500>|WORD) exact-match",
8160 "Display routes matching the community-list\n"
8161 "community-list number\n"
8162 "community-list name\n"
8163 "Exact match of the communities\n")
8166 DEFUN (show_ipv6_bgp_community_list_exact
,
8167 show_ipv6_bgp_community_list_exact_cmd
,
8168 "show ipv6 bgp community-list WORD exact-match",
8172 "Display routes matching the community-list\n"
8173 "community-list name\n"
8174 "Exact match of the communities\n")
8176 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
8180 DEFUN (show_ipv6_mbgp_community_list_exact
,
8181 show_ipv6_mbgp_community_list_exact_cmd
,
8182 "show ipv6 mbgp community-list WORD exact-match",
8186 "Display routes matching the community-list\n"
8187 "community-list name\n"
8188 "Exact match of the communities\n")
8190 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_MULTICAST
);
8192 #endif /* HAVE_IPV6 */
8195 bgp_show_prefix_longer (struct vty
*vty
, const char *prefix
, afi_t afi
,
8196 safi_t safi
, enum bgp_show_type type
)
8203 ret
= str2prefix (prefix
, p
);
8206 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
8210 ret
= bgp_show (vty
, NULL
, afi
, safi
, type
, p
);
8215 DEFUN (show_ip_bgp_prefix_longer
,
8216 show_ip_bgp_prefix_longer_cmd
,
8217 "show ip bgp A.B.C.D/M longer-prefixes",
8221 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8222 "Display route and more specific routes\n")
8224 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8225 bgp_show_type_prefix_longer
);
8228 DEFUN (show_ip_bgp_flap_prefix_longer
,
8229 show_ip_bgp_flap_prefix_longer_cmd
,
8230 "show ip bgp flap-statistics A.B.C.D/M longer-prefixes",
8234 "Display flap statistics of routes\n"
8235 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8236 "Display route and more specific routes\n")
8238 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8239 bgp_show_type_flap_prefix_longer
);
8242 DEFUN (show_ip_bgp_ipv4_prefix_longer
,
8243 show_ip_bgp_ipv4_prefix_longer_cmd
,
8244 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes",
8249 "Address Family modifier\n"
8250 "Address Family modifier\n"
8251 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8252 "Display route and more specific routes\n")
8254 if (strncmp (argv
[0], "m", 1) == 0)
8255 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
8256 bgp_show_type_prefix_longer
);
8258 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
8259 bgp_show_type_prefix_longer
);
8262 DEFUN (show_ip_bgp_flap_address
,
8263 show_ip_bgp_flap_address_cmd
,
8264 "show ip bgp flap-statistics A.B.C.D",
8268 "Display flap statistics of routes\n"
8269 "Network in the BGP routing table to display\n")
8271 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8272 bgp_show_type_flap_address
);
8275 DEFUN (show_ip_bgp_flap_prefix
,
8276 show_ip_bgp_flap_prefix_cmd
,
8277 "show ip bgp flap-statistics A.B.C.D/M",
8281 "Display flap statistics of routes\n"
8282 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
8284 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8285 bgp_show_type_flap_prefix
);
8288 DEFUN (show_bgp_prefix_longer
,
8289 show_bgp_prefix_longer_cmd
,
8290 "show bgp X:X::X:X/M longer-prefixes",
8293 "IPv6 prefix <network>/<length>\n"
8294 "Display route and more specific routes\n")
8296 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8297 bgp_show_type_prefix_longer
);
8300 ALIAS (show_bgp_prefix_longer
,
8301 show_bgp_ipv6_prefix_longer_cmd
,
8302 "show bgp ipv6 X:X::X:X/M longer-prefixes",
8306 "IPv6 prefix <network>/<length>\n"
8307 "Display route and more specific routes\n")
8310 DEFUN (show_ipv6_bgp_prefix_longer
,
8311 show_ipv6_bgp_prefix_longer_cmd
,
8312 "show ipv6 bgp X:X::X:X/M longer-prefixes",
8316 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
8317 "Display route and more specific routes\n")
8319 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8320 bgp_show_type_prefix_longer
);
8324 DEFUN (show_ipv6_mbgp_prefix_longer
,
8325 show_ipv6_mbgp_prefix_longer_cmd
,
8326 "show ipv6 mbgp X:X::X:X/M longer-prefixes",
8330 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
8331 "Display route and more specific routes\n")
8333 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
8334 bgp_show_type_prefix_longer
);
8336 #endif /* HAVE_IPV6 */
8338 static struct peer
*
8339 peer_lookup_in_view (struct vty
*vty
, const char *view_name
,
8347 /* BGP structure lookup. */
8350 bgp
= bgp_lookup_by_name (view_name
);
8353 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
8359 bgp
= bgp_get_default ();
8362 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
8367 /* Get peer sockunion. */
8368 ret
= str2sockunion (ip_str
, &su
);
8371 vty_out (vty
, "Malformed address: %s%s", ip_str
, VTY_NEWLINE
);
8375 /* Peer structure lookup. */
8376 peer
= peer_lookup (bgp
, &su
);
8379 vty_out (vty
, "No such neighbor%s", VTY_NEWLINE
);
8387 show_adj_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
,
8390 struct bgp_table
*table
;
8391 struct bgp_adj_in
*ain
;
8392 struct bgp_adj_out
*adj
;
8393 unsigned long output_count
;
8394 struct bgp_node
*rn
;
8404 table
= bgp
->rib
[afi
][safi
];
8408 if (! in
&& CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
8409 PEER_STATUS_DEFAULT_ORIGINATE
))
8411 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
8412 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8413 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8415 vty_out (vty
, "Originating default network 0.0.0.0%s%s",
8416 VTY_NEWLINE
, VTY_NEWLINE
);
8420 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
8423 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
8424 if (ain
->peer
== peer
)
8428 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
8429 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8430 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8435 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
8440 route_vty_out_tmp (vty
, &rn
->p
, ain
->attr
, safi
);
8447 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
)
8448 if (adj
->peer
== peer
)
8452 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
8453 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8454 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8459 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
8464 route_vty_out_tmp (vty
, &rn
->p
, adj
->attr
, safi
);
8470 if (output_count
!= 0)
8471 vty_out (vty
, "%sTotal number of prefixes %ld%s",
8472 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
8476 peer_adj_routes (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
, int in
)
8478 if (! peer
|| ! peer
->afc
[afi
][safi
])
8480 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
8484 if (in
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
8486 vty_out (vty
, "%% Inbound soft reconfiguration not enabled%s",
8491 show_adj_route (vty
, peer
, afi
, safi
, in
);
8496 DEFUN (show_ip_bgp_neighbor_advertised_route
,
8497 show_ip_bgp_neighbor_advertised_route_cmd
,
8498 "show ip bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8502 "Detailed information on TCP and BGP neighbor connections\n"
8503 "Neighbor to display information about\n"
8504 "Neighbor to display information about\n"
8505 "Display the routes advertised to a BGP neighbor\n")
8509 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8513 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0);
8516 DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route
,
8517 show_ip_bgp_ipv4_neighbor_advertised_route_cmd
,
8518 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8523 "Address Family modifier\n"
8524 "Address Family modifier\n"
8525 "Detailed information on TCP and BGP neighbor connections\n"
8526 "Neighbor to display information about\n"
8527 "Neighbor to display information about\n"
8528 "Display the routes advertised to a BGP neighbor\n")
8532 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
8536 if (strncmp (argv
[0], "m", 1) == 0)
8537 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 0);
8539 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0);
8543 DEFUN (show_bgp_view_neighbor_advertised_route
,
8544 show_bgp_view_neighbor_advertised_route_cmd
,
8545 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8550 "Detailed information on TCP and BGP neighbor connections\n"
8551 "Neighbor to display information about\n"
8552 "Neighbor to display information about\n"
8553 "Display the routes advertised to a BGP neighbor\n")
8558 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
8560 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8565 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0);
8568 ALIAS (show_bgp_view_neighbor_advertised_route
,
8569 show_bgp_view_ipv6_neighbor_advertised_route_cmd
,
8570 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8576 "Detailed information on TCP and BGP neighbor connections\n"
8577 "Neighbor to display information about\n"
8578 "Neighbor to display information about\n"
8579 "Display the routes advertised to a BGP neighbor\n")
8581 DEFUN (show_bgp_view_neighbor_received_routes
,
8582 show_bgp_view_neighbor_received_routes_cmd
,
8583 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received-routes",
8588 "Detailed information on TCP and BGP neighbor connections\n"
8589 "Neighbor to display information about\n"
8590 "Neighbor to display information about\n"
8591 "Display the received routes from neighbor\n")
8596 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
8598 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8603 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 1);
8606 ALIAS (show_bgp_view_neighbor_received_routes
,
8607 show_bgp_view_ipv6_neighbor_received_routes_cmd
,
8608 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
8614 "Detailed information on TCP and BGP neighbor connections\n"
8615 "Neighbor to display information about\n"
8616 "Neighbor to display information about\n"
8617 "Display the received routes from neighbor\n")
8619 ALIAS (show_bgp_view_neighbor_advertised_route
,
8620 show_bgp_neighbor_advertised_route_cmd
,
8621 "show bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8624 "Detailed information on TCP and BGP neighbor connections\n"
8625 "Neighbor to display information about\n"
8626 "Neighbor to display information about\n"
8627 "Display the routes advertised to a BGP neighbor\n")
8629 ALIAS (show_bgp_view_neighbor_advertised_route
,
8630 show_bgp_ipv6_neighbor_advertised_route_cmd
,
8631 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8635 "Detailed information on TCP and BGP neighbor connections\n"
8636 "Neighbor to display information about\n"
8637 "Neighbor to display information about\n"
8638 "Display the routes advertised to a BGP neighbor\n")
8641 ALIAS (show_bgp_view_neighbor_advertised_route
,
8642 ipv6_bgp_neighbor_advertised_route_cmd
,
8643 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8647 "Detailed information on TCP and BGP neighbor connections\n"
8648 "Neighbor to display information about\n"
8649 "Neighbor to display information about\n"
8650 "Display the routes advertised to a BGP neighbor\n")
8653 DEFUN (ipv6_mbgp_neighbor_advertised_route
,
8654 ipv6_mbgp_neighbor_advertised_route_cmd
,
8655 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8659 "Detailed information on TCP and BGP neighbor connections\n"
8660 "Neighbor to display information about\n"
8661 "Neighbor to display information about\n"
8662 "Display the routes advertised to a BGP neighbor\n")
8666 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8670 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 0);
8672 #endif /* HAVE_IPV6 */
8674 DEFUN (show_ip_bgp_neighbor_received_routes
,
8675 show_ip_bgp_neighbor_received_routes_cmd
,
8676 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
8680 "Detailed information on TCP and BGP neighbor connections\n"
8681 "Neighbor to display information about\n"
8682 "Neighbor to display information about\n"
8683 "Display the received routes from neighbor\n")
8687 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8691 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1);
8694 DEFUN (show_ip_bgp_ipv4_neighbor_received_routes
,
8695 show_ip_bgp_ipv4_neighbor_received_routes_cmd
,
8696 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received-routes",
8701 "Address Family modifier\n"
8702 "Address Family modifier\n"
8703 "Detailed information on TCP and BGP neighbor connections\n"
8704 "Neighbor to display information about\n"
8705 "Neighbor to display information about\n"
8706 "Display the received routes from neighbor\n")
8710 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
8714 if (strncmp (argv
[0], "m", 1) == 0)
8715 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 1);
8717 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1);
8720 DEFUN (show_ip_bgp_neighbor_received_prefix_filter
,
8721 show_ip_bgp_neighbor_received_prefix_filter_cmd
,
8722 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8726 "Detailed information on TCP and BGP neighbor connections\n"
8727 "Neighbor to display information about\n"
8728 "Neighbor to display information about\n"
8729 "Display information received from a BGP neighbor\n"
8730 "Display the prefixlist filter\n")
8733 union sockunion
*su
;
8737 su
= sockunion_str2su (argv
[0]);
8741 peer
= peer_lookup (NULL
, su
);
8745 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
8746 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
8749 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
8750 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
8756 DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter
,
8757 show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
,
8758 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8763 "Address Family modifier\n"
8764 "Address Family modifier\n"
8765 "Detailed information on TCP and BGP neighbor connections\n"
8766 "Neighbor to display information about\n"
8767 "Neighbor to display information about\n"
8768 "Display information received from a BGP neighbor\n"
8769 "Display the prefixlist filter\n")
8772 union sockunion
*su
;
8776 su
= sockunion_str2su (argv
[1]);
8780 peer
= peer_lookup (NULL
, su
);
8784 if (strncmp (argv
[0], "m", 1) == 0)
8786 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_MULTICAST
);
8787 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
8790 vty_out (vty
, "Address family: IPv4 Multicast%s", VTY_NEWLINE
);
8791 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
8796 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
8797 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
8800 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
8801 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
8810 ALIAS (show_bgp_view_neighbor_received_routes
,
8811 show_bgp_neighbor_received_routes_cmd
,
8812 "show bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
8815 "Detailed information on TCP and BGP neighbor connections\n"
8816 "Neighbor to display information about\n"
8817 "Neighbor to display information about\n"
8818 "Display the received routes from neighbor\n")
8820 ALIAS (show_bgp_view_neighbor_received_routes
,
8821 show_bgp_ipv6_neighbor_received_routes_cmd
,
8822 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
8826 "Detailed information on TCP and BGP neighbor connections\n"
8827 "Neighbor to display information about\n"
8828 "Neighbor to display information about\n"
8829 "Display the received routes from neighbor\n")
8831 DEFUN (show_bgp_neighbor_received_prefix_filter
,
8832 show_bgp_neighbor_received_prefix_filter_cmd
,
8833 "show bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8836 "Detailed information on TCP and BGP neighbor connections\n"
8837 "Neighbor to display information about\n"
8838 "Neighbor to display information about\n"
8839 "Display information received from a BGP neighbor\n"
8840 "Display the prefixlist filter\n")
8843 union sockunion
*su
;
8847 su
= sockunion_str2su (argv
[0]);
8851 peer
= peer_lookup (NULL
, su
);
8855 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
8856 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
8859 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
8860 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
8866 ALIAS (show_bgp_neighbor_received_prefix_filter
,
8867 show_bgp_ipv6_neighbor_received_prefix_filter_cmd
,
8868 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8872 "Detailed information on TCP and BGP neighbor connections\n"
8873 "Neighbor to display information about\n"
8874 "Neighbor to display information about\n"
8875 "Display information received from a BGP neighbor\n"
8876 "Display the prefixlist filter\n")
8879 ALIAS (show_bgp_view_neighbor_received_routes
,
8880 ipv6_bgp_neighbor_received_routes_cmd
,
8881 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
8885 "Detailed information on TCP and BGP neighbor connections\n"
8886 "Neighbor to display information about\n"
8887 "Neighbor to display information about\n"
8888 "Display the received routes from neighbor\n")
8891 DEFUN (ipv6_mbgp_neighbor_received_routes
,
8892 ipv6_mbgp_neighbor_received_routes_cmd
,
8893 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) received-routes",
8897 "Detailed information on TCP and BGP neighbor connections\n"
8898 "Neighbor to display information about\n"
8899 "Neighbor to display information about\n"
8900 "Display the received routes from neighbor\n")
8904 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8908 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 1);
8911 DEFUN (show_bgp_view_neighbor_received_prefix_filter
,
8912 show_bgp_view_neighbor_received_prefix_filter_cmd
,
8913 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8918 "Detailed information on TCP and BGP neighbor connections\n"
8919 "Neighbor to display information about\n"
8920 "Neighbor to display information about\n"
8921 "Display information received from a BGP neighbor\n"
8922 "Display the prefixlist filter\n")
8925 union sockunion
*su
;
8930 /* BGP structure lookup. */
8931 bgp
= bgp_lookup_by_name (argv
[0]);
8934 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
8938 su
= sockunion_str2su (argv
[1]);
8942 peer
= peer_lookup (bgp
, su
);
8946 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
8947 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
8950 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
8951 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
8957 ALIAS (show_bgp_view_neighbor_received_prefix_filter
,
8958 show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
,
8959 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8965 "Detailed information on TCP and BGP neighbor connections\n"
8966 "Neighbor to display information about\n"
8967 "Neighbor to display information about\n"
8968 "Display information received from a BGP neighbor\n"
8969 "Display the prefixlist filter\n")
8970 #endif /* HAVE_IPV6 */
8973 bgp_show_neighbor_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
8974 safi_t safi
, enum bgp_show_type type
)
8976 if (! peer
|| ! peer
->afc
[afi
][safi
])
8978 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
8982 return bgp_show (vty
, peer
->bgp
, afi
, safi
, type
, &peer
->su
);
8985 DEFUN (show_ip_bgp_neighbor_routes
,
8986 show_ip_bgp_neighbor_routes_cmd
,
8987 "show ip bgp neighbors (A.B.C.D|X:X::X:X) routes",
8991 "Detailed information on TCP and BGP neighbor connections\n"
8992 "Neighbor to display information about\n"
8993 "Neighbor to display information about\n"
8994 "Display routes learned from neighbor\n")
8998 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9002 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
9003 bgp_show_type_neighbor
);
9006 DEFUN (show_ip_bgp_neighbor_flap
,
9007 show_ip_bgp_neighbor_flap_cmd
,
9008 "show ip bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9012 "Detailed information on TCP and BGP neighbor connections\n"
9013 "Neighbor to display information about\n"
9014 "Neighbor to display information about\n"
9015 "Display flap statistics of the routes learned from neighbor\n")
9019 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9023 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
9024 bgp_show_type_flap_neighbor
);
9027 DEFUN (show_ip_bgp_neighbor_damp
,
9028 show_ip_bgp_neighbor_damp_cmd
,
9029 "show ip bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9033 "Detailed information on TCP and BGP neighbor connections\n"
9034 "Neighbor to display information about\n"
9035 "Neighbor to display information about\n"
9036 "Display the dampened routes received from neighbor\n")
9040 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9044 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
9045 bgp_show_type_damp_neighbor
);
9048 DEFUN (show_ip_bgp_ipv4_neighbor_routes
,
9049 show_ip_bgp_ipv4_neighbor_routes_cmd
,
9050 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) routes",
9055 "Address Family modifier\n"
9056 "Address Family modifier\n"
9057 "Detailed information on TCP and BGP neighbor connections\n"
9058 "Neighbor to display information about\n"
9059 "Neighbor to display information about\n"
9060 "Display routes learned from neighbor\n")
9064 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
9068 if (strncmp (argv
[0], "m", 1) == 0)
9069 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_MULTICAST
,
9070 bgp_show_type_neighbor
);
9072 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
9073 bgp_show_type_neighbor
);
9076 DEFUN (show_ip_bgp_view_rsclient
,
9077 show_ip_bgp_view_rsclient_cmd
,
9078 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X)",
9084 "Information about Route Server Client\n"
9087 struct bgp_table
*table
;
9091 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9093 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9098 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
9100 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9105 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
9106 PEER_FLAG_RSERVER_CLIENT
))
9108 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9113 table
= peer
->rib
[AFI_IP
][SAFI_UNICAST
];
9115 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
9118 ALIAS (show_ip_bgp_view_rsclient
,
9119 show_ip_bgp_rsclient_cmd
,
9120 "show ip bgp rsclient (A.B.C.D|X:X::X:X)",
9124 "Information about Route Server Client\n"
9127 DEFUN (show_ip_bgp_view_rsclient_route
,
9128 show_ip_bgp_view_rsclient_route_cmd
,
9129 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
9135 "Information about Route Server Client\n"
9137 "Network in the BGP routing table to display\n")
9142 /* BGP structure lookup. */
9145 bgp
= bgp_lookup_by_name (argv
[0]);
9148 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
9154 bgp
= bgp_get_default ();
9157 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9163 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9165 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9170 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
9172 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9177 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
9178 PEER_FLAG_RSERVER_CLIENT
))
9180 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9185 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
9186 (argc
== 3) ? argv
[2] : argv
[1],
9187 AFI_IP
, SAFI_UNICAST
, NULL
, 0);
9190 ALIAS (show_ip_bgp_view_rsclient_route
,
9191 show_ip_bgp_rsclient_route_cmd
,
9192 "show ip bgp rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
9196 "Information about Route Server Client\n"
9198 "Network in the BGP routing table to display\n")
9200 DEFUN (show_ip_bgp_view_rsclient_prefix
,
9201 show_ip_bgp_view_rsclient_prefix_cmd
,
9202 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
9208 "Information about Route Server Client\n"
9210 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
9215 /* BGP structure lookup. */
9218 bgp
= bgp_lookup_by_name (argv
[0]);
9221 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
9227 bgp
= bgp_get_default ();
9230 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9236 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9238 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9243 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
9245 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9250 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
9251 PEER_FLAG_RSERVER_CLIENT
))
9253 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9258 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
9259 (argc
== 3) ? argv
[2] : argv
[1],
9260 AFI_IP
, SAFI_UNICAST
, NULL
, 1);
9263 ALIAS (show_ip_bgp_view_rsclient_prefix
,
9264 show_ip_bgp_rsclient_prefix_cmd
,
9265 "show ip bgp rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
9269 "Information about Route Server Client\n"
9271 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
9275 DEFUN (show_bgp_view_neighbor_routes
,
9276 show_bgp_view_neighbor_routes_cmd
,
9277 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) routes",
9282 "Detailed information on TCP and BGP neighbor connections\n"
9283 "Neighbor to display information about\n"
9284 "Neighbor to display information about\n"
9285 "Display routes learned from neighbor\n")
9290 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9292 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9297 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
9298 bgp_show_type_neighbor
);
9301 ALIAS (show_bgp_view_neighbor_routes
,
9302 show_bgp_view_ipv6_neighbor_routes_cmd
,
9303 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) routes",
9309 "Detailed information on TCP and BGP neighbor connections\n"
9310 "Neighbor to display information about\n"
9311 "Neighbor to display information about\n"
9312 "Display routes learned from neighbor\n")
9314 DEFUN (show_bgp_view_neighbor_damp
,
9315 show_bgp_view_neighbor_damp_cmd
,
9316 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9321 "Detailed information on TCP and BGP neighbor connections\n"
9322 "Neighbor to display information about\n"
9323 "Neighbor to display information about\n"
9324 "Display the dampened routes received from neighbor\n")
9329 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9331 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9336 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
9337 bgp_show_type_damp_neighbor
);
9340 ALIAS (show_bgp_view_neighbor_damp
,
9341 show_bgp_view_ipv6_neighbor_damp_cmd
,
9342 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9348 "Detailed information on TCP and BGP neighbor connections\n"
9349 "Neighbor to display information about\n"
9350 "Neighbor to display information about\n"
9351 "Display the dampened routes received from neighbor\n")
9353 DEFUN (show_bgp_view_neighbor_flap
,
9354 show_bgp_view_neighbor_flap_cmd
,
9355 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9360 "Detailed information on TCP and BGP neighbor connections\n"
9361 "Neighbor to display information about\n"
9362 "Neighbor to display information about\n"
9363 "Display flap statistics of the routes learned from neighbor\n")
9368 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9370 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9375 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
9376 bgp_show_type_flap_neighbor
);
9379 ALIAS (show_bgp_view_neighbor_flap
,
9380 show_bgp_view_ipv6_neighbor_flap_cmd
,
9381 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9387 "Detailed information on TCP and BGP neighbor connections\n"
9388 "Neighbor to display information about\n"
9389 "Neighbor to display information about\n"
9390 "Display flap statistics of the routes learned from neighbor\n")
9392 ALIAS (show_bgp_view_neighbor_routes
,
9393 show_bgp_neighbor_routes_cmd
,
9394 "show bgp neighbors (A.B.C.D|X:X::X:X) routes",
9397 "Detailed information on TCP and BGP neighbor connections\n"
9398 "Neighbor to display information about\n"
9399 "Neighbor to display information about\n"
9400 "Display routes learned from neighbor\n")
9403 ALIAS (show_bgp_view_neighbor_routes
,
9404 show_bgp_ipv6_neighbor_routes_cmd
,
9405 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) routes",
9409 "Detailed information on TCP and BGP neighbor connections\n"
9410 "Neighbor to display information about\n"
9411 "Neighbor to display information about\n"
9412 "Display routes learned from neighbor\n")
9415 ALIAS (show_bgp_view_neighbor_routes
,
9416 ipv6_bgp_neighbor_routes_cmd
,
9417 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) routes",
9421 "Detailed information on TCP and BGP neighbor connections\n"
9422 "Neighbor to display information about\n"
9423 "Neighbor to display information about\n"
9424 "Display routes learned from neighbor\n")
9427 DEFUN (ipv6_mbgp_neighbor_routes
,
9428 ipv6_mbgp_neighbor_routes_cmd
,
9429 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) routes",
9433 "Detailed information on TCP and BGP neighbor connections\n"
9434 "Neighbor to display information about\n"
9435 "Neighbor to display information about\n"
9436 "Display routes learned from neighbor\n")
9440 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9444 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
,
9445 bgp_show_type_neighbor
);
9448 ALIAS (show_bgp_view_neighbor_flap
,
9449 show_bgp_neighbor_flap_cmd
,
9450 "show bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9453 "Detailed information on TCP and BGP neighbor connections\n"
9454 "Neighbor to display information about\n"
9455 "Neighbor to display information about\n"
9456 "Display flap statistics of the routes learned from neighbor\n")
9458 ALIAS (show_bgp_view_neighbor_flap
,
9459 show_bgp_ipv6_neighbor_flap_cmd
,
9460 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9464 "Detailed information on TCP and BGP neighbor connections\n"
9465 "Neighbor to display information about\n"
9466 "Neighbor to display information about\n"
9467 "Display flap statistics of the routes learned from neighbor\n")
9469 ALIAS (show_bgp_view_neighbor_damp
,
9470 show_bgp_neighbor_damp_cmd
,
9471 "show bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9474 "Detailed information on TCP and BGP neighbor connections\n"
9475 "Neighbor to display information about\n"
9476 "Neighbor to display information about\n"
9477 "Display the dampened routes received from neighbor\n")
9479 ALIAS (show_bgp_view_neighbor_damp
,
9480 show_bgp_ipv6_neighbor_damp_cmd
,
9481 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9485 "Detailed information on TCP and BGP neighbor connections\n"
9486 "Neighbor to display information about\n"
9487 "Neighbor to display information about\n"
9488 "Display the dampened routes received from neighbor\n")
9490 DEFUN (show_bgp_view_rsclient
,
9491 show_bgp_view_rsclient_cmd
,
9492 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X)",
9497 "Information about Route Server Client\n"
9500 struct bgp_table
*table
;
9504 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9506 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9511 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
9513 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9518 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
9519 PEER_FLAG_RSERVER_CLIENT
))
9521 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9526 table
= peer
->rib
[AFI_IP6
][SAFI_UNICAST
];
9528 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
9531 ALIAS (show_bgp_view_rsclient
,
9532 show_bgp_rsclient_cmd
,
9533 "show bgp rsclient (A.B.C.D|X:X::X:X)",
9536 "Information about Route Server Client\n"
9539 DEFUN (show_bgp_view_rsclient_route
,
9540 show_bgp_view_rsclient_route_cmd
,
9541 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
9546 "Information about Route Server Client\n"
9548 "Network in the BGP routing table to display\n")
9553 /* BGP structure lookup. */
9556 bgp
= bgp_lookup_by_name (argv
[0]);
9559 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
9565 bgp
= bgp_get_default ();
9568 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9574 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9576 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9581 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
9583 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9588 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
9589 PEER_FLAG_RSERVER_CLIENT
))
9591 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9596 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
9597 (argc
== 3) ? argv
[2] : argv
[1],
9598 AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
9601 ALIAS (show_bgp_view_rsclient_route
,
9602 show_bgp_rsclient_route_cmd
,
9603 "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
9606 "Information about Route Server Client\n"
9608 "Network in the BGP routing table to display\n")
9610 DEFUN (show_bgp_view_rsclient_prefix
,
9611 show_bgp_view_rsclient_prefix_cmd
,
9612 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
9617 "Information about Route Server Client\n"
9619 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
9624 /* BGP structure lookup. */
9627 bgp
= bgp_lookup_by_name (argv
[0]);
9630 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
9636 bgp
= bgp_get_default ();
9639 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9645 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9647 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9652 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
9654 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9659 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
9660 PEER_FLAG_RSERVER_CLIENT
))
9662 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9667 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
9668 (argc
== 3) ? argv
[2] : argv
[1],
9669 AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
9672 ALIAS (show_bgp_view_rsclient_prefix
,
9673 show_bgp_rsclient_prefix_cmd
,
9674 "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
9677 "Information about Route Server Client\n"
9679 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
9681 #endif /* HAVE_IPV6 */
9683 struct bgp_table
*bgp_distance_table
;
9687 /* Distance value for the IP source prefix. */
9690 /* Name of the access-list to be matched. */
9694 static struct bgp_distance
*
9697 struct bgp_distance
*new;
9698 new = XMALLOC (MTYPE_BGP_DISTANCE
, sizeof (struct bgp_distance
));
9699 memset (new, 0, sizeof (struct bgp_distance
));
9704 bgp_distance_free (struct bgp_distance
*bdistance
)
9706 XFREE (MTYPE_BGP_DISTANCE
, bdistance
);
9710 bgp_distance_set (struct vty
*vty
, const char *distance_str
,
9711 const char *ip_str
, const char *access_list_str
)
9714 struct prefix_ipv4 p
;
9716 struct bgp_node
*rn
;
9717 struct bgp_distance
*bdistance
;
9719 ret
= str2prefix_ipv4 (ip_str
, &p
);
9722 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
9726 distance
= atoi (distance_str
);
9728 /* Get BGP distance node. */
9729 rn
= bgp_node_get (bgp_distance_table
, (struct prefix
*) &p
);
9732 bdistance
= rn
->info
;
9733 bgp_unlock_node (rn
);
9737 bdistance
= bgp_distance_new ();
9738 rn
->info
= bdistance
;
9741 /* Set distance value. */
9742 bdistance
->distance
= distance
;
9744 /* Reset access-list configuration. */
9745 if (bdistance
->access_list
)
9747 free (bdistance
->access_list
);
9748 bdistance
->access_list
= NULL
;
9750 if (access_list_str
)
9751 bdistance
->access_list
= strdup (access_list_str
);
9757 bgp_distance_unset (struct vty
*vty
, const char *distance_str
,
9758 const char *ip_str
, const char *access_list_str
)
9761 struct prefix_ipv4 p
;
9763 struct bgp_node
*rn
;
9764 struct bgp_distance
*bdistance
;
9766 ret
= str2prefix_ipv4 (ip_str
, &p
);
9769 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
9773 distance
= atoi (distance_str
);
9775 rn
= bgp_node_lookup (bgp_distance_table
, (struct prefix
*)&p
);
9778 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
9782 bdistance
= rn
->info
;
9784 if (bdistance
->access_list
)
9785 free (bdistance
->access_list
);
9786 bgp_distance_free (bdistance
);
9789 bgp_unlock_node (rn
);
9790 bgp_unlock_node (rn
);
9796 bgp_distance_reset ()
9798 struct bgp_node
*rn
;
9799 struct bgp_distance
*bdistance
;
9801 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
9802 if ((bdistance
= rn
->info
) != NULL
)
9804 if (bdistance
->access_list
)
9805 free (bdistance
->access_list
);
9806 bgp_distance_free (bdistance
);
9808 bgp_unlock_node (rn
);
9812 /* Apply BGP information to distance method. */
9814 bgp_distance_apply (struct prefix
*p
, struct bgp_info
*rinfo
, struct bgp
*bgp
)
9816 struct bgp_node
*rn
;
9817 struct prefix_ipv4 q
;
9819 struct bgp_distance
*bdistance
;
9820 struct access_list
*alist
;
9821 struct bgp_static
*bgp_static
;
9826 if (p
->family
!= AF_INET
)
9831 if (peer
->su
.sa
.sa_family
!= AF_INET
)
9834 memset (&q
, 0, sizeof (struct prefix_ipv4
));
9836 q
.prefix
= peer
->su
.sin
.sin_addr
;
9837 q
.prefixlen
= IPV4_MAX_BITLEN
;
9839 /* Check source address. */
9840 rn
= bgp_node_match (bgp_distance_table
, (struct prefix
*) &q
);
9843 bdistance
= rn
->info
;
9844 bgp_unlock_node (rn
);
9846 if (bdistance
->access_list
)
9848 alist
= access_list_lookup (AFI_IP
, bdistance
->access_list
);
9849 if (alist
&& access_list_apply (alist
, p
) == FILTER_PERMIT
)
9850 return bdistance
->distance
;
9853 return bdistance
->distance
;
9856 /* Backdoor check. */
9857 rn
= bgp_node_lookup (bgp
->route
[AFI_IP
][SAFI_UNICAST
], p
);
9860 bgp_static
= rn
->info
;
9861 bgp_unlock_node (rn
);
9863 if (bgp_static
->backdoor
)
9865 if (bgp
->distance_local
)
9866 return bgp
->distance_local
;
9868 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
9872 if (peer_sort (peer
) == BGP_PEER_EBGP
)
9874 if (bgp
->distance_ebgp
)
9875 return bgp
->distance_ebgp
;
9876 return ZEBRA_EBGP_DISTANCE_DEFAULT
;
9880 if (bgp
->distance_ibgp
)
9881 return bgp
->distance_ibgp
;
9882 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
9886 DEFUN (bgp_distance
,
9888 "distance bgp <1-255> <1-255> <1-255>",
9889 "Define an administrative distance\n"
9891 "Distance for routes external to the AS\n"
9892 "Distance for routes internal to the AS\n"
9893 "Distance for local routes\n")
9899 bgp
->distance_ebgp
= atoi (argv
[0]);
9900 bgp
->distance_ibgp
= atoi (argv
[1]);
9901 bgp
->distance_local
= atoi (argv
[2]);
9905 DEFUN (no_bgp_distance
,
9906 no_bgp_distance_cmd
,
9907 "no distance bgp <1-255> <1-255> <1-255>",
9909 "Define an administrative distance\n"
9911 "Distance for routes external to the AS\n"
9912 "Distance for routes internal to the AS\n"
9913 "Distance for local routes\n")
9919 bgp
->distance_ebgp
= 0;
9920 bgp
->distance_ibgp
= 0;
9921 bgp
->distance_local
= 0;
9925 ALIAS (no_bgp_distance
,
9926 no_bgp_distance2_cmd
,
9929 "Define an administrative distance\n"
9932 DEFUN (bgp_distance_source
,
9933 bgp_distance_source_cmd
,
9934 "distance <1-255> A.B.C.D/M",
9935 "Define an administrative distance\n"
9936 "Administrative distance\n"
9937 "IP source prefix\n")
9939 bgp_distance_set (vty
, argv
[0], argv
[1], NULL
);
9943 DEFUN (no_bgp_distance_source
,
9944 no_bgp_distance_source_cmd
,
9945 "no distance <1-255> A.B.C.D/M",
9947 "Define an administrative distance\n"
9948 "Administrative distance\n"
9949 "IP source prefix\n")
9951 bgp_distance_unset (vty
, argv
[0], argv
[1], NULL
);
9955 DEFUN (bgp_distance_source_access_list
,
9956 bgp_distance_source_access_list_cmd
,
9957 "distance <1-255> A.B.C.D/M WORD",
9958 "Define an administrative distance\n"
9959 "Administrative distance\n"
9960 "IP source prefix\n"
9961 "Access list name\n")
9963 bgp_distance_set (vty
, argv
[0], argv
[1], argv
[2]);
9967 DEFUN (no_bgp_distance_source_access_list
,
9968 no_bgp_distance_source_access_list_cmd
,
9969 "no distance <1-255> A.B.C.D/M WORD",
9971 "Define an administrative distance\n"
9972 "Administrative distance\n"
9973 "IP source prefix\n"
9974 "Access list name\n")
9976 bgp_distance_unset (vty
, argv
[0], argv
[1], argv
[2]);
9980 DEFUN (bgp_damp_set
,
9982 "bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
9983 "BGP Specific commands\n"
9984 "Enable route-flap dampening\n"
9985 "Half-life time for the penalty\n"
9986 "Value to start reusing a route\n"
9987 "Value to start suppressing a route\n"
9988 "Maximum duration to suppress a stable route\n")
9991 int half
= DEFAULT_HALF_LIFE
* 60;
9992 int reuse
= DEFAULT_REUSE
;
9993 int suppress
= DEFAULT_SUPPRESS
;
9998 half
= atoi (argv
[0]) * 60;
9999 reuse
= atoi (argv
[1]);
10000 suppress
= atoi (argv
[2]);
10001 max
= atoi (argv
[3]) * 60;
10003 else if (argc
== 1)
10005 half
= atoi (argv
[0]) * 60;
10010 return bgp_damp_enable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
),
10011 half
, reuse
, suppress
, max
);
10014 ALIAS (bgp_damp_set
,
10016 "bgp dampening <1-45>",
10017 "BGP Specific commands\n"
10018 "Enable route-flap dampening\n"
10019 "Half-life time for the penalty\n")
10021 ALIAS (bgp_damp_set
,
10024 "BGP Specific commands\n"
10025 "Enable route-flap dampening\n")
10027 DEFUN (bgp_damp_unset
,
10028 bgp_damp_unset_cmd
,
10029 "no bgp dampening",
10031 "BGP Specific commands\n"
10032 "Enable route-flap dampening\n")
10037 return bgp_damp_disable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
));
10040 ALIAS (bgp_damp_unset
,
10041 bgp_damp_unset2_cmd
,
10042 "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
10044 "BGP Specific commands\n"
10045 "Enable route-flap dampening\n"
10046 "Half-life time for the penalty\n"
10047 "Value to start reusing a route\n"
10048 "Value to start suppressing a route\n"
10049 "Maximum duration to suppress a stable route\n")
10051 DEFUN (show_ip_bgp_dampened_paths
,
10052 show_ip_bgp_dampened_paths_cmd
,
10053 "show ip bgp dampened-paths",
10057 "Display paths suppressed due to dampening\n")
10059 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_dampend_paths
,
10063 DEFUN (show_ip_bgp_flap_statistics
,
10064 show_ip_bgp_flap_statistics_cmd
,
10065 "show ip bgp flap-statistics",
10069 "Display flap statistics of routes\n")
10071 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
10072 bgp_show_type_flap_statistics
, NULL
);
10075 /* Display specified route of BGP table. */
10077 bgp_clear_damp_route (struct vty
*vty
, const char *view_name
,
10078 const char *ip_str
, afi_t afi
, safi_t safi
,
10079 struct prefix_rd
*prd
, int prefix_check
)
10082 struct prefix match
;
10083 struct bgp_node
*rn
;
10084 struct bgp_node
*rm
;
10085 struct bgp_info
*ri
;
10086 struct bgp_info
*ri_temp
;
10088 struct bgp_table
*table
;
10090 /* BGP structure lookup. */
10093 bgp
= bgp_lookup_by_name (view_name
);
10096 vty_out (vty
, "%% Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
10097 return CMD_WARNING
;
10102 bgp
= bgp_get_default ();
10105 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
10106 return CMD_WARNING
;
10110 /* Check IP address argument. */
10111 ret
= str2prefix (ip_str
, &match
);
10114 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
10115 return CMD_WARNING
;
10118 match
.family
= afi2family (afi
);
10120 if (safi
== SAFI_MPLS_VPN
)
10122 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= bgp_route_next (rn
))
10124 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
10127 if ((table
= rn
->info
) != NULL
)
10128 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
10129 if (! prefix_check
|| rm
->p
.prefixlen
== match
.prefixlen
)
10136 ri_temp
= ri
->next
;
10137 bgp_damp_info_free (ri
->damp_info
, 1);
10148 if ((rn
= bgp_node_match (bgp
->rib
[afi
][safi
], &match
)) != NULL
)
10149 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
10156 ri_temp
= ri
->next
;
10157 bgp_damp_info_free (ri
->damp_info
, 1);
10166 return CMD_SUCCESS
;
10169 DEFUN (clear_ip_bgp_dampening
,
10170 clear_ip_bgp_dampening_cmd
,
10171 "clear ip bgp dampening",
10175 "Clear route flap dampening information\n")
10177 bgp_damp_info_clean ();
10178 return CMD_SUCCESS
;
10181 DEFUN (clear_ip_bgp_dampening_prefix
,
10182 clear_ip_bgp_dampening_prefix_cmd
,
10183 "clear ip bgp dampening A.B.C.D/M",
10187 "Clear route flap dampening information\n"
10188 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
10190 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
10191 SAFI_UNICAST
, NULL
, 1);
10194 DEFUN (clear_ip_bgp_dampening_address
,
10195 clear_ip_bgp_dampening_address_cmd
,
10196 "clear ip bgp dampening A.B.C.D",
10200 "Clear route flap dampening information\n"
10201 "Network to clear damping information\n")
10203 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
10204 SAFI_UNICAST
, NULL
, 0);
10207 DEFUN (clear_ip_bgp_dampening_address_mask
,
10208 clear_ip_bgp_dampening_address_mask_cmd
,
10209 "clear ip bgp dampening A.B.C.D A.B.C.D",
10213 "Clear route flap dampening information\n"
10214 "Network to clear damping information\n"
10218 char prefix_str
[BUFSIZ
];
10220 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
10223 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
10224 return CMD_WARNING
;
10227 return bgp_clear_damp_route (vty
, NULL
, prefix_str
, AFI_IP
,
10228 SAFI_UNICAST
, NULL
, 0);
10232 bgp_config_write_network_vpnv4 (struct vty
*vty
, struct bgp
*bgp
,
10233 afi_t afi
, safi_t safi
, int *write
)
10235 struct bgp_node
*prn
;
10236 struct bgp_node
*rn
;
10237 struct bgp_table
*table
;
10239 struct prefix_rd
*prd
;
10240 struct bgp_static
*bgp_static
;
10242 char buf
[SU_ADDRSTRLEN
];
10243 char rdbuf
[RD_ADDRSTRLEN
];
10245 /* Network configuration. */
10246 for (prn
= bgp_table_top (bgp
->route
[afi
][safi
]); prn
; prn
= bgp_route_next (prn
))
10247 if ((table
= prn
->info
) != NULL
)
10248 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
10249 if ((bgp_static
= rn
->info
) != NULL
)
10252 prd
= (struct prefix_rd
*) &prn
->p
;
10254 /* "address-family" display. */
10255 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10257 /* "network" configuration display. */
10258 prefix_rd2str (prd
, rdbuf
, RD_ADDRSTRLEN
);
10259 label
= decode_label (bgp_static
->tag
);
10261 vty_out (vty
, " network %s/%d rd %s tag %d",
10262 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
10265 vty_out (vty
, "%s", VTY_NEWLINE
);
10270 /* Configuration of static route announcement and aggregate
10273 bgp_config_write_network (struct vty
*vty
, struct bgp
*bgp
,
10274 afi_t afi
, safi_t safi
, int *write
)
10276 struct bgp_node
*rn
;
10278 struct bgp_static
*bgp_static
;
10279 struct bgp_aggregate
*bgp_aggregate
;
10280 char buf
[SU_ADDRSTRLEN
];
10282 if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
10283 return bgp_config_write_network_vpnv4 (vty
, bgp
, afi
, safi
, write
);
10285 /* Network configuration. */
10286 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
10287 if ((bgp_static
= rn
->info
) != NULL
)
10291 /* "address-family" display. */
10292 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10294 /* "network" configuration display. */
10295 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
10297 u_int32_t destination
;
10298 struct in_addr netmask
;
10300 destination
= ntohl (p
->u
.prefix4
.s_addr
);
10301 masklen2ip (p
->prefixlen
, &netmask
);
10302 vty_out (vty
, " network %s",
10303 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
));
10305 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
10306 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
10307 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
10308 || p
->u
.prefix4
.s_addr
== 0)
10310 /* Natural mask is not display. */
10313 vty_out (vty
, " mask %s", inet_ntoa (netmask
));
10317 vty_out (vty
, " network %s/%d",
10318 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
10322 if (bgp_static
->rmap
.name
)
10323 vty_out (vty
, " route-map %s", bgp_static
->rmap
.name
);
10324 else if (bgp_static
->backdoor
)
10325 vty_out (vty
, " backdoor");
10327 vty_out (vty
, "%s", VTY_NEWLINE
);
10330 /* Aggregate-address configuration. */
10331 for (rn
= bgp_table_top (bgp
->aggregate
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
10332 if ((bgp_aggregate
= rn
->info
) != NULL
)
10336 /* "address-family" display. */
10337 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10339 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
10341 struct in_addr netmask
;
10343 masklen2ip (p
->prefixlen
, &netmask
);
10344 vty_out (vty
, " aggregate-address %s %s",
10345 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
10346 inet_ntoa (netmask
));
10350 vty_out (vty
, " aggregate-address %s/%d",
10351 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
10355 if (bgp_aggregate
->as_set
)
10356 vty_out (vty
, " as-set");
10358 if (bgp_aggregate
->summary_only
)
10359 vty_out (vty
, " summary-only");
10361 vty_out (vty
, "%s", VTY_NEWLINE
);
10368 bgp_config_write_distance (struct vty
*vty
, struct bgp
*bgp
)
10370 struct bgp_node
*rn
;
10371 struct bgp_distance
*bdistance
;
10373 /* Distance configuration. */
10374 if (bgp
->distance_ebgp
10375 && bgp
->distance_ibgp
10376 && bgp
->distance_local
10377 && (bgp
->distance_ebgp
!= ZEBRA_EBGP_DISTANCE_DEFAULT
10378 || bgp
->distance_ibgp
!= ZEBRA_IBGP_DISTANCE_DEFAULT
10379 || bgp
->distance_local
!= ZEBRA_IBGP_DISTANCE_DEFAULT
))
10380 vty_out (vty
, " distance bgp %d %d %d%s",
10381 bgp
->distance_ebgp
, bgp
->distance_ibgp
, bgp
->distance_local
,
10384 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
10385 if ((bdistance
= rn
->info
) != NULL
)
10387 vty_out (vty
, " distance %d %s/%d %s%s", bdistance
->distance
,
10388 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
10389 bdistance
->access_list
? bdistance
->access_list
: "",
10396 /* Allocate routing table structure and install commands. */
10400 /* Init BGP distance table. */
10401 bgp_distance_table
= bgp_table_init (AFI_IP
, SAFI_UNICAST
);
10403 /* IPv4 BGP commands. */
10404 install_element (BGP_NODE
, &bgp_network_cmd
);
10405 install_element (BGP_NODE
, &bgp_network_mask_cmd
);
10406 install_element (BGP_NODE
, &bgp_network_mask_natural_cmd
);
10407 install_element (BGP_NODE
, &bgp_network_route_map_cmd
);
10408 install_element (BGP_NODE
, &bgp_network_mask_route_map_cmd
);
10409 install_element (BGP_NODE
, &bgp_network_mask_natural_route_map_cmd
);
10410 install_element (BGP_NODE
, &bgp_network_backdoor_cmd
);
10411 install_element (BGP_NODE
, &bgp_network_mask_backdoor_cmd
);
10412 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_cmd
);
10413 install_element (BGP_NODE
, &no_bgp_network_cmd
);
10414 install_element (BGP_NODE
, &no_bgp_network_mask_cmd
);
10415 install_element (BGP_NODE
, &no_bgp_network_mask_natural_cmd
);
10416 install_element (BGP_NODE
, &no_bgp_network_route_map_cmd
);
10417 install_element (BGP_NODE
, &no_bgp_network_mask_route_map_cmd
);
10418 install_element (BGP_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
10419 install_element (BGP_NODE
, &no_bgp_network_backdoor_cmd
);
10420 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_cmd
);
10421 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_cmd
);
10423 install_element (BGP_NODE
, &aggregate_address_cmd
);
10424 install_element (BGP_NODE
, &aggregate_address_mask_cmd
);
10425 install_element (BGP_NODE
, &aggregate_address_summary_only_cmd
);
10426 install_element (BGP_NODE
, &aggregate_address_mask_summary_only_cmd
);
10427 install_element (BGP_NODE
, &aggregate_address_as_set_cmd
);
10428 install_element (BGP_NODE
, &aggregate_address_mask_as_set_cmd
);
10429 install_element (BGP_NODE
, &aggregate_address_as_set_summary_cmd
);
10430 install_element (BGP_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
10431 install_element (BGP_NODE
, &aggregate_address_summary_as_set_cmd
);
10432 install_element (BGP_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
10433 install_element (BGP_NODE
, &no_aggregate_address_cmd
);
10434 install_element (BGP_NODE
, &no_aggregate_address_summary_only_cmd
);
10435 install_element (BGP_NODE
, &no_aggregate_address_as_set_cmd
);
10436 install_element (BGP_NODE
, &no_aggregate_address_as_set_summary_cmd
);
10437 install_element (BGP_NODE
, &no_aggregate_address_summary_as_set_cmd
);
10438 install_element (BGP_NODE
, &no_aggregate_address_mask_cmd
);
10439 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
10440 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_cmd
);
10441 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
10442 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
10444 /* IPv4 unicast configuration. */
10445 install_element (BGP_IPV4_NODE
, &bgp_network_cmd
);
10446 install_element (BGP_IPV4_NODE
, &bgp_network_mask_cmd
);
10447 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_cmd
);
10448 install_element (BGP_IPV4_NODE
, &bgp_network_route_map_cmd
);
10449 install_element (BGP_IPV4_NODE
, &bgp_network_mask_route_map_cmd
);
10450 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_route_map_cmd
);
10451 install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
10452 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_cmd
);
10453 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_cmd
);
10454 install_element (BGP_IPV4_NODE
, &no_bgp_network_route_map_cmd
);
10455 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_route_map_cmd
);
10456 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
10457 install_element (BGP_IPV4_NODE
, &aggregate_address_cmd
);
10458 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_cmd
);
10459 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_only_cmd
);
10460 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_only_cmd
);
10461 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_cmd
);
10462 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_cmd
);
10463 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_summary_cmd
);
10464 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
10465 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_as_set_cmd
);
10466 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
10467 install_element (BGP_IPV4_NODE
, &no_aggregate_address_cmd
);
10468 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_only_cmd
);
10469 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_cmd
);
10470 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_summary_cmd
);
10471 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_as_set_cmd
);
10472 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_cmd
);
10473 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
10474 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_cmd
);
10475 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
10476 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
10478 /* IPv4 multicast configuration. */
10479 install_element (BGP_IPV4M_NODE
, &bgp_network_cmd
);
10480 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_cmd
);
10481 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_cmd
);
10482 install_element (BGP_IPV4M_NODE
, &bgp_network_route_map_cmd
);
10483 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_route_map_cmd
);
10484 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_route_map_cmd
);
10485 install_element (BGP_IPV4M_NODE
, &no_bgp_network_cmd
);
10486 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_cmd
);
10487 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_cmd
);
10488 install_element (BGP_IPV4M_NODE
, &no_bgp_network_route_map_cmd
);
10489 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_route_map_cmd
);
10490 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
10491 install_element (BGP_IPV4M_NODE
, &aggregate_address_cmd
);
10492 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_cmd
);
10493 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_only_cmd
);
10494 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_only_cmd
);
10495 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_cmd
);
10496 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_cmd
);
10497 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_summary_cmd
);
10498 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
10499 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_as_set_cmd
);
10500 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
10501 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_cmd
);
10502 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_only_cmd
);
10503 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_cmd
);
10504 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_summary_cmd
);
10505 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_as_set_cmd
);
10506 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_cmd
);
10507 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
10508 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_cmd
);
10509 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
10510 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
10512 install_element (VIEW_NODE
, &show_ip_bgp_cmd
);
10513 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cmd
);
10514 install_element (VIEW_NODE
, &show_ip_bgp_route_cmd
);
10515 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_cmd
);
10516 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
10517 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
10518 install_element (VIEW_NODE
, &show_ip_bgp_prefix_cmd
);
10519 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
10520 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
10521 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
10522 install_element (VIEW_NODE
, &show_ip_bgp_view_cmd
);
10523 install_element (VIEW_NODE
, &show_ip_bgp_view_route_cmd
);
10524 install_element (VIEW_NODE
, &show_ip_bgp_view_prefix_cmd
);
10525 install_element (VIEW_NODE
, &show_ip_bgp_regexp_cmd
);
10526 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
10527 install_element (VIEW_NODE
, &show_ip_bgp_prefix_list_cmd
);
10528 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
10529 install_element (VIEW_NODE
, &show_ip_bgp_filter_list_cmd
);
10530 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
10531 install_element (VIEW_NODE
, &show_ip_bgp_route_map_cmd
);
10532 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
10533 install_element (VIEW_NODE
, &show_ip_bgp_cidr_only_cmd
);
10534 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
10535 install_element (VIEW_NODE
, &show_ip_bgp_community_all_cmd
);
10536 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
10537 install_element (VIEW_NODE
, &show_ip_bgp_community_cmd
);
10538 install_element (VIEW_NODE
, &show_ip_bgp_community2_cmd
);
10539 install_element (VIEW_NODE
, &show_ip_bgp_community3_cmd
);
10540 install_element (VIEW_NODE
, &show_ip_bgp_community4_cmd
);
10541 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_cmd
);
10542 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
10543 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
10544 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
10545 install_element (VIEW_NODE
, &show_ip_bgp_community_exact_cmd
);
10546 install_element (VIEW_NODE
, &show_ip_bgp_community2_exact_cmd
);
10547 install_element (VIEW_NODE
, &show_ip_bgp_community3_exact_cmd
);
10548 install_element (VIEW_NODE
, &show_ip_bgp_community4_exact_cmd
);
10549 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
10550 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
10551 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
10552 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
10553 install_element (VIEW_NODE
, &show_ip_bgp_community_list_cmd
);
10554 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
10555 install_element (VIEW_NODE
, &show_ip_bgp_community_list_exact_cmd
);
10556 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
10557 install_element (VIEW_NODE
, &show_ip_bgp_prefix_longer_cmd
);
10558 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
10559 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
10560 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
10561 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
10562 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
10563 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
10564 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
10565 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
10566 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
10567 install_element (VIEW_NODE
, &show_ip_bgp_dampened_paths_cmd
);
10568 install_element (VIEW_NODE
, &show_ip_bgp_flap_statistics_cmd
);
10569 install_element (VIEW_NODE
, &show_ip_bgp_flap_address_cmd
);
10570 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_cmd
);
10571 install_element (VIEW_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
10572 install_element (VIEW_NODE
, &show_ip_bgp_flap_regexp_cmd
);
10573 install_element (VIEW_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
10574 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
10575 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
10576 install_element (VIEW_NODE
, &show_ip_bgp_flap_route_map_cmd
);
10577 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
10578 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
10579 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_cmd
);
10580 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_route_cmd
);
10581 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
10582 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_cmd
);
10583 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
10584 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
10586 install_element (ENABLE_NODE
, &show_ip_bgp_cmd
);
10587 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cmd
);
10588 install_element (ENABLE_NODE
, &show_ip_bgp_route_cmd
);
10589 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_cmd
);
10590 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
10591 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
10592 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_cmd
);
10593 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
10594 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
10595 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
10596 install_element (ENABLE_NODE
, &show_ip_bgp_view_cmd
);
10597 install_element (ENABLE_NODE
, &show_ip_bgp_view_route_cmd
);
10598 install_element (ENABLE_NODE
, &show_ip_bgp_view_prefix_cmd
);
10599 install_element (ENABLE_NODE
, &show_ip_bgp_regexp_cmd
);
10600 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
10601 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_list_cmd
);
10602 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
10603 install_element (ENABLE_NODE
, &show_ip_bgp_filter_list_cmd
);
10604 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
10605 install_element (ENABLE_NODE
, &show_ip_bgp_route_map_cmd
);
10606 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
10607 install_element (ENABLE_NODE
, &show_ip_bgp_cidr_only_cmd
);
10608 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
10609 install_element (ENABLE_NODE
, &show_ip_bgp_community_all_cmd
);
10610 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
10611 install_element (ENABLE_NODE
, &show_ip_bgp_community_cmd
);
10612 install_element (ENABLE_NODE
, &show_ip_bgp_community2_cmd
);
10613 install_element (ENABLE_NODE
, &show_ip_bgp_community3_cmd
);
10614 install_element (ENABLE_NODE
, &show_ip_bgp_community4_cmd
);
10615 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_cmd
);
10616 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
10617 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
10618 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
10619 install_element (ENABLE_NODE
, &show_ip_bgp_community_exact_cmd
);
10620 install_element (ENABLE_NODE
, &show_ip_bgp_community2_exact_cmd
);
10621 install_element (ENABLE_NODE
, &show_ip_bgp_community3_exact_cmd
);
10622 install_element (ENABLE_NODE
, &show_ip_bgp_community4_exact_cmd
);
10623 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
10624 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
10625 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
10626 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
10627 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_cmd
);
10628 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
10629 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_exact_cmd
);
10630 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
10631 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_longer_cmd
);
10632 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
10633 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
10634 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
10635 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
10636 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
10637 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
10638 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
10639 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
10640 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
10641 install_element (ENABLE_NODE
, &show_ip_bgp_dampened_paths_cmd
);
10642 install_element (ENABLE_NODE
, &show_ip_bgp_flap_statistics_cmd
);
10643 install_element (ENABLE_NODE
, &show_ip_bgp_flap_address_cmd
);
10644 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_cmd
);
10645 install_element (ENABLE_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
10646 install_element (ENABLE_NODE
, &show_ip_bgp_flap_regexp_cmd
);
10647 install_element (ENABLE_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
10648 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
10649 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
10650 install_element (ENABLE_NODE
, &show_ip_bgp_flap_route_map_cmd
);
10651 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
10652 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
10653 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_cmd
);
10654 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_route_cmd
);
10655 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
10656 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_cmd
);
10657 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
10658 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
10660 /* BGP dampening clear commands */
10661 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_cmd
);
10662 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_prefix_cmd
);
10663 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_cmd
);
10664 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_mask_cmd
);
10667 /* New config IPv6 BGP commands. */
10668 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_cmd
);
10669 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_route_map_cmd
);
10670 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_cmd
);
10671 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_route_map_cmd
);
10673 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_cmd
);
10674 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_summary_only_cmd
);
10675 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_cmd
);
10676 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_summary_only_cmd
);
10678 /* Old config IPv6 BGP commands. */
10679 install_element (BGP_NODE
, &old_ipv6_bgp_network_cmd
);
10680 install_element (BGP_NODE
, &old_no_ipv6_bgp_network_cmd
);
10682 install_element (BGP_NODE
, &old_ipv6_aggregate_address_cmd
);
10683 install_element (BGP_NODE
, &old_ipv6_aggregate_address_summary_only_cmd
);
10684 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_cmd
);
10685 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_summary_only_cmd
);
10687 install_element (VIEW_NODE
, &show_bgp_cmd
);
10688 install_element (VIEW_NODE
, &show_bgp_ipv6_cmd
);
10689 install_element (VIEW_NODE
, &show_bgp_route_cmd
);
10690 install_element (VIEW_NODE
, &show_bgp_ipv6_route_cmd
);
10691 install_element (VIEW_NODE
, &show_bgp_prefix_cmd
);
10692 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_cmd
);
10693 install_element (VIEW_NODE
, &show_bgp_regexp_cmd
);
10694 install_element (VIEW_NODE
, &show_bgp_ipv6_regexp_cmd
);
10695 install_element (VIEW_NODE
, &show_bgp_prefix_list_cmd
);
10696 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
10697 install_element (VIEW_NODE
, &show_bgp_filter_list_cmd
);
10698 install_element (VIEW_NODE
, &show_bgp_ipv6_filter_list_cmd
);
10699 install_element (VIEW_NODE
, &show_bgp_route_map_cmd
);
10700 install_element (VIEW_NODE
, &show_bgp_ipv6_route_map_cmd
);
10701 install_element (VIEW_NODE
, &show_bgp_community_all_cmd
);
10702 install_element (VIEW_NODE
, &show_bgp_ipv6_community_all_cmd
);
10703 install_element (VIEW_NODE
, &show_bgp_community_cmd
);
10704 install_element (VIEW_NODE
, &show_bgp_ipv6_community_cmd
);
10705 install_element (VIEW_NODE
, &show_bgp_community2_cmd
);
10706 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_cmd
);
10707 install_element (VIEW_NODE
, &show_bgp_community3_cmd
);
10708 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_cmd
);
10709 install_element (VIEW_NODE
, &show_bgp_community4_cmd
);
10710 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_cmd
);
10711 install_element (VIEW_NODE
, &show_bgp_community_exact_cmd
);
10712 install_element (VIEW_NODE
, &show_bgp_ipv6_community_exact_cmd
);
10713 install_element (VIEW_NODE
, &show_bgp_community2_exact_cmd
);
10714 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
10715 install_element (VIEW_NODE
, &show_bgp_community3_exact_cmd
);
10716 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
10717 install_element (VIEW_NODE
, &show_bgp_community4_exact_cmd
);
10718 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
10719 install_element (VIEW_NODE
, &show_bgp_community_list_cmd
);
10720 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_cmd
);
10721 install_element (VIEW_NODE
, &show_bgp_community_list_exact_cmd
);
10722 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
10723 install_element (VIEW_NODE
, &show_bgp_prefix_longer_cmd
);
10724 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
10725 install_element (VIEW_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
10726 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
10727 install_element (VIEW_NODE
, &show_bgp_neighbor_received_routes_cmd
);
10728 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
10729 install_element (VIEW_NODE
, &show_bgp_neighbor_routes_cmd
);
10730 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
10731 install_element (VIEW_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
10732 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
10733 install_element (VIEW_NODE
, &show_bgp_neighbor_flap_cmd
);
10734 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
10735 install_element (VIEW_NODE
, &show_bgp_neighbor_damp_cmd
);
10736 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
10737 install_element (VIEW_NODE
, &show_bgp_rsclient_cmd
);
10738 install_element (VIEW_NODE
, &show_bgp_rsclient_route_cmd
);
10739 install_element (VIEW_NODE
, &show_bgp_rsclient_prefix_cmd
);
10740 install_element (VIEW_NODE
, &show_bgp_view_cmd
);
10741 install_element (VIEW_NODE
, &show_bgp_view_ipv6_cmd
);
10742 install_element (VIEW_NODE
, &show_bgp_view_route_cmd
);
10743 install_element (VIEW_NODE
, &show_bgp_view_ipv6_route_cmd
);
10744 install_element (VIEW_NODE
, &show_bgp_view_prefix_cmd
);
10745 install_element (VIEW_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
10746 install_element (VIEW_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
10747 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
10748 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
10749 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
10750 install_element (VIEW_NODE
, &show_bgp_view_neighbor_routes_cmd
);
10751 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
10752 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
10753 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
10754 install_element (VIEW_NODE
, &show_bgp_view_neighbor_flap_cmd
);
10755 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
10756 install_element (VIEW_NODE
, &show_bgp_view_neighbor_damp_cmd
);
10757 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
10758 install_element (VIEW_NODE
, &show_bgp_view_rsclient_cmd
);
10759 install_element (VIEW_NODE
, &show_bgp_view_rsclient_route_cmd
);
10760 install_element (VIEW_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
10762 install_element (ENABLE_NODE
, &show_bgp_cmd
);
10763 install_element (ENABLE_NODE
, &show_bgp_ipv6_cmd
);
10764 install_element (ENABLE_NODE
, &show_bgp_route_cmd
);
10765 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_cmd
);
10766 install_element (ENABLE_NODE
, &show_bgp_prefix_cmd
);
10767 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_cmd
);
10768 install_element (ENABLE_NODE
, &show_bgp_regexp_cmd
);
10769 install_element (ENABLE_NODE
, &show_bgp_ipv6_regexp_cmd
);
10770 install_element (ENABLE_NODE
, &show_bgp_prefix_list_cmd
);
10771 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
10772 install_element (ENABLE_NODE
, &show_bgp_filter_list_cmd
);
10773 install_element (ENABLE_NODE
, &show_bgp_ipv6_filter_list_cmd
);
10774 install_element (ENABLE_NODE
, &show_bgp_route_map_cmd
);
10775 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_map_cmd
);
10776 install_element (ENABLE_NODE
, &show_bgp_community_all_cmd
);
10777 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_all_cmd
);
10778 install_element (ENABLE_NODE
, &show_bgp_community_cmd
);
10779 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_cmd
);
10780 install_element (ENABLE_NODE
, &show_bgp_community2_cmd
);
10781 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_cmd
);
10782 install_element (ENABLE_NODE
, &show_bgp_community3_cmd
);
10783 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_cmd
);
10784 install_element (ENABLE_NODE
, &show_bgp_community4_cmd
);
10785 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_cmd
);
10786 install_element (ENABLE_NODE
, &show_bgp_community_exact_cmd
);
10787 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_exact_cmd
);
10788 install_element (ENABLE_NODE
, &show_bgp_community2_exact_cmd
);
10789 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
10790 install_element (ENABLE_NODE
, &show_bgp_community3_exact_cmd
);
10791 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
10792 install_element (ENABLE_NODE
, &show_bgp_community4_exact_cmd
);
10793 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
10794 install_element (ENABLE_NODE
, &show_bgp_community_list_cmd
);
10795 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_cmd
);
10796 install_element (ENABLE_NODE
, &show_bgp_community_list_exact_cmd
);
10797 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
10798 install_element (ENABLE_NODE
, &show_bgp_prefix_longer_cmd
);
10799 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
10800 install_element (ENABLE_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
10801 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
10802 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_routes_cmd
);
10803 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
10804 install_element (ENABLE_NODE
, &show_bgp_neighbor_routes_cmd
);
10805 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
10806 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
10807 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
10808 install_element (ENABLE_NODE
, &show_bgp_neighbor_flap_cmd
);
10809 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
10810 install_element (ENABLE_NODE
, &show_bgp_neighbor_damp_cmd
);
10811 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
10812 install_element (ENABLE_NODE
, &show_bgp_rsclient_cmd
);
10813 install_element (ENABLE_NODE
, &show_bgp_rsclient_route_cmd
);
10814 install_element (ENABLE_NODE
, &show_bgp_rsclient_prefix_cmd
);
10815 install_element (ENABLE_NODE
, &show_bgp_view_cmd
);
10816 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_cmd
);
10817 install_element (ENABLE_NODE
, &show_bgp_view_route_cmd
);
10818 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_route_cmd
);
10819 install_element (ENABLE_NODE
, &show_bgp_view_prefix_cmd
);
10820 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
10821 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
10822 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
10823 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
10824 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
10825 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_routes_cmd
);
10826 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
10827 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
10828 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
10829 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_flap_cmd
);
10830 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
10831 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_damp_cmd
);
10832 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
10833 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_cmd
);
10834 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_route_cmd
);
10835 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
10838 install_element (VIEW_NODE
, &show_ipv6_bgp_cmd
);
10839 install_element (VIEW_NODE
, &show_ipv6_bgp_route_cmd
);
10840 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_cmd
);
10841 install_element (VIEW_NODE
, &show_ipv6_bgp_regexp_cmd
);
10842 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
10843 install_element (VIEW_NODE
, &show_ipv6_bgp_filter_list_cmd
);
10844 install_element (VIEW_NODE
, &show_ipv6_bgp_community_all_cmd
);
10845 install_element (VIEW_NODE
, &show_ipv6_bgp_community_cmd
);
10846 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_cmd
);
10847 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_cmd
);
10848 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_cmd
);
10849 install_element (VIEW_NODE
, &show_ipv6_bgp_community_exact_cmd
);
10850 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
10851 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
10852 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
10853 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_cmd
);
10854 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
10855 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
10856 install_element (VIEW_NODE
, &show_ipv6_mbgp_cmd
);
10857 install_element (VIEW_NODE
, &show_ipv6_mbgp_route_cmd
);
10858 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_cmd
);
10859 install_element (VIEW_NODE
, &show_ipv6_mbgp_regexp_cmd
);
10860 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
10861 install_element (VIEW_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
10862 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_all_cmd
);
10863 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_cmd
);
10864 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_cmd
);
10865 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_cmd
);
10866 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_cmd
);
10867 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
10868 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
10869 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
10870 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
10871 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_cmd
);
10872 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
10873 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
10876 install_element (ENABLE_NODE
, &show_ipv6_bgp_cmd
);
10877 install_element (ENABLE_NODE
, &show_ipv6_bgp_route_cmd
);
10878 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_cmd
);
10879 install_element (ENABLE_NODE
, &show_ipv6_bgp_regexp_cmd
);
10880 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
10881 install_element (ENABLE_NODE
, &show_ipv6_bgp_filter_list_cmd
);
10882 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_all_cmd
);
10883 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_cmd
);
10884 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_cmd
);
10885 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_cmd
);
10886 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_cmd
);
10887 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_exact_cmd
);
10888 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
10889 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
10890 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
10891 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_cmd
);
10892 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
10893 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
10894 install_element (ENABLE_NODE
, &show_ipv6_mbgp_cmd
);
10895 install_element (ENABLE_NODE
, &show_ipv6_mbgp_route_cmd
);
10896 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_cmd
);
10897 install_element (ENABLE_NODE
, &show_ipv6_mbgp_regexp_cmd
);
10898 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
10899 install_element (ENABLE_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
10900 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_all_cmd
);
10901 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_cmd
);
10902 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_cmd
);
10903 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_cmd
);
10904 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_cmd
);
10905 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
10906 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
10907 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
10908 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
10909 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_cmd
);
10910 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
10911 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
10914 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
10915 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
10916 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
10917 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
10920 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
10921 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
10922 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
10923 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
10926 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
10927 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
10928 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
10929 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
10930 #endif /* HAVE_IPV6 */
10932 install_element (BGP_NODE
, &bgp_distance_cmd
);
10933 install_element (BGP_NODE
, &no_bgp_distance_cmd
);
10934 install_element (BGP_NODE
, &no_bgp_distance2_cmd
);
10935 install_element (BGP_NODE
, &bgp_distance_source_cmd
);
10936 install_element (BGP_NODE
, &no_bgp_distance_source_cmd
);
10937 install_element (BGP_NODE
, &bgp_distance_source_access_list_cmd
);
10938 install_element (BGP_NODE
, &no_bgp_distance_source_access_list_cmd
);
10940 install_element (BGP_NODE
, &bgp_damp_set_cmd
);
10941 install_element (BGP_NODE
, &bgp_damp_set2_cmd
);
10942 install_element (BGP_NODE
, &bgp_damp_set3_cmd
);
10943 install_element (BGP_NODE
, &bgp_damp_unset_cmd
);
10944 install_element (BGP_NODE
, &bgp_damp_unset2_cmd
);
10945 install_element (BGP_IPV4_NODE
, &bgp_damp_set_cmd
);
10946 install_element (BGP_IPV4_NODE
, &bgp_damp_set2_cmd
);
10947 install_element (BGP_IPV4_NODE
, &bgp_damp_set3_cmd
);
10948 install_element (BGP_IPV4_NODE
, &bgp_damp_unset_cmd
);
10949 install_element (BGP_IPV4_NODE
, &bgp_damp_unset2_cmd
);