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"
37 #include "bgpd/bgpd.h"
38 #include "bgpd/bgp_table.h"
39 #include "bgpd/bgp_route.h"
40 #include "bgpd/bgp_attr.h"
41 #include "bgpd/bgp_debug.h"
42 #include "bgpd/bgp_aspath.h"
43 #include "bgpd/bgp_regex.h"
44 #include "bgpd/bgp_community.h"
45 #include "bgpd/bgp_ecommunity.h"
46 #include "bgpd/bgp_clist.h"
47 #include "bgpd/bgp_packet.h"
48 #include "bgpd/bgp_filter.h"
49 #include "bgpd/bgp_fsm.h"
50 #include "bgpd/bgp_mplsvpn.h"
51 #include "bgpd/bgp_nexthop.h"
52 #include "bgpd/bgp_damp.h"
53 #include "bgpd/bgp_advertise.h"
54 #include "bgpd/bgp_zebra.h"
55 #include "bgpd/bgp_vty.h"
57 /* Extern from bgp_dump.c */
58 extern char *bgp_origin_str
[];
59 extern char *bgp_origin_long_str
[];
62 bgp_afi_node_get (struct bgp
*bgp
, afi_t afi
, safi_t safi
, struct prefix
*p
,
63 struct prefix_rd
*prd
)
66 struct bgp_node
*prn
= NULL
;
67 struct bgp_table
*table
;
69 if (safi
== SAFI_MPLS_VPN
)
71 prn
= bgp_node_get (bgp
->rib
[afi
][safi
], (struct prefix
*) prd
);
73 if (prn
->info
== NULL
)
74 prn
->info
= bgp_table_init ();
76 bgp_unlock_node (prn
);
80 table
= bgp
->rib
[afi
][safi
];
82 rn
= bgp_node_get (table
, p
);
84 if (safi
== SAFI_MPLS_VPN
)
90 /* Allocate new bgp info structure. */
96 new = XMALLOC (MTYPE_BGP_ROUTE
, sizeof (struct bgp_info
));
97 memset (new, 0, sizeof (struct bgp_info
));
102 /* Free bgp route information. */
104 bgp_info_free (struct bgp_info
*binfo
)
107 bgp_attr_unintern (binfo
->attr
);
109 if (binfo
->damp_info
)
110 bgp_damp_info_free (binfo
->damp_info
, 0);
112 XFREE (MTYPE_BGP_ROUTE
, binfo
);
116 bgp_info_add (struct bgp_node
*rn
, struct bgp_info
*ri
)
118 struct bgp_info
*top
;
130 bgp_info_delete (struct bgp_node
*rn
, struct bgp_info
*ri
)
133 ri
->next
->prev
= ri
->prev
;
135 ri
->prev
->next
= ri
->next
;
140 /* Get MED value. If MED value is missing and "bgp bestpath
141 missing-as-worst" is specified, treat it as the worst value. */
143 bgp_med_value (struct attr
*attr
, struct bgp
*bgp
)
145 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
149 if (bgp_flag_check (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
))
156 /* Compare two bgp route entity. br is preferable then return 1. */
158 bgp_info_cmp (struct bgp
*bgp
, struct bgp_info
*new, struct bgp_info
*exist
)
161 u_int32_t exist_pref
;
164 struct in_addr new_id
;
165 struct in_addr exist_id
;
168 int internal_as_route
= 0;
169 int confed_as_route
= 0;
170 int cost_community
= 0;
179 /* 1. Weight check. */
180 if (new->attr
->weight
> exist
->attr
->weight
)
182 if (new->attr
->weight
< exist
->attr
->weight
)
185 /* 2. Local preference check. */
186 if (new->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
187 new_pref
= new->attr
->local_pref
;
189 new_pref
= bgp
->default_local_pref
;
191 if (exist
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
192 exist_pref
= exist
->attr
->local_pref
;
194 exist_pref
= bgp
->default_local_pref
;
196 if (new_pref
> exist_pref
)
198 if (new_pref
< exist_pref
)
201 /* 3. Local route check. */
202 if (new->sub_type
== BGP_ROUTE_STATIC
)
204 if (exist
->sub_type
== BGP_ROUTE_STATIC
)
207 if (new->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
209 if (exist
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
212 if (new->sub_type
== BGP_ROUTE_AGGREGATE
)
214 if (exist
->sub_type
== BGP_ROUTE_AGGREGATE
)
217 /* 4. AS path length check. */
218 if (! bgp_flag_check (bgp
, BGP_FLAG_ASPATH_IGNORE
))
220 if (new->attr
->aspath
->count
< exist
->attr
->aspath
->count
)
222 if (new->attr
->aspath
->count
> exist
->attr
->aspath
->count
)
226 /* 5. Origin check. */
227 if (new->attr
->origin
< exist
->attr
->origin
)
229 if (new->attr
->origin
> exist
->attr
->origin
)
233 internal_as_route
= (new->attr
->aspath
->length
== 0
234 && exist
->attr
->aspath
->length
== 0);
235 confed_as_route
= (new->attr
->aspath
->length
> 0
236 && exist
->attr
->aspath
->length
> 0
237 && new->attr
->aspath
->count
== 0
238 && exist
->attr
->aspath
->count
== 0);
240 if (bgp_flag_check (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
)
241 || (bgp_flag_check (bgp
, BGP_FLAG_MED_CONFED
)
243 || aspath_cmp_left (new->attr
->aspath
, exist
->attr
->aspath
)
244 || aspath_cmp_left_confed (new->attr
->aspath
, exist
->attr
->aspath
)
245 || internal_as_route
)
247 new_med
= bgp_med_value (new->attr
, bgp
);
248 exist_med
= bgp_med_value (exist
->attr
, bgp
);
250 if (new_med
< exist_med
)
252 if (new_med
> exist_med
)
256 /* 7. Peer type check. */
257 if (peer_sort (new->peer
) == BGP_PEER_EBGP
258 && peer_sort (exist
->peer
) == BGP_PEER_IBGP
)
260 if (peer_sort (new->peer
) == BGP_PEER_EBGP
261 && peer_sort (exist
->peer
) == BGP_PEER_CONFED
)
263 if (peer_sort (new->peer
) == BGP_PEER_IBGP
264 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
266 if (peer_sort (new->peer
) == BGP_PEER_CONFED
267 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
270 /* 8. IGP metric check. */
271 if (new->igpmetric
< exist
->igpmetric
)
273 if (new->igpmetric
> exist
->igpmetric
)
276 /* 9. cost community check. */
277 if (! bgp_flag_check (bgp
, BGP_FLAG_COST_COMMUNITY_IGNORE
))
279 cost_community
= ecommunity_cost_cmp (new->attr
->ecommunity
,
280 exist
->attr
->ecommunity
, ECOMMUNITY_COST_POI_IGP
);
281 if (cost_community
> 0)
283 if (cost_community
< 0)
287 /* 10. Maximum path check. */
289 /* 11. If both paths are external, prefer the path that was received
290 first (the oldest one). This step minimizes route-flap, since a
291 newer path won't displace an older one, even if it was the
292 preferred route based on the additional decision criteria below. */
293 if (! bgp_flag_check (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
)
294 && peer_sort (new->peer
) == BGP_PEER_EBGP
295 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
297 if (CHECK_FLAG (new->flags
, BGP_INFO_SELECTED
))
299 if (CHECK_FLAG (exist
->flags
, BGP_INFO_SELECTED
))
303 /* 12. Rourter-ID comparision. */
304 if (new->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
305 new_id
.s_addr
= new->attr
->originator_id
.s_addr
;
307 new_id
.s_addr
= new->peer
->remote_id
.s_addr
;
308 if (exist
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
309 exist_id
.s_addr
= exist
->attr
->originator_id
.s_addr
;
311 exist_id
.s_addr
= exist
->peer
->remote_id
.s_addr
;
313 if (ntohl (new_id
.s_addr
) < ntohl (exist_id
.s_addr
))
315 if (ntohl (new_id
.s_addr
) > ntohl (exist_id
.s_addr
))
318 /* 13. Cluster length comparision. */
319 if (new->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
320 new_cluster
= new->attr
->cluster
->length
;
323 if (exist
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
324 exist_cluster
= exist
->attr
->cluster
->length
;
328 if (new_cluster
< exist_cluster
)
330 if (new_cluster
> exist_cluster
)
333 /* 14. Neighbor address comparision. */
334 ret
= sockunion_cmp (new->peer
->su_remote
, exist
->peer
->su_remote
);
345 bgp_input_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
346 afi_t afi
, safi_t safi
)
348 struct bgp_filter
*filter
;
350 filter
= &peer
->filter
[afi
][safi
];
352 if (DISTRIBUTE_IN_NAME (filter
))
353 if (access_list_apply (DISTRIBUTE_IN (filter
), p
) == FILTER_DENY
)
356 if (PREFIX_LIST_IN_NAME (filter
))
357 if (prefix_list_apply (PREFIX_LIST_IN (filter
), p
) == PREFIX_DENY
)
360 if (FILTER_LIST_IN_NAME (filter
))
361 if (as_list_apply (FILTER_LIST_IN (filter
), attr
->aspath
)== AS_FILTER_DENY
)
364 return FILTER_PERMIT
;
368 bgp_output_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
369 afi_t afi
, safi_t safi
)
371 struct bgp_filter
*filter
;
373 filter
= &peer
->filter
[afi
][safi
];
375 if (DISTRIBUTE_OUT_NAME (filter
))
376 if (access_list_apply (DISTRIBUTE_OUT (filter
), p
) == FILTER_DENY
)
379 if (PREFIX_LIST_OUT_NAME (filter
))
380 if (prefix_list_apply (PREFIX_LIST_OUT (filter
), p
) == PREFIX_DENY
)
383 if (FILTER_LIST_OUT_NAME (filter
))
384 if (as_list_apply (FILTER_LIST_OUT (filter
), attr
->aspath
) == AS_FILTER_DENY
)
387 return FILTER_PERMIT
;
390 /* If community attribute includes no_export then return 1. */
392 bgp_community_filter (struct peer
*peer
, struct attr
*attr
)
396 /* NO_ADVERTISE check. */
397 if (community_include (attr
->community
, COMMUNITY_NO_ADVERTISE
))
400 /* NO_EXPORT check. */
401 if (peer_sort (peer
) == BGP_PEER_EBGP
&&
402 community_include (attr
->community
, COMMUNITY_NO_EXPORT
))
405 /* NO_EXPORT_SUBCONFED check. */
406 if (peer_sort (peer
) == BGP_PEER_EBGP
407 || peer_sort (peer
) == BGP_PEER_CONFED
)
408 if (community_include (attr
->community
, COMMUNITY_NO_EXPORT_SUBCONFED
))
414 /* Route reflection loop check. */
416 bgp_cluster_filter (struct peer
*peer
, struct attr
*attr
)
418 struct in_addr cluster_id
;
422 if (peer
->bgp
->config
& BGP_CONFIG_CLUSTER_ID
)
423 cluster_id
= peer
->bgp
->cluster_id
;
425 cluster_id
= peer
->bgp
->router_id
;
427 if (cluster_loop_check (attr
->cluster
, cluster_id
))
434 bgp_input_modifier (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
435 afi_t afi
, safi_t safi
)
437 struct bgp_filter
*filter
;
438 struct bgp_info info
;
439 route_map_result_t ret
;
441 filter
= &peer
->filter
[afi
][safi
];
443 /* Apply default weight value. */
444 if (CHECK_FLAG (peer
->af_config
[afi
][safi
], PEER_AF_CONFIG_WEIGHT
))
445 attr
->weight
= peer
->weight
[afi
][safi
];
449 /* Route map apply. */
450 if (ROUTE_MAP_IN_NAME (filter
))
452 /* Duplicate current value to new strucutre for modification. */
456 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IN
);
458 /* Apply BGP route map to the attribute. */
459 ret
= route_map_apply (ROUTE_MAP_IN (filter
), p
, RMAP_BGP
, &info
);
463 if (ret
== RMAP_DENYMATCH
)
465 /* Free newly generated AS path and community by route-map. */
466 bgp_attr_flush (attr
);
474 bgp_announce_check (struct bgp_info
*ri
, struct peer
*peer
, struct prefix
*p
,
475 struct attr
*attr
, afi_t afi
, safi_t safi
)
478 char buf
[SU_ADDRSTRLEN
];
479 struct bgp_filter
*filter
;
480 struct bgp_info info
;
483 struct attr dummy_attr
;
488 filter
= &peer
->filter
[afi
][safi
];
491 #ifdef DISABLE_BGP_ANNOUNCE
495 /* Do not send back route to sender. */
499 /* Aggregate-address suppress check. */
501 if (! UNSUPPRESS_MAP_NAME (filter
))
504 /* Default route check. */
505 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
507 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
510 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
512 #endif /* HAVE_IPV6 */
515 /* Transparency check. */
516 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
)
517 && CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
522 /* If community is not disabled check the no-export and local. */
523 if (! transparent
&& bgp_community_filter (peer
, ri
->attr
))
526 /* If the attribute has originator-id and it is same as remote
528 if (ri
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
530 if (IPV4_ADDR_SAME (&peer
->remote_id
, &ri
->attr
->originator_id
))
532 if (BGP_DEBUG (filter
, FILTER
))
533 zlog (peer
->log
, LOG_INFO
,
534 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
536 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
542 /* ORF prefix-list filter check */
543 if (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
544 && (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
545 || CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
546 if (peer
->orf_plist
[afi
][safi
])
548 if (prefix_list_apply (peer
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
552 /* Output filter check. */
553 if (bgp_output_filter (peer
, p
, ri
->attr
, afi
, safi
) == FILTER_DENY
)
555 if (BGP_DEBUG (filter
, FILTER
))
556 zlog (peer
->log
, LOG_INFO
,
557 "%s [Update:SEND] %s/%d is filtered",
559 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
564 #ifdef BGP_SEND_ASPATH_CHECK
565 /* AS path loop check. */
566 if (aspath_loop_check (ri
->attr
->aspath
, peer
->as
))
568 if (BGP_DEBUG (filter
, FILTER
))
569 zlog (peer
->log
, LOG_INFO
,
570 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
571 peer
->host
, peer
->as
);
574 #endif /* BGP_SEND_ASPATH_CHECK */
576 /* If we're a CONFED we need to loop check the CONFED ID too */
577 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
579 if (aspath_loop_check(ri
->attr
->aspath
, bgp
->confed_id
))
581 if (BGP_DEBUG (filter
, FILTER
))
582 zlog (peer
->log
, LOG_INFO
,
583 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
590 /* Route-Reflect check. */
591 if (peer_sort (from
) == BGP_PEER_IBGP
&& peer_sort (peer
) == BGP_PEER_IBGP
)
596 /* IBGP reflection check. */
599 /* A route from a Client peer. */
600 if (CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
602 /* Reflect to all the Non-Client peers and also to the
603 Client peers other than the originator. Originator check
604 is already done. So there is noting to do. */
605 /* no bgp client-to-client reflection check. */
606 if (bgp_flag_check (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
))
607 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
612 /* A route from a Non-client peer. Reflect to all other
614 if (! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
619 /* For modify attribute, copy it to temporary structure. */
622 /* If local-preference is not set. */
623 if ((peer_sort (peer
) == BGP_PEER_IBGP
624 || peer_sort (peer
) == BGP_PEER_CONFED
)
625 && (! (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))))
627 attr
->flag
|= ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
);
628 attr
->local_pref
= bgp
->default_local_pref
;
631 /* Remove MED if its an EBGP peer - will get overwritten by route-maps */
632 if (peer_sort (peer
) == BGP_PEER_EBGP
633 && attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
635 if (ri
->peer
!= bgp
->peer_self
&& ! transparent
636 && ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
637 attr
->flag
&= ~(ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
));
641 if (transparent
|| reflect
642 || (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
)
643 && ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
)
645 || (p
->family
== AF_INET6
&& ri
->peer
!= bgp
->peer_self
)
646 #endif /* HAVE_IPV6 */
649 /* NEXT-HOP Unchanged. */
651 else if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
652 || (p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
654 || (p
->family
== AF_INET6
&& ri
->peer
== bgp
->peer_self
)
655 #endif /* HAVE_IPV6 */
656 || (peer_sort (peer
) == BGP_PEER_EBGP
657 && bgp_multiaccess_check_v4 (attr
->nexthop
, peer
->host
) == 0))
659 /* Set IPv4 nexthop. */
660 if (p
->family
== AF_INET
)
662 if (safi
== SAFI_MPLS_VPN
)
663 memcpy (&attr
->mp_nexthop_global_in
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
665 memcpy (&attr
->nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
668 /* Set IPv6 nexthop. */
669 if (p
->family
== AF_INET6
)
671 /* IPv6 global nexthop must be included. */
672 memcpy (&attr
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
674 attr
->mp_nexthop_len
= 16;
676 #endif /* HAVE_IPV6 */
680 if (p
->family
== AF_INET6
)
682 /* Link-local address should not be transit to different peer. */
683 attr
->mp_nexthop_len
= 16;
685 /* Set link-local address for shared network peer. */
686 if (peer
->shared_network
687 && ! IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
689 memcpy (&attr
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
691 attr
->mp_nexthop_len
= 32;
694 /* If bgpd act as BGP-4+ route-reflector, do not send link-local
697 attr
->mp_nexthop_len
= 16;
699 /* If BGP-4+ link-local nexthop is not link-local nexthop. */
700 if (! IN6_IS_ADDR_LINKLOCAL (&peer
->nexthop
.v6_local
))
701 attr
->mp_nexthop_len
= 16;
703 #endif /* HAVE_IPV6 */
705 /* If this is EBGP peer and remove-private-AS is set. */
706 if (peer_sort (peer
) == BGP_PEER_EBGP
707 && peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
)
708 && aspath_private_as_check (attr
->aspath
))
709 attr
->aspath
= aspath_empty_get ();
711 /* Route map & unsuppress-map apply. */
712 if (ROUTE_MAP_OUT_NAME (filter
)
718 /* The route reflector is not allowed to modify the attributes
719 of the reflected IBGP routes. */
720 if (peer_sort (from
) == BGP_PEER_IBGP
721 && peer_sort (peer
) == BGP_PEER_IBGP
)
724 info
.attr
= &dummy_attr
;
727 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_OUT
);
730 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
732 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
736 if (ret
== RMAP_DENYMATCH
)
738 bgp_attr_flush (attr
);
746 bgp_process (struct bgp
*bgp
, struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
750 struct bgp_info
*new_select
;
751 struct bgp_info
*old_select
;
755 struct bgp_info
*ri1
;
756 struct bgp_info
*ri2
;
760 /* bgp deterministic-med */
762 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
763 for (ri1
= rn
->info
; ri1
; ri1
= ri1
->next
)
765 if (CHECK_FLAG (ri1
->flags
, BGP_INFO_DMED_CHECK
))
767 if (BGP_INFO_HOLDDOWN (ri1
))
772 for (ri2
= ri1
->next
; ri2
; ri2
= ri2
->next
)
774 if (CHECK_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
))
776 if (BGP_INFO_HOLDDOWN (ri2
))
779 if (aspath_cmp_left (ri1
->attr
->aspath
, ri2
->attr
->aspath
)
780 || aspath_cmp_left_confed (ri1
->attr
->aspath
,
783 if (bgp_info_cmp (bgp
, ri2
, new_select
))
785 UNSET_FLAG (new_select
->flags
, BGP_INFO_DMED_SELECTED
);
789 SET_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
);
792 SET_FLAG (new_select
->flags
, BGP_INFO_DMED_CHECK
);
793 SET_FLAG (new_select
->flags
, BGP_INFO_DMED_SELECTED
);
796 /* Check old selected route and new selected route. */
799 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
801 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
804 if (BGP_INFO_HOLDDOWN (ri
))
807 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
)
808 && (! CHECK_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
)))
810 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_CHECK
);
813 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_CHECK
);
814 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
);
816 if (bgp_info_cmp (bgp
, ri
, new_select
))
821 if (old_select
&& old_select
== new_select
)
823 if (! CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
825 if (CHECK_FLAG (old_select
->flags
, BGP_INFO_IGP_CHANGED
))
826 bgp_zebra_announce (p
, old_select
, bgp
);
832 UNSET_FLAG (old_select
->flags
, BGP_INFO_SELECTED
);
835 SET_FLAG (new_select
->flags
, BGP_INFO_SELECTED
);
836 UNSET_FLAG (new_select
->flags
, BGP_INFO_ATTR_CHANGED
);
839 /* Check each BGP peer. */
840 LIST_LOOP (bgp
->peer
, peer
, nn
)
842 /* Announce route to Established peer. */
843 if (peer
->status
!= Established
)
846 /* Address family configuration check. */
847 if (! peer
->afc_nego
[afi
][safi
])
850 /* First update is deferred until ORF or ROUTE-REFRESH is received */
851 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
854 /* Announcement to peer->conf. If the route is filtered,
857 && bgp_announce_check (new_select
, peer
, p
, &attr
, afi
, safi
))
858 bgp_adj_out_set (rn
, peer
, p
, &attr
, afi
, safi
, new_select
);
860 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
864 if (safi
== SAFI_UNICAST
&& ! bgp
->name
&&
865 ! bgp_option_check (BGP_OPT_NO_FIB
))
868 && new_select
->type
== ZEBRA_ROUTE_BGP
869 && new_select
->sub_type
== BGP_ROUTE_NORMAL
)
870 bgp_zebra_announce (p
, new_select
, bgp
);
873 /* Withdraw the route from the kernel. */
875 && old_select
->type
== ZEBRA_ROUTE_BGP
876 && old_select
->sub_type
== BGP_ROUTE_NORMAL
)
877 bgp_zebra_withdraw (p
, old_select
);
884 bgp_maximum_prefix_restart_timer (struct thread
*thread
)
888 peer
= THREAD_ARG (thread
);
889 peer
->t_pmax_restart
= NULL
;
891 if (BGP_DEBUG (events
, EVENTS
))
892 zlog_info ("%s Maximum-prefix restart timer expired, restore peering", peer
->host
);
900 bgp_maximum_prefix_overflow (struct peer
*peer
, afi_t afi
, safi_t safi
, int always
)
902 if (! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
905 if (peer
->pcount
[afi
][safi
] > peer
->pmax
[afi
][safi
])
907 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
)
911 zlog (peer
->log
, LOG_INFO
,
912 "%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, limit %ld",
913 afi_safi_print (afi
, safi
), peer
->host
, peer
->pcount
[afi
][safi
],
914 peer
->pmax
[afi
][safi
]);
915 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
917 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
923 ndata
[0] = (u_char
)(afi
>> 8);
924 ndata
[1] = (u_char
) afi
;
925 ndata
[3] = (u_char
)(peer
->pmax
[afi
][safi
] >> 24);
926 ndata
[4] = (u_char
)(peer
->pmax
[afi
][safi
] >> 16);
927 ndata
[5] = (u_char
)(peer
->pmax
[afi
][safi
] >> 8);
928 ndata
[6] = (u_char
)(peer
->pmax
[afi
][safi
]);
930 if (safi
== SAFI_MPLS_VPN
)
931 safi
= BGP_SAFI_VPNV4
;
932 ndata
[2] = (u_char
) safi
;
934 SET_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
);
935 bgp_notify_send_with_data (peer
, BGP_NOTIFY_CEASE
,
936 BGP_NOTIFY_CEASE_MAX_PREFIX
, ndata
, 7);
939 /* restart timer start */
940 if (peer
->pmax_restart
[afi
][safi
])
942 peer
->v_pmax_restart
= peer
->pmax_restart
[afi
][safi
] * 60;
944 if (BGP_DEBUG (events
, EVENTS
))
945 zlog_info ("%s Maximum-prefix restart timer started for %d secs",
946 peer
->host
, peer
->v_pmax_restart
);
948 BGP_TIMER_ON (peer
->t_pmax_restart
, bgp_maximum_prefix_restart_timer
,
949 peer
->v_pmax_restart
);
955 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
957 if (peer
->pcount
[afi
][safi
] > (peer
->pmax
[afi
][safi
] * peer
->pmax_threshold
[afi
][safi
] / 100))
959 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
)
963 zlog (peer
->log
, LOG_INFO
,
964 "%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld",
965 afi_safi_print (afi
, safi
), peer
->host
, peer
->pcount
[afi
][safi
],
966 peer
->pmax
[afi
][safi
]);
967 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
970 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
976 bgp_rib_remove (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
977 afi_t afi
, safi_t safi
)
979 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
981 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
982 peer
->pcount
[afi
][safi
]--;
983 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
984 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
985 bgp_process (peer
->bgp
, rn
, afi
, safi
);
987 bgp_info_delete (rn
, ri
);
989 bgp_unlock_node (rn
);
993 bgp_rib_withdraw (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
994 afi_t afi
, safi_t safi
, int force
)
997 int status
= BGP_DAMP_NONE
;
999 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1001 peer
->pcount
[afi
][safi
]--;
1002 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1007 if (CHECK_FLAG (peer
->bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1008 && peer_sort (peer
) == BGP_PEER_EBGP
)
1009 status
= bgp_damp_withdraw (ri
, rn
, afi
, safi
, 0);
1011 if (status
== BGP_DAMP_SUPPRESSED
)
1015 valid
= CHECK_FLAG (ri
->flags
, BGP_INFO_VALID
);
1016 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1017 bgp_process (peer
->bgp
, rn
, afi
, safi
);
1020 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1022 if (status
!= BGP_DAMP_USED
)
1024 bgp_info_delete (rn
, ri
);
1026 bgp_unlock_node (rn
);
1031 bgp_update (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
1032 afi_t afi
, safi_t safi
, int type
, int sub_type
,
1033 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
1036 int aspath_loop_count
= 0;
1037 struct bgp_node
*rn
;
1039 struct attr new_attr
;
1040 struct attr
*attr_new
;
1041 struct bgp_info
*ri
;
1042 struct bgp_info
*new;
1044 char buf
[SU_ADDRSTRLEN
];
1047 rn
= bgp_afi_node_get (bgp
, afi
, safi
, p
, prd
);
1049 /* When peer's soft reconfiguration enabled. Record input packet in
1051 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
1052 && peer
!= bgp
->peer_self
&& ! soft_reconfig
)
1053 bgp_adj_in_set (rn
, peer
, attr
);
1055 /* Check previously received route. */
1056 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1057 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1060 /* AS path local-as loop check. */
1061 if (peer
->change_local_as
)
1063 if (! CHECK_FLAG (peer
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
1064 aspath_loop_count
= 1;
1066 if (aspath_loop_check (attr
->aspath
, peer
->change_local_as
) > aspath_loop_count
)
1068 reason
= "as-path contains our own AS;";
1073 /* AS path loop check. */
1074 if (aspath_loop_check (attr
->aspath
, bgp
->as
) > peer
->allowas_in
[afi
][safi
]
1075 || (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
1076 && aspath_loop_check(attr
->aspath
, bgp
->confed_id
)
1077 > peer
->allowas_in
[afi
][safi
]))
1079 reason
= "as-path contains our own AS;";
1083 /* Route reflector originator ID check. */
1084 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
1085 && IPV4_ADDR_SAME (&bgp
->router_id
, &attr
->originator_id
))
1087 reason
= "originator is us;";
1091 /* Route reflector cluster ID check. */
1092 if (bgp_cluster_filter (peer
, attr
))
1094 reason
= "reflected from the same cluster;";
1098 /* Apply incoming filter. */
1099 if (bgp_input_filter (peer
, p
, attr
, afi
, safi
) == FILTER_DENY
)
1105 /* Apply incoming route-map. */
1108 if (bgp_input_modifier (peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1110 reason
= "route-map;";
1114 /* IPv4 unicast next hop check. */
1115 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
1117 /* If the peer is EBGP and nexthop is not on connected route,
1119 if (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
== 1
1120 && ! bgp_nexthop_check_ebgp (afi
, &new_attr
)
1121 && ! CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
))
1123 reason
= "non-connected next-hop;";
1127 /* Next hop must not be 0.0.0.0 nor Class E address. Next hop
1128 must not be my own address. */
1129 if (bgp_nexthop_self (afi
, &new_attr
)
1130 || new_attr
.nexthop
.s_addr
== 0
1131 || ntohl (new_attr
.nexthop
.s_addr
) >= 0xe0000000)
1133 reason
= "martian next-hop;";
1138 attr_new
= bgp_attr_intern (&new_attr
);
1140 /* If the update is implicit withdraw. */
1143 ri
->uptime
= time (NULL
);
1145 /* Same attribute comes in. */
1146 if (attrhash_cmp (ri
->attr
, attr_new
))
1148 UNSET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1150 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1151 && peer_sort (peer
) == BGP_PEER_EBGP
1152 && CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1154 if (BGP_DEBUG (update
, UPDATE_IN
))
1155 zlog (peer
->log
, LOG_INFO
, "%s rcvd %s/%d",
1157 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1160 peer
->pcount
[afi
][safi
]++;
1161 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
1162 if (ret
!= BGP_DAMP_SUPPRESSED
)
1164 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
1165 bgp_process (bgp
, rn
, afi
, safi
);
1170 if (BGP_DEBUG (update
, UPDATE_IN
))
1171 zlog (peer
->log
, LOG_INFO
,
1172 "%s rcvd %s/%d...duplicate ignored",
1174 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1177 /* graceful restart STALE flag unset. */
1178 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
1180 UNSET_FLAG (ri
->flags
, BGP_INFO_STALE
);
1181 peer
->pcount
[afi
][safi
]++;
1185 bgp_unlock_node (rn
);
1186 bgp_attr_unintern (attr_new
);
1190 /* Received Logging. */
1191 if (BGP_DEBUG (update
, UPDATE_IN
))
1192 zlog (peer
->log
, LOG_INFO
, "%s rcvd %s/%d",
1194 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1197 /* graceful restart STALE flag unset. */
1198 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
1200 UNSET_FLAG (ri
->flags
, BGP_INFO_STALE
);
1201 peer
->pcount
[afi
][safi
]++;
1204 /* The attribute is changed. */
1205 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1207 /* Update bgp route dampening information. */
1208 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1209 && peer_sort (peer
) == BGP_PEER_EBGP
)
1211 /* This is implicit withdraw so we should update dampening
1213 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1214 bgp_damp_withdraw (ri
, rn
, afi
, safi
, 1);
1216 peer
->pcount
[afi
][safi
]++;
1219 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
1221 /* Update to new attribute. */
1222 bgp_attr_unintern (ri
->attr
);
1223 ri
->attr
= attr_new
;
1225 /* Update MPLS tag. */
1226 if (safi
== SAFI_MPLS_VPN
)
1227 memcpy (ri
->tag
, tag
, 3);
1229 /* Update bgp route dampening information. */
1230 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1231 && peer_sort (peer
) == BGP_PEER_EBGP
)
1233 /* Now we do normal update dampening. */
1234 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
1235 if (ret
== BGP_DAMP_SUPPRESSED
)
1237 bgp_unlock_node (rn
);
1242 /* Nexthop reachability check. */
1243 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
1244 && safi
== SAFI_UNICAST
1245 && (peer_sort (peer
) == BGP_PEER_IBGP
1246 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
1247 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
1249 if (bgp_nexthop_lookup (afi
, peer
, ri
, NULL
, NULL
))
1250 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1252 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1255 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1257 /* Process change. */
1258 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
1260 bgp_process (bgp
, rn
, afi
, safi
);
1261 bgp_unlock_node (rn
);
1265 /* Received Logging. */
1266 if (BGP_DEBUG (update
, UPDATE_IN
))
1268 zlog (peer
->log
, LOG_INFO
, "%s rcvd %s/%d",
1270 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1274 /* Increment prefix counter */
1275 peer
->pcount
[afi
][safi
]++;
1277 /* Make new BGP info. */
1278 new = bgp_info_new ();
1280 new->sub_type
= sub_type
;
1282 new->attr
= attr_new
;
1283 new->uptime
= time (NULL
);
1285 /* Update MPLS tag. */
1286 if (safi
== SAFI_MPLS_VPN
)
1287 memcpy (new->tag
, tag
, 3);
1289 /* Nexthop reachability check. */
1290 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
1291 && safi
== SAFI_UNICAST
1292 && (peer_sort (peer
) == BGP_PEER_IBGP
1293 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
1294 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
1296 if (bgp_nexthop_lookup (afi
, peer
, new, NULL
, NULL
))
1297 SET_FLAG (new->flags
, BGP_INFO_VALID
);
1299 UNSET_FLAG (new->flags
, BGP_INFO_VALID
);
1302 SET_FLAG (new->flags
, BGP_INFO_VALID
);
1304 /* Aggregate address increment. */
1305 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
1307 /* Register new BGP information. */
1308 bgp_info_add (rn
, new);
1310 /* If maximum prefix count is configured and current prefix
1312 if (bgp_maximum_prefix_overflow (peer
, afi
, safi
, 0))
1315 /* Process change. */
1316 bgp_process (bgp
, rn
, afi
, safi
);
1320 /* This BGP update is filtered. Log the reason then update BGP
1323 if (BGP_DEBUG (update
, UPDATE_IN
))
1324 zlog (peer
->log
, LOG_INFO
,
1325 "%s rcvd UPDATE about %s/%d -- DENIED due to: %s",
1327 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1328 p
->prefixlen
, reason
);
1331 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
, 1);
1333 bgp_unlock_node (rn
);
1339 bgp_withdraw (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
1340 int afi
, int safi
, int type
, int sub_type
, struct prefix_rd
*prd
,
1344 char buf
[SU_ADDRSTRLEN
];
1345 struct bgp_node
*rn
;
1346 struct bgp_info
*ri
;
1351 if (BGP_DEBUG (update
, UPDATE_IN
))
1352 zlog (peer
->log
, LOG_INFO
, "%s rcvd UPDATE about %s/%d -- withdrawn",
1354 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1358 rn
= bgp_afi_node_get (bgp
, afi
, safi
, p
, prd
);
1360 /* If peer is soft reconfiguration enabled. Record input packet for
1361 further calculation. */
1362 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
1363 && peer
!= bgp
->peer_self
)
1364 bgp_adj_in_unset (rn
, peer
);
1366 /* Lookup withdrawn route. */
1367 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1368 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1371 /* Withdraw specified route from routing table. */
1372 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1373 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
, 0);
1374 else if (BGP_DEBUG (update
, UPDATE_IN
))
1375 zlog (peer
->log
, LOG_INFO
,
1376 "%s Can't find the route %s/%d", peer
->host
,
1377 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1380 /* Unlock bgp_node_get() lock. */
1381 bgp_unlock_node (rn
);
1387 bgp_default_originate (struct peer
*peer
, afi_t afi
, safi_t safi
, int withdraw
)
1391 struct aspath
*aspath
;
1393 struct bgp_info binfo
;
1395 int ret
= RMAP_DENYMATCH
;
1398 from
= bgp
->peer_self
;
1400 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
1401 aspath
= attr
.aspath
;
1402 attr
.local_pref
= bgp
->default_local_pref
;
1403 memcpy (&attr
.nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
1406 str2prefix ("0.0.0.0/0", &p
);
1408 else if (afi
== AFI_IP6
)
1410 str2prefix ("::/0", &p
);
1412 /* IPv6 global nexthop must be included. */
1413 memcpy (&attr
.mp_nexthop_global
, &peer
->nexthop
.v6_global
,
1415 attr
.mp_nexthop_len
= 16;
1417 /* If the peer is on shared nextwork and we have link-local
1419 if (peer
->shared_network
1420 && !IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
1422 memcpy (&attr
.mp_nexthop_local
, &peer
->nexthop
.v6_local
,
1424 attr
.mp_nexthop_len
= 32;
1427 #endif /* HAVE_IPV6 */
1431 if (peer
->default_rmap
[afi
][safi
].name
)
1433 binfo
.peer
= bgp
->peer_self
;
1436 ret
= route_map_apply (peer
->default_rmap
[afi
][safi
].map
, &p
,
1439 if (ret
== RMAP_DENYMATCH
)
1441 bgp_attr_flush (&attr
);
1448 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
1449 bgp_default_withdraw_send (peer
, afi
, safi
);
1450 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
1454 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
1455 bgp_default_update_send (peer
, &attr
, afi
, safi
, from
);
1458 aspath_unintern (aspath
);
1462 bgp_announce_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
1463 struct bgp_table
*table
)
1465 struct bgp_node
*rn
;
1466 struct bgp_info
*ri
;
1470 table
= peer
->bgp
->rib
[afi
][safi
];
1472 if (safi
!= SAFI_MPLS_VPN
1473 && CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
1474 bgp_default_originate (peer
, afi
, safi
, 0);
1476 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next(rn
))
1477 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1478 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
) && ri
->peer
!= peer
)
1480 if (bgp_announce_check (ri
, peer
, &rn
->p
, &attr
, afi
, safi
))
1481 bgp_adj_out_set (rn
, peer
, &rn
->p
, &attr
, afi
, safi
, ri
);
1483 bgp_adj_out_unset (rn
, peer
, &rn
->p
, afi
, safi
);
1488 bgp_announce_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
1490 struct bgp_node
*rn
;
1491 struct bgp_table
*table
;
1493 if (peer
->status
!= Established
)
1496 if (! peer
->afc_nego
[afi
][safi
])
1499 /* First update is deferred until ORF or ROUTE-REFRESH is received */
1500 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
1503 if (safi
!= SAFI_MPLS_VPN
)
1504 bgp_announce_table (peer
, afi
, safi
, NULL
);
1506 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
1507 rn
= bgp_route_next(rn
))
1508 if ((table
= (rn
->info
)) != NULL
)
1509 bgp_announce_table (peer
, afi
, safi
, table
);
1511 if (! peer
->t_routeadv
[afi
][safi
])
1512 bgp_routeadv_timer (peer
, afi
, safi
);
1516 bgp_announce_route_all (struct peer
*peer
)
1521 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1522 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1523 bgp_announce_route (peer
, afi
, safi
);
1527 bgp_soft_reconfig_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
1528 struct bgp_table
*table
)
1531 struct bgp_node
*rn
;
1532 struct bgp_adj_in
*ain
;
1535 table
= peer
->bgp
->rib
[afi
][safi
];
1537 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
1538 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
1540 if (ain
->peer
== peer
)
1542 ret
= bgp_update (peer
, &rn
->p
, ain
->attr
, afi
, safi
,
1543 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
,
1547 bgp_unlock_node (rn
);
1556 bgp_soft_reconfig_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
1558 struct bgp_node
*rn
;
1559 struct bgp_table
*table
;
1561 if (peer
->status
!= Established
)
1564 if (safi
!= SAFI_MPLS_VPN
)
1565 bgp_soft_reconfig_table (peer
, afi
, safi
, NULL
);
1567 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
1568 rn
= bgp_route_next (rn
))
1569 if ((table
= rn
->info
) != NULL
)
1570 bgp_soft_reconfig_table (peer
, afi
, safi
, table
);
1574 bgp_clear_route_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
1575 struct bgp_table
*table
)
1577 struct bgp_node
*rn
;
1578 struct bgp_adj_in
*ain
;
1579 struct bgp_adj_out
*aout
;
1580 struct bgp_info
*ri
;
1583 table
= peer
->bgp
->rib
[afi
][safi
];
1585 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
1587 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1588 if (ri
->peer
== peer
)
1590 /* graceful restart STALE flag set. */
1591 if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_NSF_WAIT
)
1592 && peer
->nsf
[afi
][safi
]
1593 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
)
1594 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
)
1595 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
))
1597 SET_FLAG (ri
->flags
, BGP_INFO_STALE
);
1598 peer
->pcount
[afi
][safi
]--;
1601 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
1604 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
1605 if (ain
->peer
== peer
)
1607 bgp_adj_in_remove (rn
, ain
);
1608 bgp_unlock_node (rn
);
1611 for (aout
= rn
->adj_out
; aout
; aout
= aout
->next
)
1612 if (aout
->peer
== peer
)
1614 bgp_adj_out_remove (rn
, aout
, peer
, afi
, safi
);
1615 bgp_unlock_node (rn
);
1622 bgp_clear_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
1624 struct bgp_node
*rn
;
1625 struct bgp_table
*table
;
1627 if (safi
!= SAFI_MPLS_VPN
)
1628 bgp_clear_route_table (peer
, afi
, safi
, NULL
);
1630 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
1631 rn
= bgp_route_next (rn
))
1632 if ((table
= rn
->info
) != NULL
)
1633 bgp_clear_route_table (peer
, afi
, safi
, table
);
1637 bgp_clear_route_all (struct peer
*peer
)
1642 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1643 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1644 bgp_clear_route (peer
, afi
, safi
);
1648 bgp_clear_adj_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
1650 struct bgp_table
*table
;
1651 struct bgp_node
*rn
;
1652 struct bgp_adj_in
*ain
;
1654 table
= peer
->bgp
->rib
[afi
][safi
];
1656 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
1657 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
1658 if (ain
->peer
== peer
)
1660 bgp_adj_in_remove (rn
, ain
);
1661 bgp_unlock_node (rn
);
1667 bgp_clear_stale_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
1669 struct bgp_node
*rn
;
1670 struct bgp_info
*ri
;
1671 struct bgp_table
*table
;
1673 table
= peer
->bgp
->rib
[afi
][safi
];
1675 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
1677 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1678 if (ri
->peer
== peer
)
1680 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
1681 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
1687 /* Delete all kernel routes. */
1692 struct listnode
*nn
;
1693 struct bgp_node
*rn
;
1694 struct bgp_table
*table
;
1695 struct bgp_info
*ri
;
1697 LIST_LOOP (bm
->bgp
, bgp
, nn
)
1699 table
= bgp
->rib
[AFI_IP
][SAFI_UNICAST
];
1701 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
1702 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1703 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
1704 && ri
->type
== ZEBRA_ROUTE_BGP
1705 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
1706 bgp_zebra_withdraw (&rn
->p
, ri
);
1708 table
= bgp
->rib
[AFI_IP6
][SAFI_UNICAST
];
1710 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
1711 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1712 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
1713 && ri
->type
== ZEBRA_ROUTE_BGP
1714 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
1715 bgp_zebra_withdraw (&rn
->p
, ri
);
1723 bgp_zclient_reset ();
1724 access_list_reset ();
1725 prefix_list_reset ();
1728 /* Parse NLRI stream. Withdraw NLRI is recognized by NULL attr
1731 bgp_nlri_parse (struct peer
*peer
, struct attr
*attr
, struct bgp_nlri
*packet
)
1739 /* Check peer status. */
1740 if (peer
->status
!= Established
)
1744 lim
= pnt
+ packet
->length
;
1746 for (; pnt
< lim
; pnt
+= psize
)
1748 /* Clear prefix structure. */
1749 memset (&p
, 0, sizeof (struct prefix
));
1751 /* Fetch prefix length. */
1752 p
.prefixlen
= *pnt
++;
1753 p
.family
= afi2family (packet
->afi
);
1755 /* Already checked in nlri_sanity_check(). We do double check
1757 if ((packet
->afi
== AFI_IP
&& p
.prefixlen
> 32)
1758 || (packet
->afi
== AFI_IP6
&& p
.prefixlen
> 128))
1761 /* Packet size overflow check. */
1762 psize
= PSIZE (p
.prefixlen
);
1764 /* When packet overflow occur return immediately. */
1765 if (pnt
+ psize
> lim
)
1768 /* Fetch prefix from NLRI packet. */
1769 memcpy (&p
.u
.prefix
, pnt
, psize
);
1771 /* Check address. */
1772 if (packet
->afi
== AFI_IP
&& packet
->safi
== SAFI_UNICAST
)
1774 if (IN_CLASSD (ntohl (p
.u
.prefix4
.s_addr
)))
1776 zlog (peer
->log
, LOG_ERR
,
1777 "IPv4 unicast NLRI is multicast address %s",
1778 inet_ntoa (p
.u
.prefix4
));
1779 bgp_notify_send (peer
,
1780 BGP_NOTIFY_UPDATE_ERR
,
1781 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
1787 /* Check address. */
1788 if (packet
->afi
== AFI_IP6
&& packet
->safi
== SAFI_UNICAST
)
1790 if (IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
1794 zlog (peer
->log
, LOG_WARNING
,
1795 "IPv6 link-local NLRI received %s ignore this NLRI",
1796 inet_ntop (AF_INET6
, &p
.u
.prefix6
, buf
, BUFSIZ
));
1801 #endif /* HAVE_IPV6 */
1803 /* Normal process. */
1805 ret
= bgp_update (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
1806 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
, 0);
1808 ret
= bgp_withdraw (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
1809 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
1811 /* Address family configuration mismatch or maximum-prefix count
1817 /* Packet length consistency check. */
1824 /* NLRI encode syntax check routine. */
1826 bgp_nlri_sanity_check (struct peer
*peer
, int afi
, u_char
*pnt
,
1835 /* RFC1771 6.3 The NLRI field in the UPDATE message is checked for
1836 syntactic validity. If the field is syntactically incorrect,
1837 then the Error Subcode is set to Invalid Network Field. */
1843 /* Prefix length check. */
1844 if ((afi
== AFI_IP
&& prefixlen
> 32)
1845 || (afi
== AFI_IP6
&& prefixlen
> 128))
1847 plog_err (peer
->log
,
1848 "%s [Error] Update packet error (wrong prefix length %d)",
1849 peer
->host
, prefixlen
);
1850 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
1851 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
1855 /* Packet size overflow check. */
1856 psize
= PSIZE (prefixlen
);
1858 if (pnt
+ psize
> end
)
1860 plog_err (peer
->log
,
1861 "%s [Error] Update packet error"
1862 " (prefix data overflow prefix size is %d)",
1864 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
1865 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
1872 /* Packet length consistency check. */
1875 plog_err (peer
->log
,
1876 "%s [Error] Update packet error"
1877 " (prefix length mismatch with total length)",
1879 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
1880 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
1889 struct bgp_static
*new;
1890 new = XMALLOC (MTYPE_BGP_STATIC
, sizeof (struct bgp_static
));
1891 memset (new, 0, sizeof (struct bgp_static
));
1896 bgp_static_free (struct bgp_static
*bgp_static
)
1898 if (bgp_static
->rmap
.name
)
1899 free (bgp_static
->rmap
.name
);
1900 XFREE (MTYPE_BGP_STATIC
, bgp_static
);
1904 bgp_static_update (struct bgp
*bgp
, struct prefix
*p
,
1905 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
1907 struct bgp_node
*rn
;
1908 struct bgp_info
*ri
;
1909 struct bgp_info
*new;
1910 struct bgp_info info
;
1912 struct attr attr_tmp
;
1913 struct attr
*attr_new
;
1916 rn
= bgp_afi_node_get (bgp
, afi
, safi
, p
, NULL
);
1918 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
1921 attr
.nexthop
= bgp_static
->igpnexthop
;
1922 attr
.med
= bgp_static
->igpmetric
;
1923 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
1926 /* Apply route-map. */
1927 if (bgp_static
->rmap
.name
)
1930 info
.peer
= bgp
->peer_self
;
1931 info
.attr
= &attr_tmp
;
1933 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
1935 if (ret
== RMAP_DENYMATCH
)
1937 /* Free uninterned attribute. */
1938 bgp_attr_flush (&attr_tmp
);
1940 /* Unintern original. */
1941 aspath_unintern (attr
.aspath
);
1942 bgp_static_withdraw (bgp
, p
, afi
, safi
);
1945 attr_new
= bgp_attr_intern (&attr_tmp
);
1948 attr_new
= bgp_attr_intern (&attr
);
1950 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1951 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
1952 && ri
->sub_type
== BGP_ROUTE_STATIC
)
1957 if (attrhash_cmp (ri
->attr
, attr_new
))
1959 bgp_unlock_node (rn
);
1960 bgp_attr_unintern (attr_new
);
1961 aspath_unintern (attr
.aspath
);
1966 /* The attribute is changed. */
1967 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1969 /* Rewrite BGP route information. */
1970 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
1971 bgp_attr_unintern (ri
->attr
);
1972 ri
->attr
= attr_new
;
1973 ri
->uptime
= time (NULL
);
1975 /* Process change. */
1976 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
1977 bgp_process (bgp
, rn
, afi
, safi
);
1978 bgp_unlock_node (rn
);
1979 aspath_unintern (attr
.aspath
);
1984 /* Make new BGP info. */
1985 new = bgp_info_new ();
1986 new->type
= ZEBRA_ROUTE_BGP
;
1987 new->sub_type
= BGP_ROUTE_STATIC
;
1988 new->peer
= bgp
->peer_self
;
1989 SET_FLAG (new->flags
, BGP_INFO_VALID
);
1990 new->attr
= attr_new
;
1991 new->uptime
= time (NULL
);
1993 /* Aggregate address increment. */
1994 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
1996 /* Register new BGP information. */
1997 bgp_info_add (rn
, new);
1999 /* Process change. */
2000 bgp_process (bgp
, rn
, afi
, safi
);
2002 /* Unintern original. */
2003 aspath_unintern (attr
.aspath
);
2007 bgp_static_update_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
2008 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
2010 struct bgp_node
*rn
;
2011 struct bgp_info
*new;
2013 rn
= bgp_afi_node_get (bgp
, afi
, safi
, p
, prd
);
2015 /* Make new BGP info. */
2016 new = bgp_info_new ();
2017 new->type
= ZEBRA_ROUTE_BGP
;
2018 new->sub_type
= BGP_ROUTE_STATIC
;
2019 new->peer
= bgp
->peer_self
;
2020 new->attr
= bgp_attr_default_intern (BGP_ORIGIN_IGP
);
2021 SET_FLAG (new->flags
, BGP_INFO_VALID
);
2022 new->uptime
= time (NULL
);
2023 memcpy (new->tag
, tag
, 3);
2025 /* Aggregate address increment. */
2026 bgp_aggregate_increment (bgp
, p
, (struct bgp_info
*) new, afi
, safi
);
2028 /* Register new BGP information. */
2029 bgp_info_add (rn
, (struct bgp_info
*) new);
2031 /* Process change. */
2032 bgp_process (bgp
, rn
, afi
, safi
);
2036 bgp_static_withdraw (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
2039 struct bgp_node
*rn
;
2040 struct bgp_info
*ri
;
2042 rn
= bgp_afi_node_get (bgp
, afi
, safi
, p
, NULL
);
2044 /* Check selected route and self inserted route. */
2045 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2046 if (ri
->peer
== bgp
->peer_self
2047 && ri
->type
== ZEBRA_ROUTE_BGP
2048 && ri
->sub_type
== BGP_ROUTE_STATIC
)
2051 /* Withdraw static BGP route from routing table. */
2054 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
2055 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2056 bgp_process (bgp
, rn
, afi
, safi
);
2057 bgp_info_delete (rn
, ri
);
2059 bgp_unlock_node (rn
);
2062 /* Unlock bgp_node_lookup. */
2063 bgp_unlock_node (rn
);
2067 bgp_static_withdraw_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
2068 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
2070 struct bgp_node
*rn
;
2071 struct bgp_info
*ri
;
2073 rn
= bgp_afi_node_get (bgp
, afi
, safi
, p
, prd
);
2075 /* Check selected route and self inserted route. */
2076 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2077 if (ri
->peer
== bgp
->peer_self
2078 && ri
->type
== ZEBRA_ROUTE_BGP
2079 && ri
->sub_type
== BGP_ROUTE_STATIC
)
2082 /* Withdraw static BGP route from routing table. */
2085 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
2086 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2087 bgp_process (bgp
, rn
, afi
, safi
);
2088 bgp_info_delete (rn
, ri
);
2090 bgp_unlock_node (rn
);
2093 /* Unlock bgp_node_lookup. */
2094 bgp_unlock_node (rn
);
2097 /* Configure static BGP network. When user don't run zebra, static
2098 route should be installed as valid. */
2100 bgp_static_set (struct vty
*vty
, struct bgp
*bgp
, char *ip_str
, u_int16_t afi
,
2101 u_char safi
, char *rmap
, int backdoor
)
2105 struct bgp_static
*bgp_static
;
2106 struct bgp_node
*rn
;
2107 int need_update
= 0;
2109 /* Convert IP prefix string to struct prefix. */
2110 ret
= str2prefix (ip_str
, &p
);
2113 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
2117 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
2119 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
2123 #endif /* HAVE_IPV6 */
2127 /* Set BGP static route configuration. */
2128 rn
= bgp_node_get (bgp
->route
[afi
][safi
], &p
);
2132 /* Configuration change. */
2133 bgp_static
= rn
->info
;
2135 /* Check previous routes are installed into BGP. */
2136 if (! bgp_static
->backdoor
&& bgp_static
->valid
)
2139 bgp_static
->backdoor
= backdoor
;
2142 if (bgp_static
->rmap
.name
)
2143 free (bgp_static
->rmap
.name
);
2144 bgp_static
->rmap
.name
= strdup (rmap
);
2145 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
2149 if (bgp_static
->rmap
.name
)
2150 free (bgp_static
->rmap
.name
);
2151 bgp_static
->rmap
.name
= NULL
;
2152 bgp_static
->rmap
.map
= NULL
;
2153 bgp_static
->valid
= 0;
2155 bgp_unlock_node (rn
);
2159 /* New configuration. */
2160 bgp_static
= bgp_static_new ();
2161 bgp_static
->backdoor
= backdoor
;
2162 bgp_static
->valid
= 0;
2163 bgp_static
->igpmetric
= 0;
2164 bgp_static
->igpnexthop
.s_addr
= 0;
2167 if (bgp_static
->rmap
.name
)
2168 free (bgp_static
->rmap
.name
);
2169 bgp_static
->rmap
.name
= strdup (rmap
);
2170 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
2172 rn
->info
= bgp_static
;
2175 /* If BGP scan is not enabled, we should install this route here. */
2176 if (! bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
2178 bgp_static
->valid
= 1;
2181 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
2183 if (! bgp_static
->backdoor
)
2184 bgp_static_update (bgp
, &p
, bgp_static
, afi
, safi
);
2190 /* Configure static BGP network. */
2192 bgp_static_unset (struct vty
*vty
, struct bgp
*bgp
, char *ip_str
,
2193 u_int16_t afi
, u_char safi
)
2197 struct bgp_static
*bgp_static
;
2198 struct bgp_node
*rn
;
2200 /* Convert IP prefix string to struct prefix. */
2201 ret
= str2prefix (ip_str
, &p
);
2204 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
2208 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
2210 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
2214 #endif /* HAVE_IPV6 */
2218 rn
= bgp_node_lookup (bgp
->route
[afi
][safi
], &p
);
2221 vty_out (vty
, "%% Can't find specified static route configuration.%s",
2226 bgp_static
= rn
->info
;
2228 /* Update BGP RIB. */
2229 if (! bgp_static
->backdoor
)
2230 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
2232 /* Clear configuration. */
2233 bgp_static_free (bgp_static
);
2235 bgp_unlock_node (rn
);
2236 bgp_unlock_node (rn
);
2241 /* Called from bgp_delete(). Delete all static routes from the BGP
2244 bgp_static_delete (struct bgp
*bgp
)
2248 struct bgp_node
*rn
;
2249 struct bgp_node
*rm
;
2250 struct bgp_table
*table
;
2251 struct bgp_static
*bgp_static
;
2253 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2254 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2255 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
2256 if (rn
->info
!= NULL
)
2258 if (safi
== SAFI_MPLS_VPN
)
2262 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
2264 bgp_static
= rn
->info
;
2265 bgp_static_withdraw_vpnv4 (bgp
, &rm
->p
,
2266 AFI_IP
, SAFI_MPLS_VPN
,
2267 (struct prefix_rd
*)&rn
->p
,
2269 bgp_static_free (bgp_static
);
2271 bgp_unlock_node (rn
);
2276 bgp_static
= rn
->info
;
2277 bgp_static_withdraw (bgp
, &rn
->p
, afi
, safi
);
2278 bgp_static_free (bgp_static
);
2280 bgp_unlock_node (rn
);
2286 bgp_static_set_vpnv4 (struct vty
*vty
, char *ip_str
, char *rd_str
,
2291 struct prefix_rd prd
;
2293 struct bgp_node
*prn
;
2294 struct bgp_node
*rn
;
2295 struct bgp_table
*table
;
2296 struct bgp_static
*bgp_static
;
2301 ret
= str2prefix (ip_str
, &p
);
2304 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
2309 ret
= str2prefix_rd (rd_str
, &prd
);
2312 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
2316 ret
= str2tag (tag_str
, tag
);
2319 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
2323 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
2324 (struct prefix
*)&prd
);
2325 if (prn
->info
== NULL
)
2326 prn
->info
= bgp_table_init ();
2328 bgp_unlock_node (prn
);
2331 rn
= bgp_node_get (table
, &p
);
2335 vty_out (vty
, "%% Same network configuration exists%s", VTY_NEWLINE
);
2336 bgp_unlock_node (rn
);
2340 /* New configuration. */
2341 bgp_static
= bgp_static_new ();
2342 bgp_static
->valid
= 1;
2343 memcpy (bgp_static
->tag
, tag
, 3);
2344 rn
->info
= bgp_static
;
2346 bgp_static_update_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
2352 /* Configure static BGP network. */
2354 bgp_static_unset_vpnv4 (struct vty
*vty
, char *ip_str
, char *rd_str
,
2360 struct prefix_rd prd
;
2361 struct bgp_node
*prn
;
2362 struct bgp_node
*rn
;
2363 struct bgp_table
*table
;
2364 struct bgp_static
*bgp_static
;
2369 /* Convert IP prefix string to struct prefix. */
2370 ret
= str2prefix (ip_str
, &p
);
2373 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
2378 ret
= str2prefix_rd (rd_str
, &prd
);
2381 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
2385 ret
= str2tag (tag_str
, tag
);
2388 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
2392 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
2393 (struct prefix
*)&prd
);
2394 if (prn
->info
== NULL
)
2395 prn
->info
= bgp_table_init ();
2397 bgp_unlock_node (prn
);
2400 rn
= bgp_node_lookup (table
, &p
);
2404 bgp_static_withdraw_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
2406 bgp_static
= rn
->info
;
2407 bgp_static_free (bgp_static
);
2409 bgp_unlock_node (rn
);
2410 bgp_unlock_node (rn
);
2413 vty_out (vty
, "%% Can't find the route%s", VTY_NEWLINE
);
2420 "network A.B.C.D/M",
2421 "Specify a network to announce via BGP\n"
2422 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
2424 return bgp_static_set (vty
, vty
->index
, argv
[0],
2425 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
2428 DEFUN (bgp_network_route_map
,
2429 bgp_network_route_map_cmd
,
2430 "network A.B.C.D/M route-map WORD",
2431 "Specify a network to announce via BGP\n"
2432 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2433 "Route-map to modify the attributes\n"
2434 "Name of the route map\n")
2436 return bgp_static_set (vty
, vty
->index
, argv
[0],
2437 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
2440 DEFUN (bgp_network_backdoor
,
2441 bgp_network_backdoor_cmd
,
2442 "network A.B.C.D/M backdoor",
2443 "Specify a network to announce via BGP\n"
2444 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2445 "Specify a BGP backdoor route\n")
2447 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
2450 DEFUN (bgp_network_mask
,
2451 bgp_network_mask_cmd
,
2452 "network A.B.C.D mask A.B.C.D",
2453 "Specify a network to announce via BGP\n"
2459 char prefix_str
[BUFSIZ
];
2461 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
2464 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2468 return bgp_static_set (vty
, vty
->index
, prefix_str
,
2469 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
2472 DEFUN (bgp_network_mask_route_map
,
2473 bgp_network_mask_route_map_cmd
,
2474 "network A.B.C.D mask A.B.C.D route-map WORD",
2475 "Specify a network to announce via BGP\n"
2479 "Route-map to modify the attributes\n"
2480 "Name of the route map\n")
2483 char prefix_str
[BUFSIZ
];
2485 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
2488 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2492 return bgp_static_set (vty
, vty
->index
, prefix_str
,
2493 AFI_IP
, bgp_node_safi (vty
), argv
[2], 0);
2496 DEFUN (bgp_network_mask_backdoor
,
2497 bgp_network_mask_backdoor_cmd
,
2498 "network A.B.C.D mask A.B.C.D backdoor",
2499 "Specify a network to announce via BGP\n"
2503 "Specify a BGP backdoor route\n")
2506 char prefix_str
[BUFSIZ
];
2508 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
2511 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2515 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
, NULL
, 1);
2518 DEFUN (bgp_network_mask_natural
,
2519 bgp_network_mask_natural_cmd
,
2521 "Specify a network to announce via BGP\n"
2525 char prefix_str
[BUFSIZ
];
2527 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
2530 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2534 return bgp_static_set (vty
, vty
->index
, prefix_str
,
2535 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
2538 DEFUN (bgp_network_mask_natural_route_map
,
2539 bgp_network_mask_natural_route_map_cmd
,
2540 "network A.B.C.D route-map WORD",
2541 "Specify a network to announce via BGP\n"
2543 "Route-map to modify the attributes\n"
2544 "Name of the route map\n")
2547 char prefix_str
[BUFSIZ
];
2549 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
2552 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2556 return bgp_static_set (vty
, vty
->index
, prefix_str
,
2557 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
2560 DEFUN (bgp_network_mask_natural_backdoor
,
2561 bgp_network_mask_natural_backdoor_cmd
,
2562 "network A.B.C.D backdoor",
2563 "Specify a network to announce via BGP\n"
2565 "Specify a BGP backdoor route\n")
2568 char prefix_str
[BUFSIZ
];
2570 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
2573 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2577 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
, NULL
, 1);
2580 DEFUN (no_bgp_network
,
2582 "no network A.B.C.D/M",
2584 "Specify a network to announce via BGP\n"
2585 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
2587 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP
,
2588 bgp_node_safi (vty
));
2591 ALIAS (no_bgp_network
,
2592 no_bgp_network_route_map_cmd
,
2593 "no network A.B.C.D/M route-map WORD",
2595 "Specify a network to announce via BGP\n"
2596 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2597 "Route-map to modify the attributes\n"
2598 "Name of the route map\n");
2600 ALIAS (no_bgp_network
,
2601 no_bgp_network_backdoor_cmd
,
2602 "no network A.B.C.D/M backdoor",
2604 "Specify a network to announce via BGP\n"
2605 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2606 "Specify a BGP backdoor route\n");
2608 DEFUN (no_bgp_network_mask
,
2609 no_bgp_network_mask_cmd
,
2610 "no network A.B.C.D mask A.B.C.D",
2612 "Specify a network to announce via BGP\n"
2618 char prefix_str
[BUFSIZ
];
2620 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
2623 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2627 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
2628 bgp_node_safi (vty
));
2631 ALIAS (no_bgp_network_mask
,
2632 no_bgp_network_mask_route_map_cmd
,
2633 "no network A.B.C.D mask A.B.C.D route-map WORD",
2635 "Specify a network to announce via BGP\n"
2639 "Route-map to modify the attributes\n"
2640 "Name of the route map\n");
2642 ALIAS (no_bgp_network_mask
,
2643 no_bgp_network_mask_backdoor_cmd
,
2644 "no network A.B.C.D mask A.B.C.D backdoor",
2646 "Specify a network to announce via BGP\n"
2650 "Specify a BGP backdoor route\n");
2652 DEFUN (no_bgp_network_mask_natural
,
2653 no_bgp_network_mask_natural_cmd
,
2654 "no network A.B.C.D",
2656 "Specify a network to announce via BGP\n"
2660 char prefix_str
[BUFSIZ
];
2662 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
2665 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2669 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
2670 bgp_node_safi (vty
));
2673 ALIAS (no_bgp_network_mask_natural
,
2674 no_bgp_network_mask_natural_route_map_cmd
,
2675 "no network A.B.C.D route-map WORD",
2677 "Specify a network to announce via BGP\n"
2679 "Route-map to modify the attributes\n"
2680 "Name of the route map\n");
2682 ALIAS (no_bgp_network_mask_natural
,
2683 no_bgp_network_mask_natural_backdoor_cmd
,
2684 "no network A.B.C.D backdoor",
2686 "Specify a network to announce via BGP\n"
2688 "Specify a BGP backdoor route\n");
2691 DEFUN (ipv6_bgp_network
,
2692 ipv6_bgp_network_cmd
,
2693 "network X:X::X:X/M",
2694 "Specify a network to announce via BGP\n"
2695 "IPv6 prefix <network>/<length>\n")
2697 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
2700 DEFUN (ipv6_bgp_network_route_map
,
2701 ipv6_bgp_network_route_map_cmd
,
2702 "network X:X::X:X/M route-map WORD",
2703 "Specify a network to announce via BGP\n"
2704 "IPv6 prefix <network>/<length>\n"
2705 "Route-map to modify the attributes\n"
2706 "Name of the route map\n")
2708 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
,
2709 bgp_node_safi (vty
), argv
[1], 0);
2712 DEFUN (no_ipv6_bgp_network
,
2713 no_ipv6_bgp_network_cmd
,
2714 "no network X:X::X:X/M",
2716 "Specify a network to announce via BGP\n"
2717 "IPv6 prefix <network>/<length>\n")
2719 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
2722 ALIAS (no_ipv6_bgp_network
,
2723 no_ipv6_bgp_network_route_map_cmd
,
2724 "no network X:X::X:X/M route-map WORD",
2726 "Specify a network to announce via BGP\n"
2727 "IPv6 prefix <network>/<length>\n"
2728 "Route-map to modify the attributes\n"
2729 "Name of the route map\n");
2731 ALIAS (ipv6_bgp_network
,
2732 old_ipv6_bgp_network_cmd
,
2733 "ipv6 bgp network X:X::X:X/M",
2736 "Specify a network to announce via BGP\n"
2737 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n");
2739 ALIAS (no_ipv6_bgp_network
,
2740 old_no_ipv6_bgp_network_cmd
,
2741 "no ipv6 bgp network X:X::X:X/M",
2745 "Specify a network to announce via BGP\n"
2746 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n");
2747 #endif /* HAVE_IPV6 */
2749 /* Aggreagete address:
2751 advertise-map Set condition to advertise attribute
2752 as-set Generate AS set path information
2753 attribute-map Set attributes of aggregate
2754 route-map Set parameters of aggregate
2755 summary-only Filter more specific routes from updates
2756 suppress-map Conditionally filter more specific routes from updates
2759 struct bgp_aggregate
2761 /* Summary-only flag. */
2762 u_char summary_only
;
2764 /* AS set generation. */
2767 /* Route-map for aggregated route. */
2768 struct route_map
*map
;
2770 /* Suppress-count. */
2771 unsigned long count
;
2773 /* SAFI configuration. */
2777 struct bgp_aggregate
*
2778 bgp_aggregate_new ()
2780 struct bgp_aggregate
*new;
2781 new = XMALLOC (MTYPE_BGP_AGGREGATE
, sizeof (struct bgp_aggregate
));
2782 memset (new, 0, sizeof (struct bgp_aggregate
));
2787 bgp_aggregate_free (struct bgp_aggregate
*aggregate
)
2789 XFREE (MTYPE_BGP_AGGREGATE
, aggregate
);
2793 bgp_aggregate_route (struct bgp
*bgp
, struct prefix
*p
, struct bgp_info
*rinew
,
2794 afi_t afi
, safi_t safi
, struct bgp_info
*del
,
2795 struct bgp_aggregate
*aggregate
)
2797 struct bgp_table
*table
;
2798 struct bgp_node
*top
;
2799 struct bgp_node
*rn
;
2801 struct aspath
*aspath
= NULL
;
2802 struct aspath
*asmerge
= NULL
;
2803 struct community
*community
= NULL
;
2804 struct community
*commerge
= NULL
;
2805 struct in_addr nexthop
;
2807 struct bgp_info
*ri
;
2808 struct bgp_info
*new;
2810 unsigned long match
= 0;
2812 /* Record adding route's nexthop and med. */
2815 nexthop
= rinew
->attr
->nexthop
;
2816 med
= rinew
->attr
->med
;
2819 /* ORIGIN attribute: If at least one route among routes that are
2820 aggregated has ORIGIN with the value INCOMPLETE, then the
2821 aggregated route must have the ORIGIN attribute with the value
2822 INCOMPLETE. Otherwise, if at least one route among routes that
2823 are aggregated has ORIGIN with the value EGP, then the aggregated
2824 route must have the origin attribute with the value EGP. In all
2825 other case the value of the ORIGIN attribute of the aggregated
2826 route is INTERNAL. */
2827 origin
= BGP_ORIGIN_IGP
;
2829 table
= bgp
->rib
[afi
][safi
];
2831 top
= bgp_node_get (table
, p
);
2832 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
2833 if (rn
->p
.prefixlen
> p
->prefixlen
)
2837 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2839 if (BGP_INFO_HOLDDOWN (ri
))
2842 if (del
&& ri
== del
)
2845 if (! rinew
&& first
)
2847 nexthop
= ri
->attr
->nexthop
;
2848 med
= ri
->attr
->med
;
2852 #ifdef AGGREGATE_NEXTHOP_CHECK
2853 if (! IPV4_ADDR_SAME (&ri
->attr
->nexthop
, &nexthop
)
2854 || ri
->attr
->med
!= med
)
2857 aspath_free (aspath
);
2859 community_free (community
);
2860 bgp_unlock_node (rn
);
2861 bgp_unlock_node (top
);
2864 #endif /* AGGREGATE_NEXTHOP_CHECK */
2866 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
2868 if (aggregate
->summary_only
)
2871 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
2877 if (aggregate
->as_set
)
2879 if (origin
< ri
->attr
->origin
)
2880 origin
= ri
->attr
->origin
;
2884 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
2885 aspath_free (aspath
);
2889 aspath
= aspath_dup (ri
->attr
->aspath
);
2891 if (ri
->attr
->community
)
2895 commerge
= community_merge (community
,
2896 ri
->attr
->community
);
2897 community
= community_uniq_sort (commerge
);
2898 community_free (commerge
);
2901 community
= community_dup (ri
->attr
->community
);
2907 bgp_process (bgp
, rn
, afi
, safi
);
2909 bgp_unlock_node (top
);
2915 if (aggregate
->summary_only
)
2918 if (aggregate
->as_set
)
2920 if (origin
< rinew
->attr
->origin
)
2921 origin
= rinew
->attr
->origin
;
2925 asmerge
= aspath_aggregate (aspath
, rinew
->attr
->aspath
);
2926 aspath_free (aspath
);
2930 aspath
= aspath_dup (rinew
->attr
->aspath
);
2932 if (rinew
->attr
->community
)
2936 commerge
= community_merge (community
,
2937 rinew
->attr
->community
);
2938 community
= community_uniq_sort (commerge
);
2939 community_free (commerge
);
2942 community
= community_dup (rinew
->attr
->community
);
2947 if (aggregate
->count
> 0)
2949 rn
= bgp_node_get (table
, p
);
2950 new = bgp_info_new ();
2951 new->type
= ZEBRA_ROUTE_BGP
;
2952 new->sub_type
= BGP_ROUTE_AGGREGATE
;
2953 new->peer
= bgp
->peer_self
;
2954 SET_FLAG (new->flags
, BGP_INFO_VALID
);
2955 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
2956 new->uptime
= time (NULL
);
2958 bgp_info_add (rn
, new);
2959 bgp_process (bgp
, rn
, afi
, safi
);
2964 aspath_free (aspath
);
2966 community_free (community
);
2970 void bgp_aggregate_delete (struct bgp
*, struct prefix
*, afi_t
, safi_t
,
2971 struct bgp_aggregate
*);
2974 bgp_aggregate_increment (struct bgp
*bgp
, struct prefix
*p
,
2975 struct bgp_info
*ri
, afi_t afi
, safi_t safi
)
2977 struct bgp_node
*child
;
2978 struct bgp_node
*rn
;
2979 struct bgp_aggregate
*aggregate
;
2981 /* MPLS-VPN aggregation is not yet supported. */
2982 if (safi
== SAFI_MPLS_VPN
)
2985 if (p
->prefixlen
== 0)
2988 if (BGP_INFO_HOLDDOWN (ri
))
2991 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
2993 /* Aggregate address configuration check. */
2994 for (rn
= child
; rn
; rn
= rn
->parent
)
2995 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
2997 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
2998 bgp_aggregate_route (bgp
, &rn
->p
, ri
, afi
, safi
, NULL
, aggregate
);
3000 bgp_unlock_node (child
);
3004 bgp_aggregate_decrement (struct bgp
*bgp
, struct prefix
*p
,
3005 struct bgp_info
*del
, afi_t afi
, safi_t safi
)
3007 struct bgp_node
*child
;
3008 struct bgp_node
*rn
;
3009 struct bgp_aggregate
*aggregate
;
3011 /* MPLS-VPN aggregation is not yet supported. */
3012 if (safi
== SAFI_MPLS_VPN
)
3015 if (p
->prefixlen
== 0)
3018 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
3020 /* Aggregate address configuration check. */
3021 for (rn
= child
; rn
; rn
= rn
->parent
)
3022 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
3024 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
3025 bgp_aggregate_route (bgp
, &rn
->p
, NULL
, afi
, safi
, del
, aggregate
);
3027 bgp_unlock_node (child
);
3031 bgp_aggregate_add (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
, safi_t safi
,
3032 struct bgp_aggregate
*aggregate
)
3034 struct bgp_table
*table
;
3035 struct bgp_node
*top
;
3036 struct bgp_node
*rn
;
3037 struct bgp_info
*new;
3038 struct bgp_info
*ri
;
3039 unsigned long match
;
3040 u_char origin
= BGP_ORIGIN_IGP
;
3041 struct aspath
*aspath
= NULL
;
3042 struct aspath
*asmerge
= NULL
;
3043 struct community
*community
= NULL
;
3044 struct community
*commerge
= NULL
;
3046 table
= bgp
->rib
[afi
][safi
];
3049 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
3051 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
3054 /* If routes exists below this node, generate aggregate routes. */
3055 top
= bgp_node_get (table
, p
);
3056 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
3057 if (rn
->p
.prefixlen
> p
->prefixlen
)
3061 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3063 if (BGP_INFO_HOLDDOWN (ri
))
3066 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
3068 /* summary-only aggregate route suppress aggregated
3069 route announcement. */
3070 if (aggregate
->summary_only
)
3073 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
3076 /* as-set aggregate route generate origin, as path,
3077 community aggregation. */
3078 if (aggregate
->as_set
)
3080 if (origin
< ri
->attr
->origin
)
3081 origin
= ri
->attr
->origin
;
3085 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
3086 aspath_free (aspath
);
3090 aspath
= aspath_dup (ri
->attr
->aspath
);
3092 if (ri
->attr
->community
)
3096 commerge
= community_merge (community
,
3097 ri
->attr
->community
);
3098 community
= community_uniq_sort (commerge
);
3099 community_free (commerge
);
3102 community
= community_dup (ri
->attr
->community
);
3109 /* If this node is suppressed, process the change. */
3111 bgp_process (bgp
, rn
, afi
, safi
);
3113 bgp_unlock_node (top
);
3115 /* Add aggregate route to BGP table. */
3116 if (aggregate
->count
)
3118 rn
= bgp_node_get (table
, p
);
3120 new = bgp_info_new ();
3121 new->type
= ZEBRA_ROUTE_BGP
;
3122 new->sub_type
= BGP_ROUTE_AGGREGATE
;
3123 new->peer
= bgp
->peer_self
;
3124 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3125 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
3126 new->uptime
= time (NULL
);
3128 bgp_info_add (rn
, new);
3130 /* Process change. */
3131 bgp_process (bgp
, rn
, afi
, safi
);
3136 bgp_aggregate_delete (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3137 safi_t safi
, struct bgp_aggregate
*aggregate
)
3139 struct bgp_table
*table
;
3140 struct bgp_node
*top
;
3141 struct bgp_node
*rn
;
3142 struct bgp_info
*ri
;
3143 unsigned long match
;
3145 table
= bgp
->rib
[afi
][safi
];
3147 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
3149 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
3152 /* If routes exists below this node, generate aggregate routes. */
3153 top
= bgp_node_get (table
, p
);
3154 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
3155 if (rn
->p
.prefixlen
> p
->prefixlen
)
3159 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3161 if (BGP_INFO_HOLDDOWN (ri
))
3164 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
3166 if (aggregate
->summary_only
)
3170 if (ri
->suppress
== 0)
3172 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
3180 /* If this node is suppressed, process the change. */
3182 bgp_process (bgp
, rn
, afi
, safi
);
3184 bgp_unlock_node (top
);
3186 /* Delete aggregate route from BGP table. */
3187 rn
= bgp_node_get (table
, p
);
3189 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3190 if (ri
->peer
== bgp
->peer_self
3191 && ri
->type
== ZEBRA_ROUTE_BGP
3192 && ri
->sub_type
== BGP_ROUTE_AGGREGATE
)
3195 /* Withdraw static BGP route from routing table. */
3198 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
3199 bgp_process (bgp
, rn
, afi
, safi
);
3200 bgp_info_delete (rn
, ri
);
3202 bgp_unlock_node (rn
);
3205 /* Unlock bgp_node_lookup. */
3206 bgp_unlock_node (rn
);
3209 /* Aggregate route attribute. */
3210 #define AGGREGATE_SUMMARY_ONLY 1
3211 #define AGGREGATE_AS_SET 1
3214 bgp_aggregate_set (struct vty
*vty
, char *prefix_str
, afi_t afi
, safi_t safi
,
3215 u_char summary_only
, u_char as_set
)
3219 struct bgp_node
*rn
;
3221 struct bgp_aggregate
*aggregate
;
3223 /* Convert string to prefix structure. */
3224 ret
= str2prefix (prefix_str
, &p
);
3227 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
3232 /* Get BGP structure. */
3235 /* Old configuration check. */
3236 rn
= bgp_node_get (bgp
->aggregate
[afi
][safi
], &p
);
3240 vty_out (vty
, "There is already same aggregate network.%s", VTY_NEWLINE
);
3241 bgp_unlock_node (rn
);
3245 /* Make aggregate address structure. */
3246 aggregate
= bgp_aggregate_new ();
3247 aggregate
->summary_only
= summary_only
;
3248 aggregate
->as_set
= as_set
;
3249 aggregate
->safi
= safi
;
3250 rn
->info
= aggregate
;
3252 /* Aggregate address insert into BGP routing table. */
3253 if (safi
& SAFI_UNICAST
)
3254 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
3255 if (safi
& SAFI_MULTICAST
)
3256 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
3262 bgp_aggregate_unset (struct vty
*vty
, char *prefix_str
, afi_t afi
, safi_t safi
)
3266 struct bgp_node
*rn
;
3268 struct bgp_aggregate
*aggregate
;
3270 /* Convert string to prefix structure. */
3271 ret
= str2prefix (prefix_str
, &p
);
3274 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
3279 /* Get BGP structure. */
3282 /* Old configuration check. */
3283 rn
= bgp_node_lookup (bgp
->aggregate
[afi
][safi
], &p
);
3286 vty_out (vty
, "%% There is no aggregate-address configuration.%s",
3291 aggregate
= rn
->info
;
3292 if (aggregate
->safi
& SAFI_UNICAST
)
3293 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
3294 if (aggregate
->safi
& SAFI_MULTICAST
)
3295 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
3297 /* Unlock aggregate address configuration. */
3299 bgp_aggregate_free (aggregate
);
3300 bgp_unlock_node (rn
);
3301 bgp_unlock_node (rn
);
3306 DEFUN (aggregate_address
,
3307 aggregate_address_cmd
,
3308 "aggregate-address A.B.C.D/M",
3309 "Configure BGP aggregate entries\n"
3310 "Aggregate prefix\n")
3312 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
), 0, 0);
3315 DEFUN (aggregate_address_mask
,
3316 aggregate_address_mask_cmd
,
3317 "aggregate-address A.B.C.D A.B.C.D",
3318 "Configure BGP aggregate entries\n"
3319 "Aggregate address\n"
3323 char prefix_str
[BUFSIZ
];
3325 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3329 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3333 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
3337 DEFUN (aggregate_address_summary_only
,
3338 aggregate_address_summary_only_cmd
,
3339 "aggregate-address A.B.C.D/M summary-only",
3340 "Configure BGP aggregate entries\n"
3341 "Aggregate prefix\n"
3342 "Filter more specific routes from updates\n")
3344 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
3345 AGGREGATE_SUMMARY_ONLY
, 0);
3348 DEFUN (aggregate_address_mask_summary_only
,
3349 aggregate_address_mask_summary_only_cmd
,
3350 "aggregate-address A.B.C.D A.B.C.D summary-only",
3351 "Configure BGP aggregate entries\n"
3352 "Aggregate address\n"
3354 "Filter more specific routes from updates\n")
3357 char prefix_str
[BUFSIZ
];
3359 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3363 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3367 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
3368 AGGREGATE_SUMMARY_ONLY
, 0);
3371 DEFUN (aggregate_address_as_set
,
3372 aggregate_address_as_set_cmd
,
3373 "aggregate-address A.B.C.D/M as-set",
3374 "Configure BGP aggregate entries\n"
3375 "Aggregate prefix\n"
3376 "Generate AS set path information\n")
3378 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
3379 0, AGGREGATE_AS_SET
);
3382 DEFUN (aggregate_address_mask_as_set
,
3383 aggregate_address_mask_as_set_cmd
,
3384 "aggregate-address A.B.C.D A.B.C.D as-set",
3385 "Configure BGP aggregate entries\n"
3386 "Aggregate address\n"
3388 "Generate AS set path information\n")
3391 char prefix_str
[BUFSIZ
];
3393 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3397 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3401 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
3402 0, AGGREGATE_AS_SET
);
3406 DEFUN (aggregate_address_as_set_summary
,
3407 aggregate_address_as_set_summary_cmd
,
3408 "aggregate-address A.B.C.D/M as-set summary-only",
3409 "Configure BGP aggregate entries\n"
3410 "Aggregate prefix\n"
3411 "Generate AS set path information\n"
3412 "Filter more specific routes from updates\n")
3414 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
3415 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
3418 ALIAS (aggregate_address_as_set_summary
,
3419 aggregate_address_summary_as_set_cmd
,
3420 "aggregate-address A.B.C.D/M summary-only as-set",
3421 "Configure BGP aggregate entries\n"
3422 "Aggregate prefix\n"
3423 "Filter more specific routes from updates\n"
3424 "Generate AS set path information\n");
3426 DEFUN (aggregate_address_mask_as_set_summary
,
3427 aggregate_address_mask_as_set_summary_cmd
,
3428 "aggregate-address A.B.C.D A.B.C.D as-set summary-only",
3429 "Configure BGP aggregate entries\n"
3430 "Aggregate address\n"
3432 "Generate AS set path information\n"
3433 "Filter more specific routes from updates\n")
3436 char prefix_str
[BUFSIZ
];
3438 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3442 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3446 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
3447 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
3450 ALIAS (aggregate_address_mask_as_set_summary
,
3451 aggregate_address_mask_summary_as_set_cmd
,
3452 "aggregate-address A.B.C.D A.B.C.D summary-only as-set",
3453 "Configure BGP aggregate entries\n"
3454 "Aggregate address\n"
3456 "Filter more specific routes from updates\n"
3457 "Generate AS set path information\n");
3459 DEFUN (no_aggregate_address
,
3460 no_aggregate_address_cmd
,
3461 "no aggregate-address A.B.C.D/M",
3463 "Configure BGP aggregate entries\n"
3464 "Aggregate prefix\n")
3466 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
));
3469 ALIAS (no_aggregate_address
,
3470 no_aggregate_address_summary_only_cmd
,
3471 "no aggregate-address A.B.C.D/M summary-only",
3473 "Configure BGP aggregate entries\n"
3474 "Aggregate prefix\n"
3475 "Filter more specific routes from updates\n");
3477 ALIAS (no_aggregate_address
,
3478 no_aggregate_address_as_set_cmd
,
3479 "no aggregate-address A.B.C.D/M as-set",
3481 "Configure BGP aggregate entries\n"
3482 "Aggregate prefix\n"
3483 "Generate AS set path information\n");
3485 ALIAS (no_aggregate_address
,
3486 no_aggregate_address_as_set_summary_cmd
,
3487 "no aggregate-address A.B.C.D/M as-set summary-only",
3489 "Configure BGP aggregate entries\n"
3490 "Aggregate prefix\n"
3491 "Generate AS set path information\n"
3492 "Filter more specific routes from updates\n");
3494 ALIAS (no_aggregate_address
,
3495 no_aggregate_address_summary_as_set_cmd
,
3496 "no aggregate-address A.B.C.D/M summary-only as-set",
3498 "Configure BGP aggregate entries\n"
3499 "Aggregate prefix\n"
3500 "Filter more specific routes from updates\n"
3501 "Generate AS set path information\n");
3503 DEFUN (no_aggregate_address_mask
,
3504 no_aggregate_address_mask_cmd
,
3505 "no aggregate-address A.B.C.D A.B.C.D",
3507 "Configure BGP aggregate entries\n"
3508 "Aggregate address\n"
3512 char prefix_str
[BUFSIZ
];
3514 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3518 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3522 return bgp_aggregate_unset (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
));
3525 ALIAS (no_aggregate_address_mask
,
3526 no_aggregate_address_mask_summary_only_cmd
,
3527 "no aggregate-address A.B.C.D A.B.C.D summary-only",
3529 "Configure BGP aggregate entries\n"
3530 "Aggregate address\n"
3532 "Filter more specific routes from updates\n");
3534 ALIAS (no_aggregate_address_mask
,
3535 no_aggregate_address_mask_as_set_cmd
,
3536 "no aggregate-address A.B.C.D A.B.C.D as-set",
3538 "Configure BGP aggregate entries\n"
3539 "Aggregate address\n"
3541 "Generate AS set path information\n");
3543 ALIAS (no_aggregate_address_mask
,
3544 no_aggregate_address_mask_as_set_summary_cmd
,
3545 "no aggregate-address A.B.C.D A.B.C.D as-set summary-only",
3547 "Configure BGP aggregate entries\n"
3548 "Aggregate address\n"
3550 "Generate AS set path information\n"
3551 "Filter more specific routes from updates\n");
3553 ALIAS (no_aggregate_address_mask
,
3554 no_aggregate_address_mask_summary_as_set_cmd
,
3555 "no aggregate-address A.B.C.D A.B.C.D summary-only as-set",
3557 "Configure BGP aggregate entries\n"
3558 "Aggregate address\n"
3560 "Filter more specific routes from updates\n"
3561 "Generate AS set path information\n");
3564 DEFUN (ipv6_aggregate_address
,
3565 ipv6_aggregate_address_cmd
,
3566 "aggregate-address X:X::X:X/M",
3567 "Configure BGP aggregate entries\n"
3568 "Aggregate prefix\n")
3570 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0, 0);
3573 DEFUN (ipv6_aggregate_address_summary_only
,
3574 ipv6_aggregate_address_summary_only_cmd
,
3575 "aggregate-address X:X::X:X/M summary-only",
3576 "Configure BGP aggregate entries\n"
3577 "Aggregate prefix\n"
3578 "Filter more specific routes from updates\n")
3580 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
3581 AGGREGATE_SUMMARY_ONLY
, 0);
3584 DEFUN (no_ipv6_aggregate_address
,
3585 no_ipv6_aggregate_address_cmd
,
3586 "no aggregate-address X:X::X:X/M",
3588 "Configure BGP aggregate entries\n"
3589 "Aggregate prefix\n")
3591 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
3594 DEFUN (no_ipv6_aggregate_address_summary_only
,
3595 no_ipv6_aggregate_address_summary_only_cmd
,
3596 "no aggregate-address X:X::X:X/M summary-only",
3598 "Configure BGP aggregate entries\n"
3599 "Aggregate prefix\n"
3600 "Filter more specific routes from updates\n")
3602 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
3605 ALIAS (ipv6_aggregate_address
,
3606 old_ipv6_aggregate_address_cmd
,
3607 "ipv6 bgp aggregate-address X:X::X:X/M",
3610 "Configure BGP aggregate entries\n"
3611 "Aggregate prefix\n");
3613 ALIAS (ipv6_aggregate_address_summary_only
,
3614 old_ipv6_aggregate_address_summary_only_cmd
,
3615 "ipv6 bgp aggregate-address X:X::X:X/M summary-only",
3618 "Configure BGP aggregate entries\n"
3619 "Aggregate prefix\n"
3620 "Filter more specific routes from updates\n");
3622 ALIAS (no_ipv6_aggregate_address
,
3623 old_no_ipv6_aggregate_address_cmd
,
3624 "no ipv6 bgp aggregate-address X:X::X:X/M",
3628 "Configure BGP aggregate entries\n"
3629 "Aggregate prefix\n");
3631 ALIAS (no_ipv6_aggregate_address_summary_only
,
3632 old_no_ipv6_aggregate_address_summary_only_cmd
,
3633 "no ipv6 bgp aggregate-address X:X::X:X/M summary-only",
3637 "Configure BGP aggregate entries\n"
3638 "Aggregate prefix\n"
3639 "Filter more specific routes from updates\n");
3640 #endif /* HAVE_IPV6 */
3642 /* Redistribute route treatment. */
3644 bgp_redistribute_add (struct prefix
*p
, struct in_addr
*nexthop
,
3645 u_int32_t metric
, u_char type
)
3648 struct listnode
*nn
;
3649 struct bgp_info
*new;
3650 struct bgp_info
*bi
;
3651 struct bgp_info info
;
3652 struct bgp_node
*bn
;
3654 struct attr attr_new
;
3655 struct attr
*new_attr
;
3659 /* Make default attribute. */
3660 bgp_attr_default_set (&attr
, BGP_ORIGIN_INCOMPLETE
);
3662 attr
.nexthop
= *nexthop
;
3665 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3667 LIST_LOOP (bm
->bgp
, bgp
, nn
)
3669 afi
= family2afi (p
->family
);
3671 if (bgp
->redist
[afi
][type
])
3673 /* Copy attribute for modification. */
3676 if (bgp
->redist_metric_flag
[afi
][type
])
3677 attr_new
.med
= bgp
->redist_metric
[afi
][type
];
3679 /* Apply route-map. */
3680 if (bgp
->rmap
[afi
][type
].map
)
3682 info
.peer
= bgp
->peer_self
;
3683 info
.attr
= &attr_new
;
3685 ret
= route_map_apply (bgp
->rmap
[afi
][type
].map
, p
, RMAP_BGP
,
3687 if (ret
== RMAP_DENYMATCH
)
3689 /* Free uninterned attribute. */
3690 bgp_attr_flush (&attr_new
);
3692 /* Unintern original. */
3693 aspath_unintern (attr
.aspath
);
3694 bgp_redistribute_delete (p
, type
);
3699 bn
= bgp_afi_node_get (bgp
, afi
, SAFI_UNICAST
, p
, NULL
);
3700 new_attr
= bgp_attr_intern (&attr_new
);
3702 for (bi
= bn
->info
; bi
; bi
= bi
->next
)
3703 if (bi
->peer
== bgp
->peer_self
3704 && bi
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
3709 if (attrhash_cmp (bi
->attr
, new_attr
))
3711 bgp_attr_unintern (new_attr
);
3712 aspath_unintern (attr
.aspath
);
3713 bgp_unlock_node (bn
);
3718 /* The attribute is changed. */
3719 SET_FLAG (bi
->flags
, BGP_INFO_ATTR_CHANGED
);
3721 /* Rewrite BGP route information. */
3722 bgp_aggregate_decrement (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
3723 bgp_attr_unintern (bi
->attr
);
3724 bi
->attr
= new_attr
;
3725 bi
->uptime
= time (NULL
);
3727 /* Process change. */
3728 bgp_aggregate_increment (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
3729 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
3730 bgp_unlock_node (bn
);
3731 aspath_unintern (attr
.aspath
);
3736 new = bgp_info_new ();
3738 new->sub_type
= BGP_ROUTE_REDISTRIBUTE
;
3739 new->peer
= bgp
->peer_self
;
3740 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3741 new->attr
= new_attr
;
3742 new->uptime
= time (NULL
);
3744 bgp_aggregate_increment (bgp
, p
, new, afi
, SAFI_UNICAST
);
3745 bgp_info_add (bn
, new);
3746 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
3750 /* Unintern original. */
3751 aspath_unintern (attr
.aspath
);
3755 bgp_redistribute_delete (struct prefix
*p
, u_char type
)
3758 struct listnode
*nn
;
3760 struct bgp_node
*rn
;
3761 struct bgp_info
*ri
;
3763 LIST_LOOP (bm
->bgp
, bgp
, nn
)
3765 afi
= family2afi (p
->family
);
3767 if (bgp
->redist
[afi
][type
])
3769 rn
= bgp_afi_node_get (bgp
, afi
, SAFI_UNICAST
, p
, NULL
);
3771 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3772 if (ri
->peer
== bgp
->peer_self
3773 && ri
->type
== type
)
3778 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, SAFI_UNICAST
);
3779 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
3780 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
3781 bgp_info_delete (rn
, ri
);
3783 bgp_unlock_node (rn
);
3785 bgp_unlock_node (rn
);
3790 /* Withdraw specified route type's route. */
3792 bgp_redistribute_withdraw (struct bgp
*bgp
, afi_t afi
, int type
)
3794 struct bgp_node
*rn
;
3795 struct bgp_info
*ri
;
3796 struct bgp_table
*table
;
3798 table
= bgp
->rib
[afi
][SAFI_UNICAST
];
3800 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3802 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3803 if (ri
->peer
== bgp
->peer_self
3804 && ri
->type
== type
)
3809 bgp_aggregate_decrement (bgp
, &rn
->p
, ri
, afi
, SAFI_UNICAST
);
3810 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
3811 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
3812 bgp_info_delete (rn
, ri
);
3814 bgp_unlock_node (rn
);
3819 /* Static function to display route. */
3821 route_vty_out_route (struct prefix
*p
, struct vty
*vty
)
3824 u_int32_t destination
;
3827 if (p
->family
== AF_INET
)
3829 len
= vty_out (vty
, "%s", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
));
3830 destination
= ntohl (p
->u
.prefix4
.s_addr
);
3832 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
3833 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
3834 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
3835 || p
->u
.prefix4
.s_addr
== 0)
3837 /* When mask is natural, mask is not displayed. */
3840 len
+= vty_out (vty
, "/%d", p
->prefixlen
);
3843 len
= vty_out (vty
, "%s/%d", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
),
3848 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 20, " ");
3850 vty_out (vty
, "%*s", len
, " ");
3852 /* return 1 if it added extra newline */
3859 /* Calculate line number of output data. */
3861 vty_calc_line (struct vty
*vty
, unsigned long length
)
3863 return vty
->width
? (((vty
->obuf
->length
- length
) / vty
->width
) + 1) : 1;
3866 enum bgp_display_type
3871 /* called from terminal list command */
3873 route_vty_out (struct vty
*vty
, struct prefix
*p
,
3874 struct bgp_info
*binfo
, int display
, safi_t safi
)
3877 unsigned long length
= 0;
3880 length
= vty
->obuf
->length
;
3882 /* Route status display. */
3883 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
3885 else if (binfo
->suppress
)
3887 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
3893 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
3895 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
3897 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
3902 /* Internal route. */
3903 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
3908 /* print prefix and mask */
3910 extra_line
+= route_vty_out_route (p
, vty
);
3912 vty_out (vty
, "%*s", 17, " ");
3914 /* Print attribute */
3918 if (p
->family
== AF_INET
)
3920 if (safi
== SAFI_MPLS_VPN
)
3921 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
3923 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
3926 else if (p
->family
== AF_INET6
)
3931 len
= vty_out (vty
, "%s",
3932 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
3936 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
3937 extra_line
++; /* Adjust More mode for newline above */
3940 vty_out (vty
, "%*s", len
, " ");
3942 #endif /* HAVE_IPV6 */
3944 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
3945 vty_out (vty
, "%10u", attr
->med
);
3949 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
3950 vty_out (vty
, "%7u", attr
->local_pref
);
3954 vty_out (vty
, "%7d ",attr
->weight
);
3958 aspath_print_vty (vty
, attr
->aspath
);
3961 if (strlen (attr
->aspath
->str
) == 0)
3962 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
3964 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
3966 vty_out (vty
, "%s", VTY_NEWLINE
);
3968 return vty_calc_line (vty
, length
) + extra_line
;
3971 /* called from terminal list command */
3973 route_vty_out_tmp (struct vty
*vty
, struct prefix
*p
,
3974 struct attr
*attr
, safi_t safi
)
3976 /* Route status display. */
3981 /* print prefix and mask */
3982 route_vty_out_route (p
, vty
);
3984 /* Print attribute */
3987 if (p
->family
== AF_INET
)
3989 if (safi
== SAFI_MPLS_VPN
)
3990 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
3992 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
3995 else if (p
->family
== AF_INET6
)
4000 len
= vty_out (vty
, "%s",
4001 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
4004 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
4006 vty_out (vty
, "%*s", len
, " ");
4008 #endif /* HAVE_IPV6 */
4010 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
4011 vty_out (vty
, "%10u", attr
->med
);
4015 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
4016 vty_out (vty
, "%7u", attr
->local_pref
);
4020 vty_out (vty
, "%7d ",attr
->weight
);
4024 aspath_print_vty (vty
, attr
->aspath
);
4027 if (strlen (attr
->aspath
->str
) == 0)
4028 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
4030 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
4033 vty_out (vty
, "%s", VTY_NEWLINE
);
4037 route_vty_out_tag (struct vty
*vty
, struct prefix
*p
,
4038 struct bgp_info
*binfo
, int display
, safi_t safi
)
4041 unsigned long length
= 0;
4042 u_int32_t label
= 0;
4045 length
= vty
->obuf
->length
;
4047 /* Route status display. */
4048 if (binfo
->suppress
)
4050 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4056 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4058 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
4060 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
4065 /* Internal route. */
4066 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
4071 /* print prefix and mask */
4073 extra_line
+= route_vty_out_route (p
, vty
);
4075 vty_out (vty
, "%*s", 17, " ");
4077 /* Print attribute */
4081 if (p
->family
== AF_INET
)
4083 if (safi
== SAFI_MPLS_VPN
)
4084 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
4086 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
4089 else if (p
->family
== AF_INET6
)
4093 if (attr
->mp_nexthop_len
== 16)
4095 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
4096 else if (attr
->mp_nexthop_len
== 32)
4097 vty_out (vty
, "%s(%s)",
4098 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
),
4099 inet_ntop (AF_INET6
, &attr
->mp_nexthop_local
, buf1
, BUFSIZ
));
4102 #endif /* HAVE_IPV6 */
4105 label
= decode_label (binfo
->tag
);
4107 vty_out (vty
, "notag/%d", label
);
4109 vty_out (vty
, "%s", VTY_NEWLINE
);
4111 return vty_calc_line (vty
, length
) + extra_line
;
4114 /* dampening route */
4116 damp_route_vty_out (struct vty
*vty
, struct prefix
*p
,
4117 struct bgp_info
*binfo
, int display
, safi_t safi
)
4120 unsigned long length
= 0;
4124 length
= vty
->obuf
->length
;
4126 /* Route status display. */
4127 if (binfo
->suppress
)
4129 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4135 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4137 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
4139 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
4146 /* print prefix and mask */
4148 extra_line
+= route_vty_out_route (p
, vty
);
4150 vty_out (vty
, "%*s", 17, " ");
4152 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
4156 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 34, " ");
4160 vty_out (vty
, "%*s", len
, " ");
4162 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
));
4164 /* Print attribute */
4170 aspath_print_vty (vty
, attr
->aspath
);
4173 if (strlen (attr
->aspath
->str
) == 0)
4174 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
4176 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
4178 vty_out (vty
, "%s", VTY_NEWLINE
);
4180 return vty_calc_line (vty
, length
) + extra_line
;
4183 #define BGP_UPTIME_LEN 25
4187 flap_route_vty_out (struct vty
*vty
, struct prefix
*p
,
4188 struct bgp_info
*binfo
, int display
, safi_t safi
)
4191 struct bgp_damp_info
*bdi
;
4192 unsigned long length
= 0;
4193 char timebuf
[BGP_UPTIME_LEN
];
4197 length
= vty
->obuf
->length
;
4198 bdi
= binfo
->damp_info
;
4200 /* Route status display. */
4201 if (binfo
->suppress
)
4203 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4209 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4211 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
4213 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
4220 /* print prefix and mask */
4222 extra_line
+= route_vty_out_route (p
, vty
);
4224 vty_out (vty
, "%*s", 17, " ");
4226 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
4230 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 33, " ");
4234 vty_out (vty
, "%*s", len
, " ");
4236 len
= vty_out (vty
, "%d", bdi
->flap
);
4241 vty_out (vty
, "%*s ", len
, " ");
4243 vty_out (vty
, "%s ", peer_uptime (bdi
->start_time
,
4244 timebuf
, BGP_UPTIME_LEN
));
4246 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
)
4247 && ! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4248 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
));
4250 vty_out (vty
, "%*s ", 8, " ");
4252 /* Print attribute */
4258 aspath_print_vty (vty
, attr
->aspath
);
4261 if (strlen (attr
->aspath
->str
) == 0)
4262 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
4264 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
4266 vty_out (vty
, "%s", VTY_NEWLINE
);
4268 return vty_calc_line (vty
, length
) + extra_line
;
4272 route_vty_out_detail (struct vty
*vty
, struct bgp
*bgp
, struct prefix
*p
,
4273 struct bgp_info
*binfo
, afi_t afi
, safi_t safi
)
4275 char buf
[INET6_ADDRSTRLEN
];
4278 int sockunion_vty_out (struct vty
*, union sockunion
*);
4284 /* Line1 display AS-path, Aggregator */
4288 if (attr
->aspath
->length
== 0)
4289 vty_out (vty
, "Local");
4291 aspath_print_vty (vty
, attr
->aspath
);
4294 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
4295 vty_out (vty
, ", (stale)");
4296 if (CHECK_FLAG (attr
->flag
, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR
)))
4297 vty_out (vty
, ", (aggregated by %d %s)", attr
->aggregator_as
,
4298 inet_ntoa (attr
->aggregator_addr
));
4299 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
4300 vty_out (vty
, ", (Received from a RR-client)");
4301 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
4302 vty_out (vty
, ", (Received from a RS-client)");
4303 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4304 vty_out (vty
, ", (history entry)");
4305 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
4306 vty_out (vty
, ", (suppressed due to dampening)");
4307 vty_out (vty
, "%s", VTY_NEWLINE
);
4309 /* Line2 display Next-hop, Neighbor, Router-id */
4310 if (p
->family
== AF_INET
)
4312 vty_out (vty
, " %s", safi
== SAFI_MPLS_VPN
?
4313 inet_ntoa (attr
->mp_nexthop_global_in
) :
4314 inet_ntoa (attr
->nexthop
));
4319 vty_out (vty
, " %s",
4320 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
,
4321 buf
, INET6_ADDRSTRLEN
));
4323 #endif /* HAVE_IPV6 */
4325 if (binfo
->peer
== bgp
->peer_self
)
4327 vty_out (vty
, " from %s ",
4328 p
->family
== AF_INET
? "0.0.0.0" : "::");
4329 vty_out (vty
, "(%s)", inet_ntoa(bgp
->router_id
));
4333 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_VALID
))
4334 vty_out (vty
, " (inaccessible)");
4335 else if (binfo
->igpmetric
)
4336 vty_out (vty
, " (metric %d)", binfo
->igpmetric
);
4337 vty_out (vty
, " from %s", sockunion2str (&binfo
->peer
->su
, buf
, SU_ADDRSTRLEN
));
4338 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
4339 vty_out (vty
, " (%s)", inet_ntoa (attr
->originator_id
));
4341 vty_out (vty
, " (%s)", inet_ntop (AF_INET
, &binfo
->peer
->remote_id
, buf1
, BUFSIZ
));
4343 vty_out (vty
, "%s", VTY_NEWLINE
);
4346 /* display nexthop local */
4347 if (attr
->mp_nexthop_len
== 32)
4349 vty_out (vty
, " (%s)%s",
4350 inet_ntop (AF_INET6
, &attr
->mp_nexthop_local
,
4351 buf
, INET6_ADDRSTRLEN
),
4354 #endif /* HAVE_IPV6 */
4356 /* Line 3 display Origin, Med, Locpref, Weight, valid, Int/Ext/Local, Atomic, best */
4357 vty_out (vty
, " Origin %s", bgp_origin_long_str
[attr
->origin
]);
4359 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
))
4360 vty_out (vty
, ", metric %u", attr
->med
);
4362 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
))
4363 vty_out (vty
, ", localpref %u", attr
->local_pref
);
4365 vty_out (vty
, ", localpref %u", bgp
->default_local_pref
);
4367 if (attr
->weight
!= 0)
4368 vty_out (vty
, ", weight %d", attr
->weight
);
4370 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4371 vty_out (vty
, ", valid");
4373 if (binfo
->peer
!= bgp
->peer_self
)
4375 if (binfo
->peer
->as
== binfo
->peer
->local_as
)
4376 vty_out (vty
, ", internal");
4378 vty_out (vty
, ", %s",
4379 (bgp_confederation_peers_check(bgp
, binfo
->peer
->as
) ? "confed-external" : "external"));
4381 else if (binfo
->sub_type
== BGP_ROUTE_AGGREGATE
)
4382 vty_out (vty
, ", aggregated, local");
4383 else if (binfo
->type
!= ZEBRA_ROUTE_BGP
)
4384 vty_out (vty
, ", sourced");
4386 vty_out (vty
, ", sourced, local");
4388 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
4389 vty_out (vty
, ", atomic-aggregate");
4391 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
4392 vty_out (vty
, ", best");
4394 vty_out (vty
, "%s", VTY_NEWLINE
);
4396 /* Line 4 display Community */
4397 if (attr
->community
)
4398 vty_out (vty
, " Community: %s%s", attr
->community
->str
,
4401 /* Line 5 display Extended-community */
4402 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
))
4403 vty_out (vty
, " Extended Community: %s%s", attr
->ecommunity
->str
,
4406 /* Line 6 display Originator, Cluster-id */
4407 if ((attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)) ||
4408 (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
)))
4410 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
4411 vty_out (vty
, " Originator: %s", inet_ntoa (attr
->originator_id
));
4413 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
4416 vty_out (vty
, ", Cluster list: ");
4417 for (i
= 0; i
< attr
->cluster
->length
/ 4; i
++)
4418 vty_out (vty
, "%s ", inet_ntoa (attr
->cluster
->list
[i
]));
4420 vty_out (vty
, "%s", VTY_NEWLINE
);
4423 if (binfo
->damp_info
)
4424 bgp_damp_info_vty (vty
, binfo
);
4426 /* Line 7 display Uptime */
4427 vty_out (vty
, " Last update: %s", ctime (&binfo
->uptime
));
4429 vty_out (vty
, "%s", VTY_NEWLINE
);
4432 #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s r RIB-failure, S Stale%s"
4433 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s"
4434 #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s"
4435 #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s"
4436 #define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path%s"
4440 bgp_show_type_normal
,
4441 bgp_show_type_regexp
,
4442 bgp_show_type_prefix_list
,
4443 bgp_show_type_filter_list
,
4444 bgp_show_type_route_map
,
4445 bgp_show_type_neighbor
,
4446 bgp_show_type_cidr_only
,
4447 bgp_show_type_prefix_longer
,
4448 bgp_show_type_community_all
,
4449 bgp_show_type_community
,
4450 bgp_show_type_community_exact
,
4451 bgp_show_type_community_list
,
4452 bgp_show_type_community_list_exact
,
4453 bgp_show_type_flap_statistics
,
4454 bgp_show_type_flap_address
,
4455 bgp_show_type_flap_prefix
,
4456 bgp_show_type_flap_cidr_only
,
4457 bgp_show_type_flap_regexp
,
4458 bgp_show_type_flap_filter_list
,
4459 bgp_show_type_flap_prefix_list
,
4460 bgp_show_type_flap_prefix_longer
,
4461 bgp_show_type_flap_route_map
,
4462 bgp_show_type_flap_neighbor
,
4463 bgp_show_type_dampend_paths
,
4464 bgp_show_type_damp_neighbor
4468 bgp_show_callback (struct vty
*vty
, int unlock
)
4470 struct bgp_node
*rn
;
4471 struct bgp_info
*ri
;
4476 rn
= vty
->output_rn
;
4478 limit
= ((vty
->lines
== 0) ? 10 :
4479 (vty
->lines
> 0 ? vty
->lines
: vty
->height
- 2));
4480 if (vty
->status
== VTY_MORELINE
)
4483 limit
= limit
> 0 ? limit
: 2;
4485 /* Quit of display. */
4488 bgp_unlock_node (rn
);
4489 if (vty
->output_clean
)
4490 (*vty
->output_clean
) (vty
);
4491 vty
->output_rn
= NULL
;
4492 vty
->output_func
= NULL
;
4493 vty
->output_clean
= NULL
;
4494 vty
->output_arg
= NULL
;
4498 for (; rn
; rn
= bgp_route_next (rn
))
4499 if (rn
->info
!= NULL
)
4503 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4505 if (vty
->output_type
== bgp_show_type_flap_statistics
4506 || vty
->output_type
== bgp_show_type_flap_address
4507 || vty
->output_type
== bgp_show_type_flap_prefix
4508 || vty
->output_type
== bgp_show_type_flap_cidr_only
4509 || vty
->output_type
== bgp_show_type_flap_regexp
4510 || vty
->output_type
== bgp_show_type_flap_filter_list
4511 || vty
->output_type
== bgp_show_type_flap_prefix_list
4512 || vty
->output_type
== bgp_show_type_flap_prefix_longer
4513 || vty
->output_type
== bgp_show_type_flap_route_map
4514 || vty
->output_type
== bgp_show_type_flap_neighbor
4515 || vty
->output_type
== bgp_show_type_dampend_paths
4516 || vty
->output_type
== bgp_show_type_damp_neighbor
)
4518 if (! ri
->damp_info
)
4521 if (vty
->output_type
== bgp_show_type_regexp
4522 || vty
->output_type
== bgp_show_type_flap_regexp
)
4524 regex_t
*regex
= vty
->output_arg
;
4526 if (bgp_regexec (regex
, ri
->attr
->aspath
) == REG_NOMATCH
)
4529 if (vty
->output_type
== bgp_show_type_prefix_list
4530 || vty
->output_type
== bgp_show_type_flap_prefix_list
)
4532 struct prefix_list
*plist
= vty
->output_arg
;
4534 if (prefix_list_apply (plist
, &rn
->p
) != PREFIX_PERMIT
)
4537 if (vty
->output_type
== bgp_show_type_filter_list
4538 || vty
->output_type
== bgp_show_type_flap_filter_list
)
4540 struct as_list
*as_list
= vty
->output_arg
;
4542 if (as_list_apply (as_list
, ri
->attr
->aspath
) != AS_FILTER_PERMIT
)
4545 if (vty
->output_type
== bgp_show_type_route_map
4546 || vty
->output_type
== bgp_show_type_flap_route_map
)
4548 struct route_map
*rmap
= vty
->output_arg
;
4549 struct bgp_info binfo
;
4550 struct attr dummy_attr
;
4553 dummy_attr
= *ri
->attr
;
4554 binfo
.peer
= ri
->peer
;
4555 binfo
.attr
= &dummy_attr
;
4557 ret
= route_map_apply (rmap
, &rn
->p
, RMAP_BGP
, &binfo
);
4559 if (ret
== RMAP_DENYMATCH
)
4562 if (vty
->output_type
== bgp_show_type_neighbor
4563 || vty
->output_type
== bgp_show_type_flap_neighbor
4564 || vty
->output_type
== bgp_show_type_damp_neighbor
)
4566 union sockunion
*su
= vty
->output_arg
;
4568 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
4571 if (vty
->output_type
== bgp_show_type_cidr_only
4572 || vty
->output_type
== bgp_show_type_flap_cidr_only
)
4574 u_int32_t destination
;
4576 destination
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
4577 if (IN_CLASSC (destination
) && rn
->p
.prefixlen
== 24)
4579 if (IN_CLASSB (destination
) && rn
->p
.prefixlen
== 16)
4581 if (IN_CLASSA (destination
) && rn
->p
.prefixlen
== 8)
4584 if (vty
->output_type
== bgp_show_type_prefix_longer
4585 || vty
->output_type
== bgp_show_type_flap_prefix_longer
)
4587 struct prefix
*p
= vty
->output_arg
;
4589 if (! prefix_match (p
, &rn
->p
))
4592 if (vty
->output_type
== bgp_show_type_community_all
)
4594 if (! ri
->attr
->community
)
4597 if (vty
->output_type
== bgp_show_type_community
)
4599 struct community
*com
= vty
->output_arg
;
4601 if (! ri
->attr
->community
||
4602 ! community_match (ri
->attr
->community
, com
))
4605 if (vty
->output_type
== bgp_show_type_community_exact
)
4607 struct community
*com
= vty
->output_arg
;
4609 if (! ri
->attr
->community
||
4610 ! community_cmp (ri
->attr
->community
, com
))
4613 if (vty
->output_type
== bgp_show_type_community_list
)
4615 struct community_list
*list
= vty
->output_arg
;
4617 if (! community_list_match (ri
->attr
->community
, list
))
4620 if (vty
->output_type
== bgp_show_type_community_list_exact
)
4622 struct community_list
*list
= vty
->output_arg
;
4624 if (! community_list_exact_match (ri
->attr
->community
, list
))
4627 if (vty
->output_type
== bgp_show_type_flap_address
4628 || vty
->output_type
== bgp_show_type_flap_prefix
)
4630 struct prefix
*p
= vty
->output_arg
;
4632 if (! prefix_match (&rn
->p
, p
))
4635 if (vty
->output_type
== bgp_show_type_flap_prefix
)
4636 if (p
->prefixlen
!= rn
->p
.prefixlen
)
4639 if (vty
->output_type
== bgp_show_type_dampend_paths
4640 || vty
->output_type
== bgp_show_type_damp_neighbor
)
4642 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
4643 || CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
4647 if (vty
->output_type
== bgp_show_type_dampend_paths
4648 || vty
->output_type
== bgp_show_type_damp_neighbor
)
4649 count
+= damp_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
4650 else if (vty
->output_type
== bgp_show_type_flap_statistics
4651 || vty
->output_type
== bgp_show_type_flap_address
4652 || vty
->output_type
== bgp_show_type_flap_prefix
4653 || vty
->output_type
== bgp_show_type_flap_cidr_only
4654 || vty
->output_type
== bgp_show_type_flap_regexp
4655 || vty
->output_type
== bgp_show_type_flap_filter_list
4656 || vty
->output_type
== bgp_show_type_flap_prefix_list
4657 || vty
->output_type
== bgp_show_type_flap_prefix_longer
4658 || vty
->output_type
== bgp_show_type_flap_route_map
4659 || vty
->output_type
== bgp_show_type_flap_neighbor
)
4660 count
+= flap_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
4662 count
+= route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
4667 vty
->output_count
++;
4669 /* Remember current pointer then suspend output. */
4672 vty
->status
= VTY_CONTINUE
;
4673 vty
->output_rn
= bgp_route_next (rn
);;
4674 vty
->output_func
= bgp_show_callback
;
4679 /* Total line display. */
4680 if (vty
->output_count
)
4681 vty_out (vty
, "%sTotal number of prefixes %ld%s",
4682 VTY_NEWLINE
, vty
->output_count
, VTY_NEWLINE
);
4684 if (vty
->output_clean
)
4685 (*vty
->output_clean
) (vty
);
4687 vty
->status
= VTY_CONTINUE
;
4688 vty
->output_rn
= NULL
;
4689 vty
->output_func
= NULL
;
4690 vty
->output_clean
= NULL
;
4691 vty
->output_arg
= NULL
;
4697 bgp_show (struct vty
*vty
, char *view_name
, afi_t afi
, safi_t safi
,
4698 enum bgp_show_type type
)
4701 struct bgp_info
*ri
;
4702 struct bgp_node
*rn
;
4703 struct bgp_table
*table
;
4709 limit
= ((vty
->lines
== 0)
4710 ? 10 : (vty
->lines
> 0
4711 ? vty
->lines
: vty
->height
- 2));
4712 limit
= limit
> 0 ? limit
: 2;
4714 /* BGP structure lookup. */
4717 bgp
= bgp_lookup_by_name (view_name
);
4720 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
4726 bgp
= bgp_get_default ();
4729 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
4736 /* This is first entry point, so reset total line. */
4737 vty
->output_count
= 0;
4738 vty
->output_type
= type
;
4740 table
= bgp
->rib
[afi
][safi
];
4742 /* Start processing of routes. */
4743 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
4744 if (rn
->info
!= NULL
)
4748 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4750 if (vty
->output_type
== bgp_show_type_flap_statistics
4751 || type
== bgp_show_type_flap_address
4752 || type
== bgp_show_type_flap_prefix
4753 || type
== bgp_show_type_flap_cidr_only
4754 || type
== bgp_show_type_flap_regexp
4755 || type
== bgp_show_type_flap_filter_list
4756 || type
== bgp_show_type_flap_prefix_list
4757 || type
== bgp_show_type_flap_prefix_longer
4758 || type
== bgp_show_type_flap_route_map
4759 || type
== bgp_show_type_flap_neighbor
4760 || type
== bgp_show_type_dampend_paths
4761 || type
== bgp_show_type_damp_neighbor
)
4763 if (! ri
->damp_info
)
4766 if (type
== bgp_show_type_regexp
4767 || type
== bgp_show_type_flap_regexp
)
4769 regex_t
*regex
= vty
->output_arg
;
4771 if (bgp_regexec (regex
, ri
->attr
->aspath
) == REG_NOMATCH
)
4774 if (type
== bgp_show_type_prefix_list
4775 || type
== bgp_show_type_flap_prefix_list
)
4777 struct prefix_list
*plist
= vty
->output_arg
;
4779 if (prefix_list_apply (plist
, &rn
->p
) != PREFIX_PERMIT
)
4782 if (type
== bgp_show_type_filter_list
4783 || type
== bgp_show_type_flap_filter_list
)
4785 struct as_list
*as_list
= vty
->output_arg
;
4787 if (as_list_apply (as_list
, ri
->attr
->aspath
) != AS_FILTER_PERMIT
)
4790 if (type
== bgp_show_type_route_map
4791 || type
== bgp_show_type_flap_route_map
)
4793 struct route_map
*rmap
= vty
->output_arg
;
4794 struct bgp_info binfo
;
4795 struct attr dummy_attr
;
4798 dummy_attr
= *ri
->attr
;
4799 binfo
.peer
= ri
->peer
;
4800 binfo
.attr
= &dummy_attr
;
4802 ret
= route_map_apply (rmap
, &rn
->p
, RMAP_BGP
, &binfo
);
4804 if (ret
== RMAP_DENYMATCH
)
4807 if (type
== bgp_show_type_neighbor
4808 || type
== bgp_show_type_flap_neighbor
4809 || type
== bgp_show_type_damp_neighbor
)
4811 union sockunion
*su
= vty
->output_arg
;
4813 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
4816 if (type
== bgp_show_type_cidr_only
4817 || type
== bgp_show_type_flap_cidr_only
)
4819 u_int32_t destination
;
4821 destination
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
4822 if (IN_CLASSC (destination
) && rn
->p
.prefixlen
== 24)
4824 if (IN_CLASSB (destination
) && rn
->p
.prefixlen
== 16)
4826 if (IN_CLASSA (destination
) && rn
->p
.prefixlen
== 8)
4829 if (type
== bgp_show_type_prefix_longer
4830 || type
== bgp_show_type_flap_prefix_longer
)
4832 struct prefix
*p
= vty
->output_arg
;
4834 if (! prefix_match (p
, &rn
->p
))
4837 if (type
== bgp_show_type_community_all
)
4839 if (! ri
->attr
->community
)
4842 if (type
== bgp_show_type_community
)
4844 struct community
*com
= vty
->output_arg
;
4846 if (! ri
->attr
->community
||
4847 ! community_match (ri
->attr
->community
, com
))
4850 if (type
== bgp_show_type_community_exact
)
4852 struct community
*com
= vty
->output_arg
;
4854 if (! ri
->attr
->community
||
4855 ! community_cmp (ri
->attr
->community
, com
))
4858 if (type
== bgp_show_type_community_list
)
4860 struct community_list
*list
= vty
->output_arg
;
4862 if (! community_list_match (ri
->attr
->community
, list
))
4865 if (type
== bgp_show_type_community_list_exact
)
4867 struct community_list
*list
= vty
->output_arg
;
4869 if (! community_list_exact_match (ri
->attr
->community
, list
))
4872 if (type
== bgp_show_type_flap_address
4873 || type
== bgp_show_type_flap_prefix
)
4875 struct prefix
*p
= vty
->output_arg
;
4877 if (! prefix_match (&rn
->p
, p
))
4880 if (type
== bgp_show_type_flap_prefix
)
4881 if (p
->prefixlen
!= rn
->p
.prefixlen
)
4884 if (type
== bgp_show_type_dampend_paths
4885 || type
== bgp_show_type_damp_neighbor
)
4887 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
4888 || CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
4894 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
4895 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
4896 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
4897 if (type
== bgp_show_type_dampend_paths
4898 || type
== bgp_show_type_damp_neighbor
)
4899 vty_out (vty
, BGP_SHOW_DAMP_HEADER
, VTY_NEWLINE
);
4900 else if (type
== bgp_show_type_flap_statistics
4901 || type
== bgp_show_type_flap_address
4902 || type
== bgp_show_type_flap_prefix
4903 || type
== bgp_show_type_flap_cidr_only
4904 || type
== bgp_show_type_flap_regexp
4905 || type
== bgp_show_type_flap_filter_list
4906 || type
== bgp_show_type_flap_prefix_list
4907 || type
== bgp_show_type_flap_prefix_longer
4908 || type
== bgp_show_type_flap_route_map
4909 || type
== bgp_show_type_flap_neighbor
)
4910 vty_out (vty
, BGP_SHOW_FLAP_HEADER
, VTY_NEWLINE
);
4912 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
4917 if (type
== bgp_show_type_dampend_paths
4918 || type
== bgp_show_type_damp_neighbor
)
4919 count
+= damp_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
4920 else if (type
== bgp_show_type_flap_statistics
4921 || type
== bgp_show_type_flap_address
4922 || type
== bgp_show_type_flap_prefix
4923 || type
== bgp_show_type_flap_cidr_only
4924 || type
== bgp_show_type_flap_regexp
4925 || type
== bgp_show_type_flap_filter_list
4926 || type
== bgp_show_type_flap_prefix_list
4927 || type
== bgp_show_type_flap_prefix_longer
4928 || type
== bgp_show_type_flap_route_map
4929 || type
== bgp_show_type_flap_neighbor
)
4930 count
+= flap_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
4932 count
+= route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
4936 vty
->output_count
++;
4938 /* Remember current pointer then suspend output. */
4939 if (count
>= limit
&& vty
->type
!= VTY_SHELL_SERV
)
4941 vty
->status
= VTY_START
;
4942 vty
->output_rn
= bgp_route_next (rn
);
4943 vty
->output_func
= bgp_show_callback
;
4944 vty
->output_type
= type
;
4950 /* No route is displayed */
4951 if (vty
->output_count
== 0)
4953 if (type
== bgp_show_type_normal
)
4954 vty_out (vty
, "No BGP network exists%s", VTY_NEWLINE
);
4957 vty_out (vty
, "%sTotal number of prefixes %ld%s",
4958 VTY_NEWLINE
, vty
->output_count
, VTY_NEWLINE
);
4960 /* Clean up allocated resources. */
4961 if (vty
->output_clean
)
4962 (*vty
->output_clean
) (vty
);
4964 vty
->status
= VTY_START
;
4965 vty
->output_rn
= NULL
;
4966 vty
->output_func
= NULL
;
4967 vty
->output_clean
= NULL
;
4968 vty
->output_arg
= NULL
;
4973 /* Header of detailed BGP route information */
4975 route_vty_out_detail_header (struct vty
*vty
, struct bgp
*bgp
,
4976 struct bgp_node
*rn
,
4977 struct prefix_rd
*prd
, afi_t afi
, safi_t safi
)
4979 struct bgp_info
*ri
;
4982 struct listnode
*nn
;
4983 char buf1
[INET6_ADDRSTRLEN
];
4984 char buf2
[INET6_ADDRSTRLEN
];
4989 int no_advertise
= 0;
4994 vty_out (vty
, "BGP routing table entry for %s%s%s/%d%s",
4995 (safi
== SAFI_MPLS_VPN
?
4996 prefix_rd2str (prd
, buf1
, RD_ADDRSTRLEN
) : ""),
4997 safi
== SAFI_MPLS_VPN
? ":" : "",
4998 inet_ntop (p
->family
, &p
->u
.prefix
, buf2
, INET6_ADDRSTRLEN
),
4999 p
->prefixlen
, VTY_NEWLINE
);
5001 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5004 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
5009 if (ri
->attr
->community
!= NULL
)
5011 if (community_include (ri
->attr
->community
, COMMUNITY_NO_ADVERTISE
))
5013 if (community_include (ri
->attr
->community
, COMMUNITY_NO_EXPORT
))
5015 if (community_include (ri
->attr
->community
, COMMUNITY_LOCAL_AS
))
5021 vty_out (vty
, "Paths: (%d available", count
);
5024 vty_out (vty
, ", best #%d", best
);
5025 if (safi
== SAFI_UNICAST
)
5026 vty_out (vty
, ", table Default-IP-Routing-Table");
5029 vty_out (vty
, ", no best path");
5031 vty_out (vty
, ", not advertised to any peer");
5033 vty_out (vty
, ", not advertised to EBGP peer");
5035 vty_out (vty
, ", not advertised outside local AS");
5037 vty_out (vty
, ", Advertisements suppressed by an aggregate.");
5038 vty_out (vty
, ")%s", VTY_NEWLINE
);
5040 /* advertised peer */
5041 LIST_LOOP (bgp
->peer
, peer
, nn
)
5043 if (bgp_adj_out_lookup (peer
, p
, afi
, safi
, rn
))
5046 vty_out (vty
, " Advertised to non peer-group peers:%s ", VTY_NEWLINE
);
5047 vty_out (vty
, " %s", sockunion2str (&peer
->su
, buf1
, SU_ADDRSTRLEN
));
5052 vty_out (vty
, " Not advertised to any peer");
5053 vty_out (vty
, "%s", VTY_NEWLINE
);
5056 /* Display specified route of BGP table. */
5058 bgp_show_route (struct vty
*vty
, char *view_name
, char *ip_str
,
5059 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
5065 struct prefix match
;
5066 struct bgp_node
*rn
;
5067 struct bgp_node
*rm
;
5068 struct bgp_info
*ri
;
5070 struct bgp_table
*table
;
5072 /* BGP structure lookup. */
5075 bgp
= bgp_lookup_by_name (view_name
);
5078 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
5084 bgp
= bgp_get_default ();
5087 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
5092 /* Check IP address argument. */
5093 ret
= str2prefix (ip_str
, &match
);
5096 vty_out (vty
, "address is malformed%s", VTY_NEWLINE
);
5100 match
.family
= afi2family (afi
);
5102 if (safi
== SAFI_MPLS_VPN
)
5104 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= bgp_route_next (rn
))
5106 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
5109 if ((table
= rn
->info
) != NULL
)
5113 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
5115 if (prefix_check
&& rm
->p
.prefixlen
!= match
.prefixlen
)
5118 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
5122 route_vty_out_detail_header (vty
, bgp
, rm
, (struct prefix_rd
*)&rn
->p
,
5123 AFI_IP
, SAFI_MPLS_VPN
);
5128 route_vty_out_detail (vty
, bgp
, &rm
->p
, ri
, AFI_IP
, SAFI_MPLS_VPN
);
5138 if ((rn
= bgp_node_match (bgp
->rib
[afi
][safi
], &match
)) != NULL
)
5140 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
5142 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5146 route_vty_out_detail_header (vty
, bgp
, rn
, NULL
, afi
, safi
);
5150 route_vty_out_detail (vty
, bgp
, &rn
->p
, ri
, afi
, safi
);
5158 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
5165 /* BGP route print out function. */
5173 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
);
5176 DEFUN (show_ip_bgp_ipv4
,
5177 show_ip_bgp_ipv4_cmd
,
5178 "show ip bgp ipv4 (unicast|multicast)",
5183 "Address Family modifier\n"
5184 "Address Family modifier\n")
5186 if (strncmp (argv
[0], "m", 1) == 0)
5187 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, bgp_show_type_normal
);
5189 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
);
5192 DEFUN (show_ip_bgp_route
,
5193 show_ip_bgp_route_cmd
,
5194 "show ip bgp A.B.C.D",
5198 "Network in the BGP routing table to display\n")
5200 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
5203 DEFUN (show_ip_bgp_ipv4_route
,
5204 show_ip_bgp_ipv4_route_cmd
,
5205 "show ip bgp ipv4 (unicast|multicast) A.B.C.D",
5210 "Address Family modifier\n"
5211 "Address Family modifier\n"
5212 "Network in the BGP routing table to display\n")
5214 if (strncmp (argv
[0], "m", 1) == 0)
5215 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0);
5217 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
5220 DEFUN (show_ip_bgp_vpnv4_all_route
,
5221 show_ip_bgp_vpnv4_all_route_cmd
,
5222 "show ip bgp vpnv4 all A.B.C.D",
5226 "Display VPNv4 NLRI specific information\n"
5227 "Display information about all VPNv4 NLRIs\n"
5228 "Network in the BGP routing table to display\n")
5230 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 0);
5233 DEFUN (show_ip_bgp_vpnv4_rd_route
,
5234 show_ip_bgp_vpnv4_rd_route_cmd
,
5235 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D",
5239 "Display VPNv4 NLRI specific information\n"
5240 "Display information for a route distinguisher\n"
5241 "VPN Route Distinguisher\n"
5242 "Network in the BGP routing table to display\n")
5245 struct prefix_rd prd
;
5247 ret
= str2prefix_rd (argv
[0], &prd
);
5250 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
5253 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 0);
5256 DEFUN (show_ip_bgp_prefix
,
5257 show_ip_bgp_prefix_cmd
,
5258 "show ip bgp A.B.C.D/M",
5262 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
5264 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
5267 DEFUN (show_ip_bgp_ipv4_prefix
,
5268 show_ip_bgp_ipv4_prefix_cmd
,
5269 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M",
5274 "Address Family modifier\n"
5275 "Address Family modifier\n"
5276 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
5278 if (strncmp (argv
[0], "m", 1) == 0)
5279 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1);
5281 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
5284 DEFUN (show_ip_bgp_vpnv4_all_prefix
,
5285 show_ip_bgp_vpnv4_all_prefix_cmd
,
5286 "show ip bgp vpnv4 all A.B.C.D/M",
5290 "Display VPNv4 NLRI specific information\n"
5291 "Display information about all VPNv4 NLRIs\n"
5292 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
5294 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 1);
5297 DEFUN (show_ip_bgp_vpnv4_rd_prefix
,
5298 show_ip_bgp_vpnv4_rd_prefix_cmd
,
5299 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M",
5303 "Display VPNv4 NLRI specific information\n"
5304 "Display information for a route distinguisher\n"
5305 "VPN Route Distinguisher\n"
5306 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
5309 struct prefix_rd prd
;
5311 ret
= str2prefix_rd (argv
[0], &prd
);
5314 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
5317 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 1);
5320 DEFUN (show_ip_bgp_view
,
5321 show_ip_bgp_view_cmd
,
5322 "show ip bgp view WORD",
5329 return bgp_show (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
);
5332 DEFUN (show_ip_bgp_view_route
,
5333 show_ip_bgp_view_route_cmd
,
5334 "show ip bgp view WORD A.B.C.D",
5340 "Network in the BGP routing table to display\n")
5342 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
5345 DEFUN (show_ip_bgp_view_prefix
,
5346 show_ip_bgp_view_prefix_cmd
,
5347 "show ip bgp view WORD A.B.C.D/M",
5353 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
5355 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
5365 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
);
5373 "Address family\n");
5376 DEFUN (show_ipv6_bgp
,
5383 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
);
5386 DEFUN (show_bgp_route
,
5388 "show bgp X:X::X:X",
5391 "Network in the BGP routing table to display\n")
5393 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
5396 ALIAS (show_bgp_route
,
5397 show_bgp_ipv6_route_cmd
,
5398 "show bgp ipv6 X:X::X:X",
5402 "Network in the BGP routing table to display\n");
5405 DEFUN (show_ipv6_bgp_route
,
5406 show_ipv6_bgp_route_cmd
,
5407 "show ipv6 bgp X:X::X:X",
5411 "Network in the BGP routing table to display\n")
5413 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
5416 DEFUN (show_bgp_prefix
,
5417 show_bgp_prefix_cmd
,
5418 "show bgp X:X::X:X/M",
5421 "IPv6 prefix <network>/<length>\n")
5423 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
5426 ALIAS (show_bgp_prefix
,
5427 show_bgp_ipv6_prefix_cmd
,
5428 "show bgp ipv6 X:X::X:X/M",
5432 "IPv6 prefix <network>/<length>\n");
5435 DEFUN (show_ipv6_bgp_prefix
,
5436 show_ipv6_bgp_prefix_cmd
,
5437 "show ipv6 bgp X:X::X:X/M",
5441 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
5443 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
5447 DEFUN (show_ipv6_mbgp
,
5454 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
);
5458 DEFUN (show_ipv6_mbgp_route
,
5459 show_ipv6_mbgp_route_cmd
,
5460 "show ipv6 mbgp X:X::X:X",
5464 "Network in the MBGP routing table to display\n")
5466 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0);
5470 DEFUN (show_ipv6_mbgp_prefix
,
5471 show_ipv6_mbgp_prefix_cmd
,
5472 "show ipv6 mbgp X:X::X:X/M",
5476 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
5478 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1);
5483 bgp_show_regexp_clean (struct vty
*vty
)
5485 bgp_regex_free (vty
->output_arg
);
5489 bgp_show_regexp (struct vty
*vty
, int argc
, char **argv
, afi_t afi
,
5490 safi_t safi
, enum bgp_show_type type
)
5499 b
= buffer_new (1024);
5500 for (i
= 0; i
< argc
; i
++)
5503 buffer_putc (b
, ' ');
5506 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
5511 buffer_putstr (b
, argv
[i
]);
5513 buffer_putc (b
, '\0');
5515 regstr
= buffer_getstr (b
);
5518 regex
= bgp_regcomp (regstr
);
5521 vty_out (vty
, "Can't compile regexp %s%s", argv
[0],
5526 vty
->output_arg
= regex
;
5527 vty
->output_clean
= bgp_show_regexp_clean
;
5529 return bgp_show (vty
, NULL
, afi
, safi
, type
);
5532 DEFUN (show_ip_bgp_regexp
,
5533 show_ip_bgp_regexp_cmd
,
5534 "show ip bgp regexp .LINE",
5538 "Display routes matching the AS path regular expression\n"
5539 "A regular-expression to match the BGP AS paths\n")
5541 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
5542 bgp_show_type_regexp
);
5545 DEFUN (show_ip_bgp_flap_regexp
,
5546 show_ip_bgp_flap_regexp_cmd
,
5547 "show ip bgp flap-statistics regexp .LINE",
5551 "Display flap statistics of routes\n"
5552 "Display routes matching the AS path regular expression\n"
5553 "A regular-expression to match the BGP AS paths\n")
5555 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
5556 bgp_show_type_flap_regexp
);
5559 DEFUN (show_ip_bgp_ipv4_regexp
,
5560 show_ip_bgp_ipv4_regexp_cmd
,
5561 "show ip bgp ipv4 (unicast|multicast) regexp .LINE",
5566 "Address Family modifier\n"
5567 "Address Family modifier\n"
5568 "Display routes matching the AS path regular expression\n"
5569 "A regular-expression to match the BGP AS paths\n")
5571 if (strncmp (argv
[0], "m", 1) == 0)
5572 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_MULTICAST
,
5573 bgp_show_type_regexp
);
5575 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
5576 bgp_show_type_regexp
);
5580 DEFUN (show_bgp_regexp
,
5581 show_bgp_regexp_cmd
,
5582 "show bgp regexp .LINE",
5585 "Display routes matching the AS path regular expression\n"
5586 "A regular-expression to match the BGP AS paths\n")
5588 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
5589 bgp_show_type_regexp
);
5592 ALIAS (show_bgp_regexp
,
5593 show_bgp_ipv6_regexp_cmd
,
5594 "show bgp ipv6 regexp .LINE",
5598 "Display routes matching the AS path regular expression\n"
5599 "A regular-expression to match the BGP AS paths\n");
5602 DEFUN (show_ipv6_bgp_regexp
,
5603 show_ipv6_bgp_regexp_cmd
,
5604 "show ipv6 bgp regexp .LINE",
5608 "Display routes matching the AS path regular expression\n"
5609 "A regular-expression to match the BGP AS paths\n")
5611 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
5612 bgp_show_type_regexp
);
5616 DEFUN (show_ipv6_mbgp_regexp
,
5617 show_ipv6_mbgp_regexp_cmd
,
5618 "show ipv6 mbgp regexp .LINE",
5622 "Display routes matching the AS path regular expression\n"
5623 "A regular-expression to match the MBGP AS paths\n")
5625 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_MULTICAST
,
5626 bgp_show_type_regexp
);
5628 #endif /* HAVE_IPV6 */
5631 bgp_show_prefix_list (struct vty
*vty
, char *prefix_list_str
, afi_t afi
,
5632 safi_t safi
, enum bgp_show_type type
)
5634 struct prefix_list
*plist
;
5636 plist
= prefix_list_lookup (afi
, prefix_list_str
);
5639 vty_out (vty
, "%% %s is not a valid prefix-list name%s",
5640 prefix_list_str
, VTY_NEWLINE
);
5644 vty
->output_arg
= plist
;
5646 return bgp_show (vty
, NULL
, afi
, safi
, type
);
5649 DEFUN (show_ip_bgp_prefix_list
,
5650 show_ip_bgp_prefix_list_cmd
,
5651 "show ip bgp prefix-list WORD",
5655 "Display routes conforming to the prefix-list\n"
5656 "IP prefix-list name\n")
5658 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
5659 bgp_show_type_prefix_list
);
5662 DEFUN (show_ip_bgp_flap_prefix_list
,
5663 show_ip_bgp_flap_prefix_list_cmd
,
5664 "show ip bgp flap-statistics prefix-list WORD",
5668 "Display flap statistics of routes\n"
5669 "Display routes conforming to the prefix-list\n"
5670 "IP prefix-list name\n")
5672 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
5673 bgp_show_type_flap_prefix_list
);
5676 DEFUN (show_ip_bgp_ipv4_prefix_list
,
5677 show_ip_bgp_ipv4_prefix_list_cmd
,
5678 "show ip bgp ipv4 (unicast|multicast) prefix-list WORD",
5683 "Address Family modifier\n"
5684 "Address Family modifier\n"
5685 "Display routes conforming to the prefix-list\n"
5686 "IP prefix-list name\n")
5688 if (strncmp (argv
[0], "m", 1) == 0)
5689 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
5690 bgp_show_type_prefix_list
);
5692 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
5693 bgp_show_type_prefix_list
);
5697 DEFUN (show_bgp_prefix_list
,
5698 show_bgp_prefix_list_cmd
,
5699 "show bgp prefix-list WORD",
5702 "Display routes conforming to the prefix-list\n"
5703 "IPv6 prefix-list name\n")
5705 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5706 bgp_show_type_prefix_list
);
5709 ALIAS (show_bgp_prefix_list
,
5710 show_bgp_ipv6_prefix_list_cmd
,
5711 "show bgp ipv6 prefix-list WORD",
5715 "Display routes conforming to the prefix-list\n"
5716 "IPv6 prefix-list name\n");
5719 DEFUN (show_ipv6_bgp_prefix_list
,
5720 show_ipv6_bgp_prefix_list_cmd
,
5721 "show ipv6 bgp prefix-list WORD",
5725 "Display routes matching the prefix-list\n"
5726 "IPv6 prefix-list name\n")
5728 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5729 bgp_show_type_prefix_list
);
5733 DEFUN (show_ipv6_mbgp_prefix_list
,
5734 show_ipv6_mbgp_prefix_list_cmd
,
5735 "show ipv6 mbgp prefix-list WORD",
5739 "Display routes matching the prefix-list\n"
5740 "IPv6 prefix-list name\n")
5742 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
5743 bgp_show_type_prefix_list
);
5745 #endif /* HAVE_IPV6 */
5748 bgp_show_filter_list (struct vty
*vty
, char *filter
, afi_t afi
,
5749 safi_t safi
, enum bgp_show_type type
)
5751 struct as_list
*as_list
;
5753 as_list
= as_list_lookup (filter
);
5754 if (as_list
== NULL
)
5756 vty_out (vty
, "%% %s is not a valid AS-path access-list name%s", filter
, VTY_NEWLINE
);
5760 vty
->output_arg
= as_list
;
5762 return bgp_show (vty
, NULL
, afi
, safi
, type
);
5765 DEFUN (show_ip_bgp_filter_list
,
5766 show_ip_bgp_filter_list_cmd
,
5767 "show ip bgp filter-list WORD",
5771 "Display routes conforming to the filter-list\n"
5772 "Regular expression access list name\n")
5774 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
5775 bgp_show_type_filter_list
);
5778 DEFUN (show_ip_bgp_flap_filter_list
,
5779 show_ip_bgp_flap_filter_list_cmd
,
5780 "show ip bgp flap-statistics filter-list WORD",
5784 "Display flap statistics of routes\n"
5785 "Display routes conforming to the filter-list\n"
5786 "Regular expression access list name\n")
5788 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
5789 bgp_show_type_flap_filter_list
);
5792 DEFUN (show_ip_bgp_ipv4_filter_list
,
5793 show_ip_bgp_ipv4_filter_list_cmd
,
5794 "show ip bgp ipv4 (unicast|multicast) filter-list WORD",
5799 "Address Family modifier\n"
5800 "Address Family modifier\n"
5801 "Display routes conforming to the filter-list\n"
5802 "Regular expression access list name\n")
5804 if (strncmp (argv
[0], "m", 1) == 0)
5805 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
5806 bgp_show_type_filter_list
);
5808 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
5809 bgp_show_type_filter_list
);
5813 DEFUN (show_bgp_filter_list
,
5814 show_bgp_filter_list_cmd
,
5815 "show bgp filter-list WORD",
5818 "Display routes conforming to the filter-list\n"
5819 "Regular expression access list name\n")
5821 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5822 bgp_show_type_filter_list
);
5825 ALIAS (show_bgp_filter_list
,
5826 show_bgp_ipv6_filter_list_cmd
,
5827 "show bgp ipv6 filter-list WORD",
5831 "Display routes conforming to the filter-list\n"
5832 "Regular expression access list name\n");
5835 DEFUN (show_ipv6_bgp_filter_list
,
5836 show_ipv6_bgp_filter_list_cmd
,
5837 "show ipv6 bgp filter-list WORD",
5841 "Display routes conforming to the filter-list\n"
5842 "Regular expression access list name\n")
5844 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5845 bgp_show_type_filter_list
);
5849 DEFUN (show_ipv6_mbgp_filter_list
,
5850 show_ipv6_mbgp_filter_list_cmd
,
5851 "show ipv6 mbgp filter-list WORD",
5855 "Display routes conforming to the filter-list\n"
5856 "Regular expression access list name\n")
5858 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
5859 bgp_show_type_filter_list
);
5861 #endif /* HAVE_IPV6 */
5864 bgp_show_route_map (struct vty
*vty
, char *rmap_str
, afi_t afi
,
5865 safi_t safi
, enum bgp_show_type type
)
5867 struct route_map
*rmap
;
5869 rmap
= route_map_lookup_by_name (rmap_str
);
5872 vty_out (vty
, "%% %s is not a valid route-map name%s",
5873 rmap_str
, VTY_NEWLINE
);
5877 vty
->output_arg
= rmap
;
5879 return bgp_show (vty
, NULL
, afi
, safi
, type
);
5882 DEFUN (show_ip_bgp_route_map
,
5883 show_ip_bgp_route_map_cmd
,
5884 "show ip bgp route-map WORD",
5888 "Display routes matching the route-map\n"
5889 "A route-map to match on\n")
5891 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
5892 bgp_show_type_route_map
);
5895 DEFUN (show_ip_bgp_flap_route_map
,
5896 show_ip_bgp_flap_route_map_cmd
,
5897 "show ip bgp flap-statistics route-map WORD",
5901 "Display flap statistics of routes\n"
5902 "Display routes matching the route-map\n"
5903 "A route-map to match on\n")
5905 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
5906 bgp_show_type_flap_route_map
);
5909 DEFUN (show_ip_bgp_ipv4_route_map
,
5910 show_ip_bgp_ipv4_route_map_cmd
,
5911 "show ip bgp ipv4 (unicast|multicast) route-map WORD",
5916 "Address Family modifier\n"
5917 "Address Family modifier\n"
5918 "Display routes matching the route-map\n"
5919 "A route-map to match on\n")
5921 if (strncmp (argv
[0], "m", 1) == 0)
5922 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
5923 bgp_show_type_route_map
);
5925 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
5926 bgp_show_type_route_map
);
5929 DEFUN (show_bgp_route_map
,
5930 show_bgp_route_map_cmd
,
5931 "show bgp route-map WORD",
5934 "Display routes matching the route-map\n"
5935 "A route-map to match on\n")
5937 return bgp_show_route_map (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5938 bgp_show_type_route_map
);
5941 ALIAS (show_bgp_route_map
,
5942 show_bgp_ipv6_route_map_cmd
,
5943 "show bgp ipv6 route-map WORD",
5947 "Display routes matching the route-map\n"
5948 "A route-map to match on\n");
5950 DEFUN (show_ip_bgp_cidr_only
,
5951 show_ip_bgp_cidr_only_cmd
,
5952 "show ip bgp cidr-only",
5956 "Display only routes with non-natural netmasks\n")
5958 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
5959 bgp_show_type_cidr_only
);
5962 DEFUN (show_ip_bgp_flap_cidr_only
,
5963 show_ip_bgp_flap_cidr_only_cmd
,
5964 "show ip bgp flap-statistics cidr-only",
5968 "Display flap statistics of routes\n"
5969 "Display only routes with non-natural netmasks\n")
5971 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
5972 bgp_show_type_flap_cidr_only
);
5975 DEFUN (show_ip_bgp_ipv4_cidr_only
,
5976 show_ip_bgp_ipv4_cidr_only_cmd
,
5977 "show ip bgp ipv4 (unicast|multicast) cidr-only",
5982 "Address Family modifier\n"
5983 "Address Family modifier\n"
5984 "Display only routes with non-natural netmasks\n")
5986 if (strncmp (argv
[0], "m", 1) == 0)
5987 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
5988 bgp_show_type_cidr_only
);
5990 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
5991 bgp_show_type_cidr_only
);
5994 DEFUN (show_ip_bgp_community_all
,
5995 show_ip_bgp_community_all_cmd
,
5996 "show ip bgp community",
6000 "Display routes matching the communities\n")
6002 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6003 bgp_show_type_community_all
);
6006 DEFUN (show_ip_bgp_ipv4_community_all
,
6007 show_ip_bgp_ipv4_community_all_cmd
,
6008 "show ip bgp ipv4 (unicast|multicast) community",
6013 "Address Family modifier\n"
6014 "Address Family modifier\n"
6015 "Display routes matching the communities\n")
6017 if (strncmp (argv
[0], "m", 1) == 0)
6018 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
6019 bgp_show_type_community_all
);
6021 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6022 bgp_show_type_community_all
);
6026 DEFUN (show_bgp_community_all
,
6027 show_bgp_community_all_cmd
,
6028 "show bgp community",
6031 "Display routes matching the communities\n")
6033 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
6034 bgp_show_type_community_all
);
6037 ALIAS (show_bgp_community_all
,
6038 show_bgp_ipv6_community_all_cmd
,
6039 "show bgp ipv6 community",
6043 "Display routes matching the communities\n");
6046 DEFUN (show_ipv6_bgp_community_all
,
6047 show_ipv6_bgp_community_all_cmd
,
6048 "show ipv6 bgp community",
6052 "Display routes matching the communities\n")
6054 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
6055 bgp_show_type_community_all
);
6059 DEFUN (show_ipv6_mbgp_community_all
,
6060 show_ipv6_mbgp_community_all_cmd
,
6061 "show ipv6 mbgp community",
6065 "Display routes matching the communities\n")
6067 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
,
6068 bgp_show_type_community_all
);
6070 #endif /* HAVE_IPV6 */
6073 bgp_show_community (struct vty
*vty
, int argc
, char **argv
, int exact
,
6074 u_int16_t afi
, u_char safi
)
6076 struct community
*com
;
6082 b
= buffer_new (1024);
6083 for (i
= 0; i
< argc
; i
++)
6086 buffer_putc (b
, ' ');
6089 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
6094 buffer_putstr (b
, argv
[i
]);
6096 buffer_putc (b
, '\0');
6098 str
= buffer_getstr (b
);
6101 com
= community_str2com (str
);
6105 vty_out (vty
, "%% Community malformed: %s", VTY_NEWLINE
);
6109 vty
->output_arg
= com
;
6112 return bgp_show (vty
, NULL
, afi
, safi
, bgp_show_type_community_exact
);
6114 return bgp_show (vty
, NULL
, afi
, safi
, bgp_show_type_community
);
6117 DEFUN (show_ip_bgp_community
,
6118 show_ip_bgp_community_cmd
,
6119 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export)",
6123 "Display routes matching the communities\n"
6124 "community number\n"
6125 "Do not send outside local AS (well-known community)\n"
6126 "Do not advertise to any peer (well-known community)\n"
6127 "Do not export to next AS (well-known community)\n")
6129 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
6132 ALIAS (show_ip_bgp_community
,
6133 show_ip_bgp_community2_cmd
,
6134 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
6138 "Display routes matching the communities\n"
6139 "community number\n"
6140 "Do not send outside local AS (well-known community)\n"
6141 "Do not advertise to any peer (well-known community)\n"
6142 "Do not export to next AS (well-known community)\n"
6143 "community number\n"
6144 "Do not send outside local AS (well-known community)\n"
6145 "Do not advertise to any peer (well-known community)\n"
6146 "Do not export to next AS (well-known community)\n");
6148 ALIAS (show_ip_bgp_community
,
6149 show_ip_bgp_community3_cmd
,
6150 "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)",
6154 "Display routes matching the communities\n"
6155 "community number\n"
6156 "Do not send outside local AS (well-known community)\n"
6157 "Do not advertise to any peer (well-known community)\n"
6158 "Do not export to next AS (well-known community)\n"
6159 "community number\n"
6160 "Do not send outside local AS (well-known community)\n"
6161 "Do not advertise to any peer (well-known community)\n"
6162 "Do not export to next AS (well-known community)\n"
6163 "community number\n"
6164 "Do not send outside local AS (well-known community)\n"
6165 "Do not advertise to any peer (well-known community)\n"
6166 "Do not export to next AS (well-known community)\n");
6168 ALIAS (show_ip_bgp_community
,
6169 show_ip_bgp_community4_cmd
,
6170 "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)",
6174 "Display routes matching the communities\n"
6175 "community number\n"
6176 "Do not send outside local AS (well-known community)\n"
6177 "Do not advertise to any peer (well-known community)\n"
6178 "Do not export to next AS (well-known community)\n"
6179 "community number\n"
6180 "Do not send outside local AS (well-known community)\n"
6181 "Do not advertise to any peer (well-known community)\n"
6182 "Do not export to next AS (well-known community)\n"
6183 "community number\n"
6184 "Do not send outside local AS (well-known community)\n"
6185 "Do not advertise to any peer (well-known community)\n"
6186 "Do not export to next AS (well-known community)\n"
6187 "community number\n"
6188 "Do not send outside local AS (well-known community)\n"
6189 "Do not advertise to any peer (well-known community)\n"
6190 "Do not export to next AS (well-known community)\n");
6192 DEFUN (show_ip_bgp_ipv4_community
,
6193 show_ip_bgp_ipv4_community_cmd
,
6194 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
6199 "Address Family modifier\n"
6200 "Address Family modifier\n"
6201 "Display routes matching the communities\n"
6202 "community number\n"
6203 "Do not send outside local AS (well-known community)\n"
6204 "Do not advertise to any peer (well-known community)\n"
6205 "Do not export to next AS (well-known community)\n")
6207 if (strncmp (argv
[0], "m", 1) == 0)
6208 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_MULTICAST
);
6210 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
6213 ALIAS (show_ip_bgp_ipv4_community
,
6214 show_ip_bgp_ipv4_community2_cmd
,
6215 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
6220 "Address Family modifier\n"
6221 "Address Family modifier\n"
6222 "Display routes matching the communities\n"
6223 "community number\n"
6224 "Do not send outside local AS (well-known community)\n"
6225 "Do not advertise to any peer (well-known community)\n"
6226 "Do not export to next AS (well-known community)\n"
6227 "community number\n"
6228 "Do not send outside local AS (well-known community)\n"
6229 "Do not advertise to any peer (well-known community)\n"
6230 "Do not export to next AS (well-known community)\n");
6232 ALIAS (show_ip_bgp_ipv4_community
,
6233 show_ip_bgp_ipv4_community3_cmd
,
6234 "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)",
6239 "Address Family modifier\n"
6240 "Address Family modifier\n"
6241 "Display routes matching the communities\n"
6242 "community number\n"
6243 "Do not send outside local AS (well-known community)\n"
6244 "Do not advertise to any peer (well-known community)\n"
6245 "Do not export to next AS (well-known community)\n"
6246 "community number\n"
6247 "Do not send outside local AS (well-known community)\n"
6248 "Do not advertise to any peer (well-known community)\n"
6249 "Do not export to next AS (well-known community)\n"
6250 "community number\n"
6251 "Do not send outside local AS (well-known community)\n"
6252 "Do not advertise to any peer (well-known community)\n"
6253 "Do not export to next AS (well-known community)\n");
6255 ALIAS (show_ip_bgp_ipv4_community
,
6256 show_ip_bgp_ipv4_community4_cmd
,
6257 "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)",
6262 "Address Family modifier\n"
6263 "Address Family modifier\n"
6264 "Display routes matching the communities\n"
6265 "community number\n"
6266 "Do not send outside local AS (well-known community)\n"
6267 "Do not advertise to any peer (well-known community)\n"
6268 "Do not export to next AS (well-known community)\n"
6269 "community number\n"
6270 "Do not send outside local AS (well-known community)\n"
6271 "Do not advertise to any peer (well-known community)\n"
6272 "Do not export to next AS (well-known community)\n"
6273 "community number\n"
6274 "Do not send outside local AS (well-known community)\n"
6275 "Do not advertise to any peer (well-known community)\n"
6276 "Do not export to next AS (well-known community)\n"
6277 "community number\n"
6278 "Do not send outside local AS (well-known community)\n"
6279 "Do not advertise to any peer (well-known community)\n"
6280 "Do not export to next AS (well-known community)\n");
6282 DEFUN (show_ip_bgp_community_exact
,
6283 show_ip_bgp_community_exact_cmd
,
6284 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
6288 "Display routes matching the communities\n"
6289 "community number\n"
6290 "Do not send outside local AS (well-known community)\n"
6291 "Do not advertise to any peer (well-known community)\n"
6292 "Do not export to next AS (well-known community)\n"
6293 "Exact match of the communities")
6295 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
6298 ALIAS (show_ip_bgp_community_exact
,
6299 show_ip_bgp_community2_exact_cmd
,
6300 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
6304 "Display routes matching the communities\n"
6305 "community number\n"
6306 "Do not send outside local AS (well-known community)\n"
6307 "Do not advertise to any peer (well-known community)\n"
6308 "Do not export to next AS (well-known community)\n"
6309 "community number\n"
6310 "Do not send outside local AS (well-known community)\n"
6311 "Do not advertise to any peer (well-known community)\n"
6312 "Do not export to next AS (well-known community)\n"
6313 "Exact match of the communities");
6315 ALIAS (show_ip_bgp_community_exact
,
6316 show_ip_bgp_community3_exact_cmd
,
6317 "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",
6321 "Display routes matching the communities\n"
6322 "community number\n"
6323 "Do not send outside local AS (well-known community)\n"
6324 "Do not advertise to any peer (well-known community)\n"
6325 "Do not export to next AS (well-known community)\n"
6326 "community number\n"
6327 "Do not send outside local AS (well-known community)\n"
6328 "Do not advertise to any peer (well-known community)\n"
6329 "Do not export to next AS (well-known community)\n"
6330 "community number\n"
6331 "Do not send outside local AS (well-known community)\n"
6332 "Do not advertise to any peer (well-known community)\n"
6333 "Do not export to next AS (well-known community)\n"
6334 "Exact match of the communities");
6336 ALIAS (show_ip_bgp_community_exact
,
6337 show_ip_bgp_community4_exact_cmd
,
6338 "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",
6342 "Display routes matching the communities\n"
6343 "community number\n"
6344 "Do not send outside local AS (well-known community)\n"
6345 "Do not advertise to any peer (well-known community)\n"
6346 "Do not export to next AS (well-known community)\n"
6347 "community number\n"
6348 "Do not send outside local AS (well-known community)\n"
6349 "Do not advertise to any peer (well-known community)\n"
6350 "Do not export to next AS (well-known community)\n"
6351 "community number\n"
6352 "Do not send outside local AS (well-known community)\n"
6353 "Do not advertise to any peer (well-known community)\n"
6354 "Do not export to next AS (well-known community)\n"
6355 "community number\n"
6356 "Do not send outside local AS (well-known community)\n"
6357 "Do not advertise to any peer (well-known community)\n"
6358 "Do not export to next AS (well-known community)\n"
6359 "Exact match of the communities");
6361 DEFUN (show_ip_bgp_ipv4_community_exact
,
6362 show_ip_bgp_ipv4_community_exact_cmd
,
6363 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match",
6368 "Address Family modifier\n"
6369 "Address Family modifier\n"
6370 "Display routes matching the communities\n"
6371 "community number\n"
6372 "Do not send outside local AS (well-known community)\n"
6373 "Do not advertise to any peer (well-known community)\n"
6374 "Do not export to next AS (well-known community)\n"
6375 "Exact match of the communities")
6377 if (strncmp (argv
[0], "m", 1) == 0)
6378 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_MULTICAST
);
6380 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
6383 ALIAS (show_ip_bgp_ipv4_community_exact
,
6384 show_ip_bgp_ipv4_community2_exact_cmd
,
6385 "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",
6390 "Address Family modifier\n"
6391 "Address Family modifier\n"
6392 "Display routes matching the communities\n"
6393 "community number\n"
6394 "Do not send outside local AS (well-known community)\n"
6395 "Do not advertise to any peer (well-known community)\n"
6396 "Do not export to next AS (well-known community)\n"
6397 "community number\n"
6398 "Do not send outside local AS (well-known community)\n"
6399 "Do not advertise to any peer (well-known community)\n"
6400 "Do not export to next AS (well-known community)\n"
6401 "Exact match of the communities");
6403 ALIAS (show_ip_bgp_ipv4_community_exact
,
6404 show_ip_bgp_ipv4_community3_exact_cmd
,
6405 "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",
6410 "Address Family modifier\n"
6411 "Address Family modifier\n"
6412 "Display routes matching the communities\n"
6413 "community number\n"
6414 "Do not send outside local AS (well-known community)\n"
6415 "Do not advertise to any peer (well-known community)\n"
6416 "Do not export to next AS (well-known community)\n"
6417 "community number\n"
6418 "Do not send outside local AS (well-known community)\n"
6419 "Do not advertise to any peer (well-known community)\n"
6420 "Do not export to next AS (well-known community)\n"
6421 "community number\n"
6422 "Do not send outside local AS (well-known community)\n"
6423 "Do not advertise to any peer (well-known community)\n"
6424 "Do not export to next AS (well-known community)\n"
6425 "Exact match of the communities");
6427 ALIAS (show_ip_bgp_ipv4_community_exact
,
6428 show_ip_bgp_ipv4_community4_exact_cmd
,
6429 "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",
6434 "Address Family modifier\n"
6435 "Address Family modifier\n"
6436 "Display routes matching the communities\n"
6437 "community number\n"
6438 "Do not send outside local AS (well-known community)\n"
6439 "Do not advertise to any peer (well-known community)\n"
6440 "Do not export to next AS (well-known community)\n"
6441 "community number\n"
6442 "Do not send outside local AS (well-known community)\n"
6443 "Do not advertise to any peer (well-known community)\n"
6444 "Do not export to next AS (well-known community)\n"
6445 "community number\n"
6446 "Do not send outside local AS (well-known community)\n"
6447 "Do not advertise to any peer (well-known community)\n"
6448 "Do not export to next AS (well-known community)\n"
6449 "community number\n"
6450 "Do not send outside local AS (well-known community)\n"
6451 "Do not advertise to any peer (well-known community)\n"
6452 "Do not export to next AS (well-known community)\n"
6453 "Exact match of the communities");
6456 DEFUN (show_bgp_community
,
6457 show_bgp_community_cmd
,
6458 "show bgp community (AA:NN|local-AS|no-advertise|no-export)",
6461 "Display routes matching the communities\n"
6462 "community number\n"
6463 "Do not send outside local AS (well-known community)\n"
6464 "Do not advertise to any peer (well-known community)\n"
6465 "Do not export to next AS (well-known community)\n")
6467 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
6470 ALIAS (show_bgp_community
,
6471 show_bgp_ipv6_community_cmd
,
6472 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)",
6476 "Display routes matching the communities\n"
6477 "community number\n"
6478 "Do not send outside local AS (well-known community)\n"
6479 "Do not advertise to any peer (well-known community)\n"
6480 "Do not export to next AS (well-known community)\n");
6482 ALIAS (show_bgp_community
,
6483 show_bgp_community2_cmd
,
6484 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
6487 "Display routes matching the communities\n"
6488 "community number\n"
6489 "Do not send outside local AS (well-known community)\n"
6490 "Do not advertise to any peer (well-known community)\n"
6491 "Do not export to next AS (well-known community)\n"
6492 "community number\n"
6493 "Do not send outside local AS (well-known community)\n"
6494 "Do not advertise to any peer (well-known community)\n"
6495 "Do not export to next AS (well-known community)\n");
6497 ALIAS (show_bgp_community
,
6498 show_bgp_ipv6_community2_cmd
,
6499 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
6503 "Display routes matching the communities\n"
6504 "community number\n"
6505 "Do not send outside local AS (well-known community)\n"
6506 "Do not advertise to any peer (well-known community)\n"
6507 "Do not export to next AS (well-known community)\n"
6508 "community number\n"
6509 "Do not send outside local AS (well-known community)\n"
6510 "Do not advertise to any peer (well-known community)\n"
6511 "Do not export to next AS (well-known community)\n");
6513 ALIAS (show_bgp_community
,
6514 show_bgp_community3_cmd
,
6515 "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)",
6518 "Display routes matching the communities\n"
6519 "community number\n"
6520 "Do not send outside local AS (well-known community)\n"
6521 "Do not advertise to any peer (well-known community)\n"
6522 "Do not export to next AS (well-known community)\n"
6523 "community number\n"
6524 "Do not send outside local AS (well-known community)\n"
6525 "Do not advertise to any peer (well-known community)\n"
6526 "Do not export to next AS (well-known community)\n"
6527 "community number\n"
6528 "Do not send outside local AS (well-known community)\n"
6529 "Do not advertise to any peer (well-known community)\n"
6530 "Do not export to next AS (well-known community)\n");
6532 ALIAS (show_bgp_community
,
6533 show_bgp_ipv6_community3_cmd
,
6534 "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)",
6538 "Display routes matching the communities\n"
6539 "community number\n"
6540 "Do not send outside local AS (well-known community)\n"
6541 "Do not advertise to any peer (well-known community)\n"
6542 "Do not export to next AS (well-known community)\n"
6543 "community number\n"
6544 "Do not send outside local AS (well-known community)\n"
6545 "Do not advertise to any peer (well-known community)\n"
6546 "Do not export to next AS (well-known community)\n"
6547 "community number\n"
6548 "Do not send outside local AS (well-known community)\n"
6549 "Do not advertise to any peer (well-known community)\n"
6550 "Do not export to next AS (well-known community)\n");
6552 ALIAS (show_bgp_community
,
6553 show_bgp_community4_cmd
,
6554 "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)",
6557 "Display routes matching the communities\n"
6558 "community number\n"
6559 "Do not send outside local AS (well-known community)\n"
6560 "Do not advertise to any peer (well-known community)\n"
6561 "Do not export to next AS (well-known community)\n"
6562 "community number\n"
6563 "Do not send outside local AS (well-known community)\n"
6564 "Do not advertise to any peer (well-known community)\n"
6565 "Do not export to next AS (well-known community)\n"
6566 "community number\n"
6567 "Do not send outside local AS (well-known community)\n"
6568 "Do not advertise to any peer (well-known community)\n"
6569 "Do not export to next AS (well-known community)\n"
6570 "community number\n"
6571 "Do not send outside local AS (well-known community)\n"
6572 "Do not advertise to any peer (well-known community)\n"
6573 "Do not export to next AS (well-known community)\n");
6575 ALIAS (show_bgp_community
,
6576 show_bgp_ipv6_community4_cmd
,
6577 "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)",
6581 "Display routes matching the communities\n"
6582 "community number\n"
6583 "Do not send outside local AS (well-known community)\n"
6584 "Do not advertise to any peer (well-known community)\n"
6585 "Do not export to next AS (well-known community)\n"
6586 "community number\n"
6587 "Do not send outside local AS (well-known community)\n"
6588 "Do not advertise to any peer (well-known community)\n"
6589 "Do not export to next AS (well-known community)\n"
6590 "community number\n"
6591 "Do not send outside local AS (well-known community)\n"
6592 "Do not advertise to any peer (well-known community)\n"
6593 "Do not export to next AS (well-known community)\n"
6594 "community number\n"
6595 "Do not send outside local AS (well-known community)\n"
6596 "Do not advertise to any peer (well-known community)\n"
6597 "Do not export to next AS (well-known community)\n");
6600 DEFUN (show_ipv6_bgp_community
,
6601 show_ipv6_bgp_community_cmd
,
6602 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export)",
6606 "Display routes matching the communities\n"
6607 "community number\n"
6608 "Do not send outside local AS (well-known community)\n"
6609 "Do not advertise to any peer (well-known community)\n"
6610 "Do not export to next AS (well-known community)\n")
6612 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
6616 ALIAS (show_ipv6_bgp_community
,
6617 show_ipv6_bgp_community2_cmd
,
6618 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
6622 "Display routes matching the communities\n"
6623 "community number\n"
6624 "Do not send outside local AS (well-known community)\n"
6625 "Do not advertise to any peer (well-known community)\n"
6626 "Do not export to next AS (well-known community)\n"
6627 "community number\n"
6628 "Do not send outside local AS (well-known community)\n"
6629 "Do not advertise to any peer (well-known community)\n"
6630 "Do not export to next AS (well-known community)\n");
6633 ALIAS (show_ipv6_bgp_community
,
6634 show_ipv6_bgp_community3_cmd
,
6635 "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)",
6639 "Display routes matching the communities\n"
6640 "community number\n"
6641 "Do not send outside local AS (well-known community)\n"
6642 "Do not advertise to any peer (well-known community)\n"
6643 "Do not export to next AS (well-known community)\n"
6644 "community number\n"
6645 "Do not send outside local AS (well-known community)\n"
6646 "Do not advertise to any peer (well-known community)\n"
6647 "Do not export to next AS (well-known community)\n"
6648 "community number\n"
6649 "Do not send outside local AS (well-known community)\n"
6650 "Do not advertise to any peer (well-known community)\n"
6651 "Do not export to next AS (well-known community)\n");
6654 ALIAS (show_ipv6_bgp_community
,
6655 show_ipv6_bgp_community4_cmd
,
6656 "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)",
6660 "Display routes matching the communities\n"
6661 "community number\n"
6662 "Do not send outside local AS (well-known community)\n"
6663 "Do not advertise to any peer (well-known community)\n"
6664 "Do not export to next AS (well-known community)\n"
6665 "community number\n"
6666 "Do not send outside local AS (well-known community)\n"
6667 "Do not advertise to any peer (well-known community)\n"
6668 "Do not export to next AS (well-known community)\n"
6669 "community number\n"
6670 "Do not send outside local AS (well-known community)\n"
6671 "Do not advertise to any peer (well-known community)\n"
6672 "Do not export to next AS (well-known community)\n"
6673 "community number\n"
6674 "Do not send outside local AS (well-known community)\n"
6675 "Do not advertise to any peer (well-known community)\n"
6676 "Do not export to next AS (well-known community)\n");
6678 DEFUN (show_bgp_community_exact
,
6679 show_bgp_community_exact_cmd
,
6680 "show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
6683 "Display routes matching the communities\n"
6684 "community number\n"
6685 "Do not send outside local AS (well-known community)\n"
6686 "Do not advertise to any peer (well-known community)\n"
6687 "Do not export to next AS (well-known community)\n"
6688 "Exact match of the communities")
6690 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
6693 ALIAS (show_bgp_community_exact
,
6694 show_bgp_ipv6_community_exact_cmd
,
6695 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match",
6699 "Display routes matching the communities\n"
6700 "community number\n"
6701 "Do not send outside local AS (well-known community)\n"
6702 "Do not advertise to any peer (well-known community)\n"
6703 "Do not export to next AS (well-known community)\n"
6704 "Exact match of the communities");
6706 ALIAS (show_bgp_community_exact
,
6707 show_bgp_community2_exact_cmd
,
6708 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
6711 "Display routes matching the communities\n"
6712 "community number\n"
6713 "Do not send outside local AS (well-known community)\n"
6714 "Do not advertise to any peer (well-known community)\n"
6715 "Do not export to next AS (well-known community)\n"
6716 "community number\n"
6717 "Do not send outside local AS (well-known community)\n"
6718 "Do not advertise to any peer (well-known community)\n"
6719 "Do not export to next AS (well-known community)\n"
6720 "Exact match of the communities");
6722 ALIAS (show_bgp_community_exact
,
6723 show_bgp_ipv6_community2_exact_cmd
,
6724 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
6728 "Display routes matching the communities\n"
6729 "community number\n"
6730 "Do not send outside local AS (well-known community)\n"
6731 "Do not advertise to any peer (well-known community)\n"
6732 "Do not export to next AS (well-known community)\n"
6733 "community number\n"
6734 "Do not send outside local AS (well-known community)\n"
6735 "Do not advertise to any peer (well-known community)\n"
6736 "Do not export to next AS (well-known community)\n"
6737 "Exact match of the communities");
6739 ALIAS (show_bgp_community_exact
,
6740 show_bgp_community3_exact_cmd
,
6741 "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",
6744 "Display routes matching the communities\n"
6745 "community number\n"
6746 "Do not send outside local AS (well-known community)\n"
6747 "Do not advertise to any peer (well-known community)\n"
6748 "Do not export to next AS (well-known community)\n"
6749 "community number\n"
6750 "Do not send outside local AS (well-known community)\n"
6751 "Do not advertise to any peer (well-known community)\n"
6752 "Do not export to next AS (well-known community)\n"
6753 "community number\n"
6754 "Do not send outside local AS (well-known community)\n"
6755 "Do not advertise to any peer (well-known community)\n"
6756 "Do not export to next AS (well-known community)\n"
6757 "Exact match of the communities");
6759 ALIAS (show_bgp_community_exact
,
6760 show_bgp_ipv6_community3_exact_cmd
,
6761 "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",
6765 "Display routes matching the communities\n"
6766 "community number\n"
6767 "Do not send outside local AS (well-known community)\n"
6768 "Do not advertise to any peer (well-known community)\n"
6769 "Do not export to next AS (well-known community)\n"
6770 "community number\n"
6771 "Do not send outside local AS (well-known community)\n"
6772 "Do not advertise to any peer (well-known community)\n"
6773 "Do not export to next AS (well-known community)\n"
6774 "community number\n"
6775 "Do not send outside local AS (well-known community)\n"
6776 "Do not advertise to any peer (well-known community)\n"
6777 "Do not export to next AS (well-known community)\n"
6778 "Exact match of the communities");
6780 ALIAS (show_bgp_community_exact
,
6781 show_bgp_community4_exact_cmd
,
6782 "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",
6785 "Display routes matching the communities\n"
6786 "community number\n"
6787 "Do not send outside local AS (well-known community)\n"
6788 "Do not advertise to any peer (well-known community)\n"
6789 "Do not export to next AS (well-known community)\n"
6790 "community number\n"
6791 "Do not send outside local AS (well-known community)\n"
6792 "Do not advertise to any peer (well-known community)\n"
6793 "Do not export to next AS (well-known community)\n"
6794 "community number\n"
6795 "Do not send outside local AS (well-known community)\n"
6796 "Do not advertise to any peer (well-known community)\n"
6797 "Do not export to next AS (well-known community)\n"
6798 "community number\n"
6799 "Do not send outside local AS (well-known community)\n"
6800 "Do not advertise to any peer (well-known community)\n"
6801 "Do not export to next AS (well-known community)\n"
6802 "Exact match of the communities");
6804 ALIAS (show_bgp_community_exact
,
6805 show_bgp_ipv6_community4_exact_cmd
,
6806 "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",
6810 "Display routes matching the communities\n"
6811 "community number\n"
6812 "Do not send outside local AS (well-known community)\n"
6813 "Do not advertise to any peer (well-known community)\n"
6814 "Do not export to next AS (well-known community)\n"
6815 "community number\n"
6816 "Do not send outside local AS (well-known community)\n"
6817 "Do not advertise to any peer (well-known community)\n"
6818 "Do not export to next AS (well-known community)\n"
6819 "community number\n"
6820 "Do not send outside local AS (well-known community)\n"
6821 "Do not advertise to any peer (well-known community)\n"
6822 "Do not export to next AS (well-known community)\n"
6823 "community number\n"
6824 "Do not send outside local AS (well-known community)\n"
6825 "Do not advertise to any peer (well-known community)\n"
6826 "Do not export to next AS (well-known community)\n"
6827 "Exact match of the communities");
6830 DEFUN (show_ipv6_bgp_community_exact
,
6831 show_ipv6_bgp_community_exact_cmd
,
6832 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
6836 "Display routes matching the communities\n"
6837 "community number\n"
6838 "Do not send outside local AS (well-known community)\n"
6839 "Do not advertise to any peer (well-known community)\n"
6840 "Do not export to next AS (well-known community)\n"
6841 "Exact match of the communities")
6843 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
6847 ALIAS (show_ipv6_bgp_community_exact
,
6848 show_ipv6_bgp_community2_exact_cmd
,
6849 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
6853 "Display routes matching the communities\n"
6854 "community number\n"
6855 "Do not send outside local AS (well-known community)\n"
6856 "Do not advertise to any peer (well-known community)\n"
6857 "Do not export to next AS (well-known community)\n"
6858 "community number\n"
6859 "Do not send outside local AS (well-known community)\n"
6860 "Do not advertise to any peer (well-known community)\n"
6861 "Do not export to next AS (well-known community)\n"
6862 "Exact match of the communities");
6865 ALIAS (show_ipv6_bgp_community_exact
,
6866 show_ipv6_bgp_community3_exact_cmd
,
6867 "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",
6871 "Display routes matching the communities\n"
6872 "community number\n"
6873 "Do not send outside local AS (well-known community)\n"
6874 "Do not advertise to any peer (well-known community)\n"
6875 "Do not export to next AS (well-known community)\n"
6876 "community number\n"
6877 "Do not send outside local AS (well-known community)\n"
6878 "Do not advertise to any peer (well-known community)\n"
6879 "Do not export to next AS (well-known community)\n"
6880 "community number\n"
6881 "Do not send outside local AS (well-known community)\n"
6882 "Do not advertise to any peer (well-known community)\n"
6883 "Do not export to next AS (well-known community)\n"
6884 "Exact match of the communities");
6887 ALIAS (show_ipv6_bgp_community_exact
,
6888 show_ipv6_bgp_community4_exact_cmd
,
6889 "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",
6893 "Display routes matching the communities\n"
6894 "community number\n"
6895 "Do not send outside local AS (well-known community)\n"
6896 "Do not advertise to any peer (well-known community)\n"
6897 "Do not export to next AS (well-known community)\n"
6898 "community number\n"
6899 "Do not send outside local AS (well-known community)\n"
6900 "Do not advertise to any peer (well-known community)\n"
6901 "Do not export to next AS (well-known community)\n"
6902 "community number\n"
6903 "Do not send outside local AS (well-known community)\n"
6904 "Do not advertise to any peer (well-known community)\n"
6905 "Do not export to next AS (well-known community)\n"
6906 "community number\n"
6907 "Do not send outside local AS (well-known community)\n"
6908 "Do not advertise to any peer (well-known community)\n"
6909 "Do not export to next AS (well-known community)\n"
6910 "Exact match of the communities");
6913 DEFUN (show_ipv6_mbgp_community
,
6914 show_ipv6_mbgp_community_cmd
,
6915 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export)",
6919 "Display routes matching the communities\n"
6920 "community number\n"
6921 "Do not send outside local AS (well-known community)\n"
6922 "Do not advertise to any peer (well-known community)\n"
6923 "Do not export to next AS (well-known community)\n")
6925 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_MULTICAST
);
6929 ALIAS (show_ipv6_mbgp_community
,
6930 show_ipv6_mbgp_community2_cmd
,
6931 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
6935 "Display routes matching the communities\n"
6936 "community number\n"
6937 "Do not send outside local AS (well-known community)\n"
6938 "Do not advertise to any peer (well-known community)\n"
6939 "Do not export to next AS (well-known community)\n"
6940 "community number\n"
6941 "Do not send outside local AS (well-known community)\n"
6942 "Do not advertise to any peer (well-known community)\n"
6943 "Do not export to next AS (well-known community)\n");
6946 ALIAS (show_ipv6_mbgp_community
,
6947 show_ipv6_mbgp_community3_cmd
,
6948 "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)",
6952 "Display routes matching the communities\n"
6953 "community number\n"
6954 "Do not send outside local AS (well-known community)\n"
6955 "Do not advertise to any peer (well-known community)\n"
6956 "Do not export to next AS (well-known community)\n"
6957 "community number\n"
6958 "Do not send outside local AS (well-known community)\n"
6959 "Do not advertise to any peer (well-known community)\n"
6960 "Do not export to next AS (well-known community)\n"
6961 "community number\n"
6962 "Do not send outside local AS (well-known community)\n"
6963 "Do not advertise to any peer (well-known community)\n"
6964 "Do not export to next AS (well-known community)\n");
6967 ALIAS (show_ipv6_mbgp_community
,
6968 show_ipv6_mbgp_community4_cmd
,
6969 "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)",
6973 "Display routes matching the communities\n"
6974 "community number\n"
6975 "Do not send outside local AS (well-known community)\n"
6976 "Do not advertise to any peer (well-known community)\n"
6977 "Do not export to next AS (well-known community)\n"
6978 "community number\n"
6979 "Do not send outside local AS (well-known community)\n"
6980 "Do not advertise to any peer (well-known community)\n"
6981 "Do not export to next AS (well-known community)\n"
6982 "community number\n"
6983 "Do not send outside local AS (well-known community)\n"
6984 "Do not advertise to any peer (well-known community)\n"
6985 "Do not export to next AS (well-known community)\n"
6986 "community number\n"
6987 "Do not send outside local AS (well-known community)\n"
6988 "Do not advertise to any peer (well-known community)\n"
6989 "Do not export to next AS (well-known community)\n");
6992 DEFUN (show_ipv6_mbgp_community_exact
,
6993 show_ipv6_mbgp_community_exact_cmd
,
6994 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
6998 "Display routes matching the communities\n"
6999 "community number\n"
7000 "Do not send outside local AS (well-known community)\n"
7001 "Do not advertise to any peer (well-known community)\n"
7002 "Do not export to next AS (well-known community)\n"
7003 "Exact match of the communities")
7005 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_MULTICAST
);
7009 ALIAS (show_ipv6_mbgp_community_exact
,
7010 show_ipv6_mbgp_community2_exact_cmd
,
7011 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7015 "Display routes matching the communities\n"
7016 "community number\n"
7017 "Do not send outside local AS (well-known community)\n"
7018 "Do not advertise to any peer (well-known community)\n"
7019 "Do not export to next AS (well-known community)\n"
7020 "community number\n"
7021 "Do not send outside local AS (well-known community)\n"
7022 "Do not advertise to any peer (well-known community)\n"
7023 "Do not export to next AS (well-known community)\n"
7024 "Exact match of the communities");
7027 ALIAS (show_ipv6_mbgp_community_exact
,
7028 show_ipv6_mbgp_community3_exact_cmd
,
7029 "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",
7033 "Display routes matching the communities\n"
7034 "community number\n"
7035 "Do not send outside local AS (well-known community)\n"
7036 "Do not advertise to any peer (well-known community)\n"
7037 "Do not export to next AS (well-known community)\n"
7038 "community number\n"
7039 "Do not send outside local AS (well-known community)\n"
7040 "Do not advertise to any peer (well-known community)\n"
7041 "Do not export to next AS (well-known community)\n"
7042 "community number\n"
7043 "Do not send outside local AS (well-known community)\n"
7044 "Do not advertise to any peer (well-known community)\n"
7045 "Do not export to next AS (well-known community)\n"
7046 "Exact match of the communities");
7049 ALIAS (show_ipv6_mbgp_community_exact
,
7050 show_ipv6_mbgp_community4_exact_cmd
,
7051 "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",
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"
7060 "community number\n"
7061 "Do not send outside local AS (well-known community)\n"
7062 "Do not advertise to any peer (well-known community)\n"
7063 "Do not export to next AS (well-known community)\n"
7064 "community number\n"
7065 "Do not send outside local AS (well-known community)\n"
7066 "Do not advertise to any peer (well-known community)\n"
7067 "Do not export to next AS (well-known community)\n"
7068 "community number\n"
7069 "Do not send outside local AS (well-known community)\n"
7070 "Do not advertise to any peer (well-known community)\n"
7071 "Do not export to next AS (well-known community)\n"
7072 "Exact match of the communities");
7073 #endif /* HAVE_IPV6 */
7076 bgp_show_community_list (struct vty
*vty
, char *com
, int exact
,
7077 u_int16_t afi
, u_char safi
)
7079 struct community_list
*list
;
7081 list
= community_list_lookup (bgp_clist
, com
, COMMUNITY_LIST_MASTER
);
7084 vty_out (vty
, "%% %s is not a valid community-list name%s", com
,
7089 vty
->output_arg
= list
;
7092 return bgp_show (vty
, NULL
, afi
, safi
, bgp_show_type_community_list_exact
);
7094 return bgp_show (vty
, NULL
, afi
, safi
, bgp_show_type_community_list
);
7097 DEFUN (show_ip_bgp_community_list
,
7098 show_ip_bgp_community_list_cmd
,
7099 "show ip bgp community-list (<1-500>|WORD)",
7103 "Display routes matching the community-list\n"
7104 "community-list number\n"
7105 "community-list name\n")
7107 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP
, SAFI_UNICAST
);
7110 DEFUN (show_ip_bgp_ipv4_community_list
,
7111 show_ip_bgp_ipv4_community_list_cmd
,
7112 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)",
7117 "Address Family modifier\n"
7118 "Address Family modifier\n"
7119 "Display routes matching the community-list\n"
7120 "community-list number\n"
7121 "community-list name\n")
7123 if (strncmp (argv
[0], "m", 1) == 0)
7124 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_MULTICAST
);
7126 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_UNICAST
);
7129 DEFUN (show_ip_bgp_community_list_exact
,
7130 show_ip_bgp_community_list_exact_cmd
,
7131 "show ip bgp community-list (<1-500>|WORD) exact-match",
7135 "Display routes matching the community-list\n"
7136 "community-list number\n"
7137 "community-list name\n"
7138 "Exact match of the communities\n")
7140 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP
, SAFI_UNICAST
);
7143 DEFUN (show_ip_bgp_ipv4_community_list_exact
,
7144 show_ip_bgp_ipv4_community_list_exact_cmd
,
7145 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match",
7150 "Address Family modifier\n"
7151 "Address Family modifier\n"
7152 "Display routes matching the community-list\n"
7153 "community-list number\n"
7154 "community-list name\n"
7155 "Exact match of the communities\n")
7157 if (strncmp (argv
[0], "m", 1) == 0)
7158 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_MULTICAST
);
7160 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_UNICAST
);
7164 DEFUN (show_bgp_community_list
,
7165 show_bgp_community_list_cmd
,
7166 "show bgp community-list (<1-500>|WORD)",
7169 "Display routes matching the community-list\n"
7170 "community-list number\n"
7171 "community-list name\n")
7173 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
7176 ALIAS (show_bgp_community_list
,
7177 show_bgp_ipv6_community_list_cmd
,
7178 "show bgp ipv6 community-list (<1-500>|WORD)",
7182 "Display routes matching the community-list\n"
7183 "community-list number\n"
7184 "community-list name\n");
7187 DEFUN (show_ipv6_bgp_community_list
,
7188 show_ipv6_bgp_community_list_cmd
,
7189 "show ipv6 bgp community-list WORD",
7193 "Display routes matching the community-list\n"
7194 "community-list name\n")
7196 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
7200 DEFUN (show_ipv6_mbgp_community_list
,
7201 show_ipv6_mbgp_community_list_cmd
,
7202 "show ipv6 mbgp community-list WORD",
7206 "Display routes matching the community-list\n"
7207 "community-list name\n")
7209 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_MULTICAST
);
7212 DEFUN (show_bgp_community_list_exact
,
7213 show_bgp_community_list_exact_cmd
,
7214 "show bgp community-list (<1-500>|WORD) exact-match",
7217 "Display routes matching the community-list\n"
7218 "community-list number\n"
7219 "community-list name\n"
7220 "Exact match of the communities\n")
7222 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
7225 ALIAS (show_bgp_community_list_exact
,
7226 show_bgp_ipv6_community_list_exact_cmd
,
7227 "show bgp ipv6 community-list (<1-500>|WORD) exact-match",
7231 "Display routes matching the community-list\n"
7232 "community-list number\n"
7233 "community-list name\n"
7234 "Exact match of the communities\n");
7237 DEFUN (show_ipv6_bgp_community_list_exact
,
7238 show_ipv6_bgp_community_list_exact_cmd
,
7239 "show ipv6 bgp community-list WORD exact-match",
7243 "Display routes matching the community-list\n"
7244 "community-list name\n"
7245 "Exact match of the communities\n")
7247 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
7251 DEFUN (show_ipv6_mbgp_community_list_exact
,
7252 show_ipv6_mbgp_community_list_exact_cmd
,
7253 "show ipv6 mbgp community-list WORD exact-match",
7257 "Display routes matching the community-list\n"
7258 "community-list name\n"
7259 "Exact match of the communities\n")
7261 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_MULTICAST
);
7263 #endif /* HAVE_IPV6 */
7266 bgp_show_prefix_longer_clean (struct vty
*vty
)
7270 p
= vty
->output_arg
;
7275 bgp_show_prefix_longer (struct vty
*vty
, char *prefix
, afi_t afi
,
7276 safi_t safi
, enum bgp_show_type type
)
7283 ret
= str2prefix (prefix
, p
);
7286 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
7290 vty
->output_arg
= p
;
7291 vty
->output_clean
= bgp_show_prefix_longer_clean
;
7293 return bgp_show (vty
, NULL
, afi
, safi
, type
);
7296 DEFUN (show_ip_bgp_prefix_longer
,
7297 show_ip_bgp_prefix_longer_cmd
,
7298 "show ip bgp A.B.C.D/M longer-prefixes",
7302 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7303 "Display route and more specific routes\n")
7305 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7306 bgp_show_type_prefix_longer
);
7309 DEFUN (show_ip_bgp_flap_prefix_longer
,
7310 show_ip_bgp_flap_prefix_longer_cmd
,
7311 "show ip bgp flap-statistics A.B.C.D/M longer-prefixes",
7315 "Display flap statistics of routes\n"
7316 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7317 "Display route and more specific routes\n")
7319 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7320 bgp_show_type_flap_prefix_longer
);
7323 DEFUN (show_ip_bgp_ipv4_prefix_longer
,
7324 show_ip_bgp_ipv4_prefix_longer_cmd
,
7325 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes",
7330 "Address Family modifier\n"
7331 "Address Family modifier\n"
7332 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7333 "Display route and more specific routes\n")
7335 if (strncmp (argv
[0], "m", 1) == 0)
7336 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7337 bgp_show_type_prefix_longer
);
7339 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7340 bgp_show_type_prefix_longer
);
7343 DEFUN (show_ip_bgp_flap_address
,
7344 show_ip_bgp_flap_address_cmd
,
7345 "show ip bgp flap-statistics A.B.C.D",
7349 "Display flap statistics of routes\n"
7350 "Network in the BGP routing table to display\n")
7352 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7353 bgp_show_type_flap_address
);
7356 DEFUN (show_ip_bgp_flap_prefix
,
7357 show_ip_bgp_flap_prefix_cmd
,
7358 "show ip bgp flap-statistics A.B.C.D/M",
7362 "Display flap statistics of routes\n"
7363 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7365 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7366 bgp_show_type_flap_prefix
);
7369 DEFUN (show_bgp_prefix_longer
,
7370 show_bgp_prefix_longer_cmd
,
7371 "show bgp X:X::X:X/M longer-prefixes",
7374 "IPv6 prefix <network>/<length>\n"
7375 "Display route and more specific routes\n")
7377 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7378 bgp_show_type_prefix_longer
);
7381 ALIAS (show_bgp_prefix_longer
,
7382 show_bgp_ipv6_prefix_longer_cmd
,
7383 "show bgp ipv6 X:X::X:X/M longer-prefixes",
7387 "IPv6 prefix <network>/<length>\n"
7388 "Display route and more specific routes\n");
7391 DEFUN (show_ipv6_bgp_prefix_longer
,
7392 show_ipv6_bgp_prefix_longer_cmd
,
7393 "show ipv6 bgp X:X::X:X/M longer-prefixes",
7397 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
7398 "Display route and more specific routes\n")
7400 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7401 bgp_show_type_prefix_longer
);
7405 DEFUN (show_ipv6_mbgp_prefix_longer
,
7406 show_ipv6_mbgp_prefix_longer_cmd
,
7407 "show ipv6 mbgp X:X::X:X/M longer-prefixes",
7411 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
7412 "Display route and more specific routes\n")
7414 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
7415 bgp_show_type_prefix_longer
);
7417 #endif /* HAVE_IPV6 */
7420 show_adj_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
,
7423 struct bgp_table
*table
;
7424 struct bgp_adj_in
*ain
;
7425 struct bgp_adj_out
*adj
;
7426 unsigned long output_count
;
7427 struct bgp_node
*rn
;
7432 bgp
= bgp_get_default ();
7437 table
= bgp
->rib
[afi
][safi
];
7441 if (! in
&& CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
7442 PEER_STATUS_DEFAULT_ORIGINATE
))
7444 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
7445 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
7446 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
7448 vty_out (vty
, "Originating default network 0.0.0.0%s%s",
7449 VTY_NEWLINE
, VTY_NEWLINE
);
7453 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
7456 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
7457 if (ain
->peer
== peer
)
7461 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
7462 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
7463 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
7468 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
7473 route_vty_out_tmp (vty
, &rn
->p
, ain
->attr
, safi
);
7480 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
)
7481 if (adj
->peer
== peer
)
7485 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
7486 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
7487 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
7492 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
7497 route_vty_out_tmp (vty
, &rn
->p
, adj
->attr
, safi
);
7503 if (output_count
!= 0)
7504 vty_out (vty
, "%sTotal number of prefixes %ld%s",
7505 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
7509 peer_adj_routes (struct vty
*vty
, char *ip_str
, afi_t afi
, safi_t safi
, int in
)
7515 ret
= str2sockunion (ip_str
, &su
);
7518 vty_out (vty
, "Malformed address: %s%s", ip_str
, VTY_NEWLINE
);
7521 peer
= peer_lookup (NULL
, &su
);
7522 if (! peer
|| ! peer
->afc
[afi
][safi
])
7524 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
7528 if (in
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7530 vty_out (vty
, "%% Inbound soft reconfiguration not enabled%s",
7535 show_adj_route (vty
, peer
, afi
, safi
, in
);
7540 DEFUN (show_ip_bgp_neighbor_advertised_route
,
7541 show_ip_bgp_neighbor_advertised_route_cmd
,
7542 "show ip bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
7546 "Detailed information on TCP and BGP neighbor connections\n"
7547 "Neighbor to display information about\n"
7548 "Neighbor to display information about\n"
7549 "Display the routes advertised to a BGP neighbor\n")
7551 return peer_adj_routes (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, 0);
7554 DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route
,
7555 show_ip_bgp_ipv4_neighbor_advertised_route_cmd
,
7556 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) advertised-routes",
7561 "Address Family modifier\n"
7562 "Address Family modifier\n"
7563 "Detailed information on TCP and BGP neighbor connections\n"
7564 "Neighbor to display information about\n"
7565 "Neighbor to display information about\n"
7566 "Display the routes advertised to a BGP neighbor\n")
7568 if (strncmp (argv
[0], "m", 1) == 0)
7569 return peer_adj_routes (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
, 0);
7571 return peer_adj_routes (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, 0);
7575 DEFUN (show_bgp_neighbor_advertised_route
,
7576 show_bgp_neighbor_advertised_route_cmd
,
7577 "show bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
7580 "Detailed information on TCP and BGP neighbor connections\n"
7581 "Neighbor to display information about\n"
7582 "Neighbor to display information about\n"
7583 "Display the routes advertised to a BGP neighbor\n")
7585 return peer_adj_routes (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0);
7588 ALIAS (show_bgp_neighbor_advertised_route
,
7589 show_bgp_ipv6_neighbor_advertised_route_cmd
,
7590 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes",
7594 "Detailed information on TCP and BGP neighbor connections\n"
7595 "Neighbor to display information about\n"
7596 "Neighbor to display information about\n"
7597 "Display the routes advertised to a BGP neighbor\n");
7600 DEFUN (ipv6_bgp_neighbor_advertised_route
,
7601 ipv6_bgp_neighbor_advertised_route_cmd
,
7602 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
7606 "Detailed information on TCP and BGP neighbor connections\n"
7607 "Neighbor to display information about\n"
7608 "Neighbor to display information about\n"
7609 "Display the routes advertised to a BGP neighbor\n")
7611 return peer_adj_routes (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0);
7615 DEFUN (ipv6_mbgp_neighbor_advertised_route
,
7616 ipv6_mbgp_neighbor_advertised_route_cmd
,
7617 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
7621 "Detailed information on TCP and BGP neighbor connections\n"
7622 "Neighbor to display information about\n"
7623 "Neighbor to display information about\n"
7624 "Display the routes advertised to a BGP neighbor\n")
7626 return peer_adj_routes (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, 0);
7628 #endif /* HAVE_IPV6 */
7630 DEFUN (show_ip_bgp_neighbor_received_routes
,
7631 show_ip_bgp_neighbor_received_routes_cmd
,
7632 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
7636 "Detailed information on TCP and BGP neighbor connections\n"
7637 "Neighbor to display information about\n"
7638 "Neighbor to display information about\n"
7639 "Display the received routes from neighbor\n")
7641 return peer_adj_routes (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, 1);
7644 DEFUN (show_ip_bgp_ipv4_neighbor_received_routes
,
7645 show_ip_bgp_ipv4_neighbor_received_routes_cmd
,
7646 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received-routes",
7651 "Address Family modifier\n"
7652 "Address Family modifier\n"
7653 "Detailed information on TCP and BGP neighbor connections\n"
7654 "Neighbor to display information about\n"
7655 "Neighbor to display information about\n"
7656 "Display the received routes from neighbor\n")
7658 if (strncmp (argv
[0], "m", 1) == 0)
7659 return peer_adj_routes (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
, 1);
7661 return peer_adj_routes (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, 1);
7664 DEFUN (show_ip_bgp_neighbor_received_prefix_filter
,
7665 show_ip_bgp_neighbor_received_prefix_filter_cmd
,
7666 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
7670 "Detailed information on TCP and BGP neighbor connections\n"
7671 "Neighbor to display information about\n"
7672 "Neighbor to display information about\n"
7673 "Display information received from a BGP neighbor\n"
7674 "Display the prefixlist filter\n")
7677 union sockunion
*su
;
7681 su
= sockunion_str2su (argv
[0]);
7685 peer
= peer_lookup (NULL
, su
);
7689 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
7690 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
7693 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
7694 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
7700 DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter
,
7701 show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
,
7702 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
7707 "Address Family modifier\n"
7708 "Address Family modifier\n"
7709 "Detailed information on TCP and BGP neighbor connections\n"
7710 "Neighbor to display information about\n"
7711 "Neighbor to display information about\n"
7712 "Display information received from a BGP neighbor\n"
7713 "Display the prefixlist filter\n")
7716 union sockunion
*su
;
7720 su
= sockunion_str2su (argv
[1]);
7724 peer
= peer_lookup (NULL
, su
);
7728 if (strncmp (argv
[0], "m", 1) == 0)
7730 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_MULTICAST
);
7731 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
7734 vty_out (vty
, "Address family: IPv4 Multicast%s", VTY_NEWLINE
);
7735 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
7740 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
7741 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
7744 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
7745 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
7754 DEFUN (show_bgp_neighbor_received_routes
,
7755 show_bgp_neighbor_received_routes_cmd
,
7756 "show bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
7759 "Detailed information on TCP and BGP neighbor connections\n"
7760 "Neighbor to display information about\n"
7761 "Neighbor to display information about\n"
7762 "Display the received routes from neighbor\n")
7764 return peer_adj_routes (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 1);
7767 ALIAS (show_bgp_neighbor_received_routes
,
7768 show_bgp_ipv6_neighbor_received_routes_cmd
,
7769 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
7773 "Detailed information on TCP and BGP neighbor connections\n"
7774 "Neighbor to display information about\n"
7775 "Neighbor to display information about\n"
7776 "Display the received routes from neighbor\n");
7778 DEFUN (show_bgp_neighbor_received_prefix_filter
,
7779 show_bgp_neighbor_received_prefix_filter_cmd
,
7780 "show bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
7783 "Detailed information on TCP and BGP neighbor connections\n"
7784 "Neighbor to display information about\n"
7785 "Neighbor to display information about\n"
7786 "Display information received from a BGP neighbor\n"
7787 "Display the prefixlist filter\n")
7790 union sockunion
*su
;
7794 su
= sockunion_str2su (argv
[0]);
7798 peer
= peer_lookup (NULL
, su
);
7802 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
7803 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
7806 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
7807 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
7813 ALIAS (show_bgp_neighbor_received_prefix_filter
,
7814 show_bgp_ipv6_neighbor_received_prefix_filter_cmd
,
7815 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
7819 "Detailed information on TCP and BGP neighbor connections\n"
7820 "Neighbor to display information about\n"
7821 "Neighbor to display information about\n"
7822 "Display information received from a BGP neighbor\n"
7823 "Display the prefixlist filter\n");
7826 DEFUN (ipv6_bgp_neighbor_received_routes
,
7827 ipv6_bgp_neighbor_received_routes_cmd
,
7828 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
7832 "Detailed information on TCP and BGP neighbor connections\n"
7833 "Neighbor to display information about\n"
7834 "Neighbor to display information about\n"
7835 "Display the received routes from neighbor\n")
7837 return peer_adj_routes (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 1);
7841 DEFUN (ipv6_mbgp_neighbor_received_routes
,
7842 ipv6_mbgp_neighbor_received_routes_cmd
,
7843 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) received-routes",
7847 "Detailed information on TCP and BGP neighbor connections\n"
7848 "Neighbor to display information about\n"
7849 "Neighbor to display information about\n"
7850 "Display the received routes from neighbor\n")
7852 return peer_adj_routes (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, 1);
7854 #endif /* HAVE_IPV6 */
7857 bgp_show_neighbor_route_clean (struct vty
*vty
)
7859 union sockunion
*su
;
7861 su
= vty
->output_arg
;
7862 XFREE (MTYPE_SOCKUNION
, su
);
7866 bgp_show_neighbor_route (struct vty
*vty
, char *ip_str
, afi_t afi
,
7867 safi_t safi
, enum bgp_show_type type
)
7869 union sockunion
*su
;
7872 su
= sockunion_str2su (ip_str
);
7875 vty_out (vty
, "Malformed address: %s%s", ip_str
, VTY_NEWLINE
);
7879 peer
= peer_lookup (NULL
, su
);
7880 if (! peer
|| ! peer
->afc
[afi
][safi
])
7882 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
7883 XFREE (MTYPE_SOCKUNION
, su
);
7887 vty
->output_arg
= su
;
7888 vty
->output_clean
= bgp_show_neighbor_route_clean
;
7890 return bgp_show (vty
, NULL
, afi
, safi
, type
);
7893 DEFUN (show_ip_bgp_neighbor_routes
,
7894 show_ip_bgp_neighbor_routes_cmd
,
7895 "show ip bgp neighbors (A.B.C.D|X:X::X:X) routes",
7899 "Detailed information on TCP and BGP neighbor connections\n"
7900 "Neighbor to display information about\n"
7901 "Neighbor to display information about\n"
7902 "Display routes learned from neighbor\n")
7904 return bgp_show_neighbor_route (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7905 bgp_show_type_neighbor
);
7908 DEFUN (show_ip_bgp_neighbor_flap
,
7909 show_ip_bgp_neighbor_flap_cmd
,
7910 "show ip bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
7914 "Detailed information on TCP and BGP neighbor connections\n"
7915 "Neighbor to display information about\n"
7916 "Neighbor to display information about\n"
7917 "Display flap statistics of the routes learned from neighbor\n")
7919 return bgp_show_neighbor_route (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7920 bgp_show_type_flap_neighbor
);
7923 DEFUN (show_ip_bgp_neighbor_damp
,
7924 show_ip_bgp_neighbor_damp_cmd
,
7925 "show ip bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
7929 "Detailed information on TCP and BGP neighbor connections\n"
7930 "Neighbor to display information about\n"
7931 "Neighbor to display information about\n"
7932 "Display the dampened routes received from neighbor\n")
7934 return bgp_show_neighbor_route (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7935 bgp_show_type_damp_neighbor
);
7938 DEFUN (show_ip_bgp_ipv4_neighbor_routes
,
7939 show_ip_bgp_ipv4_neighbor_routes_cmd
,
7940 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) routes",
7945 "Address Family modifier\n"
7946 "Address Family modifier\n"
7947 "Detailed information on TCP and BGP neighbor connections\n"
7948 "Neighbor to display information about\n"
7949 "Neighbor to display information about\n"
7950 "Display routes learned from neighbor\n")
7952 if (strncmp (argv
[0], "m", 1) == 0)
7953 return bgp_show_neighbor_route (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7954 bgp_show_type_neighbor
);
7956 return bgp_show_neighbor_route (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7957 bgp_show_type_neighbor
);
7960 DEFUN (show_bgp_neighbor_routes
,
7961 show_bgp_neighbor_routes_cmd
,
7962 "show bgp neighbors (A.B.C.D|X:X::X:X) routes",
7965 "Detailed information on TCP and BGP neighbor connections\n"
7966 "Neighbor to display information about\n"
7967 "Neighbor to display information about\n"
7968 "Display routes learned from neighbor\n")
7970 return bgp_show_neighbor_route (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7971 bgp_show_type_neighbor
);
7974 ALIAS (show_bgp_neighbor_routes
,
7975 show_bgp_ipv6_neighbor_routes_cmd
,
7976 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) routes",
7980 "Detailed information on TCP and BGP neighbor connections\n"
7981 "Neighbor to display information about\n"
7982 "Neighbor to display information about\n"
7983 "Display routes learned from neighbor\n");
7986 DEFUN (ipv6_bgp_neighbor_routes
,
7987 ipv6_bgp_neighbor_routes_cmd
,
7988 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) routes",
7992 "Detailed information on TCP and BGP neighbor connections\n"
7993 "Neighbor to display information about\n"
7994 "Neighbor to display information about\n"
7995 "Display routes learned from neighbor\n")
7997 return bgp_show_neighbor_route (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7998 bgp_show_type_neighbor
);
8002 DEFUN (ipv6_mbgp_neighbor_routes
,
8003 ipv6_mbgp_neighbor_routes_cmd
,
8004 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) routes",
8008 "Detailed information on TCP and BGP neighbor connections\n"
8009 "Neighbor to display information about\n"
8010 "Neighbor to display information about\n"
8011 "Display routes learned from neighbor\n")
8013 return bgp_show_neighbor_route (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
8014 bgp_show_type_neighbor
);
8016 #endif /* HAVE_IPV6 */
8018 struct bgp_table
*bgp_distance_table
;
8022 /* Distance value for the IP source prefix. */
8025 /* Name of the access-list to be matched. */
8029 struct bgp_distance
*
8032 struct bgp_distance
*new;
8033 new = XMALLOC (MTYPE_BGP_DISTANCE
, sizeof (struct bgp_distance
));
8034 memset (new, 0, sizeof (struct bgp_distance
));
8039 bgp_distance_free (struct bgp_distance
*bdistance
)
8041 XFREE (MTYPE_BGP_DISTANCE
, bdistance
);
8045 bgp_distance_set (struct vty
*vty
, char *distance_str
, char *ip_str
,
8046 char *access_list_str
)
8049 struct prefix_ipv4 p
;
8051 struct bgp_node
*rn
;
8052 struct bgp_distance
*bdistance
;
8054 ret
= str2prefix_ipv4 (ip_str
, &p
);
8057 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
8061 distance
= atoi (distance_str
);
8063 /* Get BGP distance node. */
8064 rn
= bgp_node_get (bgp_distance_table
, (struct prefix
*) &p
);
8067 bdistance
= rn
->info
;
8068 bgp_unlock_node (rn
);
8072 bdistance
= bgp_distance_new ();
8073 rn
->info
= bdistance
;
8076 /* Set distance value. */
8077 bdistance
->distance
= distance
;
8079 /* Reset access-list configuration. */
8080 if (bdistance
->access_list
)
8082 free (bdistance
->access_list
);
8083 bdistance
->access_list
= NULL
;
8085 if (access_list_str
)
8086 bdistance
->access_list
= strdup (access_list_str
);
8092 bgp_distance_unset (struct vty
*vty
, char *distance_str
, char *ip_str
,
8093 char *access_list_str
)
8096 struct prefix_ipv4 p
;
8098 struct bgp_node
*rn
;
8099 struct bgp_distance
*bdistance
;
8101 ret
= str2prefix_ipv4 (ip_str
, &p
);
8104 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
8108 distance
= atoi (distance_str
);
8110 rn
= bgp_node_lookup (bgp_distance_table
, (struct prefix
*)&p
);
8113 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
8117 bdistance
= rn
->info
;
8119 if (bdistance
->access_list
)
8120 free (bdistance
->access_list
);
8121 bgp_distance_free (bdistance
);
8124 bgp_unlock_node (rn
);
8125 bgp_unlock_node (rn
);
8131 bgp_distance_reset ()
8133 struct bgp_node
*rn
;
8134 struct bgp_distance
*bdistance
;
8136 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
8137 if ((bdistance
= rn
->info
) != NULL
)
8139 if (bdistance
->access_list
)
8140 free (bdistance
->access_list
);
8141 bgp_distance_free (bdistance
);
8143 bgp_unlock_node (rn
);
8147 /* Apply BGP information to distance method. */
8149 bgp_distance_apply (struct prefix
*p
, struct bgp_info
*rinfo
, struct bgp
*bgp
)
8151 struct bgp_node
*rn
;
8152 struct prefix_ipv4 q
;
8154 struct bgp_distance
*bdistance
;
8155 struct access_list
*alist
;
8156 struct bgp_static
*bgp_static
;
8161 if (p
->family
!= AF_INET
)
8166 if (peer
->su
.sa
.sa_family
!= AF_INET
)
8169 memset (&q
, 0, sizeof (struct prefix_ipv4
));
8171 q
.prefix
= peer
->su
.sin
.sin_addr
;
8172 q
.prefixlen
= IPV4_MAX_BITLEN
;
8174 /* Check source address. */
8175 rn
= bgp_node_match (bgp_distance_table
, (struct prefix
*) &q
);
8178 bdistance
= rn
->info
;
8179 bgp_unlock_node (rn
);
8181 if (bdistance
->access_list
)
8183 alist
= access_list_lookup (AFI_IP
, bdistance
->access_list
);
8184 if (alist
&& access_list_apply (alist
, p
) == FILTER_PERMIT
)
8185 return bdistance
->distance
;
8188 return bdistance
->distance
;
8191 /* Backdoor check. */
8192 rn
= bgp_node_lookup (bgp
->route
[AFI_IP
][SAFI_UNICAST
], p
);
8195 bgp_static
= rn
->info
;
8196 bgp_unlock_node (rn
);
8198 if (bgp_static
->backdoor
)
8200 if (bgp
->distance_local
)
8201 return bgp
->distance_local
;
8203 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
8207 if (peer_sort (peer
) == BGP_PEER_EBGP
)
8209 if (bgp
->distance_ebgp
)
8210 return bgp
->distance_ebgp
;
8211 return ZEBRA_EBGP_DISTANCE_DEFAULT
;
8215 if (bgp
->distance_ibgp
)
8216 return bgp
->distance_ibgp
;
8217 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
8221 DEFUN (bgp_distance
,
8223 "distance bgp <1-255> <1-255> <1-255>",
8224 "Define an administrative distance\n"
8226 "Distance for routes external to the AS\n"
8227 "Distance for routes internal to the AS\n"
8228 "Distance for local routes\n")
8234 bgp
->distance_ebgp
= atoi (argv
[0]);
8235 bgp
->distance_ibgp
= atoi (argv
[1]);
8236 bgp
->distance_local
= atoi (argv
[2]);
8240 DEFUN (no_bgp_distance
,
8241 no_bgp_distance_cmd
,
8242 "no distance bgp <1-255> <1-255> <1-255>",
8244 "Define an administrative distance\n"
8246 "Distance for routes external to the AS\n"
8247 "Distance for routes internal to the AS\n"
8248 "Distance for local routes\n")
8254 bgp
->distance_ebgp
= 0;
8255 bgp
->distance_ibgp
= 0;
8256 bgp
->distance_local
= 0;
8260 ALIAS (no_bgp_distance
,
8261 no_bgp_distance2_cmd
,
8264 "Define an administrative distance\n"
8267 DEFUN (bgp_distance_source
,
8268 bgp_distance_source_cmd
,
8269 "distance <1-255> A.B.C.D/M",
8270 "Define an administrative distance\n"
8271 "Administrative distance\n"
8272 "IP source prefix\n")
8274 bgp_distance_set (vty
, argv
[0], argv
[1], NULL
);
8278 DEFUN (no_bgp_distance_source
,
8279 no_bgp_distance_source_cmd
,
8280 "no distance <1-255> A.B.C.D/M",
8282 "Define an administrative distance\n"
8283 "Administrative distance\n"
8284 "IP source prefix\n")
8286 bgp_distance_unset (vty
, argv
[0], argv
[1], NULL
);
8290 DEFUN (bgp_distance_source_access_list
,
8291 bgp_distance_source_access_list_cmd
,
8292 "distance <1-255> A.B.C.D/M WORD",
8293 "Define an administrative distance\n"
8294 "Administrative distance\n"
8295 "IP source prefix\n"
8296 "Access list name\n")
8298 bgp_distance_set (vty
, argv
[0], argv
[1], argv
[2]);
8302 DEFUN (no_bgp_distance_source_access_list
,
8303 no_bgp_distance_source_access_list_cmd
,
8304 "no distance <1-255> A.B.C.D/M WORD",
8306 "Define an administrative distance\n"
8307 "Administrative distance\n"
8308 "IP source prefix\n"
8309 "Access list name\n")
8311 bgp_distance_unset (vty
, argv
[0], argv
[1], argv
[2]);
8315 DEFUN (bgp_damp_set
,
8317 "bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
8318 "BGP Specific commands\n"
8319 "Enable route-flap dampening\n"
8320 "Half-life time for the penalty\n"
8321 "Value to start reusing a route\n"
8322 "Value to start suppressing a route\n"
8323 "Maximum duration to suppress a stable route\n")
8326 int half
= DEFAULT_HALF_LIFE
* 60;
8327 int reuse
= DEFAULT_REUSE
;
8328 int suppress
= DEFAULT_SUPPRESS
;
8333 half
= atoi (argv
[0]) * 60;
8334 reuse
= atoi (argv
[1]);
8335 suppress
= atoi (argv
[2]);
8336 max
= atoi (argv
[3]) * 60;
8340 half
= atoi (argv
[0]) * 60;
8345 return bgp_damp_enable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
),
8346 half
, reuse
, suppress
, max
);
8349 ALIAS (bgp_damp_set
,
8351 "bgp dampening <1-45>",
8352 "BGP Specific commands\n"
8353 "Enable route-flap dampening\n"
8354 "Half-life time for the penalty\n");
8356 ALIAS (bgp_damp_set
,
8359 "BGP Specific commands\n"
8360 "Enable route-flap dampening\n");
8362 DEFUN (bgp_damp_unset
,
8366 "BGP Specific commands\n"
8367 "Enable route-flap dampening\n")
8372 return bgp_damp_disable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
));
8375 ALIAS (bgp_damp_unset
,
8376 bgp_damp_unset2_cmd
,
8377 "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
8379 "BGP Specific commands\n"
8380 "Enable route-flap dampening\n"
8381 "Half-life time for the penalty\n"
8382 "Value to start reusing a route\n"
8383 "Value to start suppressing a route\n"
8384 "Maximum duration to suppress a stable route\n");
8386 DEFUN (show_ip_bgp_dampened_paths
,
8387 show_ip_bgp_dampened_paths_cmd
,
8388 "show ip bgp dampened-paths",
8392 "Display paths suppressed due to dampening\n")
8394 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_dampend_paths
);
8397 DEFUN (show_ip_bgp_flap_statistics
,
8398 show_ip_bgp_flap_statistics_cmd
,
8399 "show ip bgp flap-statistics",
8403 "Display flap statistics of routes\n")
8405 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_flap_statistics
);
8408 /* Display specified route of BGP table. */
8410 bgp_clear_damp_route (struct vty
*vty
, char *view_name
, char *ip_str
,
8411 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
8415 struct prefix match
;
8416 struct bgp_node
*rn
;
8417 struct bgp_node
*rm
;
8418 struct bgp_info
*ri
;
8419 struct bgp_info
*ri_temp
;
8421 struct bgp_table
*table
;
8423 /* BGP structure lookup. */
8426 bgp
= bgp_lookup_by_name (view_name
);
8429 vty_out (vty
, "%% Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
8435 bgp
= bgp_get_default ();
8438 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
8443 /* Check IP address argument. */
8444 ret
= str2prefix (ip_str
, &match
);
8447 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
8451 match
.family
= afi2family (afi
);
8453 if (safi
== SAFI_MPLS_VPN
)
8455 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= bgp_route_next (rn
))
8457 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
8460 if ((table
= rn
->info
) != NULL
)
8461 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
8462 if (! prefix_check
|| rm
->p
.prefixlen
== match
.prefixlen
)
8470 bgp_damp_info_free (ri
->damp_info
, 1);
8481 if ((rn
= bgp_node_match (bgp
->rib
[afi
][safi
], &match
)) != NULL
)
8482 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
8490 bgp_damp_info_free (ri
->damp_info
, 1);
8502 DEFUN (clear_ip_bgp_dampening
,
8503 clear_ip_bgp_dampening_cmd
,
8504 "clear ip bgp dampening",
8508 "Clear route flap dampening information\n")
8510 bgp_damp_info_clean ();
8514 DEFUN (clear_ip_bgp_dampening_prefix
,
8515 clear_ip_bgp_dampening_prefix_cmd
,
8516 "clear ip bgp dampening A.B.C.D/M",
8520 "Clear route flap dampening information\n"
8521 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
8523 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
8524 SAFI_UNICAST
, NULL
, 1);
8527 DEFUN (clear_ip_bgp_dampening_address
,
8528 clear_ip_bgp_dampening_address_cmd
,
8529 "clear ip bgp dampening A.B.C.D",
8533 "Clear route flap dampening information\n"
8534 "Network to clear damping information\n")
8536 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
8537 SAFI_UNICAST
, NULL
, 0);
8540 DEFUN (clear_ip_bgp_dampening_address_mask
,
8541 clear_ip_bgp_dampening_address_mask_cmd
,
8542 "clear ip bgp dampening A.B.C.D A.B.C.D",
8546 "Clear route flap dampening information\n"
8547 "Network to clear damping information\n"
8551 char prefix_str
[BUFSIZ
];
8553 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
8556 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
8560 return bgp_clear_damp_route (vty
, NULL
, prefix_str
, AFI_IP
,
8561 SAFI_UNICAST
, NULL
, 0);
8565 bgp_config_write_network_vpnv4 (struct vty
*vty
, struct bgp
*bgp
,
8566 afi_t afi
, safi_t safi
, int *write
)
8568 struct bgp_node
*prn
;
8569 struct bgp_node
*rn
;
8570 struct bgp_table
*table
;
8572 struct prefix_rd
*prd
;
8573 struct bgp_static
*bgp_static
;
8575 char buf
[SU_ADDRSTRLEN
];
8576 char rdbuf
[RD_ADDRSTRLEN
];
8578 /* Network configuration. */
8579 for (prn
= bgp_table_top (bgp
->route
[afi
][safi
]); prn
; prn
= bgp_route_next (prn
))
8580 if ((table
= prn
->info
) != NULL
)
8581 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
8582 if ((bgp_static
= rn
->info
) != NULL
)
8585 prd
= (struct prefix_rd
*) &prn
->p
;
8587 /* "address-family" display. */
8588 bgp_config_write_family_header (vty
, afi
, safi
, write
);
8590 /* "network" configuration display. */
8591 prefix_rd2str (prd
, rdbuf
, RD_ADDRSTRLEN
);
8592 label
= decode_label (bgp_static
->tag
);
8594 vty_out (vty
, " network %s/%d rd %s tag %d",
8595 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
8598 vty_out (vty
, "%s", VTY_NEWLINE
);
8603 /* Configuration of static route announcement and aggregate
8606 bgp_config_write_network (struct vty
*vty
, struct bgp
*bgp
,
8607 afi_t afi
, safi_t safi
, int *write
)
8609 struct bgp_node
*rn
;
8611 struct bgp_static
*bgp_static
;
8612 struct bgp_aggregate
*bgp_aggregate
;
8613 char buf
[SU_ADDRSTRLEN
];
8615 if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
8616 return bgp_config_write_network_vpnv4 (vty
, bgp
, afi
, safi
, write
);
8618 /* Network configuration. */
8619 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
8620 if ((bgp_static
= rn
->info
) != NULL
)
8624 /* "address-family" display. */
8625 bgp_config_write_family_header (vty
, afi
, safi
, write
);
8627 /* "network" configuration display. */
8628 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
8630 u_int32_t destination
;
8631 struct in_addr netmask
;
8633 destination
= ntohl (p
->u
.prefix4
.s_addr
);
8634 masklen2ip (p
->prefixlen
, &netmask
);
8635 vty_out (vty
, " network %s",
8636 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
));
8638 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
8639 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
8640 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
8641 || p
->u
.prefix4
.s_addr
== 0)
8643 /* Natural mask is not display. */
8646 vty_out (vty
, " mask %s", inet_ntoa (netmask
));
8650 vty_out (vty
, " network %s/%d",
8651 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
8655 if (bgp_static
->rmap
.name
)
8656 vty_out (vty
, " route-map %s", bgp_static
->rmap
.name
);
8657 else if (bgp_static
->backdoor
)
8658 vty_out (vty
, " backdoor");
8660 vty_out (vty
, "%s", VTY_NEWLINE
);
8663 /* Aggregate-address configuration. */
8664 for (rn
= bgp_table_top (bgp
->aggregate
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
8665 if ((bgp_aggregate
= rn
->info
) != NULL
)
8669 /* "address-family" display. */
8670 bgp_config_write_family_header (vty
, afi
, safi
, write
);
8672 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
8674 struct in_addr netmask
;
8676 masklen2ip (p
->prefixlen
, &netmask
);
8677 vty_out (vty
, " aggregate-address %s %s",
8678 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
8679 inet_ntoa (netmask
));
8683 vty_out (vty
, " aggregate-address %s/%d",
8684 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
8688 if (bgp_aggregate
->as_set
)
8689 vty_out (vty
, " as-set");
8691 if (bgp_aggregate
->summary_only
)
8692 vty_out (vty
, " summary-only");
8694 vty_out (vty
, "%s", VTY_NEWLINE
);
8701 bgp_config_write_distance (struct vty
*vty
, struct bgp
*bgp
)
8703 struct bgp_node
*rn
;
8704 struct bgp_distance
*bdistance
;
8706 /* Distance configuration. */
8707 if (bgp
->distance_ebgp
8708 && bgp
->distance_ibgp
8709 && bgp
->distance_local
8710 && (bgp
->distance_ebgp
!= ZEBRA_EBGP_DISTANCE_DEFAULT
8711 || bgp
->distance_ibgp
!= ZEBRA_IBGP_DISTANCE_DEFAULT
8712 || bgp
->distance_local
!= ZEBRA_IBGP_DISTANCE_DEFAULT
))
8713 vty_out (vty
, " distance bgp %d %d %d%s",
8714 bgp
->distance_ebgp
, bgp
->distance_ibgp
, bgp
->distance_local
,
8717 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
8718 if ((bdistance
= rn
->info
) != NULL
)
8720 vty_out (vty
, " distance %d %s/%d %s%s", bdistance
->distance
,
8721 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
8722 bdistance
->access_list
? bdistance
->access_list
: "",
8729 /* Allocate routing table structure and install commands. */
8733 /* Init BGP distance table. */
8734 bgp_distance_table
= bgp_table_init ();
8736 /* IPv4 BGP commands. */
8737 install_element (BGP_NODE
, &bgp_network_cmd
);
8738 install_element (BGP_NODE
, &bgp_network_mask_cmd
);
8739 install_element (BGP_NODE
, &bgp_network_mask_natural_cmd
);
8740 install_element (BGP_NODE
, &bgp_network_route_map_cmd
);
8741 install_element (BGP_NODE
, &bgp_network_mask_route_map_cmd
);
8742 install_element (BGP_NODE
, &bgp_network_mask_natural_route_map_cmd
);
8743 install_element (BGP_NODE
, &bgp_network_backdoor_cmd
);
8744 install_element (BGP_NODE
, &bgp_network_mask_backdoor_cmd
);
8745 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_cmd
);
8746 install_element (BGP_NODE
, &no_bgp_network_cmd
);
8747 install_element (BGP_NODE
, &no_bgp_network_mask_cmd
);
8748 install_element (BGP_NODE
, &no_bgp_network_mask_natural_cmd
);
8749 install_element (BGP_NODE
, &no_bgp_network_route_map_cmd
);
8750 install_element (BGP_NODE
, &no_bgp_network_mask_route_map_cmd
);
8751 install_element (BGP_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
8752 install_element (BGP_NODE
, &no_bgp_network_backdoor_cmd
);
8753 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_cmd
);
8754 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_cmd
);
8756 install_element (BGP_NODE
, &aggregate_address_cmd
);
8757 install_element (BGP_NODE
, &aggregate_address_mask_cmd
);
8758 install_element (BGP_NODE
, &aggregate_address_summary_only_cmd
);
8759 install_element (BGP_NODE
, &aggregate_address_mask_summary_only_cmd
);
8760 install_element (BGP_NODE
, &aggregate_address_as_set_cmd
);
8761 install_element (BGP_NODE
, &aggregate_address_mask_as_set_cmd
);
8762 install_element (BGP_NODE
, &aggregate_address_as_set_summary_cmd
);
8763 install_element (BGP_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
8764 install_element (BGP_NODE
, &aggregate_address_summary_as_set_cmd
);
8765 install_element (BGP_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
8766 install_element (BGP_NODE
, &no_aggregate_address_cmd
);
8767 install_element (BGP_NODE
, &no_aggregate_address_summary_only_cmd
);
8768 install_element (BGP_NODE
, &no_aggregate_address_as_set_cmd
);
8769 install_element (BGP_NODE
, &no_aggregate_address_as_set_summary_cmd
);
8770 install_element (BGP_NODE
, &no_aggregate_address_summary_as_set_cmd
);
8771 install_element (BGP_NODE
, &no_aggregate_address_mask_cmd
);
8772 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
8773 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_cmd
);
8774 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
8775 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
8777 /* IPv4 unicast configuration. */
8778 install_element (BGP_IPV4_NODE
, &bgp_network_cmd
);
8779 install_element (BGP_IPV4_NODE
, &bgp_network_mask_cmd
);
8780 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_cmd
);
8781 install_element (BGP_IPV4_NODE
, &bgp_network_route_map_cmd
);
8782 install_element (BGP_IPV4_NODE
, &bgp_network_mask_route_map_cmd
);
8783 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_route_map_cmd
);
8784 install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
8785 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_cmd
);
8786 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_cmd
);
8787 install_element (BGP_IPV4_NODE
, &no_bgp_network_route_map_cmd
);
8788 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_route_map_cmd
);
8789 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
8790 install_element (BGP_IPV4_NODE
, &aggregate_address_cmd
);
8791 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_cmd
);
8792 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_only_cmd
);
8793 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_only_cmd
);
8794 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_cmd
);
8795 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_cmd
);
8796 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_summary_cmd
);
8797 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
8798 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_as_set_cmd
);
8799 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
8800 install_element (BGP_IPV4_NODE
, &no_aggregate_address_cmd
);
8801 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_only_cmd
);
8802 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_cmd
);
8803 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_summary_cmd
);
8804 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_as_set_cmd
);
8805 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_cmd
);
8806 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
8807 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_cmd
);
8808 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
8809 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
8811 /* IPv4 multicast configuration. */
8812 install_element (BGP_IPV4M_NODE
, &bgp_network_cmd
);
8813 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_cmd
);
8814 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_cmd
);
8815 install_element (BGP_IPV4M_NODE
, &bgp_network_route_map_cmd
);
8816 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_route_map_cmd
);
8817 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_route_map_cmd
);
8818 install_element (BGP_IPV4M_NODE
, &no_bgp_network_cmd
);
8819 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_cmd
);
8820 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_cmd
);
8821 install_element (BGP_IPV4M_NODE
, &no_bgp_network_route_map_cmd
);
8822 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_route_map_cmd
);
8823 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
8824 install_element (BGP_IPV4M_NODE
, &aggregate_address_cmd
);
8825 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_cmd
);
8826 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_only_cmd
);
8827 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_only_cmd
);
8828 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_cmd
);
8829 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_cmd
);
8830 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_summary_cmd
);
8831 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
8832 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_as_set_cmd
);
8833 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
8834 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_cmd
);
8835 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_only_cmd
);
8836 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_cmd
);
8837 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_summary_cmd
);
8838 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_as_set_cmd
);
8839 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_cmd
);
8840 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
8841 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_cmd
);
8842 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
8843 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
8845 install_element (VIEW_NODE
, &show_ip_bgp_cmd
);
8846 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cmd
);
8847 install_element (VIEW_NODE
, &show_ip_bgp_route_cmd
);
8848 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_cmd
);
8849 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
8850 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
8851 install_element (VIEW_NODE
, &show_ip_bgp_prefix_cmd
);
8852 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
8853 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
8854 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
8855 install_element (VIEW_NODE
, &show_ip_bgp_view_cmd
);
8856 install_element (VIEW_NODE
, &show_ip_bgp_view_route_cmd
);
8857 install_element (VIEW_NODE
, &show_ip_bgp_view_prefix_cmd
);
8858 install_element (VIEW_NODE
, &show_ip_bgp_regexp_cmd
);
8859 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
8860 install_element (VIEW_NODE
, &show_ip_bgp_prefix_list_cmd
);
8861 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
8862 install_element (VIEW_NODE
, &show_ip_bgp_filter_list_cmd
);
8863 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
8864 install_element (VIEW_NODE
, &show_ip_bgp_route_map_cmd
);
8865 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
8866 install_element (VIEW_NODE
, &show_ip_bgp_cidr_only_cmd
);
8867 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
8868 install_element (VIEW_NODE
, &show_ip_bgp_community_all_cmd
);
8869 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
8870 install_element (VIEW_NODE
, &show_ip_bgp_community_cmd
);
8871 install_element (VIEW_NODE
, &show_ip_bgp_community2_cmd
);
8872 install_element (VIEW_NODE
, &show_ip_bgp_community3_cmd
);
8873 install_element (VIEW_NODE
, &show_ip_bgp_community4_cmd
);
8874 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_cmd
);
8875 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
8876 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
8877 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
8878 install_element (VIEW_NODE
, &show_ip_bgp_community_exact_cmd
);
8879 install_element (VIEW_NODE
, &show_ip_bgp_community2_exact_cmd
);
8880 install_element (VIEW_NODE
, &show_ip_bgp_community3_exact_cmd
);
8881 install_element (VIEW_NODE
, &show_ip_bgp_community4_exact_cmd
);
8882 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
8883 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
8884 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
8885 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
8886 install_element (VIEW_NODE
, &show_ip_bgp_community_list_cmd
);
8887 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
8888 install_element (VIEW_NODE
, &show_ip_bgp_community_list_exact_cmd
);
8889 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
8890 install_element (VIEW_NODE
, &show_ip_bgp_prefix_longer_cmd
);
8891 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
8892 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
8893 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
8894 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
8895 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
8896 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
8897 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
8898 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
8899 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
8900 install_element (VIEW_NODE
, &show_ip_bgp_dampened_paths_cmd
);
8901 install_element (VIEW_NODE
, &show_ip_bgp_flap_statistics_cmd
);
8902 install_element (VIEW_NODE
, &show_ip_bgp_flap_address_cmd
);
8903 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_cmd
);
8904 install_element (VIEW_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
8905 install_element (VIEW_NODE
, &show_ip_bgp_flap_regexp_cmd
);
8906 install_element (VIEW_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
8907 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
8908 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
8909 install_element (VIEW_NODE
, &show_ip_bgp_flap_route_map_cmd
);
8910 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
8911 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
8913 install_element (ENABLE_NODE
, &show_ip_bgp_cmd
);
8914 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cmd
);
8915 install_element (ENABLE_NODE
, &show_ip_bgp_route_cmd
);
8916 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_cmd
);
8917 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
8918 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
8919 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_cmd
);
8920 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
8921 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
8922 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
8923 install_element (ENABLE_NODE
, &show_ip_bgp_view_cmd
);
8924 install_element (ENABLE_NODE
, &show_ip_bgp_view_route_cmd
);
8925 install_element (ENABLE_NODE
, &show_ip_bgp_view_prefix_cmd
);
8926 install_element (ENABLE_NODE
, &show_ip_bgp_regexp_cmd
);
8927 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
8928 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_list_cmd
);
8929 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
8930 install_element (ENABLE_NODE
, &show_ip_bgp_filter_list_cmd
);
8931 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
8932 install_element (ENABLE_NODE
, &show_ip_bgp_route_map_cmd
);
8933 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
8934 install_element (ENABLE_NODE
, &show_ip_bgp_cidr_only_cmd
);
8935 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
8936 install_element (ENABLE_NODE
, &show_ip_bgp_community_all_cmd
);
8937 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
8938 install_element (ENABLE_NODE
, &show_ip_bgp_community_cmd
);
8939 install_element (ENABLE_NODE
, &show_ip_bgp_community2_cmd
);
8940 install_element (ENABLE_NODE
, &show_ip_bgp_community3_cmd
);
8941 install_element (ENABLE_NODE
, &show_ip_bgp_community4_cmd
);
8942 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_cmd
);
8943 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
8944 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
8945 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
8946 install_element (ENABLE_NODE
, &show_ip_bgp_community_exact_cmd
);
8947 install_element (ENABLE_NODE
, &show_ip_bgp_community2_exact_cmd
);
8948 install_element (ENABLE_NODE
, &show_ip_bgp_community3_exact_cmd
);
8949 install_element (ENABLE_NODE
, &show_ip_bgp_community4_exact_cmd
);
8950 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
8951 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
8952 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
8953 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
8954 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_cmd
);
8955 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
8956 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_exact_cmd
);
8957 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
8958 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_longer_cmd
);
8959 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
8960 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
8961 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
8962 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
8963 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
8964 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
8965 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
8966 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
8967 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
8968 install_element (ENABLE_NODE
, &show_ip_bgp_dampened_paths_cmd
);
8969 install_element (ENABLE_NODE
, &show_ip_bgp_flap_statistics_cmd
);
8970 install_element (ENABLE_NODE
, &show_ip_bgp_flap_address_cmd
);
8971 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_cmd
);
8972 install_element (ENABLE_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
8973 install_element (ENABLE_NODE
, &show_ip_bgp_flap_regexp_cmd
);
8974 install_element (ENABLE_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
8975 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
8976 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
8977 install_element (ENABLE_NODE
, &show_ip_bgp_flap_route_map_cmd
);
8978 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
8979 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
8981 /* BGP dampening clear commands */
8982 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_cmd
);
8983 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_prefix_cmd
);
8984 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_cmd
);
8985 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_mask_cmd
);
8988 /* New config IPv6 BGP commands. */
8989 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_cmd
);
8990 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_route_map_cmd
);
8991 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_cmd
);
8992 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_route_map_cmd
);
8994 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_cmd
);
8995 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_summary_only_cmd
);
8996 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_cmd
);
8997 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_summary_only_cmd
);
8999 /* Old config IPv6 BGP commands. */
9000 install_element (BGP_NODE
, &old_ipv6_bgp_network_cmd
);
9001 install_element (BGP_NODE
, &old_no_ipv6_bgp_network_cmd
);
9003 install_element (BGP_NODE
, &old_ipv6_aggregate_address_cmd
);
9004 install_element (BGP_NODE
, &old_ipv6_aggregate_address_summary_only_cmd
);
9005 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_cmd
);
9006 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_summary_only_cmd
);
9008 install_element (VIEW_NODE
, &show_bgp_cmd
);
9009 install_element (VIEW_NODE
, &show_bgp_ipv6_cmd
);
9010 install_element (VIEW_NODE
, &show_bgp_route_cmd
);
9011 install_element (VIEW_NODE
, &show_bgp_ipv6_route_cmd
);
9012 install_element (VIEW_NODE
, &show_bgp_prefix_cmd
);
9013 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_cmd
);
9014 install_element (VIEW_NODE
, &show_bgp_regexp_cmd
);
9015 install_element (VIEW_NODE
, &show_bgp_ipv6_regexp_cmd
);
9016 install_element (VIEW_NODE
, &show_bgp_prefix_list_cmd
);
9017 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
9018 install_element (VIEW_NODE
, &show_bgp_filter_list_cmd
);
9019 install_element (VIEW_NODE
, &show_bgp_ipv6_filter_list_cmd
);
9020 install_element (VIEW_NODE
, &show_bgp_route_map_cmd
);
9021 install_element (VIEW_NODE
, &show_bgp_ipv6_route_map_cmd
);
9022 install_element (VIEW_NODE
, &show_bgp_community_all_cmd
);
9023 install_element (VIEW_NODE
, &show_bgp_ipv6_community_all_cmd
);
9024 install_element (VIEW_NODE
, &show_bgp_community_cmd
);
9025 install_element (VIEW_NODE
, &show_bgp_ipv6_community_cmd
);
9026 install_element (VIEW_NODE
, &show_bgp_community2_cmd
);
9027 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_cmd
);
9028 install_element (VIEW_NODE
, &show_bgp_community3_cmd
);
9029 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_cmd
);
9030 install_element (VIEW_NODE
, &show_bgp_community4_cmd
);
9031 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_cmd
);
9032 install_element (VIEW_NODE
, &show_bgp_community_exact_cmd
);
9033 install_element (VIEW_NODE
, &show_bgp_ipv6_community_exact_cmd
);
9034 install_element (VIEW_NODE
, &show_bgp_community2_exact_cmd
);
9035 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
9036 install_element (VIEW_NODE
, &show_bgp_community3_exact_cmd
);
9037 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
9038 install_element (VIEW_NODE
, &show_bgp_community4_exact_cmd
);
9039 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
9040 install_element (VIEW_NODE
, &show_bgp_community_list_cmd
);
9041 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_cmd
);
9042 install_element (VIEW_NODE
, &show_bgp_community_list_exact_cmd
);
9043 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
9044 install_element (VIEW_NODE
, &show_bgp_prefix_longer_cmd
);
9045 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
9046 install_element (VIEW_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
9047 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
9048 install_element (VIEW_NODE
, &show_bgp_neighbor_received_routes_cmd
);
9049 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
9050 install_element (VIEW_NODE
, &show_bgp_neighbor_routes_cmd
);
9051 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
9052 install_element (VIEW_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
9053 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
9055 install_element (ENABLE_NODE
, &show_bgp_cmd
);
9056 install_element (ENABLE_NODE
, &show_bgp_ipv6_cmd
);
9057 install_element (ENABLE_NODE
, &show_bgp_route_cmd
);
9058 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_cmd
);
9059 install_element (ENABLE_NODE
, &show_bgp_prefix_cmd
);
9060 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_cmd
);
9061 install_element (ENABLE_NODE
, &show_bgp_regexp_cmd
);
9062 install_element (ENABLE_NODE
, &show_bgp_ipv6_regexp_cmd
);
9063 install_element (ENABLE_NODE
, &show_bgp_prefix_list_cmd
);
9064 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
9065 install_element (ENABLE_NODE
, &show_bgp_filter_list_cmd
);
9066 install_element (ENABLE_NODE
, &show_bgp_ipv6_filter_list_cmd
);
9067 install_element (ENABLE_NODE
, &show_bgp_route_map_cmd
);
9068 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_map_cmd
);
9069 install_element (ENABLE_NODE
, &show_bgp_community_all_cmd
);
9070 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_all_cmd
);
9071 install_element (ENABLE_NODE
, &show_bgp_community_cmd
);
9072 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_cmd
);
9073 install_element (ENABLE_NODE
, &show_bgp_community2_cmd
);
9074 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_cmd
);
9075 install_element (ENABLE_NODE
, &show_bgp_community3_cmd
);
9076 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_cmd
);
9077 install_element (ENABLE_NODE
, &show_bgp_community4_cmd
);
9078 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_cmd
);
9079 install_element (ENABLE_NODE
, &show_bgp_community_exact_cmd
);
9080 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_exact_cmd
);
9081 install_element (ENABLE_NODE
, &show_bgp_community2_exact_cmd
);
9082 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
9083 install_element (ENABLE_NODE
, &show_bgp_community3_exact_cmd
);
9084 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
9085 install_element (ENABLE_NODE
, &show_bgp_community4_exact_cmd
);
9086 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
9087 install_element (ENABLE_NODE
, &show_bgp_community_list_cmd
);
9088 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_cmd
);
9089 install_element (ENABLE_NODE
, &show_bgp_community_list_exact_cmd
);
9090 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
9091 install_element (ENABLE_NODE
, &show_bgp_prefix_longer_cmd
);
9092 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
9093 install_element (ENABLE_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
9094 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
9095 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_routes_cmd
);
9096 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
9097 install_element (ENABLE_NODE
, &show_bgp_neighbor_routes_cmd
);
9098 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
9099 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
9100 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
9103 install_element (VIEW_NODE
, &show_ipv6_bgp_cmd
);
9104 install_element (VIEW_NODE
, &show_ipv6_bgp_route_cmd
);
9105 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_cmd
);
9106 install_element (VIEW_NODE
, &show_ipv6_bgp_regexp_cmd
);
9107 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
9108 install_element (VIEW_NODE
, &show_ipv6_bgp_filter_list_cmd
);
9109 install_element (VIEW_NODE
, &show_ipv6_bgp_community_all_cmd
);
9110 install_element (VIEW_NODE
, &show_ipv6_bgp_community_cmd
);
9111 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_cmd
);
9112 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_cmd
);
9113 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_cmd
);
9114 install_element (VIEW_NODE
, &show_ipv6_bgp_community_exact_cmd
);
9115 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
9116 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
9117 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
9118 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_cmd
);
9119 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
9120 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
9121 install_element (VIEW_NODE
, &show_ipv6_mbgp_cmd
);
9122 install_element (VIEW_NODE
, &show_ipv6_mbgp_route_cmd
);
9123 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_cmd
);
9124 install_element (VIEW_NODE
, &show_ipv6_mbgp_regexp_cmd
);
9125 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
9126 install_element (VIEW_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
9127 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_all_cmd
);
9128 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_cmd
);
9129 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_cmd
);
9130 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_cmd
);
9131 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_cmd
);
9132 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
9133 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
9134 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
9135 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
9136 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_cmd
);
9137 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
9138 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
9141 install_element (ENABLE_NODE
, &show_ipv6_bgp_cmd
);
9142 install_element (ENABLE_NODE
, &show_ipv6_bgp_route_cmd
);
9143 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_cmd
);
9144 install_element (ENABLE_NODE
, &show_ipv6_bgp_regexp_cmd
);
9145 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
9146 install_element (ENABLE_NODE
, &show_ipv6_bgp_filter_list_cmd
);
9147 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_all_cmd
);
9148 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_cmd
);
9149 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_cmd
);
9150 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_cmd
);
9151 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_cmd
);
9152 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_exact_cmd
);
9153 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
9154 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
9155 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
9156 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_cmd
);
9157 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
9158 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
9159 install_element (ENABLE_NODE
, &show_ipv6_mbgp_cmd
);
9160 install_element (ENABLE_NODE
, &show_ipv6_mbgp_route_cmd
);
9161 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_cmd
);
9162 install_element (ENABLE_NODE
, &show_ipv6_mbgp_regexp_cmd
);
9163 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
9164 install_element (ENABLE_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
9165 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_all_cmd
);
9166 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_cmd
);
9167 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_cmd
);
9168 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_cmd
);
9169 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_cmd
);
9170 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
9171 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
9172 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
9173 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
9174 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_cmd
);
9175 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
9176 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
9179 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
9180 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
9181 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
9182 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
9185 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
9186 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
9187 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
9188 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
9191 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
9192 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
9193 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
9194 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
9195 #endif /* HAVE_IPV6 */
9197 install_element (BGP_NODE
, &bgp_distance_cmd
);
9198 install_element (BGP_NODE
, &no_bgp_distance_cmd
);
9199 install_element (BGP_NODE
, &no_bgp_distance2_cmd
);
9200 install_element (BGP_NODE
, &bgp_distance_source_cmd
);
9201 install_element (BGP_NODE
, &no_bgp_distance_source_cmd
);
9202 install_element (BGP_NODE
, &bgp_distance_source_access_list_cmd
);
9203 install_element (BGP_NODE
, &no_bgp_distance_source_access_list_cmd
);
9205 install_element (BGP_NODE
, &bgp_damp_set_cmd
);
9206 install_element (BGP_NODE
, &bgp_damp_set2_cmd
);
9207 install_element (BGP_NODE
, &bgp_damp_set3_cmd
);
9208 install_element (BGP_NODE
, &bgp_damp_unset_cmd
);
9209 install_element (BGP_NODE
, &bgp_damp_unset2_cmd
);
9210 install_element (BGP_IPV4_NODE
, &bgp_damp_set_cmd
);
9211 install_element (BGP_IPV4_NODE
, &bgp_damp_set2_cmd
);
9212 install_element (BGP_IPV4_NODE
, &bgp_damp_set3_cmd
);
9213 install_element (BGP_IPV4_NODE
, &bgp_damp_unset_cmd
);
9214 install_element (BGP_IPV4_NODE
, &bgp_damp_unset2_cmd
);