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"
57 #include "bgpd/bgp_mpath.h"
59 /* Extern from bgp_dump.c */
60 extern const char *bgp_origin_str
[];
61 extern const char *bgp_origin_long_str
[];
63 static struct bgp_node
*
64 bgp_afi_node_get (struct bgp_table
*table
, afi_t afi
, safi_t safi
, struct prefix
*p
,
65 struct prefix_rd
*prd
)
68 struct bgp_node
*prn
= NULL
;
74 if (safi
== SAFI_MPLS_VPN
)
76 prn
= bgp_node_get (table
, (struct prefix
*) prd
);
78 if (prn
->info
== NULL
)
79 prn
->info
= bgp_table_init (afi
, safi
);
81 bgp_unlock_node (prn
);
85 rn
= bgp_node_get (table
, p
);
87 if (safi
== SAFI_MPLS_VPN
)
93 /* Allocate bgp_info_extra */
94 static struct bgp_info_extra
*
95 bgp_info_extra_new (void)
97 struct bgp_info_extra
*new;
98 new = XCALLOC (MTYPE_BGP_ROUTE_EXTRA
, sizeof (struct bgp_info_extra
));
103 bgp_info_extra_free (struct bgp_info_extra
**extra
)
107 if ((*extra
)->damp_info
)
108 bgp_damp_info_free ((*extra
)->damp_info
, 0);
110 (*extra
)->damp_info
= NULL
;
112 XFREE (MTYPE_BGP_ROUTE_EXTRA
, *extra
);
118 /* Get bgp_info extra information for the given bgp_info, lazy allocated
121 struct bgp_info_extra
*
122 bgp_info_extra_get (struct bgp_info
*ri
)
125 ri
->extra
= bgp_info_extra_new();
129 /* Allocate new bgp info structure. */
130 static struct bgp_info
*
133 return XCALLOC (MTYPE_BGP_ROUTE
, sizeof (struct bgp_info
));
136 /* Free bgp route information. */
138 bgp_info_free (struct bgp_info
*binfo
)
141 bgp_attr_unintern (&binfo
->attr
);
143 bgp_info_extra_free (&binfo
->extra
);
144 bgp_info_mpath_free (&binfo
->mpath
);
146 peer_unlock (binfo
->peer
); /* bgp_info peer reference */
148 XFREE (MTYPE_BGP_ROUTE
, binfo
);
152 bgp_info_lock (struct bgp_info
*binfo
)
159 bgp_info_unlock (struct bgp_info
*binfo
)
161 assert (binfo
&& binfo
->lock
> 0);
164 if (binfo
->lock
== 0)
167 zlog_debug ("%s: unlocked and freeing", __func__
);
168 zlog_backtrace (LOG_DEBUG
);
170 bgp_info_free (binfo
);
175 if (binfo
->lock
== 1)
177 zlog_debug ("%s: unlocked to 1", __func__
);
178 zlog_backtrace (LOG_DEBUG
);
186 bgp_info_add (struct bgp_node
*rn
, struct bgp_info
*ri
)
188 struct bgp_info
*top
;
200 peer_lock (ri
->peer
); /* bgp_info peer reference */
203 /* Do the actual removal of info from RIB, for use by bgp_process
204 completion callback *only* */
206 bgp_info_reap (struct bgp_node
*rn
, struct bgp_info
*ri
)
209 ri
->next
->prev
= ri
->prev
;
211 ri
->prev
->next
= ri
->next
;
215 bgp_info_mpath_dequeue (ri
);
216 bgp_info_unlock (ri
);
217 bgp_unlock_node (rn
);
221 bgp_info_delete (struct bgp_node
*rn
, struct bgp_info
*ri
)
223 bgp_info_set_flag (rn
, ri
, BGP_INFO_REMOVED
);
224 /* set of previous already took care of pcount */
225 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
228 /* undo the effects of a previous call to bgp_info_delete; typically
229 called when a route is deleted and then quickly re-added before the
230 deletion has been processed */
232 bgp_info_restore (struct bgp_node
*rn
, struct bgp_info
*ri
)
234 bgp_info_unset_flag (rn
, ri
, BGP_INFO_REMOVED
);
235 /* unset of previous already took care of pcount */
236 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
239 /* Adjust pcount as required */
241 bgp_pcount_adjust (struct bgp_node
*rn
, struct bgp_info
*ri
)
243 struct bgp_table
*table
;
245 assert (rn
&& bgp_node_table (rn
));
246 assert (ri
&& ri
->peer
&& ri
->peer
->bgp
);
248 table
= bgp_node_table (rn
);
250 /* Ignore 'pcount' for RS-client tables */
251 if (table
->type
!= BGP_TABLE_MAIN
252 || ri
->peer
== ri
->peer
->bgp
->peer_self
)
255 if (BGP_INFO_HOLDDOWN (ri
)
256 && CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
259 UNSET_FLAG (ri
->flags
, BGP_INFO_COUNTED
);
261 /* slight hack, but more robust against errors. */
262 if (ri
->peer
->pcount
[table
->afi
][table
->safi
])
263 ri
->peer
->pcount
[table
->afi
][table
->safi
]--;
266 zlog_warn ("%s: Asked to decrement 0 prefix count for peer %s",
267 __func__
, ri
->peer
->host
);
268 zlog_backtrace (LOG_WARNING
);
269 zlog_warn ("%s: Please report to Quagga bugzilla", __func__
);
272 else if (!BGP_INFO_HOLDDOWN (ri
)
273 && !CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
275 SET_FLAG (ri
->flags
, BGP_INFO_COUNTED
);
276 ri
->peer
->pcount
[table
->afi
][table
->safi
]++;
281 /* Set/unset bgp_info flags, adjusting any other state as needed.
282 * This is here primarily to keep prefix-count in check.
285 bgp_info_set_flag (struct bgp_node
*rn
, struct bgp_info
*ri
, u_int32_t flag
)
287 SET_FLAG (ri
->flags
, flag
);
289 /* early bath if we know it's not a flag that changes useability state */
290 if (!CHECK_FLAG (flag
, BGP_INFO_VALID
|BGP_INFO_UNUSEABLE
))
293 bgp_pcount_adjust (rn
, ri
);
297 bgp_info_unset_flag (struct bgp_node
*rn
, struct bgp_info
*ri
, u_int32_t flag
)
299 UNSET_FLAG (ri
->flags
, flag
);
301 /* early bath if we know it's not a flag that changes useability state */
302 if (!CHECK_FLAG (flag
, BGP_INFO_VALID
|BGP_INFO_UNUSEABLE
))
305 bgp_pcount_adjust (rn
, ri
);
308 /* Get MED value. If MED value is missing and "bgp bestpath
309 missing-as-worst" is specified, treat it as the worst value. */
311 bgp_med_value (struct attr
*attr
, struct bgp
*bgp
)
313 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
317 if (bgp_flag_check (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
))
324 /* Compare two bgp route entity. br is preferable then return 1. */
326 bgp_info_cmp (struct bgp
*bgp
, struct bgp_info
*new, struct bgp_info
*exist
,
327 int *paths_eq
, struct bgp_maxpaths_cfg
*mpath_cfg
)
329 struct attr
*newattr
, *existattr
;
330 struct attr_extra
*newattre
, *existattre
;
331 bgp_peer_sort_t new_sort
;
332 bgp_peer_sort_t exist_sort
;
334 u_int32_t exist_pref
;
337 u_int32_t new_weight
;
338 u_int32_t exist_weight
;
339 uint32_t newm
, existm
;
340 struct in_addr new_id
;
341 struct in_addr exist_id
;
344 int internal_as_route
;
357 existattr
= exist
->attr
;
358 newattre
= newattr
->extra
;
359 existattre
= existattr
->extra
;
361 /* 1. Weight check. */
362 new_weight
= exist_weight
= 0;
365 new_weight
= newattre
->weight
;
367 exist_weight
= existattre
->weight
;
369 if (new_weight
> exist_weight
)
371 if (new_weight
< exist_weight
)
374 /* 2. Local preference check. */
375 new_pref
= exist_pref
= bgp
->default_local_pref
;
377 if (newattr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
378 new_pref
= newattr
->local_pref
;
379 if (existattr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
380 exist_pref
= existattr
->local_pref
;
382 if (new_pref
> exist_pref
)
384 if (new_pref
< exist_pref
)
387 /* 3. Local route check. We prefer:
389 * - BGP_ROUTE_AGGREGATE
390 * - BGP_ROUTE_REDISTRIBUTE
392 if (! (new->sub_type
== BGP_ROUTE_NORMAL
))
394 if (! (exist
->sub_type
== BGP_ROUTE_NORMAL
))
397 /* 4. AS path length check. */
398 if (! bgp_flag_check (bgp
, BGP_FLAG_ASPATH_IGNORE
))
400 int exist_hops
= aspath_count_hops (existattr
->aspath
);
401 int exist_confeds
= aspath_count_confeds (existattr
->aspath
);
403 if (bgp_flag_check (bgp
, BGP_FLAG_ASPATH_CONFED
))
407 aspath_hops
= aspath_count_hops (newattr
->aspath
);
408 aspath_hops
+= aspath_count_confeds (newattr
->aspath
);
410 if ( aspath_hops
< (exist_hops
+ exist_confeds
))
412 if ( aspath_hops
> (exist_hops
+ exist_confeds
))
417 int newhops
= aspath_count_hops (newattr
->aspath
);
419 if (newhops
< exist_hops
)
421 if (newhops
> exist_hops
)
426 /* 5. Origin check. */
427 if (newattr
->origin
< existattr
->origin
)
429 if (newattr
->origin
> existattr
->origin
)
433 internal_as_route
= (aspath_count_hops (newattr
->aspath
) == 0
434 && aspath_count_hops (existattr
->aspath
) == 0);
435 confed_as_route
= (aspath_count_confeds (newattr
->aspath
) > 0
436 && aspath_count_confeds (existattr
->aspath
) > 0
437 && aspath_count_hops (newattr
->aspath
) == 0
438 && aspath_count_hops (existattr
->aspath
) == 0);
440 if (bgp_flag_check (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
)
441 || (bgp_flag_check (bgp
, BGP_FLAG_MED_CONFED
)
443 || aspath_cmp_left (newattr
->aspath
, existattr
->aspath
)
444 || aspath_cmp_left_confed (newattr
->aspath
, existattr
->aspath
)
445 || internal_as_route
)
447 new_med
= bgp_med_value (new->attr
, bgp
);
448 exist_med
= bgp_med_value (exist
->attr
, bgp
);
450 if (new_med
< exist_med
)
452 if (new_med
> exist_med
)
456 /* 7. Peer type check. */
457 new_sort
= new->peer
->sort
;
458 exist_sort
= exist
->peer
->sort
;
460 if (new_sort
== BGP_PEER_EBGP
461 && (exist_sort
== BGP_PEER_IBGP
|| exist_sort
== BGP_PEER_CONFED
))
463 if (exist_sort
== BGP_PEER_EBGP
464 && (new_sort
== BGP_PEER_IBGP
|| new_sort
== BGP_PEER_CONFED
))
467 /* 8. IGP metric check. */
471 newm
= new->extra
->igpmetric
;
473 existm
= exist
->extra
->igpmetric
;
480 /* 8.1. Same IGP metric. Compare the cluster list length as
481 representative of IGP hops metric. Rewrite the metric value
482 pair (newm, existm) with the cluster list length. Prefer the
483 path with smaller cluster list length. */
486 if (peer_sort (new->peer
) == BGP_PEER_IBGP
487 && peer_sort (exist
->peer
) == BGP_PEER_IBGP
488 && CHECK_FLAG (mpath_cfg
->ibgp_flags
,
489 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
))
491 newm
= BGP_CLUSTER_LIST_LENGTH(new->attr
);
492 existm
= BGP_CLUSTER_LIST_LENGTH(exist
->attr
);
500 /* 9. Maximum path check. */
503 if (bgp_flag_check(bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
))
507 * For the two paths, all comparison steps till IGP metric
508 * have succeeded - including AS_PATH hop count. Since 'bgp
509 * bestpath as-path multipath-relax' knob is on, we don't need
510 * an exact match of AS_PATH. Thus, mark the paths are equal.
511 * That will trigger both these paths to get into the multipath
516 else if (new->peer
->sort
== BGP_PEER_IBGP
)
518 if (aspath_cmp (new->attr
->aspath
, exist
->attr
->aspath
))
521 else if (new->peer
->as
== exist
->peer
->as
)
527 * TODO: If unequal cost ibgp multipath is enabled we can
528 * mark the paths as equal here instead of returning
533 /* 10. If both paths are external, prefer the path that was received
534 first (the oldest one). This step minimizes route-flap, since a
535 newer path won't displace an older one, even if it was the
536 preferred route based on the additional decision criteria below. */
537 if (! bgp_flag_check (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
)
538 && new_sort
== BGP_PEER_EBGP
539 && exist_sort
== BGP_PEER_EBGP
)
541 if (CHECK_FLAG (new->flags
, BGP_INFO_SELECTED
))
543 if (CHECK_FLAG (exist
->flags
, BGP_INFO_SELECTED
))
547 /* 11. Rourter-ID comparision. */
548 if (newattr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
549 new_id
.s_addr
= newattre
->originator_id
.s_addr
;
551 new_id
.s_addr
= new->peer
->remote_id
.s_addr
;
552 if (existattr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
553 exist_id
.s_addr
= existattre
->originator_id
.s_addr
;
555 exist_id
.s_addr
= exist
->peer
->remote_id
.s_addr
;
557 if (ntohl (new_id
.s_addr
) < ntohl (exist_id
.s_addr
))
559 if (ntohl (new_id
.s_addr
) > ntohl (exist_id
.s_addr
))
562 /* 12. Cluster length comparision. */
563 new_cluster
= BGP_CLUSTER_LIST_LENGTH(new->attr
);
564 exist_cluster
= BGP_CLUSTER_LIST_LENGTH(exist
->attr
);
566 if (new_cluster
< exist_cluster
)
568 if (new_cluster
> exist_cluster
)
571 /* 13. Neighbor address comparision. */
572 ret
= sockunion_cmp (new->peer
->su_remote
, exist
->peer
->su_remote
);
582 static enum filter_type
583 bgp_input_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
584 afi_t afi
, safi_t safi
)
586 struct bgp_filter
*filter
;
588 filter
= &peer
->filter
[afi
][safi
];
590 #define FILTER_EXIST_WARN(F,f,filter) \
591 if (BGP_DEBUG (update, UPDATE_IN) \
592 && !(F ## _IN (filter))) \
593 plog_warn (peer->log, "%s: Could not find configured input %s-list %s!", \
594 peer->host, #f, F ## _IN_NAME(filter));
596 if (DISTRIBUTE_IN_NAME (filter
)) {
597 FILTER_EXIST_WARN(DISTRIBUTE
, distribute
, filter
);
599 if (access_list_apply (DISTRIBUTE_IN (filter
), p
) == FILTER_DENY
)
603 if (PREFIX_LIST_IN_NAME (filter
)) {
604 FILTER_EXIST_WARN(PREFIX_LIST
, prefix
, filter
);
606 if (prefix_list_apply (PREFIX_LIST_IN (filter
), p
) == PREFIX_DENY
)
610 if (FILTER_LIST_IN_NAME (filter
)) {
611 FILTER_EXIST_WARN(FILTER_LIST
, as
, filter
);
613 if (as_list_apply (FILTER_LIST_IN (filter
), attr
->aspath
)== AS_FILTER_DENY
)
617 return FILTER_PERMIT
;
618 #undef FILTER_EXIST_WARN
621 static enum filter_type
622 bgp_output_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
623 afi_t afi
, safi_t safi
)
625 struct bgp_filter
*filter
;
627 filter
= &peer
->filter
[afi
][safi
];
629 #define FILTER_EXIST_WARN(F,f,filter) \
630 if (BGP_DEBUG (update, UPDATE_OUT) \
631 && !(F ## _OUT (filter))) \
632 plog_warn (peer->log, "%s: Could not find configured output %s-list %s!", \
633 peer->host, #f, F ## _OUT_NAME(filter));
635 if (DISTRIBUTE_OUT_NAME (filter
)) {
636 FILTER_EXIST_WARN(DISTRIBUTE
, distribute
, filter
);
638 if (access_list_apply (DISTRIBUTE_OUT (filter
), p
) == FILTER_DENY
)
642 if (PREFIX_LIST_OUT_NAME (filter
)) {
643 FILTER_EXIST_WARN(PREFIX_LIST
, prefix
, filter
);
645 if (prefix_list_apply (PREFIX_LIST_OUT (filter
), p
) == PREFIX_DENY
)
649 if (FILTER_LIST_OUT_NAME (filter
)) {
650 FILTER_EXIST_WARN(FILTER_LIST
, as
, filter
);
652 if (as_list_apply (FILTER_LIST_OUT (filter
), attr
->aspath
) == AS_FILTER_DENY
)
656 return FILTER_PERMIT
;
657 #undef FILTER_EXIST_WARN
660 /* If community attribute includes no_export then return 1. */
662 bgp_community_filter (struct peer
*peer
, struct attr
*attr
)
666 /* NO_ADVERTISE check. */
667 if (community_include (attr
->community
, COMMUNITY_NO_ADVERTISE
))
670 /* NO_EXPORT check. */
671 if (peer
->sort
== BGP_PEER_EBGP
&&
672 community_include (attr
->community
, COMMUNITY_NO_EXPORT
))
675 /* NO_EXPORT_SUBCONFED check. */
676 if (peer
->sort
== BGP_PEER_EBGP
677 || peer
->sort
== BGP_PEER_CONFED
)
678 if (community_include (attr
->community
, COMMUNITY_NO_EXPORT_SUBCONFED
))
684 /* Route reflection loop check. */
686 bgp_cluster_filter (struct peer
*peer
, struct attr
*attr
)
688 struct in_addr cluster_id
;
690 if (attr
->extra
&& attr
->extra
->cluster
)
692 if (peer
->bgp
->config
& BGP_CONFIG_CLUSTER_ID
)
693 cluster_id
= peer
->bgp
->cluster_id
;
695 cluster_id
= peer
->bgp
->router_id
;
697 if (cluster_loop_check (attr
->extra
->cluster
, cluster_id
))
704 bgp_input_modifier (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
705 afi_t afi
, safi_t safi
)
707 struct bgp_filter
*filter
;
708 struct bgp_info info
;
709 route_map_result_t ret
;
711 filter
= &peer
->filter
[afi
][safi
];
713 /* Apply default weight value. */
715 (bgp_attr_extra_get (attr
))->weight
= peer
->weight
;
717 /* Route map apply. */
718 if (ROUTE_MAP_IN_NAME (filter
))
720 /* Duplicate current value to new strucutre for modification. */
724 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IN
);
726 /* Apply BGP route map to the attribute. */
727 ret
= route_map_apply (ROUTE_MAP_IN (filter
), p
, RMAP_BGP
, &info
);
731 if (ret
== RMAP_DENYMATCH
)
732 /* caller has multiple error paths with bgp_attr_flush() */
739 bgp_export_modifier (struct peer
*rsclient
, struct peer
*peer
,
740 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
742 struct bgp_filter
*filter
;
743 struct bgp_info info
;
744 route_map_result_t ret
;
746 filter
= &peer
->filter
[afi
][safi
];
748 /* Route map apply. */
749 if (ROUTE_MAP_EXPORT_NAME (filter
))
751 /* Duplicate current value to new strucutre for modification. */
752 info
.peer
= rsclient
;
755 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
757 /* Apply BGP route map to the attribute. */
758 ret
= route_map_apply (ROUTE_MAP_EXPORT (filter
), p
, RMAP_BGP
, &info
);
760 rsclient
->rmap_type
= 0;
762 if (ret
== RMAP_DENYMATCH
)
764 /* Free newly generated AS path and community by route-map. */
765 bgp_attr_flush (attr
);
773 bgp_import_modifier (struct peer
*rsclient
, struct peer
*peer
,
774 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
776 struct bgp_filter
*filter
;
777 struct bgp_info info
;
778 route_map_result_t ret
;
780 filter
= &rsclient
->filter
[afi
][safi
];
782 /* Apply default weight value. */
784 (bgp_attr_extra_get (attr
))->weight
= peer
->weight
;
786 /* Route map apply. */
787 if (ROUTE_MAP_IMPORT_NAME (filter
))
789 /* Duplicate current value to new strucutre for modification. */
793 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IMPORT
);
795 /* Apply BGP route map to the attribute. */
796 ret
= route_map_apply (ROUTE_MAP_IMPORT (filter
), p
, RMAP_BGP
, &info
);
800 if (ret
== RMAP_DENYMATCH
)
802 /* Free newly generated AS path and community by route-map. */
803 bgp_attr_flush (attr
);
811 bgp_announce_check (struct bgp_info
*ri
, struct peer
*peer
, struct prefix
*p
,
812 struct attr
*attr
, afi_t afi
, safi_t safi
)
815 char buf
[SU_ADDRSTRLEN
];
816 struct bgp_filter
*filter
;
824 filter
= &peer
->filter
[afi
][safi
];
826 riattr
= bgp_info_mpath_count (ri
) ? bgp_info_mpath_attr (ri
) : ri
->attr
;
828 if (DISABLE_BGP_ANNOUNCE
)
831 /* Do not send announces to RS-clients from the 'normal' bgp_table. */
832 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
835 /* Do not send back route to sender. */
839 /* Aggregate-address suppress check. */
840 if (ri
->extra
&& ri
->extra
->suppress
)
841 if (! UNSUPPRESS_MAP_NAME (filter
))
844 /* Default route check. */
845 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
847 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
850 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
852 #endif /* HAVE_IPV6 */
855 /* Transparency check. */
856 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
)
857 && CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
862 /* If community is not disabled check the no-export and local. */
863 if (! transparent
&& bgp_community_filter (peer
, riattr
))
866 /* If the attribute has originator-id and it is same as remote
868 if (riattr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
870 if (IPV4_ADDR_SAME (&peer
->remote_id
, &riattr
->extra
->originator_id
))
872 if (BGP_DEBUG (filter
, FILTER
))
873 zlog (peer
->log
, LOG_DEBUG
,
874 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
876 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
882 /* ORF prefix-list filter check */
883 if (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
884 && (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
885 || CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
886 if (peer
->orf_plist
[afi
][safi
])
888 if (prefix_list_apply (peer
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
892 /* Output filter check. */
893 if (bgp_output_filter (peer
, p
, riattr
, afi
, safi
) == FILTER_DENY
)
895 if (BGP_DEBUG (filter
, FILTER
))
896 zlog (peer
->log
, LOG_DEBUG
,
897 "%s [Update:SEND] %s/%d is filtered",
899 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
904 #ifdef BGP_SEND_ASPATH_CHECK
905 /* AS path loop check. */
906 if (aspath_loop_check (riattr
->aspath
, peer
->as
))
908 if (BGP_DEBUG (filter
, FILTER
))
909 zlog (peer
->log
, LOG_DEBUG
,
910 "%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
911 peer
->host
, peer
->as
);
914 #endif /* BGP_SEND_ASPATH_CHECK */
916 /* If we're a CONFED we need to loop check the CONFED ID too */
917 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
919 if (aspath_loop_check(riattr
->aspath
, bgp
->confed_id
))
921 if (BGP_DEBUG (filter
, FILTER
))
922 zlog (peer
->log
, LOG_DEBUG
,
923 "%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
930 /* Route-Reflect check. */
931 if (from
->sort
== BGP_PEER_IBGP
&& peer
->sort
== BGP_PEER_IBGP
)
936 /* IBGP reflection check. */
939 /* A route from a Client peer. */
940 if (CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
942 /* Reflect to all the Non-Client peers and also to the
943 Client peers other than the originator. Originator check
944 is already done. So there is noting to do. */
945 /* no bgp client-to-client reflection check. */
946 if (bgp_flag_check (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
))
947 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
952 /* A route from a Non-client peer. Reflect to all other
954 if (! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
959 /* For modify attribute, copy it to temporary structure. */
960 bgp_attr_dup (attr
, riattr
);
962 /* If local-preference is not set. */
963 if ((peer
->sort
== BGP_PEER_IBGP
964 || peer
->sort
== BGP_PEER_CONFED
)
965 && (! (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))))
967 attr
->flag
|= ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
);
968 attr
->local_pref
= bgp
->default_local_pref
;
971 /* If originator-id is not set and the route is to be reflected,
972 set the originator id */
973 if (peer
&& from
&& peer
->sort
== BGP_PEER_IBGP
&&
974 from
->sort
== BGP_PEER_IBGP
&&
975 (! (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))))
977 attr
->extra
= bgp_attr_extra_get(attr
);
978 IPV4_ADDR_COPY(&(attr
->extra
->originator_id
), &(from
->remote_id
));
979 SET_FLAG(attr
->flag
, BGP_ATTR_ORIGINATOR_ID
);
982 /* Remove MED if its an EBGP peer - will get overwritten by route-maps */
983 if (peer
->sort
== BGP_PEER_EBGP
984 && attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
986 if (ri
->peer
!= bgp
->peer_self
&& ! transparent
987 && ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
988 attr
->flag
&= ~(ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
));
993 || (reflect
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF_ALL
))
994 || (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
)
995 && ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
)
997 || (p
->family
== AF_INET6
&&
998 ! IN6_IS_ADDR_UNSPECIFIED(&attr
->extra
->mp_nexthop_global
))
999 #endif /* HAVE_IPV6 */
1002 /* NEXT-HOP Unchanged. */
1004 else if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
1005 || (p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
1007 || (p
->family
== AF_INET6
&&
1008 IN6_IS_ADDR_UNSPECIFIED(&attr
->extra
->mp_nexthop_global
))
1009 #endif /* HAVE_IPV6 */
1010 || (peer
->sort
== BGP_PEER_EBGP
1011 && bgp_multiaccess_check_v4 (attr
->nexthop
, peer
->host
) == 0))
1013 /* Set IPv4 nexthop. */
1014 if (p
->family
== AF_INET
)
1016 if (safi
== SAFI_MPLS_VPN
)
1017 memcpy (&attr
->extra
->mp_nexthop_global_in
, &peer
->nexthop
.v4
,
1020 memcpy (&attr
->nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
1023 /* Set IPv6 nexthop. */
1024 if (p
->family
== AF_INET6
)
1026 /* IPv6 global nexthop must be included. */
1027 memcpy (&attr
->extra
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
1029 attr
->extra
->mp_nexthop_len
= 16;
1031 #endif /* HAVE_IPV6 */
1035 if (p
->family
== AF_INET6
)
1037 /* Left nexthop_local unchanged if so configured. */
1038 if ( CHECK_FLAG (peer
->af_flags
[afi
][safi
],
1039 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
1041 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->extra
->mp_nexthop_local
) )
1042 attr
->extra
->mp_nexthop_len
=32;
1044 attr
->extra
->mp_nexthop_len
=16;
1047 /* Default nexthop_local treatment for non-RS-Clients */
1050 /* Link-local address should not be transit to different peer. */
1051 attr
->extra
->mp_nexthop_len
= 16;
1053 /* Set link-local address for shared network peer. */
1054 if (peer
->shared_network
1055 && ! IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
1057 memcpy (&attr
->extra
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
1059 attr
->extra
->mp_nexthop_len
= 32;
1062 /* If bgpd act as BGP-4+ route-reflector, do not send link-local
1065 attr
->extra
->mp_nexthop_len
= 16;
1067 /* If BGP-4+ link-local nexthop is not link-local nexthop. */
1068 if (! IN6_IS_ADDR_LINKLOCAL (&peer
->nexthop
.v6_local
))
1069 attr
->extra
->mp_nexthop_len
= 16;
1073 #endif /* HAVE_IPV6 */
1075 /* If this is EBGP peer and remove-private-AS is set. */
1076 if (peer
->sort
== BGP_PEER_EBGP
1077 && peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
)
1078 && aspath_private_as_check (attr
->aspath
))
1079 attr
->aspath
= aspath_empty_get ();
1081 /* Route map & unsuppress-map apply. */
1082 if (ROUTE_MAP_OUT_NAME (filter
)
1083 || (ri
->extra
&& ri
->extra
->suppress
) )
1085 struct bgp_info info
;
1086 struct attr dummy_attr
;
1087 struct attr_extra dummy_extra
;
1089 dummy_attr
.extra
= &dummy_extra
;
1094 /* The route reflector is not allowed to modify the attributes
1095 of the reflected IBGP routes. */
1096 if (from
->sort
== BGP_PEER_IBGP
1097 && peer
->sort
== BGP_PEER_IBGP
)
1099 bgp_attr_dup (&dummy_attr
, attr
);
1100 info
.attr
= &dummy_attr
;
1103 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_OUT
);
1105 if (ri
->extra
&& ri
->extra
->suppress
)
1106 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
1108 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
1110 peer
->rmap_type
= 0;
1112 if (ret
== RMAP_DENYMATCH
)
1114 bgp_attr_flush (attr
);
1122 bgp_announce_check_rsclient (struct bgp_info
*ri
, struct peer
*rsclient
,
1123 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
1126 char buf
[SU_ADDRSTRLEN
];
1127 struct bgp_filter
*filter
;
1128 struct bgp_info info
;
1130 struct attr
*riattr
;
1133 filter
= &rsclient
->filter
[afi
][safi
];
1134 riattr
= bgp_info_mpath_count (ri
) ? bgp_info_mpath_attr (ri
) : ri
->attr
;
1136 if (DISABLE_BGP_ANNOUNCE
)
1139 /* Do not send back route to sender. */
1140 if (from
== rsclient
)
1143 /* Aggregate-address suppress check. */
1144 if (ri
->extra
&& ri
->extra
->suppress
)
1145 if (! UNSUPPRESS_MAP_NAME (filter
))
1148 /* Default route check. */
1149 if (CHECK_FLAG (rsclient
->af_sflags
[afi
][safi
],
1150 PEER_STATUS_DEFAULT_ORIGINATE
))
1152 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
1155 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
1157 #endif /* HAVE_IPV6 */
1160 /* If the attribute has originator-id and it is same as remote
1162 if (riattr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
1164 if (IPV4_ADDR_SAME (&rsclient
->remote_id
,
1165 &riattr
->extra
->originator_id
))
1167 if (BGP_DEBUG (filter
, FILTER
))
1168 zlog (rsclient
->log
, LOG_DEBUG
,
1169 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
1171 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1177 /* ORF prefix-list filter check */
1178 if (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
1179 && (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
1180 || CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
1181 if (rsclient
->orf_plist
[afi
][safi
])
1183 if (prefix_list_apply (rsclient
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
1187 /* Output filter check. */
1188 if (bgp_output_filter (rsclient
, p
, riattr
, afi
, safi
) == FILTER_DENY
)
1190 if (BGP_DEBUG (filter
, FILTER
))
1191 zlog (rsclient
->log
, LOG_DEBUG
,
1192 "%s [Update:SEND] %s/%d is filtered",
1194 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1199 #ifdef BGP_SEND_ASPATH_CHECK
1200 /* AS path loop check. */
1201 if (aspath_loop_check (riattr
->aspath
, rsclient
->as
))
1203 if (BGP_DEBUG (filter
, FILTER
))
1204 zlog (rsclient
->log
, LOG_DEBUG
,
1205 "%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
1206 rsclient
->host
, rsclient
->as
);
1209 #endif /* BGP_SEND_ASPATH_CHECK */
1211 /* For modify attribute, copy it to temporary structure. */
1212 bgp_attr_dup (attr
, riattr
);
1215 if ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
1217 || (p
->family
== AF_INET6
&&
1218 IN6_IS_ADDR_UNSPECIFIED(&attr
->extra
->mp_nexthop_global
))
1219 #endif /* HAVE_IPV6 */
1222 /* Set IPv4 nexthop. */
1223 if (p
->family
== AF_INET
)
1225 if (safi
== SAFI_MPLS_VPN
)
1226 memcpy (&attr
->extra
->mp_nexthop_global_in
, &rsclient
->nexthop
.v4
,
1229 memcpy (&attr
->nexthop
, &rsclient
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
1232 /* Set IPv6 nexthop. */
1233 if (p
->family
== AF_INET6
)
1235 /* IPv6 global nexthop must be included. */
1236 memcpy (&attr
->extra
->mp_nexthop_global
, &rsclient
->nexthop
.v6_global
,
1238 attr
->extra
->mp_nexthop_len
= 16;
1240 #endif /* HAVE_IPV6 */
1244 if (p
->family
== AF_INET6
)
1246 struct attr_extra
*attre
= attr
->extra
;
1248 /* Left nexthop_local unchanged if so configured. */
1249 if ( CHECK_FLAG (rsclient
->af_flags
[afi
][safi
],
1250 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
1252 if ( IN6_IS_ADDR_LINKLOCAL (&attre
->mp_nexthop_local
) )
1253 attre
->mp_nexthop_len
=32;
1255 attre
->mp_nexthop_len
=16;
1258 /* Default nexthop_local treatment for RS-Clients */
1261 /* Announcer and RS-Client are both in the same network */
1262 if (rsclient
->shared_network
&& from
->shared_network
&&
1263 (rsclient
->ifindex
== from
->ifindex
))
1265 if ( IN6_IS_ADDR_LINKLOCAL (&attre
->mp_nexthop_local
) )
1266 attre
->mp_nexthop_len
=32;
1268 attre
->mp_nexthop_len
=16;
1271 /* Set link-local address for shared network peer. */
1272 else if (rsclient
->shared_network
1273 && IN6_IS_ADDR_LINKLOCAL (&rsclient
->nexthop
.v6_local
))
1275 memcpy (&attre
->mp_nexthop_local
, &rsclient
->nexthop
.v6_local
,
1277 attre
->mp_nexthop_len
= 32;
1281 attre
->mp_nexthop_len
= 16;
1285 #endif /* HAVE_IPV6 */
1288 /* If this is EBGP peer and remove-private-AS is set. */
1289 if (rsclient
->sort
== BGP_PEER_EBGP
1290 && peer_af_flag_check (rsclient
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
)
1291 && aspath_private_as_check (attr
->aspath
))
1292 attr
->aspath
= aspath_empty_get ();
1294 /* Route map & unsuppress-map apply. */
1295 if (ROUTE_MAP_OUT_NAME (filter
) || (ri
->extra
&& ri
->extra
->suppress
) )
1297 info
.peer
= rsclient
;
1300 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_OUT
);
1302 if (ri
->extra
&& ri
->extra
->suppress
)
1303 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
1305 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
1307 rsclient
->rmap_type
= 0;
1309 if (ret
== RMAP_DENYMATCH
)
1311 bgp_attr_flush (attr
);
1319 struct bgp_info_pair
1321 struct bgp_info
*old
;
1322 struct bgp_info
*new;
1326 bgp_best_selection (struct bgp
*bgp
, struct bgp_node
*rn
,
1327 struct bgp_maxpaths_cfg
*mpath_cfg
,
1328 struct bgp_info_pair
*result
)
1330 struct bgp_info
*new_select
;
1331 struct bgp_info
*old_select
;
1332 struct bgp_info
*ri
;
1333 struct bgp_info
*ri1
;
1334 struct bgp_info
*ri2
;
1335 struct bgp_info
*nextri
= NULL
;
1336 int paths_eq
, do_mpath
;
1337 struct list mp_list
;
1339 bgp_mp_list_init (&mp_list
);
1340 do_mpath
= (mpath_cfg
->maxpaths_ebgp
!= BGP_DEFAULT_MAXPATHS
||
1341 mpath_cfg
->maxpaths_ibgp
!= BGP_DEFAULT_MAXPATHS
);
1343 /* bgp deterministic-med */
1345 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1346 for (ri1
= rn
->info
; ri1
; ri1
= ri1
->next
)
1348 if (CHECK_FLAG (ri1
->flags
, BGP_INFO_DMED_CHECK
))
1350 if (BGP_INFO_HOLDDOWN (ri1
))
1355 bgp_mp_list_add (&mp_list
, ri1
);
1356 old_select
= CHECK_FLAG (ri1
->flags
, BGP_INFO_SELECTED
) ? ri1
: NULL
;
1358 for (ri2
= ri1
->next
; ri2
; ri2
= ri2
->next
)
1360 if (CHECK_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
))
1362 if (BGP_INFO_HOLDDOWN (ri2
))
1365 if (aspath_cmp_left (ri1
->attr
->aspath
, ri2
->attr
->aspath
)
1366 || aspath_cmp_left_confed (ri1
->attr
->aspath
,
1369 if (CHECK_FLAG (ri2
->flags
, BGP_INFO_SELECTED
))
1371 if (bgp_info_cmp (bgp
, ri2
, new_select
, &paths_eq
,
1374 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_DMED_SELECTED
);
1376 if (do_mpath
&& !paths_eq
)
1378 bgp_mp_list_clear (&mp_list
);
1379 bgp_mp_list_add (&mp_list
, ri2
);
1383 if (do_mpath
&& paths_eq
)
1384 bgp_mp_list_add (&mp_list
, ri2
);
1386 bgp_info_set_flag (rn
, ri2
, BGP_INFO_DMED_CHECK
);
1389 bgp_info_set_flag (rn
, new_select
, BGP_INFO_DMED_CHECK
);
1390 bgp_info_set_flag (rn
, new_select
, BGP_INFO_DMED_SELECTED
);
1392 bgp_info_mpath_update (rn
, new_select
, old_select
, &mp_list
, mpath_cfg
);
1393 bgp_mp_list_clear (&mp_list
);
1396 /* Check old selected route and new selected route. */
1399 for (ri
= rn
->info
; (ri
!= NULL
) && (nextri
= ri
->next
, 1); ri
= nextri
)
1401 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
1404 if (BGP_INFO_HOLDDOWN (ri
))
1406 /* reap REMOVED routes, if needs be
1407 * selected route must stay for a while longer though
1409 if (CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
)
1410 && (ri
!= old_select
))
1411 bgp_info_reap (rn
, ri
);
1416 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
)
1417 && (! CHECK_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
)))
1419 bgp_info_unset_flag (rn
, ri
, BGP_INFO_DMED_CHECK
);
1422 bgp_info_unset_flag (rn
, ri
, BGP_INFO_DMED_CHECK
);
1423 bgp_info_unset_flag (rn
, ri
, BGP_INFO_DMED_SELECTED
);
1425 if (bgp_info_cmp (bgp
, ri
, new_select
, &paths_eq
, mpath_cfg
))
1427 if (do_mpath
&& bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1428 bgp_mp_dmed_deselect (new_select
);
1432 if (do_mpath
&& !paths_eq
)
1434 bgp_mp_list_clear (&mp_list
);
1435 bgp_mp_list_add (&mp_list
, ri
);
1438 else if (do_mpath
&& bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1439 bgp_mp_dmed_deselect (ri
);
1441 if (do_mpath
&& paths_eq
)
1442 bgp_mp_list_add (&mp_list
, ri
);
1446 if (!bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1447 bgp_info_mpath_update (rn
, new_select
, old_select
, &mp_list
, mpath_cfg
);
1449 bgp_info_mpath_aggregate_update (new_select
, old_select
);
1450 bgp_mp_list_clear (&mp_list
);
1452 result
->old
= old_select
;
1453 result
->new = new_select
;
1459 bgp_process_announce_selected (struct peer
*peer
, struct bgp_info
*selected
,
1460 struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
1464 struct attr_extra extra
;
1468 /* Announce route to Established peer. */
1469 if (peer
->status
!= Established
)
1472 /* Address family configuration check. */
1473 if (! peer
->afc_nego
[afi
][safi
])
1476 /* First update is deferred until ORF or ROUTE-REFRESH is received */
1477 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
1478 PEER_STATUS_ORF_WAIT_REFRESH
))
1481 /* It's initialized in bgp_announce_[check|check_rsclient]() */
1482 attr
.extra
= &extra
;
1484 switch (bgp_node_table (rn
)->type
)
1486 case BGP_TABLE_MAIN
:
1487 /* Announcement to peer->conf. If the route is filtered,
1489 if (selected
&& bgp_announce_check (selected
, peer
, p
, &attr
, afi
, safi
))
1490 bgp_adj_out_set (rn
, peer
, p
, &attr
, afi
, safi
, selected
);
1492 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1494 case BGP_TABLE_RSCLIENT
:
1495 /* Announcement to peer->conf. If the route is filtered,
1498 bgp_announce_check_rsclient (selected
, peer
, p
, &attr
, afi
, safi
))
1499 bgp_adj_out_set (rn
, peer
, p
, &attr
, afi
, safi
, selected
);
1501 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1508 struct bgp_process_queue
1511 struct bgp_node
*rn
;
1516 static wq_item_status
1517 bgp_process_rsclient (struct work_queue
*wq
, void *data
)
1519 struct bgp_process_queue
*pq
= data
;
1520 struct bgp
*bgp
= pq
->bgp
;
1521 struct bgp_node
*rn
= pq
->rn
;
1522 afi_t afi
= pq
->afi
;
1523 safi_t safi
= pq
->safi
;
1524 struct bgp_info
*new_select
;
1525 struct bgp_info
*old_select
;
1526 struct bgp_info_pair old_and_new
;
1527 struct listnode
*node
, *nnode
;
1528 struct peer
*rsclient
= bgp_node_table (rn
)->owner
;
1530 /* Best path selection. */
1531 bgp_best_selection (bgp
, rn
, &bgp
->maxpaths
[afi
][safi
], &old_and_new
);
1532 new_select
= old_and_new
.new;
1533 old_select
= old_and_new
.old
;
1535 if (CHECK_FLAG (rsclient
->sflags
, PEER_STATUS_GROUP
))
1537 if (rsclient
->group
)
1538 for (ALL_LIST_ELEMENTS (rsclient
->group
->peer
, node
, nnode
, rsclient
))
1540 /* Nothing to do. */
1541 if (old_select
&& old_select
== new_select
)
1542 if (!CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1546 bgp_info_unset_flag (rn
, old_select
, BGP_INFO_SELECTED
);
1549 bgp_info_set_flag (rn
, new_select
, BGP_INFO_SELECTED
);
1550 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_ATTR_CHANGED
);
1551 UNSET_FLAG (new_select
->flags
, BGP_INFO_MULTIPATH_CHG
);
1554 bgp_process_announce_selected (rsclient
, new_select
, rn
,
1561 bgp_info_unset_flag (rn
, old_select
, BGP_INFO_SELECTED
);
1564 bgp_info_set_flag (rn
, new_select
, BGP_INFO_SELECTED
);
1565 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_ATTR_CHANGED
);
1566 UNSET_FLAG (new_select
->flags
, BGP_INFO_MULTIPATH_CHG
);
1568 bgp_process_announce_selected (rsclient
, new_select
, rn
, afi
, safi
);
1571 if (old_select
&& CHECK_FLAG (old_select
->flags
, BGP_INFO_REMOVED
))
1572 bgp_info_reap (rn
, old_select
);
1574 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1578 static wq_item_status
1579 bgp_process_main (struct work_queue
*wq
, void *data
)
1581 struct bgp_process_queue
*pq
= data
;
1582 struct bgp
*bgp
= pq
->bgp
;
1583 struct bgp_node
*rn
= pq
->rn
;
1584 afi_t afi
= pq
->afi
;
1585 safi_t safi
= pq
->safi
;
1586 struct prefix
*p
= &rn
->p
;
1587 struct bgp_info
*new_select
;
1588 struct bgp_info
*old_select
;
1589 struct bgp_info_pair old_and_new
;
1590 struct listnode
*node
, *nnode
;
1593 /* Best path selection. */
1594 bgp_best_selection (bgp
, rn
, &bgp
->maxpaths
[afi
][safi
], &old_and_new
);
1595 old_select
= old_and_new
.old
;
1596 new_select
= old_and_new
.new;
1598 /* Nothing to do. */
1599 if (old_select
&& old_select
== new_select
)
1601 if (! CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1603 if (CHECK_FLAG (old_select
->flags
, BGP_INFO_IGP_CHANGED
) ||
1604 CHECK_FLAG (old_select
->flags
, BGP_INFO_MULTIPATH_CHG
))
1605 bgp_zebra_announce (p
, old_select
, bgp
, safi
);
1607 UNSET_FLAG (old_select
->flags
, BGP_INFO_MULTIPATH_CHG
);
1608 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1614 bgp_info_unset_flag (rn
, old_select
, BGP_INFO_SELECTED
);
1617 bgp_info_set_flag (rn
, new_select
, BGP_INFO_SELECTED
);
1618 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_ATTR_CHANGED
);
1619 UNSET_FLAG (new_select
->flags
, BGP_INFO_MULTIPATH_CHG
);
1623 /* Check each BGP peer. */
1624 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1626 bgp_process_announce_selected (peer
, new_select
, rn
, afi
, safi
);
1630 if ((safi
== SAFI_UNICAST
|| safi
== SAFI_MULTICAST
) && (! bgp
->name
&&
1631 ! bgp_option_check (BGP_OPT_NO_FIB
)))
1634 && new_select
->type
== ZEBRA_ROUTE_BGP
1635 && new_select
->sub_type
== BGP_ROUTE_NORMAL
)
1636 bgp_zebra_announce (p
, new_select
, bgp
, safi
);
1639 /* Withdraw the route from the kernel. */
1641 && old_select
->type
== ZEBRA_ROUTE_BGP
1642 && old_select
->sub_type
== BGP_ROUTE_NORMAL
)
1643 bgp_zebra_withdraw (p
, old_select
, safi
);
1647 /* Reap old select bgp_info, it it has been removed */
1648 if (old_select
&& CHECK_FLAG (old_select
->flags
, BGP_INFO_REMOVED
))
1649 bgp_info_reap (rn
, old_select
);
1651 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1656 bgp_processq_del (struct work_queue
*wq
, void *data
)
1658 struct bgp_process_queue
*pq
= data
;
1659 struct bgp_table
*table
= bgp_node_table (pq
->rn
);
1661 bgp_unlock (pq
->bgp
);
1662 bgp_unlock_node (pq
->rn
);
1663 bgp_table_unlock (table
);
1664 XFREE (MTYPE_BGP_PROCESS_QUEUE
, pq
);
1668 bgp_process_queue_init (void)
1670 bm
->process_main_queue
1671 = work_queue_new (bm
->master
, "process_main_queue");
1672 bm
->process_rsclient_queue
1673 = work_queue_new (bm
->master
, "process_rsclient_queue");
1675 if ( !(bm
->process_main_queue
&& bm
->process_rsclient_queue
) )
1677 zlog_err ("%s: Failed to allocate work queue", __func__
);
1681 bm
->process_main_queue
->spec
.workfunc
= &bgp_process_main
;
1682 bm
->process_main_queue
->spec
.del_item_data
= &bgp_processq_del
;
1683 bm
->process_main_queue
->spec
.max_retries
= 0;
1684 bm
->process_main_queue
->spec
.hold
= 50;
1686 memcpy (bm
->process_rsclient_queue
, bm
->process_main_queue
,
1687 sizeof (struct work_queue
*));
1688 bm
->process_rsclient_queue
->spec
.workfunc
= &bgp_process_rsclient
;
1692 bgp_process (struct bgp
*bgp
, struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
1694 struct bgp_process_queue
*pqnode
;
1696 /* already scheduled for processing? */
1697 if (CHECK_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
))
1700 if ( (bm
->process_main_queue
== NULL
) ||
1701 (bm
->process_rsclient_queue
== NULL
) )
1702 bgp_process_queue_init ();
1704 pqnode
= XCALLOC (MTYPE_BGP_PROCESS_QUEUE
,
1705 sizeof (struct bgp_process_queue
));
1709 /* all unlocked in bgp_processq_del */
1710 bgp_table_lock (bgp_node_table (rn
));
1711 pqnode
->rn
= bgp_lock_node (rn
);
1715 pqnode
->safi
= safi
;
1717 switch (bgp_node_table (rn
)->type
)
1719 case BGP_TABLE_MAIN
:
1720 work_queue_add (bm
->process_main_queue
, pqnode
);
1722 case BGP_TABLE_RSCLIENT
:
1723 work_queue_add (bm
->process_rsclient_queue
, pqnode
);
1727 SET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1732 bgp_maximum_prefix_restart_timer (struct thread
*thread
)
1736 peer
= THREAD_ARG (thread
);
1737 peer
->t_pmax_restart
= NULL
;
1739 if (BGP_DEBUG (events
, EVENTS
))
1740 zlog_debug ("%s Maximum-prefix restart timer expired, restore peering",
1749 bgp_maximum_prefix_overflow (struct peer
*peer
, afi_t afi
,
1750 safi_t safi
, int always
)
1752 if (!CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
1755 if (peer
->pcount
[afi
][safi
] > peer
->pmax
[afi
][safi
])
1757 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
)
1761 zlog (peer
->log
, LOG_INFO
,
1762 "%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, "
1763 "limit %ld", afi_safi_print (afi
, safi
), peer
->host
,
1764 peer
->pcount
[afi
][safi
], peer
->pmax
[afi
][safi
]);
1765 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1767 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
1773 if (safi
== SAFI_MPLS_VPN
)
1774 safi
= SAFI_MPLS_LABELED_VPN
;
1776 ndata
[0] = (afi
>> 8);
1779 ndata
[3] = (peer
->pmax
[afi
][safi
] >> 24);
1780 ndata
[4] = (peer
->pmax
[afi
][safi
] >> 16);
1781 ndata
[5] = (peer
->pmax
[afi
][safi
] >> 8);
1782 ndata
[6] = (peer
->pmax
[afi
][safi
]);
1784 SET_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
);
1785 bgp_notify_send_with_data (peer
, BGP_NOTIFY_CEASE
,
1786 BGP_NOTIFY_CEASE_MAX_PREFIX
, ndata
, 7);
1789 /* restart timer start */
1790 if (peer
->pmax_restart
[afi
][safi
])
1792 peer
->v_pmax_restart
= peer
->pmax_restart
[afi
][safi
] * 60;
1794 if (BGP_DEBUG (events
, EVENTS
))
1795 zlog_debug ("%s Maximum-prefix restart timer started for %d secs",
1796 peer
->host
, peer
->v_pmax_restart
);
1798 BGP_TIMER_ON (peer
->t_pmax_restart
, bgp_maximum_prefix_restart_timer
,
1799 peer
->v_pmax_restart
);
1805 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1807 if (peer
->pcount
[afi
][safi
] > (peer
->pmax
[afi
][safi
] * peer
->pmax_threshold
[afi
][safi
] / 100))
1809 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
)
1813 zlog (peer
->log
, LOG_INFO
,
1814 "%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld",
1815 afi_safi_print (afi
, safi
), peer
->host
, peer
->pcount
[afi
][safi
],
1816 peer
->pmax
[afi
][safi
]);
1817 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
1820 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
1824 /* Unconditionally remove the route from the RIB, without taking
1825 * damping into consideration (eg, because the session went down)
1828 bgp_rib_remove (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
1829 afi_t afi
, safi_t safi
)
1831 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1833 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1834 bgp_info_delete (rn
, ri
); /* keep historical info */
1836 bgp_process (peer
->bgp
, rn
, afi
, safi
);
1840 bgp_rib_withdraw (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
1841 afi_t afi
, safi_t safi
)
1843 int status
= BGP_DAMP_NONE
;
1845 /* apply dampening, if result is suppressed, we'll be retaining
1846 * the bgp_info in the RIB for historical reference.
1848 if (CHECK_FLAG (peer
->bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1849 && peer
->sort
== BGP_PEER_EBGP
)
1850 if ( (status
= bgp_damp_withdraw (ri
, rn
, afi
, safi
, 0))
1851 == BGP_DAMP_SUPPRESSED
)
1853 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1857 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
1861 bgp_update_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
1862 struct attr
*attr
, struct peer
*peer
, struct prefix
*p
, int type
,
1863 int sub_type
, struct prefix_rd
*prd
, u_char
*tag
)
1865 struct bgp_node
*rn
;
1867 struct attr new_attr
;
1868 struct attr_extra new_extra
;
1869 struct attr
*attr_new
;
1870 struct attr
*attr_new2
;
1871 struct bgp_info
*ri
;
1872 struct bgp_info
*new;
1874 char buf
[SU_ADDRSTRLEN
];
1876 /* Do not insert announces from a rsclient into its own 'bgp_table'. */
1877 if (peer
== rsclient
)
1881 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1883 /* Check previously received route. */
1884 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1885 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1888 /* AS path loop check. */
1889 if (aspath_loop_check (attr
->aspath
, rsclient
->as
) > rsclient
->allowas_in
[afi
][safi
])
1891 reason
= "as-path contains our own AS;";
1895 /* Route reflector originator ID check. */
1896 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
1897 && IPV4_ADDR_SAME (&rsclient
->remote_id
, &attr
->extra
->originator_id
))
1899 reason
= "originator is us;";
1903 new_attr
.extra
= &new_extra
;
1904 bgp_attr_dup (&new_attr
, attr
);
1906 /* Apply export policy. */
1907 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
) &&
1908 bgp_export_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1910 reason
= "export-policy;";
1914 attr_new2
= bgp_attr_intern (&new_attr
);
1916 /* Apply import policy. */
1917 if (bgp_import_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1919 bgp_attr_unintern (&attr_new2
);
1921 reason
= "import-policy;";
1925 attr_new
= bgp_attr_intern (&new_attr
);
1926 bgp_attr_unintern (&attr_new2
);
1928 /* IPv4 unicast next hop check. */
1929 if ((afi
== AFI_IP
) && ((safi
== SAFI_UNICAST
) || safi
== SAFI_MULTICAST
))
1931 /* Next hop must not be 0.0.0.0 nor Class D/E address. */
1932 if (new_attr
.nexthop
.s_addr
== 0
1933 || IPV4_CLASS_DE (ntohl (new_attr
.nexthop
.s_addr
)))
1935 bgp_attr_unintern (&attr_new
);
1937 reason
= "martian next-hop;";
1942 /* If the update is implicit withdraw. */
1945 ri
->uptime
= bgp_clock ();
1947 /* Same attribute comes in. */
1948 if (!CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
)
1949 && attrhash_cmp (ri
->attr
, attr_new
))
1952 bgp_info_unset_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
1954 if (BGP_DEBUG (update
, UPDATE_IN
))
1955 zlog (peer
->log
, LOG_DEBUG
,
1956 "%s rcvd %s/%d for RS-client %s...duplicate ignored",
1958 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1959 p
->prefixlen
, rsclient
->host
);
1961 bgp_unlock_node (rn
);
1962 bgp_attr_unintern (&attr_new
);
1967 /* Withdraw/Announce before we fully processed the withdraw */
1968 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
1969 bgp_info_restore (rn
, ri
);
1971 /* Received Logging. */
1972 if (BGP_DEBUG (update
, UPDATE_IN
))
1973 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
1975 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1976 p
->prefixlen
, rsclient
->host
);
1978 /* The attribute is changed. */
1979 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
1981 /* Update to new attribute. */
1982 bgp_attr_unintern (&ri
->attr
);
1983 ri
->attr
= attr_new
;
1985 /* Update MPLS tag. */
1986 if (safi
== SAFI_MPLS_VPN
)
1987 memcpy ((bgp_info_extra_get (ri
))->tag
, tag
, 3);
1989 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
1991 /* Process change. */
1992 bgp_process (bgp
, rn
, afi
, safi
);
1993 bgp_unlock_node (rn
);
1998 /* Received Logging. */
1999 if (BGP_DEBUG (update
, UPDATE_IN
))
2001 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
2003 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2004 p
->prefixlen
, rsclient
->host
);
2007 /* Make new BGP info. */
2008 new = bgp_info_new ();
2010 new->sub_type
= sub_type
;
2012 new->attr
= attr_new
;
2013 new->uptime
= bgp_clock ();
2015 /* Update MPLS tag. */
2016 if (safi
== SAFI_MPLS_VPN
)
2017 memcpy ((bgp_info_extra_get (new))->tag
, tag
, 3);
2019 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2021 /* Register new BGP information. */
2022 bgp_info_add (rn
, new);
2024 /* route_node_get lock */
2025 bgp_unlock_node (rn
);
2027 /* Process change. */
2028 bgp_process (bgp
, rn
, afi
, safi
);
2034 /* This BGP update is filtered. Log the reason then update BGP entry. */
2035 if (BGP_DEBUG (update
, UPDATE_IN
))
2036 zlog (peer
->log
, LOG_DEBUG
,
2037 "%s rcvd UPDATE about %s/%d -- DENIED for RS-client %s due to: %s",
2039 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2040 p
->prefixlen
, rsclient
->host
, reason
);
2043 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2045 bgp_unlock_node (rn
);
2051 bgp_withdraw_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
2052 struct peer
*peer
, struct prefix
*p
, int type
, int sub_type
,
2053 struct prefix_rd
*prd
, u_char
*tag
)
2055 struct bgp_node
*rn
;
2056 struct bgp_info
*ri
;
2057 char buf
[SU_ADDRSTRLEN
];
2059 if (rsclient
== peer
)
2062 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2064 /* Lookup withdrawn route. */
2065 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2066 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2069 /* Withdraw specified route from routing table. */
2070 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2071 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
2072 else if (BGP_DEBUG (update
, UPDATE_IN
))
2073 zlog (peer
->log
, LOG_DEBUG
,
2074 "%s Can't find the route %s/%d", peer
->host
,
2075 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2078 /* Unlock bgp_node_get() lock. */
2079 bgp_unlock_node (rn
);
2083 bgp_update_main (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2084 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2085 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
2088 int aspath_loop_count
= 0;
2089 struct bgp_node
*rn
;
2091 struct attr new_attr
;
2092 struct attr_extra new_extra
;
2093 struct attr
*attr_new
;
2094 struct bgp_info
*ri
;
2095 struct bgp_info
*new;
2097 char buf
[SU_ADDRSTRLEN
];
2100 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2102 /* When peer's soft reconfiguration enabled. Record input packet in
2104 if (! soft_reconfig
&& CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2105 && peer
!= bgp
->peer_self
)
2106 bgp_adj_in_set (rn
, peer
, attr
);
2108 /* Check previously received route. */
2109 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2110 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2113 /* AS path local-as loop check. */
2114 if (peer
->change_local_as
)
2116 if (! CHECK_FLAG (peer
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
2117 aspath_loop_count
= 1;
2119 if (aspath_loop_check (attr
->aspath
, peer
->change_local_as
) > aspath_loop_count
)
2121 reason
= "as-path contains our own AS;";
2126 /* AS path loop check. */
2127 if (aspath_loop_check (attr
->aspath
, bgp
->as
) > peer
->allowas_in
[afi
][safi
]
2128 || (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
2129 && aspath_loop_check(attr
->aspath
, bgp
->confed_id
)
2130 > peer
->allowas_in
[afi
][safi
]))
2132 reason
= "as-path contains our own AS;";
2136 /* Route reflector originator ID check. */
2137 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
2138 && IPV4_ADDR_SAME (&bgp
->router_id
, &attr
->extra
->originator_id
))
2140 reason
= "originator is us;";
2144 /* Route reflector cluster ID check. */
2145 if (bgp_cluster_filter (peer
, attr
))
2147 reason
= "reflected from the same cluster;";
2151 /* Apply incoming filter. */
2152 if (bgp_input_filter (peer
, p
, attr
, afi
, safi
) == FILTER_DENY
)
2158 new_attr
.extra
= &new_extra
;
2159 bgp_attr_dup (&new_attr
, attr
);
2161 /* Apply incoming route-map.
2162 * NB: new_attr may now contain newly allocated values from route-map "set"
2163 * commands, so we need bgp_attr_flush in the error paths, until we intern
2164 * the attr (which takes over the memory references) */
2165 if (bgp_input_modifier (peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
2167 reason
= "route-map;";
2168 bgp_attr_flush (&new_attr
);
2172 /* IPv4 unicast next hop check. */
2173 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2175 /* If the peer is EBGP and nexthop is not on connected route,
2177 if (peer
->sort
== BGP_PEER_EBGP
&& peer
->ttl
== 1
2178 && ! bgp_nexthop_onlink (afi
, &new_attr
)
2179 && ! CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
))
2181 reason
= "non-connected next-hop;";
2182 bgp_attr_flush (&new_attr
);
2186 /* Next hop must not be 0.0.0.0 nor Class D/E address. Next hop
2187 must not be my own address. */
2188 if (new_attr
.nexthop
.s_addr
== 0
2189 || IPV4_CLASS_DE (ntohl (new_attr
.nexthop
.s_addr
))
2190 || bgp_nexthop_self (&new_attr
))
2192 reason
= "martian next-hop;";
2193 bgp_attr_flush (&new_attr
);
2198 attr_new
= bgp_attr_intern (&new_attr
);
2200 /* If the update is implicit withdraw. */
2203 ri
->uptime
= bgp_clock ();
2205 /* Same attribute comes in. */
2206 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
)
2207 && attrhash_cmp (ri
->attr
, attr_new
))
2209 bgp_info_unset_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
2211 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2212 && peer
->sort
== BGP_PEER_EBGP
2213 && CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2215 if (BGP_DEBUG (update
, UPDATE_IN
))
2216 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2218 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2221 if (bgp_damp_update (ri
, rn
, afi
, safi
) != BGP_DAMP_SUPPRESSED
)
2223 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2224 bgp_process (bgp
, rn
, afi
, safi
);
2227 else /* Duplicate - odd */
2229 if (BGP_DEBUG (update
, UPDATE_IN
))
2230 zlog (peer
->log
, LOG_DEBUG
,
2231 "%s rcvd %s/%d...duplicate ignored",
2233 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2236 /* graceful restart STALE flag unset. */
2237 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2239 bgp_info_unset_flag (rn
, ri
, BGP_INFO_STALE
);
2240 bgp_process (bgp
, rn
, afi
, safi
);
2244 bgp_unlock_node (rn
);
2245 bgp_attr_unintern (&attr_new
);
2250 /* Withdraw/Announce before we fully processed the withdraw */
2251 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
2253 if (BGP_DEBUG (update
, UPDATE_IN
))
2254 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d, flapped quicker than processing",
2256 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2258 bgp_info_restore (rn
, ri
);
2261 /* Received Logging. */
2262 if (BGP_DEBUG (update
, UPDATE_IN
))
2263 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2265 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2268 /* graceful restart STALE flag unset. */
2269 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2270 bgp_info_unset_flag (rn
, ri
, BGP_INFO_STALE
);
2272 /* The attribute is changed. */
2273 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
2275 /* implicit withdraw, decrement aggregate and pcount here.
2276 * only if update is accepted, they'll increment below.
2278 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
2280 /* Update bgp route dampening information. */
2281 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2282 && peer
->sort
== BGP_PEER_EBGP
)
2284 /* This is implicit withdraw so we should update dampening
2286 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2287 bgp_damp_withdraw (ri
, rn
, afi
, safi
, 1);
2290 /* Update to new attribute. */
2291 bgp_attr_unintern (&ri
->attr
);
2292 ri
->attr
= attr_new
;
2294 /* Update MPLS tag. */
2295 if (safi
== SAFI_MPLS_VPN
)
2296 memcpy ((bgp_info_extra_get (ri
))->tag
, tag
, 3);
2298 /* Update bgp route dampening information. */
2299 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2300 && peer
->sort
== BGP_PEER_EBGP
)
2302 /* Now we do normal update dampening. */
2303 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
2304 if (ret
== BGP_DAMP_SUPPRESSED
)
2306 bgp_unlock_node (rn
);
2311 /* Nexthop reachability check. */
2312 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
2313 && safi
== SAFI_UNICAST
2314 && (peer
->sort
== BGP_PEER_IBGP
2315 || peer
->sort
== BGP_PEER_CONFED
2316 || (peer
->sort
== BGP_PEER_EBGP
&& peer
->ttl
!= 1)
2317 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
2319 if (bgp_nexthop_lookup (afi
, peer
, ri
, NULL
, NULL
))
2320 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
2322 bgp_info_unset_flag (rn
, ri
, BGP_INFO_VALID
);
2325 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
2327 /* Process change. */
2328 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2330 bgp_process (bgp
, rn
, afi
, safi
);
2331 bgp_unlock_node (rn
);
2336 /* Received Logging. */
2337 if (BGP_DEBUG (update
, UPDATE_IN
))
2339 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2341 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2345 /* Make new BGP info. */
2346 new = bgp_info_new ();
2348 new->sub_type
= sub_type
;
2350 new->attr
= attr_new
;
2351 new->uptime
= bgp_clock ();
2353 /* Update MPLS tag. */
2354 if (safi
== SAFI_MPLS_VPN
)
2355 memcpy ((bgp_info_extra_get (new))->tag
, tag
, 3);
2357 /* Nexthop reachability check. */
2358 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
2359 && safi
== SAFI_UNICAST
2360 && (peer
->sort
== BGP_PEER_IBGP
2361 || peer
->sort
== BGP_PEER_CONFED
2362 || (peer
->sort
== BGP_PEER_EBGP
&& peer
->ttl
!= 1)
2363 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
2365 if (bgp_nexthop_lookup (afi
, peer
, new, NULL
, NULL
))
2366 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2368 bgp_info_unset_flag (rn
, new, BGP_INFO_VALID
);
2371 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2373 /* Increment prefix */
2374 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
2376 /* Register new BGP information. */
2377 bgp_info_add (rn
, new);
2379 /* route_node_get lock */
2380 bgp_unlock_node (rn
);
2382 /* If maximum prefix count is configured and current prefix
2384 if (bgp_maximum_prefix_overflow (peer
, afi
, safi
, 0))
2387 /* Process change. */
2388 bgp_process (bgp
, rn
, afi
, safi
);
2392 /* This BGP update is filtered. Log the reason then update BGP
2395 if (BGP_DEBUG (update
, UPDATE_IN
))
2396 zlog (peer
->log
, LOG_DEBUG
,
2397 "%s rcvd UPDATE about %s/%d -- DENIED due to: %s",
2399 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2400 p
->prefixlen
, reason
);
2403 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2405 bgp_unlock_node (rn
);
2411 bgp_update (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2412 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2413 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
2415 struct peer
*rsclient
;
2416 struct listnode
*node
, *nnode
;
2420 ret
= bgp_update_main (peer
, p
, attr
, afi
, safi
, type
, sub_type
, prd
, tag
,
2425 /* Process the update for each RS-client. */
2426 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2428 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2429 bgp_update_rsclient (rsclient
, afi
, safi
, attr
, peer
, p
, type
,
2430 sub_type
, prd
, tag
);
2437 bgp_withdraw (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2438 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2439 struct prefix_rd
*prd
, u_char
*tag
)
2442 char buf
[SU_ADDRSTRLEN
];
2443 struct bgp_node
*rn
;
2444 struct bgp_info
*ri
;
2445 struct peer
*rsclient
;
2446 struct listnode
*node
, *nnode
;
2450 /* Process the withdraw for each RS-client. */
2451 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2453 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2454 bgp_withdraw_rsclient (rsclient
, afi
, safi
, peer
, p
, type
, sub_type
, prd
, tag
);
2458 if (BGP_DEBUG (update
, UPDATE_IN
))
2459 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd UPDATE about %s/%d -- withdrawn",
2461 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2465 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2467 /* If peer is soft reconfiguration enabled. Record input packet for
2468 further calculation. */
2469 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2470 && peer
!= bgp
->peer_self
)
2471 bgp_adj_in_unset (rn
, peer
);
2473 /* Lookup withdrawn route. */
2474 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2475 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2478 /* Withdraw specified route from routing table. */
2479 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2480 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
2481 else if (BGP_DEBUG (update
, UPDATE_IN
))
2482 zlog (peer
->log
, LOG_DEBUG
,
2483 "%s Can't find the route %s/%d", peer
->host
,
2484 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2487 /* Unlock bgp_node_get() lock. */
2488 bgp_unlock_node (rn
);
2494 bgp_default_originate (struct peer
*peer
, afi_t afi
, safi_t safi
, int withdraw
)
2498 struct aspath
*aspath
;
2501 struct bgp_node
*rn
;
2502 struct bgp_info
*ri
;
2503 int ret
= RMAP_DENYMATCH
;
2505 if (!(afi
== AFI_IP
|| afi
== AFI_IP6
))
2509 from
= bgp
->peer_self
;
2511 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
2512 aspath
= attr
.aspath
;
2513 attr
.local_pref
= bgp
->default_local_pref
;
2514 memcpy (&attr
.nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
2517 str2prefix ("0.0.0.0/0", &p
);
2519 else if (afi
== AFI_IP6
)
2521 struct attr_extra
*ae
= attr
.extra
;
2523 str2prefix ("::/0", &p
);
2525 /* IPv6 global nexthop must be included. */
2526 memcpy (&ae
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
2528 ae
->mp_nexthop_len
= 16;
2530 /* If the peer is on shared nextwork and we have link-local
2532 if (peer
->shared_network
2533 && !IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
2535 memcpy (&ae
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
2537 ae
->mp_nexthop_len
= 32;
2540 #endif /* HAVE_IPV6 */
2542 if (peer
->default_rmap
[afi
][safi
].name
)
2544 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_DEFAULT
);
2545 for (rn
= bgp_table_top(bgp
->rib
[afi
][safi
]); rn
; rn
= bgp_route_next(rn
))
2547 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2549 struct attr dummy_attr
;
2550 struct attr_extra dummy_extra
;
2551 struct bgp_info info
;
2553 /* Provide dummy so the route-map can't modify the attributes */
2554 dummy_attr
.extra
= &dummy_extra
;
2555 bgp_attr_dup(&dummy_attr
, ri
->attr
);
2556 info
.peer
= ri
->peer
;
2557 info
.attr
= &dummy_attr
;
2559 ret
= route_map_apply(peer
->default_rmap
[afi
][safi
].map
, &rn
->p
,
2562 /* The route map might have set attributes. If we don't flush them
2563 * here, they will be leaked. */
2564 bgp_attr_flush(&dummy_attr
);
2565 if (ret
!= RMAP_DENYMATCH
)
2568 if (ret
!= RMAP_DENYMATCH
)
2571 bgp
->peer_self
->rmap_type
= 0;
2573 if (ret
== RMAP_DENYMATCH
)
2579 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
2580 bgp_default_withdraw_send (peer
, afi
, safi
);
2581 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2585 if (! CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
2587 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2588 bgp_default_update_send (peer
, &attr
, afi
, safi
, from
);
2592 bgp_attr_extra_free (&attr
);
2593 aspath_unintern (&aspath
);
2597 bgp_announce_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2598 struct bgp_table
*table
, int rsclient
)
2600 struct bgp_node
*rn
;
2601 struct bgp_info
*ri
;
2603 struct attr_extra extra
;
2606 table
= (rsclient
) ? peer
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2608 if (safi
!= SAFI_MPLS_VPN
)
2610 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
2612 bgp_default_originate (peer
, afi
, safi
, 0);
2616 /* Send the withdraw if it was postponed during read-only mode. */
2617 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
2618 bgp_default_originate (peer
, afi
, safi
, 1);
2622 /* It's initialized in bgp_announce_[check|check_rsclient]() */
2623 attr
.extra
= &extra
;
2625 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next(rn
))
2626 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2627 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
) && ri
->peer
!= peer
)
2630 (bgp_announce_check_rsclient (ri
, peer
, &rn
->p
, &attr
, afi
, safi
))
2631 : (bgp_announce_check (ri
, peer
, &rn
->p
, &attr
, afi
, safi
)))
2632 bgp_adj_out_set (rn
, peer
, &rn
->p
, &attr
, afi
, safi
, ri
);
2634 bgp_adj_out_unset (rn
, peer
, &rn
->p
, afi
, safi
);
2639 bgp_announce_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2641 struct bgp_node
*rn
;
2642 struct bgp_table
*table
;
2644 if (peer
->status
!= Established
)
2647 if (! peer
->afc_nego
[afi
][safi
])
2650 /* First update is deferred until ORF or ROUTE-REFRESH is received */
2651 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
2654 if (safi
!= SAFI_MPLS_VPN
)
2655 bgp_announce_table (peer
, afi
, safi
, NULL
, 0);
2657 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2658 rn
= bgp_route_next(rn
))
2659 if ((table
= (rn
->info
)) != NULL
)
2660 bgp_announce_table (peer
, afi
, safi
, table
, 0);
2662 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2663 bgp_announce_table (peer
, afi
, safi
, NULL
, 1);
2667 bgp_announce_route_all (struct peer
*peer
)
2672 if (bgp_update_delay_active(peer
->bgp
))
2675 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2676 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2677 bgp_announce_route (peer
, afi
, safi
);
2681 bgp_soft_reconfig_table_rsclient (struct peer
*rsclient
, afi_t afi
,
2682 safi_t safi
, struct bgp_table
*table
, struct prefix_rd
*prd
)
2684 struct bgp_node
*rn
;
2685 struct bgp_adj_in
*ain
;
2688 table
= rsclient
->bgp
->rib
[afi
][safi
];
2690 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2691 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2693 struct bgp_info
*ri
= rn
->info
;
2694 u_char
*tag
= (ri
&& ri
->extra
) ? ri
->extra
->tag
: NULL
;
2696 bgp_update_rsclient (rsclient
, afi
, safi
, ain
->attr
, ain
->peer
,
2697 &rn
->p
, ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, prd
, tag
);
2702 bgp_soft_reconfig_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
2704 struct bgp_table
*table
;
2705 struct bgp_node
*rn
;
2707 if (safi
!= SAFI_MPLS_VPN
)
2708 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, NULL
, NULL
);
2711 for (rn
= bgp_table_top (rsclient
->bgp
->rib
[afi
][safi
]); rn
;
2712 rn
= bgp_route_next (rn
))
2713 if ((table
= rn
->info
) != NULL
)
2715 struct prefix_rd prd
;
2716 prd
.family
= AF_UNSPEC
;
2718 memcpy(&prd
.val
, rn
->p
.u
.val
, 8);
2720 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, table
, &prd
);
2725 bgp_soft_reconfig_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2726 struct bgp_table
*table
, struct prefix_rd
*prd
)
2729 struct bgp_node
*rn
;
2730 struct bgp_adj_in
*ain
;
2733 table
= peer
->bgp
->rib
[afi
][safi
];
2735 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2736 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2738 if (ain
->peer
== peer
)
2740 struct bgp_info
*ri
= rn
->info
;
2741 u_char
*tag
= (ri
&& ri
->extra
) ? ri
->extra
->tag
: NULL
;
2743 ret
= bgp_update (peer
, &rn
->p
, ain
->attr
, afi
, safi
,
2744 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
,
2749 bgp_unlock_node (rn
);
2758 bgp_soft_reconfig_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2760 struct bgp_node
*rn
;
2761 struct bgp_table
*table
;
2763 if (peer
->status
!= Established
)
2766 if (safi
!= SAFI_MPLS_VPN
)
2767 bgp_soft_reconfig_table (peer
, afi
, safi
, NULL
, NULL
);
2769 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2770 rn
= bgp_route_next (rn
))
2771 if ((table
= rn
->info
) != NULL
)
2773 struct prefix_rd prd
;
2774 prd
.family
= AF_UNSPEC
;
2776 memcpy(&prd
.val
, rn
->p
.u
.val
, 8);
2778 bgp_soft_reconfig_table (peer
, afi
, safi
, table
, &prd
);
2783 struct bgp_clear_node_queue
2785 struct bgp_node
*rn
;
2786 enum bgp_clear_route_type purpose
;
2789 static wq_item_status
2790 bgp_clear_route_node (struct work_queue
*wq
, void *data
)
2792 struct bgp_clear_node_queue
*cnq
= data
;
2793 struct bgp_node
*rn
= cnq
->rn
;
2794 struct peer
*peer
= wq
->spec
.data
;
2795 struct bgp_info
*ri
;
2796 afi_t afi
= bgp_node_table (rn
)->afi
;
2797 safi_t safi
= bgp_node_table (rn
)->safi
;
2799 assert (rn
&& peer
);
2801 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2802 if (ri
->peer
== peer
|| cnq
->purpose
== BGP_CLEAR_ROUTE_MY_RSCLIENT
)
2804 /* graceful restart STALE flag set. */
2805 if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_NSF_WAIT
)
2806 && peer
->nsf
[afi
][safi
]
2807 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
)
2808 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
2809 bgp_info_set_flag (rn
, ri
, BGP_INFO_STALE
);
2811 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2818 bgp_clear_node_queue_del (struct work_queue
*wq
, void *data
)
2820 struct bgp_clear_node_queue
*cnq
= data
;
2821 struct bgp_node
*rn
= cnq
->rn
;
2822 struct bgp_table
*table
= bgp_node_table (rn
);
2824 bgp_unlock_node (rn
);
2825 bgp_table_unlock (table
);
2826 XFREE (MTYPE_BGP_CLEAR_NODE_QUEUE
, cnq
);
2830 bgp_clear_node_complete (struct work_queue
*wq
)
2832 struct peer
*peer
= wq
->spec
.data
;
2834 /* Tickle FSM to start moving again */
2835 BGP_EVENT_ADD (peer
, Clearing_Completed
);
2837 peer_unlock (peer
); /* bgp_clear_route */
2841 bgp_clear_node_queue_init (struct peer
*peer
)
2843 char wname
[sizeof("clear xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx")];
2845 snprintf (wname
, sizeof(wname
), "clear %s", peer
->host
);
2846 #undef CLEAR_QUEUE_NAME_LEN
2848 if ( (peer
->clear_node_queue
= work_queue_new (bm
->master
, wname
)) == NULL
)
2850 zlog_err ("%s: Failed to allocate work queue", __func__
);
2853 peer
->clear_node_queue
->spec
.hold
= 10;
2854 peer
->clear_node_queue
->spec
.workfunc
= &bgp_clear_route_node
;
2855 peer
->clear_node_queue
->spec
.del_item_data
= &bgp_clear_node_queue_del
;
2856 peer
->clear_node_queue
->spec
.completion_func
= &bgp_clear_node_complete
;
2857 peer
->clear_node_queue
->spec
.max_retries
= 0;
2859 /* we only 'lock' this peer reference when the queue is actually active */
2860 peer
->clear_node_queue
->spec
.data
= peer
;
2864 bgp_clear_route_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2865 struct bgp_table
*table
, struct peer
*rsclient
,
2866 enum bgp_clear_route_type purpose
)
2868 struct bgp_node
*rn
;
2872 table
= (rsclient
) ? rsclient
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2874 /* If still no table => afi/safi isn't configured at all or smth. */
2878 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2880 struct bgp_info
*ri
;
2881 struct bgp_adj_in
*ain
;
2882 struct bgp_adj_out
*aout
;
2884 /* XXX:TODO: This is suboptimal, every non-empty route_node is
2885 * queued for every clearing peer, regardless of whether it is
2886 * relevant to the peer at hand.
2888 * Overview: There are 3 different indices which need to be
2889 * scrubbed, potentially, when a peer is removed:
2891 * 1 peer's routes visible via the RIB (ie accepted routes)
2892 * 2 peer's routes visible by the (optional) peer's adj-in index
2893 * 3 other routes visible by the peer's adj-out index
2895 * 3 there is no hurry in scrubbing, once the struct peer is
2896 * removed from bgp->peer, we could just GC such deleted peer's
2897 * adj-outs at our leisure.
2899 * 1 and 2 must be 'scrubbed' in some way, at least made
2900 * invisible via RIB index before peer session is allowed to be
2901 * brought back up. So one needs to know when such a 'search' is
2906 * - there'd be a single global queue or a single RIB walker
2907 * - rather than tracking which route_nodes still need to be
2908 * examined on a peer basis, we'd track which peers still
2911 * Given that our per-peer prefix-counts now should be reliable,
2912 * this may actually be achievable. It doesn't seem to be a huge
2913 * problem at this time,
2915 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2916 if (ain
->peer
== peer
|| purpose
== BGP_CLEAR_ROUTE_MY_RSCLIENT
)
2918 bgp_adj_in_remove (rn
, ain
);
2919 bgp_unlock_node (rn
);
2922 for (aout
= rn
->adj_out
; aout
; aout
= aout
->next
)
2923 if (aout
->peer
== peer
|| purpose
== BGP_CLEAR_ROUTE_MY_RSCLIENT
)
2925 bgp_adj_out_remove (rn
, aout
, peer
, afi
, safi
);
2926 bgp_unlock_node (rn
);
2930 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2931 if (ri
->peer
== peer
|| purpose
== BGP_CLEAR_ROUTE_MY_RSCLIENT
)
2933 struct bgp_clear_node_queue
*cnq
;
2935 /* both unlocked in bgp_clear_node_queue_del */
2936 bgp_table_lock (bgp_node_table (rn
));
2938 cnq
= XCALLOC (MTYPE_BGP_CLEAR_NODE_QUEUE
,
2939 sizeof (struct bgp_clear_node_queue
));
2941 cnq
->purpose
= purpose
;
2942 work_queue_add (peer
->clear_node_queue
, cnq
);
2950 bgp_clear_route (struct peer
*peer
, afi_t afi
, safi_t safi
,
2951 enum bgp_clear_route_type purpose
)
2953 struct bgp_node
*rn
;
2954 struct bgp_table
*table
;
2955 struct peer
*rsclient
;
2956 struct listnode
*node
, *nnode
;
2958 if (peer
->clear_node_queue
== NULL
)
2959 bgp_clear_node_queue_init (peer
);
2961 /* bgp_fsm.c keeps sessions in state Clearing, not transitioning to
2962 * Idle until it receives a Clearing_Completed event. This protects
2963 * against peers which flap faster than we can we clear, which could
2966 * a) race with routes from the new session being installed before
2967 * clear_route_node visits the node (to delete the route of that
2969 * b) resource exhaustion, clear_route_node likely leads to an entry
2970 * on the process_main queue. Fast-flapping could cause that queue
2973 if (!peer
->clear_node_queue
->thread
)
2974 peer_lock (peer
); /* bgp_clear_node_complete */
2978 case BGP_CLEAR_ROUTE_NORMAL
:
2979 if (safi
!= SAFI_MPLS_VPN
)
2980 bgp_clear_route_table (peer
, afi
, safi
, NULL
, NULL
, purpose
);
2982 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2983 rn
= bgp_route_next (rn
))
2984 if ((table
= rn
->info
) != NULL
)
2985 bgp_clear_route_table (peer
, afi
, safi
, table
, NULL
, purpose
);
2987 for (ALL_LIST_ELEMENTS (peer
->bgp
->rsclient
, node
, nnode
, rsclient
))
2988 if (CHECK_FLAG(rsclient
->af_flags
[afi
][safi
],
2989 PEER_FLAG_RSERVER_CLIENT
))
2990 bgp_clear_route_table (peer
, afi
, safi
, NULL
, rsclient
, purpose
);
2993 case BGP_CLEAR_ROUTE_MY_RSCLIENT
:
2994 bgp_clear_route_table (peer
, afi
, safi
, NULL
, peer
, purpose
);
3002 /* If no routes were cleared, nothing was added to workqueue, the
3003 * completion function won't be run by workqueue code - call it here.
3004 * XXX: Actually, this assumption doesn't hold, see
3005 * bgp_clear_route_table(), we queue all non-empty nodes.
3007 * Additionally, there is a presumption in FSM that clearing is only
3008 * really needed if peer state is Established - peers in
3009 * pre-Established states shouldn't have any route-update state
3010 * associated with them (in or out).
3012 * We still can get here in pre-Established though, through
3013 * peer_delete -> bgp_fsm_change_status, so this is a useful sanity
3014 * check to ensure the assumption above holds.
3016 * At some future point, this check could be move to the top of the
3017 * function, and do a quick early-return when state is
3018 * pre-Established, avoiding above list and table scans. Once we're
3021 if (!peer
->clear_node_queue
->thread
)
3022 bgp_clear_node_complete (peer
->clear_node_queue
);
3026 bgp_clear_route_all (struct peer
*peer
)
3031 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
3032 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
3033 bgp_clear_route (peer
, afi
, safi
, BGP_CLEAR_ROUTE_NORMAL
);
3037 bgp_clear_adj_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
3039 struct bgp_table
*table
;
3040 struct bgp_node
*rn
;
3041 struct bgp_adj_in
*ain
;
3043 table
= peer
->bgp
->rib
[afi
][safi
];
3045 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3046 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
3047 if (ain
->peer
== peer
)
3049 bgp_adj_in_remove (rn
, ain
);
3050 bgp_unlock_node (rn
);
3056 bgp_clear_stale_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
3058 struct bgp_node
*rn
;
3059 struct bgp_info
*ri
;
3060 struct bgp_table
*table
;
3062 table
= peer
->bgp
->rib
[afi
][safi
];
3064 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3066 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3067 if (ri
->peer
== peer
)
3069 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
3070 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
3076 /* Delete all kernel routes. */
3078 bgp_cleanup_routes (void)
3081 struct listnode
*node
, *nnode
;
3082 struct bgp_node
*rn
;
3083 struct bgp_table
*table
;
3084 struct bgp_info
*ri
;
3086 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
3088 table
= bgp
->rib
[AFI_IP
][SAFI_UNICAST
];
3090 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3091 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3092 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
3093 && ri
->type
== ZEBRA_ROUTE_BGP
3094 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
3095 bgp_zebra_withdraw (&rn
->p
, ri
,SAFI_UNICAST
);
3097 table
= bgp
->rib
[AFI_IP6
][SAFI_UNICAST
];
3099 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3100 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3101 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
3102 && ri
->type
== ZEBRA_ROUTE_BGP
3103 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
3104 bgp_zebra_withdraw (&rn
->p
, ri
,SAFI_UNICAST
);
3112 bgp_zclient_reset ();
3113 access_list_reset ();
3114 prefix_list_reset ();
3117 /* Parse NLRI stream. Withdraw NLRI is recognized by NULL attr
3120 bgp_nlri_parse (struct peer
*peer
, struct attr
*attr
, struct bgp_nlri
*packet
)
3128 /* Check peer status. */
3129 if (peer
->status
!= Established
)
3133 lim
= pnt
+ packet
->length
;
3135 for (; pnt
< lim
; pnt
+= psize
)
3137 /* Clear prefix structure. */
3138 memset (&p
, 0, sizeof (struct prefix
));
3140 /* Fetch prefix length. */
3141 p
.prefixlen
= *pnt
++;
3142 p
.family
= afi2family (packet
->afi
);
3144 /* Already checked in nlri_sanity_check(). We do double check
3146 if ((packet
->afi
== AFI_IP
&& p
.prefixlen
> 32)
3147 || (packet
->afi
== AFI_IP6
&& p
.prefixlen
> 128))
3150 /* Packet size overflow check. */
3151 psize
= PSIZE (p
.prefixlen
);
3153 /* When packet overflow occur return immediately. */
3154 if (pnt
+ psize
> lim
)
3157 /* Fetch prefix from NLRI packet. */
3158 memcpy (&p
.u
.prefix
, pnt
, psize
);
3160 /* Check address. */
3161 if (packet
->afi
== AFI_IP
&& packet
->safi
== SAFI_UNICAST
)
3163 if (IN_CLASSD (ntohl (p
.u
.prefix4
.s_addr
)))
3166 * From draft-ietf-idr-bgp4-22, Section 6.3:
3167 * If a BGP router receives an UPDATE message with a
3168 * semantically incorrect NLRI field, in which a prefix is
3169 * semantically incorrect (eg. an unexpected multicast IP
3170 * address), it should ignore the prefix.
3172 zlog (peer
->log
, LOG_ERR
,
3173 "IPv4 unicast NLRI is multicast address %s",
3174 inet_ntoa (p
.u
.prefix4
));
3181 /* Check address. */
3182 if (packet
->afi
== AFI_IP6
&& packet
->safi
== SAFI_UNICAST
)
3184 if (IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3188 zlog (peer
->log
, LOG_WARNING
,
3189 "IPv6 link-local NLRI received %s ignore this NLRI",
3190 inet_ntop (AF_INET6
, &p
.u
.prefix6
, buf
, BUFSIZ
));
3195 #endif /* HAVE_IPV6 */
3197 /* Normal process. */
3199 ret
= bgp_update (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
3200 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
, 0);
3202 ret
= bgp_withdraw (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
3203 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
3205 /* Address family configuration mismatch or maximum-prefix count
3211 /* Packet length consistency check. */
3218 /* NLRI encode syntax check routine. */
3220 bgp_nlri_sanity_check (struct peer
*peer
, int afi
, u_char
*pnt
,
3229 /* RFC1771 6.3 The NLRI field in the UPDATE message is checked for
3230 syntactic validity. If the field is syntactically incorrect,
3231 then the Error Subcode is set to Invalid Network Field. */
3237 /* Prefix length check. */
3238 if ((afi
== AFI_IP
&& prefixlen
> 32)
3239 || (afi
== AFI_IP6
&& prefixlen
> 128))
3241 plog_err (peer
->log
,
3242 "%s [Error] Update packet error (wrong prefix length %d)",
3243 peer
->host
, prefixlen
);
3244 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3245 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3249 /* Packet size overflow check. */
3250 psize
= PSIZE (prefixlen
);
3252 if (pnt
+ psize
> end
)
3254 plog_err (peer
->log
,
3255 "%s [Error] Update packet error"
3256 " (prefix data overflow prefix size is %d)",
3258 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3259 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3266 /* Packet length consistency check. */
3269 plog_err (peer
->log
,
3270 "%s [Error] Update packet error"
3271 " (prefix length mismatch with total length)",
3273 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3274 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3280 static struct bgp_static
*
3281 bgp_static_new (void)
3283 return XCALLOC (MTYPE_BGP_STATIC
, sizeof (struct bgp_static
));
3287 bgp_static_free (struct bgp_static
*bgp_static
)
3289 if (bgp_static
->rmap
.name
)
3290 free (bgp_static
->rmap
.name
);
3291 XFREE (MTYPE_BGP_STATIC
, bgp_static
);
3295 bgp_static_withdraw_rsclient (struct bgp
*bgp
, struct peer
*rsclient
,
3296 struct prefix
*p
, afi_t afi
, safi_t safi
)
3298 struct bgp_node
*rn
;
3299 struct bgp_info
*ri
;
3301 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3303 /* Check selected route and self inserted route. */
3304 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3305 if (ri
->peer
== bgp
->peer_self
3306 && ri
->type
== ZEBRA_ROUTE_BGP
3307 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3310 /* Withdraw static BGP route from routing table. */
3313 bgp_info_delete (rn
, ri
);
3314 bgp_process (bgp
, rn
, afi
, safi
);
3317 /* Unlock bgp_node_lookup. */
3318 bgp_unlock_node (rn
);
3322 bgp_static_update_rsclient (struct peer
*rsclient
, struct prefix
*p
,
3323 struct bgp_static
*bgp_static
,
3324 afi_t afi
, safi_t safi
)
3326 struct bgp_node
*rn
;
3327 struct bgp_info
*ri
;
3328 struct bgp_info
*new;
3329 struct bgp_info info
;
3330 struct attr
*attr_new
;
3332 struct attr new_attr
;
3333 struct attr_extra new_extra
;
3336 char buf
[SU_ADDRSTRLEN
];
3338 bgp
= rsclient
->bgp
;
3340 assert (bgp_static
);
3344 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3346 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3348 attr
.nexthop
= bgp_static
->igpnexthop
;
3349 attr
.med
= bgp_static
->igpmetric
;
3350 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3352 if (bgp_static
->atomic
)
3353 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3355 /* Apply network route-map for export to this rsclient. */
3356 if (bgp_static
->rmap
.name
)
3358 struct attr attr_tmp
= attr
;
3359 info
.peer
= rsclient
;
3360 info
.attr
= &attr_tmp
;
3362 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
3363 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3365 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3367 rsclient
->rmap_type
= 0;
3369 if (ret
== RMAP_DENYMATCH
)
3371 /* Free uninterned attribute. */
3372 bgp_attr_flush (&attr_tmp
);
3374 /* Unintern original. */
3375 aspath_unintern (&attr
.aspath
);
3376 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
3377 bgp_attr_extra_free (&attr
);
3381 attr_new
= bgp_attr_intern (&attr_tmp
);
3384 attr_new
= bgp_attr_intern (&attr
);
3386 new_attr
.extra
= &new_extra
;
3387 bgp_attr_dup(&new_attr
, attr_new
);
3389 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3391 if (bgp_import_modifier (rsclient
, bgp
->peer_self
, p
, &new_attr
, afi
, safi
)
3394 /* This BGP update is filtered. Log the reason then update BGP entry. */
3395 if (BGP_DEBUG (update
, UPDATE_IN
))
3396 zlog (rsclient
->log
, LOG_DEBUG
,
3397 "Static UPDATE about %s/%d -- DENIED for RS-client %s due to: import-policy",
3398 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
3399 p
->prefixlen
, rsclient
->host
);
3401 bgp
->peer_self
->rmap_type
= 0;
3403 bgp_attr_unintern (&attr_new
);
3404 aspath_unintern (&attr
.aspath
);
3405 bgp_attr_extra_free (&attr
);
3407 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
3412 bgp
->peer_self
->rmap_type
= 0;
3414 bgp_attr_unintern (&attr_new
);
3415 attr_new
= bgp_attr_intern (&new_attr
);
3417 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3418 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3419 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3424 if (attrhash_cmp (ri
->attr
, attr_new
) &&
3425 !CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3427 bgp_unlock_node (rn
);
3428 bgp_attr_unintern (&attr_new
);
3429 aspath_unintern (&attr
.aspath
);
3430 bgp_attr_extra_free (&attr
);
3435 /* The attribute is changed. */
3436 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
3438 /* Rewrite BGP route information. */
3439 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3440 bgp_info_restore(rn
, ri
);
3441 bgp_attr_unintern (&ri
->attr
);
3442 ri
->attr
= attr_new
;
3443 ri
->uptime
= bgp_clock ();
3445 /* Process change. */
3446 bgp_process (bgp
, rn
, afi
, safi
);
3447 bgp_unlock_node (rn
);
3448 aspath_unintern (&attr
.aspath
);
3449 bgp_attr_extra_free (&attr
);
3454 /* Make new BGP info. */
3455 new = bgp_info_new ();
3456 new->type
= ZEBRA_ROUTE_BGP
;
3457 new->sub_type
= BGP_ROUTE_STATIC
;
3458 new->peer
= bgp
->peer_self
;
3459 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3460 new->attr
= attr_new
;
3461 new->uptime
= bgp_clock ();
3463 /* Register new BGP information. */
3464 bgp_info_add (rn
, new);
3466 /* route_node_get lock */
3467 bgp_unlock_node (rn
);
3469 /* Process change. */
3470 bgp_process (bgp
, rn
, afi
, safi
);
3472 /* Unintern original. */
3473 aspath_unintern (&attr
.aspath
);
3474 bgp_attr_extra_free (&attr
);
3478 bgp_static_update_main (struct bgp
*bgp
, struct prefix
*p
,
3479 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3481 struct bgp_node
*rn
;
3482 struct bgp_info
*ri
;
3483 struct bgp_info
*new;
3484 struct bgp_info info
;
3486 struct attr
*attr_new
;
3489 assert (bgp_static
);
3493 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3495 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3497 attr
.nexthop
= bgp_static
->igpnexthop
;
3498 attr
.med
= bgp_static
->igpmetric
;
3499 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3501 if (bgp_static
->atomic
)
3502 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3504 /* Apply route-map. */
3505 if (bgp_static
->rmap
.name
)
3507 struct attr attr_tmp
= attr
;
3508 info
.peer
= bgp
->peer_self
;
3509 info
.attr
= &attr_tmp
;
3511 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3513 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3515 bgp
->peer_self
->rmap_type
= 0;
3517 if (ret
== RMAP_DENYMATCH
)
3519 /* Free uninterned attribute. */
3520 bgp_attr_flush (&attr_tmp
);
3522 /* Unintern original. */
3523 aspath_unintern (&attr
.aspath
);
3524 bgp_attr_extra_free (&attr
);
3525 bgp_static_withdraw (bgp
, p
, afi
, safi
);
3528 attr_new
= bgp_attr_intern (&attr_tmp
);
3531 attr_new
= bgp_attr_intern (&attr
);
3533 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3534 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3535 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3540 if (attrhash_cmp (ri
->attr
, attr_new
) &&
3541 !CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3543 bgp_unlock_node (rn
);
3544 bgp_attr_unintern (&attr_new
);
3545 aspath_unintern (&attr
.aspath
);
3546 bgp_attr_extra_free (&attr
);
3551 /* The attribute is changed. */
3552 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
3554 /* Rewrite BGP route information. */
3555 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3556 bgp_info_restore(rn
, ri
);
3558 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3559 bgp_attr_unintern (&ri
->attr
);
3560 ri
->attr
= attr_new
;
3561 ri
->uptime
= bgp_clock ();
3563 /* Process change. */
3564 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
3565 bgp_process (bgp
, rn
, afi
, safi
);
3566 bgp_unlock_node (rn
);
3567 aspath_unintern (&attr
.aspath
);
3568 bgp_attr_extra_free (&attr
);
3573 /* Make new BGP info. */
3574 new = bgp_info_new ();
3575 new->type
= ZEBRA_ROUTE_BGP
;
3576 new->sub_type
= BGP_ROUTE_STATIC
;
3577 new->peer
= bgp
->peer_self
;
3578 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3579 new->attr
= attr_new
;
3580 new->uptime
= bgp_clock ();
3582 /* Aggregate address increment. */
3583 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3585 /* Register new BGP information. */
3586 bgp_info_add (rn
, new);
3588 /* route_node_get lock */
3589 bgp_unlock_node (rn
);
3591 /* Process change. */
3592 bgp_process (bgp
, rn
, afi
, safi
);
3594 /* Unintern original. */
3595 aspath_unintern (&attr
.aspath
);
3596 bgp_attr_extra_free (&attr
);
3600 bgp_static_update (struct bgp
*bgp
, struct prefix
*p
,
3601 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3603 struct peer
*rsclient
;
3604 struct listnode
*node
, *nnode
;
3606 bgp_static_update_main (bgp
, p
, bgp_static
, afi
, safi
);
3608 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
3610 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
3611 bgp_static_update_rsclient (rsclient
, p
, bgp_static
, afi
, safi
);
3616 bgp_static_update_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3617 safi_t safi
, struct prefix_rd
*prd
, u_char
*tag
)
3619 struct bgp_node
*rn
;
3620 struct bgp_info
*new;
3622 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3624 /* Make new BGP info. */
3625 new = bgp_info_new ();
3626 new->type
= ZEBRA_ROUTE_BGP
;
3627 new->sub_type
= BGP_ROUTE_STATIC
;
3628 new->peer
= bgp
->peer_self
;
3629 new->attr
= bgp_attr_default_intern (BGP_ORIGIN_IGP
);
3630 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3631 new->uptime
= bgp_clock ();
3632 new->extra
= bgp_info_extra_new();
3633 memcpy (new->extra
->tag
, tag
, 3);
3635 /* Aggregate address increment. */
3636 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3638 /* Register new BGP information. */
3639 bgp_info_add (rn
, new);
3641 /* route_node_get lock */
3642 bgp_unlock_node (rn
);
3644 /* Process change. */
3645 bgp_process (bgp
, rn
, afi
, safi
);
3649 bgp_static_withdraw (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3652 struct bgp_node
*rn
;
3653 struct bgp_info
*ri
;
3655 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3657 /* Check selected route and self inserted route. */
3658 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3659 if (ri
->peer
== bgp
->peer_self
3660 && ri
->type
== ZEBRA_ROUTE_BGP
3661 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3664 /* Withdraw static BGP route from routing table. */
3667 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3668 bgp_info_delete (rn
, ri
);
3669 bgp_process (bgp
, rn
, afi
, safi
);
3672 /* Unlock bgp_node_lookup. */
3673 bgp_unlock_node (rn
);
3677 bgp_check_local_routes_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
3679 struct bgp_static
*bgp_static
;
3681 struct bgp_node
*rn
;
3684 bgp
= rsclient
->bgp
;
3686 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3687 if ((bgp_static
= rn
->info
) != NULL
)
3691 bgp_static_update_rsclient (rsclient
, p
, bgp_static
,
3697 bgp_static_withdraw_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3698 safi_t safi
, struct prefix_rd
*prd
, u_char
*tag
)
3700 struct bgp_node
*rn
;
3701 struct bgp_info
*ri
;
3703 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3705 /* Check selected route and self inserted route. */
3706 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3707 if (ri
->peer
== bgp
->peer_self
3708 && ri
->type
== ZEBRA_ROUTE_BGP
3709 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3712 /* Withdraw static BGP route from routing table. */
3715 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3716 bgp_info_delete (rn
, ri
);
3717 bgp_process (bgp
, rn
, afi
, safi
);
3720 /* Unlock bgp_node_lookup. */
3721 bgp_unlock_node (rn
);
3724 /* Configure static BGP network. When user don't run zebra, static
3725 route should be installed as valid. */
3727 bgp_static_set (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3728 afi_t afi
, safi_t safi
, const char *rmap
, int backdoor
)
3732 struct bgp_static
*bgp_static
;
3733 struct bgp_node
*rn
;
3734 u_char need_update
= 0;
3736 /* Convert IP prefix string to struct prefix. */
3737 ret
= str2prefix (ip_str
, &p
);
3740 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3744 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3746 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3750 #endif /* HAVE_IPV6 */
3754 /* Set BGP static route configuration. */
3755 rn
= bgp_node_get (bgp
->route
[afi
][safi
], &p
);
3759 /* Configuration change. */
3760 bgp_static
= rn
->info
;
3762 /* Check previous routes are installed into BGP. */
3763 if (bgp_static
->valid
&& bgp_static
->backdoor
!= backdoor
)
3766 bgp_static
->backdoor
= backdoor
;
3770 if (bgp_static
->rmap
.name
)
3771 free (bgp_static
->rmap
.name
);
3772 bgp_static
->rmap
.name
= strdup (rmap
);
3773 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
3777 if (bgp_static
->rmap
.name
)
3778 free (bgp_static
->rmap
.name
);
3779 bgp_static
->rmap
.name
= NULL
;
3780 bgp_static
->rmap
.map
= NULL
;
3781 bgp_static
->valid
= 0;
3783 bgp_unlock_node (rn
);
3787 /* New configuration. */
3788 bgp_static
= bgp_static_new ();
3789 bgp_static
->backdoor
= backdoor
;
3790 bgp_static
->valid
= 0;
3791 bgp_static
->igpmetric
= 0;
3792 bgp_static
->igpnexthop
.s_addr
= 0;
3796 if (bgp_static
->rmap
.name
)
3797 free (bgp_static
->rmap
.name
);
3798 bgp_static
->rmap
.name
= strdup (rmap
);
3799 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
3801 rn
->info
= bgp_static
;
3804 /* If BGP scan is not enabled, we should install this route here. */
3805 if (! bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3807 bgp_static
->valid
= 1;
3810 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
3812 if (! bgp_static
->backdoor
)
3813 bgp_static_update (bgp
, &p
, bgp_static
, afi
, safi
);
3819 /* Configure static BGP network. */
3821 bgp_static_unset (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3822 afi_t afi
, safi_t safi
)
3826 struct bgp_static
*bgp_static
;
3827 struct bgp_node
*rn
;
3829 /* Convert IP prefix string to struct prefix. */
3830 ret
= str2prefix (ip_str
, &p
);
3833 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3837 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3839 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3843 #endif /* HAVE_IPV6 */
3847 rn
= bgp_node_lookup (bgp
->route
[afi
][safi
], &p
);
3850 vty_out (vty
, "%% Can't find specified static route configuration.%s",
3855 bgp_static
= rn
->info
;
3857 /* Update BGP RIB. */
3858 if (! bgp_static
->backdoor
)
3859 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
3861 /* Clear configuration. */
3862 bgp_static_free (bgp_static
);
3864 bgp_unlock_node (rn
);
3865 bgp_unlock_node (rn
);
3870 /* Called from bgp_delete(). Delete all static routes from the BGP
3873 bgp_static_delete (struct bgp
*bgp
)
3877 struct bgp_node
*rn
;
3878 struct bgp_node
*rm
;
3879 struct bgp_table
*table
;
3880 struct bgp_static
*bgp_static
;
3882 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
3883 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
3884 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3885 if (rn
->info
!= NULL
)
3887 if (safi
== SAFI_MPLS_VPN
)
3891 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
3893 bgp_static
= rn
->info
;
3894 bgp_static_withdraw_vpnv4 (bgp
, &rm
->p
,
3895 AFI_IP
, SAFI_MPLS_VPN
,
3896 (struct prefix_rd
*)&rn
->p
,
3898 bgp_static_free (bgp_static
);
3900 bgp_unlock_node (rn
);
3905 bgp_static
= rn
->info
;
3906 bgp_static_withdraw (bgp
, &rn
->p
, afi
, safi
);
3907 bgp_static_free (bgp_static
);
3909 bgp_unlock_node (rn
);
3915 bgp_static_set_vpnv4 (struct vty
*vty
, const char *ip_str
, const char *rd_str
,
3916 const char *tag_str
)
3920 struct prefix_rd prd
;
3922 struct bgp_node
*prn
;
3923 struct bgp_node
*rn
;
3924 struct bgp_table
*table
;
3925 struct bgp_static
*bgp_static
;
3930 ret
= str2prefix (ip_str
, &p
);
3933 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3938 ret
= str2prefix_rd (rd_str
, &prd
);
3941 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
3945 ret
= str2tag (tag_str
, tag
);
3948 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
3952 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
3953 (struct prefix
*)&prd
);
3954 if (prn
->info
== NULL
)
3955 prn
->info
= bgp_table_init (AFI_IP
, SAFI_MPLS_VPN
);
3957 bgp_unlock_node (prn
);
3960 rn
= bgp_node_get (table
, &p
);
3964 vty_out (vty
, "%% Same network configuration exists%s", VTY_NEWLINE
);
3965 bgp_unlock_node (rn
);
3969 /* New configuration. */
3970 bgp_static
= bgp_static_new ();
3971 bgp_static
->valid
= 1;
3972 memcpy (bgp_static
->tag
, tag
, 3);
3973 rn
->info
= bgp_static
;
3975 bgp_static_update_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
3981 /* Configure static BGP network. */
3983 bgp_static_unset_vpnv4 (struct vty
*vty
, const char *ip_str
,
3984 const char *rd_str
, const char *tag_str
)
3989 struct prefix_rd prd
;
3990 struct bgp_node
*prn
;
3991 struct bgp_node
*rn
;
3992 struct bgp_table
*table
;
3993 struct bgp_static
*bgp_static
;
3998 /* Convert IP prefix string to struct prefix. */
3999 ret
= str2prefix (ip_str
, &p
);
4002 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
4007 ret
= str2prefix_rd (rd_str
, &prd
);
4010 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
4014 ret
= str2tag (tag_str
, tag
);
4017 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
4021 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
4022 (struct prefix
*)&prd
);
4023 if (prn
->info
== NULL
)
4024 prn
->info
= bgp_table_init (AFI_IP
, SAFI_MPLS_VPN
);
4026 bgp_unlock_node (prn
);
4029 rn
= bgp_node_lookup (table
, &p
);
4033 bgp_static_withdraw_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
4035 bgp_static
= rn
->info
;
4036 bgp_static_free (bgp_static
);
4038 bgp_unlock_node (rn
);
4039 bgp_unlock_node (rn
);
4042 vty_out (vty
, "%% Can't find the route%s", VTY_NEWLINE
);
4049 "network A.B.C.D/M",
4050 "Specify a network to announce via BGP\n"
4051 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
4053 return bgp_static_set (vty
, vty
->index
, argv
[0],
4054 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
4057 DEFUN (bgp_network_route_map
,
4058 bgp_network_route_map_cmd
,
4059 "network A.B.C.D/M route-map WORD",
4060 "Specify a network to announce via BGP\n"
4061 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4062 "Route-map to modify the attributes\n"
4063 "Name of the route map\n")
4065 return bgp_static_set (vty
, vty
->index
, argv
[0],
4066 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
4069 DEFUN (bgp_network_backdoor
,
4070 bgp_network_backdoor_cmd
,
4071 "network A.B.C.D/M backdoor",
4072 "Specify a network to announce via BGP\n"
4073 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4074 "Specify a BGP backdoor route\n")
4076 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP
, SAFI_UNICAST
,
4080 DEFUN (bgp_network_mask
,
4081 bgp_network_mask_cmd
,
4082 "network A.B.C.D mask A.B.C.D",
4083 "Specify a network to announce via BGP\n"
4089 char prefix_str
[BUFSIZ
];
4091 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4094 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4098 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4099 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
4102 DEFUN (bgp_network_mask_route_map
,
4103 bgp_network_mask_route_map_cmd
,
4104 "network A.B.C.D mask A.B.C.D route-map WORD",
4105 "Specify a network to announce via BGP\n"
4109 "Route-map to modify the attributes\n"
4110 "Name of the route map\n")
4113 char prefix_str
[BUFSIZ
];
4115 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4118 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4122 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4123 AFI_IP
, bgp_node_safi (vty
), argv
[2], 0);
4126 DEFUN (bgp_network_mask_backdoor
,
4127 bgp_network_mask_backdoor_cmd
,
4128 "network A.B.C.D mask A.B.C.D backdoor",
4129 "Specify a network to announce via BGP\n"
4133 "Specify a BGP backdoor route\n")
4136 char prefix_str
[BUFSIZ
];
4138 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4141 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4145 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
,
4149 DEFUN (bgp_network_mask_natural
,
4150 bgp_network_mask_natural_cmd
,
4152 "Specify a network to announce via BGP\n"
4156 char prefix_str
[BUFSIZ
];
4158 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4161 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4165 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4166 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
4169 DEFUN (bgp_network_mask_natural_route_map
,
4170 bgp_network_mask_natural_route_map_cmd
,
4171 "network A.B.C.D route-map WORD",
4172 "Specify a network to announce via BGP\n"
4174 "Route-map to modify the attributes\n"
4175 "Name of the route map\n")
4178 char prefix_str
[BUFSIZ
];
4180 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4183 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4187 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4188 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
4191 DEFUN (bgp_network_mask_natural_backdoor
,
4192 bgp_network_mask_natural_backdoor_cmd
,
4193 "network A.B.C.D backdoor",
4194 "Specify a network to announce via BGP\n"
4196 "Specify a BGP backdoor route\n")
4199 char prefix_str
[BUFSIZ
];
4201 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4204 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4208 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
,
4212 DEFUN (no_bgp_network
,
4214 "no network A.B.C.D/M",
4216 "Specify a network to announce via BGP\n"
4217 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
4219 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP
,
4220 bgp_node_safi (vty
));
4223 ALIAS (no_bgp_network
,
4224 no_bgp_network_route_map_cmd
,
4225 "no network A.B.C.D/M route-map WORD",
4227 "Specify a network to announce via BGP\n"
4228 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4229 "Route-map to modify the attributes\n"
4230 "Name of the route map\n")
4232 ALIAS (no_bgp_network
,
4233 no_bgp_network_backdoor_cmd
,
4234 "no network A.B.C.D/M backdoor",
4236 "Specify a network to announce via BGP\n"
4237 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4238 "Specify a BGP backdoor route\n")
4240 DEFUN (no_bgp_network_mask
,
4241 no_bgp_network_mask_cmd
,
4242 "no network A.B.C.D mask A.B.C.D",
4244 "Specify a network to announce via BGP\n"
4250 char prefix_str
[BUFSIZ
];
4252 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4255 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4259 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
4260 bgp_node_safi (vty
));
4263 ALIAS (no_bgp_network_mask
,
4264 no_bgp_network_mask_route_map_cmd
,
4265 "no network A.B.C.D mask A.B.C.D route-map WORD",
4267 "Specify a network to announce via BGP\n"
4271 "Route-map to modify the attributes\n"
4272 "Name of the route map\n")
4274 ALIAS (no_bgp_network_mask
,
4275 no_bgp_network_mask_backdoor_cmd
,
4276 "no network A.B.C.D mask A.B.C.D backdoor",
4278 "Specify a network to announce via BGP\n"
4282 "Specify a BGP backdoor route\n")
4284 DEFUN (no_bgp_network_mask_natural
,
4285 no_bgp_network_mask_natural_cmd
,
4286 "no network A.B.C.D",
4288 "Specify a network to announce via BGP\n"
4292 char prefix_str
[BUFSIZ
];
4294 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4297 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4301 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
4302 bgp_node_safi (vty
));
4305 ALIAS (no_bgp_network_mask_natural
,
4306 no_bgp_network_mask_natural_route_map_cmd
,
4307 "no network A.B.C.D route-map WORD",
4309 "Specify a network to announce via BGP\n"
4311 "Route-map to modify the attributes\n"
4312 "Name of the route map\n")
4314 ALIAS (no_bgp_network_mask_natural
,
4315 no_bgp_network_mask_natural_backdoor_cmd
,
4316 "no network A.B.C.D backdoor",
4318 "Specify a network to announce via BGP\n"
4320 "Specify a BGP backdoor route\n")
4323 DEFUN (ipv6_bgp_network
,
4324 ipv6_bgp_network_cmd
,
4325 "network X:X::X:X/M",
4326 "Specify a network to announce via BGP\n"
4327 "IPv6 prefix <network>/<length>\n")
4329 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
, bgp_node_safi(vty
),
4333 DEFUN (ipv6_bgp_network_route_map
,
4334 ipv6_bgp_network_route_map_cmd
,
4335 "network X:X::X:X/M route-map WORD",
4336 "Specify a network to announce via BGP\n"
4337 "IPv6 prefix <network>/<length>\n"
4338 "Route-map to modify the attributes\n"
4339 "Name of the route map\n")
4341 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
,
4342 bgp_node_safi (vty
), argv
[1], 0);
4345 DEFUN (no_ipv6_bgp_network
,
4346 no_ipv6_bgp_network_cmd
,
4347 "no network X:X::X:X/M",
4349 "Specify a network to announce via BGP\n"
4350 "IPv6 prefix <network>/<length>\n")
4352 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP6
, bgp_node_safi(vty
));
4355 ALIAS (no_ipv6_bgp_network
,
4356 no_ipv6_bgp_network_route_map_cmd
,
4357 "no network X:X::X:X/M route-map WORD",
4359 "Specify a network to announce via BGP\n"
4360 "IPv6 prefix <network>/<length>\n"
4361 "Route-map to modify the attributes\n"
4362 "Name of the route map\n")
4364 ALIAS (ipv6_bgp_network
,
4365 old_ipv6_bgp_network_cmd
,
4366 "ipv6 bgp network X:X::X:X/M",
4369 "Specify a network to announce via BGP\n"
4370 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
4372 ALIAS (no_ipv6_bgp_network
,
4373 old_no_ipv6_bgp_network_cmd
,
4374 "no ipv6 bgp network X:X::X:X/M",
4378 "Specify a network to announce via BGP\n"
4379 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
4380 #endif /* HAVE_IPV6 */
4382 /* stubs for removed AS-Pathlimit commands, kept for config compatibility */
4383 ALIAS_DEPRECATED (bgp_network
,
4384 bgp_network_ttl_cmd
,
4385 "network A.B.C.D/M pathlimit <0-255>",
4386 "Specify a network to announce via BGP\n"
4387 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4388 "AS-Path hopcount limit attribute\n"
4389 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4390 ALIAS_DEPRECATED (bgp_network_backdoor
,
4391 bgp_network_backdoor_ttl_cmd
,
4392 "network A.B.C.D/M backdoor pathlimit <0-255>",
4393 "Specify a network to announce via BGP\n"
4394 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4395 "Specify a BGP backdoor route\n"
4396 "AS-Path hopcount limit attribute\n"
4397 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4398 ALIAS_DEPRECATED (bgp_network_mask
,
4399 bgp_network_mask_ttl_cmd
,
4400 "network A.B.C.D mask A.B.C.D pathlimit <0-255>",
4401 "Specify a network to announce via BGP\n"
4405 "AS-Path hopcount limit attribute\n"
4406 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4407 ALIAS_DEPRECATED (bgp_network_mask_backdoor
,
4408 bgp_network_mask_backdoor_ttl_cmd
,
4409 "network A.B.C.D mask A.B.C.D backdoor pathlimit <0-255>",
4410 "Specify a network to announce via BGP\n"
4414 "Specify a BGP backdoor route\n"
4415 "AS-Path hopcount limit attribute\n"
4416 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4417 ALIAS_DEPRECATED (bgp_network_mask_natural
,
4418 bgp_network_mask_natural_ttl_cmd
,
4419 "network A.B.C.D pathlimit <0-255>",
4420 "Specify a network to announce via BGP\n"
4422 "AS-Path hopcount limit attribute\n"
4423 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4424 ALIAS_DEPRECATED (bgp_network_mask_natural_backdoor
,
4425 bgp_network_mask_natural_backdoor_ttl_cmd
,
4426 "network A.B.C.D backdoor pathlimit <1-255>",
4427 "Specify a network to announce via BGP\n"
4429 "Specify a BGP backdoor route\n"
4430 "AS-Path hopcount limit attribute\n"
4431 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4432 ALIAS_DEPRECATED (no_bgp_network
,
4433 no_bgp_network_ttl_cmd
,
4434 "no network A.B.C.D/M pathlimit <0-255>",
4436 "Specify a network to announce via BGP\n"
4437 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4438 "AS-Path hopcount limit attribute\n"
4439 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4440 ALIAS_DEPRECATED (no_bgp_network
,
4441 no_bgp_network_backdoor_ttl_cmd
,
4442 "no network A.B.C.D/M backdoor pathlimit <0-255>",
4444 "Specify a network to announce via BGP\n"
4445 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4446 "Specify a BGP backdoor route\n"
4447 "AS-Path hopcount limit attribute\n"
4448 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4449 ALIAS_DEPRECATED (no_bgp_network
,
4450 no_bgp_network_mask_ttl_cmd
,
4451 "no network A.B.C.D mask A.B.C.D pathlimit <0-255>",
4453 "Specify a network to announce via BGP\n"
4457 "AS-Path hopcount limit attribute\n"
4458 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4459 ALIAS_DEPRECATED (no_bgp_network_mask
,
4460 no_bgp_network_mask_backdoor_ttl_cmd
,
4461 "no network A.B.C.D mask A.B.C.D backdoor pathlimit <0-255>",
4463 "Specify a network to announce via BGP\n"
4467 "Specify a BGP backdoor route\n"
4468 "AS-Path hopcount limit attribute\n"
4469 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4470 ALIAS_DEPRECATED (no_bgp_network_mask_natural
,
4471 no_bgp_network_mask_natural_ttl_cmd
,
4472 "no network A.B.C.D pathlimit <0-255>",
4474 "Specify a network to announce via BGP\n"
4476 "AS-Path hopcount limit attribute\n"
4477 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4478 ALIAS_DEPRECATED (no_bgp_network_mask_natural
,
4479 no_bgp_network_mask_natural_backdoor_ttl_cmd
,
4480 "no network A.B.C.D backdoor pathlimit <0-255>",
4482 "Specify a network to announce via BGP\n"
4484 "Specify a BGP backdoor route\n"
4485 "AS-Path hopcount limit attribute\n"
4486 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4488 ALIAS_DEPRECATED (ipv6_bgp_network
,
4489 ipv6_bgp_network_ttl_cmd
,
4490 "network X:X::X:X/M pathlimit <0-255>",
4491 "Specify a network to announce via BGP\n"
4492 "IPv6 prefix <network>/<length>\n"
4493 "AS-Path hopcount limit attribute\n"
4494 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4495 ALIAS_DEPRECATED (no_ipv6_bgp_network
,
4496 no_ipv6_bgp_network_ttl_cmd
,
4497 "no network X:X::X:X/M pathlimit <0-255>",
4499 "Specify a network to announce via BGP\n"
4500 "IPv6 prefix <network>/<length>\n"
4501 "AS-Path hopcount limit attribute\n"
4502 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4503 #endif /* HAVE_IPV6 */
4505 /* Aggreagete address:
4507 advertise-map Set condition to advertise attribute
4508 as-set Generate AS set path information
4509 attribute-map Set attributes of aggregate
4510 route-map Set parameters of aggregate
4511 summary-only Filter more specific routes from updates
4512 suppress-map Conditionally filter more specific routes from updates
4515 struct bgp_aggregate
4517 /* Summary-only flag. */
4518 u_char summary_only
;
4520 /* AS set generation. */
4523 /* Route-map for aggregated route. */
4524 struct route_map
*map
;
4526 /* Suppress-count. */
4527 unsigned long count
;
4529 /* SAFI configuration. */
4533 static struct bgp_aggregate
*
4534 bgp_aggregate_new (void)
4536 return XCALLOC (MTYPE_BGP_AGGREGATE
, sizeof (struct bgp_aggregate
));
4540 bgp_aggregate_free (struct bgp_aggregate
*aggregate
)
4542 XFREE (MTYPE_BGP_AGGREGATE
, aggregate
);
4546 bgp_aggregate_route (struct bgp
*bgp
, struct prefix
*p
, struct bgp_info
*rinew
,
4547 afi_t afi
, safi_t safi
, struct bgp_info
*del
,
4548 struct bgp_aggregate
*aggregate
)
4550 struct bgp_table
*table
;
4551 struct bgp_node
*top
;
4552 struct bgp_node
*rn
;
4554 struct aspath
*aspath
= NULL
;
4555 struct aspath
*asmerge
= NULL
;
4556 struct community
*community
= NULL
;
4557 struct community
*commerge
= NULL
;
4558 struct in_addr nexthop
;
4560 struct bgp_info
*ri
;
4561 struct bgp_info
*new;
4563 unsigned long match
= 0;
4565 /* Record adding route's nexthop and med. */
4568 nexthop
= rinew
->attr
->nexthop
;
4569 med
= rinew
->attr
->med
;
4572 /* ORIGIN attribute: If at least one route among routes that are
4573 aggregated has ORIGIN with the value INCOMPLETE, then the
4574 aggregated route must have the ORIGIN attribute with the value
4575 INCOMPLETE. Otherwise, if at least one route among routes that
4576 are aggregated has ORIGIN with the value EGP, then the aggregated
4577 route must have the origin attribute with the value EGP. In all
4578 other case the value of the ORIGIN attribute of the aggregated
4579 route is INTERNAL. */
4580 origin
= BGP_ORIGIN_IGP
;
4582 table
= bgp
->rib
[afi
][safi
];
4584 top
= bgp_node_get (table
, p
);
4585 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4586 if (rn
->p
.prefixlen
> p
->prefixlen
)
4590 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4592 if (BGP_INFO_HOLDDOWN (ri
))
4595 if (del
&& ri
== del
)
4598 if (! rinew
&& first
)
4600 nexthop
= ri
->attr
->nexthop
;
4601 med
= ri
->attr
->med
;
4605 #ifdef AGGREGATE_NEXTHOP_CHECK
4606 if (! IPV4_ADDR_SAME (&ri
->attr
->nexthop
, &nexthop
)
4607 || ri
->attr
->med
!= med
)
4610 aspath_free (aspath
);
4612 community_free (community
);
4613 bgp_unlock_node (rn
);
4614 bgp_unlock_node (top
);
4617 #endif /* AGGREGATE_NEXTHOP_CHECK */
4619 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4621 if (aggregate
->summary_only
)
4623 (bgp_info_extra_get (ri
))->suppress
++;
4624 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
4630 if (aggregate
->as_set
)
4632 if (origin
< ri
->attr
->origin
)
4633 origin
= ri
->attr
->origin
;
4637 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4638 aspath_free (aspath
);
4642 aspath
= aspath_dup (ri
->attr
->aspath
);
4644 if (ri
->attr
->community
)
4648 commerge
= community_merge (community
,
4649 ri
->attr
->community
);
4650 community
= community_uniq_sort (commerge
);
4651 community_free (commerge
);
4654 community
= community_dup (ri
->attr
->community
);
4660 bgp_process (bgp
, rn
, afi
, safi
);
4662 bgp_unlock_node (top
);
4668 if (aggregate
->summary_only
)
4669 (bgp_info_extra_get (rinew
))->suppress
++;
4671 if (aggregate
->as_set
)
4673 if (origin
< rinew
->attr
->origin
)
4674 origin
= rinew
->attr
->origin
;
4678 asmerge
= aspath_aggregate (aspath
, rinew
->attr
->aspath
);
4679 aspath_free (aspath
);
4683 aspath
= aspath_dup (rinew
->attr
->aspath
);
4685 if (rinew
->attr
->community
)
4689 commerge
= community_merge (community
,
4690 rinew
->attr
->community
);
4691 community
= community_uniq_sort (commerge
);
4692 community_free (commerge
);
4695 community
= community_dup (rinew
->attr
->community
);
4700 if (aggregate
->count
> 0)
4702 rn
= bgp_node_get (table
, p
);
4703 new = bgp_info_new ();
4704 new->type
= ZEBRA_ROUTE_BGP
;
4705 new->sub_type
= BGP_ROUTE_AGGREGATE
;
4706 new->peer
= bgp
->peer_self
;
4707 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4708 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
4709 new->uptime
= bgp_clock ();
4711 bgp_info_add (rn
, new);
4712 bgp_unlock_node (rn
);
4713 bgp_process (bgp
, rn
, afi
, safi
);
4718 aspath_free (aspath
);
4720 community_free (community
);
4724 void bgp_aggregate_delete (struct bgp
*, struct prefix
*, afi_t
, safi_t
,
4725 struct bgp_aggregate
*);
4728 bgp_aggregate_increment (struct bgp
*bgp
, struct prefix
*p
,
4729 struct bgp_info
*ri
, afi_t afi
, safi_t safi
)
4731 struct bgp_node
*child
;
4732 struct bgp_node
*rn
;
4733 struct bgp_aggregate
*aggregate
;
4734 struct bgp_table
*table
;
4736 /* MPLS-VPN aggregation is not yet supported. */
4737 if (safi
== SAFI_MPLS_VPN
)
4740 table
= bgp
->aggregate
[afi
][safi
];
4742 /* No aggregates configured. */
4743 if (bgp_table_top_nolock (table
) == NULL
)
4746 if (p
->prefixlen
== 0)
4749 if (BGP_INFO_HOLDDOWN (ri
))
4752 child
= bgp_node_get (table
, p
);
4754 /* Aggregate address configuration check. */
4755 for (rn
= child
; rn
; rn
= bgp_node_parent_nolock (rn
))
4756 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
4758 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
4759 bgp_aggregate_route (bgp
, &rn
->p
, ri
, afi
, safi
, NULL
, aggregate
);
4761 bgp_unlock_node (child
);
4765 bgp_aggregate_decrement (struct bgp
*bgp
, struct prefix
*p
,
4766 struct bgp_info
*del
, afi_t afi
, safi_t safi
)
4768 struct bgp_node
*child
;
4769 struct bgp_node
*rn
;
4770 struct bgp_aggregate
*aggregate
;
4771 struct bgp_table
*table
;
4773 /* MPLS-VPN aggregation is not yet supported. */
4774 if (safi
== SAFI_MPLS_VPN
)
4777 table
= bgp
->aggregate
[afi
][safi
];
4779 /* No aggregates configured. */
4780 if (bgp_table_top_nolock (table
) == NULL
)
4783 if (p
->prefixlen
== 0)
4786 child
= bgp_node_get (table
, p
);
4788 /* Aggregate address configuration check. */
4789 for (rn
= child
; rn
; rn
= bgp_node_parent_nolock (rn
))
4790 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
4792 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
4793 bgp_aggregate_route (bgp
, &rn
->p
, NULL
, afi
, safi
, del
, aggregate
);
4795 bgp_unlock_node (child
);
4799 bgp_aggregate_add (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
, safi_t safi
,
4800 struct bgp_aggregate
*aggregate
)
4802 struct bgp_table
*table
;
4803 struct bgp_node
*top
;
4804 struct bgp_node
*rn
;
4805 struct bgp_info
*new;
4806 struct bgp_info
*ri
;
4807 unsigned long match
;
4808 u_char origin
= BGP_ORIGIN_IGP
;
4809 struct aspath
*aspath
= NULL
;
4810 struct aspath
*asmerge
= NULL
;
4811 struct community
*community
= NULL
;
4812 struct community
*commerge
= NULL
;
4814 table
= bgp
->rib
[afi
][safi
];
4817 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
4819 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
4822 /* If routes exists below this node, generate aggregate routes. */
4823 top
= bgp_node_get (table
, p
);
4824 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4825 if (rn
->p
.prefixlen
> p
->prefixlen
)
4829 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4831 if (BGP_INFO_HOLDDOWN (ri
))
4834 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4836 /* summary-only aggregate route suppress aggregated
4837 route announcement. */
4838 if (aggregate
->summary_only
)
4840 (bgp_info_extra_get (ri
))->suppress
++;
4841 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
4844 /* as-set aggregate route generate origin, as path,
4845 community aggregation. */
4846 if (aggregate
->as_set
)
4848 if (origin
< ri
->attr
->origin
)
4849 origin
= ri
->attr
->origin
;
4853 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4854 aspath_free (aspath
);
4858 aspath
= aspath_dup (ri
->attr
->aspath
);
4860 if (ri
->attr
->community
)
4864 commerge
= community_merge (community
,
4865 ri
->attr
->community
);
4866 community
= community_uniq_sort (commerge
);
4867 community_free (commerge
);
4870 community
= community_dup (ri
->attr
->community
);
4877 /* If this node is suppressed, process the change. */
4879 bgp_process (bgp
, rn
, afi
, safi
);
4881 bgp_unlock_node (top
);
4883 /* Add aggregate route to BGP table. */
4884 if (aggregate
->count
)
4886 rn
= bgp_node_get (table
, p
);
4888 new = bgp_info_new ();
4889 new->type
= ZEBRA_ROUTE_BGP
;
4890 new->sub_type
= BGP_ROUTE_AGGREGATE
;
4891 new->peer
= bgp
->peer_self
;
4892 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4893 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
4894 new->uptime
= bgp_clock ();
4896 bgp_info_add (rn
, new);
4897 bgp_unlock_node (rn
);
4899 /* Process change. */
4900 bgp_process (bgp
, rn
, afi
, safi
);
4905 bgp_aggregate_delete (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
4906 safi_t safi
, struct bgp_aggregate
*aggregate
)
4908 struct bgp_table
*table
;
4909 struct bgp_node
*top
;
4910 struct bgp_node
*rn
;
4911 struct bgp_info
*ri
;
4912 unsigned long match
;
4914 table
= bgp
->rib
[afi
][safi
];
4916 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
4918 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
4921 /* If routes exists below this node, generate aggregate routes. */
4922 top
= bgp_node_get (table
, p
);
4923 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4924 if (rn
->p
.prefixlen
> p
->prefixlen
)
4928 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4930 if (BGP_INFO_HOLDDOWN (ri
))
4933 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4935 if (aggregate
->summary_only
&& ri
->extra
)
4937 ri
->extra
->suppress
--;
4939 if (ri
->extra
->suppress
== 0)
4941 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
4949 /* If this node was suppressed, process the change. */
4951 bgp_process (bgp
, rn
, afi
, safi
);
4953 bgp_unlock_node (top
);
4955 /* Delete aggregate route from BGP table. */
4956 rn
= bgp_node_get (table
, p
);
4958 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4959 if (ri
->peer
== bgp
->peer_self
4960 && ri
->type
== ZEBRA_ROUTE_BGP
4961 && ri
->sub_type
== BGP_ROUTE_AGGREGATE
)
4964 /* Withdraw static BGP route from routing table. */
4967 bgp_info_delete (rn
, ri
);
4968 bgp_process (bgp
, rn
, afi
, safi
);
4971 /* Unlock bgp_node_lookup. */
4972 bgp_unlock_node (rn
);
4975 /* Aggregate route attribute. */
4976 #define AGGREGATE_SUMMARY_ONLY 1
4977 #define AGGREGATE_AS_SET 1
4980 bgp_aggregate_unset (struct vty
*vty
, const char *prefix_str
,
4981 afi_t afi
, safi_t safi
)
4985 struct bgp_node
*rn
;
4987 struct bgp_aggregate
*aggregate
;
4989 /* Convert string to prefix structure. */
4990 ret
= str2prefix (prefix_str
, &p
);
4993 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
4998 /* Get BGP structure. */
5001 /* Old configuration check. */
5002 rn
= bgp_node_lookup (bgp
->aggregate
[afi
][safi
], &p
);
5005 vty_out (vty
, "%% There is no aggregate-address configuration.%s",
5010 aggregate
= rn
->info
;
5011 if (aggregate
->safi
& SAFI_UNICAST
)
5012 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
5013 if (aggregate
->safi
& SAFI_MULTICAST
)
5014 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
5016 /* Unlock aggregate address configuration. */
5018 bgp_aggregate_free (aggregate
);
5019 bgp_unlock_node (rn
);
5020 bgp_unlock_node (rn
);
5026 bgp_aggregate_set (struct vty
*vty
, const char *prefix_str
,
5027 afi_t afi
, safi_t safi
,
5028 u_char summary_only
, u_char as_set
)
5032 struct bgp_node
*rn
;
5034 struct bgp_aggregate
*aggregate
;
5036 /* Convert string to prefix structure. */
5037 ret
= str2prefix (prefix_str
, &p
);
5040 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
5045 /* Get BGP structure. */
5048 /* Old configuration check. */
5049 rn
= bgp_node_get (bgp
->aggregate
[afi
][safi
], &p
);
5053 vty_out (vty
, "There is already same aggregate network.%s", VTY_NEWLINE
);
5054 /* try to remove the old entry */
5055 ret
= bgp_aggregate_unset (vty
, prefix_str
, afi
, safi
);
5058 vty_out (vty
, "Error deleting aggregate.%s", VTY_NEWLINE
);
5059 bgp_unlock_node (rn
);
5064 /* Make aggregate address structure. */
5065 aggregate
= bgp_aggregate_new ();
5066 aggregate
->summary_only
= summary_only
;
5067 aggregate
->as_set
= as_set
;
5068 aggregate
->safi
= safi
;
5069 rn
->info
= aggregate
;
5071 /* Aggregate address insert into BGP routing table. */
5072 if (safi
& SAFI_UNICAST
)
5073 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
5074 if (safi
& SAFI_MULTICAST
)
5075 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
5080 DEFUN (aggregate_address
,
5081 aggregate_address_cmd
,
5082 "aggregate-address A.B.C.D/M",
5083 "Configure BGP aggregate entries\n"
5084 "Aggregate prefix\n")
5086 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
), 0, 0);
5089 DEFUN (aggregate_address_mask
,
5090 aggregate_address_mask_cmd
,
5091 "aggregate-address A.B.C.D A.B.C.D",
5092 "Configure BGP aggregate entries\n"
5093 "Aggregate address\n"
5097 char prefix_str
[BUFSIZ
];
5099 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5103 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5107 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5111 DEFUN (aggregate_address_summary_only
,
5112 aggregate_address_summary_only_cmd
,
5113 "aggregate-address A.B.C.D/M summary-only",
5114 "Configure BGP aggregate entries\n"
5115 "Aggregate prefix\n"
5116 "Filter more specific routes from updates\n")
5118 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5119 AGGREGATE_SUMMARY_ONLY
, 0);
5122 DEFUN (aggregate_address_mask_summary_only
,
5123 aggregate_address_mask_summary_only_cmd
,
5124 "aggregate-address A.B.C.D A.B.C.D summary-only",
5125 "Configure BGP aggregate entries\n"
5126 "Aggregate address\n"
5128 "Filter more specific routes from updates\n")
5131 char prefix_str
[BUFSIZ
];
5133 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5137 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5141 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5142 AGGREGATE_SUMMARY_ONLY
, 0);
5145 DEFUN (aggregate_address_as_set
,
5146 aggregate_address_as_set_cmd
,
5147 "aggregate-address A.B.C.D/M as-set",
5148 "Configure BGP aggregate entries\n"
5149 "Aggregate prefix\n"
5150 "Generate AS set path information\n")
5152 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5153 0, AGGREGATE_AS_SET
);
5156 DEFUN (aggregate_address_mask_as_set
,
5157 aggregate_address_mask_as_set_cmd
,
5158 "aggregate-address A.B.C.D A.B.C.D as-set",
5159 "Configure BGP aggregate entries\n"
5160 "Aggregate address\n"
5162 "Generate AS set path information\n")
5165 char prefix_str
[BUFSIZ
];
5167 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5171 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5175 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5176 0, AGGREGATE_AS_SET
);
5180 DEFUN (aggregate_address_as_set_summary
,
5181 aggregate_address_as_set_summary_cmd
,
5182 "aggregate-address A.B.C.D/M as-set summary-only",
5183 "Configure BGP aggregate entries\n"
5184 "Aggregate prefix\n"
5185 "Generate AS set path information\n"
5186 "Filter more specific routes from updates\n")
5188 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5189 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
5192 ALIAS (aggregate_address_as_set_summary
,
5193 aggregate_address_summary_as_set_cmd
,
5194 "aggregate-address A.B.C.D/M summary-only as-set",
5195 "Configure BGP aggregate entries\n"
5196 "Aggregate prefix\n"
5197 "Filter more specific routes from updates\n"
5198 "Generate AS set path information\n")
5200 DEFUN (aggregate_address_mask_as_set_summary
,
5201 aggregate_address_mask_as_set_summary_cmd
,
5202 "aggregate-address A.B.C.D A.B.C.D as-set summary-only",
5203 "Configure BGP aggregate entries\n"
5204 "Aggregate address\n"
5206 "Generate AS set path information\n"
5207 "Filter more specific routes from updates\n")
5210 char prefix_str
[BUFSIZ
];
5212 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5216 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5220 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5221 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
5224 ALIAS (aggregate_address_mask_as_set_summary
,
5225 aggregate_address_mask_summary_as_set_cmd
,
5226 "aggregate-address A.B.C.D A.B.C.D summary-only as-set",
5227 "Configure BGP aggregate entries\n"
5228 "Aggregate address\n"
5230 "Filter more specific routes from updates\n"
5231 "Generate AS set path information\n")
5233 DEFUN (no_aggregate_address
,
5234 no_aggregate_address_cmd
,
5235 "no aggregate-address A.B.C.D/M",
5237 "Configure BGP aggregate entries\n"
5238 "Aggregate prefix\n")
5240 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
));
5243 ALIAS (no_aggregate_address
,
5244 no_aggregate_address_summary_only_cmd
,
5245 "no aggregate-address A.B.C.D/M summary-only",
5247 "Configure BGP aggregate entries\n"
5248 "Aggregate prefix\n"
5249 "Filter more specific routes from updates\n")
5251 ALIAS (no_aggregate_address
,
5252 no_aggregate_address_as_set_cmd
,
5253 "no aggregate-address A.B.C.D/M as-set",
5255 "Configure BGP aggregate entries\n"
5256 "Aggregate prefix\n"
5257 "Generate AS set path information\n")
5259 ALIAS (no_aggregate_address
,
5260 no_aggregate_address_as_set_summary_cmd
,
5261 "no aggregate-address A.B.C.D/M as-set summary-only",
5263 "Configure BGP aggregate entries\n"
5264 "Aggregate prefix\n"
5265 "Generate AS set path information\n"
5266 "Filter more specific routes from updates\n")
5268 ALIAS (no_aggregate_address
,
5269 no_aggregate_address_summary_as_set_cmd
,
5270 "no aggregate-address A.B.C.D/M summary-only as-set",
5272 "Configure BGP aggregate entries\n"
5273 "Aggregate prefix\n"
5274 "Filter more specific routes from updates\n"
5275 "Generate AS set path information\n")
5277 DEFUN (no_aggregate_address_mask
,
5278 no_aggregate_address_mask_cmd
,
5279 "no aggregate-address A.B.C.D A.B.C.D",
5281 "Configure BGP aggregate entries\n"
5282 "Aggregate address\n"
5286 char prefix_str
[BUFSIZ
];
5288 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5292 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5296 return bgp_aggregate_unset (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
));
5299 ALIAS (no_aggregate_address_mask
,
5300 no_aggregate_address_mask_summary_only_cmd
,
5301 "no aggregate-address A.B.C.D A.B.C.D summary-only",
5303 "Configure BGP aggregate entries\n"
5304 "Aggregate address\n"
5306 "Filter more specific routes from updates\n")
5308 ALIAS (no_aggregate_address_mask
,
5309 no_aggregate_address_mask_as_set_cmd
,
5310 "no aggregate-address A.B.C.D A.B.C.D as-set",
5312 "Configure BGP aggregate entries\n"
5313 "Aggregate address\n"
5315 "Generate AS set path information\n")
5317 ALIAS (no_aggregate_address_mask
,
5318 no_aggregate_address_mask_as_set_summary_cmd
,
5319 "no aggregate-address A.B.C.D A.B.C.D as-set summary-only",
5321 "Configure BGP aggregate entries\n"
5322 "Aggregate address\n"
5324 "Generate AS set path information\n"
5325 "Filter more specific routes from updates\n")
5327 ALIAS (no_aggregate_address_mask
,
5328 no_aggregate_address_mask_summary_as_set_cmd
,
5329 "no aggregate-address A.B.C.D A.B.C.D summary-only as-set",
5331 "Configure BGP aggregate entries\n"
5332 "Aggregate address\n"
5334 "Filter more specific routes from updates\n"
5335 "Generate AS set path information\n")
5338 DEFUN (ipv6_aggregate_address
,
5339 ipv6_aggregate_address_cmd
,
5340 "aggregate-address X:X::X:X/M",
5341 "Configure BGP aggregate entries\n"
5342 "Aggregate prefix\n")
5344 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0, 0);
5347 DEFUN (ipv6_aggregate_address_summary_only
,
5348 ipv6_aggregate_address_summary_only_cmd
,
5349 "aggregate-address X:X::X:X/M summary-only",
5350 "Configure BGP aggregate entries\n"
5351 "Aggregate prefix\n"
5352 "Filter more specific routes from updates\n")
5354 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5355 AGGREGATE_SUMMARY_ONLY
, 0);
5358 DEFUN (no_ipv6_aggregate_address
,
5359 no_ipv6_aggregate_address_cmd
,
5360 "no aggregate-address X:X::X:X/M",
5362 "Configure BGP aggregate entries\n"
5363 "Aggregate prefix\n")
5365 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
5368 DEFUN (no_ipv6_aggregate_address_summary_only
,
5369 no_ipv6_aggregate_address_summary_only_cmd
,
5370 "no aggregate-address X:X::X:X/M summary-only",
5372 "Configure BGP aggregate entries\n"
5373 "Aggregate prefix\n"
5374 "Filter more specific routes from updates\n")
5376 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
5379 ALIAS (ipv6_aggregate_address
,
5380 old_ipv6_aggregate_address_cmd
,
5381 "ipv6 bgp aggregate-address X:X::X:X/M",
5384 "Configure BGP aggregate entries\n"
5385 "Aggregate prefix\n")
5387 ALIAS (ipv6_aggregate_address_summary_only
,
5388 old_ipv6_aggregate_address_summary_only_cmd
,
5389 "ipv6 bgp aggregate-address X:X::X:X/M summary-only",
5392 "Configure BGP aggregate entries\n"
5393 "Aggregate prefix\n"
5394 "Filter more specific routes from updates\n")
5396 ALIAS (no_ipv6_aggregate_address
,
5397 old_no_ipv6_aggregate_address_cmd
,
5398 "no ipv6 bgp aggregate-address X:X::X:X/M",
5402 "Configure BGP aggregate entries\n"
5403 "Aggregate prefix\n")
5405 ALIAS (no_ipv6_aggregate_address_summary_only
,
5406 old_no_ipv6_aggregate_address_summary_only_cmd
,
5407 "no ipv6 bgp aggregate-address X:X::X:X/M summary-only",
5411 "Configure BGP aggregate entries\n"
5412 "Aggregate prefix\n"
5413 "Filter more specific routes from updates\n")
5414 #endif /* HAVE_IPV6 */
5416 /* Redistribute route treatment. */
5418 bgp_redistribute_add (struct prefix
*p
, const struct in_addr
*nexthop
,
5419 const struct in6_addr
*nexthop6
,
5420 u_int32_t metric
, u_char type
)
5423 struct listnode
*node
, *nnode
;
5424 struct bgp_info
*new;
5425 struct bgp_info
*bi
;
5426 struct bgp_info info
;
5427 struct bgp_node
*bn
;
5429 struct attr
*new_attr
;
5433 /* Make default attribute. */
5434 bgp_attr_default_set (&attr
, BGP_ORIGIN_INCOMPLETE
);
5436 attr
.nexthop
= *nexthop
;
5441 struct attr_extra
*extra
= bgp_attr_extra_get(&attr
);
5442 extra
->mp_nexthop_global
= *nexthop6
;
5443 extra
->mp_nexthop_len
= 16;
5448 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
5450 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
5452 afi
= family2afi (p
->family
);
5454 if (bgp
->redist
[afi
][type
])
5456 struct attr attr_new
;
5457 struct attr_extra extra_new
;
5459 /* Copy attribute for modification. */
5460 attr_new
.extra
= &extra_new
;
5461 bgp_attr_dup (&attr_new
, &attr
);
5463 if (bgp
->redist_metric_flag
[afi
][type
])
5464 attr_new
.med
= bgp
->redist_metric
[afi
][type
];
5466 /* Apply route-map. */
5467 if (bgp
->rmap
[afi
][type
].map
)
5469 info
.peer
= bgp
->peer_self
;
5470 info
.attr
= &attr_new
;
5472 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_REDISTRIBUTE
);
5474 ret
= route_map_apply (bgp
->rmap
[afi
][type
].map
, p
, RMAP_BGP
,
5477 bgp
->peer_self
->rmap_type
= 0;
5479 if (ret
== RMAP_DENYMATCH
)
5481 /* Free uninterned attribute. */
5482 bgp_attr_flush (&attr_new
);
5484 /* Unintern original. */
5485 aspath_unintern (&attr
.aspath
);
5486 bgp_attr_extra_free (&attr
);
5487 bgp_redistribute_delete (p
, type
);
5492 bn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
],
5493 afi
, SAFI_UNICAST
, p
, NULL
);
5495 new_attr
= bgp_attr_intern (&attr_new
);
5497 for (bi
= bn
->info
; bi
; bi
= bi
->next
)
5498 if (bi
->peer
== bgp
->peer_self
5499 && bi
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
5504 if (attrhash_cmp (bi
->attr
, new_attr
) &&
5505 !CHECK_FLAG(bi
->flags
, BGP_INFO_REMOVED
))
5507 bgp_attr_unintern (&new_attr
);
5508 aspath_unintern (&attr
.aspath
);
5509 bgp_attr_extra_free (&attr
);
5510 bgp_unlock_node (bn
);
5515 /* The attribute is changed. */
5516 bgp_info_set_flag (bn
, bi
, BGP_INFO_ATTR_CHANGED
);
5518 /* Rewrite BGP route information. */
5519 if (CHECK_FLAG(bi
->flags
, BGP_INFO_REMOVED
))
5520 bgp_info_restore(bn
, bi
);
5522 bgp_aggregate_decrement (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
5523 bgp_attr_unintern (&bi
->attr
);
5524 bi
->attr
= new_attr
;
5525 bi
->uptime
= bgp_clock ();
5527 /* Process change. */
5528 bgp_aggregate_increment (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
5529 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
5530 bgp_unlock_node (bn
);
5531 aspath_unintern (&attr
.aspath
);
5532 bgp_attr_extra_free (&attr
);
5537 new = bgp_info_new ();
5539 new->sub_type
= BGP_ROUTE_REDISTRIBUTE
;
5540 new->peer
= bgp
->peer_self
;
5541 SET_FLAG (new->flags
, BGP_INFO_VALID
);
5542 new->attr
= new_attr
;
5543 new->uptime
= bgp_clock ();
5545 bgp_aggregate_increment (bgp
, p
, new, afi
, SAFI_UNICAST
);
5546 bgp_info_add (bn
, new);
5547 bgp_unlock_node (bn
);
5548 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
5552 /* Unintern original. */
5553 aspath_unintern (&attr
.aspath
);
5554 bgp_attr_extra_free (&attr
);
5558 bgp_redistribute_delete (struct prefix
*p
, u_char type
)
5561 struct listnode
*node
, *nnode
;
5563 struct bgp_node
*rn
;
5564 struct bgp_info
*ri
;
5566 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
5568 afi
= family2afi (p
->family
);
5570 if (bgp
->redist
[afi
][type
])
5572 rn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
], afi
, SAFI_UNICAST
, p
, NULL
);
5574 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5575 if (ri
->peer
== bgp
->peer_self
5576 && ri
->type
== type
)
5581 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, SAFI_UNICAST
);
5582 bgp_info_delete (rn
, ri
);
5583 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
5585 bgp_unlock_node (rn
);
5590 /* Withdraw specified route type's route. */
5592 bgp_redistribute_withdraw (struct bgp
*bgp
, afi_t afi
, int type
)
5594 struct bgp_node
*rn
;
5595 struct bgp_info
*ri
;
5596 struct bgp_table
*table
;
5598 table
= bgp
->rib
[afi
][SAFI_UNICAST
];
5600 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
5602 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5603 if (ri
->peer
== bgp
->peer_self
5604 && ri
->type
== type
)
5609 bgp_aggregate_decrement (bgp
, &rn
->p
, ri
, afi
, SAFI_UNICAST
);
5610 bgp_info_delete (rn
, ri
);
5611 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
5616 /* Static function to display route. */
5618 route_vty_out_route (struct prefix
*p
, struct vty
*vty
)
5621 u_int32_t destination
;
5624 if (p
->family
== AF_INET
)
5626 len
= vty_out (vty
, "%s", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
));
5627 destination
= ntohl (p
->u
.prefix4
.s_addr
);
5629 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
5630 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
5631 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
5632 || p
->u
.prefix4
.s_addr
== 0)
5634 /* When mask is natural, mask is not displayed. */
5637 len
+= vty_out (vty
, "/%d", p
->prefixlen
);
5640 len
= vty_out (vty
, "%s/%d", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
),
5645 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 20, " ");
5647 vty_out (vty
, "%*s", len
, " ");
5650 enum bgp_display_type
5655 /* Print the short form route status for a bgp_info */
5657 route_vty_short_status_out (struct vty
*vty
, struct bgp_info
*binfo
)
5659 /* Route status display. */
5660 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
5662 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
5664 else if (binfo
->extra
&& binfo
->extra
->suppress
)
5666 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5672 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5674 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5676 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
5678 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_MULTIPATH
))
5683 /* Internal route. */
5684 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
5690 /* called from terminal list command */
5692 route_vty_out (struct vty
*vty
, struct prefix
*p
,
5693 struct bgp_info
*binfo
, int display
, safi_t safi
)
5697 /* short status lead text */
5698 route_vty_short_status_out (vty
, binfo
);
5700 /* print prefix and mask */
5702 route_vty_out_route (p
, vty
);
5704 vty_out (vty
, "%*s", 17, " ");
5706 /* Print attribute */
5710 if (p
->family
== AF_INET
)
5712 if (safi
== SAFI_MPLS_VPN
)
5713 vty_out (vty
, "%-16s",
5714 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
5716 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5719 else if (p
->family
== AF_INET6
)
5724 len
= vty_out (vty
, "%s",
5725 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5729 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
5731 vty_out (vty
, "%*s", len
, " ");
5733 #endif /* HAVE_IPV6 */
5735 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
5736 vty_out (vty
, "%10u", attr
->med
);
5740 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
5741 vty_out (vty
, "%7u", attr
->local_pref
);
5745 vty_out (vty
, "%7u ", (attr
->extra
? attr
->extra
->weight
: 0));
5749 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
5752 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5754 vty_out (vty
, "%s", VTY_NEWLINE
);
5757 /* called from terminal list command */
5759 route_vty_out_tmp (struct vty
*vty
, struct prefix
*p
,
5760 struct attr
*attr
, safi_t safi
)
5762 /* Route status display. */
5767 /* print prefix and mask */
5768 route_vty_out_route (p
, vty
);
5770 /* Print attribute */
5773 if (p
->family
== AF_INET
)
5775 if (safi
== SAFI_MPLS_VPN
)
5776 vty_out (vty
, "%-16s",
5777 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
5779 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5782 else if (p
->family
== AF_INET6
)
5787 assert (attr
->extra
);
5789 len
= vty_out (vty
, "%s",
5790 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5794 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
5796 vty_out (vty
, "%*s", len
, " ");
5798 #endif /* HAVE_IPV6 */
5800 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
5801 vty_out (vty
, "%10u", attr
->med
);
5805 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
5806 vty_out (vty
, "%7u", attr
->local_pref
);
5810 vty_out (vty
, "%7u ", (attr
->extra
? attr
->extra
->weight
: 0));
5814 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
5817 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5820 vty_out (vty
, "%s", VTY_NEWLINE
);
5824 route_vty_out_tag (struct vty
*vty
, struct prefix
*p
,
5825 struct bgp_info
*binfo
, int display
, safi_t safi
)
5828 u_int32_t label
= 0;
5833 /* short status lead text */
5834 route_vty_short_status_out (vty
, binfo
);
5836 /* print prefix and mask */
5838 route_vty_out_route (p
, vty
);
5840 vty_out (vty
, "%*s", 17, " ");
5842 /* Print attribute */
5846 if (p
->family
== AF_INET
)
5848 if (safi
== SAFI_MPLS_VPN
)
5849 vty_out (vty
, "%-16s",
5850 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
5852 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5855 else if (p
->family
== AF_INET6
)
5857 assert (attr
->extra
);
5860 if (attr
->extra
->mp_nexthop_len
== 16)
5862 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5864 else if (attr
->extra
->mp_nexthop_len
== 32)
5865 vty_out (vty
, "%s(%s)",
5866 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5868 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_local
,
5872 #endif /* HAVE_IPV6 */
5875 label
= decode_label (binfo
->extra
->tag
);
5877 vty_out (vty
, "notag/%d", label
);
5879 vty_out (vty
, "%s", VTY_NEWLINE
);
5882 /* dampening route */
5884 damp_route_vty_out (struct vty
*vty
, struct prefix
*p
,
5885 struct bgp_info
*binfo
, int display
, safi_t safi
)
5889 char timebuf
[BGP_UPTIME_LEN
];
5891 /* short status lead text */
5892 route_vty_short_status_out (vty
, binfo
);
5894 /* print prefix and mask */
5896 route_vty_out_route (p
, vty
);
5898 vty_out (vty
, "%*s", 17, " ");
5900 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
5903 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 34, " ");
5905 vty_out (vty
, "%*s", len
, " ");
5907 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
, timebuf
, BGP_UPTIME_LEN
));
5909 /* Print attribute */
5915 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
5918 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5920 vty_out (vty
, "%s", VTY_NEWLINE
);
5925 flap_route_vty_out (struct vty
*vty
, struct prefix
*p
,
5926 struct bgp_info
*binfo
, int display
, safi_t safi
)
5929 struct bgp_damp_info
*bdi
;
5930 char timebuf
[BGP_UPTIME_LEN
];
5936 bdi
= binfo
->extra
->damp_info
;
5938 /* short status lead text */
5939 route_vty_short_status_out (vty
, binfo
);
5941 /* print prefix and mask */
5943 route_vty_out_route (p
, vty
);
5945 vty_out (vty
, "%*s", 17, " ");
5947 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
5950 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 33, " ");
5952 vty_out (vty
, "%*s", len
, " ");
5954 len
= vty_out (vty
, "%d", bdi
->flap
);
5959 vty_out (vty
, "%*s ", len
, " ");
5961 vty_out (vty
, "%s ", peer_uptime (bdi
->start_time
,
5962 timebuf
, BGP_UPTIME_LEN
));
5964 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
)
5965 && ! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5966 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
, timebuf
, BGP_UPTIME_LEN
));
5968 vty_out (vty
, "%*s ", 8, " ");
5970 /* Print attribute */
5976 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
5979 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5981 vty_out (vty
, "%s", VTY_NEWLINE
);
5985 route_vty_out_detail (struct vty
*vty
, struct bgp
*bgp
, struct prefix
*p
,
5986 struct bgp_info
*binfo
, afi_t afi
, safi_t safi
)
5988 char buf
[INET6_ADDRSTRLEN
];
5991 int sockunion_vty_out (struct vty
*, union sockunion
*);
5992 #ifdef HAVE_CLOCK_MONOTONIC
6000 /* Line1 display AS-path, Aggregator */
6004 if (aspath_count_hops (attr
->aspath
) == 0)
6005 vty_out (vty
, "Local");
6007 aspath_print_vty (vty
, "%s", attr
->aspath
, "");
6010 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
6011 vty_out (vty
, ", (removed)");
6012 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
6013 vty_out (vty
, ", (stale)");
6014 if (CHECK_FLAG (attr
->flag
, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR
)))
6015 vty_out (vty
, ", (aggregated by %u %s)",
6016 attr
->extra
->aggregator_as
,
6017 inet_ntoa (attr
->extra
->aggregator_addr
));
6018 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
6019 vty_out (vty
, ", (Received from a RR-client)");
6020 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
6021 vty_out (vty
, ", (Received from a RS-client)");
6022 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6023 vty_out (vty
, ", (history entry)");
6024 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
6025 vty_out (vty
, ", (suppressed due to dampening)");
6026 vty_out (vty
, "%s", VTY_NEWLINE
);
6028 /* Line2 display Next-hop, Neighbor, Router-id */
6029 if (p
->family
== AF_INET
)
6031 vty_out (vty
, " %s", safi
== SAFI_MPLS_VPN
?
6032 inet_ntoa (attr
->extra
->mp_nexthop_global_in
) :
6033 inet_ntoa (attr
->nexthop
));
6038 assert (attr
->extra
);
6039 vty_out (vty
, " %s",
6040 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
6041 buf
, INET6_ADDRSTRLEN
));
6043 #endif /* HAVE_IPV6 */
6045 if (binfo
->peer
== bgp
->peer_self
)
6047 vty_out (vty
, " from %s ",
6048 p
->family
== AF_INET
? "0.0.0.0" : "::");
6049 vty_out (vty
, "(%s)", inet_ntoa(bgp
->router_id
));
6053 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_VALID
))
6054 vty_out (vty
, " (inaccessible)");
6055 else if (binfo
->extra
&& binfo
->extra
->igpmetric
)
6056 vty_out (vty
, " (metric %u)", binfo
->extra
->igpmetric
);
6057 vty_out (vty
, " from %s", sockunion2str (&binfo
->peer
->su
, buf
, SU_ADDRSTRLEN
));
6058 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
6059 vty_out (vty
, " (%s)", inet_ntoa (attr
->extra
->originator_id
));
6061 vty_out (vty
, " (%s)", inet_ntop (AF_INET
, &binfo
->peer
->remote_id
, buf1
, BUFSIZ
));
6063 vty_out (vty
, "%s", VTY_NEWLINE
);
6066 /* display nexthop local */
6067 if (attr
->extra
&& attr
->extra
->mp_nexthop_len
== 32)
6069 vty_out (vty
, " (%s)%s",
6070 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_local
,
6071 buf
, INET6_ADDRSTRLEN
),
6074 #endif /* HAVE_IPV6 */
6076 /* Line 3 display Origin, Med, Locpref, Weight, valid, Int/Ext/Local, Atomic, best */
6077 vty_out (vty
, " Origin %s", bgp_origin_long_str
[attr
->origin
]);
6079 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
))
6080 vty_out (vty
, ", metric %u", attr
->med
);
6082 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
))
6083 vty_out (vty
, ", localpref %u", attr
->local_pref
);
6085 vty_out (vty
, ", localpref %u", bgp
->default_local_pref
);
6087 if (attr
->extra
&& attr
->extra
->weight
!= 0)
6088 vty_out (vty
, ", weight %u", attr
->extra
->weight
);
6090 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6091 vty_out (vty
, ", valid");
6093 if (binfo
->peer
!= bgp
->peer_self
)
6095 if (binfo
->peer
->as
== binfo
->peer
->local_as
)
6096 vty_out (vty
, ", internal");
6098 vty_out (vty
, ", %s",
6099 (bgp_confederation_peers_check(bgp
, binfo
->peer
->as
) ? "confed-external" : "external"));
6101 else if (binfo
->sub_type
== BGP_ROUTE_AGGREGATE
)
6102 vty_out (vty
, ", aggregated, local");
6103 else if (binfo
->type
!= ZEBRA_ROUTE_BGP
)
6104 vty_out (vty
, ", sourced");
6106 vty_out (vty
, ", sourced, local");
6108 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
6109 vty_out (vty
, ", atomic-aggregate");
6111 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_MULTIPATH
) ||
6112 (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
) &&
6113 bgp_info_mpath_count (binfo
)))
6114 vty_out (vty
, ", multipath");
6116 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
6117 vty_out (vty
, ", best");
6119 vty_out (vty
, "%s", VTY_NEWLINE
);
6121 /* Line 4 display Community */
6122 if (attr
->community
)
6123 vty_out (vty
, " Community: %s%s", attr
->community
->str
,
6126 /* Line 5 display Extended-community */
6127 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
))
6128 vty_out (vty
, " Extended Community: %s%s",
6129 attr
->extra
->ecommunity
->str
, VTY_NEWLINE
);
6131 /* Line 6 display Originator, Cluster-id */
6132 if ((attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)) ||
6133 (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
)))
6135 assert (attr
->extra
);
6136 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
6137 vty_out (vty
, " Originator: %s",
6138 inet_ntoa (attr
->extra
->originator_id
));
6140 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
6143 vty_out (vty
, ", Cluster list: ");
6144 for (i
= 0; i
< attr
->extra
->cluster
->length
/ 4; i
++)
6145 vty_out (vty
, "%s ",
6146 inet_ntoa (attr
->extra
->cluster
->list
[i
]));
6148 vty_out (vty
, "%s", VTY_NEWLINE
);
6151 if (binfo
->extra
&& binfo
->extra
->damp_info
)
6152 bgp_damp_info_vty (vty
, binfo
);
6154 /* Line 7 display Uptime */
6155 #ifdef HAVE_CLOCK_MONOTONIC
6156 tbuf
= time(NULL
) - (bgp_clock() - binfo
->uptime
);
6157 vty_out (vty
, " Last update: %s", ctime(&tbuf
));
6159 vty_out (vty
, " Last update: %s", ctime(&binfo
->uptime
));
6160 #endif /* HAVE_CLOCK_MONOTONIC */
6162 vty_out (vty
, "%s", VTY_NEWLINE
);
6165 #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, "\
6166 "h history, * valid, > best, = multipath,%s"\
6167 " i internal, r RIB-failure, S Stale, R Removed%s"
6168 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s"
6169 #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s"
6170 #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s"
6171 #define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path%s"
6175 bgp_show_type_normal
,
6176 bgp_show_type_regexp
,
6177 bgp_show_type_prefix_list
,
6178 bgp_show_type_filter_list
,
6179 bgp_show_type_route_map
,
6180 bgp_show_type_neighbor
,
6181 bgp_show_type_cidr_only
,
6182 bgp_show_type_prefix_longer
,
6183 bgp_show_type_community_all
,
6184 bgp_show_type_community
,
6185 bgp_show_type_community_exact
,
6186 bgp_show_type_community_list
,
6187 bgp_show_type_community_list_exact
,
6188 bgp_show_type_flap_statistics
,
6189 bgp_show_type_flap_address
,
6190 bgp_show_type_flap_prefix
,
6191 bgp_show_type_flap_cidr_only
,
6192 bgp_show_type_flap_regexp
,
6193 bgp_show_type_flap_filter_list
,
6194 bgp_show_type_flap_prefix_list
,
6195 bgp_show_type_flap_prefix_longer
,
6196 bgp_show_type_flap_route_map
,
6197 bgp_show_type_flap_neighbor
,
6198 bgp_show_type_dampend_paths
,
6199 bgp_show_type_damp_neighbor
6203 bgp_show_table (struct vty
*vty
, struct bgp_table
*table
, struct in_addr
*router_id
,
6204 enum bgp_show_type type
, void *output_arg
)
6206 struct bgp_info
*ri
;
6207 struct bgp_node
*rn
;
6210 unsigned long output_count
;
6212 /* This is first entry point, so reset total line. */
6215 /* Start processing of routes. */
6216 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
6217 if (rn
->info
!= NULL
)
6221 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6223 if (type
== bgp_show_type_flap_statistics
6224 || type
== bgp_show_type_flap_address
6225 || type
== bgp_show_type_flap_prefix
6226 || type
== bgp_show_type_flap_cidr_only
6227 || type
== bgp_show_type_flap_regexp
6228 || type
== bgp_show_type_flap_filter_list
6229 || type
== bgp_show_type_flap_prefix_list
6230 || type
== bgp_show_type_flap_prefix_longer
6231 || type
== bgp_show_type_flap_route_map
6232 || type
== bgp_show_type_flap_neighbor
6233 || type
== bgp_show_type_dampend_paths
6234 || type
== bgp_show_type_damp_neighbor
)
6236 if (!(ri
->extra
&& ri
->extra
->damp_info
))
6239 if (type
== bgp_show_type_regexp
6240 || type
== bgp_show_type_flap_regexp
)
6242 regex_t
*regex
= output_arg
;
6244 if (bgp_regexec (regex
, ri
->attr
->aspath
) == REG_NOMATCH
)
6247 if (type
== bgp_show_type_prefix_list
6248 || type
== bgp_show_type_flap_prefix_list
)
6250 struct prefix_list
*plist
= output_arg
;
6252 if (prefix_list_apply (plist
, &rn
->p
) != PREFIX_PERMIT
)
6255 if (type
== bgp_show_type_filter_list
6256 || type
== bgp_show_type_flap_filter_list
)
6258 struct as_list
*as_list
= output_arg
;
6260 if (as_list_apply (as_list
, ri
->attr
->aspath
) != AS_FILTER_PERMIT
)
6263 if (type
== bgp_show_type_route_map
6264 || type
== bgp_show_type_flap_route_map
)
6266 struct route_map
*rmap
= output_arg
;
6267 struct bgp_info binfo
;
6268 struct attr dummy_attr
;
6269 struct attr_extra dummy_extra
;
6272 dummy_attr
.extra
= &dummy_extra
;
6273 bgp_attr_dup (&dummy_attr
, ri
->attr
);
6275 binfo
.peer
= ri
->peer
;
6276 binfo
.attr
= &dummy_attr
;
6278 ret
= route_map_apply (rmap
, &rn
->p
, RMAP_BGP
, &binfo
);
6279 if (ret
== RMAP_DENYMATCH
)
6282 if (type
== bgp_show_type_neighbor
6283 || type
== bgp_show_type_flap_neighbor
6284 || type
== bgp_show_type_damp_neighbor
)
6286 union sockunion
*su
= output_arg
;
6288 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
6291 if (type
== bgp_show_type_cidr_only
6292 || type
== bgp_show_type_flap_cidr_only
)
6294 u_int32_t destination
;
6296 destination
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
6297 if (IN_CLASSC (destination
) && rn
->p
.prefixlen
== 24)
6299 if (IN_CLASSB (destination
) && rn
->p
.prefixlen
== 16)
6301 if (IN_CLASSA (destination
) && rn
->p
.prefixlen
== 8)
6304 if (type
== bgp_show_type_prefix_longer
6305 || type
== bgp_show_type_flap_prefix_longer
)
6307 struct prefix
*p
= output_arg
;
6309 if (! prefix_match (p
, &rn
->p
))
6312 if (type
== bgp_show_type_community_all
)
6314 if (! ri
->attr
->community
)
6317 if (type
== bgp_show_type_community
)
6319 struct community
*com
= output_arg
;
6321 if (! ri
->attr
->community
||
6322 ! community_match (ri
->attr
->community
, com
))
6325 if (type
== bgp_show_type_community_exact
)
6327 struct community
*com
= output_arg
;
6329 if (! ri
->attr
->community
||
6330 ! community_cmp (ri
->attr
->community
, com
))
6333 if (type
== bgp_show_type_community_list
)
6335 struct community_list
*list
= output_arg
;
6337 if (! community_list_match (ri
->attr
->community
, list
))
6340 if (type
== bgp_show_type_community_list_exact
)
6342 struct community_list
*list
= output_arg
;
6344 if (! community_list_exact_match (ri
->attr
->community
, list
))
6347 if (type
== bgp_show_type_flap_address
6348 || type
== bgp_show_type_flap_prefix
)
6350 struct prefix
*p
= output_arg
;
6352 if (! prefix_match (&rn
->p
, p
))
6355 if (type
== bgp_show_type_flap_prefix
)
6356 if (p
->prefixlen
!= rn
->p
.prefixlen
)
6359 if (type
== bgp_show_type_dampend_paths
6360 || type
== bgp_show_type_damp_neighbor
)
6362 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
6363 || CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
6369 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id
), VTY_NEWLINE
);
6370 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
6371 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
6372 if (type
== bgp_show_type_dampend_paths
6373 || type
== bgp_show_type_damp_neighbor
)
6374 vty_out (vty
, BGP_SHOW_DAMP_HEADER
, VTY_NEWLINE
);
6375 else if (type
== bgp_show_type_flap_statistics
6376 || type
== bgp_show_type_flap_address
6377 || type
== bgp_show_type_flap_prefix
6378 || type
== bgp_show_type_flap_cidr_only
6379 || type
== bgp_show_type_flap_regexp
6380 || type
== bgp_show_type_flap_filter_list
6381 || type
== bgp_show_type_flap_prefix_list
6382 || type
== bgp_show_type_flap_prefix_longer
6383 || type
== bgp_show_type_flap_route_map
6384 || type
== bgp_show_type_flap_neighbor
)
6385 vty_out (vty
, BGP_SHOW_FLAP_HEADER
, VTY_NEWLINE
);
6387 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
6391 if (type
== bgp_show_type_dampend_paths
6392 || type
== bgp_show_type_damp_neighbor
)
6393 damp_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6394 else if (type
== bgp_show_type_flap_statistics
6395 || type
== bgp_show_type_flap_address
6396 || type
== bgp_show_type_flap_prefix
6397 || type
== bgp_show_type_flap_cidr_only
6398 || type
== bgp_show_type_flap_regexp
6399 || type
== bgp_show_type_flap_filter_list
6400 || type
== bgp_show_type_flap_prefix_list
6401 || type
== bgp_show_type_flap_prefix_longer
6402 || type
== bgp_show_type_flap_route_map
6403 || type
== bgp_show_type_flap_neighbor
)
6404 flap_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6406 route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6413 /* No route is displayed */
6414 if (output_count
== 0)
6416 if (type
== bgp_show_type_normal
)
6417 vty_out (vty
, "No BGP network exists%s", VTY_NEWLINE
);
6420 vty_out (vty
, "%sTotal number of prefixes %ld%s",
6421 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
6427 bgp_show (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
6428 enum bgp_show_type type
, void *output_arg
)
6430 struct bgp_table
*table
;
6433 bgp
= bgp_get_default ();
6438 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
6443 table
= bgp
->rib
[afi
][safi
];
6445 return bgp_show_table (vty
, table
, &bgp
->router_id
, type
, output_arg
);
6448 /* Header of detailed BGP route information */
6450 route_vty_out_detail_header (struct vty
*vty
, struct bgp
*bgp
,
6451 struct bgp_node
*rn
,
6452 struct prefix_rd
*prd
, afi_t afi
, safi_t safi
)
6454 struct bgp_info
*ri
;
6457 struct listnode
*node
, *nnode
;
6458 char buf1
[INET6_ADDRSTRLEN
];
6459 char buf2
[INET6_ADDRSTRLEN
];
6464 int no_advertise
= 0;
6469 vty_out (vty
, "BGP routing table entry for %s%s%s/%d%s",
6470 (safi
== SAFI_MPLS_VPN
?
6471 prefix_rd2str (prd
, buf1
, RD_ADDRSTRLEN
) : ""),
6472 safi
== SAFI_MPLS_VPN
? ":" : "",
6473 inet_ntop (p
->family
, &p
->u
.prefix
, buf2
, INET6_ADDRSTRLEN
),
6474 p
->prefixlen
, VTY_NEWLINE
);
6476 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6479 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
6482 if (ri
->extra
&& ri
->extra
->suppress
)
6484 if (ri
->attr
->community
!= NULL
)
6486 if (community_include (ri
->attr
->community
, COMMUNITY_NO_ADVERTISE
))
6488 if (community_include (ri
->attr
->community
, COMMUNITY_NO_EXPORT
))
6490 if (community_include (ri
->attr
->community
, COMMUNITY_LOCAL_AS
))
6496 vty_out (vty
, "Paths: (%d available", count
);
6499 vty_out (vty
, ", best #%d", best
);
6500 if (safi
== SAFI_UNICAST
)
6501 vty_out (vty
, ", table Default-IP-Routing-Table");
6504 vty_out (vty
, ", no best path");
6506 vty_out (vty
, ", not advertised to any peer");
6508 vty_out (vty
, ", not advertised to EBGP peer");
6510 vty_out (vty
, ", not advertised outside local AS");
6512 vty_out (vty
, ", Advertisements suppressed by an aggregate.");
6513 vty_out (vty
, ")%s", VTY_NEWLINE
);
6515 /* advertised peer */
6516 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6518 if (bgp_adj_out_lookup (peer
, p
, afi
, safi
, rn
))
6521 vty_out (vty
, " Advertised to non peer-group peers:%s ", VTY_NEWLINE
);
6522 vty_out (vty
, " %s", sockunion2str (&peer
->su
, buf1
, SU_ADDRSTRLEN
));
6527 vty_out (vty
, " Not advertised to any peer");
6528 vty_out (vty
, "%s", VTY_NEWLINE
);
6531 /* Display specified route of BGP table. */
6533 bgp_show_route_in_table (struct vty
*vty
, struct bgp
*bgp
,
6534 struct bgp_table
*rib
, const char *ip_str
,
6535 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
6541 struct prefix match
;
6542 struct bgp_node
*rn
;
6543 struct bgp_node
*rm
;
6544 struct bgp_info
*ri
;
6545 struct bgp_table
*table
;
6547 /* Check IP address argument. */
6548 ret
= str2prefix (ip_str
, &match
);
6551 vty_out (vty
, "address is malformed%s", VTY_NEWLINE
);
6555 match
.family
= afi2family (afi
);
6557 if (safi
== SAFI_MPLS_VPN
)
6559 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
6561 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
6564 if ((table
= rn
->info
) != NULL
)
6568 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
6570 if (prefix_check
&& rm
->p
.prefixlen
!= match
.prefixlen
)
6572 bgp_unlock_node (rm
);
6576 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
6580 route_vty_out_detail_header (vty
, bgp
, rm
, (struct prefix_rd
*)&rn
->p
,
6581 AFI_IP
, SAFI_MPLS_VPN
);
6586 route_vty_out_detail (vty
, bgp
, &rm
->p
, ri
, AFI_IP
, SAFI_MPLS_VPN
);
6589 bgp_unlock_node (rm
);
6598 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
6600 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
6602 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6606 route_vty_out_detail_header (vty
, bgp
, rn
, NULL
, afi
, safi
);
6610 route_vty_out_detail (vty
, bgp
, &rn
->p
, ri
, afi
, safi
);
6614 bgp_unlock_node (rn
);
6620 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
6627 /* Display specified route of Main RIB */
6629 bgp_show_route (struct vty
*vty
, const char *view_name
, const char *ip_str
,
6630 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
6635 /* BGP structure lookup. */
6638 bgp
= bgp_lookup_by_name (view_name
);
6641 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
6647 bgp
= bgp_get_default ();
6650 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
6655 return bgp_show_route_in_table (vty
, bgp
, bgp
->rib
[afi
][safi
], ip_str
,
6656 afi
, safi
, prd
, prefix_check
);
6659 /* BGP route print out function. */
6667 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6670 DEFUN (show_ip_bgp_ipv4
,
6671 show_ip_bgp_ipv4_cmd
,
6672 "show ip bgp ipv4 (unicast|multicast)",
6677 "Address Family modifier\n"
6678 "Address Family modifier\n")
6680 if (strncmp (argv
[0], "m", 1) == 0)
6681 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, bgp_show_type_normal
,
6684 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6687 ALIAS (show_ip_bgp_ipv4
,
6688 show_bgp_ipv4_safi_cmd
,
6689 "show bgp ipv4 (unicast|multicast)",
6693 "Address Family modifier\n"
6694 "Address Family modifier\n")
6696 DEFUN (show_ip_bgp_route
,
6697 show_ip_bgp_route_cmd
,
6698 "show ip bgp A.B.C.D",
6702 "Network in the BGP routing table to display\n")
6704 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6707 DEFUN (show_ip_bgp_ipv4_route
,
6708 show_ip_bgp_ipv4_route_cmd
,
6709 "show ip bgp ipv4 (unicast|multicast) A.B.C.D",
6714 "Address Family modifier\n"
6715 "Address Family modifier\n"
6716 "Network in the BGP routing table to display\n")
6718 if (strncmp (argv
[0], "m", 1) == 0)
6719 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0);
6721 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6724 ALIAS (show_ip_bgp_ipv4_route
,
6725 show_bgp_ipv4_safi_route_cmd
,
6726 "show bgp ipv4 (unicast|multicast) A.B.C.D",
6730 "Address Family modifier\n"
6731 "Address Family modifier\n"
6732 "Network in the BGP routing table to display\n")
6734 DEFUN (show_ip_bgp_vpnv4_all_route
,
6735 show_ip_bgp_vpnv4_all_route_cmd
,
6736 "show ip bgp vpnv4 all A.B.C.D",
6740 "Display VPNv4 NLRI specific information\n"
6741 "Display information about all VPNv4 NLRIs\n"
6742 "Network in the BGP routing table to display\n")
6744 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 0);
6747 DEFUN (show_ip_bgp_vpnv4_rd_route
,
6748 show_ip_bgp_vpnv4_rd_route_cmd
,
6749 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D",
6753 "Display VPNv4 NLRI specific information\n"
6754 "Display information for a route distinguisher\n"
6755 "VPN Route Distinguisher\n"
6756 "Network in the BGP routing table to display\n")
6759 struct prefix_rd prd
;
6761 ret
= str2prefix_rd (argv
[0], &prd
);
6764 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
6767 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 0);
6770 DEFUN (show_ip_bgp_prefix
,
6771 show_ip_bgp_prefix_cmd
,
6772 "show ip bgp A.B.C.D/M",
6776 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6778 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6781 DEFUN (show_ip_bgp_ipv4_prefix
,
6782 show_ip_bgp_ipv4_prefix_cmd
,
6783 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M",
6788 "Address Family modifier\n"
6789 "Address Family modifier\n"
6790 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6792 if (strncmp (argv
[0], "m", 1) == 0)
6793 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1);
6795 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6798 ALIAS (show_ip_bgp_ipv4_prefix
,
6799 show_bgp_ipv4_safi_prefix_cmd
,
6800 "show bgp ipv4 (unicast|multicast) A.B.C.D/M",
6804 "Address Family modifier\n"
6805 "Address Family modifier\n"
6806 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6808 DEFUN (show_ip_bgp_vpnv4_all_prefix
,
6809 show_ip_bgp_vpnv4_all_prefix_cmd
,
6810 "show ip bgp vpnv4 all A.B.C.D/M",
6814 "Display VPNv4 NLRI specific information\n"
6815 "Display information about all VPNv4 NLRIs\n"
6816 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6818 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 1);
6821 DEFUN (show_ip_bgp_vpnv4_rd_prefix
,
6822 show_ip_bgp_vpnv4_rd_prefix_cmd
,
6823 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M",
6827 "Display VPNv4 NLRI specific information\n"
6828 "Display information for a route distinguisher\n"
6829 "VPN Route Distinguisher\n"
6830 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6833 struct prefix_rd prd
;
6835 ret
= str2prefix_rd (argv
[0], &prd
);
6838 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
6841 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 1);
6844 DEFUN (show_ip_bgp_view
,
6845 show_ip_bgp_view_cmd
,
6846 "show ip bgp view WORD",
6855 /* BGP structure lookup. */
6856 bgp
= bgp_lookup_by_name (argv
[0]);
6859 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
6863 return bgp_show (vty
, bgp
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6866 DEFUN (show_ip_bgp_view_route
,
6867 show_ip_bgp_view_route_cmd
,
6868 "show ip bgp view WORD A.B.C.D",
6874 "Network in the BGP routing table to display\n")
6876 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6879 DEFUN (show_ip_bgp_view_prefix
,
6880 show_ip_bgp_view_prefix_cmd
,
6881 "show ip bgp view WORD A.B.C.D/M",
6887 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6889 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6899 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
6910 DEFUN (show_bgp_ipv6_safi
,
6911 show_bgp_ipv6_safi_cmd
,
6912 "show bgp ipv6 (unicast|multicast)",
6916 "Address Family modifier\n"
6917 "Address Family modifier\n")
6919 if (strncmp (argv
[0], "m", 1) == 0)
6920 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
6923 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6927 DEFUN (show_ipv6_bgp
,
6934 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
6938 DEFUN (show_bgp_route
,
6940 "show bgp X:X::X:X",
6943 "Network in the BGP routing table to display\n")
6945 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6948 ALIAS (show_bgp_route
,
6949 show_bgp_ipv6_route_cmd
,
6950 "show bgp ipv6 X:X::X:X",
6954 "Network in the BGP routing table to display\n")
6956 DEFUN (show_bgp_ipv6_safi_route
,
6957 show_bgp_ipv6_safi_route_cmd
,
6958 "show bgp ipv6 (unicast|multicast) X:X::X:X",
6962 "Address Family modifier\n"
6963 "Address Family modifier\n"
6964 "Network in the BGP routing table to display\n")
6966 if (strncmp (argv
[0], "m", 1) == 0)
6967 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0);
6969 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6973 DEFUN (show_ipv6_bgp_route
,
6974 show_ipv6_bgp_route_cmd
,
6975 "show ipv6 bgp X:X::X:X",
6979 "Network in the BGP routing table to display\n")
6981 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6984 DEFUN (show_bgp_prefix
,
6985 show_bgp_prefix_cmd
,
6986 "show bgp X:X::X:X/M",
6989 "IPv6 prefix <network>/<length>\n")
6991 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6994 ALIAS (show_bgp_prefix
,
6995 show_bgp_ipv6_prefix_cmd
,
6996 "show bgp ipv6 X:X::X:X/M",
7000 "IPv6 prefix <network>/<length>\n")
7002 DEFUN (show_bgp_ipv6_safi_prefix
,
7003 show_bgp_ipv6_safi_prefix_cmd
,
7004 "show bgp ipv6 (unicast|multicast) X:X::X:X/M",
7008 "Address Family modifier\n"
7009 "Address Family modifier\n"
7010 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
7012 if (strncmp (argv
[0], "m", 1) == 0)
7013 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1);
7015 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
7019 DEFUN (show_ipv6_bgp_prefix
,
7020 show_ipv6_bgp_prefix_cmd
,
7021 "show ipv6 bgp X:X::X:X/M",
7025 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
7027 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
7030 DEFUN (show_bgp_view
,
7032 "show bgp view WORD",
7040 /* BGP structure lookup. */
7041 bgp
= bgp_lookup_by_name (argv
[0]);
7044 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
7048 return bgp_show (vty
, bgp
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
7051 ALIAS (show_bgp_view
,
7052 show_bgp_view_ipv6_cmd
,
7053 "show bgp view WORD ipv6",
7060 DEFUN (show_bgp_view_route
,
7061 show_bgp_view_route_cmd
,
7062 "show bgp view WORD X:X::X:X",
7067 "Network in the BGP routing table to display\n")
7069 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
7072 ALIAS (show_bgp_view_route
,
7073 show_bgp_view_ipv6_route_cmd
,
7074 "show bgp view WORD ipv6 X:X::X:X",
7080 "Network in the BGP routing table to display\n")
7082 DEFUN (show_bgp_view_prefix
,
7083 show_bgp_view_prefix_cmd
,
7084 "show bgp view WORD X:X::X:X/M",
7089 "IPv6 prefix <network>/<length>\n")
7091 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
7094 ALIAS (show_bgp_view_prefix
,
7095 show_bgp_view_ipv6_prefix_cmd
,
7096 "show bgp view WORD ipv6 X:X::X:X/M",
7102 "IPv6 prefix <network>/<length>\n")
7105 DEFUN (show_ipv6_mbgp
,
7112 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
7117 DEFUN (show_ipv6_mbgp_route
,
7118 show_ipv6_mbgp_route_cmd
,
7119 "show ipv6 mbgp X:X::X:X",
7123 "Network in the MBGP routing table to display\n")
7125 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0);
7129 DEFUN (show_ipv6_mbgp_prefix
,
7130 show_ipv6_mbgp_prefix_cmd
,
7131 "show ipv6 mbgp X:X::X:X/M",
7135 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
7137 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1);
7143 bgp_show_regexp (struct vty
*vty
, int argc
, const char **argv
, afi_t afi
,
7144 safi_t safi
, enum bgp_show_type type
)
7154 b
= buffer_new (1024);
7155 for (i
= 0; i
< argc
; i
++)
7158 buffer_putc (b
, ' ');
7161 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
7166 buffer_putstr (b
, argv
[i
]);
7168 buffer_putc (b
, '\0');
7170 regstr
= buffer_getstr (b
);
7173 regex
= bgp_regcomp (regstr
);
7174 XFREE(MTYPE_TMP
, regstr
);
7177 vty_out (vty
, "Can't compile regexp %s%s", argv
[0],
7182 rc
= bgp_show (vty
, NULL
, afi
, safi
, type
, regex
);
7183 bgp_regex_free (regex
);
7187 DEFUN (show_ip_bgp_regexp
,
7188 show_ip_bgp_regexp_cmd
,
7189 "show ip bgp regexp .LINE",
7193 "Display routes matching the AS path regular expression\n"
7194 "A regular-expression to match the BGP AS paths\n")
7196 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7197 bgp_show_type_regexp
);
7200 DEFUN (show_ip_bgp_flap_regexp
,
7201 show_ip_bgp_flap_regexp_cmd
,
7202 "show ip bgp flap-statistics regexp .LINE",
7206 "Display flap statistics of routes\n"
7207 "Display routes matching the AS path regular expression\n"
7208 "A regular-expression to match the BGP AS paths\n")
7210 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7211 bgp_show_type_flap_regexp
);
7214 DEFUN (show_ip_bgp_ipv4_regexp
,
7215 show_ip_bgp_ipv4_regexp_cmd
,
7216 "show ip bgp ipv4 (unicast|multicast) regexp .LINE",
7221 "Address Family modifier\n"
7222 "Address Family modifier\n"
7223 "Display routes matching the AS path regular expression\n"
7224 "A regular-expression to match the BGP AS paths\n")
7226 if (strncmp (argv
[0], "m", 1) == 0)
7227 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_MULTICAST
,
7228 bgp_show_type_regexp
);
7230 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7231 bgp_show_type_regexp
);
7235 DEFUN (show_bgp_regexp
,
7236 show_bgp_regexp_cmd
,
7237 "show bgp regexp .LINE",
7240 "Display routes matching the AS path regular expression\n"
7241 "A regular-expression to match the BGP AS paths\n")
7243 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
7244 bgp_show_type_regexp
);
7247 ALIAS (show_bgp_regexp
,
7248 show_bgp_ipv6_regexp_cmd
,
7249 "show bgp ipv6 regexp .LINE",
7253 "Display routes matching the AS path regular expression\n"
7254 "A regular-expression to match the BGP AS paths\n")
7257 DEFUN (show_ipv6_bgp_regexp
,
7258 show_ipv6_bgp_regexp_cmd
,
7259 "show ipv6 bgp regexp .LINE",
7263 "Display routes matching the AS path regular expression\n"
7264 "A regular-expression to match the BGP AS paths\n")
7266 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
7267 bgp_show_type_regexp
);
7271 DEFUN (show_ipv6_mbgp_regexp
,
7272 show_ipv6_mbgp_regexp_cmd
,
7273 "show ipv6 mbgp regexp .LINE",
7277 "Display routes matching the AS path regular expression\n"
7278 "A regular-expression to match the MBGP AS paths\n")
7280 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_MULTICAST
,
7281 bgp_show_type_regexp
);
7283 #endif /* HAVE_IPV6 */
7286 bgp_show_prefix_list (struct vty
*vty
, const char *prefix_list_str
, afi_t afi
,
7287 safi_t safi
, enum bgp_show_type type
)
7289 struct prefix_list
*plist
;
7291 plist
= prefix_list_lookup (afi
, prefix_list_str
);
7294 vty_out (vty
, "%% %s is not a valid prefix-list name%s",
7295 prefix_list_str
, VTY_NEWLINE
);
7299 return bgp_show (vty
, NULL
, afi
, safi
, type
, plist
);
7302 DEFUN (show_ip_bgp_prefix_list
,
7303 show_ip_bgp_prefix_list_cmd
,
7304 "show ip bgp prefix-list WORD",
7308 "Display routes conforming to the prefix-list\n"
7309 "IP prefix-list name\n")
7311 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7312 bgp_show_type_prefix_list
);
7315 DEFUN (show_ip_bgp_flap_prefix_list
,
7316 show_ip_bgp_flap_prefix_list_cmd
,
7317 "show ip bgp flap-statistics prefix-list WORD",
7321 "Display flap statistics of routes\n"
7322 "Display routes conforming to the prefix-list\n"
7323 "IP prefix-list name\n")
7325 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7326 bgp_show_type_flap_prefix_list
);
7329 DEFUN (show_ip_bgp_ipv4_prefix_list
,
7330 show_ip_bgp_ipv4_prefix_list_cmd
,
7331 "show ip bgp ipv4 (unicast|multicast) prefix-list WORD",
7336 "Address Family modifier\n"
7337 "Address Family modifier\n"
7338 "Display routes conforming to the prefix-list\n"
7339 "IP prefix-list name\n")
7341 if (strncmp (argv
[0], "m", 1) == 0)
7342 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7343 bgp_show_type_prefix_list
);
7345 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7346 bgp_show_type_prefix_list
);
7350 DEFUN (show_bgp_prefix_list
,
7351 show_bgp_prefix_list_cmd
,
7352 "show bgp prefix-list WORD",
7355 "Display routes conforming to the prefix-list\n"
7356 "IPv6 prefix-list name\n")
7358 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7359 bgp_show_type_prefix_list
);
7362 ALIAS (show_bgp_prefix_list
,
7363 show_bgp_ipv6_prefix_list_cmd
,
7364 "show bgp ipv6 prefix-list WORD",
7368 "Display routes conforming to the prefix-list\n"
7369 "IPv6 prefix-list name\n")
7372 DEFUN (show_ipv6_bgp_prefix_list
,
7373 show_ipv6_bgp_prefix_list_cmd
,
7374 "show ipv6 bgp prefix-list WORD",
7378 "Display routes matching the prefix-list\n"
7379 "IPv6 prefix-list name\n")
7381 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7382 bgp_show_type_prefix_list
);
7386 DEFUN (show_ipv6_mbgp_prefix_list
,
7387 show_ipv6_mbgp_prefix_list_cmd
,
7388 "show ipv6 mbgp prefix-list WORD",
7392 "Display routes matching the prefix-list\n"
7393 "IPv6 prefix-list name\n")
7395 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
7396 bgp_show_type_prefix_list
);
7398 #endif /* HAVE_IPV6 */
7401 bgp_show_filter_list (struct vty
*vty
, const char *filter
, afi_t afi
,
7402 safi_t safi
, enum bgp_show_type type
)
7404 struct as_list
*as_list
;
7406 as_list
= as_list_lookup (filter
);
7407 if (as_list
== NULL
)
7409 vty_out (vty
, "%% %s is not a valid AS-path access-list name%s", filter
, VTY_NEWLINE
);
7413 return bgp_show (vty
, NULL
, afi
, safi
, type
, as_list
);
7416 DEFUN (show_ip_bgp_filter_list
,
7417 show_ip_bgp_filter_list_cmd
,
7418 "show ip bgp filter-list WORD",
7422 "Display routes conforming to the filter-list\n"
7423 "Regular expression access list name\n")
7425 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7426 bgp_show_type_filter_list
);
7429 DEFUN (show_ip_bgp_flap_filter_list
,
7430 show_ip_bgp_flap_filter_list_cmd
,
7431 "show ip bgp flap-statistics filter-list WORD",
7435 "Display flap statistics of routes\n"
7436 "Display routes conforming to the filter-list\n"
7437 "Regular expression access list name\n")
7439 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7440 bgp_show_type_flap_filter_list
);
7443 DEFUN (show_ip_bgp_ipv4_filter_list
,
7444 show_ip_bgp_ipv4_filter_list_cmd
,
7445 "show ip bgp ipv4 (unicast|multicast) filter-list WORD",
7450 "Address Family modifier\n"
7451 "Address Family modifier\n"
7452 "Display routes conforming to the filter-list\n"
7453 "Regular expression access list name\n")
7455 if (strncmp (argv
[0], "m", 1) == 0)
7456 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7457 bgp_show_type_filter_list
);
7459 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7460 bgp_show_type_filter_list
);
7464 DEFUN (show_bgp_filter_list
,
7465 show_bgp_filter_list_cmd
,
7466 "show bgp filter-list WORD",
7469 "Display routes conforming to the filter-list\n"
7470 "Regular expression access list name\n")
7472 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7473 bgp_show_type_filter_list
);
7476 ALIAS (show_bgp_filter_list
,
7477 show_bgp_ipv6_filter_list_cmd
,
7478 "show bgp ipv6 filter-list WORD",
7482 "Display routes conforming to the filter-list\n"
7483 "Regular expression access list name\n")
7486 DEFUN (show_ipv6_bgp_filter_list
,
7487 show_ipv6_bgp_filter_list_cmd
,
7488 "show ipv6 bgp filter-list WORD",
7492 "Display routes conforming to the filter-list\n"
7493 "Regular expression access list name\n")
7495 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7496 bgp_show_type_filter_list
);
7500 DEFUN (show_ipv6_mbgp_filter_list
,
7501 show_ipv6_mbgp_filter_list_cmd
,
7502 "show ipv6 mbgp filter-list WORD",
7506 "Display routes conforming to the filter-list\n"
7507 "Regular expression access list name\n")
7509 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
7510 bgp_show_type_filter_list
);
7512 #endif /* HAVE_IPV6 */
7515 bgp_show_route_map (struct vty
*vty
, const char *rmap_str
, afi_t afi
,
7516 safi_t safi
, enum bgp_show_type type
)
7518 struct route_map
*rmap
;
7520 rmap
= route_map_lookup_by_name (rmap_str
);
7523 vty_out (vty
, "%% %s is not a valid route-map name%s",
7524 rmap_str
, VTY_NEWLINE
);
7528 return bgp_show (vty
, NULL
, afi
, safi
, type
, rmap
);
7531 DEFUN (show_ip_bgp_route_map
,
7532 show_ip_bgp_route_map_cmd
,
7533 "show ip bgp route-map WORD",
7537 "Display routes matching the route-map\n"
7538 "A route-map to match on\n")
7540 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7541 bgp_show_type_route_map
);
7544 DEFUN (show_ip_bgp_flap_route_map
,
7545 show_ip_bgp_flap_route_map_cmd
,
7546 "show ip bgp flap-statistics route-map WORD",
7550 "Display flap statistics of routes\n"
7551 "Display routes matching the route-map\n"
7552 "A route-map to match on\n")
7554 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7555 bgp_show_type_flap_route_map
);
7558 DEFUN (show_ip_bgp_ipv4_route_map
,
7559 show_ip_bgp_ipv4_route_map_cmd
,
7560 "show ip bgp ipv4 (unicast|multicast) route-map WORD",
7565 "Address Family modifier\n"
7566 "Address Family modifier\n"
7567 "Display routes matching the route-map\n"
7568 "A route-map to match on\n")
7570 if (strncmp (argv
[0], "m", 1) == 0)
7571 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7572 bgp_show_type_route_map
);
7574 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7575 bgp_show_type_route_map
);
7578 DEFUN (show_bgp_route_map
,
7579 show_bgp_route_map_cmd
,
7580 "show bgp route-map WORD",
7583 "Display routes matching the route-map\n"
7584 "A route-map to match on\n")
7586 return bgp_show_route_map (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7587 bgp_show_type_route_map
);
7590 ALIAS (show_bgp_route_map
,
7591 show_bgp_ipv6_route_map_cmd
,
7592 "show bgp ipv6 route-map WORD",
7596 "Display routes matching the route-map\n"
7597 "A route-map to match on\n")
7599 DEFUN (show_ip_bgp_cidr_only
,
7600 show_ip_bgp_cidr_only_cmd
,
7601 "show ip bgp cidr-only",
7605 "Display only routes with non-natural netmasks\n")
7607 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7608 bgp_show_type_cidr_only
, NULL
);
7611 DEFUN (show_ip_bgp_flap_cidr_only
,
7612 show_ip_bgp_flap_cidr_only_cmd
,
7613 "show ip bgp flap-statistics cidr-only",
7617 "Display flap statistics of routes\n"
7618 "Display only routes with non-natural netmasks\n")
7620 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7621 bgp_show_type_flap_cidr_only
, NULL
);
7624 DEFUN (show_ip_bgp_ipv4_cidr_only
,
7625 show_ip_bgp_ipv4_cidr_only_cmd
,
7626 "show ip bgp ipv4 (unicast|multicast) cidr-only",
7631 "Address Family modifier\n"
7632 "Address Family modifier\n"
7633 "Display only routes with non-natural netmasks\n")
7635 if (strncmp (argv
[0], "m", 1) == 0)
7636 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
7637 bgp_show_type_cidr_only
, NULL
);
7639 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7640 bgp_show_type_cidr_only
, NULL
);
7643 DEFUN (show_ip_bgp_community_all
,
7644 show_ip_bgp_community_all_cmd
,
7645 "show ip bgp community",
7649 "Display routes matching the communities\n")
7651 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7652 bgp_show_type_community_all
, NULL
);
7655 DEFUN (show_ip_bgp_ipv4_community_all
,
7656 show_ip_bgp_ipv4_community_all_cmd
,
7657 "show ip bgp ipv4 (unicast|multicast) community",
7662 "Address Family modifier\n"
7663 "Address Family modifier\n"
7664 "Display routes matching the communities\n")
7666 if (strncmp (argv
[0], "m", 1) == 0)
7667 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
7668 bgp_show_type_community_all
, NULL
);
7670 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7671 bgp_show_type_community_all
, NULL
);
7675 DEFUN (show_bgp_community_all
,
7676 show_bgp_community_all_cmd
,
7677 "show bgp community",
7680 "Display routes matching the communities\n")
7682 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
7683 bgp_show_type_community_all
, NULL
);
7686 ALIAS (show_bgp_community_all
,
7687 show_bgp_ipv6_community_all_cmd
,
7688 "show bgp ipv6 community",
7692 "Display routes matching the communities\n")
7695 DEFUN (show_ipv6_bgp_community_all
,
7696 show_ipv6_bgp_community_all_cmd
,
7697 "show ipv6 bgp community",
7701 "Display routes matching the communities\n")
7703 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
7704 bgp_show_type_community_all
, NULL
);
7708 DEFUN (show_ipv6_mbgp_community_all
,
7709 show_ipv6_mbgp_community_all_cmd
,
7710 "show ipv6 mbgp community",
7714 "Display routes matching the communities\n")
7716 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
,
7717 bgp_show_type_community_all
, NULL
);
7719 #endif /* HAVE_IPV6 */
7722 bgp_show_community (struct vty
*vty
, const char *view_name
, int argc
,
7723 const char **argv
, int exact
, afi_t afi
, safi_t safi
)
7725 struct community
*com
;
7732 /* BGP structure lookup */
7735 bgp
= bgp_lookup_by_name (view_name
);
7738 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
7744 bgp
= bgp_get_default ();
7747 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
7752 b
= buffer_new (1024);
7753 for (i
= 0; i
< argc
; i
++)
7756 buffer_putc (b
, ' ');
7759 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
7764 buffer_putstr (b
, argv
[i
]);
7766 buffer_putc (b
, '\0');
7768 str
= buffer_getstr (b
);
7771 com
= community_str2com (str
);
7772 XFREE (MTYPE_TMP
, str
);
7775 vty_out (vty
, "%% Community malformed: %s", VTY_NEWLINE
);
7779 return bgp_show (vty
, bgp
, afi
, safi
,
7780 (exact
? bgp_show_type_community_exact
:
7781 bgp_show_type_community
), com
);
7784 DEFUN (show_ip_bgp_community
,
7785 show_ip_bgp_community_cmd
,
7786 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export)",
7790 "Display routes matching the communities\n"
7791 "community number\n"
7792 "Do not send outside local AS (well-known community)\n"
7793 "Do not advertise to any peer (well-known community)\n"
7794 "Do not export to next AS (well-known community)\n")
7796 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
7799 ALIAS (show_ip_bgp_community
,
7800 show_ip_bgp_community2_cmd
,
7801 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7805 "Display routes matching the communities\n"
7806 "community number\n"
7807 "Do not send outside local AS (well-known community)\n"
7808 "Do not advertise to any peer (well-known community)\n"
7809 "Do not export to next AS (well-known community)\n"
7810 "community number\n"
7811 "Do not send outside local AS (well-known community)\n"
7812 "Do not advertise to any peer (well-known community)\n"
7813 "Do not export to next AS (well-known community)\n")
7815 ALIAS (show_ip_bgp_community
,
7816 show_ip_bgp_community3_cmd
,
7817 "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)",
7821 "Display routes matching the communities\n"
7822 "community number\n"
7823 "Do not send outside local AS (well-known community)\n"
7824 "Do not advertise to any peer (well-known community)\n"
7825 "Do not export to next AS (well-known community)\n"
7826 "community number\n"
7827 "Do not send outside local AS (well-known community)\n"
7828 "Do not advertise to any peer (well-known community)\n"
7829 "Do not export to next AS (well-known community)\n"
7830 "community number\n"
7831 "Do not send outside local AS (well-known community)\n"
7832 "Do not advertise to any peer (well-known community)\n"
7833 "Do not export to next AS (well-known community)\n")
7835 ALIAS (show_ip_bgp_community
,
7836 show_ip_bgp_community4_cmd
,
7837 "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)",
7841 "Display routes matching the communities\n"
7842 "community number\n"
7843 "Do not send outside local AS (well-known community)\n"
7844 "Do not advertise to any peer (well-known community)\n"
7845 "Do not export to next AS (well-known community)\n"
7846 "community number\n"
7847 "Do not send outside local AS (well-known community)\n"
7848 "Do not advertise to any peer (well-known community)\n"
7849 "Do not export to next AS (well-known community)\n"
7850 "community number\n"
7851 "Do not send outside local AS (well-known community)\n"
7852 "Do not advertise to any peer (well-known community)\n"
7853 "Do not export to next AS (well-known community)\n"
7854 "community number\n"
7855 "Do not send outside local AS (well-known community)\n"
7856 "Do not advertise to any peer (well-known community)\n"
7857 "Do not export to next AS (well-known community)\n")
7859 DEFUN (show_ip_bgp_ipv4_community
,
7860 show_ip_bgp_ipv4_community_cmd
,
7861 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
7866 "Address Family modifier\n"
7867 "Address Family modifier\n"
7868 "Display routes matching the communities\n"
7869 "community number\n"
7870 "Do not send outside local AS (well-known community)\n"
7871 "Do not advertise to any peer (well-known community)\n"
7872 "Do not export to next AS (well-known community)\n")
7874 if (strncmp (argv
[0], "m", 1) == 0)
7875 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP
, SAFI_MULTICAST
);
7877 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
7880 ALIAS (show_ip_bgp_ipv4_community
,
7881 show_ip_bgp_ipv4_community2_cmd
,
7882 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7887 "Address Family modifier\n"
7888 "Address Family modifier\n"
7889 "Display routes matching the communities\n"
7890 "community number\n"
7891 "Do not send outside local AS (well-known community)\n"
7892 "Do not advertise to any peer (well-known community)\n"
7893 "Do not export to next AS (well-known community)\n"
7894 "community number\n"
7895 "Do not send outside local AS (well-known community)\n"
7896 "Do not advertise to any peer (well-known community)\n"
7897 "Do not export to next AS (well-known community)\n")
7899 ALIAS (show_ip_bgp_ipv4_community
,
7900 show_ip_bgp_ipv4_community3_cmd
,
7901 "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)",
7906 "Address Family modifier\n"
7907 "Address Family modifier\n"
7908 "Display routes matching the communities\n"
7909 "community number\n"
7910 "Do not send outside local AS (well-known community)\n"
7911 "Do not advertise to any peer (well-known community)\n"
7912 "Do not export to next AS (well-known community)\n"
7913 "community number\n"
7914 "Do not send outside local AS (well-known community)\n"
7915 "Do not advertise to any peer (well-known community)\n"
7916 "Do not export to next AS (well-known community)\n"
7917 "community number\n"
7918 "Do not send outside local AS (well-known community)\n"
7919 "Do not advertise to any peer (well-known community)\n"
7920 "Do not export to next AS (well-known community)\n")
7922 ALIAS (show_ip_bgp_ipv4_community
,
7923 show_ip_bgp_ipv4_community4_cmd
,
7924 "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)",
7929 "Address Family modifier\n"
7930 "Address Family modifier\n"
7931 "Display routes matching the communities\n"
7932 "community number\n"
7933 "Do not send outside local AS (well-known community)\n"
7934 "Do not advertise to any peer (well-known community)\n"
7935 "Do not export to next AS (well-known community)\n"
7936 "community number\n"
7937 "Do not send outside local AS (well-known community)\n"
7938 "Do not advertise to any peer (well-known community)\n"
7939 "Do not export to next AS (well-known community)\n"
7940 "community number\n"
7941 "Do not send outside local AS (well-known community)\n"
7942 "Do not advertise to any peer (well-known community)\n"
7943 "Do not export to next AS (well-known community)\n"
7944 "community number\n"
7945 "Do not send outside local AS (well-known community)\n"
7946 "Do not advertise to any peer (well-known community)\n"
7947 "Do not export to next AS (well-known community)\n")
7949 DEFUN (show_bgp_view_afi_safi_community_all
,
7950 show_bgp_view_afi_safi_community_all_cmd
,
7952 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community",
7954 "show bgp view WORD ipv4 (unicast|multicast) community",
7964 "Address Family modifier\n"
7965 "Address Family modifier\n"
7966 "Display routes matching the communities\n")
7972 /* BGP structure lookup. */
7973 bgp
= bgp_lookup_by_name (argv
[0]);
7976 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
7981 afi
= (strncmp (argv
[1], "ipv6", 4) == 0) ? AFI_IP6
: AFI_IP
;
7982 safi
= (strncmp (argv
[2], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
7985 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
7987 return bgp_show (vty
, bgp
, afi
, safi
, bgp_show_type_community_all
, NULL
);
7990 DEFUN (show_bgp_view_afi_safi_community
,
7991 show_bgp_view_afi_safi_community_cmd
,
7993 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
7995 "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
8005 "Address family modifier\n"
8006 "Address family modifier\n"
8007 "Display routes matching the communities\n"
8008 "community number\n"
8009 "Do not send outside local AS (well-known community)\n"
8010 "Do not advertise to any peer (well-known community)\n"
8011 "Do not export to next AS (well-known community)\n")
8017 afi
= (strncmp (argv
[1], "ipv6", 4) == 0) ? AFI_IP6
: AFI_IP
;
8018 safi
= (strncmp (argv
[2], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
8019 return bgp_show_community (vty
, argv
[0], argc
-3, &argv
[3], 0, afi
, safi
);
8022 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
8023 return bgp_show_community (vty
, argv
[0], argc
-2, &argv
[2], 0, afi
, safi
);
8027 ALIAS (show_bgp_view_afi_safi_community
,
8028 show_bgp_view_afi_safi_community2_cmd
,
8030 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8032 "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8042 "Address family modifier\n"
8043 "Address family modifier\n"
8044 "Display routes matching the communities\n"
8045 "community number\n"
8046 "Do not send outside local AS (well-known community)\n"
8047 "Do not advertise to any peer (well-known community)\n"
8048 "Do not export to next AS (well-known community)\n"
8049 "community number\n"
8050 "Do not send outside local AS (well-known community)\n"
8051 "Do not advertise to any peer (well-known community)\n"
8052 "Do not export to next AS (well-known community)\n")
8054 ALIAS (show_bgp_view_afi_safi_community
,
8055 show_bgp_view_afi_safi_community3_cmd
,
8057 "show bgp view WORD (ipv4|ipv6) (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)",
8059 "show bgp view WORD 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)",
8069 "Address family modifier\n"
8070 "Address family modifier\n"
8071 "Display routes matching the communities\n"
8072 "community number\n"
8073 "Do not send outside local AS (well-known community)\n"
8074 "Do not advertise to any peer (well-known community)\n"
8075 "Do not export to next AS (well-known community)\n"
8076 "community number\n"
8077 "Do not send outside local AS (well-known community)\n"
8078 "Do not advertise to any peer (well-known community)\n"
8079 "Do not export to next AS (well-known community)\n"
8080 "community number\n"
8081 "Do not send outside local AS (well-known community)\n"
8082 "Do not advertise to any peer (well-known community)\n"
8083 "Do not export to next AS (well-known community)\n")
8085 ALIAS (show_bgp_view_afi_safi_community
,
8086 show_bgp_view_afi_safi_community4_cmd
,
8088 "show bgp view WORD (ipv4|ipv6) (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)",
8090 "show bgp view WORD 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)",
8100 "Address family modifier\n"
8101 "Address family modifier\n"
8102 "Display routes matching the communities\n"
8103 "community number\n"
8104 "Do not send outside local AS (well-known community)\n"
8105 "Do not advertise to any peer (well-known community)\n"
8106 "Do not export to next AS (well-known community)\n"
8107 "community number\n"
8108 "Do not send outside local AS (well-known community)\n"
8109 "Do not advertise to any peer (well-known community)\n"
8110 "Do not export to next AS (well-known community)\n"
8111 "community number\n"
8112 "Do not send outside local AS (well-known community)\n"
8113 "Do not advertise to any peer (well-known community)\n"
8114 "Do not export to next AS (well-known community)\n"
8115 "community number\n"
8116 "Do not send outside local AS (well-known community)\n"
8117 "Do not advertise to any peer (well-known community)\n"
8118 "Do not export to next AS (well-known community)\n")
8120 DEFUN (show_ip_bgp_community_exact
,
8121 show_ip_bgp_community_exact_cmd
,
8122 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8126 "Display routes matching the communities\n"
8127 "community number\n"
8128 "Do not send outside local AS (well-known community)\n"
8129 "Do not advertise to any peer (well-known community)\n"
8130 "Do not export to next AS (well-known community)\n"
8131 "Exact match of the communities")
8133 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
8136 ALIAS (show_ip_bgp_community_exact
,
8137 show_ip_bgp_community2_exact_cmd
,
8138 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8142 "Display routes matching the communities\n"
8143 "community number\n"
8144 "Do not send outside local AS (well-known community)\n"
8145 "Do not advertise to any peer (well-known community)\n"
8146 "Do not export to next AS (well-known community)\n"
8147 "community number\n"
8148 "Do not send outside local AS (well-known community)\n"
8149 "Do not advertise to any peer (well-known community)\n"
8150 "Do not export to next AS (well-known community)\n"
8151 "Exact match of the communities")
8153 ALIAS (show_ip_bgp_community_exact
,
8154 show_ip_bgp_community3_exact_cmd
,
8155 "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",
8159 "Display routes matching the communities\n"
8160 "community number\n"
8161 "Do not send outside local AS (well-known community)\n"
8162 "Do not advertise to any peer (well-known community)\n"
8163 "Do not export to next AS (well-known community)\n"
8164 "community number\n"
8165 "Do not send outside local AS (well-known community)\n"
8166 "Do not advertise to any peer (well-known community)\n"
8167 "Do not export to next AS (well-known community)\n"
8168 "community number\n"
8169 "Do not send outside local AS (well-known community)\n"
8170 "Do not advertise to any peer (well-known community)\n"
8171 "Do not export to next AS (well-known community)\n"
8172 "Exact match of the communities")
8174 ALIAS (show_ip_bgp_community_exact
,
8175 show_ip_bgp_community4_exact_cmd
,
8176 "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",
8180 "Display routes matching the communities\n"
8181 "community number\n"
8182 "Do not send outside local AS (well-known community)\n"
8183 "Do not advertise to any peer (well-known community)\n"
8184 "Do not export to next AS (well-known community)\n"
8185 "community number\n"
8186 "Do not send outside local AS (well-known community)\n"
8187 "Do not advertise to any peer (well-known community)\n"
8188 "Do not export to next AS (well-known community)\n"
8189 "community number\n"
8190 "Do not send outside local AS (well-known community)\n"
8191 "Do not advertise to any peer (well-known community)\n"
8192 "Do not export to next AS (well-known community)\n"
8193 "community number\n"
8194 "Do not send outside local AS (well-known community)\n"
8195 "Do not advertise to any peer (well-known community)\n"
8196 "Do not export to next AS (well-known community)\n"
8197 "Exact match of the communities")
8199 DEFUN (show_ip_bgp_ipv4_community_exact
,
8200 show_ip_bgp_ipv4_community_exact_cmd
,
8201 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8206 "Address Family modifier\n"
8207 "Address Family modifier\n"
8208 "Display routes matching the communities\n"
8209 "community number\n"
8210 "Do not send outside local AS (well-known community)\n"
8211 "Do not advertise to any peer (well-known community)\n"
8212 "Do not export to next AS (well-known community)\n"
8213 "Exact match of the communities")
8215 if (strncmp (argv
[0], "m", 1) == 0)
8216 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP
, SAFI_MULTICAST
);
8218 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
8221 ALIAS (show_ip_bgp_ipv4_community_exact
,
8222 show_ip_bgp_ipv4_community2_exact_cmd
,
8223 "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",
8228 "Address Family modifier\n"
8229 "Address Family modifier\n"
8230 "Display routes matching the communities\n"
8231 "community number\n"
8232 "Do not send outside local AS (well-known community)\n"
8233 "Do not advertise to any peer (well-known community)\n"
8234 "Do not export to next AS (well-known community)\n"
8235 "community number\n"
8236 "Do not send outside local AS (well-known community)\n"
8237 "Do not advertise to any peer (well-known community)\n"
8238 "Do not export to next AS (well-known community)\n"
8239 "Exact match of the communities")
8241 ALIAS (show_ip_bgp_ipv4_community_exact
,
8242 show_ip_bgp_ipv4_community3_exact_cmd
,
8243 "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",
8248 "Address Family modifier\n"
8249 "Address Family modifier\n"
8250 "Display routes matching the communities\n"
8251 "community number\n"
8252 "Do not send outside local AS (well-known community)\n"
8253 "Do not advertise to any peer (well-known community)\n"
8254 "Do not export to next AS (well-known community)\n"
8255 "community number\n"
8256 "Do not send outside local AS (well-known community)\n"
8257 "Do not advertise to any peer (well-known community)\n"
8258 "Do not export to next AS (well-known community)\n"
8259 "community number\n"
8260 "Do not send outside local AS (well-known community)\n"
8261 "Do not advertise to any peer (well-known community)\n"
8262 "Do not export to next AS (well-known community)\n"
8263 "Exact match of the communities")
8265 ALIAS (show_ip_bgp_ipv4_community_exact
,
8266 show_ip_bgp_ipv4_community4_exact_cmd
,
8267 "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",
8272 "Address Family modifier\n"
8273 "Address Family modifier\n"
8274 "Display routes matching the communities\n"
8275 "community number\n"
8276 "Do not send outside local AS (well-known community)\n"
8277 "Do not advertise to any peer (well-known community)\n"
8278 "Do not export to next AS (well-known community)\n"
8279 "community number\n"
8280 "Do not send outside local AS (well-known community)\n"
8281 "Do not advertise to any peer (well-known community)\n"
8282 "Do not export to next AS (well-known community)\n"
8283 "community number\n"
8284 "Do not send outside local AS (well-known community)\n"
8285 "Do not advertise to any peer (well-known community)\n"
8286 "Do not export to next AS (well-known community)\n"
8287 "community number\n"
8288 "Do not send outside local AS (well-known community)\n"
8289 "Do not advertise to any peer (well-known community)\n"
8290 "Do not export to next AS (well-known community)\n"
8291 "Exact match of the communities")
8294 DEFUN (show_bgp_community
,
8295 show_bgp_community_cmd
,
8296 "show bgp community (AA:NN|local-AS|no-advertise|no-export)",
8299 "Display routes matching the communities\n"
8300 "community number\n"
8301 "Do not send outside local AS (well-known community)\n"
8302 "Do not advertise to any peer (well-known community)\n"
8303 "Do not export to next AS (well-known community)\n")
8305 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
8308 ALIAS (show_bgp_community
,
8309 show_bgp_ipv6_community_cmd
,
8310 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)",
8314 "Display routes matching the communities\n"
8315 "community number\n"
8316 "Do not send outside local AS (well-known community)\n"
8317 "Do not advertise to any peer (well-known community)\n"
8318 "Do not export to next AS (well-known community)\n")
8320 ALIAS (show_bgp_community
,
8321 show_bgp_community2_cmd
,
8322 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8325 "Display routes matching the communities\n"
8326 "community number\n"
8327 "Do not send outside local AS (well-known community)\n"
8328 "Do not advertise to any peer (well-known community)\n"
8329 "Do not export to next AS (well-known community)\n"
8330 "community number\n"
8331 "Do not send outside local AS (well-known community)\n"
8332 "Do not advertise to any peer (well-known community)\n"
8333 "Do not export to next AS (well-known community)\n")
8335 ALIAS (show_bgp_community
,
8336 show_bgp_ipv6_community2_cmd
,
8337 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8341 "Display routes matching the communities\n"
8342 "community number\n"
8343 "Do not send outside local AS (well-known community)\n"
8344 "Do not advertise to any peer (well-known community)\n"
8345 "Do not export to next AS (well-known community)\n"
8346 "community number\n"
8347 "Do not send outside local AS (well-known community)\n"
8348 "Do not advertise to any peer (well-known community)\n"
8349 "Do not export to next AS (well-known community)\n")
8351 ALIAS (show_bgp_community
,
8352 show_bgp_community3_cmd
,
8353 "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)",
8356 "Display routes matching the communities\n"
8357 "community number\n"
8358 "Do not send outside local AS (well-known community)\n"
8359 "Do not advertise to any peer (well-known community)\n"
8360 "Do not export to next AS (well-known community)\n"
8361 "community number\n"
8362 "Do not send outside local AS (well-known community)\n"
8363 "Do not advertise to any peer (well-known community)\n"
8364 "Do not export to next AS (well-known community)\n"
8365 "community number\n"
8366 "Do not send outside local AS (well-known community)\n"
8367 "Do not advertise to any peer (well-known community)\n"
8368 "Do not export to next AS (well-known community)\n")
8370 ALIAS (show_bgp_community
,
8371 show_bgp_ipv6_community3_cmd
,
8372 "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)",
8376 "Display routes matching the communities\n"
8377 "community number\n"
8378 "Do not send outside local AS (well-known community)\n"
8379 "Do not advertise to any peer (well-known community)\n"
8380 "Do not export to next AS (well-known community)\n"
8381 "community number\n"
8382 "Do not send outside local AS (well-known community)\n"
8383 "Do not advertise to any peer (well-known community)\n"
8384 "Do not export to next AS (well-known community)\n"
8385 "community number\n"
8386 "Do not send outside local AS (well-known community)\n"
8387 "Do not advertise to any peer (well-known community)\n"
8388 "Do not export to next AS (well-known community)\n")
8390 ALIAS (show_bgp_community
,
8391 show_bgp_community4_cmd
,
8392 "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)",
8395 "Display routes matching the communities\n"
8396 "community number\n"
8397 "Do not send outside local AS (well-known community)\n"
8398 "Do not advertise to any peer (well-known community)\n"
8399 "Do not export to next AS (well-known community)\n"
8400 "community number\n"
8401 "Do not send outside local AS (well-known community)\n"
8402 "Do not advertise to any peer (well-known community)\n"
8403 "Do not export to next AS (well-known community)\n"
8404 "community number\n"
8405 "Do not send outside local AS (well-known community)\n"
8406 "Do not advertise to any peer (well-known community)\n"
8407 "Do not export to next AS (well-known community)\n"
8408 "community number\n"
8409 "Do not send outside local AS (well-known community)\n"
8410 "Do not advertise to any peer (well-known community)\n"
8411 "Do not export to next AS (well-known community)\n")
8413 ALIAS (show_bgp_community
,
8414 show_bgp_ipv6_community4_cmd
,
8415 "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)",
8419 "Display routes matching the communities\n"
8420 "community number\n"
8421 "Do not send outside local AS (well-known community)\n"
8422 "Do not advertise to any peer (well-known community)\n"
8423 "Do not export to next AS (well-known community)\n"
8424 "community number\n"
8425 "Do not send outside local AS (well-known community)\n"
8426 "Do not advertise to any peer (well-known community)\n"
8427 "Do not export to next AS (well-known community)\n"
8428 "community number\n"
8429 "Do not send outside local AS (well-known community)\n"
8430 "Do not advertise to any peer (well-known community)\n"
8431 "Do not export to next AS (well-known community)\n"
8432 "community number\n"
8433 "Do not send outside local AS (well-known community)\n"
8434 "Do not advertise to any peer (well-known community)\n"
8435 "Do not export to next AS (well-known community)\n")
8438 DEFUN (show_ipv6_bgp_community
,
8439 show_ipv6_bgp_community_cmd
,
8440 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export)",
8444 "Display routes matching the communities\n"
8445 "community number\n"
8446 "Do not send outside local AS (well-known community)\n"
8447 "Do not advertise to any peer (well-known community)\n"
8448 "Do not export to next AS (well-known community)\n")
8450 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
8454 ALIAS (show_ipv6_bgp_community
,
8455 show_ipv6_bgp_community2_cmd
,
8456 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8460 "Display routes matching the communities\n"
8461 "community number\n"
8462 "Do not send outside local AS (well-known community)\n"
8463 "Do not advertise to any peer (well-known community)\n"
8464 "Do not export to next AS (well-known community)\n"
8465 "community number\n"
8466 "Do not send outside local AS (well-known community)\n"
8467 "Do not advertise to any peer (well-known community)\n"
8468 "Do not export to next AS (well-known community)\n")
8471 ALIAS (show_ipv6_bgp_community
,
8472 show_ipv6_bgp_community3_cmd
,
8473 "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)",
8477 "Display routes matching the communities\n"
8478 "community number\n"
8479 "Do not send outside local AS (well-known community)\n"
8480 "Do not advertise to any peer (well-known community)\n"
8481 "Do not export to next AS (well-known community)\n"
8482 "community number\n"
8483 "Do not send outside local AS (well-known community)\n"
8484 "Do not advertise to any peer (well-known community)\n"
8485 "Do not export to next AS (well-known community)\n"
8486 "community number\n"
8487 "Do not send outside local AS (well-known community)\n"
8488 "Do not advertise to any peer (well-known community)\n"
8489 "Do not export to next AS (well-known community)\n")
8492 ALIAS (show_ipv6_bgp_community
,
8493 show_ipv6_bgp_community4_cmd
,
8494 "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)",
8498 "Display routes matching the communities\n"
8499 "community number\n"
8500 "Do not send outside local AS (well-known community)\n"
8501 "Do not advertise to any peer (well-known community)\n"
8502 "Do not export to next AS (well-known community)\n"
8503 "community number\n"
8504 "Do not send outside local AS (well-known community)\n"
8505 "Do not advertise to any peer (well-known community)\n"
8506 "Do not export to next AS (well-known community)\n"
8507 "community number\n"
8508 "Do not send outside local AS (well-known community)\n"
8509 "Do not advertise to any peer (well-known community)\n"
8510 "Do not export to next AS (well-known community)\n"
8511 "community number\n"
8512 "Do not send outside local AS (well-known community)\n"
8513 "Do not advertise to any peer (well-known community)\n"
8514 "Do not export to next AS (well-known community)\n")
8516 DEFUN (show_bgp_community_exact
,
8517 show_bgp_community_exact_cmd
,
8518 "show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8521 "Display routes matching the communities\n"
8522 "community number\n"
8523 "Do not send outside local AS (well-known community)\n"
8524 "Do not advertise to any peer (well-known community)\n"
8525 "Do not export to next AS (well-known community)\n"
8526 "Exact match of the communities")
8528 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
8531 ALIAS (show_bgp_community_exact
,
8532 show_bgp_ipv6_community_exact_cmd
,
8533 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8537 "Display routes matching the communities\n"
8538 "community number\n"
8539 "Do not send outside local AS (well-known community)\n"
8540 "Do not advertise to any peer (well-known community)\n"
8541 "Do not export to next AS (well-known community)\n"
8542 "Exact match of the communities")
8544 ALIAS (show_bgp_community_exact
,
8545 show_bgp_community2_exact_cmd
,
8546 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8549 "Display routes matching the communities\n"
8550 "community number\n"
8551 "Do not send outside local AS (well-known community)\n"
8552 "Do not advertise to any peer (well-known community)\n"
8553 "Do not export to next AS (well-known community)\n"
8554 "community number\n"
8555 "Do not send outside local AS (well-known community)\n"
8556 "Do not advertise to any peer (well-known community)\n"
8557 "Do not export to next AS (well-known community)\n"
8558 "Exact match of the communities")
8560 ALIAS (show_bgp_community_exact
,
8561 show_bgp_ipv6_community2_exact_cmd
,
8562 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8566 "Display routes matching the communities\n"
8567 "community number\n"
8568 "Do not send outside local AS (well-known community)\n"
8569 "Do not advertise to any peer (well-known community)\n"
8570 "Do not export to next AS (well-known community)\n"
8571 "community number\n"
8572 "Do not send outside local AS (well-known community)\n"
8573 "Do not advertise to any peer (well-known community)\n"
8574 "Do not export to next AS (well-known community)\n"
8575 "Exact match of the communities")
8577 ALIAS (show_bgp_community_exact
,
8578 show_bgp_community3_exact_cmd
,
8579 "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",
8582 "Display routes matching the communities\n"
8583 "community number\n"
8584 "Do not send outside local AS (well-known community)\n"
8585 "Do not advertise to any peer (well-known community)\n"
8586 "Do not export to next AS (well-known community)\n"
8587 "community number\n"
8588 "Do not send outside local AS (well-known community)\n"
8589 "Do not advertise to any peer (well-known community)\n"
8590 "Do not export to next AS (well-known community)\n"
8591 "community number\n"
8592 "Do not send outside local AS (well-known community)\n"
8593 "Do not advertise to any peer (well-known community)\n"
8594 "Do not export to next AS (well-known community)\n"
8595 "Exact match of the communities")
8597 ALIAS (show_bgp_community_exact
,
8598 show_bgp_ipv6_community3_exact_cmd
,
8599 "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",
8603 "Display routes matching the communities\n"
8604 "community number\n"
8605 "Do not send outside local AS (well-known community)\n"
8606 "Do not advertise to any peer (well-known community)\n"
8607 "Do not export to next AS (well-known community)\n"
8608 "community number\n"
8609 "Do not send outside local AS (well-known community)\n"
8610 "Do not advertise to any peer (well-known community)\n"
8611 "Do not export to next AS (well-known community)\n"
8612 "community number\n"
8613 "Do not send outside local AS (well-known community)\n"
8614 "Do not advertise to any peer (well-known community)\n"
8615 "Do not export to next AS (well-known community)\n"
8616 "Exact match of the communities")
8618 ALIAS (show_bgp_community_exact
,
8619 show_bgp_community4_exact_cmd
,
8620 "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",
8623 "Display routes matching the communities\n"
8624 "community number\n"
8625 "Do not send outside local AS (well-known community)\n"
8626 "Do not advertise to any peer (well-known community)\n"
8627 "Do not export to next AS (well-known community)\n"
8628 "community number\n"
8629 "Do not send outside local AS (well-known community)\n"
8630 "Do not advertise to any peer (well-known community)\n"
8631 "Do not export to next AS (well-known community)\n"
8632 "community number\n"
8633 "Do not send outside local AS (well-known community)\n"
8634 "Do not advertise to any peer (well-known community)\n"
8635 "Do not export to next AS (well-known community)\n"
8636 "community number\n"
8637 "Do not send outside local AS (well-known community)\n"
8638 "Do not advertise to any peer (well-known community)\n"
8639 "Do not export to next AS (well-known community)\n"
8640 "Exact match of the communities")
8642 ALIAS (show_bgp_community_exact
,
8643 show_bgp_ipv6_community4_exact_cmd
,
8644 "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",
8648 "Display routes matching the communities\n"
8649 "community number\n"
8650 "Do not send outside local AS (well-known community)\n"
8651 "Do not advertise to any peer (well-known community)\n"
8652 "Do not export to next AS (well-known community)\n"
8653 "community number\n"
8654 "Do not send outside local AS (well-known community)\n"
8655 "Do not advertise to any peer (well-known community)\n"
8656 "Do not export to next AS (well-known community)\n"
8657 "community number\n"
8658 "Do not send outside local AS (well-known community)\n"
8659 "Do not advertise to any peer (well-known community)\n"
8660 "Do not export to next AS (well-known community)\n"
8661 "community number\n"
8662 "Do not send outside local AS (well-known community)\n"
8663 "Do not advertise to any peer (well-known community)\n"
8664 "Do not export to next AS (well-known community)\n"
8665 "Exact match of the communities")
8668 DEFUN (show_ipv6_bgp_community_exact
,
8669 show_ipv6_bgp_community_exact_cmd
,
8670 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8674 "Display routes matching the communities\n"
8675 "community number\n"
8676 "Do not send outside local AS (well-known community)\n"
8677 "Do not advertise to any peer (well-known community)\n"
8678 "Do not export to next AS (well-known community)\n"
8679 "Exact match of the communities")
8681 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
8685 ALIAS (show_ipv6_bgp_community_exact
,
8686 show_ipv6_bgp_community2_exact_cmd
,
8687 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8691 "Display routes matching the communities\n"
8692 "community number\n"
8693 "Do not send outside local AS (well-known community)\n"
8694 "Do not advertise to any peer (well-known community)\n"
8695 "Do not export to next AS (well-known community)\n"
8696 "community number\n"
8697 "Do not send outside local AS (well-known community)\n"
8698 "Do not advertise to any peer (well-known community)\n"
8699 "Do not export to next AS (well-known community)\n"
8700 "Exact match of the communities")
8703 ALIAS (show_ipv6_bgp_community_exact
,
8704 show_ipv6_bgp_community3_exact_cmd
,
8705 "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",
8709 "Display routes matching the communities\n"
8710 "community number\n"
8711 "Do not send outside local AS (well-known community)\n"
8712 "Do not advertise to any peer (well-known community)\n"
8713 "Do not export to next AS (well-known community)\n"
8714 "community number\n"
8715 "Do not send outside local AS (well-known community)\n"
8716 "Do not advertise to any peer (well-known community)\n"
8717 "Do not export to next AS (well-known community)\n"
8718 "community number\n"
8719 "Do not send outside local AS (well-known community)\n"
8720 "Do not advertise to any peer (well-known community)\n"
8721 "Do not export to next AS (well-known community)\n"
8722 "Exact match of the communities")
8725 ALIAS (show_ipv6_bgp_community_exact
,
8726 show_ipv6_bgp_community4_exact_cmd
,
8727 "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",
8731 "Display routes matching the communities\n"
8732 "community number\n"
8733 "Do not send outside local AS (well-known community)\n"
8734 "Do not advertise to any peer (well-known community)\n"
8735 "Do not export to next AS (well-known community)\n"
8736 "community number\n"
8737 "Do not send outside local AS (well-known community)\n"
8738 "Do not advertise to any peer (well-known community)\n"
8739 "Do not export to next AS (well-known community)\n"
8740 "community number\n"
8741 "Do not send outside local AS (well-known community)\n"
8742 "Do not advertise to any peer (well-known community)\n"
8743 "Do not export to next AS (well-known community)\n"
8744 "community number\n"
8745 "Do not send outside local AS (well-known community)\n"
8746 "Do not advertise to any peer (well-known community)\n"
8747 "Do not export to next AS (well-known community)\n"
8748 "Exact match of the communities")
8751 DEFUN (show_ipv6_mbgp_community
,
8752 show_ipv6_mbgp_community_cmd
,
8753 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export)",
8757 "Display routes matching the communities\n"
8758 "community number\n"
8759 "Do not send outside local AS (well-known community)\n"
8760 "Do not advertise to any peer (well-known community)\n"
8761 "Do not export to next AS (well-known community)\n")
8763 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP6
, SAFI_MULTICAST
);
8767 ALIAS (show_ipv6_mbgp_community
,
8768 show_ipv6_mbgp_community2_cmd
,
8769 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8773 "Display routes matching the communities\n"
8774 "community number\n"
8775 "Do not send outside local AS (well-known community)\n"
8776 "Do not advertise to any peer (well-known community)\n"
8777 "Do not export to next AS (well-known community)\n"
8778 "community number\n"
8779 "Do not send outside local AS (well-known community)\n"
8780 "Do not advertise to any peer (well-known community)\n"
8781 "Do not export to next AS (well-known community)\n")
8784 ALIAS (show_ipv6_mbgp_community
,
8785 show_ipv6_mbgp_community3_cmd
,
8786 "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)",
8790 "Display routes matching the communities\n"
8791 "community number\n"
8792 "Do not send outside local AS (well-known community)\n"
8793 "Do not advertise to any peer (well-known community)\n"
8794 "Do not export to next AS (well-known community)\n"
8795 "community number\n"
8796 "Do not send outside local AS (well-known community)\n"
8797 "Do not advertise to any peer (well-known community)\n"
8798 "Do not export to next AS (well-known community)\n"
8799 "community number\n"
8800 "Do not send outside local AS (well-known community)\n"
8801 "Do not advertise to any peer (well-known community)\n"
8802 "Do not export to next AS (well-known community)\n")
8805 ALIAS (show_ipv6_mbgp_community
,
8806 show_ipv6_mbgp_community4_cmd
,
8807 "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)",
8811 "Display routes matching the communities\n"
8812 "community number\n"
8813 "Do not send outside local AS (well-known community)\n"
8814 "Do not advertise to any peer (well-known community)\n"
8815 "Do not export to next AS (well-known community)\n"
8816 "community number\n"
8817 "Do not send outside local AS (well-known community)\n"
8818 "Do not advertise to any peer (well-known community)\n"
8819 "Do not export to next AS (well-known community)\n"
8820 "community number\n"
8821 "Do not send outside local AS (well-known community)\n"
8822 "Do not advertise to any peer (well-known community)\n"
8823 "Do not export to next AS (well-known community)\n"
8824 "community number\n"
8825 "Do not send outside local AS (well-known community)\n"
8826 "Do not advertise to any peer (well-known community)\n"
8827 "Do not export to next AS (well-known community)\n")
8830 DEFUN (show_ipv6_mbgp_community_exact
,
8831 show_ipv6_mbgp_community_exact_cmd
,
8832 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8836 "Display routes matching the communities\n"
8837 "community number\n"
8838 "Do not send outside local AS (well-known community)\n"
8839 "Do not advertise to any peer (well-known community)\n"
8840 "Do not export to next AS (well-known community)\n"
8841 "Exact match of the communities")
8843 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP6
, SAFI_MULTICAST
);
8847 ALIAS (show_ipv6_mbgp_community_exact
,
8848 show_ipv6_mbgp_community2_exact_cmd
,
8849 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8853 "Display routes matching the communities\n"
8854 "community number\n"
8855 "Do not send outside local AS (well-known community)\n"
8856 "Do not advertise to any peer (well-known community)\n"
8857 "Do not export to next AS (well-known community)\n"
8858 "community number\n"
8859 "Do not send outside local AS (well-known community)\n"
8860 "Do not advertise to any peer (well-known community)\n"
8861 "Do not export to next AS (well-known community)\n"
8862 "Exact match of the communities")
8865 ALIAS (show_ipv6_mbgp_community_exact
,
8866 show_ipv6_mbgp_community3_exact_cmd
,
8867 "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",
8871 "Display routes matching the communities\n"
8872 "community number\n"
8873 "Do not send outside local AS (well-known community)\n"
8874 "Do not advertise to any peer (well-known community)\n"
8875 "Do not export to next AS (well-known community)\n"
8876 "community number\n"
8877 "Do not send outside local AS (well-known community)\n"
8878 "Do not advertise to any peer (well-known community)\n"
8879 "Do not export to next AS (well-known community)\n"
8880 "community number\n"
8881 "Do not send outside local AS (well-known community)\n"
8882 "Do not advertise to any peer (well-known community)\n"
8883 "Do not export to next AS (well-known community)\n"
8884 "Exact match of the communities")
8887 ALIAS (show_ipv6_mbgp_community_exact
,
8888 show_ipv6_mbgp_community4_exact_cmd
,
8889 "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",
8893 "Display routes matching the communities\n"
8894 "community number\n"
8895 "Do not send outside local AS (well-known community)\n"
8896 "Do not advertise to any peer (well-known community)\n"
8897 "Do not export to next AS (well-known community)\n"
8898 "community number\n"
8899 "Do not send outside local AS (well-known community)\n"
8900 "Do not advertise to any peer (well-known community)\n"
8901 "Do not export to next AS (well-known community)\n"
8902 "community number\n"
8903 "Do not send outside local AS (well-known community)\n"
8904 "Do not advertise to any peer (well-known community)\n"
8905 "Do not export to next AS (well-known community)\n"
8906 "community number\n"
8907 "Do not send outside local AS (well-known community)\n"
8908 "Do not advertise to any peer (well-known community)\n"
8909 "Do not export to next AS (well-known community)\n"
8910 "Exact match of the communities")
8911 #endif /* HAVE_IPV6 */
8914 bgp_show_community_list (struct vty
*vty
, const char *com
, int exact
,
8915 afi_t afi
, safi_t safi
)
8917 struct community_list
*list
;
8919 list
= community_list_lookup (bgp_clist
, com
, COMMUNITY_LIST_MASTER
);
8922 vty_out (vty
, "%% %s is not a valid community-list name%s", com
,
8927 return bgp_show (vty
, NULL
, afi
, safi
,
8928 (exact
? bgp_show_type_community_list_exact
:
8929 bgp_show_type_community_list
), list
);
8932 DEFUN (show_ip_bgp_community_list
,
8933 show_ip_bgp_community_list_cmd
,
8934 "show ip bgp community-list (<1-500>|WORD)",
8938 "Display routes matching the community-list\n"
8939 "community-list number\n"
8940 "community-list name\n")
8942 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP
, SAFI_UNICAST
);
8945 DEFUN (show_ip_bgp_ipv4_community_list
,
8946 show_ip_bgp_ipv4_community_list_cmd
,
8947 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)",
8952 "Address Family modifier\n"
8953 "Address Family modifier\n"
8954 "Display routes matching the community-list\n"
8955 "community-list number\n"
8956 "community-list name\n")
8958 if (strncmp (argv
[0], "m", 1) == 0)
8959 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_MULTICAST
);
8961 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_UNICAST
);
8964 DEFUN (show_ip_bgp_community_list_exact
,
8965 show_ip_bgp_community_list_exact_cmd
,
8966 "show ip bgp community-list (<1-500>|WORD) exact-match",
8970 "Display routes matching the community-list\n"
8971 "community-list number\n"
8972 "community-list name\n"
8973 "Exact match of the communities\n")
8975 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP
, SAFI_UNICAST
);
8978 DEFUN (show_ip_bgp_ipv4_community_list_exact
,
8979 show_ip_bgp_ipv4_community_list_exact_cmd
,
8980 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match",
8985 "Address Family modifier\n"
8986 "Address Family modifier\n"
8987 "Display routes matching the community-list\n"
8988 "community-list number\n"
8989 "community-list name\n"
8990 "Exact match of the communities\n")
8992 if (strncmp (argv
[0], "m", 1) == 0)
8993 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_MULTICAST
);
8995 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_UNICAST
);
8999 DEFUN (show_bgp_community_list
,
9000 show_bgp_community_list_cmd
,
9001 "show bgp community-list (<1-500>|WORD)",
9004 "Display routes matching the community-list\n"
9005 "community-list number\n"
9006 "community-list name\n")
9008 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
9011 ALIAS (show_bgp_community_list
,
9012 show_bgp_ipv6_community_list_cmd
,
9013 "show bgp ipv6 community-list (<1-500>|WORD)",
9017 "Display routes matching the community-list\n"
9018 "community-list number\n"
9019 "community-list name\n")
9022 DEFUN (show_ipv6_bgp_community_list
,
9023 show_ipv6_bgp_community_list_cmd
,
9024 "show ipv6 bgp community-list WORD",
9028 "Display routes matching the community-list\n"
9029 "community-list name\n")
9031 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
9035 DEFUN (show_ipv6_mbgp_community_list
,
9036 show_ipv6_mbgp_community_list_cmd
,
9037 "show ipv6 mbgp community-list WORD",
9041 "Display routes matching the community-list\n"
9042 "community-list name\n")
9044 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_MULTICAST
);
9047 DEFUN (show_bgp_community_list_exact
,
9048 show_bgp_community_list_exact_cmd
,
9049 "show bgp community-list (<1-500>|WORD) exact-match",
9052 "Display routes matching the community-list\n"
9053 "community-list number\n"
9054 "community-list name\n"
9055 "Exact match of the communities\n")
9057 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
9060 ALIAS (show_bgp_community_list_exact
,
9061 show_bgp_ipv6_community_list_exact_cmd
,
9062 "show bgp ipv6 community-list (<1-500>|WORD) exact-match",
9066 "Display routes matching the community-list\n"
9067 "community-list number\n"
9068 "community-list name\n"
9069 "Exact match of the communities\n")
9072 DEFUN (show_ipv6_bgp_community_list_exact
,
9073 show_ipv6_bgp_community_list_exact_cmd
,
9074 "show ipv6 bgp community-list WORD exact-match",
9078 "Display routes matching the community-list\n"
9079 "community-list name\n"
9080 "Exact match of the communities\n")
9082 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
9086 DEFUN (show_ipv6_mbgp_community_list_exact
,
9087 show_ipv6_mbgp_community_list_exact_cmd
,
9088 "show ipv6 mbgp community-list WORD exact-match",
9092 "Display routes matching the community-list\n"
9093 "community-list name\n"
9094 "Exact match of the communities\n")
9096 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_MULTICAST
);
9098 #endif /* HAVE_IPV6 */
9101 bgp_show_prefix_longer (struct vty
*vty
, const char *prefix
, afi_t afi
,
9102 safi_t safi
, enum bgp_show_type type
)
9109 ret
= str2prefix (prefix
, p
);
9112 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
9116 ret
= bgp_show (vty
, NULL
, afi
, safi
, type
, p
);
9121 DEFUN (show_ip_bgp_prefix_longer
,
9122 show_ip_bgp_prefix_longer_cmd
,
9123 "show ip bgp A.B.C.D/M longer-prefixes",
9127 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
9128 "Display route and more specific routes\n")
9130 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
9131 bgp_show_type_prefix_longer
);
9134 DEFUN (show_ip_bgp_flap_prefix_longer
,
9135 show_ip_bgp_flap_prefix_longer_cmd
,
9136 "show ip bgp flap-statistics A.B.C.D/M longer-prefixes",
9140 "Display flap statistics of routes\n"
9141 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
9142 "Display route and more specific routes\n")
9144 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
9145 bgp_show_type_flap_prefix_longer
);
9148 DEFUN (show_ip_bgp_ipv4_prefix_longer
,
9149 show_ip_bgp_ipv4_prefix_longer_cmd
,
9150 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes",
9155 "Address Family modifier\n"
9156 "Address Family modifier\n"
9157 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
9158 "Display route and more specific routes\n")
9160 if (strncmp (argv
[0], "m", 1) == 0)
9161 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
9162 bgp_show_type_prefix_longer
);
9164 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
9165 bgp_show_type_prefix_longer
);
9168 DEFUN (show_ip_bgp_flap_address
,
9169 show_ip_bgp_flap_address_cmd
,
9170 "show ip bgp flap-statistics A.B.C.D",
9174 "Display flap statistics of routes\n"
9175 "Network in the BGP routing table to display\n")
9177 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
9178 bgp_show_type_flap_address
);
9181 DEFUN (show_ip_bgp_flap_prefix
,
9182 show_ip_bgp_flap_prefix_cmd
,
9183 "show ip bgp flap-statistics A.B.C.D/M",
9187 "Display flap statistics of routes\n"
9188 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
9190 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
9191 bgp_show_type_flap_prefix
);
9194 DEFUN (show_bgp_prefix_longer
,
9195 show_bgp_prefix_longer_cmd
,
9196 "show bgp X:X::X:X/M longer-prefixes",
9199 "IPv6 prefix <network>/<length>\n"
9200 "Display route and more specific routes\n")
9202 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
9203 bgp_show_type_prefix_longer
);
9206 ALIAS (show_bgp_prefix_longer
,
9207 show_bgp_ipv6_prefix_longer_cmd
,
9208 "show bgp ipv6 X:X::X:X/M longer-prefixes",
9212 "IPv6 prefix <network>/<length>\n"
9213 "Display route and more specific routes\n")
9216 DEFUN (show_ipv6_bgp_prefix_longer
,
9217 show_ipv6_bgp_prefix_longer_cmd
,
9218 "show ipv6 bgp X:X::X:X/M longer-prefixes",
9222 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
9223 "Display route and more specific routes\n")
9225 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
9226 bgp_show_type_prefix_longer
);
9230 DEFUN (show_ipv6_mbgp_prefix_longer
,
9231 show_ipv6_mbgp_prefix_longer_cmd
,
9232 "show ipv6 mbgp X:X::X:X/M longer-prefixes",
9236 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
9237 "Display route and more specific routes\n")
9239 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
9240 bgp_show_type_prefix_longer
);
9242 #endif /* HAVE_IPV6 */
9244 static struct peer
*
9245 peer_lookup_in_view (struct vty
*vty
, const char *view_name
,
9253 /* BGP structure lookup. */
9256 bgp
= bgp_lookup_by_name (view_name
);
9259 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
9265 bgp
= bgp_get_default ();
9268 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9273 /* Get peer sockunion. */
9274 ret
= str2sockunion (ip_str
, &su
);
9277 vty_out (vty
, "Malformed address: %s%s", ip_str
, VTY_NEWLINE
);
9281 /* Peer structure lookup. */
9282 peer
= peer_lookup (bgp
, &su
);
9285 vty_out (vty
, "No such neighbor%s", VTY_NEWLINE
);
9294 BGP_STATS_MAXBITLEN
= 0,
9298 BGP_STATS_UNAGGREGATEABLE
,
9299 BGP_STATS_MAX_AGGREGATEABLE
,
9300 BGP_STATS_AGGREGATES
,
9302 BGP_STATS_ASPATH_COUNT
,
9303 BGP_STATS_ASPATH_MAXHOPS
,
9304 BGP_STATS_ASPATH_TOTHOPS
,
9305 BGP_STATS_ASPATH_MAXSIZE
,
9306 BGP_STATS_ASPATH_TOTSIZE
,
9307 BGP_STATS_ASN_HIGHEST
,
9311 static const char *table_stats_strs
[] =
9313 [BGP_STATS_PREFIXES
] = "Total Prefixes",
9314 [BGP_STATS_TOTPLEN
] = "Average prefix length",
9315 [BGP_STATS_RIB
] = "Total Advertisements",
9316 [BGP_STATS_UNAGGREGATEABLE
] = "Unaggregateable prefixes",
9317 [BGP_STATS_MAX_AGGREGATEABLE
] = "Maximum aggregateable prefixes",
9318 [BGP_STATS_AGGREGATES
] = "BGP Aggregate advertisements",
9319 [BGP_STATS_SPACE
] = "Address space advertised",
9320 [BGP_STATS_ASPATH_COUNT
] = "Advertisements with paths",
9321 [BGP_STATS_ASPATH_MAXHOPS
] = "Longest AS-Path (hops)",
9322 [BGP_STATS_ASPATH_MAXSIZE
] = "Largest AS-Path (bytes)",
9323 [BGP_STATS_ASPATH_TOTHOPS
] = "Average AS-Path length (hops)",
9324 [BGP_STATS_ASPATH_TOTSIZE
] = "Average AS-Path size (bytes)",
9325 [BGP_STATS_ASN_HIGHEST
] = "Highest public ASN",
9326 [BGP_STATS_MAX
] = NULL
,
9329 struct bgp_table_stats
9331 struct bgp_table
*table
;
9332 unsigned long long counts
[BGP_STATS_MAX
];
9336 #define TALLY_SIGFIG 100000
9337 static unsigned long
9338 ravg_tally (unsigned long count
, unsigned long oldavg
, unsigned long newval
)
9340 unsigned long newtot
= (count
-1) * oldavg
+ (newval
* TALLY_SIGFIG
);
9341 unsigned long res
= (newtot
* TALLY_SIGFIG
) / count
;
9342 unsigned long ret
= newtot
/ count
;
9344 if ((res
% TALLY_SIGFIG
) > (TALLY_SIGFIG
/2))
9352 bgp_table_stats_walker (struct thread
*t
)
9354 struct bgp_node
*rn
;
9355 struct bgp_node
*top
;
9356 struct bgp_table_stats
*ts
= THREAD_ARG (t
);
9357 unsigned int space
= 0;
9359 if (!(top
= bgp_table_top (ts
->table
)))
9362 switch (top
->p
.family
)
9365 space
= IPV4_MAX_BITLEN
;
9368 space
= IPV6_MAX_BITLEN
;
9372 ts
->counts
[BGP_STATS_MAXBITLEN
] = space
;
9374 for (rn
= top
; rn
; rn
= bgp_route_next (rn
))
9376 struct bgp_info
*ri
;
9377 struct bgp_node
*prn
= bgp_node_parent_nolock (rn
);
9378 unsigned int rinum
= 0;
9386 ts
->counts
[BGP_STATS_PREFIXES
]++;
9387 ts
->counts
[BGP_STATS_TOTPLEN
] += rn
->p
.prefixlen
;
9390 ts
->counts
[BGP_STATS_AVGPLEN
]
9391 = ravg_tally (ts
->counts
[BGP_STATS_PREFIXES
],
9392 ts
->counts
[BGP_STATS_AVGPLEN
],
9396 /* check if the prefix is included by any other announcements */
9397 while (prn
&& !prn
->info
)
9398 prn
= bgp_node_parent_nolock (prn
);
9400 if (prn
== NULL
|| prn
== top
)
9402 ts
->counts
[BGP_STATS_UNAGGREGATEABLE
]++;
9403 /* announced address space */
9405 ts
->counts
[BGP_STATS_SPACE
] += 1 << (space
- rn
->p
.prefixlen
);
9408 ts
->counts
[BGP_STATS_MAX_AGGREGATEABLE
]++;
9410 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
9413 ts
->counts
[BGP_STATS_RIB
]++;
9416 (CHECK_FLAG (ri
->attr
->flag
,
9417 ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
))))
9418 ts
->counts
[BGP_STATS_AGGREGATES
]++;
9421 if (ri
->attr
&& ri
->attr
->aspath
)
9423 unsigned int hops
= aspath_count_hops (ri
->attr
->aspath
);
9424 unsigned int size
= aspath_size (ri
->attr
->aspath
);
9425 as_t highest
= aspath_highest (ri
->attr
->aspath
);
9427 ts
->counts
[BGP_STATS_ASPATH_COUNT
]++;
9429 if (hops
> ts
->counts
[BGP_STATS_ASPATH_MAXHOPS
])
9430 ts
->counts
[BGP_STATS_ASPATH_MAXHOPS
] = hops
;
9432 if (size
> ts
->counts
[BGP_STATS_ASPATH_MAXSIZE
])
9433 ts
->counts
[BGP_STATS_ASPATH_MAXSIZE
] = size
;
9435 ts
->counts
[BGP_STATS_ASPATH_TOTHOPS
] += hops
;
9436 ts
->counts
[BGP_STATS_ASPATH_TOTSIZE
] += size
;
9438 ts
->counts
[BGP_STATS_ASPATH_AVGHOPS
]
9439 = ravg_tally (ts
->counts
[BGP_STATS_ASPATH_COUNT
],
9440 ts
->counts
[BGP_STATS_ASPATH_AVGHOPS
],
9442 ts
->counts
[BGP_STATS_ASPATH_AVGSIZE
]
9443 = ravg_tally (ts
->counts
[BGP_STATS_ASPATH_COUNT
],
9444 ts
->counts
[BGP_STATS_ASPATH_AVGSIZE
],
9447 if (highest
> ts
->counts
[BGP_STATS_ASN_HIGHEST
])
9448 ts
->counts
[BGP_STATS_ASN_HIGHEST
] = highest
;
9456 bgp_table_stats (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
)
9458 struct bgp_table_stats ts
;
9461 if (!bgp
->rib
[afi
][safi
])
9463 vty_out (vty
, "%% No RIB exist for the AFI/SAFI%s", VTY_NEWLINE
);
9467 memset (&ts
, 0, sizeof (ts
));
9468 ts
.table
= bgp
->rib
[afi
][safi
];
9469 thread_execute (bm
->master
, bgp_table_stats_walker
, &ts
, 0);
9471 vty_out (vty
, "BGP %s RIB statistics%s%s",
9472 afi_safi_print (afi
, safi
), VTY_NEWLINE
, VTY_NEWLINE
);
9474 for (i
= 0; i
< BGP_STATS_MAX
; i
++)
9476 if (!table_stats_strs
[i
])
9482 case BGP_STATS_ASPATH_AVGHOPS
:
9483 case BGP_STATS_ASPATH_AVGSIZE
:
9484 case BGP_STATS_AVGPLEN
:
9485 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9486 vty_out (vty
, "%12.2f",
9487 (float)ts
.counts
[i
] / (float)TALLY_SIGFIG
);
9490 case BGP_STATS_ASPATH_TOTHOPS
:
9491 case BGP_STATS_ASPATH_TOTSIZE
:
9492 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9493 vty_out (vty
, "%12.2f",
9495 (float)ts
.counts
[i
] /
9496 (float)ts
.counts
[BGP_STATS_ASPATH_COUNT
]
9499 case BGP_STATS_TOTPLEN
:
9500 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9501 vty_out (vty
, "%12.2f",
9503 (float)ts
.counts
[i
] /
9504 (float)ts
.counts
[BGP_STATS_PREFIXES
]
9507 case BGP_STATS_SPACE
:
9508 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9509 vty_out (vty
, "%12llu%s", ts
.counts
[i
], VTY_NEWLINE
);
9510 if (ts
.counts
[BGP_STATS_MAXBITLEN
] < 9)
9512 vty_out (vty
, "%30s: ", "%% announced ");
9513 vty_out (vty
, "%12.2f%s",
9514 100 * (float)ts
.counts
[BGP_STATS_SPACE
] /
9515 (float)((uint64_t)1UL << ts
.counts
[BGP_STATS_MAXBITLEN
]),
9517 vty_out (vty
, "%30s: ", "/8 equivalent ");
9518 vty_out (vty
, "%12.2f%s",
9519 (float)ts
.counts
[BGP_STATS_SPACE
] /
9520 (float)(1UL << (ts
.counts
[BGP_STATS_MAXBITLEN
] - 8)),
9522 if (ts
.counts
[BGP_STATS_MAXBITLEN
] < 25)
9524 vty_out (vty
, "%30s: ", "/24 equivalent ");
9525 vty_out (vty
, "%12.2f",
9526 (float)ts
.counts
[BGP_STATS_SPACE
] /
9527 (float)(1UL << (ts
.counts
[BGP_STATS_MAXBITLEN
] - 24)));
9530 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9531 vty_out (vty
, "%12llu", ts
.counts
[i
]);
9534 vty_out (vty
, "%s", VTY_NEWLINE
);
9540 bgp_table_stats_vty (struct vty
*vty
, const char *name
,
9541 const char *afi_str
, const char *safi_str
)
9548 bgp
= bgp_lookup_by_name (name
);
9550 bgp
= bgp_get_default ();
9554 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
9557 if (strncmp (afi_str
, "ipv", 3) == 0)
9559 if (strncmp (afi_str
, "ipv4", 4) == 0)
9561 else if (strncmp (afi_str
, "ipv6", 4) == 0)
9565 vty_out (vty
, "%% Invalid address family %s%s",
9566 afi_str
, VTY_NEWLINE
);
9569 if (strncmp (safi_str
, "m", 1) == 0)
9570 safi
= SAFI_MULTICAST
;
9571 else if (strncmp (safi_str
, "u", 1) == 0)
9572 safi
= SAFI_UNICAST
;
9573 else if (strncmp (safi_str
, "vpnv4", 5) == 0 || strncmp (safi_str
, "vpnv6", 5) == 0)
9574 safi
= SAFI_MPLS_LABELED_VPN
;
9577 vty_out (vty
, "%% Invalid subsequent address family %s%s",
9578 safi_str
, VTY_NEWLINE
);
9584 vty_out (vty
, "%% Invalid address family %s%s",
9585 afi_str
, VTY_NEWLINE
);
9589 return bgp_table_stats (vty
, bgp
, afi
, safi
);
9592 DEFUN (show_bgp_statistics
,
9593 show_bgp_statistics_cmd
,
9594 "show bgp (ipv4|ipv6) (unicast|multicast) statistics",
9599 "Address Family modifier\n"
9600 "Address Family modifier\n"
9601 "BGP RIB advertisement statistics\n")
9603 return bgp_table_stats_vty (vty
, NULL
, argv
[0], argv
[1]);
9606 ALIAS (show_bgp_statistics
,
9607 show_bgp_statistics_vpnv4_cmd
,
9608 "show bgp (ipv4) (vpnv4) statistics",
9612 "Address Family modifier\n"
9613 "BGP RIB advertisement statistics\n")
9615 DEFUN (show_bgp_statistics_view
,
9616 show_bgp_statistics_view_cmd
,
9617 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) statistics",
9623 "Address Family modifier\n"
9624 "Address Family modifier\n"
9625 "BGP RIB advertisement statistics\n")
9627 return bgp_table_stats_vty (vty
, NULL
, argv
[0], argv
[1]);
9630 ALIAS (show_bgp_statistics_view
,
9631 show_bgp_statistics_view_vpnv4_cmd
,
9632 "show bgp view WORD (ipv4) (vpnv4) statistics",
9637 "Address Family modifier\n"
9638 "BGP RIB advertisement statistics\n")
9650 PCOUNT_PFCNT
, /* the figure we display to users */
9654 static const char *pcount_strs
[] =
9656 [PCOUNT_ADJ_IN
] = "Adj-in",
9657 [PCOUNT_DAMPED
] = "Damped",
9658 [PCOUNT_REMOVED
] = "Removed",
9659 [PCOUNT_HISTORY
] = "History",
9660 [PCOUNT_STALE
] = "Stale",
9661 [PCOUNT_VALID
] = "Valid",
9662 [PCOUNT_ALL
] = "All RIB",
9663 [PCOUNT_COUNTED
] = "PfxCt counted",
9664 [PCOUNT_PFCNT
] = "Useable",
9665 [PCOUNT_MAX
] = NULL
,
9670 unsigned int count
[PCOUNT_MAX
];
9671 const struct peer
*peer
;
9672 const struct bgp_table
*table
;
9676 bgp_peer_count_walker (struct thread
*t
)
9678 struct bgp_node
*rn
;
9679 struct peer_pcounts
*pc
= THREAD_ARG (t
);
9680 const struct peer
*peer
= pc
->peer
;
9682 for (rn
= bgp_table_top (pc
->table
); rn
; rn
= bgp_route_next (rn
))
9684 struct bgp_adj_in
*ain
;
9685 struct bgp_info
*ri
;
9687 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
9688 if (ain
->peer
== peer
)
9689 pc
->count
[PCOUNT_ADJ_IN
]++;
9691 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
9693 char buf
[SU_ADDRSTRLEN
];
9695 if (ri
->peer
!= peer
)
9698 pc
->count
[PCOUNT_ALL
]++;
9700 if (CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
))
9701 pc
->count
[PCOUNT_DAMPED
]++;
9702 if (CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
9703 pc
->count
[PCOUNT_HISTORY
]++;
9704 if (CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
))
9705 pc
->count
[PCOUNT_REMOVED
]++;
9706 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
9707 pc
->count
[PCOUNT_STALE
]++;
9708 if (CHECK_FLAG (ri
->flags
, BGP_INFO_VALID
))
9709 pc
->count
[PCOUNT_VALID
]++;
9710 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
9711 pc
->count
[PCOUNT_PFCNT
]++;
9713 if (CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
9715 pc
->count
[PCOUNT_COUNTED
]++;
9716 if (CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
9717 plog_warn (peer
->log
,
9718 "%s [pcount] %s/%d is counted but flags 0x%x",
9720 inet_ntop(rn
->p
.family
, &rn
->p
.u
.prefix
,
9721 buf
, SU_ADDRSTRLEN
),
9727 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
9728 plog_warn (peer
->log
,
9729 "%s [pcount] %s/%d not counted but flags 0x%x",
9731 inet_ntop(rn
->p
.family
, &rn
->p
.u
.prefix
,
9732 buf
, SU_ADDRSTRLEN
),
9742 bgp_peer_counts (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
)
9744 struct peer_pcounts pcounts
= { .peer
= peer
};
9747 if (!peer
|| !peer
->bgp
|| !peer
->afc
[afi
][safi
]
9748 || !peer
->bgp
->rib
[afi
][safi
])
9750 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
9754 memset (&pcounts
, 0, sizeof(pcounts
));
9755 pcounts
.peer
= peer
;
9756 pcounts
.table
= peer
->bgp
->rib
[afi
][safi
];
9758 /* in-place call via thread subsystem so as to record execution time
9759 * stats for the thread-walk (i.e. ensure this can't be blamed on
9760 * on just vty_read()).
9762 thread_execute (bm
->master
, bgp_peer_count_walker
, &pcounts
, 0);
9764 vty_out (vty
, "Prefix counts for %s, %s%s",
9765 peer
->host
, afi_safi_print (afi
, safi
), VTY_NEWLINE
);
9766 vty_out (vty
, "PfxCt: %ld%s", peer
->pcount
[afi
][safi
], VTY_NEWLINE
);
9767 vty_out (vty
, "%sCounts from RIB table walk:%s%s",
9768 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
9770 for (i
= 0; i
< PCOUNT_MAX
; i
++)
9771 vty_out (vty
, "%20s: %-10d%s",
9772 pcount_strs
[i
], pcounts
.count
[i
], VTY_NEWLINE
);
9774 if (pcounts
.count
[PCOUNT_PFCNT
] != peer
->pcount
[afi
][safi
])
9776 vty_out (vty
, "%s [pcount] PfxCt drift!%s",
9777 peer
->host
, VTY_NEWLINE
);
9778 vty_out (vty
, "Please report this bug, with the above command output%s",
9785 DEFUN (show_ip_bgp_neighbor_prefix_counts
,
9786 show_ip_bgp_neighbor_prefix_counts_cmd
,
9787 "show ip bgp neighbors (A.B.C.D|X:X::X:X) prefix-counts",
9791 "Detailed information on TCP and BGP neighbor connections\n"
9792 "Neighbor to display information about\n"
9793 "Neighbor to display information about\n"
9794 "Display detailed prefix count information\n")
9798 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9802 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_UNICAST
);
9805 DEFUN (show_bgp_ipv6_neighbor_prefix_counts
,
9806 show_bgp_ipv6_neighbor_prefix_counts_cmd
,
9807 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) prefix-counts",
9811 "Detailed information on TCP and BGP neighbor connections\n"
9812 "Neighbor to display information about\n"
9813 "Neighbor to display information about\n"
9814 "Display detailed prefix count information\n")
9818 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9822 return bgp_peer_counts (vty
, peer
, AFI_IP6
, SAFI_UNICAST
);
9825 DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts
,
9826 show_ip_bgp_ipv4_neighbor_prefix_counts_cmd
,
9827 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) prefix-counts",
9832 "Address Family modifier\n"
9833 "Address Family modifier\n"
9834 "Detailed information on TCP and BGP neighbor connections\n"
9835 "Neighbor to display information about\n"
9836 "Neighbor to display information about\n"
9837 "Display detailed prefix count information\n")
9841 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
9845 if (strncmp (argv
[0], "m", 1) == 0)
9846 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_MULTICAST
);
9848 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_UNICAST
);
9851 DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts
,
9852 show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd
,
9853 "show ip bgp vpnv4 all neighbors (A.B.C.D|X:X::X:X) prefix-counts",
9858 "Address Family modifier\n"
9859 "Address Family modifier\n"
9860 "Detailed information on TCP and BGP neighbor connections\n"
9861 "Neighbor to display information about\n"
9862 "Neighbor to display information about\n"
9863 "Display detailed prefix count information\n")
9867 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9871 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_MPLS_VPN
);
9876 show_adj_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
,
9879 struct bgp_table
*table
;
9880 struct bgp_adj_in
*ain
;
9881 struct bgp_adj_out
*adj
;
9882 unsigned long output_count
;
9883 struct bgp_node
*rn
;
9893 table
= bgp
->rib
[afi
][safi
];
9897 if (! in
&& CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
9898 PEER_STATUS_DEFAULT_ORIGINATE
))
9900 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
9901 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9902 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9904 vty_out (vty
, "Originating default network 0.0.0.0%s%s",
9905 VTY_NEWLINE
, VTY_NEWLINE
);
9909 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
9912 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
9913 if (ain
->peer
== peer
)
9917 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
9918 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9919 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9924 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
9929 route_vty_out_tmp (vty
, &rn
->p
, ain
->attr
, safi
);
9936 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
)
9937 if (adj
->peer
== peer
)
9941 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
9942 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9943 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9948 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
9953 route_vty_out_tmp (vty
, &rn
->p
, adj
->attr
, safi
);
9959 if (output_count
!= 0)
9960 vty_out (vty
, "%sTotal number of prefixes %ld%s",
9961 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
9965 peer_adj_routes (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
, int in
)
9967 if (! peer
|| ! peer
->afc
[afi
][safi
])
9969 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
9973 if (in
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
9975 vty_out (vty
, "%% Inbound soft reconfiguration not enabled%s",
9980 show_adj_route (vty
, peer
, afi
, safi
, in
);
9985 DEFUN (show_ip_bgp_view_neighbor_advertised_route
,
9986 show_ip_bgp_view_neighbor_advertised_route_cmd
,
9987 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9993 "Detailed information on TCP and BGP neighbor connections\n"
9994 "Neighbor to display information about\n"
9995 "Neighbor to display information about\n"
9996 "Display the routes advertised to a BGP neighbor\n")
10001 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10003 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10006 return CMD_WARNING
;
10008 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0);
10011 ALIAS (show_ip_bgp_view_neighbor_advertised_route
,
10012 show_ip_bgp_neighbor_advertised_route_cmd
,
10013 "show ip bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
10017 "Detailed information on TCP and BGP neighbor connections\n"
10018 "Neighbor to display information about\n"
10019 "Neighbor to display information about\n"
10020 "Display the routes advertised to a BGP neighbor\n")
10022 DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route
,
10023 show_ip_bgp_ipv4_neighbor_advertised_route_cmd
,
10024 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) advertised-routes",
10029 "Address Family modifier\n"
10030 "Address Family modifier\n"
10031 "Detailed information on TCP and BGP neighbor connections\n"
10032 "Neighbor to display information about\n"
10033 "Neighbor to display information about\n"
10034 "Display the routes advertised to a BGP neighbor\n")
10038 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
10040 return CMD_WARNING
;
10042 if (strncmp (argv
[0], "m", 1) == 0)
10043 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 0);
10045 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0);
10049 DEFUN (show_bgp_view_neighbor_advertised_route
,
10050 show_bgp_view_neighbor_advertised_route_cmd
,
10051 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) advertised-routes",
10056 "Detailed information on TCP and BGP neighbor connections\n"
10057 "Neighbor to display information about\n"
10058 "Neighbor to display information about\n"
10059 "Display the routes advertised to a BGP neighbor\n")
10064 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10066 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10069 return CMD_WARNING
;
10071 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0);
10074 ALIAS (show_bgp_view_neighbor_advertised_route
,
10075 show_bgp_view_ipv6_neighbor_advertised_route_cmd
,
10076 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes",
10082 "Detailed information on TCP and BGP neighbor connections\n"
10083 "Neighbor to display information about\n"
10084 "Neighbor to display information about\n"
10085 "Display the routes advertised to a BGP neighbor\n")
10087 DEFUN (show_bgp_view_neighbor_received_routes
,
10088 show_bgp_view_neighbor_received_routes_cmd
,
10089 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received-routes",
10094 "Detailed information on TCP and BGP neighbor connections\n"
10095 "Neighbor to display information about\n"
10096 "Neighbor to display information about\n"
10097 "Display the received routes from neighbor\n")
10102 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10104 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10107 return CMD_WARNING
;
10109 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 1);
10112 ALIAS (show_bgp_view_neighbor_received_routes
,
10113 show_bgp_view_ipv6_neighbor_received_routes_cmd
,
10114 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
10120 "Detailed information on TCP and BGP neighbor connections\n"
10121 "Neighbor to display information about\n"
10122 "Neighbor to display information about\n"
10123 "Display the received routes from neighbor\n")
10125 ALIAS (show_bgp_view_neighbor_advertised_route
,
10126 show_bgp_neighbor_advertised_route_cmd
,
10127 "show bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
10130 "Detailed information on TCP and BGP neighbor connections\n"
10131 "Neighbor to display information about\n"
10132 "Neighbor to display information about\n"
10133 "Display the routes advertised to a BGP neighbor\n")
10135 ALIAS (show_bgp_view_neighbor_advertised_route
,
10136 show_bgp_ipv6_neighbor_advertised_route_cmd
,
10137 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes",
10141 "Detailed information on TCP and BGP neighbor connections\n"
10142 "Neighbor to display information about\n"
10143 "Neighbor to display information about\n"
10144 "Display the routes advertised to a BGP neighbor\n")
10147 ALIAS (show_bgp_view_neighbor_advertised_route
,
10148 ipv6_bgp_neighbor_advertised_route_cmd
,
10149 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
10153 "Detailed information on TCP and BGP neighbor connections\n"
10154 "Neighbor to display information about\n"
10155 "Neighbor to display information about\n"
10156 "Display the routes advertised to a BGP neighbor\n")
10159 DEFUN (ipv6_mbgp_neighbor_advertised_route
,
10160 ipv6_mbgp_neighbor_advertised_route_cmd
,
10161 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
10165 "Detailed information on TCP and BGP neighbor connections\n"
10166 "Neighbor to display information about\n"
10167 "Neighbor to display information about\n"
10168 "Display the routes advertised to a BGP neighbor\n")
10172 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10174 return CMD_WARNING
;
10176 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 0);
10178 #endif /* HAVE_IPV6 */
10180 DEFUN (show_ip_bgp_view_neighbor_received_routes
,
10181 show_ip_bgp_view_neighbor_received_routes_cmd
,
10182 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X) received-routes",
10188 "Detailed information on TCP and BGP neighbor connections\n"
10189 "Neighbor to display information about\n"
10190 "Neighbor to display information about\n"
10191 "Display the received routes from neighbor\n")
10196 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10198 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10201 return CMD_WARNING
;
10203 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1);
10206 ALIAS (show_ip_bgp_view_neighbor_received_routes
,
10207 show_ip_bgp_neighbor_received_routes_cmd
,
10208 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
10212 "Detailed information on TCP and BGP neighbor connections\n"
10213 "Neighbor to display information about\n"
10214 "Neighbor to display information about\n"
10215 "Display the received routes from neighbor\n")
10217 DEFUN (show_ip_bgp_ipv4_neighbor_received_routes
,
10218 show_ip_bgp_ipv4_neighbor_received_routes_cmd
,
10219 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received-routes",
10224 "Address Family modifier\n"
10225 "Address Family modifier\n"
10226 "Detailed information on TCP and BGP neighbor connections\n"
10227 "Neighbor to display information about\n"
10228 "Neighbor to display information about\n"
10229 "Display the received routes from neighbor\n")
10233 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
10235 return CMD_WARNING
;
10237 if (strncmp (argv
[0], "m", 1) == 0)
10238 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 1);
10240 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1);
10243 DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes
,
10244 show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd
,
10246 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) (advertised-routes|received-routes)",
10248 "show bgp view WORD ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) (advertised-routes|received-routes)",
10258 "Address family modifier\n"
10259 "Address family modifier\n"
10260 "Detailed information on TCP and BGP neighbor connections\n"
10261 "Neighbor to display information about\n"
10262 "Neighbor to display information about\n"
10263 "Display the advertised routes to neighbor\n"
10264 "Display the received routes from neighbor\n")
10272 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[3]);
10274 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
10278 return CMD_WARNING
;
10281 afi
= (strncmp (argv
[1], "ipv6", 4) == 0) ? AFI_IP6
: AFI_IP
;
10282 safi
= (strncmp (argv
[2], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
10283 in
= (strncmp (argv
[4], "r", 1) == 0) ? 1 : 0;
10286 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
10287 in
= (strncmp (argv
[3], "r", 1) == 0) ? 1 : 0;
10290 return peer_adj_routes (vty
, peer
, afi
, safi
, in
);
10293 DEFUN (show_ip_bgp_neighbor_received_prefix_filter
,
10294 show_ip_bgp_neighbor_received_prefix_filter_cmd
,
10295 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
10299 "Detailed information on TCP and BGP neighbor connections\n"
10300 "Neighbor to display information about\n"
10301 "Neighbor to display information about\n"
10302 "Display information received from a BGP neighbor\n"
10303 "Display the prefixlist filter\n")
10306 union sockunion su
;
10310 ret
= str2sockunion (argv
[0], &su
);
10313 vty_out (vty
, "Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
10314 return CMD_WARNING
;
10317 peer
= peer_lookup (NULL
, &su
);
10319 return CMD_WARNING
;
10321 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
10322 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
10325 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
10326 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
10329 return CMD_SUCCESS
;
10332 DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter
,
10333 show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
,
10334 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
10339 "Address Family modifier\n"
10340 "Address Family modifier\n"
10341 "Detailed information on TCP and BGP neighbor connections\n"
10342 "Neighbor to display information about\n"
10343 "Neighbor to display information about\n"
10344 "Display information received from a BGP neighbor\n"
10345 "Display the prefixlist filter\n")
10348 union sockunion su
;
10352 ret
= str2sockunion (argv
[1], &su
);
10355 vty_out (vty
, "Malformed address: %s%s", argv
[1], VTY_NEWLINE
);
10356 return CMD_WARNING
;
10359 peer
= peer_lookup (NULL
, &su
);
10361 return CMD_WARNING
;
10363 if (strncmp (argv
[0], "m", 1) == 0)
10365 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_MULTICAST
);
10366 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
10369 vty_out (vty
, "Address family: IPv4 Multicast%s", VTY_NEWLINE
);
10370 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
10375 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
10376 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
10379 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
10380 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
10384 return CMD_SUCCESS
;
10389 ALIAS (show_bgp_view_neighbor_received_routes
,
10390 show_bgp_neighbor_received_routes_cmd
,
10391 "show bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
10394 "Detailed information on TCP and BGP neighbor connections\n"
10395 "Neighbor to display information about\n"
10396 "Neighbor to display information about\n"
10397 "Display the received routes from neighbor\n")
10399 ALIAS (show_bgp_view_neighbor_received_routes
,
10400 show_bgp_ipv6_neighbor_received_routes_cmd
,
10401 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
10405 "Detailed information on TCP and BGP neighbor connections\n"
10406 "Neighbor to display information about\n"
10407 "Neighbor to display information about\n"
10408 "Display the received routes from neighbor\n")
10410 DEFUN (show_bgp_neighbor_received_prefix_filter
,
10411 show_bgp_neighbor_received_prefix_filter_cmd
,
10412 "show bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
10415 "Detailed information on TCP and BGP neighbor connections\n"
10416 "Neighbor to display information about\n"
10417 "Neighbor to display information about\n"
10418 "Display information received from a BGP neighbor\n"
10419 "Display the prefixlist filter\n")
10422 union sockunion su
;
10426 ret
= str2sockunion (argv
[0], &su
);
10429 vty_out (vty
, "Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
10430 return CMD_WARNING
;
10433 peer
= peer_lookup (NULL
, &su
);
10435 return CMD_WARNING
;
10437 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
10438 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
10441 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
10442 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
10445 return CMD_SUCCESS
;
10448 ALIAS (show_bgp_neighbor_received_prefix_filter
,
10449 show_bgp_ipv6_neighbor_received_prefix_filter_cmd
,
10450 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
10454 "Detailed information on TCP and BGP neighbor connections\n"
10455 "Neighbor to display information about\n"
10456 "Neighbor to display information about\n"
10457 "Display information received from a BGP neighbor\n"
10458 "Display the prefixlist filter\n")
10461 ALIAS (show_bgp_view_neighbor_received_routes
,
10462 ipv6_bgp_neighbor_received_routes_cmd
,
10463 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
10467 "Detailed information on TCP and BGP neighbor connections\n"
10468 "Neighbor to display information about\n"
10469 "Neighbor to display information about\n"
10470 "Display the received routes from neighbor\n")
10473 DEFUN (ipv6_mbgp_neighbor_received_routes
,
10474 ipv6_mbgp_neighbor_received_routes_cmd
,
10475 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) received-routes",
10479 "Detailed information on TCP and BGP neighbor connections\n"
10480 "Neighbor to display information about\n"
10481 "Neighbor to display information about\n"
10482 "Display the received routes from neighbor\n")
10486 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10488 return CMD_WARNING
;
10490 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 1);
10493 DEFUN (show_bgp_view_neighbor_received_prefix_filter
,
10494 show_bgp_view_neighbor_received_prefix_filter_cmd
,
10495 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
10500 "Detailed information on TCP and BGP neighbor connections\n"
10501 "Neighbor to display information about\n"
10502 "Neighbor to display information about\n"
10503 "Display information received from a BGP neighbor\n"
10504 "Display the prefixlist filter\n")
10507 union sockunion su
;
10512 /* BGP structure lookup. */
10513 bgp
= bgp_lookup_by_name (argv
[0]);
10516 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10517 return CMD_WARNING
;
10520 ret
= str2sockunion (argv
[1], &su
);
10523 vty_out (vty
, "Malformed address: %s%s", argv
[1], VTY_NEWLINE
);
10524 return CMD_WARNING
;
10527 peer
= peer_lookup (bgp
, &su
);
10529 return CMD_WARNING
;
10531 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
10532 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
10535 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
10536 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
10539 return CMD_SUCCESS
;
10542 ALIAS (show_bgp_view_neighbor_received_prefix_filter
,
10543 show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
,
10544 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
10550 "Detailed information on TCP and BGP neighbor connections\n"
10551 "Neighbor to display information about\n"
10552 "Neighbor to display information about\n"
10553 "Display information received from a BGP neighbor\n"
10554 "Display the prefixlist filter\n")
10555 #endif /* HAVE_IPV6 */
10558 bgp_show_neighbor_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
10559 safi_t safi
, enum bgp_show_type type
)
10561 if (! peer
|| ! peer
->afc
[afi
][safi
])
10563 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
10564 return CMD_WARNING
;
10567 return bgp_show (vty
, peer
->bgp
, afi
, safi
, type
, &peer
->su
);
10570 DEFUN (show_ip_bgp_neighbor_routes
,
10571 show_ip_bgp_neighbor_routes_cmd
,
10572 "show ip bgp neighbors (A.B.C.D|X:X::X:X) routes",
10576 "Detailed information on TCP and BGP neighbor connections\n"
10577 "Neighbor to display information about\n"
10578 "Neighbor to display information about\n"
10579 "Display routes learned from neighbor\n")
10583 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10585 return CMD_WARNING
;
10587 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
10588 bgp_show_type_neighbor
);
10591 DEFUN (show_ip_bgp_neighbor_flap
,
10592 show_ip_bgp_neighbor_flap_cmd
,
10593 "show ip bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
10597 "Detailed information on TCP and BGP neighbor connections\n"
10598 "Neighbor to display information about\n"
10599 "Neighbor to display information about\n"
10600 "Display flap statistics of the routes learned from neighbor\n")
10604 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10606 return CMD_WARNING
;
10608 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
10609 bgp_show_type_flap_neighbor
);
10612 DEFUN (show_ip_bgp_neighbor_damp
,
10613 show_ip_bgp_neighbor_damp_cmd
,
10614 "show ip bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
10618 "Detailed information on TCP and BGP neighbor connections\n"
10619 "Neighbor to display information about\n"
10620 "Neighbor to display information about\n"
10621 "Display the dampened routes received from neighbor\n")
10625 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10627 return CMD_WARNING
;
10629 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
10630 bgp_show_type_damp_neighbor
);
10633 DEFUN (show_ip_bgp_ipv4_neighbor_routes
,
10634 show_ip_bgp_ipv4_neighbor_routes_cmd
,
10635 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) routes",
10640 "Address Family modifier\n"
10641 "Address Family modifier\n"
10642 "Detailed information on TCP and BGP neighbor connections\n"
10643 "Neighbor to display information about\n"
10644 "Neighbor to display information about\n"
10645 "Display routes learned from neighbor\n")
10649 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
10651 return CMD_WARNING
;
10653 if (strncmp (argv
[0], "m", 1) == 0)
10654 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_MULTICAST
,
10655 bgp_show_type_neighbor
);
10657 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
10658 bgp_show_type_neighbor
);
10661 DEFUN (show_ip_bgp_view_rsclient
,
10662 show_ip_bgp_view_rsclient_cmd
,
10663 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X)",
10669 "Information about Route Server Client\n"
10672 struct bgp_table
*table
;
10676 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10678 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10681 return CMD_WARNING
;
10683 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
10685 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10687 return CMD_WARNING
;
10690 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
10691 PEER_FLAG_RSERVER_CLIENT
))
10693 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10695 return CMD_WARNING
;
10698 table
= peer
->rib
[AFI_IP
][SAFI_UNICAST
];
10700 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
10703 ALIAS (show_ip_bgp_view_rsclient
,
10704 show_ip_bgp_rsclient_cmd
,
10705 "show ip bgp rsclient (A.B.C.D|X:X::X:X)",
10709 "Information about Route Server Client\n"
10712 DEFUN (show_bgp_view_ipv4_safi_rsclient
,
10713 show_bgp_view_ipv4_safi_rsclient_cmd
,
10714 "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X)",
10720 "Address Family modifier\n"
10721 "Address Family modifier\n"
10722 "Information about Route Server Client\n"
10725 struct bgp_table
*table
;
10730 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
10731 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
10733 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
10734 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
10738 return CMD_WARNING
;
10740 if (! peer
->afc
[AFI_IP
][safi
])
10742 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10744 return CMD_WARNING
;
10747 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][safi
],
10748 PEER_FLAG_RSERVER_CLIENT
))
10750 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10752 return CMD_WARNING
;
10755 table
= peer
->rib
[AFI_IP
][safi
];
10757 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
10760 ALIAS (show_bgp_view_ipv4_safi_rsclient
,
10761 show_bgp_ipv4_safi_rsclient_cmd
,
10762 "show bgp ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X)",
10766 "Address Family modifier\n"
10767 "Address Family modifier\n"
10768 "Information about Route Server Client\n"
10771 DEFUN (show_ip_bgp_view_rsclient_route
,
10772 show_ip_bgp_view_rsclient_route_cmd
,
10773 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
10779 "Information about Route Server Client\n"
10781 "Network in the BGP routing table to display\n")
10786 /* BGP structure lookup. */
10789 bgp
= bgp_lookup_by_name (argv
[0]);
10792 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10793 return CMD_WARNING
;
10798 bgp
= bgp_get_default ();
10801 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
10802 return CMD_WARNING
;
10807 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10809 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10812 return CMD_WARNING
;
10814 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
10816 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10818 return CMD_WARNING
;
10821 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
10822 PEER_FLAG_RSERVER_CLIENT
))
10824 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10826 return CMD_WARNING
;
10829 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
10830 (argc
== 3) ? argv
[2] : argv
[1],
10831 AFI_IP
, SAFI_UNICAST
, NULL
, 0);
10834 ALIAS (show_ip_bgp_view_rsclient_route
,
10835 show_ip_bgp_rsclient_route_cmd
,
10836 "show ip bgp rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
10840 "Information about Route Server Client\n"
10842 "Network in the BGP routing table to display\n")
10844 DEFUN (show_bgp_view_ipv4_safi_rsclient_route
,
10845 show_bgp_view_ipv4_safi_rsclient_route_cmd
,
10846 "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
10852 "Address Family modifier\n"
10853 "Address Family modifier\n"
10854 "Information about Route Server Client\n"
10856 "Network in the BGP routing table to display\n")
10862 /* BGP structure lookup. */
10865 bgp
= bgp_lookup_by_name (argv
[0]);
10868 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10869 return CMD_WARNING
;
10874 bgp
= bgp_get_default ();
10877 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
10878 return CMD_WARNING
;
10883 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
10884 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
10886 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
10887 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
10891 return CMD_WARNING
;
10893 if (! peer
->afc
[AFI_IP
][safi
])
10895 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10897 return CMD_WARNING
;
10900 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][safi
],
10901 PEER_FLAG_RSERVER_CLIENT
))
10903 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10905 return CMD_WARNING
;
10908 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][safi
],
10909 (argc
== 4) ? argv
[3] : argv
[2],
10910 AFI_IP
, safi
, NULL
, 0);
10913 ALIAS (show_bgp_view_ipv4_safi_rsclient_route
,
10914 show_bgp_ipv4_safi_rsclient_route_cmd
,
10915 "show bgp ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
10919 "Address Family modifier\n"
10920 "Address Family modifier\n"
10921 "Information about Route Server Client\n"
10923 "Network in the BGP routing table to display\n")
10925 DEFUN (show_ip_bgp_view_rsclient_prefix
,
10926 show_ip_bgp_view_rsclient_prefix_cmd
,
10927 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
10933 "Information about Route Server Client\n"
10935 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
10940 /* BGP structure lookup. */
10943 bgp
= bgp_lookup_by_name (argv
[0]);
10946 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10947 return CMD_WARNING
;
10952 bgp
= bgp_get_default ();
10955 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
10956 return CMD_WARNING
;
10961 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10963 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10966 return CMD_WARNING
;
10968 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
10970 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10972 return CMD_WARNING
;
10975 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
10976 PEER_FLAG_RSERVER_CLIENT
))
10978 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10980 return CMD_WARNING
;
10983 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
10984 (argc
== 3) ? argv
[2] : argv
[1],
10985 AFI_IP
, SAFI_UNICAST
, NULL
, 1);
10988 ALIAS (show_ip_bgp_view_rsclient_prefix
,
10989 show_ip_bgp_rsclient_prefix_cmd
,
10990 "show ip bgp rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
10994 "Information about Route Server Client\n"
10996 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
10998 DEFUN (show_bgp_view_ipv4_safi_rsclient_prefix
,
10999 show_bgp_view_ipv4_safi_rsclient_prefix_cmd
,
11000 "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
11006 "Address Family modifier\n"
11007 "Address Family modifier\n"
11008 "Information about Route Server Client\n"
11010 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
11016 /* BGP structure lookup. */
11019 bgp
= bgp_lookup_by_name (argv
[0]);
11022 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
11023 return CMD_WARNING
;
11028 bgp
= bgp_get_default ();
11031 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
11032 return CMD_WARNING
;
11037 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
11038 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11040 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
11041 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11045 return CMD_WARNING
;
11047 if (! peer
->afc
[AFI_IP
][safi
])
11049 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11051 return CMD_WARNING
;
11054 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][safi
],
11055 PEER_FLAG_RSERVER_CLIENT
))
11057 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11059 return CMD_WARNING
;
11062 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][safi
],
11063 (argc
== 4) ? argv
[3] : argv
[2],
11064 AFI_IP
, safi
, NULL
, 1);
11067 ALIAS (show_bgp_view_ipv4_safi_rsclient_prefix
,
11068 show_bgp_ipv4_safi_rsclient_prefix_cmd
,
11069 "show bgp ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
11073 "Address Family modifier\n"
11074 "Address Family modifier\n"
11075 "Information about Route Server Client\n"
11077 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
11080 DEFUN (show_bgp_view_neighbor_routes
,
11081 show_bgp_view_neighbor_routes_cmd
,
11082 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) routes",
11087 "Detailed information on TCP and BGP neighbor connections\n"
11088 "Neighbor to display information about\n"
11089 "Neighbor to display information about\n"
11090 "Display routes learned from neighbor\n")
11095 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11097 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11100 return CMD_WARNING
;
11102 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
11103 bgp_show_type_neighbor
);
11106 ALIAS (show_bgp_view_neighbor_routes
,
11107 show_bgp_view_ipv6_neighbor_routes_cmd
,
11108 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) routes",
11114 "Detailed information on TCP and BGP neighbor connections\n"
11115 "Neighbor to display information about\n"
11116 "Neighbor to display information about\n"
11117 "Display routes learned from neighbor\n")
11119 DEFUN (show_bgp_view_neighbor_damp
,
11120 show_bgp_view_neighbor_damp_cmd
,
11121 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) dampened-routes",
11126 "Detailed information on TCP and BGP neighbor connections\n"
11127 "Neighbor to display information about\n"
11128 "Neighbor to display information about\n"
11129 "Display the dampened routes received from neighbor\n")
11134 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11136 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11139 return CMD_WARNING
;
11141 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
11142 bgp_show_type_damp_neighbor
);
11145 ALIAS (show_bgp_view_neighbor_damp
,
11146 show_bgp_view_ipv6_neighbor_damp_cmd
,
11147 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes",
11153 "Detailed information on TCP and BGP neighbor connections\n"
11154 "Neighbor to display information about\n"
11155 "Neighbor to display information about\n"
11156 "Display the dampened routes received from neighbor\n")
11158 DEFUN (show_bgp_view_neighbor_flap
,
11159 show_bgp_view_neighbor_flap_cmd
,
11160 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) flap-statistics",
11165 "Detailed information on TCP and BGP neighbor connections\n"
11166 "Neighbor to display information about\n"
11167 "Neighbor to display information about\n"
11168 "Display flap statistics of the routes learned from neighbor\n")
11173 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11175 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11178 return CMD_WARNING
;
11180 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
11181 bgp_show_type_flap_neighbor
);
11184 ALIAS (show_bgp_view_neighbor_flap
,
11185 show_bgp_view_ipv6_neighbor_flap_cmd
,
11186 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics",
11192 "Detailed information on TCP and BGP neighbor connections\n"
11193 "Neighbor to display information about\n"
11194 "Neighbor to display information about\n"
11195 "Display flap statistics of the routes learned from neighbor\n")
11197 ALIAS (show_bgp_view_neighbor_routes
,
11198 show_bgp_neighbor_routes_cmd
,
11199 "show bgp neighbors (A.B.C.D|X:X::X:X) routes",
11202 "Detailed information on TCP and BGP neighbor connections\n"
11203 "Neighbor to display information about\n"
11204 "Neighbor to display information about\n"
11205 "Display routes learned from neighbor\n")
11208 ALIAS (show_bgp_view_neighbor_routes
,
11209 show_bgp_ipv6_neighbor_routes_cmd
,
11210 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) routes",
11214 "Detailed information on TCP and BGP neighbor connections\n"
11215 "Neighbor to display information about\n"
11216 "Neighbor to display information about\n"
11217 "Display routes learned from neighbor\n")
11220 ALIAS (show_bgp_view_neighbor_routes
,
11221 ipv6_bgp_neighbor_routes_cmd
,
11222 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) routes",
11226 "Detailed information on TCP and BGP neighbor connections\n"
11227 "Neighbor to display information about\n"
11228 "Neighbor to display information about\n"
11229 "Display routes learned from neighbor\n")
11232 DEFUN (ipv6_mbgp_neighbor_routes
,
11233 ipv6_mbgp_neighbor_routes_cmd
,
11234 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) routes",
11238 "Detailed information on TCP and BGP neighbor connections\n"
11239 "Neighbor to display information about\n"
11240 "Neighbor to display information about\n"
11241 "Display routes learned from neighbor\n")
11245 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11247 return CMD_WARNING
;
11249 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
,
11250 bgp_show_type_neighbor
);
11253 ALIAS (show_bgp_view_neighbor_flap
,
11254 show_bgp_neighbor_flap_cmd
,
11255 "show bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
11258 "Detailed information on TCP and BGP neighbor connections\n"
11259 "Neighbor to display information about\n"
11260 "Neighbor to display information about\n"
11261 "Display flap statistics of the routes learned from neighbor\n")
11263 ALIAS (show_bgp_view_neighbor_flap
,
11264 show_bgp_ipv6_neighbor_flap_cmd
,
11265 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics",
11269 "Detailed information on TCP and BGP neighbor connections\n"
11270 "Neighbor to display information about\n"
11271 "Neighbor to display information about\n"
11272 "Display flap statistics of the routes learned from neighbor\n")
11274 ALIAS (show_bgp_view_neighbor_damp
,
11275 show_bgp_neighbor_damp_cmd
,
11276 "show bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
11279 "Detailed information on TCP and BGP neighbor connections\n"
11280 "Neighbor to display information about\n"
11281 "Neighbor to display information about\n"
11282 "Display the dampened routes received from neighbor\n")
11284 ALIAS (show_bgp_view_neighbor_damp
,
11285 show_bgp_ipv6_neighbor_damp_cmd
,
11286 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes",
11290 "Detailed information on TCP and BGP neighbor connections\n"
11291 "Neighbor to display information about\n"
11292 "Neighbor to display information about\n"
11293 "Display the dampened routes received from neighbor\n")
11295 DEFUN (show_bgp_view_rsclient
,
11296 show_bgp_view_rsclient_cmd
,
11297 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X)",
11302 "Information about Route Server Client\n"
11305 struct bgp_table
*table
;
11309 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11311 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11314 return CMD_WARNING
;
11316 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
11318 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11320 return CMD_WARNING
;
11323 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
11324 PEER_FLAG_RSERVER_CLIENT
))
11326 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11328 return CMD_WARNING
;
11331 table
= peer
->rib
[AFI_IP6
][SAFI_UNICAST
];
11333 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
11336 ALIAS (show_bgp_view_rsclient
,
11337 show_bgp_rsclient_cmd
,
11338 "show bgp rsclient (A.B.C.D|X:X::X:X)",
11341 "Information about Route Server Client\n"
11344 DEFUN (show_bgp_view_ipv6_safi_rsclient
,
11345 show_bgp_view_ipv6_safi_rsclient_cmd
,
11346 "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X)",
11352 "Address Family modifier\n"
11353 "Address Family modifier\n"
11354 "Information about Route Server Client\n"
11357 struct bgp_table
*table
;
11362 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
11363 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11365 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
11366 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11370 return CMD_WARNING
;
11372 if (! peer
->afc
[AFI_IP6
][safi
])
11374 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11376 return CMD_WARNING
;
11379 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][safi
],
11380 PEER_FLAG_RSERVER_CLIENT
))
11382 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11384 return CMD_WARNING
;
11387 table
= peer
->rib
[AFI_IP6
][safi
];
11389 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
11392 ALIAS (show_bgp_view_ipv6_safi_rsclient
,
11393 show_bgp_ipv6_safi_rsclient_cmd
,
11394 "show bgp ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X)",
11398 "Address Family modifier\n"
11399 "Address Family modifier\n"
11400 "Information about Route Server Client\n"
11403 DEFUN (show_bgp_view_rsclient_route
,
11404 show_bgp_view_rsclient_route_cmd
,
11405 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
11410 "Information about Route Server Client\n"
11412 "Network in the BGP routing table to display\n")
11417 /* BGP structure lookup. */
11420 bgp
= bgp_lookup_by_name (argv
[0]);
11423 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
11424 return CMD_WARNING
;
11429 bgp
= bgp_get_default ();
11432 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
11433 return CMD_WARNING
;
11438 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11440 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11443 return CMD_WARNING
;
11445 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
11447 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11449 return CMD_WARNING
;
11452 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
11453 PEER_FLAG_RSERVER_CLIENT
))
11455 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11457 return CMD_WARNING
;
11460 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
11461 (argc
== 3) ? argv
[2] : argv
[1],
11462 AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
11465 ALIAS (show_bgp_view_rsclient_route
,
11466 show_bgp_rsclient_route_cmd
,
11467 "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
11470 "Information about Route Server Client\n"
11472 "Network in the BGP routing table to display\n")
11474 DEFUN (show_bgp_view_ipv6_safi_rsclient_route
,
11475 show_bgp_view_ipv6_safi_rsclient_route_cmd
,
11476 "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
11482 "Address Family modifier\n"
11483 "Address Family modifier\n"
11484 "Information about Route Server Client\n"
11486 "Network in the BGP routing table to display\n")
11492 /* BGP structure lookup. */
11495 bgp
= bgp_lookup_by_name (argv
[0]);
11498 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
11499 return CMD_WARNING
;
11504 bgp
= bgp_get_default ();
11507 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
11508 return CMD_WARNING
;
11513 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
11514 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11516 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
11517 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11521 return CMD_WARNING
;
11523 if (! peer
->afc
[AFI_IP6
][safi
])
11525 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11527 return CMD_WARNING
;
11530 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][safi
],
11531 PEER_FLAG_RSERVER_CLIENT
))
11533 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11535 return CMD_WARNING
;
11538 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][safi
],
11539 (argc
== 4) ? argv
[3] : argv
[2],
11540 AFI_IP6
, safi
, NULL
, 0);
11543 ALIAS (show_bgp_view_ipv6_safi_rsclient_route
,
11544 show_bgp_ipv6_safi_rsclient_route_cmd
,
11545 "show bgp ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
11549 "Address Family modifier\n"
11550 "Address Family modifier\n"
11551 "Information about Route Server Client\n"
11553 "Network in the BGP routing table to display\n")
11555 DEFUN (show_bgp_view_rsclient_prefix
,
11556 show_bgp_view_rsclient_prefix_cmd
,
11557 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
11562 "Information about Route Server Client\n"
11564 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
11569 /* BGP structure lookup. */
11572 bgp
= bgp_lookup_by_name (argv
[0]);
11575 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
11576 return CMD_WARNING
;
11581 bgp
= bgp_get_default ();
11584 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
11585 return CMD_WARNING
;
11590 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11592 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11595 return CMD_WARNING
;
11597 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
11599 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11601 return CMD_WARNING
;
11604 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
11605 PEER_FLAG_RSERVER_CLIENT
))
11607 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11609 return CMD_WARNING
;
11612 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
11613 (argc
== 3) ? argv
[2] : argv
[1],
11614 AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
11617 ALIAS (show_bgp_view_rsclient_prefix
,
11618 show_bgp_rsclient_prefix_cmd
,
11619 "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
11622 "Information about Route Server Client\n"
11624 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
11626 DEFUN (show_bgp_view_ipv6_safi_rsclient_prefix
,
11627 show_bgp_view_ipv6_safi_rsclient_prefix_cmd
,
11628 "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
11634 "Address Family modifier\n"
11635 "Address Family modifier\n"
11636 "Information about Route Server Client\n"
11638 "IP prefix <network>/<length>, e.g., 3ffe::/16\n")
11644 /* BGP structure lookup. */
11647 bgp
= bgp_lookup_by_name (argv
[0]);
11650 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
11651 return CMD_WARNING
;
11656 bgp
= bgp_get_default ();
11659 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
11660 return CMD_WARNING
;
11665 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
11666 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11668 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
11669 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11673 return CMD_WARNING
;
11675 if (! peer
->afc
[AFI_IP6
][safi
])
11677 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11679 return CMD_WARNING
;
11682 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][safi
],
11683 PEER_FLAG_RSERVER_CLIENT
))
11685 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11687 return CMD_WARNING
;
11690 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][safi
],
11691 (argc
== 4) ? argv
[3] : argv
[2],
11692 AFI_IP6
, safi
, NULL
, 1);
11695 ALIAS (show_bgp_view_ipv6_safi_rsclient_prefix
,
11696 show_bgp_ipv6_safi_rsclient_prefix_cmd
,
11697 "show bgp ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
11701 "Address Family modifier\n"
11702 "Address Family modifier\n"
11703 "Information about Route Server Client\n"
11705 "IP prefix <network>/<length>, e.g., 3ffe::/16\n")
11707 #endif /* HAVE_IPV6 */
11709 struct bgp_table
*bgp_distance_table
;
11711 struct bgp_distance
11713 /* Distance value for the IP source prefix. */
11716 /* Name of the access-list to be matched. */
11720 static struct bgp_distance
*
11721 bgp_distance_new (void)
11723 return XCALLOC (MTYPE_BGP_DISTANCE
, sizeof (struct bgp_distance
));
11727 bgp_distance_free (struct bgp_distance
*bdistance
)
11729 XFREE (MTYPE_BGP_DISTANCE
, bdistance
);
11733 bgp_distance_set (struct vty
*vty
, const char *distance_str
,
11734 const char *ip_str
, const char *access_list_str
)
11737 struct prefix_ipv4 p
;
11739 struct bgp_node
*rn
;
11740 struct bgp_distance
*bdistance
;
11742 ret
= str2prefix_ipv4 (ip_str
, &p
);
11745 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
11746 return CMD_WARNING
;
11749 distance
= atoi (distance_str
);
11751 /* Get BGP distance node. */
11752 rn
= bgp_node_get (bgp_distance_table
, (struct prefix
*) &p
);
11755 bdistance
= rn
->info
;
11756 bgp_unlock_node (rn
);
11760 bdistance
= bgp_distance_new ();
11761 rn
->info
= bdistance
;
11764 /* Set distance value. */
11765 bdistance
->distance
= distance
;
11767 /* Reset access-list configuration. */
11768 if (bdistance
->access_list
)
11770 free (bdistance
->access_list
);
11771 bdistance
->access_list
= NULL
;
11773 if (access_list_str
)
11774 bdistance
->access_list
= strdup (access_list_str
);
11776 return CMD_SUCCESS
;
11780 bgp_distance_unset (struct vty
*vty
, const char *distance_str
,
11781 const char *ip_str
, const char *access_list_str
)
11784 struct prefix_ipv4 p
;
11786 struct bgp_node
*rn
;
11787 struct bgp_distance
*bdistance
;
11789 ret
= str2prefix_ipv4 (ip_str
, &p
);
11792 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
11793 return CMD_WARNING
;
11796 distance
= atoi (distance_str
);
11798 rn
= bgp_node_lookup (bgp_distance_table
, (struct prefix
*)&p
);
11801 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
11802 return CMD_WARNING
;
11805 bdistance
= rn
->info
;
11807 if (bdistance
->access_list
)
11808 free (bdistance
->access_list
);
11809 bgp_distance_free (bdistance
);
11812 bgp_unlock_node (rn
);
11813 bgp_unlock_node (rn
);
11815 return CMD_SUCCESS
;
11818 /* Apply BGP information to distance method. */
11820 bgp_distance_apply (struct prefix
*p
, struct bgp_info
*rinfo
, struct bgp
*bgp
)
11822 struct bgp_node
*rn
;
11823 struct prefix_ipv4 q
;
11825 struct bgp_distance
*bdistance
;
11826 struct access_list
*alist
;
11827 struct bgp_static
*bgp_static
;
11832 if (p
->family
!= AF_INET
)
11835 peer
= rinfo
->peer
;
11837 if (peer
->su
.sa
.sa_family
!= AF_INET
)
11840 memset (&q
, 0, sizeof (struct prefix_ipv4
));
11841 q
.family
= AF_INET
;
11842 q
.prefix
= peer
->su
.sin
.sin_addr
;
11843 q
.prefixlen
= IPV4_MAX_BITLEN
;
11845 /* Check source address. */
11846 rn
= bgp_node_match (bgp_distance_table
, (struct prefix
*) &q
);
11849 bdistance
= rn
->info
;
11850 bgp_unlock_node (rn
);
11852 if (bdistance
->access_list
)
11854 alist
= access_list_lookup (AFI_IP
, bdistance
->access_list
);
11855 if (alist
&& access_list_apply (alist
, p
) == FILTER_PERMIT
)
11856 return bdistance
->distance
;
11859 return bdistance
->distance
;
11862 /* Backdoor check. */
11863 rn
= bgp_node_lookup (bgp
->route
[AFI_IP
][SAFI_UNICAST
], p
);
11866 bgp_static
= rn
->info
;
11867 bgp_unlock_node (rn
);
11869 if (bgp_static
->backdoor
)
11871 if (bgp
->distance_local
)
11872 return bgp
->distance_local
;
11874 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
11878 if (peer
->sort
== BGP_PEER_EBGP
)
11880 if (bgp
->distance_ebgp
)
11881 return bgp
->distance_ebgp
;
11882 return ZEBRA_EBGP_DISTANCE_DEFAULT
;
11886 if (bgp
->distance_ibgp
)
11887 return bgp
->distance_ibgp
;
11888 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
11892 DEFUN (bgp_distance
,
11894 "distance bgp <1-255> <1-255> <1-255>",
11895 "Define an administrative distance\n"
11897 "Distance for routes external to the AS\n"
11898 "Distance for routes internal to the AS\n"
11899 "Distance for local routes\n")
11905 bgp
->distance_ebgp
= atoi (argv
[0]);
11906 bgp
->distance_ibgp
= atoi (argv
[1]);
11907 bgp
->distance_local
= atoi (argv
[2]);
11908 return CMD_SUCCESS
;
11911 DEFUN (no_bgp_distance
,
11912 no_bgp_distance_cmd
,
11913 "no distance bgp <1-255> <1-255> <1-255>",
11915 "Define an administrative distance\n"
11917 "Distance for routes external to the AS\n"
11918 "Distance for routes internal to the AS\n"
11919 "Distance for local routes\n")
11925 bgp
->distance_ebgp
= 0;
11926 bgp
->distance_ibgp
= 0;
11927 bgp
->distance_local
= 0;
11928 return CMD_SUCCESS
;
11931 ALIAS (no_bgp_distance
,
11932 no_bgp_distance2_cmd
,
11935 "Define an administrative distance\n"
11938 DEFUN (bgp_distance_source
,
11939 bgp_distance_source_cmd
,
11940 "distance <1-255> A.B.C.D/M",
11941 "Define an administrative distance\n"
11942 "Administrative distance\n"
11943 "IP source prefix\n")
11945 bgp_distance_set (vty
, argv
[0], argv
[1], NULL
);
11946 return CMD_SUCCESS
;
11949 DEFUN (no_bgp_distance_source
,
11950 no_bgp_distance_source_cmd
,
11951 "no distance <1-255> A.B.C.D/M",
11953 "Define an administrative distance\n"
11954 "Administrative distance\n"
11955 "IP source prefix\n")
11957 bgp_distance_unset (vty
, argv
[0], argv
[1], NULL
);
11958 return CMD_SUCCESS
;
11961 DEFUN (bgp_distance_source_access_list
,
11962 bgp_distance_source_access_list_cmd
,
11963 "distance <1-255> A.B.C.D/M WORD",
11964 "Define an administrative distance\n"
11965 "Administrative distance\n"
11966 "IP source prefix\n"
11967 "Access list name\n")
11969 bgp_distance_set (vty
, argv
[0], argv
[1], argv
[2]);
11970 return CMD_SUCCESS
;
11973 DEFUN (no_bgp_distance_source_access_list
,
11974 no_bgp_distance_source_access_list_cmd
,
11975 "no distance <1-255> A.B.C.D/M WORD",
11977 "Define an administrative distance\n"
11978 "Administrative distance\n"
11979 "IP source prefix\n"
11980 "Access list name\n")
11982 bgp_distance_unset (vty
, argv
[0], argv
[1], argv
[2]);
11983 return CMD_SUCCESS
;
11986 DEFUN (bgp_damp_set
,
11988 "bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
11989 "BGP Specific commands\n"
11990 "Enable route-flap dampening\n"
11991 "Half-life time for the penalty\n"
11992 "Value to start reusing a route\n"
11993 "Value to start suppressing a route\n"
11994 "Maximum duration to suppress a stable route\n")
11997 int half
= DEFAULT_HALF_LIFE
* 60;
11998 int reuse
= DEFAULT_REUSE
;
11999 int suppress
= DEFAULT_SUPPRESS
;
12000 int max
= 4 * half
;
12004 half
= atoi (argv
[0]) * 60;
12005 reuse
= atoi (argv
[1]);
12006 suppress
= atoi (argv
[2]);
12007 max
= atoi (argv
[3]) * 60;
12009 else if (argc
== 1)
12011 half
= atoi (argv
[0]) * 60;
12016 return bgp_damp_enable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
),
12017 half
, reuse
, suppress
, max
);
12020 ALIAS (bgp_damp_set
,
12022 "bgp dampening <1-45>",
12023 "BGP Specific commands\n"
12024 "Enable route-flap dampening\n"
12025 "Half-life time for the penalty\n")
12027 ALIAS (bgp_damp_set
,
12030 "BGP Specific commands\n"
12031 "Enable route-flap dampening\n")
12033 DEFUN (bgp_damp_unset
,
12034 bgp_damp_unset_cmd
,
12035 "no bgp dampening",
12037 "BGP Specific commands\n"
12038 "Enable route-flap dampening\n")
12043 return bgp_damp_disable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
));
12046 ALIAS (bgp_damp_unset
,
12047 bgp_damp_unset2_cmd
,
12048 "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
12050 "BGP Specific commands\n"
12051 "Enable route-flap dampening\n"
12052 "Half-life time for the penalty\n"
12053 "Value to start reusing a route\n"
12054 "Value to start suppressing a route\n"
12055 "Maximum duration to suppress a stable route\n")
12057 DEFUN (show_ip_bgp_dampened_paths
,
12058 show_ip_bgp_dampened_paths_cmd
,
12059 "show ip bgp dampened-paths",
12063 "Display paths suppressed due to dampening\n")
12065 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_dampend_paths
,
12069 DEFUN (show_ip_bgp_flap_statistics
,
12070 show_ip_bgp_flap_statistics_cmd
,
12071 "show ip bgp flap-statistics",
12075 "Display flap statistics of routes\n")
12077 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
12078 bgp_show_type_flap_statistics
, NULL
);
12081 /* Display specified route of BGP table. */
12083 bgp_clear_damp_route (struct vty
*vty
, const char *view_name
,
12084 const char *ip_str
, afi_t afi
, safi_t safi
,
12085 struct prefix_rd
*prd
, int prefix_check
)
12088 struct prefix match
;
12089 struct bgp_node
*rn
;
12090 struct bgp_node
*rm
;
12091 struct bgp_info
*ri
;
12092 struct bgp_info
*ri_temp
;
12094 struct bgp_table
*table
;
12096 /* BGP structure lookup. */
12099 bgp
= bgp_lookup_by_name (view_name
);
12102 vty_out (vty
, "%% Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
12103 return CMD_WARNING
;
12108 bgp
= bgp_get_default ();
12111 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
12112 return CMD_WARNING
;
12116 /* Check IP address argument. */
12117 ret
= str2prefix (ip_str
, &match
);
12120 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
12121 return CMD_WARNING
;
12124 match
.family
= afi2family (afi
);
12126 if (safi
== SAFI_MPLS_VPN
)
12128 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= bgp_route_next (rn
))
12130 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
12133 if ((table
= rn
->info
) != NULL
)
12134 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
12136 if (! prefix_check
|| rm
->p
.prefixlen
== match
.prefixlen
)
12141 if (ri
->extra
&& ri
->extra
->damp_info
)
12143 ri_temp
= ri
->next
;
12144 bgp_damp_info_free (ri
->extra
->damp_info
, 1);
12152 bgp_unlock_node (rm
);
12158 if ((rn
= bgp_node_match (bgp
->rib
[afi
][safi
], &match
)) != NULL
)
12160 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
12165 if (ri
->extra
&& ri
->extra
->damp_info
)
12167 ri_temp
= ri
->next
;
12168 bgp_damp_info_free (ri
->extra
->damp_info
, 1);
12176 bgp_unlock_node (rn
);
12180 return CMD_SUCCESS
;
12183 DEFUN (clear_ip_bgp_dampening
,
12184 clear_ip_bgp_dampening_cmd
,
12185 "clear ip bgp dampening",
12189 "Clear route flap dampening information\n")
12191 bgp_damp_info_clean ();
12192 return CMD_SUCCESS
;
12195 DEFUN (clear_ip_bgp_dampening_prefix
,
12196 clear_ip_bgp_dampening_prefix_cmd
,
12197 "clear ip bgp dampening A.B.C.D/M",
12201 "Clear route flap dampening information\n"
12202 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
12204 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
12205 SAFI_UNICAST
, NULL
, 1);
12208 DEFUN (clear_ip_bgp_dampening_address
,
12209 clear_ip_bgp_dampening_address_cmd
,
12210 "clear ip bgp dampening A.B.C.D",
12214 "Clear route flap dampening information\n"
12215 "Network to clear damping information\n")
12217 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
12218 SAFI_UNICAST
, NULL
, 0);
12221 DEFUN (clear_ip_bgp_dampening_address_mask
,
12222 clear_ip_bgp_dampening_address_mask_cmd
,
12223 "clear ip bgp dampening A.B.C.D A.B.C.D",
12227 "Clear route flap dampening information\n"
12228 "Network to clear damping information\n"
12232 char prefix_str
[BUFSIZ
];
12234 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
12237 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
12238 return CMD_WARNING
;
12241 return bgp_clear_damp_route (vty
, NULL
, prefix_str
, AFI_IP
,
12242 SAFI_UNICAST
, NULL
, 0);
12246 bgp_config_write_network_vpnv4 (struct vty
*vty
, struct bgp
*bgp
,
12247 afi_t afi
, safi_t safi
, int *write
)
12249 struct bgp_node
*prn
;
12250 struct bgp_node
*rn
;
12251 struct bgp_table
*table
;
12253 struct prefix_rd
*prd
;
12254 struct bgp_static
*bgp_static
;
12256 char buf
[SU_ADDRSTRLEN
];
12257 char rdbuf
[RD_ADDRSTRLEN
];
12259 /* Network configuration. */
12260 for (prn
= bgp_table_top (bgp
->route
[afi
][safi
]); prn
; prn
= bgp_route_next (prn
))
12261 if ((table
= prn
->info
) != NULL
)
12262 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
12263 if ((bgp_static
= rn
->info
) != NULL
)
12266 prd
= (struct prefix_rd
*) &prn
->p
;
12268 /* "address-family" display. */
12269 bgp_config_write_family_header (vty
, afi
, safi
, write
);
12271 /* "network" configuration display. */
12272 prefix_rd2str (prd
, rdbuf
, RD_ADDRSTRLEN
);
12273 label
= decode_label (bgp_static
->tag
);
12275 vty_out (vty
, " network %s/%d rd %s tag %d",
12276 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
12279 vty_out (vty
, "%s", VTY_NEWLINE
);
12284 /* Configuration of static route announcement and aggregate
12287 bgp_config_write_network (struct vty
*vty
, struct bgp
*bgp
,
12288 afi_t afi
, safi_t safi
, int *write
)
12290 struct bgp_node
*rn
;
12292 struct bgp_static
*bgp_static
;
12293 struct bgp_aggregate
*bgp_aggregate
;
12294 char buf
[SU_ADDRSTRLEN
];
12296 if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
12297 return bgp_config_write_network_vpnv4 (vty
, bgp
, afi
, safi
, write
);
12299 /* Network configuration. */
12300 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
12301 if ((bgp_static
= rn
->info
) != NULL
)
12305 /* "address-family" display. */
12306 bgp_config_write_family_header (vty
, afi
, safi
, write
);
12308 /* "network" configuration display. */
12309 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
12311 u_int32_t destination
;
12312 struct in_addr netmask
;
12314 destination
= ntohl (p
->u
.prefix4
.s_addr
);
12315 masklen2ip (p
->prefixlen
, &netmask
);
12316 vty_out (vty
, " network %s",
12317 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
));
12319 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
12320 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
12321 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
12322 || p
->u
.prefix4
.s_addr
== 0)
12324 /* Natural mask is not display. */
12327 vty_out (vty
, " mask %s", inet_ntoa (netmask
));
12331 vty_out (vty
, " network %s/%d",
12332 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
12336 if (bgp_static
->rmap
.name
)
12337 vty_out (vty
, " route-map %s", bgp_static
->rmap
.name
);
12340 if (bgp_static
->backdoor
)
12341 vty_out (vty
, " backdoor");
12344 vty_out (vty
, "%s", VTY_NEWLINE
);
12347 /* Aggregate-address configuration. */
12348 for (rn
= bgp_table_top (bgp
->aggregate
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
12349 if ((bgp_aggregate
= rn
->info
) != NULL
)
12353 /* "address-family" display. */
12354 bgp_config_write_family_header (vty
, afi
, safi
, write
);
12356 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
12358 struct in_addr netmask
;
12360 masklen2ip (p
->prefixlen
, &netmask
);
12361 vty_out (vty
, " aggregate-address %s %s",
12362 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
12363 inet_ntoa (netmask
));
12367 vty_out (vty
, " aggregate-address %s/%d",
12368 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
12372 if (bgp_aggregate
->as_set
)
12373 vty_out (vty
, " as-set");
12375 if (bgp_aggregate
->summary_only
)
12376 vty_out (vty
, " summary-only");
12378 vty_out (vty
, "%s", VTY_NEWLINE
);
12385 bgp_config_write_distance (struct vty
*vty
, struct bgp
*bgp
)
12387 struct bgp_node
*rn
;
12388 struct bgp_distance
*bdistance
;
12390 /* Distance configuration. */
12391 if (bgp
->distance_ebgp
12392 && bgp
->distance_ibgp
12393 && bgp
->distance_local
12394 && (bgp
->distance_ebgp
!= ZEBRA_EBGP_DISTANCE_DEFAULT
12395 || bgp
->distance_ibgp
!= ZEBRA_IBGP_DISTANCE_DEFAULT
12396 || bgp
->distance_local
!= ZEBRA_IBGP_DISTANCE_DEFAULT
))
12397 vty_out (vty
, " distance bgp %d %d %d%s",
12398 bgp
->distance_ebgp
, bgp
->distance_ibgp
, bgp
->distance_local
,
12401 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
12402 if ((bdistance
= rn
->info
) != NULL
)
12404 vty_out (vty
, " distance %d %s/%d %s%s", bdistance
->distance
,
12405 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
12406 bdistance
->access_list
? bdistance
->access_list
: "",
12413 /* Allocate routing table structure and install commands. */
12415 bgp_route_init (void)
12417 /* Init BGP distance table. */
12418 bgp_distance_table
= bgp_table_init (AFI_IP
, SAFI_UNICAST
);
12420 /* IPv4 BGP commands. */
12421 install_element (BGP_NODE
, &bgp_network_cmd
);
12422 install_element (BGP_NODE
, &bgp_network_mask_cmd
);
12423 install_element (BGP_NODE
, &bgp_network_mask_natural_cmd
);
12424 install_element (BGP_NODE
, &bgp_network_route_map_cmd
);
12425 install_element (BGP_NODE
, &bgp_network_mask_route_map_cmd
);
12426 install_element (BGP_NODE
, &bgp_network_mask_natural_route_map_cmd
);
12427 install_element (BGP_NODE
, &bgp_network_backdoor_cmd
);
12428 install_element (BGP_NODE
, &bgp_network_mask_backdoor_cmd
);
12429 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_cmd
);
12430 install_element (BGP_NODE
, &no_bgp_network_cmd
);
12431 install_element (BGP_NODE
, &no_bgp_network_mask_cmd
);
12432 install_element (BGP_NODE
, &no_bgp_network_mask_natural_cmd
);
12433 install_element (BGP_NODE
, &no_bgp_network_route_map_cmd
);
12434 install_element (BGP_NODE
, &no_bgp_network_mask_route_map_cmd
);
12435 install_element (BGP_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
12436 install_element (BGP_NODE
, &no_bgp_network_backdoor_cmd
);
12437 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_cmd
);
12438 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_cmd
);
12440 install_element (BGP_NODE
, &aggregate_address_cmd
);
12441 install_element (BGP_NODE
, &aggregate_address_mask_cmd
);
12442 install_element (BGP_NODE
, &aggregate_address_summary_only_cmd
);
12443 install_element (BGP_NODE
, &aggregate_address_mask_summary_only_cmd
);
12444 install_element (BGP_NODE
, &aggregate_address_as_set_cmd
);
12445 install_element (BGP_NODE
, &aggregate_address_mask_as_set_cmd
);
12446 install_element (BGP_NODE
, &aggregate_address_as_set_summary_cmd
);
12447 install_element (BGP_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
12448 install_element (BGP_NODE
, &aggregate_address_summary_as_set_cmd
);
12449 install_element (BGP_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
12450 install_element (BGP_NODE
, &no_aggregate_address_cmd
);
12451 install_element (BGP_NODE
, &no_aggregate_address_summary_only_cmd
);
12452 install_element (BGP_NODE
, &no_aggregate_address_as_set_cmd
);
12453 install_element (BGP_NODE
, &no_aggregate_address_as_set_summary_cmd
);
12454 install_element (BGP_NODE
, &no_aggregate_address_summary_as_set_cmd
);
12455 install_element (BGP_NODE
, &no_aggregate_address_mask_cmd
);
12456 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
12457 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_cmd
);
12458 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
12459 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
12461 /* IPv4 unicast configuration. */
12462 install_element (BGP_IPV4_NODE
, &bgp_network_cmd
);
12463 install_element (BGP_IPV4_NODE
, &bgp_network_mask_cmd
);
12464 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_cmd
);
12465 install_element (BGP_IPV4_NODE
, &bgp_network_route_map_cmd
);
12466 install_element (BGP_IPV4_NODE
, &bgp_network_mask_route_map_cmd
);
12467 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_route_map_cmd
);
12468 install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
12469 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_cmd
);
12470 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_cmd
);
12471 install_element (BGP_IPV4_NODE
, &no_bgp_network_route_map_cmd
);
12472 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_route_map_cmd
);
12473 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
12475 install_element (BGP_IPV4_NODE
, &aggregate_address_cmd
);
12476 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_cmd
);
12477 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_only_cmd
);
12478 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_only_cmd
);
12479 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_cmd
);
12480 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_cmd
);
12481 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_summary_cmd
);
12482 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
12483 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_as_set_cmd
);
12484 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
12485 install_element (BGP_IPV4_NODE
, &no_aggregate_address_cmd
);
12486 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_only_cmd
);
12487 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_cmd
);
12488 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_summary_cmd
);
12489 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_as_set_cmd
);
12490 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_cmd
);
12491 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
12492 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_cmd
);
12493 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
12494 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
12496 /* IPv4 multicast configuration. */
12497 install_element (BGP_IPV4M_NODE
, &bgp_network_cmd
);
12498 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_cmd
);
12499 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_cmd
);
12500 install_element (BGP_IPV4M_NODE
, &bgp_network_route_map_cmd
);
12501 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_route_map_cmd
);
12502 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_route_map_cmd
);
12503 install_element (BGP_IPV4M_NODE
, &no_bgp_network_cmd
);
12504 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_cmd
);
12505 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_cmd
);
12506 install_element (BGP_IPV4M_NODE
, &no_bgp_network_route_map_cmd
);
12507 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_route_map_cmd
);
12508 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
12509 install_element (BGP_IPV4M_NODE
, &aggregate_address_cmd
);
12510 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_cmd
);
12511 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_only_cmd
);
12512 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_only_cmd
);
12513 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_cmd
);
12514 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_cmd
);
12515 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_summary_cmd
);
12516 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
12517 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_as_set_cmd
);
12518 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
12519 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_cmd
);
12520 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_only_cmd
);
12521 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_cmd
);
12522 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_summary_cmd
);
12523 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_as_set_cmd
);
12524 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_cmd
);
12525 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
12526 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_cmd
);
12527 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
12528 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
12530 install_element (VIEW_NODE
, &show_ip_bgp_cmd
);
12531 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cmd
);
12532 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_cmd
);
12533 install_element (VIEW_NODE
, &show_ip_bgp_route_cmd
);
12534 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_cmd
);
12535 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_route_cmd
);
12536 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
12537 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
12538 install_element (VIEW_NODE
, &show_ip_bgp_prefix_cmd
);
12539 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
12540 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_prefix_cmd
);
12541 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
12542 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
12543 install_element (VIEW_NODE
, &show_ip_bgp_view_cmd
);
12544 install_element (VIEW_NODE
, &show_ip_bgp_view_route_cmd
);
12545 install_element (VIEW_NODE
, &show_ip_bgp_view_prefix_cmd
);
12546 install_element (VIEW_NODE
, &show_ip_bgp_regexp_cmd
);
12547 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
12548 install_element (VIEW_NODE
, &show_ip_bgp_prefix_list_cmd
);
12549 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
12550 install_element (VIEW_NODE
, &show_ip_bgp_filter_list_cmd
);
12551 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
12552 install_element (VIEW_NODE
, &show_ip_bgp_route_map_cmd
);
12553 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
12554 install_element (VIEW_NODE
, &show_ip_bgp_cidr_only_cmd
);
12555 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
12556 install_element (VIEW_NODE
, &show_ip_bgp_community_all_cmd
);
12557 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
12558 install_element (VIEW_NODE
, &show_ip_bgp_community_cmd
);
12559 install_element (VIEW_NODE
, &show_ip_bgp_community2_cmd
);
12560 install_element (VIEW_NODE
, &show_ip_bgp_community3_cmd
);
12561 install_element (VIEW_NODE
, &show_ip_bgp_community4_cmd
);
12562 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_cmd
);
12563 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
12564 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
12565 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
12566 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community_all_cmd
);
12567 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community_cmd
);
12568 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community2_cmd
);
12569 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community3_cmd
);
12570 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community4_cmd
);
12571 install_element (VIEW_NODE
, &show_ip_bgp_community_exact_cmd
);
12572 install_element (VIEW_NODE
, &show_ip_bgp_community2_exact_cmd
);
12573 install_element (VIEW_NODE
, &show_ip_bgp_community3_exact_cmd
);
12574 install_element (VIEW_NODE
, &show_ip_bgp_community4_exact_cmd
);
12575 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
12576 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
12577 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
12578 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
12579 install_element (VIEW_NODE
, &show_ip_bgp_community_list_cmd
);
12580 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
12581 install_element (VIEW_NODE
, &show_ip_bgp_community_list_exact_cmd
);
12582 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
12583 install_element (VIEW_NODE
, &show_ip_bgp_prefix_longer_cmd
);
12584 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
12585 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
12586 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
12587 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
12588 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
12589 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd
);
12590 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
12591 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
12592 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
12593 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
12594 install_element (VIEW_NODE
, &show_ip_bgp_dampened_paths_cmd
);
12595 install_element (VIEW_NODE
, &show_ip_bgp_flap_statistics_cmd
);
12596 install_element (VIEW_NODE
, &show_ip_bgp_flap_address_cmd
);
12597 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_cmd
);
12598 install_element (VIEW_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
12599 install_element (VIEW_NODE
, &show_ip_bgp_flap_regexp_cmd
);
12600 install_element (VIEW_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
12601 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
12602 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
12603 install_element (VIEW_NODE
, &show_ip_bgp_flap_route_map_cmd
);
12604 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
12605 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
12606 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_cmd
);
12607 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_rsclient_cmd
);
12608 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_route_cmd
);
12609 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_rsclient_route_cmd
);
12610 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
12611 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_rsclient_prefix_cmd
);
12612 install_element (VIEW_NODE
, &show_ip_bgp_view_neighbor_advertised_route_cmd
);
12613 install_element (VIEW_NODE
, &show_ip_bgp_view_neighbor_received_routes_cmd
);
12614 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_cmd
);
12615 install_element (VIEW_NODE
, &show_bgp_view_ipv4_safi_rsclient_cmd
);
12616 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
12617 install_element (VIEW_NODE
, &show_bgp_view_ipv4_safi_rsclient_route_cmd
);
12618 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
12619 install_element (VIEW_NODE
, &show_bgp_view_ipv4_safi_rsclient_prefix_cmd
);
12621 /* Restricted node: VIEW_NODE - (set of dangerous commands) */
12622 install_element (RESTRICTED_NODE
, &show_ip_bgp_route_cmd
);
12623 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_route_cmd
);
12624 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_route_cmd
);
12625 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
12626 install_element (RESTRICTED_NODE
, &show_ip_bgp_prefix_cmd
);
12627 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
12628 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_prefix_cmd
);
12629 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
12630 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
12631 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_route_cmd
);
12632 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_prefix_cmd
);
12633 install_element (RESTRICTED_NODE
, &show_ip_bgp_community_cmd
);
12634 install_element (RESTRICTED_NODE
, &show_ip_bgp_community2_cmd
);
12635 install_element (RESTRICTED_NODE
, &show_ip_bgp_community3_cmd
);
12636 install_element (RESTRICTED_NODE
, &show_ip_bgp_community4_cmd
);
12637 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community_cmd
);
12638 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
12639 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
12640 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
12641 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community_all_cmd
);
12642 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community_cmd
);
12643 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community2_cmd
);
12644 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community3_cmd
);
12645 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community4_cmd
);
12646 install_element (RESTRICTED_NODE
, &show_ip_bgp_community_exact_cmd
);
12647 install_element (RESTRICTED_NODE
, &show_ip_bgp_community2_exact_cmd
);
12648 install_element (RESTRICTED_NODE
, &show_ip_bgp_community3_exact_cmd
);
12649 install_element (RESTRICTED_NODE
, &show_ip_bgp_community4_exact_cmd
);
12650 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
12651 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
12652 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
12653 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
12654 install_element (RESTRICTED_NODE
, &show_ip_bgp_rsclient_route_cmd
);
12655 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_rsclient_route_cmd
);
12656 install_element (RESTRICTED_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
12657 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_rsclient_prefix_cmd
);
12658 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
12659 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv4_safi_rsclient_route_cmd
);
12660 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
12661 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv4_safi_rsclient_prefix_cmd
);
12663 install_element (ENABLE_NODE
, &show_ip_bgp_cmd
);
12664 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cmd
);
12665 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_cmd
);
12666 install_element (ENABLE_NODE
, &show_ip_bgp_route_cmd
);
12667 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_cmd
);
12668 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_route_cmd
);
12669 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
12670 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
12671 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_cmd
);
12672 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
12673 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_prefix_cmd
);
12674 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
12675 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
12676 install_element (ENABLE_NODE
, &show_ip_bgp_view_cmd
);
12677 install_element (ENABLE_NODE
, &show_ip_bgp_view_route_cmd
);
12678 install_element (ENABLE_NODE
, &show_ip_bgp_view_prefix_cmd
);
12679 install_element (ENABLE_NODE
, &show_ip_bgp_regexp_cmd
);
12680 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
12681 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_list_cmd
);
12682 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
12683 install_element (ENABLE_NODE
, &show_ip_bgp_filter_list_cmd
);
12684 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
12685 install_element (ENABLE_NODE
, &show_ip_bgp_route_map_cmd
);
12686 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
12687 install_element (ENABLE_NODE
, &show_ip_bgp_cidr_only_cmd
);
12688 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
12689 install_element (ENABLE_NODE
, &show_ip_bgp_community_all_cmd
);
12690 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
12691 install_element (ENABLE_NODE
, &show_ip_bgp_community_cmd
);
12692 install_element (ENABLE_NODE
, &show_ip_bgp_community2_cmd
);
12693 install_element (ENABLE_NODE
, &show_ip_bgp_community3_cmd
);
12694 install_element (ENABLE_NODE
, &show_ip_bgp_community4_cmd
);
12695 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_cmd
);
12696 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
12697 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
12698 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
12699 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community_all_cmd
);
12700 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community_cmd
);
12701 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community2_cmd
);
12702 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community3_cmd
);
12703 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community4_cmd
);
12704 install_element (ENABLE_NODE
, &show_ip_bgp_community_exact_cmd
);
12705 install_element (ENABLE_NODE
, &show_ip_bgp_community2_exact_cmd
);
12706 install_element (ENABLE_NODE
, &show_ip_bgp_community3_exact_cmd
);
12707 install_element (ENABLE_NODE
, &show_ip_bgp_community4_exact_cmd
);
12708 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
12709 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
12710 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
12711 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
12712 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_cmd
);
12713 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
12714 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_exact_cmd
);
12715 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
12716 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_longer_cmd
);
12717 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
12718 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
12719 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
12720 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
12721 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
12722 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd
);
12723 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
12724 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
12725 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
12726 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
12727 install_element (ENABLE_NODE
, &show_ip_bgp_dampened_paths_cmd
);
12728 install_element (ENABLE_NODE
, &show_ip_bgp_flap_statistics_cmd
);
12729 install_element (ENABLE_NODE
, &show_ip_bgp_flap_address_cmd
);
12730 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_cmd
);
12731 install_element (ENABLE_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
12732 install_element (ENABLE_NODE
, &show_ip_bgp_flap_regexp_cmd
);
12733 install_element (ENABLE_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
12734 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
12735 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
12736 install_element (ENABLE_NODE
, &show_ip_bgp_flap_route_map_cmd
);
12737 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
12738 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
12739 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_cmd
);
12740 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_rsclient_cmd
);
12741 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_route_cmd
);
12742 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_rsclient_route_cmd
);
12743 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
12744 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_rsclient_prefix_cmd
);
12745 install_element (ENABLE_NODE
, &show_ip_bgp_view_neighbor_advertised_route_cmd
);
12746 install_element (ENABLE_NODE
, &show_ip_bgp_view_neighbor_received_routes_cmd
);
12747 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_cmd
);
12748 install_element (ENABLE_NODE
, &show_bgp_view_ipv4_safi_rsclient_cmd
);
12749 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
12750 install_element (ENABLE_NODE
, &show_bgp_view_ipv4_safi_rsclient_route_cmd
);
12751 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
12752 install_element (ENABLE_NODE
, &show_bgp_view_ipv4_safi_rsclient_prefix_cmd
);
12754 /* BGP dampening clear commands */
12755 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_cmd
);
12756 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_prefix_cmd
);
12757 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_cmd
);
12758 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_mask_cmd
);
12761 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_prefix_counts_cmd
);
12762 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_prefix_counts_cmd
);
12763 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd
);
12765 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_prefix_counts_cmd
);
12767 /* New config IPv6 BGP commands. */
12768 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_cmd
);
12769 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_route_map_cmd
);
12770 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_cmd
);
12771 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_route_map_cmd
);
12773 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_cmd
);
12774 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_summary_only_cmd
);
12775 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_cmd
);
12776 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_summary_only_cmd
);
12778 install_element (BGP_IPV6M_NODE
, &ipv6_bgp_network_cmd
);
12779 install_element (BGP_IPV6M_NODE
, &no_ipv6_bgp_network_cmd
);
12781 /* Old config IPv6 BGP commands. */
12782 install_element (BGP_NODE
, &old_ipv6_bgp_network_cmd
);
12783 install_element (BGP_NODE
, &old_no_ipv6_bgp_network_cmd
);
12785 install_element (BGP_NODE
, &old_ipv6_aggregate_address_cmd
);
12786 install_element (BGP_NODE
, &old_ipv6_aggregate_address_summary_only_cmd
);
12787 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_cmd
);
12788 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_summary_only_cmd
);
12790 install_element (VIEW_NODE
, &show_bgp_cmd
);
12791 install_element (VIEW_NODE
, &show_bgp_ipv6_cmd
);
12792 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_cmd
);
12793 install_element (VIEW_NODE
, &show_bgp_route_cmd
);
12794 install_element (VIEW_NODE
, &show_bgp_ipv6_route_cmd
);
12795 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_route_cmd
);
12796 install_element (VIEW_NODE
, &show_bgp_prefix_cmd
);
12797 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_cmd
);
12798 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_prefix_cmd
);
12799 install_element (VIEW_NODE
, &show_bgp_regexp_cmd
);
12800 install_element (VIEW_NODE
, &show_bgp_ipv6_regexp_cmd
);
12801 install_element (VIEW_NODE
, &show_bgp_prefix_list_cmd
);
12802 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
12803 install_element (VIEW_NODE
, &show_bgp_filter_list_cmd
);
12804 install_element (VIEW_NODE
, &show_bgp_ipv6_filter_list_cmd
);
12805 install_element (VIEW_NODE
, &show_bgp_route_map_cmd
);
12806 install_element (VIEW_NODE
, &show_bgp_ipv6_route_map_cmd
);
12807 install_element (VIEW_NODE
, &show_bgp_community_all_cmd
);
12808 install_element (VIEW_NODE
, &show_bgp_ipv6_community_all_cmd
);
12809 install_element (VIEW_NODE
, &show_bgp_community_cmd
);
12810 install_element (VIEW_NODE
, &show_bgp_ipv6_community_cmd
);
12811 install_element (VIEW_NODE
, &show_bgp_community2_cmd
);
12812 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_cmd
);
12813 install_element (VIEW_NODE
, &show_bgp_community3_cmd
);
12814 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_cmd
);
12815 install_element (VIEW_NODE
, &show_bgp_community4_cmd
);
12816 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_cmd
);
12817 install_element (VIEW_NODE
, &show_bgp_community_exact_cmd
);
12818 install_element (VIEW_NODE
, &show_bgp_ipv6_community_exact_cmd
);
12819 install_element (VIEW_NODE
, &show_bgp_community2_exact_cmd
);
12820 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
12821 install_element (VIEW_NODE
, &show_bgp_community3_exact_cmd
);
12822 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
12823 install_element (VIEW_NODE
, &show_bgp_community4_exact_cmd
);
12824 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
12825 install_element (VIEW_NODE
, &show_bgp_community_list_cmd
);
12826 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_cmd
);
12827 install_element (VIEW_NODE
, &show_bgp_community_list_exact_cmd
);
12828 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
12829 install_element (VIEW_NODE
, &show_bgp_prefix_longer_cmd
);
12830 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
12831 install_element (VIEW_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
12832 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
12833 install_element (VIEW_NODE
, &show_bgp_neighbor_received_routes_cmd
);
12834 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
12835 install_element (VIEW_NODE
, &show_bgp_neighbor_routes_cmd
);
12836 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
12837 install_element (VIEW_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
12838 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
12839 install_element (VIEW_NODE
, &show_bgp_neighbor_flap_cmd
);
12840 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
12841 install_element (VIEW_NODE
, &show_bgp_neighbor_damp_cmd
);
12842 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
12843 install_element (VIEW_NODE
, &show_bgp_rsclient_cmd
);
12844 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_rsclient_cmd
);
12845 install_element (VIEW_NODE
, &show_bgp_rsclient_route_cmd
);
12846 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_rsclient_route_cmd
);
12847 install_element (VIEW_NODE
, &show_bgp_rsclient_prefix_cmd
);
12848 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_rsclient_prefix_cmd
);
12849 install_element (VIEW_NODE
, &show_bgp_view_cmd
);
12850 install_element (VIEW_NODE
, &show_bgp_view_ipv6_cmd
);
12851 install_element (VIEW_NODE
, &show_bgp_view_route_cmd
);
12852 install_element (VIEW_NODE
, &show_bgp_view_ipv6_route_cmd
);
12853 install_element (VIEW_NODE
, &show_bgp_view_prefix_cmd
);
12854 install_element (VIEW_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
12855 install_element (VIEW_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
12856 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
12857 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
12858 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
12859 install_element (VIEW_NODE
, &show_bgp_view_neighbor_routes_cmd
);
12860 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
12861 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
12862 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
12863 install_element (VIEW_NODE
, &show_bgp_view_neighbor_flap_cmd
);
12864 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
12865 install_element (VIEW_NODE
, &show_bgp_view_neighbor_damp_cmd
);
12866 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
12867 install_element (VIEW_NODE
, &show_bgp_view_rsclient_cmd
);
12868 install_element (VIEW_NODE
, &show_bgp_view_ipv6_safi_rsclient_cmd
);
12869 install_element (VIEW_NODE
, &show_bgp_view_rsclient_route_cmd
);
12870 install_element (VIEW_NODE
, &show_bgp_view_ipv6_safi_rsclient_route_cmd
);
12871 install_element (VIEW_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
12872 install_element (VIEW_NODE
, &show_bgp_view_ipv6_safi_rsclient_prefix_cmd
);
12875 * VIEW_NODE - (set of dangerous commands) - (commands dependent on prev)
12877 install_element (RESTRICTED_NODE
, &show_bgp_route_cmd
);
12878 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_route_cmd
);
12879 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_route_cmd
);
12880 install_element (RESTRICTED_NODE
, &show_bgp_prefix_cmd
);
12881 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_prefix_cmd
);
12882 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_prefix_cmd
);
12883 install_element (RESTRICTED_NODE
, &show_bgp_community_cmd
);
12884 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community_cmd
);
12885 install_element (RESTRICTED_NODE
, &show_bgp_community2_cmd
);
12886 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community2_cmd
);
12887 install_element (RESTRICTED_NODE
, &show_bgp_community3_cmd
);
12888 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community3_cmd
);
12889 install_element (RESTRICTED_NODE
, &show_bgp_community4_cmd
);
12890 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community4_cmd
);
12891 install_element (RESTRICTED_NODE
, &show_bgp_community_exact_cmd
);
12892 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community_exact_cmd
);
12893 install_element (RESTRICTED_NODE
, &show_bgp_community2_exact_cmd
);
12894 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
12895 install_element (RESTRICTED_NODE
, &show_bgp_community3_exact_cmd
);
12896 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
12897 install_element (RESTRICTED_NODE
, &show_bgp_community4_exact_cmd
);
12898 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
12899 install_element (RESTRICTED_NODE
, &show_bgp_rsclient_route_cmd
);
12900 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_rsclient_route_cmd
);
12901 install_element (RESTRICTED_NODE
, &show_bgp_rsclient_prefix_cmd
);
12902 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_rsclient_prefix_cmd
);
12903 install_element (RESTRICTED_NODE
, &show_bgp_view_route_cmd
);
12904 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_route_cmd
);
12905 install_element (RESTRICTED_NODE
, &show_bgp_view_prefix_cmd
);
12906 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
12907 install_element (RESTRICTED_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
12908 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
12909 install_element (RESTRICTED_NODE
, &show_bgp_view_rsclient_route_cmd
);
12910 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_safi_rsclient_route_cmd
);
12911 install_element (RESTRICTED_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
12912 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_safi_rsclient_prefix_cmd
);
12914 install_element (ENABLE_NODE
, &show_bgp_cmd
);
12915 install_element (ENABLE_NODE
, &show_bgp_ipv6_cmd
);
12916 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_cmd
);
12917 install_element (ENABLE_NODE
, &show_bgp_route_cmd
);
12918 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_cmd
);
12919 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_route_cmd
);
12920 install_element (ENABLE_NODE
, &show_bgp_prefix_cmd
);
12921 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_cmd
);
12922 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_prefix_cmd
);
12923 install_element (ENABLE_NODE
, &show_bgp_regexp_cmd
);
12924 install_element (ENABLE_NODE
, &show_bgp_ipv6_regexp_cmd
);
12925 install_element (ENABLE_NODE
, &show_bgp_prefix_list_cmd
);
12926 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
12927 install_element (ENABLE_NODE
, &show_bgp_filter_list_cmd
);
12928 install_element (ENABLE_NODE
, &show_bgp_ipv6_filter_list_cmd
);
12929 install_element (ENABLE_NODE
, &show_bgp_route_map_cmd
);
12930 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_map_cmd
);
12931 install_element (ENABLE_NODE
, &show_bgp_community_all_cmd
);
12932 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_all_cmd
);
12933 install_element (ENABLE_NODE
, &show_bgp_community_cmd
);
12934 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_cmd
);
12935 install_element (ENABLE_NODE
, &show_bgp_community2_cmd
);
12936 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_cmd
);
12937 install_element (ENABLE_NODE
, &show_bgp_community3_cmd
);
12938 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_cmd
);
12939 install_element (ENABLE_NODE
, &show_bgp_community4_cmd
);
12940 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_cmd
);
12941 install_element (ENABLE_NODE
, &show_bgp_community_exact_cmd
);
12942 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_exact_cmd
);
12943 install_element (ENABLE_NODE
, &show_bgp_community2_exact_cmd
);
12944 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
12945 install_element (ENABLE_NODE
, &show_bgp_community3_exact_cmd
);
12946 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
12947 install_element (ENABLE_NODE
, &show_bgp_community4_exact_cmd
);
12948 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
12949 install_element (ENABLE_NODE
, &show_bgp_community_list_cmd
);
12950 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_cmd
);
12951 install_element (ENABLE_NODE
, &show_bgp_community_list_exact_cmd
);
12952 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
12953 install_element (ENABLE_NODE
, &show_bgp_prefix_longer_cmd
);
12954 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
12955 install_element (ENABLE_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
12956 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
12957 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_routes_cmd
);
12958 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
12959 install_element (ENABLE_NODE
, &show_bgp_neighbor_routes_cmd
);
12960 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
12961 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
12962 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
12963 install_element (ENABLE_NODE
, &show_bgp_neighbor_flap_cmd
);
12964 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
12965 install_element (ENABLE_NODE
, &show_bgp_neighbor_damp_cmd
);
12966 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
12967 install_element (ENABLE_NODE
, &show_bgp_rsclient_cmd
);
12968 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_rsclient_cmd
);
12969 install_element (ENABLE_NODE
, &show_bgp_rsclient_route_cmd
);
12970 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_rsclient_route_cmd
);
12971 install_element (ENABLE_NODE
, &show_bgp_rsclient_prefix_cmd
);
12972 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_rsclient_prefix_cmd
);
12973 install_element (ENABLE_NODE
, &show_bgp_view_cmd
);
12974 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_cmd
);
12975 install_element (ENABLE_NODE
, &show_bgp_view_route_cmd
);
12976 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_route_cmd
);
12977 install_element (ENABLE_NODE
, &show_bgp_view_prefix_cmd
);
12978 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
12979 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
12980 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
12981 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
12982 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
12983 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_routes_cmd
);
12984 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
12985 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
12986 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
12987 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_flap_cmd
);
12988 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
12989 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_damp_cmd
);
12990 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
12991 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_cmd
);
12992 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_safi_rsclient_cmd
);
12993 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_route_cmd
);
12994 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_safi_rsclient_route_cmd
);
12995 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
12996 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_safi_rsclient_prefix_cmd
);
12999 install_element (ENABLE_NODE
, &show_bgp_statistics_cmd
);
13000 install_element (ENABLE_NODE
, &show_bgp_statistics_vpnv4_cmd
);
13001 install_element (ENABLE_NODE
, &show_bgp_statistics_view_cmd
);
13002 install_element (ENABLE_NODE
, &show_bgp_statistics_view_vpnv4_cmd
);
13005 install_element (VIEW_NODE
, &show_ipv6_bgp_cmd
);
13006 install_element (VIEW_NODE
, &show_ipv6_bgp_route_cmd
);
13007 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_cmd
);
13008 install_element (VIEW_NODE
, &show_ipv6_bgp_regexp_cmd
);
13009 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
13010 install_element (VIEW_NODE
, &show_ipv6_bgp_filter_list_cmd
);
13011 install_element (VIEW_NODE
, &show_ipv6_bgp_community_all_cmd
);
13012 install_element (VIEW_NODE
, &show_ipv6_bgp_community_cmd
);
13013 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_cmd
);
13014 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_cmd
);
13015 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_cmd
);
13016 install_element (VIEW_NODE
, &show_ipv6_bgp_community_exact_cmd
);
13017 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
13018 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
13019 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
13020 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_cmd
);
13021 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
13022 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
13023 install_element (VIEW_NODE
, &show_ipv6_mbgp_cmd
);
13024 install_element (VIEW_NODE
, &show_ipv6_mbgp_route_cmd
);
13025 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_cmd
);
13026 install_element (VIEW_NODE
, &show_ipv6_mbgp_regexp_cmd
);
13027 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
13028 install_element (VIEW_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
13029 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_all_cmd
);
13030 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_cmd
);
13031 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_cmd
);
13032 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_cmd
);
13033 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_cmd
);
13034 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
13035 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
13036 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
13037 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
13038 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_cmd
);
13039 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
13040 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
13043 install_element (ENABLE_NODE
, &show_ipv6_bgp_cmd
);
13044 install_element (ENABLE_NODE
, &show_ipv6_bgp_route_cmd
);
13045 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_cmd
);
13046 install_element (ENABLE_NODE
, &show_ipv6_bgp_regexp_cmd
);
13047 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
13048 install_element (ENABLE_NODE
, &show_ipv6_bgp_filter_list_cmd
);
13049 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_all_cmd
);
13050 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_cmd
);
13051 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_cmd
);
13052 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_cmd
);
13053 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_cmd
);
13054 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_exact_cmd
);
13055 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
13056 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
13057 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
13058 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_cmd
);
13059 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
13060 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
13061 install_element (ENABLE_NODE
, &show_ipv6_mbgp_cmd
);
13062 install_element (ENABLE_NODE
, &show_ipv6_mbgp_route_cmd
);
13063 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_cmd
);
13064 install_element (ENABLE_NODE
, &show_ipv6_mbgp_regexp_cmd
);
13065 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
13066 install_element (ENABLE_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
13067 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_all_cmd
);
13068 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_cmd
);
13069 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_cmd
);
13070 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_cmd
);
13071 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_cmd
);
13072 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
13073 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
13074 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
13075 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
13076 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_cmd
);
13077 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
13078 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
13081 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
13082 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
13083 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
13084 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
13087 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
13088 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
13089 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
13090 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
13093 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
13094 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
13095 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
13096 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
13097 #endif /* HAVE_IPV6 */
13099 install_element (BGP_NODE
, &bgp_distance_cmd
);
13100 install_element (BGP_NODE
, &no_bgp_distance_cmd
);
13101 install_element (BGP_NODE
, &no_bgp_distance2_cmd
);
13102 install_element (BGP_NODE
, &bgp_distance_source_cmd
);
13103 install_element (BGP_NODE
, &no_bgp_distance_source_cmd
);
13104 install_element (BGP_NODE
, &bgp_distance_source_access_list_cmd
);
13105 install_element (BGP_NODE
, &no_bgp_distance_source_access_list_cmd
);
13107 install_element (BGP_NODE
, &bgp_damp_set_cmd
);
13108 install_element (BGP_NODE
, &bgp_damp_set2_cmd
);
13109 install_element (BGP_NODE
, &bgp_damp_set3_cmd
);
13110 install_element (BGP_NODE
, &bgp_damp_unset_cmd
);
13111 install_element (BGP_NODE
, &bgp_damp_unset2_cmd
);
13112 install_element (BGP_IPV4_NODE
, &bgp_damp_set_cmd
);
13113 install_element (BGP_IPV4_NODE
, &bgp_damp_set2_cmd
);
13114 install_element (BGP_IPV4_NODE
, &bgp_damp_set3_cmd
);
13115 install_element (BGP_IPV4_NODE
, &bgp_damp_unset_cmd
);
13116 install_element (BGP_IPV4_NODE
, &bgp_damp_unset2_cmd
);
13118 /* Deprecated AS-Pathlimit commands */
13119 install_element (BGP_NODE
, &bgp_network_ttl_cmd
);
13120 install_element (BGP_NODE
, &bgp_network_mask_ttl_cmd
);
13121 install_element (BGP_NODE
, &bgp_network_mask_natural_ttl_cmd
);
13122 install_element (BGP_NODE
, &bgp_network_backdoor_ttl_cmd
);
13123 install_element (BGP_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
13124 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
);
13126 install_element (BGP_NODE
, &no_bgp_network_ttl_cmd
);
13127 install_element (BGP_NODE
, &no_bgp_network_mask_ttl_cmd
);
13128 install_element (BGP_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
13129 install_element (BGP_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
13130 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
13131 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
);
13133 install_element (BGP_IPV4_NODE
, &bgp_network_ttl_cmd
);
13134 install_element (BGP_IPV4_NODE
, &bgp_network_mask_ttl_cmd
);
13135 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_ttl_cmd
);
13136 install_element (BGP_IPV4_NODE
, &bgp_network_backdoor_ttl_cmd
);
13137 install_element (BGP_IPV4_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
13138 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
);
13140 install_element (BGP_IPV4_NODE
, &no_bgp_network_ttl_cmd
);
13141 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_ttl_cmd
);
13142 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
13143 install_element (BGP_IPV4_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
13144 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
13145 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
);
13147 install_element (BGP_IPV4M_NODE
, &bgp_network_ttl_cmd
);
13148 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_ttl_cmd
);
13149 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_ttl_cmd
);
13150 install_element (BGP_IPV4M_NODE
, &bgp_network_backdoor_ttl_cmd
);
13151 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
13152 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
);
13154 install_element (BGP_IPV4M_NODE
, &no_bgp_network_ttl_cmd
);
13155 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_ttl_cmd
);
13156 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
13157 install_element (BGP_IPV4M_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
13158 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
13159 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
);
13162 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_ttl_cmd
);
13163 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_ttl_cmd
);
13168 bgp_route_finish (void)
13170 bgp_table_unlock (bgp_distance_table
);
13171 bgp_distance_table
= NULL
;