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"
56 /* Extern from bgp_dump.c */
57 extern char *bgp_origin_str
[];
58 extern char *bgp_origin_long_str
[];
61 bgp_afi_node_get (struct bgp
*bgp
, afi_t afi
, safi_t safi
, struct prefix
*p
,
62 struct prefix_rd
*prd
)
65 struct bgp_node
*prn
= NULL
;
66 struct bgp_table
*table
;
68 if (safi
== SAFI_MPLS_VPN
)
70 prn
= bgp_node_get (bgp
->rib
[afi
][safi
], (struct prefix
*) prd
);
72 if (prn
->info
== NULL
)
73 prn
->info
= bgp_table_init ();
75 bgp_unlock_node (prn
);
79 table
= bgp
->rib
[afi
][safi
];
81 rn
= bgp_node_get (table
, p
);
83 if (safi
== SAFI_MPLS_VPN
)
89 /* Allocate new bgp info structure. */
95 new = XMALLOC (MTYPE_BGP_ROUTE
, sizeof (struct bgp_info
));
96 memset (new, 0, sizeof (struct bgp_info
));
101 /* Free bgp route information. */
103 bgp_info_free (struct bgp_info
*binfo
)
106 bgp_attr_unintern (binfo
->attr
);
108 if (binfo
->damp_info
)
109 bgp_damp_info_free (binfo
->damp_info
, 0);
111 XFREE (MTYPE_BGP_ROUTE
, binfo
);
115 bgp_info_add (struct bgp_node
*rn
, struct bgp_info
*ri
)
117 struct bgp_info
*top
;
129 bgp_info_delete (struct bgp_node
*rn
, struct bgp_info
*ri
)
132 ri
->next
->prev
= ri
->prev
;
134 ri
->prev
->next
= ri
->next
;
139 /* Get MED value. If MED value is missing and "bgp bestpath
140 missing-as-worst" is specified, treat it as the worst value. */
142 bgp_med_value (struct attr
*attr
, struct bgp
*bgp
)
144 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
148 if (bgp_flag_check (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
))
155 /* Compare two bgp route entity. br is preferable then return 1. */
157 bgp_info_cmp (struct bgp
*bgp
, struct bgp_info
*new, struct bgp_info
*exist
)
160 u_int32_t exist_pref
;
163 struct in_addr new_id
;
164 struct in_addr exist_id
;
167 int internal_as_route
= 0;
168 int confed_as_route
= 0;
177 /* 1. Weight check. */
178 if (new->attr
->weight
> exist
->attr
->weight
)
180 if (new->attr
->weight
< exist
->attr
->weight
)
183 /* 2. Local preference check. */
184 if (new->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
185 new_pref
= new->attr
->local_pref
;
187 new_pref
= bgp
->default_local_pref
;
189 if (exist
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
190 exist_pref
= exist
->attr
->local_pref
;
192 exist_pref
= bgp
->default_local_pref
;
194 if (new_pref
> exist_pref
)
196 if (new_pref
< exist_pref
)
199 /* 3. Local route check. */
200 if (new->sub_type
== BGP_ROUTE_STATIC
)
202 if (exist
->sub_type
== BGP_ROUTE_STATIC
)
205 if (new->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
207 if (exist
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
210 if (new->sub_type
== BGP_ROUTE_AGGREGATE
)
212 if (exist
->sub_type
== BGP_ROUTE_AGGREGATE
)
215 /* 4. AS path length check. */
216 if (! bgp_flag_check (bgp
, BGP_FLAG_ASPATH_IGNORE
))
218 if (new->attr
->aspath
->count
< exist
->attr
->aspath
->count
)
220 if (new->attr
->aspath
->count
> exist
->attr
->aspath
->count
)
224 /* 5. Origin check. */
225 if (new->attr
->origin
< exist
->attr
->origin
)
227 if (new->attr
->origin
> exist
->attr
->origin
)
231 internal_as_route
= (new->attr
->aspath
->length
== 0
232 && exist
->attr
->aspath
->length
== 0);
233 confed_as_route
= (new->attr
->aspath
->length
> 0
234 && exist
->attr
->aspath
->length
> 0
235 && new->attr
->aspath
->count
== 0
236 && exist
->attr
->aspath
->count
== 0);
238 if (bgp_flag_check (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
)
239 || (bgp_flag_check (bgp
, BGP_FLAG_MED_CONFED
)
241 || aspath_cmp_left (new->attr
->aspath
, exist
->attr
->aspath
)
242 || aspath_cmp_left_confed (new->attr
->aspath
, exist
->attr
->aspath
)
243 || internal_as_route
)
245 new_med
= bgp_med_value (new->attr
, bgp
);
246 exist_med
= bgp_med_value (exist
->attr
, bgp
);
248 if (new_med
< exist_med
)
250 if (new_med
> exist_med
)
254 /* 7. Peer type check. */
255 if (peer_sort (new->peer
) == BGP_PEER_EBGP
256 && peer_sort (exist
->peer
) == BGP_PEER_IBGP
)
258 if (peer_sort (new->peer
) == BGP_PEER_EBGP
259 && peer_sort (exist
->peer
) == BGP_PEER_CONFED
)
261 if (peer_sort (new->peer
) == BGP_PEER_IBGP
262 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
264 if (peer_sort (new->peer
) == BGP_PEER_CONFED
265 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
268 /* 8. IGP metric check. */
269 if (new->igpmetric
< exist
->igpmetric
)
271 if (new->igpmetric
> exist
->igpmetric
)
274 /* 9. Maximum path check. */
276 /* 10. If both paths are external, prefer the path that was received
277 first (the oldest one). This step minimizes route-flap, since a
278 newer path won't displace an older one, even if it was the
279 preferred route based on the additional decision criteria below. */
280 if (! bgp_flag_check (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
)
281 && peer_sort (new->peer
) == BGP_PEER_EBGP
282 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
284 if (CHECK_FLAG (new->flags
, BGP_INFO_SELECTED
))
286 if (CHECK_FLAG (exist
->flags
, BGP_INFO_SELECTED
))
290 /* 11. Rourter-ID comparision. */
291 if (new->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
292 new_id
.s_addr
= new->attr
->originator_id
.s_addr
;
294 new_id
.s_addr
= new->peer
->remote_id
.s_addr
;
295 if (exist
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
296 exist_id
.s_addr
= exist
->attr
->originator_id
.s_addr
;
298 exist_id
.s_addr
= exist
->peer
->remote_id
.s_addr
;
300 if (ntohl (new_id
.s_addr
) < ntohl (exist_id
.s_addr
))
302 if (ntohl (new_id
.s_addr
) > ntohl (exist_id
.s_addr
))
305 /* 12. Cluster length comparision. */
306 if (new->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
307 new_cluster
= new->attr
->cluster
->length
;
310 if (exist
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
311 exist_cluster
= exist
->attr
->cluster
->length
;
315 if (new_cluster
< exist_cluster
)
317 if (new_cluster
> exist_cluster
)
320 /* 13. Neighbor address comparision. */
321 ret
= sockunion_cmp (new->peer
->su_remote
, exist
->peer
->su_remote
);
332 bgp_input_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
333 afi_t afi
, safi_t safi
)
335 struct bgp_filter
*filter
;
337 filter
= &peer
->filter
[afi
][safi
];
339 if (DISTRIBUTE_IN_NAME (filter
))
340 if (access_list_apply (DISTRIBUTE_IN (filter
), p
) == FILTER_DENY
)
343 if (PREFIX_LIST_IN_NAME (filter
))
344 if (prefix_list_apply (PREFIX_LIST_IN (filter
), p
) == PREFIX_DENY
)
347 if (FILTER_LIST_IN_NAME (filter
))
348 if (as_list_apply (FILTER_LIST_IN (filter
), attr
->aspath
)== AS_FILTER_DENY
)
351 return FILTER_PERMIT
;
355 bgp_output_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
356 afi_t afi
, safi_t safi
)
358 struct bgp_filter
*filter
;
360 filter
= &peer
->filter
[afi
][safi
];
362 if (DISTRIBUTE_OUT_NAME (filter
))
363 if (access_list_apply (DISTRIBUTE_OUT (filter
), p
) == FILTER_DENY
)
366 if (PREFIX_LIST_OUT_NAME (filter
))
367 if (prefix_list_apply (PREFIX_LIST_OUT (filter
), p
) == PREFIX_DENY
)
370 if (FILTER_LIST_OUT_NAME (filter
))
371 if (as_list_apply (FILTER_LIST_OUT (filter
), attr
->aspath
) == AS_FILTER_DENY
)
374 return FILTER_PERMIT
;
377 /* If community attribute includes no_export then return 1. */
379 bgp_community_filter (struct peer
*peer
, struct attr
*attr
)
383 /* NO_ADVERTISE check. */
384 if (community_include (attr
->community
, COMMUNITY_NO_ADVERTISE
))
387 /* NO_EXPORT check. */
388 if (peer_sort (peer
) == BGP_PEER_EBGP
&&
389 community_include (attr
->community
, COMMUNITY_NO_EXPORT
))
392 /* NO_EXPORT_SUBCONFED check. */
393 if (peer_sort (peer
) == BGP_PEER_EBGP
394 || peer_sort (peer
) == BGP_PEER_CONFED
)
395 if (community_include (attr
->community
, COMMUNITY_NO_EXPORT_SUBCONFED
))
401 /* Route reflection loop check. */
403 bgp_cluster_filter (struct peer
*peer
, struct attr
*attr
)
405 struct in_addr cluster_id
;
409 if (peer
->bgp
->config
& BGP_CONFIG_CLUSTER_ID
)
410 cluster_id
= peer
->bgp
->cluster_id
;
412 cluster_id
= peer
->bgp
->router_id
;
414 if (cluster_loop_check (attr
->cluster
, cluster_id
))
421 bgp_input_modifier (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
422 afi_t afi
, safi_t safi
)
424 struct bgp_filter
*filter
;
425 struct bgp_info info
;
426 route_map_result_t ret
;
428 filter
= &peer
->filter
[afi
][safi
];
430 /* Apply default weight value. */
431 attr
->weight
= peer
->weight
;
433 /* Route map apply. */
434 if (ROUTE_MAP_IN_NAME (filter
))
436 /* Duplicate current value to new strucutre for modification. */
440 /* Apply BGP route map to the attribute. */
441 ret
= route_map_apply (ROUTE_MAP_IN (filter
), p
, RMAP_BGP
, &info
);
442 if (ret
== RMAP_DENYMATCH
)
444 /* Free newly generated AS path and community by route-map. */
445 bgp_attr_flush (attr
);
453 bgp_announce_check (struct bgp_info
*ri
, struct peer
*peer
, struct prefix
*p
,
454 struct attr
*attr
, afi_t afi
, safi_t safi
)
457 char buf
[SU_ADDRSTRLEN
];
458 struct bgp_filter
*filter
;
459 struct bgp_info info
;
462 struct attr dummy_attr
;
467 filter
= &peer
->filter
[afi
][safi
];
470 #ifdef DISABLE_BGP_ANNOUNCE
474 /* Do not send back route to sender. */
478 /* Aggregate-address suppress check. */
480 if (! UNSUPPRESS_MAP_NAME (filter
))
483 /* Default route check. */
484 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
486 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
489 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
491 #endif /* HAVE_IPV6 */
494 /* If community is not disabled check the no-export and local. */
495 if (bgp_community_filter (peer
, ri
->attr
))
498 /* If the attribute has originator-id and it is same as remote
500 if (ri
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
502 if (IPV4_ADDR_SAME (&peer
->remote_id
, &ri
->attr
->originator_id
))
504 if (BGP_DEBUG (filter
, FILTER
))
505 zlog (peer
->log
, LOG_INFO
,
506 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
508 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
514 /* ORF prefix-list filter check */
515 if (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
516 && (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
517 || CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
518 if (peer
->orf_plist
[afi
][safi
])
520 if (prefix_list_apply (peer
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
524 /* Output filter check. */
525 if (bgp_output_filter (peer
, p
, ri
->attr
, afi
, safi
) == FILTER_DENY
)
527 if (BGP_DEBUG (filter
, FILTER
))
528 zlog (peer
->log
, LOG_INFO
,
529 "%s [Update:SEND] %s/%d is filtered",
531 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
536 #ifdef BGP_SEND_ASPATH_CHECK
537 /* AS path loop check. */
538 if (aspath_loop_check (ri
->attr
->aspath
, peer
->as
))
540 if (BGP_DEBUG (filter
, FILTER
))
541 zlog (peer
->log
, LOG_INFO
,
542 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
543 peer
->host
, peer
->as
);
546 #endif /* BGP_SEND_ASPATH_CHECK */
548 /* If we're a CONFED we need to loop check the CONFED ID too */
549 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
551 if (aspath_loop_check(ri
->attr
->aspath
, bgp
->confed_id
))
553 if (BGP_DEBUG (filter
, FILTER
))
554 zlog (peer
->log
, LOG_INFO
,
555 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
562 /* Route-Reflect check. */
563 if (peer_sort (from
) == BGP_PEER_IBGP
&& peer_sort (peer
) == BGP_PEER_IBGP
)
568 /* IBGP reflection check. */
571 /* A route from a Client peer. */
572 if (CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
574 /* Reflect to all the Non-Client peers and also to the
575 Client peers other than the originator. Originator check
576 is already done. So there is noting to do. */
577 /* no bgp client-to-client reflection check. */
578 if (bgp_flag_check (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
))
579 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
584 /* A route from a Non-client peer. Reflect to all other
586 if (! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
591 /* For modify attribute, copy it to temporary structure. */
594 /* If local-preference is not set. */
595 if ((peer_sort (peer
) == BGP_PEER_IBGP
596 || peer_sort (peer
) == BGP_PEER_CONFED
)
597 && (! (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))))
599 attr
->flag
|= ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
);
600 attr
->local_pref
= bgp
->default_local_pref
;
603 /* Transparency check. */
604 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
)
605 && CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
610 /* Remove MED if its an EBGP peer - will get overwritten by route-maps */
611 if (peer_sort (peer
) == BGP_PEER_EBGP
612 && attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
614 if (ri
->peer
!= bgp
->peer_self
&& ! transparent
615 && ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
616 attr
->flag
&= ~(ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
));
620 if (transparent
|| reflect
621 || (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
)
622 && ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
)
623 || (p
->family
== AF_INET6
&& ri
->peer
!= bgp
->peer_self
))))
625 /* NEXT-HOP Unchanged. */
627 else if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
628 || (p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
630 || (p
->family
== AF_INET6
&& ri
->peer
== bgp
->peer_self
)
631 #endif /* HAVE_IPV6 */
632 || (peer_sort (peer
) == BGP_PEER_EBGP
633 && bgp_multiaccess_check_v4 (attr
->nexthop
, peer
->host
) == 0))
635 /* Set IPv4 nexthop. */
636 if (p
->family
== AF_INET
)
638 if (safi
== SAFI_MPLS_VPN
)
639 memcpy (&attr
->mp_nexthop_global_in
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
641 memcpy (&attr
->nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
644 /* Set IPv6 nexthop. */
645 if (p
->family
== AF_INET6
)
647 /* IPv6 global nexthop must be included. */
648 memcpy (&attr
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
650 attr
->mp_nexthop_len
= 16;
652 #endif /* HAVE_IPV6 */
656 if (p
->family
== AF_INET6
)
658 /* Link-local address should not be transit to different peer. */
659 attr
->mp_nexthop_len
= 16;
661 /* Set link-local address for shared network peer. */
662 if (peer
->shared_network
663 && ! IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
665 memcpy (&attr
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
667 attr
->mp_nexthop_len
= 32;
670 /* If bgpd act as BGP-4+ route-reflector, do not send link-local
673 attr
->mp_nexthop_len
= 16;
675 /* If BGP-4+ link-local nexthop is not link-local nexthop. */
676 if (! IN6_IS_ADDR_LINKLOCAL (&peer
->nexthop
.v6_local
))
677 attr
->mp_nexthop_len
= 16;
679 #endif /* HAVE_IPV6 */
681 /* If this is EBGP peer and remove-private-AS is set. */
682 if (peer_sort (peer
) == BGP_PEER_EBGP
683 && peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
)
684 && aspath_private_as_check (attr
->aspath
))
685 attr
->aspath
= aspath_empty_get ();
687 /* Route map & unsuppress-map apply. */
688 if (ROUTE_MAP_OUT_NAME (filter
)
694 /* The route reflector is not allowed to modify the attributes
695 of the reflected IBGP routes. */
696 if (peer_sort (from
) == BGP_PEER_IBGP
697 && peer_sort (peer
) == BGP_PEER_IBGP
)
700 info
.attr
= &dummy_attr
;
704 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
706 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
708 if (ret
== RMAP_DENYMATCH
)
710 bgp_attr_flush (attr
);
718 bgp_process (struct bgp
*bgp
, struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
722 struct bgp_info
*new_select
;
723 struct bgp_info
*old_select
;
727 struct bgp_info
*ri1
;
728 struct bgp_info
*ri2
;
732 /* bgp deterministic-med */
734 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
735 for (ri1
= rn
->info
; ri1
; ri1
= ri1
->next
)
737 if (CHECK_FLAG (ri1
->flags
, BGP_INFO_DMED_CHECK
))
739 if (BGP_INFO_HOLDDOWN (ri1
))
744 for (ri2
= ri1
->next
; ri2
; ri2
= ri2
->next
)
746 if (CHECK_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
))
748 if (BGP_INFO_HOLDDOWN (ri2
))
751 if (aspath_cmp_left (ri1
->attr
->aspath
, ri2
->attr
->aspath
)
752 || aspath_cmp_left_confed (ri1
->attr
->aspath
,
755 if (bgp_info_cmp (bgp
, ri2
, new_select
))
757 UNSET_FLAG (new_select
->flags
, BGP_INFO_DMED_SELECTED
);
761 SET_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
);
764 SET_FLAG (new_select
->flags
, BGP_INFO_DMED_CHECK
);
765 SET_FLAG (new_select
->flags
, BGP_INFO_DMED_SELECTED
);
768 /* Check old selected route and new selected route. */
771 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
773 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
776 if (BGP_INFO_HOLDDOWN (ri
))
779 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
)
780 && (! CHECK_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
)))
782 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_CHECK
);
785 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_CHECK
);
786 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
);
788 if (bgp_info_cmp (bgp
, ri
, new_select
))
793 if (old_select
&& old_select
== new_select
)
795 if (! CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
797 if (CHECK_FLAG (old_select
->flags
, BGP_INFO_IGP_CHANGED
))
798 bgp_zebra_announce (p
, old_select
, bgp
);
804 UNSET_FLAG (old_select
->flags
, BGP_INFO_SELECTED
);
807 SET_FLAG (new_select
->flags
, BGP_INFO_SELECTED
);
808 UNSET_FLAG (new_select
->flags
, BGP_INFO_ATTR_CHANGED
);
811 /* Check each BGP peer. */
812 LIST_LOOP (bgp
->peer
, peer
, nn
)
814 /* Announce route to Established peer. */
815 if (peer
->status
!= Established
)
818 /* Address family configuration check. */
819 if (! peer
->afc_nego
[afi
][safi
])
822 /* First update is deferred until ORF or ROUTE-REFRESH is received */
823 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
826 /* Announcement to peer->conf. If the route is filtered,
829 && bgp_announce_check (new_select
, peer
, p
, &attr
, afi
, safi
))
830 bgp_adj_out_set (rn
, peer
, p
, &attr
, afi
, safi
, new_select
);
832 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
836 if (safi
== SAFI_UNICAST
&& ! bgp
->name
&&
837 ! bgp_option_check (BGP_OPT_NO_FIB
))
840 && new_select
->type
== ZEBRA_ROUTE_BGP
841 && new_select
->sub_type
== BGP_ROUTE_NORMAL
)
842 bgp_zebra_announce (p
, new_select
, bgp
);
845 /* Withdraw the route from the kernel. */
847 && old_select
->type
== ZEBRA_ROUTE_BGP
848 && old_select
->sub_type
== BGP_ROUTE_NORMAL
)
849 bgp_zebra_withdraw (p
, old_select
);
856 bgp_maximum_prefix_overflow (struct peer
*peer
, afi_t afi
, safi_t safi
)
858 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
)
859 && peer
->pcount
[afi
][safi
] >= peer
->pmax
[afi
][safi
])
861 zlog (peer
->log
, LOG_INFO
,
862 "MAXPFXEXCEED: No. of prefix received from %s (afi %d): %ld exceed limit %ld",
863 peer
->host
, afi
, peer
->pcount
[afi
][safi
], peer
->pmax
[afi
][safi
]);
864 if (! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
868 ndata
[0] = (u_char
)(afi
>> 8);
869 ndata
[1] = (u_char
) afi
;
870 ndata
[3] = (u_char
)(peer
->pmax
[afi
][safi
] >> 24);
871 ndata
[4] = (u_char
)(peer
->pmax
[afi
][safi
] >> 16);
872 ndata
[5] = (u_char
)(peer
->pmax
[afi
][safi
] >> 8);
873 ndata
[6] = (u_char
)(peer
->pmax
[afi
][safi
]);
875 if (safi
== SAFI_MPLS_VPN
)
876 safi
= BGP_SAFI_VPNV4
;
877 ndata
[2] = (u_char
) safi
;
879 bgp_notify_send_with_data (peer
, BGP_NOTIFY_CEASE
,
880 BGP_NOTIFY_CEASE_MAX_PREFIX
,
882 SET_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
);
890 bgp_rib_remove (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
891 afi_t afi
, safi_t safi
)
893 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
895 peer
->pcount
[afi
][safi
]--;
896 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
897 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
898 bgp_process (peer
->bgp
, rn
, afi
, safi
);
900 bgp_info_delete (rn
, ri
);
902 bgp_unlock_node (rn
);
906 bgp_rib_withdraw (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
907 afi_t afi
, safi_t safi
, int force
)
910 int status
= BGP_DAMP_NONE
;
912 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
914 peer
->pcount
[afi
][safi
]--;
915 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
920 if (CHECK_FLAG (peer
->bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
921 && peer_sort (peer
) == BGP_PEER_EBGP
)
922 status
= bgp_damp_withdraw (ri
, rn
, afi
, safi
, 0);
924 if (status
== BGP_DAMP_SUPPRESSED
)
928 valid
= CHECK_FLAG (ri
->flags
, BGP_INFO_VALID
);
929 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
930 bgp_process (peer
->bgp
, rn
, afi
, safi
);
933 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
935 if (status
!= BGP_DAMP_USED
)
937 bgp_info_delete (rn
, ri
);
939 bgp_unlock_node (rn
);
944 bgp_update (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
945 afi_t afi
, safi_t safi
, int type
, int sub_type
,
946 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
949 int aspath_loop_count
= 0;
952 struct attr new_attr
;
953 struct attr
*attr_new
;
955 struct bgp_info
*new;
957 char buf
[SU_ADDRSTRLEN
];
960 rn
= bgp_afi_node_get (bgp
, afi
, safi
, p
, prd
);
962 /* When peer's soft reconfiguration enabled. Record input packet in
964 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
965 && peer
!= bgp
->peer_self
&& ! soft_reconfig
)
966 bgp_adj_in_set (rn
, peer
, attr
);
968 /* Check previously received route. */
969 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
970 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
973 /* AS path local-as loop check. */
974 if (peer
->change_local_as
)
976 if (! CHECK_FLAG (peer
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
977 aspath_loop_count
= 1;
979 if (aspath_loop_check (attr
->aspath
, peer
->change_local_as
) > aspath_loop_count
)
981 reason
= "as-path contains our own AS;";
986 /* AS path loop check. */
987 if (aspath_loop_check (attr
->aspath
, bgp
->as
) > peer
->allowas_in
[afi
][safi
]
988 || (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
989 && aspath_loop_check(attr
->aspath
, bgp
->confed_id
)
990 > peer
->allowas_in
[afi
][safi
]))
992 reason
= "as-path contains our own AS;";
996 /* Route reflector originator ID check. */
997 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
998 && IPV4_ADDR_SAME (&bgp
->router_id
, &attr
->originator_id
))
1000 reason
= "originator is us;";
1004 /* Route reflector cluster ID check. */
1005 if (bgp_cluster_filter (peer
, attr
))
1007 reason
= "reflected from the same cluster;";
1011 /* Apply incoming filter. */
1012 if (bgp_input_filter (peer
, p
, attr
, afi
, safi
) == FILTER_DENY
)
1018 /* Apply incoming route-map. */
1021 if (bgp_input_modifier (peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1023 reason
= "route-map;";
1027 /* IPv4 unicast next hop check. */
1028 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
1030 /* If the peer is EBGP and nexthop is not on connected route,
1032 if (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
== 1
1033 && ! bgp_nexthop_check_ebgp (afi
, &new_attr
)
1034 && ! CHECK_FLAG (peer
->flags
, PEER_FLAG_ENFORCE_MULTIHOP
))
1036 reason
= "non-connected next-hop;";
1040 /* Next hop must not be 0.0.0.0 nor Class E address. Next hop
1041 must not be my own address. */
1042 if (bgp_nexthop_self (afi
, &new_attr
)
1043 || new_attr
.nexthop
.s_addr
== 0
1044 || ntohl (new_attr
.nexthop
.s_addr
) >= 0xe0000000)
1046 reason
= "martian next-hop;";
1051 attr_new
= bgp_attr_intern (&new_attr
);
1053 /* If the update is implicit withdraw. */
1056 ri
->uptime
= time (NULL
);
1058 /* Same attribute comes in. */
1059 if (attrhash_cmp (ri
->attr
, attr_new
))
1061 UNSET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1063 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1064 && peer_sort (peer
) == BGP_PEER_EBGP
1065 && CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1067 if (BGP_DEBUG (update
, UPDATE_IN
))
1068 zlog (peer
->log
, LOG_INFO
, "%s rcvd %s/%d",
1070 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1073 peer
->pcount
[afi
][safi
]++;
1074 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
1075 if (ret
!= BGP_DAMP_SUPPRESSED
)
1077 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
1078 bgp_process (bgp
, rn
, afi
, safi
);
1083 if (BGP_DEBUG (update
, UPDATE_IN
))
1084 zlog (peer
->log
, LOG_INFO
,
1085 "%s rcvd %s/%d...duplicate ignored",
1087 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1091 bgp_unlock_node (rn
);
1092 bgp_attr_unintern (attr_new
);
1096 /* Received Logging. */
1097 if (BGP_DEBUG (update
, UPDATE_IN
))
1098 zlog (peer
->log
, LOG_INFO
, "%s rcvd %s/%d",
1100 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1103 /* The attribute is changed. */
1104 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1106 /* Update bgp route dampening information. */
1107 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1108 && peer_sort (peer
) == BGP_PEER_EBGP
)
1110 /* This is implicit withdraw so we should update dampening
1112 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1113 bgp_damp_withdraw (ri
, rn
, afi
, safi
, 1);
1115 peer
->pcount
[afi
][safi
]++;
1118 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
1120 /* Update to new attribute. */
1121 bgp_attr_unintern (ri
->attr
);
1122 ri
->attr
= attr_new
;
1124 /* Update MPLS tag. */
1125 if (safi
== SAFI_MPLS_VPN
)
1126 memcpy (ri
->tag
, tag
, 3);
1128 /* Update bgp route dampening information. */
1129 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1130 && peer_sort (peer
) == BGP_PEER_EBGP
)
1132 /* Now we do normal update dampening. */
1133 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
1134 if (ret
== BGP_DAMP_SUPPRESSED
)
1136 bgp_unlock_node (rn
);
1141 /* Nexthop reachability check. */
1142 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
1143 && safi
== SAFI_UNICAST
1144 && (peer_sort (peer
) == BGP_PEER_IBGP
1145 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
1146 || CHECK_FLAG (peer
->flags
, PEER_FLAG_ENFORCE_MULTIHOP
)))
1148 if (bgp_nexthop_lookup (afi
, peer
, ri
, NULL
, NULL
))
1149 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1151 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1154 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1156 /* Process change. */
1157 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
1159 bgp_process (bgp
, rn
, afi
, safi
);
1160 bgp_unlock_node (rn
);
1164 /* Received Logging. */
1165 if (BGP_DEBUG (update
, UPDATE_IN
))
1167 zlog (peer
->log
, LOG_INFO
, "%s rcvd %s/%d",
1169 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1173 /* Increment prefix counter */
1174 peer
->pcount
[afi
][safi
]++;
1176 /* Make new BGP info. */
1177 new = bgp_info_new ();
1179 new->sub_type
= sub_type
;
1181 new->attr
= attr_new
;
1182 new->uptime
= time (NULL
);
1184 /* Update MPLS tag. */
1185 if (safi
== SAFI_MPLS_VPN
)
1186 memcpy (new->tag
, tag
, 3);
1188 /* Nexthop reachability check. */
1189 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
1190 && safi
== SAFI_UNICAST
1191 && (peer_sort (peer
) == BGP_PEER_IBGP
1192 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
1193 || CHECK_FLAG (peer
->flags
, PEER_FLAG_ENFORCE_MULTIHOP
)))
1195 if (bgp_nexthop_lookup (afi
, peer
, new, NULL
, NULL
))
1196 SET_FLAG (new->flags
, BGP_INFO_VALID
);
1198 UNSET_FLAG (new->flags
, BGP_INFO_VALID
);
1201 SET_FLAG (new->flags
, BGP_INFO_VALID
);
1203 /* Aggregate address increment. */
1204 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
1206 /* Register new BGP information. */
1207 bgp_info_add (rn
, new);
1209 /* If maximum prefix count is configured and current prefix
1211 if (! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
1212 if (bgp_maximum_prefix_overflow (peer
, afi
, safi
))
1215 /* Process change. */
1216 bgp_process (bgp
, rn
, afi
, safi
);
1220 /* This BGP update is filtered. Log the reason then update BGP
1223 if (BGP_DEBUG (update
, UPDATE_IN
))
1224 zlog (peer
->log
, LOG_INFO
,
1225 "%s rcvd UPDATE about %s/%d -- DENIED due to: %s",
1227 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1228 p
->prefixlen
, reason
);
1231 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
, 1);
1233 bgp_unlock_node (rn
);
1239 bgp_withdraw (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
1240 int afi
, int safi
, int type
, int sub_type
, struct prefix_rd
*prd
,
1244 char buf
[SU_ADDRSTRLEN
];
1245 struct bgp_node
*rn
;
1246 struct bgp_info
*ri
;
1251 if (BGP_DEBUG (update
, UPDATE_IN
))
1252 zlog (peer
->log
, LOG_INFO
, "%s rcvd UPDATE about %s/%d -- withdrawn",
1254 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1258 rn
= bgp_afi_node_get (bgp
, afi
, safi
, p
, prd
);
1260 /* If peer is soft reconfiguration enabled. Record input packet for
1261 further calculation. */
1262 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
1263 && peer
!= bgp
->peer_self
)
1264 bgp_adj_in_unset (rn
, peer
);
1266 /* Lookup withdrawn route. */
1267 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1268 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1271 /* Withdraw specified route from routing table. */
1272 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1273 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
, 0);
1274 else if (BGP_DEBUG (update
, UPDATE_IN
))
1275 zlog (peer
->log
, LOG_INFO
,
1276 "%s Can't find the route %s/%d", peer
->host
,
1277 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1280 /* Unlock bgp_node_get() lock. */
1281 bgp_unlock_node (rn
);
1287 bgp_default_originate (struct peer
*peer
, afi_t afi
, safi_t safi
, int withdraw
)
1291 struct aspath
*aspath
;
1293 struct bgp_info binfo
;
1295 int ret
= RMAP_DENYMATCH
;
1298 from
= bgp
->peer_self
;
1300 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
1301 aspath
= attr
.aspath
;
1302 attr
.local_pref
= bgp
->default_local_pref
;
1303 memcpy (&attr
.nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
1306 str2prefix ("0.0.0.0/0", &p
);
1308 else if (afi
== AFI_IP6
)
1310 str2prefix ("::/0", &p
);
1312 /* IPv6 global nexthop must be included. */
1313 memcpy (&attr
.mp_nexthop_global
, &peer
->nexthop
.v6_global
,
1315 attr
.mp_nexthop_len
= 16;
1317 /* If the peer is on shared nextwork and we have link-local
1319 if (peer
->shared_network
1320 && !IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
1322 memcpy (&attr
.mp_nexthop_local
, &peer
->nexthop
.v6_local
,
1324 attr
.mp_nexthop_len
= 32;
1327 #endif /* HAVE_IPV6 */
1331 if (peer
->default_rmap
[afi
][safi
].name
)
1333 binfo
.peer
= bgp
->peer_self
;
1336 ret
= route_map_apply (peer
->default_rmap
[afi
][safi
].map
, &p
,
1339 if (ret
== RMAP_DENYMATCH
)
1341 bgp_attr_flush (&attr
);
1348 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
1349 bgp_default_withdraw_send (peer
, afi
, safi
);
1350 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
1354 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
1355 bgp_default_update_send (peer
, &attr
, afi
, safi
, from
);
1358 aspath_unintern (aspath
);
1362 bgp_announce_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
1363 struct bgp_table
*table
)
1365 struct bgp_node
*rn
;
1366 struct bgp_info
*ri
;
1370 table
= peer
->bgp
->rib
[afi
][safi
];
1372 if (safi
!= SAFI_MPLS_VPN
1373 && CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
1374 bgp_default_originate (peer
, afi
, safi
, 0);
1376 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next(rn
))
1377 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1378 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
) && ri
->peer
!= peer
)
1380 if (bgp_announce_check (ri
, peer
, &rn
->p
, &attr
, afi
, safi
))
1381 bgp_adj_out_set (rn
, peer
, &rn
->p
, &attr
, afi
, safi
, ri
);
1383 bgp_adj_out_unset (rn
, peer
, &rn
->p
, afi
, safi
);
1388 bgp_announce_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
1390 struct bgp_node
*rn
;
1391 struct bgp_table
*table
;
1393 if (peer
->status
!= Established
)
1396 if (! peer
->afc_nego
[afi
][safi
])
1399 /* First update is deferred until ORF or ROUTE-REFRESH is received */
1400 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
1403 if (safi
!= SAFI_MPLS_VPN
)
1404 bgp_announce_table (peer
, afi
, safi
, NULL
);
1406 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
1407 rn
= bgp_route_next(rn
))
1408 if ((table
= (rn
->info
)) != NULL
)
1409 bgp_announce_table (peer
, afi
, safi
, table
);
1413 bgp_announce_route_all (struct peer
*peer
)
1418 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1419 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1420 bgp_announce_route (peer
, afi
, safi
);
1424 bgp_soft_reconfig_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
1425 struct bgp_table
*table
)
1428 struct bgp_node
*rn
;
1429 struct bgp_adj_in
*ain
;
1432 table
= peer
->bgp
->rib
[afi
][safi
];
1434 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
1435 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
1437 if (ain
->peer
== peer
)
1439 ret
= bgp_update (peer
, &rn
->p
, ain
->attr
, afi
, safi
,
1440 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
,
1444 bgp_unlock_node (rn
);
1453 bgp_soft_reconfig_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
1455 struct bgp_node
*rn
;
1456 struct bgp_table
*table
;
1458 if (peer
->status
!= Established
)
1461 if (safi
!= SAFI_MPLS_VPN
)
1462 bgp_soft_reconfig_table (peer
, afi
, safi
, NULL
);
1464 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
1465 rn
= bgp_route_next (rn
))
1466 if ((table
= rn
->info
) != NULL
)
1467 bgp_soft_reconfig_table (peer
, afi
, safi
, table
);
1471 bgp_clear_route_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
1472 struct bgp_table
*table
)
1474 struct bgp_node
*rn
;
1475 struct bgp_adj_in
*ain
;
1476 struct bgp_adj_out
*aout
;
1477 struct bgp_info
*ri
;
1480 table
= peer
->bgp
->rib
[afi
][safi
];
1482 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
1484 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1485 if (ri
->peer
== peer
)
1487 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
1490 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
1491 if (ain
->peer
== peer
)
1493 bgp_adj_in_remove (rn
, ain
);
1494 bgp_unlock_node (rn
);
1497 for (aout
= rn
->adj_out
; aout
; aout
= aout
->next
)
1498 if (aout
->peer
== peer
)
1500 bgp_adj_out_remove (rn
, aout
, peer
, afi
, safi
);
1501 bgp_unlock_node (rn
);
1508 bgp_clear_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
1510 struct bgp_node
*rn
;
1511 struct bgp_table
*table
;
1513 if (! peer
->afc
[afi
][safi
])
1516 if (safi
!= SAFI_MPLS_VPN
)
1517 bgp_clear_route_table (peer
, afi
, safi
, NULL
);
1519 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
1520 rn
= bgp_route_next (rn
))
1521 if ((table
= rn
->info
) != NULL
)
1522 bgp_clear_route_table (peer
, afi
, safi
, table
);
1526 bgp_clear_route_all (struct peer
*peer
)
1531 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1532 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1533 bgp_clear_route (peer
, afi
, safi
);
1537 bgp_clear_adj_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
1539 struct bgp_table
*table
;
1540 struct bgp_node
*rn
;
1541 struct bgp_adj_in
*ain
;
1543 table
= peer
->bgp
->rib
[afi
][safi
];
1545 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
1546 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
1547 if (ain
->peer
== peer
)
1549 bgp_adj_in_remove (rn
, ain
);
1550 bgp_unlock_node (rn
);
1555 /* Delete all kernel routes. */
1560 struct listnode
*nn
;
1561 struct bgp_node
*rn
;
1562 struct bgp_table
*table
;
1563 struct bgp_info
*ri
;
1565 LIST_LOOP (bm
->bgp
, bgp
, nn
)
1567 table
= bgp
->rib
[AFI_IP
][SAFI_UNICAST
];
1569 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
1570 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1571 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
1572 && ri
->type
== ZEBRA_ROUTE_BGP
1573 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
1574 bgp_zebra_withdraw (&rn
->p
, ri
);
1576 table
= bgp
->rib
[AFI_IP6
][SAFI_UNICAST
];
1578 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
1579 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1580 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
1581 && ri
->type
== ZEBRA_ROUTE_BGP
1582 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
1583 bgp_zebra_withdraw (&rn
->p
, ri
);
1591 bgp_zclient_reset ();
1592 access_list_reset ();
1593 prefix_list_reset ();
1596 /* Parse NLRI stream. Withdraw NLRI is recognized by NULL attr
1599 bgp_nlri_parse (struct peer
*peer
, struct attr
*attr
, struct bgp_nlri
*packet
)
1607 /* Check peer status. */
1608 if (peer
->status
!= Established
)
1612 lim
= pnt
+ packet
->length
;
1614 for (; pnt
< lim
; pnt
+= psize
)
1616 /* Clear prefix structure. */
1617 memset (&p
, 0, sizeof (struct prefix
));
1619 /* Fetch prefix length. */
1620 p
.prefixlen
= *pnt
++;
1621 p
.family
= afi2family (packet
->afi
);
1623 /* Already checked in nlri_sanity_check(). We do double check
1625 if ((packet
->afi
== AFI_IP
&& p
.prefixlen
> 32)
1626 || (packet
->afi
== AFI_IP6
&& p
.prefixlen
> 128))
1629 /* Packet size overflow check. */
1630 psize
= PSIZE (p
.prefixlen
);
1632 /* When packet overflow occur return immediately. */
1633 if (pnt
+ psize
> lim
)
1636 /* Fetch prefix from NLRI packet. */
1637 memcpy (&p
.u
.prefix
, pnt
, psize
);
1639 /* Check address. */
1640 if (packet
->afi
== AFI_IP
&& packet
->safi
== SAFI_UNICAST
)
1642 if (IN_CLASSD (ntohl (p
.u
.prefix4
.s_addr
)))
1644 zlog (peer
->log
, LOG_ERR
,
1645 "IPv4 unicast NLRI is multicast address %s",
1646 inet_ntoa (p
.u
.prefix4
));
1647 bgp_notify_send (peer
,
1648 BGP_NOTIFY_UPDATE_ERR
,
1649 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
1655 /* Check address. */
1656 if (packet
->afi
== AFI_IP6
&& packet
->safi
== SAFI_UNICAST
)
1658 if (IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
1662 zlog (peer
->log
, LOG_WARNING
,
1663 "IPv6 link-local NLRI received %s ignore this NLRI",
1664 inet_ntop (AF_INET6
, &p
.u
.prefix6
, buf
, BUFSIZ
));
1669 #endif /* HAVE_IPV6 */
1671 /* Normal process. */
1673 ret
= bgp_update (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
1674 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
, 0);
1676 ret
= bgp_withdraw (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
1677 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
1679 /* Address family configuration mismatch or maximum-prefix count
1685 /* Packet length consistency check. */
1692 /* NLRI encode syntax check routine. */
1694 bgp_nlri_sanity_check (struct peer
*peer
, int afi
, u_char
*pnt
,
1703 /* RFC1771 6.3 The NLRI field in the UPDATE message is checked for
1704 syntactic validity. If the field is syntactically incorrect,
1705 then the Error Subcode is set to Invalid Network Field. */
1711 /* Prefix length check. */
1712 if ((afi
== AFI_IP
&& prefixlen
> 32)
1713 || (afi
== AFI_IP6
&& prefixlen
> 128))
1715 plog_err (peer
->log
,
1716 "%s [Error] Update packet error (wrong prefix length %d)",
1717 peer
->host
, prefixlen
);
1718 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
1719 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
1723 /* Packet size overflow check. */
1724 psize
= PSIZE (prefixlen
);
1726 if (pnt
+ psize
> end
)
1728 plog_err (peer
->log
,
1729 "%s [Error] Update packet error"
1730 " (prefix data overflow prefix size is %d)",
1732 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
1733 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
1740 /* Packet length consistency check. */
1743 plog_err (peer
->log
,
1744 "%s [Error] Update packet error"
1745 " (prefix length mismatch with total length)",
1747 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
1748 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
1757 struct bgp_static
*new;
1758 new = XMALLOC (MTYPE_BGP_STATIC
, sizeof (struct bgp_static
));
1759 memset (new, 0, sizeof (struct bgp_static
));
1764 bgp_static_free (struct bgp_static
*bgp_static
)
1766 if (bgp_static
->rmap
.name
)
1767 free (bgp_static
->rmap
.name
);
1768 XFREE (MTYPE_BGP_STATIC
, bgp_static
);
1772 bgp_static_update (struct bgp
*bgp
, struct prefix
*p
,
1773 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
1775 struct bgp_node
*rn
;
1776 struct bgp_info
*ri
;
1777 struct bgp_info
*new;
1778 struct bgp_info info
;
1780 struct attr
*attr_new
;
1783 rn
= bgp_afi_node_get (bgp
, afi
, safi
, p
, NULL
);
1785 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
1788 attr
.nexthop
= bgp_static
->igpnexthop
;
1789 attr
.med
= bgp_static
->igpmetric
;
1790 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
1793 /* Apply route-map. */
1794 if (bgp_static
->rmap
.name
)
1796 info
.peer
= bgp
->peer_self
;
1799 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
1800 if (ret
== RMAP_DENYMATCH
)
1802 /* Free uninterned attribute. */
1803 bgp_attr_flush (&attr
);
1805 /* Unintern original. */
1806 aspath_unintern (attr
.aspath
);
1807 bgp_static_withdraw (bgp
, p
, afi
, safi
);
1812 attr_new
= bgp_attr_intern (&attr
);
1814 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1815 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
1816 && ri
->sub_type
== BGP_ROUTE_STATIC
)
1821 if (attrhash_cmp (ri
->attr
, attr_new
))
1823 bgp_unlock_node (rn
);
1824 bgp_attr_unintern (attr_new
);
1825 aspath_unintern (attr
.aspath
);
1830 /* The attribute is changed. */
1831 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1833 /* Rewrite BGP route information. */
1834 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
1835 bgp_attr_unintern (ri
->attr
);
1836 ri
->attr
= attr_new
;
1837 ri
->uptime
= time (NULL
);
1839 /* Process change. */
1840 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
1841 bgp_process (bgp
, rn
, afi
, safi
);
1842 bgp_unlock_node (rn
);
1843 aspath_unintern (attr
.aspath
);
1848 /* Make new BGP info. */
1849 new = bgp_info_new ();
1850 new->type
= ZEBRA_ROUTE_BGP
;
1851 new->sub_type
= BGP_ROUTE_STATIC
;
1852 new->peer
= bgp
->peer_self
;
1853 SET_FLAG (new->flags
, BGP_INFO_VALID
);
1854 new->attr
= attr_new
;
1855 new->uptime
= time (NULL
);
1857 /* Aggregate address increment. */
1858 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
1860 /* Register new BGP information. */
1861 bgp_info_add (rn
, new);
1863 /* Process change. */
1864 bgp_process (bgp
, rn
, afi
, safi
);
1866 /* Unintern original. */
1867 aspath_unintern (attr
.aspath
);
1871 bgp_static_update_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
1872 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
1874 struct bgp_node
*rn
;
1875 struct bgp_info
*new;
1877 rn
= bgp_afi_node_get (bgp
, afi
, safi
, p
, prd
);
1879 /* Make new BGP info. */
1880 new = bgp_info_new ();
1881 new->type
= ZEBRA_ROUTE_BGP
;
1882 new->sub_type
= BGP_ROUTE_STATIC
;
1883 new->peer
= bgp
->peer_self
;
1884 new->attr
= bgp_attr_default_intern (BGP_ORIGIN_IGP
);
1885 SET_FLAG (new->flags
, BGP_INFO_VALID
);
1886 new->uptime
= time (NULL
);
1887 memcpy (new->tag
, tag
, 3);
1889 /* Aggregate address increment. */
1890 bgp_aggregate_increment (bgp
, p
, (struct bgp_info
*) new, afi
, safi
);
1892 /* Register new BGP information. */
1893 bgp_info_add (rn
, (struct bgp_info
*) new);
1895 /* Process change. */
1896 bgp_process (bgp
, rn
, afi
, safi
);
1900 bgp_static_withdraw (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
1903 struct bgp_node
*rn
;
1904 struct bgp_info
*ri
;
1906 rn
= bgp_afi_node_get (bgp
, afi
, safi
, p
, NULL
);
1908 /* Check selected route and self inserted route. */
1909 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1910 if (ri
->peer
== bgp
->peer_self
1911 && ri
->type
== ZEBRA_ROUTE_BGP
1912 && ri
->sub_type
== BGP_ROUTE_STATIC
)
1915 /* Withdraw static BGP route from routing table. */
1918 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
1919 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1920 bgp_process (bgp
, rn
, afi
, safi
);
1921 bgp_info_delete (rn
, ri
);
1923 bgp_unlock_node (rn
);
1926 /* Unlock bgp_node_lookup. */
1927 bgp_unlock_node (rn
);
1931 bgp_static_withdraw_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
1932 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
1934 struct bgp_node
*rn
;
1935 struct bgp_info
*ri
;
1937 rn
= bgp_afi_node_get (bgp
, afi
, safi
, p
, prd
);
1939 /* Check selected route and self inserted route. */
1940 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1941 if (ri
->peer
== bgp
->peer_self
1942 && ri
->type
== ZEBRA_ROUTE_BGP
1943 && ri
->sub_type
== BGP_ROUTE_STATIC
)
1946 /* Withdraw static BGP route from routing table. */
1949 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
1950 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1951 bgp_process (bgp
, rn
, afi
, safi
);
1952 bgp_info_delete (rn
, ri
);
1954 bgp_unlock_node (rn
);
1957 /* Unlock bgp_node_lookup. */
1958 bgp_unlock_node (rn
);
1961 /* Configure static BGP network. When user don't run zebra, static
1962 route should be installed as valid. */
1964 bgp_static_set (struct vty
*vty
, struct bgp
*bgp
, char *ip_str
, u_int16_t afi
,
1965 u_char safi
, char *rmap
, int backdoor
)
1969 struct bgp_static
*bgp_static
;
1970 struct bgp_node
*rn
;
1971 int need_update
= 0;
1973 /* Convert IP prefix string to struct prefix. */
1974 ret
= str2prefix (ip_str
, &p
);
1977 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
1981 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
1983 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
1987 #endif /* HAVE_IPV6 */
1991 /* Set BGP static route configuration. */
1992 rn
= bgp_node_get (bgp
->route
[afi
][safi
], &p
);
1996 /* Configuration change. */
1997 bgp_static
= rn
->info
;
1999 /* Check previous routes are installed into BGP. */
2000 if (! bgp_static
->backdoor
&& bgp_static
->valid
)
2003 bgp_static
->backdoor
= backdoor
;
2006 if (bgp_static
->rmap
.name
)
2007 free (bgp_static
->rmap
.name
);
2008 bgp_static
->rmap
.name
= strdup (rmap
);
2009 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
2013 if (bgp_static
->rmap
.name
)
2014 free (bgp_static
->rmap
.name
);
2015 bgp_static
->rmap
.name
= NULL
;
2016 bgp_static
->rmap
.map
= NULL
;
2017 bgp_static
->valid
= 0;
2019 bgp_unlock_node (rn
);
2023 /* New configuration. */
2024 bgp_static
= bgp_static_new ();
2025 bgp_static
->backdoor
= backdoor
;
2026 bgp_static
->valid
= 0;
2027 bgp_static
->igpmetric
= 0;
2028 bgp_static
->igpnexthop
.s_addr
= 0;
2031 if (bgp_static
->rmap
.name
)
2032 free (bgp_static
->rmap
.name
);
2033 bgp_static
->rmap
.name
= strdup (rmap
);
2034 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
2036 rn
->info
= bgp_static
;
2039 /* If BGP scan is not enabled, we should install this route here. */
2040 if (! bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
2042 bgp_static
->valid
= 1;
2045 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
2047 if (! bgp_static
->backdoor
)
2048 bgp_static_update (bgp
, &p
, bgp_static
, afi
, safi
);
2054 /* Configure static BGP network. */
2056 bgp_static_unset (struct vty
*vty
, struct bgp
*bgp
, char *ip_str
,
2057 u_int16_t afi
, u_char safi
)
2061 struct bgp_static
*bgp_static
;
2062 struct bgp_node
*rn
;
2064 /* Convert IP prefix string to struct prefix. */
2065 ret
= str2prefix (ip_str
, &p
);
2068 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
2072 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
2074 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
2078 #endif /* HAVE_IPV6 */
2082 rn
= bgp_node_lookup (bgp
->route
[afi
][safi
], &p
);
2085 vty_out (vty
, "%% Can't find specified static route configuration.%s",
2090 bgp_static
= rn
->info
;
2092 /* Update BGP RIB. */
2093 if (! bgp_static
->backdoor
)
2094 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
2096 /* Clear configuration. */
2097 bgp_static_free (bgp_static
);
2099 bgp_unlock_node (rn
);
2100 bgp_unlock_node (rn
);
2105 /* Called from bgp_delete(). Delete all static routes from the BGP
2108 bgp_static_delete (struct bgp
*bgp
)
2112 struct bgp_node
*rn
;
2113 struct bgp_node
*rm
;
2114 struct bgp_table
*table
;
2115 struct bgp_static
*bgp_static
;
2117 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2118 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2119 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
2120 if (rn
->info
!= NULL
)
2122 if (safi
== SAFI_MPLS_VPN
)
2126 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
2128 bgp_static
= rn
->info
;
2129 bgp_static_withdraw_vpnv4 (bgp
, &rm
->p
,
2130 AFI_IP
, SAFI_MPLS_VPN
,
2131 (struct prefix_rd
*)&rn
->p
,
2133 bgp_static_free (bgp_static
);
2135 bgp_unlock_node (rn
);
2140 bgp_static
= rn
->info
;
2141 bgp_static_withdraw (bgp
, &rn
->p
, afi
, safi
);
2142 bgp_static_free (bgp_static
);
2144 bgp_unlock_node (rn
);
2150 bgp_static_set_vpnv4 (struct vty
*vty
, char *ip_str
, char *rd_str
,
2155 struct prefix_rd prd
;
2157 struct bgp_node
*prn
;
2158 struct bgp_node
*rn
;
2159 struct bgp_table
*table
;
2160 struct bgp_static
*bgp_static
;
2165 ret
= str2prefix (ip_str
, &p
);
2168 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
2173 ret
= str2prefix_rd (rd_str
, &prd
);
2176 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
2180 ret
= str2tag (tag_str
, tag
);
2183 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
2187 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
2188 (struct prefix
*)&prd
);
2189 if (prn
->info
== NULL
)
2190 prn
->info
= bgp_table_init ();
2192 bgp_unlock_node (prn
);
2195 rn
= bgp_node_get (table
, &p
);
2199 vty_out (vty
, "%% Same network configuration exists%s", VTY_NEWLINE
);
2200 bgp_unlock_node (rn
);
2204 /* New configuration. */
2205 bgp_static
= bgp_static_new ();
2206 bgp_static
->valid
= 1;
2207 memcpy (bgp_static
->tag
, tag
, 3);
2208 rn
->info
= bgp_static
;
2210 bgp_static_update_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
2216 /* Configure static BGP network. */
2218 bgp_static_unset_vpnv4 (struct vty
*vty
, char *ip_str
, char *rd_str
,
2224 struct prefix_rd prd
;
2225 struct bgp_node
*prn
;
2226 struct bgp_node
*rn
;
2227 struct bgp_table
*table
;
2228 struct bgp_static
*bgp_static
;
2233 /* Convert IP prefix string to struct prefix. */
2234 ret
= str2prefix (ip_str
, &p
);
2237 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
2242 ret
= str2prefix_rd (rd_str
, &prd
);
2245 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
2249 ret
= str2tag (tag_str
, tag
);
2252 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
2256 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
2257 (struct prefix
*)&prd
);
2258 if (prn
->info
== NULL
)
2259 prn
->info
= bgp_table_init ();
2261 bgp_unlock_node (prn
);
2264 rn
= bgp_node_lookup (table
, &p
);
2268 bgp_static_withdraw_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
2270 bgp_static
= rn
->info
;
2271 bgp_static_free (bgp_static
);
2273 bgp_unlock_node (rn
);
2274 bgp_unlock_node (rn
);
2277 vty_out (vty
, "%% Can't find the route%s", VTY_NEWLINE
);
2284 "network A.B.C.D/M",
2285 "Specify a network to announce via BGP\n"
2286 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
2288 return bgp_static_set (vty
, vty
->index
, argv
[0],
2289 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
2292 DEFUN (bgp_network_route_map
,
2293 bgp_network_route_map_cmd
,
2294 "network A.B.C.D/M route-map WORD",
2295 "Specify a network to announce via BGP\n"
2296 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2297 "Route-map to modify the attributes\n"
2298 "Name of the route map\n")
2300 return bgp_static_set (vty
, vty
->index
, argv
[0],
2301 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
2304 DEFUN (bgp_network_backdoor
,
2305 bgp_network_backdoor_cmd
,
2306 "network A.B.C.D/M backdoor",
2307 "Specify a network to announce via BGP\n"
2308 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2309 "Specify a BGP backdoor route\n")
2311 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
2314 DEFUN (bgp_network_mask
,
2315 bgp_network_mask_cmd
,
2316 "network A.B.C.D mask A.B.C.D",
2317 "Specify a network to announce via BGP\n"
2323 char prefix_str
[BUFSIZ
];
2325 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
2328 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2332 return bgp_static_set (vty
, vty
->index
, prefix_str
,
2333 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
2336 DEFUN (bgp_network_mask_route_map
,
2337 bgp_network_mask_route_map_cmd
,
2338 "network A.B.C.D mask A.B.C.D route-map WORD",
2339 "Specify a network to announce via BGP\n"
2343 "Route-map to modify the attributes\n"
2344 "Name of the route map\n")
2347 char prefix_str
[BUFSIZ
];
2349 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
2352 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2356 return bgp_static_set (vty
, vty
->index
, prefix_str
,
2357 AFI_IP
, bgp_node_safi (vty
), argv
[2], 0);
2360 DEFUN (bgp_network_mask_backdoor
,
2361 bgp_network_mask_backdoor_cmd
,
2362 "network A.B.C.D mask A.B.C.D backdoor",
2363 "Specify a network to announce via BGP\n"
2367 "Specify a BGP backdoor route\n")
2370 char prefix_str
[BUFSIZ
];
2372 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
2375 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2379 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
, NULL
, 1);
2382 DEFUN (bgp_network_mask_natural
,
2383 bgp_network_mask_natural_cmd
,
2385 "Specify a network to announce via BGP\n"
2389 char prefix_str
[BUFSIZ
];
2391 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
2394 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2398 return bgp_static_set (vty
, vty
->index
, prefix_str
,
2399 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
2402 DEFUN (bgp_network_mask_natural_route_map
,
2403 bgp_network_mask_natural_route_map_cmd
,
2404 "network A.B.C.D route-map WORD",
2405 "Specify a network to announce via BGP\n"
2407 "Route-map to modify the attributes\n"
2408 "Name of the route map\n")
2411 char prefix_str
[BUFSIZ
];
2413 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
2416 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2420 return bgp_static_set (vty
, vty
->index
, prefix_str
,
2421 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
2424 DEFUN (bgp_network_mask_natural_backdoor
,
2425 bgp_network_mask_natural_backdoor_cmd
,
2426 "network A.B.C.D backdoor",
2427 "Specify a network to announce via BGP\n"
2429 "Specify a BGP backdoor route\n")
2432 char prefix_str
[BUFSIZ
];
2434 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
2437 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2441 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
, NULL
, 1);
2444 DEFUN (no_bgp_network
,
2446 "no network A.B.C.D/M",
2448 "Specify a network to announce via BGP\n"
2449 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
2451 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP
,
2452 bgp_node_safi (vty
));
2455 ALIAS (no_bgp_network
,
2456 no_bgp_network_route_map_cmd
,
2457 "no network A.B.C.D/M route-map WORD",
2459 "Specify a network to announce via BGP\n"
2460 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2461 "Route-map to modify the attributes\n"
2462 "Name of the route map\n")
2464 ALIAS (no_bgp_network
,
2465 no_bgp_network_backdoor_cmd
,
2466 "no network A.B.C.D/M backdoor",
2468 "Specify a network to announce via BGP\n"
2469 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2470 "Specify a BGP backdoor route\n")
2472 DEFUN (no_bgp_network_mask
,
2473 no_bgp_network_mask_cmd
,
2474 "no network A.B.C.D mask A.B.C.D",
2476 "Specify a network to announce via BGP\n"
2482 char prefix_str
[BUFSIZ
];
2484 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
2487 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2491 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
2492 bgp_node_safi (vty
));
2495 ALIAS (no_bgp_network_mask
,
2496 no_bgp_network_mask_route_map_cmd
,
2497 "no network A.B.C.D mask A.B.C.D route-map WORD",
2499 "Specify a network to announce via BGP\n"
2503 "Route-map to modify the attributes\n"
2504 "Name of the route map\n")
2506 ALIAS (no_bgp_network_mask
,
2507 no_bgp_network_mask_backdoor_cmd
,
2508 "no network A.B.C.D mask A.B.C.D backdoor",
2510 "Specify a network to announce via BGP\n"
2514 "Specify a BGP backdoor route\n")
2516 DEFUN (no_bgp_network_mask_natural
,
2517 no_bgp_network_mask_natural_cmd
,
2518 "no network A.B.C.D",
2520 "Specify a network to announce via BGP\n"
2524 char prefix_str
[BUFSIZ
];
2526 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
2529 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
2533 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
2534 bgp_node_safi (vty
));
2537 ALIAS (no_bgp_network_mask_natural
,
2538 no_bgp_network_mask_natural_route_map_cmd
,
2539 "no 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")
2546 ALIAS (no_bgp_network_mask_natural
,
2547 no_bgp_network_mask_natural_backdoor_cmd
,
2548 "no network A.B.C.D backdoor",
2550 "Specify a network to announce via BGP\n"
2552 "Specify a BGP backdoor route\n")
2555 DEFUN (ipv6_bgp_network
,
2556 ipv6_bgp_network_cmd
,
2557 "network X:X::X:X/M",
2558 "Specify a network to announce via BGP\n"
2559 "IPv6 prefix <network>/<length>\n")
2561 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
2564 DEFUN (ipv6_bgp_network_route_map
,
2565 ipv6_bgp_network_route_map_cmd
,
2566 "network X:X::X:X/M route-map WORD",
2567 "Specify a network to announce via BGP\n"
2568 "IPv6 prefix <network>/<length>\n"
2569 "Route-map to modify the attributes\n"
2570 "Name of the route map\n")
2572 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
,
2573 bgp_node_safi (vty
), argv
[1], 0);
2576 DEFUN (no_ipv6_bgp_network
,
2577 no_ipv6_bgp_network_cmd
,
2578 "no network X:X::X:X/M",
2580 "Specify a network to announce via BGP\n"
2581 "IPv6 prefix <network>/<length>\n")
2583 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
2586 ALIAS (no_ipv6_bgp_network
,
2587 no_ipv6_bgp_network_route_map_cmd
,
2588 "no network X:X::X:X/M route-map WORD",
2590 "Specify a network to announce via BGP\n"
2591 "IPv6 prefix <network>/<length>\n"
2592 "Route-map to modify the attributes\n"
2593 "Name of the route map\n")
2595 ALIAS (ipv6_bgp_network
,
2596 old_ipv6_bgp_network_cmd
,
2597 "ipv6 bgp network X:X::X:X/M",
2600 "Specify a network to announce via BGP\n"
2601 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
2603 ALIAS (no_ipv6_bgp_network
,
2604 old_no_ipv6_bgp_network_cmd
,
2605 "no ipv6 bgp network X:X::X:X/M",
2609 "Specify a network to announce via BGP\n"
2610 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
2611 #endif /* HAVE_IPV6 */
2613 /* Aggreagete address:
2615 advertise-map Set condition to advertise attribute
2616 as-set Generate AS set path information
2617 attribute-map Set attributes of aggregate
2618 route-map Set parameters of aggregate
2619 summary-only Filter more specific routes from updates
2620 suppress-map Conditionally filter more specific routes from updates
2623 struct bgp_aggregate
2625 /* Summary-only flag. */
2626 u_char summary_only
;
2628 /* AS set generation. */
2631 /* Route-map for aggregated route. */
2632 struct route_map
*map
;
2634 /* Suppress-count. */
2635 unsigned long count
;
2637 /* SAFI configuration. */
2641 struct bgp_aggregate
*
2642 bgp_aggregate_new ()
2644 struct bgp_aggregate
*new;
2645 new = XMALLOC (MTYPE_BGP_AGGREGATE
, sizeof (struct bgp_aggregate
));
2646 memset (new, 0, sizeof (struct bgp_aggregate
));
2651 bgp_aggregate_free (struct bgp_aggregate
*aggregate
)
2653 XFREE (MTYPE_BGP_AGGREGATE
, aggregate
);
2657 bgp_aggregate_route (struct bgp
*bgp
, struct prefix
*p
, struct bgp_info
*rinew
,
2658 afi_t afi
, safi_t safi
, struct bgp_info
*del
,
2659 struct bgp_aggregate
*aggregate
)
2661 struct bgp_table
*table
;
2662 struct bgp_node
*top
;
2663 struct bgp_node
*rn
;
2665 struct aspath
*aspath
= NULL
;
2666 struct aspath
*asmerge
= NULL
;
2667 struct community
*community
= NULL
;
2668 struct community
*commerge
= NULL
;
2669 struct in_addr nexthop
;
2671 struct bgp_info
*ri
;
2672 struct bgp_info
*new;
2674 unsigned long match
= 0;
2676 /* Record adding route's nexthop and med. */
2679 nexthop
= rinew
->attr
->nexthop
;
2680 med
= rinew
->attr
->med
;
2683 /* ORIGIN attribute: If at least one route among routes that are
2684 aggregated has ORIGIN with the value INCOMPLETE, then the
2685 aggregated route must have the ORIGIN attribute with the value
2686 INCOMPLETE. Otherwise, if at least one route among routes that
2687 are aggregated has ORIGIN with the value EGP, then the aggregated
2688 route must have the origin attribute with the value EGP. In all
2689 other case the value of the ORIGIN attribute of the aggregated
2690 route is INTERNAL. */
2691 origin
= BGP_ORIGIN_IGP
;
2693 table
= bgp
->rib
[afi
][safi
];
2695 top
= bgp_node_get (table
, p
);
2696 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
2697 if (rn
->p
.prefixlen
> p
->prefixlen
)
2701 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2703 if (BGP_INFO_HOLDDOWN (ri
))
2706 if (del
&& ri
== del
)
2709 if (! rinew
&& first
)
2711 nexthop
= ri
->attr
->nexthop
;
2712 med
= ri
->attr
->med
;
2716 #ifdef AGGREGATE_NEXTHOP_CHECK
2717 if (! IPV4_ADDR_SAME (&ri
->attr
->nexthop
, &nexthop
)
2718 || ri
->attr
->med
!= med
)
2721 aspath_free (aspath
);
2723 community_free (community
);
2724 bgp_unlock_node (rn
);
2725 bgp_unlock_node (top
);
2728 #endif /* AGGREGATE_NEXTHOP_CHECK */
2730 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
2732 if (aggregate
->summary_only
)
2735 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
2741 if (aggregate
->as_set
)
2743 if (origin
< ri
->attr
->origin
)
2744 origin
= ri
->attr
->origin
;
2748 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
2749 aspath_free (aspath
);
2753 aspath
= aspath_dup (ri
->attr
->aspath
);
2755 if (ri
->attr
->community
)
2759 commerge
= community_merge (community
,
2760 ri
->attr
->community
);
2761 community
= community_uniq_sort (commerge
);
2762 community_free (commerge
);
2765 community
= community_dup (ri
->attr
->community
);
2771 bgp_process (bgp
, rn
, afi
, safi
);
2773 bgp_unlock_node (top
);
2779 if (aggregate
->summary_only
)
2782 if (aggregate
->as_set
)
2784 if (origin
< rinew
->attr
->origin
)
2785 origin
= rinew
->attr
->origin
;
2789 asmerge
= aspath_aggregate (aspath
, rinew
->attr
->aspath
);
2790 aspath_free (aspath
);
2794 aspath
= aspath_dup (rinew
->attr
->aspath
);
2796 if (rinew
->attr
->community
)
2800 commerge
= community_merge (community
,
2801 rinew
->attr
->community
);
2802 community
= community_uniq_sort (commerge
);
2803 community_free (commerge
);
2806 community
= community_dup (rinew
->attr
->community
);
2811 if (aggregate
->count
> 0)
2813 rn
= bgp_node_get (table
, p
);
2814 new = bgp_info_new ();
2815 new->type
= ZEBRA_ROUTE_BGP
;
2816 new->sub_type
= BGP_ROUTE_AGGREGATE
;
2817 new->peer
= bgp
->peer_self
;
2818 SET_FLAG (new->flags
, BGP_INFO_VALID
);
2819 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
2820 new->uptime
= time (NULL
);
2822 bgp_info_add (rn
, new);
2823 bgp_process (bgp
, rn
, afi
, safi
);
2828 aspath_free (aspath
);
2830 community_free (community
);
2834 void bgp_aggregate_delete (struct bgp
*, struct prefix
*, afi_t
, safi_t
,
2835 struct bgp_aggregate
*);
2838 bgp_aggregate_increment (struct bgp
*bgp
, struct prefix
*p
,
2839 struct bgp_info
*ri
, afi_t afi
, safi_t safi
)
2841 struct bgp_node
*child
;
2842 struct bgp_node
*rn
;
2843 struct bgp_aggregate
*aggregate
;
2845 /* MPLS-VPN aggregation is not yet supported. */
2846 if (safi
== SAFI_MPLS_VPN
)
2849 if (p
->prefixlen
== 0)
2852 if (BGP_INFO_HOLDDOWN (ri
))
2855 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
2857 /* Aggregate address configuration check. */
2858 for (rn
= child
; rn
; rn
= rn
->parent
)
2859 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
2861 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
2862 bgp_aggregate_route (bgp
, &rn
->p
, ri
, safi
, safi
, NULL
, aggregate
);
2864 bgp_unlock_node (child
);
2868 bgp_aggregate_decrement (struct bgp
*bgp
, struct prefix
*p
,
2869 struct bgp_info
*del
, afi_t afi
, safi_t safi
)
2871 struct bgp_node
*child
;
2872 struct bgp_node
*rn
;
2873 struct bgp_aggregate
*aggregate
;
2875 /* MPLS-VPN aggregation is not yet supported. */
2876 if (safi
== SAFI_MPLS_VPN
)
2879 if (p
->prefixlen
== 0)
2882 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
2884 /* Aggregate address configuration check. */
2885 for (rn
= child
; rn
; rn
= rn
->parent
)
2886 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
2888 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
2889 bgp_aggregate_route (bgp
, &rn
->p
, NULL
, safi
, safi
, del
, aggregate
);
2891 bgp_unlock_node (child
);
2895 bgp_aggregate_add (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
, safi_t safi
,
2896 struct bgp_aggregate
*aggregate
)
2898 struct bgp_table
*table
;
2899 struct bgp_node
*top
;
2900 struct bgp_node
*rn
;
2901 struct bgp_info
*new;
2902 struct bgp_info
*ri
;
2903 unsigned long match
;
2904 u_char origin
= BGP_ORIGIN_IGP
;
2905 struct aspath
*aspath
= NULL
;
2906 struct aspath
*asmerge
= NULL
;
2907 struct community
*community
= NULL
;
2908 struct community
*commerge
= NULL
;
2910 table
= bgp
->rib
[afi
][safi
];
2913 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
2915 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
2918 /* If routes exists below this node, generate aggregate routes. */
2919 top
= bgp_node_get (table
, p
);
2920 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
2921 if (rn
->p
.prefixlen
> p
->prefixlen
)
2925 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2927 if (BGP_INFO_HOLDDOWN (ri
))
2930 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
2932 /* summary-only aggregate route suppress aggregated
2933 route announcement. */
2934 if (aggregate
->summary_only
)
2937 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
2940 /* as-set aggregate route generate origin, as path,
2941 community aggregation. */
2942 if (aggregate
->as_set
)
2944 if (origin
< ri
->attr
->origin
)
2945 origin
= ri
->attr
->origin
;
2949 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
2950 aspath_free (aspath
);
2954 aspath
= aspath_dup (ri
->attr
->aspath
);
2956 if (ri
->attr
->community
)
2960 commerge
= community_merge (community
,
2961 ri
->attr
->community
);
2962 community
= community_uniq_sort (commerge
);
2963 community_free (commerge
);
2966 community
= community_dup (ri
->attr
->community
);
2973 /* If this node is suppressed, process the change. */
2975 bgp_process (bgp
, rn
, afi
, safi
);
2977 bgp_unlock_node (top
);
2979 /* Add aggregate route to BGP table. */
2980 if (aggregate
->count
)
2982 rn
= bgp_node_get (table
, p
);
2984 new = bgp_info_new ();
2985 new->type
= ZEBRA_ROUTE_BGP
;
2986 new->sub_type
= BGP_ROUTE_AGGREGATE
;
2987 new->peer
= bgp
->peer_self
;
2988 SET_FLAG (new->flags
, BGP_INFO_VALID
);
2989 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
2990 new->uptime
= time (NULL
);
2992 bgp_info_add (rn
, new);
2994 /* Process change. */
2995 bgp_process (bgp
, rn
, afi
, safi
);
3000 bgp_aggregate_delete (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3001 safi_t safi
, struct bgp_aggregate
*aggregate
)
3003 struct bgp_table
*table
;
3004 struct bgp_node
*top
;
3005 struct bgp_node
*rn
;
3006 struct bgp_info
*ri
;
3007 unsigned long match
;
3009 table
= bgp
->rib
[afi
][safi
];
3011 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
3013 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
3016 /* If routes exists below this node, generate aggregate routes. */
3017 top
= bgp_node_get (table
, p
);
3018 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
3019 if (rn
->p
.prefixlen
> p
->prefixlen
)
3023 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3025 if (BGP_INFO_HOLDDOWN (ri
))
3028 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
3030 if (aggregate
->summary_only
)
3034 if (ri
->suppress
== 0)
3036 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
3044 /* If this node is suppressed, process the change. */
3046 bgp_process (bgp
, rn
, afi
, safi
);
3048 bgp_unlock_node (top
);
3050 /* Delete aggregate route from BGP table. */
3051 rn
= bgp_node_get (table
, p
);
3053 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3054 if (ri
->peer
== bgp
->peer_self
3055 && ri
->type
== ZEBRA_ROUTE_BGP
3056 && ri
->sub_type
== BGP_ROUTE_AGGREGATE
)
3059 /* Withdraw static BGP route from routing table. */
3062 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
3063 bgp_process (bgp
, rn
, afi
, safi
);
3064 bgp_info_delete (rn
, ri
);
3066 bgp_unlock_node (rn
);
3069 /* Unlock bgp_node_lookup. */
3070 bgp_unlock_node (rn
);
3073 /* Aggregate route attribute. */
3074 #define AGGREGATE_SUMMARY_ONLY 1
3075 #define AGGREGATE_AS_SET 1
3078 bgp_aggregate_set (struct vty
*vty
, char *prefix_str
, afi_t afi
, safi_t safi
,
3079 u_char summary_only
, u_char as_set
)
3083 struct bgp_node
*rn
;
3085 struct bgp_aggregate
*aggregate
;
3087 /* Convert string to prefix structure. */
3088 ret
= str2prefix (prefix_str
, &p
);
3091 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
3096 /* Get BGP structure. */
3099 /* Old configuration check. */
3100 rn
= bgp_node_get (bgp
->aggregate
[afi
][safi
], &p
);
3104 vty_out (vty
, "There is already same aggregate network.%s", VTY_NEWLINE
);
3105 bgp_unlock_node (rn
);
3109 /* Make aggregate address structure. */
3110 aggregate
= bgp_aggregate_new ();
3111 aggregate
->summary_only
= summary_only
;
3112 aggregate
->as_set
= as_set
;
3113 aggregate
->safi
= safi
;
3114 rn
->info
= aggregate
;
3116 /* Aggregate address insert into BGP routing table. */
3117 if (safi
& SAFI_UNICAST
)
3118 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
3119 if (safi
& SAFI_MULTICAST
)
3120 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
3126 bgp_aggregate_unset (struct vty
*vty
, char *prefix_str
, afi_t afi
, safi_t safi
)
3130 struct bgp_node
*rn
;
3132 struct bgp_aggregate
*aggregate
;
3134 /* Convert string to prefix structure. */
3135 ret
= str2prefix (prefix_str
, &p
);
3138 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
3143 /* Get BGP structure. */
3146 /* Old configuration check. */
3147 rn
= bgp_node_lookup (bgp
->aggregate
[afi
][safi
], &p
);
3150 vty_out (vty
, "%% There is no aggregate-address configuration.%s",
3155 aggregate
= rn
->info
;
3156 if (aggregate
->safi
& SAFI_UNICAST
)
3157 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
3158 if (aggregate
->safi
& SAFI_MULTICAST
)
3159 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
3161 /* Unlock aggregate address configuration. */
3163 bgp_aggregate_free (aggregate
);
3164 bgp_unlock_node (rn
);
3165 bgp_unlock_node (rn
);
3170 DEFUN (aggregate_address
,
3171 aggregate_address_cmd
,
3172 "aggregate-address A.B.C.D/M",
3173 "Configure BGP aggregate entries\n"
3174 "Aggregate prefix\n")
3176 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
), 0, 0);
3179 DEFUN (aggregate_address_mask
,
3180 aggregate_address_mask_cmd
,
3181 "aggregate-address A.B.C.D A.B.C.D",
3182 "Configure BGP aggregate entries\n"
3183 "Aggregate address\n"
3187 char prefix_str
[BUFSIZ
];
3189 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3193 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3197 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
3201 DEFUN (aggregate_address_summary_only
,
3202 aggregate_address_summary_only_cmd
,
3203 "aggregate-address A.B.C.D/M summary-only",
3204 "Configure BGP aggregate entries\n"
3205 "Aggregate prefix\n"
3206 "Filter more specific routes from updates\n")
3208 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
3209 AGGREGATE_SUMMARY_ONLY
, 0);
3212 DEFUN (aggregate_address_mask_summary_only
,
3213 aggregate_address_mask_summary_only_cmd
,
3214 "aggregate-address A.B.C.D A.B.C.D summary-only",
3215 "Configure BGP aggregate entries\n"
3216 "Aggregate address\n"
3218 "Filter more specific routes from updates\n")
3221 char prefix_str
[BUFSIZ
];
3223 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3227 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3231 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
3232 AGGREGATE_SUMMARY_ONLY
, 0);
3235 DEFUN (aggregate_address_as_set
,
3236 aggregate_address_as_set_cmd
,
3237 "aggregate-address A.B.C.D/M as-set",
3238 "Configure BGP aggregate entries\n"
3239 "Aggregate prefix\n"
3240 "Generate AS set path information\n")
3242 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
3243 0, AGGREGATE_AS_SET
);
3246 DEFUN (aggregate_address_mask_as_set
,
3247 aggregate_address_mask_as_set_cmd
,
3248 "aggregate-address A.B.C.D A.B.C.D as-set",
3249 "Configure BGP aggregate entries\n"
3250 "Aggregate address\n"
3252 "Generate AS set path information\n")
3255 char prefix_str
[BUFSIZ
];
3257 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3261 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3265 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
3266 0, AGGREGATE_AS_SET
);
3270 DEFUN (aggregate_address_as_set_summary
,
3271 aggregate_address_as_set_summary_cmd
,
3272 "aggregate-address A.B.C.D/M as-set summary-only",
3273 "Configure BGP aggregate entries\n"
3274 "Aggregate prefix\n"
3275 "Generate AS set path information\n"
3276 "Filter more specific routes from updates\n")
3278 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
3279 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
3282 ALIAS (aggregate_address_as_set_summary
,
3283 aggregate_address_summary_as_set_cmd
,
3284 "aggregate-address A.B.C.D/M summary-only as-set",
3285 "Configure BGP aggregate entries\n"
3286 "Aggregate prefix\n"
3287 "Filter more specific routes from updates\n"
3288 "Generate AS set path information\n")
3290 DEFUN (aggregate_address_mask_as_set_summary
,
3291 aggregate_address_mask_as_set_summary_cmd
,
3292 "aggregate-address A.B.C.D A.B.C.D as-set summary-only",
3293 "Configure BGP aggregate entries\n"
3294 "Aggregate address\n"
3296 "Generate AS set path information\n"
3297 "Filter more specific routes from updates\n")
3300 char prefix_str
[BUFSIZ
];
3302 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3306 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3310 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
3311 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
3314 ALIAS (aggregate_address_mask_as_set_summary
,
3315 aggregate_address_mask_summary_as_set_cmd
,
3316 "aggregate-address A.B.C.D A.B.C.D summary-only as-set",
3317 "Configure BGP aggregate entries\n"
3318 "Aggregate address\n"
3320 "Filter more specific routes from updates\n"
3321 "Generate AS set path information\n")
3323 DEFUN (no_aggregate_address
,
3324 no_aggregate_address_cmd
,
3325 "no aggregate-address A.B.C.D/M",
3327 "Configure BGP aggregate entries\n"
3328 "Aggregate prefix\n")
3330 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
));
3333 ALIAS (no_aggregate_address
,
3334 no_aggregate_address_summary_only_cmd
,
3335 "no aggregate-address A.B.C.D/M summary-only",
3337 "Configure BGP aggregate entries\n"
3338 "Aggregate prefix\n"
3339 "Filter more specific routes from updates\n")
3341 ALIAS (no_aggregate_address
,
3342 no_aggregate_address_as_set_cmd
,
3343 "no aggregate-address A.B.C.D/M as-set",
3345 "Configure BGP aggregate entries\n"
3346 "Aggregate prefix\n"
3347 "Generate AS set path information\n")
3349 ALIAS (no_aggregate_address
,
3350 no_aggregate_address_as_set_summary_cmd
,
3351 "no aggregate-address A.B.C.D/M as-set summary-only",
3353 "Configure BGP aggregate entries\n"
3354 "Aggregate prefix\n"
3355 "Generate AS set path information\n"
3356 "Filter more specific routes from updates\n")
3358 ALIAS (no_aggregate_address
,
3359 no_aggregate_address_summary_as_set_cmd
,
3360 "no aggregate-address A.B.C.D/M summary-only as-set",
3362 "Configure BGP aggregate entries\n"
3363 "Aggregate prefix\n"
3364 "Filter more specific routes from updates\n"
3365 "Generate AS set path information\n")
3367 DEFUN (no_aggregate_address_mask
,
3368 no_aggregate_address_mask_cmd
,
3369 "no aggregate-address A.B.C.D A.B.C.D",
3371 "Configure BGP aggregate entries\n"
3372 "Aggregate address\n"
3376 char prefix_str
[BUFSIZ
];
3378 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3382 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3386 return bgp_aggregate_unset (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
));
3389 ALIAS (no_aggregate_address_mask
,
3390 no_aggregate_address_mask_summary_only_cmd
,
3391 "no aggregate-address A.B.C.D A.B.C.D summary-only",
3393 "Configure BGP aggregate entries\n"
3394 "Aggregate address\n"
3396 "Filter more specific routes from updates\n")
3398 ALIAS (no_aggregate_address_mask
,
3399 no_aggregate_address_mask_as_set_cmd
,
3400 "no aggregate-address A.B.C.D A.B.C.D as-set",
3402 "Configure BGP aggregate entries\n"
3403 "Aggregate address\n"
3405 "Generate AS set path information\n")
3407 ALIAS (no_aggregate_address_mask
,
3408 no_aggregate_address_mask_as_set_summary_cmd
,
3409 "no aggregate-address A.B.C.D A.B.C.D as-set summary-only",
3411 "Configure BGP aggregate entries\n"
3412 "Aggregate address\n"
3414 "Generate AS set path information\n"
3415 "Filter more specific routes from updates\n")
3417 ALIAS (no_aggregate_address_mask
,
3418 no_aggregate_address_mask_summary_as_set_cmd
,
3419 "no aggregate-address A.B.C.D A.B.C.D summary-only as-set",
3421 "Configure BGP aggregate entries\n"
3422 "Aggregate address\n"
3424 "Filter more specific routes from updates\n"
3425 "Generate AS set path information\n")
3428 DEFUN (ipv6_aggregate_address
,
3429 ipv6_aggregate_address_cmd
,
3430 "aggregate-address X:X::X:X/M",
3431 "Configure BGP aggregate entries\n"
3432 "Aggregate prefix\n")
3434 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0, 0);
3437 DEFUN (ipv6_aggregate_address_summary_only
,
3438 ipv6_aggregate_address_summary_only_cmd
,
3439 "aggregate-address X:X::X:X/M summary-only",
3440 "Configure BGP aggregate entries\n"
3441 "Aggregate prefix\n"
3442 "Filter more specific routes from updates\n")
3444 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
3445 AGGREGATE_SUMMARY_ONLY
, 0);
3448 DEFUN (no_ipv6_aggregate_address
,
3449 no_ipv6_aggregate_address_cmd
,
3450 "no aggregate-address X:X::X:X/M",
3452 "Configure BGP aggregate entries\n"
3453 "Aggregate prefix\n")
3455 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
3458 DEFUN (no_ipv6_aggregate_address_summary_only
,
3459 no_ipv6_aggregate_address_summary_only_cmd
,
3460 "no aggregate-address X:X::X:X/M summary-only",
3462 "Configure BGP aggregate entries\n"
3463 "Aggregate prefix\n"
3464 "Filter more specific routes from updates\n")
3466 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
3469 ALIAS (ipv6_aggregate_address
,
3470 old_ipv6_aggregate_address_cmd
,
3471 "ipv6 bgp aggregate-address X:X::X:X/M",
3474 "Configure BGP aggregate entries\n"
3475 "Aggregate prefix\n")
3477 ALIAS (ipv6_aggregate_address_summary_only
,
3478 old_ipv6_aggregate_address_summary_only_cmd
,
3479 "ipv6 bgp aggregate-address X:X::X:X/M summary-only",
3482 "Configure BGP aggregate entries\n"
3483 "Aggregate prefix\n"
3484 "Filter more specific routes from updates\n")
3486 ALIAS (no_ipv6_aggregate_address
,
3487 old_no_ipv6_aggregate_address_cmd
,
3488 "no ipv6 bgp aggregate-address X:X::X:X/M",
3492 "Configure BGP aggregate entries\n"
3493 "Aggregate prefix\n")
3495 ALIAS (no_ipv6_aggregate_address_summary_only
,
3496 old_no_ipv6_aggregate_address_summary_only_cmd
,
3497 "no ipv6 bgp aggregate-address X:X::X:X/M summary-only",
3501 "Configure BGP aggregate entries\n"
3502 "Aggregate prefix\n"
3503 "Filter more specific routes from updates\n")
3504 #endif /* HAVE_IPV6 */
3506 /* Redistribute route treatment. */
3508 bgp_redistribute_add (struct prefix
*p
, struct in_addr
*nexthop
,
3509 u_int32_t metric
, u_char type
)
3512 struct listnode
*nn
;
3513 struct bgp_info
*new;
3514 struct bgp_info
*bi
;
3515 struct bgp_info info
;
3516 struct bgp_node
*bn
;
3518 struct attr attr_new
;
3519 struct attr
*new_attr
;
3523 /* Make default attribute. */
3524 bgp_attr_default_set (&attr
, BGP_ORIGIN_INCOMPLETE
);
3526 attr
.nexthop
= *nexthop
;
3529 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3531 LIST_LOOP (bm
->bgp
, bgp
, nn
)
3533 afi
= family2afi (p
->family
);
3535 if (bgp
->redist
[afi
][type
])
3537 /* Copy attribute for modification. */
3540 if (bgp
->redist_metric_flag
[afi
][type
])
3541 attr_new
.med
= bgp
->redist_metric
[afi
][type
];
3543 /* Apply route-map. */
3544 if (bgp
->rmap
[afi
][type
].map
)
3546 info
.peer
= bgp
->peer_self
;
3547 info
.attr
= &attr_new
;
3549 ret
= route_map_apply (bgp
->rmap
[afi
][type
].map
, p
, RMAP_BGP
,
3551 if (ret
== RMAP_DENYMATCH
)
3553 /* Free uninterned attribute. */
3554 bgp_attr_flush (&attr_new
);
3556 /* Unintern original. */
3557 aspath_unintern (attr
.aspath
);
3558 bgp_redistribute_delete (p
, type
);
3563 bn
= bgp_afi_node_get (bgp
, afi
, SAFI_UNICAST
, p
, NULL
);
3564 new_attr
= bgp_attr_intern (&attr_new
);
3566 for (bi
= bn
->info
; bi
; bi
= bi
->next
)
3567 if (bi
->peer
== bgp
->peer_self
3568 && bi
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
3573 if (attrhash_cmp (bi
->attr
, new_attr
))
3575 bgp_attr_unintern (new_attr
);
3576 aspath_unintern (attr
.aspath
);
3577 bgp_unlock_node (bn
);
3582 /* The attribute is changed. */
3583 SET_FLAG (bi
->flags
, BGP_INFO_ATTR_CHANGED
);
3585 /* Rewrite BGP route information. */
3586 bgp_aggregate_decrement (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
3587 bgp_attr_unintern (bi
->attr
);
3588 bi
->attr
= new_attr
;
3589 bi
->uptime
= time (NULL
);
3591 /* Process change. */
3592 bgp_aggregate_increment (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
3593 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
3594 bgp_unlock_node (bn
);
3595 aspath_unintern (attr
.aspath
);
3600 new = bgp_info_new ();
3602 new->sub_type
= BGP_ROUTE_REDISTRIBUTE
;
3603 new->peer
= bgp
->peer_self
;
3604 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3605 new->attr
= new_attr
;
3606 new->uptime
= time (NULL
);
3608 bgp_aggregate_increment (bgp
, p
, new, afi
, SAFI_UNICAST
);
3609 bgp_info_add (bn
, new);
3610 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
3614 /* Unintern original. */
3615 aspath_unintern (attr
.aspath
);
3619 bgp_redistribute_delete (struct prefix
*p
, u_char type
)
3622 struct listnode
*nn
;
3624 struct bgp_node
*rn
;
3625 struct bgp_info
*ri
;
3627 LIST_LOOP (bm
->bgp
, bgp
, nn
)
3629 afi
= family2afi (p
->family
);
3631 if (bgp
->redist
[afi
][type
])
3633 rn
= bgp_afi_node_get (bgp
, afi
, SAFI_UNICAST
, p
, NULL
);
3635 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3636 if (ri
->peer
== bgp
->peer_self
3637 && ri
->type
== type
)
3642 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, SAFI_UNICAST
);
3643 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
3644 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
3645 bgp_info_delete (rn
, ri
);
3647 bgp_unlock_node (rn
);
3649 bgp_unlock_node (rn
);
3654 /* Withdraw specified route type's route. */
3656 bgp_redistribute_withdraw (struct bgp
*bgp
, afi_t afi
, int type
)
3658 struct bgp_node
*rn
;
3659 struct bgp_info
*ri
;
3660 struct bgp_table
*table
;
3662 table
= bgp
->rib
[afi
][SAFI_UNICAST
];
3664 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3666 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3667 if (ri
->peer
== bgp
->peer_self
3668 && ri
->type
== type
)
3673 bgp_aggregate_decrement (bgp
, &rn
->p
, ri
, afi
, SAFI_UNICAST
);
3674 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
3675 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
3676 bgp_info_delete (rn
, ri
);
3678 bgp_unlock_node (rn
);
3683 /* Static function to display route. */
3685 route_vty_out_route (struct prefix
*p
, struct vty
*vty
)
3688 u_int32_t destination
;
3691 if (p
->family
== AF_INET
)
3693 len
= vty_out (vty
, "%s", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
));
3694 destination
= ntohl (p
->u
.prefix4
.s_addr
);
3696 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
3697 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
3698 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
3699 || p
->u
.prefix4
.s_addr
== 0)
3701 /* When mask is natural, mask is not displayed. */
3704 len
+= vty_out (vty
, "/%d", p
->prefixlen
);
3707 len
= vty_out (vty
, "%s/%d", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
),
3712 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 20, " ");
3714 vty_out (vty
, "%*s", len
, " ");
3717 /* Calculate line number of output data. */
3719 vty_calc_line (struct vty
*vty
, unsigned long length
)
3721 return vty
->width
? (((vty
->obuf
->length
- length
) / vty
->width
) + 1) : 1;
3724 enum bgp_display_type
3729 /* called from terminal list command */
3731 route_vty_out (struct vty
*vty
, struct prefix
*p
,
3732 struct bgp_info
*binfo
, int display
, safi_t safi
)
3735 unsigned long length
= 0;
3737 length
= vty
->obuf
->length
;
3739 /* Route status display. */
3740 if (binfo
->suppress
)
3742 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
3748 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
3750 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
3752 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
3757 /* Internal route. */
3758 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
3763 /* print prefix and mask */
3765 route_vty_out_route (p
, vty
);
3767 vty_out (vty
, "%*s", 17, " ");
3769 /* Print attribute */
3773 if (p
->family
== AF_INET
)
3775 if (safi
== SAFI_MPLS_VPN
)
3776 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
3778 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
3781 else if (p
->family
== AF_INET6
)
3786 len
= vty_out (vty
, "%s",
3787 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
3790 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
3792 vty_out (vty
, "%*s", len
, " ");
3794 #endif /* HAVE_IPV6 */
3796 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
3797 vty_out (vty
, "%10d", attr
->med
);
3801 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
3802 vty_out (vty
, "%7d", attr
->local_pref
);
3806 vty_out (vty
, "%7u ",attr
->weight
);
3810 aspath_print_vty (vty
, attr
->aspath
);
3813 if (strlen (attr
->aspath
->str
) == 0)
3814 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
3816 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
3818 vty_out (vty
, "%s", VTY_NEWLINE
);
3820 return vty_calc_line (vty
, length
);
3823 /* called from terminal list command */
3825 route_vty_out_tmp (struct vty
*vty
, struct prefix
*p
,
3826 struct attr
*attr
, safi_t safi
)
3828 /* Route status display. */
3833 /* print prefix and mask */
3834 route_vty_out_route (p
, vty
);
3836 /* Print attribute */
3839 if (p
->family
== AF_INET
)
3841 if (safi
== SAFI_MPLS_VPN
)
3842 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
3844 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
3847 else if (p
->family
== AF_INET6
)
3852 len
= vty_out (vty
, "%s",
3853 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
3856 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
3858 vty_out (vty
, "%*s", len
, " ");
3860 #endif /* HAVE_IPV6 */
3862 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
3863 vty_out (vty
, "%10d", attr
->med
);
3867 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
3868 vty_out (vty
, "%7d", attr
->local_pref
);
3872 vty_out (vty
, "%7d ",attr
->weight
);
3876 aspath_print_vty (vty
, attr
->aspath
);
3879 if (strlen (attr
->aspath
->str
) == 0)
3880 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
3882 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
3885 vty_out (vty
, "%s", VTY_NEWLINE
);
3889 route_vty_out_tag (struct vty
*vty
, struct prefix
*p
,
3890 struct bgp_info
*binfo
, int display
, safi_t safi
)
3893 unsigned long length
= 0;
3894 u_int32_t label
= 0;
3896 length
= vty
->obuf
->length
;
3898 /* Route status display. */
3899 if (binfo
->suppress
)
3901 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
3907 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
3909 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
3911 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
3916 /* Internal route. */
3917 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
3922 /* print prefix and mask */
3924 route_vty_out_route (p
, vty
);
3926 vty_out (vty
, "%*s", 17, " ");
3928 /* Print attribute */
3932 if (p
->family
== AF_INET
)
3934 if (safi
== SAFI_MPLS_VPN
)
3935 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
3937 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
3940 else if (p
->family
== AF_INET6
)
3944 if (attr
->mp_nexthop_len
== 16)
3946 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
3947 else if (attr
->mp_nexthop_len
== 32)
3948 vty_out (vty
, "%s(%s)",
3949 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
),
3950 inet_ntop (AF_INET6
, &attr
->mp_nexthop_local
, buf1
, BUFSIZ
));
3953 #endif /* HAVE_IPV6 */
3956 label
= decode_label (binfo
->tag
);
3958 vty_out (vty
, "notag/%d", label
);
3960 vty_out (vty
, "%s", VTY_NEWLINE
);
3962 return vty_calc_line (vty
, length
);
3965 /* dampening route */
3967 damp_route_vty_out (struct vty
*vty
, struct prefix
*p
,
3968 struct bgp_info
*binfo
, int display
, safi_t safi
)
3971 unsigned long length
= 0;
3974 length
= vty
->obuf
->length
;
3976 /* Route status display. */
3977 if (binfo
->suppress
)
3979 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
3985 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
3987 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
3989 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
3996 /* print prefix and mask */
3998 route_vty_out_route (p
, vty
);
4000 vty_out (vty
, "%*s", 17, " ");
4002 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
4005 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 34, " ");
4007 vty_out (vty
, "%*s", len
, " ");
4009 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
));
4011 /* Print attribute */
4017 aspath_print_vty (vty
, attr
->aspath
);
4020 if (strlen (attr
->aspath
->str
) == 0)
4021 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
4023 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
4025 vty_out (vty
, "%s", VTY_NEWLINE
);
4027 return vty_calc_line (vty
, length
);
4030 #define BGP_UPTIME_LEN 25
4034 flap_route_vty_out (struct vty
*vty
, struct prefix
*p
,
4035 struct bgp_info
*binfo
, int display
, safi_t safi
)
4038 struct bgp_damp_info
*bdi
;
4039 unsigned long length
= 0;
4040 char timebuf
[BGP_UPTIME_LEN
];
4043 length
= vty
->obuf
->length
;
4044 bdi
= binfo
->damp_info
;
4046 /* Route status display. */
4047 if (binfo
->suppress
)
4049 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4055 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4057 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
4059 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
4066 /* print prefix and mask */
4068 route_vty_out_route (p
, vty
);
4070 vty_out (vty
, "%*s", 17, " ");
4072 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
4075 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 33, " ");
4077 vty_out (vty
, "%*s", len
, " ");
4079 len
= vty_out (vty
, "%d", bdi
->flap
);
4084 vty_out (vty
, "%*s ", len
, " ");
4086 vty_out (vty
, "%s ", peer_uptime (bdi
->start_time
,
4087 timebuf
, BGP_UPTIME_LEN
));
4089 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
)
4090 && ! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4091 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
));
4093 vty_out (vty
, "%*s ", 8, " ");
4095 /* Print attribute */
4101 aspath_print_vty (vty
, attr
->aspath
);
4104 if (strlen (attr
->aspath
->str
) == 0)
4105 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
4107 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
4109 vty_out (vty
, "%s", VTY_NEWLINE
);
4111 return vty_calc_line (vty
, length
);
4115 route_vty_out_detail (struct vty
*vty
, struct bgp
*bgp
, struct prefix
*p
,
4116 struct bgp_info
*binfo
, afi_t afi
, safi_t safi
)
4118 char buf
[INET6_ADDRSTRLEN
];
4121 int sockunion_vty_out (struct vty
*, union sockunion
*);
4127 /* Line1 display AS-path, Aggregator */
4131 if (attr
->aspath
->length
== 0)
4132 vty_out (vty
, "Local");
4134 aspath_print_vty (vty
, attr
->aspath
);
4137 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR
)
4138 || CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
)
4139 || CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
)
4140 || CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
)
4141 || CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
4145 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR
))
4146 vty_out (vty
, " (aggregated by %d %s)", attr
->aggregator_as
,
4147 inet_ntoa (attr
->aggregator_addr
));
4148 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
4149 vty_out (vty
, " (Received from a RR-client)");
4150 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
4151 vty_out (vty
, " (Received from a RS-client)");
4152 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4153 vty_out (vty
, " (history entry)");
4154 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
4155 vty_out (vty
, " (suppressed due to dampening)");
4157 vty_out (vty
, "%s", VTY_NEWLINE
);
4159 /* Line2 display Next-hop, Neighbor, Router-id */
4160 if (p
->family
== AF_INET
)
4162 vty_out (vty
, " %s", safi
== SAFI_MPLS_VPN
?
4163 inet_ntoa (attr
->mp_nexthop_global_in
) :
4164 inet_ntoa (attr
->nexthop
));
4169 vty_out (vty
, " %s",
4170 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
,
4171 buf
, INET6_ADDRSTRLEN
));
4173 #endif /* HAVE_IPV6 */
4175 if (binfo
->peer
== bgp
->peer_self
)
4177 vty_out (vty
, " from %s ",
4178 p
->family
== AF_INET
? "0.0.0.0" : "::");
4179 vty_out (vty
, "(%s)", inet_ntoa(bgp
->router_id
));
4183 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_VALID
))
4184 vty_out (vty
, " (inaccessible)");
4185 else if (binfo
->igpmetric
)
4186 vty_out (vty
, " (metric %d)", binfo
->igpmetric
);
4187 vty_out (vty
, " from %s", sockunion2str (&binfo
->peer
->su
, buf
, SU_ADDRSTRLEN
));
4188 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
4189 vty_out (vty
, " (%s)", inet_ntoa (attr
->originator_id
));
4191 vty_out (vty
, " (%s)", inet_ntop (AF_INET
, &binfo
->peer
->remote_id
, buf1
, BUFSIZ
));
4193 vty_out (vty
, "%s", VTY_NEWLINE
);
4196 /* display nexthop local */
4197 if (attr
->mp_nexthop_len
== 32)
4199 vty_out (vty
, " (%s)%s",
4200 inet_ntop (AF_INET6
, &attr
->mp_nexthop_local
,
4201 buf
, INET6_ADDRSTRLEN
),
4204 #endif /* HAVE_IPV6 */
4206 /* Line 3 display Origin, Med, Locpref, Weight, valid, Int/Ext/Local, Atomic, best */
4207 vty_out (vty
, " Origin %s", bgp_origin_long_str
[attr
->origin
]);
4209 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
))
4210 vty_out (vty
, ", metric %d", attr
->med
);
4212 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
))
4213 vty_out (vty
, ", localpref %d", attr
->local_pref
);
4215 vty_out (vty
, ", localpref %d", bgp
->default_local_pref
);
4217 if (attr
->weight
!= 0)
4218 vty_out (vty
, ", weight %d", attr
->weight
);
4220 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
4221 vty_out (vty
, ", valid");
4223 if (binfo
->peer
!= bgp
->peer_self
)
4225 if (binfo
->peer
->as
== binfo
->peer
->local_as
)
4226 vty_out (vty
, ", internal");
4228 vty_out (vty
, ", %s",
4229 (bgp_confederation_peers_check(bgp
, binfo
->peer
->as
) ? "confed-external" : "external"));
4231 else if (binfo
->sub_type
== BGP_ROUTE_AGGREGATE
)
4232 vty_out (vty
, ", aggregated, local");
4233 else if (binfo
->type
!= ZEBRA_ROUTE_BGP
)
4234 vty_out (vty
, ", sourced");
4236 vty_out (vty
, ", sourced, local");
4238 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
4239 vty_out (vty
, ", atomic-aggregate");
4241 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
4242 vty_out (vty
, ", best");
4244 vty_out (vty
, "%s", VTY_NEWLINE
);
4246 /* Line 4 display Community */
4247 if (attr
->community
)
4248 vty_out (vty
, " Community: %s%s", attr
->community
->str
,
4251 /* Line 5 display Extended-community */
4252 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
))
4253 vty_out (vty
, " Extended Community: %s%s", attr
->ecommunity
->str
,
4256 /* Line 6 display Originator, Cluster-id */
4257 if ((attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)) ||
4258 (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
)))
4260 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
4261 vty_out (vty
, " Originator: %s", inet_ntoa (attr
->originator_id
));
4263 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
4266 vty_out (vty
, ", Cluster list: ");
4267 for (i
= 0; i
< attr
->cluster
->length
/ 4; i
++)
4268 vty_out (vty
, "%s ", inet_ntoa (attr
->cluster
->list
[i
]));
4270 vty_out (vty
, "%s", VTY_NEWLINE
);
4273 if (binfo
->damp_info
)
4274 bgp_damp_info_vty (vty
, binfo
);
4276 /* Line 7 display Uptime */
4277 vty_out (vty
, " Last update: %s", ctime (&binfo
->uptime
));
4279 vty_out (vty
, "%s", VTY_NEWLINE
);
4282 #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s"
4283 #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s"
4284 #define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path%s"
4288 bgp_show_type_normal
,
4289 bgp_show_type_regexp
,
4290 bgp_show_type_prefix_list
,
4291 bgp_show_type_filter_list
,
4292 bgp_show_type_route_map
,
4293 bgp_show_type_neighbor
,
4294 bgp_show_type_cidr_only
,
4295 bgp_show_type_prefix_longer
,
4296 bgp_show_type_community_all
,
4297 bgp_show_type_community
,
4298 bgp_show_type_community_exact
,
4299 bgp_show_type_community_list
,
4300 bgp_show_type_community_list_exact
,
4301 bgp_show_type_flap_statistics
,
4302 bgp_show_type_flap_address
,
4303 bgp_show_type_flap_prefix
,
4304 bgp_show_type_flap_cidr_only
,
4305 bgp_show_type_flap_regexp
,
4306 bgp_show_type_flap_filter_list
,
4307 bgp_show_type_flap_prefix_list
,
4308 bgp_show_type_flap_prefix_longer
,
4309 bgp_show_type_flap_route_map
,
4310 bgp_show_type_flap_neighbor
,
4311 bgp_show_type_dampend_paths
,
4312 bgp_show_type_damp_neighbor
4316 bgp_show_callback (struct vty
*vty
, int unlock
)
4318 struct bgp_node
*rn
;
4319 struct bgp_info
*ri
;
4324 rn
= vty
->output_rn
;
4326 limit
= ((vty
->lines
== 0)
4327 ? 10 : (vty
->lines
> 0
4328 ? vty
->lines
: vty
->height
- 2));
4329 limit
= limit
> 0 ? limit
: 2;
4331 /* Quit of display. */
4334 bgp_unlock_node (rn
);
4335 if (vty
->output_clean
)
4336 (*vty
->output_clean
) (vty
);
4337 vty
->output_rn
= NULL
;
4338 vty
->output_func
= NULL
;
4339 vty
->output_clean
= NULL
;
4340 vty
->output_arg
= NULL
;
4344 for (; rn
; rn
= bgp_route_next (rn
))
4345 if (rn
->info
!= NULL
)
4349 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4351 if (vty
->output_type
== bgp_show_type_flap_statistics
4352 || vty
->output_type
== bgp_show_type_flap_address
4353 || vty
->output_type
== bgp_show_type_flap_prefix
4354 || vty
->output_type
== bgp_show_type_flap_cidr_only
4355 || vty
->output_type
== bgp_show_type_flap_regexp
4356 || vty
->output_type
== bgp_show_type_flap_filter_list
4357 || vty
->output_type
== bgp_show_type_flap_prefix_list
4358 || vty
->output_type
== bgp_show_type_flap_prefix_longer
4359 || vty
->output_type
== bgp_show_type_flap_route_map
4360 || vty
->output_type
== bgp_show_type_flap_neighbor
4361 || vty
->output_type
== bgp_show_type_dampend_paths
4362 || vty
->output_type
== bgp_show_type_damp_neighbor
)
4364 if (! ri
->damp_info
)
4367 if (vty
->output_type
== bgp_show_type_regexp
4368 || vty
->output_type
== bgp_show_type_flap_regexp
)
4370 regex_t
*regex
= vty
->output_arg
;
4372 if (bgp_regexec (regex
, ri
->attr
->aspath
) == REG_NOMATCH
)
4375 if (vty
->output_type
== bgp_show_type_prefix_list
4376 || vty
->output_type
== bgp_show_type_flap_prefix_list
)
4378 struct prefix_list
*plist
= vty
->output_arg
;
4380 if (prefix_list_apply (plist
, &rn
->p
) != PREFIX_PERMIT
)
4383 if (vty
->output_type
== bgp_show_type_filter_list
4384 || vty
->output_type
== bgp_show_type_flap_filter_list
)
4386 struct as_list
*as_list
= vty
->output_arg
;
4388 if (as_list_apply (as_list
, ri
->attr
->aspath
) != AS_FILTER_PERMIT
)
4391 if (vty
->output_type
== bgp_show_type_route_map
4392 || vty
->output_type
== bgp_show_type_flap_route_map
)
4394 struct route_map
*rmap
= vty
->output_arg
;
4395 struct bgp_info binfo
;
4396 struct attr dummy_attr
;
4399 dummy_attr
= *ri
->attr
;
4400 binfo
.peer
= ri
->peer
;
4401 binfo
.attr
= &dummy_attr
;
4403 ret
= route_map_apply (rmap
, &rn
->p
, RMAP_BGP
, &binfo
);
4405 if (ret
== RMAP_DENYMATCH
)
4408 if (vty
->output_type
== bgp_show_type_neighbor
4409 || vty
->output_type
== bgp_show_type_flap_neighbor
4410 || vty
->output_type
== bgp_show_type_damp_neighbor
)
4412 union sockunion
*su
= vty
->output_arg
;
4414 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
4417 if (vty
->output_type
== bgp_show_type_cidr_only
4418 || vty
->output_type
== bgp_show_type_flap_cidr_only
)
4420 u_int32_t destination
;
4422 destination
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
4423 if (IN_CLASSC (destination
) && rn
->p
.prefixlen
== 24)
4425 if (IN_CLASSB (destination
) && rn
->p
.prefixlen
== 16)
4427 if (IN_CLASSA (destination
) && rn
->p
.prefixlen
== 8)
4430 if (vty
->output_type
== bgp_show_type_prefix_longer
4431 || vty
->output_type
== bgp_show_type_flap_prefix_longer
)
4433 struct prefix
*p
= vty
->output_arg
;
4435 if (! prefix_match (p
, &rn
->p
))
4438 if (vty
->output_type
== bgp_show_type_community_all
)
4440 if (! ri
->attr
->community
)
4443 if (vty
->output_type
== bgp_show_type_community
)
4445 struct community
*com
= vty
->output_arg
;
4447 if (! ri
->attr
->community
||
4448 ! community_match (ri
->attr
->community
, com
))
4451 if (vty
->output_type
== bgp_show_type_community_exact
)
4453 struct community
*com
= vty
->output_arg
;
4455 if (! ri
->attr
->community
||
4456 ! community_cmp (ri
->attr
->community
, com
))
4459 if (vty
->output_type
== bgp_show_type_community_list
)
4461 struct community_list
*list
= vty
->output_arg
;
4463 if (! community_list_match (ri
->attr
->community
, list
))
4466 if (vty
->output_type
== bgp_show_type_community_list_exact
)
4468 struct community_list
*list
= vty
->output_arg
;
4470 if (! community_list_exact_match (ri
->attr
->community
, list
))
4473 if (vty
->output_type
== bgp_show_type_flap_address
4474 || vty
->output_type
== bgp_show_type_flap_prefix
)
4476 struct prefix
*p
= vty
->output_arg
;
4478 if (! prefix_match (&rn
->p
, p
))
4481 if (vty
->output_type
== bgp_show_type_flap_prefix
)
4482 if (p
->prefixlen
!= rn
->p
.prefixlen
)
4485 if (vty
->output_type
== bgp_show_type_dampend_paths
4486 || vty
->output_type
== bgp_show_type_damp_neighbor
)
4488 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
4489 || CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
4493 if (vty
->output_type
== bgp_show_type_dampend_paths
4494 || vty
->output_type
== bgp_show_type_damp_neighbor
)
4495 count
+= damp_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
4496 else if (vty
->output_type
== bgp_show_type_flap_statistics
4497 || vty
->output_type
== bgp_show_type_flap_address
4498 || vty
->output_type
== bgp_show_type_flap_prefix
4499 || vty
->output_type
== bgp_show_type_flap_cidr_only
4500 || vty
->output_type
== bgp_show_type_flap_regexp
4501 || vty
->output_type
== bgp_show_type_flap_filter_list
4502 || vty
->output_type
== bgp_show_type_flap_prefix_list
4503 || vty
->output_type
== bgp_show_type_flap_prefix_longer
4504 || vty
->output_type
== bgp_show_type_flap_route_map
4505 || vty
->output_type
== bgp_show_type_flap_neighbor
)
4506 count
+= flap_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
4508 count
+= route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
4513 vty
->output_count
++;
4515 /* Remember current pointer then suspend output. */
4518 vty
->status
= VTY_CONTINUE
;
4519 vty
->output_rn
= bgp_route_next (rn
);;
4520 vty
->output_func
= bgp_show_callback
;
4525 /* Total line display. */
4526 if (vty
->output_count
)
4527 vty_out (vty
, "%sTotal number of prefixes %ld%s",
4528 VTY_NEWLINE
, vty
->output_count
, VTY_NEWLINE
);
4530 if (vty
->output_clean
)
4531 (*vty
->output_clean
) (vty
);
4533 vty
->status
= VTY_CONTINUE
;
4534 vty
->output_rn
= NULL
;
4535 vty
->output_func
= NULL
;
4536 vty
->output_clean
= NULL
;
4537 vty
->output_arg
= NULL
;
4543 bgp_show (struct vty
*vty
, char *view_name
, afi_t afi
, safi_t safi
,
4544 enum bgp_show_type type
)
4547 struct bgp_info
*ri
;
4548 struct bgp_node
*rn
;
4549 struct bgp_table
*table
;
4555 limit
= ((vty
->lines
== 0)
4556 ? 10 : (vty
->lines
> 0
4557 ? vty
->lines
: vty
->height
- 2));
4558 limit
= limit
> 0 ? limit
: 2;
4560 /* BGP structure lookup. */
4563 bgp
= bgp_lookup_by_name (view_name
);
4566 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
4572 bgp
= bgp_get_default ();
4575 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
4582 /* This is first entry point, so reset total line. */
4583 vty
->output_count
= 0;
4584 vty
->output_type
= type
;
4586 table
= bgp
->rib
[afi
][safi
];
4588 /* Start processing of routes. */
4589 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
4590 if (rn
->info
!= NULL
)
4594 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4596 if (vty
->output_type
== bgp_show_type_flap_statistics
4597 || type
== bgp_show_type_flap_address
4598 || type
== bgp_show_type_flap_prefix
4599 || type
== bgp_show_type_flap_cidr_only
4600 || type
== bgp_show_type_flap_regexp
4601 || type
== bgp_show_type_flap_filter_list
4602 || type
== bgp_show_type_flap_prefix_list
4603 || type
== bgp_show_type_flap_prefix_longer
4604 || type
== bgp_show_type_flap_route_map
4605 || type
== bgp_show_type_flap_neighbor
4606 || type
== bgp_show_type_dampend_paths
4607 || type
== bgp_show_type_damp_neighbor
)
4609 if (! ri
->damp_info
)
4612 if (type
== bgp_show_type_regexp
4613 || type
== bgp_show_type_flap_regexp
)
4615 regex_t
*regex
= vty
->output_arg
;
4617 if (bgp_regexec (regex
, ri
->attr
->aspath
) == REG_NOMATCH
)
4620 if (type
== bgp_show_type_prefix_list
4621 || type
== bgp_show_type_flap_prefix_list
)
4623 struct prefix_list
*plist
= vty
->output_arg
;
4625 if (prefix_list_apply (plist
, &rn
->p
) != PREFIX_PERMIT
)
4628 if (type
== bgp_show_type_filter_list
4629 || type
== bgp_show_type_flap_filter_list
)
4631 struct as_list
*as_list
= vty
->output_arg
;
4633 if (as_list_apply (as_list
, ri
->attr
->aspath
) != AS_FILTER_PERMIT
)
4636 if (type
== bgp_show_type_route_map
4637 || type
== bgp_show_type_flap_route_map
)
4639 struct route_map
*rmap
= vty
->output_arg
;
4640 struct bgp_info binfo
;
4641 struct attr dummy_attr
;
4644 dummy_attr
= *ri
->attr
;
4645 binfo
.peer
= ri
->peer
;
4646 binfo
.attr
= &dummy_attr
;
4648 ret
= route_map_apply (rmap
, &rn
->p
, RMAP_BGP
, &binfo
);
4650 if (ret
== RMAP_DENYMATCH
)
4653 if (type
== bgp_show_type_neighbor
4654 || type
== bgp_show_type_flap_neighbor
4655 || type
== bgp_show_type_damp_neighbor
)
4657 union sockunion
*su
= vty
->output_arg
;
4659 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
4662 if (type
== bgp_show_type_cidr_only
4663 || type
== bgp_show_type_flap_cidr_only
)
4665 u_int32_t destination
;
4667 destination
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
4668 if (IN_CLASSC (destination
) && rn
->p
.prefixlen
== 24)
4670 if (IN_CLASSB (destination
) && rn
->p
.prefixlen
== 16)
4672 if (IN_CLASSA (destination
) && rn
->p
.prefixlen
== 8)
4675 if (type
== bgp_show_type_prefix_longer
4676 || type
== bgp_show_type_flap_prefix_longer
)
4678 struct prefix
*p
= vty
->output_arg
;
4680 if (! prefix_match (p
, &rn
->p
))
4683 if (type
== bgp_show_type_community_all
)
4685 if (! ri
->attr
->community
)
4688 if (type
== bgp_show_type_community
)
4690 struct community
*com
= vty
->output_arg
;
4692 if (! ri
->attr
->community
||
4693 ! community_match (ri
->attr
->community
, com
))
4696 if (type
== bgp_show_type_community_exact
)
4698 struct community
*com
= vty
->output_arg
;
4700 if (! ri
->attr
->community
||
4701 ! community_cmp (ri
->attr
->community
, com
))
4704 if (type
== bgp_show_type_community_list
)
4706 struct community_list
*list
= vty
->output_arg
;
4708 if (! community_list_match (ri
->attr
->community
, list
))
4711 if (type
== bgp_show_type_community_list_exact
)
4713 struct community_list
*list
= vty
->output_arg
;
4715 if (! community_list_exact_match (ri
->attr
->community
, list
))
4718 if (type
== bgp_show_type_flap_address
4719 || type
== bgp_show_type_flap_prefix
)
4721 struct prefix
*p
= vty
->output_arg
;
4723 if (! prefix_match (&rn
->p
, p
))
4726 if (type
== bgp_show_type_flap_prefix
)
4727 if (p
->prefixlen
!= rn
->p
.prefixlen
)
4730 if (type
== bgp_show_type_dampend_paths
4731 || type
== bgp_show_type_damp_neighbor
)
4733 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
4734 || CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
4740 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
4741 vty_out (vty
, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s", VTY_NEWLINE
);
4742 vty_out (vty
, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s", VTY_NEWLINE
, VTY_NEWLINE
);
4743 if (type
== bgp_show_type_dampend_paths
4744 || type
== bgp_show_type_damp_neighbor
)
4745 vty_out (vty
, BGP_SHOW_DAMP_HEADER
, VTY_NEWLINE
);
4746 else if (type
== bgp_show_type_flap_statistics
4747 || type
== bgp_show_type_flap_address
4748 || type
== bgp_show_type_flap_prefix
4749 || type
== bgp_show_type_flap_cidr_only
4750 || type
== bgp_show_type_flap_regexp
4751 || type
== bgp_show_type_flap_filter_list
4752 || type
== bgp_show_type_flap_prefix_list
4753 || type
== bgp_show_type_flap_prefix_longer
4754 || type
== bgp_show_type_flap_route_map
4755 || type
== bgp_show_type_flap_neighbor
)
4756 vty_out (vty
, BGP_SHOW_FLAP_HEADER
, VTY_NEWLINE
);
4758 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
4763 if (type
== bgp_show_type_dampend_paths
4764 || type
== bgp_show_type_damp_neighbor
)
4765 count
+= damp_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
4766 else if (type
== bgp_show_type_flap_statistics
4767 || type
== bgp_show_type_flap_address
4768 || type
== bgp_show_type_flap_prefix
4769 || type
== bgp_show_type_flap_cidr_only
4770 || type
== bgp_show_type_flap_regexp
4771 || type
== bgp_show_type_flap_filter_list
4772 || type
== bgp_show_type_flap_prefix_list
4773 || type
== bgp_show_type_flap_prefix_longer
4774 || type
== bgp_show_type_flap_route_map
4775 || type
== bgp_show_type_flap_neighbor
)
4776 count
+= flap_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
4778 count
+= route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
4782 vty
->output_count
++;
4784 /* Remember current pointer then suspend output. */
4785 if (count
>= limit
&& vty
->type
!= VTY_SHELL_SERV
)
4787 vty
->status
= VTY_START
;
4788 vty
->output_rn
= bgp_route_next (rn
);
4789 vty
->output_func
= bgp_show_callback
;
4790 vty
->output_type
= type
;
4796 /* No route is displayed */
4797 if (vty
->output_count
== 0)
4799 if (type
== bgp_show_type_normal
)
4800 vty_out (vty
, "No BGP network exists%s", VTY_NEWLINE
);
4803 vty_out (vty
, "%sTotal number of prefixes %ld%s",
4804 VTY_NEWLINE
, vty
->output_count
, VTY_NEWLINE
);
4806 /* Clean up allocated resources. */
4807 if (vty
->output_clean
)
4808 (*vty
->output_clean
) (vty
);
4810 vty
->status
= VTY_START
;
4811 vty
->output_rn
= NULL
;
4812 vty
->output_func
= NULL
;
4813 vty
->output_clean
= NULL
;
4814 vty
->output_arg
= NULL
;
4819 /* Header of detailed BGP route information */
4821 route_vty_out_detail_header (struct vty
*vty
, struct bgp
*bgp
,
4822 struct bgp_node
*rn
,
4823 struct prefix_rd
*prd
, afi_t afi
, safi_t safi
)
4825 struct bgp_info
*ri
;
4828 struct listnode
*nn
;
4829 char buf1
[INET6_ADDRSTRLEN
];
4830 char buf2
[INET6_ADDRSTRLEN
];
4835 int no_advertise
= 0;
4840 vty_out (vty
, "BGP routing table entry for %s%s%s/%d%s",
4841 (safi
== SAFI_MPLS_VPN
?
4842 prefix_rd2str (prd
, buf1
, RD_ADDRSTRLEN
) : ""),
4843 safi
== SAFI_MPLS_VPN
? ":" : "",
4844 inet_ntop (p
->family
, &p
->u
.prefix
, buf2
, INET6_ADDRSTRLEN
),
4845 p
->prefixlen
, VTY_NEWLINE
);
4847 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4850 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
4855 if (ri
->attr
->community
!= NULL
)
4857 if (community_include (ri
->attr
->community
, COMMUNITY_NO_ADVERTISE
))
4859 if (community_include (ri
->attr
->community
, COMMUNITY_NO_EXPORT
))
4861 if (community_include (ri
->attr
->community
, COMMUNITY_LOCAL_AS
))
4867 vty_out (vty
, "Paths: (%d available", count
);
4870 vty_out (vty
, ", best #%d", best
);
4871 if (safi
== SAFI_UNICAST
)
4872 vty_out (vty
, ", table Default-IP-Routing-Table");
4875 vty_out (vty
, ", no best path");
4877 vty_out (vty
, ", not advertised to any peer");
4879 vty_out (vty
, ", not advertised to EBGP peer");
4881 vty_out (vty
, ", not advertised outside local AS");
4883 vty_out (vty
, ", Advertisements suppressed by an aggregate.");
4884 vty_out (vty
, ")%s", VTY_NEWLINE
);
4886 /* advertised peer */
4887 LIST_LOOP (bgp
->peer
, peer
, nn
)
4889 if (bgp_adj_out_lookup (peer
, p
, afi
, safi
, rn
))
4892 vty_out (vty
, " Advertised to non peer-group peers:%s ", VTY_NEWLINE
);
4893 vty_out (vty
, " %s", sockunion2str (&peer
->su
, buf1
, SU_ADDRSTRLEN
));
4898 vty_out (vty
, " Not advertised to any peer");
4899 vty_out (vty
, "%s", VTY_NEWLINE
);
4902 /* Display specified route of BGP table. */
4904 bgp_show_route (struct vty
*vty
, char *view_name
, char *ip_str
,
4905 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
4911 struct prefix match
;
4912 struct bgp_node
*rn
;
4913 struct bgp_node
*rm
;
4914 struct bgp_info
*ri
;
4916 struct bgp_table
*table
;
4918 /* BGP structure lookup. */
4921 bgp
= bgp_lookup_by_name (view_name
);
4924 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
4930 bgp
= bgp_get_default ();
4933 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
4938 /* Check IP address argument. */
4939 ret
= str2prefix (ip_str
, &match
);
4942 vty_out (vty
, "address is malformed%s", VTY_NEWLINE
);
4946 match
.family
= afi2family (afi
);
4948 if (safi
== SAFI_MPLS_VPN
)
4950 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= bgp_route_next (rn
))
4952 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
4955 if ((table
= rn
->info
) != NULL
)
4959 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
4961 if (prefix_check
&& rm
->p
.prefixlen
!= match
.prefixlen
)
4964 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
4968 route_vty_out_detail_header (vty
, bgp
, rm
, (struct prefix_rd
*)&rn
->p
,
4969 AFI_IP
, SAFI_MPLS_VPN
);
4974 route_vty_out_detail (vty
, bgp
, &rm
->p
, ri
, AFI_IP
, SAFI_MPLS_VPN
);
4984 if ((rn
= bgp_node_match (bgp
->rib
[afi
][safi
], &match
)) != NULL
)
4986 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
4988 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4992 route_vty_out_detail_header (vty
, bgp
, rn
, NULL
, afi
, safi
);
4996 route_vty_out_detail (vty
, bgp
, &rn
->p
, ri
, afi
, safi
);
5004 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
5011 /* BGP route print out function. */
5019 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
);
5022 DEFUN (show_ip_bgp_ipv4
,
5023 show_ip_bgp_ipv4_cmd
,
5024 "show ip bgp ipv4 (unicast|multicast)",
5029 "Address Family modifier\n"
5030 "Address Family modifier\n")
5032 if (strncmp (argv
[0], "m", 1) == 0)
5033 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, bgp_show_type_normal
);
5035 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
);
5038 DEFUN (show_ip_bgp_route
,
5039 show_ip_bgp_route_cmd
,
5040 "show ip bgp A.B.C.D",
5044 "Network in the BGP routing table to display\n")
5046 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
5049 DEFUN (show_ip_bgp_ipv4_route
,
5050 show_ip_bgp_ipv4_route_cmd
,
5051 "show ip bgp ipv4 (unicast|multicast) A.B.C.D",
5056 "Address Family modifier\n"
5057 "Address Family modifier\n"
5058 "Network in the BGP routing table to display\n")
5060 if (strncmp (argv
[0], "m", 1) == 0)
5061 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0);
5063 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
5066 DEFUN (show_ip_bgp_vpnv4_all_route
,
5067 show_ip_bgp_vpnv4_all_route_cmd
,
5068 "show ip bgp vpnv4 all A.B.C.D",
5072 "Display VPNv4 NLRI specific information\n"
5073 "Display information about all VPNv4 NLRIs\n"
5074 "Network in the BGP routing table to display\n")
5076 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 0);
5079 DEFUN (show_ip_bgp_vpnv4_rd_route
,
5080 show_ip_bgp_vpnv4_rd_route_cmd
,
5081 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D",
5085 "Display VPNv4 NLRI specific information\n"
5086 "Display information for a route distinguisher\n"
5087 "VPN Route Distinguisher\n"
5088 "Network in the BGP routing table to display\n")
5091 struct prefix_rd prd
;
5093 ret
= str2prefix_rd (argv
[0], &prd
);
5096 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
5099 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 0);
5102 DEFUN (show_ip_bgp_prefix
,
5103 show_ip_bgp_prefix_cmd
,
5104 "show ip bgp A.B.C.D/M",
5108 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
5110 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
5113 DEFUN (show_ip_bgp_ipv4_prefix
,
5114 show_ip_bgp_ipv4_prefix_cmd
,
5115 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M",
5120 "Address Family modifier\n"
5121 "Address Family modifier\n"
5122 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
5124 if (strncmp (argv
[0], "m", 1) == 0)
5125 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1);
5127 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
5130 DEFUN (show_ip_bgp_vpnv4_all_prefix
,
5131 show_ip_bgp_vpnv4_all_prefix_cmd
,
5132 "show ip bgp vpnv4 all A.B.C.D/M",
5136 "Display VPNv4 NLRI specific information\n"
5137 "Display information about all VPNv4 NLRIs\n"
5138 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
5140 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 1);
5143 DEFUN (show_ip_bgp_vpnv4_rd_prefix
,
5144 show_ip_bgp_vpnv4_rd_prefix_cmd
,
5145 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M",
5149 "Display VPNv4 NLRI specific information\n"
5150 "Display information for a route distinguisher\n"
5151 "VPN Route Distinguisher\n"
5152 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
5155 struct prefix_rd prd
;
5157 ret
= str2prefix_rd (argv
[0], &prd
);
5160 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
5163 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 1);
5166 DEFUN (show_ip_bgp_view
,
5167 show_ip_bgp_view_cmd
,
5168 "show ip bgp view WORD",
5175 return bgp_show (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
);
5178 DEFUN (show_ip_bgp_view_route
,
5179 show_ip_bgp_view_route_cmd
,
5180 "show ip bgp view WORD A.B.C.D",
5186 "Network in the BGP routing table to display\n")
5188 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
5191 DEFUN (show_ip_bgp_view_prefix
,
5192 show_ip_bgp_view_prefix_cmd
,
5193 "show ip bgp view WORD A.B.C.D/M",
5199 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
5201 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
5211 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
);
5222 DEFUN (show_ipv6_bgp
,
5229 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
);
5232 DEFUN (show_bgp_route
,
5234 "show bgp X:X::X:X",
5237 "Network in the BGP routing table to display\n")
5239 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
5242 ALIAS (show_bgp_route
,
5243 show_bgp_ipv6_route_cmd
,
5244 "show bgp ipv6 X:X::X:X",
5248 "Network in the BGP routing table to display\n")
5251 DEFUN (show_ipv6_bgp_route
,
5252 show_ipv6_bgp_route_cmd
,
5253 "show ipv6 bgp X:X::X:X",
5257 "Network in the BGP routing table to display\n")
5259 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
5262 DEFUN (show_bgp_prefix
,
5263 show_bgp_prefix_cmd
,
5264 "show bgp X:X::X:X/M",
5267 "IPv6 prefix <network>/<length>\n")
5269 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
5272 ALIAS (show_bgp_prefix
,
5273 show_bgp_ipv6_prefix_cmd
,
5274 "show bgp ipv6 X:X::X:X/M",
5278 "IPv6 prefix <network>/<length>\n")
5281 DEFUN (show_ipv6_bgp_prefix
,
5282 show_ipv6_bgp_prefix_cmd
,
5283 "show ipv6 bgp X:X::X:X/M",
5287 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
5289 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
5293 DEFUN (show_ipv6_mbgp
,
5300 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
);
5304 DEFUN (show_ipv6_mbgp_route
,
5305 show_ipv6_mbgp_route_cmd
,
5306 "show ipv6 mbgp X:X::X:X",
5310 "Network in the MBGP routing table to display\n")
5312 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0);
5316 DEFUN (show_ipv6_mbgp_prefix
,
5317 show_ipv6_mbgp_prefix_cmd
,
5318 "show ipv6 mbgp X:X::X:X/M",
5322 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
5324 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1);
5329 bgp_show_regexp_clean (struct vty
*vty
)
5331 bgp_regex_free (vty
->output_arg
);
5335 bgp_show_regexp (struct vty
*vty
, int argc
, char **argv
, afi_t afi
,
5336 safi_t safi
, enum bgp_show_type type
)
5345 b
= buffer_new (1024);
5346 for (i
= 0; i
< argc
; i
++)
5349 buffer_putc (b
, ' ');
5352 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
5357 buffer_putstr (b
, argv
[i
]);
5359 buffer_putc (b
, '\0');
5361 regstr
= buffer_getstr (b
);
5364 regex
= bgp_regcomp (regstr
);
5367 vty_out (vty
, "Can't compile regexp %s%s", argv
[0],
5372 vty
->output_arg
= regex
;
5373 vty
->output_clean
= bgp_show_regexp_clean
;
5375 return bgp_show (vty
, NULL
, afi
, safi
, type
);
5378 DEFUN (show_ip_bgp_regexp
,
5379 show_ip_bgp_regexp_cmd
,
5380 "show ip bgp regexp .LINE",
5384 "Display routes matching the AS path regular expression\n"
5385 "A regular-expression to match the BGP AS paths\n")
5387 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
5388 bgp_show_type_regexp
);
5391 DEFUN (show_ip_bgp_flap_regexp
,
5392 show_ip_bgp_flap_regexp_cmd
,
5393 "show ip bgp flap-statistics regexp .LINE",
5397 "Display flap statistics of routes\n"
5398 "Display routes matching the AS path regular expression\n"
5399 "A regular-expression to match the BGP AS paths\n")
5401 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
5402 bgp_show_type_flap_regexp
);
5405 DEFUN (show_ip_bgp_ipv4_regexp
,
5406 show_ip_bgp_ipv4_regexp_cmd
,
5407 "show ip bgp ipv4 (unicast|multicast) regexp .LINE",
5412 "Address Family modifier\n"
5413 "Address Family modifier\n"
5414 "Display routes matching the AS path regular expression\n"
5415 "A regular-expression to match the BGP AS paths\n")
5417 if (strncmp (argv
[0], "m", 1) == 0)
5418 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_MULTICAST
,
5419 bgp_show_type_regexp
);
5421 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
5422 bgp_show_type_regexp
);
5426 DEFUN (show_bgp_regexp
,
5427 show_bgp_regexp_cmd
,
5428 "show bgp regexp .LINE",
5431 "Display routes matching the AS path regular expression\n"
5432 "A regular-expression to match the BGP AS paths\n")
5434 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
5435 bgp_show_type_regexp
);
5438 ALIAS (show_bgp_regexp
,
5439 show_bgp_ipv6_regexp_cmd
,
5440 "show bgp ipv6 regexp .LINE",
5444 "Display routes matching the AS path regular expression\n"
5445 "A regular-expression to match the BGP AS paths\n")
5448 DEFUN (show_ipv6_bgp_regexp
,
5449 show_ipv6_bgp_regexp_cmd
,
5450 "show ipv6 bgp regexp .LINE",
5454 "Display routes matching the AS path regular expression\n"
5455 "A regular-expression to match the BGP AS paths\n")
5457 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
5458 bgp_show_type_regexp
);
5462 DEFUN (show_ipv6_mbgp_regexp
,
5463 show_ipv6_mbgp_regexp_cmd
,
5464 "show ipv6 mbgp regexp .LINE",
5468 "Display routes matching the AS path regular expression\n"
5469 "A regular-expression to match the MBGP AS paths\n")
5471 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_MULTICAST
,
5472 bgp_show_type_regexp
);
5474 #endif /* HAVE_IPV6 */
5477 bgp_show_prefix_list (struct vty
*vty
, char *prefix_list_str
, afi_t afi
,
5478 safi_t safi
, enum bgp_show_type type
)
5480 struct prefix_list
*plist
;
5482 plist
= prefix_list_lookup (afi
, prefix_list_str
);
5485 vty_out (vty
, "%% %s is not a valid prefix-list name%s",
5486 prefix_list_str
, VTY_NEWLINE
);
5490 vty
->output_arg
= plist
;
5492 return bgp_show (vty
, NULL
, afi
, safi
, type
);
5495 DEFUN (show_ip_bgp_prefix_list
,
5496 show_ip_bgp_prefix_list_cmd
,
5497 "show ip bgp prefix-list WORD",
5501 "Display routes conforming to the prefix-list\n"
5502 "IP prefix-list name\n")
5504 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
5505 bgp_show_type_prefix_list
);
5508 DEFUN (show_ip_bgp_flap_prefix_list
,
5509 show_ip_bgp_flap_prefix_list_cmd
,
5510 "show ip bgp flap-statistics prefix-list WORD",
5514 "Display flap statistics of routes\n"
5515 "Display routes conforming to the prefix-list\n"
5516 "IP prefix-list name\n")
5518 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
5519 bgp_show_type_flap_prefix_list
);
5522 DEFUN (show_ip_bgp_ipv4_prefix_list
,
5523 show_ip_bgp_ipv4_prefix_list_cmd
,
5524 "show ip bgp ipv4 (unicast|multicast) prefix-list WORD",
5529 "Address Family modifier\n"
5530 "Address Family modifier\n"
5531 "Display routes conforming to the prefix-list\n"
5532 "IP prefix-list name\n")
5534 if (strncmp (argv
[0], "m", 1) == 0)
5535 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
5536 bgp_show_type_prefix_list
);
5538 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
5539 bgp_show_type_prefix_list
);
5543 DEFUN (show_bgp_prefix_list
,
5544 show_bgp_prefix_list_cmd
,
5545 "show bgp prefix-list WORD",
5548 "Display routes conforming to the prefix-list\n"
5549 "IPv6 prefix-list name\n")
5551 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5552 bgp_show_type_prefix_list
);
5555 ALIAS (show_bgp_prefix_list
,
5556 show_bgp_ipv6_prefix_list_cmd
,
5557 "show bgp ipv6 prefix-list WORD",
5561 "Display routes conforming to the prefix-list\n"
5562 "IPv6 prefix-list name\n")
5565 DEFUN (show_ipv6_bgp_prefix_list
,
5566 show_ipv6_bgp_prefix_list_cmd
,
5567 "show ipv6 bgp prefix-list WORD",
5571 "Display routes matching the prefix-list\n"
5572 "IPv6 prefix-list name\n")
5574 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5575 bgp_show_type_prefix_list
);
5579 DEFUN (show_ipv6_mbgp_prefix_list
,
5580 show_ipv6_mbgp_prefix_list_cmd
,
5581 "show ipv6 mbgp prefix-list WORD",
5585 "Display routes matching the prefix-list\n"
5586 "IPv6 prefix-list name\n")
5588 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
5589 bgp_show_type_prefix_list
);
5591 #endif /* HAVE_IPV6 */
5594 bgp_show_filter_list (struct vty
*vty
, char *filter
, afi_t afi
,
5595 safi_t safi
, enum bgp_show_type type
)
5597 struct as_list
*as_list
;
5599 as_list
= as_list_lookup (filter
);
5600 if (as_list
== NULL
)
5602 vty_out (vty
, "%% %s is not a valid AS-path access-list name%s", filter
, VTY_NEWLINE
);
5606 vty
->output_arg
= as_list
;
5608 return bgp_show (vty
, NULL
, afi
, safi
, type
);
5611 DEFUN (show_ip_bgp_filter_list
,
5612 show_ip_bgp_filter_list_cmd
,
5613 "show ip bgp filter-list WORD",
5617 "Display routes conforming to the filter-list\n"
5618 "Regular expression access list name\n")
5620 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
5621 bgp_show_type_filter_list
);
5624 DEFUN (show_ip_bgp_flap_filter_list
,
5625 show_ip_bgp_flap_filter_list_cmd
,
5626 "show ip bgp flap-statistics filter-list WORD",
5630 "Display flap statistics of routes\n"
5631 "Display routes conforming to the filter-list\n"
5632 "Regular expression access list name\n")
5634 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
5635 bgp_show_type_flap_filter_list
);
5638 DEFUN (show_ip_bgp_ipv4_filter_list
,
5639 show_ip_bgp_ipv4_filter_list_cmd
,
5640 "show ip bgp ipv4 (unicast|multicast) filter-list WORD",
5645 "Address Family modifier\n"
5646 "Address Family modifier\n"
5647 "Display routes conforming to the filter-list\n"
5648 "Regular expression access list name\n")
5650 if (strncmp (argv
[0], "m", 1) == 0)
5651 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
5652 bgp_show_type_filter_list
);
5654 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
5655 bgp_show_type_filter_list
);
5659 DEFUN (show_bgp_filter_list
,
5660 show_bgp_filter_list_cmd
,
5661 "show bgp filter-list WORD",
5664 "Display routes conforming to the filter-list\n"
5665 "Regular expression access list name\n")
5667 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5668 bgp_show_type_filter_list
);
5671 ALIAS (show_bgp_filter_list
,
5672 show_bgp_ipv6_filter_list_cmd
,
5673 "show bgp ipv6 filter-list WORD",
5677 "Display routes conforming to the filter-list\n"
5678 "Regular expression access list name\n")
5681 DEFUN (show_ipv6_bgp_filter_list
,
5682 show_ipv6_bgp_filter_list_cmd
,
5683 "show ipv6 bgp filter-list WORD",
5687 "Display routes conforming to the filter-list\n"
5688 "Regular expression access list name\n")
5690 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5691 bgp_show_type_filter_list
);
5695 DEFUN (show_ipv6_mbgp_filter_list
,
5696 show_ipv6_mbgp_filter_list_cmd
,
5697 "show ipv6 mbgp filter-list WORD",
5701 "Display routes conforming to the filter-list\n"
5702 "Regular expression access list name\n")
5704 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
5705 bgp_show_type_filter_list
);
5707 #endif /* HAVE_IPV6 */
5710 bgp_show_route_map (struct vty
*vty
, char *rmap_str
, afi_t afi
,
5711 safi_t safi
, enum bgp_show_type type
)
5713 struct route_map
*rmap
;
5715 rmap
= route_map_lookup_by_name (rmap_str
);
5718 vty_out (vty
, "%% %s is not a valid route-map name%s",
5719 rmap_str
, VTY_NEWLINE
);
5723 vty
->output_arg
= rmap
;
5725 return bgp_show (vty
, NULL
, afi
, safi
, type
);
5728 DEFUN (show_ip_bgp_route_map
,
5729 show_ip_bgp_route_map_cmd
,
5730 "show ip bgp route-map WORD",
5734 "Display routes matching the route-map\n"
5735 "A route-map to match on\n")
5737 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
5738 bgp_show_type_route_map
);
5741 DEFUN (show_ip_bgp_flap_route_map
,
5742 show_ip_bgp_flap_route_map_cmd
,
5743 "show ip bgp flap-statistics route-map WORD",
5747 "Display flap statistics of routes\n"
5748 "Display routes matching the route-map\n"
5749 "A route-map to match on\n")
5751 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
5752 bgp_show_type_flap_route_map
);
5755 DEFUN (show_ip_bgp_ipv4_route_map
,
5756 show_ip_bgp_ipv4_route_map_cmd
,
5757 "show ip bgp ipv4 (unicast|multicast) route-map WORD",
5762 "Address Family modifier\n"
5763 "Address Family modifier\n"
5764 "Display routes matching the route-map\n"
5765 "A route-map to match on\n")
5767 if (strncmp (argv
[0], "m", 1) == 0)
5768 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
5769 bgp_show_type_route_map
);
5771 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
5772 bgp_show_type_route_map
);
5775 DEFUN (show_bgp_route_map
,
5776 show_bgp_route_map_cmd
,
5777 "show bgp route-map WORD",
5780 "Display routes matching the route-map\n"
5781 "A route-map to match on\n")
5783 return bgp_show_route_map (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5784 bgp_show_type_route_map
);
5787 ALIAS (show_bgp_route_map
,
5788 show_bgp_ipv6_route_map_cmd
,
5789 "show bgp ipv6 route-map WORD",
5793 "Display routes matching the route-map\n"
5794 "A route-map to match on\n")
5796 DEFUN (show_ip_bgp_cidr_only
,
5797 show_ip_bgp_cidr_only_cmd
,
5798 "show ip bgp cidr-only",
5802 "Display only routes with non-natural netmasks\n")
5804 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
5805 bgp_show_type_cidr_only
);
5808 DEFUN (show_ip_bgp_flap_cidr_only
,
5809 show_ip_bgp_flap_cidr_only_cmd
,
5810 "show ip bgp flap-statistics cidr-only",
5814 "Display flap statistics of routes\n"
5815 "Display only routes with non-natural netmasks\n")
5817 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
5818 bgp_show_type_flap_cidr_only
);
5821 DEFUN (show_ip_bgp_ipv4_cidr_only
,
5822 show_ip_bgp_ipv4_cidr_only_cmd
,
5823 "show ip bgp ipv4 (unicast|multicast) cidr-only",
5828 "Address Family modifier\n"
5829 "Address Family modifier\n"
5830 "Display only routes with non-natural netmasks\n")
5832 if (strncmp (argv
[0], "m", 1) == 0)
5833 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
5834 bgp_show_type_cidr_only
);
5836 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
5837 bgp_show_type_cidr_only
);
5840 DEFUN (show_ip_bgp_community_all
,
5841 show_ip_bgp_community_all_cmd
,
5842 "show ip bgp community",
5846 "Display routes matching the communities\n")
5848 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
5849 bgp_show_type_community_all
);
5852 DEFUN (show_ip_bgp_ipv4_community_all
,
5853 show_ip_bgp_ipv4_community_all_cmd
,
5854 "show ip bgp ipv4 (unicast|multicast) community",
5859 "Address Family modifier\n"
5860 "Address Family modifier\n"
5861 "Display routes matching the communities\n")
5863 if (strncmp (argv
[0], "m", 1) == 0)
5864 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
5865 bgp_show_type_community_all
);
5867 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
5868 bgp_show_type_community_all
);
5872 DEFUN (show_bgp_community_all
,
5873 show_bgp_community_all_cmd
,
5874 "show bgp community",
5877 "Display routes matching the communities\n")
5879 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
5880 bgp_show_type_community_all
);
5883 ALIAS (show_bgp_community_all
,
5884 show_bgp_ipv6_community_all_cmd
,
5885 "show bgp ipv6 community",
5889 "Display routes matching the communities\n")
5892 DEFUN (show_ipv6_bgp_community_all
,
5893 show_ipv6_bgp_community_all_cmd
,
5894 "show ipv6 bgp community",
5898 "Display routes matching the communities\n")
5900 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
5901 bgp_show_type_community_all
);
5905 DEFUN (show_ipv6_mbgp_community_all
,
5906 show_ipv6_mbgp_community_all_cmd
,
5907 "show ipv6 mbgp community",
5911 "Display routes matching the communities\n")
5913 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
,
5914 bgp_show_type_community_all
);
5916 #endif /* HAVE_IPV6 */
5919 bgp_show_community (struct vty
*vty
, int argc
, char **argv
, int exact
,
5920 u_int16_t afi
, u_char safi
)
5922 struct community
*com
;
5928 b
= buffer_new (1024);
5929 for (i
= 0; i
< argc
; i
++)
5932 buffer_putc (b
, ' ');
5935 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
5940 buffer_putstr (b
, argv
[i
]);
5942 buffer_putc (b
, '\0');
5944 str
= buffer_getstr (b
);
5947 com
= community_str2com (str
);
5951 vty_out (vty
, "%% Community malformed: %s", VTY_NEWLINE
);
5955 vty
->output_arg
= com
;
5958 return bgp_show (vty
, NULL
, afi
, safi
, bgp_show_type_community_exact
);
5960 return bgp_show (vty
, NULL
, afi
, safi
, bgp_show_type_community
);
5963 DEFUN (show_ip_bgp_community
,
5964 show_ip_bgp_community_cmd
,
5965 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export)",
5969 "Display routes matching the communities\n"
5970 "community number\n"
5971 "Do not send outside local AS (well-known community)\n"
5972 "Do not advertise to any peer (well-known community)\n"
5973 "Do not export to next AS (well-known community)\n")
5975 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
5978 ALIAS (show_ip_bgp_community
,
5979 show_ip_bgp_community2_cmd
,
5980 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
5984 "Display routes matching the communities\n"
5985 "community number\n"
5986 "Do not send outside local AS (well-known community)\n"
5987 "Do not advertise to any peer (well-known community)\n"
5988 "Do not export to next AS (well-known community)\n"
5989 "community number\n"
5990 "Do not send outside local AS (well-known community)\n"
5991 "Do not advertise to any peer (well-known community)\n"
5992 "Do not export to next AS (well-known community)\n")
5994 ALIAS (show_ip_bgp_community
,
5995 show_ip_bgp_community3_cmd
,
5996 "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)",
6000 "Display routes matching the communities\n"
6001 "community number\n"
6002 "Do not send outside local AS (well-known community)\n"
6003 "Do not advertise to any peer (well-known community)\n"
6004 "Do not export to next AS (well-known community)\n"
6005 "community number\n"
6006 "Do not send outside local AS (well-known community)\n"
6007 "Do not advertise to any peer (well-known community)\n"
6008 "Do not export to next AS (well-known community)\n"
6009 "community number\n"
6010 "Do not send outside local AS (well-known community)\n"
6011 "Do not advertise to any peer (well-known community)\n"
6012 "Do not export to next AS (well-known community)\n")
6014 ALIAS (show_ip_bgp_community
,
6015 show_ip_bgp_community4_cmd
,
6016 "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)",
6020 "Display routes matching the communities\n"
6021 "community number\n"
6022 "Do not send outside local AS (well-known community)\n"
6023 "Do not advertise to any peer (well-known community)\n"
6024 "Do not export to next AS (well-known community)\n"
6025 "community number\n"
6026 "Do not send outside local AS (well-known community)\n"
6027 "Do not advertise to any peer (well-known community)\n"
6028 "Do not export to next AS (well-known community)\n"
6029 "community number\n"
6030 "Do not send outside local AS (well-known community)\n"
6031 "Do not advertise to any peer (well-known community)\n"
6032 "Do not export to next AS (well-known community)\n"
6033 "community number\n"
6034 "Do not send outside local AS (well-known community)\n"
6035 "Do not advertise to any peer (well-known community)\n"
6036 "Do not export to next AS (well-known community)\n")
6038 DEFUN (show_ip_bgp_ipv4_community
,
6039 show_ip_bgp_ipv4_community_cmd
,
6040 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
6045 "Address Family modifier\n"
6046 "Address Family modifier\n"
6047 "Display routes matching the communities\n"
6048 "community number\n"
6049 "Do not send outside local AS (well-known community)\n"
6050 "Do not advertise to any peer (well-known community)\n"
6051 "Do not export to next AS (well-known community)\n")
6053 if (strncmp (argv
[0], "m", 1) == 0)
6054 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_MULTICAST
);
6056 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
6059 ALIAS (show_ip_bgp_ipv4_community
,
6060 show_ip_bgp_ipv4_community2_cmd
,
6061 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
6066 "Address Family modifier\n"
6067 "Address Family modifier\n"
6068 "Display routes matching the communities\n"
6069 "community number\n"
6070 "Do not send outside local AS (well-known community)\n"
6071 "Do not advertise to any peer (well-known community)\n"
6072 "Do not export to next AS (well-known community)\n"
6073 "community number\n"
6074 "Do not send outside local AS (well-known community)\n"
6075 "Do not advertise to any peer (well-known community)\n"
6076 "Do not export to next AS (well-known community)\n")
6078 ALIAS (show_ip_bgp_ipv4_community
,
6079 show_ip_bgp_ipv4_community3_cmd
,
6080 "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)",
6085 "Address Family modifier\n"
6086 "Address Family modifier\n"
6087 "Display routes matching the communities\n"
6088 "community number\n"
6089 "Do not send outside local AS (well-known community)\n"
6090 "Do not advertise to any peer (well-known community)\n"
6091 "Do not export to next AS (well-known community)\n"
6092 "community number\n"
6093 "Do not send outside local AS (well-known community)\n"
6094 "Do not advertise to any peer (well-known community)\n"
6095 "Do not export to next AS (well-known community)\n"
6096 "community number\n"
6097 "Do not send outside local AS (well-known community)\n"
6098 "Do not advertise to any peer (well-known community)\n"
6099 "Do not export to next AS (well-known community)\n")
6101 ALIAS (show_ip_bgp_ipv4_community
,
6102 show_ip_bgp_ipv4_community4_cmd
,
6103 "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)",
6108 "Address Family modifier\n"
6109 "Address Family modifier\n"
6110 "Display routes matching the communities\n"
6111 "community number\n"
6112 "Do not send outside local AS (well-known community)\n"
6113 "Do not advertise to any peer (well-known community)\n"
6114 "Do not export to next AS (well-known community)\n"
6115 "community number\n"
6116 "Do not send outside local AS (well-known community)\n"
6117 "Do not advertise to any peer (well-known community)\n"
6118 "Do not export to next AS (well-known community)\n"
6119 "community number\n"
6120 "Do not send outside local AS (well-known community)\n"
6121 "Do not advertise to any peer (well-known community)\n"
6122 "Do not export to next AS (well-known community)\n"
6123 "community number\n"
6124 "Do not send outside local AS (well-known community)\n"
6125 "Do not advertise to any peer (well-known community)\n"
6126 "Do not export to next AS (well-known community)\n")
6128 DEFUN (show_ip_bgp_community_exact
,
6129 show_ip_bgp_community_exact_cmd
,
6130 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
6134 "Display routes matching the communities\n"
6135 "community number\n"
6136 "Do not send outside local AS (well-known community)\n"
6137 "Do not advertise to any peer (well-known community)\n"
6138 "Do not export to next AS (well-known community)\n"
6139 "Exact match of the communities")
6141 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
6144 ALIAS (show_ip_bgp_community_exact
,
6145 show_ip_bgp_community2_exact_cmd
,
6146 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
6150 "Display routes matching the communities\n"
6151 "community number\n"
6152 "Do not send outside local AS (well-known community)\n"
6153 "Do not advertise to any peer (well-known community)\n"
6154 "Do not export to next AS (well-known community)\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 "Exact match of the communities")
6161 ALIAS (show_ip_bgp_community_exact
,
6162 show_ip_bgp_community3_exact_cmd
,
6163 "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",
6167 "Display routes matching the communities\n"
6168 "community number\n"
6169 "Do not send outside local AS (well-known community)\n"
6170 "Do not advertise to any peer (well-known community)\n"
6171 "Do not export to next AS (well-known community)\n"
6172 "community number\n"
6173 "Do not send outside local AS (well-known community)\n"
6174 "Do not advertise to any peer (well-known community)\n"
6175 "Do not export to next AS (well-known community)\n"
6176 "community number\n"
6177 "Do not send outside local AS (well-known community)\n"
6178 "Do not advertise to any peer (well-known community)\n"
6179 "Do not export to next AS (well-known community)\n"
6180 "Exact match of the communities")
6182 ALIAS (show_ip_bgp_community_exact
,
6183 show_ip_bgp_community4_exact_cmd
,
6184 "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",
6188 "Display routes matching the communities\n"
6189 "community number\n"
6190 "Do not send outside local AS (well-known community)\n"
6191 "Do not advertise to any peer (well-known community)\n"
6192 "Do not export to next AS (well-known community)\n"
6193 "community number\n"
6194 "Do not send outside local AS (well-known community)\n"
6195 "Do not advertise to any peer (well-known community)\n"
6196 "Do not export to next AS (well-known community)\n"
6197 "community number\n"
6198 "Do not send outside local AS (well-known community)\n"
6199 "Do not advertise to any peer (well-known community)\n"
6200 "Do not export to next AS (well-known community)\n"
6201 "community number\n"
6202 "Do not send outside local AS (well-known community)\n"
6203 "Do not advertise to any peer (well-known community)\n"
6204 "Do not export to next AS (well-known community)\n"
6205 "Exact match of the communities")
6207 DEFUN (show_ip_bgp_ipv4_community_exact
,
6208 show_ip_bgp_ipv4_community_exact_cmd
,
6209 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match",
6214 "Address Family modifier\n"
6215 "Address Family modifier\n"
6216 "Display routes matching the communities\n"
6217 "community number\n"
6218 "Do not send outside local AS (well-known community)\n"
6219 "Do not advertise to any peer (well-known community)\n"
6220 "Do not export to next AS (well-known community)\n"
6221 "Exact match of the communities")
6223 if (strncmp (argv
[0], "m", 1) == 0)
6224 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_MULTICAST
);
6226 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
6229 ALIAS (show_ip_bgp_ipv4_community_exact
,
6230 show_ip_bgp_ipv4_community2_exact_cmd
,
6231 "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",
6236 "Address Family modifier\n"
6237 "Address Family modifier\n"
6238 "Display routes matching the communities\n"
6239 "community number\n"
6240 "Do not send outside local AS (well-known community)\n"
6241 "Do not advertise to any peer (well-known community)\n"
6242 "Do not export to next AS (well-known community)\n"
6243 "community number\n"
6244 "Do not send outside local AS (well-known community)\n"
6245 "Do not advertise to any peer (well-known community)\n"
6246 "Do not export to next AS (well-known community)\n"
6247 "Exact match of the communities")
6249 ALIAS (show_ip_bgp_ipv4_community_exact
,
6250 show_ip_bgp_ipv4_community3_exact_cmd
,
6251 "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",
6256 "Address Family modifier\n"
6257 "Address Family modifier\n"
6258 "Display routes matching the communities\n"
6259 "community number\n"
6260 "Do not send outside local AS (well-known community)\n"
6261 "Do not advertise to any peer (well-known community)\n"
6262 "Do not export to next AS (well-known community)\n"
6263 "community number\n"
6264 "Do not send outside local AS (well-known community)\n"
6265 "Do not advertise to any peer (well-known community)\n"
6266 "Do not export to next AS (well-known community)\n"
6267 "community number\n"
6268 "Do not send outside local AS (well-known community)\n"
6269 "Do not advertise to any peer (well-known community)\n"
6270 "Do not export to next AS (well-known community)\n"
6271 "Exact match of the communities")
6273 ALIAS (show_ip_bgp_ipv4_community_exact
,
6274 show_ip_bgp_ipv4_community4_exact_cmd
,
6275 "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",
6280 "Address Family modifier\n"
6281 "Address Family modifier\n"
6282 "Display routes matching the communities\n"
6283 "community number\n"
6284 "Do not send outside local AS (well-known community)\n"
6285 "Do not advertise to any peer (well-known community)\n"
6286 "Do not export to next AS (well-known community)\n"
6287 "community number\n"
6288 "Do not send outside local AS (well-known community)\n"
6289 "Do not advertise to any peer (well-known community)\n"
6290 "Do not export to next AS (well-known community)\n"
6291 "community number\n"
6292 "Do not send outside local AS (well-known community)\n"
6293 "Do not advertise to any peer (well-known community)\n"
6294 "Do not export to next AS (well-known community)\n"
6295 "community number\n"
6296 "Do not send outside local AS (well-known community)\n"
6297 "Do not advertise to any peer (well-known community)\n"
6298 "Do not export to next AS (well-known community)\n"
6299 "Exact match of the communities")
6302 DEFUN (show_bgp_community
,
6303 show_bgp_community_cmd
,
6304 "show bgp community (AA:NN|local-AS|no-advertise|no-export)",
6307 "Display routes matching the communities\n"
6308 "community number\n"
6309 "Do not send outside local AS (well-known community)\n"
6310 "Do not advertise to any peer (well-known community)\n"
6311 "Do not export to next AS (well-known community)\n")
6313 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
6316 ALIAS (show_bgp_community
,
6317 show_bgp_ipv6_community_cmd
,
6318 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)",
6322 "Display routes matching the communities\n"
6323 "community number\n"
6324 "Do not send outside local AS (well-known community)\n"
6325 "Do not advertise to any peer (well-known community)\n"
6326 "Do not export to next AS (well-known community)\n")
6328 ALIAS (show_bgp_community
,
6329 show_bgp_community2_cmd
,
6330 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
6333 "Display routes matching the communities\n"
6334 "community number\n"
6335 "Do not send outside local AS (well-known community)\n"
6336 "Do not advertise to any peer (well-known community)\n"
6337 "Do not export to next AS (well-known community)\n"
6338 "community number\n"
6339 "Do not send outside local AS (well-known community)\n"
6340 "Do not advertise to any peer (well-known community)\n"
6341 "Do not export to next AS (well-known community)\n")
6343 ALIAS (show_bgp_community
,
6344 show_bgp_ipv6_community2_cmd
,
6345 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
6349 "Display routes matching the communities\n"
6350 "community number\n"
6351 "Do not send outside local AS (well-known community)\n"
6352 "Do not advertise to any peer (well-known community)\n"
6353 "Do not export to next AS (well-known community)\n"
6354 "community number\n"
6355 "Do not send outside local AS (well-known community)\n"
6356 "Do not advertise to any peer (well-known community)\n"
6357 "Do not export to next AS (well-known community)\n")
6359 ALIAS (show_bgp_community
,
6360 show_bgp_community3_cmd
,
6361 "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)",
6364 "Display routes matching the communities\n"
6365 "community number\n"
6366 "Do not send outside local AS (well-known community)\n"
6367 "Do not advertise to any peer (well-known community)\n"
6368 "Do not export to next AS (well-known community)\n"
6369 "community number\n"
6370 "Do not send outside local AS (well-known community)\n"
6371 "Do not advertise to any peer (well-known community)\n"
6372 "Do not export to next AS (well-known community)\n"
6373 "community number\n"
6374 "Do not send outside local AS (well-known community)\n"
6375 "Do not advertise to any peer (well-known community)\n"
6376 "Do not export to next AS (well-known community)\n")
6378 ALIAS (show_bgp_community
,
6379 show_bgp_ipv6_community3_cmd
,
6380 "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)",
6384 "Display routes matching the communities\n"
6385 "community number\n"
6386 "Do not send outside local AS (well-known community)\n"
6387 "Do not advertise to any peer (well-known community)\n"
6388 "Do not export to next AS (well-known community)\n"
6389 "community number\n"
6390 "Do not send outside local AS (well-known community)\n"
6391 "Do not advertise to any peer (well-known community)\n"
6392 "Do not export to next AS (well-known community)\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")
6398 ALIAS (show_bgp_community
,
6399 show_bgp_community4_cmd
,
6400 "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)",
6403 "Display routes matching the communities\n"
6404 "community number\n"
6405 "Do not send outside local AS (well-known community)\n"
6406 "Do not advertise to any peer (well-known community)\n"
6407 "Do not export to next AS (well-known community)\n"
6408 "community number\n"
6409 "Do not send outside local AS (well-known community)\n"
6410 "Do not advertise to any peer (well-known community)\n"
6411 "Do not export to next AS (well-known community)\n"
6412 "community number\n"
6413 "Do not send outside local AS (well-known community)\n"
6414 "Do not advertise to any peer (well-known community)\n"
6415 "Do not export to next AS (well-known community)\n"
6416 "community number\n"
6417 "Do not send outside local AS (well-known community)\n"
6418 "Do not advertise to any peer (well-known community)\n"
6419 "Do not export to next AS (well-known community)\n")
6421 ALIAS (show_bgp_community
,
6422 show_bgp_ipv6_community4_cmd
,
6423 "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)",
6427 "Display routes matching the communities\n"
6428 "community number\n"
6429 "Do not send outside local AS (well-known community)\n"
6430 "Do not advertise to any peer (well-known community)\n"
6431 "Do not export to next AS (well-known community)\n"
6432 "community number\n"
6433 "Do not send outside local AS (well-known community)\n"
6434 "Do not advertise to any peer (well-known community)\n"
6435 "Do not export to next AS (well-known community)\n"
6436 "community number\n"
6437 "Do not send outside local AS (well-known community)\n"
6438 "Do not advertise to any peer (well-known community)\n"
6439 "Do not export to next AS (well-known community)\n"
6440 "community number\n"
6441 "Do not send outside local AS (well-known community)\n"
6442 "Do not advertise to any peer (well-known community)\n"
6443 "Do not export to next AS (well-known community)\n")
6446 DEFUN (show_ipv6_bgp_community
,
6447 show_ipv6_bgp_community_cmd
,
6448 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export)",
6452 "Display routes matching the communities\n"
6453 "community number\n"
6454 "Do not send outside local AS (well-known community)\n"
6455 "Do not advertise to any peer (well-known community)\n"
6456 "Do not export to next AS (well-known community)\n")
6458 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
6462 ALIAS (show_ipv6_bgp_community
,
6463 show_ipv6_bgp_community2_cmd
,
6464 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
6468 "Display routes matching the communities\n"
6469 "community number\n"
6470 "Do not send outside local AS (well-known community)\n"
6471 "Do not advertise to any peer (well-known community)\n"
6472 "Do not export to next AS (well-known community)\n"
6473 "community number\n"
6474 "Do not send outside local AS (well-known community)\n"
6475 "Do not advertise to any peer (well-known community)\n"
6476 "Do not export to next AS (well-known community)\n")
6479 ALIAS (show_ipv6_bgp_community
,
6480 show_ipv6_bgp_community3_cmd
,
6481 "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)",
6485 "Display routes matching the communities\n"
6486 "community number\n"
6487 "Do not send outside local AS (well-known community)\n"
6488 "Do not advertise to any peer (well-known community)\n"
6489 "Do not export to next AS (well-known community)\n"
6490 "community number\n"
6491 "Do not send outside local AS (well-known community)\n"
6492 "Do not advertise to any peer (well-known community)\n"
6493 "Do not export to next AS (well-known community)\n"
6494 "community number\n"
6495 "Do not send outside local AS (well-known community)\n"
6496 "Do not advertise to any peer (well-known community)\n"
6497 "Do not export to next AS (well-known community)\n")
6500 ALIAS (show_ipv6_bgp_community
,
6501 show_ipv6_bgp_community4_cmd
,
6502 "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)",
6506 "Display routes matching the communities\n"
6507 "community number\n"
6508 "Do not send outside local AS (well-known community)\n"
6509 "Do not advertise to any peer (well-known community)\n"
6510 "Do not export to next AS (well-known community)\n"
6511 "community number\n"
6512 "Do not send outside local AS (well-known community)\n"
6513 "Do not advertise to any peer (well-known community)\n"
6514 "Do not export to next AS (well-known community)\n"
6515 "community number\n"
6516 "Do not send outside local AS (well-known community)\n"
6517 "Do not advertise to any peer (well-known community)\n"
6518 "Do not export to next AS (well-known community)\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")
6524 DEFUN (show_bgp_community_exact
,
6525 show_bgp_community_exact_cmd
,
6526 "show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
6529 "Display routes matching the communities\n"
6530 "community number\n"
6531 "Do not send outside local AS (well-known community)\n"
6532 "Do not advertise to any peer (well-known community)\n"
6533 "Do not export to next AS (well-known community)\n"
6534 "Exact match of the communities")
6536 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
6539 ALIAS (show_bgp_community_exact
,
6540 show_bgp_ipv6_community_exact_cmd
,
6541 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match",
6545 "Display routes matching the communities\n"
6546 "community number\n"
6547 "Do not send outside local AS (well-known community)\n"
6548 "Do not advertise to any peer (well-known community)\n"
6549 "Do not export to next AS (well-known community)\n"
6550 "Exact match of the communities")
6552 ALIAS (show_bgp_community_exact
,
6553 show_bgp_community2_exact_cmd
,
6554 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
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 "Exact match of the communities")
6568 ALIAS (show_bgp_community_exact
,
6569 show_bgp_ipv6_community2_exact_cmd
,
6570 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
6574 "Display routes matching the communities\n"
6575 "community number\n"
6576 "Do not send outside local AS (well-known community)\n"
6577 "Do not advertise to any peer (well-known community)\n"
6578 "Do not export to next AS (well-known community)\n"
6579 "community number\n"
6580 "Do not send outside local AS (well-known community)\n"
6581 "Do not advertise to any peer (well-known community)\n"
6582 "Do not export to next AS (well-known community)\n"
6583 "Exact match of the communities")
6585 ALIAS (show_bgp_community_exact
,
6586 show_bgp_community3_exact_cmd
,
6587 "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",
6590 "Display routes matching the communities\n"
6591 "community number\n"
6592 "Do not send outside local AS (well-known community)\n"
6593 "Do not advertise to any peer (well-known community)\n"
6594 "Do not export to next AS (well-known community)\n"
6595 "community number\n"
6596 "Do not send outside local AS (well-known community)\n"
6597 "Do not advertise to any peer (well-known community)\n"
6598 "Do not export to next AS (well-known community)\n"
6599 "community number\n"
6600 "Do not send outside local AS (well-known community)\n"
6601 "Do not advertise to any peer (well-known community)\n"
6602 "Do not export to next AS (well-known community)\n"
6603 "Exact match of the communities")
6605 ALIAS (show_bgp_community_exact
,
6606 show_bgp_ipv6_community3_exact_cmd
,
6607 "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",
6611 "Display routes matching the communities\n"
6612 "community number\n"
6613 "Do not send outside local AS (well-known community)\n"
6614 "Do not advertise to any peer (well-known community)\n"
6615 "Do not export to next AS (well-known community)\n"
6616 "community number\n"
6617 "Do not send outside local AS (well-known community)\n"
6618 "Do not advertise to any peer (well-known community)\n"
6619 "Do not export to next AS (well-known community)\n"
6620 "community number\n"
6621 "Do not send outside local AS (well-known community)\n"
6622 "Do not advertise to any peer (well-known community)\n"
6623 "Do not export to next AS (well-known community)\n"
6624 "Exact match of the communities")
6626 ALIAS (show_bgp_community_exact
,
6627 show_bgp_community4_exact_cmd
,
6628 "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",
6631 "Display routes matching the communities\n"
6632 "community number\n"
6633 "Do not send outside local AS (well-known community)\n"
6634 "Do not advertise to any peer (well-known community)\n"
6635 "Do not export to next AS (well-known community)\n"
6636 "community number\n"
6637 "Do not send outside local AS (well-known community)\n"
6638 "Do not advertise to any peer (well-known community)\n"
6639 "Do not export to next AS (well-known community)\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 "Exact match of the communities")
6650 ALIAS (show_bgp_community_exact
,
6651 show_bgp_ipv6_community4_exact_cmd
,
6652 "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",
6656 "Display routes matching the communities\n"
6657 "community number\n"
6658 "Do not send outside local AS (well-known community)\n"
6659 "Do not advertise to any peer (well-known community)\n"
6660 "Do not export to next AS (well-known community)\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 "Exact match of the communities")
6676 DEFUN (show_ipv6_bgp_community_exact
,
6677 show_ipv6_bgp_community_exact_cmd
,
6678 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
6682 "Display routes matching the communities\n"
6683 "community number\n"
6684 "Do not send outside local AS (well-known community)\n"
6685 "Do not advertise to any peer (well-known community)\n"
6686 "Do not export to next AS (well-known community)\n"
6687 "Exact match of the communities")
6689 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
6693 ALIAS (show_ipv6_bgp_community_exact
,
6694 show_ipv6_bgp_community2_exact_cmd
,
6695 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (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 "community number\n"
6705 "Do not send outside local AS (well-known community)\n"
6706 "Do not advertise to any peer (well-known community)\n"
6707 "Do not export to next AS (well-known community)\n"
6708 "Exact match of the communities")
6711 ALIAS (show_ipv6_bgp_community_exact
,
6712 show_ipv6_bgp_community3_exact_cmd
,
6713 "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",
6717 "Display routes matching the communities\n"
6718 "community number\n"
6719 "Do not send outside local AS (well-known community)\n"
6720 "Do not advertise to any peer (well-known community)\n"
6721 "Do not export to next AS (well-known community)\n"
6722 "community number\n"
6723 "Do not send outside local AS (well-known community)\n"
6724 "Do not advertise to any peer (well-known community)\n"
6725 "Do not export to next AS (well-known community)\n"
6726 "community number\n"
6727 "Do not send outside local AS (well-known community)\n"
6728 "Do not advertise to any peer (well-known community)\n"
6729 "Do not export to next AS (well-known community)\n"
6730 "Exact match of the communities")
6733 ALIAS (show_ipv6_bgp_community_exact
,
6734 show_ipv6_bgp_community4_exact_cmd
,
6735 "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",
6739 "Display routes matching the communities\n"
6740 "community number\n"
6741 "Do not send outside local AS (well-known community)\n"
6742 "Do not advertise to any peer (well-known community)\n"
6743 "Do not export to next AS (well-known community)\n"
6744 "community number\n"
6745 "Do not send outside local AS (well-known community)\n"
6746 "Do not advertise to any peer (well-known community)\n"
6747 "Do not export to next AS (well-known community)\n"
6748 "community number\n"
6749 "Do not send outside local AS (well-known community)\n"
6750 "Do not advertise to any peer (well-known community)\n"
6751 "Do not export to next AS (well-known community)\n"
6752 "community number\n"
6753 "Do not send outside local AS (well-known community)\n"
6754 "Do not advertise to any peer (well-known community)\n"
6755 "Do not export to next AS (well-known community)\n"
6756 "Exact match of the communities")
6759 DEFUN (show_ipv6_mbgp_community
,
6760 show_ipv6_mbgp_community_cmd
,
6761 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export)",
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")
6771 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_MULTICAST
);
6775 ALIAS (show_ipv6_mbgp_community
,
6776 show_ipv6_mbgp_community2_cmd
,
6777 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
6781 "Display routes matching the communities\n"
6782 "community number\n"
6783 "Do not send outside local AS (well-known community)\n"
6784 "Do not advertise to any peer (well-known community)\n"
6785 "Do not export to next AS (well-known community)\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")
6792 ALIAS (show_ipv6_mbgp_community
,
6793 show_ipv6_mbgp_community3_cmd
,
6794 "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)",
6798 "Display routes matching the communities\n"
6799 "community number\n"
6800 "Do not send outside local AS (well-known community)\n"
6801 "Do not advertise to any peer (well-known community)\n"
6802 "Do not export to next AS (well-known community)\n"
6803 "community number\n"
6804 "Do not send outside local AS (well-known community)\n"
6805 "Do not advertise to any peer (well-known community)\n"
6806 "Do not export to next AS (well-known community)\n"
6807 "community number\n"
6808 "Do not send outside local AS (well-known community)\n"
6809 "Do not advertise to any peer (well-known community)\n"
6810 "Do not export to next AS (well-known community)\n")
6813 ALIAS (show_ipv6_mbgp_community
,
6814 show_ipv6_mbgp_community4_cmd
,
6815 "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)",
6819 "Display routes matching the communities\n"
6820 "community number\n"
6821 "Do not send outside local AS (well-known community)\n"
6822 "Do not advertise to any peer (well-known community)\n"
6823 "Do not export to next AS (well-known community)\n"
6824 "community number\n"
6825 "Do not send outside local AS (well-known community)\n"
6826 "Do not advertise to any peer (well-known community)\n"
6827 "Do not export to next AS (well-known community)\n"
6828 "community number\n"
6829 "Do not send outside local AS (well-known community)\n"
6830 "Do not advertise to any peer (well-known community)\n"
6831 "Do not export to next AS (well-known community)\n"
6832 "community number\n"
6833 "Do not send outside local AS (well-known community)\n"
6834 "Do not advertise to any peer (well-known community)\n"
6835 "Do not export to next AS (well-known community)\n")
6838 DEFUN (show_ipv6_mbgp_community_exact
,
6839 show_ipv6_mbgp_community_exact_cmd
,
6840 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
6844 "Display routes matching the communities\n"
6845 "community number\n"
6846 "Do not send outside local AS (well-known community)\n"
6847 "Do not advertise to any peer (well-known community)\n"
6848 "Do not export to next AS (well-known community)\n"
6849 "Exact match of the communities")
6851 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_MULTICAST
);
6855 ALIAS (show_ipv6_mbgp_community_exact
,
6856 show_ipv6_mbgp_community2_exact_cmd
,
6857 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
6861 "Display routes matching the communities\n"
6862 "community number\n"
6863 "Do not send outside local AS (well-known community)\n"
6864 "Do not advertise to any peer (well-known community)\n"
6865 "Do not export to next AS (well-known community)\n"
6866 "community number\n"
6867 "Do not send outside local AS (well-known community)\n"
6868 "Do not advertise to any peer (well-known community)\n"
6869 "Do not export to next AS (well-known community)\n"
6870 "Exact match of the communities")
6873 ALIAS (show_ipv6_mbgp_community_exact
,
6874 show_ipv6_mbgp_community3_exact_cmd
,
6875 "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",
6879 "Display routes matching the communities\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 "community number\n"
6885 "Do not send outside local AS (well-known community)\n"
6886 "Do not advertise to any peer (well-known community)\n"
6887 "Do not export to next AS (well-known community)\n"
6888 "community number\n"
6889 "Do not send outside local AS (well-known community)\n"
6890 "Do not advertise to any peer (well-known community)\n"
6891 "Do not export to next AS (well-known community)\n"
6892 "Exact match of the communities")
6895 ALIAS (show_ipv6_mbgp_community_exact
,
6896 show_ipv6_mbgp_community4_exact_cmd
,
6897 "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",
6901 "Display routes matching the communities\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 "community number\n"
6911 "Do not send outside local AS (well-known community)\n"
6912 "Do not advertise to any peer (well-known community)\n"
6913 "Do not export to next AS (well-known community)\n"
6914 "community number\n"
6915 "Do not send outside local AS (well-known community)\n"
6916 "Do not advertise to any peer (well-known community)\n"
6917 "Do not export to next AS (well-known community)\n"
6918 "Exact match of the communities")
6919 #endif /* HAVE_IPV6 */
6922 bgp_show_community_list (struct vty
*vty
, char *com
, int exact
,
6923 u_int16_t afi
, u_char safi
)
6925 struct community_list
*list
;
6927 list
= community_list_lookup (bgp_clist
, com
, COMMUNITY_LIST_AUTO
);
6930 vty_out (vty
, "%% %s is not a valid community-list name%s", com
,
6935 vty
->output_arg
= list
;
6938 return bgp_show (vty
, NULL
, afi
, safi
, bgp_show_type_community_list_exact
);
6940 return bgp_show (vty
, NULL
, afi
, safi
, bgp_show_type_community_list
);
6943 DEFUN (show_ip_bgp_community_list
,
6944 show_ip_bgp_community_list_cmd
,
6945 "show ip bgp community-list WORD",
6949 "Display routes matching the community-list\n"
6950 "community-list name\n")
6952 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP
, SAFI_UNICAST
);
6955 DEFUN (show_ip_bgp_ipv4_community_list
,
6956 show_ip_bgp_ipv4_community_list_cmd
,
6957 "show ip bgp ipv4 (unicast|multicast) community-list WORD",
6962 "Address Family modifier\n"
6963 "Address Family modifier\n"
6964 "Display routes matching the community-list\n"
6965 "community-list name\n")
6967 if (strncmp (argv
[0], "m", 1) == 0)
6968 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_MULTICAST
);
6970 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_UNICAST
);
6973 DEFUN (show_ip_bgp_community_list_exact
,
6974 show_ip_bgp_community_list_exact_cmd
,
6975 "show ip bgp community-list WORD exact-match",
6979 "Display routes matching the community-list\n"
6980 "community-list name\n"
6981 "Exact match of the communities\n")
6983 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP
, SAFI_UNICAST
);
6986 DEFUN (show_ip_bgp_ipv4_community_list_exact
,
6987 show_ip_bgp_ipv4_community_list_exact_cmd
,
6988 "show ip bgp ipv4 (unicast|multicast) community-list WORD exact-match",
6993 "Address Family modifier\n"
6994 "Address Family modifier\n"
6995 "Display routes matching the community-list\n"
6996 "community-list name\n"
6997 "Exact match of the communities\n")
6999 if (strncmp (argv
[0], "m", 1) == 0)
7000 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_MULTICAST
);
7002 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_UNICAST
);
7006 DEFUN (show_bgp_community_list
,
7007 show_bgp_community_list_cmd
,
7008 "show bgp community-list WORD",
7011 "Display routes matching the community-list\n"
7012 "community-list name\n")
7014 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
7017 ALIAS (show_bgp_community_list
,
7018 show_bgp_ipv6_community_list_cmd
,
7019 "show bgp ipv6 community-list WORD",
7023 "Display routes matching the community-list\n"
7024 "community-list name\n")
7027 DEFUN (show_ipv6_bgp_community_list
,
7028 show_ipv6_bgp_community_list_cmd
,
7029 "show ipv6 bgp community-list WORD",
7033 "Display routes matching the community-list\n"
7034 "community-list name\n")
7036 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
7040 DEFUN (show_ipv6_mbgp_community_list
,
7041 show_ipv6_mbgp_community_list_cmd
,
7042 "show ipv6 mbgp community-list WORD",
7046 "Display routes matching the community-list\n"
7047 "community-list name\n")
7049 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_MULTICAST
);
7052 DEFUN (show_bgp_community_list_exact
,
7053 show_bgp_community_list_exact_cmd
,
7054 "show bgp community-list WORD exact-match",
7057 "Display routes matching the community-list\n"
7058 "community-list name\n"
7059 "Exact match of the communities\n")
7061 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
7064 ALIAS (show_bgp_community_list_exact
,
7065 show_bgp_ipv6_community_list_exact_cmd
,
7066 "show bgp ipv6 community-list WORD exact-match",
7070 "Display routes matching the community-list\n"
7071 "community-list name\n"
7072 "Exact match of the communities\n")
7075 DEFUN (show_ipv6_bgp_community_list_exact
,
7076 show_ipv6_bgp_community_list_exact_cmd
,
7077 "show ipv6 bgp community-list WORD exact-match",
7081 "Display routes matching the community-list\n"
7082 "community-list name\n"
7083 "Exact match of the communities\n")
7085 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
7089 DEFUN (show_ipv6_mbgp_community_list_exact
,
7090 show_ipv6_mbgp_community_list_exact_cmd
,
7091 "show ipv6 mbgp community-list WORD exact-match",
7095 "Display routes matching the community-list\n"
7096 "community-list name\n"
7097 "Exact match of the communities\n")
7099 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_MULTICAST
);
7101 #endif /* HAVE_IPV6 */
7104 bgp_show_prefix_longer_clean (struct vty
*vty
)
7108 p
= vty
->output_arg
;
7113 bgp_show_prefix_longer (struct vty
*vty
, char *prefix
, afi_t afi
,
7114 safi_t safi
, enum bgp_show_type type
)
7121 ret
= str2prefix (prefix
, p
);
7124 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
7128 vty
->output_arg
= p
;
7129 vty
->output_clean
= bgp_show_prefix_longer_clean
;
7131 return bgp_show (vty
, NULL
, afi
, safi
, type
);
7134 DEFUN (show_ip_bgp_prefix_longer
,
7135 show_ip_bgp_prefix_longer_cmd
,
7136 "show ip bgp A.B.C.D/M longer-prefixes",
7140 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7141 "Display route and more specific routes\n")
7143 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7144 bgp_show_type_prefix_longer
);
7147 DEFUN (show_ip_bgp_flap_prefix_longer
,
7148 show_ip_bgp_flap_prefix_longer_cmd
,
7149 "show ip bgp flap-statistics A.B.C.D/M longer-prefixes",
7153 "Display flap statistics of routes\n"
7154 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7155 "Display route and more specific routes\n")
7157 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7158 bgp_show_type_flap_prefix_longer
);
7161 DEFUN (show_ip_bgp_ipv4_prefix_longer
,
7162 show_ip_bgp_ipv4_prefix_longer_cmd
,
7163 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes",
7168 "Address Family modifier\n"
7169 "Address Family modifier\n"
7170 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7171 "Display route and more specific routes\n")
7173 if (strncmp (argv
[0], "m", 1) == 0)
7174 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7175 bgp_show_type_prefix_longer
);
7177 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7178 bgp_show_type_prefix_longer
);
7181 DEFUN (show_ip_bgp_flap_address
,
7182 show_ip_bgp_flap_address_cmd
,
7183 "show ip bgp flap-statistics A.B.C.D",
7187 "Display flap statistics of routes\n"
7188 "Network in the BGP routing table to display\n")
7190 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7191 bgp_show_type_flap_address
);
7194 DEFUN (show_ip_bgp_flap_prefix
,
7195 show_ip_bgp_flap_prefix_cmd
,
7196 "show ip bgp flap-statistics A.B.C.D/M",
7200 "Display flap statistics of routes\n"
7201 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7203 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7204 bgp_show_type_flap_prefix
);
7207 DEFUN (show_bgp_prefix_longer
,
7208 show_bgp_prefix_longer_cmd
,
7209 "show bgp X:X::X:X/M longer-prefixes",
7212 "IPv6 prefix <network>/<length>\n"
7213 "Display route and more specific routes\n")
7215 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7216 bgp_show_type_prefix_longer
);
7219 ALIAS (show_bgp_prefix_longer
,
7220 show_bgp_ipv6_prefix_longer_cmd
,
7221 "show bgp ipv6 X:X::X:X/M longer-prefixes",
7225 "IPv6 prefix <network>/<length>\n"
7226 "Display route and more specific routes\n")
7229 DEFUN (show_ipv6_bgp_prefix_longer
,
7230 show_ipv6_bgp_prefix_longer_cmd
,
7231 "show ipv6 bgp X:X::X:X/M longer-prefixes",
7235 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
7236 "Display route and more specific routes\n")
7238 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7239 bgp_show_type_prefix_longer
);
7243 DEFUN (show_ipv6_mbgp_prefix_longer
,
7244 show_ipv6_mbgp_prefix_longer_cmd
,
7245 "show ipv6 mbgp X:X::X:X/M longer-prefixes",
7249 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
7250 "Display route and more specific routes\n")
7252 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
7253 bgp_show_type_prefix_longer
);
7255 #endif /* HAVE_IPV6 */
7258 show_adj_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
,
7261 struct bgp_table
*table
;
7262 struct bgp_adj_in
*ain
;
7263 struct bgp_adj_out
*adj
;
7264 unsigned long output_count
;
7265 struct bgp_node
*rn
;
7270 bgp
= bgp_get_default ();
7275 table
= bgp
->rib
[afi
][safi
];
7279 if (! in
&& CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
7280 PEER_STATUS_DEFAULT_ORIGINATE
))
7282 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
7283 vty_out (vty
, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s", VTY_NEWLINE
);
7284 vty_out (vty
, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s", VTY_NEWLINE
, VTY_NEWLINE
);
7286 vty_out (vty
, "Originating default network 0.0.0.0%s%s",
7287 VTY_NEWLINE
, VTY_NEWLINE
);
7291 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
7294 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
7295 if (ain
->peer
== peer
)
7299 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
7300 vty_out (vty
, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s", VTY_NEWLINE
);
7301 vty_out (vty
, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s", VTY_NEWLINE
, VTY_NEWLINE
);
7306 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
7311 route_vty_out_tmp (vty
, &rn
->p
, ain
->attr
, safi
);
7318 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
)
7319 if (adj
->peer
== peer
)
7323 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
7324 vty_out (vty
, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s", VTY_NEWLINE
);
7325 vty_out (vty
, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s", VTY_NEWLINE
, VTY_NEWLINE
);
7330 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
7335 route_vty_out_tmp (vty
, &rn
->p
, adj
->attr
, safi
);
7341 if (output_count
!= 0)
7342 vty_out (vty
, "%sTotal number of prefixes %ld%s",
7343 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
7347 peer_adj_routes (struct vty
*vty
, char *ip_str
, afi_t afi
, safi_t safi
, int in
)
7353 ret
= str2sockunion (ip_str
, &su
);
7356 vty_out (vty
, "Malformed address: %s%s", ip_str
, VTY_NEWLINE
);
7359 peer
= peer_lookup (NULL
, &su
);
7360 if (! peer
|| ! peer
->afc
[afi
][safi
])
7362 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
7366 if (in
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7368 vty_out (vty
, "%% Inbound soft reconfiguration not enabled%s",
7373 show_adj_route (vty
, peer
, afi
, safi
, in
);
7378 DEFUN (show_ip_bgp_neighbor_advertised_route
,
7379 show_ip_bgp_neighbor_advertised_route_cmd
,
7380 "show ip bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
7384 "Detailed information on TCP and BGP neighbor connections\n"
7385 "Neighbor to display information about\n"
7386 "Neighbor to display information about\n"
7387 "Display the routes advertised to a BGP neighbor\n")
7389 return peer_adj_routes (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, 0);
7392 DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route
,
7393 show_ip_bgp_ipv4_neighbor_advertised_route_cmd
,
7394 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) advertised-routes",
7399 "Address Family modifier\n"
7400 "Address Family modifier\n"
7401 "Detailed information on TCP and BGP neighbor connections\n"
7402 "Neighbor to display information about\n"
7403 "Neighbor to display information about\n"
7404 "Display the routes advertised to a BGP neighbor\n")
7406 if (strncmp (argv
[0], "m", 1) == 0)
7407 return peer_adj_routes (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
, 0);
7409 return peer_adj_routes (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, 0);
7413 DEFUN (show_bgp_neighbor_advertised_route
,
7414 show_bgp_neighbor_advertised_route_cmd
,
7415 "show bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
7418 "Detailed information on TCP and BGP neighbor connections\n"
7419 "Neighbor to display information about\n"
7420 "Neighbor to display information about\n"
7421 "Display the routes advertised to a BGP neighbor\n")
7423 return peer_adj_routes (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0);
7426 ALIAS (show_bgp_neighbor_advertised_route
,
7427 show_bgp_ipv6_neighbor_advertised_route_cmd
,
7428 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes",
7432 "Detailed information on TCP and BGP neighbor connections\n"
7433 "Neighbor to display information about\n"
7434 "Neighbor to display information about\n"
7435 "Display the routes advertised to a BGP neighbor\n")
7438 DEFUN (ipv6_bgp_neighbor_advertised_route
,
7439 ipv6_bgp_neighbor_advertised_route_cmd
,
7440 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
7444 "Detailed information on TCP and BGP neighbor connections\n"
7445 "Neighbor to display information about\n"
7446 "Neighbor to display information about\n"
7447 "Display the routes advertised to a BGP neighbor\n")
7449 return peer_adj_routes (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0);
7453 DEFUN (ipv6_mbgp_neighbor_advertised_route
,
7454 ipv6_mbgp_neighbor_advertised_route_cmd
,
7455 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
7459 "Detailed information on TCP and BGP neighbor connections\n"
7460 "Neighbor to display information about\n"
7461 "Neighbor to display information about\n"
7462 "Display the routes advertised to a BGP neighbor\n")
7464 return peer_adj_routes (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, 0);
7466 #endif /* HAVE_IPV6 */
7468 DEFUN (show_ip_bgp_neighbor_received_routes
,
7469 show_ip_bgp_neighbor_received_routes_cmd
,
7470 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
7474 "Detailed information on TCP and BGP neighbor connections\n"
7475 "Neighbor to display information about\n"
7476 "Neighbor to display information about\n"
7477 "Display the received routes from neighbor\n")
7479 return peer_adj_routes (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, 1);
7482 DEFUN (show_ip_bgp_ipv4_neighbor_received_routes
,
7483 show_ip_bgp_ipv4_neighbor_received_routes_cmd
,
7484 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received-routes",
7489 "Address Family modifier\n"
7490 "Address Family modifier\n"
7491 "Detailed information on TCP and BGP neighbor connections\n"
7492 "Neighbor to display information about\n"
7493 "Neighbor to display information about\n"
7494 "Display the received routes from neighbor\n")
7496 if (strncmp (argv
[0], "m", 1) == 0)
7497 return peer_adj_routes (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
, 1);
7499 return peer_adj_routes (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, 1);
7502 DEFUN (show_ip_bgp_neighbor_received_prefix_filter
,
7503 show_ip_bgp_neighbor_received_prefix_filter_cmd
,
7504 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
7508 "Detailed information on TCP and BGP neighbor connections\n"
7509 "Neighbor to display information about\n"
7510 "Neighbor to display information about\n"
7511 "Display information received from a BGP neighbor\n"
7512 "Display the prefixlist filter\n")
7515 union sockunion
*su
;
7519 su
= sockunion_str2su (argv
[0]);
7523 peer
= peer_lookup (NULL
, su
);
7527 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
7528 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
7531 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
7532 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
7538 DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter
,
7539 show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
,
7540 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
7545 "Address Family modifier\n"
7546 "Address Family modifier\n"
7547 "Detailed information on TCP and BGP neighbor connections\n"
7548 "Neighbor to display information about\n"
7549 "Neighbor to display information about\n"
7550 "Display information received from a BGP neighbor\n"
7551 "Display the prefixlist filter\n")
7554 union sockunion
*su
;
7558 su
= sockunion_str2su (argv
[1]);
7562 peer
= peer_lookup (NULL
, su
);
7566 if (strncmp (argv
[0], "m", 1) == 0)
7568 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_MULTICAST
);
7569 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
7572 vty_out (vty
, "Address family: IPv4 Multicast%s", VTY_NEWLINE
);
7573 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
7578 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
7579 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
7582 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
7583 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
7592 DEFUN (show_bgp_neighbor_received_routes
,
7593 show_bgp_neighbor_received_routes_cmd
,
7594 "show bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
7597 "Detailed information on TCP and BGP neighbor connections\n"
7598 "Neighbor to display information about\n"
7599 "Neighbor to display information about\n"
7600 "Display the received routes from neighbor\n")
7602 return peer_adj_routes (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 1);
7605 ALIAS (show_bgp_neighbor_received_routes
,
7606 show_bgp_ipv6_neighbor_received_routes_cmd
,
7607 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
7611 "Detailed information on TCP and BGP neighbor connections\n"
7612 "Neighbor to display information about\n"
7613 "Neighbor to display information about\n"
7614 "Display the received routes from neighbor\n")
7616 DEFUN (show_bgp_neighbor_received_prefix_filter
,
7617 show_bgp_neighbor_received_prefix_filter_cmd
,
7618 "show bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
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 information received from a BGP neighbor\n"
7625 "Display the prefixlist filter\n")
7628 union sockunion
*su
;
7632 su
= sockunion_str2su (argv
[0]);
7636 peer
= peer_lookup (NULL
, su
);
7640 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
7641 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
7644 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
7645 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
7651 ALIAS (show_bgp_neighbor_received_prefix_filter
,
7652 show_bgp_ipv6_neighbor_received_prefix_filter_cmd
,
7653 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
7657 "Detailed information on TCP and BGP neighbor connections\n"
7658 "Neighbor to display information about\n"
7659 "Neighbor to display information about\n"
7660 "Display information received from a BGP neighbor\n"
7661 "Display the prefixlist filter\n")
7664 DEFUN (ipv6_bgp_neighbor_received_routes
,
7665 ipv6_bgp_neighbor_received_routes_cmd
,
7666 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
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 the received routes from neighbor\n")
7675 return peer_adj_routes (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 1);
7679 DEFUN (ipv6_mbgp_neighbor_received_routes
,
7680 ipv6_mbgp_neighbor_received_routes_cmd
,
7681 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) received-routes",
7685 "Detailed information on TCP and BGP neighbor connections\n"
7686 "Neighbor to display information about\n"
7687 "Neighbor to display information about\n"
7688 "Display the received routes from neighbor\n")
7690 return peer_adj_routes (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, 1);
7692 #endif /* HAVE_IPV6 */
7695 bgp_show_neighbor_route_clean (struct vty
*vty
)
7697 union sockunion
*su
;
7699 su
= vty
->output_arg
;
7700 XFREE (MTYPE_SOCKUNION
, su
);
7704 bgp_show_neighbor_route (struct vty
*vty
, char *ip_str
, afi_t afi
,
7705 safi_t safi
, enum bgp_show_type type
)
7707 union sockunion
*su
;
7710 su
= sockunion_str2su (ip_str
);
7713 vty_out (vty
, "Malformed address: %s%s", ip_str
, VTY_NEWLINE
);
7717 peer
= peer_lookup (NULL
, su
);
7718 if (! peer
|| ! peer
->afc
[afi
][safi
])
7720 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
7721 XFREE (MTYPE_SOCKUNION
, su
);
7725 vty
->output_arg
= su
;
7726 vty
->output_clean
= bgp_show_neighbor_route_clean
;
7728 return bgp_show (vty
, NULL
, afi
, safi
, type
);
7731 DEFUN (show_ip_bgp_neighbor_routes
,
7732 show_ip_bgp_neighbor_routes_cmd
,
7733 "show ip bgp neighbors (A.B.C.D|X:X::X:X) routes",
7737 "Detailed information on TCP and BGP neighbor connections\n"
7738 "Neighbor to display information about\n"
7739 "Neighbor to display information about\n"
7740 "Display routes learned from neighbor\n")
7742 return bgp_show_neighbor_route (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7743 bgp_show_type_neighbor
);
7746 DEFUN (show_ip_bgp_neighbor_flap
,
7747 show_ip_bgp_neighbor_flap_cmd
,
7748 "show ip bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
7752 "Detailed information on TCP and BGP neighbor connections\n"
7753 "Neighbor to display information about\n"
7754 "Neighbor to display information about\n"
7755 "Display flap statistics of the routes learned from neighbor\n")
7757 return bgp_show_neighbor_route (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7758 bgp_show_type_flap_neighbor
);
7761 DEFUN (show_ip_bgp_neighbor_damp
,
7762 show_ip_bgp_neighbor_damp_cmd
,
7763 "show ip bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
7767 "Detailed information on TCP and BGP neighbor connections\n"
7768 "Neighbor to display information about\n"
7769 "Neighbor to display information about\n"
7770 "Display the dampened routes received from neighbor\n")
7772 return bgp_show_neighbor_route (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7773 bgp_show_type_damp_neighbor
);
7776 DEFUN (show_ip_bgp_ipv4_neighbor_routes
,
7777 show_ip_bgp_ipv4_neighbor_routes_cmd
,
7778 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) routes",
7783 "Address Family modifier\n"
7784 "Address Family modifier\n"
7785 "Detailed information on TCP and BGP neighbor connections\n"
7786 "Neighbor to display information about\n"
7787 "Neighbor to display information about\n"
7788 "Display routes learned from neighbor\n")
7790 if (strncmp (argv
[0], "m", 1) == 0)
7791 return bgp_show_neighbor_route (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7792 bgp_show_type_neighbor
);
7794 return bgp_show_neighbor_route (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7795 bgp_show_type_neighbor
);
7798 DEFUN (show_bgp_neighbor_routes
,
7799 show_bgp_neighbor_routes_cmd
,
7800 "show bgp neighbors (A.B.C.D|X:X::X:X) routes",
7803 "Detailed information on TCP and BGP neighbor connections\n"
7804 "Neighbor to display information about\n"
7805 "Neighbor to display information about\n"
7806 "Display routes learned from neighbor\n")
7808 return bgp_show_neighbor_route (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7809 bgp_show_type_neighbor
);
7812 ALIAS (show_bgp_neighbor_routes
,
7813 show_bgp_ipv6_neighbor_routes_cmd
,
7814 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) routes",
7818 "Detailed information on TCP and BGP neighbor connections\n"
7819 "Neighbor to display information about\n"
7820 "Neighbor to display information about\n"
7821 "Display routes learned from neighbor\n")
7824 DEFUN (ipv6_bgp_neighbor_routes
,
7825 ipv6_bgp_neighbor_routes_cmd
,
7826 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) routes",
7830 "Detailed information on TCP and BGP neighbor connections\n"
7831 "Neighbor to display information about\n"
7832 "Neighbor to display information about\n"
7833 "Display routes learned from neighbor\n")
7835 return bgp_show_neighbor_route (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7836 bgp_show_type_neighbor
);
7840 DEFUN (ipv6_mbgp_neighbor_routes
,
7841 ipv6_mbgp_neighbor_routes_cmd
,
7842 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) routes",
7846 "Detailed information on TCP and BGP neighbor connections\n"
7847 "Neighbor to display information about\n"
7848 "Neighbor to display information about\n"
7849 "Display routes learned from neighbor\n")
7851 return bgp_show_neighbor_route (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
7852 bgp_show_type_neighbor
);
7854 #endif /* HAVE_IPV6 */
7856 struct bgp_table
*bgp_distance_table
;
7860 /* Distance value for the IP source prefix. */
7863 /* Name of the access-list to be matched. */
7867 struct bgp_distance
*
7870 struct bgp_distance
*new;
7871 new = XMALLOC (MTYPE_BGP_DISTANCE
, sizeof (struct bgp_distance
));
7872 memset (new, 0, sizeof (struct bgp_distance
));
7877 bgp_distance_free (struct bgp_distance
*bdistance
)
7879 XFREE (MTYPE_BGP_DISTANCE
, bdistance
);
7883 bgp_distance_set (struct vty
*vty
, char *distance_str
, char *ip_str
,
7884 char *access_list_str
)
7887 struct prefix_ipv4 p
;
7889 struct bgp_node
*rn
;
7890 struct bgp_distance
*bdistance
;
7892 ret
= str2prefix_ipv4 (ip_str
, &p
);
7895 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
7899 distance
= atoi (distance_str
);
7901 /* Get BGP distance node. */
7902 rn
= bgp_node_get (bgp_distance_table
, (struct prefix
*) &p
);
7905 bdistance
= rn
->info
;
7906 bgp_unlock_node (rn
);
7910 bdistance
= bgp_distance_new ();
7911 rn
->info
= bdistance
;
7914 /* Set distance value. */
7915 bdistance
->distance
= distance
;
7917 /* Reset access-list configuration. */
7918 if (bdistance
->access_list
)
7920 free (bdistance
->access_list
);
7921 bdistance
->access_list
= NULL
;
7923 if (access_list_str
)
7924 bdistance
->access_list
= strdup (access_list_str
);
7930 bgp_distance_unset (struct vty
*vty
, char *distance_str
, char *ip_str
,
7931 char *access_list_str
)
7934 struct prefix_ipv4 p
;
7936 struct bgp_node
*rn
;
7937 struct bgp_distance
*bdistance
;
7939 ret
= str2prefix_ipv4 (ip_str
, &p
);
7942 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
7946 distance
= atoi (distance_str
);
7948 rn
= bgp_node_lookup (bgp_distance_table
, (struct prefix
*)&p
);
7951 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
7955 bdistance
= rn
->info
;
7957 if (bdistance
->access_list
)
7958 free (bdistance
->access_list
);
7959 bgp_distance_free (bdistance
);
7962 bgp_unlock_node (rn
);
7963 bgp_unlock_node (rn
);
7969 bgp_distance_reset ()
7971 struct bgp_node
*rn
;
7972 struct bgp_distance
*bdistance
;
7974 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
7975 if ((bdistance
= rn
->info
) != NULL
)
7977 if (bdistance
->access_list
)
7978 free (bdistance
->access_list
);
7979 bgp_distance_free (bdistance
);
7981 bgp_unlock_node (rn
);
7985 /* Apply BGP information to distance method. */
7987 bgp_distance_apply (struct prefix
*p
, struct bgp_info
*rinfo
, struct bgp
*bgp
)
7989 struct bgp_node
*rn
;
7990 struct prefix_ipv4 q
;
7992 struct bgp_distance
*bdistance
;
7993 struct access_list
*alist
;
7994 struct bgp_static
*bgp_static
;
7999 if (p
->family
!= AF_INET
)
8004 if (peer
->su
.sa
.sa_family
!= AF_INET
)
8007 memset (&q
, 0, sizeof (struct prefix_ipv4
));
8009 q
.prefix
= peer
->su
.sin
.sin_addr
;
8010 q
.prefixlen
= IPV4_MAX_BITLEN
;
8012 /* Check source address. */
8013 rn
= bgp_node_match (bgp_distance_table
, (struct prefix
*) &q
);
8016 bdistance
= rn
->info
;
8017 bgp_unlock_node (rn
);
8019 if (bdistance
->access_list
)
8021 alist
= access_list_lookup (AFI_IP
, bdistance
->access_list
);
8022 if (alist
&& access_list_apply (alist
, p
) == FILTER_PERMIT
)
8023 return bdistance
->distance
;
8026 return bdistance
->distance
;
8029 /* Backdoor check. */
8030 rn
= bgp_node_lookup (bgp
->route
[AFI_IP
][SAFI_UNICAST
], p
);
8033 bgp_static
= rn
->info
;
8034 bgp_unlock_node (rn
);
8036 if (bgp_static
->backdoor
)
8038 if (bgp
->distance_local
)
8039 return bgp
->distance_local
;
8041 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
8045 if (peer_sort (peer
) == BGP_PEER_EBGP
)
8047 if (bgp
->distance_ebgp
)
8048 return bgp
->distance_ebgp
;
8049 return ZEBRA_EBGP_DISTANCE_DEFAULT
;
8053 if (bgp
->distance_ibgp
)
8054 return bgp
->distance_ibgp
;
8055 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
8059 DEFUN (bgp_distance
,
8061 "distance bgp <1-255> <1-255> <1-255>",
8062 "Define an administrative distance\n"
8064 "Distance for routes external to the AS\n"
8065 "Distance for routes internal to the AS\n"
8066 "Distance for local routes\n")
8072 bgp
->distance_ebgp
= atoi (argv
[0]);
8073 bgp
->distance_ibgp
= atoi (argv
[1]);
8074 bgp
->distance_local
= atoi (argv
[2]);
8078 DEFUN (no_bgp_distance
,
8079 no_bgp_distance_cmd
,
8080 "no distance bgp <1-255> <1-255> <1-255>",
8082 "Define an administrative distance\n"
8084 "Distance for routes external to the AS\n"
8085 "Distance for routes internal to the AS\n"
8086 "Distance for local routes\n")
8092 bgp
->distance_ebgp
= 0;
8093 bgp
->distance_ibgp
= 0;
8094 bgp
->distance_local
= 0;
8098 ALIAS (no_bgp_distance
,
8099 no_bgp_distance2_cmd
,
8102 "Define an administrative distance\n"
8105 DEFUN (bgp_distance_source
,
8106 bgp_distance_source_cmd
,
8107 "distance <1-255> A.B.C.D/M",
8108 "Define an administrative distance\n"
8109 "Administrative distance\n"
8110 "IP source prefix\n")
8112 bgp_distance_set (vty
, argv
[0], argv
[1], NULL
);
8116 DEFUN (no_bgp_distance_source
,
8117 no_bgp_distance_source_cmd
,
8118 "no distance <1-255> A.B.C.D/M",
8120 "Define an administrative distance\n"
8121 "Administrative distance\n"
8122 "IP source prefix\n")
8124 bgp_distance_unset (vty
, argv
[0], argv
[1], NULL
);
8128 DEFUN (bgp_distance_source_access_list
,
8129 bgp_distance_source_access_list_cmd
,
8130 "distance <1-255> A.B.C.D/M WORD",
8131 "Define an administrative distance\n"
8132 "Administrative distance\n"
8133 "IP source prefix\n"
8134 "Access list name\n")
8136 bgp_distance_set (vty
, argv
[0], argv
[1], argv
[2]);
8140 DEFUN (no_bgp_distance_source_access_list
,
8141 no_bgp_distance_source_access_list_cmd
,
8142 "no distance <1-255> A.B.C.D/M WORD",
8144 "Define an administrative distance\n"
8145 "Administrative distance\n"
8146 "IP source prefix\n"
8147 "Access list name\n")
8149 bgp_distance_unset (vty
, argv
[0], argv
[1], argv
[2]);
8153 DEFUN (bgp_damp_set
,
8155 "bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
8156 "BGP Specific commands\n"
8157 "Enable route-flap dampening\n"
8158 "Half-life time for the penalty\n"
8159 "Value to start reusing a route\n"
8160 "Value to start suppressing a route\n"
8161 "Maximum duration to suppress a stable route\n")
8164 int half
= DEFAULT_HALF_LIFE
* 60;
8165 int reuse
= DEFAULT_REUSE
;
8166 int suppress
= DEFAULT_SUPPRESS
;
8171 half
= atoi (argv
[0]) * 60;
8172 reuse
= atoi (argv
[1]);
8173 suppress
= atoi (argv
[2]);
8174 max
= atoi (argv
[3]) * 60;
8178 half
= atoi (argv
[0]) * 60;
8183 return bgp_damp_enable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
),
8184 half
, reuse
, suppress
, max
);
8187 ALIAS (bgp_damp_set
,
8189 "bgp dampening <1-45>",
8190 "BGP Specific commands\n"
8191 "Enable route-flap dampening\n"
8192 "Half-life time for the penalty\n")
8194 ALIAS (bgp_damp_set
,
8197 "BGP Specific commands\n"
8198 "Enable route-flap dampening\n")
8200 DEFUN (bgp_damp_unset
,
8204 "BGP Specific commands\n"
8205 "Enable route-flap dampening\n")
8210 return bgp_damp_disable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
));
8213 ALIAS (bgp_damp_unset
,
8214 bgp_damp_unset2_cmd
,
8215 "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
8217 "BGP Specific commands\n"
8218 "Enable route-flap dampening\n"
8219 "Half-life time for the penalty\n"
8220 "Value to start reusing a route\n"
8221 "Value to start suppressing a route\n"
8222 "Maximum duration to suppress a stable route\n")
8224 DEFUN (show_ip_bgp_dampened_paths
,
8225 show_ip_bgp_dampened_paths_cmd
,
8226 "show ip bgp dampened-paths",
8230 "Display paths suppressed due to dampening\n")
8232 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_dampend_paths
);
8235 DEFUN (show_ip_bgp_flap_statistics
,
8236 show_ip_bgp_flap_statistics_cmd
,
8237 "show ip bgp flap-statistics",
8241 "Display flap statistics of routes\n")
8243 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_flap_statistics
);
8246 /* Display specified route of BGP table. */
8248 bgp_clear_damp_route (struct vty
*vty
, char *view_name
, char *ip_str
,
8249 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
8253 struct prefix match
;
8254 struct bgp_node
*rn
;
8255 struct bgp_node
*rm
;
8256 struct bgp_info
*ri
;
8257 struct bgp_info
*ri_temp
;
8259 struct bgp_table
*table
;
8261 /* BGP structure lookup. */
8264 bgp
= bgp_lookup_by_name (view_name
);
8267 vty_out (vty
, "%% Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
8273 bgp
= bgp_get_default ();
8276 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
8281 /* Check IP address argument. */
8282 ret
= str2prefix (ip_str
, &match
);
8285 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
8289 match
.family
= afi2family (afi
);
8291 if (safi
== SAFI_MPLS_VPN
)
8293 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= bgp_route_next (rn
))
8295 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
8298 if ((table
= rn
->info
) != NULL
)
8299 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
8300 if (! prefix_check
|| rm
->p
.prefixlen
== match
.prefixlen
)
8308 bgp_damp_info_free (ri
->damp_info
, 1);
8319 if ((rn
= bgp_node_match (bgp
->rib
[afi
][safi
], &match
)) != NULL
)
8320 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
8328 bgp_damp_info_free (ri
->damp_info
, 1);
8340 DEFUN (clear_ip_bgp_dampening
,
8341 clear_ip_bgp_dampening_cmd
,
8342 "clear ip bgp dampening",
8346 "Clear route flap dampening information\n")
8348 bgp_damp_info_clean ();
8352 DEFUN (clear_ip_bgp_dampening_prefix
,
8353 clear_ip_bgp_dampening_prefix_cmd
,
8354 "clear ip bgp dampening A.B.C.D/M",
8358 "Clear route flap dampening information\n"
8359 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
8361 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
8362 SAFI_UNICAST
, NULL
, 1);
8365 DEFUN (clear_ip_bgp_dampening_address
,
8366 clear_ip_bgp_dampening_address_cmd
,
8367 "clear ip bgp dampening A.B.C.D",
8371 "Clear route flap dampening information\n"
8372 "Network to clear damping information\n")
8374 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
8375 SAFI_UNICAST
, NULL
, 0);
8378 DEFUN (clear_ip_bgp_dampening_address_mask
,
8379 clear_ip_bgp_dampening_address_mask_cmd
,
8380 "clear ip bgp dampening A.B.C.D A.B.C.D",
8384 "Clear route flap dampening information\n"
8385 "Network to clear damping information\n"
8389 char prefix_str
[BUFSIZ
];
8391 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
8394 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
8398 return bgp_clear_damp_route (vty
, NULL
, prefix_str
, AFI_IP
,
8399 SAFI_UNICAST
, NULL
, 0);
8403 bgp_config_write_network_vpnv4 (struct vty
*vty
, struct bgp
*bgp
,
8404 afi_t afi
, safi_t safi
, int *write
)
8406 struct bgp_node
*prn
;
8407 struct bgp_node
*rn
;
8408 struct bgp_table
*table
;
8410 struct prefix_rd
*prd
;
8411 struct bgp_static
*bgp_static
;
8413 char buf
[SU_ADDRSTRLEN
];
8414 char rdbuf
[RD_ADDRSTRLEN
];
8416 /* Network configuration. */
8417 for (prn
= bgp_table_top (bgp
->route
[afi
][safi
]); prn
; prn
= bgp_route_next (prn
))
8418 if ((table
= prn
->info
) != NULL
)
8419 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
8420 if ((bgp_static
= rn
->info
) != NULL
)
8423 prd
= (struct prefix_rd
*) &prn
->p
;
8425 /* "address-family" display. */
8426 bgp_config_write_family_header (vty
, afi
, safi
, write
);
8428 /* "network" configuration display. */
8429 prefix_rd2str (prd
, rdbuf
, RD_ADDRSTRLEN
);
8430 label
= decode_label (bgp_static
->tag
);
8432 vty_out (vty
, " network %s/%d rd %s tag %d",
8433 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
8436 vty_out (vty
, "%s", VTY_NEWLINE
);
8441 /* Configuration of static route announcement and aggregate
8444 bgp_config_write_network (struct vty
*vty
, struct bgp
*bgp
,
8445 afi_t afi
, safi_t safi
, int *write
)
8447 struct bgp_node
*rn
;
8449 struct bgp_static
*bgp_static
;
8450 struct bgp_aggregate
*bgp_aggregate
;
8451 char buf
[SU_ADDRSTRLEN
];
8453 if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
8454 return bgp_config_write_network_vpnv4 (vty
, bgp
, afi
, safi
, write
);
8456 /* Network configuration. */
8457 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
8458 if ((bgp_static
= rn
->info
) != NULL
)
8462 /* "address-family" display. */
8463 bgp_config_write_family_header (vty
, afi
, safi
, write
);
8465 /* "network" configuration display. */
8466 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
8468 u_int32_t destination
;
8469 struct in_addr netmask
;
8471 destination
= ntohl (p
->u
.prefix4
.s_addr
);
8472 masklen2ip (p
->prefixlen
, &netmask
);
8473 vty_out (vty
, " network %s",
8474 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
));
8476 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
8477 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
8478 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
8479 || p
->u
.prefix4
.s_addr
== 0)
8481 /* Natural mask is not display. */
8484 vty_out (vty
, " mask %s", inet_ntoa (netmask
));
8488 vty_out (vty
, " network %s/%d",
8489 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
8493 if (bgp_static
->rmap
.name
)
8494 vty_out (vty
, " route-map %s", bgp_static
->rmap
.name
);
8495 else if (bgp_static
->backdoor
)
8496 vty_out (vty
, " backdoor");
8498 vty_out (vty
, "%s", VTY_NEWLINE
);
8501 /* Aggregate-address configuration. */
8502 for (rn
= bgp_table_top (bgp
->aggregate
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
8503 if ((bgp_aggregate
= rn
->info
) != NULL
)
8507 /* "address-family" display. */
8508 bgp_config_write_family_header (vty
, afi
, safi
, write
);
8510 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
8512 struct in_addr netmask
;
8514 masklen2ip (p
->prefixlen
, &netmask
);
8515 vty_out (vty
, " aggregate-address %s %s",
8516 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
8517 inet_ntoa (netmask
));
8521 vty_out (vty
, " aggregate-address %s/%d",
8522 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
8526 if (bgp_aggregate
->as_set
)
8527 vty_out (vty
, " as-set");
8529 if (bgp_aggregate
->summary_only
)
8530 vty_out (vty
, " summary-only");
8532 vty_out (vty
, "%s", VTY_NEWLINE
);
8539 bgp_config_write_distance (struct vty
*vty
, struct bgp
*bgp
)
8541 struct bgp_node
*rn
;
8542 struct bgp_distance
*bdistance
;
8544 /* Distance configuration. */
8545 if (bgp
->distance_ebgp
8546 && bgp
->distance_ibgp
8547 && bgp
->distance_local
8548 && (bgp
->distance_ebgp
!= ZEBRA_EBGP_DISTANCE_DEFAULT
8549 || bgp
->distance_ibgp
!= ZEBRA_IBGP_DISTANCE_DEFAULT
8550 || bgp
->distance_local
!= ZEBRA_IBGP_DISTANCE_DEFAULT
))
8551 vty_out (vty
, " distance bgp %d %d %d%s",
8552 bgp
->distance_ebgp
, bgp
->distance_ibgp
, bgp
->distance_local
,
8555 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
8556 if ((bdistance
= rn
->info
) != NULL
)
8558 vty_out (vty
, " distance %d %s/%d %s%s", bdistance
->distance
,
8559 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
8560 bdistance
->access_list
? bdistance
->access_list
: "",
8567 /* Allocate routing table structure and install commands. */
8571 /* Init BGP distance table. */
8572 bgp_distance_table
= bgp_table_init ();
8574 /* IPv4 BGP commands. */
8575 install_element (BGP_NODE
, &bgp_network_cmd
);
8576 install_element (BGP_NODE
, &bgp_network_mask_cmd
);
8577 install_element (BGP_NODE
, &bgp_network_mask_natural_cmd
);
8578 install_element (BGP_NODE
, &bgp_network_route_map_cmd
);
8579 install_element (BGP_NODE
, &bgp_network_mask_route_map_cmd
);
8580 install_element (BGP_NODE
, &bgp_network_mask_natural_route_map_cmd
);
8581 install_element (BGP_NODE
, &bgp_network_backdoor_cmd
);
8582 install_element (BGP_NODE
, &bgp_network_mask_backdoor_cmd
);
8583 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_cmd
);
8584 install_element (BGP_NODE
, &no_bgp_network_cmd
);
8585 install_element (BGP_NODE
, &no_bgp_network_mask_cmd
);
8586 install_element (BGP_NODE
, &no_bgp_network_mask_natural_cmd
);
8587 install_element (BGP_NODE
, &no_bgp_network_route_map_cmd
);
8588 install_element (BGP_NODE
, &no_bgp_network_mask_route_map_cmd
);
8589 install_element (BGP_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
8590 install_element (BGP_NODE
, &no_bgp_network_backdoor_cmd
);
8591 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_cmd
);
8592 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_cmd
);
8594 install_element (BGP_NODE
, &aggregate_address_cmd
);
8595 install_element (BGP_NODE
, &aggregate_address_mask_cmd
);
8596 install_element (BGP_NODE
, &aggregate_address_summary_only_cmd
);
8597 install_element (BGP_NODE
, &aggregate_address_mask_summary_only_cmd
);
8598 install_element (BGP_NODE
, &aggregate_address_as_set_cmd
);
8599 install_element (BGP_NODE
, &aggregate_address_mask_as_set_cmd
);
8600 install_element (BGP_NODE
, &aggregate_address_as_set_summary_cmd
);
8601 install_element (BGP_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
8602 install_element (BGP_NODE
, &aggregate_address_summary_as_set_cmd
);
8603 install_element (BGP_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
8604 install_element (BGP_NODE
, &no_aggregate_address_cmd
);
8605 install_element (BGP_NODE
, &no_aggregate_address_summary_only_cmd
);
8606 install_element (BGP_NODE
, &no_aggregate_address_as_set_cmd
);
8607 install_element (BGP_NODE
, &no_aggregate_address_as_set_summary_cmd
);
8608 install_element (BGP_NODE
, &no_aggregate_address_summary_as_set_cmd
);
8609 install_element (BGP_NODE
, &no_aggregate_address_mask_cmd
);
8610 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
8611 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_cmd
);
8612 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
8613 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
8615 /* IPv4 unicast configuration. */
8616 install_element (BGP_IPV4_NODE
, &bgp_network_cmd
);
8617 install_element (BGP_IPV4_NODE
, &bgp_network_mask_cmd
);
8618 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_cmd
);
8619 install_element (BGP_IPV4_NODE
, &bgp_network_route_map_cmd
);
8620 install_element (BGP_IPV4_NODE
, &bgp_network_mask_route_map_cmd
);
8621 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_route_map_cmd
);
8622 install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
8623 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_cmd
);
8624 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_cmd
);
8625 install_element (BGP_IPV4_NODE
, &no_bgp_network_route_map_cmd
);
8626 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_route_map_cmd
);
8627 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
8628 install_element (BGP_IPV4_NODE
, &aggregate_address_cmd
);
8629 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_cmd
);
8630 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_only_cmd
);
8631 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_only_cmd
);
8632 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_cmd
);
8633 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_cmd
);
8634 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_summary_cmd
);
8635 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
8636 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_as_set_cmd
);
8637 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
8638 install_element (BGP_IPV4_NODE
, &no_aggregate_address_cmd
);
8639 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_only_cmd
);
8640 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_cmd
);
8641 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_summary_cmd
);
8642 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_as_set_cmd
);
8643 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_cmd
);
8644 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
8645 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_cmd
);
8646 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
8647 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
8649 /* IPv4 multicast configuration. */
8650 install_element (BGP_IPV4M_NODE
, &bgp_network_cmd
);
8651 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_cmd
);
8652 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_cmd
);
8653 install_element (BGP_IPV4M_NODE
, &bgp_network_route_map_cmd
);
8654 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_route_map_cmd
);
8655 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_route_map_cmd
);
8656 install_element (BGP_IPV4M_NODE
, &no_bgp_network_cmd
);
8657 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_cmd
);
8658 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_cmd
);
8659 install_element (BGP_IPV4M_NODE
, &no_bgp_network_route_map_cmd
);
8660 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_route_map_cmd
);
8661 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
8662 install_element (BGP_IPV4M_NODE
, &aggregate_address_cmd
);
8663 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_cmd
);
8664 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_only_cmd
);
8665 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_only_cmd
);
8666 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_cmd
);
8667 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_cmd
);
8668 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_summary_cmd
);
8669 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
8670 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_as_set_cmd
);
8671 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
8672 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_cmd
);
8673 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_only_cmd
);
8674 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_cmd
);
8675 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_summary_cmd
);
8676 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_as_set_cmd
);
8677 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_cmd
);
8678 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
8679 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_cmd
);
8680 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
8681 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
8683 install_element (VIEW_NODE
, &show_ip_bgp_cmd
);
8684 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cmd
);
8685 install_element (VIEW_NODE
, &show_ip_bgp_route_cmd
);
8686 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_cmd
);
8687 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
8688 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
8689 install_element (VIEW_NODE
, &show_ip_bgp_prefix_cmd
);
8690 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
8691 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
8692 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
8693 install_element (VIEW_NODE
, &show_ip_bgp_view_cmd
);
8694 install_element (VIEW_NODE
, &show_ip_bgp_view_route_cmd
);
8695 install_element (VIEW_NODE
, &show_ip_bgp_view_prefix_cmd
);
8696 install_element (VIEW_NODE
, &show_ip_bgp_regexp_cmd
);
8697 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
8698 install_element (VIEW_NODE
, &show_ip_bgp_prefix_list_cmd
);
8699 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
8700 install_element (VIEW_NODE
, &show_ip_bgp_filter_list_cmd
);
8701 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
8702 install_element (VIEW_NODE
, &show_ip_bgp_route_map_cmd
);
8703 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
8704 install_element (VIEW_NODE
, &show_ip_bgp_cidr_only_cmd
);
8705 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
8706 install_element (VIEW_NODE
, &show_ip_bgp_community_all_cmd
);
8707 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
8708 install_element (VIEW_NODE
, &show_ip_bgp_community_cmd
);
8709 install_element (VIEW_NODE
, &show_ip_bgp_community2_cmd
);
8710 install_element (VIEW_NODE
, &show_ip_bgp_community3_cmd
);
8711 install_element (VIEW_NODE
, &show_ip_bgp_community4_cmd
);
8712 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_cmd
);
8713 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
8714 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
8715 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
8716 install_element (VIEW_NODE
, &show_ip_bgp_community_exact_cmd
);
8717 install_element (VIEW_NODE
, &show_ip_bgp_community2_exact_cmd
);
8718 install_element (VIEW_NODE
, &show_ip_bgp_community3_exact_cmd
);
8719 install_element (VIEW_NODE
, &show_ip_bgp_community4_exact_cmd
);
8720 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
8721 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
8722 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
8723 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
8724 install_element (VIEW_NODE
, &show_ip_bgp_community_list_cmd
);
8725 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
8726 install_element (VIEW_NODE
, &show_ip_bgp_community_list_exact_cmd
);
8727 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
8728 install_element (VIEW_NODE
, &show_ip_bgp_prefix_longer_cmd
);
8729 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
8730 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
8731 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
8732 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
8733 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
8734 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
8735 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
8736 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
8737 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
8738 install_element (VIEW_NODE
, &show_ip_bgp_dampened_paths_cmd
);
8739 install_element (VIEW_NODE
, &show_ip_bgp_flap_statistics_cmd
);
8740 install_element (VIEW_NODE
, &show_ip_bgp_flap_address_cmd
);
8741 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_cmd
);
8742 install_element (VIEW_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
8743 install_element (VIEW_NODE
, &show_ip_bgp_flap_regexp_cmd
);
8744 install_element (VIEW_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
8745 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
8746 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
8747 install_element (VIEW_NODE
, &show_ip_bgp_flap_route_map_cmd
);
8748 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
8749 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
8751 install_element (ENABLE_NODE
, &show_ip_bgp_cmd
);
8752 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cmd
);
8753 install_element (ENABLE_NODE
, &show_ip_bgp_route_cmd
);
8754 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_cmd
);
8755 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
8756 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
8757 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_cmd
);
8758 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
8759 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
8760 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
8761 install_element (ENABLE_NODE
, &show_ip_bgp_view_cmd
);
8762 install_element (ENABLE_NODE
, &show_ip_bgp_view_route_cmd
);
8763 install_element (ENABLE_NODE
, &show_ip_bgp_view_prefix_cmd
);
8764 install_element (ENABLE_NODE
, &show_ip_bgp_regexp_cmd
);
8765 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
8766 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_list_cmd
);
8767 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
8768 install_element (ENABLE_NODE
, &show_ip_bgp_filter_list_cmd
);
8769 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
8770 install_element (ENABLE_NODE
, &show_ip_bgp_route_map_cmd
);
8771 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
8772 install_element (ENABLE_NODE
, &show_ip_bgp_cidr_only_cmd
);
8773 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
8774 install_element (ENABLE_NODE
, &show_ip_bgp_community_all_cmd
);
8775 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
8776 install_element (ENABLE_NODE
, &show_ip_bgp_community_cmd
);
8777 install_element (ENABLE_NODE
, &show_ip_bgp_community2_cmd
);
8778 install_element (ENABLE_NODE
, &show_ip_bgp_community3_cmd
);
8779 install_element (ENABLE_NODE
, &show_ip_bgp_community4_cmd
);
8780 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_cmd
);
8781 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
8782 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
8783 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
8784 install_element (ENABLE_NODE
, &show_ip_bgp_community_exact_cmd
);
8785 install_element (ENABLE_NODE
, &show_ip_bgp_community2_exact_cmd
);
8786 install_element (ENABLE_NODE
, &show_ip_bgp_community3_exact_cmd
);
8787 install_element (ENABLE_NODE
, &show_ip_bgp_community4_exact_cmd
);
8788 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
8789 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
8790 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
8791 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
8792 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_cmd
);
8793 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
8794 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_exact_cmd
);
8795 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
8796 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_longer_cmd
);
8797 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
8798 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
8799 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
8800 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
8801 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
8802 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
8803 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
8804 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
8805 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
8806 install_element (ENABLE_NODE
, &show_ip_bgp_dampened_paths_cmd
);
8807 install_element (ENABLE_NODE
, &show_ip_bgp_flap_statistics_cmd
);
8808 install_element (ENABLE_NODE
, &show_ip_bgp_flap_address_cmd
);
8809 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_cmd
);
8810 install_element (ENABLE_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
8811 install_element (ENABLE_NODE
, &show_ip_bgp_flap_regexp_cmd
);
8812 install_element (ENABLE_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
8813 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
8814 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
8815 install_element (ENABLE_NODE
, &show_ip_bgp_flap_route_map_cmd
);
8816 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
8817 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
8819 /* BGP dampening clear commands */
8820 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_cmd
);
8821 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_prefix_cmd
);
8822 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_cmd
);
8823 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_mask_cmd
);
8826 /* New config IPv6 BGP commands. */
8827 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_cmd
);
8828 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_route_map_cmd
);
8829 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_cmd
);
8830 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_route_map_cmd
);
8832 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_cmd
);
8833 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_summary_only_cmd
);
8834 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_cmd
);
8835 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_summary_only_cmd
);
8837 /* Old config IPv6 BGP commands. */
8838 install_element (BGP_NODE
, &old_ipv6_bgp_network_cmd
);
8839 install_element (BGP_NODE
, &old_no_ipv6_bgp_network_cmd
);
8841 install_element (BGP_NODE
, &old_ipv6_aggregate_address_cmd
);
8842 install_element (BGP_NODE
, &old_ipv6_aggregate_address_summary_only_cmd
);
8843 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_cmd
);
8844 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_summary_only_cmd
);
8846 install_element (VIEW_NODE
, &show_bgp_cmd
);
8847 install_element (VIEW_NODE
, &show_bgp_ipv6_cmd
);
8848 install_element (VIEW_NODE
, &show_bgp_route_cmd
);
8849 install_element (VIEW_NODE
, &show_bgp_ipv6_route_cmd
);
8850 install_element (VIEW_NODE
, &show_bgp_prefix_cmd
);
8851 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_cmd
);
8852 install_element (VIEW_NODE
, &show_bgp_regexp_cmd
);
8853 install_element (VIEW_NODE
, &show_bgp_ipv6_regexp_cmd
);
8854 install_element (VIEW_NODE
, &show_bgp_prefix_list_cmd
);
8855 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
8856 install_element (VIEW_NODE
, &show_bgp_filter_list_cmd
);
8857 install_element (VIEW_NODE
, &show_bgp_ipv6_filter_list_cmd
);
8858 install_element (VIEW_NODE
, &show_bgp_route_map_cmd
);
8859 install_element (VIEW_NODE
, &show_bgp_ipv6_route_map_cmd
);
8860 install_element (VIEW_NODE
, &show_bgp_community_all_cmd
);
8861 install_element (VIEW_NODE
, &show_bgp_ipv6_community_all_cmd
);
8862 install_element (VIEW_NODE
, &show_bgp_community_cmd
);
8863 install_element (VIEW_NODE
, &show_bgp_ipv6_community_cmd
);
8864 install_element (VIEW_NODE
, &show_bgp_community2_cmd
);
8865 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_cmd
);
8866 install_element (VIEW_NODE
, &show_bgp_community3_cmd
);
8867 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_cmd
);
8868 install_element (VIEW_NODE
, &show_bgp_community4_cmd
);
8869 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_cmd
);
8870 install_element (VIEW_NODE
, &show_bgp_community_exact_cmd
);
8871 install_element (VIEW_NODE
, &show_bgp_ipv6_community_exact_cmd
);
8872 install_element (VIEW_NODE
, &show_bgp_community2_exact_cmd
);
8873 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
8874 install_element (VIEW_NODE
, &show_bgp_community3_exact_cmd
);
8875 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
8876 install_element (VIEW_NODE
, &show_bgp_community4_exact_cmd
);
8877 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
8878 install_element (VIEW_NODE
, &show_bgp_community_list_cmd
);
8879 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_cmd
);
8880 install_element (VIEW_NODE
, &show_bgp_community_list_exact_cmd
);
8881 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
8882 install_element (VIEW_NODE
, &show_bgp_prefix_longer_cmd
);
8883 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
8884 install_element (VIEW_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
8885 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
8886 install_element (VIEW_NODE
, &show_bgp_neighbor_received_routes_cmd
);
8887 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
8888 install_element (VIEW_NODE
, &show_bgp_neighbor_routes_cmd
);
8889 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
8890 install_element (VIEW_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
8891 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
8893 install_element (ENABLE_NODE
, &show_bgp_cmd
);
8894 install_element (ENABLE_NODE
, &show_bgp_ipv6_cmd
);
8895 install_element (ENABLE_NODE
, &show_bgp_route_cmd
);
8896 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_cmd
);
8897 install_element (ENABLE_NODE
, &show_bgp_prefix_cmd
);
8898 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_cmd
);
8899 install_element (ENABLE_NODE
, &show_bgp_regexp_cmd
);
8900 install_element (ENABLE_NODE
, &show_bgp_ipv6_regexp_cmd
);
8901 install_element (ENABLE_NODE
, &show_bgp_prefix_list_cmd
);
8902 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
8903 install_element (ENABLE_NODE
, &show_bgp_filter_list_cmd
);
8904 install_element (ENABLE_NODE
, &show_bgp_ipv6_filter_list_cmd
);
8905 install_element (ENABLE_NODE
, &show_bgp_route_map_cmd
);
8906 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_map_cmd
);
8907 install_element (ENABLE_NODE
, &show_bgp_community_all_cmd
);
8908 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_all_cmd
);
8909 install_element (ENABLE_NODE
, &show_bgp_community_cmd
);
8910 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_cmd
);
8911 install_element (ENABLE_NODE
, &show_bgp_community2_cmd
);
8912 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_cmd
);
8913 install_element (ENABLE_NODE
, &show_bgp_community3_cmd
);
8914 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_cmd
);
8915 install_element (ENABLE_NODE
, &show_bgp_community4_cmd
);
8916 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_cmd
);
8917 install_element (ENABLE_NODE
, &show_bgp_community_exact_cmd
);
8918 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_exact_cmd
);
8919 install_element (ENABLE_NODE
, &show_bgp_community2_exact_cmd
);
8920 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
8921 install_element (ENABLE_NODE
, &show_bgp_community3_exact_cmd
);
8922 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
8923 install_element (ENABLE_NODE
, &show_bgp_community4_exact_cmd
);
8924 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
8925 install_element (ENABLE_NODE
, &show_bgp_community_list_cmd
);
8926 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_cmd
);
8927 install_element (ENABLE_NODE
, &show_bgp_community_list_exact_cmd
);
8928 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
8929 install_element (ENABLE_NODE
, &show_bgp_prefix_longer_cmd
);
8930 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
8931 install_element (ENABLE_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
8932 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
8933 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_routes_cmd
);
8934 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
8935 install_element (ENABLE_NODE
, &show_bgp_neighbor_routes_cmd
);
8936 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
8937 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
8938 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
8941 install_element (VIEW_NODE
, &show_ipv6_bgp_cmd
);
8942 install_element (VIEW_NODE
, &show_ipv6_bgp_route_cmd
);
8943 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_cmd
);
8944 install_element (VIEW_NODE
, &show_ipv6_bgp_regexp_cmd
);
8945 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
8946 install_element (VIEW_NODE
, &show_ipv6_bgp_filter_list_cmd
);
8947 install_element (VIEW_NODE
, &show_ipv6_bgp_community_all_cmd
);
8948 install_element (VIEW_NODE
, &show_ipv6_bgp_community_cmd
);
8949 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_cmd
);
8950 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_cmd
);
8951 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_cmd
);
8952 install_element (VIEW_NODE
, &show_ipv6_bgp_community_exact_cmd
);
8953 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
8954 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
8955 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
8956 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_cmd
);
8957 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
8958 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
8959 install_element (VIEW_NODE
, &show_ipv6_mbgp_cmd
);
8960 install_element (VIEW_NODE
, &show_ipv6_mbgp_route_cmd
);
8961 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_cmd
);
8962 install_element (VIEW_NODE
, &show_ipv6_mbgp_regexp_cmd
);
8963 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
8964 install_element (VIEW_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
8965 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_all_cmd
);
8966 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_cmd
);
8967 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_cmd
);
8968 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_cmd
);
8969 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_cmd
);
8970 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
8971 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
8972 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
8973 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
8974 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_cmd
);
8975 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
8976 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
8979 install_element (ENABLE_NODE
, &show_ipv6_bgp_cmd
);
8980 install_element (ENABLE_NODE
, &show_ipv6_bgp_route_cmd
);
8981 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_cmd
);
8982 install_element (ENABLE_NODE
, &show_ipv6_bgp_regexp_cmd
);
8983 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
8984 install_element (ENABLE_NODE
, &show_ipv6_bgp_filter_list_cmd
);
8985 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_all_cmd
);
8986 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_cmd
);
8987 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_cmd
);
8988 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_cmd
);
8989 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_cmd
);
8990 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_exact_cmd
);
8991 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
8992 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
8993 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
8994 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_cmd
);
8995 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
8996 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
8997 install_element (ENABLE_NODE
, &show_ipv6_mbgp_cmd
);
8998 install_element (ENABLE_NODE
, &show_ipv6_mbgp_route_cmd
);
8999 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_cmd
);
9000 install_element (ENABLE_NODE
, &show_ipv6_mbgp_regexp_cmd
);
9001 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
9002 install_element (ENABLE_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
9003 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_all_cmd
);
9004 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_cmd
);
9005 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_cmd
);
9006 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_cmd
);
9007 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_cmd
);
9008 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
9009 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
9010 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
9011 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
9012 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_cmd
);
9013 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
9014 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
9017 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
9018 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
9019 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
9020 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
9023 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
9024 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
9025 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
9026 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
9029 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
9030 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
9031 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
9032 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
9033 #endif /* HAVE_IPV6 */
9035 install_element (BGP_NODE
, &bgp_distance_cmd
);
9036 install_element (BGP_NODE
, &no_bgp_distance_cmd
);
9037 install_element (BGP_NODE
, &no_bgp_distance2_cmd
);
9038 install_element (BGP_NODE
, &bgp_distance_source_cmd
);
9039 install_element (BGP_NODE
, &no_bgp_distance_source_cmd
);
9040 install_element (BGP_NODE
, &bgp_distance_source_access_list_cmd
);
9041 install_element (BGP_NODE
, &no_bgp_distance_source_access_list_cmd
);
9043 install_element (BGP_NODE
, &bgp_damp_set_cmd
);
9044 install_element (BGP_NODE
, &bgp_damp_set2_cmd
);
9045 install_element (BGP_NODE
, &bgp_damp_set3_cmd
);
9046 install_element (BGP_NODE
, &bgp_damp_unset_cmd
);
9047 install_element (BGP_NODE
, &bgp_damp_unset2_cmd
);
9048 install_element (BGP_IPV4_NODE
, &bgp_damp_set_cmd
);
9049 install_element (BGP_IPV4_NODE
, &bgp_damp_set2_cmd
);
9050 install_element (BGP_IPV4_NODE
, &bgp_damp_set3_cmd
);
9051 install_element (BGP_IPV4_NODE
, &bgp_damp_unset_cmd
);
9052 install_element (BGP_IPV4_NODE
, &bgp_damp_unset2_cmd
);