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"
58 #include "bgpd/bgp_nht.h"
60 /* Extern from bgp_dump.c */
61 extern const char *bgp_origin_str
[];
62 extern const char *bgp_origin_long_str
[];
65 static struct bgp_node
*
66 bgp_afi_node_get (struct bgp_table
*table
, afi_t afi
, safi_t safi
, struct prefix
*p
,
67 struct prefix_rd
*prd
)
70 struct bgp_node
*prn
= NULL
;
76 if (safi
== SAFI_MPLS_VPN
)
78 prn
= bgp_node_get (table
, (struct prefix
*) prd
);
80 if (prn
->info
== NULL
)
81 prn
->info
= bgp_table_init (afi
, safi
);
83 bgp_unlock_node (prn
);
87 rn
= bgp_node_get (table
, p
);
89 if (safi
== SAFI_MPLS_VPN
)
95 /* Allocate bgp_info_extra */
96 static struct bgp_info_extra
*
97 bgp_info_extra_new (void)
99 struct bgp_info_extra
*new;
100 new = XCALLOC (MTYPE_BGP_ROUTE_EXTRA
, sizeof (struct bgp_info_extra
));
105 bgp_info_extra_free (struct bgp_info_extra
**extra
)
109 if ((*extra
)->damp_info
)
110 bgp_damp_info_free ((*extra
)->damp_info
, 0);
112 (*extra
)->damp_info
= NULL
;
114 XFREE (MTYPE_BGP_ROUTE_EXTRA
, *extra
);
120 /* Get bgp_info extra information for the given bgp_info, lazy allocated
123 struct bgp_info_extra
*
124 bgp_info_extra_get (struct bgp_info
*ri
)
127 ri
->extra
= bgp_info_extra_new();
131 /* Free bgp route information. */
133 bgp_info_free (struct bgp_info
*binfo
)
136 bgp_attr_unintern (&binfo
->attr
);
138 bgp_unlink_nexthop(binfo
);
139 bgp_info_extra_free (&binfo
->extra
);
140 bgp_info_mpath_free (&binfo
->mpath
);
142 peer_unlock (binfo
->peer
); /* bgp_info peer reference */
144 XFREE (MTYPE_BGP_ROUTE
, binfo
);
148 bgp_info_lock (struct bgp_info
*binfo
)
155 bgp_info_unlock (struct bgp_info
*binfo
)
157 assert (binfo
&& binfo
->lock
> 0);
160 if (binfo
->lock
== 0)
163 zlog_debug ("%s: unlocked and freeing", __func__
);
164 zlog_backtrace (LOG_DEBUG
);
166 bgp_info_free (binfo
);
171 if (binfo
->lock
== 1)
173 zlog_debug ("%s: unlocked to 1", __func__
);
174 zlog_backtrace (LOG_DEBUG
);
182 bgp_info_add (struct bgp_node
*rn
, struct bgp_info
*ri
)
184 struct bgp_info
*top
;
196 peer_lock (ri
->peer
); /* bgp_info peer reference */
199 /* Do the actual removal of info from RIB, for use by bgp_process
200 completion callback *only* */
202 bgp_info_reap (struct bgp_node
*rn
, struct bgp_info
*ri
)
205 ri
->next
->prev
= ri
->prev
;
207 ri
->prev
->next
= ri
->next
;
211 bgp_info_mpath_dequeue (ri
);
212 bgp_info_unlock (ri
);
213 bgp_unlock_node (rn
);
217 bgp_info_delete (struct bgp_node
*rn
, struct bgp_info
*ri
)
219 bgp_info_set_flag (rn
, ri
, BGP_INFO_REMOVED
);
220 /* set of previous already took care of pcount */
221 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
224 /* undo the effects of a previous call to bgp_info_delete; typically
225 called when a route is deleted and then quickly re-added before the
226 deletion has been processed */
228 bgp_info_restore (struct bgp_node
*rn
, struct bgp_info
*ri
)
230 bgp_info_unset_flag (rn
, ri
, BGP_INFO_REMOVED
);
231 /* unset of previous already took care of pcount */
232 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
235 /* Adjust pcount as required */
237 bgp_pcount_adjust (struct bgp_node
*rn
, struct bgp_info
*ri
)
239 struct bgp_table
*table
;
241 assert (rn
&& bgp_node_table (rn
));
242 assert (ri
&& ri
->peer
&& ri
->peer
->bgp
);
244 table
= bgp_node_table (rn
);
246 /* Ignore 'pcount' for RS-client tables */
247 if (table
->type
!= BGP_TABLE_MAIN
248 || ri
->peer
== ri
->peer
->bgp
->peer_self
)
251 if (!BGP_INFO_COUNTABLE (ri
)
252 && CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
255 UNSET_FLAG (ri
->flags
, BGP_INFO_COUNTED
);
257 /* slight hack, but more robust against errors. */
258 if (ri
->peer
->pcount
[table
->afi
][table
->safi
])
259 ri
->peer
->pcount
[table
->afi
][table
->safi
]--;
262 zlog_warn ("%s: Asked to decrement 0 prefix count for peer %s",
263 __func__
, ri
->peer
->host
);
264 zlog_backtrace (LOG_WARNING
);
265 zlog_warn ("%s: Please report to Quagga bugzilla", __func__
);
268 else if (BGP_INFO_COUNTABLE (ri
)
269 && !CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
271 SET_FLAG (ri
->flags
, BGP_INFO_COUNTED
);
272 ri
->peer
->pcount
[table
->afi
][table
->safi
]++;
277 /* Set/unset bgp_info flags, adjusting any other state as needed.
278 * This is here primarily to keep prefix-count in check.
281 bgp_info_set_flag (struct bgp_node
*rn
, struct bgp_info
*ri
, u_int32_t flag
)
283 SET_FLAG (ri
->flags
, flag
);
285 /* early bath if we know it's not a flag that changes countability state */
286 if (!CHECK_FLAG (flag
, BGP_INFO_VALID
|BGP_INFO_HISTORY
|BGP_INFO_REMOVED
))
289 bgp_pcount_adjust (rn
, ri
);
293 bgp_info_unset_flag (struct bgp_node
*rn
, struct bgp_info
*ri
, u_int32_t flag
)
295 UNSET_FLAG (ri
->flags
, flag
);
297 /* early bath if we know it's not a flag that changes countability state */
298 if (!CHECK_FLAG (flag
, BGP_INFO_VALID
|BGP_INFO_HISTORY
|BGP_INFO_REMOVED
))
301 bgp_pcount_adjust (rn
, ri
);
304 /* Get MED value. If MED value is missing and "bgp bestpath
305 missing-as-worst" is specified, treat it as the worst value. */
307 bgp_med_value (struct attr
*attr
, struct bgp
*bgp
)
309 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
313 if (bgp_flag_check (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
))
320 /* Compare two bgp route entity. br is preferable then return 1. */
322 bgp_info_cmp (struct bgp
*bgp
, struct bgp_info
*new, struct bgp_info
*exist
,
323 int *paths_eq
, struct bgp_maxpaths_cfg
*mpath_cfg
)
325 struct attr
*newattr
, *existattr
;
326 struct attr_extra
*newattre
, *existattre
;
327 bgp_peer_sort_t new_sort
;
328 bgp_peer_sort_t exist_sort
;
330 u_int32_t exist_pref
;
333 u_int32_t new_weight
;
334 u_int32_t exist_weight
;
335 uint32_t newm
, existm
;
336 struct in_addr new_id
;
337 struct in_addr exist_id
;
340 int internal_as_route
;
353 existattr
= exist
->attr
;
354 newattre
= newattr
->extra
;
355 existattre
= existattr
->extra
;
357 /* 1. Weight check. */
358 new_weight
= exist_weight
= 0;
361 new_weight
= newattre
->weight
;
363 exist_weight
= existattre
->weight
;
365 if (new_weight
> exist_weight
)
367 if (new_weight
< exist_weight
)
370 /* 2. Local preference check. */
371 new_pref
= exist_pref
= bgp
->default_local_pref
;
373 if (newattr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
374 new_pref
= newattr
->local_pref
;
375 if (existattr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
376 exist_pref
= existattr
->local_pref
;
378 if (new_pref
> exist_pref
)
380 if (new_pref
< exist_pref
)
383 /* 3. Local route check. We prefer:
385 * - BGP_ROUTE_AGGREGATE
386 * - BGP_ROUTE_REDISTRIBUTE
388 if (! (new->sub_type
== BGP_ROUTE_NORMAL
))
390 if (! (exist
->sub_type
== BGP_ROUTE_NORMAL
))
393 /* 4. AS path length check. */
394 if (! bgp_flag_check (bgp
, BGP_FLAG_ASPATH_IGNORE
))
396 int exist_hops
= aspath_count_hops (existattr
->aspath
);
397 int exist_confeds
= aspath_count_confeds (existattr
->aspath
);
399 if (bgp_flag_check (bgp
, BGP_FLAG_ASPATH_CONFED
))
403 aspath_hops
= aspath_count_hops (newattr
->aspath
);
404 aspath_hops
+= aspath_count_confeds (newattr
->aspath
);
406 if ( aspath_hops
< (exist_hops
+ exist_confeds
))
408 if ( aspath_hops
> (exist_hops
+ exist_confeds
))
413 int newhops
= aspath_count_hops (newattr
->aspath
);
415 if (newhops
< exist_hops
)
417 if (newhops
> exist_hops
)
422 /* 5. Origin check. */
423 if (newattr
->origin
< existattr
->origin
)
425 if (newattr
->origin
> existattr
->origin
)
429 internal_as_route
= (aspath_count_hops (newattr
->aspath
) == 0
430 && aspath_count_hops (existattr
->aspath
) == 0);
431 confed_as_route
= (aspath_count_confeds (newattr
->aspath
) > 0
432 && aspath_count_confeds (existattr
->aspath
) > 0
433 && aspath_count_hops (newattr
->aspath
) == 0
434 && aspath_count_hops (existattr
->aspath
) == 0);
436 if (bgp_flag_check (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
)
437 || (bgp_flag_check (bgp
, BGP_FLAG_MED_CONFED
)
439 || aspath_cmp_left (newattr
->aspath
, existattr
->aspath
)
440 || aspath_cmp_left_confed (newattr
->aspath
, existattr
->aspath
)
441 || internal_as_route
)
443 new_med
= bgp_med_value (new->attr
, bgp
);
444 exist_med
= bgp_med_value (exist
->attr
, bgp
);
446 if (new_med
< exist_med
)
448 if (new_med
> exist_med
)
452 /* 7. Peer type check. */
453 new_sort
= new->peer
->sort
;
454 exist_sort
= exist
->peer
->sort
;
456 if (new_sort
== BGP_PEER_EBGP
457 && (exist_sort
== BGP_PEER_IBGP
|| exist_sort
== BGP_PEER_CONFED
))
459 if (exist_sort
== BGP_PEER_EBGP
460 && (new_sort
== BGP_PEER_IBGP
|| new_sort
== BGP_PEER_CONFED
))
463 /* 8. IGP metric check. */
467 newm
= new->extra
->igpmetric
;
469 existm
= exist
->extra
->igpmetric
;
476 /* 8.1. Same IGP metric. Compare the cluster list length as
477 representative of IGP hops metric. Rewrite the metric value
478 pair (newm, existm) with the cluster list length. Prefer the
479 path with smaller cluster list length. */
482 if (peer_sort (new->peer
) == BGP_PEER_IBGP
483 && peer_sort (exist
->peer
) == BGP_PEER_IBGP
484 && CHECK_FLAG (mpath_cfg
->ibgp_flags
,
485 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
))
487 newm
= BGP_CLUSTER_LIST_LENGTH(new->attr
);
488 existm
= BGP_CLUSTER_LIST_LENGTH(exist
->attr
);
496 /* 9. Maximum path check. */
499 if (bgp_flag_check(bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
))
503 * For the two paths, all comparison steps till IGP metric
504 * have succeeded - including AS_PATH hop count. Since 'bgp
505 * bestpath as-path multipath-relax' knob is on, we don't need
506 * an exact match of AS_PATH. Thus, mark the paths are equal.
507 * That will trigger both these paths to get into the multipath
512 else if (new->peer
->sort
== BGP_PEER_IBGP
)
514 if (aspath_cmp (new->attr
->aspath
, exist
->attr
->aspath
))
517 else if (new->peer
->as
== exist
->peer
->as
)
523 * TODO: If unequal cost ibgp multipath is enabled we can
524 * mark the paths as equal here instead of returning
529 /* 10. If both paths are external, prefer the path that was received
530 first (the oldest one). This step minimizes route-flap, since a
531 newer path won't displace an older one, even if it was the
532 preferred route based on the additional decision criteria below. */
533 if (! bgp_flag_check (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
)
534 && new_sort
== BGP_PEER_EBGP
535 && exist_sort
== BGP_PEER_EBGP
)
537 if (CHECK_FLAG (new->flags
, BGP_INFO_SELECTED
))
539 if (CHECK_FLAG (exist
->flags
, BGP_INFO_SELECTED
))
543 /* 11. Router-ID comparision. */
544 /* If one of the paths is "stale", the corresponding peer router-id will
545 * be 0 and would always win over the other path. If originator id is
546 * used for the comparision, it will decide which path is better.
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 /* Do this only if neither path is "stale" as stale paths do not have
573 * valid peer information (as the connection may or may not be up).
575 if (CHECK_FLAG (exist
->flags
, BGP_INFO_STALE
))
577 if (CHECK_FLAG (new->flags
, BGP_INFO_STALE
))
580 ret
= sockunion_cmp (new->peer
->su_remote
, exist
->peer
->su_remote
);
590 static enum filter_type
591 bgp_input_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
592 afi_t afi
, safi_t safi
)
594 struct bgp_filter
*filter
;
596 filter
= &peer
->filter
[afi
][safi
];
598 #define FILTER_EXIST_WARN(F,f,filter) \
599 if (BGP_DEBUG (update, UPDATE_IN) \
600 && !(F ## _IN (filter))) \
601 zlog_warn ("%s: Could not find configured input %s-list %s!", \
602 peer->host, #f, F ## _IN_NAME(filter));
604 if (DISTRIBUTE_IN_NAME (filter
)) {
605 FILTER_EXIST_WARN(DISTRIBUTE
, distribute
, filter
);
607 if (access_list_apply (DISTRIBUTE_IN (filter
), p
) == FILTER_DENY
)
611 if (PREFIX_LIST_IN_NAME (filter
)) {
612 FILTER_EXIST_WARN(PREFIX_LIST
, prefix
, filter
);
614 if (prefix_list_apply (PREFIX_LIST_IN (filter
), p
) == PREFIX_DENY
)
618 if (FILTER_LIST_IN_NAME (filter
)) {
619 FILTER_EXIST_WARN(FILTER_LIST
, as
, filter
);
621 if (as_list_apply (FILTER_LIST_IN (filter
), attr
->aspath
)== AS_FILTER_DENY
)
625 return FILTER_PERMIT
;
626 #undef FILTER_EXIST_WARN
629 static enum filter_type
630 bgp_output_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
631 afi_t afi
, safi_t safi
)
633 struct bgp_filter
*filter
;
635 filter
= &peer
->filter
[afi
][safi
];
637 #define FILTER_EXIST_WARN(F,f,filter) \
638 if (BGP_DEBUG (update, UPDATE_OUT) \
639 && !(F ## _OUT (filter))) \
640 zlog_warn ("%s: Could not find configured output %s-list %s!", \
641 peer->host, #f, F ## _OUT_NAME(filter));
643 if (DISTRIBUTE_OUT_NAME (filter
)) {
644 FILTER_EXIST_WARN(DISTRIBUTE
, distribute
, filter
);
646 if (access_list_apply (DISTRIBUTE_OUT (filter
), p
) == FILTER_DENY
)
650 if (PREFIX_LIST_OUT_NAME (filter
)) {
651 FILTER_EXIST_WARN(PREFIX_LIST
, prefix
, filter
);
653 if (prefix_list_apply (PREFIX_LIST_OUT (filter
), p
) == PREFIX_DENY
)
657 if (FILTER_LIST_OUT_NAME (filter
)) {
658 FILTER_EXIST_WARN(FILTER_LIST
, as
, filter
);
660 if (as_list_apply (FILTER_LIST_OUT (filter
), attr
->aspath
) == AS_FILTER_DENY
)
664 return FILTER_PERMIT
;
665 #undef FILTER_EXIST_WARN
668 /* If community attribute includes no_export then return 1. */
670 bgp_community_filter (struct peer
*peer
, struct attr
*attr
)
674 /* NO_ADVERTISE check. */
675 if (community_include (attr
->community
, COMMUNITY_NO_ADVERTISE
))
678 /* NO_EXPORT check. */
679 if (peer
->sort
== BGP_PEER_EBGP
&&
680 community_include (attr
->community
, COMMUNITY_NO_EXPORT
))
683 /* NO_EXPORT_SUBCONFED check. */
684 if (peer
->sort
== BGP_PEER_EBGP
685 || peer
->sort
== BGP_PEER_CONFED
)
686 if (community_include (attr
->community
, COMMUNITY_NO_EXPORT_SUBCONFED
))
692 /* Route reflection loop check. */
694 bgp_cluster_filter (struct peer
*peer
, struct attr
*attr
)
696 struct in_addr cluster_id
;
698 if (attr
->extra
&& attr
->extra
->cluster
)
700 if (peer
->bgp
->config
& BGP_CONFIG_CLUSTER_ID
)
701 cluster_id
= peer
->bgp
->cluster_id
;
703 cluster_id
= peer
->bgp
->router_id
;
705 if (cluster_loop_check (attr
->extra
->cluster
, cluster_id
))
712 bgp_input_modifier (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
713 afi_t afi
, safi_t safi
, char *rmap_name
)
715 struct bgp_filter
*filter
;
716 struct bgp_info info
;
717 route_map_result_t ret
;
718 struct route_map
*rmap
= NULL
;
720 filter
= &peer
->filter
[afi
][safi
];
722 /* Apply default weight value. */
724 (bgp_attr_extra_get (attr
))->weight
= peer
->weight
;
728 rmap
= route_map_lookup_by_name(rmap_name
);
732 if (ROUTE_MAP_IN_NAME(filter
))
733 rmap
= ROUTE_MAP_IN (filter
);
736 /* Route map apply. */
739 /* Duplicate current value to new strucutre for modification. */
743 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IN
);
745 /* Apply BGP route map to the attribute. */
746 ret
= route_map_apply (rmap
, p
, RMAP_BGP
, &info
);
750 if (ret
== RMAP_DENYMATCH
)
752 /* Free newly generated AS path and community by route-map. */
753 bgp_attr_flush (attr
);
761 bgp_output_modifier (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
762 afi_t afi
, safi_t safi
, char *rmap_name
)
764 struct bgp_filter
*filter
;
765 struct bgp_info info
;
766 route_map_result_t ret
;
767 struct route_map
*rmap
= NULL
;
769 filter
= &peer
->filter
[afi
][safi
];
771 /* Apply default weight value. */
773 (bgp_attr_extra_get (attr
))->weight
= peer
->weight
;
777 rmap
= route_map_lookup_by_name(rmap_name
);
781 if (ROUTE_MAP_OUT_NAME(filter
))
782 rmap
= ROUTE_MAP_OUT (filter
);
785 /* Route map apply. */
788 /* Duplicate current value to new strucutre for modification. */
792 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_OUT
);
794 /* Apply BGP route map to the attribute. */
795 ret
= route_map_apply (rmap
, p
, RMAP_BGP
, &info
);
799 if (ret
== RMAP_DENYMATCH
)
800 /* caller has multiple error paths with bgp_attr_flush() */
807 bgp_export_modifier (struct peer
*rsclient
, struct peer
*peer
,
808 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
810 struct bgp_filter
*filter
;
811 struct bgp_info info
;
812 route_map_result_t ret
;
814 filter
= &peer
->filter
[afi
][safi
];
816 /* Route map apply. */
817 if (ROUTE_MAP_EXPORT_NAME (filter
))
819 /* Duplicate current value to new strucutre for modification. */
820 info
.peer
= rsclient
;
823 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
825 /* Apply BGP route map to the attribute. */
826 ret
= route_map_apply (ROUTE_MAP_EXPORT (filter
), p
, RMAP_BGP
, &info
);
828 rsclient
->rmap_type
= 0;
830 if (ret
== RMAP_DENYMATCH
)
832 /* Free newly generated AS path and community by route-map. */
833 bgp_attr_flush (attr
);
841 bgp_import_modifier (struct peer
*rsclient
, struct peer
*peer
,
842 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
844 struct bgp_filter
*filter
;
845 struct bgp_info info
;
846 route_map_result_t ret
;
848 filter
= &rsclient
->filter
[afi
][safi
];
850 /* Apply default weight value. */
852 (bgp_attr_extra_get (attr
))->weight
= peer
->weight
;
854 /* Route map apply. */
855 if (ROUTE_MAP_IMPORT_NAME (filter
))
857 /* Duplicate current value to new strucutre for modification. */
861 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IMPORT
);
863 /* Apply BGP route map to the attribute. */
864 ret
= route_map_apply (ROUTE_MAP_IMPORT (filter
), p
, RMAP_BGP
, &info
);
868 if (ret
== RMAP_DENYMATCH
)
870 /* Free newly generated AS path and community by route-map. */
871 bgp_attr_flush (attr
);
879 /* If this is an EBGP peer with remove-private-AS */
881 bgp_peer_remove_private_as(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
882 struct peer
*peer
, struct attr
*attr
)
884 if (peer
->sort
== BGP_PEER_EBGP
&&
885 peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
))
887 // Take action on the entire aspath
888 if (peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
890 if (peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
891 attr
->aspath
= aspath_replace_private_asns (attr
->aspath
, bgp
->as
);
893 // The entire aspath consists of private ASNs so create an empty aspath
894 else if (aspath_private_as_check (attr
->aspath
))
895 attr
->aspath
= aspath_empty_get ();
897 // There are some public and some private ASNs, remove the private ASNs
899 attr
->aspath
= aspath_remove_private_asns (attr
->aspath
);
902 // 'all' was not specified so the entire aspath must be private ASNs
903 // for us to do anything
904 else if (aspath_private_as_check (attr
->aspath
))
906 if (peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
907 attr
->aspath
= aspath_replace_private_asns (attr
->aspath
, bgp
->as
);
909 attr
->aspath
= aspath_empty_get ();
914 /* If this is an EBGP peer with as-override */
916 bgp_peer_as_override(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
917 struct peer
*peer
, struct attr
*attr
)
919 if (peer
->sort
== BGP_PEER_EBGP
&&
920 peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_AS_OVERRIDE
))
922 if (aspath_single_asn_check (attr
->aspath
, peer
->as
))
923 attr
->aspath
= aspath_replace_specific_asn (attr
->aspath
, peer
->as
, bgp
->as
);
928 bgp_announce_check (struct bgp_info
*ri
, struct peer
*peer
, struct prefix
*p
,
929 struct attr
*attr
, afi_t afi
, safi_t safi
)
932 char buf
[SU_ADDRSTRLEN
];
933 struct bgp_filter
*filter
;
941 filter
= &peer
->filter
[afi
][safi
];
943 riattr
= bgp_info_mpath_count (ri
) ? bgp_info_mpath_attr (ri
) : ri
->attr
;
945 if (DISABLE_BGP_ANNOUNCE
)
948 /* Do not send announces to RS-clients from the 'normal' bgp_table. */
949 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
952 /* Do not send back route to sender. */
956 /* Aggregate-address suppress check. */
957 if (ri
->extra
&& ri
->extra
->suppress
)
958 if (! UNSUPPRESS_MAP_NAME (filter
))
961 /* Default route check. */
962 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
964 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
967 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
969 #endif /* HAVE_IPV6 */
972 /* Transparency check. */
973 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
)
974 && CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
979 /* If community is not disabled check the no-export and local. */
980 if (! transparent
&& bgp_community_filter (peer
, riattr
))
983 /* If the attribute has originator-id and it is same as remote
985 if (riattr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
987 if (IPV4_ADDR_SAME (&peer
->remote_id
, &riattr
->extra
->originator_id
))
989 if (bgp_debug_update(peer
, p
, 0))
990 zlog_debug("%s [Update:SEND] %s/%d originator-id is same as remote router-id",
992 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
998 /* ORF prefix-list filter check */
999 if (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
1000 && (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
1001 || CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
1002 if (peer
->orf_plist
[afi
][safi
])
1004 if (prefix_list_apply (peer
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
1008 /* Output filter check. */
1009 if (bgp_output_filter (peer
, p
, riattr
, afi
, safi
) == FILTER_DENY
)
1011 if (bgp_debug_update(peer
, p
, 0))
1012 zlog_debug("%s [Update:SEND] %s/%d is filtered",
1014 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1019 #ifdef BGP_SEND_ASPATH_CHECK
1020 /* AS path loop check. */
1021 if (aspath_loop_check (riattr
->aspath
, peer
->as
))
1023 if (bgp_debug_update(peer
, p
, 0))
1024 zlog_debug("%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
1025 peer
->host
, peer
->as
);
1028 #endif /* BGP_SEND_ASPATH_CHECK */
1030 /* If we're a CONFED we need to loop check the CONFED ID too */
1031 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
1033 if (aspath_loop_check(riattr
->aspath
, bgp
->confed_id
))
1035 if (bgp_debug_update(peer
, p
, 0))
1036 zlog_debug("%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
1043 /* Route-Reflect check. */
1044 if (from
->sort
== BGP_PEER_IBGP
&& peer
->sort
== BGP_PEER_IBGP
)
1049 /* IBGP reflection check. */
1052 /* A route from a Client peer. */
1053 if (CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
1055 /* Reflect to all the Non-Client peers and also to the
1056 Client peers other than the originator. Originator check
1057 is already done. So there is noting to do. */
1058 /* no bgp client-to-client reflection check. */
1059 if (bgp_flag_check (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
))
1060 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
1065 /* A route from a Non-client peer. Reflect to all other
1067 if (! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
1072 /* For modify attribute, copy it to temporary structure. */
1073 bgp_attr_dup (attr
, riattr
);
1075 /* If local-preference is not set. */
1076 if ((peer
->sort
== BGP_PEER_IBGP
1077 || peer
->sort
== BGP_PEER_CONFED
)
1078 && (! (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))))
1080 attr
->flag
|= ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
);
1081 attr
->local_pref
= bgp
->default_local_pref
;
1084 /* If originator-id is not set and the route is to be reflected,
1085 set the originator id */
1086 if (peer
&& from
&& peer
->sort
== BGP_PEER_IBGP
&&
1087 from
->sort
== BGP_PEER_IBGP
&&
1088 (! (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))))
1090 attr
->extra
= bgp_attr_extra_get(attr
);
1091 IPV4_ADDR_COPY(&(attr
->extra
->originator_id
), &(from
->remote_id
));
1092 SET_FLAG(attr
->flag
, BGP_ATTR_ORIGINATOR_ID
);
1095 /* Remove MED if its an EBGP peer - will get overwritten by route-maps */
1096 if (peer
->sort
== BGP_PEER_EBGP
1097 && attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
1099 if (ri
->peer
!= bgp
->peer_self
&& ! transparent
1100 && ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
1101 attr
->flag
&= ~(ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
));
1106 || (reflect
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF_ALL
))
1107 || (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
)
1108 && ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
)
1110 || (p
->family
== AF_INET6
&&
1111 ! IN6_IS_ADDR_UNSPECIFIED(&attr
->extra
->mp_nexthop_global
))
1112 #endif /* HAVE_IPV6 */
1115 /* NEXT-HOP Unchanged. */
1117 else if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
1118 || (p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
1120 || (p
->family
== AF_INET6
&&
1121 IN6_IS_ADDR_UNSPECIFIED(&attr
->extra
->mp_nexthop_global
))
1122 #endif /* HAVE_IPV6 */
1123 || (peer
->sort
== BGP_PEER_EBGP
1124 && (bgp_multiaccess_check_v4 (attr
->nexthop
, peer
) == 0)))
1126 /* Set IPv4 nexthop. */
1127 if (p
->family
== AF_INET
)
1129 if (safi
== SAFI_MPLS_VPN
)
1130 memcpy (&attr
->extra
->mp_nexthop_global_in
, &peer
->nexthop
.v4
,
1133 memcpy (&attr
->nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
1136 /* Set IPv6 nexthop. */
1137 if (p
->family
== AF_INET6
)
1139 /* IPv6 global nexthop must be included. */
1140 memcpy (&attr
->extra
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
1142 attr
->extra
->mp_nexthop_len
= 16;
1144 #endif /* HAVE_IPV6 */
1148 if (p
->family
== AF_INET6
)
1150 /* Left nexthop_local unchanged if so configured. */
1151 if ( CHECK_FLAG (peer
->af_flags
[afi
][safi
],
1152 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
1154 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->extra
->mp_nexthop_local
) )
1155 attr
->extra
->mp_nexthop_len
=32;
1157 attr
->extra
->mp_nexthop_len
=16;
1160 /* Default nexthop_local treatment for non-RS-Clients */
1163 /* Link-local address should not be transit to different peer. */
1164 attr
->extra
->mp_nexthop_len
= 16;
1166 /* Set link-local address for shared network peer. */
1167 if (peer
->shared_network
1168 && ! IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
1170 memcpy (&attr
->extra
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
1172 attr
->extra
->mp_nexthop_len
= 32;
1175 /* If bgpd act as BGP-4+ route-reflector, do not send link-local
1178 attr
->extra
->mp_nexthop_len
= 16;
1180 /* If BGP-4+ link-local nexthop is not link-local nexthop. */
1181 if (! IN6_IS_ADDR_LINKLOCAL (&peer
->nexthop
.v6_local
))
1182 attr
->extra
->mp_nexthop_len
= 16;
1186 #endif /* HAVE_IPV6 */
1188 bgp_peer_remove_private_as(bgp
, afi
, safi
, peer
, attr
);
1189 bgp_peer_as_override(bgp
, afi
, safi
, peer
, attr
);
1191 /* Route map & unsuppress-map apply. */
1192 if (ROUTE_MAP_OUT_NAME (filter
)
1193 || (ri
->extra
&& ri
->extra
->suppress
) )
1195 struct bgp_info info
;
1196 struct attr dummy_attr
;
1197 struct attr_extra dummy_extra
;
1199 dummy_attr
.extra
= &dummy_extra
;
1204 /* The route reflector is not allowed to modify the attributes
1205 of the reflected IBGP routes. */
1206 if ((from
->sort
== BGP_PEER_IBGP
&& peer
->sort
== BGP_PEER_IBGP
) &&
1207 !bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
1209 bgp_attr_dup (&dummy_attr
, attr
);
1210 info
.attr
= &dummy_attr
;
1213 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_OUT
);
1215 if (ri
->extra
&& ri
->extra
->suppress
)
1216 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
1218 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
1220 peer
->rmap_type
= 0;
1222 if (ret
== RMAP_DENYMATCH
)
1224 bgp_attr_flush (attr
);
1232 bgp_announce_check_rsclient (struct bgp_info
*ri
, struct peer
*rsclient
,
1233 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
1236 char buf
[SU_ADDRSTRLEN
];
1237 struct bgp_filter
*filter
;
1238 struct bgp_info info
;
1240 struct attr
*riattr
;
1244 filter
= &rsclient
->filter
[afi
][safi
];
1245 bgp
= rsclient
->bgp
;
1246 riattr
= bgp_info_mpath_count (ri
) ? bgp_info_mpath_attr (ri
) : ri
->attr
;
1248 if (DISABLE_BGP_ANNOUNCE
)
1251 /* Do not send back route to sender. */
1252 if (from
== rsclient
)
1255 /* Aggregate-address suppress check. */
1256 if (ri
->extra
&& ri
->extra
->suppress
)
1257 if (! UNSUPPRESS_MAP_NAME (filter
))
1260 /* Default route check. */
1261 if (CHECK_FLAG (rsclient
->af_sflags
[afi
][safi
],
1262 PEER_STATUS_DEFAULT_ORIGINATE
))
1264 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
1267 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
1269 #endif /* HAVE_IPV6 */
1272 /* If the attribute has originator-id and it is same as remote
1274 if (riattr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
1276 if (IPV4_ADDR_SAME (&rsclient
->remote_id
,
1277 &riattr
->extra
->originator_id
))
1279 if (bgp_debug_update(rsclient
, p
, 0))
1280 zlog_debug ("%s [Update:SEND] %s/%d originator-id is same as remote router-id",
1282 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1288 /* ORF prefix-list filter check */
1289 if (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
1290 && (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
1291 || CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
1292 if (rsclient
->orf_plist
[afi
][safi
])
1294 if (prefix_list_apply (rsclient
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
1298 /* Output filter check. */
1299 if (bgp_output_filter (rsclient
, p
, riattr
, afi
, safi
) == FILTER_DENY
)
1301 if (bgp_debug_update(rsclient
, p
, 0))
1302 zlog_debug ("%s [Update:SEND] %s/%d is filtered",
1304 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1309 #ifdef BGP_SEND_ASPATH_CHECK
1310 /* AS path loop check. */
1311 if (aspath_loop_check (riattr
->aspath
, rsclient
->as
))
1313 if (bgp_debug_update(rsclient
, p
, 0))
1314 zlog_debug ("%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
1315 rsclient
->host
, rsclient
->as
);
1318 #endif /* BGP_SEND_ASPATH_CHECK */
1320 /* For modify attribute, copy it to temporary structure. */
1321 bgp_attr_dup (attr
, riattr
);
1324 if ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
1326 || (p
->family
== AF_INET6
&&
1327 IN6_IS_ADDR_UNSPECIFIED(&attr
->extra
->mp_nexthop_global
))
1328 #endif /* HAVE_IPV6 */
1331 /* Set IPv4 nexthop. */
1332 if (p
->family
== AF_INET
)
1334 if (safi
== SAFI_MPLS_VPN
)
1335 memcpy (&attr
->extra
->mp_nexthop_global_in
, &rsclient
->nexthop
.v4
,
1338 memcpy (&attr
->nexthop
, &rsclient
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
1341 /* Set IPv6 nexthop. */
1342 if (p
->family
== AF_INET6
)
1344 /* IPv6 global nexthop must be included. */
1345 memcpy (&attr
->extra
->mp_nexthop_global
, &rsclient
->nexthop
.v6_global
,
1347 attr
->extra
->mp_nexthop_len
= 16;
1349 #endif /* HAVE_IPV6 */
1353 if (p
->family
== AF_INET6
)
1355 struct attr_extra
*attre
= attr
->extra
;
1357 /* Left nexthop_local unchanged if so configured. */
1358 if ( CHECK_FLAG (rsclient
->af_flags
[afi
][safi
],
1359 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
1361 if ( IN6_IS_ADDR_LINKLOCAL (&attre
->mp_nexthop_local
) )
1362 attre
->mp_nexthop_len
=32;
1364 attre
->mp_nexthop_len
=16;
1367 /* Default nexthop_local treatment for RS-Clients */
1370 /* Announcer and RS-Client are both in the same network */
1371 if (rsclient
->shared_network
&& from
->shared_network
&&
1372 (rsclient
->ifindex
== from
->ifindex
))
1374 if ( IN6_IS_ADDR_LINKLOCAL (&attre
->mp_nexthop_local
) )
1375 attre
->mp_nexthop_len
=32;
1377 attre
->mp_nexthop_len
=16;
1380 /* Set link-local address for shared network peer. */
1381 else if (rsclient
->shared_network
1382 && IN6_IS_ADDR_LINKLOCAL (&rsclient
->nexthop
.v6_local
))
1384 memcpy (&attre
->mp_nexthop_local
, &rsclient
->nexthop
.v6_local
,
1386 attre
->mp_nexthop_len
= 32;
1390 attre
->mp_nexthop_len
= 16;
1394 #endif /* HAVE_IPV6 */
1396 bgp_peer_remove_private_as(bgp
, afi
, safi
, rsclient
, attr
);
1397 bgp_peer_as_override(bgp
, afi
, safi
, rsclient
, attr
);
1399 /* Route map & unsuppress-map apply. */
1400 if (ROUTE_MAP_OUT_NAME (filter
) || (ri
->extra
&& ri
->extra
->suppress
) )
1402 info
.peer
= rsclient
;
1405 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_OUT
);
1407 if (ri
->extra
&& ri
->extra
->suppress
)
1408 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
1410 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
1412 rsclient
->rmap_type
= 0;
1414 if (ret
== RMAP_DENYMATCH
)
1416 bgp_attr_flush (attr
);
1424 struct bgp_info_pair
1426 struct bgp_info
*old
;
1427 struct bgp_info
*new;
1431 bgp_best_selection (struct bgp
*bgp
, struct bgp_node
*rn
,
1432 struct bgp_maxpaths_cfg
*mpath_cfg
,
1433 struct bgp_info_pair
*result
)
1435 struct bgp_info
*new_select
;
1436 struct bgp_info
*old_select
;
1437 struct bgp_info
*ri
;
1438 struct bgp_info
*ri1
;
1439 struct bgp_info
*ri2
;
1440 struct bgp_info
*nextri
= NULL
;
1441 int paths_eq
, do_mpath
;
1442 struct list mp_list
;
1443 char buf
[INET6_BUFSIZ
];
1445 bgp_mp_list_init (&mp_list
);
1446 do_mpath
= (mpath_cfg
->maxpaths_ebgp
!= BGP_DEFAULT_MAXPATHS
||
1447 mpath_cfg
->maxpaths_ibgp
!= BGP_DEFAULT_MAXPATHS
);
1449 /* bgp deterministic-med */
1451 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1452 for (ri1
= rn
->info
; ri1
; ri1
= ri1
->next
)
1454 if (CHECK_FLAG (ri1
->flags
, BGP_INFO_DMED_CHECK
))
1456 if (BGP_INFO_HOLDDOWN (ri1
))
1461 bgp_mp_list_add (&mp_list
, ri1
);
1462 old_select
= CHECK_FLAG (ri1
->flags
, BGP_INFO_SELECTED
) ? ri1
: NULL
;
1464 for (ri2
= ri1
->next
; ri2
; ri2
= ri2
->next
)
1466 if (CHECK_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
))
1468 if (BGP_INFO_HOLDDOWN (ri2
))
1471 if (aspath_cmp_left (ri1
->attr
->aspath
, ri2
->attr
->aspath
)
1472 || aspath_cmp_left_confed (ri1
->attr
->aspath
,
1475 if (CHECK_FLAG (ri2
->flags
, BGP_INFO_SELECTED
))
1477 if (bgp_info_cmp (bgp
, ri2
, new_select
, &paths_eq
,
1480 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_DMED_SELECTED
);
1482 if (do_mpath
&& !paths_eq
)
1484 bgp_mp_list_clear (&mp_list
);
1485 bgp_mp_list_add (&mp_list
, ri2
);
1489 if (do_mpath
&& paths_eq
)
1490 bgp_mp_list_add (&mp_list
, ri2
);
1492 bgp_info_set_flag (rn
, ri2
, BGP_INFO_DMED_CHECK
);
1495 bgp_info_set_flag (rn
, new_select
, BGP_INFO_DMED_CHECK
);
1496 bgp_info_set_flag (rn
, new_select
, BGP_INFO_DMED_SELECTED
);
1498 bgp_info_mpath_update (rn
, new_select
, old_select
, &mp_list
, mpath_cfg
);
1499 bgp_mp_list_clear (&mp_list
);
1502 /* Check old selected route and new selected route. */
1505 for (ri
= rn
->info
; (ri
!= NULL
) && (nextri
= ri
->next
, 1); ri
= nextri
)
1507 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
1510 if (BGP_INFO_HOLDDOWN (ri
))
1512 /* reap REMOVED routes, if needs be
1513 * selected route must stay for a while longer though
1515 if (CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
)
1516 && (ri
!= old_select
))
1517 bgp_info_reap (rn
, ri
);
1522 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
)
1523 && (! CHECK_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
)))
1525 bgp_info_unset_flag (rn
, ri
, BGP_INFO_DMED_CHECK
);
1528 bgp_info_unset_flag (rn
, ri
, BGP_INFO_DMED_CHECK
);
1529 bgp_info_unset_flag (rn
, ri
, BGP_INFO_DMED_SELECTED
);
1531 if (bgp_info_cmp (bgp
, ri
, new_select
, &paths_eq
, mpath_cfg
))
1533 if (do_mpath
&& bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1534 bgp_mp_dmed_deselect (new_select
);
1538 if (do_mpath
&& !paths_eq
)
1540 bgp_mp_list_clear (&mp_list
);
1541 bgp_mp_list_add (&mp_list
, ri
);
1544 else if (do_mpath
&& bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1545 bgp_mp_dmed_deselect (ri
);
1547 if (do_mpath
&& paths_eq
)
1548 bgp_mp_list_add (&mp_list
, ri
);
1552 if (!bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1553 bgp_info_mpath_update (rn
, new_select
, old_select
, &mp_list
, mpath_cfg
);
1555 bgp_info_mpath_aggregate_update (new_select
, old_select
);
1556 bgp_mp_list_clear (&mp_list
);
1558 result
->old
= old_select
;
1559 result
->new = new_select
;
1565 bgp_process_announce_selected (struct peer
*peer
, struct bgp_info
*selected
,
1566 struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
1570 struct attr_extra extra
;
1574 /* Announce route to Established peer. */
1575 if (peer
->status
!= Established
)
1578 /* Address family configuration check. */
1579 if (! peer
->afc_nego
[afi
][safi
])
1582 /* First update is deferred until ORF or ROUTE-REFRESH is received */
1583 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
1584 PEER_STATUS_ORF_WAIT_REFRESH
))
1587 /* It's initialized in bgp_announce_[check|check_rsclient]() */
1588 attr
.extra
= &extra
;
1590 switch (bgp_node_table (rn
)->type
)
1592 case BGP_TABLE_MAIN
:
1593 /* Announcement to peer->conf. If the route is filtered,
1595 if (selected
&& bgp_announce_check (selected
, peer
, p
, &attr
, afi
, safi
))
1596 bgp_adj_out_set (rn
, peer
, p
, &attr
, afi
, safi
, selected
);
1598 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1600 case BGP_TABLE_RSCLIENT
:
1601 /* Announcement to peer->conf. If the route is filtered,
1604 bgp_announce_check_rsclient (selected
, peer
, p
, &attr
, afi
, safi
))
1605 bgp_adj_out_set (rn
, peer
, p
, &attr
, afi
, safi
, selected
);
1607 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1614 struct bgp_process_queue
1617 struct bgp_node
*rn
;
1622 static wq_item_status
1623 bgp_process_rsclient (struct work_queue
*wq
, void *data
)
1625 struct bgp_process_queue
*pq
= data
;
1626 struct bgp
*bgp
= pq
->bgp
;
1627 struct bgp_node
*rn
= pq
->rn
;
1628 afi_t afi
= pq
->afi
;
1629 safi_t safi
= pq
->safi
;
1630 struct bgp_info
*new_select
;
1631 struct bgp_info
*old_select
;
1632 struct bgp_info_pair old_and_new
;
1633 struct listnode
*node
, *nnode
;
1634 struct peer
*rsclient
;
1636 /* Is it end of initial update? (after startup) */
1639 /* This is just to keep the display sane in case all the peers are
1641 quagga_timestamp(3, bgp
->update_delay_zebra_resume_time
,
1642 sizeof(bgp
->update_delay_zebra_resume_time
));
1644 bgp
->rsclient_peers_update_hold
= 0;
1645 bgp_start_routeadv(bgp
);
1649 rsclient
= bgp_node_table (rn
)->owner
;
1651 /* Best path selection. */
1652 bgp_best_selection (bgp
, rn
, &bgp
->maxpaths
[afi
][safi
], &old_and_new
);
1653 new_select
= old_and_new
.new;
1654 old_select
= old_and_new
.old
;
1656 if (CHECK_FLAG (rsclient
->sflags
, PEER_STATUS_GROUP
))
1658 if (rsclient
->group
)
1659 for (ALL_LIST_ELEMENTS (rsclient
->group
->peer
, node
, nnode
, rsclient
))
1661 /* Nothing to do. */
1662 if (old_select
&& old_select
== new_select
)
1663 if (!CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1667 bgp_info_unset_flag (rn
, old_select
, BGP_INFO_SELECTED
);
1670 bgp_info_set_flag (rn
, new_select
, BGP_INFO_SELECTED
);
1671 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_ATTR_CHANGED
);
1672 UNSET_FLAG (new_select
->flags
, BGP_INFO_MULTIPATH_CHG
);
1675 bgp_process_announce_selected (rsclient
, new_select
, rn
,
1682 bgp_info_unset_flag (rn
, old_select
, BGP_INFO_SELECTED
);
1685 bgp_info_set_flag (rn
, new_select
, BGP_INFO_SELECTED
);
1686 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_ATTR_CHANGED
);
1687 UNSET_FLAG (new_select
->flags
, BGP_INFO_MULTIPATH_CHG
);
1689 bgp_process_announce_selected (rsclient
, new_select
, rn
, afi
, safi
);
1692 if (old_select
&& CHECK_FLAG (old_select
->flags
, BGP_INFO_REMOVED
))
1693 bgp_info_reap (rn
, old_select
);
1695 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1699 static wq_item_status
1700 bgp_process_main (struct work_queue
*wq
, void *data
)
1702 struct bgp_process_queue
*pq
= data
;
1703 struct bgp
*bgp
= pq
->bgp
;
1704 struct bgp_node
*rn
= pq
->rn
;
1705 afi_t afi
= pq
->afi
;
1706 safi_t safi
= pq
->safi
;
1707 struct prefix
*p
= &rn
->p
;
1708 struct bgp_info
*new_select
;
1709 struct bgp_info
*old_select
;
1710 struct bgp_info_pair old_and_new
;
1711 struct listnode
*node
, *nnode
;
1714 /* Is it end of initial update? (after startup) */
1717 quagga_timestamp(3, bgp
->update_delay_zebra_resume_time
,
1718 sizeof(bgp
->update_delay_zebra_resume_time
));
1720 bgp
->main_zebra_update_hold
= 0;
1721 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1722 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1724 bgp_zebra_announce_table(bgp
, afi
, safi
);
1726 bgp
->main_peers_update_hold
= 0;
1728 bgp_start_routeadv(bgp
);
1732 /* Best path selection. */
1733 bgp_best_selection (bgp
, rn
, &bgp
->maxpaths
[afi
][safi
], &old_and_new
);
1734 old_select
= old_and_new
.old
;
1735 new_select
= old_and_new
.new;
1737 /* Nothing to do. */
1738 if (old_select
&& old_select
== new_select
&& !CHECK_FLAG(rn
->flags
, BGP_NODE_USER_CLEAR
))
1740 if (! CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1742 if (CHECK_FLAG (old_select
->flags
, BGP_INFO_IGP_CHANGED
) ||
1743 CHECK_FLAG (old_select
->flags
, BGP_INFO_MULTIPATH_CHG
))
1744 bgp_zebra_announce (p
, old_select
, bgp
, afi
, safi
);
1746 UNSET_FLAG (old_select
->flags
, BGP_INFO_MULTIPATH_CHG
);
1747 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1752 /* If the user did "clear ip bgp prefix x.x.x.x" this flag will be set */
1753 UNSET_FLAG(rn
->flags
, BGP_NODE_USER_CLEAR
);
1756 bgp_info_unset_flag (rn
, old_select
, BGP_INFO_SELECTED
);
1759 bgp_info_set_flag (rn
, new_select
, BGP_INFO_SELECTED
);
1760 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_ATTR_CHANGED
);
1761 UNSET_FLAG (new_select
->flags
, BGP_INFO_MULTIPATH_CHG
);
1765 /* Check each BGP peer. */
1766 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1768 bgp_process_announce_selected (peer
, new_select
, rn
, afi
, safi
);
1772 if ((safi
== SAFI_UNICAST
|| safi
== SAFI_MULTICAST
) && (! bgp
->name
&&
1773 ! bgp_option_check (BGP_OPT_NO_FIB
)))
1776 && new_select
->type
== ZEBRA_ROUTE_BGP
1777 && new_select
->sub_type
== BGP_ROUTE_NORMAL
)
1778 bgp_zebra_announce (p
, new_select
, bgp
, afi
, safi
);
1781 /* Withdraw the route from the kernel. */
1783 && old_select
->type
== ZEBRA_ROUTE_BGP
1784 && old_select
->sub_type
== BGP_ROUTE_NORMAL
)
1785 bgp_zebra_withdraw (p
, old_select
, safi
);
1789 /* Reap old select bgp_info, it it has been removed */
1790 if (old_select
&& CHECK_FLAG (old_select
->flags
, BGP_INFO_REMOVED
))
1791 bgp_info_reap (rn
, old_select
);
1793 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1798 bgp_processq_del (struct work_queue
*wq
, void *data
)
1800 struct bgp_process_queue
*pq
= data
;
1801 struct bgp_table
*table
;
1803 bgp_unlock (pq
->bgp
);
1806 table
= bgp_node_table (pq
->rn
);
1807 bgp_unlock_node (pq
->rn
);
1808 bgp_table_unlock (table
);
1810 XFREE (MTYPE_BGP_PROCESS_QUEUE
, pq
);
1814 bgp_process_queue_complete (struct work_queue
*wq
)
1818 struct listnode
*node
, *nnode
;
1820 /* Schedule write thread either directly or through the MRAI timer
1823 bgp
= bgp_get_default ();
1827 if (BGP_ROUTE_ADV_HOLD(bgp
))
1830 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1831 bgp_peer_schedule_updates(peer
);
1835 bgp_process_queue_init (void)
1837 bm
->process_main_queue
1838 = work_queue_new (bm
->master
, "process_main_queue");
1839 bm
->process_rsclient_queue
1840 = work_queue_new (bm
->master
, "process_rsclient_queue");
1842 if ( !(bm
->process_main_queue
&& bm
->process_rsclient_queue
) )
1844 zlog_err ("%s: Failed to allocate work queue", __func__
);
1848 bm
->process_main_queue
->spec
.workfunc
= &bgp_process_main
;
1849 bm
->process_main_queue
->spec
.del_item_data
= &bgp_processq_del
;
1850 bm
->process_main_queue
->spec
.completion_func
= &bgp_process_queue_complete
;
1851 bm
->process_main_queue
->spec
.max_retries
= 0;
1852 bm
->process_main_queue
->spec
.hold
= 50;
1853 /* Use a higher yield value of 50ms for main queue processing */
1854 bm
->process_main_queue
->spec
.yield
= 50 * 1000L;
1856 memcpy (bm
->process_rsclient_queue
, bm
->process_main_queue
,
1857 sizeof (struct work_queue
*));
1858 bm
->process_rsclient_queue
->spec
.workfunc
= &bgp_process_rsclient
;
1862 bgp_process (struct bgp
*bgp
, struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
1864 struct bgp_process_queue
*pqnode
;
1866 /* already scheduled for processing? */
1867 if (CHECK_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
))
1870 if ( (bm
->process_main_queue
== NULL
) ||
1871 (bm
->process_rsclient_queue
== NULL
) )
1872 bgp_process_queue_init ();
1874 pqnode
= XCALLOC (MTYPE_BGP_PROCESS_QUEUE
,
1875 sizeof (struct bgp_process_queue
));
1879 /* all unlocked in bgp_processq_del */
1880 bgp_table_lock (bgp_node_table (rn
));
1881 pqnode
->rn
= bgp_lock_node (rn
);
1885 pqnode
->safi
= safi
;
1887 switch (bgp_node_table (rn
)->type
)
1889 case BGP_TABLE_MAIN
:
1890 work_queue_add (bm
->process_main_queue
, pqnode
);
1892 case BGP_TABLE_RSCLIENT
:
1893 work_queue_add (bm
->process_rsclient_queue
, pqnode
);
1897 SET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1902 bgp_add_eoiu_mark (struct bgp
*bgp
, bgp_table_t type
)
1904 struct bgp_process_queue
*pqnode
;
1906 if ( (bm
->process_main_queue
== NULL
) ||
1907 (bm
->process_rsclient_queue
== NULL
) )
1908 bgp_process_queue_init ();
1910 pqnode
= XCALLOC (MTYPE_BGP_PROCESS_QUEUE
,
1911 sizeof (struct bgp_process_queue
));
1920 case BGP_TABLE_MAIN
:
1921 work_queue_add (bm
->process_main_queue
, pqnode
);
1923 case BGP_TABLE_RSCLIENT
:
1924 work_queue_add (bm
->process_rsclient_queue
, pqnode
);
1932 bgp_maximum_prefix_restart_timer (struct thread
*thread
)
1936 peer
= THREAD_ARG (thread
);
1937 peer
->t_pmax_restart
= NULL
;
1939 if (bgp_debug_neighbor_events(peer
))
1940 zlog_debug ("%s Maximum-prefix restart timer expired, restore peering",
1943 peer_clear (peer
, NULL
);
1949 bgp_maximum_prefix_overflow (struct peer
*peer
, afi_t afi
,
1950 safi_t safi
, int always
)
1952 if (!CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
1955 if (peer
->pcount
[afi
][safi
] > peer
->pmax
[afi
][safi
])
1957 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
)
1961 zlog_info ("%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, "
1962 "limit %ld", afi_safi_print (afi
, safi
), peer
->host
,
1963 peer
->pcount
[afi
][safi
], peer
->pmax
[afi
][safi
]);
1964 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1966 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
1972 if (safi
== SAFI_MPLS_VPN
)
1973 safi
= SAFI_MPLS_LABELED_VPN
;
1975 ndata
[0] = (afi
>> 8);
1978 ndata
[3] = (peer
->pmax
[afi
][safi
] >> 24);
1979 ndata
[4] = (peer
->pmax
[afi
][safi
] >> 16);
1980 ndata
[5] = (peer
->pmax
[afi
][safi
] >> 8);
1981 ndata
[6] = (peer
->pmax
[afi
][safi
]);
1983 SET_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
);
1984 bgp_notify_send_with_data (peer
, BGP_NOTIFY_CEASE
,
1985 BGP_NOTIFY_CEASE_MAX_PREFIX
, ndata
, 7);
1988 /* restart timer start */
1989 if (peer
->pmax_restart
[afi
][safi
])
1991 peer
->v_pmax_restart
= peer
->pmax_restart
[afi
][safi
] * 60;
1993 if (bgp_debug_neighbor_events(peer
))
1994 zlog_debug ("%s Maximum-prefix restart timer started for %d secs",
1995 peer
->host
, peer
->v_pmax_restart
);
1997 BGP_TIMER_ON (peer
->t_pmax_restart
, bgp_maximum_prefix_restart_timer
,
1998 peer
->v_pmax_restart
);
2004 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
2006 if (peer
->pcount
[afi
][safi
] > (peer
->pmax
[afi
][safi
] * peer
->pmax_threshold
[afi
][safi
] / 100))
2008 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
)
2012 zlog_info ("%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld",
2013 afi_safi_print (afi
, safi
), peer
->host
, peer
->pcount
[afi
][safi
],
2014 peer
->pmax
[afi
][safi
]);
2015 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
2018 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
2022 /* Unconditionally remove the route from the RIB, without taking
2023 * damping into consideration (eg, because the session went down)
2026 bgp_rib_remove (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
2027 afi_t afi
, safi_t safi
)
2029 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
2031 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2032 bgp_info_delete (rn
, ri
); /* keep historical info */
2034 bgp_process (peer
->bgp
, rn
, afi
, safi
);
2038 bgp_rib_withdraw (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
2039 afi_t afi
, safi_t safi
)
2041 int status
= BGP_DAMP_NONE
;
2043 /* apply dampening, if result is suppressed, we'll be retaining
2044 * the bgp_info in the RIB for historical reference.
2046 if (CHECK_FLAG (peer
->bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2047 && peer
->sort
== BGP_PEER_EBGP
)
2048 if ( (status
= bgp_damp_withdraw (ri
, rn
, afi
, safi
, 0))
2049 == BGP_DAMP_SUPPRESSED
)
2051 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
2055 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2058 static struct bgp_info
*
2059 info_make (int type
, int sub_type
, u_short instance
, struct peer
*peer
, struct attr
*attr
,
2060 struct bgp_node
*rn
)
2062 struct bgp_info
*new;
2064 /* Make new BGP info. */
2065 new = XCALLOC (MTYPE_BGP_ROUTE
, sizeof (struct bgp_info
));
2067 new->instance
= instance
;
2068 new->sub_type
= sub_type
;
2071 new->uptime
= bgp_clock ();
2077 bgp_update_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
2078 struct attr
*attr
, struct peer
*peer
, struct prefix
*p
, int type
,
2079 int sub_type
, struct prefix_rd
*prd
, u_char
*tag
)
2081 struct bgp_node
*rn
;
2083 struct attr new_attr
;
2084 struct attr_extra new_extra
;
2085 struct attr
*attr_new
;
2086 struct attr
*attr_new2
;
2087 struct bgp_info
*ri
;
2088 struct bgp_info
*new;
2090 char buf
[SU_ADDRSTRLEN
];
2092 /* Do not insert announces from a rsclient into its own 'bgp_table'. */
2093 if (peer
== rsclient
)
2097 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2099 /* Check previously received route. */
2100 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2101 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2104 /* AS path loop check. */
2105 if (aspath_loop_check (attr
->aspath
, rsclient
->as
) > rsclient
->allowas_in
[afi
][safi
])
2107 reason
= "as-path contains our own AS;";
2111 /* Route reflector originator ID check. */
2112 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
2113 && IPV4_ADDR_SAME (&rsclient
->remote_id
, &attr
->extra
->originator_id
))
2115 reason
= "originator is us;";
2119 new_attr
.extra
= &new_extra
;
2120 bgp_attr_dup (&new_attr
, attr
);
2122 /* Apply export policy. */
2123 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
) &&
2124 bgp_export_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
2126 reason
= "export-policy;";
2130 attr_new2
= bgp_attr_intern (&new_attr
);
2132 /* Apply import policy. */
2133 if (bgp_import_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
2135 bgp_attr_unintern (&attr_new2
);
2137 reason
= "import-policy;";
2141 attr_new
= bgp_attr_intern (&new_attr
);
2142 bgp_attr_unintern (&attr_new2
);
2144 /* IPv4 unicast next hop check. */
2145 if ((afi
== AFI_IP
) && ((safi
== SAFI_UNICAST
) || safi
== SAFI_MULTICAST
))
2147 /* Next hop must not be 0.0.0.0 nor Class D/E address. */
2148 if (new_attr
.nexthop
.s_addr
== 0
2149 || IPV4_CLASS_DE (ntohl (new_attr
.nexthop
.s_addr
)))
2151 bgp_attr_unintern (&attr_new
);
2153 reason
= "martian next-hop;";
2158 /* If the update is implicit withdraw. */
2161 ri
->uptime
= bgp_clock ();
2163 /* Same attribute comes in. */
2164 if (!CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
)
2165 && attrhash_cmp (ri
->attr
, attr_new
))
2168 if (bgp_debug_update(peer
, p
, 1))
2169 zlog_debug ("%s rcvd %s/%d for RS-client %s...duplicate ignored",
2171 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2172 p
->prefixlen
, rsclient
->host
);
2175 bgp_unlock_node (rn
);
2176 bgp_attr_unintern (&attr_new
);
2181 /* Withdraw/Announce before we fully processed the withdraw */
2182 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
2183 bgp_info_restore (rn
, ri
);
2185 /* Received Logging. */
2186 if (bgp_debug_update(peer
, p
, 1))
2187 zlog_debug ("%s rcvd %s/%d for RS-client %s",
2189 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2190 p
->prefixlen
, rsclient
->host
);
2192 /* The attribute is changed. */
2193 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
2195 /* Update to new attribute. */
2196 bgp_attr_unintern (&ri
->attr
);
2197 ri
->attr
= attr_new
;
2199 /* Update MPLS tag. */
2200 if (safi
== SAFI_MPLS_VPN
)
2201 memcpy ((bgp_info_extra_get (ri
))->tag
, tag
, 3);
2203 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
2205 /* Process change. */
2206 bgp_process (bgp
, rn
, afi
, safi
);
2207 bgp_unlock_node (rn
);
2212 /* Received Logging. */
2213 if (bgp_debug_update(peer
, p
, 1))
2215 zlog_debug ("%s rcvd %s/%d for RS-client %s",
2217 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2218 p
->prefixlen
, rsclient
->host
);
2221 new = info_make(type
, sub_type
, 0, peer
, attr_new
, rn
);
2223 /* Update MPLS tag. */
2224 if (safi
== SAFI_MPLS_VPN
)
2225 memcpy ((bgp_info_extra_get (new))->tag
, tag
, 3);
2227 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2229 /* Register new BGP information. */
2230 bgp_info_add (rn
, new);
2232 /* route_node_get lock */
2233 bgp_unlock_node (rn
);
2235 /* Process change. */
2236 bgp_process (bgp
, rn
, afi
, safi
);
2242 /* This BGP update is filtered. Log the reason then update BGP entry. */
2243 if (bgp_debug_update(peer
, p
, 1))
2244 zlog_debug ("%s rcvd UPDATE about %s/%d -- DENIED for RS-client %s due to: %s",
2246 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2247 p
->prefixlen
, rsclient
->host
, reason
);
2250 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2252 bgp_unlock_node (rn
);
2258 bgp_withdraw_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
2259 struct peer
*peer
, struct prefix
*p
, int type
, int sub_type
,
2260 struct prefix_rd
*prd
, u_char
*tag
)
2262 struct bgp_node
*rn
;
2263 struct bgp_info
*ri
;
2264 char buf
[SU_ADDRSTRLEN
];
2266 if (rsclient
== peer
)
2269 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2271 /* Lookup withdrawn route. */
2272 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2273 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2276 /* Withdraw specified route from routing table. */
2277 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2278 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
2279 else if (bgp_debug_update(peer
, p
, 1))
2280 zlog_debug ("%s Can't find the route %s/%d", peer
->host
,
2281 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2284 /* Unlock bgp_node_get() lock. */
2285 bgp_unlock_node (rn
);
2289 bgp_update_main (struct peer
*peer
, struct prefix
*p
, u_int32_t addpath_id
,
2290 struct attr
*attr
, afi_t afi
, safi_t safi
, int type
,
2291 int sub_type
, struct prefix_rd
*prd
, u_char
*tag
,
2295 int aspath_loop_count
= 0;
2296 struct bgp_node
*rn
;
2298 struct attr new_attr
;
2299 struct attr_extra new_extra
;
2300 struct attr
*attr_new
;
2301 struct bgp_info
*ri
;
2302 struct bgp_info
*new;
2304 char buf
[SU_ADDRSTRLEN
];
2308 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2310 /* When peer's soft reconfiguration enabled. Record input packet in
2312 if (! soft_reconfig
&& CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2313 && peer
!= bgp
->peer_self
)
2314 bgp_adj_in_set (rn
, peer
, attr
);
2316 /* Check previously received route. */
2317 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2318 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
&&
2319 ri
->addpath_rx_id
== addpath_id
)
2322 /* AS path local-as loop check. */
2323 if (peer
->change_local_as
)
2325 if (! CHECK_FLAG (peer
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
2326 aspath_loop_count
= 1;
2328 if (aspath_loop_check (attr
->aspath
, peer
->change_local_as
) > aspath_loop_count
)
2330 reason
= "as-path contains our own AS;";
2335 /* AS path loop check. */
2336 if (aspath_loop_check (attr
->aspath
, bgp
->as
) > peer
->allowas_in
[afi
][safi
]
2337 || (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
2338 && aspath_loop_check(attr
->aspath
, bgp
->confed_id
)
2339 > peer
->allowas_in
[afi
][safi
]))
2341 reason
= "as-path contains our own AS;";
2345 /* Route reflector originator ID check. */
2346 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
2347 && IPV4_ADDR_SAME (&bgp
->router_id
, &attr
->extra
->originator_id
))
2349 reason
= "originator is us;";
2353 /* Route reflector cluster ID check. */
2354 if (bgp_cluster_filter (peer
, attr
))
2356 reason
= "reflected from the same cluster;";
2360 /* Apply incoming filter. */
2361 if (bgp_input_filter (peer
, p
, attr
, afi
, safi
) == FILTER_DENY
)
2367 new_attr
.extra
= &new_extra
;
2368 bgp_attr_dup (&new_attr
, attr
);
2370 /* Apply incoming route-map.
2371 * NB: new_attr may now contain newly allocated values from route-map "set"
2372 * commands, so we need bgp_attr_flush in the error paths, until we intern
2373 * the attr (which takes over the memory references) */
2374 if (bgp_input_modifier (peer
, p
, &new_attr
, afi
, safi
, NULL
) == RMAP_DENY
)
2376 reason
= "route-map;";
2377 bgp_attr_flush (&new_attr
);
2381 /* IPv4 unicast next hop check. */
2382 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2384 /* Next hop must not be 0.0.0.0 nor Class D/E address. Next hop
2385 must not be my own address. */
2386 if (new_attr
.nexthop
.s_addr
== 0
2387 || IPV4_CLASS_DE (ntohl (new_attr
.nexthop
.s_addr
))
2388 || bgp_nexthop_self (&new_attr
))
2390 reason
= "martian next-hop;";
2391 bgp_attr_flush (&new_attr
);
2396 attr_new
= bgp_attr_intern (&new_attr
);
2398 /* If the update is implicit withdraw. */
2401 ri
->uptime
= bgp_clock ();
2403 /* Same attribute comes in. */
2404 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
)
2405 && attrhash_cmp (ri
->attr
, attr_new
))
2407 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2408 && peer
->sort
== BGP_PEER_EBGP
2409 && CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2411 if (bgp_debug_update(peer
, p
, 1))
2412 zlog_debug ("%s rcvd %s/%d",
2414 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2417 if (bgp_damp_update (ri
, rn
, afi
, safi
) != BGP_DAMP_SUPPRESSED
)
2419 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2420 bgp_process (bgp
, rn
, afi
, safi
);
2423 else /* Duplicate - odd */
2425 if (bgp_debug_update(peer
, p
, 1))
2427 if (!peer
->rcvd_attr_printed
)
2429 zlog_debug ("%s rcvd UPDATE w/ attr: %s", peer
->host
, peer
->rcvd_attr_str
);
2430 peer
->rcvd_attr_printed
= 1;
2433 zlog_debug ("%s rcvd %s/%d...duplicate ignored",
2435 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2439 /* graceful restart STALE flag unset. */
2440 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2442 bgp_info_unset_flag (rn
, ri
, BGP_INFO_STALE
);
2443 bgp_process (bgp
, rn
, afi
, safi
);
2447 bgp_unlock_node (rn
);
2448 bgp_attr_unintern (&attr_new
);
2453 /* Withdraw/Announce before we fully processed the withdraw */
2454 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
2456 if (bgp_debug_update(peer
, p
, 1))
2457 zlog_debug ("%s rcvd %s/%d, flapped quicker than processing",
2459 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2461 bgp_info_restore (rn
, ri
);
2464 /* Received Logging. */
2465 if (bgp_debug_update(peer
, p
, 1))
2466 zlog_debug ("%s rcvd %s/%d",
2468 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2471 /* graceful restart STALE flag unset. */
2472 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2473 bgp_info_unset_flag (rn
, ri
, BGP_INFO_STALE
);
2475 /* The attribute is changed. */
2476 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
2478 /* implicit withdraw, decrement aggregate and pcount here.
2479 * only if update is accepted, they'll increment below.
2481 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
2483 /* Update bgp route dampening information. */
2484 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2485 && peer
->sort
== BGP_PEER_EBGP
)
2487 /* This is implicit withdraw so we should update dampening
2489 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2490 bgp_damp_withdraw (ri
, rn
, afi
, safi
, 1);
2493 /* Update to new attribute. */
2494 bgp_attr_unintern (&ri
->attr
);
2495 ri
->attr
= attr_new
;
2497 /* Update MPLS tag. */
2498 if (safi
== SAFI_MPLS_VPN
)
2499 memcpy ((bgp_info_extra_get (ri
))->tag
, tag
, 3);
2501 /* Update bgp route dampening information. */
2502 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2503 && peer
->sort
== BGP_PEER_EBGP
)
2505 /* Now we do normal update dampening. */
2506 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
2507 if (ret
== BGP_DAMP_SUPPRESSED
)
2509 bgp_unlock_node (rn
);
2514 /* Nexthop reachability check. */
2515 if ((afi
== AFI_IP
|| afi
== AFI_IP6
) && safi
== SAFI_UNICAST
)
2517 if (peer
->sort
== BGP_PEER_EBGP
&& peer
->ttl
== 1 &&
2518 ! CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
))
2523 if (bgp_find_or_add_nexthop (afi
, ri
, NULL
, connected
))
2524 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
2527 if (BGP_DEBUG(nht
, NHT
))
2529 char buf1
[INET6_ADDRSTRLEN
];
2530 inet_ntop(AF_INET
, (const void *)&attr_new
->nexthop
, buf1
, INET6_ADDRSTRLEN
);
2531 zlog_debug("%s(%s): NH unresolved", __FUNCTION__
, buf1
);
2533 bgp_info_unset_flag (rn
, ri
, BGP_INFO_VALID
);
2537 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
2539 /* Process change. */
2540 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2542 bgp_process (bgp
, rn
, afi
, safi
);
2543 bgp_unlock_node (rn
);
2546 } // End of implicit withdraw
2548 /* Received Logging. */
2549 if (bgp_debug_update(peer
, p
, 1))
2551 if (!peer
->rcvd_attr_printed
)
2553 zlog_debug ("%s rcvd UPDATE w/ attr: %s", peer
->host
, peer
->rcvd_attr_str
);
2554 peer
->rcvd_attr_printed
= 1;
2557 zlog_debug ("%s rcvd %s/%d",
2559 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2563 /* Make new BGP info. */
2564 new = info_make(type
, sub_type
, 0, peer
, attr_new
, rn
);
2566 /* Update MPLS tag. */
2567 if (safi
== SAFI_MPLS_VPN
)
2568 memcpy ((bgp_info_extra_get (new))->tag
, tag
, 3);
2570 /* Nexthop reachability check. */
2571 if ((afi
== AFI_IP
|| afi
== AFI_IP6
) && safi
== SAFI_UNICAST
)
2573 if (peer
->sort
== BGP_PEER_EBGP
&& peer
->ttl
== 1 &&
2574 ! CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
))
2579 if (bgp_find_or_add_nexthop (afi
, new, NULL
, connected
))
2580 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2583 if (BGP_DEBUG(nht
, NHT
))
2585 char buf1
[INET6_ADDRSTRLEN
];
2586 inet_ntop(AF_INET
, (const void *)&attr_new
->nexthop
, buf1
, INET6_ADDRSTRLEN
);
2587 zlog_debug("%s(%s): NH unresolved", __FUNCTION__
, buf1
);
2589 bgp_info_unset_flag (rn
, new, BGP_INFO_VALID
);
2593 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2596 new->addpath_rx_id
= addpath_id
;
2597 new->addpath_tx_id
= 0;
2599 /* Increment prefix */
2600 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
2602 /* Register new BGP information. */
2603 bgp_info_add (rn
, new);
2605 /* route_node_get lock */
2606 bgp_unlock_node (rn
);
2608 /* If maximum prefix count is configured and current prefix
2610 if (bgp_maximum_prefix_overflow (peer
, afi
, safi
, 0))
2613 /* Process change. */
2614 bgp_process (bgp
, rn
, afi
, safi
);
2618 /* This BGP update is filtered. Log the reason then update BGP
2621 if (bgp_debug_update(peer
, p
, 1))
2623 if (!peer
->rcvd_attr_printed
)
2625 zlog_debug ("%s rcvd UPDATE w/ attr: %s", peer
->host
, peer
->rcvd_attr_str
);
2626 peer
->rcvd_attr_printed
= 1;
2629 zlog_debug ("%s rcvd UPDATE about %s/%d -- DENIED due to: %s",
2631 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2632 p
->prefixlen
, reason
);
2636 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2638 bgp_unlock_node (rn
);
2644 bgp_update (struct peer
*peer
, struct prefix
*p
, u_int32_t addpath_id
,
2645 struct attr
*attr
, afi_t afi
, safi_t safi
, int type
, int sub_type
,
2646 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
2648 struct peer
*rsclient
;
2649 struct listnode
*node
, *nnode
;
2653 ret
= bgp_update_main (peer
, p
, addpath_id
, attr
, afi
, safi
, type
, sub_type
,
2654 prd
, tag
, soft_reconfig
);
2658 /* Process the update for each RS-client. */
2659 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2661 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2662 bgp_update_rsclient (rsclient
, afi
, safi
, attr
, peer
, p
,
2663 type
, sub_type
, prd
, tag
);
2670 bgp_withdraw (struct peer
*peer
, struct prefix
*p
, u_int32_t addpath_id
,
2671 struct attr
*attr
, afi_t afi
, safi_t safi
, int type
, int sub_type
,
2672 struct prefix_rd
*prd
, u_char
*tag
)
2675 char buf
[SU_ADDRSTRLEN
];
2676 struct bgp_node
*rn
;
2677 struct bgp_info
*ri
;
2678 struct peer
*rsclient
;
2679 struct listnode
*node
, *nnode
;
2683 /* Process the withdraw for each RS-client. */
2684 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2686 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2687 bgp_withdraw_rsclient (rsclient
, afi
, safi
, peer
, p
, type
,
2688 sub_type
, prd
, tag
);
2692 if (bgp_debug_update(peer
, p
, 1))
2693 zlog_debug ("%s rcvd UPDATE about %s/%d -- withdrawn",
2695 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2699 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2701 /* If peer is soft reconfiguration enabled. Record input packet for
2702 further calculation. */
2703 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2704 && peer
!= bgp
->peer_self
)
2705 bgp_adj_in_unset (rn
, peer
);
2707 /* Lookup withdrawn route. */
2708 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2709 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
&&
2710 ri
->addpath_rx_id
== addpath_id
)
2713 /* Withdraw specified route from routing table. */
2714 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2715 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
2716 else if (bgp_debug_update(peer
, p
, 1))
2717 zlog_debug ("%s Can't find the route %s/%d", peer
->host
,
2718 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2721 /* Unlock bgp_node_get() lock. */
2722 bgp_unlock_node (rn
);
2728 bgp_default_originate (struct peer
*peer
, afi_t afi
, safi_t safi
, int withdraw
)
2732 struct aspath
*aspath
;
2735 struct bgp_node
*rn
;
2736 struct bgp_info
*ri
;
2737 int ret
= RMAP_DENYMATCH
;
2739 if (!(afi
== AFI_IP
|| afi
== AFI_IP6
))
2743 from
= bgp
->peer_self
;
2745 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
2746 aspath
= attr
.aspath
;
2747 attr
.local_pref
= bgp
->default_local_pref
;
2748 memcpy (&attr
.nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
2751 str2prefix ("0.0.0.0/0", &p
);
2753 else if (afi
== AFI_IP6
)
2755 struct attr_extra
*ae
= attr
.extra
;
2757 str2prefix ("::/0", &p
);
2759 /* IPv6 global nexthop must be included. */
2760 memcpy (&ae
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
2762 ae
->mp_nexthop_len
= 16;
2764 /* If the peer is on shared nextwork and we have link-local
2766 if (peer
->shared_network
2767 && !IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
2769 memcpy (&ae
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
2771 ae
->mp_nexthop_len
= 32;
2774 #endif /* HAVE_IPV6 */
2776 if (peer
->default_rmap
[afi
][safi
].name
)
2778 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_DEFAULT
);
2779 for (rn
= bgp_table_top(bgp
->rib
[afi
][safi
]); rn
; rn
= bgp_route_next(rn
))
2781 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2783 struct attr dummy_attr
;
2784 struct attr_extra dummy_extra
;
2785 struct bgp_info info
;
2787 /* Provide dummy so the route-map can't modify the attributes */
2788 dummy_attr
.extra
= &dummy_extra
;
2789 bgp_attr_dup(&dummy_attr
, ri
->attr
);
2790 info
.peer
= ri
->peer
;
2791 info
.attr
= &dummy_attr
;
2793 ret
= route_map_apply(peer
->default_rmap
[afi
][safi
].map
, &rn
->p
,
2796 /* The route map might have set attributes. If we don't flush them
2797 * here, they will be leaked. */
2798 bgp_attr_flush(&dummy_attr
);
2799 if (ret
!= RMAP_DENYMATCH
)
2802 if (ret
!= RMAP_DENYMATCH
)
2805 bgp
->peer_self
->rmap_type
= 0;
2807 if (ret
== RMAP_DENYMATCH
)
2813 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
2814 bgp_default_withdraw_send (peer
, afi
, safi
);
2815 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2819 if (! CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
2821 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2822 bgp_default_update_send (peer
, &attr
, afi
, safi
, from
);
2826 bgp_attr_extra_free (&attr
);
2827 aspath_unintern (&aspath
);
2831 bgp_announce_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2832 struct bgp_table
*table
, int rsclient
)
2834 struct bgp_node
*rn
;
2835 struct bgp_info
*ri
;
2837 struct attr_extra extra
;
2840 table
= (rsclient
) ? peer
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2842 if (safi
!= SAFI_MPLS_VPN
2843 && CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
2844 bgp_default_originate (peer
, afi
, safi
, 0);
2846 /* It's initialized in bgp_announce_[check|check_rsclient]() */
2847 attr
.extra
= &extra
;
2849 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next(rn
))
2850 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2851 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
) && ri
->peer
!= peer
)
2854 (bgp_announce_check_rsclient (ri
, peer
, &rn
->p
, &attr
, afi
, safi
))
2855 : (bgp_announce_check (ri
, peer
, &rn
->p
, &attr
, afi
, safi
)))
2856 bgp_adj_out_set (rn
, peer
, &rn
->p
, &attr
, afi
, safi
, ri
);
2858 bgp_adj_out_unset (rn
, peer
, &rn
->p
, afi
, safi
);
2863 bgp_announce_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2865 struct bgp_node
*rn
;
2866 struct bgp_table
*table
;
2868 if (peer
->status
!= Established
)
2871 if (! peer
->afc_nego
[afi
][safi
])
2874 /* First update is deferred until ORF or ROUTE-REFRESH is received */
2875 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
2878 if (safi
!= SAFI_MPLS_VPN
)
2879 bgp_announce_table (peer
, afi
, safi
, NULL
, 0);
2881 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2882 rn
= bgp_route_next(rn
))
2883 if ((table
= (rn
->info
)) != NULL
)
2884 bgp_announce_table (peer
, afi
, safi
, table
, 0);
2886 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2887 bgp_announce_table (peer
, afi
, safi
, NULL
, 1);
2890 * The write thread needs to be scheduled since it may not be done as
2891 * part of building adj_out.
2893 bgp_peer_schedule_updates(peer
);
2897 bgp_announce_route_all (struct peer
*peer
)
2902 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2903 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2904 bgp_announce_route (peer
, afi
, safi
);
2908 bgp_soft_reconfig_table_rsclient (struct peer
*rsclient
, afi_t afi
,
2909 safi_t safi
, struct bgp_table
*table
, struct prefix_rd
*prd
)
2911 struct bgp_node
*rn
;
2912 struct bgp_adj_in
*ain
;
2915 table
= rsclient
->bgp
->rib
[afi
][safi
];
2917 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2918 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2920 struct bgp_info
*ri
= rn
->info
;
2921 u_char
*tag
= (ri
&& ri
->extra
) ? ri
->extra
->tag
: NULL
;
2923 bgp_update_rsclient (rsclient
, afi
, safi
, ain
->attr
, ain
->peer
,
2924 &rn
->p
, ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, prd
, tag
);
2929 bgp_soft_reconfig_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
2931 struct bgp_table
*table
;
2932 struct bgp_node
*rn
;
2934 if (safi
!= SAFI_MPLS_VPN
)
2935 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, NULL
, NULL
);
2938 for (rn
= bgp_table_top (rsclient
->bgp
->rib
[afi
][safi
]); rn
;
2939 rn
= bgp_route_next (rn
))
2940 if ((table
= rn
->info
) != NULL
)
2942 struct prefix_rd prd
;
2943 prd
.family
= AF_UNSPEC
;
2945 memcpy(&prd
.val
, rn
->p
.u
.val
, 8);
2947 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, table
, &prd
);
2952 bgp_soft_reconfig_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2953 struct bgp_table
*table
, struct prefix_rd
*prd
)
2956 struct bgp_node
*rn
;
2957 struct bgp_adj_in
*ain
;
2960 table
= peer
->bgp
->rib
[afi
][safi
];
2962 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2963 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2965 if (ain
->peer
== peer
)
2967 struct bgp_info
*ri
= rn
->info
;
2968 u_char
*tag
= (ri
&& ri
->extra
) ? ri
->extra
->tag
: NULL
;
2970 ret
= bgp_update (peer
, &rn
->p
, ri
->addpath_rx_id
, ain
->attr
,
2971 afi
, safi
, ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
,
2976 bgp_unlock_node (rn
);
2985 bgp_soft_reconfig_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2987 struct bgp_node
*rn
;
2988 struct bgp_table
*table
;
2990 if (peer
->status
!= Established
)
2993 if (safi
!= SAFI_MPLS_VPN
)
2994 bgp_soft_reconfig_table (peer
, afi
, safi
, NULL
, NULL
);
2996 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2997 rn
= bgp_route_next (rn
))
2998 if ((table
= rn
->info
) != NULL
)
3000 struct prefix_rd prd
;
3001 prd
.family
= AF_UNSPEC
;
3003 memcpy(&prd
.val
, rn
->p
.u
.val
, 8);
3005 bgp_soft_reconfig_table (peer
, afi
, safi
, table
, &prd
);
3010 struct bgp_clear_node_queue
3012 struct bgp_node
*rn
;
3013 enum bgp_clear_route_type purpose
;
3016 static wq_item_status
3017 bgp_clear_route_node (struct work_queue
*wq
, void *data
)
3019 struct bgp_clear_node_queue
*cnq
= data
;
3020 struct bgp_node
*rn
= cnq
->rn
;
3021 struct peer
*peer
= wq
->spec
.data
;
3022 struct bgp_info
*ri
;
3023 afi_t afi
= bgp_node_table (rn
)->afi
;
3024 safi_t safi
= bgp_node_table (rn
)->safi
;
3026 assert (rn
&& peer
);
3028 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3029 if (ri
->peer
== peer
|| cnq
->purpose
== BGP_CLEAR_ROUTE_MY_RSCLIENT
)
3031 /* graceful restart STALE flag set. */
3032 if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_NSF_WAIT
)
3033 && peer
->nsf
[afi
][safi
]
3034 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
)
3035 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
3036 bgp_info_set_flag (rn
, ri
, BGP_INFO_STALE
);
3038 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
3045 bgp_clear_node_queue_del (struct work_queue
*wq
, void *data
)
3047 struct bgp_clear_node_queue
*cnq
= data
;
3048 struct bgp_node
*rn
= cnq
->rn
;
3049 struct bgp_table
*table
= bgp_node_table (rn
);
3051 bgp_unlock_node (rn
);
3052 bgp_table_unlock (table
);
3053 XFREE (MTYPE_BGP_CLEAR_NODE_QUEUE
, cnq
);
3057 bgp_clear_node_complete (struct work_queue
*wq
)
3059 struct peer
*peer
= wq
->spec
.data
;
3061 /* Tickle FSM to start moving again */
3062 BGP_EVENT_ADD (peer
, Clearing_Completed
);
3064 peer_unlock (peer
); /* bgp_clear_route */
3068 bgp_clear_node_queue_init (struct peer
*peer
)
3070 char wname
[sizeof("clear xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx")];
3072 snprintf (wname
, sizeof(wname
), "clear %s", peer
->host
);
3073 #undef CLEAR_QUEUE_NAME_LEN
3075 if ( (peer
->clear_node_queue
= work_queue_new (bm
->master
, wname
)) == NULL
)
3077 zlog_err ("%s: Failed to allocate work queue", __func__
);
3080 peer
->clear_node_queue
->spec
.hold
= 10;
3081 peer
->clear_node_queue
->spec
.workfunc
= &bgp_clear_route_node
;
3082 peer
->clear_node_queue
->spec
.del_item_data
= &bgp_clear_node_queue_del
;
3083 peer
->clear_node_queue
->spec
.completion_func
= &bgp_clear_node_complete
;
3084 peer
->clear_node_queue
->spec
.max_retries
= 0;
3086 /* we only 'lock' this peer reference when the queue is actually active */
3087 peer
->clear_node_queue
->spec
.data
= peer
;
3091 bgp_clear_route_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
3092 struct bgp_table
*table
, struct peer
*rsclient
,
3093 enum bgp_clear_route_type purpose
)
3095 struct bgp_node
*rn
;
3099 table
= (rsclient
) ? rsclient
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
3101 /* If still no table => afi/safi isn't configured at all or smth. */
3105 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3107 struct bgp_info
*ri
;
3108 struct bgp_adj_in
*ain
;
3109 struct bgp_adj_out
*aout
;
3111 /* XXX:TODO: This is suboptimal, every non-empty route_node is
3112 * queued for every clearing peer, regardless of whether it is
3113 * relevant to the peer at hand.
3115 * Overview: There are 3 different indices which need to be
3116 * scrubbed, potentially, when a peer is removed:
3118 * 1 peer's routes visible via the RIB (ie accepted routes)
3119 * 2 peer's routes visible by the (optional) peer's adj-in index
3120 * 3 other routes visible by the peer's adj-out index
3122 * 3 there is no hurry in scrubbing, once the struct peer is
3123 * removed from bgp->peer, we could just GC such deleted peer's
3124 * adj-outs at our leisure.
3126 * 1 and 2 must be 'scrubbed' in some way, at least made
3127 * invisible via RIB index before peer session is allowed to be
3128 * brought back up. So one needs to know when such a 'search' is
3133 * - there'd be a single global queue or a single RIB walker
3134 * - rather than tracking which route_nodes still need to be
3135 * examined on a peer basis, we'd track which peers still
3138 * Given that our per-peer prefix-counts now should be reliable,
3139 * this may actually be achievable. It doesn't seem to be a huge
3140 * problem at this time,
3142 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
3143 if (ain
->peer
== peer
|| purpose
== BGP_CLEAR_ROUTE_MY_RSCLIENT
)
3145 bgp_adj_in_remove (rn
, ain
);
3146 bgp_unlock_node (rn
);
3149 for (aout
= rn
->adj_out
; aout
; aout
= aout
->next
)
3150 if (aout
->peer
== peer
|| purpose
== BGP_CLEAR_ROUTE_MY_RSCLIENT
)
3152 bgp_adj_out_remove (rn
, aout
, peer
, afi
, safi
);
3153 bgp_unlock_node (rn
);
3157 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3158 if (ri
->peer
== peer
|| purpose
== BGP_CLEAR_ROUTE_MY_RSCLIENT
)
3160 struct bgp_clear_node_queue
*cnq
;
3162 /* both unlocked in bgp_clear_node_queue_del */
3163 bgp_table_lock (bgp_node_table (rn
));
3165 cnq
= XCALLOC (MTYPE_BGP_CLEAR_NODE_QUEUE
,
3166 sizeof (struct bgp_clear_node_queue
));
3168 cnq
->purpose
= purpose
;
3169 work_queue_add (peer
->clear_node_queue
, cnq
);
3177 bgp_clear_route (struct peer
*peer
, afi_t afi
, safi_t safi
,
3178 enum bgp_clear_route_type purpose
)
3180 struct bgp_node
*rn
;
3181 struct bgp_table
*table
;
3182 struct peer
*rsclient
;
3183 struct listnode
*node
, *nnode
;
3185 if (peer
->clear_node_queue
== NULL
)
3186 bgp_clear_node_queue_init (peer
);
3188 /* bgp_fsm.c keeps sessions in state Clearing, not transitioning to
3189 * Idle until it receives a Clearing_Completed event. This protects
3190 * against peers which flap faster than we can we clear, which could
3193 * a) race with routes from the new session being installed before
3194 * clear_route_node visits the node (to delete the route of that
3196 * b) resource exhaustion, clear_route_node likely leads to an entry
3197 * on the process_main queue. Fast-flapping could cause that queue
3200 if (!peer
->clear_node_queue
->thread
)
3201 peer_lock (peer
); /* bgp_clear_node_complete */
3205 case BGP_CLEAR_ROUTE_NORMAL
:
3206 if (safi
!= SAFI_MPLS_VPN
)
3207 bgp_clear_route_table (peer
, afi
, safi
, NULL
, NULL
, purpose
);
3209 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
3210 rn
= bgp_route_next (rn
))
3211 if ((table
= rn
->info
) != NULL
)
3212 bgp_clear_route_table (peer
, afi
, safi
, table
, NULL
, purpose
);
3214 for (ALL_LIST_ELEMENTS (peer
->bgp
->rsclient
, node
, nnode
, rsclient
))
3215 if (CHECK_FLAG(rsclient
->af_flags
[afi
][safi
],
3216 PEER_FLAG_RSERVER_CLIENT
))
3217 bgp_clear_route_table (peer
, afi
, safi
, NULL
, rsclient
, purpose
);
3220 case BGP_CLEAR_ROUTE_MY_RSCLIENT
:
3221 bgp_clear_route_table (peer
, afi
, safi
, NULL
, peer
, purpose
);
3229 /* If no routes were cleared, nothing was added to workqueue, the
3230 * completion function won't be run by workqueue code - call it here.
3231 * XXX: Actually, this assumption doesn't hold, see
3232 * bgp_clear_route_table(), we queue all non-empty nodes.
3234 * Additionally, there is a presumption in FSM that clearing is only
3235 * really needed if peer state is Established - peers in
3236 * pre-Established states shouldn't have any route-update state
3237 * associated with them (in or out).
3239 * We still can get here in pre-Established though, through
3240 * peer_delete -> bgp_fsm_change_status, so this is a useful sanity
3241 * check to ensure the assumption above holds.
3243 * At some future point, this check could be move to the top of the
3244 * function, and do a quick early-return when state is
3245 * pre-Established, avoiding above list and table scans. Once we're
3248 if (!peer
->clear_node_queue
->thread
)
3249 bgp_clear_node_complete (peer
->clear_node_queue
);
3253 bgp_clear_route_all (struct peer
*peer
)
3258 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
3259 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
3260 bgp_clear_route (peer
, afi
, safi
, BGP_CLEAR_ROUTE_NORMAL
);
3264 bgp_clear_adj_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
3266 struct bgp_table
*table
;
3267 struct bgp_node
*rn
;
3268 struct bgp_adj_in
*ain
;
3270 table
= peer
->bgp
->rib
[afi
][safi
];
3272 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3273 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
3274 if (ain
->peer
== peer
)
3276 bgp_adj_in_remove (rn
, ain
);
3277 bgp_unlock_node (rn
);
3283 bgp_clear_stale_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
3285 struct bgp_node
*rn
;
3286 struct bgp_info
*ri
;
3287 struct bgp_table
*table
;
3289 table
= peer
->bgp
->rib
[afi
][safi
];
3291 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3293 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3294 if (ri
->peer
== peer
)
3296 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
3297 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
3303 /* Delete all kernel routes. */
3305 bgp_cleanup_routes (void)
3308 struct listnode
*node
, *nnode
;
3309 struct bgp_node
*rn
;
3310 struct bgp_table
*table
;
3311 struct bgp_info
*ri
;
3313 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
3315 table
= bgp
->rib
[AFI_IP
][SAFI_UNICAST
];
3317 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3318 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3319 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
3320 && ri
->type
== ZEBRA_ROUTE_BGP
3321 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
3322 bgp_zebra_withdraw (&rn
->p
, ri
,SAFI_UNICAST
);
3324 table
= bgp
->rib
[AFI_IP6
][SAFI_UNICAST
];
3326 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
3327 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3328 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
3329 && ri
->type
== ZEBRA_ROUTE_BGP
3330 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
3331 bgp_zebra_withdraw (&rn
->p
, ri
,SAFI_UNICAST
);
3339 bgp_zclient_reset ();
3340 access_list_reset ();
3341 prefix_list_reset ();
3344 /* Parse NLRI stream. Withdraw NLRI is recognized by NULL attr
3347 bgp_nlri_parse (struct peer
*peer
, struct attr
*attr
, struct bgp_nlri
*packet
)
3356 u_char addpath_encoded
;
3357 u_int32_t addpath_id
;
3359 /* Check peer status. */
3360 if (peer
->status
!= Established
)
3364 lim
= pnt
+ packet
->length
;
3366 safi
= packet
->safi
;
3369 addpath_encoded
= (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) &&
3370 CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
));
3372 for (; pnt
< lim
; pnt
+= psize
)
3374 /* Clear prefix structure. */
3375 memset (&p
, 0, sizeof (struct prefix
));
3377 if (addpath_encoded
)
3379 addpath_id
= ntohl(*((uint32_t*) pnt
));
3380 pnt
+= BGP_ADDPATH_ID_LEN
;
3383 /* Fetch prefix length. */
3384 p
.prefixlen
= *pnt
++;
3385 p
.family
= afi2family (afi
);
3387 /* Already checked in nlri_sanity_check(). We do double check
3389 if ((afi
== AFI_IP
&& p
.prefixlen
> 32)
3390 || (afi
== AFI_IP6
&& p
.prefixlen
> 128))
3393 /* Packet size overflow check. */
3394 psize
= PSIZE (p
.prefixlen
);
3396 /* When packet overflow occur return immediately. */
3397 if (pnt
+ psize
> lim
)
3400 /* Fetch prefix from NLRI packet. */
3401 memcpy (&p
.u
.prefix
, pnt
, psize
);
3403 /* Check address. */
3404 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
3406 if (IN_CLASSD (ntohl (p
.u
.prefix4
.s_addr
)))
3409 * From draft-ietf-idr-bgp4-22, Section 6.3:
3410 * If a BGP router receives an UPDATE message with a
3411 * semantically incorrect NLRI field, in which a prefix is
3412 * semantically incorrect (eg. an unexpected multicast IP
3413 * address), it should ignore the prefix.
3415 zlog_err ("IPv4 unicast NLRI is multicast address %s",
3416 inet_ntoa (p
.u
.prefix4
));
3423 /* Check address. */
3424 if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
3426 if (IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3430 zlog_warn ("IPv6 link-local NLRI received %s ignore this NLRI",
3431 inet_ntop (AF_INET6
, &p
.u
.prefix6
, buf
, BUFSIZ
));
3436 #endif /* HAVE_IPV6 */
3438 /* Normal process. */
3440 ret
= bgp_update (peer
, &p
, addpath_id
, attr
, afi
, safi
,
3441 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
, 0);
3443 ret
= bgp_withdraw (peer
, &p
, addpath_id
, attr
, afi
, safi
,
3444 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
3446 /* Address family configuration mismatch or maximum-prefix count
3452 /* Packet length consistency check. */
3459 /* NLRI encode syntax check routine. */
3461 bgp_nlri_sanity_check (struct peer
*peer
, int afi
, safi_t safi
, u_char
*pnt
,
3462 bgp_size_t length
, int *numpfx
)
3467 u_char addpath_encoded
;
3472 addpath_encoded
= (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) &&
3473 CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
));
3475 /* RFC1771 6.3 The NLRI field in the UPDATE message is checked for
3476 syntactic validity. If the field is syntactically incorrect,
3477 then the Error Subcode is set to Invalid Network Field. */
3481 /* If the NLRI is encoded using addpath then the first 4 bytes are
3482 * the addpath ID. */
3483 if (addpath_encoded
)
3484 pnt
+= BGP_ADDPATH_ID_LEN
;
3488 /* Prefix length check. */
3489 if ((afi
== AFI_IP
&& prefixlen
> 32)
3490 || (afi
== AFI_IP6
&& prefixlen
> 128))
3492 zlog_err ("%s [Error] Update packet error (wrong prefix length %d)",
3493 peer
->host
, prefixlen
);
3494 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3495 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3499 /* Packet size overflow check. */
3500 psize
= PSIZE (prefixlen
);
3502 if (pnt
+ psize
> end
)
3504 zlog_err ("%s [Error] Update packet error"
3505 " (prefix data overflow prefix size is %d)",
3507 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3508 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3516 /* Packet length consistency check. */
3519 zlog_err ("%s [Error] Update packet error"
3520 " (prefix length mismatch with total length)",
3522 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3523 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3529 static struct bgp_static
*
3530 bgp_static_new (void)
3532 return XCALLOC (MTYPE_BGP_STATIC
, sizeof (struct bgp_static
));
3536 bgp_static_free (struct bgp_static
*bgp_static
)
3538 if (bgp_static
->rmap
.name
)
3539 free (bgp_static
->rmap
.name
);
3540 XFREE (MTYPE_BGP_STATIC
, bgp_static
);
3544 bgp_static_withdraw_rsclient (struct bgp
*bgp
, struct peer
*rsclient
,
3545 struct prefix
*p
, afi_t afi
, safi_t safi
)
3547 struct bgp_node
*rn
;
3548 struct bgp_info
*ri
;
3550 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3552 /* Check selected route and self inserted route. */
3553 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3554 if (ri
->peer
== bgp
->peer_self
3555 && ri
->type
== ZEBRA_ROUTE_BGP
3556 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3559 /* Withdraw static BGP route from routing table. */
3562 bgp_info_delete (rn
, ri
);
3563 bgp_process (bgp
, rn
, afi
, safi
);
3566 /* Unlock bgp_node_lookup. */
3567 bgp_unlock_node (rn
);
3571 bgp_static_update_rsclient (struct peer
*rsclient
, struct prefix
*p
,
3572 struct bgp_static
*bgp_static
,
3573 afi_t afi
, safi_t safi
)
3575 struct bgp_node
*rn
;
3576 struct bgp_info
*ri
;
3577 struct bgp_info
*new;
3578 struct bgp_info info
;
3579 struct attr
*attr_new
;
3581 struct attr new_attr
;
3582 struct attr_extra new_extra
;
3585 char buf
[SU_ADDRSTRLEN
];
3587 bgp
= rsclient
->bgp
;
3589 assert (bgp_static
);
3593 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3595 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3597 attr
.nexthop
= bgp_static
->igpnexthop
;
3598 attr
.med
= bgp_static
->igpmetric
;
3599 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3601 if (bgp_static
->atomic
)
3602 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3604 /* Apply network route-map for export to this rsclient. */
3605 if (bgp_static
->rmap
.name
)
3607 struct attr attr_tmp
= attr
;
3608 info
.peer
= rsclient
;
3609 info
.attr
= &attr_tmp
;
3611 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
3612 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3614 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3616 rsclient
->rmap_type
= 0;
3618 if (ret
== RMAP_DENYMATCH
)
3620 /* Free uninterned attribute. */
3621 bgp_attr_flush (&attr_tmp
);
3623 /* Unintern original. */
3624 aspath_unintern (&attr
.aspath
);
3625 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
3626 bgp_attr_extra_free (&attr
);
3630 attr_new
= bgp_attr_intern (&attr_tmp
);
3633 attr_new
= bgp_attr_intern (&attr
);
3635 new_attr
.extra
= &new_extra
;
3636 bgp_attr_dup(&new_attr
, attr_new
);
3638 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3640 if (bgp_import_modifier (rsclient
, bgp
->peer_self
, p
, &new_attr
, afi
, safi
)
3643 /* This BGP update is filtered. Log the reason then update BGP entry. */
3644 if (bgp_debug_update(rsclient
, p
, 1))
3645 zlog_debug ("Static UPDATE about %s/%d -- DENIED for RS-client %s due to: import-policy",
3646 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
3647 p
->prefixlen
, rsclient
->host
);
3649 bgp
->peer_self
->rmap_type
= 0;
3651 bgp_attr_unintern (&attr_new
);
3652 aspath_unintern (&attr
.aspath
);
3653 bgp_attr_extra_free (&attr
);
3655 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
3660 bgp
->peer_self
->rmap_type
= 0;
3662 bgp_attr_unintern (&attr_new
);
3663 attr_new
= bgp_attr_intern (&new_attr
);
3665 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3666 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3667 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3672 if (attrhash_cmp (ri
->attr
, attr_new
) &&
3673 !CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3675 bgp_unlock_node (rn
);
3676 bgp_attr_unintern (&attr_new
);
3677 aspath_unintern (&attr
.aspath
);
3678 bgp_attr_extra_free (&attr
);
3683 /* The attribute is changed. */
3684 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
3686 /* Rewrite BGP route information. */
3687 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3688 bgp_info_restore(rn
, ri
);
3689 bgp_attr_unintern (&ri
->attr
);
3690 ri
->attr
= attr_new
;
3691 ri
->uptime
= bgp_clock ();
3693 /* Nexthop reachability check. */
3694 if (bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3696 if (bgp_find_or_add_nexthop (afi
, ri
, NULL
, 0))
3697 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
3700 if (BGP_DEBUG(nht
, NHT
))
3702 char buf1
[INET6_ADDRSTRLEN
];
3703 inet_ntop(AF_INET
, (const void *)&attr_new
->nexthop
,
3704 buf1
, INET6_ADDRSTRLEN
);
3705 zlog_debug("%s(%s): NH unresolved", __FUNCTION__
, buf1
);
3707 bgp_info_unset_flag (rn
, ri
, BGP_INFO_VALID
);
3710 /* Process change. */
3711 bgp_process (bgp
, rn
, afi
, safi
);
3712 bgp_unlock_node (rn
);
3713 aspath_unintern (&attr
.aspath
);
3714 bgp_attr_extra_free (&attr
);
3719 /* Make new BGP info. */
3720 new = info_make(ZEBRA_ROUTE_BGP
, BGP_ROUTE_STATIC
, 0, bgp
->peer_self
,
3722 /* Nexthop reachability check. */
3723 if (bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3725 if (bgp_find_or_add_nexthop (afi
, new, NULL
, 0))
3726 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
3729 if (BGP_DEBUG(nht
, NHT
))
3731 char buf1
[INET6_ADDRSTRLEN
];
3732 inet_ntop(AF_INET
, (const void *)&attr_new
->nexthop
,
3733 buf1
, INET6_ADDRSTRLEN
);
3734 zlog_debug("%s(%s): NH unresolved", __FUNCTION__
, buf1
);
3736 bgp_info_unset_flag (rn
, new, BGP_INFO_VALID
);
3740 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
3742 /* Register new BGP information. */
3743 bgp_info_add (rn
, new);
3745 /* route_node_get lock */
3746 bgp_unlock_node (rn
);
3748 /* Process change. */
3749 bgp_process (bgp
, rn
, afi
, safi
);
3751 /* Unintern original. */
3752 aspath_unintern (&attr
.aspath
);
3753 bgp_attr_extra_free (&attr
);
3757 bgp_static_update_main (struct bgp
*bgp
, struct prefix
*p
,
3758 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3760 struct bgp_node
*rn
;
3761 struct bgp_info
*ri
;
3762 struct bgp_info
*new;
3763 struct bgp_info info
;
3765 struct attr
*attr_new
;
3768 assert (bgp_static
);
3772 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3774 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3776 attr
.nexthop
= bgp_static
->igpnexthop
;
3777 attr
.med
= bgp_static
->igpmetric
;
3778 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3780 if (bgp_static
->atomic
)
3781 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3783 /* Apply route-map. */
3784 if (bgp_static
->rmap
.name
)
3786 struct attr attr_tmp
= attr
;
3787 info
.peer
= bgp
->peer_self
;
3788 info
.attr
= &attr_tmp
;
3790 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3792 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3794 bgp
->peer_self
->rmap_type
= 0;
3796 if (ret
== RMAP_DENYMATCH
)
3798 /* Free uninterned attribute. */
3799 bgp_attr_flush (&attr_tmp
);
3801 /* Unintern original. */
3802 aspath_unintern (&attr
.aspath
);
3803 bgp_attr_extra_free (&attr
);
3804 bgp_static_withdraw (bgp
, p
, afi
, safi
);
3807 attr_new
= bgp_attr_intern (&attr_tmp
);
3810 attr_new
= bgp_attr_intern (&attr
);
3812 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3813 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3814 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3819 if (attrhash_cmp (ri
->attr
, attr_new
) &&
3820 !CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3822 bgp_unlock_node (rn
);
3823 bgp_attr_unintern (&attr_new
);
3824 aspath_unintern (&attr
.aspath
);
3825 bgp_attr_extra_free (&attr
);
3830 /* The attribute is changed. */
3831 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
3833 /* Rewrite BGP route information. */
3834 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3835 bgp_info_restore(rn
, ri
);
3837 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3838 bgp_attr_unintern (&ri
->attr
);
3839 ri
->attr
= attr_new
;
3840 ri
->uptime
= bgp_clock ();
3842 /* Nexthop reachability check. */
3843 if (bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3845 if (bgp_find_or_add_nexthop (afi
, ri
, NULL
, 0))
3846 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
3849 if (BGP_DEBUG(nht
, NHT
))
3851 char buf1
[INET6_ADDRSTRLEN
];
3852 inet_ntop(AF_INET
, (const void *)&attr_new
->nexthop
,
3853 buf1
, INET6_ADDRSTRLEN
);
3854 zlog_debug("%s(%s): NH unresolved", __FUNCTION__
, buf1
);
3856 bgp_info_unset_flag (rn
, ri
, BGP_INFO_VALID
);
3859 /* Process change. */
3860 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
3861 bgp_process (bgp
, rn
, afi
, safi
);
3862 bgp_unlock_node (rn
);
3863 aspath_unintern (&attr
.aspath
);
3864 bgp_attr_extra_free (&attr
);
3869 /* Make new BGP info. */
3870 new = info_make(ZEBRA_ROUTE_BGP
, BGP_ROUTE_STATIC
, 0, bgp
->peer_self
, attr_new
,
3872 /* Nexthop reachability check. */
3873 if (bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3875 if (bgp_find_or_add_nexthop (afi
, new, NULL
, 0))
3876 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
3879 if (BGP_DEBUG(nht
, NHT
))
3881 char buf1
[INET6_ADDRSTRLEN
];
3882 inet_ntop(AF_INET
, (const void *)&attr_new
->nexthop
, buf1
,
3884 zlog_debug("%s(%s): NH unresolved", __FUNCTION__
, buf1
);
3886 bgp_info_unset_flag (rn
, new, BGP_INFO_VALID
);
3890 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
3892 /* Aggregate address increment. */
3893 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3895 /* Register new BGP information. */
3896 bgp_info_add (rn
, new);
3898 /* route_node_get lock */
3899 bgp_unlock_node (rn
);
3901 /* Process change. */
3902 bgp_process (bgp
, rn
, afi
, safi
);
3904 /* Unintern original. */
3905 aspath_unintern (&attr
.aspath
);
3906 bgp_attr_extra_free (&attr
);
3910 bgp_static_update (struct bgp
*bgp
, struct prefix
*p
,
3911 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3913 struct peer
*rsclient
;
3914 struct listnode
*node
, *nnode
;
3916 bgp_static_update_main (bgp
, p
, bgp_static
, afi
, safi
);
3918 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
3920 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
3921 bgp_static_update_rsclient (rsclient
, p
, bgp_static
, afi
, safi
);
3926 bgp_static_update_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3927 safi_t safi
, struct prefix_rd
*prd
, u_char
*tag
)
3929 struct bgp_node
*rn
;
3930 struct bgp_info
*new;
3932 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3934 /* Make new BGP info. */
3935 new = info_make(ZEBRA_ROUTE_BGP
, BGP_ROUTE_STATIC
, 0, bgp
->peer_self
,
3936 bgp_attr_default_intern(BGP_ORIGIN_IGP
), rn
);
3938 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3939 new->extra
= bgp_info_extra_new();
3940 memcpy (new->extra
->tag
, tag
, 3);
3942 /* Aggregate address increment. */
3943 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3945 /* Register new BGP information. */
3946 bgp_info_add (rn
, new);
3948 /* route_node_get lock */
3949 bgp_unlock_node (rn
);
3951 /* Process change. */
3952 bgp_process (bgp
, rn
, afi
, safi
);
3956 bgp_static_withdraw (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3959 struct bgp_node
*rn
;
3960 struct bgp_info
*ri
;
3962 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3964 /* Check selected route and self inserted route. */
3965 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3966 if (ri
->peer
== bgp
->peer_self
3967 && ri
->type
== ZEBRA_ROUTE_BGP
3968 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3971 /* Withdraw static BGP route from routing table. */
3974 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3975 bgp_unlink_nexthop(ri
);
3976 bgp_info_delete (rn
, ri
);
3977 bgp_process (bgp
, rn
, afi
, safi
);
3980 /* Unlock bgp_node_lookup. */
3981 bgp_unlock_node (rn
);
3985 bgp_check_local_routes_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
3987 struct bgp_static
*bgp_static
;
3989 struct bgp_node
*rn
;
3992 bgp
= rsclient
->bgp
;
3994 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3995 if ((bgp_static
= rn
->info
) != NULL
)
3999 bgp_static_update_rsclient (rsclient
, p
, bgp_static
,
4005 bgp_static_withdraw_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
4006 safi_t safi
, struct prefix_rd
*prd
, u_char
*tag
)
4008 struct bgp_node
*rn
;
4009 struct bgp_info
*ri
;
4011 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
4013 /* Check selected route and self inserted route. */
4014 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4015 if (ri
->peer
== bgp
->peer_self
4016 && ri
->type
== ZEBRA_ROUTE_BGP
4017 && ri
->sub_type
== BGP_ROUTE_STATIC
)
4020 /* Withdraw static BGP route from routing table. */
4023 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
4024 bgp_info_delete (rn
, ri
);
4025 bgp_process (bgp
, rn
, afi
, safi
);
4028 /* Unlock bgp_node_lookup. */
4029 bgp_unlock_node (rn
);
4032 /* Configure static BGP network. When user don't run zebra, static
4033 route should be installed as valid. */
4035 bgp_static_set (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
4036 afi_t afi
, safi_t safi
, const char *rmap
, int backdoor
)
4040 struct bgp_static
*bgp_static
;
4041 struct bgp_node
*rn
;
4042 u_char need_update
= 0;
4044 /* Convert IP prefix string to struct prefix. */
4045 ret
= str2prefix (ip_str
, &p
);
4048 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
4052 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
4054 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
4058 #endif /* HAVE_IPV6 */
4062 /* Set BGP static route configuration. */
4063 rn
= bgp_node_get (bgp
->route
[afi
][safi
], &p
);
4067 /* Configuration change. */
4068 bgp_static
= rn
->info
;
4070 /* Check previous routes are installed into BGP. */
4071 if (bgp_static
->valid
&& bgp_static
->backdoor
!= backdoor
)
4074 bgp_static
->backdoor
= backdoor
;
4078 if (bgp_static
->rmap
.name
)
4079 free (bgp_static
->rmap
.name
);
4080 bgp_static
->rmap
.name
= strdup (rmap
);
4081 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
4085 if (bgp_static
->rmap
.name
)
4086 free (bgp_static
->rmap
.name
);
4087 bgp_static
->rmap
.name
= NULL
;
4088 bgp_static
->rmap
.map
= NULL
;
4089 bgp_static
->valid
= 0;
4091 bgp_unlock_node (rn
);
4095 /* New configuration. */
4096 bgp_static
= bgp_static_new ();
4097 bgp_static
->backdoor
= backdoor
;
4098 bgp_static
->valid
= 0;
4099 bgp_static
->igpmetric
= 0;
4100 bgp_static
->igpnexthop
.s_addr
= 0;
4104 if (bgp_static
->rmap
.name
)
4105 free (bgp_static
->rmap
.name
);
4106 bgp_static
->rmap
.name
= strdup (rmap
);
4107 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
4109 rn
->info
= bgp_static
;
4112 bgp_static
->valid
= 1;
4114 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
4116 if (! bgp_static
->backdoor
)
4117 bgp_static_update (bgp
, &p
, bgp_static
, afi
, safi
);
4122 /* Configure static BGP network. */
4124 bgp_static_unset (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
4125 afi_t afi
, safi_t safi
)
4129 struct bgp_static
*bgp_static
;
4130 struct bgp_node
*rn
;
4132 /* Convert IP prefix string to struct prefix. */
4133 ret
= str2prefix (ip_str
, &p
);
4136 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
4140 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
4142 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
4146 #endif /* HAVE_IPV6 */
4150 rn
= bgp_node_lookup (bgp
->route
[afi
][safi
], &p
);
4153 vty_out (vty
, "%% Can't find specified static route configuration.%s",
4158 bgp_static
= rn
->info
;
4160 /* Update BGP RIB. */
4161 if (! bgp_static
->backdoor
)
4162 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
4164 /* Clear configuration. */
4165 bgp_unlink_nexthop(bgp_static
);
4166 bgp_static_free (bgp_static
);
4168 bgp_unlock_node (rn
);
4169 bgp_unlock_node (rn
);
4174 /* Called from bgp_delete(). Delete all static routes from the BGP
4177 bgp_static_delete (struct bgp
*bgp
)
4181 struct bgp_node
*rn
;
4182 struct bgp_node
*rm
;
4183 struct bgp_table
*table
;
4184 struct bgp_static
*bgp_static
;
4186 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
4187 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
4188 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
4189 if (rn
->info
!= NULL
)
4191 if (safi
== SAFI_MPLS_VPN
)
4195 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
4197 bgp_static
= rn
->info
;
4198 bgp_static_withdraw_vpnv4 (bgp
, &rm
->p
,
4199 AFI_IP
, SAFI_MPLS_VPN
,
4200 (struct prefix_rd
*)&rn
->p
,
4202 bgp_static_free (bgp_static
);
4204 bgp_unlock_node (rn
);
4209 bgp_static
= rn
->info
;
4210 bgp_static_withdraw (bgp
, &rn
->p
, afi
, safi
);
4211 bgp_static_free (bgp_static
);
4213 bgp_unlock_node (rn
);
4219 bgp_static_set_vpnv4 (struct vty
*vty
, const char *ip_str
, const char *rd_str
,
4220 const char *tag_str
)
4224 struct prefix_rd prd
;
4226 struct bgp_node
*prn
;
4227 struct bgp_node
*rn
;
4228 struct bgp_table
*table
;
4229 struct bgp_static
*bgp_static
;
4234 ret
= str2prefix (ip_str
, &p
);
4237 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
4242 ret
= str2prefix_rd (rd_str
, &prd
);
4245 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
4249 ret
= str2tag (tag_str
, tag
);
4252 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
4256 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
4257 (struct prefix
*)&prd
);
4258 if (prn
->info
== NULL
)
4259 prn
->info
= bgp_table_init (AFI_IP
, SAFI_MPLS_VPN
);
4261 bgp_unlock_node (prn
);
4264 rn
= bgp_node_get (table
, &p
);
4268 vty_out (vty
, "%% Same network configuration exists%s", VTY_NEWLINE
);
4269 bgp_unlock_node (rn
);
4273 /* New configuration. */
4274 bgp_static
= bgp_static_new ();
4275 bgp_static
->valid
= 1;
4276 memcpy (bgp_static
->tag
, tag
, 3);
4277 rn
->info
= bgp_static
;
4279 bgp_static_update_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
4285 /* Configure static BGP network. */
4287 bgp_static_unset_vpnv4 (struct vty
*vty
, const char *ip_str
,
4288 const char *rd_str
, const char *tag_str
)
4293 struct prefix_rd prd
;
4294 struct bgp_node
*prn
;
4295 struct bgp_node
*rn
;
4296 struct bgp_table
*table
;
4297 struct bgp_static
*bgp_static
;
4302 /* Convert IP prefix string to struct prefix. */
4303 ret
= str2prefix (ip_str
, &p
);
4306 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
4311 ret
= str2prefix_rd (rd_str
, &prd
);
4314 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
4318 ret
= str2tag (tag_str
, tag
);
4321 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
4325 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
4326 (struct prefix
*)&prd
);
4327 if (prn
->info
== NULL
)
4328 prn
->info
= bgp_table_init (AFI_IP
, SAFI_MPLS_VPN
);
4330 bgp_unlock_node (prn
);
4333 rn
= bgp_node_lookup (table
, &p
);
4337 bgp_static_withdraw_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
4339 bgp_static
= rn
->info
;
4340 bgp_static_free (bgp_static
);
4342 bgp_unlock_node (rn
);
4343 bgp_unlock_node (rn
);
4346 vty_out (vty
, "%% Can't find the route%s", VTY_NEWLINE
);
4352 bgp_table_map_set (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
4353 const char *rmap_name
)
4355 struct bgp_rmap
*rmap
;
4357 rmap
= &bgp
->table_map
[afi
][safi
];
4362 rmap
->name
= strdup (rmap_name
);
4363 rmap
->map
= route_map_lookup_by_name (rmap_name
);
4373 bgp_zebra_announce_table(bgp
, afi
, safi
);
4379 bgp_table_map_unset (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
4380 const char *rmap_name
)
4382 struct bgp_rmap
*rmap
;
4384 rmap
= &bgp
->table_map
[afi
][safi
];
4390 bgp_zebra_announce_table(bgp
, afi
, safi
);
4396 bgp_config_write_table_map (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
4397 safi_t safi
, int *write
)
4399 if (bgp
->table_map
[afi
][safi
].name
)
4401 bgp_config_write_family_header (vty
, afi
, safi
, write
);
4402 vty_out (vty
, " table-map %s%s",
4403 bgp
->table_map
[afi
][safi
].name
, VTY_NEWLINE
);
4410 DEFUN (bgp_table_map
,
4413 "BGP table to RIB route download filter\n"
4414 "Name of the route map\n")
4416 return bgp_table_map_set (vty
, vty
->index
,
4417 bgp_node_afi (vty
), bgp_node_safi (vty
), argv
[0]);
4419 DEFUN (no_bgp_table_map
,
4420 no_bgp_table_map_cmd
,
4421 "no table-map WORD",
4422 "BGP table to RIB route download filter\n"
4423 "Name of the route map\n")
4425 return bgp_table_map_unset (vty
, vty
->index
,
4426 bgp_node_afi (vty
), bgp_node_safi (vty
), argv
[0]);
4431 "network A.B.C.D/M",
4432 "Specify a network to announce via BGP\n"
4433 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
4435 return bgp_static_set (vty
, vty
->index
, argv
[0],
4436 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
4439 DEFUN (bgp_network_route_map
,
4440 bgp_network_route_map_cmd
,
4441 "network A.B.C.D/M route-map WORD",
4442 "Specify a network to announce via BGP\n"
4443 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4444 "Route-map to modify the attributes\n"
4445 "Name of the route map\n")
4447 return bgp_static_set (vty
, vty
->index
, argv
[0],
4448 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
4451 DEFUN (bgp_network_backdoor
,
4452 bgp_network_backdoor_cmd
,
4453 "network A.B.C.D/M backdoor",
4454 "Specify a network to announce via BGP\n"
4455 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4456 "Specify a BGP backdoor route\n")
4458 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP
, SAFI_UNICAST
,
4462 DEFUN (bgp_network_mask
,
4463 bgp_network_mask_cmd
,
4464 "network A.B.C.D mask A.B.C.D",
4465 "Specify a network to announce via BGP\n"
4471 char prefix_str
[BUFSIZ
];
4473 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4476 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4480 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4481 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
4484 DEFUN (bgp_network_mask_route_map
,
4485 bgp_network_mask_route_map_cmd
,
4486 "network A.B.C.D mask A.B.C.D route-map WORD",
4487 "Specify a network to announce via BGP\n"
4491 "Route-map to modify the attributes\n"
4492 "Name of the route map\n")
4495 char prefix_str
[BUFSIZ
];
4497 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4500 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4504 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4505 AFI_IP
, bgp_node_safi (vty
), argv
[2], 0);
4508 DEFUN (bgp_network_mask_backdoor
,
4509 bgp_network_mask_backdoor_cmd
,
4510 "network A.B.C.D mask A.B.C.D backdoor",
4511 "Specify a network to announce via BGP\n"
4515 "Specify a BGP backdoor route\n")
4518 char prefix_str
[BUFSIZ
];
4520 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4523 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4527 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
,
4531 DEFUN (bgp_network_mask_natural
,
4532 bgp_network_mask_natural_cmd
,
4534 "Specify a network to announce via BGP\n"
4538 char prefix_str
[BUFSIZ
];
4540 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4543 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4547 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4548 AFI_IP
, bgp_node_safi (vty
), NULL
, 0);
4551 DEFUN (bgp_network_mask_natural_route_map
,
4552 bgp_network_mask_natural_route_map_cmd
,
4553 "network A.B.C.D route-map WORD",
4554 "Specify a network to announce via BGP\n"
4556 "Route-map to modify the attributes\n"
4557 "Name of the route map\n")
4560 char prefix_str
[BUFSIZ
];
4562 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4565 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4569 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4570 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0);
4573 DEFUN (bgp_network_mask_natural_backdoor
,
4574 bgp_network_mask_natural_backdoor_cmd
,
4575 "network A.B.C.D backdoor",
4576 "Specify a network to announce via BGP\n"
4578 "Specify a BGP backdoor route\n")
4581 char prefix_str
[BUFSIZ
];
4583 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4586 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4590 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
,
4594 DEFUN (no_bgp_network
,
4596 "no network A.B.C.D/M",
4598 "Specify a network to announce via BGP\n"
4599 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
4601 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP
,
4602 bgp_node_safi (vty
));
4605 ALIAS (no_bgp_network
,
4606 no_bgp_network_route_map_cmd
,
4607 "no network A.B.C.D/M route-map WORD",
4609 "Specify a network to announce via BGP\n"
4610 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4611 "Route-map to modify the attributes\n"
4612 "Name of the route map\n")
4614 ALIAS (no_bgp_network
,
4615 no_bgp_network_backdoor_cmd
,
4616 "no network A.B.C.D/M backdoor",
4618 "Specify a network to announce via BGP\n"
4619 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4620 "Specify a BGP backdoor route\n")
4622 DEFUN (no_bgp_network_mask
,
4623 no_bgp_network_mask_cmd
,
4624 "no network A.B.C.D mask A.B.C.D",
4626 "Specify a network to announce via BGP\n"
4632 char prefix_str
[BUFSIZ
];
4634 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4637 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4641 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
4642 bgp_node_safi (vty
));
4645 ALIAS (no_bgp_network_mask
,
4646 no_bgp_network_mask_route_map_cmd
,
4647 "no network A.B.C.D mask A.B.C.D route-map WORD",
4649 "Specify a network to announce via BGP\n"
4653 "Route-map to modify the attributes\n"
4654 "Name of the route map\n")
4656 ALIAS (no_bgp_network_mask
,
4657 no_bgp_network_mask_backdoor_cmd
,
4658 "no network A.B.C.D mask A.B.C.D backdoor",
4660 "Specify a network to announce via BGP\n"
4664 "Specify a BGP backdoor route\n")
4666 DEFUN (no_bgp_network_mask_natural
,
4667 no_bgp_network_mask_natural_cmd
,
4668 "no network A.B.C.D",
4670 "Specify a network to announce via BGP\n"
4674 char prefix_str
[BUFSIZ
];
4676 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4679 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4683 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
4684 bgp_node_safi (vty
));
4687 ALIAS (no_bgp_network_mask_natural
,
4688 no_bgp_network_mask_natural_route_map_cmd
,
4689 "no network A.B.C.D route-map WORD",
4691 "Specify a network to announce via BGP\n"
4693 "Route-map to modify the attributes\n"
4694 "Name of the route map\n")
4696 ALIAS (no_bgp_network_mask_natural
,
4697 no_bgp_network_mask_natural_backdoor_cmd
,
4698 "no network A.B.C.D backdoor",
4700 "Specify a network to announce via BGP\n"
4702 "Specify a BGP backdoor route\n")
4705 DEFUN (ipv6_bgp_network
,
4706 ipv6_bgp_network_cmd
,
4707 "network X:X::X:X/M",
4708 "Specify a network to announce via BGP\n"
4709 "IPv6 prefix <network>/<length>\n")
4711 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
, bgp_node_safi(vty
),
4715 DEFUN (ipv6_bgp_network_route_map
,
4716 ipv6_bgp_network_route_map_cmd
,
4717 "network X:X::X:X/M route-map WORD",
4718 "Specify a network to announce via BGP\n"
4719 "IPv6 prefix <network>/<length>\n"
4720 "Route-map to modify the attributes\n"
4721 "Name of the route map\n")
4723 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
,
4724 bgp_node_safi (vty
), argv
[1], 0);
4727 DEFUN (no_ipv6_bgp_network
,
4728 no_ipv6_bgp_network_cmd
,
4729 "no network X:X::X:X/M",
4731 "Specify a network to announce via BGP\n"
4732 "IPv6 prefix <network>/<length>\n")
4734 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP6
, bgp_node_safi(vty
));
4737 ALIAS (no_ipv6_bgp_network
,
4738 no_ipv6_bgp_network_route_map_cmd
,
4739 "no network X:X::X:X/M route-map WORD",
4741 "Specify a network to announce via BGP\n"
4742 "IPv6 prefix <network>/<length>\n"
4743 "Route-map to modify the attributes\n"
4744 "Name of the route map\n")
4746 ALIAS (ipv6_bgp_network
,
4747 old_ipv6_bgp_network_cmd
,
4748 "ipv6 bgp network X:X::X:X/M",
4751 "Specify a network to announce via BGP\n"
4752 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
4754 ALIAS (no_ipv6_bgp_network
,
4755 old_no_ipv6_bgp_network_cmd
,
4756 "no ipv6 bgp network X:X::X:X/M",
4760 "Specify a network to announce via BGP\n"
4761 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
4762 #endif /* HAVE_IPV6 */
4764 /* stubs for removed AS-Pathlimit commands, kept for config compatibility */
4765 ALIAS_DEPRECATED (bgp_network
,
4766 bgp_network_ttl_cmd
,
4767 "network A.B.C.D/M pathlimit <0-255>",
4768 "Specify a network to announce via BGP\n"
4769 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4770 "AS-Path hopcount limit attribute\n"
4771 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4772 ALIAS_DEPRECATED (bgp_network_backdoor
,
4773 bgp_network_backdoor_ttl_cmd
,
4774 "network A.B.C.D/M backdoor pathlimit <0-255>",
4775 "Specify a network to announce via BGP\n"
4776 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4777 "Specify a BGP backdoor route\n"
4778 "AS-Path hopcount limit attribute\n"
4779 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4780 ALIAS_DEPRECATED (bgp_network_mask
,
4781 bgp_network_mask_ttl_cmd
,
4782 "network A.B.C.D mask A.B.C.D pathlimit <0-255>",
4783 "Specify a network to announce via BGP\n"
4787 "AS-Path hopcount limit attribute\n"
4788 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4789 ALIAS_DEPRECATED (bgp_network_mask_backdoor
,
4790 bgp_network_mask_backdoor_ttl_cmd
,
4791 "network A.B.C.D mask A.B.C.D backdoor pathlimit <0-255>",
4792 "Specify a network to announce via BGP\n"
4796 "Specify a BGP backdoor route\n"
4797 "AS-Path hopcount limit attribute\n"
4798 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4799 ALIAS_DEPRECATED (bgp_network_mask_natural
,
4800 bgp_network_mask_natural_ttl_cmd
,
4801 "network A.B.C.D pathlimit <0-255>",
4802 "Specify a network to announce via BGP\n"
4804 "AS-Path hopcount limit attribute\n"
4805 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4806 ALIAS_DEPRECATED (bgp_network_mask_natural_backdoor
,
4807 bgp_network_mask_natural_backdoor_ttl_cmd
,
4808 "network A.B.C.D backdoor pathlimit <1-255>",
4809 "Specify a network to announce via BGP\n"
4811 "Specify a BGP backdoor route\n"
4812 "AS-Path hopcount limit attribute\n"
4813 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4814 ALIAS_DEPRECATED (no_bgp_network
,
4815 no_bgp_network_ttl_cmd
,
4816 "no network A.B.C.D/M pathlimit <0-255>",
4818 "Specify a network to announce via BGP\n"
4819 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4820 "AS-Path hopcount limit attribute\n"
4821 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4822 ALIAS_DEPRECATED (no_bgp_network
,
4823 no_bgp_network_backdoor_ttl_cmd
,
4824 "no network A.B.C.D/M backdoor pathlimit <0-255>",
4826 "Specify a network to announce via BGP\n"
4827 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4828 "Specify a BGP backdoor route\n"
4829 "AS-Path hopcount limit attribute\n"
4830 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4831 ALIAS_DEPRECATED (no_bgp_network
,
4832 no_bgp_network_mask_ttl_cmd
,
4833 "no network A.B.C.D mask A.B.C.D pathlimit <0-255>",
4835 "Specify a network to announce via BGP\n"
4839 "AS-Path hopcount limit attribute\n"
4840 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4841 ALIAS_DEPRECATED (no_bgp_network_mask
,
4842 no_bgp_network_mask_backdoor_ttl_cmd
,
4843 "no network A.B.C.D mask A.B.C.D backdoor pathlimit <0-255>",
4845 "Specify a network to announce via BGP\n"
4849 "Specify a BGP backdoor route\n"
4850 "AS-Path hopcount limit attribute\n"
4851 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4852 ALIAS_DEPRECATED (no_bgp_network_mask_natural
,
4853 no_bgp_network_mask_natural_ttl_cmd
,
4854 "no network A.B.C.D pathlimit <0-255>",
4856 "Specify a network to announce via BGP\n"
4858 "AS-Path hopcount limit attribute\n"
4859 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4860 ALIAS_DEPRECATED (no_bgp_network_mask_natural
,
4861 no_bgp_network_mask_natural_backdoor_ttl_cmd
,
4862 "no network A.B.C.D backdoor pathlimit <0-255>",
4864 "Specify a network to announce via BGP\n"
4866 "Specify a BGP backdoor route\n"
4867 "AS-Path hopcount limit attribute\n"
4868 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4870 ALIAS_DEPRECATED (ipv6_bgp_network
,
4871 ipv6_bgp_network_ttl_cmd
,
4872 "network X:X::X:X/M pathlimit <0-255>",
4873 "Specify a network to announce via BGP\n"
4874 "IPv6 prefix <network>/<length>\n"
4875 "AS-Path hopcount limit attribute\n"
4876 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4877 ALIAS_DEPRECATED (no_ipv6_bgp_network
,
4878 no_ipv6_bgp_network_ttl_cmd
,
4879 "no network X:X::X:X/M pathlimit <0-255>",
4881 "Specify a network to announce via BGP\n"
4882 "IPv6 prefix <network>/<length>\n"
4883 "AS-Path hopcount limit attribute\n"
4884 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4885 #endif /* HAVE_IPV6 */
4887 /* Aggreagete address:
4889 advertise-map Set condition to advertise attribute
4890 as-set Generate AS set path information
4891 attribute-map Set attributes of aggregate
4892 route-map Set parameters of aggregate
4893 summary-only Filter more specific routes from updates
4894 suppress-map Conditionally filter more specific routes from updates
4897 struct bgp_aggregate
4899 /* Summary-only flag. */
4900 u_char summary_only
;
4902 /* AS set generation. */
4905 /* Route-map for aggregated route. */
4906 struct route_map
*map
;
4908 /* Suppress-count. */
4909 unsigned long count
;
4911 /* SAFI configuration. */
4915 static struct bgp_aggregate
*
4916 bgp_aggregate_new (void)
4918 return XCALLOC (MTYPE_BGP_AGGREGATE
, sizeof (struct bgp_aggregate
));
4922 bgp_aggregate_free (struct bgp_aggregate
*aggregate
)
4924 XFREE (MTYPE_BGP_AGGREGATE
, aggregate
);
4927 /* Update an aggregate as routes are added/removed from the BGP table */
4929 bgp_aggregate_route (struct bgp
*bgp
, struct prefix
*p
, struct bgp_info
*rinew
,
4930 afi_t afi
, safi_t safi
, struct bgp_info
*del
,
4931 struct bgp_aggregate
*aggregate
)
4933 struct bgp_table
*table
;
4934 struct bgp_node
*top
;
4935 struct bgp_node
*rn
;
4937 struct aspath
*aspath
= NULL
;
4938 struct aspath
*asmerge
= NULL
;
4939 struct community
*community
= NULL
;
4940 struct community
*commerge
= NULL
;
4941 struct in_addr nexthop
;
4943 struct bgp_info
*ri
;
4944 struct bgp_info
*new;
4946 unsigned long match
= 0;
4947 u_char atomic_aggregate
= 0;
4949 /* Record adding route's nexthop and med. */
4952 nexthop
= rinew
->attr
->nexthop
;
4953 med
= rinew
->attr
->med
;
4956 /* ORIGIN attribute: If at least one route among routes that are
4957 aggregated has ORIGIN with the value INCOMPLETE, then the
4958 aggregated route must have the ORIGIN attribute with the value
4959 INCOMPLETE. Otherwise, if at least one route among routes that
4960 are aggregated has ORIGIN with the value EGP, then the aggregated
4961 route must have the origin attribute with the value EGP. In all
4962 other case the value of the ORIGIN attribute of the aggregated
4963 route is INTERNAL. */
4964 origin
= BGP_ORIGIN_IGP
;
4966 table
= bgp
->rib
[afi
][safi
];
4968 top
= bgp_node_get (table
, p
);
4969 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4970 if (rn
->p
.prefixlen
> p
->prefixlen
)
4974 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4976 if (BGP_INFO_HOLDDOWN (ri
))
4979 if (del
&& ri
== del
)
4982 if (! rinew
&& first
)
4984 nexthop
= ri
->attr
->nexthop
;
4985 med
= ri
->attr
->med
;
4989 #ifdef AGGREGATE_NEXTHOP_CHECK
4990 if (! IPV4_ADDR_SAME (&ri
->attr
->nexthop
, &nexthop
)
4991 || ri
->attr
->med
!= med
)
4994 aspath_free (aspath
);
4996 community_free (community
);
4997 bgp_unlock_node (rn
);
4998 bgp_unlock_node (top
);
5001 #endif /* AGGREGATE_NEXTHOP_CHECK */
5003 if (ri
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
5004 atomic_aggregate
= 1;
5006 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
5008 if (aggregate
->summary_only
)
5010 (bgp_info_extra_get (ri
))->suppress
++;
5011 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
5017 if (origin
< ri
->attr
->origin
)
5018 origin
= ri
->attr
->origin
;
5020 if (aggregate
->as_set
)
5024 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
5025 aspath_free (aspath
);
5029 aspath
= aspath_dup (ri
->attr
->aspath
);
5031 if (ri
->attr
->community
)
5035 commerge
= community_merge (community
,
5036 ri
->attr
->community
);
5037 community
= community_uniq_sort (commerge
);
5038 community_free (commerge
);
5041 community
= community_dup (ri
->attr
->community
);
5047 bgp_process (bgp
, rn
, afi
, safi
);
5049 bgp_unlock_node (top
);
5055 if (aggregate
->summary_only
)
5056 (bgp_info_extra_get (rinew
))->suppress
++;
5058 if (origin
< rinew
->attr
->origin
)
5059 origin
= rinew
->attr
->origin
;
5061 if (aggregate
->as_set
)
5065 asmerge
= aspath_aggregate (aspath
, rinew
->attr
->aspath
);
5066 aspath_free (aspath
);
5070 aspath
= aspath_dup (rinew
->attr
->aspath
);
5072 if (rinew
->attr
->community
)
5076 commerge
= community_merge (community
,
5077 rinew
->attr
->community
);
5078 community
= community_uniq_sort (commerge
);
5079 community_free (commerge
);
5082 community
= community_dup (rinew
->attr
->community
);
5087 if (aggregate
->count
> 0)
5089 rn
= bgp_node_get (table
, p
);
5090 new = info_make(ZEBRA_ROUTE_BGP
, BGP_ROUTE_AGGREGATE
, 0, bgp
->peer_self
,
5091 bgp_attr_aggregate_intern(bgp
, origin
, aspath
, community
,
5093 atomic_aggregate
), rn
);
5094 SET_FLAG (new->flags
, BGP_INFO_VALID
);
5096 bgp_info_add (rn
, new);
5097 bgp_unlock_node (rn
);
5098 bgp_process (bgp
, rn
, afi
, safi
);
5103 aspath_free (aspath
);
5105 community_free (community
);
5109 void bgp_aggregate_delete (struct bgp
*, struct prefix
*, afi_t
, safi_t
,
5110 struct bgp_aggregate
*);
5113 bgp_aggregate_increment (struct bgp
*bgp
, struct prefix
*p
,
5114 struct bgp_info
*ri
, afi_t afi
, safi_t safi
)
5116 struct bgp_node
*child
;
5117 struct bgp_node
*rn
;
5118 struct bgp_aggregate
*aggregate
;
5119 struct bgp_table
*table
;
5121 /* MPLS-VPN aggregation is not yet supported. */
5122 if (safi
== SAFI_MPLS_VPN
)
5125 table
= bgp
->aggregate
[afi
][safi
];
5127 /* No aggregates configured. */
5128 if (bgp_table_top_nolock (table
) == NULL
)
5131 if (p
->prefixlen
== 0)
5134 if (BGP_INFO_HOLDDOWN (ri
))
5137 child
= bgp_node_get (table
, p
);
5139 /* Aggregate address configuration check. */
5140 for (rn
= child
; rn
; rn
= bgp_node_parent_nolock (rn
))
5141 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
5143 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
5144 bgp_aggregate_route (bgp
, &rn
->p
, ri
, afi
, safi
, NULL
, aggregate
);
5146 bgp_unlock_node (child
);
5150 bgp_aggregate_decrement (struct bgp
*bgp
, struct prefix
*p
,
5151 struct bgp_info
*del
, afi_t afi
, safi_t safi
)
5153 struct bgp_node
*child
;
5154 struct bgp_node
*rn
;
5155 struct bgp_aggregate
*aggregate
;
5156 struct bgp_table
*table
;
5158 /* MPLS-VPN aggregation is not yet supported. */
5159 if (safi
== SAFI_MPLS_VPN
)
5162 table
= bgp
->aggregate
[afi
][safi
];
5164 /* No aggregates configured. */
5165 if (bgp_table_top_nolock (table
) == NULL
)
5168 if (p
->prefixlen
== 0)
5171 child
= bgp_node_get (table
, p
);
5173 /* Aggregate address configuration check. */
5174 for (rn
= child
; rn
; rn
= bgp_node_parent_nolock (rn
))
5175 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
5177 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
5178 bgp_aggregate_route (bgp
, &rn
->p
, NULL
, afi
, safi
, del
, aggregate
);
5180 bgp_unlock_node (child
);
5183 /* Called via bgp_aggregate_set when the user configures aggregate-address */
5185 bgp_aggregate_add (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
, safi_t safi
,
5186 struct bgp_aggregate
*aggregate
)
5188 struct bgp_table
*table
;
5189 struct bgp_node
*top
;
5190 struct bgp_node
*rn
;
5191 struct bgp_info
*new;
5192 struct bgp_info
*ri
;
5193 unsigned long match
;
5194 u_char origin
= BGP_ORIGIN_IGP
;
5195 struct aspath
*aspath
= NULL
;
5196 struct aspath
*asmerge
= NULL
;
5197 struct community
*community
= NULL
;
5198 struct community
*commerge
= NULL
;
5199 u_char atomic_aggregate
= 0;
5201 table
= bgp
->rib
[afi
][safi
];
5204 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
5206 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
5209 /* If routes exists below this node, generate aggregate routes. */
5210 top
= bgp_node_get (table
, p
);
5211 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
5212 if (rn
->p
.prefixlen
> p
->prefixlen
)
5216 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5218 if (BGP_INFO_HOLDDOWN (ri
))
5221 if (ri
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
5222 atomic_aggregate
= 1;
5224 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
5226 /* summary-only aggregate route suppress aggregated
5227 route announcement. */
5228 if (aggregate
->summary_only
)
5230 (bgp_info_extra_get (ri
))->suppress
++;
5231 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
5235 /* If at least one route among routes that are aggregated has
5236 * ORIGIN with the value INCOMPLETE, then the aggregated route
5237 * MUST have the ORIGIN attribute with the value INCOMPLETE.
5238 * Otherwise, if at least one route among routes that are
5239 * aggregated has ORIGIN with the value EGP, then the aggregated
5240 * route MUST have the ORIGIN attribute with the value EGP.
5242 if (origin
< ri
->attr
->origin
)
5243 origin
= ri
->attr
->origin
;
5245 /* as-set aggregate route generate origin, as path,
5246 community aggregation. */
5247 if (aggregate
->as_set
)
5251 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
5252 aspath_free (aspath
);
5256 aspath
= aspath_dup (ri
->attr
->aspath
);
5258 if (ri
->attr
->community
)
5262 commerge
= community_merge (community
,
5263 ri
->attr
->community
);
5264 community
= community_uniq_sort (commerge
);
5265 community_free (commerge
);
5268 community
= community_dup (ri
->attr
->community
);
5275 /* If this node is suppressed, process the change. */
5277 bgp_process (bgp
, rn
, afi
, safi
);
5279 bgp_unlock_node (top
);
5281 /* Add aggregate route to BGP table. */
5282 if (aggregate
->count
)
5284 rn
= bgp_node_get (table
, p
);
5285 new = info_make(ZEBRA_ROUTE_BGP
, BGP_ROUTE_AGGREGATE
, 0, bgp
->peer_self
,
5286 bgp_attr_aggregate_intern(bgp
, origin
, aspath
, community
,
5288 atomic_aggregate
), rn
);
5289 SET_FLAG (new->flags
, BGP_INFO_VALID
);
5291 bgp_info_add (rn
, new);
5292 bgp_unlock_node (rn
);
5294 /* Process change. */
5295 bgp_process (bgp
, rn
, afi
, safi
);
5300 bgp_aggregate_delete (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
5301 safi_t safi
, struct bgp_aggregate
*aggregate
)
5303 struct bgp_table
*table
;
5304 struct bgp_node
*top
;
5305 struct bgp_node
*rn
;
5306 struct bgp_info
*ri
;
5307 unsigned long match
;
5309 table
= bgp
->rib
[afi
][safi
];
5311 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
5313 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
5316 /* If routes exists below this node, generate aggregate routes. */
5317 top
= bgp_node_get (table
, p
);
5318 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
5319 if (rn
->p
.prefixlen
> p
->prefixlen
)
5323 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5325 if (BGP_INFO_HOLDDOWN (ri
))
5328 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
5330 if (aggregate
->summary_only
&& ri
->extra
)
5332 ri
->extra
->suppress
--;
5334 if (ri
->extra
->suppress
== 0)
5336 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
5344 /* If this node was suppressed, process the change. */
5346 bgp_process (bgp
, rn
, afi
, safi
);
5348 bgp_unlock_node (top
);
5350 /* Delete aggregate route from BGP table. */
5351 rn
= bgp_node_get (table
, p
);
5353 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5354 if (ri
->peer
== bgp
->peer_self
5355 && ri
->type
== ZEBRA_ROUTE_BGP
5356 && ri
->sub_type
== BGP_ROUTE_AGGREGATE
)
5359 /* Withdraw static BGP route from routing table. */
5362 bgp_info_delete (rn
, ri
);
5363 bgp_process (bgp
, rn
, afi
, safi
);
5366 /* Unlock bgp_node_lookup. */
5367 bgp_unlock_node (rn
);
5370 /* Aggregate route attribute. */
5371 #define AGGREGATE_SUMMARY_ONLY 1
5372 #define AGGREGATE_AS_SET 1
5375 bgp_aggregate_unset (struct vty
*vty
, const char *prefix_str
,
5376 afi_t afi
, safi_t safi
)
5380 struct bgp_node
*rn
;
5382 struct bgp_aggregate
*aggregate
;
5384 /* Convert string to prefix structure. */
5385 ret
= str2prefix (prefix_str
, &p
);
5388 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
5393 /* Get BGP structure. */
5396 /* Old configuration check. */
5397 rn
= bgp_node_lookup (bgp
->aggregate
[afi
][safi
], &p
);
5400 vty_out (vty
, "%% There is no aggregate-address configuration.%s",
5405 aggregate
= rn
->info
;
5406 if (aggregate
->safi
& SAFI_UNICAST
)
5407 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
5408 if (aggregate
->safi
& SAFI_MULTICAST
)
5409 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
5411 /* Unlock aggregate address configuration. */
5413 bgp_aggregate_free (aggregate
);
5414 bgp_unlock_node (rn
);
5415 bgp_unlock_node (rn
);
5421 bgp_aggregate_set (struct vty
*vty
, const char *prefix_str
,
5422 afi_t afi
, safi_t safi
,
5423 u_char summary_only
, u_char as_set
)
5427 struct bgp_node
*rn
;
5429 struct bgp_aggregate
*aggregate
;
5431 /* Convert string to prefix structure. */
5432 ret
= str2prefix (prefix_str
, &p
);
5435 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
5440 /* Get BGP structure. */
5443 /* Old configuration check. */
5444 rn
= bgp_node_get (bgp
->aggregate
[afi
][safi
], &p
);
5448 vty_out (vty
, "There is already same aggregate network.%s", VTY_NEWLINE
);
5449 /* try to remove the old entry */
5450 ret
= bgp_aggregate_unset (vty
, prefix_str
, afi
, safi
);
5453 vty_out (vty
, "Error deleting aggregate.%s", VTY_NEWLINE
);
5454 bgp_unlock_node (rn
);
5459 /* Make aggregate address structure. */
5460 aggregate
= bgp_aggregate_new ();
5461 aggregate
->summary_only
= summary_only
;
5462 aggregate
->as_set
= as_set
;
5463 aggregate
->safi
= safi
;
5464 rn
->info
= aggregate
;
5466 /* Aggregate address insert into BGP routing table. */
5467 if (safi
& SAFI_UNICAST
)
5468 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
5469 if (safi
& SAFI_MULTICAST
)
5470 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
5475 DEFUN (aggregate_address
,
5476 aggregate_address_cmd
,
5477 "aggregate-address A.B.C.D/M",
5478 "Configure BGP aggregate entries\n"
5479 "Aggregate prefix\n")
5481 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
), 0, 0);
5484 DEFUN (aggregate_address_mask
,
5485 aggregate_address_mask_cmd
,
5486 "aggregate-address A.B.C.D A.B.C.D",
5487 "Configure BGP aggregate entries\n"
5488 "Aggregate address\n"
5492 char prefix_str
[BUFSIZ
];
5494 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5498 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5502 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5506 DEFUN (aggregate_address_summary_only
,
5507 aggregate_address_summary_only_cmd
,
5508 "aggregate-address A.B.C.D/M summary-only",
5509 "Configure BGP aggregate entries\n"
5510 "Aggregate prefix\n"
5511 "Filter more specific routes from updates\n")
5513 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5514 AGGREGATE_SUMMARY_ONLY
, 0);
5517 DEFUN (aggregate_address_mask_summary_only
,
5518 aggregate_address_mask_summary_only_cmd
,
5519 "aggregate-address A.B.C.D A.B.C.D summary-only",
5520 "Configure BGP aggregate entries\n"
5521 "Aggregate address\n"
5523 "Filter more specific routes from updates\n")
5526 char prefix_str
[BUFSIZ
];
5528 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5532 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5536 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5537 AGGREGATE_SUMMARY_ONLY
, 0);
5540 DEFUN (aggregate_address_as_set
,
5541 aggregate_address_as_set_cmd
,
5542 "aggregate-address A.B.C.D/M as-set",
5543 "Configure BGP aggregate entries\n"
5544 "Aggregate prefix\n"
5545 "Generate AS set path information\n")
5547 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5548 0, AGGREGATE_AS_SET
);
5551 DEFUN (aggregate_address_mask_as_set
,
5552 aggregate_address_mask_as_set_cmd
,
5553 "aggregate-address A.B.C.D A.B.C.D as-set",
5554 "Configure BGP aggregate entries\n"
5555 "Aggregate address\n"
5557 "Generate AS set path information\n")
5560 char prefix_str
[BUFSIZ
];
5562 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5566 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5570 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5571 0, AGGREGATE_AS_SET
);
5575 DEFUN (aggregate_address_as_set_summary
,
5576 aggregate_address_as_set_summary_cmd
,
5577 "aggregate-address A.B.C.D/M as-set summary-only",
5578 "Configure BGP aggregate entries\n"
5579 "Aggregate prefix\n"
5580 "Generate AS set path information\n"
5581 "Filter more specific routes from updates\n")
5583 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5584 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
5587 ALIAS (aggregate_address_as_set_summary
,
5588 aggregate_address_summary_as_set_cmd
,
5589 "aggregate-address A.B.C.D/M summary-only as-set",
5590 "Configure BGP aggregate entries\n"
5591 "Aggregate prefix\n"
5592 "Filter more specific routes from updates\n"
5593 "Generate AS set path information\n")
5595 DEFUN (aggregate_address_mask_as_set_summary
,
5596 aggregate_address_mask_as_set_summary_cmd
,
5597 "aggregate-address A.B.C.D A.B.C.D as-set summary-only",
5598 "Configure BGP aggregate entries\n"
5599 "Aggregate address\n"
5601 "Generate AS set path information\n"
5602 "Filter more specific routes from updates\n")
5605 char prefix_str
[BUFSIZ
];
5607 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5611 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5615 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5616 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
5619 ALIAS (aggregate_address_mask_as_set_summary
,
5620 aggregate_address_mask_summary_as_set_cmd
,
5621 "aggregate-address A.B.C.D A.B.C.D summary-only as-set",
5622 "Configure BGP aggregate entries\n"
5623 "Aggregate address\n"
5625 "Filter more specific routes from updates\n"
5626 "Generate AS set path information\n")
5628 DEFUN (no_aggregate_address
,
5629 no_aggregate_address_cmd
,
5630 "no aggregate-address A.B.C.D/M",
5632 "Configure BGP aggregate entries\n"
5633 "Aggregate prefix\n")
5635 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
));
5638 ALIAS (no_aggregate_address
,
5639 no_aggregate_address_summary_only_cmd
,
5640 "no aggregate-address A.B.C.D/M summary-only",
5642 "Configure BGP aggregate entries\n"
5643 "Aggregate prefix\n"
5644 "Filter more specific routes from updates\n")
5646 ALIAS (no_aggregate_address
,
5647 no_aggregate_address_as_set_cmd
,
5648 "no aggregate-address A.B.C.D/M as-set",
5650 "Configure BGP aggregate entries\n"
5651 "Aggregate prefix\n"
5652 "Generate AS set path information\n")
5654 ALIAS (no_aggregate_address
,
5655 no_aggregate_address_as_set_summary_cmd
,
5656 "no aggregate-address A.B.C.D/M as-set summary-only",
5658 "Configure BGP aggregate entries\n"
5659 "Aggregate prefix\n"
5660 "Generate AS set path information\n"
5661 "Filter more specific routes from updates\n")
5663 ALIAS (no_aggregate_address
,
5664 no_aggregate_address_summary_as_set_cmd
,
5665 "no aggregate-address A.B.C.D/M summary-only as-set",
5667 "Configure BGP aggregate entries\n"
5668 "Aggregate prefix\n"
5669 "Filter more specific routes from updates\n"
5670 "Generate AS set path information\n")
5672 DEFUN (no_aggregate_address_mask
,
5673 no_aggregate_address_mask_cmd
,
5674 "no aggregate-address A.B.C.D A.B.C.D",
5676 "Configure BGP aggregate entries\n"
5677 "Aggregate address\n"
5681 char prefix_str
[BUFSIZ
];
5683 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5687 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5691 return bgp_aggregate_unset (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
));
5694 ALIAS (no_aggregate_address_mask
,
5695 no_aggregate_address_mask_summary_only_cmd
,
5696 "no aggregate-address A.B.C.D A.B.C.D summary-only",
5698 "Configure BGP aggregate entries\n"
5699 "Aggregate address\n"
5701 "Filter more specific routes from updates\n")
5703 ALIAS (no_aggregate_address_mask
,
5704 no_aggregate_address_mask_as_set_cmd
,
5705 "no aggregate-address A.B.C.D A.B.C.D as-set",
5707 "Configure BGP aggregate entries\n"
5708 "Aggregate address\n"
5710 "Generate AS set path information\n")
5712 ALIAS (no_aggregate_address_mask
,
5713 no_aggregate_address_mask_as_set_summary_cmd
,
5714 "no aggregate-address A.B.C.D A.B.C.D as-set summary-only",
5716 "Configure BGP aggregate entries\n"
5717 "Aggregate address\n"
5719 "Generate AS set path information\n"
5720 "Filter more specific routes from updates\n")
5722 ALIAS (no_aggregate_address_mask
,
5723 no_aggregate_address_mask_summary_as_set_cmd
,
5724 "no aggregate-address A.B.C.D A.B.C.D summary-only as-set",
5726 "Configure BGP aggregate entries\n"
5727 "Aggregate address\n"
5729 "Filter more specific routes from updates\n"
5730 "Generate AS set path information\n")
5733 DEFUN (ipv6_aggregate_address
,
5734 ipv6_aggregate_address_cmd
,
5735 "aggregate-address X:X::X:X/M",
5736 "Configure BGP aggregate entries\n"
5737 "Aggregate prefix\n")
5739 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0, 0);
5742 DEFUN (ipv6_aggregate_address_summary_only
,
5743 ipv6_aggregate_address_summary_only_cmd
,
5744 "aggregate-address X:X::X:X/M summary-only",
5745 "Configure BGP aggregate entries\n"
5746 "Aggregate prefix\n"
5747 "Filter more specific routes from updates\n")
5749 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5750 AGGREGATE_SUMMARY_ONLY
, 0);
5753 DEFUN (no_ipv6_aggregate_address
,
5754 no_ipv6_aggregate_address_cmd
,
5755 "no aggregate-address X:X::X:X/M",
5757 "Configure BGP aggregate entries\n"
5758 "Aggregate prefix\n")
5760 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
5763 DEFUN (no_ipv6_aggregate_address_summary_only
,
5764 no_ipv6_aggregate_address_summary_only_cmd
,
5765 "no aggregate-address X:X::X:X/M summary-only",
5767 "Configure BGP aggregate entries\n"
5768 "Aggregate prefix\n"
5769 "Filter more specific routes from updates\n")
5771 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
5774 ALIAS (ipv6_aggregate_address
,
5775 old_ipv6_aggregate_address_cmd
,
5776 "ipv6 bgp aggregate-address X:X::X:X/M",
5779 "Configure BGP aggregate entries\n"
5780 "Aggregate prefix\n")
5782 ALIAS (ipv6_aggregate_address_summary_only
,
5783 old_ipv6_aggregate_address_summary_only_cmd
,
5784 "ipv6 bgp aggregate-address X:X::X:X/M summary-only",
5787 "Configure BGP aggregate entries\n"
5788 "Aggregate prefix\n"
5789 "Filter more specific routes from updates\n")
5791 ALIAS (no_ipv6_aggregate_address
,
5792 old_no_ipv6_aggregate_address_cmd
,
5793 "no ipv6 bgp aggregate-address X:X::X:X/M",
5797 "Configure BGP aggregate entries\n"
5798 "Aggregate prefix\n")
5800 ALIAS (no_ipv6_aggregate_address_summary_only
,
5801 old_no_ipv6_aggregate_address_summary_only_cmd
,
5802 "no ipv6 bgp aggregate-address X:X::X:X/M summary-only",
5806 "Configure BGP aggregate entries\n"
5807 "Aggregate prefix\n"
5808 "Filter more specific routes from updates\n")
5809 #endif /* HAVE_IPV6 */
5811 /* Redistribute route treatment. */
5813 bgp_redistribute_add (struct prefix
*p
, const struct in_addr
*nexthop
,
5814 const struct in6_addr
*nexthop6
, unsigned int ifindex
,
5815 u_int32_t metric
, u_char type
, u_short instance
, u_short tag
)
5818 struct listnode
*node
, *nnode
;
5819 struct bgp_info
*new;
5820 struct bgp_info
*bi
;
5821 struct bgp_info info
;
5822 struct bgp_node
*bn
;
5824 struct attr
*new_attr
;
5827 struct bgp_redist
*red
;
5829 /* Make default attribute. */
5830 bgp_attr_default_set (&attr
, BGP_ORIGIN_INCOMPLETE
);
5832 attr
.nexthop
= *nexthop
;
5833 attr
.nh_ifindex
= ifindex
;
5838 struct attr_extra
*extra
= bgp_attr_extra_get(&attr
);
5839 extra
->mp_nexthop_global
= *nexthop6
;
5840 extra
->mp_nexthop_len
= 16;
5845 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
5846 attr
.extra
->tag
= tag
;
5848 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
5850 afi
= family2afi (p
->family
);
5852 red
= bgp_redist_lookup(bgp
, afi
, type
, instance
);
5855 struct attr attr_new
;
5856 struct attr_extra extra_new
;
5858 /* Copy attribute for modification. */
5859 attr_new
.extra
= &extra_new
;
5860 bgp_attr_dup (&attr_new
, &attr
);
5862 if (red
->redist_metric_flag
)
5863 attr_new
.med
= red
->redist_metric
;
5865 /* Apply route-map. */
5868 info
.peer
= bgp
->peer_self
;
5869 info
.attr
= &attr_new
;
5871 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_REDISTRIBUTE
);
5873 ret
= route_map_apply (red
->rmap
.map
, p
, RMAP_BGP
, &info
);
5875 bgp
->peer_self
->rmap_type
= 0;
5877 if (ret
== RMAP_DENYMATCH
)
5879 /* Free uninterned attribute. */
5880 bgp_attr_flush (&attr_new
);
5882 /* Unintern original. */
5883 aspath_unintern (&attr
.aspath
);
5884 bgp_attr_extra_free (&attr
);
5885 bgp_redistribute_delete (p
, type
, instance
);
5890 bn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
],
5891 afi
, SAFI_UNICAST
, p
, NULL
);
5893 new_attr
= bgp_attr_intern (&attr_new
);
5895 for (bi
= bn
->info
; bi
; bi
= bi
->next
)
5896 if (bi
->peer
== bgp
->peer_self
5897 && bi
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
5902 if (attrhash_cmp (bi
->attr
, new_attr
) &&
5903 !CHECK_FLAG(bi
->flags
, BGP_INFO_REMOVED
))
5905 bgp_attr_unintern (&new_attr
);
5906 aspath_unintern (&attr
.aspath
);
5907 bgp_attr_extra_free (&attr
);
5908 bgp_unlock_node (bn
);
5913 /* The attribute is changed. */
5914 bgp_info_set_flag (bn
, bi
, BGP_INFO_ATTR_CHANGED
);
5916 /* Rewrite BGP route information. */
5917 if (CHECK_FLAG(bi
->flags
, BGP_INFO_REMOVED
))
5918 bgp_info_restore(bn
, bi
);
5920 bgp_aggregate_decrement (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
5921 bgp_attr_unintern (&bi
->attr
);
5922 bi
->attr
= new_attr
;
5923 bi
->uptime
= bgp_clock ();
5925 /* Process change. */
5926 bgp_aggregate_increment (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
5927 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
5928 bgp_unlock_node (bn
);
5929 aspath_unintern (&attr
.aspath
);
5930 bgp_attr_extra_free (&attr
);
5935 new = info_make(type
, BGP_ROUTE_REDISTRIBUTE
, instance
, bgp
->peer_self
,
5937 SET_FLAG (new->flags
, BGP_INFO_VALID
);
5939 bgp_aggregate_increment (bgp
, p
, new, afi
, SAFI_UNICAST
);
5940 bgp_info_add (bn
, new);
5941 bgp_unlock_node (bn
);
5942 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
5946 /* Unintern original. */
5947 aspath_unintern (&attr
.aspath
);
5948 bgp_attr_extra_free (&attr
);
5952 bgp_redistribute_delete (struct prefix
*p
, u_char type
, u_short instance
)
5955 struct listnode
*node
, *nnode
;
5957 struct bgp_node
*rn
;
5958 struct bgp_info
*ri
;
5959 struct bgp_redist
*red
;
5961 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
5963 afi
= family2afi (p
->family
);
5965 red
= bgp_redist_lookup(bgp
, afi
, type
, instance
);
5968 rn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
], afi
, SAFI_UNICAST
, p
, NULL
);
5970 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5971 if (ri
->peer
== bgp
->peer_self
5972 && ri
->type
== type
)
5977 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, SAFI_UNICAST
);
5978 bgp_info_delete (rn
, ri
);
5979 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
5981 bgp_unlock_node (rn
);
5986 /* Withdraw specified route type's route. */
5988 bgp_redistribute_withdraw (struct bgp
*bgp
, afi_t afi
, int type
, u_short instance
)
5990 struct bgp_node
*rn
;
5991 struct bgp_info
*ri
;
5992 struct bgp_table
*table
;
5994 table
= bgp
->rib
[afi
][SAFI_UNICAST
];
5996 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
5998 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5999 if (ri
->peer
== bgp
->peer_self
6001 && ri
->instance
== instance
)
6006 bgp_aggregate_decrement (bgp
, &rn
->p
, ri
, afi
, SAFI_UNICAST
);
6007 bgp_info_delete (rn
, ri
);
6008 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
6013 /* Static function to display route. */
6015 route_vty_out_route (struct prefix
*p
, struct vty
*vty
)
6018 u_int32_t destination
;
6021 if (p
->family
== AF_INET
)
6023 len
= vty_out (vty
, "%s", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
));
6024 destination
= ntohl (p
->u
.prefix4
.s_addr
);
6026 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
6027 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
6028 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
6029 || p
->u
.prefix4
.s_addr
== 0)
6031 /* When mask is natural, mask is not displayed. */
6034 len
+= vty_out (vty
, "/%d", p
->prefixlen
);
6037 len
= vty_out (vty
, "%s/%d", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
),
6042 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 20, " ");
6044 vty_out (vty
, "%*s", len
, " ");
6047 enum bgp_display_type
6052 /* Print the short form route status for a bgp_info */
6054 route_vty_short_status_out (struct vty
*vty
, struct bgp_info
*binfo
)
6056 /* Route status display. */
6057 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
6059 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
6061 else if (binfo
->extra
&& binfo
->extra
->suppress
)
6063 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_VALID
) &&
6064 ! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6070 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6072 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
6074 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
6076 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_MULTIPATH
))
6081 /* Internal route. */
6082 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
6088 /* called from terminal list command */
6090 route_vty_out (struct vty
*vty
, struct prefix
*p
,
6091 struct bgp_info
*binfo
, int display
, safi_t safi
, char *delim
)
6095 /* short status lead text */
6096 route_vty_short_status_out (vty
, binfo
);
6099 vty_out (vty
, "%c", *delim
);
6101 /* print prefix and mask */
6103 route_vty_out_route (p
, vty
);
6105 vty_out (vty
, "%*s", 17, " ");
6108 vty_out (vty
, "%c", *delim
);
6110 /* Print attribute */
6114 if (p
->family
== AF_INET
)
6116 if (safi
== SAFI_MPLS_VPN
)
6117 vty_out (vty
, "%-16s",
6118 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
6120 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
6123 else if (p
->family
== AF_INET6
)
6128 len
= vty_out (vty
, "%s",
6129 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
6133 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
6135 vty_out (vty
, "%*s", len
, " ");
6137 #endif /* HAVE_IPV6 */
6140 vty_out (vty
, "%c", *delim
);
6142 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
6143 vty_out (vty
, "%10u", attr
->med
);
6148 vty_out (vty
, "%c", *delim
);
6150 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
6151 vty_out (vty
, "%7u", attr
->local_pref
);
6156 vty_out (vty
, "%c", *delim
);
6158 vty_out (vty
, "%7u ", (attr
->extra
? attr
->extra
->weight
: 0));
6161 vty_out (vty
, "%c", *delim
);
6165 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
6168 vty_out (vty
, "%c", *delim
);
6171 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
6173 vty_out (vty
, "%s", VTY_NEWLINE
);
6176 /* called from terminal list command */
6178 route_vty_out_tmp (struct vty
*vty
, struct prefix
*p
,
6179 struct attr
*attr
, safi_t safi
, char *delim
)
6181 /* Route status display. */
6187 vty_out (vty
, "%c", *delim
);
6189 /* print prefix and mask */
6190 route_vty_out_route (p
, vty
);
6193 vty_out (vty
, "%c", *delim
);
6195 /* Print attribute */
6198 if (p
->family
== AF_INET
)
6200 if (safi
== SAFI_MPLS_VPN
)
6201 vty_out (vty
, "%-16s",
6202 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
6204 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
6207 else if (p
->family
== AF_INET6
)
6212 assert (attr
->extra
);
6214 len
= vty_out (vty
, "%s",
6215 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
6219 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
6221 vty_out (vty
, "%*s", len
, " ");
6223 #endif /* HAVE_IPV6 */
6226 vty_out (vty
, "%c", *delim
);
6228 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
6229 vty_out (vty
, "%10u", attr
->med
);
6234 vty_out (vty
, "%c", *delim
);
6236 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
6237 vty_out (vty
, "%7u", attr
->local_pref
);
6242 vty_out (vty
, "%c", *delim
);
6244 vty_out (vty
, "%7u ", (attr
->extra
? attr
->extra
->weight
: 0));
6247 vty_out (vty
, "%c", *delim
);
6251 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
6254 vty_out (vty
, "%c", *delim
);
6257 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
6260 vty_out (vty
, "%s", VTY_NEWLINE
);
6264 route_vty_out_tag (struct vty
*vty
, struct prefix
*p
,
6265 struct bgp_info
*binfo
, int display
, safi_t safi
)
6268 u_int32_t label
= 0;
6273 /* short status lead text */
6274 route_vty_short_status_out (vty
, binfo
);
6276 /* print prefix and mask */
6278 route_vty_out_route (p
, vty
);
6280 vty_out (vty
, "%*s", 17, " ");
6282 /* Print attribute */
6286 if (p
->family
== AF_INET
)
6288 if (safi
== SAFI_MPLS_VPN
)
6289 vty_out (vty
, "%-16s",
6290 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
6292 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
6295 else if (p
->family
== AF_INET6
)
6297 assert (attr
->extra
);
6300 if (attr
->extra
->mp_nexthop_len
== 16)
6302 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
6304 else if (attr
->extra
->mp_nexthop_len
== 32)
6305 vty_out (vty
, "%s(%s)",
6306 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
6308 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_local
,
6312 #endif /* HAVE_IPV6 */
6315 label
= decode_label (binfo
->extra
->tag
);
6317 vty_out (vty
, "notag/%d", label
);
6319 vty_out (vty
, "%s", VTY_NEWLINE
);
6322 /* dampening route */
6324 damp_route_vty_out (struct vty
*vty
, struct prefix
*p
,
6325 struct bgp_info
*binfo
, int display
, safi_t safi
)
6329 char timebuf
[BGP_UPTIME_LEN
];
6331 /* short status lead text */
6332 route_vty_short_status_out (vty
, binfo
);
6334 /* print prefix and mask */
6336 route_vty_out_route (p
, vty
);
6338 vty_out (vty
, "%*s", 17, " ");
6340 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
6343 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 34, " ");
6345 vty_out (vty
, "%*s", len
, " ");
6347 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
, timebuf
, BGP_UPTIME_LEN
));
6349 /* Print attribute */
6355 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
6358 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
6360 vty_out (vty
, "%s", VTY_NEWLINE
);
6365 flap_route_vty_out (struct vty
*vty
, struct prefix
*p
,
6366 struct bgp_info
*binfo
, int display
, safi_t safi
)
6369 struct bgp_damp_info
*bdi
;
6370 char timebuf
[BGP_UPTIME_LEN
];
6376 bdi
= binfo
->extra
->damp_info
;
6378 /* short status lead text */
6379 route_vty_short_status_out (vty
, binfo
);
6381 /* print prefix and mask */
6383 route_vty_out_route (p
, vty
);
6385 vty_out (vty
, "%*s", 17, " ");
6387 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
6390 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 33, " ");
6392 vty_out (vty
, "%*s", len
, " ");
6394 len
= vty_out (vty
, "%d", bdi
->flap
);
6399 vty_out (vty
, "%*s ", len
, " ");
6401 vty_out (vty
, "%s ", peer_uptime (bdi
->start_time
,
6402 timebuf
, BGP_UPTIME_LEN
));
6404 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
)
6405 && ! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6406 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
, timebuf
, BGP_UPTIME_LEN
));
6408 vty_out (vty
, "%*s ", 8, " ");
6410 /* Print attribute */
6416 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
6419 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
6421 vty_out (vty
, "%s", VTY_NEWLINE
);
6425 route_vty_out_detail (struct vty
*vty
, struct bgp
*bgp
, struct prefix
*p
,
6426 struct bgp_info
*binfo
, afi_t afi
, safi_t safi
)
6428 char buf
[INET6_ADDRSTRLEN
];
6431 int sockunion_vty_out (struct vty
*, union sockunion
*);
6432 #ifdef HAVE_CLOCK_MONOTONIC
6440 /* Line1 display AS-path, Aggregator */
6444 if (aspath_count_hops (attr
->aspath
) == 0)
6445 vty_out (vty
, "Local");
6447 aspath_print_vty (vty
, "%s", attr
->aspath
, "");
6450 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
6451 vty_out (vty
, ", (removed)");
6452 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
6453 vty_out (vty
, ", (stale)");
6454 if (CHECK_FLAG (attr
->flag
, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR
)))
6455 vty_out (vty
, ", (aggregated by %u %s)",
6456 attr
->extra
->aggregator_as
,
6457 inet_ntoa (attr
->extra
->aggregator_addr
));
6458 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
6459 vty_out (vty
, ", (Received from a RR-client)");
6460 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
6461 vty_out (vty
, ", (Received from a RS-client)");
6462 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6463 vty_out (vty
, ", (history entry)");
6464 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
6465 vty_out (vty
, ", (suppressed due to dampening)");
6466 vty_out (vty
, "%s", VTY_NEWLINE
);
6468 /* Line2 display Next-hop, Neighbor, Router-id */
6469 if (p
->family
== AF_INET
)
6471 vty_out (vty
, " %s", safi
== SAFI_MPLS_VPN
?
6472 inet_ntoa (attr
->extra
->mp_nexthop_global_in
) :
6473 inet_ntoa (attr
->nexthop
));
6478 assert (attr
->extra
);
6479 vty_out (vty
, " %s",
6480 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
6481 buf
, INET6_ADDRSTRLEN
));
6483 #endif /* HAVE_IPV6 */
6485 if (binfo
->peer
== bgp
->peer_self
)
6487 vty_out (vty
, " from %s ",
6488 p
->family
== AF_INET
? "0.0.0.0" : "::");
6489 vty_out (vty
, "(%s)", inet_ntoa(bgp
->router_id
));
6493 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_VALID
))
6494 vty_out (vty
, " (inaccessible)");
6495 else if (binfo
->extra
&& binfo
->extra
->igpmetric
)
6496 vty_out (vty
, " (metric %u)", binfo
->extra
->igpmetric
);
6497 vty_out (vty
, " from %s", sockunion2str (&binfo
->peer
->su
, buf
, SU_ADDRSTRLEN
));
6498 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
6499 vty_out (vty
, " (%s)", inet_ntoa (attr
->extra
->originator_id
));
6501 vty_out (vty
, " (%s)", inet_ntop (AF_INET
, &binfo
->peer
->remote_id
, buf1
, BUFSIZ
));
6503 vty_out (vty
, "%s", VTY_NEWLINE
);
6506 /* display nexthop local */
6507 if (attr
->extra
&& attr
->extra
->mp_nexthop_len
== 32)
6509 vty_out (vty
, " (%s)%s",
6510 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_local
,
6511 buf
, INET6_ADDRSTRLEN
),
6514 #endif /* HAVE_IPV6 */
6516 /* Line 3 display Origin, Med, Locpref, Weight, Tag, valid, Int/Ext/Local, Atomic, best */
6517 vty_out (vty
, " Origin %s", bgp_origin_long_str
[attr
->origin
]);
6519 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
))
6520 vty_out (vty
, ", metric %u", attr
->med
);
6522 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
))
6523 vty_out (vty
, ", localpref %u", attr
->local_pref
);
6525 vty_out (vty
, ", localpref %u", bgp
->default_local_pref
);
6527 if (attr
->extra
&& attr
->extra
->weight
!= 0)
6528 vty_out (vty
, ", weight %u", attr
->extra
->weight
);
6530 if (attr
->extra
&& attr
->extra
->tag
!= 0)
6531 vty_out (vty
, ", tag %d", attr
->extra
->tag
);
6533 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_VALID
))
6534 vty_out (vty
, ", invalid");
6535 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6536 vty_out (vty
, ", valid");
6538 if (binfo
->peer
!= bgp
->peer_self
)
6540 if (binfo
->peer
->as
== binfo
->peer
->local_as
)
6541 vty_out (vty
, ", internal");
6543 vty_out (vty
, ", %s",
6544 (bgp_confederation_peers_check(bgp
, binfo
->peer
->as
) ? "confed-external" : "external"));
6546 else if (binfo
->sub_type
== BGP_ROUTE_AGGREGATE
)
6547 vty_out (vty
, ", aggregated, local");
6548 else if (binfo
->type
!= ZEBRA_ROUTE_BGP
)
6549 vty_out (vty
, ", sourced");
6551 vty_out (vty
, ", sourced, local");
6553 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
6554 vty_out (vty
, ", atomic-aggregate");
6556 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_MULTIPATH
) ||
6557 (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
) &&
6558 bgp_info_mpath_count (binfo
)))
6559 vty_out (vty
, ", multipath");
6561 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
6562 vty_out (vty
, ", best");
6564 vty_out (vty
, "%s", VTY_NEWLINE
);
6566 /* Line 4 display Community */
6567 if (attr
->community
)
6568 vty_out (vty
, " Community: %s%s", attr
->community
->str
,
6571 /* Line 5 display Extended-community */
6572 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
))
6573 vty_out (vty
, " Extended Community: %s%s",
6574 attr
->extra
->ecommunity
->str
, VTY_NEWLINE
);
6576 /* Line 6 display Originator, Cluster-id */
6577 if ((attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)) ||
6578 (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
)))
6580 assert (attr
->extra
);
6581 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
6582 vty_out (vty
, " Originator: %s",
6583 inet_ntoa (attr
->extra
->originator_id
));
6585 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
6588 vty_out (vty
, ", Cluster list: ");
6589 for (i
= 0; i
< attr
->extra
->cluster
->length
/ 4; i
++)
6590 vty_out (vty
, "%s ",
6591 inet_ntoa (attr
->extra
->cluster
->list
[i
]));
6593 vty_out (vty
, "%s", VTY_NEWLINE
);
6596 if (binfo
->extra
&& binfo
->extra
->damp_info
)
6597 bgp_damp_info_vty (vty
, binfo
);
6599 /* Line 7 display Addpath IDs */
6600 if (binfo
->addpath_rx_id
|| binfo
->addpath_tx_id
)
6601 vty_out (vty
, " AddPath ID: RX %u, TX %u%s",
6602 binfo
->addpath_rx_id
, binfo
->addpath_tx_id
,
6605 /* Line 8 display Uptime */
6606 #ifdef HAVE_CLOCK_MONOTONIC
6607 tbuf
= time(NULL
) - (bgp_clock() - binfo
->uptime
);
6608 vty_out (vty
, " Last update: %s", ctime(&tbuf
));
6610 vty_out (vty
, " Last update: %s", ctime(&binfo
->uptime
));
6611 #endif /* HAVE_CLOCK_MONOTONIC */
6613 vty_out (vty
, "%s", VTY_NEWLINE
);
6616 #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, "\
6617 "h history, * valid, > best, = multipath,%s"\
6618 " i internal, r RIB-failure, S Stale, R Removed%s"
6619 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s"
6620 #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s"
6621 #define BGP_SHOW_HEADER_CSV "Flags, Network, Next Hop, Metric, LocPrf, Weight, Path%s"
6622 #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s"
6623 #define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path%s"
6627 bgp_show_type_normal
,
6628 bgp_show_type_regexp
,
6629 bgp_show_type_prefix_list
,
6630 bgp_show_type_filter_list
,
6631 bgp_show_type_route_map
,
6632 bgp_show_type_neighbor
,
6633 bgp_show_type_cidr_only
,
6634 bgp_show_type_prefix_longer
,
6635 bgp_show_type_community_all
,
6636 bgp_show_type_community
,
6637 bgp_show_type_community_exact
,
6638 bgp_show_type_community_list
,
6639 bgp_show_type_community_list_exact
,
6640 bgp_show_type_flap_statistics
,
6641 bgp_show_type_flap_address
,
6642 bgp_show_type_flap_prefix
,
6643 bgp_show_type_flap_cidr_only
,
6644 bgp_show_type_flap_regexp
,
6645 bgp_show_type_flap_filter_list
,
6646 bgp_show_type_flap_prefix_list
,
6647 bgp_show_type_flap_prefix_longer
,
6648 bgp_show_type_flap_route_map
,
6649 bgp_show_type_flap_neighbor
,
6650 bgp_show_type_dampend_paths
,
6651 bgp_show_type_damp_neighbor
6655 bgp_show_table (struct vty
*vty
, struct bgp_table
*table
, struct in_addr
*router_id
,
6656 enum bgp_show_type type
, void *output_arg
, char *delim
)
6658 struct bgp_info
*ri
;
6659 struct bgp_node
*rn
;
6662 unsigned long output_count
;
6664 /* This is first entry point, so reset total line. */
6667 /* Start processing of routes. */
6668 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
6669 if (rn
->info
!= NULL
)
6673 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6675 if (type
== bgp_show_type_flap_statistics
6676 || type
== bgp_show_type_flap_address
6677 || type
== bgp_show_type_flap_prefix
6678 || type
== bgp_show_type_flap_cidr_only
6679 || type
== bgp_show_type_flap_regexp
6680 || type
== bgp_show_type_flap_filter_list
6681 || type
== bgp_show_type_flap_prefix_list
6682 || type
== bgp_show_type_flap_prefix_longer
6683 || type
== bgp_show_type_flap_route_map
6684 || type
== bgp_show_type_flap_neighbor
6685 || type
== bgp_show_type_dampend_paths
6686 || type
== bgp_show_type_damp_neighbor
)
6688 if (!(ri
->extra
&& ri
->extra
->damp_info
))
6691 if (type
== bgp_show_type_regexp
6692 || type
== bgp_show_type_flap_regexp
)
6694 regex_t
*regex
= output_arg
;
6696 if (bgp_regexec (regex
, ri
->attr
->aspath
) == REG_NOMATCH
)
6699 if (type
== bgp_show_type_prefix_list
6700 || type
== bgp_show_type_flap_prefix_list
)
6702 struct prefix_list
*plist
= output_arg
;
6704 if (prefix_list_apply (plist
, &rn
->p
) != PREFIX_PERMIT
)
6707 if (type
== bgp_show_type_filter_list
6708 || type
== bgp_show_type_flap_filter_list
)
6710 struct as_list
*as_list
= output_arg
;
6712 if (as_list_apply (as_list
, ri
->attr
->aspath
) != AS_FILTER_PERMIT
)
6715 if (type
== bgp_show_type_route_map
6716 || type
== bgp_show_type_flap_route_map
)
6718 struct route_map
*rmap
= output_arg
;
6719 struct bgp_info binfo
;
6720 struct attr dummy_attr
;
6721 struct attr_extra dummy_extra
;
6724 dummy_attr
.extra
= &dummy_extra
;
6725 bgp_attr_dup (&dummy_attr
, ri
->attr
);
6727 binfo
.peer
= ri
->peer
;
6728 binfo
.attr
= &dummy_attr
;
6730 ret
= route_map_apply (rmap
, &rn
->p
, RMAP_BGP
, &binfo
);
6731 if (ret
== RMAP_DENYMATCH
)
6734 if (type
== bgp_show_type_neighbor
6735 || type
== bgp_show_type_flap_neighbor
6736 || type
== bgp_show_type_damp_neighbor
)
6738 union sockunion
*su
= output_arg
;
6740 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
6743 if (type
== bgp_show_type_cidr_only
6744 || type
== bgp_show_type_flap_cidr_only
)
6746 u_int32_t destination
;
6748 destination
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
6749 if (IN_CLASSC (destination
) && rn
->p
.prefixlen
== 24)
6751 if (IN_CLASSB (destination
) && rn
->p
.prefixlen
== 16)
6753 if (IN_CLASSA (destination
) && rn
->p
.prefixlen
== 8)
6756 if (type
== bgp_show_type_prefix_longer
6757 || type
== bgp_show_type_flap_prefix_longer
)
6759 struct prefix
*p
= output_arg
;
6761 if (! prefix_match (p
, &rn
->p
))
6764 if (type
== bgp_show_type_community_all
)
6766 if (! ri
->attr
->community
)
6769 if (type
== bgp_show_type_community
)
6771 struct community
*com
= output_arg
;
6773 if (! ri
->attr
->community
||
6774 ! community_match (ri
->attr
->community
, com
))
6777 if (type
== bgp_show_type_community_exact
)
6779 struct community
*com
= output_arg
;
6781 if (! ri
->attr
->community
||
6782 ! community_cmp (ri
->attr
->community
, com
))
6785 if (type
== bgp_show_type_community_list
)
6787 struct community_list
*list
= output_arg
;
6789 if (! community_list_match (ri
->attr
->community
, list
))
6792 if (type
== bgp_show_type_community_list_exact
)
6794 struct community_list
*list
= output_arg
;
6796 if (! community_list_exact_match (ri
->attr
->community
, list
))
6799 if (type
== bgp_show_type_flap_address
6800 || type
== bgp_show_type_flap_prefix
)
6802 struct prefix
*p
= output_arg
;
6804 if (! prefix_match (&rn
->p
, p
))
6807 if (type
== bgp_show_type_flap_prefix
)
6808 if (p
->prefixlen
!= rn
->p
.prefixlen
)
6811 if (type
== bgp_show_type_dampend_paths
6812 || type
== bgp_show_type_damp_neighbor
)
6814 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
6815 || CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
6823 vty_out (vty
, BGP_SHOW_HEADER_CSV
, VTY_NEWLINE
);
6829 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id
), VTY_NEWLINE
);
6830 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
6831 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
6832 if (type
== bgp_show_type_dampend_paths
6833 || type
== bgp_show_type_damp_neighbor
)
6834 vty_out (vty
, BGP_SHOW_DAMP_HEADER
, VTY_NEWLINE
);
6835 else if (type
== bgp_show_type_flap_statistics
6836 || type
== bgp_show_type_flap_address
6837 || type
== bgp_show_type_flap_prefix
6838 || type
== bgp_show_type_flap_cidr_only
6839 || type
== bgp_show_type_flap_regexp
6840 || type
== bgp_show_type_flap_filter_list
6841 || type
== bgp_show_type_flap_prefix_list
6842 || type
== bgp_show_type_flap_prefix_longer
6843 || type
== bgp_show_type_flap_route_map
6844 || type
== bgp_show_type_flap_neighbor
)
6845 vty_out (vty
, BGP_SHOW_FLAP_HEADER
, VTY_NEWLINE
);
6847 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
6851 if (type
== bgp_show_type_dampend_paths
6852 || type
== bgp_show_type_damp_neighbor
)
6853 damp_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6854 else if (type
== bgp_show_type_flap_statistics
6855 || type
== bgp_show_type_flap_address
6856 || type
== bgp_show_type_flap_prefix
6857 || type
== bgp_show_type_flap_cidr_only
6858 || type
== bgp_show_type_flap_regexp
6859 || type
== bgp_show_type_flap_filter_list
6860 || type
== bgp_show_type_flap_prefix_list
6861 || type
== bgp_show_type_flap_prefix_longer
6862 || type
== bgp_show_type_flap_route_map
6863 || type
== bgp_show_type_flap_neighbor
)
6864 flap_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6866 route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
, delim
);
6873 /* No route is displayed */
6874 if (output_count
== 0)
6876 if (type
== bgp_show_type_normal
)
6877 vty_out (vty
, "No BGP network exists%s", VTY_NEWLINE
);
6880 vty_out (vty
, "%sTotal number of prefixes %ld%s",
6881 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
6887 bgp_show (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
6888 enum bgp_show_type type
, void *output_arg
, char *delim
)
6890 struct bgp_table
*table
;
6893 bgp
= bgp_get_default ();
6898 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
6903 table
= bgp
->rib
[afi
][safi
];
6905 return bgp_show_table (vty
, table
, &bgp
->router_id
, type
, output_arg
, delim
);
6908 /* Header of detailed BGP route information */
6910 route_vty_out_detail_header (struct vty
*vty
, struct bgp
*bgp
,
6911 struct bgp_node
*rn
,
6912 struct prefix_rd
*prd
, afi_t afi
, safi_t safi
)
6914 struct bgp_info
*ri
;
6917 struct listnode
*node
, *nnode
;
6918 char buf1
[INET6_ADDRSTRLEN
];
6919 char buf2
[INET6_ADDRSTRLEN
];
6924 int no_advertise
= 0;
6929 vty_out (vty
, "BGP routing table entry for %s%s%s/%d%s",
6930 (safi
== SAFI_MPLS_VPN
?
6931 prefix_rd2str (prd
, buf1
, RD_ADDRSTRLEN
) : ""),
6932 safi
== SAFI_MPLS_VPN
? ":" : "",
6933 inet_ntop (p
->family
, &p
->u
.prefix
, buf2
, INET6_ADDRSTRLEN
),
6934 p
->prefixlen
, VTY_NEWLINE
);
6936 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6939 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
6942 if (ri
->extra
&& ri
->extra
->suppress
)
6944 if (ri
->attr
->community
!= NULL
)
6946 if (community_include (ri
->attr
->community
, COMMUNITY_NO_ADVERTISE
))
6948 if (community_include (ri
->attr
->community
, COMMUNITY_NO_EXPORT
))
6950 if (community_include (ri
->attr
->community
, COMMUNITY_LOCAL_AS
))
6956 vty_out (vty
, "Paths: (%d available", count
);
6959 vty_out (vty
, ", best #%d", best
);
6960 if (safi
== SAFI_UNICAST
)
6961 vty_out (vty
, ", table Default-IP-Routing-Table");
6964 vty_out (vty
, ", no best path");
6966 vty_out (vty
, ", not advertised to any peer");
6968 vty_out (vty
, ", not advertised to EBGP peer");
6970 vty_out (vty
, ", not advertised outside local AS");
6972 vty_out (vty
, ", Advertisements suppressed by an aggregate.");
6973 vty_out (vty
, ")%s", VTY_NEWLINE
);
6975 /* advertised peer */
6976 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6978 if (bgp_adj_out_lookup (peer
, p
, afi
, safi
, rn
))
6981 vty_out (vty
, " Advertised to non peer-group peers:%s ", VTY_NEWLINE
);
6982 vty_out (vty
, " %s", sockunion2str (&peer
->su
, buf1
, SU_ADDRSTRLEN
));
6987 vty_out (vty
, " Not advertised to any peer");
6988 vty_out (vty
, "%s", VTY_NEWLINE
);
6991 /* Display specified route of BGP table. */
6993 bgp_show_route_in_table (struct vty
*vty
, struct bgp
*bgp
,
6994 struct bgp_table
*rib
, const char *ip_str
,
6995 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
6996 int prefix_check
, enum bgp_path_type pathtype
)
7001 struct prefix match
;
7002 struct bgp_node
*rn
;
7003 struct bgp_node
*rm
;
7004 struct bgp_info
*ri
;
7005 struct bgp_table
*table
;
7007 /* Check IP address argument. */
7008 ret
= str2prefix (ip_str
, &match
);
7011 vty_out (vty
, "address is malformed%s", VTY_NEWLINE
);
7015 match
.family
= afi2family (afi
);
7017 if (safi
== SAFI_MPLS_VPN
)
7019 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
7021 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
7024 if ((table
= rn
->info
) != NULL
)
7028 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
7030 if (prefix_check
&& rm
->p
.prefixlen
!= match
.prefixlen
)
7032 bgp_unlock_node (rm
);
7036 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
7040 route_vty_out_detail_header (vty
, bgp
, rm
, (struct prefix_rd
*)&rn
->p
,
7041 AFI_IP
, SAFI_MPLS_VPN
);
7047 if (pathtype
== BGP_PATH_ALL
||
7048 (pathtype
== BGP_PATH_BESTPATH
&& CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)) ||
7049 (pathtype
== BGP_PATH_MULTIPATH
&&
7050 (CHECK_FLAG (ri
->flags
, BGP_INFO_MULTIPATH
) || CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))))
7051 route_vty_out_detail (vty
, bgp
, &rm
->p
, ri
, AFI_IP
, SAFI_MPLS_VPN
);
7054 bgp_unlock_node (rm
);
7063 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
7065 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
7067 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
7071 route_vty_out_detail_header (vty
, bgp
, rn
, NULL
, afi
, safi
);
7076 if (pathtype
== BGP_PATH_ALL
||
7077 (pathtype
== BGP_PATH_BESTPATH
&& CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)) ||
7078 (pathtype
== BGP_PATH_MULTIPATH
&&
7079 (CHECK_FLAG (ri
->flags
, BGP_INFO_MULTIPATH
) || CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))))
7080 route_vty_out_detail (vty
, bgp
, &rn
->p
, ri
, afi
, safi
);
7084 bgp_unlock_node (rn
);
7090 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
7097 /* Display specified route of Main RIB */
7099 bgp_show_route (struct vty
*vty
, const char *view_name
, const char *ip_str
,
7100 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
7101 int prefix_check
, enum bgp_path_type pathtype
)
7105 /* BGP structure lookup. */
7108 bgp
= bgp_lookup_by_name (view_name
);
7111 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
7117 bgp
= bgp_get_default ();
7120 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
7125 return bgp_show_route_in_table (vty
, bgp
, bgp
->rib
[afi
][safi
], ip_str
,
7126 afi
, safi
, prd
, prefix_check
, pathtype
);
7129 /* BGP route print out function. */
7137 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, NULL
);
7140 DEFUN (show_ip_bgp_csv
,
7141 show_ip_bgp_csv_cmd
,
7147 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, &csv
);
7150 DEFUN (show_ip_bgp_ipv4
,
7151 show_ip_bgp_ipv4_cmd
,
7152 "show ip bgp ipv4 (unicast|multicast)",
7157 "Address Family modifier\n"
7158 "Address Family modifier\n")
7160 if (strncmp (argv
[0], "m", 1) == 0)
7161 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, bgp_show_type_normal
,
7164 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, NULL
);
7167 ALIAS (show_ip_bgp_ipv4
,
7168 show_bgp_ipv4_safi_cmd
,
7169 "show bgp ipv4 (unicast|multicast)",
7173 "Address Family modifier\n"
7174 "Address Family modifier\n")
7176 DEFUN (show_ip_bgp_ipv4_csv
,
7177 show_bgp_ipv4_safi_csv_cmd
,
7178 "show bgp ipv4 (unicast|multicast) csv",
7182 "Address Family modifier\n"
7183 "Address Family modifier\n")
7185 if (strncmp (argv
[0], "m", 1) == 0)
7186 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, bgp_show_type_normal
,
7189 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, &csv
);
7192 DEFUN (show_ip_bgp_route
,
7193 show_ip_bgp_route_cmd
,
7194 "show ip bgp A.B.C.D",
7198 "Network in the BGP routing table to display\n")
7200 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7203 DEFUN (show_ip_bgp_route_pathtype
,
7204 show_ip_bgp_route_pathtype_cmd
,
7205 "show ip bgp A.B.C.D (bestpath|multipath)",
7209 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7210 "Display only the bestpath\n"
7211 "Display only multipaths\n")
7213 if (strncmp (argv
[1], "b", 1) == 0)
7214 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_BESTPATH
);
7216 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_MULTIPATH
);
7219 DEFUN (show_bgp_ipv4_safi_route_pathtype
,
7220 show_bgp_ipv4_safi_route_pathtype_cmd
,
7221 "show bgp ipv4 (unicast|multicast) A.B.C.D (bestpath|multipath)",
7225 "Address Family modifier\n"
7226 "Address Family modifier\n"
7227 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7228 "Display only the bestpath\n"
7229 "Display only multipaths\n")
7231 if (strncmp (argv
[0], "m", 1) == 0)
7232 if (strncmp (argv
[2], "b", 1) == 0)
7233 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_BESTPATH
);
7235 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_MULTIPATH
);
7237 if (strncmp (argv
[2], "b", 1) == 0)
7238 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_BESTPATH
);
7240 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_MULTIPATH
);
7243 DEFUN (show_ip_bgp_ipv4_route
,
7244 show_ip_bgp_ipv4_route_cmd
,
7245 "show ip bgp ipv4 (unicast|multicast) A.B.C.D",
7250 "Address Family modifier\n"
7251 "Address Family modifier\n"
7252 "Network in the BGP routing table to display\n")
7254 if (strncmp (argv
[0], "m", 1) == 0)
7255 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_ALL
);
7257 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7260 ALIAS (show_ip_bgp_ipv4_route
,
7261 show_bgp_ipv4_safi_route_cmd
,
7262 "show bgp ipv4 (unicast|multicast) A.B.C.D",
7266 "Address Family modifier\n"
7267 "Address Family modifier\n"
7268 "Network in the BGP routing table to display\n")
7270 DEFUN (show_ip_bgp_vpnv4_all_route
,
7271 show_ip_bgp_vpnv4_all_route_cmd
,
7272 "show ip bgp vpnv4 all A.B.C.D",
7276 "Display VPNv4 NLRI specific information\n"
7277 "Display information about all VPNv4 NLRIs\n"
7278 "Network in the BGP routing table to display\n")
7280 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 0, BGP_PATH_ALL
);
7284 DEFUN (show_ip_bgp_vpnv4_rd_route
,
7285 show_ip_bgp_vpnv4_rd_route_cmd
,
7286 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D",
7290 "Display VPNv4 NLRI specific information\n"
7291 "Display information for a route distinguisher\n"
7292 "VPN Route Distinguisher\n"
7293 "Network in the BGP routing table to display\n")
7296 struct prefix_rd prd
;
7298 ret
= str2prefix_rd (argv
[0], &prd
);
7301 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
7304 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 0, BGP_PATH_ALL
);
7307 DEFUN (show_ip_bgp_prefix
,
7308 show_ip_bgp_prefix_cmd
,
7309 "show ip bgp A.B.C.D/M",
7313 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7315 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7318 DEFUN (show_ip_bgp_prefix_pathtype
,
7319 show_ip_bgp_prefix_pathtype_cmd
,
7320 "show ip bgp A.B.C.D/M (bestpath|multipath)",
7324 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7325 "Display only the bestpath\n"
7326 "Display only multipaths\n")
7328 if (strncmp (argv
[1], "b", 1) == 0)
7329 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_BESTPATH
);
7331 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_MULTIPATH
);
7334 DEFUN (show_ip_bgp_ipv4_prefix
,
7335 show_ip_bgp_ipv4_prefix_cmd
,
7336 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M",
7341 "Address Family modifier\n"
7342 "Address Family modifier\n"
7343 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7345 if (strncmp (argv
[0], "m", 1) == 0)
7346 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_ALL
);
7348 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7351 ALIAS (show_ip_bgp_ipv4_prefix
,
7352 show_bgp_ipv4_safi_prefix_cmd
,
7353 "show bgp ipv4 (unicast|multicast) A.B.C.D/M",
7357 "Address Family modifier\n"
7358 "Address Family modifier\n"
7359 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7361 DEFUN (show_ip_bgp_ipv4_prefix_pathtype
,
7362 show_ip_bgp_ipv4_prefix_pathtype_cmd
,
7363 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath)",
7368 "Address Family modifier\n"
7369 "Address Family modifier\n"
7370 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7371 "Display only the bestpath\n"
7372 "Display only multipaths\n")
7374 if (strncmp (argv
[0], "m", 1) == 0)
7375 if (strncmp (argv
[2], "b", 1) == 0)
7376 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_BESTPATH
);
7378 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_MULTIPATH
);
7380 if (strncmp (argv
[2], "b", 1) == 0)
7381 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_BESTPATH
);
7383 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_MULTIPATH
);
7386 ALIAS (show_ip_bgp_ipv4_prefix_pathtype
,
7387 show_bgp_ipv4_safi_prefix_pathtype_cmd
,
7388 "show bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath)",
7392 "Address Family modifier\n"
7393 "Address Family modifier\n"
7394 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
7395 "Display only the bestpath\n"
7396 "Display only multipaths\n")
7398 DEFUN (show_ip_bgp_vpnv4_all_prefix
,
7399 show_ip_bgp_vpnv4_all_prefix_cmd
,
7400 "show ip bgp vpnv4 all A.B.C.D/M",
7404 "Display VPNv4 NLRI specific information\n"
7405 "Display information about all VPNv4 NLRIs\n"
7406 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7408 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 1, BGP_PATH_ALL
);
7411 DEFUN (show_ip_bgp_vpnv4_rd_prefix
,
7412 show_ip_bgp_vpnv4_rd_prefix_cmd
,
7413 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M",
7417 "Display VPNv4 NLRI specific information\n"
7418 "Display information for a route distinguisher\n"
7419 "VPN Route Distinguisher\n"
7420 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7423 struct prefix_rd prd
;
7425 ret
= str2prefix_rd (argv
[0], &prd
);
7428 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
7431 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 1, BGP_PATH_ALL
);
7434 DEFUN (show_ip_bgp_view
,
7435 show_ip_bgp_view_cmd
,
7436 "show ip bgp view WORD",
7445 /* BGP structure lookup. */
7446 bgp
= bgp_lookup_by_name (argv
[0]);
7449 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
7453 return bgp_show (vty
, bgp
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, NULL
);
7456 DEFUN (show_ip_bgp_view_route
,
7457 show_ip_bgp_view_route_cmd
,
7458 "show ip bgp view WORD A.B.C.D",
7464 "Network in the BGP routing table to display\n")
7466 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7469 DEFUN (show_ip_bgp_view_prefix
,
7470 show_ip_bgp_view_prefix_cmd
,
7471 "show ip bgp view WORD A.B.C.D/M",
7477 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
7479 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7489 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
7500 DEFUN (show_bgp_ipv6_safi
,
7501 show_bgp_ipv6_safi_cmd
,
7502 "show bgp ipv6 (unicast|multicast)",
7506 "Address Family modifier\n"
7507 "Address Family modifier\n")
7509 if (strncmp (argv
[0], "m", 1) == 0)
7510 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
7513 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, NULL
);
7516 DEFUN (show_bgp_ipv6_safi_csv
,
7517 show_bgp_ipv6_safi_csv_cmd
,
7518 "show bgp ipv6 (unicast|multicast) csv",
7522 "Address Family modifier\n"
7523 "Address Family modifier\n")
7525 if (strncmp (argv
[0], "m", 1) == 0)
7526 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
7529 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, &csv
);
7533 DEFUN (show_ipv6_bgp
,
7540 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
7544 DEFUN (show_bgp_route
,
7546 "show bgp X:X::X:X",
7549 "Network in the BGP routing table to display\n")
7551 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7554 ALIAS (show_bgp_route
,
7555 show_bgp_ipv6_route_cmd
,
7556 "show bgp ipv6 X:X::X:X",
7560 "Network in the BGP routing table to display\n")
7562 DEFUN (show_bgp_ipv6_safi_route
,
7563 show_bgp_ipv6_safi_route_cmd
,
7564 "show bgp ipv6 (unicast|multicast) X:X::X:X",
7568 "Address Family modifier\n"
7569 "Address Family modifier\n"
7570 "Network in the BGP routing table to display\n")
7572 if (strncmp (argv
[0], "m", 1) == 0)
7573 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_ALL
);
7575 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7578 DEFUN (show_bgp_route_pathtype
,
7579 show_bgp_route_pathtype_cmd
,
7580 "show bgp X:X::X:X (bestpath|multipath)",
7583 "Network in the BGP routing table to display\n"
7584 "Display only the bestpath\n"
7585 "Display only multipaths\n")
7587 if (strncmp (argv
[1], "b", 1) == 0)
7588 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_BESTPATH
);
7590 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_MULTIPATH
);
7593 ALIAS (show_bgp_route_pathtype
,
7594 show_bgp_ipv6_route_pathtype_cmd
,
7595 "show bgp ipv6 X:X::X:X (bestpath|multipath)",
7599 "Network in the BGP routing table to display\n"
7600 "Display only the bestpath\n"
7601 "Display only multipaths\n")
7603 DEFUN (show_bgp_ipv6_safi_route_pathtype
,
7604 show_bgp_ipv6_safi_route_pathtype_cmd
,
7605 "show bgp ipv6 (unicast|multicast) X:X::X:X (bestpath|multipath)",
7609 "Address Family modifier\n"
7610 "Address Family modifier\n"
7611 "Network in the BGP routing table to display\n"
7612 "Display only the bestpath\n"
7613 "Display only multipaths\n")
7615 if (strncmp (argv
[0], "m", 1) == 0)
7616 if (strncmp (argv
[2], "b", 1) == 0)
7617 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_BESTPATH
);
7619 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_MULTIPATH
);
7621 if (strncmp (argv
[2], "b", 1) == 0)
7622 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_BESTPATH
);
7624 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_MULTIPATH
);
7628 DEFUN (show_ipv6_bgp_route
,
7629 show_ipv6_bgp_route_cmd
,
7630 "show ipv6 bgp X:X::X:X",
7634 "Network in the BGP routing table to display\n")
7636 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7639 DEFUN (show_bgp_prefix
,
7640 show_bgp_prefix_cmd
,
7641 "show bgp X:X::X:X/M",
7644 "IPv6 prefix <network>/<length>\n")
7646 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7649 ALIAS (show_bgp_prefix
,
7650 show_bgp_ipv6_prefix_cmd
,
7651 "show bgp ipv6 X:X::X:X/M",
7655 "IPv6 prefix <network>/<length>\n")
7657 DEFUN (show_bgp_ipv6_safi_prefix
,
7658 show_bgp_ipv6_safi_prefix_cmd
,
7659 "show bgp ipv6 (unicast|multicast) X:X::X:X/M",
7663 "Address Family modifier\n"
7664 "Address Family modifier\n"
7665 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
7667 if (strncmp (argv
[0], "m", 1) == 0)
7668 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_ALL
);
7670 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7673 DEFUN (show_bgp_prefix_pathtype
,
7674 show_bgp_prefix_pathtype_cmd
,
7675 "show bgp X:X::X:X/M (bestpath|multipath)",
7678 "IPv6 prefix <network>/<length>\n"
7679 "Display only the bestpath\n"
7680 "Display only multipaths\n")
7682 if (strncmp (argv
[1], "b", 1) == 0)
7683 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_BESTPATH
);
7685 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_MULTIPATH
);
7688 ALIAS (show_bgp_prefix_pathtype
,
7689 show_bgp_ipv6_prefix_pathtype_cmd
,
7690 "show bgp ipv6 X:X::X:X/M (bestpath|multipath)",
7694 "IPv6 prefix <network>/<length>\n"
7695 "Display only the bestpath\n"
7696 "Display only multipaths\n")
7698 DEFUN (show_bgp_ipv6_safi_prefix_pathtype
,
7699 show_bgp_ipv6_safi_prefix_pathtype_cmd
,
7700 "show bgp ipv6 (unicast|multicast) X:X::X:X/M (bestpath|multipath)",
7704 "Address Family modifier\n"
7705 "Address Family modifier\n"
7706 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
7707 "Display only the bestpath\n"
7708 "Display only multipaths\n")
7710 if (strncmp (argv
[0], "m", 1) == 0)
7711 if (strncmp (argv
[2], "b", 1) == 0)
7712 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_BESTPATH
);
7714 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_MULTIPATH
);
7716 if (strncmp (argv
[2], "b", 1) == 0)
7717 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_BESTPATH
);
7719 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_MULTIPATH
);
7723 DEFUN (show_ipv6_bgp_prefix
,
7724 show_ipv6_bgp_prefix_cmd
,
7725 "show ipv6 bgp X:X::X:X/M",
7729 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
7731 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7734 DEFUN (show_bgp_view
,
7736 "show bgp view WORD",
7744 /* BGP structure lookup. */
7745 bgp
= bgp_lookup_by_name (argv
[0]);
7748 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
7752 return bgp_show (vty
, bgp
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
, NULL
);
7755 ALIAS (show_bgp_view
,
7756 show_bgp_view_ipv6_cmd
,
7757 "show bgp view WORD ipv6",
7764 DEFUN (show_bgp_view_route
,
7765 show_bgp_view_route_cmd
,
7766 "show bgp view WORD X:X::X:X",
7771 "Network in the BGP routing table to display\n")
7773 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
7776 ALIAS (show_bgp_view_route
,
7777 show_bgp_view_ipv6_route_cmd
,
7778 "show bgp view WORD ipv6 X:X::X:X",
7784 "Network in the BGP routing table to display\n")
7786 DEFUN (show_bgp_view_prefix
,
7787 show_bgp_view_prefix_cmd
,
7788 "show bgp view WORD X:X::X:X/M",
7793 "IPv6 prefix <network>/<length>\n")
7795 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
7798 ALIAS (show_bgp_view_prefix
,
7799 show_bgp_view_ipv6_prefix_cmd
,
7800 "show bgp view WORD ipv6 X:X::X:X/M",
7806 "IPv6 prefix <network>/<length>\n")
7809 DEFUN (show_ipv6_mbgp
,
7816 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
7821 DEFUN (show_ipv6_mbgp_route
,
7822 show_ipv6_mbgp_route_cmd
,
7823 "show ipv6 mbgp X:X::X:X",
7827 "Network in the MBGP routing table to display\n")
7829 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0, BGP_PATH_ALL
);
7833 DEFUN (show_ipv6_mbgp_prefix
,
7834 show_ipv6_mbgp_prefix_cmd
,
7835 "show ipv6 mbgp X:X::X:X/M",
7839 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
7841 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1, BGP_PATH_ALL
);
7847 bgp_show_regexp (struct vty
*vty
, int argc
, const char **argv
, afi_t afi
,
7848 safi_t safi
, enum bgp_show_type type
)
7858 b
= buffer_new (1024);
7859 for (i
= 0; i
< argc
; i
++)
7862 buffer_putc (b
, ' ');
7865 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
7870 buffer_putstr (b
, argv
[i
]);
7872 buffer_putc (b
, '\0');
7874 regstr
= buffer_getstr (b
);
7877 regex
= bgp_regcomp (regstr
);
7878 XFREE(MTYPE_TMP
, regstr
);
7881 vty_out (vty
, "Can't compile regexp %s%s", argv
[0],
7886 rc
= bgp_show (vty
, NULL
, afi
, safi
, type
, regex
, NULL
);
7887 bgp_regex_free (regex
);
7891 DEFUN (show_ip_bgp_regexp
,
7892 show_ip_bgp_regexp_cmd
,
7893 "show ip bgp regexp .LINE",
7897 "Display routes matching the AS path regular expression\n"
7898 "A regular-expression to match the BGP AS paths\n")
7900 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7901 bgp_show_type_regexp
);
7904 DEFUN (show_ip_bgp_flap_regexp
,
7905 show_ip_bgp_flap_regexp_cmd
,
7906 "show ip bgp flap-statistics regexp .LINE",
7910 "Display flap statistics of routes\n"
7911 "Display routes matching the AS path regular expression\n"
7912 "A regular-expression to match the BGP AS paths\n")
7914 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7915 bgp_show_type_flap_regexp
);
7918 DEFUN (show_ip_bgp_ipv4_regexp
,
7919 show_ip_bgp_ipv4_regexp_cmd
,
7920 "show ip bgp ipv4 (unicast|multicast) regexp .LINE",
7925 "Address Family modifier\n"
7926 "Address Family modifier\n"
7927 "Display routes matching the AS path regular expression\n"
7928 "A regular-expression to match the BGP AS paths\n")
7930 if (strncmp (argv
[0], "m", 1) == 0)
7931 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_MULTICAST
,
7932 bgp_show_type_regexp
);
7934 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7935 bgp_show_type_regexp
);
7939 DEFUN (show_bgp_regexp
,
7940 show_bgp_regexp_cmd
,
7941 "show bgp regexp .LINE",
7944 "Display routes matching the AS path regular expression\n"
7945 "A regular-expression to match the BGP AS paths\n")
7947 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
7948 bgp_show_type_regexp
);
7951 ALIAS (show_bgp_regexp
,
7952 show_bgp_ipv6_regexp_cmd
,
7953 "show bgp ipv6 regexp .LINE",
7957 "Display routes matching the AS path regular expression\n"
7958 "A regular-expression to match the BGP AS paths\n")
7961 DEFUN (show_ipv6_bgp_regexp
,
7962 show_ipv6_bgp_regexp_cmd
,
7963 "show ipv6 bgp regexp .LINE",
7967 "Display routes matching the AS path regular expression\n"
7968 "A regular-expression to match the BGP AS paths\n")
7970 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
7971 bgp_show_type_regexp
);
7975 DEFUN (show_ipv6_mbgp_regexp
,
7976 show_ipv6_mbgp_regexp_cmd
,
7977 "show ipv6 mbgp regexp .LINE",
7981 "Display routes matching the AS path regular expression\n"
7982 "A regular-expression to match the MBGP AS paths\n")
7984 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_MULTICAST
,
7985 bgp_show_type_regexp
);
7987 #endif /* HAVE_IPV6 */
7990 bgp_show_prefix_list (struct vty
*vty
, const char *prefix_list_str
, afi_t afi
,
7991 safi_t safi
, enum bgp_show_type type
)
7993 struct prefix_list
*plist
;
7995 plist
= prefix_list_lookup (afi
, prefix_list_str
);
7998 vty_out (vty
, "%% %s is not a valid prefix-list name%s",
7999 prefix_list_str
, VTY_NEWLINE
);
8003 return bgp_show (vty
, NULL
, afi
, safi
, type
, plist
, NULL
);
8006 DEFUN (show_ip_bgp_prefix_list
,
8007 show_ip_bgp_prefix_list_cmd
,
8008 "show ip bgp prefix-list WORD",
8012 "Display routes conforming to the prefix-list\n"
8013 "IP prefix-list name\n")
8015 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8016 bgp_show_type_prefix_list
);
8019 DEFUN (show_ip_bgp_flap_prefix_list
,
8020 show_ip_bgp_flap_prefix_list_cmd
,
8021 "show ip bgp flap-statistics prefix-list WORD",
8025 "Display flap statistics of routes\n"
8026 "Display routes conforming to the prefix-list\n"
8027 "IP prefix-list name\n")
8029 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8030 bgp_show_type_flap_prefix_list
);
8033 DEFUN (show_ip_bgp_ipv4_prefix_list
,
8034 show_ip_bgp_ipv4_prefix_list_cmd
,
8035 "show ip bgp ipv4 (unicast|multicast) prefix-list WORD",
8040 "Address Family modifier\n"
8041 "Address Family modifier\n"
8042 "Display routes conforming to the prefix-list\n"
8043 "IP prefix-list name\n")
8045 if (strncmp (argv
[0], "m", 1) == 0)
8046 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
8047 bgp_show_type_prefix_list
);
8049 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
8050 bgp_show_type_prefix_list
);
8054 DEFUN (show_bgp_prefix_list
,
8055 show_bgp_prefix_list_cmd
,
8056 "show bgp prefix-list WORD",
8059 "Display routes conforming to the prefix-list\n"
8060 "IPv6 prefix-list name\n")
8062 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8063 bgp_show_type_prefix_list
);
8066 ALIAS (show_bgp_prefix_list
,
8067 show_bgp_ipv6_prefix_list_cmd
,
8068 "show bgp ipv6 prefix-list WORD",
8072 "Display routes conforming to the prefix-list\n"
8073 "IPv6 prefix-list name\n")
8076 DEFUN (show_ipv6_bgp_prefix_list
,
8077 show_ipv6_bgp_prefix_list_cmd
,
8078 "show ipv6 bgp prefix-list WORD",
8082 "Display routes matching the prefix-list\n"
8083 "IPv6 prefix-list name\n")
8085 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8086 bgp_show_type_prefix_list
);
8090 DEFUN (show_ipv6_mbgp_prefix_list
,
8091 show_ipv6_mbgp_prefix_list_cmd
,
8092 "show ipv6 mbgp prefix-list WORD",
8096 "Display routes matching the prefix-list\n"
8097 "IPv6 prefix-list name\n")
8099 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
8100 bgp_show_type_prefix_list
);
8102 #endif /* HAVE_IPV6 */
8105 bgp_show_filter_list (struct vty
*vty
, const char *filter
, afi_t afi
,
8106 safi_t safi
, enum bgp_show_type type
)
8108 struct as_list
*as_list
;
8110 as_list
= as_list_lookup (filter
);
8111 if (as_list
== NULL
)
8113 vty_out (vty
, "%% %s is not a valid AS-path access-list name%s", filter
, VTY_NEWLINE
);
8117 return bgp_show (vty
, NULL
, afi
, safi
, type
, as_list
, NULL
);
8120 DEFUN (show_ip_bgp_filter_list
,
8121 show_ip_bgp_filter_list_cmd
,
8122 "show ip bgp filter-list WORD",
8126 "Display routes conforming to the filter-list\n"
8127 "Regular expression access list name\n")
8129 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8130 bgp_show_type_filter_list
);
8133 DEFUN (show_ip_bgp_flap_filter_list
,
8134 show_ip_bgp_flap_filter_list_cmd
,
8135 "show ip bgp flap-statistics filter-list WORD",
8139 "Display flap statistics of routes\n"
8140 "Display routes conforming to the filter-list\n"
8141 "Regular expression access list name\n")
8143 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8144 bgp_show_type_flap_filter_list
);
8147 DEFUN (show_ip_bgp_ipv4_filter_list
,
8148 show_ip_bgp_ipv4_filter_list_cmd
,
8149 "show ip bgp ipv4 (unicast|multicast) filter-list WORD",
8154 "Address Family modifier\n"
8155 "Address Family modifier\n"
8156 "Display routes conforming to the filter-list\n"
8157 "Regular expression access list name\n")
8159 if (strncmp (argv
[0], "m", 1) == 0)
8160 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
8161 bgp_show_type_filter_list
);
8163 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
8164 bgp_show_type_filter_list
);
8168 DEFUN (show_bgp_filter_list
,
8169 show_bgp_filter_list_cmd
,
8170 "show bgp filter-list WORD",
8173 "Display routes conforming to the filter-list\n"
8174 "Regular expression access list name\n")
8176 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8177 bgp_show_type_filter_list
);
8180 ALIAS (show_bgp_filter_list
,
8181 show_bgp_ipv6_filter_list_cmd
,
8182 "show bgp ipv6 filter-list WORD",
8186 "Display routes conforming to the filter-list\n"
8187 "Regular expression access list name\n")
8190 DEFUN (show_ipv6_bgp_filter_list
,
8191 show_ipv6_bgp_filter_list_cmd
,
8192 "show ipv6 bgp filter-list WORD",
8196 "Display routes conforming to the filter-list\n"
8197 "Regular expression access list name\n")
8199 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8200 bgp_show_type_filter_list
);
8204 DEFUN (show_ipv6_mbgp_filter_list
,
8205 show_ipv6_mbgp_filter_list_cmd
,
8206 "show ipv6 mbgp filter-list WORD",
8210 "Display routes conforming to the filter-list\n"
8211 "Regular expression access list name\n")
8213 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
8214 bgp_show_type_filter_list
);
8216 #endif /* HAVE_IPV6 */
8219 bgp_show_route_map (struct vty
*vty
, const char *rmap_str
, afi_t afi
,
8220 safi_t safi
, enum bgp_show_type type
)
8222 struct route_map
*rmap
;
8224 rmap
= route_map_lookup_by_name (rmap_str
);
8227 vty_out (vty
, "%% %s is not a valid route-map name%s",
8228 rmap_str
, VTY_NEWLINE
);
8232 return bgp_show (vty
, NULL
, afi
, safi
, type
, rmap
, NULL
);
8235 DEFUN (show_ip_bgp_route_map
,
8236 show_ip_bgp_route_map_cmd
,
8237 "show ip bgp route-map WORD",
8241 "Display routes matching the route-map\n"
8242 "A route-map to match on\n")
8244 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8245 bgp_show_type_route_map
);
8248 DEFUN (show_ip_bgp_flap_route_map
,
8249 show_ip_bgp_flap_route_map_cmd
,
8250 "show ip bgp flap-statistics route-map WORD",
8254 "Display flap statistics of routes\n"
8255 "Display routes matching the route-map\n"
8256 "A route-map to match on\n")
8258 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8259 bgp_show_type_flap_route_map
);
8262 DEFUN (show_ip_bgp_ipv4_route_map
,
8263 show_ip_bgp_ipv4_route_map_cmd
,
8264 "show ip bgp ipv4 (unicast|multicast) route-map WORD",
8269 "Address Family modifier\n"
8270 "Address Family modifier\n"
8271 "Display routes matching the route-map\n"
8272 "A route-map to match on\n")
8274 if (strncmp (argv
[0], "m", 1) == 0)
8275 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
8276 bgp_show_type_route_map
);
8278 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
8279 bgp_show_type_route_map
);
8282 DEFUN (show_bgp_route_map
,
8283 show_bgp_route_map_cmd
,
8284 "show bgp route-map WORD",
8287 "Display routes matching the route-map\n"
8288 "A route-map to match on\n")
8290 return bgp_show_route_map (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8291 bgp_show_type_route_map
);
8294 ALIAS (show_bgp_route_map
,
8295 show_bgp_ipv6_route_map_cmd
,
8296 "show bgp ipv6 route-map WORD",
8300 "Display routes matching the route-map\n"
8301 "A route-map to match on\n")
8303 DEFUN (show_ip_bgp_cidr_only
,
8304 show_ip_bgp_cidr_only_cmd
,
8305 "show ip bgp cidr-only",
8309 "Display only routes with non-natural netmasks\n")
8311 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
8312 bgp_show_type_cidr_only
, NULL
, NULL
);
8315 DEFUN (show_ip_bgp_flap_cidr_only
,
8316 show_ip_bgp_flap_cidr_only_cmd
,
8317 "show ip bgp flap-statistics cidr-only",
8321 "Display flap statistics of routes\n"
8322 "Display only routes with non-natural netmasks\n")
8324 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
8325 bgp_show_type_flap_cidr_only
, NULL
, NULL
);
8328 DEFUN (show_ip_bgp_ipv4_cidr_only
,
8329 show_ip_bgp_ipv4_cidr_only_cmd
,
8330 "show ip bgp ipv4 (unicast|multicast) cidr-only",
8335 "Address Family modifier\n"
8336 "Address Family modifier\n"
8337 "Display only routes with non-natural netmasks\n")
8339 if (strncmp (argv
[0], "m", 1) == 0)
8340 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
8341 bgp_show_type_cidr_only
, NULL
, NULL
);
8343 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
8344 bgp_show_type_cidr_only
, NULL
, NULL
);
8347 DEFUN (show_ip_bgp_community_all
,
8348 show_ip_bgp_community_all_cmd
,
8349 "show ip bgp community",
8353 "Display routes matching the communities\n")
8355 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
8356 bgp_show_type_community_all
, NULL
, NULL
);
8359 DEFUN (show_ip_bgp_ipv4_community_all
,
8360 show_ip_bgp_ipv4_community_all_cmd
,
8361 "show ip bgp ipv4 (unicast|multicast) community",
8366 "Address Family modifier\n"
8367 "Address Family modifier\n"
8368 "Display routes matching the communities\n")
8370 if (strncmp (argv
[0], "m", 1) == 0)
8371 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
8372 bgp_show_type_community_all
, NULL
, NULL
);
8374 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
8375 bgp_show_type_community_all
, NULL
, NULL
);
8379 DEFUN (show_bgp_community_all
,
8380 show_bgp_community_all_cmd
,
8381 "show bgp community",
8384 "Display routes matching the communities\n")
8386 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
8387 bgp_show_type_community_all
, NULL
, NULL
);
8390 ALIAS (show_bgp_community_all
,
8391 show_bgp_ipv6_community_all_cmd
,
8392 "show bgp ipv6 community",
8396 "Display routes matching the communities\n")
8399 DEFUN (show_ipv6_bgp_community_all
,
8400 show_ipv6_bgp_community_all_cmd
,
8401 "show ipv6 bgp community",
8405 "Display routes matching the communities\n")
8407 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
8408 bgp_show_type_community_all
, NULL
, NULL
);
8412 DEFUN (show_ipv6_mbgp_community_all
,
8413 show_ipv6_mbgp_community_all_cmd
,
8414 "show ipv6 mbgp community",
8418 "Display routes matching the communities\n")
8420 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
,
8421 bgp_show_type_community_all
, NULL
, NULL
);
8423 #endif /* HAVE_IPV6 */
8426 bgp_show_community (struct vty
*vty
, const char *view_name
, int argc
,
8427 const char **argv
, int exact
, afi_t afi
, safi_t safi
)
8429 struct community
*com
;
8436 /* BGP structure lookup */
8439 bgp
= bgp_lookup_by_name (view_name
);
8442 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
8448 bgp
= bgp_get_default ();
8451 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
8456 b
= buffer_new (1024);
8457 for (i
= 0; i
< argc
; i
++)
8460 buffer_putc (b
, ' ');
8463 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
8468 buffer_putstr (b
, argv
[i
]);
8470 buffer_putc (b
, '\0');
8472 str
= buffer_getstr (b
);
8475 com
= community_str2com (str
);
8476 XFREE (MTYPE_TMP
, str
);
8479 vty_out (vty
, "%% Community malformed: %s", VTY_NEWLINE
);
8483 return bgp_show (vty
, bgp
, afi
, safi
,
8484 (exact
? bgp_show_type_community_exact
:
8485 bgp_show_type_community
), com
, NULL
);
8488 DEFUN (show_ip_bgp_community
,
8489 show_ip_bgp_community_cmd
,
8490 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export)",
8494 "Display routes matching the communities\n"
8495 "community number\n"
8496 "Do not send outside local AS (well-known community)\n"
8497 "Do not advertise to any peer (well-known community)\n"
8498 "Do not export to next AS (well-known community)\n")
8500 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
8503 ALIAS (show_ip_bgp_community
,
8504 show_ip_bgp_community2_cmd
,
8505 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8509 "Display routes matching the communities\n"
8510 "community number\n"
8511 "Do not send outside local AS (well-known community)\n"
8512 "Do not advertise to any peer (well-known community)\n"
8513 "Do not export to next AS (well-known community)\n"
8514 "community number\n"
8515 "Do not send outside local AS (well-known community)\n"
8516 "Do not advertise to any peer (well-known community)\n"
8517 "Do not export to next AS (well-known community)\n")
8519 ALIAS (show_ip_bgp_community
,
8520 show_ip_bgp_community3_cmd
,
8521 "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)",
8525 "Display routes matching the communities\n"
8526 "community number\n"
8527 "Do not send outside local AS (well-known community)\n"
8528 "Do not advertise to any peer (well-known community)\n"
8529 "Do not export to next AS (well-known community)\n"
8530 "community number\n"
8531 "Do not send outside local AS (well-known community)\n"
8532 "Do not advertise to any peer (well-known community)\n"
8533 "Do not export to next AS (well-known community)\n"
8534 "community number\n"
8535 "Do not send outside local AS (well-known community)\n"
8536 "Do not advertise to any peer (well-known community)\n"
8537 "Do not export to next AS (well-known community)\n")
8539 ALIAS (show_ip_bgp_community
,
8540 show_ip_bgp_community4_cmd
,
8541 "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)",
8545 "Display routes matching the communities\n"
8546 "community number\n"
8547 "Do not send outside local AS (well-known community)\n"
8548 "Do not advertise to any peer (well-known community)\n"
8549 "Do not export to next AS (well-known community)\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 "community number\n"
8559 "Do not send outside local AS (well-known community)\n"
8560 "Do not advertise to any peer (well-known community)\n"
8561 "Do not export to next AS (well-known community)\n")
8563 DEFUN (show_ip_bgp_ipv4_community
,
8564 show_ip_bgp_ipv4_community_cmd
,
8565 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
8570 "Address Family modifier\n"
8571 "Address Family modifier\n"
8572 "Display routes matching the communities\n"
8573 "community number\n"
8574 "Do not send outside local AS (well-known community)\n"
8575 "Do not advertise to any peer (well-known community)\n"
8576 "Do not export to next AS (well-known community)\n")
8578 if (strncmp (argv
[0], "m", 1) == 0)
8579 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP
, SAFI_MULTICAST
);
8581 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
8584 ALIAS (show_ip_bgp_ipv4_community
,
8585 show_ip_bgp_ipv4_community2_cmd
,
8586 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8591 "Address Family modifier\n"
8592 "Address Family modifier\n"
8593 "Display routes matching the communities\n"
8594 "community number\n"
8595 "Do not send outside local AS (well-known community)\n"
8596 "Do not advertise to any peer (well-known community)\n"
8597 "Do not export to next AS (well-known community)\n"
8598 "community number\n"
8599 "Do not send outside local AS (well-known community)\n"
8600 "Do not advertise to any peer (well-known community)\n"
8601 "Do not export to next AS (well-known community)\n")
8603 ALIAS (show_ip_bgp_ipv4_community
,
8604 show_ip_bgp_ipv4_community3_cmd
,
8605 "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)",
8610 "Address Family modifier\n"
8611 "Address Family modifier\n"
8612 "Display routes matching the communities\n"
8613 "community number\n"
8614 "Do not send outside local AS (well-known community)\n"
8615 "Do not advertise to any peer (well-known community)\n"
8616 "Do not export to next AS (well-known community)\n"
8617 "community number\n"
8618 "Do not send outside local AS (well-known community)\n"
8619 "Do not advertise to any peer (well-known community)\n"
8620 "Do not export to next AS (well-known community)\n"
8621 "community number\n"
8622 "Do not send outside local AS (well-known community)\n"
8623 "Do not advertise to any peer (well-known community)\n"
8624 "Do not export to next AS (well-known community)\n")
8626 ALIAS (show_ip_bgp_ipv4_community
,
8627 show_ip_bgp_ipv4_community4_cmd
,
8628 "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)",
8633 "Address Family modifier\n"
8634 "Address Family modifier\n"
8635 "Display routes matching the communities\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 "community number\n"
8641 "Do not send outside local AS (well-known community)\n"
8642 "Do not advertise to any peer (well-known community)\n"
8643 "Do not export to next AS (well-known community)\n"
8644 "community number\n"
8645 "Do not send outside local AS (well-known community)\n"
8646 "Do not advertise to any peer (well-known community)\n"
8647 "Do not export to next AS (well-known community)\n"
8648 "community number\n"
8649 "Do not send outside local AS (well-known community)\n"
8650 "Do not advertise to any peer (well-known community)\n"
8651 "Do not export to next AS (well-known community)\n")
8653 DEFUN (show_bgp_view_afi_safi_community_all
,
8654 show_bgp_view_afi_safi_community_all_cmd
,
8656 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community",
8658 "show bgp view WORD ipv4 (unicast|multicast) community",
8668 "Address Family modifier\n"
8669 "Address Family modifier\n"
8670 "Display routes matching the communities\n")
8676 /* BGP structure lookup. */
8677 bgp
= bgp_lookup_by_name (argv
[0]);
8680 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
8685 afi
= (strncmp (argv
[1], "ipv6", 4) == 0) ? AFI_IP6
: AFI_IP
;
8686 safi
= (strncmp (argv
[2], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
8689 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
8691 return bgp_show (vty
, bgp
, afi
, safi
, bgp_show_type_community_all
, NULL
, NULL
);
8694 DEFUN (show_bgp_view_afi_safi_community
,
8695 show_bgp_view_afi_safi_community_cmd
,
8697 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
8699 "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
8709 "Address family modifier\n"
8710 "Address family modifier\n"
8711 "Display routes matching the communities\n"
8712 "community number\n"
8713 "Do not send outside local AS (well-known community)\n"
8714 "Do not advertise to any peer (well-known community)\n"
8715 "Do not export to next AS (well-known community)\n")
8721 afi
= (strncmp (argv
[1], "ipv6", 4) == 0) ? AFI_IP6
: AFI_IP
;
8722 safi
= (strncmp (argv
[2], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
8723 return bgp_show_community (vty
, argv
[0], argc
-3, &argv
[3], 0, afi
, safi
);
8726 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
8727 return bgp_show_community (vty
, argv
[0], argc
-2, &argv
[2], 0, afi
, safi
);
8731 ALIAS (show_bgp_view_afi_safi_community
,
8732 show_bgp_view_afi_safi_community2_cmd
,
8734 "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)",
8736 "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8746 "Address family modifier\n"
8747 "Address family modifier\n"
8748 "Display routes matching the communities\n"
8749 "community number\n"
8750 "Do not send outside local AS (well-known community)\n"
8751 "Do not advertise to any peer (well-known community)\n"
8752 "Do not export to next AS (well-known community)\n"
8753 "community number\n"
8754 "Do not send outside local AS (well-known community)\n"
8755 "Do not advertise to any peer (well-known community)\n"
8756 "Do not export to next AS (well-known community)\n")
8758 ALIAS (show_bgp_view_afi_safi_community
,
8759 show_bgp_view_afi_safi_community3_cmd
,
8761 "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)",
8763 "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)",
8773 "Address family modifier\n"
8774 "Address family modifier\n"
8775 "Display routes matching the communities\n"
8776 "community number\n"
8777 "Do not send outside local AS (well-known community)\n"
8778 "Do not advertise to any peer (well-known community)\n"
8779 "Do not export to next AS (well-known community)\n"
8780 "community number\n"
8781 "Do not send outside local AS (well-known community)\n"
8782 "Do not advertise to any peer (well-known community)\n"
8783 "Do not export to next AS (well-known community)\n"
8784 "community number\n"
8785 "Do not send outside local AS (well-known community)\n"
8786 "Do not advertise to any peer (well-known community)\n"
8787 "Do not export to next AS (well-known community)\n")
8789 ALIAS (show_bgp_view_afi_safi_community
,
8790 show_bgp_view_afi_safi_community4_cmd
,
8792 "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)",
8794 "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)",
8804 "Address family modifier\n"
8805 "Address family modifier\n"
8806 "Display routes matching the communities\n"
8807 "community number\n"
8808 "Do not send outside local AS (well-known community)\n"
8809 "Do not advertise to any peer (well-known community)\n"
8810 "Do not export to next AS (well-known community)\n"
8811 "community number\n"
8812 "Do not send outside local AS (well-known community)\n"
8813 "Do not advertise to any peer (well-known community)\n"
8814 "Do not export to next AS (well-known community)\n"
8815 "community number\n"
8816 "Do not send outside local AS (well-known community)\n"
8817 "Do not advertise to any peer (well-known community)\n"
8818 "Do not export to next AS (well-known community)\n"
8819 "community number\n"
8820 "Do not send outside local AS (well-known community)\n"
8821 "Do not advertise to any peer (well-known community)\n"
8822 "Do not export to next AS (well-known community)\n")
8824 DEFUN (show_ip_bgp_community_exact
,
8825 show_ip_bgp_community_exact_cmd
,
8826 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8830 "Display routes matching the communities\n"
8831 "community number\n"
8832 "Do not send outside local AS (well-known community)\n"
8833 "Do not advertise to any peer (well-known community)\n"
8834 "Do not export to next AS (well-known community)\n"
8835 "Exact match of the communities")
8837 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
8840 ALIAS (show_ip_bgp_community_exact
,
8841 show_ip_bgp_community2_exact_cmd
,
8842 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8846 "Display routes matching the communities\n"
8847 "community number\n"
8848 "Do not send outside local AS (well-known community)\n"
8849 "Do not advertise to any peer (well-known community)\n"
8850 "Do not export to next AS (well-known community)\n"
8851 "community number\n"
8852 "Do not send outside local AS (well-known community)\n"
8853 "Do not advertise to any peer (well-known community)\n"
8854 "Do not export to next AS (well-known community)\n"
8855 "Exact match of the communities")
8857 ALIAS (show_ip_bgp_community_exact
,
8858 show_ip_bgp_community3_exact_cmd
,
8859 "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",
8863 "Display routes matching the communities\n"
8864 "community number\n"
8865 "Do not send outside local AS (well-known community)\n"
8866 "Do not advertise to any peer (well-known community)\n"
8867 "Do not export to next AS (well-known community)\n"
8868 "community number\n"
8869 "Do not send outside local AS (well-known community)\n"
8870 "Do not advertise to any peer (well-known community)\n"
8871 "Do not export to next AS (well-known community)\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 "Exact match of the communities")
8878 ALIAS (show_ip_bgp_community_exact
,
8879 show_ip_bgp_community4_exact_cmd
,
8880 "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",
8884 "Display routes matching the communities\n"
8885 "community number\n"
8886 "Do not send outside local AS (well-known community)\n"
8887 "Do not advertise to any peer (well-known community)\n"
8888 "Do not export to next AS (well-known community)\n"
8889 "community number\n"
8890 "Do not send outside local AS (well-known community)\n"
8891 "Do not advertise to any peer (well-known community)\n"
8892 "Do not export to next AS (well-known community)\n"
8893 "community number\n"
8894 "Do not send outside local AS (well-known community)\n"
8895 "Do not advertise to any peer (well-known community)\n"
8896 "Do not export to next AS (well-known community)\n"
8897 "community number\n"
8898 "Do not send outside local AS (well-known community)\n"
8899 "Do not advertise to any peer (well-known community)\n"
8900 "Do not export to next AS (well-known community)\n"
8901 "Exact match of the communities")
8903 DEFUN (show_ip_bgp_ipv4_community_exact
,
8904 show_ip_bgp_ipv4_community_exact_cmd
,
8905 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8910 "Address Family modifier\n"
8911 "Address Family modifier\n"
8912 "Display routes matching the communities\n"
8913 "community number\n"
8914 "Do not send outside local AS (well-known community)\n"
8915 "Do not advertise to any peer (well-known community)\n"
8916 "Do not export to next AS (well-known community)\n"
8917 "Exact match of the communities")
8919 if (strncmp (argv
[0], "m", 1) == 0)
8920 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP
, SAFI_MULTICAST
);
8922 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
8925 ALIAS (show_ip_bgp_ipv4_community_exact
,
8926 show_ip_bgp_ipv4_community2_exact_cmd
,
8927 "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",
8932 "Address Family modifier\n"
8933 "Address Family modifier\n"
8934 "Display routes matching the communities\n"
8935 "community number\n"
8936 "Do not send outside local AS (well-known community)\n"
8937 "Do not advertise to any peer (well-known community)\n"
8938 "Do not export to next AS (well-known community)\n"
8939 "community number\n"
8940 "Do not send outside local AS (well-known community)\n"
8941 "Do not advertise to any peer (well-known community)\n"
8942 "Do not export to next AS (well-known community)\n"
8943 "Exact match of the communities")
8945 ALIAS (show_ip_bgp_ipv4_community_exact
,
8946 show_ip_bgp_ipv4_community3_exact_cmd
,
8947 "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",
8952 "Address Family modifier\n"
8953 "Address Family modifier\n"
8954 "Display routes matching the communities\n"
8955 "community number\n"
8956 "Do not send outside local AS (well-known community)\n"
8957 "Do not advertise to any peer (well-known community)\n"
8958 "Do not export to next AS (well-known community)\n"
8959 "community number\n"
8960 "Do not send outside local AS (well-known community)\n"
8961 "Do not advertise to any peer (well-known community)\n"
8962 "Do not export to next AS (well-known community)\n"
8963 "community number\n"
8964 "Do not send outside local AS (well-known community)\n"
8965 "Do not advertise to any peer (well-known community)\n"
8966 "Do not export to next AS (well-known community)\n"
8967 "Exact match of the communities")
8969 ALIAS (show_ip_bgp_ipv4_community_exact
,
8970 show_ip_bgp_ipv4_community4_exact_cmd
,
8971 "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",
8976 "Address Family modifier\n"
8977 "Address Family modifier\n"
8978 "Display routes matching the communities\n"
8979 "community number\n"
8980 "Do not send outside local AS (well-known community)\n"
8981 "Do not advertise to any peer (well-known community)\n"
8982 "Do not export to next AS (well-known community)\n"
8983 "community number\n"
8984 "Do not send outside local AS (well-known community)\n"
8985 "Do not advertise to any peer (well-known community)\n"
8986 "Do not export to next AS (well-known community)\n"
8987 "community number\n"
8988 "Do not send outside local AS (well-known community)\n"
8989 "Do not advertise to any peer (well-known community)\n"
8990 "Do not export to next AS (well-known community)\n"
8991 "community number\n"
8992 "Do not send outside local AS (well-known community)\n"
8993 "Do not advertise to any peer (well-known community)\n"
8994 "Do not export to next AS (well-known community)\n"
8995 "Exact match of the communities")
8998 DEFUN (show_bgp_community
,
8999 show_bgp_community_cmd
,
9000 "show bgp community (AA:NN|local-AS|no-advertise|no-export)",
9003 "Display routes matching the communities\n"
9004 "community number\n"
9005 "Do not send outside local AS (well-known community)\n"
9006 "Do not advertise to any peer (well-known community)\n"
9007 "Do not export to next AS (well-known community)\n")
9009 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
9012 ALIAS (show_bgp_community
,
9013 show_bgp_ipv6_community_cmd
,
9014 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)",
9018 "Display routes matching the communities\n"
9019 "community number\n"
9020 "Do not send outside local AS (well-known community)\n"
9021 "Do not advertise to any peer (well-known community)\n"
9022 "Do not export to next AS (well-known community)\n")
9024 ALIAS (show_bgp_community
,
9025 show_bgp_community2_cmd
,
9026 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9029 "Display routes matching the communities\n"
9030 "community number\n"
9031 "Do not send outside local AS (well-known community)\n"
9032 "Do not advertise to any peer (well-known community)\n"
9033 "Do not export to next AS (well-known community)\n"
9034 "community number\n"
9035 "Do not send outside local AS (well-known community)\n"
9036 "Do not advertise to any peer (well-known community)\n"
9037 "Do not export to next AS (well-known community)\n")
9039 ALIAS (show_bgp_community
,
9040 show_bgp_ipv6_community2_cmd
,
9041 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9045 "Display routes matching the communities\n"
9046 "community number\n"
9047 "Do not send outside local AS (well-known community)\n"
9048 "Do not advertise to any peer (well-known community)\n"
9049 "Do not export to next AS (well-known community)\n"
9050 "community number\n"
9051 "Do not send outside local AS (well-known community)\n"
9052 "Do not advertise to any peer (well-known community)\n"
9053 "Do not export to next AS (well-known community)\n")
9055 ALIAS (show_bgp_community
,
9056 show_bgp_community3_cmd
,
9057 "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)",
9060 "Display routes matching the communities\n"
9061 "community number\n"
9062 "Do not send outside local AS (well-known community)\n"
9063 "Do not advertise to any peer (well-known community)\n"
9064 "Do not export to next AS (well-known community)\n"
9065 "community number\n"
9066 "Do not send outside local AS (well-known community)\n"
9067 "Do not advertise to any peer (well-known community)\n"
9068 "Do not export to next AS (well-known community)\n"
9069 "community number\n"
9070 "Do not send outside local AS (well-known community)\n"
9071 "Do not advertise to any peer (well-known community)\n"
9072 "Do not export to next AS (well-known community)\n")
9074 ALIAS (show_bgp_community
,
9075 show_bgp_ipv6_community3_cmd
,
9076 "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)",
9080 "Display routes matching the communities\n"
9081 "community number\n"
9082 "Do not send outside local AS (well-known community)\n"
9083 "Do not advertise to any peer (well-known community)\n"
9084 "Do not export to next AS (well-known community)\n"
9085 "community number\n"
9086 "Do not send outside local AS (well-known community)\n"
9087 "Do not advertise to any peer (well-known community)\n"
9088 "Do not export to next AS (well-known community)\n"
9089 "community number\n"
9090 "Do not send outside local AS (well-known community)\n"
9091 "Do not advertise to any peer (well-known community)\n"
9092 "Do not export to next AS (well-known community)\n")
9094 ALIAS (show_bgp_community
,
9095 show_bgp_community4_cmd
,
9096 "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)",
9099 "Display routes matching the communities\n"
9100 "community number\n"
9101 "Do not send outside local AS (well-known community)\n"
9102 "Do not advertise to any peer (well-known community)\n"
9103 "Do not export to next AS (well-known community)\n"
9104 "community number\n"
9105 "Do not send outside local AS (well-known community)\n"
9106 "Do not advertise to any peer (well-known community)\n"
9107 "Do not export to next AS (well-known community)\n"
9108 "community number\n"
9109 "Do not send outside local AS (well-known community)\n"
9110 "Do not advertise to any peer (well-known community)\n"
9111 "Do not export to next AS (well-known community)\n"
9112 "community number\n"
9113 "Do not send outside local AS (well-known community)\n"
9114 "Do not advertise to any peer (well-known community)\n"
9115 "Do not export to next AS (well-known community)\n")
9117 ALIAS (show_bgp_community
,
9118 show_bgp_ipv6_community4_cmd
,
9119 "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)",
9123 "Display routes matching the communities\n"
9124 "community number\n"
9125 "Do not send outside local AS (well-known community)\n"
9126 "Do not advertise to any peer (well-known community)\n"
9127 "Do not export to next AS (well-known community)\n"
9128 "community number\n"
9129 "Do not send outside local AS (well-known community)\n"
9130 "Do not advertise to any peer (well-known community)\n"
9131 "Do not export to next AS (well-known community)\n"
9132 "community number\n"
9133 "Do not send outside local AS (well-known community)\n"
9134 "Do not advertise to any peer (well-known community)\n"
9135 "Do not export to next AS (well-known community)\n"
9136 "community number\n"
9137 "Do not send outside local AS (well-known community)\n"
9138 "Do not advertise to any peer (well-known community)\n"
9139 "Do not export to next AS (well-known community)\n")
9142 DEFUN (show_ipv6_bgp_community
,
9143 show_ipv6_bgp_community_cmd
,
9144 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export)",
9148 "Display routes matching the communities\n"
9149 "community number\n"
9150 "Do not send outside local AS (well-known community)\n"
9151 "Do not advertise to any peer (well-known community)\n"
9152 "Do not export to next AS (well-known community)\n")
9154 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
9158 ALIAS (show_ipv6_bgp_community
,
9159 show_ipv6_bgp_community2_cmd
,
9160 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9164 "Display routes matching the communities\n"
9165 "community number\n"
9166 "Do not send outside local AS (well-known community)\n"
9167 "Do not advertise to any peer (well-known community)\n"
9168 "Do not export to next AS (well-known community)\n"
9169 "community number\n"
9170 "Do not send outside local AS (well-known community)\n"
9171 "Do not advertise to any peer (well-known community)\n"
9172 "Do not export to next AS (well-known community)\n")
9175 ALIAS (show_ipv6_bgp_community
,
9176 show_ipv6_bgp_community3_cmd
,
9177 "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)",
9181 "Display routes matching the communities\n"
9182 "community number\n"
9183 "Do not send outside local AS (well-known community)\n"
9184 "Do not advertise to any peer (well-known community)\n"
9185 "Do not export to next AS (well-known community)\n"
9186 "community number\n"
9187 "Do not send outside local AS (well-known community)\n"
9188 "Do not advertise to any peer (well-known community)\n"
9189 "Do not export to next AS (well-known community)\n"
9190 "community number\n"
9191 "Do not send outside local AS (well-known community)\n"
9192 "Do not advertise to any peer (well-known community)\n"
9193 "Do not export to next AS (well-known community)\n")
9196 ALIAS (show_ipv6_bgp_community
,
9197 show_ipv6_bgp_community4_cmd
,
9198 "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)",
9202 "Display routes matching the communities\n"
9203 "community number\n"
9204 "Do not send outside local AS (well-known community)\n"
9205 "Do not advertise to any peer (well-known community)\n"
9206 "Do not export to next AS (well-known community)\n"
9207 "community number\n"
9208 "Do not send outside local AS (well-known community)\n"
9209 "Do not advertise to any peer (well-known community)\n"
9210 "Do not export to next AS (well-known community)\n"
9211 "community number\n"
9212 "Do not send outside local AS (well-known community)\n"
9213 "Do not advertise to any peer (well-known community)\n"
9214 "Do not export to next AS (well-known community)\n"
9215 "community number\n"
9216 "Do not send outside local AS (well-known community)\n"
9217 "Do not advertise to any peer (well-known community)\n"
9218 "Do not export to next AS (well-known community)\n")
9220 DEFUN (show_bgp_community_exact
,
9221 show_bgp_community_exact_cmd
,
9222 "show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
9225 "Display routes matching the communities\n"
9226 "community number\n"
9227 "Do not send outside local AS (well-known community)\n"
9228 "Do not advertise to any peer (well-known community)\n"
9229 "Do not export to next AS (well-known community)\n"
9230 "Exact match of the communities")
9232 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
9235 ALIAS (show_bgp_community_exact
,
9236 show_bgp_ipv6_community_exact_cmd
,
9237 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match",
9241 "Display routes matching the communities\n"
9242 "community number\n"
9243 "Do not send outside local AS (well-known community)\n"
9244 "Do not advertise to any peer (well-known community)\n"
9245 "Do not export to next AS (well-known community)\n"
9246 "Exact match of the communities")
9248 ALIAS (show_bgp_community_exact
,
9249 show_bgp_community2_exact_cmd
,
9250 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9253 "Display routes matching the communities\n"
9254 "community number\n"
9255 "Do not send outside local AS (well-known community)\n"
9256 "Do not advertise to any peer (well-known community)\n"
9257 "Do not export to next AS (well-known community)\n"
9258 "community number\n"
9259 "Do not send outside local AS (well-known community)\n"
9260 "Do not advertise to any peer (well-known community)\n"
9261 "Do not export to next AS (well-known community)\n"
9262 "Exact match of the communities")
9264 ALIAS (show_bgp_community_exact
,
9265 show_bgp_ipv6_community2_exact_cmd
,
9266 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9270 "Display routes matching the communities\n"
9271 "community number\n"
9272 "Do not send outside local AS (well-known community)\n"
9273 "Do not advertise to any peer (well-known community)\n"
9274 "Do not export to next AS (well-known community)\n"
9275 "community number\n"
9276 "Do not send outside local AS (well-known community)\n"
9277 "Do not advertise to any peer (well-known community)\n"
9278 "Do not export to next AS (well-known community)\n"
9279 "Exact match of the communities")
9281 ALIAS (show_bgp_community_exact
,
9282 show_bgp_community3_exact_cmd
,
9283 "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",
9286 "Display routes matching the communities\n"
9287 "community number\n"
9288 "Do not send outside local AS (well-known community)\n"
9289 "Do not advertise to any peer (well-known community)\n"
9290 "Do not export to next AS (well-known community)\n"
9291 "community number\n"
9292 "Do not send outside local AS (well-known community)\n"
9293 "Do not advertise to any peer (well-known community)\n"
9294 "Do not export to next AS (well-known community)\n"
9295 "community number\n"
9296 "Do not send outside local AS (well-known community)\n"
9297 "Do not advertise to any peer (well-known community)\n"
9298 "Do not export to next AS (well-known community)\n"
9299 "Exact match of the communities")
9301 ALIAS (show_bgp_community_exact
,
9302 show_bgp_ipv6_community3_exact_cmd
,
9303 "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",
9307 "Display routes matching the communities\n"
9308 "community number\n"
9309 "Do not send outside local AS (well-known community)\n"
9310 "Do not advertise to any peer (well-known community)\n"
9311 "Do not export to next AS (well-known community)\n"
9312 "community number\n"
9313 "Do not send outside local AS (well-known community)\n"
9314 "Do not advertise to any peer (well-known community)\n"
9315 "Do not export to next AS (well-known community)\n"
9316 "community number\n"
9317 "Do not send outside local AS (well-known community)\n"
9318 "Do not advertise to any peer (well-known community)\n"
9319 "Do not export to next AS (well-known community)\n"
9320 "Exact match of the communities")
9322 ALIAS (show_bgp_community_exact
,
9323 show_bgp_community4_exact_cmd
,
9324 "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",
9327 "Display routes matching the communities\n"
9328 "community number\n"
9329 "Do not send outside local AS (well-known community)\n"
9330 "Do not advertise to any peer (well-known community)\n"
9331 "Do not export to next AS (well-known community)\n"
9332 "community number\n"
9333 "Do not send outside local AS (well-known community)\n"
9334 "Do not advertise to any peer (well-known community)\n"
9335 "Do not export to next AS (well-known community)\n"
9336 "community number\n"
9337 "Do not send outside local AS (well-known community)\n"
9338 "Do not advertise to any peer (well-known community)\n"
9339 "Do not export to next AS (well-known community)\n"
9340 "community number\n"
9341 "Do not send outside local AS (well-known community)\n"
9342 "Do not advertise to any peer (well-known community)\n"
9343 "Do not export to next AS (well-known community)\n"
9344 "Exact match of the communities")
9346 ALIAS (show_bgp_community_exact
,
9347 show_bgp_ipv6_community4_exact_cmd
,
9348 "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",
9352 "Display routes matching the communities\n"
9353 "community number\n"
9354 "Do not send outside local AS (well-known community)\n"
9355 "Do not advertise to any peer (well-known community)\n"
9356 "Do not export to next AS (well-known community)\n"
9357 "community number\n"
9358 "Do not send outside local AS (well-known community)\n"
9359 "Do not advertise to any peer (well-known community)\n"
9360 "Do not export to next AS (well-known community)\n"
9361 "community number\n"
9362 "Do not send outside local AS (well-known community)\n"
9363 "Do not advertise to any peer (well-known community)\n"
9364 "Do not export to next AS (well-known community)\n"
9365 "community number\n"
9366 "Do not send outside local AS (well-known community)\n"
9367 "Do not advertise to any peer (well-known community)\n"
9368 "Do not export to next AS (well-known community)\n"
9369 "Exact match of the communities")
9372 DEFUN (show_ipv6_bgp_community_exact
,
9373 show_ipv6_bgp_community_exact_cmd
,
9374 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
9378 "Display routes matching the communities\n"
9379 "community number\n"
9380 "Do not send outside local AS (well-known community)\n"
9381 "Do not advertise to any peer (well-known community)\n"
9382 "Do not export to next AS (well-known community)\n"
9383 "Exact match of the communities")
9385 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
9389 ALIAS (show_ipv6_bgp_community_exact
,
9390 show_ipv6_bgp_community2_exact_cmd
,
9391 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9395 "Display routes matching the communities\n"
9396 "community number\n"
9397 "Do not send outside local AS (well-known community)\n"
9398 "Do not advertise to any peer (well-known community)\n"
9399 "Do not export to next AS (well-known community)\n"
9400 "community number\n"
9401 "Do not send outside local AS (well-known community)\n"
9402 "Do not advertise to any peer (well-known community)\n"
9403 "Do not export to next AS (well-known community)\n"
9404 "Exact match of the communities")
9407 ALIAS (show_ipv6_bgp_community_exact
,
9408 show_ipv6_bgp_community3_exact_cmd
,
9409 "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",
9413 "Display routes matching the communities\n"
9414 "community number\n"
9415 "Do not send outside local AS (well-known community)\n"
9416 "Do not advertise to any peer (well-known community)\n"
9417 "Do not export to next AS (well-known community)\n"
9418 "community number\n"
9419 "Do not send outside local AS (well-known community)\n"
9420 "Do not advertise to any peer (well-known community)\n"
9421 "Do not export to next AS (well-known community)\n"
9422 "community number\n"
9423 "Do not send outside local AS (well-known community)\n"
9424 "Do not advertise to any peer (well-known community)\n"
9425 "Do not export to next AS (well-known community)\n"
9426 "Exact match of the communities")
9429 ALIAS (show_ipv6_bgp_community_exact
,
9430 show_ipv6_bgp_community4_exact_cmd
,
9431 "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",
9435 "Display routes matching the communities\n"
9436 "community number\n"
9437 "Do not send outside local AS (well-known community)\n"
9438 "Do not advertise to any peer (well-known community)\n"
9439 "Do not export to next AS (well-known community)\n"
9440 "community number\n"
9441 "Do not send outside local AS (well-known community)\n"
9442 "Do not advertise to any peer (well-known community)\n"
9443 "Do not export to next AS (well-known community)\n"
9444 "community number\n"
9445 "Do not send outside local AS (well-known community)\n"
9446 "Do not advertise to any peer (well-known community)\n"
9447 "Do not export to next AS (well-known community)\n"
9448 "community number\n"
9449 "Do not send outside local AS (well-known community)\n"
9450 "Do not advertise to any peer (well-known community)\n"
9451 "Do not export to next AS (well-known community)\n"
9452 "Exact match of the communities")
9455 DEFUN (show_ipv6_mbgp_community
,
9456 show_ipv6_mbgp_community_cmd
,
9457 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export)",
9461 "Display routes matching the communities\n"
9462 "community number\n"
9463 "Do not send outside local AS (well-known community)\n"
9464 "Do not advertise to any peer (well-known community)\n"
9465 "Do not export to next AS (well-known community)\n")
9467 return bgp_show_community (vty
, NULL
, argc
, argv
, 0, AFI_IP6
, SAFI_MULTICAST
);
9471 ALIAS (show_ipv6_mbgp_community
,
9472 show_ipv6_mbgp_community2_cmd
,
9473 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
9477 "Display routes matching the communities\n"
9478 "community number\n"
9479 "Do not send outside local AS (well-known community)\n"
9480 "Do not advertise to any peer (well-known community)\n"
9481 "Do not export to next AS (well-known community)\n"
9482 "community number\n"
9483 "Do not send outside local AS (well-known community)\n"
9484 "Do not advertise to any peer (well-known community)\n"
9485 "Do not export to next AS (well-known community)\n")
9488 ALIAS (show_ipv6_mbgp_community
,
9489 show_ipv6_mbgp_community3_cmd
,
9490 "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)",
9494 "Display routes matching the communities\n"
9495 "community number\n"
9496 "Do not send outside local AS (well-known community)\n"
9497 "Do not advertise to any peer (well-known community)\n"
9498 "Do not export to next AS (well-known community)\n"
9499 "community number\n"
9500 "Do not send outside local AS (well-known community)\n"
9501 "Do not advertise to any peer (well-known community)\n"
9502 "Do not export to next AS (well-known community)\n"
9503 "community number\n"
9504 "Do not send outside local AS (well-known community)\n"
9505 "Do not advertise to any peer (well-known community)\n"
9506 "Do not export to next AS (well-known community)\n")
9509 ALIAS (show_ipv6_mbgp_community
,
9510 show_ipv6_mbgp_community4_cmd
,
9511 "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)",
9515 "Display routes matching the communities\n"
9516 "community number\n"
9517 "Do not send outside local AS (well-known community)\n"
9518 "Do not advertise to any peer (well-known community)\n"
9519 "Do not export to next AS (well-known community)\n"
9520 "community number\n"
9521 "Do not send outside local AS (well-known community)\n"
9522 "Do not advertise to any peer (well-known community)\n"
9523 "Do not export to next AS (well-known community)\n"
9524 "community number\n"
9525 "Do not send outside local AS (well-known community)\n"
9526 "Do not advertise to any peer (well-known community)\n"
9527 "Do not export to next AS (well-known community)\n"
9528 "community number\n"
9529 "Do not send outside local AS (well-known community)\n"
9530 "Do not advertise to any peer (well-known community)\n"
9531 "Do not export to next AS (well-known community)\n")
9534 DEFUN (show_ipv6_mbgp_community_exact
,
9535 show_ipv6_mbgp_community_exact_cmd
,
9536 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
9540 "Display routes matching the communities\n"
9541 "community number\n"
9542 "Do not send outside local AS (well-known community)\n"
9543 "Do not advertise to any peer (well-known community)\n"
9544 "Do not export to next AS (well-known community)\n"
9545 "Exact match of the communities")
9547 return bgp_show_community (vty
, NULL
, argc
, argv
, 1, AFI_IP6
, SAFI_MULTICAST
);
9551 ALIAS (show_ipv6_mbgp_community_exact
,
9552 show_ipv6_mbgp_community2_exact_cmd
,
9553 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
9557 "Display routes matching the communities\n"
9558 "community number\n"
9559 "Do not send outside local AS (well-known community)\n"
9560 "Do not advertise to any peer (well-known community)\n"
9561 "Do not export to next AS (well-known community)\n"
9562 "community number\n"
9563 "Do not send outside local AS (well-known community)\n"
9564 "Do not advertise to any peer (well-known community)\n"
9565 "Do not export to next AS (well-known community)\n"
9566 "Exact match of the communities")
9569 ALIAS (show_ipv6_mbgp_community_exact
,
9570 show_ipv6_mbgp_community3_exact_cmd
,
9571 "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",
9575 "Display routes matching the communities\n"
9576 "community number\n"
9577 "Do not send outside local AS (well-known community)\n"
9578 "Do not advertise to any peer (well-known community)\n"
9579 "Do not export to next AS (well-known community)\n"
9580 "community number\n"
9581 "Do not send outside local AS (well-known community)\n"
9582 "Do not advertise to any peer (well-known community)\n"
9583 "Do not export to next AS (well-known community)\n"
9584 "community number\n"
9585 "Do not send outside local AS (well-known community)\n"
9586 "Do not advertise to any peer (well-known community)\n"
9587 "Do not export to next AS (well-known community)\n"
9588 "Exact match of the communities")
9591 ALIAS (show_ipv6_mbgp_community_exact
,
9592 show_ipv6_mbgp_community4_exact_cmd
,
9593 "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",
9597 "Display routes matching the communities\n"
9598 "community number\n"
9599 "Do not send outside local AS (well-known community)\n"
9600 "Do not advertise to any peer (well-known community)\n"
9601 "Do not export to next AS (well-known community)\n"
9602 "community number\n"
9603 "Do not send outside local AS (well-known community)\n"
9604 "Do not advertise to any peer (well-known community)\n"
9605 "Do not export to next AS (well-known community)\n"
9606 "community number\n"
9607 "Do not send outside local AS (well-known community)\n"
9608 "Do not advertise to any peer (well-known community)\n"
9609 "Do not export to next AS (well-known community)\n"
9610 "community number\n"
9611 "Do not send outside local AS (well-known community)\n"
9612 "Do not advertise to any peer (well-known community)\n"
9613 "Do not export to next AS (well-known community)\n"
9614 "Exact match of the communities")
9615 #endif /* HAVE_IPV6 */
9618 bgp_show_community_list (struct vty
*vty
, const char *com
, int exact
,
9619 afi_t afi
, safi_t safi
)
9621 struct community_list
*list
;
9623 list
= community_list_lookup (bgp_clist
, com
, COMMUNITY_LIST_MASTER
);
9626 vty_out (vty
, "%% %s is not a valid community-list name%s", com
,
9631 return bgp_show (vty
, NULL
, afi
, safi
,
9632 (exact
? bgp_show_type_community_list_exact
:
9633 bgp_show_type_community_list
), list
, NULL
);
9636 DEFUN (show_ip_bgp_community_list
,
9637 show_ip_bgp_community_list_cmd
,
9638 "show ip bgp community-list (<1-500>|WORD)",
9642 "Display routes matching the community-list\n"
9643 "community-list number\n"
9644 "community-list name\n")
9646 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP
, SAFI_UNICAST
);
9649 DEFUN (show_ip_bgp_ipv4_community_list
,
9650 show_ip_bgp_ipv4_community_list_cmd
,
9651 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)",
9656 "Address Family modifier\n"
9657 "Address Family modifier\n"
9658 "Display routes matching the community-list\n"
9659 "community-list number\n"
9660 "community-list name\n")
9662 if (strncmp (argv
[0], "m", 1) == 0)
9663 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_MULTICAST
);
9665 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_UNICAST
);
9668 DEFUN (show_ip_bgp_community_list_exact
,
9669 show_ip_bgp_community_list_exact_cmd
,
9670 "show ip bgp community-list (<1-500>|WORD) exact-match",
9674 "Display routes matching the community-list\n"
9675 "community-list number\n"
9676 "community-list name\n"
9677 "Exact match of the communities\n")
9679 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP
, SAFI_UNICAST
);
9682 DEFUN (show_ip_bgp_ipv4_community_list_exact
,
9683 show_ip_bgp_ipv4_community_list_exact_cmd
,
9684 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match",
9689 "Address Family modifier\n"
9690 "Address Family modifier\n"
9691 "Display routes matching the community-list\n"
9692 "community-list number\n"
9693 "community-list name\n"
9694 "Exact match of the communities\n")
9696 if (strncmp (argv
[0], "m", 1) == 0)
9697 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_MULTICAST
);
9699 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_UNICAST
);
9703 DEFUN (show_bgp_community_list
,
9704 show_bgp_community_list_cmd
,
9705 "show bgp community-list (<1-500>|WORD)",
9708 "Display routes matching the community-list\n"
9709 "community-list number\n"
9710 "community-list name\n")
9712 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
9715 ALIAS (show_bgp_community_list
,
9716 show_bgp_ipv6_community_list_cmd
,
9717 "show bgp ipv6 community-list (<1-500>|WORD)",
9721 "Display routes matching the community-list\n"
9722 "community-list number\n"
9723 "community-list name\n")
9726 DEFUN (show_ipv6_bgp_community_list
,
9727 show_ipv6_bgp_community_list_cmd
,
9728 "show ipv6 bgp community-list WORD",
9732 "Display routes matching the community-list\n"
9733 "community-list name\n")
9735 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
9739 DEFUN (show_ipv6_mbgp_community_list
,
9740 show_ipv6_mbgp_community_list_cmd
,
9741 "show ipv6 mbgp community-list WORD",
9745 "Display routes matching the community-list\n"
9746 "community-list name\n")
9748 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_MULTICAST
);
9751 DEFUN (show_bgp_community_list_exact
,
9752 show_bgp_community_list_exact_cmd
,
9753 "show bgp community-list (<1-500>|WORD) exact-match",
9756 "Display routes matching the community-list\n"
9757 "community-list number\n"
9758 "community-list name\n"
9759 "Exact match of the communities\n")
9761 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
9764 ALIAS (show_bgp_community_list_exact
,
9765 show_bgp_ipv6_community_list_exact_cmd
,
9766 "show bgp ipv6 community-list (<1-500>|WORD) exact-match",
9770 "Display routes matching the community-list\n"
9771 "community-list number\n"
9772 "community-list name\n"
9773 "Exact match of the communities\n")
9776 DEFUN (show_ipv6_bgp_community_list_exact
,
9777 show_ipv6_bgp_community_list_exact_cmd
,
9778 "show ipv6 bgp community-list WORD exact-match",
9782 "Display routes matching the community-list\n"
9783 "community-list name\n"
9784 "Exact match of the communities\n")
9786 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
9790 DEFUN (show_ipv6_mbgp_community_list_exact
,
9791 show_ipv6_mbgp_community_list_exact_cmd
,
9792 "show ipv6 mbgp community-list WORD exact-match",
9796 "Display routes matching the community-list\n"
9797 "community-list name\n"
9798 "Exact match of the communities\n")
9800 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_MULTICAST
);
9802 #endif /* HAVE_IPV6 */
9805 bgp_show_prefix_longer (struct vty
*vty
, const char *prefix
, afi_t afi
,
9806 safi_t safi
, enum bgp_show_type type
)
9813 ret
= str2prefix (prefix
, p
);
9816 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
9820 ret
= bgp_show (vty
, NULL
, afi
, safi
, type
, p
, NULL
);
9825 DEFUN (show_ip_bgp_prefix_longer
,
9826 show_ip_bgp_prefix_longer_cmd
,
9827 "show ip bgp A.B.C.D/M longer-prefixes",
9831 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
9832 "Display route and more specific routes\n")
9834 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
9835 bgp_show_type_prefix_longer
);
9838 DEFUN (show_ip_bgp_flap_prefix_longer
,
9839 show_ip_bgp_flap_prefix_longer_cmd
,
9840 "show ip bgp flap-statistics A.B.C.D/M longer-prefixes",
9844 "Display flap statistics of routes\n"
9845 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
9846 "Display route and more specific routes\n")
9848 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
9849 bgp_show_type_flap_prefix_longer
);
9852 DEFUN (show_ip_bgp_ipv4_prefix_longer
,
9853 show_ip_bgp_ipv4_prefix_longer_cmd
,
9854 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes",
9859 "Address Family modifier\n"
9860 "Address Family modifier\n"
9861 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
9862 "Display route and more specific routes\n")
9864 if (strncmp (argv
[0], "m", 1) == 0)
9865 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
9866 bgp_show_type_prefix_longer
);
9868 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
9869 bgp_show_type_prefix_longer
);
9872 DEFUN (show_ip_bgp_flap_address
,
9873 show_ip_bgp_flap_address_cmd
,
9874 "show ip bgp flap-statistics A.B.C.D",
9878 "Display flap statistics of routes\n"
9879 "Network in the BGP routing table to display\n")
9881 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
9882 bgp_show_type_flap_address
);
9885 DEFUN (show_ip_bgp_flap_prefix
,
9886 show_ip_bgp_flap_prefix_cmd
,
9887 "show ip bgp flap-statistics A.B.C.D/M",
9891 "Display flap statistics of routes\n"
9892 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
9894 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
9895 bgp_show_type_flap_prefix
);
9898 DEFUN (show_bgp_prefix_longer
,
9899 show_bgp_prefix_longer_cmd
,
9900 "show bgp X:X::X:X/M longer-prefixes",
9903 "IPv6 prefix <network>/<length>\n"
9904 "Display route and more specific routes\n")
9906 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
9907 bgp_show_type_prefix_longer
);
9910 ALIAS (show_bgp_prefix_longer
,
9911 show_bgp_ipv6_prefix_longer_cmd
,
9912 "show bgp ipv6 X:X::X:X/M longer-prefixes",
9916 "IPv6 prefix <network>/<length>\n"
9917 "Display route and more specific routes\n")
9920 DEFUN (show_ipv6_bgp_prefix_longer
,
9921 show_ipv6_bgp_prefix_longer_cmd
,
9922 "show ipv6 bgp X:X::X:X/M longer-prefixes",
9926 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
9927 "Display route and more specific routes\n")
9929 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
9930 bgp_show_type_prefix_longer
);
9934 DEFUN (show_ipv6_mbgp_prefix_longer
,
9935 show_ipv6_mbgp_prefix_longer_cmd
,
9936 "show ipv6 mbgp X:X::X:X/M longer-prefixes",
9940 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
9941 "Display route and more specific routes\n")
9943 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
9944 bgp_show_type_prefix_longer
);
9946 #endif /* HAVE_IPV6 */
9948 static struct peer
*
9949 peer_lookup_in_view (struct vty
*vty
, const char *view_name
,
9957 /* BGP structure lookup. */
9960 bgp
= bgp_lookup_by_name (view_name
);
9963 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
9969 bgp
= bgp_get_default ();
9972 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
9977 /* Get peer sockunion. */
9978 ret
= str2sockunion (ip_str
, &su
);
9981 peer
= peer_lookup_by_conf_if (bgp
, ip_str
);
9984 vty_out (vty
, "%% Malformed address or name: %s%s", ip_str
, VTY_NEWLINE
);
9990 /* Peer structure lookup. */
9991 peer
= peer_lookup (bgp
, &su
);
9994 vty_out (vty
, "No such neighbor%s", VTY_NEWLINE
);
10003 BGP_STATS_MAXBITLEN
= 0,
10005 BGP_STATS_PREFIXES
,
10007 BGP_STATS_UNAGGREGATEABLE
,
10008 BGP_STATS_MAX_AGGREGATEABLE
,
10009 BGP_STATS_AGGREGATES
,
10011 BGP_STATS_ASPATH_COUNT
,
10012 BGP_STATS_ASPATH_MAXHOPS
,
10013 BGP_STATS_ASPATH_TOTHOPS
,
10014 BGP_STATS_ASPATH_MAXSIZE
,
10015 BGP_STATS_ASPATH_TOTSIZE
,
10016 BGP_STATS_ASN_HIGHEST
,
10020 static const char *table_stats_strs
[] =
10022 [BGP_STATS_PREFIXES
] = "Total Prefixes",
10023 [BGP_STATS_TOTPLEN
] = "Average prefix length",
10024 [BGP_STATS_RIB
] = "Total Advertisements",
10025 [BGP_STATS_UNAGGREGATEABLE
] = "Unaggregateable prefixes",
10026 [BGP_STATS_MAX_AGGREGATEABLE
] = "Maximum aggregateable prefixes",
10027 [BGP_STATS_AGGREGATES
] = "BGP Aggregate advertisements",
10028 [BGP_STATS_SPACE
] = "Address space advertised",
10029 [BGP_STATS_ASPATH_COUNT
] = "Advertisements with paths",
10030 [BGP_STATS_ASPATH_MAXHOPS
] = "Longest AS-Path (hops)",
10031 [BGP_STATS_ASPATH_MAXSIZE
] = "Largest AS-Path (bytes)",
10032 [BGP_STATS_ASPATH_TOTHOPS
] = "Average AS-Path length (hops)",
10033 [BGP_STATS_ASPATH_TOTSIZE
] = "Average AS-Path size (bytes)",
10034 [BGP_STATS_ASN_HIGHEST
] = "Highest public ASN",
10035 [BGP_STATS_MAX
] = NULL
,
10038 struct bgp_table_stats
10040 struct bgp_table
*table
;
10041 unsigned long long counts
[BGP_STATS_MAX
];
10045 #define TALLY_SIGFIG 100000
10046 static unsigned long
10047 ravg_tally (unsigned long count
, unsigned long oldavg
, unsigned long newval
)
10049 unsigned long newtot
= (count
-1) * oldavg
+ (newval
* TALLY_SIGFIG
);
10050 unsigned long res
= (newtot
* TALLY_SIGFIG
) / count
;
10051 unsigned long ret
= newtot
/ count
;
10053 if ((res
% TALLY_SIGFIG
) > (TALLY_SIGFIG
/2))
10061 bgp_table_stats_walker (struct thread
*t
)
10063 struct bgp_node
*rn
;
10064 struct bgp_node
*top
;
10065 struct bgp_table_stats
*ts
= THREAD_ARG (t
);
10066 unsigned int space
= 0;
10068 if (!(top
= bgp_table_top (ts
->table
)))
10071 switch (top
->p
.family
)
10074 space
= IPV4_MAX_BITLEN
;
10077 space
= IPV6_MAX_BITLEN
;
10081 ts
->counts
[BGP_STATS_MAXBITLEN
] = space
;
10083 for (rn
= top
; rn
; rn
= bgp_route_next (rn
))
10085 struct bgp_info
*ri
;
10086 struct bgp_node
*prn
= bgp_node_parent_nolock (rn
);
10087 unsigned int rinum
= 0;
10095 ts
->counts
[BGP_STATS_PREFIXES
]++;
10096 ts
->counts
[BGP_STATS_TOTPLEN
] += rn
->p
.prefixlen
;
10099 ts
->counts
[BGP_STATS_AVGPLEN
]
10100 = ravg_tally (ts
->counts
[BGP_STATS_PREFIXES
],
10101 ts
->counts
[BGP_STATS_AVGPLEN
],
10105 /* check if the prefix is included by any other announcements */
10106 while (prn
&& !prn
->info
)
10107 prn
= bgp_node_parent_nolock (prn
);
10109 if (prn
== NULL
|| prn
== top
)
10111 ts
->counts
[BGP_STATS_UNAGGREGATEABLE
]++;
10112 /* announced address space */
10114 ts
->counts
[BGP_STATS_SPACE
] += 1 << (space
- rn
->p
.prefixlen
);
10116 else if (prn
->info
)
10117 ts
->counts
[BGP_STATS_MAX_AGGREGATEABLE
]++;
10119 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
10122 ts
->counts
[BGP_STATS_RIB
]++;
10125 (CHECK_FLAG (ri
->attr
->flag
,
10126 ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
))))
10127 ts
->counts
[BGP_STATS_AGGREGATES
]++;
10129 /* as-path stats */
10130 if (ri
->attr
&& ri
->attr
->aspath
)
10132 unsigned int hops
= aspath_count_hops (ri
->attr
->aspath
);
10133 unsigned int size
= aspath_size (ri
->attr
->aspath
);
10134 as_t highest
= aspath_highest (ri
->attr
->aspath
);
10136 ts
->counts
[BGP_STATS_ASPATH_COUNT
]++;
10138 if (hops
> ts
->counts
[BGP_STATS_ASPATH_MAXHOPS
])
10139 ts
->counts
[BGP_STATS_ASPATH_MAXHOPS
] = hops
;
10141 if (size
> ts
->counts
[BGP_STATS_ASPATH_MAXSIZE
])
10142 ts
->counts
[BGP_STATS_ASPATH_MAXSIZE
] = size
;
10144 ts
->counts
[BGP_STATS_ASPATH_TOTHOPS
] += hops
;
10145 ts
->counts
[BGP_STATS_ASPATH_TOTSIZE
] += size
;
10147 ts
->counts
[BGP_STATS_ASPATH_AVGHOPS
]
10148 = ravg_tally (ts
->counts
[BGP_STATS_ASPATH_COUNT
],
10149 ts
->counts
[BGP_STATS_ASPATH_AVGHOPS
],
10151 ts
->counts
[BGP_STATS_ASPATH_AVGSIZE
]
10152 = ravg_tally (ts
->counts
[BGP_STATS_ASPATH_COUNT
],
10153 ts
->counts
[BGP_STATS_ASPATH_AVGSIZE
],
10156 if (highest
> ts
->counts
[BGP_STATS_ASN_HIGHEST
])
10157 ts
->counts
[BGP_STATS_ASN_HIGHEST
] = highest
;
10165 bgp_table_stats (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
)
10167 struct bgp_table_stats ts
;
10170 if (!bgp
->rib
[afi
][safi
])
10172 vty_out (vty
, "%% No RIB exist for the AFI/SAFI%s", VTY_NEWLINE
);
10173 return CMD_WARNING
;
10176 memset (&ts
, 0, sizeof (ts
));
10177 ts
.table
= bgp
->rib
[afi
][safi
];
10178 thread_execute (bm
->master
, bgp_table_stats_walker
, &ts
, 0);
10180 vty_out (vty
, "BGP %s RIB statistics%s%s",
10181 afi_safi_print (afi
, safi
), VTY_NEWLINE
, VTY_NEWLINE
);
10183 for (i
= 0; i
< BGP_STATS_MAX
; i
++)
10185 if (!table_stats_strs
[i
])
10191 case BGP_STATS_ASPATH_AVGHOPS
:
10192 case BGP_STATS_ASPATH_AVGSIZE
:
10193 case BGP_STATS_AVGPLEN
:
10194 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
10195 vty_out (vty
, "%12.2f",
10196 (float)ts
.counts
[i
] / (float)TALLY_SIGFIG
);
10199 case BGP_STATS_ASPATH_TOTHOPS
:
10200 case BGP_STATS_ASPATH_TOTSIZE
:
10201 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
10202 vty_out (vty
, "%12.2f",
10204 (float)ts
.counts
[i
] /
10205 (float)ts
.counts
[BGP_STATS_ASPATH_COUNT
]
10208 case BGP_STATS_TOTPLEN
:
10209 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
10210 vty_out (vty
, "%12.2f",
10212 (float)ts
.counts
[i
] /
10213 (float)ts
.counts
[BGP_STATS_PREFIXES
]
10216 case BGP_STATS_SPACE
:
10217 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
10218 vty_out (vty
, "%12llu%s", ts
.counts
[i
], VTY_NEWLINE
);
10219 if (ts
.counts
[BGP_STATS_MAXBITLEN
] < 9)
10221 vty_out (vty
, "%30s: ", "%% announced ");
10222 vty_out (vty
, "%12.2f%s",
10223 100 * (float)ts
.counts
[BGP_STATS_SPACE
] /
10224 (float)((uint64_t)1UL << ts
.counts
[BGP_STATS_MAXBITLEN
]),
10226 vty_out (vty
, "%30s: ", "/8 equivalent ");
10227 vty_out (vty
, "%12.2f%s",
10228 (float)ts
.counts
[BGP_STATS_SPACE
] /
10229 (float)(1UL << (ts
.counts
[BGP_STATS_MAXBITLEN
] - 8)),
10231 if (ts
.counts
[BGP_STATS_MAXBITLEN
] < 25)
10233 vty_out (vty
, "%30s: ", "/24 equivalent ");
10234 vty_out (vty
, "%12.2f",
10235 (float)ts
.counts
[BGP_STATS_SPACE
] /
10236 (float)(1UL << (ts
.counts
[BGP_STATS_MAXBITLEN
] - 24)));
10239 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
10240 vty_out (vty
, "%12llu", ts
.counts
[i
]);
10243 vty_out (vty
, "%s", VTY_NEWLINE
);
10245 return CMD_SUCCESS
;
10249 bgp_table_stats_vty (struct vty
*vty
, const char *name
,
10250 const char *afi_str
, const char *safi_str
)
10257 bgp
= bgp_lookup_by_name (name
);
10259 bgp
= bgp_get_default ();
10263 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
10264 return CMD_WARNING
;
10266 if (strncmp (afi_str
, "ipv", 3) == 0)
10268 if (strncmp (afi_str
, "ipv4", 4) == 0)
10270 else if (strncmp (afi_str
, "ipv6", 4) == 0)
10274 vty_out (vty
, "%% Invalid address family %s%s",
10275 afi_str
, VTY_NEWLINE
);
10276 return CMD_WARNING
;
10278 if (strncmp (safi_str
, "m", 1) == 0)
10279 safi
= SAFI_MULTICAST
;
10280 else if (strncmp (safi_str
, "u", 1) == 0)
10281 safi
= SAFI_UNICAST
;
10282 else if (strncmp (safi_str
, "vpnv4", 5) == 0 || strncmp (safi_str
, "vpnv6", 5) == 0)
10283 safi
= SAFI_MPLS_LABELED_VPN
;
10286 vty_out (vty
, "%% Invalid subsequent address family %s%s",
10287 safi_str
, VTY_NEWLINE
);
10288 return CMD_WARNING
;
10293 vty_out (vty
, "%% Invalid address family %s%s",
10294 afi_str
, VTY_NEWLINE
);
10295 return CMD_WARNING
;
10298 return bgp_table_stats (vty
, bgp
, afi
, safi
);
10301 DEFUN (show_bgp_statistics
,
10302 show_bgp_statistics_cmd
,
10303 "show bgp (ipv4|ipv6) (unicast|multicast) statistics",
10308 "Address Family modifier\n"
10309 "Address Family modifier\n"
10310 "BGP RIB advertisement statistics\n")
10312 return bgp_table_stats_vty (vty
, NULL
, argv
[0], argv
[1]);
10315 ALIAS (show_bgp_statistics
,
10316 show_bgp_statistics_vpnv4_cmd
,
10317 "show bgp (ipv4) (vpnv4) statistics",
10321 "Address Family modifier\n"
10322 "BGP RIB advertisement statistics\n")
10324 DEFUN (show_bgp_statistics_view
,
10325 show_bgp_statistics_view_cmd
,
10326 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) statistics",
10332 "Address Family modifier\n"
10333 "Address Family modifier\n"
10334 "BGP RIB advertisement statistics\n")
10336 return bgp_table_stats_vty (vty
, NULL
, argv
[0], argv
[1]);
10339 ALIAS (show_bgp_statistics_view
,
10340 show_bgp_statistics_view_vpnv4_cmd
,
10341 "show bgp view WORD (ipv4) (vpnv4) statistics",
10346 "Address Family modifier\n"
10347 "BGP RIB advertisement statistics\n")
10359 PCOUNT_PFCNT
, /* the figure we display to users */
10363 static const char *pcount_strs
[] =
10365 [PCOUNT_ADJ_IN
] = "Adj-in",
10366 [PCOUNT_DAMPED
] = "Damped",
10367 [PCOUNT_REMOVED
] = "Removed",
10368 [PCOUNT_HISTORY
] = "History",
10369 [PCOUNT_STALE
] = "Stale",
10370 [PCOUNT_VALID
] = "Valid",
10371 [PCOUNT_ALL
] = "All RIB",
10372 [PCOUNT_COUNTED
] = "PfxCt counted",
10373 [PCOUNT_PFCNT
] = "Useable",
10374 [PCOUNT_MAX
] = NULL
,
10377 struct peer_pcounts
10379 unsigned int count
[PCOUNT_MAX
];
10380 const struct peer
*peer
;
10381 const struct bgp_table
*table
;
10385 bgp_peer_count_walker (struct thread
*t
)
10387 struct bgp_node
*rn
;
10388 struct peer_pcounts
*pc
= THREAD_ARG (t
);
10389 const struct peer
*peer
= pc
->peer
;
10391 for (rn
= bgp_table_top (pc
->table
); rn
; rn
= bgp_route_next (rn
))
10393 struct bgp_adj_in
*ain
;
10394 struct bgp_info
*ri
;
10396 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
10397 if (ain
->peer
== peer
)
10398 pc
->count
[PCOUNT_ADJ_IN
]++;
10400 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
10402 char buf
[SU_ADDRSTRLEN
];
10404 if (ri
->peer
!= peer
)
10407 pc
->count
[PCOUNT_ALL
]++;
10409 if (CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
))
10410 pc
->count
[PCOUNT_DAMPED
]++;
10411 if (CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
10412 pc
->count
[PCOUNT_HISTORY
]++;
10413 if (CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
))
10414 pc
->count
[PCOUNT_REMOVED
]++;
10415 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
10416 pc
->count
[PCOUNT_STALE
]++;
10417 if (CHECK_FLAG (ri
->flags
, BGP_INFO_VALID
))
10418 pc
->count
[PCOUNT_VALID
]++;
10419 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
10420 pc
->count
[PCOUNT_PFCNT
]++;
10422 if (CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
10424 pc
->count
[PCOUNT_COUNTED
]++;
10425 if (CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
10426 zlog_warn ("%s [pcount] %s/%d is counted but flags 0x%x",
10428 inet_ntop(rn
->p
.family
, &rn
->p
.u
.prefix
,
10429 buf
, SU_ADDRSTRLEN
),
10435 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
10436 zlog_warn ("%s [pcount] %s/%d not counted but flags 0x%x",
10438 inet_ntop(rn
->p
.family
, &rn
->p
.u
.prefix
,
10439 buf
, SU_ADDRSTRLEN
),
10449 bgp_peer_counts (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
)
10451 struct peer_pcounts pcounts
= { .peer
= peer
};
10454 if (!peer
|| !peer
->bgp
|| !peer
->afc
[afi
][safi
]
10455 || !peer
->bgp
->rib
[afi
][safi
])
10457 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
10458 return CMD_WARNING
;
10461 memset (&pcounts
, 0, sizeof(pcounts
));
10462 pcounts
.peer
= peer
;
10463 pcounts
.table
= peer
->bgp
->rib
[afi
][safi
];
10465 /* in-place call via thread subsystem so as to record execution time
10466 * stats for the thread-walk (i.e. ensure this can't be blamed on
10467 * on just vty_read()).
10469 thread_execute (bm
->master
, bgp_peer_count_walker
, &pcounts
, 0);
10471 vty_out (vty
, "Prefix counts for %s, %s%s",
10472 peer
->host
, afi_safi_print (afi
, safi
), VTY_NEWLINE
);
10473 vty_out (vty
, "PfxCt: %ld%s", peer
->pcount
[afi
][safi
], VTY_NEWLINE
);
10474 vty_out (vty
, "%sCounts from RIB table walk:%s%s",
10475 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
10477 for (i
= 0; i
< PCOUNT_MAX
; i
++)
10478 vty_out (vty
, "%20s: %-10d%s",
10479 pcount_strs
[i
], pcounts
.count
[i
], VTY_NEWLINE
);
10481 if (pcounts
.count
[PCOUNT_PFCNT
] != peer
->pcount
[afi
][safi
])
10483 vty_out (vty
, "%s [pcount] PfxCt drift!%s",
10484 peer
->host
, VTY_NEWLINE
);
10485 vty_out (vty
, "Please report this bug, with the above command output%s",
10489 return CMD_SUCCESS
;
10492 DEFUN (show_ip_bgp_neighbor_prefix_counts
,
10493 show_ip_bgp_neighbor_prefix_counts_cmd
,
10494 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts",
10498 "Detailed information on TCP and BGP neighbor connections\n"
10499 "Neighbor to display information about\n"
10500 "Neighbor to display information about\n"
10501 "Neighbor on bgp configured interface\n"
10502 "Display detailed prefix count information\n")
10506 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10508 return CMD_WARNING
;
10510 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_UNICAST
);
10513 DEFUN (show_bgp_ipv6_neighbor_prefix_counts
,
10514 show_bgp_ipv6_neighbor_prefix_counts_cmd
,
10515 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts",
10519 "Detailed information on TCP and BGP neighbor connections\n"
10520 "Neighbor to display information about\n"
10521 "Neighbor to display information about\n"
10522 "Neighbor on bgp configured interface\n"
10523 "Display detailed prefix count information\n")
10527 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10529 return CMD_WARNING
;
10531 return bgp_peer_counts (vty
, peer
, AFI_IP6
, SAFI_UNICAST
);
10534 DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts
,
10535 show_ip_bgp_ipv4_neighbor_prefix_counts_cmd
,
10536 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts",
10541 "Address Family modifier\n"
10542 "Address Family modifier\n"
10543 "Detailed information on TCP and BGP neighbor connections\n"
10544 "Neighbor to display information about\n"
10545 "Neighbor to display information about\n"
10546 "Neighbor on bgp configured interface\n"
10547 "Display detailed prefix count information\n")
10551 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
10553 return CMD_WARNING
;
10555 if (strncmp (argv
[0], "m", 1) == 0)
10556 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_MULTICAST
);
10558 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_UNICAST
);
10561 DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts
,
10562 show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd
,
10563 "show ip bgp vpnv4 all neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts",
10568 "Address Family modifier\n"
10569 "Address Family modifier\n"
10570 "Detailed information on TCP and BGP neighbor connections\n"
10571 "Neighbor to display information about\n"
10572 "Neighbor to display information about\n"
10573 "Neighbor on bgp configured interface\n"
10574 "Display detailed prefix count information\n")
10578 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10580 return CMD_WARNING
;
10582 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_MPLS_VPN
);
10586 show_adj_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
,
10587 int in
, char *delim
, char *rmap_name
)
10589 struct bgp_table
*table
;
10590 struct bgp_adj_in
*ain
;
10591 struct bgp_adj_out
*adj
;
10592 unsigned long output_count
;
10593 unsigned long filtered_count
;
10594 struct bgp_node
*rn
;
10599 struct attr_extra extra
;
10610 table
= bgp
->rib
[afi
][safi
];
10612 output_count
= filtered_count
= 0;
10614 if (! in
&& CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
10615 PEER_STATUS_DEFAULT_ORIGINATE
))
10617 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
10618 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
10619 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
10621 vty_out (vty
, "Originating default network 0.0.0.0%s%s",
10622 VTY_NEWLINE
, VTY_NEWLINE
);
10626 attr
.extra
= &extra
;
10627 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
10630 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
10631 if (ain
->peer
== peer
)
10635 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
10636 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
10637 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
10643 vty_out (vty
, BGP_SHOW_HEADER_CSV
, VTY_NEWLINE
);
10645 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
10650 bgp_attr_dup(&attr
, ain
->attr
);
10651 if (bgp_input_modifier(peer
, &rn
->p
, &attr
, afi
,
10652 safi
, rmap_name
) != RMAP_DENY
)
10654 route_vty_out_tmp (vty
, &rn
->p
, &attr
, safi
, delim
);
10664 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
)
10665 if (adj
->peer
== peer
)
10669 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
10670 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
10671 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
10677 vty_out (vty
, BGP_SHOW_HEADER_CSV
, VTY_NEWLINE
);
10679 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
10684 if (!CHECK_FLAG(peer
->af_flags
[afi
][safi
],
10685 PEER_FLAG_REFLECTOR_CLIENT
)
10686 || bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
10689 bgp_attr_dup(&attr
, adj
->attr
);
10690 ret
= bgp_output_modifier(peer
, &rn
->p
, &attr
, afi
,
10696 if (ret
!= RMAP_DENY
)
10698 route_vty_out_tmp (vty
, &rn
->p
, &attr
, safi
, delim
);
10707 if (output_count
!= 0)
10708 vty_out (vty
, "%sTotal number of prefixes %ld%s",
10709 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
10713 peer_adj_routes (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
,
10714 int in
, char *delim
, char *rmap_name
)
10716 if (! peer
|| ! peer
->afc
[afi
][safi
])
10718 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
10719 return CMD_WARNING
;
10722 if (in
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
10724 vty_out (vty
, "%% Inbound soft reconfiguration not enabled%s",
10726 return CMD_WARNING
;
10729 if (!in
&& (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
)
10730 && !bgp_flag_check(peer
->bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
)))
10732 vty_out (vty
, "%% Cannot apply outgoing route-map on route-reflector clients%s",
10734 vty_out (vty
, "%% Enable bgp route-reflector allow-outbound-policy flag%s",
10736 return CMD_WARNING
;
10739 show_adj_route (vty
, peer
, afi
, safi
, in
, delim
, rmap_name
);
10741 return CMD_SUCCESS
;
10744 DEFUN (show_ip_bgp_view_neighbor_advertised_route
,
10745 show_ip_bgp_view_neighbor_advertised_route_cmd
,
10746 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10752 "Detailed information on TCP and BGP neighbor connections\n"
10753 "Neighbor to display information about\n"
10754 "Neighbor to display information about\n"
10755 "Display the routes advertised to a BGP neighbor\n")
10760 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10762 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10765 return CMD_WARNING
;
10767 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0, NULL
, NULL
);
10770 DEFUN (show_ip_bgp_neighbor_advertised_route
,
10771 show_ip_bgp_neighbor_advertised_route_cmd
,
10772 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10776 "Detailed information on TCP and BGP neighbor connections\n"
10777 "Neighbor to display information about\n"
10778 "Neighbor to display information about\n"
10779 "Neighbor on bgp configured interface\n"
10780 "Display the routes advertised to a BGP neighbor\n")
10784 char *rmap_name
= NULL
;
10786 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10789 return CMD_WARNING
;
10792 rmap_name
= argv
[1];
10794 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0, NULL
, rmap_name
);
10797 ALIAS (show_ip_bgp_neighbor_advertised_route
,
10798 show_ip_bgp_neighbor_advertised_route_rmap_cmd
,
10799 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD",
10803 "Detailed information on TCP and BGP neighbor connections\n"
10804 "Neighbor to display information about\n"
10805 "Neighbor to display information about\n"
10806 "Neighbor on bgp configured interface\n"
10807 "Display the routes advertised to a BGP neighbor\n")
10809 DEFUN (show_ip_bgp_neighbor_advertised_route_csv
,
10810 show_ip_bgp_neighbor_advertised_route_csv_cmd
,
10811 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
10817 "Detailed information on TCP and BGP neighbor connections\n"
10818 "Neighbor to display information about\n"
10819 "Neighbor to display information about\n"
10820 "Neighbor on bgp configured interface\n"
10821 "Display the routes advertised to a BGP neighbor\n")
10824 char *rmap_name
= NULL
;
10826 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10829 return CMD_WARNING
;
10832 rmap_name
= argv
[1];
10834 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0, &csv
, rmap_name
);
10837 ALIAS (show_ip_bgp_neighbor_advertised_route_csv
,
10838 show_ip_bgp_neighbor_advertised_route_csv_rmap_cmd
,
10839 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv route-map WORD",
10845 "Detailed information on TCP and BGP neighbor connections\n"
10846 "Neighbor to display information about\n"
10847 "Neighbor to display information about\n"
10848 "Neighbor on bgp configured interface\n"
10849 "Display the routes advertised to a BGP neighbor\n"
10850 "Apply this route-map to display what would've been advertised\n")
10852 DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route
,
10853 show_ip_bgp_ipv4_neighbor_advertised_route_cmd
,
10854 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10859 "Address Family modifier\n"
10860 "Address Family modifier\n"
10861 "Detailed information on TCP and BGP neighbor connections\n"
10862 "Neighbor to display information about\n"
10863 "Neighbor to display information about\n"
10864 "Neighbor on bgp configured interface\n"
10865 "Display the routes advertised to a BGP neighbor\n")
10868 char *rmap_name
= NULL
;
10870 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
10872 return CMD_WARNING
;
10875 rmap_name
= argv
[2];
10877 if (strncmp (argv
[0], "m", 1) == 0)
10878 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 0, NULL
, rmap_name
);
10880 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0, NULL
, rmap_name
);
10883 ALIAS (show_ip_bgp_ipv4_neighbor_advertised_route
,
10884 show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd
,
10885 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD",
10890 "Address Family modifier\n"
10891 "Address Family modifier\n"
10892 "Detailed information on TCP and BGP neighbor connections\n"
10893 "Neighbor to display information about\n"
10894 "Neighbor to display information about\n"
10895 "Neighbor on bgp configured interface\n"
10896 "Display the routes advertised to a BGP neighbor\n"
10897 "Route-map to control what is displayed\n")
10900 DEFUN (show_bgp_view_neighbor_advertised_route
,
10901 show_bgp_view_neighbor_advertised_route_cmd
,
10902 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10907 "Detailed information on TCP and BGP neighbor connections\n"
10908 "Neighbor to display information about\n"
10909 "Neighbor to display information about\n"
10910 "Neighbor on bgp configured interface\n"
10911 "Display the routes advertised to a BGP neighbor\n")
10916 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10918 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10921 return CMD_WARNING
;
10923 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0, NULL
, NULL
);
10926 ALIAS (show_bgp_view_neighbor_advertised_route
,
10927 show_bgp_view_ipv6_neighbor_advertised_route_cmd
,
10928 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10934 "Detailed information on TCP and BGP neighbor connections\n"
10935 "Neighbor to display information about\n"
10936 "Neighbor to display information about\n"
10937 "Neighbor on bgp configured interface\n"
10938 "Display the routes advertised to a BGP neighbor\n")
10940 DEFUN (show_bgp_view_neighbor_advertised_route_csv
,
10941 show_bgp_view_neighbor_advertised_route_csv_cmd
,
10942 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
10947 "Detailed information on TCP and BGP neighbor connections\n"
10948 "Neighbor to display information about\n"
10949 "Neighbor to display information about\n"
10950 "Neighbor on bgp configured interface\n"
10951 "Display the routes advertised to a BGP neighbor\n")
10956 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10958 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10961 return CMD_WARNING
;
10963 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0, &csv
, NULL
);
10966 ALIAS (show_bgp_view_neighbor_advertised_route_csv
,
10967 show_bgp_view_ipv6_neighbor_advertised_route_csv_cmd
,
10968 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
10974 "Detailed information on TCP and BGP neighbor connections\n"
10975 "Neighbor to display information about\n"
10976 "Neighbor to display information about\n"
10977 "Neighbor on bgp configured interface\n"
10978 "Display the routes advertised to a BGP neighbor\n")
10980 DEFUN (show_bgp_neighbor_advertised_route
,
10981 show_bgp_neighbor_advertised_route_cmd
,
10982 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
10985 "Detailed information on TCP and BGP neighbor connections\n"
10986 "Neighbor to display information about\n"
10987 "Neighbor to display information about\n"
10988 "Neighbor on bgp configured interface\n"
10989 "Display the routes advertised to a BGP neighbor\n")
10993 char *rmap_name
= NULL
;
10995 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10998 return CMD_WARNING
;
11001 rmap_name
= argv
[1];
11003 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0, NULL
, rmap_name
);
11006 ALIAS (show_bgp_neighbor_advertised_route
,
11007 show_bgp_neighbor_advertised_route_rmap_cmd
,
11008 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD",
11011 "Detailed information on TCP and BGP neighbor connections\n"
11012 "Neighbor to display information about\n"
11013 "Neighbor to display information about\n"
11014 "Neighbor on bgp configured interface\n"
11015 "Display the routes advertised to a BGP neighbor\n")
11017 ALIAS (show_bgp_neighbor_advertised_route
,
11018 show_bgp_ipv6_neighbor_advertised_route_cmd
,
11019 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
11023 "Detailed information on TCP and BGP neighbor connections\n"
11024 "Neighbor to display information about\n"
11025 "Neighbor to display information about\n"
11026 "Neighbor on bgp configured interface\n"
11027 "Display the routes advertised to a BGP neighbor\n")
11029 ALIAS (show_bgp_neighbor_advertised_route
,
11030 show_bgp_ipv6_neighbor_advertised_route_rmap_cmd
,
11031 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD",
11035 "Detailed information on TCP and BGP neighbor connections\n"
11036 "Neighbor to display information about\n"
11037 "Neighbor to display information about\n"
11038 "Neighbor on bgp configured interface\n"
11039 "Display the routes advertised to a BGP neighbor\n")
11041 DEFUN (show_bgp_neighbor_advertised_route_csv
,
11042 show_bgp_neighbor_advertised_route_csv_cmd
,
11043 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
11046 "Detailed information on TCP and BGP neighbor connections\n"
11047 "Neighbor to display information about\n"
11048 "Neighbor to display information about\n"
11049 "Neighbor on bgp configured interface\n"
11050 "Display the routes advertised to a BGP neighbor\n")
11053 char *rmap_name
= NULL
;
11055 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11058 return CMD_WARNING
;
11061 rmap_name
= argv
[1];
11063 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0, &csv
, rmap_name
);
11066 ALIAS (show_bgp_neighbor_advertised_route_csv
,
11067 show_bgp_neighbor_advertised_route_csv_rmap_cmd
,
11068 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv route-map WORD",
11071 "Detailed information on TCP and BGP neighbor connections\n"
11072 "Neighbor to display information about\n"
11073 "Neighbor to display information about\n"
11074 "Neighbor on bgp configured interface\n"
11075 "Display the routes advertised to a BGP neighbor\n")
11077 ALIAS (show_bgp_neighbor_advertised_route_csv
,
11078 show_bgp_ipv6_neighbor_advertised_route_csv_cmd
,
11079 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
11083 "Detailed information on TCP and BGP neighbor connections\n"
11084 "Neighbor to display information about\n"
11085 "Neighbor to display information about\n"
11086 "Neighbor on bgp configured interface\n"
11087 "Display the routes advertised to a BGP neighbor\n")
11089 ALIAS (show_bgp_neighbor_advertised_route_csv
,
11090 show_bgp_ipv6_neighbor_advertised_route_csv_rmap_cmd
,
11091 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv route-map WORD",
11095 "Detailed information on TCP and BGP neighbor connections\n"
11096 "Neighbor to display information about\n"
11097 "Neighbor to display information about\n"
11098 "Neighbor on bgp configured interface\n"
11099 "Display the routes advertised to a BGP neighbor\n")
11102 ALIAS (show_bgp_neighbor_advertised_route
,
11103 ipv6_bgp_neighbor_advertised_route_cmd
,
11104 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
11108 "Detailed information on TCP and BGP neighbor connections\n"
11109 "Neighbor to display information about\n"
11110 "Neighbor to display information about\n"
11111 "Neighbor on bgp configured interface\n"
11112 "Display the routes advertised to a BGP neighbor\n")
11115 DEFUN (ipv6_mbgp_neighbor_advertised_route
,
11116 ipv6_mbgp_neighbor_advertised_route_cmd
,
11117 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
11121 "Detailed information on TCP and BGP neighbor connections\n"
11122 "Neighbor to display information about\n"
11123 "Neighbor to display information about\n"
11124 "Neighbor on bgp configured interface\n"
11125 "Neighbor on bgp configured interface\n"
11126 "Display the routes advertised to a BGP neighbor\n")
11130 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11132 return CMD_WARNING
;
11134 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 0, NULL
, NULL
);
11136 #endif /* HAVE_IPV6 */
11138 DEFUN (show_bgp_view_neighbor_received_routes
,
11139 show_bgp_view_neighbor_received_routes_cmd
,
11140 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11145 "Detailed information on TCP and BGP neighbor connections\n"
11146 "Neighbor to display information about\n"
11147 "Neighbor to display information about\n"
11148 "Neighbor on bgp configured interface\n"
11149 "Display the received routes from neighbor\n")
11154 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11156 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11159 return CMD_WARNING
;
11161 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 1, NULL
, NULL
);
11164 DEFUN (show_ip_bgp_view_neighbor_received_routes
,
11165 show_ip_bgp_view_neighbor_received_routes_cmd
,
11166 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11172 "Detailed information on TCP and BGP neighbor connections\n"
11173 "Neighbor to display information about\n"
11174 "Neighbor to display information about\n"
11175 "Neighbor on bgp configured interface\n"
11176 "Display the received routes from neighbor\n")
11181 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11183 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11186 return CMD_WARNING
;
11188 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1, NULL
, NULL
);
11191 ALIAS (show_bgp_view_neighbor_received_routes
,
11192 show_bgp_view_ipv6_neighbor_received_routes_cmd
,
11193 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11199 "Detailed information on TCP and BGP neighbor connections\n"
11200 "Neighbor to display information about\n"
11201 "Neighbor to display information about\n"
11202 "Neighbor on bgp configured interface\n"
11203 "Display the received routes from neighbor\n")
11205 DEFUN (show_ip_bgp_neighbor_received_routes
,
11206 show_ip_bgp_neighbor_received_routes_cmd
,
11207 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11211 "Detailed information on TCP and BGP neighbor connections\n"
11212 "Neighbor to display information about\n"
11213 "Neighbor to display information about\n"
11214 "Neighbor on bgp configured interface\n"
11215 "Display the received routes from neighbor\n")
11219 char *rmap_name
= NULL
;
11221 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11224 return CMD_WARNING
;
11227 rmap_name
= argv
[1];
11229 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1, NULL
, rmap_name
);
11232 ALIAS (show_ip_bgp_neighbor_received_routes
,
11233 show_ip_bgp_neighbor_received_routes_rmap_cmd
,
11234 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD",
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 "Neighbor on bgp configured interface\n"
11242 "Display the received routes from neighbor\n")
11244 DEFUN (show_ip_bgp_ipv4_neighbor_received_routes
,
11245 show_ip_bgp_ipv4_neighbor_received_routes_cmd
,
11246 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11251 "Address Family modifier\n"
11252 "Address Family modifier\n"
11253 "Detailed information on TCP and BGP neighbor connections\n"
11254 "Neighbor to display information about\n"
11255 "Neighbor to display information about\n"
11256 "Neighbor on bgp configured interface\n"
11257 "Display the received routes from neighbor\n")
11260 char *rmap_name
= NULL
;
11262 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
11264 return CMD_WARNING
;
11267 rmap_name
= argv
[2];
11269 if (strncmp (argv
[0], "m", 1) == 0)
11270 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 1, NULL
, rmap_name
);
11272 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1, NULL
, rmap_name
);
11275 ALIAS (show_ip_bgp_ipv4_neighbor_received_routes
,
11276 show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd
,
11277 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD",
11282 "Address Family modifier\n"
11283 "Address Family modifier\n"
11284 "Detailed information on TCP and BGP neighbor connections\n"
11285 "Neighbor to display information about\n"
11286 "Neighbor to display information about\n"
11287 "Neighbor on bgp configured interface\n"
11288 "Display the received routes from neighbor\n")
11290 DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes
,
11291 show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd
,
11293 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes)",
11295 "show bgp view WORD ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes)",
11305 "Address family modifier\n"
11306 "Address family modifier\n"
11307 "Detailed information on TCP and BGP neighbor connections\n"
11308 "Neighbor to display information about\n"
11309 "Neighbor to display information about\n"
11310 "Neighbor on bgp configured interface\n"
11311 "Display the advertised routes to neighbor\n"
11312 "Display the received routes from neighbor\n")
11320 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[3]);
11322 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
11326 return CMD_WARNING
;
11329 afi
= (strncmp (argv
[1], "ipv6", 4) == 0) ? AFI_IP6
: AFI_IP
;
11330 safi
= (strncmp (argv
[2], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11331 in
= (strncmp (argv
[4], "r", 1) == 0) ? 1 : 0;
11334 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11335 in
= (strncmp (argv
[3], "r", 1) == 0) ? 1 : 0;
11338 return peer_adj_routes (vty
, peer
, afi
, safi
, in
, NULL
, NULL
);
11341 DEFUN (show_ip_bgp_neighbor_received_prefix_filter
,
11342 show_ip_bgp_neighbor_received_prefix_filter_cmd
,
11343 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
11347 "Detailed information on TCP and BGP neighbor connections\n"
11348 "Neighbor to display information about\n"
11349 "Neighbor to display information about\n"
11350 "Neighbor on bgp configured interface\n"
11351 "Display information received from a BGP neighbor\n"
11352 "Display the prefixlist filter\n")
11355 union sockunion su
;
11359 ret
= str2sockunion (argv
[0], &su
);
11362 peer
= peer_lookup_by_conf_if (NULL
, argv
[0]);
11365 vty_out (vty
, "Malformed address or name: %s%s", argv
[0], VTY_NEWLINE
);
11366 return CMD_WARNING
;
11371 peer
= peer_lookup (NULL
, &su
);
11373 return CMD_WARNING
;
11376 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
11377 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
11380 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
11381 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
11384 return CMD_SUCCESS
;
11387 DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter
,
11388 show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
,
11389 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
11394 "Address Family modifier\n"
11395 "Address Family modifier\n"
11396 "Detailed information on TCP and BGP neighbor connections\n"
11397 "Neighbor to display information about\n"
11398 "Neighbor to display information about\n"
11399 "Neighbor on bgp configured interface\n"
11400 "Display information received from a BGP neighbor\n"
11401 "Display the prefixlist filter\n")
11404 union sockunion su
;
11408 ret
= str2sockunion (argv
[1], &su
);
11411 peer
= peer_lookup_by_conf_if (NULL
, argv
[1]);
11414 vty_out (vty
, "Malformed address or name: %s%s", argv
[1], VTY_NEWLINE
);
11415 return CMD_WARNING
;
11420 peer
= peer_lookup (NULL
, &su
);
11422 return CMD_WARNING
;
11425 if (strncmp (argv
[0], "m", 1) == 0)
11427 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_MULTICAST
);
11428 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
11431 vty_out (vty
, "Address family: IPv4 Multicast%s", VTY_NEWLINE
);
11432 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
11437 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
11438 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
11441 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
11442 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
11446 return CMD_SUCCESS
;
11451 ALIAS (show_bgp_view_neighbor_received_routes
,
11452 show_bgp_neighbor_received_routes_cmd
,
11453 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11456 "Detailed information on TCP and BGP neighbor connections\n"
11457 "Neighbor to display information about\n"
11458 "Neighbor to display information about\n"
11459 "Neighbor on bgp configured interface\n"
11460 "Display the received routes from neighbor\n")
11462 ALIAS (show_bgp_view_neighbor_received_routes
,
11463 show_bgp_ipv6_neighbor_received_routes_cmd
,
11464 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11468 "Detailed information on TCP and BGP neighbor connections\n"
11469 "Neighbor to display information about\n"
11470 "Neighbor to display information about\n"
11471 "Neighbor on bgp configured interface\n"
11472 "Display the received routes from neighbor\n")
11474 ALIAS (show_bgp_view_neighbor_received_routes
,
11475 show_bgp_neighbor_received_routes_rmap_cmd
,
11476 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD",
11479 "Detailed information on TCP and BGP neighbor connections\n"
11480 "Neighbor to display information about\n"
11481 "Neighbor to display information about\n"
11482 "Neighbor on bgp configured interface\n"
11483 "Display the received routes from neighbor\n")
11485 ALIAS (show_bgp_view_neighbor_received_routes
,
11486 show_bgp_ipv6_neighbor_received_routes_rmap_cmd
,
11487 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD",
11491 "Detailed information on TCP and BGP neighbor connections\n"
11492 "Neighbor to display information about\n"
11493 "Neighbor to display information about\n"
11494 "Neighbor on bgp configured interface\n"
11495 "Display the received routes from neighbor\n")
11497 DEFUN (show_bgp_neighbor_received_prefix_filter
,
11498 show_bgp_neighbor_received_prefix_filter_cmd
,
11499 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
11502 "Detailed information on TCP and BGP neighbor connections\n"
11503 "Neighbor to display information about\n"
11504 "Neighbor to display information about\n"
11505 "Neighbor on bgp configured interface\n"
11506 "Display information received from a BGP neighbor\n"
11507 "Display the prefixlist filter\n")
11510 union sockunion su
;
11514 ret
= str2sockunion (argv
[0], &su
);
11517 peer
= peer_lookup_by_conf_if (NULL
, argv
[0]);
11520 vty_out (vty
, "Malformed address or name: %s%s", argv
[0], VTY_NEWLINE
);
11521 return CMD_WARNING
;
11526 peer
= peer_lookup (NULL
, &su
);
11528 return CMD_WARNING
;
11531 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
11532 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
11535 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
11536 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
11539 return CMD_SUCCESS
;
11542 ALIAS (show_bgp_neighbor_received_prefix_filter
,
11543 show_bgp_ipv6_neighbor_received_prefix_filter_cmd
,
11544 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
11548 "Detailed information on TCP and BGP neighbor connections\n"
11549 "Neighbor to display information about\n"
11550 "Neighbor to display information about\n"
11551 "Neighbor on bgp configured interface\n"
11552 "Display information received from a BGP neighbor\n"
11553 "Display the prefixlist filter\n")
11556 ALIAS (show_bgp_view_neighbor_received_routes
,
11557 ipv6_bgp_neighbor_received_routes_cmd
,
11558 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11562 "Detailed information on TCP and BGP neighbor connections\n"
11563 "Neighbor to display information about\n"
11564 "Neighbor to display information about\n"
11565 "Neighbor on bgp configured interface\n"
11566 "Display the received routes from neighbor\n")
11569 DEFUN (ipv6_mbgp_neighbor_received_routes
,
11570 ipv6_mbgp_neighbor_received_routes_cmd
,
11571 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
11575 "Detailed information on TCP and BGP neighbor connections\n"
11576 "Neighbor to display information about\n"
11577 "Neighbor to display information about\n"
11578 "Neighbor on bgp configured interface\n"
11579 "Display the received routes from neighbor\n")
11583 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11585 return CMD_WARNING
;
11587 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 1, NULL
, NULL
);
11590 DEFUN (show_bgp_view_neighbor_received_prefix_filter
,
11591 show_bgp_view_neighbor_received_prefix_filter_cmd
,
11592 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
11597 "Detailed information on TCP and BGP neighbor connections\n"
11598 "Neighbor to display information about\n"
11599 "Neighbor to display information about\n"
11600 "Neighbor on bgp configured interface\n"
11601 "Display information received from a BGP neighbor\n"
11602 "Display the prefixlist filter\n")
11605 union sockunion su
;
11610 /* BGP structure lookup. */
11611 bgp
= bgp_lookup_by_name (argv
[0]);
11614 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
11615 return CMD_WARNING
;
11618 ret
= str2sockunion (argv
[1], &su
);
11621 peer
= peer_lookup_by_conf_if (bgp
, argv
[1]);
11624 vty_out (vty
, "%% Malformed address or name: %s%s", argv
[1], VTY_NEWLINE
);
11625 return CMD_WARNING
;
11630 peer
= peer_lookup (bgp
, &su
);
11632 return CMD_WARNING
;
11635 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
11636 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
11639 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
11640 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
11643 return CMD_SUCCESS
;
11646 ALIAS (show_bgp_view_neighbor_received_prefix_filter
,
11647 show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
,
11648 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
11654 "Detailed information on TCP and BGP neighbor connections\n"
11655 "Neighbor to display information about\n"
11656 "Neighbor to display information about\n"
11657 "Neighbor on bgp configured interface\n"
11658 "Display information received from a BGP neighbor\n"
11659 "Display the prefixlist filter\n")
11660 #endif /* HAVE_IPV6 */
11663 bgp_show_neighbor_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
11664 safi_t safi
, enum bgp_show_type type
, char *delim
)
11666 if (! peer
|| ! peer
->afc
[afi
][safi
])
11668 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
11669 return CMD_WARNING
;
11672 return bgp_show (vty
, peer
->bgp
, afi
, safi
, type
, &peer
->su
, delim
);
11675 DEFUN (show_ip_bgp_neighbor_routes
,
11676 show_ip_bgp_neighbor_routes_cmd
,
11677 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes",
11681 "Detailed information on TCP and BGP neighbor connections\n"
11682 "Neighbor to display information about\n"
11683 "Neighbor to display information about\n"
11684 "Neighbor on bgp configured interface\n"
11685 "Display routes learned from neighbor\n")
11689 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11691 return CMD_WARNING
;
11693 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
11694 bgp_show_type_neighbor
, NULL
);
11697 DEFUN (show_ip_bgp_neighbor_routes_csv
,
11698 show_ip_bgp_neighbor_routes_csv_cmd
,
11699 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes csv",
11703 "Detailed information on TCP and BGP neighbor connections\n"
11704 "Neighbor to display information about\n"
11705 "Neighbor to display information about\n"
11706 "Neighbor on bgp configured interface\n"
11707 "Display routes learned from neighbor\n")
11711 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11713 return CMD_WARNING
;
11715 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
11716 bgp_show_type_neighbor
, &csv
);
11719 DEFUN (show_ip_bgp_neighbor_flap
,
11720 show_ip_bgp_neighbor_flap_cmd
,
11721 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics",
11725 "Detailed information on TCP and BGP neighbor connections\n"
11726 "Neighbor to display information about\n"
11727 "Neighbor to display information about\n"
11728 "Neighbor on bgp configured interface\n"
11729 "Display flap statistics of the routes learned from neighbor\n")
11733 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11735 return CMD_WARNING
;
11737 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
11738 bgp_show_type_flap_neighbor
, NULL
);
11741 DEFUN (show_ip_bgp_neighbor_damp
,
11742 show_ip_bgp_neighbor_damp_cmd
,
11743 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes",
11747 "Detailed information on TCP and BGP neighbor connections\n"
11748 "Neighbor to display information about\n"
11749 "Neighbor to display information about\n"
11750 "Neighbor on bgp configured interface\n"
11751 "Display the dampened routes received from neighbor\n")
11755 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11757 return CMD_WARNING
;
11759 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
11760 bgp_show_type_damp_neighbor
, NULL
);
11763 DEFUN (show_ip_bgp_ipv4_neighbor_routes
,
11764 show_ip_bgp_ipv4_neighbor_routes_cmd
,
11765 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) routes",
11770 "Address Family modifier\n"
11771 "Address Family modifier\n"
11772 "Detailed information on TCP and BGP neighbor connections\n"
11773 "Neighbor to display information about\n"
11774 "Neighbor to display information about\n"
11775 "Neighbor on bgp configured interface\n"
11776 "Display routes learned from neighbor\n")
11780 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
11782 return CMD_WARNING
;
11784 if (strncmp (argv
[0], "m", 1) == 0)
11785 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_MULTICAST
,
11786 bgp_show_type_neighbor
, NULL
);
11788 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
11789 bgp_show_type_neighbor
, NULL
);
11792 DEFUN (show_ip_bgp_view_rsclient
,
11793 show_ip_bgp_view_rsclient_cmd
,
11794 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD)",
11800 "Information about Route Server Client\n"
11801 NEIGHBOR_ADDR_STR3
)
11803 struct bgp_table
*table
;
11807 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11809 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11812 return CMD_WARNING
;
11814 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
11816 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11818 return CMD_WARNING
;
11821 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
11822 PEER_FLAG_RSERVER_CLIENT
))
11824 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11826 return CMD_WARNING
;
11829 table
= peer
->rib
[AFI_IP
][SAFI_UNICAST
];
11831 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
,
11835 ALIAS (show_ip_bgp_view_rsclient
,
11836 show_ip_bgp_rsclient_cmd
,
11837 "show ip bgp rsclient (A.B.C.D|X:X::X:X|WORD)",
11841 "Information about Route Server Client\n"
11842 NEIGHBOR_ADDR_STR3
)
11844 DEFUN (show_bgp_view_ipv4_safi_rsclient
,
11845 show_bgp_view_ipv4_safi_rsclient_cmd
,
11846 "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)",
11852 "Address Family modifier\n"
11853 "Address Family modifier\n"
11854 "Information about Route Server Client\n"
11855 NEIGHBOR_ADDR_STR3
)
11857 struct bgp_table
*table
;
11862 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
11863 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11865 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
11866 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11870 return CMD_WARNING
;
11872 if (! peer
->afc
[AFI_IP
][safi
])
11874 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11876 return CMD_WARNING
;
11879 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][safi
],
11880 PEER_FLAG_RSERVER_CLIENT
))
11882 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11884 return CMD_WARNING
;
11887 table
= peer
->rib
[AFI_IP
][safi
];
11889 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
,
11893 ALIAS (show_bgp_view_ipv4_safi_rsclient
,
11894 show_bgp_ipv4_safi_rsclient_cmd
,
11895 "show bgp ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)",
11899 "Address Family modifier\n"
11900 "Address Family modifier\n"
11901 "Information about Route Server Client\n"
11902 NEIGHBOR_ADDR_STR3
)
11904 DEFUN (show_ip_bgp_view_rsclient_route
,
11905 show_ip_bgp_view_rsclient_route_cmd
,
11906 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D",
11912 "Information about Route Server Client\n"
11914 "Network in the BGP routing table to display\n")
11919 /* BGP structure lookup. */
11922 bgp
= bgp_lookup_by_name (argv
[0]);
11925 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
11926 return CMD_WARNING
;
11931 bgp
= bgp_get_default ();
11934 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
11935 return CMD_WARNING
;
11940 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
11942 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
11945 return CMD_WARNING
;
11947 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
11949 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
11951 return CMD_WARNING
;
11954 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
11955 PEER_FLAG_RSERVER_CLIENT
))
11957 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
11959 return CMD_WARNING
;
11962 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
11963 (argc
== 3) ? argv
[2] : argv
[1],
11964 AFI_IP
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
11967 ALIAS (show_ip_bgp_view_rsclient_route
,
11968 show_ip_bgp_rsclient_route_cmd
,
11969 "show ip bgp rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D",
11973 "Information about Route Server Client\n"
11975 "Network in the BGP routing table to display\n")
11977 DEFUN (show_bgp_view_ipv4_safi_rsclient_route
,
11978 show_bgp_view_ipv4_safi_rsclient_route_cmd
,
11979 "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D",
11985 "Address Family modifier\n"
11986 "Address Family modifier\n"
11987 "Information about Route Server Client\n"
11989 "Network in the BGP routing table to display\n")
11995 /* BGP structure lookup. */
11998 bgp
= bgp_lookup_by_name (argv
[0]);
12001 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12002 return CMD_WARNING
;
12007 bgp
= bgp_get_default ();
12010 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12011 return CMD_WARNING
;
12016 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
12017 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12019 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
12020 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12024 return CMD_WARNING
;
12026 if (! peer
->afc
[AFI_IP
][safi
])
12028 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12030 return CMD_WARNING
;
12033 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][safi
],
12034 PEER_FLAG_RSERVER_CLIENT
))
12036 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12038 return CMD_WARNING
;
12041 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][safi
],
12042 (argc
== 4) ? argv
[3] : argv
[2],
12043 AFI_IP
, safi
, NULL
, 0, BGP_PATH_ALL
);
12046 ALIAS (show_bgp_view_ipv4_safi_rsclient_route
,
12047 show_bgp_ipv4_safi_rsclient_route_cmd
,
12048 "show bgp ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D",
12052 "Address Family modifier\n"
12053 "Address Family modifier\n"
12054 "Information about Route Server Client\n"
12056 "Network in the BGP routing table to display\n")
12058 DEFUN (show_ip_bgp_view_rsclient_prefix
,
12059 show_ip_bgp_view_rsclient_prefix_cmd
,
12060 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D/M",
12066 "Information about Route Server Client\n"
12068 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
12073 /* BGP structure lookup. */
12076 bgp
= bgp_lookup_by_name (argv
[0]);
12079 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12080 return CMD_WARNING
;
12085 bgp
= bgp_get_default ();
12088 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12089 return CMD_WARNING
;
12094 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12096 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12099 return CMD_WARNING
;
12101 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
12103 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12105 return CMD_WARNING
;
12108 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
12109 PEER_FLAG_RSERVER_CLIENT
))
12111 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12113 return CMD_WARNING
;
12116 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
12117 (argc
== 3) ? argv
[2] : argv
[1],
12118 AFI_IP
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
12121 ALIAS (show_ip_bgp_view_rsclient_prefix
,
12122 show_ip_bgp_rsclient_prefix_cmd
,
12123 "show ip bgp rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D/M",
12127 "Information about Route Server Client\n"
12129 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
12131 DEFUN (show_bgp_view_ipv4_safi_rsclient_prefix
,
12132 show_bgp_view_ipv4_safi_rsclient_prefix_cmd
,
12133 "show bgp view WORD ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D/M",
12139 "Address Family modifier\n"
12140 "Address Family modifier\n"
12141 "Information about Route Server Client\n"
12143 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
12149 /* BGP structure lookup. */
12152 bgp
= bgp_lookup_by_name (argv
[0]);
12155 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12156 return CMD_WARNING
;
12161 bgp
= bgp_get_default ();
12164 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12165 return CMD_WARNING
;
12170 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
12171 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12173 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
12174 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12178 return CMD_WARNING
;
12180 if (! peer
->afc
[AFI_IP
][safi
])
12182 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12184 return CMD_WARNING
;
12187 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][safi
],
12188 PEER_FLAG_RSERVER_CLIENT
))
12190 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12192 return CMD_WARNING
;
12195 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][safi
],
12196 (argc
== 4) ? argv
[3] : argv
[2],
12197 AFI_IP
, safi
, NULL
, 1, BGP_PATH_ALL
);
12200 ALIAS (show_bgp_view_ipv4_safi_rsclient_prefix
,
12201 show_bgp_ipv4_safi_rsclient_prefix_cmd
,
12202 "show bgp ipv4 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) A.B.C.D/M",
12206 "Address Family modifier\n"
12207 "Address Family modifier\n"
12208 "Information about Route Server Client\n"
12210 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
12213 DEFUN (show_bgp_view_neighbor_routes
,
12214 show_bgp_view_neighbor_routes_cmd
,
12215 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) routes",
12220 "Detailed information on TCP and BGP neighbor connections\n"
12221 "Neighbor to display information about\n"
12222 "Neighbor to display information about\n"
12223 "Neighbor on bgp configured interface\n"
12224 "Display routes learned from neighbor\n")
12229 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12231 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12234 return CMD_WARNING
;
12236 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
12237 bgp_show_type_neighbor
, NULL
);
12240 DEFUN (show_bgp_view_neighbor_routes_csv
,
12241 show_bgp_view_neighbor_routes_csv_cmd
,
12242 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) routes csv",
12247 "Detailed information on TCP and BGP neighbor connections\n"
12248 "Neighbor to display information about\n"
12249 "Neighbor to display information about\n"
12250 "Neighbor on bgp configured interface\n"
12251 "Display routes learned from neighbor\n")
12256 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12258 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12261 return CMD_WARNING
;
12263 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
12264 bgp_show_type_neighbor
, &csv
);
12267 ALIAS (show_bgp_view_neighbor_routes
,
12268 show_bgp_view_ipv6_neighbor_routes_cmd
,
12269 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes",
12275 "Detailed information on TCP and BGP neighbor connections\n"
12276 "Neighbor to display information about\n"
12277 "Neighbor to display information about\n"
12278 "Neighbor on bgp configured interface\n"
12279 "Display routes learned from neighbor\n")
12281 DEFUN (show_bgp_view_neighbor_damp
,
12282 show_bgp_view_neighbor_damp_cmd
,
12283 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes",
12288 "Detailed information on TCP and BGP neighbor connections\n"
12289 "Neighbor to display information about\n"
12290 "Neighbor to display information about\n"
12291 "Neighbor on bgp configured interface\n"
12292 "Display the dampened routes received from neighbor\n")
12297 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12299 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12302 return CMD_WARNING
;
12304 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
12305 bgp_show_type_damp_neighbor
, NULL
);
12308 ALIAS (show_bgp_view_neighbor_damp
,
12309 show_bgp_view_ipv6_neighbor_damp_cmd
,
12310 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes",
12316 "Detailed information on TCP and BGP neighbor connections\n"
12317 "Neighbor to display information about\n"
12318 "Neighbor to display information about\n"
12319 "Neighbor on bgp configured interface\n"
12320 "Display the dampened routes received from neighbor\n")
12322 DEFUN (show_bgp_view_neighbor_flap
,
12323 show_bgp_view_neighbor_flap_cmd
,
12324 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics",
12329 "Detailed information on TCP and BGP neighbor connections\n"
12330 "Neighbor to display information about\n"
12331 "Neighbor to display information about\n"
12332 "Neighbor on bgp configured interface\n"
12333 "Display flap statistics of the routes learned from neighbor\n")
12338 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12340 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12343 return CMD_WARNING
;
12345 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
12346 bgp_show_type_flap_neighbor
, NULL
);
12349 ALIAS (show_bgp_view_neighbor_flap
,
12350 show_bgp_view_ipv6_neighbor_flap_cmd
,
12351 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics",
12357 "Detailed information on TCP and BGP neighbor connections\n"
12358 "Neighbor to display information about\n"
12359 "Neighbor to display information about\n"
12360 "Neighbor on bgp configured interface\n"
12361 "Display flap statistics of the routes learned from neighbor\n")
12363 ALIAS (show_bgp_view_neighbor_routes
,
12364 show_bgp_neighbor_routes_cmd
,
12365 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes",
12368 "Detailed information on TCP and BGP neighbor connections\n"
12369 "Neighbor to display information about\n"
12370 "Neighbor to display information about\n"
12371 "Neighbor on bgp configured interface\n"
12372 "Display routes learned from neighbor\n")
12375 ALIAS (show_bgp_view_neighbor_routes
,
12376 show_bgp_ipv6_neighbor_routes_cmd
,
12377 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes",
12381 "Detailed information on TCP and BGP neighbor connections\n"
12382 "Neighbor to display information about\n"
12383 "Neighbor to display information about\n"
12384 "Neighbor on bgp configured interface\n"
12385 "Display routes learned from neighbor\n")
12388 ALIAS (show_bgp_view_neighbor_routes
,
12389 ipv6_bgp_neighbor_routes_cmd
,
12390 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes",
12394 "Detailed information on TCP and BGP neighbor connections\n"
12395 "Neighbor to display information about\n"
12396 "Neighbor to display information about\n"
12397 "Neighbor on bgp configured interface\n"
12398 "Display routes learned from neighbor\n")
12400 ALIAS (show_bgp_view_neighbor_routes_csv
,
12401 show_bgp_neighbor_routes_csv_cmd
,
12402 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes csv",
12405 "Detailed information on TCP and BGP neighbor connections\n"
12406 "Neighbor to display information about\n"
12407 "Neighbor to display information about\n"
12408 "Neighbor on bgp configured interface\n"
12409 "Display routes learned from neighbor\n")
12412 ALIAS (show_bgp_view_neighbor_routes_csv
,
12413 show_bgp_ipv6_neighbor_routes_csv_cmd
,
12414 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes csv",
12418 "Detailed information on TCP and BGP neighbor connections\n"
12419 "Neighbor to display information about\n"
12420 "Neighbor to display information about\n"
12421 "Neighbor on bgp configured interface\n"
12422 "Display routes learned from neighbor\n")
12425 ALIAS (show_bgp_view_neighbor_routes_csv
,
12426 ipv6_bgp_neighbor_routes_csv_cmd
,
12427 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes csv",
12431 "Detailed information on TCP and BGP neighbor connections\n"
12432 "Neighbor to display information about\n"
12433 "Neighbor to display information about\n"
12434 "Neighbor on bgp configured interface\n"
12435 "Display routes learned from neighbor\n")
12438 DEFUN (ipv6_mbgp_neighbor_routes
,
12439 ipv6_mbgp_neighbor_routes_cmd
,
12440 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) routes",
12444 "Detailed information on TCP and BGP neighbor connections\n"
12445 "Neighbor to display information about\n"
12446 "Neighbor to display information about\n"
12447 "Neighbor on bgp configured interface\n"
12448 "Display routes learned from neighbor\n")
12452 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12454 return CMD_WARNING
;
12456 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
,
12457 bgp_show_type_neighbor
, NULL
);
12460 ALIAS (show_bgp_view_neighbor_flap
,
12461 show_bgp_neighbor_flap_cmd
,
12462 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics",
12465 "Detailed information on TCP and BGP neighbor connections\n"
12466 "Neighbor to display information about\n"
12467 "Neighbor to display information about\n"
12468 "Neighbor on bgp configured interface\n"
12469 "Display flap statistics of the routes learned from neighbor\n")
12471 ALIAS (show_bgp_view_neighbor_flap
,
12472 show_bgp_ipv6_neighbor_flap_cmd
,
12473 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics",
12477 "Detailed information on TCP and BGP neighbor connections\n"
12478 "Neighbor to display information about\n"
12479 "Neighbor to display information about\n"
12480 "Neighbor on bgp configured interface\n"
12481 "Display flap statistics of the routes learned from neighbor\n")
12483 ALIAS (show_bgp_view_neighbor_damp
,
12484 show_bgp_neighbor_damp_cmd
,
12485 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes",
12488 "Detailed information on TCP and BGP neighbor connections\n"
12489 "Neighbor to display information about\n"
12490 "Neighbor to display information about\n"
12491 "Neighbor on bgp configured interface\n"
12492 "Display the dampened routes received from neighbor\n")
12494 ALIAS (show_bgp_view_neighbor_damp
,
12495 show_bgp_ipv6_neighbor_damp_cmd
,
12496 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes",
12500 "Detailed information on TCP and BGP neighbor connections\n"
12501 "Neighbor to display information about\n"
12502 "Neighbor to display information about\n"
12503 "Neighbor on bgp configured interface\n"
12504 "Display the dampened routes received from neighbor\n")
12506 DEFUN (show_bgp_view_rsclient
,
12507 show_bgp_view_rsclient_cmd
,
12508 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD)",
12513 "Information about Route Server Client\n"
12514 NEIGHBOR_ADDR_STR3
)
12516 struct bgp_table
*table
;
12520 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12522 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12525 return CMD_WARNING
;
12527 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
12529 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12531 return CMD_WARNING
;
12534 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
12535 PEER_FLAG_RSERVER_CLIENT
))
12537 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12539 return CMD_WARNING
;
12542 table
= peer
->rib
[AFI_IP6
][SAFI_UNICAST
];
12544 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
,
12548 ALIAS (show_bgp_view_rsclient
,
12549 show_bgp_rsclient_cmd
,
12550 "show bgp rsclient (A.B.C.D|X:X::X:X|WORD)",
12553 "Information about Route Server Client\n"
12554 NEIGHBOR_ADDR_STR3
)
12556 DEFUN (show_bgp_view_ipv6_safi_rsclient
,
12557 show_bgp_view_ipv6_safi_rsclient_cmd
,
12558 "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)",
12564 "Address Family modifier\n"
12565 "Address Family modifier\n"
12566 "Information about Route Server Client\n"
12567 NEIGHBOR_ADDR_STR3
)
12569 struct bgp_table
*table
;
12574 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
12575 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12577 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
12578 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12582 return CMD_WARNING
;
12584 if (! peer
->afc
[AFI_IP6
][safi
])
12586 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12588 return CMD_WARNING
;
12591 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][safi
],
12592 PEER_FLAG_RSERVER_CLIENT
))
12594 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12596 return CMD_WARNING
;
12599 table
= peer
->rib
[AFI_IP6
][safi
];
12601 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
,
12605 ALIAS (show_bgp_view_ipv6_safi_rsclient
,
12606 show_bgp_ipv6_safi_rsclient_cmd
,
12607 "show bgp ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD)",
12611 "Address Family modifier\n"
12612 "Address Family modifier\n"
12613 "Information about Route Server Client\n"
12614 NEIGHBOR_ADDR_STR3
)
12616 DEFUN (show_bgp_view_rsclient_route
,
12617 show_bgp_view_rsclient_route_cmd
,
12618 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X",
12623 "Information about Route Server Client\n"
12625 "Network in the BGP routing table to display\n")
12630 /* BGP structure lookup. */
12633 bgp
= bgp_lookup_by_name (argv
[0]);
12636 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12637 return CMD_WARNING
;
12642 bgp
= bgp_get_default ();
12645 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12646 return CMD_WARNING
;
12651 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12653 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12656 return CMD_WARNING
;
12658 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
12660 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12662 return CMD_WARNING
;
12665 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
12666 PEER_FLAG_RSERVER_CLIENT
))
12668 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12670 return CMD_WARNING
;
12673 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
12674 (argc
== 3) ? argv
[2] : argv
[1],
12675 AFI_IP6
, SAFI_UNICAST
, NULL
, 0, BGP_PATH_ALL
);
12678 ALIAS (show_bgp_view_rsclient_route
,
12679 show_bgp_rsclient_route_cmd
,
12680 "show bgp rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X",
12683 "Information about Route Server Client\n"
12685 "Network in the BGP routing table to display\n")
12687 DEFUN (show_bgp_view_ipv6_safi_rsclient_route
,
12688 show_bgp_view_ipv6_safi_rsclient_route_cmd
,
12689 "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X",
12695 "Address Family modifier\n"
12696 "Address Family modifier\n"
12697 "Information about Route Server Client\n"
12699 "Network in the BGP routing table to display\n")
12705 /* BGP structure lookup. */
12708 bgp
= bgp_lookup_by_name (argv
[0]);
12711 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12712 return CMD_WARNING
;
12717 bgp
= bgp_get_default ();
12720 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12721 return CMD_WARNING
;
12726 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
12727 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12729 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
12730 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12734 return CMD_WARNING
;
12736 if (! peer
->afc
[AFI_IP6
][safi
])
12738 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12740 return CMD_WARNING
;
12743 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][safi
],
12744 PEER_FLAG_RSERVER_CLIENT
))
12746 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12748 return CMD_WARNING
;
12751 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][safi
],
12752 (argc
== 4) ? argv
[3] : argv
[2],
12753 AFI_IP6
, safi
, NULL
, 0, BGP_PATH_ALL
);
12756 ALIAS (show_bgp_view_ipv6_safi_rsclient_route
,
12757 show_bgp_ipv6_safi_rsclient_route_cmd
,
12758 "show bgp ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X",
12762 "Address Family modifier\n"
12763 "Address Family modifier\n"
12764 "Information about Route Server Client\n"
12766 "Network in the BGP routing table to display\n")
12768 DEFUN (show_bgp_view_rsclient_prefix
,
12769 show_bgp_view_rsclient_prefix_cmd
,
12770 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M",
12775 "Information about Route Server Client\n"
12777 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
12782 /* BGP structure lookup. */
12785 bgp
= bgp_lookup_by_name (argv
[0]);
12788 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12789 return CMD_WARNING
;
12794 bgp
= bgp_get_default ();
12797 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12798 return CMD_WARNING
;
12803 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
12805 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
12808 return CMD_WARNING
;
12810 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
12812 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12814 return CMD_WARNING
;
12817 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
12818 PEER_FLAG_RSERVER_CLIENT
))
12820 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12822 return CMD_WARNING
;
12825 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
12826 (argc
== 3) ? argv
[2] : argv
[1],
12827 AFI_IP6
, SAFI_UNICAST
, NULL
, 1, BGP_PATH_ALL
);
12830 ALIAS (show_bgp_view_rsclient_prefix
,
12831 show_bgp_rsclient_prefix_cmd
,
12832 "show bgp rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M",
12835 "Information about Route Server Client\n"
12837 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
12839 DEFUN (show_bgp_view_ipv6_safi_rsclient_prefix
,
12840 show_bgp_view_ipv6_safi_rsclient_prefix_cmd
,
12841 "show bgp view WORD ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M",
12847 "Address Family modifier\n"
12848 "Address Family modifier\n"
12849 "Information about Route Server Client\n"
12851 "IP prefix <network>/<length>, e.g., 3ffe::/16\n")
12857 /* BGP structure lookup. */
12860 bgp
= bgp_lookup_by_name (argv
[0]);
12863 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
12864 return CMD_WARNING
;
12869 bgp
= bgp_get_default ();
12872 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
12873 return CMD_WARNING
;
12878 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[2]);
12879 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12881 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
12882 safi
= (strncmp (argv
[0], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
12886 return CMD_WARNING
;
12888 if (! peer
->afc
[AFI_IP6
][safi
])
12890 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
12892 return CMD_WARNING
;
12895 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][safi
],
12896 PEER_FLAG_RSERVER_CLIENT
))
12898 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
12900 return CMD_WARNING
;
12903 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][safi
],
12904 (argc
== 4) ? argv
[3] : argv
[2],
12905 AFI_IP6
, safi
, NULL
, 1, BGP_PATH_ALL
);
12908 ALIAS (show_bgp_view_ipv6_safi_rsclient_prefix
,
12909 show_bgp_ipv6_safi_rsclient_prefix_cmd
,
12910 "show bgp ipv6 (unicast|multicast) rsclient (A.B.C.D|X:X::X:X|WORD) X:X::X:X/M",
12914 "Address Family modifier\n"
12915 "Address Family modifier\n"
12916 "Information about Route Server Client\n"
12918 "IP prefix <network>/<length>, e.g., 3ffe::/16\n")
12920 #endif /* HAVE_IPV6 */
12922 struct bgp_table
*bgp_distance_table
;
12924 struct bgp_distance
12926 /* Distance value for the IP source prefix. */
12929 /* Name of the access-list to be matched. */
12933 static struct bgp_distance
*
12934 bgp_distance_new (void)
12936 return XCALLOC (MTYPE_BGP_DISTANCE
, sizeof (struct bgp_distance
));
12940 bgp_distance_free (struct bgp_distance
*bdistance
)
12942 XFREE (MTYPE_BGP_DISTANCE
, bdistance
);
12946 bgp_distance_set (struct vty
*vty
, const char *distance_str
,
12947 const char *ip_str
, const char *access_list_str
)
12950 struct prefix_ipv4 p
;
12952 struct bgp_node
*rn
;
12953 struct bgp_distance
*bdistance
;
12955 ret
= str2prefix_ipv4 (ip_str
, &p
);
12958 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
12959 return CMD_WARNING
;
12962 distance
= atoi (distance_str
);
12964 /* Get BGP distance node. */
12965 rn
= bgp_node_get (bgp_distance_table
, (struct prefix
*) &p
);
12968 bdistance
= rn
->info
;
12969 bgp_unlock_node (rn
);
12973 bdistance
= bgp_distance_new ();
12974 rn
->info
= bdistance
;
12977 /* Set distance value. */
12978 bdistance
->distance
= distance
;
12980 /* Reset access-list configuration. */
12981 if (bdistance
->access_list
)
12983 free (bdistance
->access_list
);
12984 bdistance
->access_list
= NULL
;
12986 if (access_list_str
)
12987 bdistance
->access_list
= strdup (access_list_str
);
12989 return CMD_SUCCESS
;
12993 bgp_distance_unset (struct vty
*vty
, const char *distance_str
,
12994 const char *ip_str
, const char *access_list_str
)
12997 struct prefix_ipv4 p
;
12999 struct bgp_node
*rn
;
13000 struct bgp_distance
*bdistance
;
13002 ret
= str2prefix_ipv4 (ip_str
, &p
);
13005 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
13006 return CMD_WARNING
;
13009 distance
= atoi (distance_str
);
13011 rn
= bgp_node_lookup (bgp_distance_table
, (struct prefix
*)&p
);
13014 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
13015 return CMD_WARNING
;
13018 bdistance
= rn
->info
;
13020 if (bdistance
->access_list
)
13021 free (bdistance
->access_list
);
13022 bgp_distance_free (bdistance
);
13025 bgp_unlock_node (rn
);
13026 bgp_unlock_node (rn
);
13028 return CMD_SUCCESS
;
13031 /* Apply BGP information to distance method. */
13033 bgp_distance_apply (struct prefix
*p
, struct bgp_info
*rinfo
, struct bgp
*bgp
)
13035 struct bgp_node
*rn
;
13036 struct prefix_ipv4 q
;
13038 struct bgp_distance
*bdistance
;
13039 struct access_list
*alist
;
13040 struct bgp_static
*bgp_static
;
13045 if (p
->family
!= AF_INET
)
13048 peer
= rinfo
->peer
;
13050 if (peer
->su
.sa
.sa_family
!= AF_INET
)
13053 memset (&q
, 0, sizeof (struct prefix_ipv4
));
13054 q
.family
= AF_INET
;
13055 q
.prefix
= peer
->su
.sin
.sin_addr
;
13056 q
.prefixlen
= IPV4_MAX_BITLEN
;
13058 /* Check source address. */
13059 rn
= bgp_node_match (bgp_distance_table
, (struct prefix
*) &q
);
13062 bdistance
= rn
->info
;
13063 bgp_unlock_node (rn
);
13065 if (bdistance
->access_list
)
13067 alist
= access_list_lookup (AFI_IP
, bdistance
->access_list
);
13068 if (alist
&& access_list_apply (alist
, p
) == FILTER_PERMIT
)
13069 return bdistance
->distance
;
13072 return bdistance
->distance
;
13075 /* Backdoor check. */
13076 rn
= bgp_node_lookup (bgp
->route
[AFI_IP
][SAFI_UNICAST
], p
);
13079 bgp_static
= rn
->info
;
13080 bgp_unlock_node (rn
);
13082 if (bgp_static
->backdoor
)
13084 if (bgp
->distance_local
)
13085 return bgp
->distance_local
;
13087 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
13091 if (peer
->sort
== BGP_PEER_EBGP
)
13093 if (bgp
->distance_ebgp
)
13094 return bgp
->distance_ebgp
;
13095 return ZEBRA_EBGP_DISTANCE_DEFAULT
;
13099 if (bgp
->distance_ibgp
)
13100 return bgp
->distance_ibgp
;
13101 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
13105 DEFUN (bgp_distance
,
13107 "distance bgp <1-255> <1-255> <1-255>",
13108 "Define an administrative distance\n"
13110 "Distance for routes external to the AS\n"
13111 "Distance for routes internal to the AS\n"
13112 "Distance for local routes\n")
13118 bgp
->distance_ebgp
= atoi (argv
[0]);
13119 bgp
->distance_ibgp
= atoi (argv
[1]);
13120 bgp
->distance_local
= atoi (argv
[2]);
13121 return CMD_SUCCESS
;
13124 DEFUN (no_bgp_distance
,
13125 no_bgp_distance_cmd
,
13126 "no distance bgp <1-255> <1-255> <1-255>",
13128 "Define an administrative distance\n"
13130 "Distance for routes external to the AS\n"
13131 "Distance for routes internal to the AS\n"
13132 "Distance for local routes\n")
13138 bgp
->distance_ebgp
= 0;
13139 bgp
->distance_ibgp
= 0;
13140 bgp
->distance_local
= 0;
13141 return CMD_SUCCESS
;
13144 ALIAS (no_bgp_distance
,
13145 no_bgp_distance2_cmd
,
13148 "Define an administrative distance\n"
13151 DEFUN (bgp_distance_source
,
13152 bgp_distance_source_cmd
,
13153 "distance <1-255> A.B.C.D/M",
13154 "Define an administrative distance\n"
13155 "Administrative distance\n"
13156 "IP source prefix\n")
13158 bgp_distance_set (vty
, argv
[0], argv
[1], NULL
);
13159 return CMD_SUCCESS
;
13162 DEFUN (no_bgp_distance_source
,
13163 no_bgp_distance_source_cmd
,
13164 "no distance <1-255> A.B.C.D/M",
13166 "Define an administrative distance\n"
13167 "Administrative distance\n"
13168 "IP source prefix\n")
13170 bgp_distance_unset (vty
, argv
[0], argv
[1], NULL
);
13171 return CMD_SUCCESS
;
13174 DEFUN (bgp_distance_source_access_list
,
13175 bgp_distance_source_access_list_cmd
,
13176 "distance <1-255> A.B.C.D/M WORD",
13177 "Define an administrative distance\n"
13178 "Administrative distance\n"
13179 "IP source prefix\n"
13180 "Access list name\n")
13182 bgp_distance_set (vty
, argv
[0], argv
[1], argv
[2]);
13183 return CMD_SUCCESS
;
13186 DEFUN (no_bgp_distance_source_access_list
,
13187 no_bgp_distance_source_access_list_cmd
,
13188 "no distance <1-255> A.B.C.D/M WORD",
13190 "Define an administrative distance\n"
13191 "Administrative distance\n"
13192 "IP source prefix\n"
13193 "Access list name\n")
13195 bgp_distance_unset (vty
, argv
[0], argv
[1], argv
[2]);
13196 return CMD_SUCCESS
;
13199 DEFUN (bgp_damp_set
,
13201 "bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
13202 "BGP Specific commands\n"
13203 "Enable route-flap dampening\n"
13204 "Half-life time for the penalty\n"
13205 "Value to start reusing a route\n"
13206 "Value to start suppressing a route\n"
13207 "Maximum duration to suppress a stable route\n")
13210 int half
= DEFAULT_HALF_LIFE
* 60;
13211 int reuse
= DEFAULT_REUSE
;
13212 int suppress
= DEFAULT_SUPPRESS
;
13213 int max
= 4 * half
;
13217 half
= atoi (argv
[0]) * 60;
13218 reuse
= atoi (argv
[1]);
13219 suppress
= atoi (argv
[2]);
13220 max
= atoi (argv
[3]) * 60;
13222 else if (argc
== 1)
13224 half
= atoi (argv
[0]) * 60;
13229 return bgp_damp_enable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
),
13230 half
, reuse
, suppress
, max
);
13233 ALIAS (bgp_damp_set
,
13235 "bgp dampening <1-45>",
13236 "BGP Specific commands\n"
13237 "Enable route-flap dampening\n"
13238 "Half-life time for the penalty\n")
13240 ALIAS (bgp_damp_set
,
13243 "BGP Specific commands\n"
13244 "Enable route-flap dampening\n")
13246 DEFUN (bgp_damp_unset
,
13247 bgp_damp_unset_cmd
,
13248 "no bgp dampening",
13250 "BGP Specific commands\n"
13251 "Enable route-flap dampening\n")
13256 return bgp_damp_disable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
));
13259 ALIAS (bgp_damp_unset
,
13260 bgp_damp_unset2_cmd
,
13261 "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
13263 "BGP Specific commands\n"
13264 "Enable route-flap dampening\n"
13265 "Half-life time for the penalty\n"
13266 "Value to start reusing a route\n"
13267 "Value to start suppressing a route\n"
13268 "Maximum duration to suppress a stable route\n")
13270 DEFUN (show_ip_bgp_dampened_paths
,
13271 show_ip_bgp_dampened_paths_cmd
,
13272 "show ip bgp dampened-paths",
13276 "Display paths suppressed due to dampening\n")
13278 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_dampend_paths
,
13282 DEFUN (show_ip_bgp_flap_statistics
,
13283 show_ip_bgp_flap_statistics_cmd
,
13284 "show ip bgp flap-statistics",
13288 "Display flap statistics of routes\n")
13290 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
13291 bgp_show_type_flap_statistics
, NULL
, NULL
);
13294 /* Display specified route of BGP table. */
13296 bgp_clear_damp_route (struct vty
*vty
, const char *view_name
,
13297 const char *ip_str
, afi_t afi
, safi_t safi
,
13298 struct prefix_rd
*prd
, int prefix_check
)
13301 struct prefix match
;
13302 struct bgp_node
*rn
;
13303 struct bgp_node
*rm
;
13304 struct bgp_info
*ri
;
13305 struct bgp_info
*ri_temp
;
13307 struct bgp_table
*table
;
13309 /* BGP structure lookup. */
13312 bgp
= bgp_lookup_by_name (view_name
);
13315 vty_out (vty
, "%% Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
13316 return CMD_WARNING
;
13321 bgp
= bgp_get_default ();
13324 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
13325 return CMD_WARNING
;
13329 /* Check IP address argument. */
13330 ret
= str2prefix (ip_str
, &match
);
13333 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
13334 return CMD_WARNING
;
13337 match
.family
= afi2family (afi
);
13339 if (safi
== SAFI_MPLS_VPN
)
13341 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= bgp_route_next (rn
))
13343 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
13346 if ((table
= rn
->info
) != NULL
)
13347 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
13349 if (! prefix_check
|| rm
->p
.prefixlen
== match
.prefixlen
)
13354 if (ri
->extra
&& ri
->extra
->damp_info
)
13356 ri_temp
= ri
->next
;
13357 bgp_damp_info_free (ri
->extra
->damp_info
, 1);
13365 bgp_unlock_node (rm
);
13371 if ((rn
= bgp_node_match (bgp
->rib
[afi
][safi
], &match
)) != NULL
)
13373 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
13378 if (ri
->extra
&& ri
->extra
->damp_info
)
13380 ri_temp
= ri
->next
;
13381 bgp_damp_info_free (ri
->extra
->damp_info
, 1);
13389 bgp_unlock_node (rn
);
13393 return CMD_SUCCESS
;
13396 DEFUN (clear_ip_bgp_dampening
,
13397 clear_ip_bgp_dampening_cmd
,
13398 "clear ip bgp dampening",
13402 "Clear route flap dampening information\n")
13404 bgp_damp_info_clean ();
13405 return CMD_SUCCESS
;
13408 DEFUN (clear_ip_bgp_dampening_prefix
,
13409 clear_ip_bgp_dampening_prefix_cmd
,
13410 "clear ip bgp dampening A.B.C.D/M",
13414 "Clear route flap dampening information\n"
13415 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
13417 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
13418 SAFI_UNICAST
, NULL
, 1);
13421 DEFUN (clear_ip_bgp_dampening_address
,
13422 clear_ip_bgp_dampening_address_cmd
,
13423 "clear ip bgp dampening A.B.C.D",
13427 "Clear route flap dampening information\n"
13428 "Network to clear damping information\n")
13430 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
13431 SAFI_UNICAST
, NULL
, 0);
13434 DEFUN (clear_ip_bgp_dampening_address_mask
,
13435 clear_ip_bgp_dampening_address_mask_cmd
,
13436 "clear ip bgp dampening A.B.C.D A.B.C.D",
13440 "Clear route flap dampening information\n"
13441 "Network to clear damping information\n"
13445 char prefix_str
[BUFSIZ
];
13447 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
13450 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
13451 return CMD_WARNING
;
13454 return bgp_clear_damp_route (vty
, NULL
, prefix_str
, AFI_IP
,
13455 SAFI_UNICAST
, NULL
, 0);
13459 bgp_config_write_network_vpnv4 (struct vty
*vty
, struct bgp
*bgp
,
13460 afi_t afi
, safi_t safi
, int *write
)
13462 struct bgp_node
*prn
;
13463 struct bgp_node
*rn
;
13464 struct bgp_table
*table
;
13466 struct prefix_rd
*prd
;
13467 struct bgp_static
*bgp_static
;
13469 char buf
[SU_ADDRSTRLEN
];
13470 char rdbuf
[RD_ADDRSTRLEN
];
13472 /* Network configuration. */
13473 for (prn
= bgp_table_top (bgp
->route
[afi
][safi
]); prn
; prn
= bgp_route_next (prn
))
13474 if ((table
= prn
->info
) != NULL
)
13475 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
13476 if ((bgp_static
= rn
->info
) != NULL
)
13479 prd
= (struct prefix_rd
*) &prn
->p
;
13481 /* "address-family" display. */
13482 bgp_config_write_family_header (vty
, afi
, safi
, write
);
13484 /* "network" configuration display. */
13485 prefix_rd2str (prd
, rdbuf
, RD_ADDRSTRLEN
);
13486 label
= decode_label (bgp_static
->tag
);
13488 vty_out (vty
, " network %s/%d rd %s tag %d",
13489 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
13492 vty_out (vty
, "%s", VTY_NEWLINE
);
13497 /* Configuration of static route announcement and aggregate
13500 bgp_config_write_network (struct vty
*vty
, struct bgp
*bgp
,
13501 afi_t afi
, safi_t safi
, int *write
)
13503 struct bgp_node
*rn
;
13505 struct bgp_static
*bgp_static
;
13506 struct bgp_aggregate
*bgp_aggregate
;
13507 char buf
[SU_ADDRSTRLEN
];
13509 if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
13510 return bgp_config_write_network_vpnv4 (vty
, bgp
, afi
, safi
, write
);
13512 /* Network configuration. */
13513 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
13514 if ((bgp_static
= rn
->info
) != NULL
)
13518 /* "address-family" display. */
13519 bgp_config_write_family_header (vty
, afi
, safi
, write
);
13521 /* "network" configuration display. */
13522 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
13524 u_int32_t destination
;
13525 struct in_addr netmask
;
13527 destination
= ntohl (p
->u
.prefix4
.s_addr
);
13528 masklen2ip (p
->prefixlen
, &netmask
);
13529 vty_out (vty
, " network %s",
13530 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
));
13532 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
13533 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
13534 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
13535 || p
->u
.prefix4
.s_addr
== 0)
13537 /* Natural mask is not display. */
13540 vty_out (vty
, " mask %s", inet_ntoa (netmask
));
13544 vty_out (vty
, " network %s/%d",
13545 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
13549 if (bgp_static
->rmap
.name
)
13550 vty_out (vty
, " route-map %s", bgp_static
->rmap
.name
);
13553 if (bgp_static
->backdoor
)
13554 vty_out (vty
, " backdoor");
13557 vty_out (vty
, "%s", VTY_NEWLINE
);
13560 /* Aggregate-address configuration. */
13561 for (rn
= bgp_table_top (bgp
->aggregate
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
13562 if ((bgp_aggregate
= rn
->info
) != NULL
)
13566 /* "address-family" display. */
13567 bgp_config_write_family_header (vty
, afi
, safi
, write
);
13569 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
13571 struct in_addr netmask
;
13573 masklen2ip (p
->prefixlen
, &netmask
);
13574 vty_out (vty
, " aggregate-address %s %s",
13575 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
13576 inet_ntoa (netmask
));
13580 vty_out (vty
, " aggregate-address %s/%d",
13581 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
13585 if (bgp_aggregate
->as_set
)
13586 vty_out (vty
, " as-set");
13588 if (bgp_aggregate
->summary_only
)
13589 vty_out (vty
, " summary-only");
13591 vty_out (vty
, "%s", VTY_NEWLINE
);
13598 bgp_config_write_distance (struct vty
*vty
, struct bgp
*bgp
)
13600 struct bgp_node
*rn
;
13601 struct bgp_distance
*bdistance
;
13603 /* Distance configuration. */
13604 if (bgp
->distance_ebgp
13605 && bgp
->distance_ibgp
13606 && bgp
->distance_local
13607 && (bgp
->distance_ebgp
!= ZEBRA_EBGP_DISTANCE_DEFAULT
13608 || bgp
->distance_ibgp
!= ZEBRA_IBGP_DISTANCE_DEFAULT
13609 || bgp
->distance_local
!= ZEBRA_IBGP_DISTANCE_DEFAULT
))
13610 vty_out (vty
, " distance bgp %d %d %d%s",
13611 bgp
->distance_ebgp
, bgp
->distance_ibgp
, bgp
->distance_local
,
13614 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
13615 if ((bdistance
= rn
->info
) != NULL
)
13617 vty_out (vty
, " distance %d %s/%d %s%s", bdistance
->distance
,
13618 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
13619 bdistance
->access_list
? bdistance
->access_list
: "",
13626 /* Allocate routing table structure and install commands. */
13628 bgp_route_init (void)
13630 /* Init BGP distance table. */
13631 bgp_distance_table
= bgp_table_init (AFI_IP
, SAFI_UNICAST
);
13633 /* IPv4 BGP commands. */
13634 install_element (BGP_NODE
, &bgp_table_map_cmd
);
13635 install_element (BGP_NODE
, &bgp_network_cmd
);
13636 install_element (BGP_NODE
, &bgp_network_mask_cmd
);
13637 install_element (BGP_NODE
, &bgp_network_mask_natural_cmd
);
13638 install_element (BGP_NODE
, &bgp_network_route_map_cmd
);
13639 install_element (BGP_NODE
, &bgp_network_mask_route_map_cmd
);
13640 install_element (BGP_NODE
, &bgp_network_mask_natural_route_map_cmd
);
13641 install_element (BGP_NODE
, &bgp_network_backdoor_cmd
);
13642 install_element (BGP_NODE
, &bgp_network_mask_backdoor_cmd
);
13643 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_cmd
);
13644 install_element (BGP_NODE
, &no_bgp_table_map_cmd
);
13645 install_element (BGP_NODE
, &no_bgp_network_cmd
);
13646 install_element (BGP_NODE
, &no_bgp_network_mask_cmd
);
13647 install_element (BGP_NODE
, &no_bgp_network_mask_natural_cmd
);
13648 install_element (BGP_NODE
, &no_bgp_network_route_map_cmd
);
13649 install_element (BGP_NODE
, &no_bgp_network_mask_route_map_cmd
);
13650 install_element (BGP_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
13651 install_element (BGP_NODE
, &no_bgp_network_backdoor_cmd
);
13652 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_cmd
);
13653 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_cmd
);
13655 install_element (BGP_NODE
, &aggregate_address_cmd
);
13656 install_element (BGP_NODE
, &aggregate_address_mask_cmd
);
13657 install_element (BGP_NODE
, &aggregate_address_summary_only_cmd
);
13658 install_element (BGP_NODE
, &aggregate_address_mask_summary_only_cmd
);
13659 install_element (BGP_NODE
, &aggregate_address_as_set_cmd
);
13660 install_element (BGP_NODE
, &aggregate_address_mask_as_set_cmd
);
13661 install_element (BGP_NODE
, &aggregate_address_as_set_summary_cmd
);
13662 install_element (BGP_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
13663 install_element (BGP_NODE
, &aggregate_address_summary_as_set_cmd
);
13664 install_element (BGP_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
13665 install_element (BGP_NODE
, &no_aggregate_address_cmd
);
13666 install_element (BGP_NODE
, &no_aggregate_address_summary_only_cmd
);
13667 install_element (BGP_NODE
, &no_aggregate_address_as_set_cmd
);
13668 install_element (BGP_NODE
, &no_aggregate_address_as_set_summary_cmd
);
13669 install_element (BGP_NODE
, &no_aggregate_address_summary_as_set_cmd
);
13670 install_element (BGP_NODE
, &no_aggregate_address_mask_cmd
);
13671 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
13672 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_cmd
);
13673 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
13674 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
13676 /* IPv4 unicast configuration. */
13677 install_element (BGP_IPV4_NODE
, &bgp_table_map_cmd
);
13678 install_element (BGP_IPV4_NODE
, &bgp_network_cmd
);
13679 install_element (BGP_IPV4_NODE
, &bgp_network_mask_cmd
);
13680 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_cmd
);
13681 install_element (BGP_IPV4_NODE
, &bgp_network_route_map_cmd
);
13682 install_element (BGP_IPV4_NODE
, &bgp_network_mask_route_map_cmd
);
13683 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_route_map_cmd
);
13684 install_element (BGP_IPV4_NODE
, &no_bgp_table_map_cmd
);
13685 install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
13686 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_cmd
);
13687 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_cmd
);
13688 install_element (BGP_IPV4_NODE
, &no_bgp_network_route_map_cmd
);
13689 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_route_map_cmd
);
13690 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
13692 install_element (BGP_IPV4_NODE
, &aggregate_address_cmd
);
13693 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_cmd
);
13694 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_only_cmd
);
13695 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_only_cmd
);
13696 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_cmd
);
13697 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_cmd
);
13698 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_summary_cmd
);
13699 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
13700 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_as_set_cmd
);
13701 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
13702 install_element (BGP_IPV4_NODE
, &no_aggregate_address_cmd
);
13703 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_only_cmd
);
13704 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_cmd
);
13705 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_summary_cmd
);
13706 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_as_set_cmd
);
13707 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_cmd
);
13708 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
13709 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_cmd
);
13710 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
13711 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
13713 /* IPv4 multicast configuration. */
13714 install_element (BGP_IPV4M_NODE
, &bgp_table_map_cmd
);
13715 install_element (BGP_IPV4M_NODE
, &bgp_network_cmd
);
13716 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_cmd
);
13717 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_cmd
);
13718 install_element (BGP_IPV4M_NODE
, &bgp_network_route_map_cmd
);
13719 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_route_map_cmd
);
13720 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_route_map_cmd
);
13721 install_element (BGP_IPV4M_NODE
, &no_bgp_table_map_cmd
);
13722 install_element (BGP_IPV4M_NODE
, &no_bgp_network_cmd
);
13723 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_cmd
);
13724 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_cmd
);
13725 install_element (BGP_IPV4M_NODE
, &no_bgp_network_route_map_cmd
);
13726 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_route_map_cmd
);
13727 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
13728 install_element (BGP_IPV4M_NODE
, &aggregate_address_cmd
);
13729 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_cmd
);
13730 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_only_cmd
);
13731 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_only_cmd
);
13732 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_cmd
);
13733 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_cmd
);
13734 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_summary_cmd
);
13735 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
13736 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_as_set_cmd
);
13737 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
13738 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_cmd
);
13739 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_only_cmd
);
13740 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_cmd
);
13741 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_summary_cmd
);
13742 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_as_set_cmd
);
13743 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_cmd
);
13744 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
13745 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_cmd
);
13746 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
13747 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
13749 install_element (VIEW_NODE
, &show_ip_bgp_cmd
);
13750 install_element (VIEW_NODE
, &show_ip_bgp_csv_cmd
);
13751 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cmd
);
13752 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_cmd
);
13753 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_csv_cmd
);
13754 install_element (VIEW_NODE
, &show_ip_bgp_route_cmd
);
13755 install_element (VIEW_NODE
, &show_ip_bgp_route_pathtype_cmd
);
13756 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_route_pathtype_cmd
);
13757 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_cmd
);
13758 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_route_cmd
);
13759 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
13760 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
13761 install_element (VIEW_NODE
, &show_ip_bgp_prefix_cmd
);
13762 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
13763 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_pathtype_cmd
);
13764 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_prefix_pathtype_cmd
);
13765 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_prefix_cmd
);
13766 install_element (VIEW_NODE
, &show_ip_bgp_prefix_pathtype_cmd
);
13767 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
13768 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
13769 install_element (VIEW_NODE
, &show_ip_bgp_view_cmd
);
13770 install_element (VIEW_NODE
, &show_ip_bgp_view_route_cmd
);
13771 install_element (VIEW_NODE
, &show_ip_bgp_view_prefix_cmd
);
13772 install_element (VIEW_NODE
, &show_ip_bgp_regexp_cmd
);
13773 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
13774 install_element (VIEW_NODE
, &show_ip_bgp_prefix_list_cmd
);
13775 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
13776 install_element (VIEW_NODE
, &show_ip_bgp_filter_list_cmd
);
13777 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
13778 install_element (VIEW_NODE
, &show_ip_bgp_route_map_cmd
);
13779 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
13780 install_element (VIEW_NODE
, &show_ip_bgp_cidr_only_cmd
);
13781 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
13782 install_element (VIEW_NODE
, &show_ip_bgp_community_all_cmd
);
13783 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
13784 install_element (VIEW_NODE
, &show_ip_bgp_community_cmd
);
13785 install_element (VIEW_NODE
, &show_ip_bgp_community2_cmd
);
13786 install_element (VIEW_NODE
, &show_ip_bgp_community3_cmd
);
13787 install_element (VIEW_NODE
, &show_ip_bgp_community4_cmd
);
13788 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_cmd
);
13789 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
13790 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
13791 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
13792 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community_all_cmd
);
13793 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community_cmd
);
13794 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community2_cmd
);
13795 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community3_cmd
);
13796 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_community4_cmd
);
13797 install_element (VIEW_NODE
, &show_ip_bgp_community_exact_cmd
);
13798 install_element (VIEW_NODE
, &show_ip_bgp_community2_exact_cmd
);
13799 install_element (VIEW_NODE
, &show_ip_bgp_community3_exact_cmd
);
13800 install_element (VIEW_NODE
, &show_ip_bgp_community4_exact_cmd
);
13801 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
13802 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
13803 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
13804 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
13805 install_element (VIEW_NODE
, &show_ip_bgp_community_list_cmd
);
13806 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
13807 install_element (VIEW_NODE
, &show_ip_bgp_community_list_exact_cmd
);
13808 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
13809 install_element (VIEW_NODE
, &show_ip_bgp_prefix_longer_cmd
);
13810 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
13811 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
13812 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_rmap_cmd
);
13813 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_csv_cmd
);
13814 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_csv_rmap_cmd
);
13815 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
13816 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd
);
13817 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
13818 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_routes_rmap_cmd
);
13819 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
13820 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd
);
13821 install_element (VIEW_NODE
, &show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd
);
13822 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
13823 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_routes_csv_cmd
);
13824 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
13825 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
13826 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
13827 install_element (VIEW_NODE
, &show_ip_bgp_dampened_paths_cmd
);
13828 install_element (VIEW_NODE
, &show_ip_bgp_flap_statistics_cmd
);
13829 install_element (VIEW_NODE
, &show_ip_bgp_flap_address_cmd
);
13830 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_cmd
);
13831 install_element (VIEW_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
13832 install_element (VIEW_NODE
, &show_ip_bgp_flap_regexp_cmd
);
13833 install_element (VIEW_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
13834 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
13835 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
13836 install_element (VIEW_NODE
, &show_ip_bgp_flap_route_map_cmd
);
13837 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
13838 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
13839 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_cmd
);
13840 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_rsclient_cmd
);
13841 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_route_cmd
);
13842 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_rsclient_route_cmd
);
13843 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
13844 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_rsclient_prefix_cmd
);
13845 install_element (VIEW_NODE
, &show_ip_bgp_view_neighbor_advertised_route_cmd
);
13846 install_element (VIEW_NODE
, &show_ip_bgp_view_neighbor_received_routes_cmd
);
13847 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_cmd
);
13848 install_element (VIEW_NODE
, &show_bgp_view_ipv4_safi_rsclient_cmd
);
13849 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
13850 install_element (VIEW_NODE
, &show_bgp_view_ipv4_safi_rsclient_route_cmd
);
13851 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
13852 install_element (VIEW_NODE
, &show_bgp_view_ipv4_safi_rsclient_prefix_cmd
);
13854 /* Restricted node: VIEW_NODE - (set of dangerous commands) */
13855 install_element (RESTRICTED_NODE
, &show_ip_bgp_route_cmd
);
13856 install_element (RESTRICTED_NODE
, &show_ip_bgp_route_pathtype_cmd
);
13857 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_route_pathtype_cmd
);
13858 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_route_cmd
);
13859 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_route_cmd
);
13860 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
13861 install_element (RESTRICTED_NODE
, &show_ip_bgp_prefix_cmd
);
13862 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
13863 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_prefix_pathtype_cmd
);
13864 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_prefix_pathtype_cmd
);
13865 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_prefix_cmd
);
13866 install_element (RESTRICTED_NODE
, &show_ip_bgp_prefix_pathtype_cmd
);
13867 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
13868 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
13869 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_route_cmd
);
13870 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_prefix_cmd
);
13871 install_element (RESTRICTED_NODE
, &show_ip_bgp_community_cmd
);
13872 install_element (RESTRICTED_NODE
, &show_ip_bgp_community2_cmd
);
13873 install_element (RESTRICTED_NODE
, &show_ip_bgp_community3_cmd
);
13874 install_element (RESTRICTED_NODE
, &show_ip_bgp_community4_cmd
);
13875 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community_cmd
);
13876 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
13877 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
13878 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
13879 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community_all_cmd
);
13880 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community_cmd
);
13881 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community2_cmd
);
13882 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community3_cmd
);
13883 install_element (RESTRICTED_NODE
, &show_bgp_view_afi_safi_community4_cmd
);
13884 install_element (RESTRICTED_NODE
, &show_ip_bgp_community_exact_cmd
);
13885 install_element (RESTRICTED_NODE
, &show_ip_bgp_community2_exact_cmd
);
13886 install_element (RESTRICTED_NODE
, &show_ip_bgp_community3_exact_cmd
);
13887 install_element (RESTRICTED_NODE
, &show_ip_bgp_community4_exact_cmd
);
13888 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
13889 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
13890 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
13891 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
13892 install_element (RESTRICTED_NODE
, &show_ip_bgp_rsclient_route_cmd
);
13893 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_rsclient_route_cmd
);
13894 install_element (RESTRICTED_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
13895 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_rsclient_prefix_cmd
);
13896 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
13897 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv4_safi_rsclient_route_cmd
);
13898 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
13899 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv4_safi_rsclient_prefix_cmd
);
13901 install_element (ENABLE_NODE
, &show_ip_bgp_cmd
);
13902 install_element (ENABLE_NODE
, &show_ip_bgp_csv_cmd
);
13903 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cmd
);
13904 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_cmd
);
13905 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_csv_cmd
);
13906 install_element (ENABLE_NODE
, &show_ip_bgp_route_cmd
);
13907 install_element (ENABLE_NODE
, &show_ip_bgp_route_pathtype_cmd
);
13908 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_route_pathtype_cmd
);
13909 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_cmd
);
13910 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_route_cmd
);
13911 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
13912 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
13913 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_cmd
);
13914 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
13915 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_pathtype_cmd
);
13916 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_prefix_pathtype_cmd
);
13917 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_prefix_cmd
);
13918 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_pathtype_cmd
);
13919 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
13920 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
13921 install_element (ENABLE_NODE
, &show_ip_bgp_view_cmd
);
13922 install_element (ENABLE_NODE
, &show_ip_bgp_view_route_cmd
);
13923 install_element (ENABLE_NODE
, &show_ip_bgp_view_prefix_cmd
);
13924 install_element (ENABLE_NODE
, &show_ip_bgp_regexp_cmd
);
13925 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
13926 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_list_cmd
);
13927 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
13928 install_element (ENABLE_NODE
, &show_ip_bgp_filter_list_cmd
);
13929 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
13930 install_element (ENABLE_NODE
, &show_ip_bgp_route_map_cmd
);
13931 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
13932 install_element (ENABLE_NODE
, &show_ip_bgp_cidr_only_cmd
);
13933 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
13934 install_element (ENABLE_NODE
, &show_ip_bgp_community_all_cmd
);
13935 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
13936 install_element (ENABLE_NODE
, &show_ip_bgp_community_cmd
);
13937 install_element (ENABLE_NODE
, &show_ip_bgp_community2_cmd
);
13938 install_element (ENABLE_NODE
, &show_ip_bgp_community3_cmd
);
13939 install_element (ENABLE_NODE
, &show_ip_bgp_community4_cmd
);
13940 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_cmd
);
13941 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
13942 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
13943 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
13944 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community_all_cmd
);
13945 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community_cmd
);
13946 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community2_cmd
);
13947 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community3_cmd
);
13948 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_community4_cmd
);
13949 install_element (ENABLE_NODE
, &show_ip_bgp_community_exact_cmd
);
13950 install_element (ENABLE_NODE
, &show_ip_bgp_community2_exact_cmd
);
13951 install_element (ENABLE_NODE
, &show_ip_bgp_community3_exact_cmd
);
13952 install_element (ENABLE_NODE
, &show_ip_bgp_community4_exact_cmd
);
13953 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
13954 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
13955 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
13956 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
13957 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_cmd
);
13958 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
13959 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_exact_cmd
);
13960 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
13961 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_longer_cmd
);
13962 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
13963 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
13964 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_csv_cmd
);
13965 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_rmap_cmd
);
13966 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_csv_rmap_cmd
);
13967 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
13968 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd
);
13969 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
13970 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_routes_rmap_cmd
);
13971 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
13972 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd
);
13973 install_element (ENABLE_NODE
, &show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd
);
13974 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
13975 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_routes_csv_cmd
);
13976 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
13977 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
13978 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
13979 install_element (ENABLE_NODE
, &show_ip_bgp_dampened_paths_cmd
);
13980 install_element (ENABLE_NODE
, &show_ip_bgp_flap_statistics_cmd
);
13981 install_element (ENABLE_NODE
, &show_ip_bgp_flap_address_cmd
);
13982 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_cmd
);
13983 install_element (ENABLE_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
13984 install_element (ENABLE_NODE
, &show_ip_bgp_flap_regexp_cmd
);
13985 install_element (ENABLE_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
13986 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
13987 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
13988 install_element (ENABLE_NODE
, &show_ip_bgp_flap_route_map_cmd
);
13989 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
13990 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
13991 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_cmd
);
13992 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_rsclient_cmd
);
13993 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_route_cmd
);
13994 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_rsclient_route_cmd
);
13995 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
13996 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_rsclient_prefix_cmd
);
13997 install_element (ENABLE_NODE
, &show_ip_bgp_view_neighbor_advertised_route_cmd
);
13998 install_element (ENABLE_NODE
, &show_ip_bgp_view_neighbor_received_routes_cmd
);
13999 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_cmd
);
14000 install_element (ENABLE_NODE
, &show_bgp_view_ipv4_safi_rsclient_cmd
);
14001 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
14002 install_element (ENABLE_NODE
, &show_bgp_view_ipv4_safi_rsclient_route_cmd
);
14003 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
14004 install_element (ENABLE_NODE
, &show_bgp_view_ipv4_safi_rsclient_prefix_cmd
);
14006 /* BGP dampening clear commands */
14007 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_cmd
);
14008 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_prefix_cmd
);
14009 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_cmd
);
14010 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_mask_cmd
);
14013 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_prefix_counts_cmd
);
14014 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_prefix_counts_cmd
);
14015 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd
);
14017 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_prefix_counts_cmd
);
14019 /* New config IPv6 BGP commands. */
14020 install_element (BGP_IPV6_NODE
, &bgp_table_map_cmd
);
14021 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_cmd
);
14022 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_route_map_cmd
);
14023 install_element (BGP_IPV6_NODE
, &no_bgp_table_map_cmd
);
14024 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_cmd
);
14025 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_route_map_cmd
);
14027 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_cmd
);
14028 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_summary_only_cmd
);
14029 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_cmd
);
14030 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_summary_only_cmd
);
14032 install_element (BGP_IPV6M_NODE
, &ipv6_bgp_network_cmd
);
14033 install_element (BGP_IPV6M_NODE
, &no_ipv6_bgp_network_cmd
);
14035 /* Old config IPv6 BGP commands. */
14036 install_element (BGP_NODE
, &old_ipv6_bgp_network_cmd
);
14037 install_element (BGP_NODE
, &old_no_ipv6_bgp_network_cmd
);
14039 install_element (BGP_NODE
, &old_ipv6_aggregate_address_cmd
);
14040 install_element (BGP_NODE
, &old_ipv6_aggregate_address_summary_only_cmd
);
14041 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_cmd
);
14042 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_summary_only_cmd
);
14044 install_element (VIEW_NODE
, &show_bgp_cmd
);
14045 install_element (VIEW_NODE
, &show_bgp_ipv6_cmd
);
14046 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_cmd
);
14047 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_csv_cmd
);
14048 install_element (VIEW_NODE
, &show_bgp_route_cmd
);
14049 install_element (VIEW_NODE
, &show_bgp_ipv6_route_cmd
);
14050 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_route_cmd
);
14051 install_element (VIEW_NODE
, &show_bgp_route_pathtype_cmd
);
14052 install_element (VIEW_NODE
, &show_bgp_ipv6_route_pathtype_cmd
);
14053 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_route_pathtype_cmd
);
14054 install_element (VIEW_NODE
, &show_bgp_prefix_cmd
);
14055 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_cmd
);
14056 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_prefix_cmd
);
14057 install_element (VIEW_NODE
, &show_bgp_prefix_pathtype_cmd
);
14058 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_pathtype_cmd
);
14059 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_prefix_pathtype_cmd
);
14060 install_element (VIEW_NODE
, &show_bgp_regexp_cmd
);
14061 install_element (VIEW_NODE
, &show_bgp_ipv6_regexp_cmd
);
14062 install_element (VIEW_NODE
, &show_bgp_prefix_list_cmd
);
14063 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
14064 install_element (VIEW_NODE
, &show_bgp_filter_list_cmd
);
14065 install_element (VIEW_NODE
, &show_bgp_ipv6_filter_list_cmd
);
14066 install_element (VIEW_NODE
, &show_bgp_route_map_cmd
);
14067 install_element (VIEW_NODE
, &show_bgp_ipv6_route_map_cmd
);
14068 install_element (VIEW_NODE
, &show_bgp_community_all_cmd
);
14069 install_element (VIEW_NODE
, &show_bgp_ipv6_community_all_cmd
);
14070 install_element (VIEW_NODE
, &show_bgp_community_cmd
);
14071 install_element (VIEW_NODE
, &show_bgp_ipv6_community_cmd
);
14072 install_element (VIEW_NODE
, &show_bgp_community2_cmd
);
14073 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_cmd
);
14074 install_element (VIEW_NODE
, &show_bgp_community3_cmd
);
14075 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_cmd
);
14076 install_element (VIEW_NODE
, &show_bgp_community4_cmd
);
14077 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_cmd
);
14078 install_element (VIEW_NODE
, &show_bgp_community_exact_cmd
);
14079 install_element (VIEW_NODE
, &show_bgp_ipv6_community_exact_cmd
);
14080 install_element (VIEW_NODE
, &show_bgp_community2_exact_cmd
);
14081 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
14082 install_element (VIEW_NODE
, &show_bgp_community3_exact_cmd
);
14083 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
14084 install_element (VIEW_NODE
, &show_bgp_community4_exact_cmd
);
14085 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
14086 install_element (VIEW_NODE
, &show_bgp_community_list_cmd
);
14087 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_cmd
);
14088 install_element (VIEW_NODE
, &show_bgp_community_list_exact_cmd
);
14089 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
14090 install_element (VIEW_NODE
, &show_bgp_prefix_longer_cmd
);
14091 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
14092 install_element (VIEW_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
14093 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
14094 install_element (VIEW_NODE
, &show_bgp_neighbor_advertised_route_csv_cmd
);
14095 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_advertised_route_csv_cmd
);
14096 install_element (VIEW_NODE
, &show_bgp_neighbor_received_routes_cmd
);
14097 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
14098 install_element (VIEW_NODE
, &show_bgp_neighbor_routes_cmd
);
14099 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
14100 install_element (VIEW_NODE
, &show_bgp_neighbor_routes_csv_cmd
);
14101 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_routes_csv_cmd
);
14102 install_element (VIEW_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
14103 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
14104 install_element (VIEW_NODE
, &show_bgp_neighbor_flap_cmd
);
14105 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
14106 install_element (VIEW_NODE
, &show_bgp_neighbor_damp_cmd
);
14107 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
14108 install_element (VIEW_NODE
, &show_bgp_rsclient_cmd
);
14109 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_rsclient_cmd
);
14110 install_element (VIEW_NODE
, &show_bgp_rsclient_route_cmd
);
14111 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_rsclient_route_cmd
);
14112 install_element (VIEW_NODE
, &show_bgp_rsclient_prefix_cmd
);
14113 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_rsclient_prefix_cmd
);
14114 install_element (VIEW_NODE
, &show_bgp_view_cmd
);
14115 install_element (VIEW_NODE
, &show_bgp_view_ipv6_cmd
);
14116 install_element (VIEW_NODE
, &show_bgp_view_route_cmd
);
14117 install_element (VIEW_NODE
, &show_bgp_view_ipv6_route_cmd
);
14118 install_element (VIEW_NODE
, &show_bgp_view_prefix_cmd
);
14119 install_element (VIEW_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
14120 install_element (VIEW_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
14121 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
14122 install_element (VIEW_NODE
, &show_bgp_view_neighbor_advertised_route_csv_cmd
);
14123 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_csv_cmd
);
14124 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
14125 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
14126 install_element (VIEW_NODE
, &show_bgp_view_neighbor_routes_cmd
);
14127 install_element (VIEW_NODE
, &show_bgp_view_neighbor_routes_csv_cmd
);
14128 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
14129 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
14130 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
14131 install_element (VIEW_NODE
, &show_bgp_view_neighbor_flap_cmd
);
14132 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
14133 install_element (VIEW_NODE
, &show_bgp_view_neighbor_damp_cmd
);
14134 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
14135 install_element (VIEW_NODE
, &show_bgp_view_rsclient_cmd
);
14136 install_element (VIEW_NODE
, &show_bgp_view_ipv6_safi_rsclient_cmd
);
14137 install_element (VIEW_NODE
, &show_bgp_view_rsclient_route_cmd
);
14138 install_element (VIEW_NODE
, &show_bgp_view_ipv6_safi_rsclient_route_cmd
);
14139 install_element (VIEW_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
14140 install_element (VIEW_NODE
, &show_bgp_view_ipv6_safi_rsclient_prefix_cmd
);
14143 * VIEW_NODE - (set of dangerous commands) - (commands dependent on prev)
14145 install_element (RESTRICTED_NODE
, &show_bgp_route_cmd
);
14146 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_route_cmd
);
14147 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_route_cmd
);
14148 install_element (RESTRICTED_NODE
, &show_bgp_route_pathtype_cmd
);
14149 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_route_pathtype_cmd
);
14150 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_route_pathtype_cmd
);
14151 install_element (RESTRICTED_NODE
, &show_bgp_prefix_cmd
);
14152 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_prefix_cmd
);
14153 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_prefix_cmd
);
14154 install_element (RESTRICTED_NODE
, &show_bgp_prefix_pathtype_cmd
);
14155 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_prefix_pathtype_cmd
);
14156 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_prefix_pathtype_cmd
);
14157 install_element (RESTRICTED_NODE
, &show_bgp_community_cmd
);
14158 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community_cmd
);
14159 install_element (RESTRICTED_NODE
, &show_bgp_community2_cmd
);
14160 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community2_cmd
);
14161 install_element (RESTRICTED_NODE
, &show_bgp_community3_cmd
);
14162 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community3_cmd
);
14163 install_element (RESTRICTED_NODE
, &show_bgp_community4_cmd
);
14164 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community4_cmd
);
14165 install_element (RESTRICTED_NODE
, &show_bgp_community_exact_cmd
);
14166 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community_exact_cmd
);
14167 install_element (RESTRICTED_NODE
, &show_bgp_community2_exact_cmd
);
14168 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
14169 install_element (RESTRICTED_NODE
, &show_bgp_community3_exact_cmd
);
14170 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
14171 install_element (RESTRICTED_NODE
, &show_bgp_community4_exact_cmd
);
14172 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
14173 install_element (RESTRICTED_NODE
, &show_bgp_rsclient_route_cmd
);
14174 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_rsclient_route_cmd
);
14175 install_element (RESTRICTED_NODE
, &show_bgp_rsclient_prefix_cmd
);
14176 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_rsclient_prefix_cmd
);
14177 install_element (RESTRICTED_NODE
, &show_bgp_view_route_cmd
);
14178 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_route_cmd
);
14179 install_element (RESTRICTED_NODE
, &show_bgp_view_prefix_cmd
);
14180 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
14181 install_element (RESTRICTED_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
14182 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
14183 install_element (RESTRICTED_NODE
, &show_bgp_view_rsclient_route_cmd
);
14184 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_safi_rsclient_route_cmd
);
14185 install_element (RESTRICTED_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
14186 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_safi_rsclient_prefix_cmd
);
14188 install_element (ENABLE_NODE
, &show_bgp_cmd
);
14189 install_element (ENABLE_NODE
, &show_bgp_ipv6_cmd
);
14190 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_cmd
);
14191 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_csv_cmd
);
14192 install_element (ENABLE_NODE
, &show_bgp_route_cmd
);
14193 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_cmd
);
14194 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_route_cmd
);
14195 install_element (ENABLE_NODE
, &show_bgp_route_pathtype_cmd
);
14196 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_pathtype_cmd
);
14197 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_route_pathtype_cmd
);
14198 install_element (ENABLE_NODE
, &show_bgp_prefix_cmd
);
14199 install_element (ENABLE_NODE
, &show_bgp_prefix_pathtype_cmd
);
14200 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_pathtype_cmd
);
14201 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_prefix_pathtype_cmd
);
14202 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_cmd
);
14203 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_prefix_cmd
);
14204 install_element (ENABLE_NODE
, &show_bgp_regexp_cmd
);
14205 install_element (ENABLE_NODE
, &show_bgp_ipv6_regexp_cmd
);
14206 install_element (ENABLE_NODE
, &show_bgp_prefix_list_cmd
);
14207 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
14208 install_element (ENABLE_NODE
, &show_bgp_filter_list_cmd
);
14209 install_element (ENABLE_NODE
, &show_bgp_ipv6_filter_list_cmd
);
14210 install_element (ENABLE_NODE
, &show_bgp_route_map_cmd
);
14211 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_map_cmd
);
14212 install_element (ENABLE_NODE
, &show_bgp_community_all_cmd
);
14213 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_all_cmd
);
14214 install_element (ENABLE_NODE
, &show_bgp_community_cmd
);
14215 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_cmd
);
14216 install_element (ENABLE_NODE
, &show_bgp_community2_cmd
);
14217 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_cmd
);
14218 install_element (ENABLE_NODE
, &show_bgp_community3_cmd
);
14219 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_cmd
);
14220 install_element (ENABLE_NODE
, &show_bgp_community4_cmd
);
14221 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_cmd
);
14222 install_element (ENABLE_NODE
, &show_bgp_community_exact_cmd
);
14223 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_exact_cmd
);
14224 install_element (ENABLE_NODE
, &show_bgp_community2_exact_cmd
);
14225 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
14226 install_element (ENABLE_NODE
, &show_bgp_community3_exact_cmd
);
14227 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
14228 install_element (ENABLE_NODE
, &show_bgp_community4_exact_cmd
);
14229 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
14230 install_element (ENABLE_NODE
, &show_bgp_community_list_cmd
);
14231 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_cmd
);
14232 install_element (ENABLE_NODE
, &show_bgp_community_list_exact_cmd
);
14233 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
14234 install_element (ENABLE_NODE
, &show_bgp_prefix_longer_cmd
);
14235 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
14236 install_element (ENABLE_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
14237 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
14238 install_element (ENABLE_NODE
, &show_bgp_neighbor_advertised_route_csv_cmd
);
14239 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_advertised_route_csv_cmd
);
14240 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_routes_cmd
);
14241 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
14242 install_element (ENABLE_NODE
, &show_bgp_neighbor_routes_cmd
);
14243 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
14244 install_element (ENABLE_NODE
, &show_bgp_neighbor_routes_csv_cmd
);
14245 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_routes_csv_cmd
);
14246 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
14247 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
14248 install_element (ENABLE_NODE
, &show_bgp_neighbor_flap_cmd
);
14249 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
14250 install_element (ENABLE_NODE
, &show_bgp_neighbor_damp_cmd
);
14251 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
14252 install_element (ENABLE_NODE
, &show_bgp_rsclient_cmd
);
14253 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_rsclient_cmd
);
14254 install_element (ENABLE_NODE
, &show_bgp_rsclient_route_cmd
);
14255 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_rsclient_route_cmd
);
14256 install_element (ENABLE_NODE
, &show_bgp_rsclient_prefix_cmd
);
14257 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_rsclient_prefix_cmd
);
14258 install_element (ENABLE_NODE
, &show_bgp_view_cmd
);
14259 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_cmd
);
14260 install_element (ENABLE_NODE
, &show_bgp_view_route_cmd
);
14261 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_route_cmd
);
14262 install_element (ENABLE_NODE
, &show_bgp_view_prefix_cmd
);
14263 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
14264 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
14265 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
14266 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_advertised_route_csv_cmd
);
14267 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_csv_cmd
);
14268 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
14269 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
14270 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_routes_cmd
);
14271 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_routes_csv_cmd
);
14272 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
14273 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
14274 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
14275 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_flap_cmd
);
14276 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
14277 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_damp_cmd
);
14278 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
14279 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_cmd
);
14280 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_safi_rsclient_cmd
);
14281 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_route_cmd
);
14282 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_safi_rsclient_route_cmd
);
14283 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
14284 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_safi_rsclient_prefix_cmd
);
14287 install_element (ENABLE_NODE
, &show_bgp_statistics_cmd
);
14288 install_element (ENABLE_NODE
, &show_bgp_statistics_vpnv4_cmd
);
14289 install_element (ENABLE_NODE
, &show_bgp_statistics_view_cmd
);
14290 install_element (ENABLE_NODE
, &show_bgp_statistics_view_vpnv4_cmd
);
14293 install_element (VIEW_NODE
, &show_ipv6_bgp_cmd
);
14294 install_element (VIEW_NODE
, &show_ipv6_bgp_route_cmd
);
14295 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_cmd
);
14296 install_element (VIEW_NODE
, &show_ipv6_bgp_regexp_cmd
);
14297 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
14298 install_element (VIEW_NODE
, &show_ipv6_bgp_filter_list_cmd
);
14299 install_element (VIEW_NODE
, &show_ipv6_bgp_community_all_cmd
);
14300 install_element (VIEW_NODE
, &show_ipv6_bgp_community_cmd
);
14301 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_cmd
);
14302 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_cmd
);
14303 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_cmd
);
14304 install_element (VIEW_NODE
, &show_ipv6_bgp_community_exact_cmd
);
14305 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
14306 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
14307 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
14308 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_cmd
);
14309 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
14310 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
14311 install_element (VIEW_NODE
, &show_ipv6_mbgp_cmd
);
14312 install_element (VIEW_NODE
, &show_ipv6_mbgp_route_cmd
);
14313 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_cmd
);
14314 install_element (VIEW_NODE
, &show_ipv6_mbgp_regexp_cmd
);
14315 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
14316 install_element (VIEW_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
14317 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_all_cmd
);
14318 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_cmd
);
14319 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_cmd
);
14320 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_cmd
);
14321 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_cmd
);
14322 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
14323 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
14324 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
14325 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
14326 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_cmd
);
14327 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
14328 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
14331 install_element (ENABLE_NODE
, &show_ipv6_bgp_cmd
);
14332 install_element (ENABLE_NODE
, &show_ipv6_bgp_route_cmd
);
14333 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_cmd
);
14334 install_element (ENABLE_NODE
, &show_ipv6_bgp_regexp_cmd
);
14335 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
14336 install_element (ENABLE_NODE
, &show_ipv6_bgp_filter_list_cmd
);
14337 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_all_cmd
);
14338 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_cmd
);
14339 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_cmd
);
14340 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_cmd
);
14341 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_cmd
);
14342 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_exact_cmd
);
14343 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
14344 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
14345 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
14346 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_cmd
);
14347 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
14348 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
14349 install_element (ENABLE_NODE
, &show_ipv6_mbgp_cmd
);
14350 install_element (ENABLE_NODE
, &show_ipv6_mbgp_route_cmd
);
14351 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_cmd
);
14352 install_element (ENABLE_NODE
, &show_ipv6_mbgp_regexp_cmd
);
14353 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
14354 install_element (ENABLE_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
14355 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_all_cmd
);
14356 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_cmd
);
14357 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_cmd
);
14358 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_cmd
);
14359 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_cmd
);
14360 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
14361 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
14362 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
14363 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
14364 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_cmd
);
14365 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
14366 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
14369 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
14370 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
14371 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
14372 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
14375 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
14376 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
14377 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
14378 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
14381 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
14382 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
14383 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
14384 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
14385 #endif /* HAVE_IPV6 */
14387 install_element (BGP_NODE
, &bgp_distance_cmd
);
14388 install_element (BGP_NODE
, &no_bgp_distance_cmd
);
14389 install_element (BGP_NODE
, &no_bgp_distance2_cmd
);
14390 install_element (BGP_NODE
, &bgp_distance_source_cmd
);
14391 install_element (BGP_NODE
, &no_bgp_distance_source_cmd
);
14392 install_element (BGP_NODE
, &bgp_distance_source_access_list_cmd
);
14393 install_element (BGP_NODE
, &no_bgp_distance_source_access_list_cmd
);
14395 install_element (BGP_NODE
, &bgp_damp_set_cmd
);
14396 install_element (BGP_NODE
, &bgp_damp_set2_cmd
);
14397 install_element (BGP_NODE
, &bgp_damp_set3_cmd
);
14398 install_element (BGP_NODE
, &bgp_damp_unset_cmd
);
14399 install_element (BGP_NODE
, &bgp_damp_unset2_cmd
);
14400 install_element (BGP_IPV4_NODE
, &bgp_damp_set_cmd
);
14401 install_element (BGP_IPV4_NODE
, &bgp_damp_set2_cmd
);
14402 install_element (BGP_IPV4_NODE
, &bgp_damp_set3_cmd
);
14403 install_element (BGP_IPV4_NODE
, &bgp_damp_unset_cmd
);
14404 install_element (BGP_IPV4_NODE
, &bgp_damp_unset2_cmd
);
14406 /* Deprecated AS-Pathlimit commands */
14407 install_element (BGP_NODE
, &bgp_network_ttl_cmd
);
14408 install_element (BGP_NODE
, &bgp_network_mask_ttl_cmd
);
14409 install_element (BGP_NODE
, &bgp_network_mask_natural_ttl_cmd
);
14410 install_element (BGP_NODE
, &bgp_network_backdoor_ttl_cmd
);
14411 install_element (BGP_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
14412 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
);
14414 install_element (BGP_NODE
, &no_bgp_network_ttl_cmd
);
14415 install_element (BGP_NODE
, &no_bgp_network_mask_ttl_cmd
);
14416 install_element (BGP_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
14417 install_element (BGP_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
14418 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
14419 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
);
14421 install_element (BGP_IPV4_NODE
, &bgp_network_ttl_cmd
);
14422 install_element (BGP_IPV4_NODE
, &bgp_network_mask_ttl_cmd
);
14423 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_ttl_cmd
);
14424 install_element (BGP_IPV4_NODE
, &bgp_network_backdoor_ttl_cmd
);
14425 install_element (BGP_IPV4_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
14426 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
);
14428 install_element (BGP_IPV4_NODE
, &no_bgp_network_ttl_cmd
);
14429 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_ttl_cmd
);
14430 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
14431 install_element (BGP_IPV4_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
14432 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
14433 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
);
14435 install_element (BGP_IPV4M_NODE
, &bgp_network_ttl_cmd
);
14436 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_ttl_cmd
);
14437 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_ttl_cmd
);
14438 install_element (BGP_IPV4M_NODE
, &bgp_network_backdoor_ttl_cmd
);
14439 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
14440 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
);
14442 install_element (BGP_IPV4M_NODE
, &no_bgp_network_ttl_cmd
);
14443 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_ttl_cmd
);
14444 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
14445 install_element (BGP_IPV4M_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
14446 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
14447 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
);
14450 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_ttl_cmd
);
14451 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_ttl_cmd
);
14456 bgp_route_finish (void)
14458 bgp_table_unlock (bgp_distance_table
);
14459 bgp_distance_table
= NULL
;