1 /* BGP routing information
2 Copyright (C) 1996, 97, 98, 99 Kunihiro Ishiguro
4 This file is part of GNU Zebra.
6 GNU Zebra is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 GNU Zebra is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Zebra; see the file COPYING. If not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
33 #include "sockunion.h"
36 #include "workqueue.h"
38 #include "bgpd/bgpd.h"
39 #include "bgpd/bgp_table.h"
40 #include "bgpd/bgp_route.h"
41 #include "bgpd/bgp_attr.h"
42 #include "bgpd/bgp_debug.h"
43 #include "bgpd/bgp_aspath.h"
44 #include "bgpd/bgp_regex.h"
45 #include "bgpd/bgp_community.h"
46 #include "bgpd/bgp_ecommunity.h"
47 #include "bgpd/bgp_clist.h"
48 #include "bgpd/bgp_packet.h"
49 #include "bgpd/bgp_filter.h"
50 #include "bgpd/bgp_fsm.h"
51 #include "bgpd/bgp_mplsvpn.h"
52 #include "bgpd/bgp_nexthop.h"
53 #include "bgpd/bgp_damp.h"
54 #include "bgpd/bgp_advertise.h"
55 #include "bgpd/bgp_zebra.h"
56 #include "bgpd/bgp_vty.h"
58 /* Extern from bgp_dump.c */
59 extern char *bgp_origin_str
[];
60 extern char *bgp_origin_long_str
[];
62 static struct bgp_node
*
63 bgp_afi_node_get (struct bgp_table
*table
, afi_t afi
, safi_t safi
, struct prefix
*p
,
64 struct prefix_rd
*prd
)
67 struct bgp_node
*prn
= NULL
;
69 if (safi
== SAFI_MPLS_VPN
)
71 prn
= bgp_node_get (table
, (struct prefix
*) prd
);
73 if (prn
->info
== NULL
)
74 prn
->info
= bgp_table_init ();
76 bgp_unlock_node (prn
);
80 rn
= bgp_node_get (table
, p
);
82 if (safi
== SAFI_MPLS_VPN
)
88 /* Allocate new bgp info structure. */
89 static struct bgp_info
*
94 new = XMALLOC (MTYPE_BGP_ROUTE
, sizeof (struct bgp_info
));
95 memset (new, 0, sizeof (struct bgp_info
));
100 /* Free bgp route information. */
102 bgp_info_free (struct bgp_info
*binfo
)
105 bgp_attr_unintern (binfo
->attr
);
107 if (binfo
->damp_info
)
108 bgp_damp_info_free (binfo
->damp_info
, 0);
110 peer_unlock (binfo
->peer
); /* bgp_info peer reference */
112 XFREE (MTYPE_BGP_ROUTE
, binfo
);
116 bgp_info_lock (struct bgp_info
*binfo
)
123 bgp_info_unlock (struct bgp_info
*binfo
)
125 assert (binfo
&& binfo
->lock
> 0);
128 if (binfo
->lock
== 0)
131 zlog_debug ("%s: unlocked and freeing", __func__
);
132 zlog_backtrace (LOG_DEBUG
);
134 bgp_info_free (binfo
);
139 if (binfo
->lock
== 1)
141 zlog_debug ("%s: unlocked to 1", __func__
);
142 zlog_backtrace (LOG_DEBUG
);
150 bgp_info_add (struct bgp_node
*rn
, struct bgp_info
*ri
)
152 struct bgp_info
*top
;
164 peer_lock (ri
->peer
); /* bgp_info peer reference */
168 bgp_info_delete (struct bgp_node
*rn
, struct bgp_info
*ri
)
171 ri
->next
->prev
= ri
->prev
;
173 ri
->prev
->next
= ri
->next
;
177 bgp_info_unlock (ri
);
178 bgp_unlock_node (rn
);
181 /* Get MED value. If MED value is missing and "bgp bestpath
182 missing-as-worst" is specified, treat it as the worst value. */
184 bgp_med_value (struct attr
*attr
, struct bgp
*bgp
)
186 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
190 if (bgp_flag_check (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
))
197 /* Compare two bgp route entity. br is preferable then return 1. */
199 bgp_info_cmp (struct bgp
*bgp
, struct bgp_info
*new, struct bgp_info
*exist
)
202 u_int32_t exist_pref
;
205 struct in_addr new_id
;
206 struct in_addr exist_id
;
209 int internal_as_route
= 0;
210 int confed_as_route
= 0;
219 /* 1. Weight check. */
220 if (new->attr
->weight
> exist
->attr
->weight
)
222 if (new->attr
->weight
< exist
->attr
->weight
)
225 /* 2. Local preference check. */
226 if (new->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
227 new_pref
= new->attr
->local_pref
;
229 new_pref
= bgp
->default_local_pref
;
231 if (exist
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
232 exist_pref
= exist
->attr
->local_pref
;
234 exist_pref
= bgp
->default_local_pref
;
236 if (new_pref
> exist_pref
)
238 if (new_pref
< exist_pref
)
241 /* 3. Local route check. */
242 if (new->sub_type
== BGP_ROUTE_STATIC
)
244 if (exist
->sub_type
== BGP_ROUTE_STATIC
)
247 if (new->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
249 if (exist
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
252 if (new->sub_type
== BGP_ROUTE_AGGREGATE
)
254 if (exist
->sub_type
== BGP_ROUTE_AGGREGATE
)
257 /* 4. AS path length check. */
258 if (! bgp_flag_check (bgp
, BGP_FLAG_ASPATH_IGNORE
))
260 if (bgp_flag_check (bgp
, BGP_FLAG_ASPATH_CONFED
))
262 if ((new->attr
->aspath
->count
+
263 new->attr
->aspath
->confed_count
)
264 < (exist
->attr
->aspath
->count
+
265 exist
->attr
->aspath
->confed_count
))
267 if ((new->attr
->aspath
->count
+
268 new->attr
->aspath
->confed_count
)
269 > (exist
->attr
->aspath
->count
+
270 exist
->attr
->aspath
->confed_count
))
275 if (new->attr
->aspath
->count
< exist
->attr
->aspath
->count
)
277 if (new->attr
->aspath
->count
> exist
->attr
->aspath
->count
)
282 /* 5. Origin check. */
283 if (new->attr
->origin
< exist
->attr
->origin
)
285 if (new->attr
->origin
> exist
->attr
->origin
)
289 internal_as_route
= (new->attr
->aspath
->length
== 0
290 && exist
->attr
->aspath
->length
== 0);
291 confed_as_route
= (new->attr
->aspath
->length
> 0
292 && exist
->attr
->aspath
->length
> 0
293 && new->attr
->aspath
->count
== 0
294 && exist
->attr
->aspath
->count
== 0);
296 if (bgp_flag_check (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
)
297 || (bgp_flag_check (bgp
, BGP_FLAG_MED_CONFED
)
299 || aspath_cmp_left (new->attr
->aspath
, exist
->attr
->aspath
)
300 || aspath_cmp_left_confed (new->attr
->aspath
, exist
->attr
->aspath
)
301 || internal_as_route
)
303 new_med
= bgp_med_value (new->attr
, bgp
);
304 exist_med
= bgp_med_value (exist
->attr
, bgp
);
306 if (new_med
< exist_med
)
308 if (new_med
> exist_med
)
312 /* 7. Peer type check. */
313 if (peer_sort (new->peer
) == BGP_PEER_EBGP
314 && peer_sort (exist
->peer
) == BGP_PEER_IBGP
)
316 if (peer_sort (new->peer
) == BGP_PEER_EBGP
317 && peer_sort (exist
->peer
) == BGP_PEER_CONFED
)
319 if (peer_sort (new->peer
) == BGP_PEER_IBGP
320 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
322 if (peer_sort (new->peer
) == BGP_PEER_CONFED
323 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
326 /* 8. IGP metric check. */
327 if (new->igpmetric
< exist
->igpmetric
)
329 if (new->igpmetric
> exist
->igpmetric
)
332 /* 9. Maximum path check. */
334 /* 10. If both paths are external, prefer the path that was received
335 first (the oldest one). This step minimizes route-flap, since a
336 newer path won't displace an older one, even if it was the
337 preferred route based on the additional decision criteria below. */
338 if (! bgp_flag_check (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
)
339 && peer_sort (new->peer
) == BGP_PEER_EBGP
340 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
342 if (CHECK_FLAG (new->flags
, BGP_INFO_SELECTED
))
344 if (CHECK_FLAG (exist
->flags
, BGP_INFO_SELECTED
))
348 /* 11. Rourter-ID comparision. */
349 if (new->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
350 new_id
.s_addr
= new->attr
->originator_id
.s_addr
;
352 new_id
.s_addr
= new->peer
->remote_id
.s_addr
;
353 if (exist
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
354 exist_id
.s_addr
= exist
->attr
->originator_id
.s_addr
;
356 exist_id
.s_addr
= exist
->peer
->remote_id
.s_addr
;
358 if (ntohl (new_id
.s_addr
) < ntohl (exist_id
.s_addr
))
360 if (ntohl (new_id
.s_addr
) > ntohl (exist_id
.s_addr
))
363 /* 12. Cluster length comparision. */
364 if (new->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
365 new_cluster
= new->attr
->cluster
->length
;
368 if (exist
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
369 exist_cluster
= exist
->attr
->cluster
->length
;
373 if (new_cluster
< exist_cluster
)
375 if (new_cluster
> exist_cluster
)
378 /* 13. Neighbor address comparision. */
379 ret
= sockunion_cmp (new->peer
->su_remote
, exist
->peer
->su_remote
);
389 static enum filter_type
390 bgp_input_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
391 afi_t afi
, safi_t safi
)
393 struct bgp_filter
*filter
;
395 filter
= &peer
->filter
[afi
][safi
];
397 if (DISTRIBUTE_IN_NAME (filter
))
398 if (access_list_apply (DISTRIBUTE_IN (filter
), p
) == FILTER_DENY
)
401 if (PREFIX_LIST_IN_NAME (filter
))
402 if (prefix_list_apply (PREFIX_LIST_IN (filter
), p
) == PREFIX_DENY
)
405 if (FILTER_LIST_IN_NAME (filter
))
406 if (as_list_apply (FILTER_LIST_IN (filter
), attr
->aspath
)== AS_FILTER_DENY
)
409 return FILTER_PERMIT
;
412 static enum filter_type
413 bgp_output_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
414 afi_t afi
, safi_t safi
)
416 struct bgp_filter
*filter
;
418 filter
= &peer
->filter
[afi
][safi
];
420 if (DISTRIBUTE_OUT_NAME (filter
))
421 if (access_list_apply (DISTRIBUTE_OUT (filter
), p
) == FILTER_DENY
)
424 if (PREFIX_LIST_OUT_NAME (filter
))
425 if (prefix_list_apply (PREFIX_LIST_OUT (filter
), p
) == PREFIX_DENY
)
428 if (FILTER_LIST_OUT_NAME (filter
))
429 if (as_list_apply (FILTER_LIST_OUT (filter
), attr
->aspath
) == AS_FILTER_DENY
)
432 return FILTER_PERMIT
;
435 /* If community attribute includes no_export then return 1. */
437 bgp_community_filter (struct peer
*peer
, struct attr
*attr
)
441 /* NO_ADVERTISE check. */
442 if (community_include (attr
->community
, COMMUNITY_NO_ADVERTISE
))
445 /* NO_EXPORT check. */
446 if (peer_sort (peer
) == BGP_PEER_EBGP
&&
447 community_include (attr
->community
, COMMUNITY_NO_EXPORT
))
450 /* NO_EXPORT_SUBCONFED check. */
451 if (peer_sort (peer
) == BGP_PEER_EBGP
452 || peer_sort (peer
) == BGP_PEER_CONFED
)
453 if (community_include (attr
->community
, COMMUNITY_NO_EXPORT_SUBCONFED
))
459 /* Route reflection loop check. */
461 bgp_cluster_filter (struct peer
*peer
, struct attr
*attr
)
463 struct in_addr cluster_id
;
467 if (peer
->bgp
->config
& BGP_CONFIG_CLUSTER_ID
)
468 cluster_id
= peer
->bgp
->cluster_id
;
470 cluster_id
= peer
->bgp
->router_id
;
472 if (cluster_loop_check (attr
->cluster
, cluster_id
))
479 bgp_input_modifier (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
480 afi_t afi
, safi_t safi
)
482 struct bgp_filter
*filter
;
483 struct bgp_info info
;
484 route_map_result_t ret
;
486 filter
= &peer
->filter
[afi
][safi
];
488 /* Apply default weight value. */
489 attr
->weight
= peer
->weight
;
491 /* Route map apply. */
492 if (ROUTE_MAP_IN_NAME (filter
))
494 /* Duplicate current value to new strucutre for modification. */
498 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IN
);
500 /* Apply BGP route map to the attribute. */
501 ret
= route_map_apply (ROUTE_MAP_IN (filter
), p
, RMAP_BGP
, &info
);
505 if (ret
== RMAP_DENYMATCH
)
507 /* Free newly generated AS path and community by route-map. */
508 bgp_attr_flush (attr
);
516 bgp_export_modifier (struct peer
*rsclient
, struct peer
*peer
,
517 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
519 struct bgp_filter
*filter
;
520 struct bgp_info info
;
521 route_map_result_t ret
;
523 filter
= &peer
->filter
[afi
][safi
];
525 /* Route map apply. */
526 if (ROUTE_MAP_EXPORT_NAME (filter
))
528 /* Duplicate current value to new strucutre for modification. */
529 info
.peer
= rsclient
;
532 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
534 /* Apply BGP route map to the attribute. */
535 ret
= route_map_apply (ROUTE_MAP_EXPORT (filter
), p
, RMAP_BGP
, &info
);
537 rsclient
->rmap_type
= 0;
539 if (ret
== RMAP_DENYMATCH
)
541 /* Free newly generated AS path and community by route-map. */
542 bgp_attr_flush (attr
);
550 bgp_import_modifier (struct peer
*rsclient
, struct peer
*peer
,
551 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
553 struct bgp_filter
*filter
;
554 struct bgp_info info
;
555 route_map_result_t ret
;
557 filter
= &rsclient
->filter
[afi
][safi
];
559 /* Apply default weight value. */
560 attr
->weight
= peer
->weight
;
562 /* Route map apply. */
563 if (ROUTE_MAP_IMPORT_NAME (filter
))
565 /* Duplicate current value to new strucutre for modification. */
569 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IMPORT
);
571 /* Apply BGP route map to the attribute. */
572 ret
= route_map_apply (ROUTE_MAP_IMPORT (filter
), p
, RMAP_BGP
, &info
);
576 if (ret
== RMAP_DENYMATCH
)
578 /* Free newly generated AS path and community by route-map. */
579 bgp_attr_flush (attr
);
587 bgp_announce_check (struct bgp_info
*ri
, struct peer
*peer
, struct prefix
*p
,
588 struct attr
*attr
, afi_t afi
, safi_t safi
)
591 char buf
[SU_ADDRSTRLEN
];
592 struct bgp_filter
*filter
;
593 struct bgp_info info
;
596 struct attr dummy_attr
;
601 filter
= &peer
->filter
[afi
][safi
];
604 #ifdef DISABLE_BGP_ANNOUNCE
608 /* Do not send announces to RS-clients from the 'normal' bgp_table. */
609 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
612 /* Do not send back route to sender. */
616 /* If peer's id and route's nexthop are same. draft-ietf-idr-bgp4-23 5.1.3 */
617 if (p
->family
== AF_INET
618 && IPV4_ADDR_SAME(&peer
->remote_id
, &ri
->attr
->nexthop
))
621 if (p
->family
== AF_INET6
622 && IPV6_ADDR_SAME(&peer
->remote_id
, &ri
->attr
->nexthop
))
626 /* Aggregate-address suppress check. */
628 if (! UNSUPPRESS_MAP_NAME (filter
))
631 /* Default route check. */
632 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
634 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
637 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
639 #endif /* HAVE_IPV6 */
642 /* Transparency check. */
643 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
)
644 && CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
649 /* If community is not disabled check the no-export and local. */
650 if (! transparent
&& bgp_community_filter (peer
, ri
->attr
))
653 /* If the attribute has originator-id and it is same as remote
655 if (ri
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
657 if (IPV4_ADDR_SAME (&peer
->remote_id
, &ri
->attr
->originator_id
))
659 if (BGP_DEBUG (filter
, FILTER
))
660 zlog (peer
->log
, LOG_DEBUG
,
661 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
663 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
669 /* ORF prefix-list filter check */
670 if (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
671 && (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
672 || CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
673 if (peer
->orf_plist
[afi
][safi
])
675 if (prefix_list_apply (peer
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
679 /* Output filter check. */
680 if (bgp_output_filter (peer
, p
, ri
->attr
, afi
, safi
) == FILTER_DENY
)
682 if (BGP_DEBUG (filter
, FILTER
))
683 zlog (peer
->log
, LOG_DEBUG
,
684 "%s [Update:SEND] %s/%d is filtered",
686 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
691 #ifdef BGP_SEND_ASPATH_CHECK
692 /* AS path loop check. */
693 if (aspath_loop_check (ri
->attr
->aspath
, peer
->as
))
695 if (BGP_DEBUG (filter
, FILTER
))
696 zlog (peer
->log
, LOG_DEBUG
,
697 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
698 peer
->host
, peer
->as
);
701 #endif /* BGP_SEND_ASPATH_CHECK */
703 /* If we're a CONFED we need to loop check the CONFED ID too */
704 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
706 if (aspath_loop_check(ri
->attr
->aspath
, bgp
->confed_id
))
708 if (BGP_DEBUG (filter
, FILTER
))
709 zlog (peer
->log
, LOG_DEBUG
,
710 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
717 /* Route-Reflect check. */
718 if (peer_sort (from
) == BGP_PEER_IBGP
&& peer_sort (peer
) == BGP_PEER_IBGP
)
723 /* IBGP reflection check. */
726 /* A route from a Client peer. */
727 if (CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
729 /* Reflect to all the Non-Client peers and also to the
730 Client peers other than the originator. Originator check
731 is already done. So there is noting to do. */
732 /* no bgp client-to-client reflection check. */
733 if (bgp_flag_check (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
))
734 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
739 /* A route from a Non-client peer. Reflect to all other
741 if (! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
746 /* For modify attribute, copy it to temporary structure. */
749 /* If local-preference is not set. */
750 if ((peer_sort (peer
) == BGP_PEER_IBGP
751 || peer_sort (peer
) == BGP_PEER_CONFED
)
752 && (! (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))))
754 attr
->flag
|= ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
);
755 attr
->local_pref
= bgp
->default_local_pref
;
758 /* Remove MED if its an EBGP peer - will get overwritten by route-maps */
759 if (peer_sort (peer
) == BGP_PEER_EBGP
760 && attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
762 if (ri
->peer
!= bgp
->peer_self
&& ! transparent
763 && ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
764 attr
->flag
&= ~(ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
));
768 if (transparent
|| reflect
769 || (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
)
770 && ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
)
772 || (p
->family
== AF_INET6
&&
773 ! IN6_IS_ADDR_UNSPECIFIED(&attr
->mp_nexthop_global
))
774 #endif /* HAVE_IPV6 */
777 /* NEXT-HOP Unchanged. */
779 else if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
780 || (p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
782 || (p
->family
== AF_INET6
&&
783 IN6_IS_ADDR_UNSPECIFIED(&attr
->mp_nexthop_global
))
784 #endif /* HAVE_IPV6 */
785 || (peer_sort (peer
) == BGP_PEER_EBGP
786 && bgp_multiaccess_check_v4 (attr
->nexthop
, peer
->host
) == 0))
788 /* Set IPv4 nexthop. */
789 if (p
->family
== AF_INET
)
791 if (safi
== SAFI_MPLS_VPN
)
792 memcpy (&attr
->mp_nexthop_global_in
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
794 memcpy (&attr
->nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
797 /* Set IPv6 nexthop. */
798 if (p
->family
== AF_INET6
)
800 /* IPv6 global nexthop must be included. */
801 memcpy (&attr
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
803 attr
->mp_nexthop_len
= 16;
805 #endif /* HAVE_IPV6 */
809 if (p
->family
== AF_INET6
)
811 /* Left nexthop_local unchanged if so configured. */
812 if ( CHECK_FLAG (peer
->af_flags
[afi
][safi
],
813 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
815 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->mp_nexthop_local
) )
816 attr
->mp_nexthop_len
=32;
818 attr
->mp_nexthop_len
=16;
821 /* Default nexthop_local treatment for non-RS-Clients */
824 /* Link-local address should not be transit to different peer. */
825 attr
->mp_nexthop_len
= 16;
827 /* Set link-local address for shared network peer. */
828 if (peer
->shared_network
829 && ! IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
831 memcpy (&attr
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
833 attr
->mp_nexthop_len
= 32;
836 /* If bgpd act as BGP-4+ route-reflector, do not send link-local
839 attr
->mp_nexthop_len
= 16;
841 /* If BGP-4+ link-local nexthop is not link-local nexthop. */
842 if (! IN6_IS_ADDR_LINKLOCAL (&peer
->nexthop
.v6_local
))
843 attr
->mp_nexthop_len
= 16;
847 #endif /* HAVE_IPV6 */
849 /* If this is EBGP peer and remove-private-AS is set. */
850 if (peer_sort (peer
) == BGP_PEER_EBGP
851 && peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
)
852 && aspath_private_as_check (attr
->aspath
))
853 attr
->aspath
= aspath_empty_get ();
855 /* Route map & unsuppress-map apply. */
856 if (ROUTE_MAP_OUT_NAME (filter
)
862 /* The route reflector is not allowed to modify the attributes
863 of the reflected IBGP routes. */
864 if (peer_sort (from
) == BGP_PEER_IBGP
865 && peer_sort (peer
) == BGP_PEER_IBGP
)
868 info
.attr
= &dummy_attr
;
871 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_OUT
);
874 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
876 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
880 if (ret
== RMAP_DENYMATCH
)
882 bgp_attr_flush (attr
);
890 bgp_announce_check_rsclient (struct bgp_info
*ri
, struct peer
*rsclient
,
891 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
894 char buf
[SU_ADDRSTRLEN
];
895 struct bgp_filter
*filter
;
896 struct bgp_info info
;
901 filter
= &rsclient
->filter
[afi
][safi
];
904 #ifdef DISABLE_BGP_ANNOUNCE
908 /* Do not send back route to sender. */
909 if (from
== rsclient
)
912 /* Aggregate-address suppress check. */
914 if (! UNSUPPRESS_MAP_NAME (filter
))
917 /* Default route check. */
918 if (CHECK_FLAG (rsclient
->af_sflags
[afi
][safi
],
919 PEER_STATUS_DEFAULT_ORIGINATE
))
921 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
924 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
926 #endif /* HAVE_IPV6 */
929 /* If the attribute has originator-id and it is same as remote
931 if (ri
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
933 if (IPV4_ADDR_SAME (&rsclient
->remote_id
, &ri
->attr
->originator_id
))
935 if (BGP_DEBUG (filter
, FILTER
))
936 zlog (rsclient
->log
, LOG_DEBUG
,
937 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
939 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
945 /* ORF prefix-list filter check */
946 if (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
947 && (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
948 || CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
949 if (rsclient
->orf_plist
[afi
][safi
])
951 if (prefix_list_apply (rsclient
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
955 /* Output filter check. */
956 if (bgp_output_filter (rsclient
, p
, ri
->attr
, afi
, safi
) == FILTER_DENY
)
958 if (BGP_DEBUG (filter
, FILTER
))
959 zlog (rsclient
->log
, LOG_DEBUG
,
960 "%s [Update:SEND] %s/%d is filtered",
962 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
967 #ifdef BGP_SEND_ASPATH_CHECK
968 /* AS path loop check. */
969 if (aspath_loop_check (ri
->attr
->aspath
, rsclient
->as
))
971 if (BGP_DEBUG (filter
, FILTER
))
972 zlog (rsclient
->log
, LOG_DEBUG
,
973 "%s [Update:SEND] suppress announcement to peer AS %d is AS path.",
974 rsclient
->host
, rsclient
->as
);
977 #endif /* BGP_SEND_ASPATH_CHECK */
979 /* For modify attribute, copy it to temporary structure. */
983 if ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
985 || (p
->family
== AF_INET6
&&
986 IN6_IS_ADDR_UNSPECIFIED(&attr
->mp_nexthop_global
))
987 #endif /* HAVE_IPV6 */
990 /* Set IPv4 nexthop. */
991 if (p
->family
== AF_INET
)
993 if (safi
== SAFI_MPLS_VPN
)
994 memcpy (&attr
->mp_nexthop_global_in
, &rsclient
->nexthop
.v4
,
997 memcpy (&attr
->nexthop
, &rsclient
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
1000 /* Set IPv6 nexthop. */
1001 if (p
->family
== AF_INET6
)
1003 /* IPv6 global nexthop must be included. */
1004 memcpy (&attr
->mp_nexthop_global
, &rsclient
->nexthop
.v6_global
,
1007 attr
->mp_nexthop_len
= 16;
1009 #endif /* HAVE_IPV6 */
1013 if (p
->family
== AF_INET6
)
1015 /* Left nexthop_local unchanged if so configured. */
1016 if ( CHECK_FLAG (rsclient
->af_flags
[afi
][safi
],
1017 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
1019 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->mp_nexthop_local
) )
1020 attr
->mp_nexthop_len
=32;
1022 attr
->mp_nexthop_len
=16;
1025 /* Default nexthop_local treatment for RS-Clients */
1028 /* Announcer and RS-Client are both in the same network */
1029 if (rsclient
->shared_network
&& from
->shared_network
&&
1030 (rsclient
->ifindex
== from
->ifindex
))
1032 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->mp_nexthop_local
) )
1033 attr
->mp_nexthop_len
=32;
1035 attr
->mp_nexthop_len
=16;
1038 /* Set link-local address for shared network peer. */
1039 else if (rsclient
->shared_network
1040 && IN6_IS_ADDR_LINKLOCAL (&rsclient
->nexthop
.v6_local
))
1042 memcpy (&attr
->mp_nexthop_local
, &rsclient
->nexthop
.v6_local
,
1044 attr
->mp_nexthop_len
= 32;
1048 attr
->mp_nexthop_len
= 16;
1052 #endif /* HAVE_IPV6 */
1055 /* If this is EBGP peer and remove-private-AS is set. */
1056 if (peer_sort (rsclient
) == BGP_PEER_EBGP
1057 && peer_af_flag_check (rsclient
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
)
1058 && aspath_private_as_check (attr
->aspath
))
1059 attr
->aspath
= aspath_empty_get ();
1061 /* Route map & unsuppress-map apply. */
1062 if (ROUTE_MAP_OUT_NAME (filter
) || ri
->suppress
)
1064 info
.peer
= rsclient
;
1067 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_OUT
);
1070 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
1072 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
1074 rsclient
->rmap_type
= 0;
1076 if (ret
== RMAP_DENYMATCH
)
1078 bgp_attr_flush (attr
);
1086 struct bgp_info_pair
1088 struct bgp_info
*old
;
1089 struct bgp_info
*new;
1093 bgp_best_selection (struct bgp
*bgp
, struct bgp_node
*rn
, struct bgp_info_pair
*result
)
1095 struct bgp_info
*new_select
;
1096 struct bgp_info
*old_select
;
1097 struct bgp_info
*ri
;
1098 struct bgp_info
*ri1
;
1099 struct bgp_info
*ri2
;
1101 /* bgp deterministic-med */
1103 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1104 for (ri1
= rn
->info
; ri1
; ri1
= ri1
->next
)
1106 if (CHECK_FLAG (ri1
->flags
, BGP_INFO_DMED_CHECK
))
1108 if (BGP_INFO_HOLDDOWN (ri1
))
1113 for (ri2
= ri1
->next
; ri2
; ri2
= ri2
->next
)
1115 if (CHECK_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
))
1117 if (BGP_INFO_HOLDDOWN (ri2
))
1120 if (aspath_cmp_left (ri1
->attr
->aspath
, ri2
->attr
->aspath
)
1121 || aspath_cmp_left_confed (ri1
->attr
->aspath
,
1124 if (bgp_info_cmp (bgp
, ri2
, new_select
))
1126 UNSET_FLAG (new_select
->flags
, BGP_INFO_DMED_SELECTED
);
1130 SET_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
);
1133 SET_FLAG (new_select
->flags
, BGP_INFO_DMED_CHECK
);
1134 SET_FLAG (new_select
->flags
, BGP_INFO_DMED_SELECTED
);
1137 /* Check old selected route and new selected route. */
1140 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1142 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
1145 if (BGP_INFO_HOLDDOWN (ri
))
1148 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
)
1149 && (! CHECK_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
)))
1151 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_CHECK
);
1154 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_CHECK
);
1155 UNSET_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
);
1157 if (bgp_info_cmp (bgp
, ri
, new_select
))
1161 result
->old
= old_select
;
1162 result
->new = new_select
;
1168 bgp_process_announce_selected (struct peer
*peer
, struct bgp_info
*selected
,
1169 struct bgp_node
*rn
, struct attr
*attr
, afi_t afi
, safi_t safi
)
1175 /* Announce route to Established peer. */
1176 if (peer
->status
!= Established
)
1179 /* Address family configuration check. */
1180 if (! peer
->afc_nego
[afi
][safi
])
1183 /* First update is deferred until ORF or ROUTE-REFRESH is received */
1184 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
1185 PEER_STATUS_ORF_WAIT_REFRESH
))
1188 switch (rn
->table
->type
)
1190 case BGP_TABLE_MAIN
:
1191 /* Announcement to peer->conf. If the route is filtered,
1193 if (selected
&& bgp_announce_check (selected
, peer
, p
, attr
, afi
, safi
))
1194 bgp_adj_out_set (rn
, peer
, p
, attr
, afi
, safi
, selected
);
1196 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1198 case BGP_TABLE_RSCLIENT
:
1199 /* Announcement to peer->conf. If the route is filtered,
1201 if (selected
&& bgp_announce_check_rsclient
1202 (selected
, peer
, p
, attr
, afi
, safi
))
1203 bgp_adj_out_set (rn
, peer
, p
, attr
, afi
, safi
, selected
);
1205 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1211 struct bgp_process_queue
1214 struct bgp_node
*rn
;
1219 static wq_item_status
1220 bgp_process_rsclient (struct bgp_process_queue
*pq
)
1222 struct bgp
*bgp
= pq
->bgp
;
1223 struct bgp_node
*rn
= pq
->rn
;
1224 afi_t afi
= pq
->afi
;
1225 safi_t safi
= pq
->safi
;
1226 struct bgp_info
*new_select
;
1227 struct bgp_info
*old_select
;
1228 struct bgp_info_pair old_and_new
;
1230 struct listnode
*node
, *nnode
;
1231 struct peer
*rsclient
= rn
->table
->owner
;
1233 /* we shouldn't run if the clear_route_node queue is still running
1234 * or scheduled to run, or we can race with session coming up
1235 * and adding routes back before we've cleared them
1237 if (bm
->clear_node_queue
&& bm
->clear_node_queue
->thread
)
1238 return WQ_QUEUE_BLOCKED
;
1240 /* Best path selection. */
1241 bgp_best_selection (bgp
, rn
, &old_and_new
);
1242 new_select
= old_and_new
.new;
1243 old_select
= old_and_new
.old
;
1245 if (CHECK_FLAG (rsclient
->sflags
, PEER_STATUS_GROUP
))
1247 for (ALL_LIST_ELEMENTS (rsclient
->group
->peer
, node
, nnode
, rsclient
))
1249 /* Nothing to do. */
1250 if (old_select
&& old_select
== new_select
)
1251 if (!CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1255 UNSET_FLAG (old_select
->flags
, BGP_INFO_SELECTED
);
1258 SET_FLAG (new_select
->flags
, BGP_INFO_SELECTED
);
1259 UNSET_FLAG (new_select
->flags
, BGP_INFO_ATTR_CHANGED
);
1262 bgp_process_announce_selected (rsclient
, new_select
, rn
, &attr
,
1268 bgp_process_announce_selected (rsclient
, new_select
, rn
,
1272 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1276 static wq_item_status
1277 bgp_process_main (struct bgp_process_queue
*pq
)
1279 struct bgp
*bgp
= pq
->bgp
;
1280 struct bgp_node
*rn
= pq
->rn
;
1281 afi_t afi
= pq
->afi
;
1282 safi_t safi
= pq
->safi
;
1283 struct prefix
*p
= &rn
->p
;
1284 struct bgp_info
*new_select
;
1285 struct bgp_info
*old_select
;
1286 struct bgp_info_pair old_and_new
;
1287 struct listnode
*node
, *nnode
;
1291 /* we shouldn't run if the clear_route_node queue is still running
1292 * or scheduled to run, or we can race with session coming up
1293 * and adding routes back before we've cleared them
1295 if (bm
->clear_node_queue
&& bm
->clear_node_queue
->thread
)
1296 return WQ_QUEUE_BLOCKED
;
1298 /* Best path selection. */
1299 bgp_best_selection (bgp
, rn
, &old_and_new
);
1300 old_select
= old_and_new
.old
;
1301 new_select
= old_and_new
.new;
1303 /* Nothing to do. */
1304 if (old_select
&& old_select
== new_select
)
1306 if (! CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1308 if (CHECK_FLAG (old_select
->flags
, BGP_INFO_IGP_CHANGED
))
1309 bgp_zebra_announce (p
, old_select
, bgp
);
1311 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1317 UNSET_FLAG (old_select
->flags
, BGP_INFO_SELECTED
);
1320 SET_FLAG (new_select
->flags
, BGP_INFO_SELECTED
);
1321 UNSET_FLAG (new_select
->flags
, BGP_INFO_ATTR_CHANGED
);
1325 /* Check each BGP peer. */
1326 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1328 bgp_process_announce_selected (peer
, new_select
, rn
, &attr
, afi
, safi
);
1332 if (safi
== SAFI_UNICAST
&& ! bgp
->name
&&
1333 ! bgp_option_check (BGP_OPT_NO_FIB
))
1336 && new_select
->type
== ZEBRA_ROUTE_BGP
1337 && new_select
->sub_type
== BGP_ROUTE_NORMAL
)
1338 bgp_zebra_announce (p
, new_select
, bgp
);
1341 /* Withdraw the route from the kernel. */
1343 && old_select
->type
== ZEBRA_ROUTE_BGP
1344 && old_select
->sub_type
== BGP_ROUTE_NORMAL
)
1345 bgp_zebra_withdraw (p
, old_select
);
1348 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1353 bgp_processq_del (struct bgp_process_queue
*pq
)
1355 bgp_unlock_node (pq
->rn
);
1356 XFREE (MTYPE_BGP_PROCESS_QUEUE
, pq
);
1360 bgp_process_queue_init (void)
1362 bm
->process_main_queue
1363 = work_queue_new (bm
->master
, "process_main_queue");
1364 bm
->process_rsclient_queue
1365 = work_queue_new (bm
->master
, "process_rsclient_queue");
1367 if ( !(bm
->process_main_queue
&& bm
->process_rsclient_queue
) )
1369 zlog_err ("%s: Failed to allocate work queue", __func__
);
1373 bm
->process_main_queue
->spec
.workfunc
= &bgp_process_main
;
1374 bm
->process_rsclient_queue
->spec
.workfunc
= &bgp_process_rsclient
;
1375 bm
->process_main_queue
->spec
.del_item_data
= &bgp_processq_del
;
1376 bm
->process_rsclient_queue
->spec
.del_item_data
1377 = bm
->process_main_queue
->spec
.del_item_data
;
1378 bm
->process_main_queue
->spec
.max_retries
1379 = bm
->process_main_queue
->spec
.max_retries
= 0;
1380 bm
->process_rsclient_queue
->spec
.hold
1381 = bm
->process_main_queue
->spec
.hold
= 500;
1382 bm
->process_rsclient_queue
->spec
.delay
1383 = bm
->process_main_queue
->spec
.delay
= 10;
1387 bgp_process (struct bgp
*bgp
, struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
1389 struct bgp_process_queue
*pqnode
;
1391 /* already scheduled for processing? */
1392 if (CHECK_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
))
1395 if ( (bm
->process_main_queue
== NULL
) ||
1396 (bm
->process_rsclient_queue
== NULL
) )
1397 bgp_process_queue_init ();
1399 pqnode
= XCALLOC (MTYPE_BGP_PROCESS_QUEUE
,
1400 sizeof (struct bgp_process_queue
));
1404 pqnode
->rn
= bgp_lock_node (rn
); /* unlocked by bgp_processq_del */
1407 pqnode
->safi
= safi
;
1409 switch (rn
->table
->type
)
1411 case BGP_TABLE_MAIN
:
1412 work_queue_add (bm
->process_main_queue
, pqnode
);
1414 case BGP_TABLE_RSCLIENT
:
1415 work_queue_add (bm
->process_rsclient_queue
, pqnode
);
1423 bgp_maximum_prefix_restart_timer (struct thread
*thread
)
1427 peer
= THREAD_ARG (thread
);
1428 peer
->t_pmax_restart
= NULL
;
1430 if (BGP_DEBUG (events
, EVENTS
))
1431 zlog_debug ("%s Maximum-prefix restart timer expired, restore peering",
1440 bgp_maximum_prefix_overflow (struct peer
*peer
, afi_t afi
,
1441 safi_t safi
, int always
)
1443 if (!CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
1446 if (peer
->pcount
[afi
][safi
] > peer
->pmax
[afi
][safi
])
1448 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
)
1452 zlog (peer
->log
, LOG_INFO
,
1453 "%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, "
1454 "limit %ld", afi_safi_print (afi
, safi
), peer
->host
,
1455 peer
->pcount
[afi
][safi
], peer
->pmax
[afi
][safi
]);
1456 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1458 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
1464 if (safi
== SAFI_MPLS_VPN
)
1465 safi
= BGP_SAFI_VPNV4
;
1467 ndata
[0] = (afi
>> 8);
1470 ndata
[3] = (peer
->pmax
[afi
][safi
] >> 24);
1471 ndata
[4] = (peer
->pmax
[afi
][safi
] >> 16);
1472 ndata
[5] = (peer
->pmax
[afi
][safi
] >> 8);
1473 ndata
[6] = (peer
->pmax
[afi
][safi
]);
1475 SET_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
);
1476 bgp_notify_send_with_data (peer
, BGP_NOTIFY_CEASE
,
1477 BGP_NOTIFY_CEASE_MAX_PREFIX
, ndata
, 7);
1480 /* restart timer start */
1481 if (peer
->pmax_restart
[afi
][safi
])
1483 peer
->v_pmax_restart
= peer
->pmax_restart
[afi
][safi
] * 60;
1485 if (BGP_DEBUG (events
, EVENTS
))
1486 zlog_debug ("%s Maximum-prefix restart timer started for %d secs",
1487 peer
->host
, peer
->v_pmax_restart
);
1489 BGP_TIMER_ON (peer
->t_pmax_restart
, bgp_maximum_prefix_restart_timer
,
1490 peer
->v_pmax_restart
);
1496 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1498 if (peer
->pcount
[afi
][safi
] > (peer
->pmax
[afi
][safi
] * peer
->pmax_threshold
[afi
][safi
] / 100))
1500 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
)
1504 zlog (peer
->log
, LOG_INFO
,
1505 "%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld",
1506 afi_safi_print (afi
, safi
), peer
->host
, peer
->pcount
[afi
][safi
],
1507 peer
->pmax
[afi
][safi
]);
1508 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
1511 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
1516 bgp_rib_remove (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
1517 afi_t afi
, safi_t safi
)
1519 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1521 /* Ignore 'pcount' for RS-client tables */
1522 if ( rn
->table
->type
== BGP_TABLE_MAIN
)
1524 peer
->pcount
[afi
][safi
]--;
1525 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1527 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1528 bgp_process (peer
->bgp
, rn
, afi
, safi
);
1530 bgp_info_delete (rn
, ri
);
1534 bgp_rib_withdraw (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
1535 afi_t afi
, safi_t safi
, int force
)
1538 int status
= BGP_DAMP_NONE
;
1540 /* Ignore 'pcount' for RS-client tables */
1541 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
) &&
1542 rn
->table
->type
== BGP_TABLE_MAIN
)
1544 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
1545 peer
->pcount
[afi
][safi
]--;
1546 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1551 if (CHECK_FLAG (peer
->bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1552 && peer_sort (peer
) == BGP_PEER_EBGP
)
1553 status
= bgp_damp_withdraw (ri
, rn
, afi
, safi
, 0);
1555 if (status
== BGP_DAMP_SUPPRESSED
)
1559 valid
= CHECK_FLAG (ri
->flags
, BGP_INFO_VALID
);
1560 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1561 bgp_process (peer
->bgp
, rn
, afi
, safi
);
1564 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1566 if (status
!= BGP_DAMP_USED
)
1567 bgp_info_delete (rn
, ri
);
1571 bgp_update_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
1572 struct attr
*attr
, struct peer
*peer
, struct prefix
*p
, int type
,
1573 int sub_type
, struct prefix_rd
*prd
, u_char
*tag
)
1575 struct bgp_node
*rn
;
1577 struct attr new_attr
;
1578 struct attr
*attr_new
;
1579 struct attr
*attr_new2
;
1580 struct bgp_info
*ri
;
1581 struct bgp_info
*new;
1583 char buf
[SU_ADDRSTRLEN
];
1585 /* Do not insert announces from a rsclient into its own 'bgp_table'. */
1586 if (peer
== rsclient
)
1590 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1592 /* Check previously received route. */
1593 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1594 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1597 /* AS path loop check. */
1598 if (aspath_loop_check (attr
->aspath
, rsclient
->as
) > peer
->allowas_in
[afi
][safi
])
1600 reason
= "as-path contains our own AS;";
1604 /* Route reflector originator ID check. */
1605 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
1606 && IPV4_ADDR_SAME (&rsclient
->remote_id
, &attr
->originator_id
))
1608 reason
= "originator is us;";
1614 /* Apply export policy. */
1615 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
) &&
1616 bgp_export_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1618 reason
= "export-policy;";
1622 attr_new2
= bgp_attr_intern (&new_attr
);
1624 /* Apply import policy. */
1625 if (bgp_import_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1627 bgp_attr_unintern (attr_new2
);
1629 reason
= "import-policy;";
1633 attr_new
= bgp_attr_intern (&new_attr
);
1634 bgp_attr_unintern (attr_new2
);
1636 /* IPv4 unicast next hop check. */
1637 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
1639 /* Next hop must not be 0.0.0.0 nor Class E address. */
1640 if (new_attr
.nexthop
.s_addr
== 0
1641 || ntohl (new_attr
.nexthop
.s_addr
) >= 0xe0000000)
1643 bgp_attr_unintern (attr_new
);
1645 reason
= "martian next-hop;";
1650 /* If the update is implicit withdraw. */
1653 ri
->uptime
= time (NULL
);
1655 /* Same attribute comes in. */
1656 if (attrhash_cmp (ri
->attr
, attr_new
))
1659 UNSET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1661 if (BGP_DEBUG (update
, UPDATE_IN
))
1662 zlog (peer
->log
, LOG_DEBUG
,
1663 "%s rcvd %s/%d for RS-client %s...duplicate ignored",
1665 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1666 p
->prefixlen
, rsclient
->host
);
1668 bgp_unlock_node (rn
);
1669 bgp_attr_unintern (attr_new
);
1674 /* Received Logging. */
1675 if (BGP_DEBUG (update
, UPDATE_IN
))
1676 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
1678 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1679 p
->prefixlen
, rsclient
->host
);
1681 /* The attribute is changed. */
1682 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1684 /* Update to new attribute. */
1685 bgp_attr_unintern (ri
->attr
);
1686 ri
->attr
= attr_new
;
1688 /* Update MPLS tag. */
1689 if (safi
== SAFI_MPLS_VPN
)
1690 memcpy (ri
->tag
, tag
, 3);
1692 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
1694 /* Process change. */
1695 bgp_process (bgp
, rn
, afi
, safi
);
1696 bgp_unlock_node (rn
);
1701 /* Received Logging. */
1702 if (BGP_DEBUG (update
, UPDATE_IN
))
1704 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
1706 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1707 p
->prefixlen
, rsclient
->host
);
1710 /* Make new BGP info. */
1711 new = bgp_info_new ();
1713 new->sub_type
= sub_type
;
1715 new->attr
= attr_new
;
1716 new->uptime
= time (NULL
);
1718 /* Update MPLS tag. */
1719 if (safi
== SAFI_MPLS_VPN
)
1720 memcpy (new->tag
, tag
, 3);
1722 SET_FLAG (new->flags
, BGP_INFO_VALID
);
1724 /* Register new BGP information. */
1725 bgp_info_add (rn
, new);
1727 /* route_node_get lock */
1728 bgp_unlock_node (rn
);
1730 /* Process change. */
1731 bgp_process (bgp
, rn
, afi
, safi
);
1737 /* This BGP update is filtered. Log the reason then update BGP entry. */
1738 if (BGP_DEBUG (update
, UPDATE_IN
))
1739 zlog (peer
->log
, LOG_DEBUG
,
1740 "%s rcvd UPDATE about %s/%d -- DENIED for RS-client %s due to: %s",
1742 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1743 p
->prefixlen
, rsclient
->host
, reason
);
1746 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
, 1);
1748 bgp_unlock_node (rn
);
1754 bgp_withdraw_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
1755 struct peer
*peer
, struct prefix
*p
, int type
, int sub_type
,
1756 struct prefix_rd
*prd
, u_char
*tag
)
1758 struct bgp_node
*rn
;
1759 struct bgp_info
*ri
;
1760 char buf
[SU_ADDRSTRLEN
];
1762 if (rsclient
== peer
)
1765 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1767 /* Lookup withdrawn route. */
1768 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1769 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1772 /* Withdraw specified route from routing table. */
1773 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1774 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
, 0);
1775 else if (BGP_DEBUG (update
, UPDATE_IN
))
1776 zlog (peer
->log
, LOG_DEBUG
,
1777 "%s Can't find the route %s/%d", peer
->host
,
1778 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1781 /* Unlock bgp_node_get() lock. */
1782 bgp_unlock_node (rn
);
1786 bgp_update_main (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
1787 afi_t afi
, safi_t safi
, int type
, int sub_type
,
1788 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
1791 int aspath_loop_count
= 0;
1792 struct bgp_node
*rn
;
1794 struct attr new_attr
;
1795 struct attr
*attr_new
;
1796 struct bgp_info
*ri
;
1797 struct bgp_info
*new;
1799 char buf
[SU_ADDRSTRLEN
];
1802 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1804 /* When peer's soft reconfiguration enabled. Record input packet in
1806 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
1807 && peer
!= bgp
->peer_self
&& ! soft_reconfig
)
1808 bgp_adj_in_set (rn
, peer
, attr
);
1810 /* Check previously received route. */
1811 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1812 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1815 /* AS path local-as loop check. */
1816 if (peer
->change_local_as
)
1818 if (! CHECK_FLAG (peer
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
1819 aspath_loop_count
= 1;
1821 if (aspath_loop_check (attr
->aspath
, peer
->change_local_as
) > aspath_loop_count
)
1823 reason
= "as-path contains our own AS;";
1828 /* AS path loop check. */
1829 if (aspath_loop_check (attr
->aspath
, bgp
->as
) > peer
->allowas_in
[afi
][safi
]
1830 || (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
1831 && aspath_loop_check(attr
->aspath
, bgp
->confed_id
)
1832 > peer
->allowas_in
[afi
][safi
]))
1834 reason
= "as-path contains our own AS;";
1838 /* Route reflector originator ID check. */
1839 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
1840 && IPV4_ADDR_SAME (&bgp
->router_id
, &attr
->originator_id
))
1842 reason
= "originator is us;";
1846 /* Route reflector cluster ID check. */
1847 if (bgp_cluster_filter (peer
, attr
))
1849 reason
= "reflected from the same cluster;";
1853 /* Apply incoming filter. */
1854 if (bgp_input_filter (peer
, p
, attr
, afi
, safi
) == FILTER_DENY
)
1860 /* Apply incoming route-map. */
1863 if (bgp_input_modifier (peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1865 reason
= "route-map;";
1869 /* IPv4 unicast next hop check. */
1870 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
1872 /* If the peer is EBGP and nexthop is not on connected route,
1874 if (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
== 1
1875 && ! bgp_nexthop_check_ebgp (afi
, &new_attr
)
1876 && ! CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
))
1878 reason
= "non-connected next-hop;";
1882 /* Next hop must not be 0.0.0.0 nor Class E address. Next hop
1883 must not be my own address. */
1884 if (bgp_nexthop_self (afi
, &new_attr
)
1885 || new_attr
.nexthop
.s_addr
== 0
1886 || ntohl (new_attr
.nexthop
.s_addr
) >= 0xe0000000)
1888 reason
= "martian next-hop;";
1893 attr_new
= bgp_attr_intern (&new_attr
);
1895 /* If the update is implicit withdraw. */
1898 ri
->uptime
= time (NULL
);
1900 /* Same attribute comes in. */
1901 if (attrhash_cmp (ri
->attr
, attr_new
))
1903 UNSET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1905 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1906 && peer_sort (peer
) == BGP_PEER_EBGP
1907 && CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1909 if (BGP_DEBUG (update
, UPDATE_IN
))
1910 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
1912 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1915 peer
->pcount
[afi
][safi
]++;
1916 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
1917 if (ret
!= BGP_DAMP_SUPPRESSED
)
1919 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
1920 bgp_process (bgp
, rn
, afi
, safi
);
1925 if (BGP_DEBUG (update
, UPDATE_IN
))
1926 zlog (peer
->log
, LOG_DEBUG
,
1927 "%s rcvd %s/%d...duplicate ignored",
1929 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1932 /* graceful restart STALE flag unset. */
1933 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
1935 UNSET_FLAG (ri
->flags
, BGP_INFO_STALE
);
1936 peer
->pcount
[afi
][safi
]++;
1940 bgp_unlock_node (rn
);
1941 bgp_attr_unintern (attr_new
);
1945 /* Received Logging. */
1946 if (BGP_DEBUG (update
, UPDATE_IN
))
1947 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
1949 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1952 /* graceful restart STALE flag unset. */
1953 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
1955 UNSET_FLAG (ri
->flags
, BGP_INFO_STALE
);
1956 peer
->pcount
[afi
][safi
]++;
1959 /* The attribute is changed. */
1960 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
1962 /* Update bgp route dampening information. */
1963 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1964 && peer_sort (peer
) == BGP_PEER_EBGP
)
1966 /* This is implicit withdraw so we should update dampening
1968 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1969 bgp_damp_withdraw (ri
, rn
, afi
, safi
, 1);
1971 peer
->pcount
[afi
][safi
]++;
1974 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
1976 /* Update to new attribute. */
1977 bgp_attr_unintern (ri
->attr
);
1978 ri
->attr
= attr_new
;
1980 /* Update MPLS tag. */
1981 if (safi
== SAFI_MPLS_VPN
)
1982 memcpy (ri
->tag
, tag
, 3);
1984 /* Update bgp route dampening information. */
1985 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1986 && peer_sort (peer
) == BGP_PEER_EBGP
)
1988 /* Now we do normal update dampening. */
1989 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
1990 if (ret
== BGP_DAMP_SUPPRESSED
)
1992 bgp_unlock_node (rn
);
1997 /* Nexthop reachability check. */
1998 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
1999 && safi
== SAFI_UNICAST
2000 && (peer_sort (peer
) == BGP_PEER_IBGP
2001 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
2002 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
2004 if (bgp_nexthop_lookup (afi
, peer
, ri
, NULL
, NULL
))
2005 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2007 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2010 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2012 /* Process change. */
2013 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2015 bgp_process (bgp
, rn
, afi
, safi
);
2016 bgp_unlock_node (rn
);
2020 /* Received Logging. */
2021 if (BGP_DEBUG (update
, UPDATE_IN
))
2023 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2025 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2029 /* Increment prefix counter */
2030 peer
->pcount
[afi
][safi
]++;
2032 /* Make new BGP info. */
2033 new = bgp_info_new ();
2035 new->sub_type
= sub_type
;
2037 new->attr
= attr_new
;
2038 new->uptime
= time (NULL
);
2040 /* Update MPLS tag. */
2041 if (safi
== SAFI_MPLS_VPN
)
2042 memcpy (new->tag
, tag
, 3);
2044 /* Nexthop reachability check. */
2045 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
2046 && safi
== SAFI_UNICAST
2047 && (peer_sort (peer
) == BGP_PEER_IBGP
2048 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
2049 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
2051 if (bgp_nexthop_lookup (afi
, peer
, new, NULL
, NULL
))
2052 SET_FLAG (new->flags
, BGP_INFO_VALID
);
2054 UNSET_FLAG (new->flags
, BGP_INFO_VALID
);
2057 SET_FLAG (new->flags
, BGP_INFO_VALID
);
2059 /* Aggregate address increment. */
2060 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
2062 /* Register new BGP information. */
2063 bgp_info_add (rn
, new);
2065 /* route_node_get lock */
2066 bgp_unlock_node (rn
);
2068 /* If maximum prefix count is configured and current prefix
2070 if (bgp_maximum_prefix_overflow (peer
, afi
, safi
, 0))
2073 /* Process change. */
2074 bgp_process (bgp
, rn
, afi
, safi
);
2078 /* This BGP update is filtered. Log the reason then update BGP
2081 if (BGP_DEBUG (update
, UPDATE_IN
))
2082 zlog (peer
->log
, LOG_DEBUG
,
2083 "%s rcvd UPDATE about %s/%d -- DENIED due to: %s",
2085 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2086 p
->prefixlen
, reason
);
2089 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
, 1);
2091 bgp_unlock_node (rn
);
2097 bgp_update (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2098 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2099 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
2101 struct peer
*rsclient
;
2102 struct listnode
*node
, *nnode
;
2106 ret
= bgp_update_main (peer
, p
, attr
, afi
, safi
, type
, sub_type
, prd
, tag
,
2111 /* Process the update for each RS-client. */
2112 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2114 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2115 bgp_update_rsclient (rsclient
, afi
, safi
, attr
, peer
, p
, type
,
2116 sub_type
, prd
, tag
);
2123 bgp_withdraw (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2124 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2125 struct prefix_rd
*prd
, u_char
*tag
)
2128 char buf
[SU_ADDRSTRLEN
];
2129 struct bgp_node
*rn
;
2130 struct bgp_info
*ri
;
2131 struct peer
*rsclient
;
2132 struct listnode
*node
, *nnode
;
2136 /* Process the withdraw for each RS-client. */
2137 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2139 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2140 bgp_withdraw_rsclient (rsclient
, afi
, safi
, peer
, p
, type
, sub_type
, prd
, tag
);
2144 if (BGP_DEBUG (update
, UPDATE_IN
))
2145 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd UPDATE about %s/%d -- withdrawn",
2147 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2151 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2153 /* If peer is soft reconfiguration enabled. Record input packet for
2154 further calculation. */
2155 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2156 && peer
!= bgp
->peer_self
)
2157 bgp_adj_in_unset (rn
, peer
);
2159 /* Lookup withdrawn route. */
2160 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2161 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2164 /* Withdraw specified route from routing table. */
2165 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2166 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
, 0);
2167 else if (BGP_DEBUG (update
, UPDATE_IN
))
2168 zlog (peer
->log
, LOG_DEBUG
,
2169 "%s Can't find the route %s/%d", peer
->host
,
2170 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2173 /* Unlock bgp_node_get() lock. */
2174 bgp_unlock_node (rn
);
2180 bgp_default_originate (struct peer
*peer
, afi_t afi
, safi_t safi
, int withdraw
)
2184 struct aspath
*aspath
;
2186 struct bgp_info binfo
;
2188 int ret
= RMAP_DENYMATCH
;
2191 from
= bgp
->peer_self
;
2193 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
2194 aspath
= attr
.aspath
;
2195 attr
.local_pref
= bgp
->default_local_pref
;
2196 memcpy (&attr
.nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
2199 str2prefix ("0.0.0.0/0", &p
);
2201 else if (afi
== AFI_IP6
)
2203 str2prefix ("::/0", &p
);
2205 /* IPv6 global nexthop must be included. */
2206 memcpy (&attr
.mp_nexthop_global
, &peer
->nexthop
.v6_global
,
2208 attr
.mp_nexthop_len
= 16;
2210 /* If the peer is on shared nextwork and we have link-local
2212 if (peer
->shared_network
2213 && !IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
2215 memcpy (&attr
.mp_nexthop_local
, &peer
->nexthop
.v6_local
,
2217 attr
.mp_nexthop_len
= 32;
2220 #endif /* HAVE_IPV6 */
2224 if (peer
->default_rmap
[afi
][safi
].name
)
2226 binfo
.peer
= bgp
->peer_self
;
2229 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_DEFAULT
);
2231 ret
= route_map_apply (peer
->default_rmap
[afi
][safi
].map
, &p
,
2234 bgp
->peer_self
->rmap_type
= 0;
2236 if (ret
== RMAP_DENYMATCH
)
2238 bgp_attr_flush (&attr
);
2245 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
2246 bgp_default_withdraw_send (peer
, afi
, safi
);
2247 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2251 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2252 bgp_default_update_send (peer
, &attr
, afi
, safi
, from
);
2255 aspath_unintern (aspath
);
2259 bgp_announce_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2260 struct bgp_table
*table
, int rsclient
)
2262 struct bgp_node
*rn
;
2263 struct bgp_info
*ri
;
2267 table
= (rsclient
) ? peer
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2269 if (safi
!= SAFI_MPLS_VPN
2270 && CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
2271 bgp_default_originate (peer
, afi
, safi
, 0);
2273 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next(rn
))
2274 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2275 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
) && ri
->peer
!= peer
)
2278 (bgp_announce_check_rsclient (ri
, peer
, &rn
->p
, &attr
, afi
, safi
))
2279 : (bgp_announce_check (ri
, peer
, &rn
->p
, &attr
, afi
, safi
)))
2280 bgp_adj_out_set (rn
, peer
, &rn
->p
, &attr
, afi
, safi
, ri
);
2282 bgp_adj_out_unset (rn
, peer
, &rn
->p
, afi
, safi
);
2287 bgp_announce_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2289 struct bgp_node
*rn
;
2290 struct bgp_table
*table
;
2292 if (peer
->status
!= Established
)
2295 if (! peer
->afc_nego
[afi
][safi
])
2298 /* First update is deferred until ORF or ROUTE-REFRESH is received */
2299 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
2302 if (safi
!= SAFI_MPLS_VPN
)
2303 bgp_announce_table (peer
, afi
, safi
, NULL
, 0);
2305 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2306 rn
= bgp_route_next(rn
))
2307 if ((table
= (rn
->info
)) != NULL
)
2308 bgp_announce_table (peer
, afi
, safi
, table
, 0);
2310 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2311 bgp_announce_table (peer
, afi
, safi
, NULL
, 1);
2315 bgp_announce_route_all (struct peer
*peer
)
2320 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2321 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2322 bgp_announce_route (peer
, afi
, safi
);
2326 bgp_soft_reconfig_table_rsclient (struct peer
*rsclient
, afi_t afi
,
2327 safi_t safi
, struct bgp_table
*table
)
2329 struct bgp_node
*rn
;
2330 struct bgp_adj_in
*ain
;
2333 table
= rsclient
->bgp
->rib
[afi
][safi
];
2335 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2336 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2338 bgp_update_rsclient (rsclient
, afi
, safi
, ain
->attr
, ain
->peer
,
2339 &rn
->p
, ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
2344 bgp_soft_reconfig_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
2346 struct bgp_table
*table
;
2347 struct bgp_node
*rn
;
2349 if (safi
!= SAFI_MPLS_VPN
)
2350 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, NULL
);
2353 for (rn
= bgp_table_top (rsclient
->bgp
->rib
[afi
][safi
]); rn
;
2354 rn
= bgp_route_next (rn
))
2355 if ((table
= rn
->info
) != NULL
)
2356 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, table
);
2360 bgp_soft_reconfig_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2361 struct bgp_table
*table
)
2364 struct bgp_node
*rn
;
2365 struct bgp_adj_in
*ain
;
2368 table
= peer
->bgp
->rib
[afi
][safi
];
2370 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2371 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2373 if (ain
->peer
== peer
)
2375 ret
= bgp_update (peer
, &rn
->p
, ain
->attr
, afi
, safi
,
2376 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
,
2380 bgp_unlock_node (rn
);
2389 bgp_soft_reconfig_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2391 struct bgp_node
*rn
;
2392 struct bgp_table
*table
;
2394 if (peer
->status
!= Established
)
2397 if (safi
!= SAFI_MPLS_VPN
)
2398 bgp_soft_reconfig_table (peer
, afi
, safi
, NULL
);
2400 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2401 rn
= bgp_route_next (rn
))
2402 if ((table
= rn
->info
) != NULL
)
2403 bgp_soft_reconfig_table (peer
, afi
, safi
, table
);
2406 struct bgp_clear_node_queue
2408 struct bgp_node
*rn
;
2414 static wq_item_status
2415 bgp_clear_route_node (struct bgp_clear_node_queue
*cq
)
2417 struct bgp_adj_in
*ain
;
2418 struct bgp_adj_out
*aout
;
2419 struct bgp_info
*ri
;
2421 assert (cq
->rn
&& cq
->peer
);
2423 for (ri
= cq
->rn
->info
; ri
; ri
= ri
->next
)
2424 if (ri
->peer
== cq
->peer
)
2426 /* graceful restart STALE flag set. */
2427 if (CHECK_FLAG (cq
->peer
->sflags
, PEER_STATUS_NSF_WAIT
)
2428 && cq
->peer
->nsf
[cq
->afi
][cq
->safi
]
2429 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
)
2430 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
)
2431 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
))
2433 SET_FLAG (ri
->flags
, BGP_INFO_STALE
);
2434 cq
->peer
->pcount
[cq
->afi
][cq
->safi
]--;
2437 bgp_rib_remove (cq
->rn
, ri
, cq
->peer
, cq
->afi
, cq
->safi
);
2440 for (ain
= cq
->rn
->adj_in
; ain
; ain
= ain
->next
)
2441 if (ain
->peer
== cq
->peer
)
2443 bgp_adj_in_remove (cq
->rn
, ain
);
2444 bgp_unlock_node (cq
->rn
);
2447 for (aout
= cq
->rn
->adj_out
; aout
; aout
= aout
->next
)
2448 if (aout
->peer
== cq
->peer
)
2450 bgp_adj_out_remove (cq
->rn
, aout
, cq
->peer
, cq
->afi
, cq
->safi
);
2451 bgp_unlock_node (cq
->rn
);
2458 bgp_clear_node_queue_del (struct bgp_clear_node_queue
*cq
)
2460 bgp_unlock_node (cq
->rn
);
2461 peer_unlock (cq
->peer
); /* bgp_clear_node_queue_del */
2462 XFREE (MTYPE_BGP_CLEAR_NODE_QUEUE
, cq
);
2466 bgp_clear_node_complete (struct work_queue
*wq
)
2468 /* unplug the 2 processing queues */
2469 if (bm
->process_main_queue
)
2470 work_queue_unplug (bm
->process_main_queue
);
2471 if (bm
->process_rsclient_queue
)
2472 work_queue_unplug (bm
->process_rsclient_queue
);
2476 bgp_clear_node_queue_init (void)
2478 if ( (bm
->clear_node_queue
2479 = work_queue_new (bm
->master
, "clear_route_node")) == NULL
)
2481 zlog_err ("%s: Failed to allocate work queue", __func__
);
2484 bm
->clear_node_queue
->spec
.hold
= 10;
2485 bm
->clear_node_queue
->spec
.delay
= 0; /* no gathering to be gained */
2486 bm
->clear_node_queue
->spec
.workfunc
= &bgp_clear_route_node
;
2487 bm
->clear_node_queue
->spec
.del_item_data
= &bgp_clear_node_queue_del
;
2488 bm
->clear_node_queue
->spec
.completion_func
= &bgp_clear_node_complete
;
2489 bm
->clear_node_queue
->spec
.max_retries
= 0;
2493 bgp_clear_route_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2494 struct bgp_table
*table
, struct peer
*rsclient
)
2496 struct bgp_clear_node_queue
*cqnode
;
2497 struct bgp_node
*rn
;
2500 table
= (rsclient
) ? rsclient
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2502 /* If still no table => afi/safi isn't configured at all or smth. */
2506 if (bm
->clear_node_queue
== NULL
)
2507 bgp_clear_node_queue_init ();
2509 /* plug the two bgp_process queues to avoid any chance of racing
2510 * with a session coming back up and adding routes before we've
2511 * cleared them all. We'll unplug them with completion callback.
2513 if (bm
->process_main_queue
)
2514 work_queue_plug (bm
->process_main_queue
);
2515 if (bm
->process_rsclient_queue
)
2516 work_queue_plug (bm
->process_rsclient_queue
);
2518 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2520 if (rn
->info
== NULL
)
2523 if ( (cqnode
= XCALLOC (MTYPE_BGP_CLEAR_NODE_QUEUE
,
2524 sizeof (struct bgp_clear_node_queue
))) == NULL
)
2527 cqnode
->rn
= bgp_lock_node (rn
); /* unlocked: bgp_clear_node_queue_del */
2529 cqnode
->safi
= safi
;
2530 cqnode
->peer
= peer_lock (peer
); /* bgp_clear_node_queue_del */
2531 work_queue_add (bm
->clear_node_queue
, cqnode
);
2537 bgp_clear_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2539 struct bgp_node
*rn
;
2540 struct bgp_table
*table
;
2541 struct peer
*rsclient
;
2542 struct listnode
*node
, *nnode
;
2544 if (safi
!= SAFI_MPLS_VPN
)
2545 bgp_clear_route_table (peer
, afi
, safi
, NULL
, NULL
);
2547 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2548 rn
= bgp_route_next (rn
))
2549 if ((table
= rn
->info
) != NULL
)
2550 bgp_clear_route_table (peer
, afi
, safi
, table
, NULL
);
2552 for (ALL_LIST_ELEMENTS (peer
->bgp
->rsclient
, node
, nnode
, rsclient
))
2554 if (CHECK_FLAG(rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2555 bgp_clear_route_table (peer
, afi
, safi
, NULL
, rsclient
);
2560 bgp_clear_route_all (struct peer
*peer
)
2565 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2566 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2567 bgp_clear_route (peer
, afi
, safi
);
2571 bgp_clear_adj_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2573 struct bgp_table
*table
;
2574 struct bgp_node
*rn
;
2575 struct bgp_adj_in
*ain
;
2577 table
= peer
->bgp
->rib
[afi
][safi
];
2579 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2580 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2581 if (ain
->peer
== peer
)
2583 bgp_adj_in_remove (rn
, ain
);
2584 bgp_unlock_node (rn
);
2590 bgp_clear_stale_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2592 struct bgp_node
*rn
;
2593 struct bgp_info
*ri
;
2594 struct bgp_table
*table
;
2596 table
= peer
->bgp
->rib
[afi
][safi
];
2598 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2600 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2601 if (ri
->peer
== peer
)
2603 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2604 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2610 /* Delete all kernel routes. */
2612 bgp_cleanup_routes ()
2615 struct listnode
*node
, *nnode
;
2616 struct bgp_node
*rn
;
2617 struct bgp_table
*table
;
2618 struct bgp_info
*ri
;
2620 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
2622 table
= bgp
->rib
[AFI_IP
][SAFI_UNICAST
];
2624 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2625 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2626 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
2627 && ri
->type
== ZEBRA_ROUTE_BGP
2628 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
2629 bgp_zebra_withdraw (&rn
->p
, ri
);
2631 table
= bgp
->rib
[AFI_IP6
][SAFI_UNICAST
];
2633 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2634 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2635 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
2636 && ri
->type
== ZEBRA_ROUTE_BGP
2637 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
2638 bgp_zebra_withdraw (&rn
->p
, ri
);
2646 bgp_zclient_reset ();
2647 access_list_reset ();
2648 prefix_list_reset ();
2651 /* Parse NLRI stream. Withdraw NLRI is recognized by NULL attr
2654 bgp_nlri_parse (struct peer
*peer
, struct attr
*attr
, struct bgp_nlri
*packet
)
2662 /* Check peer status. */
2663 if (peer
->status
!= Established
)
2667 lim
= pnt
+ packet
->length
;
2669 for (; pnt
< lim
; pnt
+= psize
)
2671 /* Clear prefix structure. */
2672 memset (&p
, 0, sizeof (struct prefix
));
2674 /* Fetch prefix length. */
2675 p
.prefixlen
= *pnt
++;
2676 p
.family
= afi2family (packet
->afi
);
2678 /* Already checked in nlri_sanity_check(). We do double check
2680 if ((packet
->afi
== AFI_IP
&& p
.prefixlen
> 32)
2681 || (packet
->afi
== AFI_IP6
&& p
.prefixlen
> 128))
2684 /* Packet size overflow check. */
2685 psize
= PSIZE (p
.prefixlen
);
2687 /* When packet overflow occur return immediately. */
2688 if (pnt
+ psize
> lim
)
2691 /* Fetch prefix from NLRI packet. */
2692 memcpy (&p
.u
.prefix
, pnt
, psize
);
2694 /* Check address. */
2695 if (packet
->afi
== AFI_IP
&& packet
->safi
== SAFI_UNICAST
)
2697 if (IN_CLASSD (ntohl (p
.u
.prefix4
.s_addr
)))
2700 * From draft-ietf-idr-bgp4-22, Section 6.3:
2701 * If a BGP router receives an UPDATE message with a
2702 * semantically incorrect NLRI field, in which a prefix is
2703 * semantically incorrect (eg. an unexpected multicast IP
2704 * address), it should ignore the prefix.
2706 zlog (peer
->log
, LOG_ERR
,
2707 "IPv4 unicast NLRI is multicast address %s",
2708 inet_ntoa (p
.u
.prefix4
));
2715 /* Check address. */
2716 if (packet
->afi
== AFI_IP6
&& packet
->safi
== SAFI_UNICAST
)
2718 if (IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
2722 zlog (peer
->log
, LOG_WARNING
,
2723 "IPv6 link-local NLRI received %s ignore this NLRI",
2724 inet_ntop (AF_INET6
, &p
.u
.prefix6
, buf
, BUFSIZ
));
2729 #endif /* HAVE_IPV6 */
2731 /* Normal process. */
2733 ret
= bgp_update (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
2734 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
, 0);
2736 ret
= bgp_withdraw (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
2737 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
2739 /* Address family configuration mismatch or maximum-prefix count
2745 /* Packet length consistency check. */
2752 /* NLRI encode syntax check routine. */
2754 bgp_nlri_sanity_check (struct peer
*peer
, int afi
, u_char
*pnt
,
2763 /* RFC1771 6.3 The NLRI field in the UPDATE message is checked for
2764 syntactic validity. If the field is syntactically incorrect,
2765 then the Error Subcode is set to Invalid Network Field. */
2771 /* Prefix length check. */
2772 if ((afi
== AFI_IP
&& prefixlen
> 32)
2773 || (afi
== AFI_IP6
&& prefixlen
> 128))
2775 plog_err (peer
->log
,
2776 "%s [Error] Update packet error (wrong prefix length %d)",
2777 peer
->host
, prefixlen
);
2778 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
2779 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
2783 /* Packet size overflow check. */
2784 psize
= PSIZE (prefixlen
);
2786 if (pnt
+ psize
> end
)
2788 plog_err (peer
->log
,
2789 "%s [Error] Update packet error"
2790 " (prefix data overflow prefix size is %d)",
2792 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
2793 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
2800 /* Packet length consistency check. */
2803 plog_err (peer
->log
,
2804 "%s [Error] Update packet error"
2805 " (prefix length mismatch with total length)",
2807 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
2808 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
2814 static struct bgp_static
*
2817 struct bgp_static
*new;
2818 new = XMALLOC (MTYPE_BGP_STATIC
, sizeof (struct bgp_static
));
2819 memset (new, 0, sizeof (struct bgp_static
));
2824 bgp_static_free (struct bgp_static
*bgp_static
)
2826 if (bgp_static
->rmap
.name
)
2827 free (bgp_static
->rmap
.name
);
2828 XFREE (MTYPE_BGP_STATIC
, bgp_static
);
2832 bgp_static_withdraw_rsclient (struct bgp
*bgp
, struct peer
*rsclient
,
2833 struct prefix
*p
, afi_t afi
, safi_t safi
)
2835 struct bgp_node
*rn
;
2836 struct bgp_info
*ri
;
2838 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
2840 /* Check selected route and self inserted route. */
2841 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2842 if (ri
->peer
== bgp
->peer_self
2843 && ri
->type
== ZEBRA_ROUTE_BGP
2844 && ri
->sub_type
== BGP_ROUTE_STATIC
)
2847 /* Withdraw static BGP route from routing table. */
2850 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
2851 bgp_process (bgp
, rn
, afi
, safi
);
2852 bgp_info_delete (rn
, ri
);
2855 /* Unlock bgp_node_lookup. */
2856 bgp_unlock_node (rn
);
2860 bgp_static_update_rsclient (struct peer
*rsclient
, struct prefix
*p
,
2861 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
2863 struct bgp_node
*rn
;
2864 struct bgp_info
*ri
;
2865 struct bgp_info
*new;
2866 struct bgp_info info
;
2867 struct attr new_attr
;
2868 struct attr
*attr_new
;
2872 char buf
[SU_ADDRSTRLEN
];
2874 bgp
= rsclient
->bgp
;
2876 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
2878 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
2881 attr
.nexthop
= bgp_static
->igpnexthop
;
2882 attr
.med
= bgp_static
->igpmetric
;
2883 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
2888 /* Apply network route-map for export to this rsclient. */
2889 if (bgp_static
->rmap
.name
)
2891 info
.peer
= rsclient
;
2892 info
.attr
= &new_attr
;
2894 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
2895 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
2897 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
2899 rsclient
->rmap_type
= 0;
2901 if (ret
== RMAP_DENYMATCH
)
2903 /* Free uninterned attribute. */
2904 bgp_attr_flush (&new_attr
);
2906 /* Unintern original. */
2907 aspath_unintern (attr
.aspath
);
2908 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
2912 attr_new
= bgp_attr_intern (&new_attr
);
2915 attr_new
= bgp_attr_intern (&attr
);
2917 new_attr
= *attr_new
;
2919 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
2921 if (bgp_import_modifier (rsclient
, bgp
->peer_self
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
2923 /* This BGP update is filtered. Log the reason then update BGP entry. */
2924 if (BGP_DEBUG (update
, UPDATE_IN
))
2925 zlog (rsclient
->log
, LOG_DEBUG
,
2926 "Static UPDATE about %s/%d -- DENIED for RS-client %s due to: import-policy",
2927 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2928 p
->prefixlen
, rsclient
->host
);
2930 bgp
->peer_self
->rmap_type
= 0;
2932 bgp_attr_unintern (attr_new
);
2933 aspath_unintern (attr
.aspath
);
2935 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
2940 bgp
->peer_self
->rmap_type
= 0;
2942 bgp_attr_unintern (attr_new
);
2943 attr_new
= bgp_attr_intern (&new_attr
);
2945 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2946 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
2947 && ri
->sub_type
== BGP_ROUTE_STATIC
)
2952 if (attrhash_cmp (ri
->attr
, attr_new
))
2954 bgp_unlock_node (rn
);
2955 bgp_attr_unintern (attr_new
);
2956 aspath_unintern (attr
.aspath
);
2961 /* The attribute is changed. */
2962 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
2964 /* Rewrite BGP route information. */
2965 bgp_attr_unintern (ri
->attr
);
2966 ri
->attr
= attr_new
;
2967 ri
->uptime
= time (NULL
);
2969 /* Process change. */
2970 bgp_process (bgp
, rn
, afi
, safi
);
2971 bgp_unlock_node (rn
);
2972 aspath_unintern (attr
.aspath
);
2977 /* Make new BGP info. */
2978 new = bgp_info_new ();
2979 new->type
= ZEBRA_ROUTE_BGP
;
2980 new->sub_type
= BGP_ROUTE_STATIC
;
2981 new->peer
= bgp
->peer_self
;
2982 SET_FLAG (new->flags
, BGP_INFO_VALID
);
2983 new->attr
= attr_new
;
2984 new->uptime
= time (NULL
);
2986 /* Register new BGP information. */
2987 bgp_info_add (rn
, new);
2989 /* route_node_get lock */
2990 bgp_unlock_node (rn
);
2992 /* Process change. */
2993 bgp_process (bgp
, rn
, afi
, safi
);
2995 /* Unintern original. */
2996 aspath_unintern (attr
.aspath
);
3000 bgp_static_update_main (struct bgp
*bgp
, struct prefix
*p
,
3001 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3003 struct bgp_node
*rn
;
3004 struct bgp_info
*ri
;
3005 struct bgp_info
*new;
3006 struct bgp_info info
;
3008 struct attr attr_tmp
;
3009 struct attr
*attr_new
;
3012 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3014 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3017 attr
.nexthop
= bgp_static
->igpnexthop
;
3018 attr
.med
= bgp_static
->igpmetric
;
3019 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3022 /* Apply route-map. */
3023 if (bgp_static
->rmap
.name
)
3026 info
.peer
= bgp
->peer_self
;
3027 info
.attr
= &attr_tmp
;
3029 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3031 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3033 bgp
->peer_self
->rmap_type
= 0;
3035 if (ret
== RMAP_DENYMATCH
)
3037 /* Free uninterned attribute. */
3038 bgp_attr_flush (&attr_tmp
);
3040 /* Unintern original. */
3041 aspath_unintern (attr
.aspath
);
3042 bgp_static_withdraw (bgp
, p
, afi
, safi
);
3045 attr_new
= bgp_attr_intern (&attr_tmp
);
3048 attr_new
= bgp_attr_intern (&attr
);
3050 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3051 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3052 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3057 if (attrhash_cmp (ri
->attr
, attr_new
))
3059 bgp_unlock_node (rn
);
3060 bgp_attr_unintern (attr_new
);
3061 aspath_unintern (attr
.aspath
);
3066 /* The attribute is changed. */
3067 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
3069 /* Rewrite BGP route information. */
3070 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3071 bgp_attr_unintern (ri
->attr
);
3072 ri
->attr
= attr_new
;
3073 ri
->uptime
= time (NULL
);
3075 /* Process change. */
3076 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
3077 bgp_process (bgp
, rn
, afi
, safi
);
3078 bgp_unlock_node (rn
);
3079 aspath_unintern (attr
.aspath
);
3084 /* Make new BGP info. */
3085 new = bgp_info_new ();
3086 new->type
= ZEBRA_ROUTE_BGP
;
3087 new->sub_type
= BGP_ROUTE_STATIC
;
3088 new->peer
= bgp
->peer_self
;
3089 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3090 new->attr
= attr_new
;
3091 new->uptime
= time (NULL
);
3093 /* Aggregate address increment. */
3094 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3096 /* Register new BGP information. */
3097 bgp_info_add (rn
, new);
3099 /* route_node_get lock */
3100 bgp_unlock_node (rn
);
3102 /* Process change. */
3103 bgp_process (bgp
, rn
, afi
, safi
);
3105 /* Unintern original. */
3106 aspath_unintern (attr
.aspath
);
3110 bgp_static_update (struct bgp
*bgp
, struct prefix
*p
,
3111 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3113 struct peer
*rsclient
;
3114 struct listnode
*node
, *nnode
;
3116 bgp_static_update_main (bgp
, p
, bgp_static
, afi
, safi
);
3118 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
3120 bgp_static_update_rsclient (rsclient
, p
, bgp_static
, afi
, safi
);
3125 bgp_static_update_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
3126 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
3128 struct bgp_node
*rn
;
3129 struct bgp_info
*new;
3131 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3133 /* Make new BGP info. */
3134 new = bgp_info_new ();
3135 new->type
= ZEBRA_ROUTE_BGP
;
3136 new->sub_type
= BGP_ROUTE_STATIC
;
3137 new->peer
= bgp
->peer_self
;
3138 new->attr
= bgp_attr_default_intern (BGP_ORIGIN_IGP
);
3139 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3140 new->uptime
= time (NULL
);
3141 memcpy (new->tag
, tag
, 3);
3143 /* Aggregate address increment. */
3144 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3146 /* Register new BGP information. */
3147 bgp_info_add (rn
, new);
3149 /* route_node_get lock */
3150 bgp_unlock_node (rn
);
3152 /* Process change. */
3153 bgp_process (bgp
, rn
, afi
, safi
);
3157 bgp_static_withdraw (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3160 struct bgp_node
*rn
;
3161 struct bgp_info
*ri
;
3163 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3165 /* Check selected route and self inserted route. */
3166 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3167 if (ri
->peer
== bgp
->peer_self
3168 && ri
->type
== ZEBRA_ROUTE_BGP
3169 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3172 /* Withdraw static BGP route from routing table. */
3175 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3176 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
3177 bgp_process (bgp
, rn
, afi
, safi
);
3178 bgp_info_delete (rn
, ri
);
3181 /* Unlock bgp_node_lookup. */
3182 bgp_unlock_node (rn
);
3186 bgp_check_local_routes_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
3188 struct bgp_static
*bgp_static
;
3190 struct bgp_node
*rn
;
3193 bgp
= rsclient
->bgp
;
3195 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3196 if ((bgp_static
= rn
->info
) != NULL
)
3200 bgp_static_update_rsclient (rsclient
, p
, bgp_static
,
3206 bgp_static_withdraw_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
3207 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
3209 struct bgp_node
*rn
;
3210 struct bgp_info
*ri
;
3212 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3214 /* Check selected route and self inserted route. */
3215 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3216 if (ri
->peer
== bgp
->peer_self
3217 && ri
->type
== ZEBRA_ROUTE_BGP
3218 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3221 /* Withdraw static BGP route from routing table. */
3224 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3225 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
3226 bgp_process (bgp
, rn
, afi
, safi
);
3227 bgp_info_delete (rn
, ri
);
3230 /* Unlock bgp_node_lookup. */
3231 bgp_unlock_node (rn
);
3234 /* Configure static BGP network. When user don't run zebra, static
3235 route should be installed as valid. */
3237 bgp_static_set (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3238 u_int16_t afi
, u_char safi
, const char *rmap
, int backdoor
)
3242 struct bgp_static
*bgp_static
;
3243 struct bgp_node
*rn
;
3244 int need_update
= 0;
3246 /* Convert IP prefix string to struct prefix. */
3247 ret
= str2prefix (ip_str
, &p
);
3250 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3254 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3256 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3260 #endif /* HAVE_IPV6 */
3264 /* Set BGP static route configuration. */
3265 rn
= bgp_node_get (bgp
->route
[afi
][safi
], &p
);
3269 /* Configuration change. */
3270 bgp_static
= rn
->info
;
3272 /* Check previous routes are installed into BGP. */
3273 if (! bgp_static
->backdoor
&& bgp_static
->valid
)
3276 bgp_static
->backdoor
= backdoor
;
3279 if (bgp_static
->rmap
.name
)
3280 free (bgp_static
->rmap
.name
);
3281 bgp_static
->rmap
.name
= strdup (rmap
);
3282 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
3286 if (bgp_static
->rmap
.name
)
3287 free (bgp_static
->rmap
.name
);
3288 bgp_static
->rmap
.name
= NULL
;
3289 bgp_static
->rmap
.map
= NULL
;
3290 bgp_static
->valid
= 0;
3292 bgp_unlock_node (rn
);
3296 /* New configuration. */
3297 bgp_static
= bgp_static_new ();
3298 bgp_static
->backdoor
= backdoor
;
3299 bgp_static
->valid
= 0;
3300 bgp_static
->igpmetric
= 0;
3301 bgp_static
->igpnexthop
.s_addr
= 0;
3304 if (bgp_static
->rmap
.name
)
3305 free (bgp_static
->rmap
.name
);
3306 bgp_static
->rmap
.name
= strdup (rmap
);
3307 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
3309 rn
->info
= bgp_static
;
3312 /* If BGP scan is not enabled, we should install this route here. */
3313 if (! bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3315 bgp_static
->valid
= 1;
3318 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
3320 if (! bgp_static
->backdoor
)
3321 bgp_static_update (bgp
, &p
, bgp_static
, afi
, safi
);
3327 /* Configure static BGP network. */
3329 bgp_static_unset (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3330 u_int16_t afi
, u_char safi
)
3334 struct bgp_static
*bgp_static
;
3335 struct bgp_node
*rn
;
3337 /* Convert IP prefix string to struct prefix. */
3338 ret
= str2prefix (ip_str
, &p
);
3341 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3345 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3347 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3351 #endif /* HAVE_IPV6 */
3355 rn
= bgp_node_lookup (bgp
->route
[afi
][safi
], &p
);
3358 vty_out (vty
, "%% Can't find specified static route configuration.%s",
3363 bgp_static
= rn
->info
;
3365 /* Update BGP RIB. */
3366 if (! bgp_static
->backdoor
)
3367 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
3369 /* Clear configuration. */
3370 bgp_static_free (bgp_static
);
3372 bgp_unlock_node (rn
);
3373 bgp_unlock_node (rn
);
3378 /* Called from bgp_delete(). Delete all static routes from the BGP
3381 bgp_static_delete (struct bgp
*bgp
)
3385 struct bgp_node
*rn
;
3386 struct bgp_node
*rm
;
3387 struct bgp_table
*table
;
3388 struct bgp_static
*bgp_static
;
3390 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
3391 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
3392 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3393 if (rn
->info
!= NULL
)
3395 if (safi
== SAFI_MPLS_VPN
)
3399 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
3401 bgp_static
= rn
->info
;
3402 bgp_static_withdraw_vpnv4 (bgp
, &rm
->p
,
3403 AFI_IP
, SAFI_MPLS_VPN
,
3404 (struct prefix_rd
*)&rn
->p
,
3406 bgp_static_free (bgp_static
);
3408 bgp_unlock_node (rn
);
3413 bgp_static
= rn
->info
;
3414 bgp_static_withdraw (bgp
, &rn
->p
, afi
, safi
);
3415 bgp_static_free (bgp_static
);
3417 bgp_unlock_node (rn
);
3423 bgp_static_set_vpnv4 (struct vty
*vty
, const char *ip_str
, const char *rd_str
,
3424 const char *tag_str
)
3428 struct prefix_rd prd
;
3430 struct bgp_node
*prn
;
3431 struct bgp_node
*rn
;
3432 struct bgp_table
*table
;
3433 struct bgp_static
*bgp_static
;
3438 ret
= str2prefix (ip_str
, &p
);
3441 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3446 ret
= str2prefix_rd (rd_str
, &prd
);
3449 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
3453 ret
= str2tag (tag_str
, tag
);
3456 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
3460 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
3461 (struct prefix
*)&prd
);
3462 if (prn
->info
== NULL
)
3463 prn
->info
= bgp_table_init ();
3465 bgp_unlock_node (prn
);
3468 rn
= bgp_node_get (table
, &p
);
3472 vty_out (vty
, "%% Same network configuration exists%s", VTY_NEWLINE
);
3473 bgp_unlock_node (rn
);
3477 /* New configuration. */
3478 bgp_static
= bgp_static_new ();
3479 bgp_static
->valid
= 1;
3480 memcpy (bgp_static
->tag
, tag
, 3);
3481 rn
->info
= bgp_static
;
3483 bgp_static_update_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
3489 /* Configure static BGP network. */
3491 bgp_static_unset_vpnv4 (struct vty
*vty
, const char *ip_str
,
3492 const char *rd_str
, const char *tag_str
)
3497 struct prefix_rd prd
;
3498 struct bgp_node
*prn
;
3499 struct bgp_node
*rn
;
3500 struct bgp_table
*table
;
3501 struct bgp_static
*bgp_static
;
3506 /* Convert IP prefix string to struct prefix. */
3507 ret
= str2prefix (ip_str
, &p
);
3510 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3515 ret
= str2prefix_rd (rd_str
, &prd
);
3518 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
3522 ret
= str2tag (tag_str
, tag
);
3525 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
3529 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
3530 (struct prefix
*)&prd
);
3531 if (prn
->info
== NULL
)
3532 prn
->info
= bgp_table_init ();
3534 bgp_unlock_node (prn
);
3537 rn
= bgp_node_lookup (table
, &p
);
3541 bgp_static_withdraw_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
3543 bgp_static
= rn
->info
;
3544 bgp_static_free (bgp_static
);
3546 bgp_unlock_node (rn
);
3547 bgp_unlock_node (rn
);
3550 vty_out (vty
, "%% Can't find the route%s", VTY_NEWLINE
);
3557 "network A.B.C.D/M",
3558 "Specify a network to announce via BGP\n"
3559 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
3561 return bgp_static_set (vty
, vty
->index
, argv
[0],
3562 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
3565 DEFUN (bgp_network_route_map
,
3566 bgp_network_route_map_cmd
,
3567 "network A.B.C.D/M route-map WORD",
3568 "Specify a network to announce via BGP\n"
3569 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3570 "Route-map to modify the attributes\n"
3571 "Name of the route map\n")
3573 return bgp_static_set (vty
, vty
->index
, argv
[0],
3574 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
3577 DEFUN (bgp_network_backdoor
,
3578 bgp_network_backdoor_cmd
,
3579 "network A.B.C.D/M backdoor",
3580 "Specify a network to announce via BGP\n"
3581 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3582 "Specify a BGP backdoor route\n")
3584 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
3587 DEFUN (bgp_network_mask
,
3588 bgp_network_mask_cmd
,
3589 "network A.B.C.D mask A.B.C.D",
3590 "Specify a network to announce via BGP\n"
3596 char prefix_str
[BUFSIZ
];
3598 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3601 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3605 return bgp_static_set (vty
, vty
->index
, prefix_str
,
3606 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
3609 DEFUN (bgp_network_mask_route_map
,
3610 bgp_network_mask_route_map_cmd
,
3611 "network A.B.C.D mask A.B.C.D route-map WORD",
3612 "Specify a network to announce via BGP\n"
3616 "Route-map to modify the attributes\n"
3617 "Name of the route map\n")
3620 char prefix_str
[BUFSIZ
];
3622 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3625 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3629 return bgp_static_set (vty
, vty
->index
, prefix_str
,
3630 AFI_IP
, bgp_node_safi (vty
), argv
[2], 0);
3633 DEFUN (bgp_network_mask_backdoor
,
3634 bgp_network_mask_backdoor_cmd
,
3635 "network A.B.C.D mask A.B.C.D backdoor",
3636 "Specify a network to announce via BGP\n"
3640 "Specify a BGP backdoor route\n")
3643 char prefix_str
[BUFSIZ
];
3645 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3648 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3652 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
, NULL
, 1);
3655 DEFUN (bgp_network_mask_natural
,
3656 bgp_network_mask_natural_cmd
,
3658 "Specify a network to announce via BGP\n"
3662 char prefix_str
[BUFSIZ
];
3664 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
3667 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3671 return bgp_static_set (vty
, vty
->index
, prefix_str
,
3672 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
3675 DEFUN (bgp_network_mask_natural_route_map
,
3676 bgp_network_mask_natural_route_map_cmd
,
3677 "network A.B.C.D route-map WORD",
3678 "Specify a network to announce via BGP\n"
3680 "Route-map to modify the attributes\n"
3681 "Name of the route map\n")
3684 char prefix_str
[BUFSIZ
];
3686 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
3689 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3693 return bgp_static_set (vty
, vty
->index
, prefix_str
,
3694 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
3697 DEFUN (bgp_network_mask_natural_backdoor
,
3698 bgp_network_mask_natural_backdoor_cmd
,
3699 "network A.B.C.D backdoor",
3700 "Specify a network to announce via BGP\n"
3702 "Specify a BGP backdoor route\n")
3705 char prefix_str
[BUFSIZ
];
3707 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
3710 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3714 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
, NULL
, 1);
3717 DEFUN (no_bgp_network
,
3719 "no network A.B.C.D/M",
3721 "Specify a network to announce via BGP\n"
3722 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
3724 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP
,
3725 bgp_node_safi (vty
));
3728 ALIAS (no_bgp_network
,
3729 no_bgp_network_route_map_cmd
,
3730 "no network A.B.C.D/M route-map WORD",
3732 "Specify a network to announce via BGP\n"
3733 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3734 "Route-map to modify the attributes\n"
3735 "Name of the route map\n")
3737 ALIAS (no_bgp_network
,
3738 no_bgp_network_backdoor_cmd
,
3739 "no network A.B.C.D/M backdoor",
3741 "Specify a network to announce via BGP\n"
3742 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3743 "Specify a BGP backdoor route\n")
3745 DEFUN (no_bgp_network_mask
,
3746 no_bgp_network_mask_cmd
,
3747 "no network A.B.C.D mask A.B.C.D",
3749 "Specify a network to announce via BGP\n"
3755 char prefix_str
[BUFSIZ
];
3757 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
3760 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3764 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
3765 bgp_node_safi (vty
));
3768 ALIAS (no_bgp_network_mask
,
3769 no_bgp_network_mask_route_map_cmd
,
3770 "no network A.B.C.D mask A.B.C.D route-map WORD",
3772 "Specify a network to announce via BGP\n"
3776 "Route-map to modify the attributes\n"
3777 "Name of the route map\n")
3779 ALIAS (no_bgp_network_mask
,
3780 no_bgp_network_mask_backdoor_cmd
,
3781 "no network A.B.C.D mask A.B.C.D backdoor",
3783 "Specify a network to announce via BGP\n"
3787 "Specify a BGP backdoor route\n")
3789 DEFUN (no_bgp_network_mask_natural
,
3790 no_bgp_network_mask_natural_cmd
,
3791 "no network A.B.C.D",
3793 "Specify a network to announce via BGP\n"
3797 char prefix_str
[BUFSIZ
];
3799 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
3802 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
3806 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
3807 bgp_node_safi (vty
));
3810 ALIAS (no_bgp_network_mask_natural
,
3811 no_bgp_network_mask_natural_route_map_cmd
,
3812 "no network A.B.C.D route-map WORD",
3814 "Specify a network to announce via BGP\n"
3816 "Route-map to modify the attributes\n"
3817 "Name of the route map\n")
3819 ALIAS (no_bgp_network_mask_natural
,
3820 no_bgp_network_mask_natural_backdoor_cmd
,
3821 "no network A.B.C.D backdoor",
3823 "Specify a network to announce via BGP\n"
3825 "Specify a BGP backdoor route\n")
3828 DEFUN (ipv6_bgp_network
,
3829 ipv6_bgp_network_cmd
,
3830 "network X:X::X:X/M",
3831 "Specify a network to announce via BGP\n"
3832 "IPv6 prefix <network>/<length>\n")
3834 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
3837 DEFUN (ipv6_bgp_network_route_map
,
3838 ipv6_bgp_network_route_map_cmd
,
3839 "network X:X::X:X/M route-map WORD",
3840 "Specify a network to announce via BGP\n"
3841 "IPv6 prefix <network>/<length>\n"
3842 "Route-map to modify the attributes\n"
3843 "Name of the route map\n")
3845 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
,
3846 bgp_node_safi (vty
), argv
[1], 0);
3849 DEFUN (no_ipv6_bgp_network
,
3850 no_ipv6_bgp_network_cmd
,
3851 "no network X:X::X:X/M",
3853 "Specify a network to announce via BGP\n"
3854 "IPv6 prefix <network>/<length>\n")
3856 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
3859 ALIAS (no_ipv6_bgp_network
,
3860 no_ipv6_bgp_network_route_map_cmd
,
3861 "no network X:X::X:X/M route-map WORD",
3863 "Specify a network to announce via BGP\n"
3864 "IPv6 prefix <network>/<length>\n"
3865 "Route-map to modify the attributes\n"
3866 "Name of the route map\n")
3868 ALIAS (ipv6_bgp_network
,
3869 old_ipv6_bgp_network_cmd
,
3870 "ipv6 bgp network X:X::X:X/M",
3873 "Specify a network to announce via BGP\n"
3874 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
3876 ALIAS (no_ipv6_bgp_network
,
3877 old_no_ipv6_bgp_network_cmd
,
3878 "no ipv6 bgp network X:X::X:X/M",
3882 "Specify a network to announce via BGP\n"
3883 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
3884 #endif /* HAVE_IPV6 */
3886 /* Aggreagete address:
3888 advertise-map Set condition to advertise attribute
3889 as-set Generate AS set path information
3890 attribute-map Set attributes of aggregate
3891 route-map Set parameters of aggregate
3892 summary-only Filter more specific routes from updates
3893 suppress-map Conditionally filter more specific routes from updates
3896 struct bgp_aggregate
3898 /* Summary-only flag. */
3899 u_char summary_only
;
3901 /* AS set generation. */
3904 /* Route-map for aggregated route. */
3905 struct route_map
*map
;
3907 /* Suppress-count. */
3908 unsigned long count
;
3910 /* SAFI configuration. */
3914 static struct bgp_aggregate
*
3915 bgp_aggregate_new ()
3917 struct bgp_aggregate
*new;
3918 new = XMALLOC (MTYPE_BGP_AGGREGATE
, sizeof (struct bgp_aggregate
));
3919 memset (new, 0, sizeof (struct bgp_aggregate
));
3924 bgp_aggregate_free (struct bgp_aggregate
*aggregate
)
3926 XFREE (MTYPE_BGP_AGGREGATE
, aggregate
);
3930 bgp_aggregate_route (struct bgp
*bgp
, struct prefix
*p
, struct bgp_info
*rinew
,
3931 afi_t afi
, safi_t safi
, struct bgp_info
*del
,
3932 struct bgp_aggregate
*aggregate
)
3934 struct bgp_table
*table
;
3935 struct bgp_node
*top
;
3936 struct bgp_node
*rn
;
3938 struct aspath
*aspath
= NULL
;
3939 struct aspath
*asmerge
= NULL
;
3940 struct community
*community
= NULL
;
3941 struct community
*commerge
= NULL
;
3942 struct in_addr nexthop
;
3944 struct bgp_info
*ri
;
3945 struct bgp_info
*new;
3947 unsigned long match
= 0;
3949 /* Record adding route's nexthop and med. */
3952 nexthop
= rinew
->attr
->nexthop
;
3953 med
= rinew
->attr
->med
;
3956 /* ORIGIN attribute: If at least one route among routes that are
3957 aggregated has ORIGIN with the value INCOMPLETE, then the
3958 aggregated route must have the ORIGIN attribute with the value
3959 INCOMPLETE. Otherwise, if at least one route among routes that
3960 are aggregated has ORIGIN with the value EGP, then the aggregated
3961 route must have the origin attribute with the value EGP. In all
3962 other case the value of the ORIGIN attribute of the aggregated
3963 route is INTERNAL. */
3964 origin
= BGP_ORIGIN_IGP
;
3966 table
= bgp
->rib
[afi
][safi
];
3968 top
= bgp_node_get (table
, p
);
3969 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
3970 if (rn
->p
.prefixlen
> p
->prefixlen
)
3974 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3976 if (BGP_INFO_HOLDDOWN (ri
))
3979 if (del
&& ri
== del
)
3982 if (! rinew
&& first
)
3984 nexthop
= ri
->attr
->nexthop
;
3985 med
= ri
->attr
->med
;
3989 #ifdef AGGREGATE_NEXTHOP_CHECK
3990 if (! IPV4_ADDR_SAME (&ri
->attr
->nexthop
, &nexthop
)
3991 || ri
->attr
->med
!= med
)
3994 aspath_free (aspath
);
3996 community_free (community
);
3997 bgp_unlock_node (rn
);
3998 bgp_unlock_node (top
);
4001 #endif /* AGGREGATE_NEXTHOP_CHECK */
4003 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4005 if (aggregate
->summary_only
)
4008 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
4014 if (aggregate
->as_set
)
4016 if (origin
< ri
->attr
->origin
)
4017 origin
= ri
->attr
->origin
;
4021 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4022 aspath_free (aspath
);
4026 aspath
= aspath_dup (ri
->attr
->aspath
);
4028 if (ri
->attr
->community
)
4032 commerge
= community_merge (community
,
4033 ri
->attr
->community
);
4034 community
= community_uniq_sort (commerge
);
4035 community_free (commerge
);
4038 community
= community_dup (ri
->attr
->community
);
4044 bgp_process (bgp
, rn
, afi
, safi
);
4046 bgp_unlock_node (top
);
4052 if (aggregate
->summary_only
)
4055 if (aggregate
->as_set
)
4057 if (origin
< rinew
->attr
->origin
)
4058 origin
= rinew
->attr
->origin
;
4062 asmerge
= aspath_aggregate (aspath
, rinew
->attr
->aspath
);
4063 aspath_free (aspath
);
4067 aspath
= aspath_dup (rinew
->attr
->aspath
);
4069 if (rinew
->attr
->community
)
4073 commerge
= community_merge (community
,
4074 rinew
->attr
->community
);
4075 community
= community_uniq_sort (commerge
);
4076 community_free (commerge
);
4079 community
= community_dup (rinew
->attr
->community
);
4084 if (aggregate
->count
> 0)
4086 rn
= bgp_node_get (table
, p
);
4087 new = bgp_info_new ();
4088 new->type
= ZEBRA_ROUTE_BGP
;
4089 new->sub_type
= BGP_ROUTE_AGGREGATE
;
4090 new->peer
= bgp
->peer_self
;
4091 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4092 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
4093 new->uptime
= time (NULL
);
4095 bgp_info_add (rn
, new);
4096 bgp_unlock_node (rn
);
4097 bgp_process (bgp
, rn
, afi
, safi
);
4102 aspath_free (aspath
);
4104 community_free (community
);
4108 void bgp_aggregate_delete (struct bgp
*, struct prefix
*, afi_t
, safi_t
,
4109 struct bgp_aggregate
*);
4112 bgp_aggregate_increment (struct bgp
*bgp
, struct prefix
*p
,
4113 struct bgp_info
*ri
, afi_t afi
, safi_t safi
)
4115 struct bgp_node
*child
;
4116 struct bgp_node
*rn
;
4117 struct bgp_aggregate
*aggregate
;
4119 /* MPLS-VPN aggregation is not yet supported. */
4120 if (safi
== SAFI_MPLS_VPN
)
4123 if (p
->prefixlen
== 0)
4126 if (BGP_INFO_HOLDDOWN (ri
))
4129 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
4131 /* Aggregate address configuration check. */
4132 for (rn
= child
; rn
; rn
= rn
->parent
)
4133 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
4135 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
4136 bgp_aggregate_route (bgp
, &rn
->p
, ri
, afi
, safi
, NULL
, aggregate
);
4138 bgp_unlock_node (child
);
4142 bgp_aggregate_decrement (struct bgp
*bgp
, struct prefix
*p
,
4143 struct bgp_info
*del
, afi_t afi
, safi_t safi
)
4145 struct bgp_node
*child
;
4146 struct bgp_node
*rn
;
4147 struct bgp_aggregate
*aggregate
;
4149 /* MPLS-VPN aggregation is not yet supported. */
4150 if (safi
== SAFI_MPLS_VPN
)
4153 if (p
->prefixlen
== 0)
4156 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
4158 /* Aggregate address configuration check. */
4159 for (rn
= child
; rn
; rn
= rn
->parent
)
4160 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
4162 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
4163 bgp_aggregate_route (bgp
, &rn
->p
, NULL
, afi
, safi
, del
, aggregate
);
4165 bgp_unlock_node (child
);
4169 bgp_aggregate_add (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
, safi_t safi
,
4170 struct bgp_aggregate
*aggregate
)
4172 struct bgp_table
*table
;
4173 struct bgp_node
*top
;
4174 struct bgp_node
*rn
;
4175 struct bgp_info
*new;
4176 struct bgp_info
*ri
;
4177 unsigned long match
;
4178 u_char origin
= BGP_ORIGIN_IGP
;
4179 struct aspath
*aspath
= NULL
;
4180 struct aspath
*asmerge
= NULL
;
4181 struct community
*community
= NULL
;
4182 struct community
*commerge
= NULL
;
4184 table
= bgp
->rib
[afi
][safi
];
4187 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
4189 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
4192 /* If routes exists below this node, generate aggregate routes. */
4193 top
= bgp_node_get (table
, p
);
4194 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4195 if (rn
->p
.prefixlen
> p
->prefixlen
)
4199 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4201 if (BGP_INFO_HOLDDOWN (ri
))
4204 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4206 /* summary-only aggregate route suppress aggregated
4207 route announcement. */
4208 if (aggregate
->summary_only
)
4211 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
4214 /* as-set aggregate route generate origin, as path,
4215 community aggregation. */
4216 if (aggregate
->as_set
)
4218 if (origin
< ri
->attr
->origin
)
4219 origin
= ri
->attr
->origin
;
4223 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4224 aspath_free (aspath
);
4228 aspath
= aspath_dup (ri
->attr
->aspath
);
4230 if (ri
->attr
->community
)
4234 commerge
= community_merge (community
,
4235 ri
->attr
->community
);
4236 community
= community_uniq_sort (commerge
);
4237 community_free (commerge
);
4240 community
= community_dup (ri
->attr
->community
);
4247 /* If this node is suppressed, process the change. */
4249 bgp_process (bgp
, rn
, afi
, safi
);
4251 bgp_unlock_node (top
);
4253 /* Add aggregate route to BGP table. */
4254 if (aggregate
->count
)
4256 rn
= bgp_node_get (table
, p
);
4258 new = bgp_info_new ();
4259 new->type
= ZEBRA_ROUTE_BGP
;
4260 new->sub_type
= BGP_ROUTE_AGGREGATE
;
4261 new->peer
= bgp
->peer_self
;
4262 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4263 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
4264 new->uptime
= time (NULL
);
4266 bgp_info_add (rn
, new);
4267 bgp_unlock_node (rn
);
4269 /* Process change. */
4270 bgp_process (bgp
, rn
, afi
, safi
);
4275 bgp_aggregate_delete (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
4276 safi_t safi
, struct bgp_aggregate
*aggregate
)
4278 struct bgp_table
*table
;
4279 struct bgp_node
*top
;
4280 struct bgp_node
*rn
;
4281 struct bgp_info
*ri
;
4282 unsigned long match
;
4284 table
= bgp
->rib
[afi
][safi
];
4286 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
4288 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
4291 /* If routes exists below this node, generate aggregate routes. */
4292 top
= bgp_node_get (table
, p
);
4293 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4294 if (rn
->p
.prefixlen
> p
->prefixlen
)
4298 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4300 if (BGP_INFO_HOLDDOWN (ri
))
4303 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4305 if (aggregate
->summary_only
)
4309 if (ri
->suppress
== 0)
4311 SET_FLAG (ri
->flags
, BGP_INFO_ATTR_CHANGED
);
4319 /* If this node is suppressed, process the change. */
4321 bgp_process (bgp
, rn
, afi
, safi
);
4323 bgp_unlock_node (top
);
4325 /* Delete aggregate route from BGP table. */
4326 rn
= bgp_node_get (table
, p
);
4328 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4329 if (ri
->peer
== bgp
->peer_self
4330 && ri
->type
== ZEBRA_ROUTE_BGP
4331 && ri
->sub_type
== BGP_ROUTE_AGGREGATE
)
4334 /* Withdraw static BGP route from routing table. */
4337 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
4338 bgp_process (bgp
, rn
, afi
, safi
);
4339 bgp_info_delete (rn
, ri
);
4342 /* Unlock bgp_node_lookup. */
4343 bgp_unlock_node (rn
);
4346 /* Aggregate route attribute. */
4347 #define AGGREGATE_SUMMARY_ONLY 1
4348 #define AGGREGATE_AS_SET 1
4351 bgp_aggregate_set (struct vty
*vty
, const char *prefix_str
,
4352 afi_t afi
, safi_t safi
,
4353 u_char summary_only
, u_char as_set
)
4357 struct bgp_node
*rn
;
4359 struct bgp_aggregate
*aggregate
;
4361 /* Convert string to prefix structure. */
4362 ret
= str2prefix (prefix_str
, &p
);
4365 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
4370 /* Get BGP structure. */
4373 /* Old configuration check. */
4374 rn
= bgp_node_get (bgp
->aggregate
[afi
][safi
], &p
);
4378 vty_out (vty
, "There is already same aggregate network.%s", VTY_NEWLINE
);
4379 bgp_unlock_node (rn
);
4383 /* Make aggregate address structure. */
4384 aggregate
= bgp_aggregate_new ();
4385 aggregate
->summary_only
= summary_only
;
4386 aggregate
->as_set
= as_set
;
4387 aggregate
->safi
= safi
;
4388 rn
->info
= aggregate
;
4390 /* Aggregate address insert into BGP routing table. */
4391 if (safi
& SAFI_UNICAST
)
4392 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
4393 if (safi
& SAFI_MULTICAST
)
4394 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
4400 bgp_aggregate_unset (struct vty
*vty
, const char *prefix_str
,
4401 afi_t afi
, safi_t safi
)
4405 struct bgp_node
*rn
;
4407 struct bgp_aggregate
*aggregate
;
4409 /* Convert string to prefix structure. */
4410 ret
= str2prefix (prefix_str
, &p
);
4413 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
4418 /* Get BGP structure. */
4421 /* Old configuration check. */
4422 rn
= bgp_node_lookup (bgp
->aggregate
[afi
][safi
], &p
);
4425 vty_out (vty
, "%% There is no aggregate-address configuration.%s",
4430 aggregate
= rn
->info
;
4431 if (aggregate
->safi
& SAFI_UNICAST
)
4432 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
4433 if (aggregate
->safi
& SAFI_MULTICAST
)
4434 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
4436 /* Unlock aggregate address configuration. */
4438 bgp_aggregate_free (aggregate
);
4439 bgp_unlock_node (rn
);
4440 bgp_unlock_node (rn
);
4445 DEFUN (aggregate_address
,
4446 aggregate_address_cmd
,
4447 "aggregate-address A.B.C.D/M",
4448 "Configure BGP aggregate entries\n"
4449 "Aggregate prefix\n")
4451 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
), 0, 0);
4454 DEFUN (aggregate_address_mask
,
4455 aggregate_address_mask_cmd
,
4456 "aggregate-address A.B.C.D A.B.C.D",
4457 "Configure BGP aggregate entries\n"
4458 "Aggregate address\n"
4462 char prefix_str
[BUFSIZ
];
4464 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4468 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4472 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
4476 DEFUN (aggregate_address_summary_only
,
4477 aggregate_address_summary_only_cmd
,
4478 "aggregate-address A.B.C.D/M summary-only",
4479 "Configure BGP aggregate entries\n"
4480 "Aggregate prefix\n"
4481 "Filter more specific routes from updates\n")
4483 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
4484 AGGREGATE_SUMMARY_ONLY
, 0);
4487 DEFUN (aggregate_address_mask_summary_only
,
4488 aggregate_address_mask_summary_only_cmd
,
4489 "aggregate-address A.B.C.D A.B.C.D summary-only",
4490 "Configure BGP aggregate entries\n"
4491 "Aggregate address\n"
4493 "Filter more specific routes from updates\n")
4496 char prefix_str
[BUFSIZ
];
4498 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4502 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4506 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
4507 AGGREGATE_SUMMARY_ONLY
, 0);
4510 DEFUN (aggregate_address_as_set
,
4511 aggregate_address_as_set_cmd
,
4512 "aggregate-address A.B.C.D/M as-set",
4513 "Configure BGP aggregate entries\n"
4514 "Aggregate prefix\n"
4515 "Generate AS set path information\n")
4517 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
4518 0, AGGREGATE_AS_SET
);
4521 DEFUN (aggregate_address_mask_as_set
,
4522 aggregate_address_mask_as_set_cmd
,
4523 "aggregate-address A.B.C.D A.B.C.D as-set",
4524 "Configure BGP aggregate entries\n"
4525 "Aggregate address\n"
4527 "Generate AS set path information\n")
4530 char prefix_str
[BUFSIZ
];
4532 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4536 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4540 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
4541 0, AGGREGATE_AS_SET
);
4545 DEFUN (aggregate_address_as_set_summary
,
4546 aggregate_address_as_set_summary_cmd
,
4547 "aggregate-address A.B.C.D/M as-set summary-only",
4548 "Configure BGP aggregate entries\n"
4549 "Aggregate prefix\n"
4550 "Generate AS set path information\n"
4551 "Filter more specific routes from updates\n")
4553 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
4554 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
4557 ALIAS (aggregate_address_as_set_summary
,
4558 aggregate_address_summary_as_set_cmd
,
4559 "aggregate-address A.B.C.D/M summary-only as-set",
4560 "Configure BGP aggregate entries\n"
4561 "Aggregate prefix\n"
4562 "Filter more specific routes from updates\n"
4563 "Generate AS set path information\n")
4565 DEFUN (aggregate_address_mask_as_set_summary
,
4566 aggregate_address_mask_as_set_summary_cmd
,
4567 "aggregate-address A.B.C.D A.B.C.D as-set summary-only",
4568 "Configure BGP aggregate entries\n"
4569 "Aggregate address\n"
4571 "Generate AS set path information\n"
4572 "Filter more specific routes from updates\n")
4575 char prefix_str
[BUFSIZ
];
4577 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4581 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4585 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
4586 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
4589 ALIAS (aggregate_address_mask_as_set_summary
,
4590 aggregate_address_mask_summary_as_set_cmd
,
4591 "aggregate-address A.B.C.D A.B.C.D summary-only as-set",
4592 "Configure BGP aggregate entries\n"
4593 "Aggregate address\n"
4595 "Filter more specific routes from updates\n"
4596 "Generate AS set path information\n")
4598 DEFUN (no_aggregate_address
,
4599 no_aggregate_address_cmd
,
4600 "no aggregate-address A.B.C.D/M",
4602 "Configure BGP aggregate entries\n"
4603 "Aggregate prefix\n")
4605 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
));
4608 ALIAS (no_aggregate_address
,
4609 no_aggregate_address_summary_only_cmd
,
4610 "no aggregate-address A.B.C.D/M summary-only",
4612 "Configure BGP aggregate entries\n"
4613 "Aggregate prefix\n"
4614 "Filter more specific routes from updates\n")
4616 ALIAS (no_aggregate_address
,
4617 no_aggregate_address_as_set_cmd
,
4618 "no aggregate-address A.B.C.D/M as-set",
4620 "Configure BGP aggregate entries\n"
4621 "Aggregate prefix\n"
4622 "Generate AS set path information\n")
4624 ALIAS (no_aggregate_address
,
4625 no_aggregate_address_as_set_summary_cmd
,
4626 "no aggregate-address A.B.C.D/M as-set summary-only",
4628 "Configure BGP aggregate entries\n"
4629 "Aggregate prefix\n"
4630 "Generate AS set path information\n"
4631 "Filter more specific routes from updates\n")
4633 ALIAS (no_aggregate_address
,
4634 no_aggregate_address_summary_as_set_cmd
,
4635 "no aggregate-address A.B.C.D/M summary-only as-set",
4637 "Configure BGP aggregate entries\n"
4638 "Aggregate prefix\n"
4639 "Filter more specific routes from updates\n"
4640 "Generate AS set path information\n")
4642 DEFUN (no_aggregate_address_mask
,
4643 no_aggregate_address_mask_cmd
,
4644 "no aggregate-address A.B.C.D A.B.C.D",
4646 "Configure BGP aggregate entries\n"
4647 "Aggregate address\n"
4651 char prefix_str
[BUFSIZ
];
4653 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4657 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4661 return bgp_aggregate_unset (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
));
4664 ALIAS (no_aggregate_address_mask
,
4665 no_aggregate_address_mask_summary_only_cmd
,
4666 "no aggregate-address A.B.C.D A.B.C.D summary-only",
4668 "Configure BGP aggregate entries\n"
4669 "Aggregate address\n"
4671 "Filter more specific routes from updates\n")
4673 ALIAS (no_aggregate_address_mask
,
4674 no_aggregate_address_mask_as_set_cmd
,
4675 "no aggregate-address A.B.C.D A.B.C.D as-set",
4677 "Configure BGP aggregate entries\n"
4678 "Aggregate address\n"
4680 "Generate AS set path information\n")
4682 ALIAS (no_aggregate_address_mask
,
4683 no_aggregate_address_mask_as_set_summary_cmd
,
4684 "no aggregate-address A.B.C.D A.B.C.D as-set summary-only",
4686 "Configure BGP aggregate entries\n"
4687 "Aggregate address\n"
4689 "Generate AS set path information\n"
4690 "Filter more specific routes from updates\n")
4692 ALIAS (no_aggregate_address_mask
,
4693 no_aggregate_address_mask_summary_as_set_cmd
,
4694 "no aggregate-address A.B.C.D A.B.C.D summary-only as-set",
4696 "Configure BGP aggregate entries\n"
4697 "Aggregate address\n"
4699 "Filter more specific routes from updates\n"
4700 "Generate AS set path information\n")
4703 DEFUN (ipv6_aggregate_address
,
4704 ipv6_aggregate_address_cmd
,
4705 "aggregate-address X:X::X:X/M",
4706 "Configure BGP aggregate entries\n"
4707 "Aggregate prefix\n")
4709 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0, 0);
4712 DEFUN (ipv6_aggregate_address_summary_only
,
4713 ipv6_aggregate_address_summary_only_cmd
,
4714 "aggregate-address X:X::X:X/M summary-only",
4715 "Configure BGP aggregate entries\n"
4716 "Aggregate prefix\n"
4717 "Filter more specific routes from updates\n")
4719 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
4720 AGGREGATE_SUMMARY_ONLY
, 0);
4723 DEFUN (no_ipv6_aggregate_address
,
4724 no_ipv6_aggregate_address_cmd
,
4725 "no aggregate-address X:X::X:X/M",
4727 "Configure BGP aggregate entries\n"
4728 "Aggregate prefix\n")
4730 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
4733 DEFUN (no_ipv6_aggregate_address_summary_only
,
4734 no_ipv6_aggregate_address_summary_only_cmd
,
4735 "no aggregate-address X:X::X:X/M summary-only",
4737 "Configure BGP aggregate entries\n"
4738 "Aggregate prefix\n"
4739 "Filter more specific routes from updates\n")
4741 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
4744 ALIAS (ipv6_aggregate_address
,
4745 old_ipv6_aggregate_address_cmd
,
4746 "ipv6 bgp aggregate-address X:X::X:X/M",
4749 "Configure BGP aggregate entries\n"
4750 "Aggregate prefix\n")
4752 ALIAS (ipv6_aggregate_address_summary_only
,
4753 old_ipv6_aggregate_address_summary_only_cmd
,
4754 "ipv6 bgp aggregate-address X:X::X:X/M summary-only",
4757 "Configure BGP aggregate entries\n"
4758 "Aggregate prefix\n"
4759 "Filter more specific routes from updates\n")
4761 ALIAS (no_ipv6_aggregate_address
,
4762 old_no_ipv6_aggregate_address_cmd
,
4763 "no ipv6 bgp aggregate-address X:X::X:X/M",
4767 "Configure BGP aggregate entries\n"
4768 "Aggregate prefix\n")
4770 ALIAS (no_ipv6_aggregate_address_summary_only
,
4771 old_no_ipv6_aggregate_address_summary_only_cmd
,
4772 "no ipv6 bgp aggregate-address X:X::X:X/M summary-only",
4776 "Configure BGP aggregate entries\n"
4777 "Aggregate prefix\n"
4778 "Filter more specific routes from updates\n")
4779 #endif /* HAVE_IPV6 */
4781 /* Redistribute route treatment. */
4783 bgp_redistribute_add (struct prefix
*p
, struct in_addr
*nexthop
,
4784 u_int32_t metric
, u_char type
)
4787 struct listnode
*node
, *nnode
;
4788 struct bgp_info
*new;
4789 struct bgp_info
*bi
;
4790 struct bgp_info info
;
4791 struct bgp_node
*bn
;
4793 struct attr attr_new
;
4794 struct attr
*new_attr
;
4798 /* Make default attribute. */
4799 bgp_attr_default_set (&attr
, BGP_ORIGIN_INCOMPLETE
);
4801 attr
.nexthop
= *nexthop
;
4804 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
4806 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
4808 afi
= family2afi (p
->family
);
4810 if (bgp
->redist
[afi
][type
])
4812 /* Copy attribute for modification. */
4815 if (bgp
->redist_metric_flag
[afi
][type
])
4816 attr_new
.med
= bgp
->redist_metric
[afi
][type
];
4818 /* Apply route-map. */
4819 if (bgp
->rmap
[afi
][type
].map
)
4821 info
.peer
= bgp
->peer_self
;
4822 info
.attr
= &attr_new
;
4824 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_REDISTRIBUTE
);
4826 ret
= route_map_apply (bgp
->rmap
[afi
][type
].map
, p
, RMAP_BGP
,
4829 bgp
->peer_self
->rmap_type
= 0;
4831 if (ret
== RMAP_DENYMATCH
)
4833 /* Free uninterned attribute. */
4834 bgp_attr_flush (&attr_new
);
4836 /* Unintern original. */
4837 aspath_unintern (attr
.aspath
);
4838 bgp_redistribute_delete (p
, type
);
4843 bn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
], afi
, SAFI_UNICAST
, p
, NULL
);
4844 new_attr
= bgp_attr_intern (&attr_new
);
4846 for (bi
= bn
->info
; bi
; bi
= bi
->next
)
4847 if (bi
->peer
== bgp
->peer_self
4848 && bi
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
4853 if (attrhash_cmp (bi
->attr
, new_attr
))
4855 bgp_attr_unintern (new_attr
);
4856 aspath_unintern (attr
.aspath
);
4857 bgp_unlock_node (bn
);
4862 /* The attribute is changed. */
4863 SET_FLAG (bi
->flags
, BGP_INFO_ATTR_CHANGED
);
4865 /* Rewrite BGP route information. */
4866 bgp_aggregate_decrement (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
4867 bgp_attr_unintern (bi
->attr
);
4868 bi
->attr
= new_attr
;
4869 bi
->uptime
= time (NULL
);
4871 /* Process change. */
4872 bgp_aggregate_increment (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
4873 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
4874 bgp_unlock_node (bn
);
4875 aspath_unintern (attr
.aspath
);
4880 new = bgp_info_new ();
4882 new->sub_type
= BGP_ROUTE_REDISTRIBUTE
;
4883 new->peer
= bgp
->peer_self
;
4884 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4885 new->attr
= new_attr
;
4886 new->uptime
= time (NULL
);
4888 bgp_aggregate_increment (bgp
, p
, new, afi
, SAFI_UNICAST
);
4889 bgp_info_add (bn
, new);
4890 bgp_unlock_node (bn
);
4891 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
4895 /* Unintern original. */
4896 aspath_unintern (attr
.aspath
);
4900 bgp_redistribute_delete (struct prefix
*p
, u_char type
)
4903 struct listnode
*node
, *nnode
;
4905 struct bgp_node
*rn
;
4906 struct bgp_info
*ri
;
4908 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
4910 afi
= family2afi (p
->family
);
4912 if (bgp
->redist
[afi
][type
])
4914 rn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
], afi
, SAFI_UNICAST
, p
, NULL
);
4916 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4917 if (ri
->peer
== bgp
->peer_self
4918 && ri
->type
== type
)
4923 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, SAFI_UNICAST
);
4924 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
4925 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
4926 bgp_info_delete (rn
, ri
);
4928 bgp_unlock_node (rn
);
4933 /* Withdraw specified route type's route. */
4935 bgp_redistribute_withdraw (struct bgp
*bgp
, afi_t afi
, int type
)
4937 struct bgp_node
*rn
;
4938 struct bgp_info
*ri
;
4939 struct bgp_table
*table
;
4941 table
= bgp
->rib
[afi
][SAFI_UNICAST
];
4943 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
4945 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4946 if (ri
->peer
== bgp
->peer_self
4947 && ri
->type
== type
)
4952 bgp_aggregate_decrement (bgp
, &rn
->p
, ri
, afi
, SAFI_UNICAST
);
4953 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
4954 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
4955 bgp_info_delete (rn
, ri
);
4960 /* Static function to display route. */
4962 route_vty_out_route (struct prefix
*p
, struct vty
*vty
)
4965 u_int32_t destination
;
4968 if (p
->family
== AF_INET
)
4970 len
= vty_out (vty
, "%s", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
));
4971 destination
= ntohl (p
->u
.prefix4
.s_addr
);
4973 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
4974 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
4975 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
4976 || p
->u
.prefix4
.s_addr
== 0)
4978 /* When mask is natural, mask is not displayed. */
4981 len
+= vty_out (vty
, "/%d", p
->prefixlen
);
4984 len
= vty_out (vty
, "%s/%d", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
),
4989 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 20, " ");
4991 vty_out (vty
, "%*s", len
, " ");
4994 enum bgp_display_type
4999 /* called from terminal list command */
5001 route_vty_out (struct vty
*vty
, struct prefix
*p
,
5002 struct bgp_info
*binfo
, int display
, safi_t safi
)
5006 /* Route status display. */
5007 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
5009 else if (binfo
->suppress
)
5011 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5017 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5019 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5021 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
5026 /* Internal route. */
5027 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
5032 /* print prefix and mask */
5034 route_vty_out_route (p
, vty
);
5036 vty_out (vty
, "%*s", 17, " ");
5038 /* Print attribute */
5042 if (p
->family
== AF_INET
)
5044 if (safi
== SAFI_MPLS_VPN
)
5045 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
5047 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5050 else if (p
->family
== AF_INET6
)
5055 len
= vty_out (vty
, "%s",
5056 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
5059 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
5061 vty_out (vty
, "%*s", len
, " ");
5063 #endif /* HAVE_IPV6 */
5065 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
5066 vty_out (vty
, "%10d", attr
->med
);
5070 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
5071 vty_out (vty
, "%7d", attr
->local_pref
);
5075 vty_out (vty
, "%7u ",attr
->weight
);
5079 aspath_print_vty (vty
, attr
->aspath
);
5082 if (strlen (attr
->aspath
->str
) == 0)
5083 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5085 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
5087 vty_out (vty
, "%s", VTY_NEWLINE
);
5090 /* called from terminal list command */
5092 route_vty_out_tmp (struct vty
*vty
, struct prefix
*p
,
5093 struct attr
*attr
, safi_t safi
)
5095 /* Route status display. */
5100 /* print prefix and mask */
5101 route_vty_out_route (p
, vty
);
5103 /* Print attribute */
5106 if (p
->family
== AF_INET
)
5108 if (safi
== SAFI_MPLS_VPN
)
5109 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
5111 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5114 else if (p
->family
== AF_INET6
)
5119 len
= vty_out (vty
, "%s",
5120 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
5123 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
5125 vty_out (vty
, "%*s", len
, " ");
5127 #endif /* HAVE_IPV6 */
5129 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
5130 vty_out (vty
, "%10d", attr
->med
);
5134 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
5135 vty_out (vty
, "%7d", attr
->local_pref
);
5139 vty_out (vty
, "%7d ",attr
->weight
);
5143 aspath_print_vty (vty
, attr
->aspath
);
5146 if (strlen (attr
->aspath
->str
) == 0)
5147 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5149 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
5152 vty_out (vty
, "%s", VTY_NEWLINE
);
5156 route_vty_out_tag (struct vty
*vty
, struct prefix
*p
,
5157 struct bgp_info
*binfo
, int display
, safi_t safi
)
5160 u_int32_t label
= 0;
5162 /* Route status display. */
5163 if (binfo
->suppress
)
5165 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5171 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5173 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5175 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
5180 /* Internal route. */
5181 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
5186 /* print prefix and mask */
5188 route_vty_out_route (p
, vty
);
5190 vty_out (vty
, "%*s", 17, " ");
5192 /* Print attribute */
5196 if (p
->family
== AF_INET
)
5198 if (safi
== SAFI_MPLS_VPN
)
5199 vty_out (vty
, "%-16s", inet_ntoa (attr
->mp_nexthop_global_in
));
5201 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5204 else if (p
->family
== AF_INET6
)
5208 if (attr
->mp_nexthop_len
== 16)
5210 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
));
5211 else if (attr
->mp_nexthop_len
== 32)
5212 vty_out (vty
, "%s(%s)",
5213 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
, buf
, BUFSIZ
),
5214 inet_ntop (AF_INET6
, &attr
->mp_nexthop_local
, buf1
, BUFSIZ
));
5217 #endif /* HAVE_IPV6 */
5220 label
= decode_label (binfo
->tag
);
5222 vty_out (vty
, "notag/%d", label
);
5224 vty_out (vty
, "%s", VTY_NEWLINE
);
5227 /* dampening route */
5229 damp_route_vty_out (struct vty
*vty
, struct prefix
*p
,
5230 struct bgp_info
*binfo
, int display
, safi_t safi
)
5235 /* Route status display. */
5236 if (binfo
->suppress
)
5238 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5244 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5246 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5248 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
5255 /* print prefix and mask */
5257 route_vty_out_route (p
, vty
);
5259 vty_out (vty
, "%*s", 17, " ");
5261 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
5264 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 34, " ");
5266 vty_out (vty
, "%*s", len
, " ");
5268 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
));
5270 /* Print attribute */
5276 aspath_print_vty (vty
, attr
->aspath
);
5279 if (strlen (attr
->aspath
->str
) == 0)
5280 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5282 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
5284 vty_out (vty
, "%s", VTY_NEWLINE
);
5287 #define BGP_UPTIME_LEN 25
5291 flap_route_vty_out (struct vty
*vty
, struct prefix
*p
,
5292 struct bgp_info
*binfo
, int display
, safi_t safi
)
5295 struct bgp_damp_info
*bdi
;
5296 char timebuf
[BGP_UPTIME_LEN
];
5299 bdi
= binfo
->damp_info
;
5301 /* Route status display. */
5302 if (binfo
->suppress
)
5304 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5310 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5312 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5314 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
5321 /* print prefix and mask */
5323 route_vty_out_route (p
, vty
);
5325 vty_out (vty
, "%*s", 17, " ");
5327 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
5330 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 33, " ");
5332 vty_out (vty
, "%*s", len
, " ");
5334 len
= vty_out (vty
, "%d", bdi
->flap
);
5339 vty_out (vty
, "%*s ", len
, " ");
5341 vty_out (vty
, "%s ", peer_uptime (bdi
->start_time
,
5342 timebuf
, BGP_UPTIME_LEN
));
5344 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
)
5345 && ! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5346 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
));
5348 vty_out (vty
, "%*s ", 8, " ");
5350 /* Print attribute */
5356 aspath_print_vty (vty
, attr
->aspath
);
5359 if (strlen (attr
->aspath
->str
) == 0)
5360 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5362 vty_out (vty
, " %s", bgp_origin_str
[attr
->origin
]);
5364 vty_out (vty
, "%s", VTY_NEWLINE
);
5368 route_vty_out_detail (struct vty
*vty
, struct bgp
*bgp
, struct prefix
*p
,
5369 struct bgp_info
*binfo
, afi_t afi
, safi_t safi
)
5371 char buf
[INET6_ADDRSTRLEN
];
5374 int sockunion_vty_out (struct vty
*, union sockunion
*);
5380 /* Line1 display AS-path, Aggregator */
5384 if (attr
->aspath
->length
== 0)
5385 vty_out (vty
, "Local");
5387 aspath_print_vty (vty
, attr
->aspath
);
5390 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
5391 vty_out (vty
, ", (stale)");
5392 if (CHECK_FLAG (attr
->flag
, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR
)))
5393 vty_out (vty
, ", (aggregated by %d %s)", attr
->aggregator_as
,
5394 inet_ntoa (attr
->aggregator_addr
));
5395 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
5396 vty_out (vty
, ", (Received from a RR-client)");
5397 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
5398 vty_out (vty
, ", (Received from a RS-client)");
5399 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5400 vty_out (vty
, ", (history entry)");
5401 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5402 vty_out (vty
, ", (suppressed due to dampening)");
5403 vty_out (vty
, "%s", VTY_NEWLINE
);
5405 /* Line2 display Next-hop, Neighbor, Router-id */
5406 if (p
->family
== AF_INET
)
5408 vty_out (vty
, " %s", safi
== SAFI_MPLS_VPN
?
5409 inet_ntoa (attr
->mp_nexthop_global_in
) :
5410 inet_ntoa (attr
->nexthop
));
5415 vty_out (vty
, " %s",
5416 inet_ntop (AF_INET6
, &attr
->mp_nexthop_global
,
5417 buf
, INET6_ADDRSTRLEN
));
5419 #endif /* HAVE_IPV6 */
5421 if (binfo
->peer
== bgp
->peer_self
)
5423 vty_out (vty
, " from %s ",
5424 p
->family
== AF_INET
? "0.0.0.0" : "::");
5425 vty_out (vty
, "(%s)", inet_ntoa(bgp
->router_id
));
5429 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_VALID
))
5430 vty_out (vty
, " (inaccessible)");
5431 else if (binfo
->igpmetric
)
5432 vty_out (vty
, " (metric %d)", binfo
->igpmetric
);
5433 vty_out (vty
, " from %s", sockunion2str (&binfo
->peer
->su
, buf
, SU_ADDRSTRLEN
));
5434 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
5435 vty_out (vty
, " (%s)", inet_ntoa (attr
->originator_id
));
5437 vty_out (vty
, " (%s)", inet_ntop (AF_INET
, &binfo
->peer
->remote_id
, buf1
, BUFSIZ
));
5439 vty_out (vty
, "%s", VTY_NEWLINE
);
5442 /* display nexthop local */
5443 if (attr
->mp_nexthop_len
== 32)
5445 vty_out (vty
, " (%s)%s",
5446 inet_ntop (AF_INET6
, &attr
->mp_nexthop_local
,
5447 buf
, INET6_ADDRSTRLEN
),
5450 #endif /* HAVE_IPV6 */
5452 /* Line 3 display Origin, Med, Locpref, Weight, valid, Int/Ext/Local, Atomic, best */
5453 vty_out (vty
, " Origin %s", bgp_origin_long_str
[attr
->origin
]);
5455 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
))
5456 vty_out (vty
, ", metric %d", attr
->med
);
5458 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
))
5459 vty_out (vty
, ", localpref %d", attr
->local_pref
);
5461 vty_out (vty
, ", localpref %d", bgp
->default_local_pref
);
5463 if (attr
->weight
!= 0)
5464 vty_out (vty
, ", weight %d", attr
->weight
);
5466 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5467 vty_out (vty
, ", valid");
5469 if (binfo
->peer
!= bgp
->peer_self
)
5471 if (binfo
->peer
->as
== binfo
->peer
->local_as
)
5472 vty_out (vty
, ", internal");
5474 vty_out (vty
, ", %s",
5475 (bgp_confederation_peers_check(bgp
, binfo
->peer
->as
) ? "confed-external" : "external"));
5477 else if (binfo
->sub_type
== BGP_ROUTE_AGGREGATE
)
5478 vty_out (vty
, ", aggregated, local");
5479 else if (binfo
->type
!= ZEBRA_ROUTE_BGP
)
5480 vty_out (vty
, ", sourced");
5482 vty_out (vty
, ", sourced, local");
5484 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
5485 vty_out (vty
, ", atomic-aggregate");
5487 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
5488 vty_out (vty
, ", best");
5490 vty_out (vty
, "%s", VTY_NEWLINE
);
5492 /* Line 4 display Community */
5493 if (attr
->community
)
5494 vty_out (vty
, " Community: %s%s", attr
->community
->str
,
5497 /* Line 5 display Extended-community */
5498 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
))
5499 vty_out (vty
, " Extended Community: %s%s", attr
->ecommunity
->str
,
5502 /* Line 6 display Originator, Cluster-id */
5503 if ((attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)) ||
5504 (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
)))
5506 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
5507 vty_out (vty
, " Originator: %s", inet_ntoa (attr
->originator_id
));
5509 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
5512 vty_out (vty
, ", Cluster list: ");
5513 for (i
= 0; i
< attr
->cluster
->length
/ 4; i
++)
5514 vty_out (vty
, "%s ", inet_ntoa (attr
->cluster
->list
[i
]));
5516 vty_out (vty
, "%s", VTY_NEWLINE
);
5519 if (binfo
->damp_info
)
5520 bgp_damp_info_vty (vty
, binfo
);
5522 /* Line 7 display Uptime */
5523 vty_out (vty
, " Last update: %s", ctime (&binfo
->uptime
));
5525 vty_out (vty
, "%s", VTY_NEWLINE
);
5528 #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s r RIB-failure, S Stale%s"
5529 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s"
5530 #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s"
5531 #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s"
5532 #define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path%s"
5536 bgp_show_type_normal
,
5537 bgp_show_type_regexp
,
5538 bgp_show_type_prefix_list
,
5539 bgp_show_type_filter_list
,
5540 bgp_show_type_route_map
,
5541 bgp_show_type_neighbor
,
5542 bgp_show_type_cidr_only
,
5543 bgp_show_type_prefix_longer
,
5544 bgp_show_type_community_all
,
5545 bgp_show_type_community
,
5546 bgp_show_type_community_exact
,
5547 bgp_show_type_community_list
,
5548 bgp_show_type_community_list_exact
,
5549 bgp_show_type_flap_statistics
,
5550 bgp_show_type_flap_address
,
5551 bgp_show_type_flap_prefix
,
5552 bgp_show_type_flap_cidr_only
,
5553 bgp_show_type_flap_regexp
,
5554 bgp_show_type_flap_filter_list
,
5555 bgp_show_type_flap_prefix_list
,
5556 bgp_show_type_flap_prefix_longer
,
5557 bgp_show_type_flap_route_map
,
5558 bgp_show_type_flap_neighbor
,
5559 bgp_show_type_dampend_paths
,
5560 bgp_show_type_damp_neighbor
5564 bgp_show_table (struct vty
*vty
, struct bgp_table
*table
, struct in_addr
*router_id
,
5565 enum bgp_show_type type
, void *output_arg
)
5567 struct bgp_info
*ri
;
5568 struct bgp_node
*rn
;
5571 unsigned long output_count
;
5573 /* This is first entry point, so reset total line. */
5576 /* Start processing of routes. */
5577 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
5578 if (rn
->info
!= NULL
)
5582 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5584 if (type
== bgp_show_type_flap_statistics
5585 || type
== bgp_show_type_flap_address
5586 || type
== bgp_show_type_flap_prefix
5587 || type
== bgp_show_type_flap_cidr_only
5588 || type
== bgp_show_type_flap_regexp
5589 || type
== bgp_show_type_flap_filter_list
5590 || type
== bgp_show_type_flap_prefix_list
5591 || type
== bgp_show_type_flap_prefix_longer
5592 || type
== bgp_show_type_flap_route_map
5593 || type
== bgp_show_type_flap_neighbor
5594 || type
== bgp_show_type_dampend_paths
5595 || type
== bgp_show_type_damp_neighbor
)
5597 if (! ri
->damp_info
)
5600 if (type
== bgp_show_type_regexp
5601 || type
== bgp_show_type_flap_regexp
)
5603 regex_t
*regex
= output_arg
;
5605 if (bgp_regexec (regex
, ri
->attr
->aspath
) == REG_NOMATCH
)
5608 if (type
== bgp_show_type_prefix_list
5609 || type
== bgp_show_type_flap_prefix_list
)
5611 struct prefix_list
*plist
= output_arg
;
5613 if (prefix_list_apply (plist
, &rn
->p
) != PREFIX_PERMIT
)
5616 if (type
== bgp_show_type_filter_list
5617 || type
== bgp_show_type_flap_filter_list
)
5619 struct as_list
*as_list
= output_arg
;
5621 if (as_list_apply (as_list
, ri
->attr
->aspath
) != AS_FILTER_PERMIT
)
5624 if (type
== bgp_show_type_route_map
5625 || type
== bgp_show_type_flap_route_map
)
5627 struct route_map
*rmap
= output_arg
;
5628 struct bgp_info binfo
;
5629 struct attr dummy_attr
;
5632 dummy_attr
= *ri
->attr
;
5633 binfo
.peer
= ri
->peer
;
5634 binfo
.attr
= &dummy_attr
;
5636 ret
= route_map_apply (rmap
, &rn
->p
, RMAP_BGP
, &binfo
);
5638 if (ret
== RMAP_DENYMATCH
)
5641 if (type
== bgp_show_type_neighbor
5642 || type
== bgp_show_type_flap_neighbor
5643 || type
== bgp_show_type_damp_neighbor
)
5645 union sockunion
*su
= output_arg
;
5647 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
5650 if (type
== bgp_show_type_cidr_only
5651 || type
== bgp_show_type_flap_cidr_only
)
5653 u_int32_t destination
;
5655 destination
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
5656 if (IN_CLASSC (destination
) && rn
->p
.prefixlen
== 24)
5658 if (IN_CLASSB (destination
) && rn
->p
.prefixlen
== 16)
5660 if (IN_CLASSA (destination
) && rn
->p
.prefixlen
== 8)
5663 if (type
== bgp_show_type_prefix_longer
5664 || type
== bgp_show_type_flap_prefix_longer
)
5666 struct prefix
*p
= output_arg
;
5668 if (! prefix_match (p
, &rn
->p
))
5671 if (type
== bgp_show_type_community_all
)
5673 if (! ri
->attr
->community
)
5676 if (type
== bgp_show_type_community
)
5678 struct community
*com
= output_arg
;
5680 if (! ri
->attr
->community
||
5681 ! community_match (ri
->attr
->community
, com
))
5684 if (type
== bgp_show_type_community_exact
)
5686 struct community
*com
= output_arg
;
5688 if (! ri
->attr
->community
||
5689 ! community_cmp (ri
->attr
->community
, com
))
5692 if (type
== bgp_show_type_community_list
)
5694 struct community_list
*list
= output_arg
;
5696 if (! community_list_match (ri
->attr
->community
, list
))
5699 if (type
== bgp_show_type_community_list_exact
)
5701 struct community_list
*list
= output_arg
;
5703 if (! community_list_exact_match (ri
->attr
->community
, list
))
5706 if (type
== bgp_show_type_flap_address
5707 || type
== bgp_show_type_flap_prefix
)
5709 struct prefix
*p
= output_arg
;
5711 if (! prefix_match (&rn
->p
, p
))
5714 if (type
== bgp_show_type_flap_prefix
)
5715 if (p
->prefixlen
!= rn
->p
.prefixlen
)
5718 if (type
== bgp_show_type_dampend_paths
5719 || type
== bgp_show_type_damp_neighbor
)
5721 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
5722 || CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
5728 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id
), VTY_NEWLINE
);
5729 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
5730 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
5731 if (type
== bgp_show_type_dampend_paths
5732 || type
== bgp_show_type_damp_neighbor
)
5733 vty_out (vty
, BGP_SHOW_DAMP_HEADER
, VTY_NEWLINE
);
5734 else if (type
== bgp_show_type_flap_statistics
5735 || type
== bgp_show_type_flap_address
5736 || type
== bgp_show_type_flap_prefix
5737 || type
== bgp_show_type_flap_cidr_only
5738 || type
== bgp_show_type_flap_regexp
5739 || type
== bgp_show_type_flap_filter_list
5740 || type
== bgp_show_type_flap_prefix_list
5741 || type
== bgp_show_type_flap_prefix_longer
5742 || type
== bgp_show_type_flap_route_map
5743 || type
== bgp_show_type_flap_neighbor
)
5744 vty_out (vty
, BGP_SHOW_FLAP_HEADER
, VTY_NEWLINE
);
5746 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
5750 if (type
== bgp_show_type_dampend_paths
5751 || type
== bgp_show_type_damp_neighbor
)
5752 damp_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
5753 else if (type
== bgp_show_type_flap_statistics
5754 || type
== bgp_show_type_flap_address
5755 || type
== bgp_show_type_flap_prefix
5756 || type
== bgp_show_type_flap_cidr_only
5757 || type
== bgp_show_type_flap_regexp
5758 || type
== bgp_show_type_flap_filter_list
5759 || type
== bgp_show_type_flap_prefix_list
5760 || type
== bgp_show_type_flap_prefix_longer
5761 || type
== bgp_show_type_flap_route_map
5762 || type
== bgp_show_type_flap_neighbor
)
5763 flap_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
5765 route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
5772 /* No route is displayed */
5773 if (output_count
== 0)
5775 if (type
== bgp_show_type_normal
)
5776 vty_out (vty
, "No BGP network exists%s", VTY_NEWLINE
);
5779 vty_out (vty
, "%sTotal number of prefixes %ld%s",
5780 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
5786 bgp_show (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
5787 enum bgp_show_type type
, void *output_arg
)
5789 struct bgp_table
*table
;
5792 bgp
= bgp_get_default ();
5797 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
5802 table
= bgp
->rib
[afi
][safi
];
5804 return bgp_show_table (vty
, table
, &bgp
->router_id
, type
, output_arg
);
5807 /* Header of detailed BGP route information */
5809 route_vty_out_detail_header (struct vty
*vty
, struct bgp
*bgp
,
5810 struct bgp_node
*rn
,
5811 struct prefix_rd
*prd
, afi_t afi
, safi_t safi
)
5813 struct bgp_info
*ri
;
5816 struct listnode
*node
, *nnode
;
5817 char buf1
[INET6_ADDRSTRLEN
];
5818 char buf2
[INET6_ADDRSTRLEN
];
5823 int no_advertise
= 0;
5828 vty_out (vty
, "BGP routing table entry for %s%s%s/%d%s",
5829 (safi
== SAFI_MPLS_VPN
?
5830 prefix_rd2str (prd
, buf1
, RD_ADDRSTRLEN
) : ""),
5831 safi
== SAFI_MPLS_VPN
? ":" : "",
5832 inet_ntop (p
->family
, &p
->u
.prefix
, buf2
, INET6_ADDRSTRLEN
),
5833 p
->prefixlen
, VTY_NEWLINE
);
5835 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5838 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
5843 if (ri
->attr
->community
!= NULL
)
5845 if (community_include (ri
->attr
->community
, COMMUNITY_NO_ADVERTISE
))
5847 if (community_include (ri
->attr
->community
, COMMUNITY_NO_EXPORT
))
5849 if (community_include (ri
->attr
->community
, COMMUNITY_LOCAL_AS
))
5855 vty_out (vty
, "Paths: (%d available", count
);
5858 vty_out (vty
, ", best #%d", best
);
5859 if (safi
== SAFI_UNICAST
)
5860 vty_out (vty
, ", table Default-IP-Routing-Table");
5863 vty_out (vty
, ", no best path");
5865 vty_out (vty
, ", not advertised to any peer");
5867 vty_out (vty
, ", not advertised to EBGP peer");
5869 vty_out (vty
, ", not advertised outside local AS");
5871 vty_out (vty
, ", Advertisements suppressed by an aggregate.");
5872 vty_out (vty
, ")%s", VTY_NEWLINE
);
5874 /* advertised peer */
5875 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
5877 if (bgp_adj_out_lookup (peer
, p
, afi
, safi
, rn
))
5880 vty_out (vty
, " Advertised to non peer-group peers:%s ", VTY_NEWLINE
);
5881 vty_out (vty
, " %s", sockunion2str (&peer
->su
, buf1
, SU_ADDRSTRLEN
));
5886 vty_out (vty
, " Not advertised to any peer");
5887 vty_out (vty
, "%s", VTY_NEWLINE
);
5890 /* Display specified route of BGP table. */
5892 bgp_show_route_in_table (struct vty
*vty
, struct bgp
*bgp
,
5893 struct bgp_table
*rib
, const char *ip_str
,
5894 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
5900 struct prefix match
;
5901 struct bgp_node
*rn
;
5902 struct bgp_node
*rm
;
5903 struct bgp_info
*ri
;
5904 struct bgp_table
*table
;
5906 /* Check IP address argument. */
5907 ret
= str2prefix (ip_str
, &match
);
5910 vty_out (vty
, "address is malformed%s", VTY_NEWLINE
);
5914 match
.family
= afi2family (afi
);
5916 if (safi
== SAFI_MPLS_VPN
)
5918 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
5920 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
5923 if ((table
= rn
->info
) != NULL
)
5927 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
5929 if (prefix_check
&& rm
->p
.prefixlen
!= match
.prefixlen
)
5932 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
5936 route_vty_out_detail_header (vty
, bgp
, rm
, (struct prefix_rd
*)&rn
->p
,
5937 AFI_IP
, SAFI_MPLS_VPN
);
5942 route_vty_out_detail (vty
, bgp
, &rm
->p
, ri
, AFI_IP
, SAFI_MPLS_VPN
);
5952 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
5954 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
5956 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5960 route_vty_out_detail_header (vty
, bgp
, rn
, NULL
, afi
, safi
);
5964 route_vty_out_detail (vty
, bgp
, &rn
->p
, ri
, afi
, safi
);
5972 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
5979 /* Display specified route of Main RIB */
5981 bgp_show_route (struct vty
*vty
, const char *view_name
, const char *ip_str
,
5982 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
5987 /* BGP structure lookup. */
5990 bgp
= bgp_lookup_by_name (view_name
);
5993 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
5999 bgp
= bgp_get_default ();
6002 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
6007 return bgp_show_route_in_table (vty
, bgp
, bgp
->rib
[afi
][safi
], ip_str
,
6008 afi
, safi
, prd
, prefix_check
);
6011 /* BGP route print out function. */
6019 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6022 DEFUN (show_ip_bgp_ipv4
,
6023 show_ip_bgp_ipv4_cmd
,
6024 "show ip bgp ipv4 (unicast|multicast)",
6029 "Address Family modifier\n"
6030 "Address Family modifier\n")
6032 if (strncmp (argv
[0], "m", 1) == 0)
6033 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, bgp_show_type_normal
,
6036 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6039 DEFUN (show_ip_bgp_route
,
6040 show_ip_bgp_route_cmd
,
6041 "show ip bgp A.B.C.D",
6045 "Network in the BGP routing table to display\n")
6047 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6050 DEFUN (show_ip_bgp_ipv4_route
,
6051 show_ip_bgp_ipv4_route_cmd
,
6052 "show ip bgp ipv4 (unicast|multicast) A.B.C.D",
6057 "Address Family modifier\n"
6058 "Address Family modifier\n"
6059 "Network in the BGP routing table to display\n")
6061 if (strncmp (argv
[0], "m", 1) == 0)
6062 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0);
6064 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6067 DEFUN (show_ip_bgp_vpnv4_all_route
,
6068 show_ip_bgp_vpnv4_all_route_cmd
,
6069 "show ip bgp vpnv4 all A.B.C.D",
6073 "Display VPNv4 NLRI specific information\n"
6074 "Display information about all VPNv4 NLRIs\n"
6075 "Network in the BGP routing table to display\n")
6077 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 0);
6080 DEFUN (show_ip_bgp_vpnv4_rd_route
,
6081 show_ip_bgp_vpnv4_rd_route_cmd
,
6082 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D",
6086 "Display VPNv4 NLRI specific information\n"
6087 "Display information for a route distinguisher\n"
6088 "VPN Route Distinguisher\n"
6089 "Network in the BGP routing table to display\n")
6092 struct prefix_rd prd
;
6094 ret
= str2prefix_rd (argv
[0], &prd
);
6097 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
6100 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 0);
6103 DEFUN (show_ip_bgp_prefix
,
6104 show_ip_bgp_prefix_cmd
,
6105 "show ip bgp A.B.C.D/M",
6109 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6111 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6114 DEFUN (show_ip_bgp_ipv4_prefix
,
6115 show_ip_bgp_ipv4_prefix_cmd
,
6116 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M",
6121 "Address Family modifier\n"
6122 "Address Family modifier\n"
6123 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6125 if (strncmp (argv
[0], "m", 1) == 0)
6126 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1);
6128 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6131 DEFUN (show_ip_bgp_vpnv4_all_prefix
,
6132 show_ip_bgp_vpnv4_all_prefix_cmd
,
6133 "show ip bgp vpnv4 all A.B.C.D/M",
6137 "Display VPNv4 NLRI specific information\n"
6138 "Display information about all VPNv4 NLRIs\n"
6139 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6141 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 1);
6144 DEFUN (show_ip_bgp_vpnv4_rd_prefix
,
6145 show_ip_bgp_vpnv4_rd_prefix_cmd
,
6146 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M",
6150 "Display VPNv4 NLRI specific information\n"
6151 "Display information for a route distinguisher\n"
6152 "VPN Route Distinguisher\n"
6153 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6156 struct prefix_rd prd
;
6158 ret
= str2prefix_rd (argv
[0], &prd
);
6161 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
6164 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 1);
6167 DEFUN (show_ip_bgp_view
,
6168 show_ip_bgp_view_cmd
,
6169 "show ip bgp view WORD",
6178 /* BGP structure lookup. */
6179 bgp
= bgp_lookup_by_name (argv
[0]);
6182 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
6186 return bgp_show (vty
, bgp
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6189 DEFUN (show_ip_bgp_view_route
,
6190 show_ip_bgp_view_route_cmd
,
6191 "show ip bgp view WORD A.B.C.D",
6197 "Network in the BGP routing table to display\n")
6199 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6202 DEFUN (show_ip_bgp_view_prefix
,
6203 show_ip_bgp_view_prefix_cmd
,
6204 "show ip bgp view WORD A.B.C.D/M",
6210 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6212 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6222 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
6234 DEFUN (show_ipv6_bgp
,
6241 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
6245 DEFUN (show_bgp_route
,
6247 "show bgp X:X::X:X",
6250 "Network in the BGP routing table to display\n")
6252 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6255 ALIAS (show_bgp_route
,
6256 show_bgp_ipv6_route_cmd
,
6257 "show bgp ipv6 X:X::X:X",
6261 "Network in the BGP routing table to display\n")
6264 DEFUN (show_ipv6_bgp_route
,
6265 show_ipv6_bgp_route_cmd
,
6266 "show ipv6 bgp X:X::X:X",
6270 "Network in the BGP routing table to display\n")
6272 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6275 DEFUN (show_bgp_prefix
,
6276 show_bgp_prefix_cmd
,
6277 "show bgp X:X::X:X/M",
6280 "IPv6 prefix <network>/<length>\n")
6282 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6285 ALIAS (show_bgp_prefix
,
6286 show_bgp_ipv6_prefix_cmd
,
6287 "show bgp ipv6 X:X::X:X/M",
6291 "IPv6 prefix <network>/<length>\n")
6294 DEFUN (show_ipv6_bgp_prefix
,
6295 show_ipv6_bgp_prefix_cmd
,
6296 "show ipv6 bgp X:X::X:X/M",
6300 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6302 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6305 DEFUN (show_bgp_view
,
6307 "show bgp view WORD",
6315 /* BGP structure lookup. */
6316 bgp
= bgp_lookup_by_name (argv
[0]);
6319 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
6323 return bgp_show (vty
, bgp
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6326 ALIAS (show_bgp_view
,
6327 show_bgp_view_ipv6_cmd
,
6328 "show bgp view WORD ipv6",
6335 DEFUN (show_bgp_view_route
,
6336 show_bgp_view_route_cmd
,
6337 "show bgp view WORD X:X::X:X",
6342 "Network in the BGP routing table to display\n")
6344 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6347 ALIAS (show_bgp_view_route
,
6348 show_bgp_view_ipv6_route_cmd
,
6349 "show bgp view WORD ipv6 X:X::X:X",
6355 "Network in the BGP routing table to display\n")
6357 DEFUN (show_bgp_view_prefix
,
6358 show_bgp_view_prefix_cmd
,
6359 "show bgp view WORD X:X::X:X/M",
6364 "IPv6 prefix <network>/<length>\n")
6366 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6369 ALIAS (show_bgp_view_prefix
,
6370 show_bgp_view_ipv6_prefix_cmd
,
6371 "show bgp view WORD ipv6 X:X::X:X/M",
6377 "IPv6 prefix <network>/<length>\n")
6380 DEFUN (show_ipv6_mbgp
,
6387 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
6392 DEFUN (show_ipv6_mbgp_route
,
6393 show_ipv6_mbgp_route_cmd
,
6394 "show ipv6 mbgp X:X::X:X",
6398 "Network in the MBGP routing table to display\n")
6400 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0);
6404 DEFUN (show_ipv6_mbgp_prefix
,
6405 show_ipv6_mbgp_prefix_cmd
,
6406 "show ipv6 mbgp X:X::X:X/M",
6410 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6412 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1);
6418 bgp_show_regexp (struct vty
*vty
, int argc
, const char **argv
, afi_t afi
,
6419 safi_t safi
, enum bgp_show_type type
)
6429 b
= buffer_new (1024);
6430 for (i
= 0; i
< argc
; i
++)
6433 buffer_putc (b
, ' ');
6436 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
6441 buffer_putstr (b
, argv
[i
]);
6443 buffer_putc (b
, '\0');
6445 regstr
= buffer_getstr (b
);
6448 regex
= bgp_regcomp (regstr
);
6449 XFREE(MTYPE_TMP
, regstr
);
6452 vty_out (vty
, "Can't compile regexp %s%s", argv
[0],
6457 rc
= bgp_show (vty
, NULL
, afi
, safi
, type
, regex
);
6458 bgp_regex_free (regex
);
6462 DEFUN (show_ip_bgp_regexp
,
6463 show_ip_bgp_regexp_cmd
,
6464 "show ip bgp regexp .LINE",
6468 "Display routes matching the AS path regular expression\n"
6469 "A regular-expression to match the BGP AS paths\n")
6471 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
6472 bgp_show_type_regexp
);
6475 DEFUN (show_ip_bgp_flap_regexp
,
6476 show_ip_bgp_flap_regexp_cmd
,
6477 "show ip bgp flap-statistics regexp .LINE",
6481 "Display flap statistics of routes\n"
6482 "Display routes matching the AS path regular expression\n"
6483 "A regular-expression to match the BGP AS paths\n")
6485 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
6486 bgp_show_type_flap_regexp
);
6489 DEFUN (show_ip_bgp_ipv4_regexp
,
6490 show_ip_bgp_ipv4_regexp_cmd
,
6491 "show ip bgp ipv4 (unicast|multicast) regexp .LINE",
6496 "Address Family modifier\n"
6497 "Address Family modifier\n"
6498 "Display routes matching the AS path regular expression\n"
6499 "A regular-expression to match the BGP AS paths\n")
6501 if (strncmp (argv
[0], "m", 1) == 0)
6502 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_MULTICAST
,
6503 bgp_show_type_regexp
);
6505 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
6506 bgp_show_type_regexp
);
6510 DEFUN (show_bgp_regexp
,
6511 show_bgp_regexp_cmd
,
6512 "show bgp regexp .LINE",
6515 "Display routes matching the AS path regular expression\n"
6516 "A regular-expression to match the BGP AS paths\n")
6518 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
6519 bgp_show_type_regexp
);
6522 ALIAS (show_bgp_regexp
,
6523 show_bgp_ipv6_regexp_cmd
,
6524 "show bgp ipv6 regexp .LINE",
6528 "Display routes matching the AS path regular expression\n"
6529 "A regular-expression to match the BGP AS paths\n")
6532 DEFUN (show_ipv6_bgp_regexp
,
6533 show_ipv6_bgp_regexp_cmd
,
6534 "show ipv6 bgp regexp .LINE",
6538 "Display routes matching the AS path regular expression\n"
6539 "A regular-expression to match the BGP AS paths\n")
6541 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
6542 bgp_show_type_regexp
);
6546 DEFUN (show_ipv6_mbgp_regexp
,
6547 show_ipv6_mbgp_regexp_cmd
,
6548 "show ipv6 mbgp regexp .LINE",
6552 "Display routes matching the AS path regular expression\n"
6553 "A regular-expression to match the MBGP AS paths\n")
6555 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_MULTICAST
,
6556 bgp_show_type_regexp
);
6558 #endif /* HAVE_IPV6 */
6561 bgp_show_prefix_list (struct vty
*vty
, const char *prefix_list_str
, afi_t afi
,
6562 safi_t safi
, enum bgp_show_type type
)
6564 struct prefix_list
*plist
;
6566 plist
= prefix_list_lookup (afi
, prefix_list_str
);
6569 vty_out (vty
, "%% %s is not a valid prefix-list name%s",
6570 prefix_list_str
, VTY_NEWLINE
);
6574 return bgp_show (vty
, NULL
, afi
, safi
, type
, plist
);
6577 DEFUN (show_ip_bgp_prefix_list
,
6578 show_ip_bgp_prefix_list_cmd
,
6579 "show ip bgp prefix-list WORD",
6583 "Display routes conforming to the prefix-list\n"
6584 "IP prefix-list name\n")
6586 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6587 bgp_show_type_prefix_list
);
6590 DEFUN (show_ip_bgp_flap_prefix_list
,
6591 show_ip_bgp_flap_prefix_list_cmd
,
6592 "show ip bgp flap-statistics prefix-list WORD",
6596 "Display flap statistics of routes\n"
6597 "Display routes conforming to the prefix-list\n"
6598 "IP prefix-list name\n")
6600 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6601 bgp_show_type_flap_prefix_list
);
6604 DEFUN (show_ip_bgp_ipv4_prefix_list
,
6605 show_ip_bgp_ipv4_prefix_list_cmd
,
6606 "show ip bgp ipv4 (unicast|multicast) prefix-list WORD",
6611 "Address Family modifier\n"
6612 "Address Family modifier\n"
6613 "Display routes conforming to the prefix-list\n"
6614 "IP prefix-list name\n")
6616 if (strncmp (argv
[0], "m", 1) == 0)
6617 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
6618 bgp_show_type_prefix_list
);
6620 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
6621 bgp_show_type_prefix_list
);
6625 DEFUN (show_bgp_prefix_list
,
6626 show_bgp_prefix_list_cmd
,
6627 "show bgp prefix-list WORD",
6630 "Display routes conforming to the prefix-list\n"
6631 "IPv6 prefix-list name\n")
6633 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6634 bgp_show_type_prefix_list
);
6637 ALIAS (show_bgp_prefix_list
,
6638 show_bgp_ipv6_prefix_list_cmd
,
6639 "show bgp ipv6 prefix-list WORD",
6643 "Display routes conforming to the prefix-list\n"
6644 "IPv6 prefix-list name\n")
6647 DEFUN (show_ipv6_bgp_prefix_list
,
6648 show_ipv6_bgp_prefix_list_cmd
,
6649 "show ipv6 bgp prefix-list WORD",
6653 "Display routes matching the prefix-list\n"
6654 "IPv6 prefix-list name\n")
6656 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6657 bgp_show_type_prefix_list
);
6661 DEFUN (show_ipv6_mbgp_prefix_list
,
6662 show_ipv6_mbgp_prefix_list_cmd
,
6663 "show ipv6 mbgp prefix-list WORD",
6667 "Display routes matching the prefix-list\n"
6668 "IPv6 prefix-list name\n")
6670 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
6671 bgp_show_type_prefix_list
);
6673 #endif /* HAVE_IPV6 */
6676 bgp_show_filter_list (struct vty
*vty
, const char *filter
, afi_t afi
,
6677 safi_t safi
, enum bgp_show_type type
)
6679 struct as_list
*as_list
;
6681 as_list
= as_list_lookup (filter
);
6682 if (as_list
== NULL
)
6684 vty_out (vty
, "%% %s is not a valid AS-path access-list name%s", filter
, VTY_NEWLINE
);
6688 return bgp_show (vty
, NULL
, afi
, safi
, type
, as_list
);
6691 DEFUN (show_ip_bgp_filter_list
,
6692 show_ip_bgp_filter_list_cmd
,
6693 "show ip bgp filter-list WORD",
6697 "Display routes conforming to the filter-list\n"
6698 "Regular expression access list name\n")
6700 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6701 bgp_show_type_filter_list
);
6704 DEFUN (show_ip_bgp_flap_filter_list
,
6705 show_ip_bgp_flap_filter_list_cmd
,
6706 "show ip bgp flap-statistics filter-list WORD",
6710 "Display flap statistics of routes\n"
6711 "Display routes conforming to the filter-list\n"
6712 "Regular expression access list name\n")
6714 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6715 bgp_show_type_flap_filter_list
);
6718 DEFUN (show_ip_bgp_ipv4_filter_list
,
6719 show_ip_bgp_ipv4_filter_list_cmd
,
6720 "show ip bgp ipv4 (unicast|multicast) filter-list WORD",
6725 "Address Family modifier\n"
6726 "Address Family modifier\n"
6727 "Display routes conforming to the filter-list\n"
6728 "Regular expression access list name\n")
6730 if (strncmp (argv
[0], "m", 1) == 0)
6731 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
6732 bgp_show_type_filter_list
);
6734 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
6735 bgp_show_type_filter_list
);
6739 DEFUN (show_bgp_filter_list
,
6740 show_bgp_filter_list_cmd
,
6741 "show bgp filter-list WORD",
6744 "Display routes conforming to the filter-list\n"
6745 "Regular expression access list name\n")
6747 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6748 bgp_show_type_filter_list
);
6751 ALIAS (show_bgp_filter_list
,
6752 show_bgp_ipv6_filter_list_cmd
,
6753 "show bgp ipv6 filter-list WORD",
6757 "Display routes conforming to the filter-list\n"
6758 "Regular expression access list name\n")
6761 DEFUN (show_ipv6_bgp_filter_list
,
6762 show_ipv6_bgp_filter_list_cmd
,
6763 "show ipv6 bgp filter-list WORD",
6767 "Display routes conforming to the filter-list\n"
6768 "Regular expression access list name\n")
6770 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6771 bgp_show_type_filter_list
);
6775 DEFUN (show_ipv6_mbgp_filter_list
,
6776 show_ipv6_mbgp_filter_list_cmd
,
6777 "show ipv6 mbgp filter-list WORD",
6781 "Display routes conforming to the filter-list\n"
6782 "Regular expression access list name\n")
6784 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
6785 bgp_show_type_filter_list
);
6787 #endif /* HAVE_IPV6 */
6790 bgp_show_route_map (struct vty
*vty
, const char *rmap_str
, afi_t afi
,
6791 safi_t safi
, enum bgp_show_type type
)
6793 struct route_map
*rmap
;
6795 rmap
= route_map_lookup_by_name (rmap_str
);
6798 vty_out (vty
, "%% %s is not a valid route-map name%s",
6799 rmap_str
, VTY_NEWLINE
);
6803 return bgp_show (vty
, NULL
, afi
, safi
, type
, rmap
);
6806 DEFUN (show_ip_bgp_route_map
,
6807 show_ip_bgp_route_map_cmd
,
6808 "show ip bgp route-map WORD",
6812 "Display routes matching the route-map\n"
6813 "A route-map to match on\n")
6815 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6816 bgp_show_type_route_map
);
6819 DEFUN (show_ip_bgp_flap_route_map
,
6820 show_ip_bgp_flap_route_map_cmd
,
6821 "show ip bgp flap-statistics route-map WORD",
6825 "Display flap statistics of routes\n"
6826 "Display routes matching the route-map\n"
6827 "A route-map to match on\n")
6829 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
6830 bgp_show_type_flap_route_map
);
6833 DEFUN (show_ip_bgp_ipv4_route_map
,
6834 show_ip_bgp_ipv4_route_map_cmd
,
6835 "show ip bgp ipv4 (unicast|multicast) route-map WORD",
6840 "Address Family modifier\n"
6841 "Address Family modifier\n"
6842 "Display routes matching the route-map\n"
6843 "A route-map to match on\n")
6845 if (strncmp (argv
[0], "m", 1) == 0)
6846 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
6847 bgp_show_type_route_map
);
6849 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
6850 bgp_show_type_route_map
);
6853 DEFUN (show_bgp_route_map
,
6854 show_bgp_route_map_cmd
,
6855 "show bgp route-map WORD",
6858 "Display routes matching the route-map\n"
6859 "A route-map to match on\n")
6861 return bgp_show_route_map (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
6862 bgp_show_type_route_map
);
6865 ALIAS (show_bgp_route_map
,
6866 show_bgp_ipv6_route_map_cmd
,
6867 "show bgp ipv6 route-map WORD",
6871 "Display routes matching the route-map\n"
6872 "A route-map to match on\n")
6874 DEFUN (show_ip_bgp_cidr_only
,
6875 show_ip_bgp_cidr_only_cmd
,
6876 "show ip bgp cidr-only",
6880 "Display only routes with non-natural netmasks\n")
6882 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6883 bgp_show_type_cidr_only
, NULL
);
6886 DEFUN (show_ip_bgp_flap_cidr_only
,
6887 show_ip_bgp_flap_cidr_only_cmd
,
6888 "show ip bgp flap-statistics cidr-only",
6892 "Display flap statistics of routes\n"
6893 "Display only routes with non-natural netmasks\n")
6895 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6896 bgp_show_type_flap_cidr_only
, NULL
);
6899 DEFUN (show_ip_bgp_ipv4_cidr_only
,
6900 show_ip_bgp_ipv4_cidr_only_cmd
,
6901 "show ip bgp ipv4 (unicast|multicast) cidr-only",
6906 "Address Family modifier\n"
6907 "Address Family modifier\n"
6908 "Display only routes with non-natural netmasks\n")
6910 if (strncmp (argv
[0], "m", 1) == 0)
6911 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
6912 bgp_show_type_cidr_only
, NULL
);
6914 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6915 bgp_show_type_cidr_only
, NULL
);
6918 DEFUN (show_ip_bgp_community_all
,
6919 show_ip_bgp_community_all_cmd
,
6920 "show ip bgp community",
6924 "Display routes matching the communities\n")
6926 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6927 bgp_show_type_community_all
, NULL
);
6930 DEFUN (show_ip_bgp_ipv4_community_all
,
6931 show_ip_bgp_ipv4_community_all_cmd
,
6932 "show ip bgp ipv4 (unicast|multicast) community",
6937 "Address Family modifier\n"
6938 "Address Family modifier\n"
6939 "Display routes matching the communities\n")
6941 if (strncmp (argv
[0], "m", 1) == 0)
6942 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
6943 bgp_show_type_community_all
, NULL
);
6945 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
6946 bgp_show_type_community_all
, NULL
);
6950 DEFUN (show_bgp_community_all
,
6951 show_bgp_community_all_cmd
,
6952 "show bgp community",
6955 "Display routes matching the communities\n")
6957 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
6958 bgp_show_type_community_all
, NULL
);
6961 ALIAS (show_bgp_community_all
,
6962 show_bgp_ipv6_community_all_cmd
,
6963 "show bgp ipv6 community",
6967 "Display routes matching the communities\n")
6970 DEFUN (show_ipv6_bgp_community_all
,
6971 show_ipv6_bgp_community_all_cmd
,
6972 "show ipv6 bgp community",
6976 "Display routes matching the communities\n")
6978 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
6979 bgp_show_type_community_all
, NULL
);
6983 DEFUN (show_ipv6_mbgp_community_all
,
6984 show_ipv6_mbgp_community_all_cmd
,
6985 "show ipv6 mbgp community",
6989 "Display routes matching the communities\n")
6991 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
,
6992 bgp_show_type_community_all
, NULL
);
6994 #endif /* HAVE_IPV6 */
6997 bgp_show_community (struct vty
*vty
, int argc
, const char **argv
, int exact
,
6998 u_int16_t afi
, u_char safi
)
7000 struct community
*com
;
7006 b
= buffer_new (1024);
7007 for (i
= 0; i
< argc
; i
++)
7010 buffer_putc (b
, ' ');
7013 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
7018 buffer_putstr (b
, argv
[i
]);
7020 buffer_putc (b
, '\0');
7022 str
= buffer_getstr (b
);
7025 com
= community_str2com (str
);
7026 XFREE (MTYPE_TMP
, str
);
7029 vty_out (vty
, "%% Community malformed: %s", VTY_NEWLINE
);
7033 return bgp_show (vty
, NULL
, afi
, safi
,
7034 (exact
? bgp_show_type_community_exact
:
7035 bgp_show_type_community
), com
);
7038 DEFUN (show_ip_bgp_community
,
7039 show_ip_bgp_community_cmd
,
7040 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export)",
7044 "Display routes matching the communities\n"
7045 "community number\n"
7046 "Do not send outside local AS (well-known community)\n"
7047 "Do not advertise to any peer (well-known community)\n"
7048 "Do not export to next AS (well-known community)\n")
7050 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
7053 ALIAS (show_ip_bgp_community
,
7054 show_ip_bgp_community2_cmd
,
7055 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7059 "Display routes matching the communities\n"
7060 "community number\n"
7061 "Do not send outside local AS (well-known community)\n"
7062 "Do not advertise to any peer (well-known community)\n"
7063 "Do not export to next AS (well-known community)\n"
7064 "community number\n"
7065 "Do not send outside local AS (well-known community)\n"
7066 "Do not advertise to any peer (well-known community)\n"
7067 "Do not export to next AS (well-known community)\n")
7069 ALIAS (show_ip_bgp_community
,
7070 show_ip_bgp_community3_cmd
,
7071 "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)",
7075 "Display routes matching the communities\n"
7076 "community number\n"
7077 "Do not send outside local AS (well-known community)\n"
7078 "Do not advertise to any peer (well-known community)\n"
7079 "Do not export to next AS (well-known community)\n"
7080 "community number\n"
7081 "Do not send outside local AS (well-known community)\n"
7082 "Do not advertise to any peer (well-known community)\n"
7083 "Do not export to next AS (well-known community)\n"
7084 "community number\n"
7085 "Do not send outside local AS (well-known community)\n"
7086 "Do not advertise to any peer (well-known community)\n"
7087 "Do not export to next AS (well-known community)\n")
7089 ALIAS (show_ip_bgp_community
,
7090 show_ip_bgp_community4_cmd
,
7091 "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)",
7095 "Display routes matching the communities\n"
7096 "community number\n"
7097 "Do not send outside local AS (well-known community)\n"
7098 "Do not advertise to any peer (well-known community)\n"
7099 "Do not export to next AS (well-known community)\n"
7100 "community number\n"
7101 "Do not send outside local AS (well-known community)\n"
7102 "Do not advertise to any peer (well-known community)\n"
7103 "Do not export to next AS (well-known community)\n"
7104 "community number\n"
7105 "Do not send outside local AS (well-known community)\n"
7106 "Do not advertise to any peer (well-known community)\n"
7107 "Do not export to next AS (well-known community)\n"
7108 "community number\n"
7109 "Do not send outside local AS (well-known community)\n"
7110 "Do not advertise to any peer (well-known community)\n"
7111 "Do not export to next AS (well-known community)\n")
7113 DEFUN (show_ip_bgp_ipv4_community
,
7114 show_ip_bgp_ipv4_community_cmd
,
7115 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
7120 "Address Family modifier\n"
7121 "Address Family modifier\n"
7122 "Display routes matching the communities\n"
7123 "community number\n"
7124 "Do not send outside local AS (well-known community)\n"
7125 "Do not advertise to any peer (well-known community)\n"
7126 "Do not export to next AS (well-known community)\n")
7128 if (strncmp (argv
[0], "m", 1) == 0)
7129 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_MULTICAST
);
7131 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
7134 ALIAS (show_ip_bgp_ipv4_community
,
7135 show_ip_bgp_ipv4_community2_cmd
,
7136 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7141 "Address Family modifier\n"
7142 "Address Family modifier\n"
7143 "Display routes matching the communities\n"
7144 "community number\n"
7145 "Do not send outside local AS (well-known community)\n"
7146 "Do not advertise to any peer (well-known community)\n"
7147 "Do not export to next AS (well-known community)\n"
7148 "community number\n"
7149 "Do not send outside local AS (well-known community)\n"
7150 "Do not advertise to any peer (well-known community)\n"
7151 "Do not export to next AS (well-known community)\n")
7153 ALIAS (show_ip_bgp_ipv4_community
,
7154 show_ip_bgp_ipv4_community3_cmd
,
7155 "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)",
7160 "Address Family modifier\n"
7161 "Address Family modifier\n"
7162 "Display routes matching the communities\n"
7163 "community number\n"
7164 "Do not send outside local AS (well-known community)\n"
7165 "Do not advertise to any peer (well-known community)\n"
7166 "Do not export to next AS (well-known community)\n"
7167 "community number\n"
7168 "Do not send outside local AS (well-known community)\n"
7169 "Do not advertise to any peer (well-known community)\n"
7170 "Do not export to next AS (well-known community)\n"
7171 "community number\n"
7172 "Do not send outside local AS (well-known community)\n"
7173 "Do not advertise to any peer (well-known community)\n"
7174 "Do not export to next AS (well-known community)\n")
7176 ALIAS (show_ip_bgp_ipv4_community
,
7177 show_ip_bgp_ipv4_community4_cmd
,
7178 "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)",
7183 "Address Family modifier\n"
7184 "Address Family modifier\n"
7185 "Display routes matching the communities\n"
7186 "community number\n"
7187 "Do not send outside local AS (well-known community)\n"
7188 "Do not advertise to any peer (well-known community)\n"
7189 "Do not export to next AS (well-known community)\n"
7190 "community number\n"
7191 "Do not send outside local AS (well-known community)\n"
7192 "Do not advertise to any peer (well-known community)\n"
7193 "Do not export to next AS (well-known community)\n"
7194 "community number\n"
7195 "Do not send outside local AS (well-known community)\n"
7196 "Do not advertise to any peer (well-known community)\n"
7197 "Do not export to next AS (well-known community)\n"
7198 "community number\n"
7199 "Do not send outside local AS (well-known community)\n"
7200 "Do not advertise to any peer (well-known community)\n"
7201 "Do not export to next AS (well-known community)\n")
7203 DEFUN (show_ip_bgp_community_exact
,
7204 show_ip_bgp_community_exact_cmd
,
7205 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7209 "Display routes matching the communities\n"
7210 "community number\n"
7211 "Do not send outside local AS (well-known community)\n"
7212 "Do not advertise to any peer (well-known community)\n"
7213 "Do not export to next AS (well-known community)\n"
7214 "Exact match of the communities")
7216 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
7219 ALIAS (show_ip_bgp_community_exact
,
7220 show_ip_bgp_community2_exact_cmd
,
7221 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7225 "Display routes matching the communities\n"
7226 "community number\n"
7227 "Do not send outside local AS (well-known community)\n"
7228 "Do not advertise to any peer (well-known community)\n"
7229 "Do not export to next AS (well-known community)\n"
7230 "community number\n"
7231 "Do not send outside local AS (well-known community)\n"
7232 "Do not advertise to any peer (well-known community)\n"
7233 "Do not export to next AS (well-known community)\n"
7234 "Exact match of the communities")
7236 ALIAS (show_ip_bgp_community_exact
,
7237 show_ip_bgp_community3_exact_cmd
,
7238 "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",
7242 "Display routes matching the communities\n"
7243 "community number\n"
7244 "Do not send outside local AS (well-known community)\n"
7245 "Do not advertise to any peer (well-known community)\n"
7246 "Do not export to next AS (well-known community)\n"
7247 "community number\n"
7248 "Do not send outside local AS (well-known community)\n"
7249 "Do not advertise to any peer (well-known community)\n"
7250 "Do not export to next AS (well-known community)\n"
7251 "community number\n"
7252 "Do not send outside local AS (well-known community)\n"
7253 "Do not advertise to any peer (well-known community)\n"
7254 "Do not export to next AS (well-known community)\n"
7255 "Exact match of the communities")
7257 ALIAS (show_ip_bgp_community_exact
,
7258 show_ip_bgp_community4_exact_cmd
,
7259 "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",
7263 "Display routes matching the communities\n"
7264 "community number\n"
7265 "Do not send outside local AS (well-known community)\n"
7266 "Do not advertise to any peer (well-known community)\n"
7267 "Do not export to next AS (well-known community)\n"
7268 "community number\n"
7269 "Do not send outside local AS (well-known community)\n"
7270 "Do not advertise to any peer (well-known community)\n"
7271 "Do not export to next AS (well-known community)\n"
7272 "community number\n"
7273 "Do not send outside local AS (well-known community)\n"
7274 "Do not advertise to any peer (well-known community)\n"
7275 "Do not export to next AS (well-known community)\n"
7276 "community number\n"
7277 "Do not send outside local AS (well-known community)\n"
7278 "Do not advertise to any peer (well-known community)\n"
7279 "Do not export to next AS (well-known community)\n"
7280 "Exact match of the communities")
7282 DEFUN (show_ip_bgp_ipv4_community_exact
,
7283 show_ip_bgp_ipv4_community_exact_cmd
,
7284 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7289 "Address Family modifier\n"
7290 "Address Family modifier\n"
7291 "Display routes matching the communities\n"
7292 "community number\n"
7293 "Do not send outside local AS (well-known community)\n"
7294 "Do not advertise to any peer (well-known community)\n"
7295 "Do not export to next AS (well-known community)\n"
7296 "Exact match of the communities")
7298 if (strncmp (argv
[0], "m", 1) == 0)
7299 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_MULTICAST
);
7301 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
7304 ALIAS (show_ip_bgp_ipv4_community_exact
,
7305 show_ip_bgp_ipv4_community2_exact_cmd
,
7306 "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",
7311 "Address Family modifier\n"
7312 "Address Family modifier\n"
7313 "Display routes matching the communities\n"
7314 "community number\n"
7315 "Do not send outside local AS (well-known community)\n"
7316 "Do not advertise to any peer (well-known community)\n"
7317 "Do not export to next AS (well-known community)\n"
7318 "community number\n"
7319 "Do not send outside local AS (well-known community)\n"
7320 "Do not advertise to any peer (well-known community)\n"
7321 "Do not export to next AS (well-known community)\n"
7322 "Exact match of the communities")
7324 ALIAS (show_ip_bgp_ipv4_community_exact
,
7325 show_ip_bgp_ipv4_community3_exact_cmd
,
7326 "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",
7331 "Address Family modifier\n"
7332 "Address Family modifier\n"
7333 "Display routes matching the communities\n"
7334 "community number\n"
7335 "Do not send outside local AS (well-known community)\n"
7336 "Do not advertise to any peer (well-known community)\n"
7337 "Do not export to next AS (well-known community)\n"
7338 "community number\n"
7339 "Do not send outside local AS (well-known community)\n"
7340 "Do not advertise to any peer (well-known community)\n"
7341 "Do not export to next AS (well-known community)\n"
7342 "community number\n"
7343 "Do not send outside local AS (well-known community)\n"
7344 "Do not advertise to any peer (well-known community)\n"
7345 "Do not export to next AS (well-known community)\n"
7346 "Exact match of the communities")
7348 ALIAS (show_ip_bgp_ipv4_community_exact
,
7349 show_ip_bgp_ipv4_community4_exact_cmd
,
7350 "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",
7355 "Address Family modifier\n"
7356 "Address Family modifier\n"
7357 "Display routes matching the communities\n"
7358 "community number\n"
7359 "Do not send outside local AS (well-known community)\n"
7360 "Do not advertise to any peer (well-known community)\n"
7361 "Do not export to next AS (well-known community)\n"
7362 "community number\n"
7363 "Do not send outside local AS (well-known community)\n"
7364 "Do not advertise to any peer (well-known community)\n"
7365 "Do not export to next AS (well-known community)\n"
7366 "community number\n"
7367 "Do not send outside local AS (well-known community)\n"
7368 "Do not advertise to any peer (well-known community)\n"
7369 "Do not export to next AS (well-known community)\n"
7370 "community number\n"
7371 "Do not send outside local AS (well-known community)\n"
7372 "Do not advertise to any peer (well-known community)\n"
7373 "Do not export to next AS (well-known community)\n"
7374 "Exact match of the communities")
7377 DEFUN (show_bgp_community
,
7378 show_bgp_community_cmd
,
7379 "show bgp community (AA:NN|local-AS|no-advertise|no-export)",
7382 "Display routes matching the communities\n"
7383 "community number\n"
7384 "Do not send outside local AS (well-known community)\n"
7385 "Do not advertise to any peer (well-known community)\n"
7386 "Do not export to next AS (well-known community)\n")
7388 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
7391 ALIAS (show_bgp_community
,
7392 show_bgp_ipv6_community_cmd
,
7393 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)",
7397 "Display routes matching the communities\n"
7398 "community number\n"
7399 "Do not send outside local AS (well-known community)\n"
7400 "Do not advertise to any peer (well-known community)\n"
7401 "Do not export to next AS (well-known community)\n")
7403 ALIAS (show_bgp_community
,
7404 show_bgp_community2_cmd
,
7405 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7408 "Display routes matching the communities\n"
7409 "community number\n"
7410 "Do not send outside local AS (well-known community)\n"
7411 "Do not advertise to any peer (well-known community)\n"
7412 "Do not export to next AS (well-known community)\n"
7413 "community number\n"
7414 "Do not send outside local AS (well-known community)\n"
7415 "Do not advertise to any peer (well-known community)\n"
7416 "Do not export to next AS (well-known community)\n")
7418 ALIAS (show_bgp_community
,
7419 show_bgp_ipv6_community2_cmd
,
7420 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7424 "Display routes matching the communities\n"
7425 "community number\n"
7426 "Do not send outside local AS (well-known community)\n"
7427 "Do not advertise to any peer (well-known community)\n"
7428 "Do not export to next AS (well-known community)\n"
7429 "community number\n"
7430 "Do not send outside local AS (well-known community)\n"
7431 "Do not advertise to any peer (well-known community)\n"
7432 "Do not export to next AS (well-known community)\n")
7434 ALIAS (show_bgp_community
,
7435 show_bgp_community3_cmd
,
7436 "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)",
7439 "Display routes matching the communities\n"
7440 "community number\n"
7441 "Do not send outside local AS (well-known community)\n"
7442 "Do not advertise to any peer (well-known community)\n"
7443 "Do not export to next AS (well-known community)\n"
7444 "community number\n"
7445 "Do not send outside local AS (well-known community)\n"
7446 "Do not advertise to any peer (well-known community)\n"
7447 "Do not export to next AS (well-known community)\n"
7448 "community number\n"
7449 "Do not send outside local AS (well-known community)\n"
7450 "Do not advertise to any peer (well-known community)\n"
7451 "Do not export to next AS (well-known community)\n")
7453 ALIAS (show_bgp_community
,
7454 show_bgp_ipv6_community3_cmd
,
7455 "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)",
7459 "Display routes matching the communities\n"
7460 "community number\n"
7461 "Do not send outside local AS (well-known community)\n"
7462 "Do not advertise to any peer (well-known community)\n"
7463 "Do not export to next AS (well-known community)\n"
7464 "community number\n"
7465 "Do not send outside local AS (well-known community)\n"
7466 "Do not advertise to any peer (well-known community)\n"
7467 "Do not export to next AS (well-known community)\n"
7468 "community number\n"
7469 "Do not send outside local AS (well-known community)\n"
7470 "Do not advertise to any peer (well-known community)\n"
7471 "Do not export to next AS (well-known community)\n")
7473 ALIAS (show_bgp_community
,
7474 show_bgp_community4_cmd
,
7475 "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)",
7478 "Display routes matching the communities\n"
7479 "community number\n"
7480 "Do not send outside local AS (well-known community)\n"
7481 "Do not advertise to any peer (well-known community)\n"
7482 "Do not export to next AS (well-known community)\n"
7483 "community number\n"
7484 "Do not send outside local AS (well-known community)\n"
7485 "Do not advertise to any peer (well-known community)\n"
7486 "Do not export to next AS (well-known community)\n"
7487 "community number\n"
7488 "Do not send outside local AS (well-known community)\n"
7489 "Do not advertise to any peer (well-known community)\n"
7490 "Do not export to next AS (well-known community)\n"
7491 "community number\n"
7492 "Do not send outside local AS (well-known community)\n"
7493 "Do not advertise to any peer (well-known community)\n"
7494 "Do not export to next AS (well-known community)\n")
7496 ALIAS (show_bgp_community
,
7497 show_bgp_ipv6_community4_cmd
,
7498 "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)",
7502 "Display routes matching the communities\n"
7503 "community number\n"
7504 "Do not send outside local AS (well-known community)\n"
7505 "Do not advertise to any peer (well-known community)\n"
7506 "Do not export to next AS (well-known community)\n"
7507 "community number\n"
7508 "Do not send outside local AS (well-known community)\n"
7509 "Do not advertise to any peer (well-known community)\n"
7510 "Do not export to next AS (well-known community)\n"
7511 "community number\n"
7512 "Do not send outside local AS (well-known community)\n"
7513 "Do not advertise to any peer (well-known community)\n"
7514 "Do not export to next AS (well-known community)\n"
7515 "community number\n"
7516 "Do not send outside local AS (well-known community)\n"
7517 "Do not advertise to any peer (well-known community)\n"
7518 "Do not export to next AS (well-known community)\n")
7521 DEFUN (show_ipv6_bgp_community
,
7522 show_ipv6_bgp_community_cmd
,
7523 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export)",
7527 "Display routes matching the communities\n"
7528 "community number\n"
7529 "Do not send outside local AS (well-known community)\n"
7530 "Do not advertise to any peer (well-known community)\n"
7531 "Do not export to next AS (well-known community)\n")
7533 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
7537 ALIAS (show_ipv6_bgp_community
,
7538 show_ipv6_bgp_community2_cmd
,
7539 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7543 "Display routes matching the communities\n"
7544 "community number\n"
7545 "Do not send outside local AS (well-known community)\n"
7546 "Do not advertise to any peer (well-known community)\n"
7547 "Do not export to next AS (well-known community)\n"
7548 "community number\n"
7549 "Do not send outside local AS (well-known community)\n"
7550 "Do not advertise to any peer (well-known community)\n"
7551 "Do not export to next AS (well-known community)\n")
7554 ALIAS (show_ipv6_bgp_community
,
7555 show_ipv6_bgp_community3_cmd
,
7556 "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)",
7560 "Display routes matching the communities\n"
7561 "community number\n"
7562 "Do not send outside local AS (well-known community)\n"
7563 "Do not advertise to any peer (well-known community)\n"
7564 "Do not export to next AS (well-known community)\n"
7565 "community number\n"
7566 "Do not send outside local AS (well-known community)\n"
7567 "Do not advertise to any peer (well-known community)\n"
7568 "Do not export to next AS (well-known community)\n"
7569 "community number\n"
7570 "Do not send outside local AS (well-known community)\n"
7571 "Do not advertise to any peer (well-known community)\n"
7572 "Do not export to next AS (well-known community)\n")
7575 ALIAS (show_ipv6_bgp_community
,
7576 show_ipv6_bgp_community4_cmd
,
7577 "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)",
7581 "Display routes matching the communities\n"
7582 "community number\n"
7583 "Do not send outside local AS (well-known community)\n"
7584 "Do not advertise to any peer (well-known community)\n"
7585 "Do not export to next AS (well-known community)\n"
7586 "community number\n"
7587 "Do not send outside local AS (well-known community)\n"
7588 "Do not advertise to any peer (well-known community)\n"
7589 "Do not export to next AS (well-known community)\n"
7590 "community number\n"
7591 "Do not send outside local AS (well-known community)\n"
7592 "Do not advertise to any peer (well-known community)\n"
7593 "Do not export to next AS (well-known community)\n"
7594 "community number\n"
7595 "Do not send outside local AS (well-known community)\n"
7596 "Do not advertise to any peer (well-known community)\n"
7597 "Do not export to next AS (well-known community)\n")
7599 DEFUN (show_bgp_community_exact
,
7600 show_bgp_community_exact_cmd
,
7601 "show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7604 "Display routes matching the communities\n"
7605 "community number\n"
7606 "Do not send outside local AS (well-known community)\n"
7607 "Do not advertise to any peer (well-known community)\n"
7608 "Do not export to next AS (well-known community)\n"
7609 "Exact match of the communities")
7611 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
7614 ALIAS (show_bgp_community_exact
,
7615 show_bgp_ipv6_community_exact_cmd
,
7616 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7620 "Display routes matching the communities\n"
7621 "community number\n"
7622 "Do not send outside local AS (well-known community)\n"
7623 "Do not advertise to any peer (well-known community)\n"
7624 "Do not export to next AS (well-known community)\n"
7625 "Exact match of the communities")
7627 ALIAS (show_bgp_community_exact
,
7628 show_bgp_community2_exact_cmd
,
7629 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7632 "Display routes matching the communities\n"
7633 "community number\n"
7634 "Do not send outside local AS (well-known community)\n"
7635 "Do not advertise to any peer (well-known community)\n"
7636 "Do not export to next AS (well-known community)\n"
7637 "community number\n"
7638 "Do not send outside local AS (well-known community)\n"
7639 "Do not advertise to any peer (well-known community)\n"
7640 "Do not export to next AS (well-known community)\n"
7641 "Exact match of the communities")
7643 ALIAS (show_bgp_community_exact
,
7644 show_bgp_ipv6_community2_exact_cmd
,
7645 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7649 "Display routes matching the communities\n"
7650 "community number\n"
7651 "Do not send outside local AS (well-known community)\n"
7652 "Do not advertise to any peer (well-known community)\n"
7653 "Do not export to next AS (well-known community)\n"
7654 "community number\n"
7655 "Do not send outside local AS (well-known community)\n"
7656 "Do not advertise to any peer (well-known community)\n"
7657 "Do not export to next AS (well-known community)\n"
7658 "Exact match of the communities")
7660 ALIAS (show_bgp_community_exact
,
7661 show_bgp_community3_exact_cmd
,
7662 "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",
7665 "Display routes matching the communities\n"
7666 "community number\n"
7667 "Do not send outside local AS (well-known community)\n"
7668 "Do not advertise to any peer (well-known community)\n"
7669 "Do not export to next AS (well-known community)\n"
7670 "community number\n"
7671 "Do not send outside local AS (well-known community)\n"
7672 "Do not advertise to any peer (well-known community)\n"
7673 "Do not export to next AS (well-known community)\n"
7674 "community number\n"
7675 "Do not send outside local AS (well-known community)\n"
7676 "Do not advertise to any peer (well-known community)\n"
7677 "Do not export to next AS (well-known community)\n"
7678 "Exact match of the communities")
7680 ALIAS (show_bgp_community_exact
,
7681 show_bgp_ipv6_community3_exact_cmd
,
7682 "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",
7686 "Display routes matching the communities\n"
7687 "community number\n"
7688 "Do not send outside local AS (well-known community)\n"
7689 "Do not advertise to any peer (well-known community)\n"
7690 "Do not export to next AS (well-known community)\n"
7691 "community number\n"
7692 "Do not send outside local AS (well-known community)\n"
7693 "Do not advertise to any peer (well-known community)\n"
7694 "Do not export to next AS (well-known community)\n"
7695 "community number\n"
7696 "Do not send outside local AS (well-known community)\n"
7697 "Do not advertise to any peer (well-known community)\n"
7698 "Do not export to next AS (well-known community)\n"
7699 "Exact match of the communities")
7701 ALIAS (show_bgp_community_exact
,
7702 show_bgp_community4_exact_cmd
,
7703 "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",
7706 "Display routes matching the communities\n"
7707 "community number\n"
7708 "Do not send outside local AS (well-known community)\n"
7709 "Do not advertise to any peer (well-known community)\n"
7710 "Do not export to next AS (well-known community)\n"
7711 "community number\n"
7712 "Do not send outside local AS (well-known community)\n"
7713 "Do not advertise to any peer (well-known community)\n"
7714 "Do not export to next AS (well-known community)\n"
7715 "community number\n"
7716 "Do not send outside local AS (well-known community)\n"
7717 "Do not advertise to any peer (well-known community)\n"
7718 "Do not export to next AS (well-known community)\n"
7719 "community number\n"
7720 "Do not send outside local AS (well-known community)\n"
7721 "Do not advertise to any peer (well-known community)\n"
7722 "Do not export to next AS (well-known community)\n"
7723 "Exact match of the communities")
7725 ALIAS (show_bgp_community_exact
,
7726 show_bgp_ipv6_community4_exact_cmd
,
7727 "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",
7731 "Display routes matching the communities\n"
7732 "community number\n"
7733 "Do not send outside local AS (well-known community)\n"
7734 "Do not advertise to any peer (well-known community)\n"
7735 "Do not export to next AS (well-known community)\n"
7736 "community number\n"
7737 "Do not send outside local AS (well-known community)\n"
7738 "Do not advertise to any peer (well-known community)\n"
7739 "Do not export to next AS (well-known community)\n"
7740 "community number\n"
7741 "Do not send outside local AS (well-known community)\n"
7742 "Do not advertise to any peer (well-known community)\n"
7743 "Do not export to next AS (well-known community)\n"
7744 "community number\n"
7745 "Do not send outside local AS (well-known community)\n"
7746 "Do not advertise to any peer (well-known community)\n"
7747 "Do not export to next AS (well-known community)\n"
7748 "Exact match of the communities")
7751 DEFUN (show_ipv6_bgp_community_exact
,
7752 show_ipv6_bgp_community_exact_cmd
,
7753 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7757 "Display routes matching the communities\n"
7758 "community number\n"
7759 "Do not send outside local AS (well-known community)\n"
7760 "Do not advertise to any peer (well-known community)\n"
7761 "Do not export to next AS (well-known community)\n"
7762 "Exact match of the communities")
7764 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
7768 ALIAS (show_ipv6_bgp_community_exact
,
7769 show_ipv6_bgp_community2_exact_cmd
,
7770 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7774 "Display routes matching the communities\n"
7775 "community number\n"
7776 "Do not send outside local AS (well-known community)\n"
7777 "Do not advertise to any peer (well-known community)\n"
7778 "Do not export to next AS (well-known community)\n"
7779 "community number\n"
7780 "Do not send outside local AS (well-known community)\n"
7781 "Do not advertise to any peer (well-known community)\n"
7782 "Do not export to next AS (well-known community)\n"
7783 "Exact match of the communities")
7786 ALIAS (show_ipv6_bgp_community_exact
,
7787 show_ipv6_bgp_community3_exact_cmd
,
7788 "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",
7792 "Display routes matching the communities\n"
7793 "community number\n"
7794 "Do not send outside local AS (well-known community)\n"
7795 "Do not advertise to any peer (well-known community)\n"
7796 "Do not export to next AS (well-known community)\n"
7797 "community number\n"
7798 "Do not send outside local AS (well-known community)\n"
7799 "Do not advertise to any peer (well-known community)\n"
7800 "Do not export to next AS (well-known community)\n"
7801 "community number\n"
7802 "Do not send outside local AS (well-known community)\n"
7803 "Do not advertise to any peer (well-known community)\n"
7804 "Do not export to next AS (well-known community)\n"
7805 "Exact match of the communities")
7808 ALIAS (show_ipv6_bgp_community_exact
,
7809 show_ipv6_bgp_community4_exact_cmd
,
7810 "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",
7814 "Display routes matching the communities\n"
7815 "community number\n"
7816 "Do not send outside local AS (well-known community)\n"
7817 "Do not advertise to any peer (well-known community)\n"
7818 "Do not export to next AS (well-known community)\n"
7819 "community number\n"
7820 "Do not send outside local AS (well-known community)\n"
7821 "Do not advertise to any peer (well-known community)\n"
7822 "Do not export to next AS (well-known community)\n"
7823 "community number\n"
7824 "Do not send outside local AS (well-known community)\n"
7825 "Do not advertise to any peer (well-known community)\n"
7826 "Do not export to next AS (well-known community)\n"
7827 "community number\n"
7828 "Do not send outside local AS (well-known community)\n"
7829 "Do not advertise to any peer (well-known community)\n"
7830 "Do not export to next AS (well-known community)\n"
7831 "Exact match of the communities")
7834 DEFUN (show_ipv6_mbgp_community
,
7835 show_ipv6_mbgp_community_cmd
,
7836 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export)",
7840 "Display routes matching the communities\n"
7841 "community number\n"
7842 "Do not send outside local AS (well-known community)\n"
7843 "Do not advertise to any peer (well-known community)\n"
7844 "Do not export to next AS (well-known community)\n")
7846 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_MULTICAST
);
7850 ALIAS (show_ipv6_mbgp_community
,
7851 show_ipv6_mbgp_community2_cmd
,
7852 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7856 "Display routes matching the communities\n"
7857 "community number\n"
7858 "Do not send outside local AS (well-known community)\n"
7859 "Do not advertise to any peer (well-known community)\n"
7860 "Do not export to next AS (well-known community)\n"
7861 "community number\n"
7862 "Do not send outside local AS (well-known community)\n"
7863 "Do not advertise to any peer (well-known community)\n"
7864 "Do not export to next AS (well-known community)\n")
7867 ALIAS (show_ipv6_mbgp_community
,
7868 show_ipv6_mbgp_community3_cmd
,
7869 "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)",
7873 "Display routes matching the communities\n"
7874 "community number\n"
7875 "Do not send outside local AS (well-known community)\n"
7876 "Do not advertise to any peer (well-known community)\n"
7877 "Do not export to next AS (well-known community)\n"
7878 "community number\n"
7879 "Do not send outside local AS (well-known community)\n"
7880 "Do not advertise to any peer (well-known community)\n"
7881 "Do not export to next AS (well-known community)\n"
7882 "community number\n"
7883 "Do not send outside local AS (well-known community)\n"
7884 "Do not advertise to any peer (well-known community)\n"
7885 "Do not export to next AS (well-known community)\n")
7888 ALIAS (show_ipv6_mbgp_community
,
7889 show_ipv6_mbgp_community4_cmd
,
7890 "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)",
7894 "Display routes matching the communities\n"
7895 "community number\n"
7896 "Do not send outside local AS (well-known community)\n"
7897 "Do not advertise to any peer (well-known community)\n"
7898 "Do not export to next AS (well-known community)\n"
7899 "community number\n"
7900 "Do not send outside local AS (well-known community)\n"
7901 "Do not advertise to any peer (well-known community)\n"
7902 "Do not export to next AS (well-known community)\n"
7903 "community number\n"
7904 "Do not send outside local AS (well-known community)\n"
7905 "Do not advertise to any peer (well-known community)\n"
7906 "Do not export to next AS (well-known community)\n"
7907 "community number\n"
7908 "Do not send outside local AS (well-known community)\n"
7909 "Do not advertise to any peer (well-known community)\n"
7910 "Do not export to next AS (well-known community)\n")
7913 DEFUN (show_ipv6_mbgp_community_exact
,
7914 show_ipv6_mbgp_community_exact_cmd
,
7915 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7919 "Display routes matching the communities\n"
7920 "community number\n"
7921 "Do not send outside local AS (well-known community)\n"
7922 "Do not advertise to any peer (well-known community)\n"
7923 "Do not export to next AS (well-known community)\n"
7924 "Exact match of the communities")
7926 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_MULTICAST
);
7930 ALIAS (show_ipv6_mbgp_community_exact
,
7931 show_ipv6_mbgp_community2_exact_cmd
,
7932 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7936 "Display routes matching the communities\n"
7937 "community number\n"
7938 "Do not send outside local AS (well-known community)\n"
7939 "Do not advertise to any peer (well-known community)\n"
7940 "Do not export to next AS (well-known community)\n"
7941 "community number\n"
7942 "Do not send outside local AS (well-known community)\n"
7943 "Do not advertise to any peer (well-known community)\n"
7944 "Do not export to next AS (well-known community)\n"
7945 "Exact match of the communities")
7948 ALIAS (show_ipv6_mbgp_community_exact
,
7949 show_ipv6_mbgp_community3_exact_cmd
,
7950 "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",
7954 "Display routes matching the communities\n"
7955 "community number\n"
7956 "Do not send outside local AS (well-known community)\n"
7957 "Do not advertise to any peer (well-known community)\n"
7958 "Do not export to next AS (well-known community)\n"
7959 "community number\n"
7960 "Do not send outside local AS (well-known community)\n"
7961 "Do not advertise to any peer (well-known community)\n"
7962 "Do not export to next AS (well-known community)\n"
7963 "community number\n"
7964 "Do not send outside local AS (well-known community)\n"
7965 "Do not advertise to any peer (well-known community)\n"
7966 "Do not export to next AS (well-known community)\n"
7967 "Exact match of the communities")
7970 ALIAS (show_ipv6_mbgp_community_exact
,
7971 show_ipv6_mbgp_community4_exact_cmd
,
7972 "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",
7976 "Display routes matching the communities\n"
7977 "community number\n"
7978 "Do not send outside local AS (well-known community)\n"
7979 "Do not advertise to any peer (well-known community)\n"
7980 "Do not export to next AS (well-known community)\n"
7981 "community number\n"
7982 "Do not send outside local AS (well-known community)\n"
7983 "Do not advertise to any peer (well-known community)\n"
7984 "Do not export to next AS (well-known community)\n"
7985 "community number\n"
7986 "Do not send outside local AS (well-known community)\n"
7987 "Do not advertise to any peer (well-known community)\n"
7988 "Do not export to next AS (well-known community)\n"
7989 "community number\n"
7990 "Do not send outside local AS (well-known community)\n"
7991 "Do not advertise to any peer (well-known community)\n"
7992 "Do not export to next AS (well-known community)\n"
7993 "Exact match of the communities")
7994 #endif /* HAVE_IPV6 */
7997 bgp_show_community_list (struct vty
*vty
, const char *com
, int exact
,
7998 u_int16_t afi
, u_char safi
)
8000 struct community_list
*list
;
8002 list
= community_list_lookup (bgp_clist
, com
, COMMUNITY_LIST_MASTER
);
8005 vty_out (vty
, "%% %s is not a valid community-list name%s", com
,
8010 return bgp_show (vty
, NULL
, afi
, safi
,
8011 (exact
? bgp_show_type_community_list_exact
:
8012 bgp_show_type_community_list
), list
);
8015 DEFUN (show_ip_bgp_community_list
,
8016 show_ip_bgp_community_list_cmd
,
8017 "show ip bgp community-list (<1-500>|WORD)",
8021 "Display routes matching the community-list\n"
8022 "community-list number\n"
8023 "community-list name\n")
8025 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP
, SAFI_UNICAST
);
8028 DEFUN (show_ip_bgp_ipv4_community_list
,
8029 show_ip_bgp_ipv4_community_list_cmd
,
8030 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)",
8035 "Address Family modifier\n"
8036 "Address Family modifier\n"
8037 "Display routes matching the community-list\n"
8038 "community-list number\n"
8039 "community-list name\n")
8041 if (strncmp (argv
[0], "m", 1) == 0)
8042 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_MULTICAST
);
8044 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_UNICAST
);
8047 DEFUN (show_ip_bgp_community_list_exact
,
8048 show_ip_bgp_community_list_exact_cmd
,
8049 "show ip bgp community-list (<1-500>|WORD) exact-match",
8053 "Display routes matching the community-list\n"
8054 "community-list number\n"
8055 "community-list name\n"
8056 "Exact match of the communities\n")
8058 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP
, SAFI_UNICAST
);
8061 DEFUN (show_ip_bgp_ipv4_community_list_exact
,
8062 show_ip_bgp_ipv4_community_list_exact_cmd
,
8063 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match",
8068 "Address Family modifier\n"
8069 "Address Family modifier\n"
8070 "Display routes matching the community-list\n"
8071 "community-list number\n"
8072 "community-list name\n"
8073 "Exact match of the communities\n")
8075 if (strncmp (argv
[0], "m", 1) == 0)
8076 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_MULTICAST
);
8078 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_UNICAST
);
8082 DEFUN (show_bgp_community_list
,
8083 show_bgp_community_list_cmd
,
8084 "show bgp community-list (<1-500>|WORD)",
8087 "Display routes matching the community-list\n"
8088 "community-list number\n"
8089 "community-list name\n")
8091 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
8094 ALIAS (show_bgp_community_list
,
8095 show_bgp_ipv6_community_list_cmd
,
8096 "show bgp ipv6 community-list (<1-500>|WORD)",
8100 "Display routes matching the community-list\n"
8101 "community-list number\n"
8102 "community-list name\n");
8105 DEFUN (show_ipv6_bgp_community_list
,
8106 show_ipv6_bgp_community_list_cmd
,
8107 "show ipv6 bgp community-list WORD",
8111 "Display routes matching the community-list\n"
8112 "community-list name\n")
8114 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
8118 DEFUN (show_ipv6_mbgp_community_list
,
8119 show_ipv6_mbgp_community_list_cmd
,
8120 "show ipv6 mbgp community-list WORD",
8124 "Display routes matching the community-list\n"
8125 "community-list name\n")
8127 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_MULTICAST
);
8130 DEFUN (show_bgp_community_list_exact
,
8131 show_bgp_community_list_exact_cmd
,
8132 "show bgp community-list (<1-500>|WORD) exact-match",
8135 "Display routes matching the community-list\n"
8136 "community-list number\n"
8137 "community-list name\n"
8138 "Exact match of the communities\n")
8140 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
8143 ALIAS (show_bgp_community_list_exact
,
8144 show_bgp_ipv6_community_list_exact_cmd
,
8145 "show bgp ipv6 community-list (<1-500>|WORD) exact-match",
8149 "Display routes matching the community-list\n"
8150 "community-list number\n"
8151 "community-list name\n"
8152 "Exact match of the communities\n")
8155 DEFUN (show_ipv6_bgp_community_list_exact
,
8156 show_ipv6_bgp_community_list_exact_cmd
,
8157 "show ipv6 bgp community-list WORD exact-match",
8161 "Display routes matching the community-list\n"
8162 "community-list name\n"
8163 "Exact match of the communities\n")
8165 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
8169 DEFUN (show_ipv6_mbgp_community_list_exact
,
8170 show_ipv6_mbgp_community_list_exact_cmd
,
8171 "show ipv6 mbgp community-list WORD exact-match",
8175 "Display routes matching the community-list\n"
8176 "community-list name\n"
8177 "Exact match of the communities\n")
8179 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_MULTICAST
);
8181 #endif /* HAVE_IPV6 */
8184 bgp_show_prefix_longer (struct vty
*vty
, const char *prefix
, afi_t afi
,
8185 safi_t safi
, enum bgp_show_type type
)
8192 ret
= str2prefix (prefix
, p
);
8195 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
8199 ret
= bgp_show (vty
, NULL
, afi
, safi
, type
, p
);
8204 DEFUN (show_ip_bgp_prefix_longer
,
8205 show_ip_bgp_prefix_longer_cmd
,
8206 "show ip bgp A.B.C.D/M longer-prefixes",
8210 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8211 "Display route and more specific routes\n")
8213 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8214 bgp_show_type_prefix_longer
);
8217 DEFUN (show_ip_bgp_flap_prefix_longer
,
8218 show_ip_bgp_flap_prefix_longer_cmd
,
8219 "show ip bgp flap-statistics A.B.C.D/M longer-prefixes",
8223 "Display flap statistics of routes\n"
8224 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8225 "Display route and more specific routes\n")
8227 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8228 bgp_show_type_flap_prefix_longer
);
8231 DEFUN (show_ip_bgp_ipv4_prefix_longer
,
8232 show_ip_bgp_ipv4_prefix_longer_cmd
,
8233 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes",
8238 "Address Family modifier\n"
8239 "Address Family modifier\n"
8240 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8241 "Display route and more specific routes\n")
8243 if (strncmp (argv
[0], "m", 1) == 0)
8244 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
8245 bgp_show_type_prefix_longer
);
8247 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
8248 bgp_show_type_prefix_longer
);
8251 DEFUN (show_ip_bgp_flap_address
,
8252 show_ip_bgp_flap_address_cmd
,
8253 "show ip bgp flap-statistics A.B.C.D",
8257 "Display flap statistics of routes\n"
8258 "Network in the BGP routing table to display\n")
8260 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8261 bgp_show_type_flap_address
);
8264 DEFUN (show_ip_bgp_flap_prefix
,
8265 show_ip_bgp_flap_prefix_cmd
,
8266 "show ip bgp flap-statistics A.B.C.D/M",
8270 "Display flap statistics of routes\n"
8271 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
8273 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8274 bgp_show_type_flap_prefix
);
8277 DEFUN (show_bgp_prefix_longer
,
8278 show_bgp_prefix_longer_cmd
,
8279 "show bgp X:X::X:X/M longer-prefixes",
8282 "IPv6 prefix <network>/<length>\n"
8283 "Display route and more specific routes\n")
8285 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8286 bgp_show_type_prefix_longer
);
8289 ALIAS (show_bgp_prefix_longer
,
8290 show_bgp_ipv6_prefix_longer_cmd
,
8291 "show bgp ipv6 X:X::X:X/M longer-prefixes",
8295 "IPv6 prefix <network>/<length>\n"
8296 "Display route and more specific routes\n")
8299 DEFUN (show_ipv6_bgp_prefix_longer
,
8300 show_ipv6_bgp_prefix_longer_cmd
,
8301 "show ipv6 bgp X:X::X:X/M longer-prefixes",
8305 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
8306 "Display route and more specific routes\n")
8308 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8309 bgp_show_type_prefix_longer
);
8313 DEFUN (show_ipv6_mbgp_prefix_longer
,
8314 show_ipv6_mbgp_prefix_longer_cmd
,
8315 "show ipv6 mbgp X:X::X:X/M longer-prefixes",
8319 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
8320 "Display route and more specific routes\n")
8322 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
8323 bgp_show_type_prefix_longer
);
8325 #endif /* HAVE_IPV6 */
8327 static struct peer
*
8328 peer_lookup_in_view (struct vty
*vty
, const char *view_name
,
8336 /* BGP structure lookup. */
8339 bgp
= bgp_lookup_by_name (view_name
);
8342 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
8348 bgp
= bgp_get_default ();
8351 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
8356 /* Get peer sockunion. */
8357 ret
= str2sockunion (ip_str
, &su
);
8360 vty_out (vty
, "Malformed address: %s%s", ip_str
, VTY_NEWLINE
);
8364 /* Peer structure lookup. */
8365 peer
= peer_lookup (bgp
, &su
);
8368 vty_out (vty
, "No such neighbor%s", VTY_NEWLINE
);
8376 show_adj_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
,
8379 struct bgp_table
*table
;
8380 struct bgp_adj_in
*ain
;
8381 struct bgp_adj_out
*adj
;
8382 unsigned long output_count
;
8383 struct bgp_node
*rn
;
8393 table
= bgp
->rib
[afi
][safi
];
8397 if (! in
&& CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
8398 PEER_STATUS_DEFAULT_ORIGINATE
))
8400 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
8401 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8402 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8404 vty_out (vty
, "Originating default network 0.0.0.0%s%s",
8405 VTY_NEWLINE
, VTY_NEWLINE
);
8409 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
8412 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
8413 if (ain
->peer
== peer
)
8417 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
8418 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8419 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8424 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
8429 route_vty_out_tmp (vty
, &rn
->p
, ain
->attr
, safi
);
8436 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
)
8437 if (adj
->peer
== peer
)
8441 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
8442 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8443 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
8448 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
8453 route_vty_out_tmp (vty
, &rn
->p
, adj
->attr
, safi
);
8459 if (output_count
!= 0)
8460 vty_out (vty
, "%sTotal number of prefixes %ld%s",
8461 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
8465 peer_adj_routes (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
, int in
)
8467 if (! peer
|| ! peer
->afc
[afi
][safi
])
8469 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
8473 if (in
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
8475 vty_out (vty
, "%% Inbound soft reconfiguration not enabled%s",
8480 show_adj_route (vty
, peer
, afi
, safi
, in
);
8485 DEFUN (show_ip_bgp_neighbor_advertised_route
,
8486 show_ip_bgp_neighbor_advertised_route_cmd
,
8487 "show ip bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8491 "Detailed information on TCP and BGP neighbor connections\n"
8492 "Neighbor to display information about\n"
8493 "Neighbor to display information about\n"
8494 "Display the routes advertised to a BGP neighbor\n")
8498 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8502 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0);
8505 DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route
,
8506 show_ip_bgp_ipv4_neighbor_advertised_route_cmd
,
8507 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8512 "Address Family modifier\n"
8513 "Address Family modifier\n"
8514 "Detailed information on TCP and BGP neighbor connections\n"
8515 "Neighbor to display information about\n"
8516 "Neighbor to display information about\n"
8517 "Display the routes advertised to a BGP neighbor\n")
8521 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
8525 if (strncmp (argv
[0], "m", 1) == 0)
8526 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 0);
8528 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0);
8532 DEFUN (show_bgp_view_neighbor_advertised_route
,
8533 show_bgp_view_neighbor_advertised_route_cmd
,
8534 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8539 "Detailed information on TCP and BGP neighbor connections\n"
8540 "Neighbor to display information about\n"
8541 "Neighbor to display information about\n"
8542 "Display the routes advertised to a BGP neighbor\n")
8547 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
8549 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8554 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0);
8557 ALIAS (show_bgp_view_neighbor_advertised_route
,
8558 show_bgp_view_ipv6_neighbor_advertised_route_cmd
,
8559 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8565 "Detailed information on TCP and BGP neighbor connections\n"
8566 "Neighbor to display information about\n"
8567 "Neighbor to display information about\n"
8568 "Display the routes advertised to a BGP neighbor\n")
8570 DEFUN (show_bgp_view_neighbor_received_routes
,
8571 show_bgp_view_neighbor_received_routes_cmd
,
8572 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received-routes",
8577 "Detailed information on TCP and BGP neighbor connections\n"
8578 "Neighbor to display information about\n"
8579 "Neighbor to display information about\n"
8580 "Display the received routes from neighbor\n")
8585 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
8587 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8592 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 1);
8595 ALIAS (show_bgp_view_neighbor_received_routes
,
8596 show_bgp_view_ipv6_neighbor_received_routes_cmd
,
8597 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
8603 "Detailed information on TCP and BGP neighbor connections\n"
8604 "Neighbor to display information about\n"
8605 "Neighbor to display information about\n"
8606 "Display the received routes from neighbor\n")
8608 ALIAS (show_bgp_view_neighbor_advertised_route
,
8609 show_bgp_neighbor_advertised_route_cmd
,
8610 "show bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8613 "Detailed information on TCP and BGP neighbor connections\n"
8614 "Neighbor to display information about\n"
8615 "Neighbor to display information about\n"
8616 "Display the routes advertised to a BGP neighbor\n")
8618 ALIAS (show_bgp_view_neighbor_advertised_route
,
8619 show_bgp_ipv6_neighbor_advertised_route_cmd
,
8620 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8624 "Detailed information on TCP and BGP neighbor connections\n"
8625 "Neighbor to display information about\n"
8626 "Neighbor to display information about\n"
8627 "Display the routes advertised to a BGP neighbor\n")
8630 ALIAS (show_bgp_view_neighbor_advertised_route
,
8631 ipv6_bgp_neighbor_advertised_route_cmd
,
8632 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8636 "Detailed information on TCP and BGP neighbor connections\n"
8637 "Neighbor to display information about\n"
8638 "Neighbor to display information about\n"
8639 "Display the routes advertised to a BGP neighbor\n")
8642 DEFUN (ipv6_mbgp_neighbor_advertised_route
,
8643 ipv6_mbgp_neighbor_advertised_route_cmd
,
8644 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
8648 "Detailed information on TCP and BGP neighbor connections\n"
8649 "Neighbor to display information about\n"
8650 "Neighbor to display information about\n"
8651 "Display the routes advertised to a BGP neighbor\n")
8655 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8659 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 0);
8661 #endif /* HAVE_IPV6 */
8663 DEFUN (show_ip_bgp_neighbor_received_routes
,
8664 show_ip_bgp_neighbor_received_routes_cmd
,
8665 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
8669 "Detailed information on TCP and BGP neighbor connections\n"
8670 "Neighbor to display information about\n"
8671 "Neighbor to display information about\n"
8672 "Display the received routes from neighbor\n")
8676 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8680 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1);
8683 DEFUN (show_ip_bgp_ipv4_neighbor_received_routes
,
8684 show_ip_bgp_ipv4_neighbor_received_routes_cmd
,
8685 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received-routes",
8690 "Address Family modifier\n"
8691 "Address Family modifier\n"
8692 "Detailed information on TCP and BGP neighbor connections\n"
8693 "Neighbor to display information about\n"
8694 "Neighbor to display information about\n"
8695 "Display the received routes from neighbor\n")
8699 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
8703 if (strncmp (argv
[0], "m", 1) == 0)
8704 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 1);
8706 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1);
8709 DEFUN (show_ip_bgp_neighbor_received_prefix_filter
,
8710 show_ip_bgp_neighbor_received_prefix_filter_cmd
,
8711 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8715 "Detailed information on TCP and BGP neighbor connections\n"
8716 "Neighbor to display information about\n"
8717 "Neighbor to display information about\n"
8718 "Display information received from a BGP neighbor\n"
8719 "Display the prefixlist filter\n")
8722 union sockunion
*su
;
8726 su
= sockunion_str2su (argv
[0]);
8730 peer
= peer_lookup (NULL
, su
);
8734 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
8735 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
8738 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
8739 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
8745 DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter
,
8746 show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
,
8747 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8752 "Address Family modifier\n"
8753 "Address Family modifier\n"
8754 "Detailed information on TCP and BGP neighbor connections\n"
8755 "Neighbor to display information about\n"
8756 "Neighbor to display information about\n"
8757 "Display information received from a BGP neighbor\n"
8758 "Display the prefixlist filter\n")
8761 union sockunion
*su
;
8765 su
= sockunion_str2su (argv
[1]);
8769 peer
= peer_lookup (NULL
, su
);
8773 if (strncmp (argv
[0], "m", 1) == 0)
8775 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_MULTICAST
);
8776 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
8779 vty_out (vty
, "Address family: IPv4 Multicast%s", VTY_NEWLINE
);
8780 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
8785 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
8786 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
8789 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
8790 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
8799 ALIAS (show_bgp_view_neighbor_received_routes
,
8800 show_bgp_neighbor_received_routes_cmd
,
8801 "show bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
8804 "Detailed information on TCP and BGP neighbor connections\n"
8805 "Neighbor to display information about\n"
8806 "Neighbor to display information about\n"
8807 "Display the received routes from neighbor\n")
8809 ALIAS (show_bgp_view_neighbor_received_routes
,
8810 show_bgp_ipv6_neighbor_received_routes_cmd
,
8811 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
8815 "Detailed information on TCP and BGP neighbor connections\n"
8816 "Neighbor to display information about\n"
8817 "Neighbor to display information about\n"
8818 "Display the received routes from neighbor\n")
8820 DEFUN (show_bgp_neighbor_received_prefix_filter
,
8821 show_bgp_neighbor_received_prefix_filter_cmd
,
8822 "show bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8825 "Detailed information on TCP and BGP neighbor connections\n"
8826 "Neighbor to display information about\n"
8827 "Neighbor to display information about\n"
8828 "Display information received from a BGP neighbor\n"
8829 "Display the prefixlist filter\n")
8832 union sockunion
*su
;
8836 su
= sockunion_str2su (argv
[0]);
8840 peer
= peer_lookup (NULL
, su
);
8844 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
8845 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
8848 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
8849 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
8855 ALIAS (show_bgp_neighbor_received_prefix_filter
,
8856 show_bgp_ipv6_neighbor_received_prefix_filter_cmd
,
8857 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8861 "Detailed information on TCP and BGP neighbor connections\n"
8862 "Neighbor to display information about\n"
8863 "Neighbor to display information about\n"
8864 "Display information received from a BGP neighbor\n"
8865 "Display the prefixlist filter\n")
8868 ALIAS (show_bgp_view_neighbor_received_routes
,
8869 ipv6_bgp_neighbor_received_routes_cmd
,
8870 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
8874 "Detailed information on TCP and BGP neighbor connections\n"
8875 "Neighbor to display information about\n"
8876 "Neighbor to display information about\n"
8877 "Display the received routes from neighbor\n")
8880 DEFUN (ipv6_mbgp_neighbor_received_routes
,
8881 ipv6_mbgp_neighbor_received_routes_cmd
,
8882 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) received-routes",
8886 "Detailed information on TCP and BGP neighbor connections\n"
8887 "Neighbor to display information about\n"
8888 "Neighbor to display information about\n"
8889 "Display the received routes from neighbor\n")
8893 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8897 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 1);
8900 DEFUN (show_bgp_view_neighbor_received_prefix_filter
,
8901 show_bgp_view_neighbor_received_prefix_filter_cmd
,
8902 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8907 "Detailed information on TCP and BGP neighbor connections\n"
8908 "Neighbor to display information about\n"
8909 "Neighbor to display information about\n"
8910 "Display information received from a BGP neighbor\n"
8911 "Display the prefixlist filter\n")
8914 union sockunion
*su
;
8919 /* BGP structure lookup. */
8920 bgp
= bgp_lookup_by_name (argv
[0]);
8923 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
8927 su
= sockunion_str2su (argv
[1]);
8931 peer
= peer_lookup (bgp
, su
);
8935 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
8936 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
8939 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
8940 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
8946 ALIAS (show_bgp_view_neighbor_received_prefix_filter
,
8947 show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
,
8948 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
8954 "Detailed information on TCP and BGP neighbor connections\n"
8955 "Neighbor to display information about\n"
8956 "Neighbor to display information about\n"
8957 "Display information received from a BGP neighbor\n"
8958 "Display the prefixlist filter\n")
8959 #endif /* HAVE_IPV6 */
8962 bgp_show_neighbor_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
8963 safi_t safi
, enum bgp_show_type type
)
8965 if (! peer
|| ! peer
->afc
[afi
][safi
])
8967 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
8971 return bgp_show (vty
, peer
->bgp
, afi
, safi
, type
, &peer
->su
);
8974 DEFUN (show_ip_bgp_neighbor_routes
,
8975 show_ip_bgp_neighbor_routes_cmd
,
8976 "show ip bgp neighbors (A.B.C.D|X:X::X:X) routes",
8980 "Detailed information on TCP and BGP neighbor connections\n"
8981 "Neighbor to display information about\n"
8982 "Neighbor to display information about\n"
8983 "Display routes learned from neighbor\n")
8987 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
8991 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
8992 bgp_show_type_neighbor
);
8995 DEFUN (show_ip_bgp_neighbor_flap
,
8996 show_ip_bgp_neighbor_flap_cmd
,
8997 "show ip bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9001 "Detailed information on TCP and BGP neighbor connections\n"
9002 "Neighbor to display information about\n"
9003 "Neighbor to display information about\n"
9004 "Display flap statistics of the routes learned from neighbor\n")
9008 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9012 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
9013 bgp_show_type_flap_neighbor
);
9016 DEFUN (show_ip_bgp_neighbor_damp
,
9017 show_ip_bgp_neighbor_damp_cmd
,
9018 "show ip bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9022 "Detailed information on TCP and BGP neighbor connections\n"
9023 "Neighbor to display information about\n"
9024 "Neighbor to display information about\n"
9025 "Display the dampened routes received from neighbor\n")
9029 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9033 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
9034 bgp_show_type_damp_neighbor
);
9037 DEFUN (show_ip_bgp_ipv4_neighbor_routes
,
9038 show_ip_bgp_ipv4_neighbor_routes_cmd
,
9039 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) routes",
9044 "Address Family modifier\n"
9045 "Address Family modifier\n"
9046 "Detailed information on TCP and BGP neighbor connections\n"
9047 "Neighbor to display information about\n"
9048 "Neighbor to display information about\n"
9049 "Display routes learned from neighbor\n")
9053 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
9057 if (strncmp (argv
[0], "m", 1) == 0)
9058 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_MULTICAST
,
9059 bgp_show_type_neighbor
);
9061 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
9062 bgp_show_type_neighbor
);
9065 DEFUN (show_ip_bgp_view_rsclient
,
9066 show_ip_bgp_view_rsclient_cmd
,
9067 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X)",
9073 "Information about Route Server Client\n"
9076 struct bgp_table
*table
;
9080 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9082 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9087 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
9089 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9094 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
9095 PEER_FLAG_RSERVER_CLIENT
))
9097 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9102 table
= peer
->rib
[AFI_IP
][SAFI_UNICAST
];
9104 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
9107 ALIAS (show_ip_bgp_view_rsclient
,
9108 show_ip_bgp_rsclient_cmd
,
9109 "show ip bgp rsclient (A.B.C.D|X:X::X:X)",
9113 "Information about Route Server Client\n"
9116 DEFUN (show_ip_bgp_view_rsclient_route
,
9117 show_ip_bgp_view_rsclient_route_cmd
,
9118 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
9124 "Information about Route Server Client\n"
9126 "Network in the BGP routing table to display\n")
9131 /* BGP structure lookup. */
9134 bgp
= bgp_lookup_by_name (argv
[0]);
9137 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
9143 bgp
= bgp_get_default ();
9146 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9152 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9154 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9159 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
9161 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9166 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
9167 PEER_FLAG_RSERVER_CLIENT
))
9169 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9174 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
9175 (argc
== 3) ? argv
[2] : argv
[1],
9176 AFI_IP
, SAFI_UNICAST
, NULL
, 0);
9179 ALIAS (show_ip_bgp_view_rsclient_route
,
9180 show_ip_bgp_rsclient_route_cmd
,
9181 "show ip bgp rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
9185 "Information about Route Server Client\n"
9187 "Network in the BGP routing table to display\n")
9189 DEFUN (show_ip_bgp_view_rsclient_prefix
,
9190 show_ip_bgp_view_rsclient_prefix_cmd
,
9191 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
9197 "Information about Route Server Client\n"
9199 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
9204 /* BGP structure lookup. */
9207 bgp
= bgp_lookup_by_name (argv
[0]);
9210 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
9216 bgp
= bgp_get_default ();
9219 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9225 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9227 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9232 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
9234 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9239 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
9240 PEER_FLAG_RSERVER_CLIENT
))
9242 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9247 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
9248 (argc
== 3) ? argv
[2] : argv
[1],
9249 AFI_IP
, SAFI_UNICAST
, NULL
, 1);
9252 ALIAS (show_ip_bgp_view_rsclient_prefix
,
9253 show_ip_bgp_rsclient_prefix_cmd
,
9254 "show ip bgp rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
9258 "Information about Route Server Client\n"
9260 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
9264 DEFUN (show_bgp_view_neighbor_routes
,
9265 show_bgp_view_neighbor_routes_cmd
,
9266 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) routes",
9271 "Detailed information on TCP and BGP neighbor connections\n"
9272 "Neighbor to display information about\n"
9273 "Neighbor to display information about\n"
9274 "Display routes learned from neighbor\n")
9279 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9281 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9286 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
9287 bgp_show_type_neighbor
);
9290 ALIAS (show_bgp_view_neighbor_routes
,
9291 show_bgp_view_ipv6_neighbor_routes_cmd
,
9292 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) routes",
9298 "Detailed information on TCP and BGP neighbor connections\n"
9299 "Neighbor to display information about\n"
9300 "Neighbor to display information about\n"
9301 "Display routes learned from neighbor\n")
9303 DEFUN (show_bgp_view_neighbor_damp
,
9304 show_bgp_view_neighbor_damp_cmd
,
9305 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9310 "Detailed information on TCP and BGP neighbor connections\n"
9311 "Neighbor to display information about\n"
9312 "Neighbor to display information about\n"
9313 "Display the dampened routes received from neighbor\n")
9318 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9320 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9325 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
9326 bgp_show_type_damp_neighbor
);
9329 ALIAS (show_bgp_view_neighbor_damp
,
9330 show_bgp_view_ipv6_neighbor_damp_cmd
,
9331 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9337 "Detailed information on TCP and BGP neighbor connections\n"
9338 "Neighbor to display information about\n"
9339 "Neighbor to display information about\n"
9340 "Display the dampened routes received from neighbor\n")
9342 DEFUN (show_bgp_view_neighbor_flap
,
9343 show_bgp_view_neighbor_flap_cmd
,
9344 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9349 "Detailed information on TCP and BGP neighbor connections\n"
9350 "Neighbor to display information about\n"
9351 "Neighbor to display information about\n"
9352 "Display flap statistics of the routes learned from neighbor\n")
9357 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9359 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9364 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
9365 bgp_show_type_flap_neighbor
);
9368 ALIAS (show_bgp_view_neighbor_flap
,
9369 show_bgp_view_ipv6_neighbor_flap_cmd
,
9370 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9376 "Detailed information on TCP and BGP neighbor connections\n"
9377 "Neighbor to display information about\n"
9378 "Neighbor to display information about\n"
9379 "Display flap statistics of the routes learned from neighbor\n")
9381 ALIAS (show_bgp_view_neighbor_routes
,
9382 show_bgp_neighbor_routes_cmd
,
9383 "show bgp neighbors (A.B.C.D|X:X::X:X) routes",
9386 "Detailed information on TCP and BGP neighbor connections\n"
9387 "Neighbor to display information about\n"
9388 "Neighbor to display information about\n"
9389 "Display routes learned from neighbor\n")
9392 ALIAS (show_bgp_view_neighbor_routes
,
9393 show_bgp_ipv6_neighbor_routes_cmd
,
9394 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) routes",
9398 "Detailed information on TCP and BGP neighbor connections\n"
9399 "Neighbor to display information about\n"
9400 "Neighbor to display information about\n"
9401 "Display routes learned from neighbor\n")
9404 ALIAS (show_bgp_view_neighbor_routes
,
9405 ipv6_bgp_neighbor_routes_cmd
,
9406 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) routes",
9410 "Detailed information on TCP and BGP neighbor connections\n"
9411 "Neighbor to display information about\n"
9412 "Neighbor to display information about\n"
9413 "Display routes learned from neighbor\n")
9416 DEFUN (ipv6_mbgp_neighbor_routes
,
9417 ipv6_mbgp_neighbor_routes_cmd
,
9418 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) routes",
9422 "Detailed information on TCP and BGP neighbor connections\n"
9423 "Neighbor to display information about\n"
9424 "Neighbor to display information about\n"
9425 "Display routes learned from neighbor\n")
9429 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9433 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
,
9434 bgp_show_type_neighbor
);
9437 ALIAS (show_bgp_view_neighbor_flap
,
9438 show_bgp_neighbor_flap_cmd
,
9439 "show bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9442 "Detailed information on TCP and BGP neighbor connections\n"
9443 "Neighbor to display information about\n"
9444 "Neighbor to display information about\n"
9445 "Display flap statistics of the routes learned from neighbor\n")
9447 ALIAS (show_bgp_view_neighbor_flap
,
9448 show_bgp_ipv6_neighbor_flap_cmd
,
9449 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics",
9453 "Detailed information on TCP and BGP neighbor connections\n"
9454 "Neighbor to display information about\n"
9455 "Neighbor to display information about\n"
9456 "Display flap statistics of the routes learned from neighbor\n")
9458 ALIAS (show_bgp_view_neighbor_damp
,
9459 show_bgp_neighbor_damp_cmd
,
9460 "show bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9463 "Detailed information on TCP and BGP neighbor connections\n"
9464 "Neighbor to display information about\n"
9465 "Neighbor to display information about\n"
9466 "Display the dampened routes received from neighbor\n")
9468 ALIAS (show_bgp_view_neighbor_damp
,
9469 show_bgp_ipv6_neighbor_damp_cmd
,
9470 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes",
9474 "Detailed information on TCP and BGP neighbor connections\n"
9475 "Neighbor to display information about\n"
9476 "Neighbor to display information about\n"
9477 "Display the dampened routes received from neighbor\n")
9479 DEFUN (show_bgp_view_rsclient
,
9480 show_bgp_view_rsclient_cmd
,
9481 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X)",
9486 "Information about Route Server Client\n"
9489 struct bgp_table
*table
;
9493 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9495 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9500 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
9502 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9507 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
9508 PEER_FLAG_RSERVER_CLIENT
))
9510 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9515 table
= peer
->rib
[AFI_IP6
][SAFI_UNICAST
];
9517 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
9520 ALIAS (show_bgp_view_rsclient
,
9521 show_bgp_rsclient_cmd
,
9522 "show bgp rsclient (A.B.C.D|X:X::X:X)",
9525 "Information about Route Server Client\n"
9528 DEFUN (show_bgp_view_rsclient_route
,
9529 show_bgp_view_rsclient_route_cmd
,
9530 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
9535 "Information about Route Server Client\n"
9537 "Network in the BGP routing table to display\n")
9542 /* BGP structure lookup. */
9545 bgp
= bgp_lookup_by_name (argv
[0]);
9548 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
9554 bgp
= bgp_get_default ();
9557 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9563 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9565 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9570 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
9572 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9577 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
9578 PEER_FLAG_RSERVER_CLIENT
))
9580 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9585 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
9586 (argc
== 3) ? argv
[2] : argv
[1],
9587 AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
9590 ALIAS (show_bgp_view_rsclient_route
,
9591 show_bgp_rsclient_route_cmd
,
9592 "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
9595 "Information about Route Server Client\n"
9597 "Network in the BGP routing table to display\n")
9599 DEFUN (show_bgp_view_rsclient_prefix
,
9600 show_bgp_view_rsclient_prefix_cmd
,
9601 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
9606 "Information about Route Server Client\n"
9608 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
9613 /* BGP structure lookup. */
9616 bgp
= bgp_lookup_by_name (argv
[0]);
9619 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
9625 bgp
= bgp_get_default ();
9628 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9634 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9636 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9641 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
9643 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
9648 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
9649 PEER_FLAG_RSERVER_CLIENT
))
9651 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
9656 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
9657 (argc
== 3) ? argv
[2] : argv
[1],
9658 AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
9661 ALIAS (show_bgp_view_rsclient_prefix
,
9662 show_bgp_rsclient_prefix_cmd
,
9663 "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
9666 "Information about Route Server Client\n"
9668 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
9670 #endif /* HAVE_IPV6 */
9672 struct bgp_table
*bgp_distance_table
;
9676 /* Distance value for the IP source prefix. */
9679 /* Name of the access-list to be matched. */
9683 static struct bgp_distance
*
9686 struct bgp_distance
*new;
9687 new = XMALLOC (MTYPE_BGP_DISTANCE
, sizeof (struct bgp_distance
));
9688 memset (new, 0, sizeof (struct bgp_distance
));
9693 bgp_distance_free (struct bgp_distance
*bdistance
)
9695 XFREE (MTYPE_BGP_DISTANCE
, bdistance
);
9699 bgp_distance_set (struct vty
*vty
, const char *distance_str
,
9700 const char *ip_str
, const char *access_list_str
)
9703 struct prefix_ipv4 p
;
9705 struct bgp_node
*rn
;
9706 struct bgp_distance
*bdistance
;
9708 ret
= str2prefix_ipv4 (ip_str
, &p
);
9711 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
9715 distance
= atoi (distance_str
);
9717 /* Get BGP distance node. */
9718 rn
= bgp_node_get (bgp_distance_table
, (struct prefix
*) &p
);
9721 bdistance
= rn
->info
;
9722 bgp_unlock_node (rn
);
9726 bdistance
= bgp_distance_new ();
9727 rn
->info
= bdistance
;
9730 /* Set distance value. */
9731 bdistance
->distance
= distance
;
9733 /* Reset access-list configuration. */
9734 if (bdistance
->access_list
)
9736 free (bdistance
->access_list
);
9737 bdistance
->access_list
= NULL
;
9739 if (access_list_str
)
9740 bdistance
->access_list
= strdup (access_list_str
);
9746 bgp_distance_unset (struct vty
*vty
, const char *distance_str
,
9747 const char *ip_str
, const char *access_list_str
)
9750 struct prefix_ipv4 p
;
9752 struct bgp_node
*rn
;
9753 struct bgp_distance
*bdistance
;
9755 ret
= str2prefix_ipv4 (ip_str
, &p
);
9758 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
9762 distance
= atoi (distance_str
);
9764 rn
= bgp_node_lookup (bgp_distance_table
, (struct prefix
*)&p
);
9767 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
9771 bdistance
= rn
->info
;
9773 if (bdistance
->access_list
)
9774 free (bdistance
->access_list
);
9775 bgp_distance_free (bdistance
);
9778 bgp_unlock_node (rn
);
9779 bgp_unlock_node (rn
);
9785 bgp_distance_reset ()
9787 struct bgp_node
*rn
;
9788 struct bgp_distance
*bdistance
;
9790 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
9791 if ((bdistance
= rn
->info
) != NULL
)
9793 if (bdistance
->access_list
)
9794 free (bdistance
->access_list
);
9795 bgp_distance_free (bdistance
);
9797 bgp_unlock_node (rn
);
9801 /* Apply BGP information to distance method. */
9803 bgp_distance_apply (struct prefix
*p
, struct bgp_info
*rinfo
, struct bgp
*bgp
)
9805 struct bgp_node
*rn
;
9806 struct prefix_ipv4 q
;
9808 struct bgp_distance
*bdistance
;
9809 struct access_list
*alist
;
9810 struct bgp_static
*bgp_static
;
9815 if (p
->family
!= AF_INET
)
9820 if (peer
->su
.sa
.sa_family
!= AF_INET
)
9823 memset (&q
, 0, sizeof (struct prefix_ipv4
));
9825 q
.prefix
= peer
->su
.sin
.sin_addr
;
9826 q
.prefixlen
= IPV4_MAX_BITLEN
;
9828 /* Check source address. */
9829 rn
= bgp_node_match (bgp_distance_table
, (struct prefix
*) &q
);
9832 bdistance
= rn
->info
;
9833 bgp_unlock_node (rn
);
9835 if (bdistance
->access_list
)
9837 alist
= access_list_lookup (AFI_IP
, bdistance
->access_list
);
9838 if (alist
&& access_list_apply (alist
, p
) == FILTER_PERMIT
)
9839 return bdistance
->distance
;
9842 return bdistance
->distance
;
9845 /* Backdoor check. */
9846 rn
= bgp_node_lookup (bgp
->route
[AFI_IP
][SAFI_UNICAST
], p
);
9849 bgp_static
= rn
->info
;
9850 bgp_unlock_node (rn
);
9852 if (bgp_static
->backdoor
)
9854 if (bgp
->distance_local
)
9855 return bgp
->distance_local
;
9857 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
9861 if (peer_sort (peer
) == BGP_PEER_EBGP
)
9863 if (bgp
->distance_ebgp
)
9864 return bgp
->distance_ebgp
;
9865 return ZEBRA_EBGP_DISTANCE_DEFAULT
;
9869 if (bgp
->distance_ibgp
)
9870 return bgp
->distance_ibgp
;
9871 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
9875 DEFUN (bgp_distance
,
9877 "distance bgp <1-255> <1-255> <1-255>",
9878 "Define an administrative distance\n"
9880 "Distance for routes external to the AS\n"
9881 "Distance for routes internal to the AS\n"
9882 "Distance for local routes\n")
9888 bgp
->distance_ebgp
= atoi (argv
[0]);
9889 bgp
->distance_ibgp
= atoi (argv
[1]);
9890 bgp
->distance_local
= atoi (argv
[2]);
9894 DEFUN (no_bgp_distance
,
9895 no_bgp_distance_cmd
,
9896 "no distance bgp <1-255> <1-255> <1-255>",
9898 "Define an administrative distance\n"
9900 "Distance for routes external to the AS\n"
9901 "Distance for routes internal to the AS\n"
9902 "Distance for local routes\n")
9908 bgp
->distance_ebgp
= 0;
9909 bgp
->distance_ibgp
= 0;
9910 bgp
->distance_local
= 0;
9914 ALIAS (no_bgp_distance
,
9915 no_bgp_distance2_cmd
,
9918 "Define an administrative distance\n"
9921 DEFUN (bgp_distance_source
,
9922 bgp_distance_source_cmd
,
9923 "distance <1-255> A.B.C.D/M",
9924 "Define an administrative distance\n"
9925 "Administrative distance\n"
9926 "IP source prefix\n")
9928 bgp_distance_set (vty
, argv
[0], argv
[1], NULL
);
9932 DEFUN (no_bgp_distance_source
,
9933 no_bgp_distance_source_cmd
,
9934 "no distance <1-255> A.B.C.D/M",
9936 "Define an administrative distance\n"
9937 "Administrative distance\n"
9938 "IP source prefix\n")
9940 bgp_distance_unset (vty
, argv
[0], argv
[1], NULL
);
9944 DEFUN (bgp_distance_source_access_list
,
9945 bgp_distance_source_access_list_cmd
,
9946 "distance <1-255> A.B.C.D/M WORD",
9947 "Define an administrative distance\n"
9948 "Administrative distance\n"
9949 "IP source prefix\n"
9950 "Access list name\n")
9952 bgp_distance_set (vty
, argv
[0], argv
[1], argv
[2]);
9956 DEFUN (no_bgp_distance_source_access_list
,
9957 no_bgp_distance_source_access_list_cmd
,
9958 "no distance <1-255> A.B.C.D/M WORD",
9960 "Define an administrative distance\n"
9961 "Administrative distance\n"
9962 "IP source prefix\n"
9963 "Access list name\n")
9965 bgp_distance_unset (vty
, argv
[0], argv
[1], argv
[2]);
9969 DEFUN (bgp_damp_set
,
9971 "bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
9972 "BGP Specific commands\n"
9973 "Enable route-flap dampening\n"
9974 "Half-life time for the penalty\n"
9975 "Value to start reusing a route\n"
9976 "Value to start suppressing a route\n"
9977 "Maximum duration to suppress a stable route\n")
9980 int half
= DEFAULT_HALF_LIFE
* 60;
9981 int reuse
= DEFAULT_REUSE
;
9982 int suppress
= DEFAULT_SUPPRESS
;
9987 half
= atoi (argv
[0]) * 60;
9988 reuse
= atoi (argv
[1]);
9989 suppress
= atoi (argv
[2]);
9990 max
= atoi (argv
[3]) * 60;
9994 half
= atoi (argv
[0]) * 60;
9999 return bgp_damp_enable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
),
10000 half
, reuse
, suppress
, max
);
10003 ALIAS (bgp_damp_set
,
10005 "bgp dampening <1-45>",
10006 "BGP Specific commands\n"
10007 "Enable route-flap dampening\n"
10008 "Half-life time for the penalty\n")
10010 ALIAS (bgp_damp_set
,
10013 "BGP Specific commands\n"
10014 "Enable route-flap dampening\n")
10016 DEFUN (bgp_damp_unset
,
10017 bgp_damp_unset_cmd
,
10018 "no bgp dampening",
10020 "BGP Specific commands\n"
10021 "Enable route-flap dampening\n")
10026 return bgp_damp_disable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
));
10029 ALIAS (bgp_damp_unset
,
10030 bgp_damp_unset2_cmd
,
10031 "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
10033 "BGP Specific commands\n"
10034 "Enable route-flap dampening\n"
10035 "Half-life time for the penalty\n"
10036 "Value to start reusing a route\n"
10037 "Value to start suppressing a route\n"
10038 "Maximum duration to suppress a stable route\n")
10040 DEFUN (show_ip_bgp_dampened_paths
,
10041 show_ip_bgp_dampened_paths_cmd
,
10042 "show ip bgp dampened-paths",
10046 "Display paths suppressed due to dampening\n")
10048 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_dampend_paths
,
10052 DEFUN (show_ip_bgp_flap_statistics
,
10053 show_ip_bgp_flap_statistics_cmd
,
10054 "show ip bgp flap-statistics",
10058 "Display flap statistics of routes\n")
10060 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
10061 bgp_show_type_flap_statistics
, NULL
);
10064 /* Display specified route of BGP table. */
10066 bgp_clear_damp_route (struct vty
*vty
, const char *view_name
,
10067 const char *ip_str
, afi_t afi
, safi_t safi
,
10068 struct prefix_rd
*prd
, int prefix_check
)
10071 struct prefix match
;
10072 struct bgp_node
*rn
;
10073 struct bgp_node
*rm
;
10074 struct bgp_info
*ri
;
10075 struct bgp_info
*ri_temp
;
10077 struct bgp_table
*table
;
10079 /* BGP structure lookup. */
10082 bgp
= bgp_lookup_by_name (view_name
);
10085 vty_out (vty
, "%% Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
10086 return CMD_WARNING
;
10091 bgp
= bgp_get_default ();
10094 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
10095 return CMD_WARNING
;
10099 /* Check IP address argument. */
10100 ret
= str2prefix (ip_str
, &match
);
10103 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
10104 return CMD_WARNING
;
10107 match
.family
= afi2family (afi
);
10109 if (safi
== SAFI_MPLS_VPN
)
10111 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= bgp_route_next (rn
))
10113 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
10116 if ((table
= rn
->info
) != NULL
)
10117 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
10118 if (! prefix_check
|| rm
->p
.prefixlen
== match
.prefixlen
)
10125 ri_temp
= ri
->next
;
10126 bgp_damp_info_free (ri
->damp_info
, 1);
10137 if ((rn
= bgp_node_match (bgp
->rib
[afi
][safi
], &match
)) != NULL
)
10138 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
10145 ri_temp
= ri
->next
;
10146 bgp_damp_info_free (ri
->damp_info
, 1);
10155 return CMD_SUCCESS
;
10158 DEFUN (clear_ip_bgp_dampening
,
10159 clear_ip_bgp_dampening_cmd
,
10160 "clear ip bgp dampening",
10164 "Clear route flap dampening information\n")
10166 bgp_damp_info_clean ();
10167 return CMD_SUCCESS
;
10170 DEFUN (clear_ip_bgp_dampening_prefix
,
10171 clear_ip_bgp_dampening_prefix_cmd
,
10172 "clear ip bgp dampening A.B.C.D/M",
10176 "Clear route flap dampening information\n"
10177 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
10179 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
10180 SAFI_UNICAST
, NULL
, 1);
10183 DEFUN (clear_ip_bgp_dampening_address
,
10184 clear_ip_bgp_dampening_address_cmd
,
10185 "clear ip bgp dampening A.B.C.D",
10189 "Clear route flap dampening information\n"
10190 "Network to clear damping information\n")
10192 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
10193 SAFI_UNICAST
, NULL
, 0);
10196 DEFUN (clear_ip_bgp_dampening_address_mask
,
10197 clear_ip_bgp_dampening_address_mask_cmd
,
10198 "clear ip bgp dampening A.B.C.D A.B.C.D",
10202 "Clear route flap dampening information\n"
10203 "Network to clear damping information\n"
10207 char prefix_str
[BUFSIZ
];
10209 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
10212 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
10213 return CMD_WARNING
;
10216 return bgp_clear_damp_route (vty
, NULL
, prefix_str
, AFI_IP
,
10217 SAFI_UNICAST
, NULL
, 0);
10221 bgp_config_write_network_vpnv4 (struct vty
*vty
, struct bgp
*bgp
,
10222 afi_t afi
, safi_t safi
, int *write
)
10224 struct bgp_node
*prn
;
10225 struct bgp_node
*rn
;
10226 struct bgp_table
*table
;
10228 struct prefix_rd
*prd
;
10229 struct bgp_static
*bgp_static
;
10231 char buf
[SU_ADDRSTRLEN
];
10232 char rdbuf
[RD_ADDRSTRLEN
];
10234 /* Network configuration. */
10235 for (prn
= bgp_table_top (bgp
->route
[afi
][safi
]); prn
; prn
= bgp_route_next (prn
))
10236 if ((table
= prn
->info
) != NULL
)
10237 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
10238 if ((bgp_static
= rn
->info
) != NULL
)
10241 prd
= (struct prefix_rd
*) &prn
->p
;
10243 /* "address-family" display. */
10244 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10246 /* "network" configuration display. */
10247 prefix_rd2str (prd
, rdbuf
, RD_ADDRSTRLEN
);
10248 label
= decode_label (bgp_static
->tag
);
10250 vty_out (vty
, " network %s/%d rd %s tag %d",
10251 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
10254 vty_out (vty
, "%s", VTY_NEWLINE
);
10259 /* Configuration of static route announcement and aggregate
10262 bgp_config_write_network (struct vty
*vty
, struct bgp
*bgp
,
10263 afi_t afi
, safi_t safi
, int *write
)
10265 struct bgp_node
*rn
;
10267 struct bgp_static
*bgp_static
;
10268 struct bgp_aggregate
*bgp_aggregate
;
10269 char buf
[SU_ADDRSTRLEN
];
10271 if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
10272 return bgp_config_write_network_vpnv4 (vty
, bgp
, afi
, safi
, write
);
10274 /* Network configuration. */
10275 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
10276 if ((bgp_static
= rn
->info
) != NULL
)
10280 /* "address-family" display. */
10281 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10283 /* "network" configuration display. */
10284 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
10286 u_int32_t destination
;
10287 struct in_addr netmask
;
10289 destination
= ntohl (p
->u
.prefix4
.s_addr
);
10290 masklen2ip (p
->prefixlen
, &netmask
);
10291 vty_out (vty
, " network %s",
10292 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
));
10294 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
10295 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
10296 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
10297 || p
->u
.prefix4
.s_addr
== 0)
10299 /* Natural mask is not display. */
10302 vty_out (vty
, " mask %s", inet_ntoa (netmask
));
10306 vty_out (vty
, " network %s/%d",
10307 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
10311 if (bgp_static
->rmap
.name
)
10312 vty_out (vty
, " route-map %s", bgp_static
->rmap
.name
);
10313 else if (bgp_static
->backdoor
)
10314 vty_out (vty
, " backdoor");
10316 vty_out (vty
, "%s", VTY_NEWLINE
);
10319 /* Aggregate-address configuration. */
10320 for (rn
= bgp_table_top (bgp
->aggregate
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
10321 if ((bgp_aggregate
= rn
->info
) != NULL
)
10325 /* "address-family" display. */
10326 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10328 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
10330 struct in_addr netmask
;
10332 masklen2ip (p
->prefixlen
, &netmask
);
10333 vty_out (vty
, " aggregate-address %s %s",
10334 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
10335 inet_ntoa (netmask
));
10339 vty_out (vty
, " aggregate-address %s/%d",
10340 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
10344 if (bgp_aggregate
->as_set
)
10345 vty_out (vty
, " as-set");
10347 if (bgp_aggregate
->summary_only
)
10348 vty_out (vty
, " summary-only");
10350 vty_out (vty
, "%s", VTY_NEWLINE
);
10357 bgp_config_write_distance (struct vty
*vty
, struct bgp
*bgp
)
10359 struct bgp_node
*rn
;
10360 struct bgp_distance
*bdistance
;
10362 /* Distance configuration. */
10363 if (bgp
->distance_ebgp
10364 && bgp
->distance_ibgp
10365 && bgp
->distance_local
10366 && (bgp
->distance_ebgp
!= ZEBRA_EBGP_DISTANCE_DEFAULT
10367 || bgp
->distance_ibgp
!= ZEBRA_IBGP_DISTANCE_DEFAULT
10368 || bgp
->distance_local
!= ZEBRA_IBGP_DISTANCE_DEFAULT
))
10369 vty_out (vty
, " distance bgp %d %d %d%s",
10370 bgp
->distance_ebgp
, bgp
->distance_ibgp
, bgp
->distance_local
,
10373 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
10374 if ((bdistance
= rn
->info
) != NULL
)
10376 vty_out (vty
, " distance %d %s/%d %s%s", bdistance
->distance
,
10377 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
10378 bdistance
->access_list
? bdistance
->access_list
: "",
10385 /* Allocate routing table structure and install commands. */
10389 /* Init BGP distance table. */
10390 bgp_distance_table
= bgp_table_init ();
10392 /* IPv4 BGP commands. */
10393 install_element (BGP_NODE
, &bgp_network_cmd
);
10394 install_element (BGP_NODE
, &bgp_network_mask_cmd
);
10395 install_element (BGP_NODE
, &bgp_network_mask_natural_cmd
);
10396 install_element (BGP_NODE
, &bgp_network_route_map_cmd
);
10397 install_element (BGP_NODE
, &bgp_network_mask_route_map_cmd
);
10398 install_element (BGP_NODE
, &bgp_network_mask_natural_route_map_cmd
);
10399 install_element (BGP_NODE
, &bgp_network_backdoor_cmd
);
10400 install_element (BGP_NODE
, &bgp_network_mask_backdoor_cmd
);
10401 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_cmd
);
10402 install_element (BGP_NODE
, &no_bgp_network_cmd
);
10403 install_element (BGP_NODE
, &no_bgp_network_mask_cmd
);
10404 install_element (BGP_NODE
, &no_bgp_network_mask_natural_cmd
);
10405 install_element (BGP_NODE
, &no_bgp_network_route_map_cmd
);
10406 install_element (BGP_NODE
, &no_bgp_network_mask_route_map_cmd
);
10407 install_element (BGP_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
10408 install_element (BGP_NODE
, &no_bgp_network_backdoor_cmd
);
10409 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_cmd
);
10410 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_cmd
);
10412 install_element (BGP_NODE
, &aggregate_address_cmd
);
10413 install_element (BGP_NODE
, &aggregate_address_mask_cmd
);
10414 install_element (BGP_NODE
, &aggregate_address_summary_only_cmd
);
10415 install_element (BGP_NODE
, &aggregate_address_mask_summary_only_cmd
);
10416 install_element (BGP_NODE
, &aggregate_address_as_set_cmd
);
10417 install_element (BGP_NODE
, &aggregate_address_mask_as_set_cmd
);
10418 install_element (BGP_NODE
, &aggregate_address_as_set_summary_cmd
);
10419 install_element (BGP_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
10420 install_element (BGP_NODE
, &aggregate_address_summary_as_set_cmd
);
10421 install_element (BGP_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
10422 install_element (BGP_NODE
, &no_aggregate_address_cmd
);
10423 install_element (BGP_NODE
, &no_aggregate_address_summary_only_cmd
);
10424 install_element (BGP_NODE
, &no_aggregate_address_as_set_cmd
);
10425 install_element (BGP_NODE
, &no_aggregate_address_as_set_summary_cmd
);
10426 install_element (BGP_NODE
, &no_aggregate_address_summary_as_set_cmd
);
10427 install_element (BGP_NODE
, &no_aggregate_address_mask_cmd
);
10428 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
10429 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_cmd
);
10430 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
10431 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
10433 /* IPv4 unicast configuration. */
10434 install_element (BGP_IPV4_NODE
, &bgp_network_cmd
);
10435 install_element (BGP_IPV4_NODE
, &bgp_network_mask_cmd
);
10436 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_cmd
);
10437 install_element (BGP_IPV4_NODE
, &bgp_network_route_map_cmd
);
10438 install_element (BGP_IPV4_NODE
, &bgp_network_mask_route_map_cmd
);
10439 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_route_map_cmd
);
10440 install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
10441 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_cmd
);
10442 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_cmd
);
10443 install_element (BGP_IPV4_NODE
, &no_bgp_network_route_map_cmd
);
10444 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_route_map_cmd
);
10445 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
10446 install_element (BGP_IPV4_NODE
, &aggregate_address_cmd
);
10447 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_cmd
);
10448 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_only_cmd
);
10449 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_only_cmd
);
10450 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_cmd
);
10451 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_cmd
);
10452 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_summary_cmd
);
10453 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
10454 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_as_set_cmd
);
10455 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
10456 install_element (BGP_IPV4_NODE
, &no_aggregate_address_cmd
);
10457 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_only_cmd
);
10458 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_cmd
);
10459 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_summary_cmd
);
10460 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_as_set_cmd
);
10461 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_cmd
);
10462 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
10463 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_cmd
);
10464 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
10465 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
10467 /* IPv4 multicast configuration. */
10468 install_element (BGP_IPV4M_NODE
, &bgp_network_cmd
);
10469 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_cmd
);
10470 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_cmd
);
10471 install_element (BGP_IPV4M_NODE
, &bgp_network_route_map_cmd
);
10472 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_route_map_cmd
);
10473 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_route_map_cmd
);
10474 install_element (BGP_IPV4M_NODE
, &no_bgp_network_cmd
);
10475 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_cmd
);
10476 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_cmd
);
10477 install_element (BGP_IPV4M_NODE
, &no_bgp_network_route_map_cmd
);
10478 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_route_map_cmd
);
10479 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
10480 install_element (BGP_IPV4M_NODE
, &aggregate_address_cmd
);
10481 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_cmd
);
10482 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_only_cmd
);
10483 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_only_cmd
);
10484 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_cmd
);
10485 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_cmd
);
10486 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_summary_cmd
);
10487 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
10488 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_as_set_cmd
);
10489 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
10490 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_cmd
);
10491 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_only_cmd
);
10492 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_cmd
);
10493 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_summary_cmd
);
10494 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_as_set_cmd
);
10495 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_cmd
);
10496 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
10497 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_cmd
);
10498 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
10499 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
10501 install_element (VIEW_NODE
, &show_ip_bgp_cmd
);
10502 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cmd
);
10503 install_element (VIEW_NODE
, &show_ip_bgp_route_cmd
);
10504 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_cmd
);
10505 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
10506 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
10507 install_element (VIEW_NODE
, &show_ip_bgp_prefix_cmd
);
10508 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
10509 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
10510 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
10511 install_element (VIEW_NODE
, &show_ip_bgp_view_cmd
);
10512 install_element (VIEW_NODE
, &show_ip_bgp_view_route_cmd
);
10513 install_element (VIEW_NODE
, &show_ip_bgp_view_prefix_cmd
);
10514 install_element (VIEW_NODE
, &show_ip_bgp_regexp_cmd
);
10515 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
10516 install_element (VIEW_NODE
, &show_ip_bgp_prefix_list_cmd
);
10517 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
10518 install_element (VIEW_NODE
, &show_ip_bgp_filter_list_cmd
);
10519 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
10520 install_element (VIEW_NODE
, &show_ip_bgp_route_map_cmd
);
10521 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
10522 install_element (VIEW_NODE
, &show_ip_bgp_cidr_only_cmd
);
10523 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
10524 install_element (VIEW_NODE
, &show_ip_bgp_community_all_cmd
);
10525 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
10526 install_element (VIEW_NODE
, &show_ip_bgp_community_cmd
);
10527 install_element (VIEW_NODE
, &show_ip_bgp_community2_cmd
);
10528 install_element (VIEW_NODE
, &show_ip_bgp_community3_cmd
);
10529 install_element (VIEW_NODE
, &show_ip_bgp_community4_cmd
);
10530 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_cmd
);
10531 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
10532 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
10533 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
10534 install_element (VIEW_NODE
, &show_ip_bgp_community_exact_cmd
);
10535 install_element (VIEW_NODE
, &show_ip_bgp_community2_exact_cmd
);
10536 install_element (VIEW_NODE
, &show_ip_bgp_community3_exact_cmd
);
10537 install_element (VIEW_NODE
, &show_ip_bgp_community4_exact_cmd
);
10538 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
10539 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
10540 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
10541 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
10542 install_element (VIEW_NODE
, &show_ip_bgp_community_list_cmd
);
10543 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
10544 install_element (VIEW_NODE
, &show_ip_bgp_community_list_exact_cmd
);
10545 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
10546 install_element (VIEW_NODE
, &show_ip_bgp_prefix_longer_cmd
);
10547 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
10548 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
10549 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
10550 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
10551 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
10552 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
10553 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
10554 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
10555 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
10556 install_element (VIEW_NODE
, &show_ip_bgp_dampened_paths_cmd
);
10557 install_element (VIEW_NODE
, &show_ip_bgp_flap_statistics_cmd
);
10558 install_element (VIEW_NODE
, &show_ip_bgp_flap_address_cmd
);
10559 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_cmd
);
10560 install_element (VIEW_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
10561 install_element (VIEW_NODE
, &show_ip_bgp_flap_regexp_cmd
);
10562 install_element (VIEW_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
10563 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
10564 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
10565 install_element (VIEW_NODE
, &show_ip_bgp_flap_route_map_cmd
);
10566 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
10567 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
10568 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_cmd
);
10569 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_route_cmd
);
10570 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
10571 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_cmd
);
10572 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
10573 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
10575 install_element (ENABLE_NODE
, &show_ip_bgp_cmd
);
10576 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cmd
);
10577 install_element (ENABLE_NODE
, &show_ip_bgp_route_cmd
);
10578 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_cmd
);
10579 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
10580 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
10581 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_cmd
);
10582 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
10583 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
10584 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
10585 install_element (ENABLE_NODE
, &show_ip_bgp_view_cmd
);
10586 install_element (ENABLE_NODE
, &show_ip_bgp_view_route_cmd
);
10587 install_element (ENABLE_NODE
, &show_ip_bgp_view_prefix_cmd
);
10588 install_element (ENABLE_NODE
, &show_ip_bgp_regexp_cmd
);
10589 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
10590 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_list_cmd
);
10591 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
10592 install_element (ENABLE_NODE
, &show_ip_bgp_filter_list_cmd
);
10593 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
10594 install_element (ENABLE_NODE
, &show_ip_bgp_route_map_cmd
);
10595 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
10596 install_element (ENABLE_NODE
, &show_ip_bgp_cidr_only_cmd
);
10597 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
10598 install_element (ENABLE_NODE
, &show_ip_bgp_community_all_cmd
);
10599 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
10600 install_element (ENABLE_NODE
, &show_ip_bgp_community_cmd
);
10601 install_element (ENABLE_NODE
, &show_ip_bgp_community2_cmd
);
10602 install_element (ENABLE_NODE
, &show_ip_bgp_community3_cmd
);
10603 install_element (ENABLE_NODE
, &show_ip_bgp_community4_cmd
);
10604 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_cmd
);
10605 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
10606 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
10607 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
10608 install_element (ENABLE_NODE
, &show_ip_bgp_community_exact_cmd
);
10609 install_element (ENABLE_NODE
, &show_ip_bgp_community2_exact_cmd
);
10610 install_element (ENABLE_NODE
, &show_ip_bgp_community3_exact_cmd
);
10611 install_element (ENABLE_NODE
, &show_ip_bgp_community4_exact_cmd
);
10612 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
10613 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
10614 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
10615 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
10616 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_cmd
);
10617 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
10618 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_exact_cmd
);
10619 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
10620 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_longer_cmd
);
10621 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
10622 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
10623 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
10624 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
10625 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
10626 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
10627 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
10628 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
10629 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
10630 install_element (ENABLE_NODE
, &show_ip_bgp_dampened_paths_cmd
);
10631 install_element (ENABLE_NODE
, &show_ip_bgp_flap_statistics_cmd
);
10632 install_element (ENABLE_NODE
, &show_ip_bgp_flap_address_cmd
);
10633 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_cmd
);
10634 install_element (ENABLE_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
10635 install_element (ENABLE_NODE
, &show_ip_bgp_flap_regexp_cmd
);
10636 install_element (ENABLE_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
10637 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
10638 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
10639 install_element (ENABLE_NODE
, &show_ip_bgp_flap_route_map_cmd
);
10640 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
10641 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
10642 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_cmd
);
10643 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_route_cmd
);
10644 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
10645 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_cmd
);
10646 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
10647 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
10649 /* BGP dampening clear commands */
10650 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_cmd
);
10651 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_prefix_cmd
);
10652 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_cmd
);
10653 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_mask_cmd
);
10656 /* New config IPv6 BGP commands. */
10657 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_cmd
);
10658 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_route_map_cmd
);
10659 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_cmd
);
10660 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_route_map_cmd
);
10662 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_cmd
);
10663 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_summary_only_cmd
);
10664 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_cmd
);
10665 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_summary_only_cmd
);
10667 /* Old config IPv6 BGP commands. */
10668 install_element (BGP_NODE
, &old_ipv6_bgp_network_cmd
);
10669 install_element (BGP_NODE
, &old_no_ipv6_bgp_network_cmd
);
10671 install_element (BGP_NODE
, &old_ipv6_aggregate_address_cmd
);
10672 install_element (BGP_NODE
, &old_ipv6_aggregate_address_summary_only_cmd
);
10673 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_cmd
);
10674 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_summary_only_cmd
);
10676 install_element (VIEW_NODE
, &show_bgp_cmd
);
10677 install_element (VIEW_NODE
, &show_bgp_ipv6_cmd
);
10678 install_element (VIEW_NODE
, &show_bgp_route_cmd
);
10679 install_element (VIEW_NODE
, &show_bgp_ipv6_route_cmd
);
10680 install_element (VIEW_NODE
, &show_bgp_prefix_cmd
);
10681 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_cmd
);
10682 install_element (VIEW_NODE
, &show_bgp_regexp_cmd
);
10683 install_element (VIEW_NODE
, &show_bgp_ipv6_regexp_cmd
);
10684 install_element (VIEW_NODE
, &show_bgp_prefix_list_cmd
);
10685 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
10686 install_element (VIEW_NODE
, &show_bgp_filter_list_cmd
);
10687 install_element (VIEW_NODE
, &show_bgp_ipv6_filter_list_cmd
);
10688 install_element (VIEW_NODE
, &show_bgp_route_map_cmd
);
10689 install_element (VIEW_NODE
, &show_bgp_ipv6_route_map_cmd
);
10690 install_element (VIEW_NODE
, &show_bgp_community_all_cmd
);
10691 install_element (VIEW_NODE
, &show_bgp_ipv6_community_all_cmd
);
10692 install_element (VIEW_NODE
, &show_bgp_community_cmd
);
10693 install_element (VIEW_NODE
, &show_bgp_ipv6_community_cmd
);
10694 install_element (VIEW_NODE
, &show_bgp_community2_cmd
);
10695 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_cmd
);
10696 install_element (VIEW_NODE
, &show_bgp_community3_cmd
);
10697 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_cmd
);
10698 install_element (VIEW_NODE
, &show_bgp_community4_cmd
);
10699 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_cmd
);
10700 install_element (VIEW_NODE
, &show_bgp_community_exact_cmd
);
10701 install_element (VIEW_NODE
, &show_bgp_ipv6_community_exact_cmd
);
10702 install_element (VIEW_NODE
, &show_bgp_community2_exact_cmd
);
10703 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
10704 install_element (VIEW_NODE
, &show_bgp_community3_exact_cmd
);
10705 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
10706 install_element (VIEW_NODE
, &show_bgp_community4_exact_cmd
);
10707 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
10708 install_element (VIEW_NODE
, &show_bgp_community_list_cmd
);
10709 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_cmd
);
10710 install_element (VIEW_NODE
, &show_bgp_community_list_exact_cmd
);
10711 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
10712 install_element (VIEW_NODE
, &show_bgp_prefix_longer_cmd
);
10713 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
10714 install_element (VIEW_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
10715 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
10716 install_element (VIEW_NODE
, &show_bgp_neighbor_received_routes_cmd
);
10717 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
10718 install_element (VIEW_NODE
, &show_bgp_neighbor_routes_cmd
);
10719 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
10720 install_element (VIEW_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
10721 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
10722 install_element (VIEW_NODE
, &show_bgp_neighbor_flap_cmd
);
10723 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
10724 install_element (VIEW_NODE
, &show_bgp_neighbor_damp_cmd
);
10725 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
10726 install_element (VIEW_NODE
, &show_bgp_rsclient_cmd
);
10727 install_element (VIEW_NODE
, &show_bgp_rsclient_route_cmd
);
10728 install_element (VIEW_NODE
, &show_bgp_rsclient_prefix_cmd
);
10729 install_element (VIEW_NODE
, &show_bgp_view_cmd
);
10730 install_element (VIEW_NODE
, &show_bgp_view_ipv6_cmd
);
10731 install_element (VIEW_NODE
, &show_bgp_view_route_cmd
);
10732 install_element (VIEW_NODE
, &show_bgp_view_ipv6_route_cmd
);
10733 install_element (VIEW_NODE
, &show_bgp_view_prefix_cmd
);
10734 install_element (VIEW_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
10735 install_element (VIEW_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
10736 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
10737 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
10738 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
10739 install_element (VIEW_NODE
, &show_bgp_view_neighbor_routes_cmd
);
10740 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
10741 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
10742 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
10743 install_element (VIEW_NODE
, &show_bgp_view_neighbor_flap_cmd
);
10744 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
10745 install_element (VIEW_NODE
, &show_bgp_view_neighbor_damp_cmd
);
10746 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
10747 install_element (VIEW_NODE
, &show_bgp_view_rsclient_cmd
);
10748 install_element (VIEW_NODE
, &show_bgp_view_rsclient_route_cmd
);
10749 install_element (VIEW_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
10751 install_element (ENABLE_NODE
, &show_bgp_cmd
);
10752 install_element (ENABLE_NODE
, &show_bgp_ipv6_cmd
);
10753 install_element (ENABLE_NODE
, &show_bgp_route_cmd
);
10754 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_cmd
);
10755 install_element (ENABLE_NODE
, &show_bgp_prefix_cmd
);
10756 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_cmd
);
10757 install_element (ENABLE_NODE
, &show_bgp_regexp_cmd
);
10758 install_element (ENABLE_NODE
, &show_bgp_ipv6_regexp_cmd
);
10759 install_element (ENABLE_NODE
, &show_bgp_prefix_list_cmd
);
10760 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
10761 install_element (ENABLE_NODE
, &show_bgp_filter_list_cmd
);
10762 install_element (ENABLE_NODE
, &show_bgp_ipv6_filter_list_cmd
);
10763 install_element (ENABLE_NODE
, &show_bgp_route_map_cmd
);
10764 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_map_cmd
);
10765 install_element (ENABLE_NODE
, &show_bgp_community_all_cmd
);
10766 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_all_cmd
);
10767 install_element (ENABLE_NODE
, &show_bgp_community_cmd
);
10768 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_cmd
);
10769 install_element (ENABLE_NODE
, &show_bgp_community2_cmd
);
10770 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_cmd
);
10771 install_element (ENABLE_NODE
, &show_bgp_community3_cmd
);
10772 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_cmd
);
10773 install_element (ENABLE_NODE
, &show_bgp_community4_cmd
);
10774 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_cmd
);
10775 install_element (ENABLE_NODE
, &show_bgp_community_exact_cmd
);
10776 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_exact_cmd
);
10777 install_element (ENABLE_NODE
, &show_bgp_community2_exact_cmd
);
10778 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
10779 install_element (ENABLE_NODE
, &show_bgp_community3_exact_cmd
);
10780 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
10781 install_element (ENABLE_NODE
, &show_bgp_community4_exact_cmd
);
10782 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
10783 install_element (ENABLE_NODE
, &show_bgp_community_list_cmd
);
10784 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_cmd
);
10785 install_element (ENABLE_NODE
, &show_bgp_community_list_exact_cmd
);
10786 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
10787 install_element (ENABLE_NODE
, &show_bgp_prefix_longer_cmd
);
10788 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
10789 install_element (ENABLE_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
10790 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
10791 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_routes_cmd
);
10792 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
10793 install_element (ENABLE_NODE
, &show_bgp_neighbor_routes_cmd
);
10794 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
10795 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
10796 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
10797 install_element (ENABLE_NODE
, &show_bgp_neighbor_flap_cmd
);
10798 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
10799 install_element (ENABLE_NODE
, &show_bgp_neighbor_damp_cmd
);
10800 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
10801 install_element (ENABLE_NODE
, &show_bgp_rsclient_cmd
);
10802 install_element (ENABLE_NODE
, &show_bgp_rsclient_route_cmd
);
10803 install_element (ENABLE_NODE
, &show_bgp_rsclient_prefix_cmd
);
10804 install_element (ENABLE_NODE
, &show_bgp_view_cmd
);
10805 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_cmd
);
10806 install_element (ENABLE_NODE
, &show_bgp_view_route_cmd
);
10807 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_route_cmd
);
10808 install_element (ENABLE_NODE
, &show_bgp_view_prefix_cmd
);
10809 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
10810 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
10811 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
10812 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
10813 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
10814 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_routes_cmd
);
10815 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
10816 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
10817 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
10818 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_flap_cmd
);
10819 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
10820 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_damp_cmd
);
10821 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
10822 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_cmd
);
10823 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_route_cmd
);
10824 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
10827 install_element (VIEW_NODE
, &show_ipv6_bgp_cmd
);
10828 install_element (VIEW_NODE
, &show_ipv6_bgp_route_cmd
);
10829 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_cmd
);
10830 install_element (VIEW_NODE
, &show_ipv6_bgp_regexp_cmd
);
10831 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
10832 install_element (VIEW_NODE
, &show_ipv6_bgp_filter_list_cmd
);
10833 install_element (VIEW_NODE
, &show_ipv6_bgp_community_all_cmd
);
10834 install_element (VIEW_NODE
, &show_ipv6_bgp_community_cmd
);
10835 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_cmd
);
10836 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_cmd
);
10837 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_cmd
);
10838 install_element (VIEW_NODE
, &show_ipv6_bgp_community_exact_cmd
);
10839 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
10840 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
10841 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
10842 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_cmd
);
10843 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
10844 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
10845 install_element (VIEW_NODE
, &show_ipv6_mbgp_cmd
);
10846 install_element (VIEW_NODE
, &show_ipv6_mbgp_route_cmd
);
10847 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_cmd
);
10848 install_element (VIEW_NODE
, &show_ipv6_mbgp_regexp_cmd
);
10849 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
10850 install_element (VIEW_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
10851 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_all_cmd
);
10852 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_cmd
);
10853 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_cmd
);
10854 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_cmd
);
10855 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_cmd
);
10856 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
10857 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
10858 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
10859 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
10860 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_cmd
);
10861 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
10862 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
10865 install_element (ENABLE_NODE
, &show_ipv6_bgp_cmd
);
10866 install_element (ENABLE_NODE
, &show_ipv6_bgp_route_cmd
);
10867 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_cmd
);
10868 install_element (ENABLE_NODE
, &show_ipv6_bgp_regexp_cmd
);
10869 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
10870 install_element (ENABLE_NODE
, &show_ipv6_bgp_filter_list_cmd
);
10871 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_all_cmd
);
10872 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_cmd
);
10873 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_cmd
);
10874 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_cmd
);
10875 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_cmd
);
10876 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_exact_cmd
);
10877 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
10878 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
10879 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
10880 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_cmd
);
10881 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
10882 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
10883 install_element (ENABLE_NODE
, &show_ipv6_mbgp_cmd
);
10884 install_element (ENABLE_NODE
, &show_ipv6_mbgp_route_cmd
);
10885 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_cmd
);
10886 install_element (ENABLE_NODE
, &show_ipv6_mbgp_regexp_cmd
);
10887 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
10888 install_element (ENABLE_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
10889 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_all_cmd
);
10890 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_cmd
);
10891 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_cmd
);
10892 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_cmd
);
10893 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_cmd
);
10894 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
10895 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
10896 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
10897 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
10898 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_cmd
);
10899 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
10900 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
10903 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
10904 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
10905 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
10906 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
10909 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
10910 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
10911 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
10912 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
10915 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
10916 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
10917 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
10918 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
10919 #endif /* HAVE_IPV6 */
10921 install_element (BGP_NODE
, &bgp_distance_cmd
);
10922 install_element (BGP_NODE
, &no_bgp_distance_cmd
);
10923 install_element (BGP_NODE
, &no_bgp_distance2_cmd
);
10924 install_element (BGP_NODE
, &bgp_distance_source_cmd
);
10925 install_element (BGP_NODE
, &no_bgp_distance_source_cmd
);
10926 install_element (BGP_NODE
, &bgp_distance_source_access_list_cmd
);
10927 install_element (BGP_NODE
, &no_bgp_distance_source_access_list_cmd
);
10929 install_element (BGP_NODE
, &bgp_damp_set_cmd
);
10930 install_element (BGP_NODE
, &bgp_damp_set2_cmd
);
10931 install_element (BGP_NODE
, &bgp_damp_set3_cmd
);
10932 install_element (BGP_NODE
, &bgp_damp_unset_cmd
);
10933 install_element (BGP_NODE
, &bgp_damp_unset2_cmd
);
10934 install_element (BGP_IPV4_NODE
, &bgp_damp_set_cmd
);
10935 install_element (BGP_IPV4_NODE
, &bgp_damp_set2_cmd
);
10936 install_element (BGP_IPV4_NODE
, &bgp_damp_set3_cmd
);
10937 install_element (BGP_IPV4_NODE
, &bgp_damp_unset_cmd
);
10938 install_element (BGP_IPV4_NODE
, &bgp_damp_unset2_cmd
);