1 /* BGP routing information
2 Copyright (C) 1996, 97, 98, 99 Kunihiro Ishiguro
4 This file is part of GNU Zebra.
6 GNU Zebra is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 GNU Zebra is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Zebra; see the file COPYING. If not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
33 #include "sockunion.h"
36 #include "workqueue.h"
38 #include "bgpd/bgpd.h"
39 #include "bgpd/bgp_table.h"
40 #include "bgpd/bgp_route.h"
41 #include "bgpd/bgp_attr.h"
42 #include "bgpd/bgp_debug.h"
43 #include "bgpd/bgp_aspath.h"
44 #include "bgpd/bgp_regex.h"
45 #include "bgpd/bgp_community.h"
46 #include "bgpd/bgp_ecommunity.h"
47 #include "bgpd/bgp_clist.h"
48 #include "bgpd/bgp_packet.h"
49 #include "bgpd/bgp_filter.h"
50 #include "bgpd/bgp_fsm.h"
51 #include "bgpd/bgp_mplsvpn.h"
52 #include "bgpd/bgp_nexthop.h"
53 #include "bgpd/bgp_damp.h"
54 #include "bgpd/bgp_advertise.h"
55 #include "bgpd/bgp_zebra.h"
56 #include "bgpd/bgp_vty.h"
58 /* Extern from bgp_dump.c */
59 extern const char *bgp_origin_str
[];
60 extern const char *bgp_origin_long_str
[];
62 static struct bgp_node
*
63 bgp_afi_node_get (struct bgp_table
*table
, afi_t afi
, safi_t safi
, struct prefix
*p
,
64 struct prefix_rd
*prd
)
67 struct bgp_node
*prn
= NULL
;
73 if (safi
== SAFI_MPLS_VPN
)
75 prn
= bgp_node_get (table
, (struct prefix
*) prd
);
77 if (prn
->info
== NULL
)
78 prn
->info
= bgp_table_init (afi
, safi
);
80 bgp_unlock_node (prn
);
84 rn
= bgp_node_get (table
, p
);
86 if (safi
== SAFI_MPLS_VPN
)
92 /* Allocate bgp_info_extra */
93 static struct bgp_info_extra
*
94 bgp_info_extra_new (void)
96 struct bgp_info_extra
*new;
97 new = XCALLOC (MTYPE_BGP_ROUTE_EXTRA
, sizeof (struct bgp_info_extra
));
102 bgp_info_extra_free (struct bgp_info_extra
**extra
)
106 if ((*extra
)->damp_info
)
107 bgp_damp_info_free ((*extra
)->damp_info
, 0);
109 (*extra
)->damp_info
= NULL
;
111 XFREE (MTYPE_BGP_ROUTE_EXTRA
, *extra
);
117 /* Get bgp_info extra information for the given bgp_info, lazy allocated
120 struct bgp_info_extra
*
121 bgp_info_extra_get (struct bgp_info
*ri
)
124 ri
->extra
= bgp_info_extra_new();
128 /* Allocate new bgp info structure. */
129 static struct bgp_info
*
132 return XCALLOC (MTYPE_BGP_ROUTE
, sizeof (struct bgp_info
));
135 /* Free bgp route information. */
137 bgp_info_free (struct bgp_info
*binfo
)
140 bgp_attr_unintern (binfo
->attr
);
142 bgp_info_extra_free (&binfo
->extra
);
144 peer_unlock (binfo
->peer
); /* bgp_info peer reference */
146 XFREE (MTYPE_BGP_ROUTE
, binfo
);
150 bgp_info_lock (struct bgp_info
*binfo
)
157 bgp_info_unlock (struct bgp_info
*binfo
)
159 assert (binfo
&& binfo
->lock
> 0);
162 if (binfo
->lock
== 0)
165 zlog_debug ("%s: unlocked and freeing", __func__
);
166 zlog_backtrace (LOG_DEBUG
);
168 bgp_info_free (binfo
);
173 if (binfo
->lock
== 1)
175 zlog_debug ("%s: unlocked to 1", __func__
);
176 zlog_backtrace (LOG_DEBUG
);
184 bgp_info_add (struct bgp_node
*rn
, struct bgp_info
*ri
)
186 struct bgp_info
*top
;
198 peer_lock (ri
->peer
); /* bgp_info peer reference */
201 /* Do the actual removal of info from RIB, for use by bgp_process
202 completion callback *only* */
204 bgp_info_reap (struct bgp_node
*rn
, struct bgp_info
*ri
)
207 ri
->next
->prev
= ri
->prev
;
209 ri
->prev
->next
= ri
->next
;
213 bgp_info_unlock (ri
);
214 bgp_unlock_node (rn
);
218 bgp_info_delete (struct bgp_node
*rn
, struct bgp_info
*ri
)
220 bgp_info_set_flag (rn
, ri
, BGP_INFO_REMOVED
);
221 /* set of previous already took care of pcount */
222 UNSET_FLAG (ri
->flags
, BGP_INFO_VALID
);
225 /* undo the effects of a previous call to bgp_info_delete; typically
226 called when a route is deleted and then quickly re-added before the
227 deletion has been processed */
229 bgp_info_restore (struct bgp_node
*rn
, struct bgp_info
*ri
)
231 bgp_info_unset_flag (rn
, ri
, BGP_INFO_REMOVED
);
232 /* unset of previous already took care of pcount */
233 SET_FLAG (ri
->flags
, BGP_INFO_VALID
);
236 /* Adjust pcount as required */
238 bgp_pcount_adjust (struct bgp_node
*rn
, struct bgp_info
*ri
)
240 assert (rn
&& rn
->table
);
241 assert (ri
&& ri
->peer
&& ri
->peer
->bgp
);
243 /* Ignore 'pcount' for RS-client tables */
244 if (rn
->table
->type
!= BGP_TABLE_MAIN
245 || ri
->peer
== ri
->peer
->bgp
->peer_self
)
248 if (BGP_INFO_HOLDDOWN (ri
)
249 && CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
252 UNSET_FLAG (ri
->flags
, BGP_INFO_COUNTED
);
254 /* slight hack, but more robust against errors. */
255 if (ri
->peer
->pcount
[rn
->table
->afi
][rn
->table
->safi
])
256 ri
->peer
->pcount
[rn
->table
->afi
][rn
->table
->safi
]--;
259 zlog_warn ("%s: Asked to decrement 0 prefix count for peer %s",
260 __func__
, ri
->peer
->host
);
261 zlog_backtrace (LOG_WARNING
);
262 zlog_warn ("%s: Please report to Quagga bugzilla", __func__
);
265 else if (!BGP_INFO_HOLDDOWN (ri
)
266 && !CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
268 SET_FLAG (ri
->flags
, BGP_INFO_COUNTED
);
269 ri
->peer
->pcount
[rn
->table
->afi
][rn
->table
->safi
]++;
274 /* Set/unset bgp_info flags, adjusting any other state as needed.
275 * This is here primarily to keep prefix-count in check.
278 bgp_info_set_flag (struct bgp_node
*rn
, struct bgp_info
*ri
, u_int32_t flag
)
280 SET_FLAG (ri
->flags
, flag
);
282 /* early bath if we know it's not a flag that changes useability state */
283 if (!CHECK_FLAG (flag
, BGP_INFO_VALID
|BGP_INFO_UNUSEABLE
))
286 bgp_pcount_adjust (rn
, ri
);
290 bgp_info_unset_flag (struct bgp_node
*rn
, struct bgp_info
*ri
, u_int32_t flag
)
292 UNSET_FLAG (ri
->flags
, flag
);
294 /* early bath if we know it's not a flag that changes useability state */
295 if (!CHECK_FLAG (flag
, BGP_INFO_VALID
|BGP_INFO_UNUSEABLE
))
298 bgp_pcount_adjust (rn
, ri
);
301 /* Get MED value. If MED value is missing and "bgp bestpath
302 missing-as-worst" is specified, treat it as the worst value. */
304 bgp_med_value (struct attr
*attr
, struct bgp
*bgp
)
306 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
310 if (bgp_flag_check (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
))
317 /* Compare two bgp route entity. br is preferable then return 1. */
319 bgp_info_cmp (struct bgp
*bgp
, struct bgp_info
*new, struct bgp_info
*exist
)
322 u_int32_t exist_pref
;
325 u_int32_t new_weight
= 0;
326 u_int32_t exist_weight
= 0;
327 struct in_addr new_id
;
328 struct in_addr exist_id
;
331 int internal_as_route
= 0;
332 int confed_as_route
= 0;
341 /* 1. Weight check. */
342 if (new->attr
->extra
)
343 new_weight
= new->attr
->extra
->weight
;
344 if (exist
->attr
->extra
)
345 exist_weight
= exist
->attr
->extra
->weight
;
346 if (new_weight
> exist_weight
)
348 if (new_weight
< exist_weight
)
351 /* 2. Local preference check. */
352 if (new->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
353 new_pref
= new->attr
->local_pref
;
355 new_pref
= bgp
->default_local_pref
;
357 if (exist
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
358 exist_pref
= exist
->attr
->local_pref
;
360 exist_pref
= bgp
->default_local_pref
;
362 if (new_pref
> exist_pref
)
364 if (new_pref
< exist_pref
)
367 /* 3. Local route check. */
368 if (new->sub_type
== BGP_ROUTE_STATIC
)
370 if (exist
->sub_type
== BGP_ROUTE_STATIC
)
373 if (new->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
375 if (exist
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
378 if (new->sub_type
== BGP_ROUTE_AGGREGATE
)
380 if (exist
->sub_type
== BGP_ROUTE_AGGREGATE
)
383 /* 4. AS path length check. */
384 if (! bgp_flag_check (bgp
, BGP_FLAG_ASPATH_IGNORE
))
386 int exist_hops
= aspath_count_hops (exist
->attr
->aspath
);
387 int exist_confeds
= aspath_count_confeds (exist
->attr
->aspath
);
389 if (bgp_flag_check (bgp
, BGP_FLAG_ASPATH_CONFED
))
393 aspath_hops
= aspath_count_hops (new->attr
->aspath
);
394 aspath_hops
+= aspath_count_confeds (new->attr
->aspath
);
396 if ( aspath_hops
< (exist_hops
+ exist_confeds
))
398 if ( aspath_hops
> (exist_hops
+ exist_confeds
))
403 int newhops
= aspath_count_hops (new->attr
->aspath
);
405 if (newhops
< exist_hops
)
407 if (newhops
> exist_hops
)
412 /* 5. Origin check. */
413 if (new->attr
->origin
< exist
->attr
->origin
)
415 if (new->attr
->origin
> exist
->attr
->origin
)
419 internal_as_route
= (aspath_count_hops (new->attr
->aspath
) == 0
420 && aspath_count_hops (exist
->attr
->aspath
) == 0);
421 confed_as_route
= (aspath_count_confeds (new->attr
->aspath
) > 0
422 && aspath_count_confeds (exist
->attr
->aspath
) > 0
423 && aspath_count_hops (new->attr
->aspath
) == 0
424 && aspath_count_hops (exist
->attr
->aspath
) == 0);
426 if (bgp_flag_check (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
)
427 || (bgp_flag_check (bgp
, BGP_FLAG_MED_CONFED
)
429 || aspath_cmp_left (new->attr
->aspath
, exist
->attr
->aspath
)
430 || aspath_cmp_left_confed (new->attr
->aspath
, exist
->attr
->aspath
)
431 || internal_as_route
)
433 new_med
= bgp_med_value (new->attr
, bgp
);
434 exist_med
= bgp_med_value (exist
->attr
, bgp
);
436 if (new_med
< exist_med
)
438 if (new_med
> exist_med
)
442 /* 7. Peer type check. */
443 if (peer_sort (new->peer
) == BGP_PEER_EBGP
444 && peer_sort (exist
->peer
) == BGP_PEER_IBGP
)
446 if (peer_sort (new->peer
) == BGP_PEER_EBGP
447 && peer_sort (exist
->peer
) == BGP_PEER_CONFED
)
449 if (peer_sort (new->peer
) == BGP_PEER_IBGP
450 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
452 if (peer_sort (new->peer
) == BGP_PEER_CONFED
453 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
456 /* 8. IGP metric check. */
457 if (new->extra
|| exist
->extra
)
459 uint32_t newm
= (new->extra
? new->extra
->igpmetric
: 0);
460 uint32_t existm
= (exist
->extra
? exist
->extra
->igpmetric
: 0);
468 /* 9. Maximum path check. */
470 /* 10. If both paths are external, prefer the path that was received
471 first (the oldest one). This step minimizes route-flap, since a
472 newer path won't displace an older one, even if it was the
473 preferred route based on the additional decision criteria below. */
474 if (! bgp_flag_check (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
)
475 && peer_sort (new->peer
) == BGP_PEER_EBGP
476 && peer_sort (exist
->peer
) == BGP_PEER_EBGP
)
478 if (CHECK_FLAG (new->flags
, BGP_INFO_SELECTED
))
480 if (CHECK_FLAG (exist
->flags
, BGP_INFO_SELECTED
))
484 /* 11. Rourter-ID comparision. */
485 if (new->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
486 new_id
.s_addr
= new->attr
->extra
->originator_id
.s_addr
;
488 new_id
.s_addr
= new->peer
->remote_id
.s_addr
;
489 if (exist
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
490 exist_id
.s_addr
= exist
->attr
->extra
->originator_id
.s_addr
;
492 exist_id
.s_addr
= exist
->peer
->remote_id
.s_addr
;
494 if (ntohl (new_id
.s_addr
) < ntohl (exist_id
.s_addr
))
496 if (ntohl (new_id
.s_addr
) > ntohl (exist_id
.s_addr
))
499 /* 12. Cluster length comparision. */
500 if (new->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
501 new_cluster
= new->attr
->extra
->cluster
->length
;
504 if (exist
->attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
505 exist_cluster
= exist
->attr
->extra
->cluster
->length
;
509 if (new_cluster
< exist_cluster
)
511 if (new_cluster
> exist_cluster
)
514 /* 13. Neighbor address comparision. */
515 ret
= sockunion_cmp (new->peer
->su_remote
, exist
->peer
->su_remote
);
525 static enum filter_type
526 bgp_input_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
527 afi_t afi
, safi_t safi
)
529 struct bgp_filter
*filter
;
531 filter
= &peer
->filter
[afi
][safi
];
533 if (DISTRIBUTE_IN_NAME (filter
))
534 if (access_list_apply (DISTRIBUTE_IN (filter
), p
) == FILTER_DENY
)
537 if (PREFIX_LIST_IN_NAME (filter
))
538 if (prefix_list_apply (PREFIX_LIST_IN (filter
), p
) == PREFIX_DENY
)
541 if (FILTER_LIST_IN_NAME (filter
))
542 if (as_list_apply (FILTER_LIST_IN (filter
), attr
->aspath
)== AS_FILTER_DENY
)
545 return FILTER_PERMIT
;
548 static enum filter_type
549 bgp_output_filter (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
550 afi_t afi
, safi_t safi
)
552 struct bgp_filter
*filter
;
554 filter
= &peer
->filter
[afi
][safi
];
556 if (DISTRIBUTE_OUT_NAME (filter
))
557 if (access_list_apply (DISTRIBUTE_OUT (filter
), p
) == FILTER_DENY
)
560 if (PREFIX_LIST_OUT_NAME (filter
))
561 if (prefix_list_apply (PREFIX_LIST_OUT (filter
), p
) == PREFIX_DENY
)
564 if (FILTER_LIST_OUT_NAME (filter
))
565 if (as_list_apply (FILTER_LIST_OUT (filter
), attr
->aspath
) == AS_FILTER_DENY
)
568 return FILTER_PERMIT
;
571 /* If community attribute includes no_export then return 1. */
573 bgp_community_filter (struct peer
*peer
, struct attr
*attr
)
577 /* NO_ADVERTISE check. */
578 if (community_include (attr
->community
, COMMUNITY_NO_ADVERTISE
))
581 /* NO_EXPORT check. */
582 if (peer_sort (peer
) == BGP_PEER_EBGP
&&
583 community_include (attr
->community
, COMMUNITY_NO_EXPORT
))
586 /* NO_EXPORT_SUBCONFED check. */
587 if (peer_sort (peer
) == BGP_PEER_EBGP
588 || peer_sort (peer
) == BGP_PEER_CONFED
)
589 if (community_include (attr
->community
, COMMUNITY_NO_EXPORT_SUBCONFED
))
595 /* Route reflection loop check. */
597 bgp_cluster_filter (struct peer
*peer
, struct attr
*attr
)
599 struct in_addr cluster_id
;
601 if (attr
->extra
&& attr
->extra
->cluster
)
603 if (peer
->bgp
->config
& BGP_CONFIG_CLUSTER_ID
)
604 cluster_id
= peer
->bgp
->cluster_id
;
606 cluster_id
= peer
->bgp
->router_id
;
608 if (cluster_loop_check (attr
->extra
->cluster
, cluster_id
))
615 bgp_input_modifier (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
616 afi_t afi
, safi_t safi
)
618 struct bgp_filter
*filter
;
619 struct bgp_info info
;
620 route_map_result_t ret
;
622 filter
= &peer
->filter
[afi
][safi
];
624 /* Apply default weight value. */
626 (bgp_attr_extra_get (attr
))->weight
= peer
->weight
;
628 /* Route map apply. */
629 if (ROUTE_MAP_IN_NAME (filter
))
631 /* Duplicate current value to new strucutre for modification. */
635 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IN
);
637 /* Apply BGP route map to the attribute. */
638 ret
= route_map_apply (ROUTE_MAP_IN (filter
), p
, RMAP_BGP
, &info
);
642 if (ret
== RMAP_DENYMATCH
)
644 /* Free newly generated AS path and community by route-map. */
645 bgp_attr_flush (attr
);
653 bgp_export_modifier (struct peer
*rsclient
, struct peer
*peer
,
654 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
656 struct bgp_filter
*filter
;
657 struct bgp_info info
;
658 route_map_result_t ret
;
660 filter
= &peer
->filter
[afi
][safi
];
662 /* Route map apply. */
663 if (ROUTE_MAP_EXPORT_NAME (filter
))
665 /* Duplicate current value to new strucutre for modification. */
666 info
.peer
= rsclient
;
669 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
671 /* Apply BGP route map to the attribute. */
672 ret
= route_map_apply (ROUTE_MAP_EXPORT (filter
), p
, RMAP_BGP
, &info
);
674 rsclient
->rmap_type
= 0;
676 if (ret
== RMAP_DENYMATCH
)
678 /* Free newly generated AS path and community by route-map. */
679 bgp_attr_flush (attr
);
687 bgp_import_modifier (struct peer
*rsclient
, struct peer
*peer
,
688 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
690 struct bgp_filter
*filter
;
691 struct bgp_info info
;
692 route_map_result_t ret
;
694 filter
= &rsclient
->filter
[afi
][safi
];
696 /* Apply default weight value. */
698 (bgp_attr_extra_get (attr
))->weight
= peer
->weight
;
700 /* Route map apply. */
701 if (ROUTE_MAP_IMPORT_NAME (filter
))
703 /* Duplicate current value to new strucutre for modification. */
707 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_IMPORT
);
709 /* Apply BGP route map to the attribute. */
710 ret
= route_map_apply (ROUTE_MAP_IMPORT (filter
), p
, RMAP_BGP
, &info
);
714 if (ret
== RMAP_DENYMATCH
)
716 /* Free newly generated AS path and community by route-map. */
717 bgp_attr_flush (attr
);
725 bgp_announce_check (struct bgp_info
*ri
, struct peer
*peer
, struct prefix
*p
,
726 struct attr
*attr
, afi_t afi
, safi_t safi
)
729 char buf
[SU_ADDRSTRLEN
];
730 struct bgp_filter
*filter
;
737 filter
= &peer
->filter
[afi
][safi
];
740 if (DISABLE_BGP_ANNOUNCE
)
743 /* Do not send announces to RS-clients from the 'normal' bgp_table. */
744 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
747 /* Do not send back route to sender. */
751 /* If peer's id and route's nexthop are same. draft-ietf-idr-bgp4-23 5.1.3 */
752 if (p
->family
== AF_INET
753 && IPV4_ADDR_SAME(&peer
->remote_id
, &ri
->attr
->nexthop
))
756 if (p
->family
== AF_INET6
757 && IPV6_ADDR_SAME(&peer
->remote_id
, &ri
->attr
->nexthop
))
761 /* Aggregate-address suppress check. */
762 if (ri
->extra
&& ri
->extra
->suppress
)
763 if (! UNSUPPRESS_MAP_NAME (filter
))
766 /* Default route check. */
767 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
769 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
772 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
774 #endif /* HAVE_IPV6 */
777 /* Transparency check. */
778 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
)
779 && CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
784 /* If community is not disabled check the no-export and local. */
785 if (! transparent
&& bgp_community_filter (peer
, ri
->attr
))
788 /* If the attribute has originator-id and it is same as remote
790 if (ri
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
792 if (IPV4_ADDR_SAME (&peer
->remote_id
, &ri
->attr
->extra
->originator_id
))
794 if (BGP_DEBUG (filter
, FILTER
))
795 zlog (peer
->log
, LOG_DEBUG
,
796 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
798 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
804 /* ORF prefix-list filter check */
805 if (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
806 && (CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
807 || CHECK_FLAG (peer
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
808 if (peer
->orf_plist
[afi
][safi
])
810 if (prefix_list_apply (peer
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
814 /* Output filter check. */
815 if (bgp_output_filter (peer
, p
, ri
->attr
, afi
, safi
) == FILTER_DENY
)
817 if (BGP_DEBUG (filter
, FILTER
))
818 zlog (peer
->log
, LOG_DEBUG
,
819 "%s [Update:SEND] %s/%d is filtered",
821 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
826 #ifdef BGP_SEND_ASPATH_CHECK
827 /* AS path loop check. */
828 if (aspath_loop_check (ri
->attr
->aspath
, peer
->as
))
830 if (BGP_DEBUG (filter
, FILTER
))
831 zlog (peer
->log
, LOG_DEBUG
,
832 "%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
833 peer
->host
, peer
->as
);
836 #endif /* BGP_SEND_ASPATH_CHECK */
838 /* If we're a CONFED we need to loop check the CONFED ID too */
839 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
841 if (aspath_loop_check(ri
->attr
->aspath
, bgp
->confed_id
))
843 if (BGP_DEBUG (filter
, FILTER
))
844 zlog (peer
->log
, LOG_DEBUG
,
845 "%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
852 /* Route-Reflect check. */
853 if (peer_sort (from
) == BGP_PEER_IBGP
&& peer_sort (peer
) == BGP_PEER_IBGP
)
858 /* IBGP reflection check. */
861 /* A route from a Client peer. */
862 if (CHECK_FLAG (from
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
864 /* Reflect to all the Non-Client peers and also to the
865 Client peers other than the originator. Originator check
866 is already done. So there is noting to do. */
867 /* no bgp client-to-client reflection check. */
868 if (bgp_flag_check (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
))
869 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
874 /* A route from a Non-client peer. Reflect to all other
876 if (! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
881 /* AS-Pathlimit check */
882 if (ri
->attr
->pathlimit
.ttl
&& peer_sort (peer
) == BGP_PEER_EBGP
)
883 /* Our ASN has not yet been pre-pended, that's done in packet_attribute
884 * on output. Hence the test here is for >=.
886 if (aspath_count_hops (ri
->attr
->aspath
) >= ri
->attr
->pathlimit
.ttl
)
888 if (BGP_DEBUG (filter
, FILTER
))
889 zlog_info ("%s [Update:SEND] suppressed, AS-Pathlimit TTL %u exceeded",
890 peer
->host
, ri
->attr
->pathlimit
.ttl
);
894 /* For modify attribute, copy it to temporary structure. */
895 bgp_attr_dup (attr
, ri
->attr
);
897 /* If local-preference is not set. */
898 if ((peer_sort (peer
) == BGP_PEER_IBGP
899 || peer_sort (peer
) == BGP_PEER_CONFED
)
900 && (! (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))))
902 attr
->flag
|= ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
);
903 attr
->local_pref
= bgp
->default_local_pref
;
906 /* Remove MED if its an EBGP peer - will get overwritten by route-maps */
907 if (peer_sort (peer
) == BGP_PEER_EBGP
908 && attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
910 if (ri
->peer
!= bgp
->peer_self
&& ! transparent
911 && ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
912 attr
->flag
&= ~(ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
));
916 if (transparent
|| reflect
917 || (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
)
918 && ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
)
920 || (p
->family
== AF_INET6
&&
921 ! IN6_IS_ADDR_UNSPECIFIED(&attr
->extra
->mp_nexthop_global
))
922 #endif /* HAVE_IPV6 */
925 /* NEXT-HOP Unchanged. */
927 else if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
928 || (p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
930 || (p
->family
== AF_INET6
&&
931 IN6_IS_ADDR_UNSPECIFIED(&attr
->extra
->mp_nexthop_global
))
932 #endif /* HAVE_IPV6 */
933 || (peer_sort (peer
) == BGP_PEER_EBGP
934 && bgp_multiaccess_check_v4 (attr
->nexthop
, peer
->host
) == 0))
936 /* Set IPv4 nexthop. */
937 if (p
->family
== AF_INET
)
939 if (safi
== SAFI_MPLS_VPN
)
940 memcpy (&attr
->extra
->mp_nexthop_global_in
, &peer
->nexthop
.v4
,
943 memcpy (&attr
->nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
946 /* Set IPv6 nexthop. */
947 if (p
->family
== AF_INET6
)
949 /* IPv6 global nexthop must be included. */
950 memcpy (&attr
->extra
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
952 attr
->extra
->mp_nexthop_len
= 16;
954 #endif /* HAVE_IPV6 */
958 if (p
->family
== AF_INET6
)
960 /* Left nexthop_local unchanged if so configured. */
961 if ( CHECK_FLAG (peer
->af_flags
[afi
][safi
],
962 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
964 if ( IN6_IS_ADDR_LINKLOCAL (&attr
->extra
->mp_nexthop_local
) )
965 attr
->extra
->mp_nexthop_len
=32;
967 attr
->extra
->mp_nexthop_len
=16;
970 /* Default nexthop_local treatment for non-RS-Clients */
973 /* Link-local address should not be transit to different peer. */
974 attr
->extra
->mp_nexthop_len
= 16;
976 /* Set link-local address for shared network peer. */
977 if (peer
->shared_network
978 && ! IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
980 memcpy (&attr
->extra
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
982 attr
->extra
->mp_nexthop_len
= 32;
985 /* If bgpd act as BGP-4+ route-reflector, do not send link-local
988 attr
->extra
->mp_nexthop_len
= 16;
990 /* If BGP-4+ link-local nexthop is not link-local nexthop. */
991 if (! IN6_IS_ADDR_LINKLOCAL (&peer
->nexthop
.v6_local
))
992 attr
->extra
->mp_nexthop_len
= 16;
996 #endif /* HAVE_IPV6 */
998 /* AS-Pathlimit: Check ASN for private/confed */
999 if (attr
->pathlimit
.ttl
)
1001 /* locally originated update */
1002 if (!attr
->pathlimit
.as
)
1003 attr
->pathlimit
.as
= peer
->local_as
;
1005 /* if the AS_PATHLIMIT attribute is attached to a prefix by a
1006 member of a confederation, then when the prefix is advertised outside
1007 of the confederation boundary, then the AS number of the
1008 confederation member inside of the AS_PATHLIMIT attribute should be
1009 replaced by the confederation's AS number. */
1010 if (peer_sort (from
) == BGP_PEER_CONFED
1011 && peer_sort (peer
) != BGP_PEER_CONFED
)
1012 attr
->pathlimit
.as
= peer
->local_as
;
1014 /* Private ASN should be updated whenever announcement leaves
1015 * private space. This is deliberately done after simple confed
1018 if (attr
->pathlimit
.as
>= BGP_PRIVATE_AS_MIN
1019 && attr
->pathlimit
.as
<= BGP_PRIVATE_AS_MAX
)
1021 if (peer
->local_as
< BGP_PRIVATE_AS_MIN
1022 || peer
->local_as
> BGP_PRIVATE_AS_MAX
)
1023 attr
->pathlimit
.as
= peer
->local_as
;
1024 /* Ours is private, try using theirs.. */
1025 else if (peer
->as
< BGP_PRIVATE_AS_MIN
1026 || peer
->local_as
> BGP_PRIVATE_AS_MAX
)
1027 attr
->pathlimit
.as
= peer
->as
;
1031 /* If this is EBGP peer and remove-private-AS is set. */
1032 if (peer_sort (peer
) == BGP_PEER_EBGP
1033 && peer_af_flag_check (peer
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
)
1034 && aspath_private_as_check (attr
->aspath
))
1035 attr
->aspath
= aspath_empty_get ();
1037 /* Route map & unsuppress-map apply. */
1038 if (ROUTE_MAP_OUT_NAME (filter
)
1039 || (ri
->extra
&& ri
->extra
->suppress
) )
1041 struct bgp_info info
;
1042 struct attr dummy_attr
= { 0 };
1047 /* The route reflector is not allowed to modify the attributes
1048 of the reflected IBGP routes. */
1049 if (peer_sort (from
) == BGP_PEER_IBGP
1050 && peer_sort (peer
) == BGP_PEER_IBGP
)
1052 bgp_attr_dup (&dummy_attr
, attr
);
1053 info
.attr
= &dummy_attr
;
1056 SET_FLAG (peer
->rmap_type
, PEER_RMAP_TYPE_OUT
);
1058 if (ri
->extra
&& ri
->extra
->suppress
)
1059 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
1061 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
1063 peer
->rmap_type
= 0;
1065 if (dummy_attr
.extra
)
1066 bgp_attr_extra_free (&dummy_attr
);
1068 if (ret
== RMAP_DENYMATCH
)
1070 bgp_attr_flush (attr
);
1078 bgp_announce_check_rsclient (struct bgp_info
*ri
, struct peer
*rsclient
,
1079 struct prefix
*p
, struct attr
*attr
, afi_t afi
, safi_t safi
)
1082 char buf
[SU_ADDRSTRLEN
];
1083 struct bgp_filter
*filter
;
1084 struct bgp_info info
;
1089 filter
= &rsclient
->filter
[afi
][safi
];
1090 bgp
= rsclient
->bgp
;
1092 if (DISABLE_BGP_ANNOUNCE
)
1095 /* Do not send back route to sender. */
1096 if (from
== rsclient
)
1099 /* Aggregate-address suppress check. */
1100 if (ri
->extra
&& ri
->extra
->suppress
)
1101 if (! UNSUPPRESS_MAP_NAME (filter
))
1104 /* Default route check. */
1105 if (CHECK_FLAG (rsclient
->af_sflags
[afi
][safi
],
1106 PEER_STATUS_DEFAULT_ORIGINATE
))
1108 if (p
->family
== AF_INET
&& p
->u
.prefix4
.s_addr
== INADDR_ANY
)
1111 else if (p
->family
== AF_INET6
&& p
->prefixlen
== 0)
1113 #endif /* HAVE_IPV6 */
1116 /* If the attribute has originator-id and it is same as remote
1118 if (ri
->attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
))
1120 if (IPV4_ADDR_SAME (&rsclient
->remote_id
,
1121 &ri
->attr
->extra
->originator_id
))
1123 if (BGP_DEBUG (filter
, FILTER
))
1124 zlog (rsclient
->log
, LOG_DEBUG
,
1125 "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
1127 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1133 /* ORF prefix-list filter check */
1134 if (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
1135 && (CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
1136 || CHECK_FLAG (rsclient
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)))
1137 if (rsclient
->orf_plist
[afi
][safi
])
1139 if (prefix_list_apply (rsclient
->orf_plist
[afi
][safi
], p
) == PREFIX_DENY
)
1143 /* Output filter check. */
1144 if (bgp_output_filter (rsclient
, p
, ri
->attr
, afi
, safi
) == FILTER_DENY
)
1146 if (BGP_DEBUG (filter
, FILTER
))
1147 zlog (rsclient
->log
, LOG_DEBUG
,
1148 "%s [Update:SEND] %s/%d is filtered",
1150 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1155 #ifdef BGP_SEND_ASPATH_CHECK
1156 /* AS path loop check. */
1157 if (aspath_loop_check (ri
->attr
->aspath
, rsclient
->as
))
1159 if (BGP_DEBUG (filter
, FILTER
))
1160 zlog (rsclient
->log
, LOG_DEBUG
,
1161 "%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
1162 rsclient
->host
, rsclient
->as
);
1165 #endif /* BGP_SEND_ASPATH_CHECK */
1167 /* For modify attribute, copy it to temporary structure. */
1168 bgp_attr_dup (attr
, ri
->attr
);
1171 if ((p
->family
== AF_INET
&& attr
->nexthop
.s_addr
== 0)
1173 || (p
->family
== AF_INET6
&&
1174 IN6_IS_ADDR_UNSPECIFIED(&attr
->extra
->mp_nexthop_global
))
1175 #endif /* HAVE_IPV6 */
1178 /* Set IPv4 nexthop. */
1179 if (p
->family
== AF_INET
)
1181 if (safi
== SAFI_MPLS_VPN
)
1182 memcpy (&attr
->extra
->mp_nexthop_global_in
, &rsclient
->nexthop
.v4
,
1185 memcpy (&attr
->nexthop
, &rsclient
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
1188 /* Set IPv6 nexthop. */
1189 if (p
->family
== AF_INET6
)
1191 /* IPv6 global nexthop must be included. */
1192 memcpy (&attr
->extra
->mp_nexthop_global
, &rsclient
->nexthop
.v6_global
,
1194 attr
->extra
->mp_nexthop_len
= 16;
1196 #endif /* HAVE_IPV6 */
1200 if (p
->family
== AF_INET6
)
1202 struct attr_extra
*attre
= attr
->extra
;
1204 assert (attr
->extra
);
1206 /* Left nexthop_local unchanged if so configured. */
1207 if ( CHECK_FLAG (rsclient
->af_flags
[afi
][safi
],
1208 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
) )
1210 if ( IN6_IS_ADDR_LINKLOCAL (&attre
->mp_nexthop_local
) )
1211 attre
->mp_nexthop_len
=32;
1213 attre
->mp_nexthop_len
=16;
1216 /* Default nexthop_local treatment for RS-Clients */
1219 /* Announcer and RS-Client are both in the same network */
1220 if (rsclient
->shared_network
&& from
->shared_network
&&
1221 (rsclient
->ifindex
== from
->ifindex
))
1223 if ( IN6_IS_ADDR_LINKLOCAL (&attre
->mp_nexthop_local
) )
1224 attre
->mp_nexthop_len
=32;
1226 attre
->mp_nexthop_len
=16;
1229 /* Set link-local address for shared network peer. */
1230 else if (rsclient
->shared_network
1231 && IN6_IS_ADDR_LINKLOCAL (&rsclient
->nexthop
.v6_local
))
1233 memcpy (&attre
->mp_nexthop_local
, &rsclient
->nexthop
.v6_local
,
1235 attre
->mp_nexthop_len
= 32;
1239 attre
->mp_nexthop_len
= 16;
1243 #endif /* HAVE_IPV6 */
1246 /* If this is EBGP peer and remove-private-AS is set. */
1247 if (peer_sort (rsclient
) == BGP_PEER_EBGP
1248 && peer_af_flag_check (rsclient
, afi
, safi
, PEER_FLAG_REMOVE_PRIVATE_AS
)
1249 && aspath_private_as_check (attr
->aspath
))
1250 attr
->aspath
= aspath_empty_get ();
1252 /* Route map & unsuppress-map apply. */
1253 if (ROUTE_MAP_OUT_NAME (filter
) || (ri
->extra
&& ri
->extra
->suppress
) )
1255 info
.peer
= rsclient
;
1258 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_OUT
);
1260 if (ri
->extra
&& ri
->extra
->suppress
)
1261 ret
= route_map_apply (UNSUPPRESS_MAP (filter
), p
, RMAP_BGP
, &info
);
1263 ret
= route_map_apply (ROUTE_MAP_OUT (filter
), p
, RMAP_BGP
, &info
);
1265 rsclient
->rmap_type
= 0;
1267 if (ret
== RMAP_DENYMATCH
)
1269 bgp_attr_flush (attr
);
1277 struct bgp_info_pair
1279 struct bgp_info
*old
;
1280 struct bgp_info
*new;
1284 bgp_best_selection (struct bgp
*bgp
, struct bgp_node
*rn
, struct bgp_info_pair
*result
)
1286 struct bgp_info
*new_select
;
1287 struct bgp_info
*old_select
;
1288 struct bgp_info
*ri
;
1289 struct bgp_info
*ri1
;
1290 struct bgp_info
*ri2
;
1291 struct bgp_info
*nextri
= NULL
;
1293 /* bgp deterministic-med */
1295 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1296 for (ri1
= rn
->info
; ri1
; ri1
= ri1
->next
)
1298 if (CHECK_FLAG (ri1
->flags
, BGP_INFO_DMED_CHECK
))
1300 if (BGP_INFO_HOLDDOWN (ri1
))
1305 for (ri2
= ri1
->next
; ri2
; ri2
= ri2
->next
)
1307 if (CHECK_FLAG (ri2
->flags
, BGP_INFO_DMED_CHECK
))
1309 if (BGP_INFO_HOLDDOWN (ri2
))
1312 if (aspath_cmp_left (ri1
->attr
->aspath
, ri2
->attr
->aspath
)
1313 || aspath_cmp_left_confed (ri1
->attr
->aspath
,
1316 if (bgp_info_cmp (bgp
, ri2
, new_select
))
1318 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_DMED_SELECTED
);
1322 bgp_info_set_flag (rn
, ri2
, BGP_INFO_DMED_CHECK
);
1325 bgp_info_set_flag (rn
, new_select
, BGP_INFO_DMED_CHECK
);
1326 bgp_info_set_flag (rn
, new_select
, BGP_INFO_DMED_SELECTED
);
1329 /* Check old selected route and new selected route. */
1332 for (ri
= rn
->info
; (ri
!= NULL
) && (nextri
= ri
->next
, 1); ri
= nextri
)
1334 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
1337 if (BGP_INFO_HOLDDOWN (ri
))
1339 /* reap REMOVED routes, if needs be
1340 * selected route must stay for a while longer though
1342 if (CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
)
1343 && (ri
!= old_select
))
1344 bgp_info_reap (rn
, ri
);
1349 if (bgp_flag_check (bgp
, BGP_FLAG_DETERMINISTIC_MED
)
1350 && (! CHECK_FLAG (ri
->flags
, BGP_INFO_DMED_SELECTED
)))
1352 bgp_info_unset_flag (rn
, ri
, BGP_INFO_DMED_CHECK
);
1355 bgp_info_unset_flag (rn
, ri
, BGP_INFO_DMED_CHECK
);
1356 bgp_info_unset_flag (rn
, ri
, BGP_INFO_DMED_SELECTED
);
1358 if (bgp_info_cmp (bgp
, ri
, new_select
))
1362 result
->old
= old_select
;
1363 result
->new = new_select
;
1369 bgp_process_announce_selected (struct peer
*peer
, struct bgp_info
*selected
,
1370 struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
1373 struct attr attr
= { 0 };
1377 /* Announce route to Established peer. */
1378 if (peer
->status
!= Established
)
1381 /* Address family configuration check. */
1382 if (! peer
->afc_nego
[afi
][safi
])
1385 /* First update is deferred until ORF or ROUTE-REFRESH is received */
1386 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
1387 PEER_STATUS_ORF_WAIT_REFRESH
))
1390 switch (rn
->table
->type
)
1392 case BGP_TABLE_MAIN
:
1393 /* Announcement to peer->conf. If the route is filtered,
1395 if (selected
&& bgp_announce_check (selected
, peer
, p
, &attr
, afi
, safi
))
1396 bgp_adj_out_set (rn
, peer
, p
, &attr
, afi
, safi
, selected
);
1398 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1400 case BGP_TABLE_RSCLIENT
:
1401 /* Announcement to peer->conf. If the route is filtered,
1404 bgp_announce_check_rsclient (selected
, peer
, p
, &attr
, afi
, safi
))
1405 bgp_adj_out_set (rn
, peer
, p
, &attr
, afi
, safi
, selected
);
1407 bgp_adj_out_unset (rn
, peer
, p
, afi
, safi
);
1411 bgp_attr_extra_free (&attr
);
1416 struct bgp_process_queue
1419 struct bgp_node
*rn
;
1424 static wq_item_status
1425 bgp_process_rsclient (struct work_queue
*wq
, void *data
)
1427 struct bgp_process_queue
*pq
= data
;
1428 struct bgp
*bgp
= pq
->bgp
;
1429 struct bgp_node
*rn
= pq
->rn
;
1430 afi_t afi
= pq
->afi
;
1431 safi_t safi
= pq
->safi
;
1432 struct bgp_info
*new_select
;
1433 struct bgp_info
*old_select
;
1434 struct bgp_info_pair old_and_new
;
1436 struct listnode
*node
, *nnode
;
1437 struct peer
*rsclient
= rn
->table
->owner
;
1439 memset (&attr
, 0, sizeof (struct attr
));
1440 /* Best path selection. */
1441 bgp_best_selection (bgp
, rn
, &old_and_new
);
1442 new_select
= old_and_new
.new;
1443 old_select
= old_and_new
.old
;
1445 if (CHECK_FLAG (rsclient
->sflags
, PEER_STATUS_GROUP
))
1447 for (ALL_LIST_ELEMENTS (rsclient
->group
->peer
, node
, nnode
, rsclient
))
1449 /* Nothing to do. */
1450 if (old_select
&& old_select
== new_select
)
1451 if (!CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1455 bgp_info_unset_flag (rn
, old_select
, BGP_INFO_SELECTED
);
1458 bgp_info_set_flag (rn
, new_select
, BGP_INFO_SELECTED
);
1459 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_ATTR_CHANGED
);
1462 bgp_process_announce_selected (rsclient
, new_select
, rn
, afi
, safi
);
1468 bgp_info_unset_flag (rn
, old_select
, BGP_INFO_SELECTED
);
1471 bgp_info_set_flag (rn
, new_select
, BGP_INFO_SELECTED
);
1472 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_ATTR_CHANGED
);
1474 bgp_process_announce_selected (rsclient
, new_select
, rn
, afi
, safi
);
1477 if (old_select
&& CHECK_FLAG (old_select
->flags
, BGP_INFO_REMOVED
))
1478 bgp_info_reap (rn
, old_select
);
1480 bgp_attr_extra_free (&attr
);
1482 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1486 static wq_item_status
1487 bgp_process_main (struct work_queue
*wq
, void *data
)
1489 struct bgp_process_queue
*pq
= data
;
1490 struct bgp
*bgp
= pq
->bgp
;
1491 struct bgp_node
*rn
= pq
->rn
;
1492 afi_t afi
= pq
->afi
;
1493 safi_t safi
= pq
->safi
;
1494 struct prefix
*p
= &rn
->p
;
1495 struct bgp_info
*new_select
;
1496 struct bgp_info
*old_select
;
1497 struct bgp_info_pair old_and_new
;
1498 struct listnode
*node
, *nnode
;
1501 /* Best path selection. */
1502 bgp_best_selection (bgp
, rn
, &old_and_new
);
1503 old_select
= old_and_new
.old
;
1504 new_select
= old_and_new
.new;
1506 /* Nothing to do. */
1507 if (old_select
&& old_select
== new_select
)
1509 if (! CHECK_FLAG (old_select
->flags
, BGP_INFO_ATTR_CHANGED
))
1511 if (CHECK_FLAG (old_select
->flags
, BGP_INFO_IGP_CHANGED
))
1512 bgp_zebra_announce (p
, old_select
, bgp
);
1514 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1520 bgp_info_unset_flag (rn
, old_select
, BGP_INFO_SELECTED
);
1523 bgp_info_set_flag (rn
, new_select
, BGP_INFO_SELECTED
);
1524 bgp_info_unset_flag (rn
, new_select
, BGP_INFO_ATTR_CHANGED
);
1528 /* Check each BGP peer. */
1529 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1531 bgp_process_announce_selected (peer
, new_select
, rn
, afi
, safi
);
1535 if (safi
== SAFI_UNICAST
&& ! bgp
->name
&&
1536 ! bgp_option_check (BGP_OPT_NO_FIB
))
1539 && new_select
->type
== ZEBRA_ROUTE_BGP
1540 && new_select
->sub_type
== BGP_ROUTE_NORMAL
)
1541 bgp_zebra_announce (p
, new_select
, bgp
);
1544 /* Withdraw the route from the kernel. */
1546 && old_select
->type
== ZEBRA_ROUTE_BGP
1547 && old_select
->sub_type
== BGP_ROUTE_NORMAL
)
1548 bgp_zebra_withdraw (p
, old_select
);
1552 /* Reap old select bgp_info, it it has been removed */
1553 if (old_select
&& CHECK_FLAG (old_select
->flags
, BGP_INFO_REMOVED
))
1554 bgp_info_reap (rn
, old_select
);
1556 UNSET_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
);
1561 bgp_processq_del (struct work_queue
*wq
, void *data
)
1563 struct bgp_process_queue
*pq
= data
;
1565 bgp_unlock(pq
->bgp
);
1566 bgp_unlock_node (pq
->rn
);
1567 XFREE (MTYPE_BGP_PROCESS_QUEUE
, pq
);
1571 bgp_process_queue_init (void)
1573 bm
->process_main_queue
1574 = work_queue_new (bm
->master
, "process_main_queue");
1575 bm
->process_rsclient_queue
1576 = work_queue_new (bm
->master
, "process_rsclient_queue");
1578 if ( !(bm
->process_main_queue
&& bm
->process_rsclient_queue
) )
1580 zlog_err ("%s: Failed to allocate work queue", __func__
);
1584 bm
->process_main_queue
->spec
.workfunc
= &bgp_process_main
;
1585 bm
->process_rsclient_queue
->spec
.workfunc
= &bgp_process_rsclient
;
1586 bm
->process_main_queue
->spec
.del_item_data
= &bgp_processq_del
;
1587 bm
->process_rsclient_queue
->spec
.del_item_data
1588 = bm
->process_main_queue
->spec
.del_item_data
;
1589 bm
->process_main_queue
->spec
.max_retries
1590 = bm
->process_main_queue
->spec
.max_retries
= 0;
1591 bm
->process_rsclient_queue
->spec
.hold
1592 = bm
->process_main_queue
->spec
.hold
= 50;
1596 bgp_process (struct bgp
*bgp
, struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
1598 struct bgp_process_queue
*pqnode
;
1600 /* already scheduled for processing? */
1601 if (CHECK_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
))
1604 if ( (bm
->process_main_queue
== NULL
) ||
1605 (bm
->process_rsclient_queue
== NULL
) )
1606 bgp_process_queue_init ();
1608 pqnode
= XCALLOC (MTYPE_BGP_PROCESS_QUEUE
,
1609 sizeof (struct bgp_process_queue
));
1613 pqnode
->rn
= bgp_lock_node (rn
); /* unlocked by bgp_processq_del */
1617 pqnode
->safi
= safi
;
1619 switch (rn
->table
->type
)
1621 case BGP_TABLE_MAIN
:
1622 work_queue_add (bm
->process_main_queue
, pqnode
);
1624 case BGP_TABLE_RSCLIENT
:
1625 work_queue_add (bm
->process_rsclient_queue
, pqnode
);
1633 bgp_maximum_prefix_restart_timer (struct thread
*thread
)
1637 peer
= THREAD_ARG (thread
);
1638 peer
->t_pmax_restart
= NULL
;
1640 if (BGP_DEBUG (events
, EVENTS
))
1641 zlog_debug ("%s Maximum-prefix restart timer expired, restore peering",
1650 bgp_maximum_prefix_overflow (struct peer
*peer
, afi_t afi
,
1651 safi_t safi
, int always
)
1653 if (!CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
1656 if (peer
->pcount
[afi
][safi
] > peer
->pmax
[afi
][safi
])
1658 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
)
1662 zlog (peer
->log
, LOG_INFO
,
1663 "%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, "
1664 "limit %ld", afi_safi_print (afi
, safi
), peer
->host
,
1665 peer
->pcount
[afi
][safi
], peer
->pmax
[afi
][safi
]);
1666 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1668 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
1674 if (safi
== SAFI_MPLS_VPN
)
1675 safi
= BGP_SAFI_VPNV4
;
1677 ndata
[0] = (afi
>> 8);
1680 ndata
[3] = (peer
->pmax
[afi
][safi
] >> 24);
1681 ndata
[4] = (peer
->pmax
[afi
][safi
] >> 16);
1682 ndata
[5] = (peer
->pmax
[afi
][safi
] >> 8);
1683 ndata
[6] = (peer
->pmax
[afi
][safi
]);
1685 SET_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
);
1686 bgp_notify_send_with_data (peer
, BGP_NOTIFY_CEASE
,
1687 BGP_NOTIFY_CEASE_MAX_PREFIX
, ndata
, 7);
1690 /* restart timer start */
1691 if (peer
->pmax_restart
[afi
][safi
])
1693 peer
->v_pmax_restart
= peer
->pmax_restart
[afi
][safi
] * 60;
1695 if (BGP_DEBUG (events
, EVENTS
))
1696 zlog_debug ("%s Maximum-prefix restart timer started for %d secs",
1697 peer
->host
, peer
->v_pmax_restart
);
1699 BGP_TIMER_ON (peer
->t_pmax_restart
, bgp_maximum_prefix_restart_timer
,
1700 peer
->v_pmax_restart
);
1706 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1708 if (peer
->pcount
[afi
][safi
] > (peer
->pmax
[afi
][safi
] * peer
->pmax_threshold
[afi
][safi
] / 100))
1710 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
)
1714 zlog (peer
->log
, LOG_INFO
,
1715 "%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld",
1716 afi_safi_print (afi
, safi
), peer
->host
, peer
->pcount
[afi
][safi
],
1717 peer
->pmax
[afi
][safi
]);
1718 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
1721 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
1725 /* Unconditionally remove the route from the RIB, without taking
1726 * damping into consideration (eg, because the session went down)
1729 bgp_rib_remove (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
1730 afi_t afi
, safi_t safi
)
1732 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1734 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1735 bgp_info_delete (rn
, ri
); /* keep historical info */
1737 bgp_process (peer
->bgp
, rn
, afi
, safi
);
1741 bgp_rib_withdraw (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
1742 afi_t afi
, safi_t safi
)
1744 int status
= BGP_DAMP_NONE
;
1746 /* apply dampening, if result is suppressed, we'll be retaining
1747 * the bgp_info in the RIB for historical reference.
1749 if (CHECK_FLAG (peer
->bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1750 && peer_sort (peer
) == BGP_PEER_EBGP
)
1751 if ( (status
= bgp_damp_withdraw (ri
, rn
, afi
, safi
, 0))
1752 == BGP_DAMP_SUPPRESSED
)
1754 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1758 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
1762 bgp_update_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
1763 struct attr
*attr
, struct peer
*peer
, struct prefix
*p
, int type
,
1764 int sub_type
, struct prefix_rd
*prd
, u_char
*tag
)
1766 struct bgp_node
*rn
;
1768 struct attr new_attr
= { 0 };
1769 struct attr
*attr_new
;
1770 struct attr
*attr_new2
;
1771 struct bgp_info
*ri
;
1772 struct bgp_info
*new;
1774 char buf
[SU_ADDRSTRLEN
];
1776 //memset (new_attr, 0, sizeof (struct attr));
1778 /* Do not insert announces from a rsclient into its own 'bgp_table'. */
1779 if (peer
== rsclient
)
1783 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1785 /* Check previously received route. */
1786 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1787 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1790 /* AS path loop check. */
1791 if (aspath_loop_check (attr
->aspath
, rsclient
->as
) > peer
->allowas_in
[afi
][safi
])
1793 reason
= "as-path contains our own AS;";
1797 /* Route reflector originator ID check. */
1798 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
1799 && IPV4_ADDR_SAME (&rsclient
->remote_id
, &attr
->extra
->originator_id
))
1801 reason
= "originator is us;";
1805 bgp_attr_dup (&new_attr
, attr
);
1807 /* Apply export policy. */
1808 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
) &&
1809 bgp_export_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1811 reason
= "export-policy;";
1815 attr_new2
= bgp_attr_intern (&new_attr
);
1817 /* Apply import policy. */
1818 if (bgp_import_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1820 bgp_attr_unintern (attr_new2
);
1822 reason
= "import-policy;";
1826 attr_new
= bgp_attr_intern (&new_attr
);
1827 bgp_attr_unintern (attr_new2
);
1829 /* IPv4 unicast next hop check. */
1830 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
1832 /* Next hop must not be 0.0.0.0 nor Class E address. */
1833 if (new_attr
.nexthop
.s_addr
== 0
1834 || ntohl (new_attr
.nexthop
.s_addr
) >= 0xe0000000)
1836 bgp_attr_unintern (attr_new
);
1838 reason
= "martian next-hop;";
1843 /* new_attr isn't passed to any functions after here */
1844 bgp_attr_extra_free (&new_attr
);
1846 /* If the update is implicit withdraw. */
1849 ri
->uptime
= time (NULL
);
1851 /* Same attribute comes in. */
1852 if (!CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
)
1853 && attrhash_cmp (ri
->attr
, attr_new
))
1856 bgp_info_unset_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
1858 if (BGP_DEBUG (update
, UPDATE_IN
))
1859 zlog (peer
->log
, LOG_DEBUG
,
1860 "%s rcvd %s/%d for RS-client %s...duplicate ignored",
1862 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1863 p
->prefixlen
, rsclient
->host
);
1865 bgp_unlock_node (rn
);
1866 bgp_attr_unintern (attr_new
);
1871 /* Withdraw/Announce before we fully processed the withdraw */
1872 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
1873 bgp_info_restore (rn
, ri
);
1875 /* Received Logging. */
1876 if (BGP_DEBUG (update
, UPDATE_IN
))
1877 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
1879 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1880 p
->prefixlen
, rsclient
->host
);
1882 /* The attribute is changed. */
1883 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
1885 /* Update to new attribute. */
1886 bgp_attr_unintern (ri
->attr
);
1887 ri
->attr
= attr_new
;
1889 /* Update MPLS tag. */
1890 if (safi
== SAFI_MPLS_VPN
)
1891 memcpy ((bgp_info_extra_get (ri
))->tag
, tag
, 3);
1893 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
1895 /* Process change. */
1896 bgp_process (bgp
, rn
, afi
, safi
);
1897 bgp_unlock_node (rn
);
1902 /* Received Logging. */
1903 if (BGP_DEBUG (update
, UPDATE_IN
))
1905 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
1907 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1908 p
->prefixlen
, rsclient
->host
);
1911 /* Make new BGP info. */
1912 new = bgp_info_new ();
1914 new->sub_type
= sub_type
;
1916 new->attr
= attr_new
;
1917 new->uptime
= time (NULL
);
1919 /* Update MPLS tag. */
1920 if (safi
== SAFI_MPLS_VPN
)
1921 memcpy ((bgp_info_extra_get (new))->tag
, tag
, 3);
1923 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
1925 /* Register new BGP information. */
1926 bgp_info_add (rn
, new);
1928 /* route_node_get lock */
1929 bgp_unlock_node (rn
);
1931 /* Process change. */
1932 bgp_process (bgp
, rn
, afi
, safi
);
1934 bgp_attr_extra_free (&new_attr
);
1940 /* This BGP update is filtered. Log the reason then update BGP entry. */
1941 if (BGP_DEBUG (update
, UPDATE_IN
))
1942 zlog (peer
->log
, LOG_DEBUG
,
1943 "%s rcvd UPDATE about %s/%d -- DENIED for RS-client %s due to: %s",
1945 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1946 p
->prefixlen
, rsclient
->host
, reason
);
1949 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
1951 bgp_unlock_node (rn
);
1954 bgp_attr_extra_free (&new_attr
);
1960 bgp_withdraw_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
1961 struct peer
*peer
, struct prefix
*p
, int type
, int sub_type
,
1962 struct prefix_rd
*prd
, u_char
*tag
)
1964 struct bgp_node
*rn
;
1965 struct bgp_info
*ri
;
1966 char buf
[SU_ADDRSTRLEN
];
1968 if (rsclient
== peer
)
1971 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1973 /* Lookup withdrawn route. */
1974 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1975 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1978 /* Withdraw specified route from routing table. */
1979 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1980 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
1981 else if (BGP_DEBUG (update
, UPDATE_IN
))
1982 zlog (peer
->log
, LOG_DEBUG
,
1983 "%s Can't find the route %s/%d", peer
->host
,
1984 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1987 /* Unlock bgp_node_get() lock. */
1988 bgp_unlock_node (rn
);
1992 bgp_update_main (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
1993 afi_t afi
, safi_t safi
, int type
, int sub_type
,
1994 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
1997 int aspath_loop_count
= 0;
1998 struct bgp_node
*rn
;
2000 struct attr new_attr
= { 0 };
2001 struct attr
*attr_new
;
2002 struct bgp_info
*ri
;
2003 struct bgp_info
*new;
2005 char buf
[SU_ADDRSTRLEN
];
2008 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2010 /* When peer's soft reconfiguration enabled. Record input packet in
2012 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2013 && peer
!= bgp
->peer_self
&& ! soft_reconfig
)
2014 bgp_adj_in_set (rn
, peer
, attr
);
2016 /* Check previously received route. */
2017 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2018 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2021 /* AS path local-as loop check. */
2022 if (peer
->change_local_as
)
2024 if (! CHECK_FLAG (peer
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
2025 aspath_loop_count
= 1;
2027 if (aspath_loop_check (attr
->aspath
, peer
->change_local_as
) > aspath_loop_count
)
2029 reason
= "as-path contains our own AS;";
2034 /* AS path loop check. */
2035 if (aspath_loop_check (attr
->aspath
, bgp
->as
) > peer
->allowas_in
[afi
][safi
]
2036 || (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
2037 && aspath_loop_check(attr
->aspath
, bgp
->confed_id
)
2038 > peer
->allowas_in
[afi
][safi
]))
2040 reason
= "as-path contains our own AS;";
2044 /* Route reflector originator ID check. */
2045 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
2046 && IPV4_ADDR_SAME (&bgp
->router_id
, &attr
->extra
->originator_id
))
2048 reason
= "originator is us;";
2052 /* Route reflector cluster ID check. */
2053 if (bgp_cluster_filter (peer
, attr
))
2055 reason
= "reflected from the same cluster;";
2059 /* Apply incoming filter. */
2060 if (bgp_input_filter (peer
, p
, attr
, afi
, safi
) == FILTER_DENY
)
2066 /* Apply incoming route-map. */
2067 bgp_attr_dup (&new_attr
, attr
);
2069 if (bgp_input_modifier (peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
2071 reason
= "route-map;";
2075 /* IPv4 unicast next hop check. */
2076 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2078 /* If the peer is EBGP and nexthop is not on connected route,
2080 if (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
== 1
2081 && ! bgp_nexthop_check_ebgp (afi
, &new_attr
)
2082 && ! CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
))
2084 reason
= "non-connected next-hop;";
2088 /* Next hop must not be 0.0.0.0 nor Class E address. Next hop
2089 must not be my own address. */
2090 if (bgp_nexthop_self (afi
, &new_attr
)
2091 || new_attr
.nexthop
.s_addr
== 0
2092 || ntohl (new_attr
.nexthop
.s_addr
) >= 0xe0000000)
2094 reason
= "martian next-hop;";
2099 attr_new
= bgp_attr_intern (&new_attr
);
2101 /* If the update is implicit withdraw. */
2104 ri
->uptime
= time (NULL
);
2106 /* Same attribute comes in. */
2107 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
)
2108 && attrhash_cmp (ri
->attr
, attr_new
))
2110 bgp_info_unset_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
2112 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2113 && peer_sort (peer
) == BGP_PEER_EBGP
2114 && CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2116 if (BGP_DEBUG (update
, UPDATE_IN
))
2117 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2119 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2122 if (bgp_damp_update (ri
, rn
, afi
, safi
) != BGP_DAMP_SUPPRESSED
)
2124 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2125 bgp_process (bgp
, rn
, afi
, safi
);
2128 else /* Duplicate - odd */
2130 if (BGP_DEBUG (update
, UPDATE_IN
))
2131 zlog (peer
->log
, LOG_DEBUG
,
2132 "%s rcvd %s/%d...duplicate ignored",
2134 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2137 /* graceful restart STALE flag unset. */
2138 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2140 bgp_info_unset_flag (rn
, ri
, BGP_INFO_STALE
);
2141 bgp_process (bgp
, rn
, afi
, safi
);
2145 bgp_unlock_node (rn
);
2146 bgp_attr_unintern (attr_new
);
2147 bgp_attr_extra_free (&new_attr
);
2152 /* Withdraw/Announce before we fully processed the withdraw */
2153 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
2155 if (BGP_DEBUG (update
, UPDATE_IN
))
2156 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d, flapped quicker than processing",
2158 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2160 bgp_info_restore (rn
, ri
);
2163 /* Received Logging. */
2164 if (BGP_DEBUG (update
, UPDATE_IN
))
2165 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2167 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2170 /* graceful restart STALE flag unset. */
2171 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2172 bgp_info_unset_flag (rn
, ri
, BGP_INFO_STALE
);
2174 /* The attribute is changed. */
2175 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
2177 /* implicit withdraw, decrement aggregate and pcount here.
2178 * only if update is accepted, they'll increment below.
2180 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
2182 /* Update bgp route dampening information. */
2183 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2184 && peer_sort (peer
) == BGP_PEER_EBGP
)
2186 /* This is implicit withdraw so we should update dampening
2188 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2189 bgp_damp_withdraw (ri
, rn
, afi
, safi
, 1);
2192 /* Update to new attribute. */
2193 bgp_attr_unintern (ri
->attr
);
2194 ri
->attr
= attr_new
;
2196 /* Update MPLS tag. */
2197 if (safi
== SAFI_MPLS_VPN
)
2198 memcpy ((bgp_info_extra_get (ri
))->tag
, tag
, 3);
2200 /* Update bgp route dampening information. */
2201 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2202 && peer_sort (peer
) == BGP_PEER_EBGP
)
2204 /* Now we do normal update dampening. */
2205 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
2206 if (ret
== BGP_DAMP_SUPPRESSED
)
2208 bgp_unlock_node (rn
);
2209 bgp_attr_extra_free (&new_attr
);
2214 /* Nexthop reachability check. */
2215 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
2216 && safi
== SAFI_UNICAST
2217 && (peer_sort (peer
) == BGP_PEER_IBGP
2218 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
2219 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
2221 if (bgp_nexthop_lookup (afi
, peer
, ri
, NULL
, NULL
))
2222 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
2224 bgp_info_unset_flag (rn
, ri
, BGP_INFO_VALID
);
2227 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
2229 /* Process change. */
2230 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2232 bgp_process (bgp
, rn
, afi
, safi
);
2233 bgp_unlock_node (rn
);
2234 bgp_attr_extra_free (&new_attr
);
2239 /* Received Logging. */
2240 if (BGP_DEBUG (update
, UPDATE_IN
))
2242 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2244 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2248 /* Make new BGP info. */
2249 new = bgp_info_new ();
2251 new->sub_type
= sub_type
;
2253 new->attr
= attr_new
;
2254 new->uptime
= time (NULL
);
2256 /* Update MPLS tag. */
2257 if (safi
== SAFI_MPLS_VPN
)
2258 memcpy ((bgp_info_extra_get (new))->tag
, tag
, 3);
2260 /* Nexthop reachability check. */
2261 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
2262 && safi
== SAFI_UNICAST
2263 && (peer_sort (peer
) == BGP_PEER_IBGP
2264 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
2265 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
2267 if (bgp_nexthop_lookup (afi
, peer
, new, NULL
, NULL
))
2268 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2270 bgp_info_unset_flag (rn
, new, BGP_INFO_VALID
);
2273 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2275 /* Increment prefix */
2276 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
2278 /* Register new BGP information. */
2279 bgp_info_add (rn
, new);
2281 /* route_node_get lock */
2282 bgp_unlock_node (rn
);
2284 bgp_attr_extra_free (&new_attr
);
2286 /* If maximum prefix count is configured and current prefix
2288 if (bgp_maximum_prefix_overflow (peer
, afi
, safi
, 0))
2291 /* Process change. */
2292 bgp_process (bgp
, rn
, afi
, safi
);
2296 /* This BGP update is filtered. Log the reason then update BGP
2299 if (BGP_DEBUG (update
, UPDATE_IN
))
2300 zlog (peer
->log
, LOG_DEBUG
,
2301 "%s rcvd UPDATE about %s/%d -- DENIED due to: %s",
2303 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2304 p
->prefixlen
, reason
);
2307 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2309 bgp_unlock_node (rn
);
2311 bgp_attr_extra_free (&new_attr
);
2317 bgp_update (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2318 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2319 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
2321 struct peer
*rsclient
;
2322 struct listnode
*node
, *nnode
;
2326 ret
= bgp_update_main (peer
, p
, attr
, afi
, safi
, type
, sub_type
, prd
, tag
,
2331 /* Process the update for each RS-client. */
2332 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2334 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2335 bgp_update_rsclient (rsclient
, afi
, safi
, attr
, peer
, p
, type
,
2336 sub_type
, prd
, tag
);
2343 bgp_withdraw (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2344 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2345 struct prefix_rd
*prd
, u_char
*tag
)
2348 char buf
[SU_ADDRSTRLEN
];
2349 struct bgp_node
*rn
;
2350 struct bgp_info
*ri
;
2351 struct peer
*rsclient
;
2352 struct listnode
*node
, *nnode
;
2356 /* Process the withdraw for each RS-client. */
2357 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2359 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2360 bgp_withdraw_rsclient (rsclient
, afi
, safi
, peer
, p
, type
, sub_type
, prd
, tag
);
2364 if (BGP_DEBUG (update
, UPDATE_IN
))
2365 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd UPDATE about %s/%d -- withdrawn",
2367 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2371 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2373 /* If peer is soft reconfiguration enabled. Record input packet for
2374 further calculation. */
2375 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2376 && peer
!= bgp
->peer_self
)
2377 bgp_adj_in_unset (rn
, peer
);
2379 /* Lookup withdrawn route. */
2380 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2381 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2384 /* Withdraw specified route from routing table. */
2385 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2386 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
2387 else if (BGP_DEBUG (update
, UPDATE_IN
))
2388 zlog (peer
->log
, LOG_DEBUG
,
2389 "%s Can't find the route %s/%d", peer
->host
,
2390 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2393 /* Unlock bgp_node_get() lock. */
2394 bgp_unlock_node (rn
);
2400 bgp_default_originate (struct peer
*peer
, afi_t afi
, safi_t safi
, int withdraw
)
2404 struct aspath
*aspath
= { 0 };
2406 struct bgp_info binfo
;
2408 int ret
= RMAP_DENYMATCH
;
2410 if (!(afi
== AFI_IP
|| afi
== AFI_IP6
))
2414 from
= bgp
->peer_self
;
2416 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
2417 aspath
= attr
.aspath
;
2418 attr
.local_pref
= bgp
->default_local_pref
;
2419 memcpy (&attr
.nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
2422 str2prefix ("0.0.0.0/0", &p
);
2424 else if (afi
== AFI_IP6
)
2426 struct attr_extra
*ae
;
2429 ae
= bgp_attr_extra_get (&attr
);
2432 str2prefix ("::/0", &p
);
2434 /* IPv6 global nexthop must be included. */
2435 memcpy (&ae
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
2437 ae
->mp_nexthop_len
= 16;
2439 /* If the peer is on shared nextwork and we have link-local
2441 if (peer
->shared_network
2442 && !IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
2444 memcpy (&ae
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
2446 ae
->mp_nexthop_len
= 32;
2449 #endif /* HAVE_IPV6 */
2451 if (peer
->default_rmap
[afi
][safi
].name
)
2453 binfo
.peer
= bgp
->peer_self
;
2456 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_DEFAULT
);
2458 ret
= route_map_apply (peer
->default_rmap
[afi
][safi
].map
, &p
,
2461 bgp
->peer_self
->rmap_type
= 0;
2463 if (ret
== RMAP_DENYMATCH
)
2465 bgp_attr_flush (&attr
);
2472 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
2473 bgp_default_withdraw_send (peer
, afi
, safi
);
2474 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2478 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2479 bgp_default_update_send (peer
, &attr
, afi
, safi
, from
);
2482 bgp_attr_extra_free (&attr
);
2483 aspath_unintern (aspath
);
2487 bgp_announce_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2488 struct bgp_table
*table
, int rsclient
)
2490 struct bgp_node
*rn
;
2491 struct bgp_info
*ri
;
2494 memset (&attr
, 0, sizeof (struct attr
));
2497 table
= (rsclient
) ? peer
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2499 if (safi
!= SAFI_MPLS_VPN
2500 && CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
2501 bgp_default_originate (peer
, afi
, safi
, 0);
2503 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next(rn
))
2504 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2505 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
) && ri
->peer
!= peer
)
2508 (bgp_announce_check_rsclient (ri
, peer
, &rn
->p
, &attr
, afi
, safi
))
2509 : (bgp_announce_check (ri
, peer
, &rn
->p
, &attr
, afi
, safi
)))
2510 bgp_adj_out_set (rn
, peer
, &rn
->p
, &attr
, afi
, safi
, ri
);
2512 bgp_adj_out_unset (rn
, peer
, &rn
->p
, afi
, safi
);
2514 bgp_attr_extra_free (&attr
);
2519 bgp_announce_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2521 struct bgp_node
*rn
;
2522 struct bgp_table
*table
;
2524 if (peer
->status
!= Established
)
2527 if (! peer
->afc_nego
[afi
][safi
])
2530 /* First update is deferred until ORF or ROUTE-REFRESH is received */
2531 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
2534 if (safi
!= SAFI_MPLS_VPN
)
2535 bgp_announce_table (peer
, afi
, safi
, NULL
, 0);
2537 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2538 rn
= bgp_route_next(rn
))
2539 if ((table
= (rn
->info
)) != NULL
)
2540 bgp_announce_table (peer
, afi
, safi
, table
, 0);
2542 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2543 bgp_announce_table (peer
, afi
, safi
, NULL
, 1);
2547 bgp_announce_route_all (struct peer
*peer
)
2552 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2553 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2554 bgp_announce_route (peer
, afi
, safi
);
2558 bgp_soft_reconfig_table_rsclient (struct peer
*rsclient
, afi_t afi
,
2559 safi_t safi
, struct bgp_table
*table
)
2561 struct bgp_node
*rn
;
2562 struct bgp_adj_in
*ain
;
2565 table
= rsclient
->bgp
->rib
[afi
][safi
];
2567 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2568 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2570 bgp_update_rsclient (rsclient
, afi
, safi
, ain
->attr
, ain
->peer
,
2571 &rn
->p
, ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
2576 bgp_soft_reconfig_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
2578 struct bgp_table
*table
;
2579 struct bgp_node
*rn
;
2581 if (safi
!= SAFI_MPLS_VPN
)
2582 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, NULL
);
2585 for (rn
= bgp_table_top (rsclient
->bgp
->rib
[afi
][safi
]); rn
;
2586 rn
= bgp_route_next (rn
))
2587 if ((table
= rn
->info
) != NULL
)
2588 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, table
);
2592 bgp_soft_reconfig_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2593 struct bgp_table
*table
)
2596 struct bgp_node
*rn
;
2597 struct bgp_adj_in
*ain
;
2600 table
= peer
->bgp
->rib
[afi
][safi
];
2602 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2603 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2605 if (ain
->peer
== peer
)
2607 ret
= bgp_update (peer
, &rn
->p
, ain
->attr
, afi
, safi
,
2608 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
,
2612 bgp_unlock_node (rn
);
2621 bgp_soft_reconfig_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2623 struct bgp_node
*rn
;
2624 struct bgp_table
*table
;
2626 if (peer
->status
!= Established
)
2629 if (safi
!= SAFI_MPLS_VPN
)
2630 bgp_soft_reconfig_table (peer
, afi
, safi
, NULL
);
2632 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2633 rn
= bgp_route_next (rn
))
2634 if ((table
= rn
->info
) != NULL
)
2635 bgp_soft_reconfig_table (peer
, afi
, safi
, table
);
2638 static wq_item_status
2639 bgp_clear_route_node (struct work_queue
*wq
, void *data
)
2641 struct bgp_node
*rn
= data
;
2642 struct peer
*peer
= wq
->spec
.data
;
2643 struct bgp_info
*ri
;
2644 afi_t afi
= rn
->table
->afi
;
2645 safi_t safi
= rn
->table
->safi
;
2647 assert (rn
&& peer
);
2649 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2650 if (ri
->peer
== peer
)
2652 /* graceful restart STALE flag set. */
2653 if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_NSF_WAIT
)
2654 && peer
->nsf
[afi
][safi
]
2655 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
)
2656 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
2657 bgp_info_set_flag (rn
, ri
, BGP_INFO_STALE
);
2659 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2666 bgp_clear_node_queue_del (struct work_queue
*wq
, void *data
)
2668 struct bgp_node
*rn
= data
;
2670 bgp_unlock_node (rn
);
2674 bgp_clear_node_complete (struct work_queue
*wq
)
2676 struct peer
*peer
= wq
->spec
.data
;
2678 peer_unlock (peer
); /* bgp_clear_node_complete */
2680 /* Tickle FSM to start moving again */
2681 BGP_EVENT_ADD (peer
, Clearing_Completed
);
2685 bgp_clear_node_queue_init (struct peer
*peer
)
2687 #define CLEAR_QUEUE_NAME_LEN 26 /* "clear 2001:123:123:123::1" */
2688 char wname
[CLEAR_QUEUE_NAME_LEN
];
2690 snprintf (wname
, CLEAR_QUEUE_NAME_LEN
, "clear %s", peer
->host
);
2691 #undef CLEAR_QUEUE_NAME_LEN
2693 if ( (peer
->clear_node_queue
= work_queue_new (bm
->master
, wname
)) == NULL
)
2695 zlog_err ("%s: Failed to allocate work queue", __func__
);
2698 peer
->clear_node_queue
->spec
.hold
= 10;
2699 peer
->clear_node_queue
->spec
.workfunc
= &bgp_clear_route_node
;
2700 peer
->clear_node_queue
->spec
.del_item_data
= &bgp_clear_node_queue_del
;
2701 peer
->clear_node_queue
->spec
.completion_func
= &bgp_clear_node_complete
;
2702 peer
->clear_node_queue
->spec
.max_retries
= 0;
2704 /* we only 'lock' this peer reference when the queue is actually active */
2705 peer
->clear_node_queue
->spec
.data
= peer
;
2709 bgp_clear_route_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2710 struct bgp_table
*table
, struct peer
*rsclient
)
2712 struct bgp_node
*rn
;
2716 table
= (rsclient
) ? rsclient
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2718 /* If still no table => afi/safi isn't configured at all or smth. */
2722 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2724 struct bgp_info
*ri
;
2725 struct bgp_adj_in
*ain
;
2726 struct bgp_adj_out
*aout
;
2728 if (rn
->info
== NULL
)
2731 /* XXX:TODO: This is suboptimal, every non-empty route_node is
2732 * queued for every clearing peer, regardless of whether it is
2733 * relevant to the peer at hand.
2735 * Overview: There are 3 different indices which need to be
2736 * scrubbed, potentially, when a peer is removed:
2738 * 1 peer's routes visible via the RIB (ie accepted routes)
2739 * 2 peer's routes visible by the (optional) peer's adj-in index
2740 * 3 other routes visible by the peer's adj-out index
2742 * 3 there is no hurry in scrubbing, once the struct peer is
2743 * removed from bgp->peer, we could just GC such deleted peer's
2744 * adj-outs at our leisure.
2746 * 1 and 2 must be 'scrubbed' in some way, at least made
2747 * invisible via RIB index before peer session is allowed to be
2748 * brought back up. So one needs to know when such a 'search' is
2753 * - there'd be a single global queue or a single RIB walker
2754 * - rather than tracking which route_nodes still need to be
2755 * examined on a peer basis, we'd track which peers still
2758 * Given that our per-peer prefix-counts now should be reliable,
2759 * this may actually be achievable. It doesn't seem to be a huge
2760 * problem at this time,
2762 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2763 if (ri
->peer
== peer
)
2765 bgp_lock_node (rn
); /* unlocked: bgp_clear_node_queue_del */
2766 work_queue_add (peer
->clear_node_queue
, rn
);
2769 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2770 if (ain
->peer
== peer
)
2772 bgp_adj_in_remove (rn
, ain
);
2773 bgp_unlock_node (rn
);
2776 for (aout
= rn
->adj_out
; aout
; aout
= aout
->next
)
2777 if (aout
->peer
== peer
)
2779 bgp_adj_out_remove (rn
, aout
, peer
, afi
, safi
);
2780 bgp_unlock_node (rn
);
2788 bgp_clear_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2790 struct bgp_node
*rn
;
2791 struct bgp_table
*table
;
2792 struct peer
*rsclient
;
2793 struct listnode
*node
, *nnode
;
2795 if (peer
->clear_node_queue
== NULL
)
2796 bgp_clear_node_queue_init (peer
);
2798 /* bgp_fsm.c keeps sessions in state Clearing, not transitioning to
2799 * Idle until it receives a Clearing_Completed event. This protects
2800 * against peers which flap faster than we can we clear, which could
2803 * a) race with routes from the new session being installed before
2804 * clear_route_node visits the node (to delete the route of that
2806 * b) resource exhaustion, clear_route_node likely leads to an entry
2807 * on the process_main queue. Fast-flapping could cause that queue
2810 if (!peer
->clear_node_queue
->thread
)
2811 peer_lock (peer
); /* bgp_clear_node_complete */
2813 if (safi
!= SAFI_MPLS_VPN
)
2814 bgp_clear_route_table (peer
, afi
, safi
, NULL
, NULL
);
2816 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2817 rn
= bgp_route_next (rn
))
2818 if ((table
= rn
->info
) != NULL
)
2819 bgp_clear_route_table (peer
, afi
, safi
, table
, NULL
);
2821 for (ALL_LIST_ELEMENTS (peer
->bgp
->rsclient
, node
, nnode
, rsclient
))
2823 if (CHECK_FLAG(rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2824 bgp_clear_route_table (peer
, afi
, safi
, NULL
, rsclient
);
2827 /* If no routes were cleared, nothing was added to workqueue, the
2828 * completion function won't be run by workqueue code - call it here.
2829 * XXX: Actually, this assumption doesn't hold, see
2830 * bgp_clear_route_table(), we queue all non-empty nodes.
2832 * Additionally, there is a presumption in FSM that clearing is only
2833 * really needed if peer state is Established - peers in
2834 * pre-Established states shouldn't have any route-update state
2835 * associated with them (in or out).
2837 * We still can get here in pre-Established though, through
2838 * peer_delete -> bgp_fsm_change_status, so this is a useful sanity
2839 * check to ensure the assumption above holds.
2841 * At some future point, this check could be move to the top of the
2842 * function, and do a quick early-return when state is
2843 * pre-Established, avoiding above list and table scans. Once we're
2846 if (!peer
->clear_node_queue
->thread
)
2847 bgp_clear_node_complete (peer
->clear_node_queue
);
2851 bgp_clear_route_all (struct peer
*peer
)
2856 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2857 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2858 bgp_clear_route (peer
, afi
, safi
);
2862 bgp_clear_adj_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2864 struct bgp_table
*table
;
2865 struct bgp_node
*rn
;
2866 struct bgp_adj_in
*ain
;
2868 table
= peer
->bgp
->rib
[afi
][safi
];
2870 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2871 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2872 if (ain
->peer
== peer
)
2874 bgp_adj_in_remove (rn
, ain
);
2875 bgp_unlock_node (rn
);
2881 bgp_clear_stale_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2883 struct bgp_node
*rn
;
2884 struct bgp_info
*ri
;
2885 struct bgp_table
*table
;
2887 table
= peer
->bgp
->rib
[afi
][safi
];
2889 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2891 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2892 if (ri
->peer
== peer
)
2894 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2895 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2901 /* Delete all kernel routes. */
2903 bgp_cleanup_routes (void)
2906 struct listnode
*node
, *nnode
;
2907 struct bgp_node
*rn
;
2908 struct bgp_table
*table
;
2909 struct bgp_info
*ri
;
2911 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
2913 table
= bgp
->rib
[AFI_IP
][SAFI_UNICAST
];
2915 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2916 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2917 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
2918 && ri
->type
== ZEBRA_ROUTE_BGP
2919 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
2920 bgp_zebra_withdraw (&rn
->p
, ri
);
2922 table
= bgp
->rib
[AFI_IP6
][SAFI_UNICAST
];
2924 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2925 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2926 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
2927 && ri
->type
== ZEBRA_ROUTE_BGP
2928 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
2929 bgp_zebra_withdraw (&rn
->p
, ri
);
2937 bgp_zclient_reset ();
2938 access_list_reset ();
2939 prefix_list_reset ();
2942 /* Parse NLRI stream. Withdraw NLRI is recognized by NULL attr
2945 bgp_nlri_parse (struct peer
*peer
, struct attr
*attr
, struct bgp_nlri
*packet
)
2953 /* Check peer status. */
2954 if (peer
->status
!= Established
)
2958 lim
= pnt
+ packet
->length
;
2960 for (; pnt
< lim
; pnt
+= psize
)
2962 /* Clear prefix structure. */
2963 memset (&p
, 0, sizeof (struct prefix
));
2965 /* Fetch prefix length. */
2966 p
.prefixlen
= *pnt
++;
2967 p
.family
= afi2family (packet
->afi
);
2969 /* Already checked in nlri_sanity_check(). We do double check
2971 if ((packet
->afi
== AFI_IP
&& p
.prefixlen
> 32)
2972 || (packet
->afi
== AFI_IP6
&& p
.prefixlen
> 128))
2975 /* Packet size overflow check. */
2976 psize
= PSIZE (p
.prefixlen
);
2978 /* When packet overflow occur return immediately. */
2979 if (pnt
+ psize
> lim
)
2982 /* Fetch prefix from NLRI packet. */
2983 memcpy (&p
.u
.prefix
, pnt
, psize
);
2985 /* Check address. */
2986 if (packet
->afi
== AFI_IP
&& packet
->safi
== SAFI_UNICAST
)
2988 if (IN_CLASSD (ntohl (p
.u
.prefix4
.s_addr
)))
2991 * From draft-ietf-idr-bgp4-22, Section 6.3:
2992 * If a BGP router receives an UPDATE message with a
2993 * semantically incorrect NLRI field, in which a prefix is
2994 * semantically incorrect (eg. an unexpected multicast IP
2995 * address), it should ignore the prefix.
2997 zlog (peer
->log
, LOG_ERR
,
2998 "IPv4 unicast NLRI is multicast address %s",
2999 inet_ntoa (p
.u
.prefix4
));
3006 /* Check address. */
3007 if (packet
->afi
== AFI_IP6
&& packet
->safi
== SAFI_UNICAST
)
3009 if (IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3013 zlog (peer
->log
, LOG_WARNING
,
3014 "IPv6 link-local NLRI received %s ignore this NLRI",
3015 inet_ntop (AF_INET6
, &p
.u
.prefix6
, buf
, BUFSIZ
));
3020 #endif /* HAVE_IPV6 */
3022 /* Normal process. */
3024 ret
= bgp_update (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
3025 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
, 0);
3027 ret
= bgp_withdraw (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
3028 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
3030 /* Address family configuration mismatch or maximum-prefix count
3036 /* Packet length consistency check. */
3043 /* NLRI encode syntax check routine. */
3045 bgp_nlri_sanity_check (struct peer
*peer
, int afi
, u_char
*pnt
,
3054 /* RFC1771 6.3 The NLRI field in the UPDATE message is checked for
3055 syntactic validity. If the field is syntactically incorrect,
3056 then the Error Subcode is set to Invalid Network Field. */
3062 /* Prefix length check. */
3063 if ((afi
== AFI_IP
&& prefixlen
> 32)
3064 || (afi
== AFI_IP6
&& prefixlen
> 128))
3066 plog_err (peer
->log
,
3067 "%s [Error] Update packet error (wrong prefix length %d)",
3068 peer
->host
, prefixlen
);
3069 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3070 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3074 /* Packet size overflow check. */
3075 psize
= PSIZE (prefixlen
);
3077 if (pnt
+ psize
> end
)
3079 plog_err (peer
->log
,
3080 "%s [Error] Update packet error"
3081 " (prefix data overflow prefix size is %d)",
3083 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3084 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3091 /* Packet length consistency check. */
3094 plog_err (peer
->log
,
3095 "%s [Error] Update packet error"
3096 " (prefix length mismatch with total length)",
3098 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3099 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3105 static struct bgp_static
*
3106 bgp_static_new (void)
3108 return XCALLOC (MTYPE_BGP_STATIC
, sizeof (struct bgp_static
));
3112 bgp_static_free (struct bgp_static
*bgp_static
)
3114 if (bgp_static
->rmap
.name
)
3115 free (bgp_static
->rmap
.name
);
3116 XFREE (MTYPE_BGP_STATIC
, bgp_static
);
3120 bgp_static_withdraw_rsclient (struct bgp
*bgp
, struct peer
*rsclient
,
3121 struct prefix
*p
, afi_t afi
, safi_t safi
)
3123 struct bgp_node
*rn
;
3124 struct bgp_info
*ri
;
3126 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3128 /* Check selected route and self inserted route. */
3129 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3130 if (ri
->peer
== bgp
->peer_self
3131 && ri
->type
== ZEBRA_ROUTE_BGP
3132 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3135 /* Withdraw static BGP route from routing table. */
3138 bgp_info_delete (rn
, ri
);
3139 bgp_process (bgp
, rn
, afi
, safi
);
3142 /* Unlock bgp_node_lookup. */
3143 bgp_unlock_node (rn
);
3147 bgp_static_update_rsclient (struct peer
*rsclient
, struct prefix
*p
,
3148 struct bgp_static
*bgp_static
,
3149 afi_t afi
, safi_t safi
)
3151 struct bgp_node
*rn
;
3152 struct bgp_info
*ri
;
3153 struct bgp_info
*new;
3154 struct bgp_info info
;
3155 struct attr
*attr_new
;
3156 struct attr attr
= {0 };
3157 struct attr new_attr
= { .extra
= 0 };
3160 char buf
[SU_ADDRSTRLEN
];
3162 bgp
= rsclient
->bgp
;
3164 assert (bgp_static
);
3168 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3170 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3172 attr
.nexthop
= bgp_static
->igpnexthop
;
3173 attr
.med
= bgp_static
->igpmetric
;
3174 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3176 if (bgp_static
->ttl
)
3178 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_AS_PATHLIMIT
);
3179 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3180 attr
.pathlimit
.as
= 0;
3181 attr
.pathlimit
.ttl
= bgp_static
->ttl
;
3184 if (bgp_static
->atomic
)
3185 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3187 /* Apply network route-map for export to this rsclient. */
3188 if (bgp_static
->rmap
.name
)
3190 struct attr attr_tmp
= attr
;
3191 info
.peer
= rsclient
;
3192 info
.attr
= &attr_tmp
;
3194 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
3195 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3197 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3199 rsclient
->rmap_type
= 0;
3201 if (ret
== RMAP_DENYMATCH
)
3203 /* Free uninterned attribute. */
3204 bgp_attr_flush (&attr_tmp
);
3206 /* Unintern original. */
3207 aspath_unintern (attr
.aspath
);
3208 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
3209 bgp_attr_extra_free (&attr
);
3213 attr_new
= bgp_attr_intern (&attr_tmp
);
3216 attr_new
= bgp_attr_intern (&attr
);
3218 new_attr
= *attr_new
;
3220 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3222 if (bgp_import_modifier (rsclient
, bgp
->peer_self
, p
, &new_attr
, afi
, safi
)
3225 /* This BGP update is filtered. Log the reason then update BGP entry. */
3226 if (BGP_DEBUG (update
, UPDATE_IN
))
3227 zlog (rsclient
->log
, LOG_DEBUG
,
3228 "Static UPDATE about %s/%d -- DENIED for RS-client %s due to: import-policy",
3229 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
3230 p
->prefixlen
, rsclient
->host
);
3232 bgp
->peer_self
->rmap_type
= 0;
3234 bgp_attr_unintern (attr_new
);
3235 aspath_unintern (attr
.aspath
);
3236 bgp_attr_extra_free (&attr
);
3238 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
3243 bgp
->peer_self
->rmap_type
= 0;
3245 bgp_attr_unintern (attr_new
);
3246 attr_new
= bgp_attr_intern (&new_attr
);
3248 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3249 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3250 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3255 if (attrhash_cmp (ri
->attr
, attr_new
) &&
3256 !CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3258 bgp_unlock_node (rn
);
3259 bgp_attr_unintern (attr_new
);
3260 aspath_unintern (attr
.aspath
);
3261 bgp_attr_extra_free (&attr
);
3266 /* The attribute is changed. */
3267 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
3269 /* Rewrite BGP route information. */
3270 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3271 bgp_info_restore(rn
, ri
);
3272 bgp_attr_unintern (ri
->attr
);
3273 ri
->attr
= attr_new
;
3274 ri
->uptime
= time (NULL
);
3276 /* Process change. */
3277 bgp_process (bgp
, rn
, afi
, safi
);
3278 bgp_unlock_node (rn
);
3279 aspath_unintern (attr
.aspath
);
3280 bgp_attr_extra_free (&attr
);
3285 /* Make new BGP info. */
3286 new = bgp_info_new ();
3287 new->type
= ZEBRA_ROUTE_BGP
;
3288 new->sub_type
= BGP_ROUTE_STATIC
;
3289 new->peer
= bgp
->peer_self
;
3290 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3291 new->attr
= attr_new
;
3292 new->uptime
= time (NULL
);
3294 /* Register new BGP information. */
3295 bgp_info_add (rn
, new);
3297 /* route_node_get lock */
3298 bgp_unlock_node (rn
);
3300 /* Process change. */
3301 bgp_process (bgp
, rn
, afi
, safi
);
3303 /* Unintern original. */
3304 aspath_unintern (attr
.aspath
);
3305 bgp_attr_extra_free (&attr
);
3309 bgp_static_update_main (struct bgp
*bgp
, struct prefix
*p
,
3310 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3312 struct bgp_node
*rn
;
3313 struct bgp_info
*ri
;
3314 struct bgp_info
*new;
3315 struct bgp_info info
;
3316 struct attr attr
= { 0 };
3317 struct attr
*attr_new
;
3320 assert (bgp_static
);
3324 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3326 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3328 attr
.nexthop
= bgp_static
->igpnexthop
;
3329 attr
.med
= bgp_static
->igpmetric
;
3330 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3332 if (bgp_static
->ttl
)
3334 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_AS_PATHLIMIT
);
3335 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3336 attr
.pathlimit
.as
= 0;
3337 attr
.pathlimit
.ttl
= bgp_static
->ttl
;
3340 if (bgp_static
->atomic
)
3341 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3343 /* Apply route-map. */
3344 if (bgp_static
->rmap
.name
)
3346 struct attr attr_tmp
= attr
;
3347 info
.peer
= bgp
->peer_self
;
3348 info
.attr
= &attr_tmp
;
3350 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3352 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3354 bgp
->peer_self
->rmap_type
= 0;
3356 if (ret
== RMAP_DENYMATCH
)
3358 /* Free uninterned attribute. */
3359 bgp_attr_flush (&attr_tmp
);
3361 /* Unintern original. */
3362 aspath_unintern (attr
.aspath
);
3363 bgp_attr_extra_free (&attr
);
3364 bgp_static_withdraw (bgp
, p
, afi
, safi
);
3367 attr_new
= bgp_attr_intern (&attr_tmp
);
3370 attr_new
= bgp_attr_intern (&attr
);
3372 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3373 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3374 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3379 if (attrhash_cmp (ri
->attr
, attr_new
) &&
3380 !CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3382 bgp_unlock_node (rn
);
3383 bgp_attr_unintern (attr_new
);
3384 aspath_unintern (attr
.aspath
);
3385 bgp_attr_extra_free (&attr
);
3390 /* The attribute is changed. */
3391 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
3393 /* Rewrite BGP route information. */
3394 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3395 bgp_info_restore(rn
, ri
);
3397 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3398 bgp_attr_unintern (ri
->attr
);
3399 ri
->attr
= attr_new
;
3400 ri
->uptime
= time (NULL
);
3402 /* Process change. */
3403 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
3404 bgp_process (bgp
, rn
, afi
, safi
);
3405 bgp_unlock_node (rn
);
3406 aspath_unintern (attr
.aspath
);
3407 bgp_attr_extra_free (&attr
);
3412 /* Make new BGP info. */
3413 new = bgp_info_new ();
3414 new->type
= ZEBRA_ROUTE_BGP
;
3415 new->sub_type
= BGP_ROUTE_STATIC
;
3416 new->peer
= bgp
->peer_self
;
3417 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3418 new->attr
= attr_new
;
3419 new->uptime
= time (NULL
);
3421 /* Aggregate address increment. */
3422 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3424 /* Register new BGP information. */
3425 bgp_info_add (rn
, new);
3427 /* route_node_get lock */
3428 bgp_unlock_node (rn
);
3430 /* Process change. */
3431 bgp_process (bgp
, rn
, afi
, safi
);
3433 /* Unintern original. */
3434 aspath_unintern (attr
.aspath
);
3435 bgp_attr_extra_free (&attr
);
3439 bgp_static_update (struct bgp
*bgp
, struct prefix
*p
,
3440 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3442 struct peer
*rsclient
;
3443 struct listnode
*node
, *nnode
;
3445 bgp_static_update_main (bgp
, p
, bgp_static
, afi
, safi
);
3447 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
3449 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
3450 bgp_static_update_rsclient (rsclient
, p
, bgp_static
, afi
, safi
);
3455 bgp_static_update_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
3456 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
3458 struct bgp_node
*rn
;
3459 struct bgp_info
*new;
3461 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3463 /* Make new BGP info. */
3464 new = bgp_info_new ();
3465 new->type
= ZEBRA_ROUTE_BGP
;
3466 new->sub_type
= BGP_ROUTE_STATIC
;
3467 new->peer
= bgp
->peer_self
;
3468 new->attr
= bgp_attr_default_intern (BGP_ORIGIN_IGP
);
3469 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3470 new->uptime
= time (NULL
);
3471 new->extra
= bgp_info_extra_new();
3472 memcpy (new->extra
->tag
, tag
, 3);
3474 /* Aggregate address increment. */
3475 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3477 /* Register new BGP information. */
3478 bgp_info_add (rn
, new);
3480 /* route_node_get lock */
3481 bgp_unlock_node (rn
);
3483 /* Process change. */
3484 bgp_process (bgp
, rn
, afi
, safi
);
3488 bgp_static_withdraw (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3491 struct bgp_node
*rn
;
3492 struct bgp_info
*ri
;
3494 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3496 /* Check selected route and self inserted route. */
3497 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3498 if (ri
->peer
== bgp
->peer_self
3499 && ri
->type
== ZEBRA_ROUTE_BGP
3500 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3503 /* Withdraw static BGP route from routing table. */
3506 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3507 bgp_info_delete (rn
, ri
);
3508 bgp_process (bgp
, rn
, afi
, safi
);
3511 /* Unlock bgp_node_lookup. */
3512 bgp_unlock_node (rn
);
3516 bgp_check_local_routes_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
3518 struct bgp_static
*bgp_static
;
3520 struct bgp_node
*rn
;
3523 bgp
= rsclient
->bgp
;
3525 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3526 if ((bgp_static
= rn
->info
) != NULL
)
3530 bgp_static_update_rsclient (rsclient
, p
, bgp_static
,
3536 bgp_static_withdraw_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
3537 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
3539 struct bgp_node
*rn
;
3540 struct bgp_info
*ri
;
3542 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3544 /* Check selected route and self inserted route. */
3545 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3546 if (ri
->peer
== bgp
->peer_self
3547 && ri
->type
== ZEBRA_ROUTE_BGP
3548 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3551 /* Withdraw static BGP route from routing table. */
3554 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3555 bgp_info_delete (rn
, ri
);
3556 bgp_process (bgp
, rn
, afi
, safi
);
3559 /* Unlock bgp_node_lookup. */
3560 bgp_unlock_node (rn
);
3564 bgp_pathlimit_update_parents (struct bgp
*bgp
, struct bgp_node
*rn
,
3567 struct bgp_node
*parent
= rn
;
3568 struct bgp_static
*sp
;
3570 /* Existing static changed TTL, search parents and adjust their atomic */
3571 while ((parent
= parent
->parent
))
3572 if ((sp
= parent
->info
))
3574 int sp_level
= (sp
->atomic
? 1 : 0);
3575 ttl_edge
? sp
->atomic
++ : sp
->atomic
--;
3577 /* did we change state of parent whether atomic is set or not? */
3578 if (sp_level
!= (sp
->atomic
? 1 : 0))
3580 bgp_static_update (bgp
, &parent
->p
, sp
,
3581 rn
->table
->afi
, rn
->table
->safi
);
3586 /* Configure static BGP network. When user don't run zebra, static
3587 route should be installed as valid. */
3589 bgp_static_set (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3590 u_int16_t afi
, u_char safi
, const char *rmap
, int backdoor
,
3595 struct bgp_static
*bgp_static
;
3596 struct bgp_node
*rn
;
3597 u_char need_update
= 0;
3598 u_char ttl_change
= 0;
3599 u_char ttl_edge
= (ttl
? 1 : 0);
3602 /* Convert IP prefix string to struct prefix. */
3603 ret
= str2prefix (ip_str
, &p
);
3606 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3610 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3612 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3616 #endif /* HAVE_IPV6 */
3620 /* Set BGP static route configuration. */
3621 rn
= bgp_node_get (bgp
->route
[afi
][safi
], &p
);
3625 /* Configuration change. */
3626 bgp_static
= rn
->info
;
3628 /* Check previous routes are installed into BGP. */
3629 if (bgp_static
->valid
)
3631 if (bgp_static
->backdoor
!= backdoor
3632 || bgp_static
->ttl
!= ttl
)
3636 /* need to catch TTL set/unset transitions for handling of
3639 if ((bgp_static
->ttl
? 1 : 0) != ttl_edge
)
3642 bgp_static
->backdoor
= backdoor
;
3643 bgp_static
->ttl
= ttl
;
3647 if (bgp_static
->rmap
.name
)
3648 free (bgp_static
->rmap
.name
);
3649 bgp_static
->rmap
.name
= strdup (rmap
);
3650 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
3654 if (bgp_static
->rmap
.name
)
3655 free (bgp_static
->rmap
.name
);
3656 bgp_static
->rmap
.name
= NULL
;
3657 bgp_static
->rmap
.map
= NULL
;
3658 bgp_static
->valid
= 0;
3660 bgp_unlock_node (rn
);
3664 /* New configuration. */
3665 bgp_static
= bgp_static_new ();
3666 bgp_static
->backdoor
= backdoor
;
3667 bgp_static
->valid
= 0;
3668 bgp_static
->igpmetric
= 0;
3669 bgp_static
->igpnexthop
.s_addr
= 0;
3670 bgp_static
->ttl
= ttl
;
3671 ttl_change
= ttl_edge
;
3676 if (bgp_static
->rmap
.name
)
3677 free (bgp_static
->rmap
.name
);
3678 bgp_static
->rmap
.name
= strdup (rmap
);
3679 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
3681 rn
->info
= bgp_static
;
3684 /* ".. sites that choose to advertise the
3685 * AS_PATHLIMIT path attribute SHOULD advertise the ATOMIC_AGGREGATE on
3686 * all less specific covering prefixes as well as the more specific
3690 * Prefix that has just had pathlimit set/unset:
3691 * - Must bump ATOMIC refcount on all parents.
3693 * To catch less specific prefixes:
3694 * - Must search children for ones with TTL, bump atomic refcount
3695 * (we dont care if we're deleting a less specific prefix..)
3699 /* Existing static changed TTL, search parents and adjust their atomic */
3700 bgp_pathlimit_update_parents (bgp
, rn
, ttl_edge
);
3705 struct bgp_node
*child
;
3706 struct bgp_static
*sc
;
3708 /* New static, search children and bump this statics atomic.. */
3709 child
= bgp_lock_node (rn
); /* route_next_until unlocks it.. */
3710 while ((child
= bgp_route_next_until (child
, rn
)))
3712 if ((sc
= child
->info
) && sc
->ttl
)
3713 bgp_static
->atomic
++;
3717 /* If BGP scan is not enabled, we should install this route here. */
3718 if (! bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3720 bgp_static
->valid
= 1;
3723 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
3725 if (! bgp_static
->backdoor
)
3726 bgp_static_update (bgp
, &p
, bgp_static
, afi
, safi
);
3732 /* Configure static BGP network. */
3734 bgp_static_unset (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3735 u_int16_t afi
, u_char safi
)
3739 struct bgp_static
*bgp_static
;
3740 struct bgp_node
*rn
;
3742 /* Convert IP prefix string to struct prefix. */
3743 ret
= str2prefix (ip_str
, &p
);
3746 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3750 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3752 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3756 #endif /* HAVE_IPV6 */
3760 rn
= bgp_node_lookup (bgp
->route
[afi
][safi
], &p
);
3763 vty_out (vty
, "%% Can't find specified static route configuration.%s",
3768 bgp_static
= rn
->info
;
3770 /* decrement atomic in parents, see bgp_static_set */
3771 bgp_pathlimit_update_parents (bgp
, rn
, 0);
3773 /* Update BGP RIB. */
3774 if (! bgp_static
->backdoor
)
3775 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
3777 /* Clear configuration. */
3778 bgp_static_free (bgp_static
);
3780 bgp_unlock_node (rn
);
3781 bgp_unlock_node (rn
);
3786 /* Called from bgp_delete(). Delete all static routes from the BGP
3789 bgp_static_delete (struct bgp
*bgp
)
3793 struct bgp_node
*rn
;
3794 struct bgp_node
*rm
;
3795 struct bgp_table
*table
;
3796 struct bgp_static
*bgp_static
;
3798 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
3799 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
3800 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3801 if (rn
->info
!= NULL
)
3803 if (safi
== SAFI_MPLS_VPN
)
3807 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
3809 bgp_static
= rn
->info
;
3810 bgp_static_withdraw_vpnv4 (bgp
, &rm
->p
,
3811 AFI_IP
, SAFI_MPLS_VPN
,
3812 (struct prefix_rd
*)&rn
->p
,
3814 bgp_static_free (bgp_static
);
3816 bgp_unlock_node (rn
);
3821 bgp_static
= rn
->info
;
3822 bgp_static_withdraw (bgp
, &rn
->p
, afi
, safi
);
3823 bgp_static_free (bgp_static
);
3825 bgp_unlock_node (rn
);
3831 bgp_static_set_vpnv4 (struct vty
*vty
, const char *ip_str
, const char *rd_str
,
3832 const char *tag_str
)
3836 struct prefix_rd prd
;
3838 struct bgp_node
*prn
;
3839 struct bgp_node
*rn
;
3840 struct bgp_table
*table
;
3841 struct bgp_static
*bgp_static
;
3846 ret
= str2prefix (ip_str
, &p
);
3849 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3854 ret
= str2prefix_rd (rd_str
, &prd
);
3857 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
3861 ret
= str2tag (tag_str
, tag
);
3864 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
3868 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
3869 (struct prefix
*)&prd
);
3870 if (prn
->info
== NULL
)
3871 prn
->info
= bgp_table_init (AFI_IP
, SAFI_MPLS_VPN
);
3873 bgp_unlock_node (prn
);
3876 rn
= bgp_node_get (table
, &p
);
3880 vty_out (vty
, "%% Same network configuration exists%s", VTY_NEWLINE
);
3881 bgp_unlock_node (rn
);
3885 /* New configuration. */
3886 bgp_static
= bgp_static_new ();
3887 bgp_static
->valid
= 1;
3888 memcpy (bgp_static
->tag
, tag
, 3);
3889 rn
->info
= bgp_static
;
3891 bgp_static_update_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
3897 /* Configure static BGP network. */
3899 bgp_static_unset_vpnv4 (struct vty
*vty
, const char *ip_str
,
3900 const char *rd_str
, const char *tag_str
)
3905 struct prefix_rd prd
;
3906 struct bgp_node
*prn
;
3907 struct bgp_node
*rn
;
3908 struct bgp_table
*table
;
3909 struct bgp_static
*bgp_static
;
3914 /* Convert IP prefix string to struct prefix. */
3915 ret
= str2prefix (ip_str
, &p
);
3918 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3923 ret
= str2prefix_rd (rd_str
, &prd
);
3926 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
3930 ret
= str2tag (tag_str
, tag
);
3933 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
3937 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
3938 (struct prefix
*)&prd
);
3939 if (prn
->info
== NULL
)
3940 prn
->info
= bgp_table_init (AFI_IP
, SAFI_MPLS_VPN
);
3942 bgp_unlock_node (prn
);
3945 rn
= bgp_node_lookup (table
, &p
);
3949 bgp_static_withdraw_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
3951 bgp_static
= rn
->info
;
3952 bgp_static_free (bgp_static
);
3954 bgp_unlock_node (rn
);
3955 bgp_unlock_node (rn
);
3958 vty_out (vty
, "%% Can't find the route%s", VTY_NEWLINE
);
3965 "network A.B.C.D/M",
3966 "Specify a network to announce via BGP\n"
3967 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
3972 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[1], 1, 255);
3974 return bgp_static_set (vty
, vty
->index
, argv
[0],
3975 AFI_IP
, bgp_node_safi (vty
), NULL
, 0, ttl
);
3979 bgp_network_ttl_cmd
,
3980 "network A.B.C.D/M pathlimit <0-255>",
3981 "Specify a network to announce via BGP\n"
3982 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3983 "AS-Path hopcount limit attribute\n"
3984 "AS-Pathlimit TTL, in number of AS-Path hops\n")
3986 DEFUN (bgp_network_route_map
,
3987 bgp_network_route_map_cmd
,
3988 "network A.B.C.D/M route-map WORD",
3989 "Specify a network to announce via BGP\n"
3990 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3991 "Route-map to modify the attributes\n"
3992 "Name of the route map\n")
3994 return bgp_static_set (vty
, vty
->index
, argv
[0],
3995 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0, 0);
3998 DEFUN (bgp_network_backdoor
,
3999 bgp_network_backdoor_cmd
,
4000 "network A.B.C.D/M backdoor",
4001 "Specify a network to announce via BGP\n"
4002 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4003 "Specify a BGP backdoor route\n")
4008 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[1], 1, 255);
4010 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP
, SAFI_UNICAST
,
4014 ALIAS (bgp_network_backdoor
,
4015 bgp_network_backdoor_ttl_cmd
,
4016 "network A.B.C.D/M backdoor pathlimit <0-255>",
4017 "Specify a network to announce via BGP\n"
4018 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4019 "Specify a BGP backdoor route\n"
4020 "AS-Path hopcount limit attribute\n"
4021 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4023 DEFUN (bgp_network_mask
,
4024 bgp_network_mask_cmd
,
4025 "network A.B.C.D mask A.B.C.D",
4026 "Specify a network to announce via BGP\n"
4032 char prefix_str
[BUFSIZ
];
4036 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[2], 1, 255);
4038 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4041 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4045 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4046 AFI_IP
, bgp_node_safi (vty
), NULL
, 0, ttl
);
4049 ALIAS (bgp_network_mask
,
4050 bgp_network_mask_ttl_cmd
,
4051 "network A.B.C.D mask A.B.C.D pathlimit <0-255>",
4052 "Specify a network to announce via BGP\n"
4056 "AS-Path hopcount limit attribute\n"
4057 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4059 DEFUN (bgp_network_mask_route_map
,
4060 bgp_network_mask_route_map_cmd
,
4061 "network A.B.C.D mask A.B.C.D route-map WORD",
4062 "Specify a network to announce via BGP\n"
4066 "Route-map to modify the attributes\n"
4067 "Name of the route map\n")
4070 char prefix_str
[BUFSIZ
];
4072 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4075 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4079 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4080 AFI_IP
, bgp_node_safi (vty
), argv
[2], 0, 0);
4083 DEFUN (bgp_network_mask_backdoor
,
4084 bgp_network_mask_backdoor_cmd
,
4085 "network A.B.C.D mask A.B.C.D backdoor",
4086 "Specify a network to announce via BGP\n"
4090 "Specify a BGP backdoor route\n")
4093 char prefix_str
[BUFSIZ
];
4097 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[2], 1, 255);
4099 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4102 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4106 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
,
4110 ALIAS (bgp_network_mask_backdoor
,
4111 bgp_network_mask_backdoor_ttl_cmd
,
4112 "network A.B.C.D mask A.B.C.D backdoor pathlimit <0-255>",
4113 "Specify a network to announce via BGP\n"
4117 "Specify a BGP backdoor route\n"
4118 "AS-Path hopcount limit attribute\n"
4119 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4121 DEFUN (bgp_network_mask_natural
,
4122 bgp_network_mask_natural_cmd
,
4124 "Specify a network to announce via BGP\n"
4128 char prefix_str
[BUFSIZ
];
4132 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[1], 1, 255);
4134 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4137 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4141 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4142 AFI_IP
, bgp_node_safi (vty
), NULL
, 0, ttl
);
4145 ALIAS (bgp_network_mask_natural
,
4146 bgp_network_mask_natural_ttl_cmd
,
4147 "network A.B.C.D pathlimit <0-255>",
4148 "Specify a network to announce via BGP\n"
4150 "AS-Path hopcount limit attribute\n"
4151 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4153 DEFUN (bgp_network_mask_natural_route_map
,
4154 bgp_network_mask_natural_route_map_cmd
,
4155 "network A.B.C.D route-map WORD",
4156 "Specify a network to announce via BGP\n"
4158 "Route-map to modify the attributes\n"
4159 "Name of the route map\n")
4162 char prefix_str
[BUFSIZ
];
4164 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4167 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4171 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4172 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0, 0);
4175 DEFUN (bgp_network_mask_natural_backdoor
,
4176 bgp_network_mask_natural_backdoor_cmd
,
4177 "network A.B.C.D backdoor",
4178 "Specify a network to announce via BGP\n"
4180 "Specify a BGP backdoor route\n")
4183 char prefix_str
[BUFSIZ
];
4187 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[1], 1, 255);
4189 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4192 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4196 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
,
4200 ALIAS (bgp_network_mask_natural_backdoor
,
4201 bgp_network_mask_natural_backdoor_ttl_cmd
,
4202 "network A.B.C.D backdoor pathlimit (1-255>",
4203 "Specify a network to announce via BGP\n"
4205 "Specify a BGP backdoor route\n"
4206 "AS-Path hopcount limit attribute\n"
4207 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4209 DEFUN (no_bgp_network
,
4211 "no network A.B.C.D/M",
4213 "Specify a network to announce via BGP\n"
4214 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
4216 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP
,
4217 bgp_node_safi (vty
));
4220 ALIAS (no_bgp_network
,
4221 no_bgp_network_ttl_cmd
,
4222 "no network A.B.C.D/M pathlimit <0-255>",
4224 "Specify a network to announce via BGP\n"
4225 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4226 "AS-Path hopcount limit attribute\n"
4227 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4229 ALIAS (no_bgp_network
,
4230 no_bgp_network_route_map_cmd
,
4231 "no network A.B.C.D/M route-map WORD",
4233 "Specify a network to announce via BGP\n"
4234 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4235 "Route-map to modify the attributes\n"
4236 "Name of the route map\n")
4238 ALIAS (no_bgp_network
,
4239 no_bgp_network_backdoor_cmd
,
4240 "no network A.B.C.D/M backdoor",
4242 "Specify a network to announce via BGP\n"
4243 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4244 "Specify a BGP backdoor route\n")
4246 ALIAS (no_bgp_network
,
4247 no_bgp_network_backdoor_ttl_cmd
,
4248 "no network A.B.C.D/M backdoor pathlimit <0-255>",
4250 "Specify a network to announce via BGP\n"
4251 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4252 "Specify a BGP backdoor route\n"
4253 "AS-Path hopcount limit attribute\n"
4254 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4256 DEFUN (no_bgp_network_mask
,
4257 no_bgp_network_mask_cmd
,
4258 "no network A.B.C.D mask A.B.C.D",
4260 "Specify a network to announce via BGP\n"
4266 char prefix_str
[BUFSIZ
];
4268 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4271 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4275 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
4276 bgp_node_safi (vty
));
4279 ALIAS (no_bgp_network
,
4280 no_bgp_network_mask_ttl_cmd
,
4281 "no network A.B.C.D mask A.B.C.D pathlimit <0-255>",
4283 "Specify a network to announce via BGP\n"
4287 "AS-Path hopcount limit attribute\n"
4288 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4290 ALIAS (no_bgp_network_mask
,
4291 no_bgp_network_mask_route_map_cmd
,
4292 "no network A.B.C.D mask A.B.C.D route-map WORD",
4294 "Specify a network to announce via BGP\n"
4298 "Route-map to modify the attributes\n"
4299 "Name of the route map\n")
4301 ALIAS (no_bgp_network_mask
,
4302 no_bgp_network_mask_backdoor_cmd
,
4303 "no network A.B.C.D mask A.B.C.D backdoor",
4305 "Specify a network to announce via BGP\n"
4309 "Specify a BGP backdoor route\n")
4311 ALIAS (no_bgp_network_mask
,
4312 no_bgp_network_mask_backdoor_ttl_cmd
,
4313 "no network A.B.C.D mask A.B.C.D backdoor pathlimit <0-255>",
4315 "Specify a network to announce via BGP\n"
4319 "Specify a BGP backdoor route\n"
4320 "AS-Path hopcount limit attribute\n"
4321 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4323 DEFUN (no_bgp_network_mask_natural
,
4324 no_bgp_network_mask_natural_cmd
,
4325 "no network A.B.C.D",
4327 "Specify a network to announce via BGP\n"
4331 char prefix_str
[BUFSIZ
];
4333 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4336 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4340 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
4341 bgp_node_safi (vty
));
4344 ALIAS (no_bgp_network_mask_natural
,
4345 no_bgp_network_mask_natural_route_map_cmd
,
4346 "no network A.B.C.D route-map WORD",
4348 "Specify a network to announce via BGP\n"
4350 "Route-map to modify the attributes\n"
4351 "Name of the route map\n")
4353 ALIAS (no_bgp_network_mask_natural
,
4354 no_bgp_network_mask_natural_backdoor_cmd
,
4355 "no network A.B.C.D backdoor",
4357 "Specify a network to announce via BGP\n"
4359 "Specify a BGP backdoor route\n")
4361 ALIAS (no_bgp_network_mask_natural
,
4362 no_bgp_network_mask_natural_ttl_cmd
,
4363 "no network A.B.C.D pathlimit <0-255>",
4365 "Specify a network to announce via BGP\n"
4367 "AS-Path hopcount limit attribute\n"
4368 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4370 ALIAS (no_bgp_network_mask_natural
,
4371 no_bgp_network_mask_natural_backdoor_ttl_cmd
,
4372 "no network A.B.C.D backdoor pathlimit <0-255>",
4374 "Specify a network to announce via BGP\n"
4376 "Specify a BGP backdoor route\n"
4377 "AS-Path hopcount limit attribute\n"
4378 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4381 DEFUN (ipv6_bgp_network
,
4382 ipv6_bgp_network_cmd
,
4383 "network X:X::X:X/M",
4384 "Specify a network to announce via BGP\n"
4385 "IPv6 prefix <network>/<length>\n")
4390 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[1], 1, 255);
4392 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
4396 ALIAS (ipv6_bgp_network
,
4397 ipv6_bgp_network_ttl_cmd
,
4398 "network X:X::X:X/M pathlimit <0-255>",
4399 "Specify a network to announce via BGP\n"
4400 "IPv6 prefix <network>/<length>\n"
4401 "AS-Path hopcount limit attribute\n"
4402 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4404 DEFUN (ipv6_bgp_network_route_map
,
4405 ipv6_bgp_network_route_map_cmd
,
4406 "network X:X::X:X/M route-map WORD",
4407 "Specify a network to announce via BGP\n"
4408 "IPv6 prefix <network>/<length>\n"
4409 "Route-map to modify the attributes\n"
4410 "Name of the route map\n")
4412 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
,
4413 bgp_node_safi (vty
), argv
[1], 0, 0);
4416 DEFUN (no_ipv6_bgp_network
,
4417 no_ipv6_bgp_network_cmd
,
4418 "no network X:X::X:X/M",
4420 "Specify a network to announce via BGP\n"
4421 "IPv6 prefix <network>/<length>\n")
4423 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
4426 ALIAS (no_ipv6_bgp_network
,
4427 no_ipv6_bgp_network_route_map_cmd
,
4428 "no network X:X::X:X/M route-map WORD",
4430 "Specify a network to announce via BGP\n"
4431 "IPv6 prefix <network>/<length>\n"
4432 "Route-map to modify the attributes\n"
4433 "Name of the route map\n")
4435 ALIAS (no_ipv6_bgp_network
,
4436 no_ipv6_bgp_network_ttl_cmd
,
4437 "no network X:X::X:X/M pathlimit <0-255>",
4439 "Specify a network to announce via BGP\n"
4440 "IPv6 prefix <network>/<length>\n"
4441 "AS-Path hopcount limit attribute\n"
4442 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4444 ALIAS (ipv6_bgp_network
,
4445 old_ipv6_bgp_network_cmd
,
4446 "ipv6 bgp network X:X::X:X/M",
4449 "Specify a network to announce via BGP\n"
4450 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
4452 ALIAS (no_ipv6_bgp_network
,
4453 old_no_ipv6_bgp_network_cmd
,
4454 "no ipv6 bgp network X:X::X:X/M",
4458 "Specify a network to announce via BGP\n"
4459 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
4460 #endif /* HAVE_IPV6 */
4462 /* Aggreagete address:
4464 advertise-map Set condition to advertise attribute
4465 as-set Generate AS set path information
4466 attribute-map Set attributes of aggregate
4467 route-map Set parameters of aggregate
4468 summary-only Filter more specific routes from updates
4469 suppress-map Conditionally filter more specific routes from updates
4472 struct bgp_aggregate
4474 /* Summary-only flag. */
4475 u_char summary_only
;
4477 /* AS set generation. */
4480 /* Route-map for aggregated route. */
4481 struct route_map
*map
;
4483 /* Suppress-count. */
4484 unsigned long count
;
4486 /* SAFI configuration. */
4490 static struct bgp_aggregate
*
4491 bgp_aggregate_new (void)
4493 return XCALLOC (MTYPE_BGP_AGGREGATE
, sizeof (struct bgp_aggregate
));
4497 bgp_aggregate_free (struct bgp_aggregate
*aggregate
)
4499 XFREE (MTYPE_BGP_AGGREGATE
, aggregate
);
4503 bgp_aggregate_route (struct bgp
*bgp
, struct prefix
*p
, struct bgp_info
*rinew
,
4504 afi_t afi
, safi_t safi
, struct bgp_info
*del
,
4505 struct bgp_aggregate
*aggregate
)
4507 struct bgp_table
*table
;
4508 struct bgp_node
*top
;
4509 struct bgp_node
*rn
;
4511 struct aspath
*aspath
= NULL
;
4512 struct aspath
*asmerge
= NULL
;
4513 struct community
*community
= NULL
;
4514 struct community
*commerge
= NULL
;
4515 struct in_addr nexthop
;
4517 struct bgp_info
*ri
;
4518 struct bgp_info
*new;
4520 unsigned long match
= 0;
4522 /* Record adding route's nexthop and med. */
4525 nexthop
= rinew
->attr
->nexthop
;
4526 med
= rinew
->attr
->med
;
4529 /* ORIGIN attribute: If at least one route among routes that are
4530 aggregated has ORIGIN with the value INCOMPLETE, then the
4531 aggregated route must have the ORIGIN attribute with the value
4532 INCOMPLETE. Otherwise, if at least one route among routes that
4533 are aggregated has ORIGIN with the value EGP, then the aggregated
4534 route must have the origin attribute with the value EGP. In all
4535 other case the value of the ORIGIN attribute of the aggregated
4536 route is INTERNAL. */
4537 origin
= BGP_ORIGIN_IGP
;
4539 table
= bgp
->rib
[afi
][safi
];
4541 top
= bgp_node_get (table
, p
);
4542 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4543 if (rn
->p
.prefixlen
> p
->prefixlen
)
4547 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4549 if (BGP_INFO_HOLDDOWN (ri
))
4552 if (del
&& ri
== del
)
4555 if (! rinew
&& first
)
4557 nexthop
= ri
->attr
->nexthop
;
4558 med
= ri
->attr
->med
;
4562 #ifdef AGGREGATE_NEXTHOP_CHECK
4563 if (! IPV4_ADDR_SAME (&ri
->attr
->nexthop
, &nexthop
)
4564 || ri
->attr
->med
!= med
)
4567 aspath_free (aspath
);
4569 community_free (community
);
4570 bgp_unlock_node (rn
);
4571 bgp_unlock_node (top
);
4574 #endif /* AGGREGATE_NEXTHOP_CHECK */
4576 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4578 if (aggregate
->summary_only
)
4580 (bgp_info_extra_get (ri
))->suppress
++;
4581 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
4587 if (aggregate
->as_set
)
4589 if (origin
< ri
->attr
->origin
)
4590 origin
= ri
->attr
->origin
;
4594 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4595 aspath_free (aspath
);
4599 aspath
= aspath_dup (ri
->attr
->aspath
);
4601 if (ri
->attr
->community
)
4605 commerge
= community_merge (community
,
4606 ri
->attr
->community
);
4607 community
= community_uniq_sort (commerge
);
4608 community_free (commerge
);
4611 community
= community_dup (ri
->attr
->community
);
4617 bgp_process (bgp
, rn
, afi
, safi
);
4619 bgp_unlock_node (top
);
4625 if (aggregate
->summary_only
)
4626 (bgp_info_extra_get (rinew
))->suppress
++;
4628 if (aggregate
->as_set
)
4630 if (origin
< rinew
->attr
->origin
)
4631 origin
= rinew
->attr
->origin
;
4635 asmerge
= aspath_aggregate (aspath
, rinew
->attr
->aspath
);
4636 aspath_free (aspath
);
4640 aspath
= aspath_dup (rinew
->attr
->aspath
);
4642 if (rinew
->attr
->community
)
4646 commerge
= community_merge (community
,
4647 rinew
->attr
->community
);
4648 community
= community_uniq_sort (commerge
);
4649 community_free (commerge
);
4652 community
= community_dup (rinew
->attr
->community
);
4657 if (aggregate
->count
> 0)
4659 rn
= bgp_node_get (table
, p
);
4660 new = bgp_info_new ();
4661 new->type
= ZEBRA_ROUTE_BGP
;
4662 new->sub_type
= BGP_ROUTE_AGGREGATE
;
4663 new->peer
= bgp
->peer_self
;
4664 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4665 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
4666 new->uptime
= time (NULL
);
4668 bgp_info_add (rn
, new);
4669 bgp_unlock_node (rn
);
4670 bgp_process (bgp
, rn
, afi
, safi
);
4675 aspath_free (aspath
);
4677 community_free (community
);
4681 void bgp_aggregate_delete (struct bgp
*, struct prefix
*, afi_t
, safi_t
,
4682 struct bgp_aggregate
*);
4685 bgp_aggregate_increment (struct bgp
*bgp
, struct prefix
*p
,
4686 struct bgp_info
*ri
, afi_t afi
, safi_t safi
)
4688 struct bgp_node
*child
;
4689 struct bgp_node
*rn
;
4690 struct bgp_aggregate
*aggregate
;
4692 /* MPLS-VPN aggregation is not yet supported. */
4693 if (safi
== SAFI_MPLS_VPN
)
4696 if (p
->prefixlen
== 0)
4699 if (BGP_INFO_HOLDDOWN (ri
))
4702 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
4704 /* Aggregate address configuration check. */
4705 for (rn
= child
; rn
; rn
= rn
->parent
)
4706 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
4708 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
4709 bgp_aggregate_route (bgp
, &rn
->p
, ri
, afi
, safi
, NULL
, aggregate
);
4711 bgp_unlock_node (child
);
4715 bgp_aggregate_decrement (struct bgp
*bgp
, struct prefix
*p
,
4716 struct bgp_info
*del
, afi_t afi
, safi_t safi
)
4718 struct bgp_node
*child
;
4719 struct bgp_node
*rn
;
4720 struct bgp_aggregate
*aggregate
;
4722 /* MPLS-VPN aggregation is not yet supported. */
4723 if (safi
== SAFI_MPLS_VPN
)
4726 if (p
->prefixlen
== 0)
4729 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
4731 /* Aggregate address configuration check. */
4732 for (rn
= child
; rn
; rn
= rn
->parent
)
4733 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
4735 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
4736 bgp_aggregate_route (bgp
, &rn
->p
, NULL
, afi
, safi
, del
, aggregate
);
4738 bgp_unlock_node (child
);
4742 bgp_aggregate_add (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
, safi_t safi
,
4743 struct bgp_aggregate
*aggregate
)
4745 struct bgp_table
*table
;
4746 struct bgp_node
*top
;
4747 struct bgp_node
*rn
;
4748 struct bgp_info
*new;
4749 struct bgp_info
*ri
;
4750 unsigned long match
;
4751 u_char origin
= BGP_ORIGIN_IGP
;
4752 struct aspath
*aspath
= NULL
;
4753 struct aspath
*asmerge
= NULL
;
4754 struct community
*community
= NULL
;
4755 struct community
*commerge
= NULL
;
4757 table
= bgp
->rib
[afi
][safi
];
4760 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
4762 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
4765 /* If routes exists below this node, generate aggregate routes. */
4766 top
= bgp_node_get (table
, p
);
4767 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4768 if (rn
->p
.prefixlen
> p
->prefixlen
)
4772 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4774 if (BGP_INFO_HOLDDOWN (ri
))
4777 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4779 /* summary-only aggregate route suppress aggregated
4780 route announcement. */
4781 if (aggregate
->summary_only
)
4783 (bgp_info_extra_get (ri
))->suppress
++;
4784 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
4787 /* as-set aggregate route generate origin, as path,
4788 community aggregation. */
4789 if (aggregate
->as_set
)
4791 if (origin
< ri
->attr
->origin
)
4792 origin
= ri
->attr
->origin
;
4796 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4797 aspath_free (aspath
);
4801 aspath
= aspath_dup (ri
->attr
->aspath
);
4803 if (ri
->attr
->community
)
4807 commerge
= community_merge (community
,
4808 ri
->attr
->community
);
4809 community
= community_uniq_sort (commerge
);
4810 community_free (commerge
);
4813 community
= community_dup (ri
->attr
->community
);
4820 /* If this node is suppressed, process the change. */
4822 bgp_process (bgp
, rn
, afi
, safi
);
4824 bgp_unlock_node (top
);
4826 /* Add aggregate route to BGP table. */
4827 if (aggregate
->count
)
4829 rn
= bgp_node_get (table
, p
);
4831 new = bgp_info_new ();
4832 new->type
= ZEBRA_ROUTE_BGP
;
4833 new->sub_type
= BGP_ROUTE_AGGREGATE
;
4834 new->peer
= bgp
->peer_self
;
4835 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4836 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
4837 new->uptime
= time (NULL
);
4839 bgp_info_add (rn
, new);
4840 bgp_unlock_node (rn
);
4842 /* Process change. */
4843 bgp_process (bgp
, rn
, afi
, safi
);
4848 bgp_aggregate_delete (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
4849 safi_t safi
, struct bgp_aggregate
*aggregate
)
4851 struct bgp_table
*table
;
4852 struct bgp_node
*top
;
4853 struct bgp_node
*rn
;
4854 struct bgp_info
*ri
;
4855 unsigned long match
;
4857 table
= bgp
->rib
[afi
][safi
];
4859 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
4861 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
4864 /* If routes exists below this node, generate aggregate routes. */
4865 top
= bgp_node_get (table
, p
);
4866 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4867 if (rn
->p
.prefixlen
> p
->prefixlen
)
4871 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4873 if (BGP_INFO_HOLDDOWN (ri
))
4876 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4878 if (aggregate
->summary_only
&& ri
->extra
)
4880 ri
->extra
->suppress
--;
4882 if (ri
->extra
->suppress
== 0)
4884 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
4892 /* If this node was suppressed, process the change. */
4894 bgp_process (bgp
, rn
, afi
, safi
);
4896 bgp_unlock_node (top
);
4898 /* Delete aggregate route from BGP table. */
4899 rn
= bgp_node_get (table
, p
);
4901 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4902 if (ri
->peer
== bgp
->peer_self
4903 && ri
->type
== ZEBRA_ROUTE_BGP
4904 && ri
->sub_type
== BGP_ROUTE_AGGREGATE
)
4907 /* Withdraw static BGP route from routing table. */
4910 bgp_info_delete (rn
, ri
);
4911 bgp_process (bgp
, rn
, afi
, safi
);
4914 /* Unlock bgp_node_lookup. */
4915 bgp_unlock_node (rn
);
4918 /* Aggregate route attribute. */
4919 #define AGGREGATE_SUMMARY_ONLY 1
4920 #define AGGREGATE_AS_SET 1
4923 bgp_aggregate_set (struct vty
*vty
, const char *prefix_str
,
4924 afi_t afi
, safi_t safi
,
4925 u_char summary_only
, u_char as_set
)
4929 struct bgp_node
*rn
;
4931 struct bgp_aggregate
*aggregate
;
4933 /* Convert string to prefix structure. */
4934 ret
= str2prefix (prefix_str
, &p
);
4937 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
4942 /* Get BGP structure. */
4945 /* Old configuration check. */
4946 rn
= bgp_node_get (bgp
->aggregate
[afi
][safi
], &p
);
4950 vty_out (vty
, "There is already same aggregate network.%s", VTY_NEWLINE
);
4951 bgp_unlock_node (rn
);
4955 /* Make aggregate address structure. */
4956 aggregate
= bgp_aggregate_new ();
4957 aggregate
->summary_only
= summary_only
;
4958 aggregate
->as_set
= as_set
;
4959 aggregate
->safi
= safi
;
4960 rn
->info
= aggregate
;
4962 /* Aggregate address insert into BGP routing table. */
4963 if (safi
& SAFI_UNICAST
)
4964 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
4965 if (safi
& SAFI_MULTICAST
)
4966 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
4972 bgp_aggregate_unset (struct vty
*vty
, const char *prefix_str
,
4973 afi_t afi
, safi_t safi
)
4977 struct bgp_node
*rn
;
4979 struct bgp_aggregate
*aggregate
;
4981 /* Convert string to prefix structure. */
4982 ret
= str2prefix (prefix_str
, &p
);
4985 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
4990 /* Get BGP structure. */
4993 /* Old configuration check. */
4994 rn
= bgp_node_lookup (bgp
->aggregate
[afi
][safi
], &p
);
4997 vty_out (vty
, "%% There is no aggregate-address configuration.%s",
5002 aggregate
= rn
->info
;
5003 if (aggregate
->safi
& SAFI_UNICAST
)
5004 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
5005 if (aggregate
->safi
& SAFI_MULTICAST
)
5006 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
5008 /* Unlock aggregate address configuration. */
5010 bgp_aggregate_free (aggregate
);
5011 bgp_unlock_node (rn
);
5012 bgp_unlock_node (rn
);
5017 DEFUN (aggregate_address
,
5018 aggregate_address_cmd
,
5019 "aggregate-address A.B.C.D/M",
5020 "Configure BGP aggregate entries\n"
5021 "Aggregate prefix\n")
5023 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
), 0, 0);
5026 DEFUN (aggregate_address_mask
,
5027 aggregate_address_mask_cmd
,
5028 "aggregate-address A.B.C.D A.B.C.D",
5029 "Configure BGP aggregate entries\n"
5030 "Aggregate address\n"
5034 char prefix_str
[BUFSIZ
];
5036 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5040 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5044 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5048 DEFUN (aggregate_address_summary_only
,
5049 aggregate_address_summary_only_cmd
,
5050 "aggregate-address A.B.C.D/M summary-only",
5051 "Configure BGP aggregate entries\n"
5052 "Aggregate prefix\n"
5053 "Filter more specific routes from updates\n")
5055 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5056 AGGREGATE_SUMMARY_ONLY
, 0);
5059 DEFUN (aggregate_address_mask_summary_only
,
5060 aggregate_address_mask_summary_only_cmd
,
5061 "aggregate-address A.B.C.D A.B.C.D summary-only",
5062 "Configure BGP aggregate entries\n"
5063 "Aggregate address\n"
5065 "Filter more specific routes from updates\n")
5068 char prefix_str
[BUFSIZ
];
5070 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5074 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5078 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5079 AGGREGATE_SUMMARY_ONLY
, 0);
5082 DEFUN (aggregate_address_as_set
,
5083 aggregate_address_as_set_cmd
,
5084 "aggregate-address A.B.C.D/M as-set",
5085 "Configure BGP aggregate entries\n"
5086 "Aggregate prefix\n"
5087 "Generate AS set path information\n")
5089 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5090 0, AGGREGATE_AS_SET
);
5093 DEFUN (aggregate_address_mask_as_set
,
5094 aggregate_address_mask_as_set_cmd
,
5095 "aggregate-address A.B.C.D A.B.C.D as-set",
5096 "Configure BGP aggregate entries\n"
5097 "Aggregate address\n"
5099 "Generate AS set path information\n")
5102 char prefix_str
[BUFSIZ
];
5104 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5108 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5112 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5113 0, AGGREGATE_AS_SET
);
5117 DEFUN (aggregate_address_as_set_summary
,
5118 aggregate_address_as_set_summary_cmd
,
5119 "aggregate-address A.B.C.D/M as-set summary-only",
5120 "Configure BGP aggregate entries\n"
5121 "Aggregate prefix\n"
5122 "Generate AS set path information\n"
5123 "Filter more specific routes from updates\n")
5125 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5126 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
5129 ALIAS (aggregate_address_as_set_summary
,
5130 aggregate_address_summary_as_set_cmd
,
5131 "aggregate-address A.B.C.D/M summary-only as-set",
5132 "Configure BGP aggregate entries\n"
5133 "Aggregate prefix\n"
5134 "Filter more specific routes from updates\n"
5135 "Generate AS set path information\n")
5137 DEFUN (aggregate_address_mask_as_set_summary
,
5138 aggregate_address_mask_as_set_summary_cmd
,
5139 "aggregate-address A.B.C.D A.B.C.D as-set summary-only",
5140 "Configure BGP aggregate entries\n"
5141 "Aggregate address\n"
5143 "Generate AS set path information\n"
5144 "Filter more specific routes from updates\n")
5147 char prefix_str
[BUFSIZ
];
5149 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5153 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5157 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5158 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
5161 ALIAS (aggregate_address_mask_as_set_summary
,
5162 aggregate_address_mask_summary_as_set_cmd
,
5163 "aggregate-address A.B.C.D A.B.C.D summary-only as-set",
5164 "Configure BGP aggregate entries\n"
5165 "Aggregate address\n"
5167 "Filter more specific routes from updates\n"
5168 "Generate AS set path information\n")
5170 DEFUN (no_aggregate_address
,
5171 no_aggregate_address_cmd
,
5172 "no aggregate-address A.B.C.D/M",
5174 "Configure BGP aggregate entries\n"
5175 "Aggregate prefix\n")
5177 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
));
5180 ALIAS (no_aggregate_address
,
5181 no_aggregate_address_summary_only_cmd
,
5182 "no aggregate-address A.B.C.D/M summary-only",
5184 "Configure BGP aggregate entries\n"
5185 "Aggregate prefix\n"
5186 "Filter more specific routes from updates\n")
5188 ALIAS (no_aggregate_address
,
5189 no_aggregate_address_as_set_cmd
,
5190 "no aggregate-address A.B.C.D/M as-set",
5192 "Configure BGP aggregate entries\n"
5193 "Aggregate prefix\n"
5194 "Generate AS set path information\n")
5196 ALIAS (no_aggregate_address
,
5197 no_aggregate_address_as_set_summary_cmd
,
5198 "no aggregate-address A.B.C.D/M as-set summary-only",
5200 "Configure BGP aggregate entries\n"
5201 "Aggregate prefix\n"
5202 "Generate AS set path information\n"
5203 "Filter more specific routes from updates\n")
5205 ALIAS (no_aggregate_address
,
5206 no_aggregate_address_summary_as_set_cmd
,
5207 "no aggregate-address A.B.C.D/M summary-only as-set",
5209 "Configure BGP aggregate entries\n"
5210 "Aggregate prefix\n"
5211 "Filter more specific routes from updates\n"
5212 "Generate AS set path information\n")
5214 DEFUN (no_aggregate_address_mask
,
5215 no_aggregate_address_mask_cmd
,
5216 "no aggregate-address A.B.C.D A.B.C.D",
5218 "Configure BGP aggregate entries\n"
5219 "Aggregate address\n"
5223 char prefix_str
[BUFSIZ
];
5225 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5229 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5233 return bgp_aggregate_unset (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
));
5236 ALIAS (no_aggregate_address_mask
,
5237 no_aggregate_address_mask_summary_only_cmd
,
5238 "no aggregate-address A.B.C.D A.B.C.D summary-only",
5240 "Configure BGP aggregate entries\n"
5241 "Aggregate address\n"
5243 "Filter more specific routes from updates\n")
5245 ALIAS (no_aggregate_address_mask
,
5246 no_aggregate_address_mask_as_set_cmd
,
5247 "no aggregate-address A.B.C.D A.B.C.D as-set",
5249 "Configure BGP aggregate entries\n"
5250 "Aggregate address\n"
5252 "Generate AS set path information\n")
5254 ALIAS (no_aggregate_address_mask
,
5255 no_aggregate_address_mask_as_set_summary_cmd
,
5256 "no aggregate-address A.B.C.D A.B.C.D as-set summary-only",
5258 "Configure BGP aggregate entries\n"
5259 "Aggregate address\n"
5261 "Generate AS set path information\n"
5262 "Filter more specific routes from updates\n")
5264 ALIAS (no_aggregate_address_mask
,
5265 no_aggregate_address_mask_summary_as_set_cmd
,
5266 "no aggregate-address A.B.C.D A.B.C.D summary-only as-set",
5268 "Configure BGP aggregate entries\n"
5269 "Aggregate address\n"
5271 "Filter more specific routes from updates\n"
5272 "Generate AS set path information\n")
5275 DEFUN (ipv6_aggregate_address
,
5276 ipv6_aggregate_address_cmd
,
5277 "aggregate-address X:X::X:X/M",
5278 "Configure BGP aggregate entries\n"
5279 "Aggregate prefix\n")
5281 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0, 0);
5284 DEFUN (ipv6_aggregate_address_summary_only
,
5285 ipv6_aggregate_address_summary_only_cmd
,
5286 "aggregate-address X:X::X:X/M summary-only",
5287 "Configure BGP aggregate entries\n"
5288 "Aggregate prefix\n"
5289 "Filter more specific routes from updates\n")
5291 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5292 AGGREGATE_SUMMARY_ONLY
, 0);
5295 DEFUN (no_ipv6_aggregate_address
,
5296 no_ipv6_aggregate_address_cmd
,
5297 "no aggregate-address X:X::X:X/M",
5299 "Configure BGP aggregate entries\n"
5300 "Aggregate prefix\n")
5302 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
5305 DEFUN (no_ipv6_aggregate_address_summary_only
,
5306 no_ipv6_aggregate_address_summary_only_cmd
,
5307 "no aggregate-address X:X::X:X/M summary-only",
5309 "Configure BGP aggregate entries\n"
5310 "Aggregate prefix\n"
5311 "Filter more specific routes from updates\n")
5313 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
5316 ALIAS (ipv6_aggregate_address
,
5317 old_ipv6_aggregate_address_cmd
,
5318 "ipv6 bgp aggregate-address X:X::X:X/M",
5321 "Configure BGP aggregate entries\n"
5322 "Aggregate prefix\n")
5324 ALIAS (ipv6_aggregate_address_summary_only
,
5325 old_ipv6_aggregate_address_summary_only_cmd
,
5326 "ipv6 bgp aggregate-address X:X::X:X/M summary-only",
5329 "Configure BGP aggregate entries\n"
5330 "Aggregate prefix\n"
5331 "Filter more specific routes from updates\n")
5333 ALIAS (no_ipv6_aggregate_address
,
5334 old_no_ipv6_aggregate_address_cmd
,
5335 "no ipv6 bgp aggregate-address X:X::X:X/M",
5339 "Configure BGP aggregate entries\n"
5340 "Aggregate prefix\n")
5342 ALIAS (no_ipv6_aggregate_address_summary_only
,
5343 old_no_ipv6_aggregate_address_summary_only_cmd
,
5344 "no ipv6 bgp aggregate-address X:X::X:X/M summary-only",
5348 "Configure BGP aggregate entries\n"
5349 "Aggregate prefix\n"
5350 "Filter more specific routes from updates\n")
5351 #endif /* HAVE_IPV6 */
5353 /* Redistribute route treatment. */
5355 bgp_redistribute_add (struct prefix
*p
, struct in_addr
*nexthop
,
5356 u_int32_t metric
, u_char type
)
5359 struct listnode
*node
, *nnode
;
5360 struct bgp_info
*new;
5361 struct bgp_info
*bi
;
5362 struct bgp_info info
;
5363 struct bgp_node
*bn
;
5364 struct attr attr
= { 0 };
5365 struct attr attr_new
= { 0 };
5366 struct attr
*new_attr
;
5370 /* Make default attribute. */
5371 bgp_attr_default_set (&attr
, BGP_ORIGIN_INCOMPLETE
);
5373 attr
.nexthop
= *nexthop
;
5376 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
5378 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
5380 afi
= family2afi (p
->family
);
5382 if (bgp
->redist
[afi
][type
])
5384 /* Copy attribute for modification. */
5385 bgp_attr_dup (&attr_new
, &attr
);
5387 if (bgp
->redist_metric_flag
[afi
][type
])
5388 attr_new
.med
= bgp
->redist_metric
[afi
][type
];
5390 /* Apply route-map. */
5391 if (bgp
->rmap
[afi
][type
].map
)
5393 info
.peer
= bgp
->peer_self
;
5394 info
.attr
= &attr_new
;
5396 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_REDISTRIBUTE
);
5398 ret
= route_map_apply (bgp
->rmap
[afi
][type
].map
, p
, RMAP_BGP
,
5401 bgp
->peer_self
->rmap_type
= 0;
5403 if (ret
== RMAP_DENYMATCH
)
5405 /* Free uninterned attribute. */
5406 bgp_attr_flush (&attr_new
);
5407 bgp_attr_extra_free (&attr_new
);
5409 /* Unintern original. */
5410 aspath_unintern (attr
.aspath
);
5411 bgp_attr_extra_free (&attr
);
5412 bgp_redistribute_delete (p
, type
);
5417 bn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
],
5418 afi
, SAFI_UNICAST
, p
, NULL
);
5420 new_attr
= bgp_attr_intern (&attr_new
);
5421 bgp_attr_extra_free (&attr_new
);
5423 for (bi
= bn
->info
; bi
; bi
= bi
->next
)
5424 if (bi
->peer
== bgp
->peer_self
5425 && bi
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
5430 if (attrhash_cmp (bi
->attr
, new_attr
) &&
5431 !CHECK_FLAG(bi
->flags
, BGP_INFO_REMOVED
))
5433 bgp_attr_unintern (new_attr
);
5434 aspath_unintern (attr
.aspath
);
5435 bgp_attr_extra_free (&attr
);
5436 bgp_unlock_node (bn
);
5441 /* The attribute is changed. */
5442 bgp_info_set_flag (bn
, bi
, BGP_INFO_ATTR_CHANGED
);
5444 /* Rewrite BGP route information. */
5445 if (CHECK_FLAG(bi
->flags
, BGP_INFO_REMOVED
))
5446 bgp_info_restore(bn
, bi
);
5448 bgp_aggregate_decrement (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
5449 bgp_attr_unintern (bi
->attr
);
5450 bi
->attr
= new_attr
;
5451 bi
->uptime
= time (NULL
);
5453 /* Process change. */
5454 bgp_aggregate_increment (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
5455 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
5456 bgp_unlock_node (bn
);
5457 aspath_unintern (attr
.aspath
);
5458 bgp_attr_extra_free (&attr
);
5463 new = bgp_info_new ();
5465 new->sub_type
= BGP_ROUTE_REDISTRIBUTE
;
5466 new->peer
= bgp
->peer_self
;
5467 SET_FLAG (new->flags
, BGP_INFO_VALID
);
5468 new->attr
= new_attr
;
5469 new->uptime
= time (NULL
);
5471 bgp_aggregate_increment (bgp
, p
, new, afi
, SAFI_UNICAST
);
5472 bgp_info_add (bn
, new);
5473 bgp_unlock_node (bn
);
5474 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
5478 /* Unintern original. */
5479 aspath_unintern (attr
.aspath
);
5480 bgp_attr_extra_free (&attr
);
5484 bgp_redistribute_delete (struct prefix
*p
, u_char type
)
5487 struct listnode
*node
, *nnode
;
5489 struct bgp_node
*rn
;
5490 struct bgp_info
*ri
;
5492 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
5494 afi
= family2afi (p
->family
);
5496 if (bgp
->redist
[afi
][type
])
5498 rn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
], afi
, SAFI_UNICAST
, p
, NULL
);
5500 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5501 if (ri
->peer
== bgp
->peer_self
5502 && ri
->type
== type
)
5507 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, SAFI_UNICAST
);
5508 bgp_info_delete (rn
, ri
);
5509 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
5511 bgp_unlock_node (rn
);
5516 /* Withdraw specified route type's route. */
5518 bgp_redistribute_withdraw (struct bgp
*bgp
, afi_t afi
, int type
)
5520 struct bgp_node
*rn
;
5521 struct bgp_info
*ri
;
5522 struct bgp_table
*table
;
5524 table
= bgp
->rib
[afi
][SAFI_UNICAST
];
5526 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
5528 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5529 if (ri
->peer
== bgp
->peer_self
5530 && ri
->type
== type
)
5535 bgp_aggregate_decrement (bgp
, &rn
->p
, ri
, afi
, SAFI_UNICAST
);
5536 bgp_info_delete (rn
, ri
);
5537 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
5542 /* Static function to display route. */
5544 route_vty_out_route (struct prefix
*p
, struct vty
*vty
)
5547 u_int32_t destination
;
5550 if (p
->family
== AF_INET
)
5552 len
= vty_out (vty
, "%s", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
));
5553 destination
= ntohl (p
->u
.prefix4
.s_addr
);
5555 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
5556 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
5557 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
5558 || p
->u
.prefix4
.s_addr
== 0)
5560 /* When mask is natural, mask is not displayed. */
5563 len
+= vty_out (vty
, "/%d", p
->prefixlen
);
5566 len
= vty_out (vty
, "%s/%d", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
),
5571 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 20, " ");
5573 vty_out (vty
, "%*s", len
, " ");
5576 enum bgp_display_type
5581 /* Print the short form route status for a bgp_info */
5583 route_vty_short_status_out (struct vty
*vty
, struct bgp_info
*binfo
)
5585 /* Route status display. */
5586 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
5588 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
5590 else if (binfo
->extra
&& binfo
->extra
->suppress
)
5592 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5598 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5600 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5602 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
5607 /* Internal route. */
5608 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
5614 /* called from terminal list command */
5616 route_vty_out (struct vty
*vty
, struct prefix
*p
,
5617 struct bgp_info
*binfo
, int display
, safi_t safi
)
5621 /* short status lead text */
5622 route_vty_short_status_out (vty
, binfo
);
5624 /* print prefix and mask */
5626 route_vty_out_route (p
, vty
);
5628 vty_out (vty
, "%*s", 17, " ");
5630 /* Print attribute */
5634 if (p
->family
== AF_INET
)
5636 if (safi
== SAFI_MPLS_VPN
)
5637 vty_out (vty
, "%-16s",
5638 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
5640 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5643 else if (p
->family
== AF_INET6
)
5648 len
= vty_out (vty
, "%s",
5649 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5653 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
5655 vty_out (vty
, "%*s", len
, " ");
5657 #endif /* HAVE_IPV6 */
5659 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
5660 vty_out (vty
, "%10d", attr
->med
);
5664 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
5665 vty_out (vty
, "%7d", attr
->local_pref
);
5669 vty_out (vty
, "%7u ", (attr
->extra
? attr
->extra
->weight
: 0));
5673 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
5676 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5678 vty_out (vty
, "%s", VTY_NEWLINE
);
5681 /* called from terminal list command */
5683 route_vty_out_tmp (struct vty
*vty
, struct prefix
*p
,
5684 struct attr
*attr
, safi_t safi
)
5686 /* Route status display. */
5691 /* print prefix and mask */
5692 route_vty_out_route (p
, vty
);
5694 /* Print attribute */
5697 if (p
->family
== AF_INET
)
5699 if (safi
== SAFI_MPLS_VPN
)
5700 vty_out (vty
, "%-16s",
5701 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
5703 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5706 else if (p
->family
== AF_INET6
)
5711 assert (attr
->extra
);
5713 len
= vty_out (vty
, "%s",
5714 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5718 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
5720 vty_out (vty
, "%*s", len
, " ");
5722 #endif /* HAVE_IPV6 */
5724 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
5725 vty_out (vty
, "%10d", attr
->med
);
5729 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
5730 vty_out (vty
, "%7d", attr
->local_pref
);
5734 vty_out (vty
, "%7d ", (attr
->extra
? attr
->extra
->weight
: 0));
5738 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
5741 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5744 vty_out (vty
, "%s", VTY_NEWLINE
);
5748 route_vty_out_tag (struct vty
*vty
, struct prefix
*p
,
5749 struct bgp_info
*binfo
, int display
, safi_t safi
)
5752 u_int32_t label
= 0;
5757 /* short status lead text */
5758 route_vty_short_status_out (vty
, binfo
);
5760 /* print prefix and mask */
5762 route_vty_out_route (p
, vty
);
5764 vty_out (vty
, "%*s", 17, " ");
5766 /* Print attribute */
5770 if (p
->family
== AF_INET
)
5772 if (safi
== SAFI_MPLS_VPN
)
5773 vty_out (vty
, "%-16s",
5774 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
5776 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5779 else if (p
->family
== AF_INET6
)
5781 assert (attr
->extra
);
5784 if (attr
->extra
->mp_nexthop_len
== 16)
5786 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5788 else if (attr
->extra
->mp_nexthop_len
== 32)
5789 vty_out (vty
, "%s(%s)",
5790 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5792 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_local
,
5796 #endif /* HAVE_IPV6 */
5799 label
= decode_label (binfo
->extra
->tag
);
5801 vty_out (vty
, "notag/%d", label
);
5803 vty_out (vty
, "%s", VTY_NEWLINE
);
5806 /* dampening route */
5808 damp_route_vty_out (struct vty
*vty
, struct prefix
*p
,
5809 struct bgp_info
*binfo
, int display
, safi_t safi
)
5813 char timebuf
[BGP_UPTIME_LEN
];
5815 /* short status lead text */
5816 route_vty_short_status_out (vty
, binfo
);
5818 /* print prefix and mask */
5820 route_vty_out_route (p
, vty
);
5822 vty_out (vty
, "%*s", 17, " ");
5824 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
5827 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 34, " ");
5829 vty_out (vty
, "%*s", len
, " ");
5831 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
, timebuf
, BGP_UPTIME_LEN
));
5833 /* Print attribute */
5839 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
5842 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5844 vty_out (vty
, "%s", VTY_NEWLINE
);
5849 flap_route_vty_out (struct vty
*vty
, struct prefix
*p
,
5850 struct bgp_info
*binfo
, int display
, safi_t safi
)
5853 struct bgp_damp_info
*bdi
;
5854 char timebuf
[BGP_UPTIME_LEN
];
5860 bdi
= binfo
->extra
->damp_info
;
5862 /* short status lead text */
5863 route_vty_short_status_out (vty
, binfo
);
5865 /* print prefix and mask */
5867 route_vty_out_route (p
, vty
);
5869 vty_out (vty
, "%*s", 17, " ");
5871 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
5874 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 33, " ");
5876 vty_out (vty
, "%*s", len
, " ");
5878 len
= vty_out (vty
, "%d", bdi
->flap
);
5883 vty_out (vty
, "%*s ", len
, " ");
5885 vty_out (vty
, "%s ", peer_uptime (bdi
->start_time
,
5886 timebuf
, BGP_UPTIME_LEN
));
5888 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
)
5889 && ! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5890 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
, timebuf
, BGP_UPTIME_LEN
));
5892 vty_out (vty
, "%*s ", 8, " ");
5894 /* Print attribute */
5900 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
5903 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5905 vty_out (vty
, "%s", VTY_NEWLINE
);
5909 route_vty_out_detail (struct vty
*vty
, struct bgp
*bgp
, struct prefix
*p
,
5910 struct bgp_info
*binfo
, afi_t afi
, safi_t safi
)
5912 char buf
[INET6_ADDRSTRLEN
];
5915 int sockunion_vty_out (struct vty
*, union sockunion
*);
5921 /* Line1 display AS-path, Aggregator */
5925 if (aspath_count_hops (attr
->aspath
) == 0)
5926 vty_out (vty
, "Local");
5928 aspath_print_vty (vty
, "%s", attr
->aspath
, "");
5931 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
5932 vty_out (vty
, ", (removed)");
5933 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
5934 vty_out (vty
, ", (stale)");
5935 if (CHECK_FLAG (attr
->flag
, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR
)))
5936 vty_out (vty
, ", (aggregated by %u %s)",
5937 attr
->extra
->aggregator_as
,
5938 inet_ntoa (attr
->extra
->aggregator_addr
));
5939 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
5940 vty_out (vty
, ", (Received from a RR-client)");
5941 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
5942 vty_out (vty
, ", (Received from a RS-client)");
5943 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5944 vty_out (vty
, ", (history entry)");
5945 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5946 vty_out (vty
, ", (suppressed due to dampening)");
5947 vty_out (vty
, "%s", VTY_NEWLINE
);
5949 /* Line2 display Next-hop, Neighbor, Router-id */
5950 if (p
->family
== AF_INET
)
5952 vty_out (vty
, " %s", safi
== SAFI_MPLS_VPN
?
5953 inet_ntoa (attr
->extra
->mp_nexthop_global_in
) :
5954 inet_ntoa (attr
->nexthop
));
5959 assert (attr
->extra
);
5960 vty_out (vty
, " %s",
5961 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5962 buf
, INET6_ADDRSTRLEN
));
5964 #endif /* HAVE_IPV6 */
5966 if (binfo
->peer
== bgp
->peer_self
)
5968 vty_out (vty
, " from %s ",
5969 p
->family
== AF_INET
? "0.0.0.0" : "::");
5970 vty_out (vty
, "(%s)", inet_ntoa(bgp
->router_id
));
5974 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_VALID
))
5975 vty_out (vty
, " (inaccessible)");
5976 else if (binfo
->extra
&& binfo
->extra
->igpmetric
)
5977 vty_out (vty
, " (metric %d)", binfo
->extra
->igpmetric
);
5978 vty_out (vty
, " from %s", sockunion2str (&binfo
->peer
->su
, buf
, SU_ADDRSTRLEN
));
5979 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
5980 vty_out (vty
, " (%s)", inet_ntoa (attr
->extra
->originator_id
));
5982 vty_out (vty
, " (%s)", inet_ntop (AF_INET
, &binfo
->peer
->remote_id
, buf1
, BUFSIZ
));
5984 vty_out (vty
, "%s", VTY_NEWLINE
);
5987 /* display nexthop local */
5988 if (attr
->extra
&& attr
->extra
->mp_nexthop_len
== 32)
5990 vty_out (vty
, " (%s)%s",
5991 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_local
,
5992 buf
, INET6_ADDRSTRLEN
),
5995 #endif /* HAVE_IPV6 */
5997 /* Line 3 display Origin, Med, Locpref, Weight, valid, Int/Ext/Local, Atomic, best */
5998 vty_out (vty
, " Origin %s", bgp_origin_long_str
[attr
->origin
]);
6000 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
))
6001 vty_out (vty
, ", metric %d", attr
->med
);
6003 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
))
6004 vty_out (vty
, ", localpref %d", attr
->local_pref
);
6006 vty_out (vty
, ", localpref %d", bgp
->default_local_pref
);
6008 if (attr
->extra
&& attr
->extra
->weight
!= 0)
6009 vty_out (vty
, ", weight %d", attr
->extra
->weight
);
6011 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6012 vty_out (vty
, ", valid");
6014 if (binfo
->peer
!= bgp
->peer_self
)
6016 if (binfo
->peer
->as
== binfo
->peer
->local_as
)
6017 vty_out (vty
, ", internal");
6019 vty_out (vty
, ", %s",
6020 (bgp_confederation_peers_check(bgp
, binfo
->peer
->as
) ? "confed-external" : "external"));
6022 else if (binfo
->sub_type
== BGP_ROUTE_AGGREGATE
)
6023 vty_out (vty
, ", aggregated, local");
6024 else if (binfo
->type
!= ZEBRA_ROUTE_BGP
)
6025 vty_out (vty
, ", sourced");
6027 vty_out (vty
, ", sourced, local");
6029 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
6030 vty_out (vty
, ", atomic-aggregate");
6032 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
6033 vty_out (vty
, ", best");
6035 vty_out (vty
, "%s", VTY_NEWLINE
);
6037 /* Line 4 display Community */
6038 if (attr
->community
)
6039 vty_out (vty
, " Community: %s%s", attr
->community
->str
,
6042 /* Line 5 display Extended-community */
6043 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
))
6044 vty_out (vty
, " Extended Community: %s%s",
6045 attr
->extra
->ecommunity
->str
, VTY_NEWLINE
);
6047 /* Line 6 display Originator, Cluster-id */
6048 if ((attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)) ||
6049 (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
)))
6051 assert (attr
->extra
);
6052 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
6053 vty_out (vty
, " Originator: %s",
6054 inet_ntoa (attr
->extra
->originator_id
));
6056 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
6059 vty_out (vty
, ", Cluster list: ");
6060 for (i
= 0; i
< attr
->extra
->cluster
->length
/ 4; i
++)
6061 vty_out (vty
, "%s ",
6062 inet_ntoa (attr
->extra
->cluster
->list
[i
]));
6064 vty_out (vty
, "%s", VTY_NEWLINE
);
6067 /* 7: AS Pathlimit */
6068 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_AS_PATHLIMIT
))
6071 vty_out (vty
, " AS-Pathlimit: %u",
6072 attr
->pathlimit
.ttl
);
6073 if (attr
->pathlimit
.as
)
6074 vty_out (vty
, " (%u)", attr
->pathlimit
.as
);
6075 vty_out (vty
, "%s", VTY_NEWLINE
);
6078 if (binfo
->extra
&& binfo
->extra
->damp_info
)
6079 bgp_damp_info_vty (vty
, binfo
);
6081 /* Line 7 display Uptime */
6082 vty_out (vty
, " Last update: %s", ctime (&binfo
->uptime
));
6084 vty_out (vty
, "%s", VTY_NEWLINE
);
6087 #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s r RIB-failure, S Stale, R Removed%s"
6088 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s"
6089 #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s"
6090 #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s"
6091 #define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path%s"
6095 bgp_show_type_normal
,
6096 bgp_show_type_regexp
,
6097 bgp_show_type_prefix_list
,
6098 bgp_show_type_filter_list
,
6099 bgp_show_type_route_map
,
6100 bgp_show_type_neighbor
,
6101 bgp_show_type_cidr_only
,
6102 bgp_show_type_prefix_longer
,
6103 bgp_show_type_community_all
,
6104 bgp_show_type_community
,
6105 bgp_show_type_community_exact
,
6106 bgp_show_type_community_list
,
6107 bgp_show_type_community_list_exact
,
6108 bgp_show_type_flap_statistics
,
6109 bgp_show_type_flap_address
,
6110 bgp_show_type_flap_prefix
,
6111 bgp_show_type_flap_cidr_only
,
6112 bgp_show_type_flap_regexp
,
6113 bgp_show_type_flap_filter_list
,
6114 bgp_show_type_flap_prefix_list
,
6115 bgp_show_type_flap_prefix_longer
,
6116 bgp_show_type_flap_route_map
,
6117 bgp_show_type_flap_neighbor
,
6118 bgp_show_type_dampend_paths
,
6119 bgp_show_type_damp_neighbor
6123 bgp_show_table (struct vty
*vty
, struct bgp_table
*table
, struct in_addr
*router_id
,
6124 enum bgp_show_type type
, void *output_arg
)
6126 struct bgp_info
*ri
;
6127 struct bgp_node
*rn
;
6130 unsigned long output_count
;
6132 /* This is first entry point, so reset total line. */
6135 /* Start processing of routes. */
6136 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
6137 if (rn
->info
!= NULL
)
6141 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6143 if (type
== bgp_show_type_flap_statistics
6144 || type
== bgp_show_type_flap_address
6145 || type
== bgp_show_type_flap_prefix
6146 || type
== bgp_show_type_flap_cidr_only
6147 || type
== bgp_show_type_flap_regexp
6148 || type
== bgp_show_type_flap_filter_list
6149 || type
== bgp_show_type_flap_prefix_list
6150 || type
== bgp_show_type_flap_prefix_longer
6151 || type
== bgp_show_type_flap_route_map
6152 || type
== bgp_show_type_flap_neighbor
6153 || type
== bgp_show_type_dampend_paths
6154 || type
== bgp_show_type_damp_neighbor
)
6156 if (!(ri
->extra
&& ri
->extra
->damp_info
))
6159 if (type
== bgp_show_type_regexp
6160 || type
== bgp_show_type_flap_regexp
)
6162 regex_t
*regex
= output_arg
;
6164 if (bgp_regexec (regex
, ri
->attr
->aspath
) == REG_NOMATCH
)
6167 if (type
== bgp_show_type_prefix_list
6168 || type
== bgp_show_type_flap_prefix_list
)
6170 struct prefix_list
*plist
= output_arg
;
6172 if (prefix_list_apply (plist
, &rn
->p
) != PREFIX_PERMIT
)
6175 if (type
== bgp_show_type_filter_list
6176 || type
== bgp_show_type_flap_filter_list
)
6178 struct as_list
*as_list
= output_arg
;
6180 if (as_list_apply (as_list
, ri
->attr
->aspath
) != AS_FILTER_PERMIT
)
6183 if (type
== bgp_show_type_route_map
6184 || type
== bgp_show_type_flap_route_map
)
6186 struct route_map
*rmap
= output_arg
;
6187 struct bgp_info binfo
;
6188 struct attr dummy_attr
= { 0 };
6191 bgp_attr_dup (&dummy_attr
, ri
->attr
);
6192 binfo
.peer
= ri
->peer
;
6193 binfo
.attr
= &dummy_attr
;
6195 ret
= route_map_apply (rmap
, &rn
->p
, RMAP_BGP
, &binfo
);
6197 bgp_attr_extra_free (&dummy_attr
);
6199 if (ret
== RMAP_DENYMATCH
)
6202 if (type
== bgp_show_type_neighbor
6203 || type
== bgp_show_type_flap_neighbor
6204 || type
== bgp_show_type_damp_neighbor
)
6206 union sockunion
*su
= output_arg
;
6208 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
6211 if (type
== bgp_show_type_cidr_only
6212 || type
== bgp_show_type_flap_cidr_only
)
6214 u_int32_t destination
;
6216 destination
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
6217 if (IN_CLASSC (destination
) && rn
->p
.prefixlen
== 24)
6219 if (IN_CLASSB (destination
) && rn
->p
.prefixlen
== 16)
6221 if (IN_CLASSA (destination
) && rn
->p
.prefixlen
== 8)
6224 if (type
== bgp_show_type_prefix_longer
6225 || type
== bgp_show_type_flap_prefix_longer
)
6227 struct prefix
*p
= output_arg
;
6229 if (! prefix_match (p
, &rn
->p
))
6232 if (type
== bgp_show_type_community_all
)
6234 if (! ri
->attr
->community
)
6237 if (type
== bgp_show_type_community
)
6239 struct community
*com
= output_arg
;
6241 if (! ri
->attr
->community
||
6242 ! community_match (ri
->attr
->community
, com
))
6245 if (type
== bgp_show_type_community_exact
)
6247 struct community
*com
= output_arg
;
6249 if (! ri
->attr
->community
||
6250 ! community_cmp (ri
->attr
->community
, com
))
6253 if (type
== bgp_show_type_community_list
)
6255 struct community_list
*list
= output_arg
;
6257 if (! community_list_match (ri
->attr
->community
, list
))
6260 if (type
== bgp_show_type_community_list_exact
)
6262 struct community_list
*list
= output_arg
;
6264 if (! community_list_exact_match (ri
->attr
->community
, list
))
6267 if (type
== bgp_show_type_flap_address
6268 || type
== bgp_show_type_flap_prefix
)
6270 struct prefix
*p
= output_arg
;
6272 if (! prefix_match (&rn
->p
, p
))
6275 if (type
== bgp_show_type_flap_prefix
)
6276 if (p
->prefixlen
!= rn
->p
.prefixlen
)
6279 if (type
== bgp_show_type_dampend_paths
6280 || type
== bgp_show_type_damp_neighbor
)
6282 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
6283 || CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
6289 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id
), VTY_NEWLINE
);
6290 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
6291 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
6292 if (type
== bgp_show_type_dampend_paths
6293 || type
== bgp_show_type_damp_neighbor
)
6294 vty_out (vty
, BGP_SHOW_DAMP_HEADER
, VTY_NEWLINE
);
6295 else if (type
== bgp_show_type_flap_statistics
6296 || type
== bgp_show_type_flap_address
6297 || type
== bgp_show_type_flap_prefix
6298 || type
== bgp_show_type_flap_cidr_only
6299 || type
== bgp_show_type_flap_regexp
6300 || type
== bgp_show_type_flap_filter_list
6301 || type
== bgp_show_type_flap_prefix_list
6302 || type
== bgp_show_type_flap_prefix_longer
6303 || type
== bgp_show_type_flap_route_map
6304 || type
== bgp_show_type_flap_neighbor
)
6305 vty_out (vty
, BGP_SHOW_FLAP_HEADER
, VTY_NEWLINE
);
6307 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
6311 if (type
== bgp_show_type_dampend_paths
6312 || type
== bgp_show_type_damp_neighbor
)
6313 damp_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6314 else if (type
== bgp_show_type_flap_statistics
6315 || type
== bgp_show_type_flap_address
6316 || type
== bgp_show_type_flap_prefix
6317 || type
== bgp_show_type_flap_cidr_only
6318 || type
== bgp_show_type_flap_regexp
6319 || type
== bgp_show_type_flap_filter_list
6320 || type
== bgp_show_type_flap_prefix_list
6321 || type
== bgp_show_type_flap_prefix_longer
6322 || type
== bgp_show_type_flap_route_map
6323 || type
== bgp_show_type_flap_neighbor
)
6324 flap_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6326 route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6333 /* No route is displayed */
6334 if (output_count
== 0)
6336 if (type
== bgp_show_type_normal
)
6337 vty_out (vty
, "No BGP network exists%s", VTY_NEWLINE
);
6340 vty_out (vty
, "%sTotal number of prefixes %ld%s",
6341 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
6347 bgp_show (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
6348 enum bgp_show_type type
, void *output_arg
)
6350 struct bgp_table
*table
;
6353 bgp
= bgp_get_default ();
6358 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
6363 table
= bgp
->rib
[afi
][safi
];
6365 return bgp_show_table (vty
, table
, &bgp
->router_id
, type
, output_arg
);
6368 /* Header of detailed BGP route information */
6370 route_vty_out_detail_header (struct vty
*vty
, struct bgp
*bgp
,
6371 struct bgp_node
*rn
,
6372 struct prefix_rd
*prd
, afi_t afi
, safi_t safi
)
6374 struct bgp_info
*ri
;
6377 struct listnode
*node
, *nnode
;
6378 char buf1
[INET6_ADDRSTRLEN
];
6379 char buf2
[INET6_ADDRSTRLEN
];
6384 int no_advertise
= 0;
6389 vty_out (vty
, "BGP routing table entry for %s%s%s/%d%s",
6390 (safi
== SAFI_MPLS_VPN
?
6391 prefix_rd2str (prd
, buf1
, RD_ADDRSTRLEN
) : ""),
6392 safi
== SAFI_MPLS_VPN
? ":" : "",
6393 inet_ntop (p
->family
, &p
->u
.prefix
, buf2
, INET6_ADDRSTRLEN
),
6394 p
->prefixlen
, VTY_NEWLINE
);
6396 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6399 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
6402 if (ri
->extra
&& ri
->extra
->suppress
)
6404 if (ri
->attr
->community
!= NULL
)
6406 if (community_include (ri
->attr
->community
, COMMUNITY_NO_ADVERTISE
))
6408 if (community_include (ri
->attr
->community
, COMMUNITY_NO_EXPORT
))
6410 if (community_include (ri
->attr
->community
, COMMUNITY_LOCAL_AS
))
6416 vty_out (vty
, "Paths: (%d available", count
);
6419 vty_out (vty
, ", best #%d", best
);
6420 if (safi
== SAFI_UNICAST
)
6421 vty_out (vty
, ", table Default-IP-Routing-Table");
6424 vty_out (vty
, ", no best path");
6426 vty_out (vty
, ", not advertised to any peer");
6428 vty_out (vty
, ", not advertised to EBGP peer");
6430 vty_out (vty
, ", not advertised outside local AS");
6432 vty_out (vty
, ", Advertisements suppressed by an aggregate.");
6433 vty_out (vty
, ")%s", VTY_NEWLINE
);
6435 /* advertised peer */
6436 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6438 if (bgp_adj_out_lookup (peer
, p
, afi
, safi
, rn
))
6441 vty_out (vty
, " Advertised to non peer-group peers:%s ", VTY_NEWLINE
);
6442 vty_out (vty
, " %s", sockunion2str (&peer
->su
, buf1
, SU_ADDRSTRLEN
));
6447 vty_out (vty
, " Not advertised to any peer");
6448 vty_out (vty
, "%s", VTY_NEWLINE
);
6451 /* Display specified route of BGP table. */
6453 bgp_show_route_in_table (struct vty
*vty
, struct bgp
*bgp
,
6454 struct bgp_table
*rib
, const char *ip_str
,
6455 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
6461 struct prefix match
;
6462 struct bgp_node
*rn
;
6463 struct bgp_node
*rm
;
6464 struct bgp_info
*ri
;
6465 struct bgp_table
*table
;
6467 /* Check IP address argument. */
6468 ret
= str2prefix (ip_str
, &match
);
6471 vty_out (vty
, "address is malformed%s", VTY_NEWLINE
);
6475 match
.family
= afi2family (afi
);
6477 if (safi
== SAFI_MPLS_VPN
)
6479 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
6481 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
6484 if ((table
= rn
->info
) != NULL
)
6488 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
6490 if (prefix_check
&& rm
->p
.prefixlen
!= match
.prefixlen
)
6493 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
6497 route_vty_out_detail_header (vty
, bgp
, rm
, (struct prefix_rd
*)&rn
->p
,
6498 AFI_IP
, SAFI_MPLS_VPN
);
6503 route_vty_out_detail (vty
, bgp
, &rm
->p
, ri
, AFI_IP
, SAFI_MPLS_VPN
);
6513 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
6515 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
6517 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6521 route_vty_out_detail_header (vty
, bgp
, rn
, NULL
, afi
, safi
);
6525 route_vty_out_detail (vty
, bgp
, &rn
->p
, ri
, afi
, safi
);
6533 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
6540 /* Display specified route of Main RIB */
6542 bgp_show_route (struct vty
*vty
, const char *view_name
, const char *ip_str
,
6543 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
6548 /* BGP structure lookup. */
6551 bgp
= bgp_lookup_by_name (view_name
);
6554 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
6560 bgp
= bgp_get_default ();
6563 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
6568 return bgp_show_route_in_table (vty
, bgp
, bgp
->rib
[afi
][safi
], ip_str
,
6569 afi
, safi
, prd
, prefix_check
);
6572 /* BGP route print out function. */
6580 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6583 DEFUN (show_ip_bgp_ipv4
,
6584 show_ip_bgp_ipv4_cmd
,
6585 "show ip bgp ipv4 (unicast|multicast)",
6590 "Address Family modifier\n"
6591 "Address Family modifier\n")
6593 if (strncmp (argv
[0], "m", 1) == 0)
6594 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, bgp_show_type_normal
,
6597 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6600 DEFUN (show_ip_bgp_route
,
6601 show_ip_bgp_route_cmd
,
6602 "show ip bgp A.B.C.D",
6606 "Network in the BGP routing table to display\n")
6608 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6611 DEFUN (show_ip_bgp_ipv4_route
,
6612 show_ip_bgp_ipv4_route_cmd
,
6613 "show ip bgp ipv4 (unicast|multicast) A.B.C.D",
6618 "Address Family modifier\n"
6619 "Address Family modifier\n"
6620 "Network in the BGP routing table to display\n")
6622 if (strncmp (argv
[0], "m", 1) == 0)
6623 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0);
6625 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6628 DEFUN (show_ip_bgp_vpnv4_all_route
,
6629 show_ip_bgp_vpnv4_all_route_cmd
,
6630 "show ip bgp vpnv4 all A.B.C.D",
6634 "Display VPNv4 NLRI specific information\n"
6635 "Display information about all VPNv4 NLRIs\n"
6636 "Network in the BGP routing table to display\n")
6638 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 0);
6641 DEFUN (show_ip_bgp_vpnv4_rd_route
,
6642 show_ip_bgp_vpnv4_rd_route_cmd
,
6643 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D",
6647 "Display VPNv4 NLRI specific information\n"
6648 "Display information for a route distinguisher\n"
6649 "VPN Route Distinguisher\n"
6650 "Network in the BGP routing table to display\n")
6653 struct prefix_rd prd
;
6655 ret
= str2prefix_rd (argv
[0], &prd
);
6658 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
6661 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 0);
6664 DEFUN (show_ip_bgp_prefix
,
6665 show_ip_bgp_prefix_cmd
,
6666 "show ip bgp A.B.C.D/M",
6670 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6672 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6675 DEFUN (show_ip_bgp_ipv4_prefix
,
6676 show_ip_bgp_ipv4_prefix_cmd
,
6677 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M",
6682 "Address Family modifier\n"
6683 "Address Family modifier\n"
6684 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6686 if (strncmp (argv
[0], "m", 1) == 0)
6687 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1);
6689 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6692 DEFUN (show_ip_bgp_vpnv4_all_prefix
,
6693 show_ip_bgp_vpnv4_all_prefix_cmd
,
6694 "show ip bgp vpnv4 all A.B.C.D/M",
6698 "Display VPNv4 NLRI specific information\n"
6699 "Display information about all VPNv4 NLRIs\n"
6700 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6702 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 1);
6705 DEFUN (show_ip_bgp_vpnv4_rd_prefix
,
6706 show_ip_bgp_vpnv4_rd_prefix_cmd
,
6707 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M",
6711 "Display VPNv4 NLRI specific information\n"
6712 "Display information for a route distinguisher\n"
6713 "VPN Route Distinguisher\n"
6714 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6717 struct prefix_rd prd
;
6719 ret
= str2prefix_rd (argv
[0], &prd
);
6722 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
6725 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 1);
6728 DEFUN (show_ip_bgp_view
,
6729 show_ip_bgp_view_cmd
,
6730 "show ip bgp view WORD",
6739 /* BGP structure lookup. */
6740 bgp
= bgp_lookup_by_name (argv
[0]);
6743 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
6747 return bgp_show (vty
, bgp
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6750 DEFUN (show_ip_bgp_view_route
,
6751 show_ip_bgp_view_route_cmd
,
6752 "show ip bgp view WORD A.B.C.D",
6758 "Network in the BGP routing table to display\n")
6760 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6763 DEFUN (show_ip_bgp_view_prefix
,
6764 show_ip_bgp_view_prefix_cmd
,
6765 "show ip bgp view WORD A.B.C.D/M",
6771 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6773 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6783 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
6795 DEFUN (show_ipv6_bgp
,
6802 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
6806 DEFUN (show_bgp_route
,
6808 "show bgp X:X::X:X",
6811 "Network in the BGP routing table to display\n")
6813 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6816 ALIAS (show_bgp_route
,
6817 show_bgp_ipv6_route_cmd
,
6818 "show bgp ipv6 X:X::X:X",
6822 "Network in the BGP routing table to display\n")
6825 DEFUN (show_ipv6_bgp_route
,
6826 show_ipv6_bgp_route_cmd
,
6827 "show ipv6 bgp X:X::X:X",
6831 "Network in the BGP routing table to display\n")
6833 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6836 DEFUN (show_bgp_prefix
,
6837 show_bgp_prefix_cmd
,
6838 "show bgp X:X::X:X/M",
6841 "IPv6 prefix <network>/<length>\n")
6843 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6846 ALIAS (show_bgp_prefix
,
6847 show_bgp_ipv6_prefix_cmd
,
6848 "show bgp ipv6 X:X::X:X/M",
6852 "IPv6 prefix <network>/<length>\n")
6855 DEFUN (show_ipv6_bgp_prefix
,
6856 show_ipv6_bgp_prefix_cmd
,
6857 "show ipv6 bgp X:X::X:X/M",
6861 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6863 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6866 DEFUN (show_bgp_view
,
6868 "show bgp view WORD",
6876 /* BGP structure lookup. */
6877 bgp
= bgp_lookup_by_name (argv
[0]);
6880 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
6884 return bgp_show (vty
, bgp
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6887 ALIAS (show_bgp_view
,
6888 show_bgp_view_ipv6_cmd
,
6889 "show bgp view WORD ipv6",
6896 DEFUN (show_bgp_view_route
,
6897 show_bgp_view_route_cmd
,
6898 "show bgp view WORD X:X::X:X",
6903 "Network in the BGP routing table to display\n")
6905 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6908 ALIAS (show_bgp_view_route
,
6909 show_bgp_view_ipv6_route_cmd
,
6910 "show bgp view WORD ipv6 X:X::X:X",
6916 "Network in the BGP routing table to display\n")
6918 DEFUN (show_bgp_view_prefix
,
6919 show_bgp_view_prefix_cmd
,
6920 "show bgp view WORD X:X::X:X/M",
6925 "IPv6 prefix <network>/<length>\n")
6927 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6930 ALIAS (show_bgp_view_prefix
,
6931 show_bgp_view_ipv6_prefix_cmd
,
6932 "show bgp view WORD ipv6 X:X::X:X/M",
6938 "IPv6 prefix <network>/<length>\n")
6941 DEFUN (show_ipv6_mbgp
,
6948 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
6953 DEFUN (show_ipv6_mbgp_route
,
6954 show_ipv6_mbgp_route_cmd
,
6955 "show ipv6 mbgp X:X::X:X",
6959 "Network in the MBGP routing table to display\n")
6961 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0);
6965 DEFUN (show_ipv6_mbgp_prefix
,
6966 show_ipv6_mbgp_prefix_cmd
,
6967 "show ipv6 mbgp X:X::X:X/M",
6971 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6973 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1);
6979 bgp_show_regexp (struct vty
*vty
, int argc
, const char **argv
, afi_t afi
,
6980 safi_t safi
, enum bgp_show_type type
)
6990 b
= buffer_new (1024);
6991 for (i
= 0; i
< argc
; i
++)
6994 buffer_putc (b
, ' ');
6997 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
7002 buffer_putstr (b
, argv
[i
]);
7004 buffer_putc (b
, '\0');
7006 regstr
= buffer_getstr (b
);
7009 regex
= bgp_regcomp (regstr
);
7010 XFREE(MTYPE_TMP
, regstr
);
7013 vty_out (vty
, "Can't compile regexp %s%s", argv
[0],
7018 rc
= bgp_show (vty
, NULL
, afi
, safi
, type
, regex
);
7019 bgp_regex_free (regex
);
7023 DEFUN (show_ip_bgp_regexp
,
7024 show_ip_bgp_regexp_cmd
,
7025 "show ip bgp regexp .LINE",
7029 "Display routes matching the AS path regular expression\n"
7030 "A regular-expression to match the BGP AS paths\n")
7032 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7033 bgp_show_type_regexp
);
7036 DEFUN (show_ip_bgp_flap_regexp
,
7037 show_ip_bgp_flap_regexp_cmd
,
7038 "show ip bgp flap-statistics regexp .LINE",
7042 "Display flap statistics of routes\n"
7043 "Display routes matching the AS path regular expression\n"
7044 "A regular-expression to match the BGP AS paths\n")
7046 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7047 bgp_show_type_flap_regexp
);
7050 DEFUN (show_ip_bgp_ipv4_regexp
,
7051 show_ip_bgp_ipv4_regexp_cmd
,
7052 "show ip bgp ipv4 (unicast|multicast) regexp .LINE",
7057 "Address Family modifier\n"
7058 "Address Family modifier\n"
7059 "Display routes matching the AS path regular expression\n"
7060 "A regular-expression to match the BGP AS paths\n")
7062 if (strncmp (argv
[0], "m", 1) == 0)
7063 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_MULTICAST
,
7064 bgp_show_type_regexp
);
7066 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7067 bgp_show_type_regexp
);
7071 DEFUN (show_bgp_regexp
,
7072 show_bgp_regexp_cmd
,
7073 "show bgp regexp .LINE",
7076 "Display routes matching the AS path regular expression\n"
7077 "A regular-expression to match the BGP AS paths\n")
7079 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
7080 bgp_show_type_regexp
);
7083 ALIAS (show_bgp_regexp
,
7084 show_bgp_ipv6_regexp_cmd
,
7085 "show bgp ipv6 regexp .LINE",
7089 "Display routes matching the AS path regular expression\n"
7090 "A regular-expression to match the BGP AS paths\n")
7093 DEFUN (show_ipv6_bgp_regexp
,
7094 show_ipv6_bgp_regexp_cmd
,
7095 "show ipv6 bgp regexp .LINE",
7099 "Display routes matching the AS path regular expression\n"
7100 "A regular-expression to match the BGP AS paths\n")
7102 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
7103 bgp_show_type_regexp
);
7107 DEFUN (show_ipv6_mbgp_regexp
,
7108 show_ipv6_mbgp_regexp_cmd
,
7109 "show ipv6 mbgp regexp .LINE",
7113 "Display routes matching the AS path regular expression\n"
7114 "A regular-expression to match the MBGP AS paths\n")
7116 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_MULTICAST
,
7117 bgp_show_type_regexp
);
7119 #endif /* HAVE_IPV6 */
7122 bgp_show_prefix_list (struct vty
*vty
, const char *prefix_list_str
, afi_t afi
,
7123 safi_t safi
, enum bgp_show_type type
)
7125 struct prefix_list
*plist
;
7127 plist
= prefix_list_lookup (afi
, prefix_list_str
);
7130 vty_out (vty
, "%% %s is not a valid prefix-list name%s",
7131 prefix_list_str
, VTY_NEWLINE
);
7135 return bgp_show (vty
, NULL
, afi
, safi
, type
, plist
);
7138 DEFUN (show_ip_bgp_prefix_list
,
7139 show_ip_bgp_prefix_list_cmd
,
7140 "show ip bgp prefix-list WORD",
7144 "Display routes conforming to the prefix-list\n"
7145 "IP prefix-list name\n")
7147 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7148 bgp_show_type_prefix_list
);
7151 DEFUN (show_ip_bgp_flap_prefix_list
,
7152 show_ip_bgp_flap_prefix_list_cmd
,
7153 "show ip bgp flap-statistics prefix-list WORD",
7157 "Display flap statistics of routes\n"
7158 "Display routes conforming to the prefix-list\n"
7159 "IP prefix-list name\n")
7161 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7162 bgp_show_type_flap_prefix_list
);
7165 DEFUN (show_ip_bgp_ipv4_prefix_list
,
7166 show_ip_bgp_ipv4_prefix_list_cmd
,
7167 "show ip bgp ipv4 (unicast|multicast) prefix-list WORD",
7172 "Address Family modifier\n"
7173 "Address Family modifier\n"
7174 "Display routes conforming to the prefix-list\n"
7175 "IP prefix-list name\n")
7177 if (strncmp (argv
[0], "m", 1) == 0)
7178 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7179 bgp_show_type_prefix_list
);
7181 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7182 bgp_show_type_prefix_list
);
7186 DEFUN (show_bgp_prefix_list
,
7187 show_bgp_prefix_list_cmd
,
7188 "show bgp prefix-list WORD",
7191 "Display routes conforming to the prefix-list\n"
7192 "IPv6 prefix-list name\n")
7194 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7195 bgp_show_type_prefix_list
);
7198 ALIAS (show_bgp_prefix_list
,
7199 show_bgp_ipv6_prefix_list_cmd
,
7200 "show bgp ipv6 prefix-list WORD",
7204 "Display routes conforming to the prefix-list\n"
7205 "IPv6 prefix-list name\n")
7208 DEFUN (show_ipv6_bgp_prefix_list
,
7209 show_ipv6_bgp_prefix_list_cmd
,
7210 "show ipv6 bgp prefix-list WORD",
7214 "Display routes matching the prefix-list\n"
7215 "IPv6 prefix-list name\n")
7217 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7218 bgp_show_type_prefix_list
);
7222 DEFUN (show_ipv6_mbgp_prefix_list
,
7223 show_ipv6_mbgp_prefix_list_cmd
,
7224 "show ipv6 mbgp prefix-list WORD",
7228 "Display routes matching the prefix-list\n"
7229 "IPv6 prefix-list name\n")
7231 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
7232 bgp_show_type_prefix_list
);
7234 #endif /* HAVE_IPV6 */
7237 bgp_show_filter_list (struct vty
*vty
, const char *filter
, afi_t afi
,
7238 safi_t safi
, enum bgp_show_type type
)
7240 struct as_list
*as_list
;
7242 as_list
= as_list_lookup (filter
);
7243 if (as_list
== NULL
)
7245 vty_out (vty
, "%% %s is not a valid AS-path access-list name%s", filter
, VTY_NEWLINE
);
7249 return bgp_show (vty
, NULL
, afi
, safi
, type
, as_list
);
7252 DEFUN (show_ip_bgp_filter_list
,
7253 show_ip_bgp_filter_list_cmd
,
7254 "show ip bgp filter-list WORD",
7258 "Display routes conforming to the filter-list\n"
7259 "Regular expression access list name\n")
7261 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7262 bgp_show_type_filter_list
);
7265 DEFUN (show_ip_bgp_flap_filter_list
,
7266 show_ip_bgp_flap_filter_list_cmd
,
7267 "show ip bgp flap-statistics filter-list WORD",
7271 "Display flap statistics of routes\n"
7272 "Display routes conforming to the filter-list\n"
7273 "Regular expression access list name\n")
7275 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7276 bgp_show_type_flap_filter_list
);
7279 DEFUN (show_ip_bgp_ipv4_filter_list
,
7280 show_ip_bgp_ipv4_filter_list_cmd
,
7281 "show ip bgp ipv4 (unicast|multicast) filter-list WORD",
7286 "Address Family modifier\n"
7287 "Address Family modifier\n"
7288 "Display routes conforming to the filter-list\n"
7289 "Regular expression access list name\n")
7291 if (strncmp (argv
[0], "m", 1) == 0)
7292 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7293 bgp_show_type_filter_list
);
7295 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7296 bgp_show_type_filter_list
);
7300 DEFUN (show_bgp_filter_list
,
7301 show_bgp_filter_list_cmd
,
7302 "show bgp filter-list WORD",
7305 "Display routes conforming to the filter-list\n"
7306 "Regular expression access list name\n")
7308 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7309 bgp_show_type_filter_list
);
7312 ALIAS (show_bgp_filter_list
,
7313 show_bgp_ipv6_filter_list_cmd
,
7314 "show bgp ipv6 filter-list WORD",
7318 "Display routes conforming to the filter-list\n"
7319 "Regular expression access list name\n")
7322 DEFUN (show_ipv6_bgp_filter_list
,
7323 show_ipv6_bgp_filter_list_cmd
,
7324 "show ipv6 bgp filter-list WORD",
7328 "Display routes conforming to the filter-list\n"
7329 "Regular expression access list name\n")
7331 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7332 bgp_show_type_filter_list
);
7336 DEFUN (show_ipv6_mbgp_filter_list
,
7337 show_ipv6_mbgp_filter_list_cmd
,
7338 "show ipv6 mbgp filter-list WORD",
7342 "Display routes conforming to the filter-list\n"
7343 "Regular expression access list name\n")
7345 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
7346 bgp_show_type_filter_list
);
7348 #endif /* HAVE_IPV6 */
7351 bgp_show_route_map (struct vty
*vty
, const char *rmap_str
, afi_t afi
,
7352 safi_t safi
, enum bgp_show_type type
)
7354 struct route_map
*rmap
;
7356 rmap
= route_map_lookup_by_name (rmap_str
);
7359 vty_out (vty
, "%% %s is not a valid route-map name%s",
7360 rmap_str
, VTY_NEWLINE
);
7364 return bgp_show (vty
, NULL
, afi
, safi
, type
, rmap
);
7367 DEFUN (show_ip_bgp_route_map
,
7368 show_ip_bgp_route_map_cmd
,
7369 "show ip bgp route-map WORD",
7373 "Display routes matching the route-map\n"
7374 "A route-map to match on\n")
7376 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7377 bgp_show_type_route_map
);
7380 DEFUN (show_ip_bgp_flap_route_map
,
7381 show_ip_bgp_flap_route_map_cmd
,
7382 "show ip bgp flap-statistics route-map WORD",
7386 "Display flap statistics of routes\n"
7387 "Display routes matching the route-map\n"
7388 "A route-map to match on\n")
7390 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7391 bgp_show_type_flap_route_map
);
7394 DEFUN (show_ip_bgp_ipv4_route_map
,
7395 show_ip_bgp_ipv4_route_map_cmd
,
7396 "show ip bgp ipv4 (unicast|multicast) route-map WORD",
7401 "Address Family modifier\n"
7402 "Address Family modifier\n"
7403 "Display routes matching the route-map\n"
7404 "A route-map to match on\n")
7406 if (strncmp (argv
[0], "m", 1) == 0)
7407 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7408 bgp_show_type_route_map
);
7410 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7411 bgp_show_type_route_map
);
7414 DEFUN (show_bgp_route_map
,
7415 show_bgp_route_map_cmd
,
7416 "show bgp route-map WORD",
7419 "Display routes matching the route-map\n"
7420 "A route-map to match on\n")
7422 return bgp_show_route_map (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7423 bgp_show_type_route_map
);
7426 ALIAS (show_bgp_route_map
,
7427 show_bgp_ipv6_route_map_cmd
,
7428 "show bgp ipv6 route-map WORD",
7432 "Display routes matching the route-map\n"
7433 "A route-map to match on\n")
7435 DEFUN (show_ip_bgp_cidr_only
,
7436 show_ip_bgp_cidr_only_cmd
,
7437 "show ip bgp cidr-only",
7441 "Display only routes with non-natural netmasks\n")
7443 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7444 bgp_show_type_cidr_only
, NULL
);
7447 DEFUN (show_ip_bgp_flap_cidr_only
,
7448 show_ip_bgp_flap_cidr_only_cmd
,
7449 "show ip bgp flap-statistics cidr-only",
7453 "Display flap statistics of routes\n"
7454 "Display only routes with non-natural netmasks\n")
7456 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7457 bgp_show_type_flap_cidr_only
, NULL
);
7460 DEFUN (show_ip_bgp_ipv4_cidr_only
,
7461 show_ip_bgp_ipv4_cidr_only_cmd
,
7462 "show ip bgp ipv4 (unicast|multicast) cidr-only",
7467 "Address Family modifier\n"
7468 "Address Family modifier\n"
7469 "Display only routes with non-natural netmasks\n")
7471 if (strncmp (argv
[0], "m", 1) == 0)
7472 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
7473 bgp_show_type_cidr_only
, NULL
);
7475 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7476 bgp_show_type_cidr_only
, NULL
);
7479 DEFUN (show_ip_bgp_community_all
,
7480 show_ip_bgp_community_all_cmd
,
7481 "show ip bgp community",
7485 "Display routes matching the communities\n")
7487 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7488 bgp_show_type_community_all
, NULL
);
7491 DEFUN (show_ip_bgp_ipv4_community_all
,
7492 show_ip_bgp_ipv4_community_all_cmd
,
7493 "show ip bgp ipv4 (unicast|multicast) community",
7498 "Address Family modifier\n"
7499 "Address Family modifier\n"
7500 "Display routes matching the communities\n")
7502 if (strncmp (argv
[0], "m", 1) == 0)
7503 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
7504 bgp_show_type_community_all
, NULL
);
7506 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7507 bgp_show_type_community_all
, NULL
);
7511 DEFUN (show_bgp_community_all
,
7512 show_bgp_community_all_cmd
,
7513 "show bgp community",
7516 "Display routes matching the communities\n")
7518 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
7519 bgp_show_type_community_all
, NULL
);
7522 ALIAS (show_bgp_community_all
,
7523 show_bgp_ipv6_community_all_cmd
,
7524 "show bgp ipv6 community",
7528 "Display routes matching the communities\n")
7531 DEFUN (show_ipv6_bgp_community_all
,
7532 show_ipv6_bgp_community_all_cmd
,
7533 "show ipv6 bgp community",
7537 "Display routes matching the communities\n")
7539 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
7540 bgp_show_type_community_all
, NULL
);
7544 DEFUN (show_ipv6_mbgp_community_all
,
7545 show_ipv6_mbgp_community_all_cmd
,
7546 "show ipv6 mbgp community",
7550 "Display routes matching the communities\n")
7552 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
,
7553 bgp_show_type_community_all
, NULL
);
7555 #endif /* HAVE_IPV6 */
7558 bgp_show_community (struct vty
*vty
, int argc
, const char **argv
, int exact
,
7559 u_int16_t afi
, u_char safi
)
7561 struct community
*com
;
7567 b
= buffer_new (1024);
7568 for (i
= 0; i
< argc
; i
++)
7571 buffer_putc (b
, ' ');
7574 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
7579 buffer_putstr (b
, argv
[i
]);
7581 buffer_putc (b
, '\0');
7583 str
= buffer_getstr (b
);
7586 com
= community_str2com (str
);
7587 XFREE (MTYPE_TMP
, str
);
7590 vty_out (vty
, "%% Community malformed: %s", VTY_NEWLINE
);
7594 return bgp_show (vty
, NULL
, afi
, safi
,
7595 (exact
? bgp_show_type_community_exact
:
7596 bgp_show_type_community
), com
);
7599 DEFUN (show_ip_bgp_community
,
7600 show_ip_bgp_community_cmd
,
7601 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export)",
7605 "Display routes matching the communities\n"
7606 "community number\n"
7607 "Do not send outside local AS (well-known community)\n"
7608 "Do not advertise to any peer (well-known community)\n"
7609 "Do not export to next AS (well-known community)\n")
7611 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
7614 ALIAS (show_ip_bgp_community
,
7615 show_ip_bgp_community2_cmd
,
7616 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7620 "Display routes matching the communities\n"
7621 "community number\n"
7622 "Do not send outside local AS (well-known community)\n"
7623 "Do not advertise to any peer (well-known community)\n"
7624 "Do not export to next AS (well-known community)\n"
7625 "community number\n"
7626 "Do not send outside local AS (well-known community)\n"
7627 "Do not advertise to any peer (well-known community)\n"
7628 "Do not export to next AS (well-known community)\n")
7630 ALIAS (show_ip_bgp_community
,
7631 show_ip_bgp_community3_cmd
,
7632 "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)",
7636 "Display routes matching the communities\n"
7637 "community number\n"
7638 "Do not send outside local AS (well-known community)\n"
7639 "Do not advertise to any peer (well-known community)\n"
7640 "Do not export to next AS (well-known community)\n"
7641 "community number\n"
7642 "Do not send outside local AS (well-known community)\n"
7643 "Do not advertise to any peer (well-known community)\n"
7644 "Do not export to next AS (well-known community)\n"
7645 "community number\n"
7646 "Do not send outside local AS (well-known community)\n"
7647 "Do not advertise to any peer (well-known community)\n"
7648 "Do not export to next AS (well-known community)\n")
7650 ALIAS (show_ip_bgp_community
,
7651 show_ip_bgp_community4_cmd
,
7652 "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)",
7656 "Display routes matching the communities\n"
7657 "community number\n"
7658 "Do not send outside local AS (well-known community)\n"
7659 "Do not advertise to any peer (well-known community)\n"
7660 "Do not export to next AS (well-known community)\n"
7661 "community number\n"
7662 "Do not send outside local AS (well-known community)\n"
7663 "Do not advertise to any peer (well-known community)\n"
7664 "Do not export to next AS (well-known community)\n"
7665 "community number\n"
7666 "Do not send outside local AS (well-known community)\n"
7667 "Do not advertise to any peer (well-known community)\n"
7668 "Do not export to next AS (well-known community)\n"
7669 "community number\n"
7670 "Do not send outside local AS (well-known community)\n"
7671 "Do not advertise to any peer (well-known community)\n"
7672 "Do not export to next AS (well-known community)\n")
7674 DEFUN (show_ip_bgp_ipv4_community
,
7675 show_ip_bgp_ipv4_community_cmd
,
7676 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
7681 "Address Family modifier\n"
7682 "Address Family modifier\n"
7683 "Display routes matching the communities\n"
7684 "community number\n"
7685 "Do not send outside local AS (well-known community)\n"
7686 "Do not advertise to any peer (well-known community)\n"
7687 "Do not export to next AS (well-known community)\n")
7689 if (strncmp (argv
[0], "m", 1) == 0)
7690 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_MULTICAST
);
7692 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
7695 ALIAS (show_ip_bgp_ipv4_community
,
7696 show_ip_bgp_ipv4_community2_cmd
,
7697 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7702 "Address Family modifier\n"
7703 "Address Family modifier\n"
7704 "Display routes matching the communities\n"
7705 "community number\n"
7706 "Do not send outside local AS (well-known community)\n"
7707 "Do not advertise to any peer (well-known community)\n"
7708 "Do not export to next AS (well-known community)\n"
7709 "community number\n"
7710 "Do not send outside local AS (well-known community)\n"
7711 "Do not advertise to any peer (well-known community)\n"
7712 "Do not export to next AS (well-known community)\n")
7714 ALIAS (show_ip_bgp_ipv4_community
,
7715 show_ip_bgp_ipv4_community3_cmd
,
7716 "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)",
7721 "Address Family modifier\n"
7722 "Address Family modifier\n"
7723 "Display routes matching the communities\n"
7724 "community number\n"
7725 "Do not send outside local AS (well-known community)\n"
7726 "Do not advertise to any peer (well-known community)\n"
7727 "Do not export to next AS (well-known community)\n"
7728 "community number\n"
7729 "Do not send outside local AS (well-known community)\n"
7730 "Do not advertise to any peer (well-known community)\n"
7731 "Do not export to next AS (well-known community)\n"
7732 "community number\n"
7733 "Do not send outside local AS (well-known community)\n"
7734 "Do not advertise to any peer (well-known community)\n"
7735 "Do not export to next AS (well-known community)\n")
7737 ALIAS (show_ip_bgp_ipv4_community
,
7738 show_ip_bgp_ipv4_community4_cmd
,
7739 "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)",
7744 "Address Family modifier\n"
7745 "Address Family modifier\n"
7746 "Display routes matching the communities\n"
7747 "community number\n"
7748 "Do not send outside local AS (well-known community)\n"
7749 "Do not advertise to any peer (well-known community)\n"
7750 "Do not export to next AS (well-known community)\n"
7751 "community number\n"
7752 "Do not send outside local AS (well-known community)\n"
7753 "Do not advertise to any peer (well-known community)\n"
7754 "Do not export to next AS (well-known community)\n"
7755 "community number\n"
7756 "Do not send outside local AS (well-known community)\n"
7757 "Do not advertise to any peer (well-known community)\n"
7758 "Do not export to next AS (well-known community)\n"
7759 "community number\n"
7760 "Do not send outside local AS (well-known community)\n"
7761 "Do not advertise to any peer (well-known community)\n"
7762 "Do not export to next AS (well-known community)\n")
7764 DEFUN (show_ip_bgp_community_exact
,
7765 show_ip_bgp_community_exact_cmd
,
7766 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7770 "Display routes matching the communities\n"
7771 "community number\n"
7772 "Do not send outside local AS (well-known community)\n"
7773 "Do not advertise to any peer (well-known community)\n"
7774 "Do not export to next AS (well-known community)\n"
7775 "Exact match of the communities")
7777 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
7780 ALIAS (show_ip_bgp_community_exact
,
7781 show_ip_bgp_community2_exact_cmd
,
7782 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7786 "Display routes matching the communities\n"
7787 "community number\n"
7788 "Do not send outside local AS (well-known community)\n"
7789 "Do not advertise to any peer (well-known community)\n"
7790 "Do not export to next AS (well-known community)\n"
7791 "community number\n"
7792 "Do not send outside local AS (well-known community)\n"
7793 "Do not advertise to any peer (well-known community)\n"
7794 "Do not export to next AS (well-known community)\n"
7795 "Exact match of the communities")
7797 ALIAS (show_ip_bgp_community_exact
,
7798 show_ip_bgp_community3_exact_cmd
,
7799 "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",
7803 "Display routes matching the communities\n"
7804 "community number\n"
7805 "Do not send outside local AS (well-known community)\n"
7806 "Do not advertise to any peer (well-known community)\n"
7807 "Do not export to next AS (well-known community)\n"
7808 "community number\n"
7809 "Do not send outside local AS (well-known community)\n"
7810 "Do not advertise to any peer (well-known community)\n"
7811 "Do not export to next AS (well-known community)\n"
7812 "community number\n"
7813 "Do not send outside local AS (well-known community)\n"
7814 "Do not advertise to any peer (well-known community)\n"
7815 "Do not export to next AS (well-known community)\n"
7816 "Exact match of the communities")
7818 ALIAS (show_ip_bgp_community_exact
,
7819 show_ip_bgp_community4_exact_cmd
,
7820 "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",
7824 "Display routes matching the communities\n"
7825 "community number\n"
7826 "Do not send outside local AS (well-known community)\n"
7827 "Do not advertise to any peer (well-known community)\n"
7828 "Do not export to next AS (well-known community)\n"
7829 "community number\n"
7830 "Do not send outside local AS (well-known community)\n"
7831 "Do not advertise to any peer (well-known community)\n"
7832 "Do not export to next AS (well-known community)\n"
7833 "community number\n"
7834 "Do not send outside local AS (well-known community)\n"
7835 "Do not advertise to any peer (well-known community)\n"
7836 "Do not export to next AS (well-known community)\n"
7837 "community number\n"
7838 "Do not send outside local AS (well-known community)\n"
7839 "Do not advertise to any peer (well-known community)\n"
7840 "Do not export to next AS (well-known community)\n"
7841 "Exact match of the communities")
7843 DEFUN (show_ip_bgp_ipv4_community_exact
,
7844 show_ip_bgp_ipv4_community_exact_cmd
,
7845 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7850 "Address Family modifier\n"
7851 "Address Family modifier\n"
7852 "Display routes matching the communities\n"
7853 "community number\n"
7854 "Do not send outside local AS (well-known community)\n"
7855 "Do not advertise to any peer (well-known community)\n"
7856 "Do not export to next AS (well-known community)\n"
7857 "Exact match of the communities")
7859 if (strncmp (argv
[0], "m", 1) == 0)
7860 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_MULTICAST
);
7862 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
7865 ALIAS (show_ip_bgp_ipv4_community_exact
,
7866 show_ip_bgp_ipv4_community2_exact_cmd
,
7867 "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",
7872 "Address Family modifier\n"
7873 "Address Family modifier\n"
7874 "Display routes matching the communities\n"
7875 "community number\n"
7876 "Do not send outside local AS (well-known community)\n"
7877 "Do not advertise to any peer (well-known community)\n"
7878 "Do not export to next AS (well-known community)\n"
7879 "community number\n"
7880 "Do not send outside local AS (well-known community)\n"
7881 "Do not advertise to any peer (well-known community)\n"
7882 "Do not export to next AS (well-known community)\n"
7883 "Exact match of the communities")
7885 ALIAS (show_ip_bgp_ipv4_community_exact
,
7886 show_ip_bgp_ipv4_community3_exact_cmd
,
7887 "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",
7892 "Address Family modifier\n"
7893 "Address Family modifier\n"
7894 "Display routes matching the communities\n"
7895 "community number\n"
7896 "Do not send outside local AS (well-known community)\n"
7897 "Do not advertise to any peer (well-known community)\n"
7898 "Do not export to next AS (well-known community)\n"
7899 "community number\n"
7900 "Do not send outside local AS (well-known community)\n"
7901 "Do not advertise to any peer (well-known community)\n"
7902 "Do not export to next AS (well-known community)\n"
7903 "community number\n"
7904 "Do not send outside local AS (well-known community)\n"
7905 "Do not advertise to any peer (well-known community)\n"
7906 "Do not export to next AS (well-known community)\n"
7907 "Exact match of the communities")
7909 ALIAS (show_ip_bgp_ipv4_community_exact
,
7910 show_ip_bgp_ipv4_community4_exact_cmd
,
7911 "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",
7916 "Address Family modifier\n"
7917 "Address Family modifier\n"
7918 "Display routes matching the communities\n"
7919 "community number\n"
7920 "Do not send outside local AS (well-known community)\n"
7921 "Do not advertise to any peer (well-known community)\n"
7922 "Do not export to next AS (well-known community)\n"
7923 "community number\n"
7924 "Do not send outside local AS (well-known community)\n"
7925 "Do not advertise to any peer (well-known community)\n"
7926 "Do not export to next AS (well-known community)\n"
7927 "community number\n"
7928 "Do not send outside local AS (well-known community)\n"
7929 "Do not advertise to any peer (well-known community)\n"
7930 "Do not export to next AS (well-known community)\n"
7931 "community number\n"
7932 "Do not send outside local AS (well-known community)\n"
7933 "Do not advertise to any peer (well-known community)\n"
7934 "Do not export to next AS (well-known community)\n"
7935 "Exact match of the communities")
7938 DEFUN (show_bgp_community
,
7939 show_bgp_community_cmd
,
7940 "show bgp community (AA:NN|local-AS|no-advertise|no-export)",
7943 "Display routes matching the communities\n"
7944 "community number\n"
7945 "Do not send outside local AS (well-known community)\n"
7946 "Do not advertise to any peer (well-known community)\n"
7947 "Do not export to next AS (well-known community)\n")
7949 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
7952 ALIAS (show_bgp_community
,
7953 show_bgp_ipv6_community_cmd
,
7954 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)",
7958 "Display routes matching the communities\n"
7959 "community number\n"
7960 "Do not send outside local AS (well-known community)\n"
7961 "Do not advertise to any peer (well-known community)\n"
7962 "Do not export to next AS (well-known community)\n")
7964 ALIAS (show_bgp_community
,
7965 show_bgp_community2_cmd
,
7966 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7969 "Display routes matching the communities\n"
7970 "community number\n"
7971 "Do not send outside local AS (well-known community)\n"
7972 "Do not advertise to any peer (well-known community)\n"
7973 "Do not export to next AS (well-known community)\n"
7974 "community number\n"
7975 "Do not send outside local AS (well-known community)\n"
7976 "Do not advertise to any peer (well-known community)\n"
7977 "Do not export to next AS (well-known community)\n")
7979 ALIAS (show_bgp_community
,
7980 show_bgp_ipv6_community2_cmd
,
7981 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7985 "Display routes matching the communities\n"
7986 "community number\n"
7987 "Do not send outside local AS (well-known community)\n"
7988 "Do not advertise to any peer (well-known community)\n"
7989 "Do not export to next AS (well-known community)\n"
7990 "community number\n"
7991 "Do not send outside local AS (well-known community)\n"
7992 "Do not advertise to any peer (well-known community)\n"
7993 "Do not export to next AS (well-known community)\n")
7995 ALIAS (show_bgp_community
,
7996 show_bgp_community3_cmd
,
7997 "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)",
8000 "Display routes matching the communities\n"
8001 "community number\n"
8002 "Do not send outside local AS (well-known community)\n"
8003 "Do not advertise to any peer (well-known community)\n"
8004 "Do not export to next AS (well-known community)\n"
8005 "community number\n"
8006 "Do not send outside local AS (well-known community)\n"
8007 "Do not advertise to any peer (well-known community)\n"
8008 "Do not export to next AS (well-known community)\n"
8009 "community number\n"
8010 "Do not send outside local AS (well-known community)\n"
8011 "Do not advertise to any peer (well-known community)\n"
8012 "Do not export to next AS (well-known community)\n")
8014 ALIAS (show_bgp_community
,
8015 show_bgp_ipv6_community3_cmd
,
8016 "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)",
8020 "Display routes matching the communities\n"
8021 "community number\n"
8022 "Do not send outside local AS (well-known community)\n"
8023 "Do not advertise to any peer (well-known community)\n"
8024 "Do not export to next AS (well-known community)\n"
8025 "community number\n"
8026 "Do not send outside local AS (well-known community)\n"
8027 "Do not advertise to any peer (well-known community)\n"
8028 "Do not export to next AS (well-known community)\n"
8029 "community number\n"
8030 "Do not send outside local AS (well-known community)\n"
8031 "Do not advertise to any peer (well-known community)\n"
8032 "Do not export to next AS (well-known community)\n")
8034 ALIAS (show_bgp_community
,
8035 show_bgp_community4_cmd
,
8036 "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)",
8039 "Display routes matching the communities\n"
8040 "community number\n"
8041 "Do not send outside local AS (well-known community)\n"
8042 "Do not advertise to any peer (well-known community)\n"
8043 "Do not export to next AS (well-known community)\n"
8044 "community number\n"
8045 "Do not send outside local AS (well-known community)\n"
8046 "Do not advertise to any peer (well-known community)\n"
8047 "Do not export to next AS (well-known community)\n"
8048 "community number\n"
8049 "Do not send outside local AS (well-known community)\n"
8050 "Do not advertise to any peer (well-known community)\n"
8051 "Do not export to next AS (well-known community)\n"
8052 "community number\n"
8053 "Do not send outside local AS (well-known community)\n"
8054 "Do not advertise to any peer (well-known community)\n"
8055 "Do not export to next AS (well-known community)\n")
8057 ALIAS (show_bgp_community
,
8058 show_bgp_ipv6_community4_cmd
,
8059 "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)",
8063 "Display routes matching the communities\n"
8064 "community number\n"
8065 "Do not send outside local AS (well-known community)\n"
8066 "Do not advertise to any peer (well-known community)\n"
8067 "Do not export to next AS (well-known community)\n"
8068 "community number\n"
8069 "Do not send outside local AS (well-known community)\n"
8070 "Do not advertise to any peer (well-known community)\n"
8071 "Do not export to next AS (well-known community)\n"
8072 "community number\n"
8073 "Do not send outside local AS (well-known community)\n"
8074 "Do not advertise to any peer (well-known community)\n"
8075 "Do not export to next AS (well-known community)\n"
8076 "community number\n"
8077 "Do not send outside local AS (well-known community)\n"
8078 "Do not advertise to any peer (well-known community)\n"
8079 "Do not export to next AS (well-known community)\n")
8082 DEFUN (show_ipv6_bgp_community
,
8083 show_ipv6_bgp_community_cmd
,
8084 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export)",
8088 "Display routes matching the communities\n"
8089 "community number\n"
8090 "Do not send outside local AS (well-known community)\n"
8091 "Do not advertise to any peer (well-known community)\n"
8092 "Do not export to next AS (well-known community)\n")
8094 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
8098 ALIAS (show_ipv6_bgp_community
,
8099 show_ipv6_bgp_community2_cmd
,
8100 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8104 "Display routes matching the communities\n"
8105 "community number\n"
8106 "Do not send outside local AS (well-known community)\n"
8107 "Do not advertise to any peer (well-known community)\n"
8108 "Do not export to next AS (well-known community)\n"
8109 "community number\n"
8110 "Do not send outside local AS (well-known community)\n"
8111 "Do not advertise to any peer (well-known community)\n"
8112 "Do not export to next AS (well-known community)\n")
8115 ALIAS (show_ipv6_bgp_community
,
8116 show_ipv6_bgp_community3_cmd
,
8117 "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)",
8121 "Display routes matching the communities\n"
8122 "community number\n"
8123 "Do not send outside local AS (well-known community)\n"
8124 "Do not advertise to any peer (well-known community)\n"
8125 "Do not export to next AS (well-known community)\n"
8126 "community number\n"
8127 "Do not send outside local AS (well-known community)\n"
8128 "Do not advertise to any peer (well-known community)\n"
8129 "Do not export to next AS (well-known community)\n"
8130 "community number\n"
8131 "Do not send outside local AS (well-known community)\n"
8132 "Do not advertise to any peer (well-known community)\n"
8133 "Do not export to next AS (well-known community)\n")
8136 ALIAS (show_ipv6_bgp_community
,
8137 show_ipv6_bgp_community4_cmd
,
8138 "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)",
8142 "Display routes matching the communities\n"
8143 "community number\n"
8144 "Do not send outside local AS (well-known community)\n"
8145 "Do not advertise to any peer (well-known community)\n"
8146 "Do not export to next AS (well-known community)\n"
8147 "community number\n"
8148 "Do not send outside local AS (well-known community)\n"
8149 "Do not advertise to any peer (well-known community)\n"
8150 "Do not export to next AS (well-known community)\n"
8151 "community number\n"
8152 "Do not send outside local AS (well-known community)\n"
8153 "Do not advertise to any peer (well-known community)\n"
8154 "Do not export to next AS (well-known community)\n"
8155 "community number\n"
8156 "Do not send outside local AS (well-known community)\n"
8157 "Do not advertise to any peer (well-known community)\n"
8158 "Do not export to next AS (well-known community)\n")
8160 DEFUN (show_bgp_community_exact
,
8161 show_bgp_community_exact_cmd
,
8162 "show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8165 "Display routes matching the communities\n"
8166 "community number\n"
8167 "Do not send outside local AS (well-known community)\n"
8168 "Do not advertise to any peer (well-known community)\n"
8169 "Do not export to next AS (well-known community)\n"
8170 "Exact match of the communities")
8172 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
8175 ALIAS (show_bgp_community_exact
,
8176 show_bgp_ipv6_community_exact_cmd
,
8177 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8181 "Display routes matching the communities\n"
8182 "community number\n"
8183 "Do not send outside local AS (well-known community)\n"
8184 "Do not advertise to any peer (well-known community)\n"
8185 "Do not export to next AS (well-known community)\n"
8186 "Exact match of the communities")
8188 ALIAS (show_bgp_community_exact
,
8189 show_bgp_community2_exact_cmd
,
8190 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8193 "Display routes matching the communities\n"
8194 "community number\n"
8195 "Do not send outside local AS (well-known community)\n"
8196 "Do not advertise to any peer (well-known community)\n"
8197 "Do not export to next AS (well-known community)\n"
8198 "community number\n"
8199 "Do not send outside local AS (well-known community)\n"
8200 "Do not advertise to any peer (well-known community)\n"
8201 "Do not export to next AS (well-known community)\n"
8202 "Exact match of the communities")
8204 ALIAS (show_bgp_community_exact
,
8205 show_bgp_ipv6_community2_exact_cmd
,
8206 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8210 "Display routes matching the communities\n"
8211 "community number\n"
8212 "Do not send outside local AS (well-known community)\n"
8213 "Do not advertise to any peer (well-known community)\n"
8214 "Do not export to next AS (well-known community)\n"
8215 "community number\n"
8216 "Do not send outside local AS (well-known community)\n"
8217 "Do not advertise to any peer (well-known community)\n"
8218 "Do not export to next AS (well-known community)\n"
8219 "Exact match of the communities")
8221 ALIAS (show_bgp_community_exact
,
8222 show_bgp_community3_exact_cmd
,
8223 "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",
8226 "Display routes matching the communities\n"
8227 "community number\n"
8228 "Do not send outside local AS (well-known community)\n"
8229 "Do not advertise to any peer (well-known community)\n"
8230 "Do not export to next AS (well-known community)\n"
8231 "community number\n"
8232 "Do not send outside local AS (well-known community)\n"
8233 "Do not advertise to any peer (well-known community)\n"
8234 "Do not export to next AS (well-known community)\n"
8235 "community number\n"
8236 "Do not send outside local AS (well-known community)\n"
8237 "Do not advertise to any peer (well-known community)\n"
8238 "Do not export to next AS (well-known community)\n"
8239 "Exact match of the communities")
8241 ALIAS (show_bgp_community_exact
,
8242 show_bgp_ipv6_community3_exact_cmd
,
8243 "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",
8247 "Display routes matching the communities\n"
8248 "community number\n"
8249 "Do not send outside local AS (well-known community)\n"
8250 "Do not advertise to any peer (well-known community)\n"
8251 "Do not export to next AS (well-known community)\n"
8252 "community number\n"
8253 "Do not send outside local AS (well-known community)\n"
8254 "Do not advertise to any peer (well-known community)\n"
8255 "Do not export to next AS (well-known community)\n"
8256 "community number\n"
8257 "Do not send outside local AS (well-known community)\n"
8258 "Do not advertise to any peer (well-known community)\n"
8259 "Do not export to next AS (well-known community)\n"
8260 "Exact match of the communities")
8262 ALIAS (show_bgp_community_exact
,
8263 show_bgp_community4_exact_cmd
,
8264 "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",
8267 "Display routes matching the communities\n"
8268 "community number\n"
8269 "Do not send outside local AS (well-known community)\n"
8270 "Do not advertise to any peer (well-known community)\n"
8271 "Do not export to next AS (well-known community)\n"
8272 "community number\n"
8273 "Do not send outside local AS (well-known community)\n"
8274 "Do not advertise to any peer (well-known community)\n"
8275 "Do not export to next AS (well-known community)\n"
8276 "community number\n"
8277 "Do not send outside local AS (well-known community)\n"
8278 "Do not advertise to any peer (well-known community)\n"
8279 "Do not export to next AS (well-known community)\n"
8280 "community number\n"
8281 "Do not send outside local AS (well-known community)\n"
8282 "Do not advertise to any peer (well-known community)\n"
8283 "Do not export to next AS (well-known community)\n"
8284 "Exact match of the communities")
8286 ALIAS (show_bgp_community_exact
,
8287 show_bgp_ipv6_community4_exact_cmd
,
8288 "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",
8292 "Display routes matching the communities\n"
8293 "community number\n"
8294 "Do not send outside local AS (well-known community)\n"
8295 "Do not advertise to any peer (well-known community)\n"
8296 "Do not export to next AS (well-known community)\n"
8297 "community number\n"
8298 "Do not send outside local AS (well-known community)\n"
8299 "Do not advertise to any peer (well-known community)\n"
8300 "Do not export to next AS (well-known community)\n"
8301 "community number\n"
8302 "Do not send outside local AS (well-known community)\n"
8303 "Do not advertise to any peer (well-known community)\n"
8304 "Do not export to next AS (well-known community)\n"
8305 "community number\n"
8306 "Do not send outside local AS (well-known community)\n"
8307 "Do not advertise to any peer (well-known community)\n"
8308 "Do not export to next AS (well-known community)\n"
8309 "Exact match of the communities")
8312 DEFUN (show_ipv6_bgp_community_exact
,
8313 show_ipv6_bgp_community_exact_cmd
,
8314 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8318 "Display routes matching the communities\n"
8319 "community number\n"
8320 "Do not send outside local AS (well-known community)\n"
8321 "Do not advertise to any peer (well-known community)\n"
8322 "Do not export to next AS (well-known community)\n"
8323 "Exact match of the communities")
8325 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
8329 ALIAS (show_ipv6_bgp_community_exact
,
8330 show_ipv6_bgp_community2_exact_cmd
,
8331 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8335 "Display routes matching the communities\n"
8336 "community number\n"
8337 "Do not send outside local AS (well-known community)\n"
8338 "Do not advertise to any peer (well-known community)\n"
8339 "Do not export to next AS (well-known community)\n"
8340 "community number\n"
8341 "Do not send outside local AS (well-known community)\n"
8342 "Do not advertise to any peer (well-known community)\n"
8343 "Do not export to next AS (well-known community)\n"
8344 "Exact match of the communities")
8347 ALIAS (show_ipv6_bgp_community_exact
,
8348 show_ipv6_bgp_community3_exact_cmd
,
8349 "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",
8353 "Display routes matching the communities\n"
8354 "community number\n"
8355 "Do not send outside local AS (well-known community)\n"
8356 "Do not advertise to any peer (well-known community)\n"
8357 "Do not export to next AS (well-known community)\n"
8358 "community number\n"
8359 "Do not send outside local AS (well-known community)\n"
8360 "Do not advertise to any peer (well-known community)\n"
8361 "Do not export to next AS (well-known community)\n"
8362 "community number\n"
8363 "Do not send outside local AS (well-known community)\n"
8364 "Do not advertise to any peer (well-known community)\n"
8365 "Do not export to next AS (well-known community)\n"
8366 "Exact match of the communities")
8369 ALIAS (show_ipv6_bgp_community_exact
,
8370 show_ipv6_bgp_community4_exact_cmd
,
8371 "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",
8375 "Display routes matching the communities\n"
8376 "community number\n"
8377 "Do not send outside local AS (well-known community)\n"
8378 "Do not advertise to any peer (well-known community)\n"
8379 "Do not export to next AS (well-known community)\n"
8380 "community number\n"
8381 "Do not send outside local AS (well-known community)\n"
8382 "Do not advertise to any peer (well-known community)\n"
8383 "Do not export to next AS (well-known community)\n"
8384 "community number\n"
8385 "Do not send outside local AS (well-known community)\n"
8386 "Do not advertise to any peer (well-known community)\n"
8387 "Do not export to next AS (well-known community)\n"
8388 "community number\n"
8389 "Do not send outside local AS (well-known community)\n"
8390 "Do not advertise to any peer (well-known community)\n"
8391 "Do not export to next AS (well-known community)\n"
8392 "Exact match of the communities")
8395 DEFUN (show_ipv6_mbgp_community
,
8396 show_ipv6_mbgp_community_cmd
,
8397 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export)",
8401 "Display routes matching the communities\n"
8402 "community number\n"
8403 "Do not send outside local AS (well-known community)\n"
8404 "Do not advertise to any peer (well-known community)\n"
8405 "Do not export to next AS (well-known community)\n")
8407 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_MULTICAST
);
8411 ALIAS (show_ipv6_mbgp_community
,
8412 show_ipv6_mbgp_community2_cmd
,
8413 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8417 "Display routes matching the communities\n"
8418 "community number\n"
8419 "Do not send outside local AS (well-known community)\n"
8420 "Do not advertise to any peer (well-known community)\n"
8421 "Do not export to next AS (well-known community)\n"
8422 "community number\n"
8423 "Do not send outside local AS (well-known community)\n"
8424 "Do not advertise to any peer (well-known community)\n"
8425 "Do not export to next AS (well-known community)\n")
8428 ALIAS (show_ipv6_mbgp_community
,
8429 show_ipv6_mbgp_community3_cmd
,
8430 "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)",
8434 "Display routes matching the communities\n"
8435 "community number\n"
8436 "Do not send outside local AS (well-known community)\n"
8437 "Do not advertise to any peer (well-known community)\n"
8438 "Do not export to next AS (well-known community)\n"
8439 "community number\n"
8440 "Do not send outside local AS (well-known community)\n"
8441 "Do not advertise to any peer (well-known community)\n"
8442 "Do not export to next AS (well-known community)\n"
8443 "community number\n"
8444 "Do not send outside local AS (well-known community)\n"
8445 "Do not advertise to any peer (well-known community)\n"
8446 "Do not export to next AS (well-known community)\n")
8449 ALIAS (show_ipv6_mbgp_community
,
8450 show_ipv6_mbgp_community4_cmd
,
8451 "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)",
8455 "Display routes matching the communities\n"
8456 "community number\n"
8457 "Do not send outside local AS (well-known community)\n"
8458 "Do not advertise to any peer (well-known community)\n"
8459 "Do not export to next AS (well-known community)\n"
8460 "community number\n"
8461 "Do not send outside local AS (well-known community)\n"
8462 "Do not advertise to any peer (well-known community)\n"
8463 "Do not export to next AS (well-known community)\n"
8464 "community number\n"
8465 "Do not send outside local AS (well-known community)\n"
8466 "Do not advertise to any peer (well-known community)\n"
8467 "Do not export to next AS (well-known community)\n"
8468 "community number\n"
8469 "Do not send outside local AS (well-known community)\n"
8470 "Do not advertise to any peer (well-known community)\n"
8471 "Do not export to next AS (well-known community)\n")
8474 DEFUN (show_ipv6_mbgp_community_exact
,
8475 show_ipv6_mbgp_community_exact_cmd
,
8476 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8480 "Display routes matching the communities\n"
8481 "community number\n"
8482 "Do not send outside local AS (well-known community)\n"
8483 "Do not advertise to any peer (well-known community)\n"
8484 "Do not export to next AS (well-known community)\n"
8485 "Exact match of the communities")
8487 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_MULTICAST
);
8491 ALIAS (show_ipv6_mbgp_community_exact
,
8492 show_ipv6_mbgp_community2_exact_cmd
,
8493 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8497 "Display routes matching the communities\n"
8498 "community number\n"
8499 "Do not send outside local AS (well-known community)\n"
8500 "Do not advertise to any peer (well-known community)\n"
8501 "Do not export to next AS (well-known community)\n"
8502 "community number\n"
8503 "Do not send outside local AS (well-known community)\n"
8504 "Do not advertise to any peer (well-known community)\n"
8505 "Do not export to next AS (well-known community)\n"
8506 "Exact match of the communities")
8509 ALIAS (show_ipv6_mbgp_community_exact
,
8510 show_ipv6_mbgp_community3_exact_cmd
,
8511 "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",
8515 "Display routes matching the communities\n"
8516 "community number\n"
8517 "Do not send outside local AS (well-known community)\n"
8518 "Do not advertise to any peer (well-known community)\n"
8519 "Do not export to next AS (well-known community)\n"
8520 "community number\n"
8521 "Do not send outside local AS (well-known community)\n"
8522 "Do not advertise to any peer (well-known community)\n"
8523 "Do not export to next AS (well-known community)\n"
8524 "community number\n"
8525 "Do not send outside local AS (well-known community)\n"
8526 "Do not advertise to any peer (well-known community)\n"
8527 "Do not export to next AS (well-known community)\n"
8528 "Exact match of the communities")
8531 ALIAS (show_ipv6_mbgp_community_exact
,
8532 show_ipv6_mbgp_community4_exact_cmd
,
8533 "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",
8537 "Display routes matching the communities\n"
8538 "community number\n"
8539 "Do not send outside local AS (well-known community)\n"
8540 "Do not advertise to any peer (well-known community)\n"
8541 "Do not export to next AS (well-known community)\n"
8542 "community number\n"
8543 "Do not send outside local AS (well-known community)\n"
8544 "Do not advertise to any peer (well-known community)\n"
8545 "Do not export to next AS (well-known community)\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 "Exact match of the communities")
8555 #endif /* HAVE_IPV6 */
8558 bgp_show_community_list (struct vty
*vty
, const char *com
, int exact
,
8559 u_int16_t afi
, u_char safi
)
8561 struct community_list
*list
;
8563 list
= community_list_lookup (bgp_clist
, com
, COMMUNITY_LIST_MASTER
);
8566 vty_out (vty
, "%% %s is not a valid community-list name%s", com
,
8571 return bgp_show (vty
, NULL
, afi
, safi
,
8572 (exact
? bgp_show_type_community_list_exact
:
8573 bgp_show_type_community_list
), list
);
8576 DEFUN (show_ip_bgp_community_list
,
8577 show_ip_bgp_community_list_cmd
,
8578 "show ip bgp community-list (<1-500>|WORD)",
8582 "Display routes matching the community-list\n"
8583 "community-list number\n"
8584 "community-list name\n")
8586 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP
, SAFI_UNICAST
);
8589 DEFUN (show_ip_bgp_ipv4_community_list
,
8590 show_ip_bgp_ipv4_community_list_cmd
,
8591 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)",
8596 "Address Family modifier\n"
8597 "Address Family modifier\n"
8598 "Display routes matching the community-list\n"
8599 "community-list number\n"
8600 "community-list name\n")
8602 if (strncmp (argv
[0], "m", 1) == 0)
8603 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_MULTICAST
);
8605 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_UNICAST
);
8608 DEFUN (show_ip_bgp_community_list_exact
,
8609 show_ip_bgp_community_list_exact_cmd
,
8610 "show ip bgp community-list (<1-500>|WORD) exact-match",
8614 "Display routes matching the community-list\n"
8615 "community-list number\n"
8616 "community-list name\n"
8617 "Exact match of the communities\n")
8619 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP
, SAFI_UNICAST
);
8622 DEFUN (show_ip_bgp_ipv4_community_list_exact
,
8623 show_ip_bgp_ipv4_community_list_exact_cmd
,
8624 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match",
8629 "Address Family modifier\n"
8630 "Address Family modifier\n"
8631 "Display routes matching the community-list\n"
8632 "community-list number\n"
8633 "community-list name\n"
8634 "Exact match of the communities\n")
8636 if (strncmp (argv
[0], "m", 1) == 0)
8637 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_MULTICAST
);
8639 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_UNICAST
);
8643 DEFUN (show_bgp_community_list
,
8644 show_bgp_community_list_cmd
,
8645 "show bgp community-list (<1-500>|WORD)",
8648 "Display routes matching the community-list\n"
8649 "community-list number\n"
8650 "community-list name\n")
8652 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
8655 ALIAS (show_bgp_community_list
,
8656 show_bgp_ipv6_community_list_cmd
,
8657 "show bgp ipv6 community-list (<1-500>|WORD)",
8661 "Display routes matching the community-list\n"
8662 "community-list number\n"
8663 "community-list name\n")
8666 DEFUN (show_ipv6_bgp_community_list
,
8667 show_ipv6_bgp_community_list_cmd
,
8668 "show ipv6 bgp community-list WORD",
8672 "Display routes matching the community-list\n"
8673 "community-list name\n")
8675 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
8679 DEFUN (show_ipv6_mbgp_community_list
,
8680 show_ipv6_mbgp_community_list_cmd
,
8681 "show ipv6 mbgp community-list WORD",
8685 "Display routes matching the community-list\n"
8686 "community-list name\n")
8688 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_MULTICAST
);
8691 DEFUN (show_bgp_community_list_exact
,
8692 show_bgp_community_list_exact_cmd
,
8693 "show bgp community-list (<1-500>|WORD) exact-match",
8696 "Display routes matching the community-list\n"
8697 "community-list number\n"
8698 "community-list name\n"
8699 "Exact match of the communities\n")
8701 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
8704 ALIAS (show_bgp_community_list_exact
,
8705 show_bgp_ipv6_community_list_exact_cmd
,
8706 "show bgp ipv6 community-list (<1-500>|WORD) exact-match",
8710 "Display routes matching the community-list\n"
8711 "community-list number\n"
8712 "community-list name\n"
8713 "Exact match of the communities\n")
8716 DEFUN (show_ipv6_bgp_community_list_exact
,
8717 show_ipv6_bgp_community_list_exact_cmd
,
8718 "show ipv6 bgp community-list WORD exact-match",
8722 "Display routes matching the community-list\n"
8723 "community-list name\n"
8724 "Exact match of the communities\n")
8726 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
8730 DEFUN (show_ipv6_mbgp_community_list_exact
,
8731 show_ipv6_mbgp_community_list_exact_cmd
,
8732 "show ipv6 mbgp community-list WORD exact-match",
8736 "Display routes matching the community-list\n"
8737 "community-list name\n"
8738 "Exact match of the communities\n")
8740 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_MULTICAST
);
8742 #endif /* HAVE_IPV6 */
8745 bgp_show_prefix_longer (struct vty
*vty
, const char *prefix
, afi_t afi
,
8746 safi_t safi
, enum bgp_show_type type
)
8753 ret
= str2prefix (prefix
, p
);
8756 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
8760 ret
= bgp_show (vty
, NULL
, afi
, safi
, type
, p
);
8765 DEFUN (show_ip_bgp_prefix_longer
,
8766 show_ip_bgp_prefix_longer_cmd
,
8767 "show ip bgp A.B.C.D/M longer-prefixes",
8771 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8772 "Display route and more specific routes\n")
8774 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8775 bgp_show_type_prefix_longer
);
8778 DEFUN (show_ip_bgp_flap_prefix_longer
,
8779 show_ip_bgp_flap_prefix_longer_cmd
,
8780 "show ip bgp flap-statistics A.B.C.D/M longer-prefixes",
8784 "Display flap statistics of routes\n"
8785 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8786 "Display route and more specific routes\n")
8788 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8789 bgp_show_type_flap_prefix_longer
);
8792 DEFUN (show_ip_bgp_ipv4_prefix_longer
,
8793 show_ip_bgp_ipv4_prefix_longer_cmd
,
8794 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes",
8799 "Address Family modifier\n"
8800 "Address Family modifier\n"
8801 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8802 "Display route and more specific routes\n")
8804 if (strncmp (argv
[0], "m", 1) == 0)
8805 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
8806 bgp_show_type_prefix_longer
);
8808 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
8809 bgp_show_type_prefix_longer
);
8812 DEFUN (show_ip_bgp_flap_address
,
8813 show_ip_bgp_flap_address_cmd
,
8814 "show ip bgp flap-statistics A.B.C.D",
8818 "Display flap statistics of routes\n"
8819 "Network in the BGP routing table to display\n")
8821 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8822 bgp_show_type_flap_address
);
8825 DEFUN (show_ip_bgp_flap_prefix
,
8826 show_ip_bgp_flap_prefix_cmd
,
8827 "show ip bgp flap-statistics A.B.C.D/M",
8831 "Display flap statistics of routes\n"
8832 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
8834 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8835 bgp_show_type_flap_prefix
);
8838 DEFUN (show_bgp_prefix_longer
,
8839 show_bgp_prefix_longer_cmd
,
8840 "show bgp X:X::X:X/M longer-prefixes",
8843 "IPv6 prefix <network>/<length>\n"
8844 "Display route and more specific routes\n")
8846 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8847 bgp_show_type_prefix_longer
);
8850 ALIAS (show_bgp_prefix_longer
,
8851 show_bgp_ipv6_prefix_longer_cmd
,
8852 "show bgp ipv6 X:X::X:X/M longer-prefixes",
8856 "IPv6 prefix <network>/<length>\n"
8857 "Display route and more specific routes\n")
8860 DEFUN (show_ipv6_bgp_prefix_longer
,
8861 show_ipv6_bgp_prefix_longer_cmd
,
8862 "show ipv6 bgp X:X::X:X/M longer-prefixes",
8866 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
8867 "Display route and more specific routes\n")
8869 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8870 bgp_show_type_prefix_longer
);
8874 DEFUN (show_ipv6_mbgp_prefix_longer
,
8875 show_ipv6_mbgp_prefix_longer_cmd
,
8876 "show ipv6 mbgp X:X::X:X/M longer-prefixes",
8880 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
8881 "Display route and more specific routes\n")
8883 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
8884 bgp_show_type_prefix_longer
);
8886 #endif /* HAVE_IPV6 */
8888 static struct peer
*
8889 peer_lookup_in_view (struct vty
*vty
, const char *view_name
,
8897 /* BGP structure lookup. */
8900 bgp
= bgp_lookup_by_name (view_name
);
8903 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
8909 bgp
= bgp_get_default ();
8912 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
8917 /* Get peer sockunion. */
8918 ret
= str2sockunion (ip_str
, &su
);
8921 vty_out (vty
, "Malformed address: %s%s", ip_str
, VTY_NEWLINE
);
8925 /* Peer structure lookup. */
8926 peer
= peer_lookup (bgp
, &su
);
8929 vty_out (vty
, "No such neighbor%s", VTY_NEWLINE
);
8938 BGP_STATS_MAXBITLEN
= 0,
8942 BGP_STATS_UNAGGREGATEABLE
,
8943 BGP_STATS_MAX_AGGREGATEABLE
,
8944 BGP_STATS_AGGREGATES
,
8946 BGP_STATS_ASPATH_COUNT
,
8947 BGP_STATS_ASPATH_MAXHOPS
,
8948 BGP_STATS_ASPATH_TOTHOPS
,
8949 BGP_STATS_ASPATH_MAXSIZE
,
8950 BGP_STATS_ASPATH_TOTSIZE
,
8951 BGP_STATS_ASN_HIGHEST
,
8955 static const char *table_stats_strs
[] =
8957 [BGP_STATS_PREFIXES
] = "Total Prefixes",
8958 [BGP_STATS_TOTPLEN
] = "Average prefix length",
8959 [BGP_STATS_RIB
] = "Total Advertisements",
8960 [BGP_STATS_UNAGGREGATEABLE
] = "Unaggregateable prefixes",
8961 [BGP_STATS_MAX_AGGREGATEABLE
] = "Maximum aggregateable prefixes",
8962 [BGP_STATS_AGGREGATES
] = "BGP Aggregate advertisements",
8963 [BGP_STATS_SPACE
] = "Address space advertised",
8964 [BGP_STATS_ASPATH_COUNT
] = "Advertisements with paths",
8965 [BGP_STATS_ASPATH_MAXHOPS
] = "Longest AS-Path (hops)",
8966 [BGP_STATS_ASPATH_MAXSIZE
] = "Largest AS-Path (bytes)",
8967 [BGP_STATS_ASPATH_TOTHOPS
] = "Average AS-Path length (hops)",
8968 [BGP_STATS_ASPATH_TOTSIZE
] = "Average AS-Path size (bytes)",
8969 [BGP_STATS_ASN_HIGHEST
] = "Highest public ASN",
8970 [BGP_STATS_MAX
] = NULL
,
8973 struct bgp_table_stats
8975 struct bgp_table
*table
;
8976 unsigned long long counts
[BGP_STATS_MAX
];
8980 #define TALLY_SIGFIG 100000
8981 static unsigned long
8982 ravg_tally (unsigned long count
, unsigned long oldavg
, unsigned long newval
)
8984 unsigned long newtot
= (count
-1) * oldavg
+ (newval
* TALLY_SIGFIG
);
8985 unsigned long res
= (newtot
* TALLY_SIGFIG
) / count
;
8986 unsigned long ret
= newtot
/ count
;
8988 if ((res
% TALLY_SIGFIG
) > (TALLY_SIGFIG
/2))
8996 bgp_table_stats_walker (struct thread
*t
)
8998 struct bgp_node
*rn
;
8999 struct bgp_node
*top
;
9000 struct bgp_table_stats
*ts
= THREAD_ARG (t
);
9001 unsigned int space
= 0;
9003 if (!(top
= bgp_table_top (ts
->table
)))
9006 switch (top
->p
.family
)
9009 space
= IPV4_MAX_BITLEN
;
9012 space
= IPV6_MAX_BITLEN
;
9016 ts
->counts
[BGP_STATS_MAXBITLEN
] = space
;
9018 for (rn
= top
; rn
; rn
= bgp_route_next (rn
))
9020 struct bgp_info
*ri
;
9021 struct bgp_node
*prn
= rn
->parent
;
9022 unsigned int rinum
= 0;
9030 ts
->counts
[BGP_STATS_PREFIXES
]++;
9031 ts
->counts
[BGP_STATS_TOTPLEN
] += rn
->p
.prefixlen
;
9034 ts
->counts
[BGP_STATS_AVGPLEN
]
9035 = ravg_tally (ts
->counts
[BGP_STATS_PREFIXES
],
9036 ts
->counts
[BGP_STATS_AVGPLEN
],
9040 /* check if the prefix is included by any other announcements */
9041 while (prn
&& !prn
->info
)
9044 if (prn
== NULL
|| prn
== top
)
9046 ts
->counts
[BGP_STATS_UNAGGREGATEABLE
]++;
9047 /* announced address space */
9049 ts
->counts
[BGP_STATS_SPACE
] += 1 << (space
- rn
->p
.prefixlen
);
9052 ts
->counts
[BGP_STATS_MAX_AGGREGATEABLE
]++;
9054 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
9057 ts
->counts
[BGP_STATS_RIB
]++;
9060 (CHECK_FLAG (ri
->attr
->flag
,
9061 ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
))))
9062 ts
->counts
[BGP_STATS_AGGREGATES
]++;
9065 if (ri
->attr
&& ri
->attr
->aspath
)
9067 unsigned int hops
= aspath_count_hops (ri
->attr
->aspath
);
9068 unsigned int size
= aspath_size (ri
->attr
->aspath
);
9069 as_t highest
= aspath_highest (ri
->attr
->aspath
);
9071 ts
->counts
[BGP_STATS_ASPATH_COUNT
]++;
9073 if (hops
> ts
->counts
[BGP_STATS_ASPATH_MAXHOPS
])
9074 ts
->counts
[BGP_STATS_ASPATH_MAXHOPS
] = hops
;
9076 if (size
> ts
->counts
[BGP_STATS_ASPATH_MAXSIZE
])
9077 ts
->counts
[BGP_STATS_ASPATH_MAXSIZE
] = size
;
9079 ts
->counts
[BGP_STATS_ASPATH_TOTHOPS
] += hops
;
9080 ts
->counts
[BGP_STATS_ASPATH_TOTSIZE
] += size
;
9082 ts
->counts
[BGP_STATS_ASPATH_AVGHOPS
]
9083 = ravg_tally (ts
->counts
[BGP_STATS_ASPATH_COUNT
],
9084 ts
->counts
[BGP_STATS_ASPATH_AVGHOPS
],
9086 ts
->counts
[BGP_STATS_ASPATH_AVGSIZE
]
9087 = ravg_tally (ts
->counts
[BGP_STATS_ASPATH_COUNT
],
9088 ts
->counts
[BGP_STATS_ASPATH_AVGSIZE
],
9091 if (highest
> ts
->counts
[BGP_STATS_ASN_HIGHEST
])
9092 ts
->counts
[BGP_STATS_ASN_HIGHEST
] = highest
;
9100 bgp_table_stats (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
)
9102 struct bgp_table_stats ts
;
9105 if (!bgp
->rib
[afi
][safi
])
9107 vty_out (vty
, "%% No RIB exist for the AFI/SAFI%s", VTY_NEWLINE
);
9111 memset (&ts
, 0, sizeof (ts
));
9112 ts
.table
= bgp
->rib
[afi
][safi
];
9113 thread_execute (bm
->master
, bgp_table_stats_walker
, &ts
, 0);
9115 vty_out (vty
, "BGP %s RIB statistics%s%s",
9116 afi_safi_print (afi
, safi
), VTY_NEWLINE
, VTY_NEWLINE
);
9118 for (i
= 0; i
< BGP_STATS_MAX
; i
++)
9120 if (!table_stats_strs
[i
])
9126 case BGP_STATS_ASPATH_AVGHOPS
:
9127 case BGP_STATS_ASPATH_AVGSIZE
:
9128 case BGP_STATS_AVGPLEN
:
9129 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9130 vty_out (vty
, "%12.2f",
9131 (float)ts
.counts
[i
] / (float)TALLY_SIGFIG
);
9134 case BGP_STATS_ASPATH_TOTHOPS
:
9135 case BGP_STATS_ASPATH_TOTSIZE
:
9136 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9137 vty_out (vty
, "%12.2f",
9139 (float)ts
.counts
[i
] /
9140 (float)ts
.counts
[BGP_STATS_ASPATH_COUNT
]
9143 case BGP_STATS_TOTPLEN
:
9144 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9145 vty_out (vty
, "%12.2f",
9147 (float)ts
.counts
[i
] /
9148 (float)ts
.counts
[BGP_STATS_PREFIXES
]
9151 case BGP_STATS_SPACE
:
9152 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9153 vty_out (vty
, "%12llu%s", ts
.counts
[i
], VTY_NEWLINE
);
9154 if (ts
.counts
[BGP_STATS_MAXBITLEN
] < 9)
9156 vty_out (vty
, "%30s: ", "%% announced ");
9157 vty_out (vty
, "%12.2f%s",
9158 100 * (float)ts
.counts
[BGP_STATS_SPACE
] /
9159 (float)((uint64_t)1UL << ts
.counts
[BGP_STATS_MAXBITLEN
]),
9161 vty_out (vty
, "%30s: ", "/8 equivalent ");
9162 vty_out (vty
, "%12.2f%s",
9163 (float)ts
.counts
[BGP_STATS_SPACE
] /
9164 (float)(1UL << (ts
.counts
[BGP_STATS_MAXBITLEN
] - 8)),
9166 if (ts
.counts
[BGP_STATS_MAXBITLEN
] < 25)
9168 vty_out (vty
, "%30s: ", "/24 equivalent ");
9169 vty_out (vty
, "%12.2f",
9170 (float)ts
.counts
[BGP_STATS_SPACE
] /
9171 (float)(1UL << (ts
.counts
[BGP_STATS_MAXBITLEN
] - 24)));
9174 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9175 vty_out (vty
, "%12llu", ts
.counts
[i
]);
9178 vty_out (vty
, "%s", VTY_NEWLINE
);
9184 bgp_table_stats_vty (struct vty
*vty
, const char *name
,
9185 const char *afi_str
, const char *safi_str
)
9192 bgp
= bgp_lookup_by_name (name
);
9194 bgp
= bgp_get_default ();
9198 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
9201 if (strncmp (afi_str
, "ipv", 3) == 0)
9203 if (strncmp (afi_str
, "ipv4", 4) == 0)
9205 else if (strncmp (afi_str
, "ipv6", 4) == 0)
9209 vty_out (vty
, "%% Invalid address family %s%s",
9210 afi_str
, VTY_NEWLINE
);
9213 if (strncmp (safi_str
, "m", 1) == 0)
9214 safi
= SAFI_MULTICAST
;
9215 else if (strncmp (safi_str
, "u", 1) == 0)
9216 safi
= SAFI_UNICAST
;
9217 else if (strncmp (safi_str
, "vpnv4", 5) == 0)
9218 safi
= BGP_SAFI_VPNV4
;
9219 else if (strncmp (safi_str
, "vpnv6", 6) == 0)
9220 safi
= BGP_SAFI_VPNV6
;
9223 vty_out (vty
, "%% Invalid subsequent address family %s%s",
9224 safi_str
, VTY_NEWLINE
);
9230 vty_out (vty
, "%% Invalid address family %s%s",
9231 afi_str
, VTY_NEWLINE
);
9235 if ((afi
== AFI_IP
&& safi
== BGP_SAFI_VPNV6
)
9236 || (afi
== AFI_IP6
&& safi
== BGP_SAFI_VPNV4
))
9238 vty_out (vty
, "%% Invalid subsequent address family %s for %s%s",
9239 afi_str
, safi_str
, VTY_NEWLINE
);
9242 return bgp_table_stats (vty
, bgp
, afi
, safi
);
9245 DEFUN (show_bgp_statistics
,
9246 show_bgp_statistics_cmd
,
9247 "show bgp (ipv4|ipv6) (unicast|multicast) statistics",
9252 "Address Family modifier\n"
9253 "Address Family modifier\n"
9254 "BGP RIB advertisement statistics\n")
9256 return bgp_table_stats_vty (vty
, NULL
, argv
[0], argv
[1]);
9259 ALIAS (show_bgp_statistics
,
9260 show_bgp_statistics_vpnv4_cmd
,
9261 "show bgp (ipv4) (vpnv4) statistics",
9265 "Address Family modifier\n"
9266 "BGP RIB advertisement statistics\n")
9268 DEFUN (show_bgp_statistics_view
,
9269 show_bgp_statistics_view_cmd
,
9270 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) statistics",
9276 "Address Family modifier\n"
9277 "Address Family modifier\n"
9278 "BGP RIB advertisement statistics\n")
9280 return bgp_table_stats_vty (vty
, NULL
, argv
[0], argv
[1]);
9283 ALIAS (show_bgp_statistics_view
,
9284 show_bgp_statistics_view_vpnv4_cmd
,
9285 "show bgp view WORD (ipv4) (vpnv4) statistics",
9290 "Address Family modifier\n"
9291 "BGP RIB advertisement statistics\n")
9303 PCOUNT_PFCNT
, /* the figure we display to users */
9307 static const char *pcount_strs
[] =
9309 [PCOUNT_ADJ_IN
] = "Adj-in",
9310 [PCOUNT_DAMPED
] = "Damped",
9311 [PCOUNT_REMOVED
] = "Removed",
9312 [PCOUNT_HISTORY
] = "History",
9313 [PCOUNT_STALE
] = "Stale",
9314 [PCOUNT_VALID
] = "Valid",
9315 [PCOUNT_ALL
] = "All RIB",
9316 [PCOUNT_COUNTED
] = "PfxCt counted",
9317 [PCOUNT_PFCNT
] = "Useable",
9318 [PCOUNT_MAX
] = NULL
,
9323 unsigned int count
[PCOUNT_MAX
];
9324 const struct peer
*peer
;
9325 const struct bgp_table
*table
;
9329 bgp_peer_count_walker (struct thread
*t
)
9331 struct bgp_node
*rn
;
9332 struct peer_pcounts
*pc
= THREAD_ARG (t
);
9333 const struct peer
*peer
= pc
->peer
;
9335 for (rn
= bgp_table_top (pc
->table
); rn
; rn
= bgp_route_next (rn
))
9337 struct bgp_adj_in
*ain
;
9338 struct bgp_info
*ri
;
9340 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
9341 if (ain
->peer
== peer
)
9342 pc
->count
[PCOUNT_ADJ_IN
]++;
9344 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
9346 char buf
[SU_ADDRSTRLEN
];
9348 if (ri
->peer
!= peer
)
9351 pc
->count
[PCOUNT_ALL
]++;
9353 if (CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
))
9354 pc
->count
[PCOUNT_DAMPED
]++;
9355 if (CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
9356 pc
->count
[PCOUNT_HISTORY
]++;
9357 if (CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
))
9358 pc
->count
[PCOUNT_REMOVED
]++;
9359 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
9360 pc
->count
[PCOUNT_STALE
]++;
9361 if (CHECK_FLAG (ri
->flags
, BGP_INFO_VALID
))
9362 pc
->count
[PCOUNT_VALID
]++;
9363 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
9364 pc
->count
[PCOUNT_PFCNT
]++;
9366 if (CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
9368 pc
->count
[PCOUNT_COUNTED
]++;
9369 if (CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
9370 plog_warn (peer
->log
,
9371 "%s [pcount] %s/%d is counted but flags 0x%x",
9373 inet_ntop(rn
->p
.family
, &rn
->p
.u
.prefix
,
9374 buf
, SU_ADDRSTRLEN
),
9380 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
9381 plog_warn (peer
->log
,
9382 "%s [pcount] %s/%d not counted but flags 0x%x",
9384 inet_ntop(rn
->p
.family
, &rn
->p
.u
.prefix
,
9385 buf
, SU_ADDRSTRLEN
),
9395 bgp_peer_counts (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
)
9397 struct peer_pcounts pcounts
= { .peer
= peer
};
9400 if (!peer
|| !peer
->bgp
|| !peer
->afc
[afi
][safi
]
9401 || !peer
->bgp
->rib
[afi
][safi
])
9403 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
9407 memset (&pcounts
, 0, sizeof(pcounts
));
9408 pcounts
.peer
= peer
;
9409 pcounts
.table
= peer
->bgp
->rib
[afi
][safi
];
9411 /* in-place call via thread subsystem so as to record execution time
9412 * stats for the thread-walk (i.e. ensure this can't be blamed on
9413 * on just vty_read()).
9415 thread_execute (bm
->master
, bgp_peer_count_walker
, &pcounts
, 0);
9417 vty_out (vty
, "Prefix counts for %s, %s%s",
9418 peer
->host
, afi_safi_print (afi
, safi
), VTY_NEWLINE
);
9419 vty_out (vty
, "PfxCt: %ld%s", peer
->pcount
[afi
][safi
], VTY_NEWLINE
);
9420 vty_out (vty
, "%sCounts from RIB table walk:%s%s",
9421 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
9423 for (i
= 0; i
< PCOUNT_MAX
; i
++)
9424 vty_out (vty
, "%20s: %-10d%s",
9425 pcount_strs
[i
], pcounts
.count
[i
], VTY_NEWLINE
);
9427 if (pcounts
.count
[PCOUNT_PFCNT
] != peer
->pcount
[afi
][safi
])
9429 vty_out (vty
, "%s [pcount] PfxCt drift!%s",
9430 peer
->host
, VTY_NEWLINE
);
9431 vty_out (vty
, "Please report this bug, with the above command output%s",
9438 DEFUN (show_ip_bgp_neighbor_prefix_counts
,
9439 show_ip_bgp_neighbor_prefix_counts_cmd
,
9440 "show ip bgp neighbors (A.B.C.D|X:X::X:X) prefix-counts",
9444 "Detailed information on TCP and BGP neighbor connections\n"
9445 "Neighbor to display information about\n"
9446 "Neighbor to display information about\n"
9447 "Display detailed prefix count information\n")
9451 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9455 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_UNICAST
);
9458 DEFUN (show_bgp_ipv6_neighbor_prefix_counts
,
9459 show_bgp_ipv6_neighbor_prefix_counts_cmd
,
9460 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) prefix-counts",
9464 "Detailed information on TCP and BGP neighbor connections\n"
9465 "Neighbor to display information about\n"
9466 "Neighbor to display information about\n"
9467 "Display detailed prefix count information\n")
9471 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9475 return bgp_peer_counts (vty
, peer
, AFI_IP6
, SAFI_UNICAST
);
9478 DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts
,
9479 show_ip_bgp_ipv4_neighbor_prefix_counts_cmd
,
9480 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) prefix-counts",
9485 "Address Family modifier\n"
9486 "Address Family modifier\n"
9487 "Detailed information on TCP and BGP neighbor connections\n"
9488 "Neighbor to display information about\n"
9489 "Neighbor to display information about\n"
9490 "Display detailed prefix count information\n")
9494 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
9498 if (strncmp (argv
[0], "m", 1) == 0)
9499 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_MULTICAST
);
9501 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_UNICAST
);
9504 DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts
,
9505 show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd
,
9506 "show ip bgp vpnv4 all neighbors (A.B.C.D|X:X::X:X) prefix-counts",
9511 "Address Family modifier\n"
9512 "Address Family modifier\n"
9513 "Detailed information on TCP and BGP neighbor connections\n"
9514 "Neighbor to display information about\n"
9515 "Neighbor to display information about\n"
9516 "Display detailed prefix count information\n")
9520 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9524 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_MPLS_VPN
);
9529 show_adj_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
,
9532 struct bgp_table
*table
;
9533 struct bgp_adj_in
*ain
;
9534 struct bgp_adj_out
*adj
;
9535 unsigned long output_count
;
9536 struct bgp_node
*rn
;
9546 table
= bgp
->rib
[afi
][safi
];
9550 if (! in
&& CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
9551 PEER_STATUS_DEFAULT_ORIGINATE
))
9553 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
9554 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9555 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9557 vty_out (vty
, "Originating default network 0.0.0.0%s%s",
9558 VTY_NEWLINE
, VTY_NEWLINE
);
9562 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
9565 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
9566 if (ain
->peer
== peer
)
9570 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
9571 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9572 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9577 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
9582 route_vty_out_tmp (vty
, &rn
->p
, ain
->attr
, safi
);
9589 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
)
9590 if (adj
->peer
== peer
)
9594 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
9595 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9596 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9601 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
9606 route_vty_out_tmp (vty
, &rn
->p
, adj
->attr
, safi
);
9612 if (output_count
!= 0)
9613 vty_out (vty
, "%sTotal number of prefixes %ld%s",
9614 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
9618 peer_adj_routes (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
, int in
)
9620 if (! peer
|| ! peer
->afc
[afi
][safi
])
9622 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
9626 if (in
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
9628 vty_out (vty
, "%% Inbound soft reconfiguration not enabled%s",
9633 show_adj_route (vty
, peer
, afi
, safi
, in
);
9638 DEFUN (show_ip_bgp_neighbor_advertised_route
,
9639 show_ip_bgp_neighbor_advertised_route_cmd
,
9640 "show ip bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9644 "Detailed information on TCP and BGP neighbor connections\n"
9645 "Neighbor to display information about\n"
9646 "Neighbor to display information about\n"
9647 "Display the routes advertised to a BGP neighbor\n")
9651 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9655 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0);
9658 DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route
,
9659 show_ip_bgp_ipv4_neighbor_advertised_route_cmd
,
9660 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9665 "Address Family modifier\n"
9666 "Address Family modifier\n"
9667 "Detailed information on TCP and BGP neighbor connections\n"
9668 "Neighbor to display information about\n"
9669 "Neighbor to display information about\n"
9670 "Display the routes advertised to a BGP neighbor\n")
9674 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
9678 if (strncmp (argv
[0], "m", 1) == 0)
9679 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 0);
9681 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0);
9685 DEFUN (show_bgp_view_neighbor_advertised_route
,
9686 show_bgp_view_neighbor_advertised_route_cmd
,
9687 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9692 "Detailed information on TCP and BGP neighbor connections\n"
9693 "Neighbor to display information about\n"
9694 "Neighbor to display information about\n"
9695 "Display the routes advertised to a BGP neighbor\n")
9700 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9702 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9707 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0);
9710 ALIAS (show_bgp_view_neighbor_advertised_route
,
9711 show_bgp_view_ipv6_neighbor_advertised_route_cmd
,
9712 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9718 "Detailed information on TCP and BGP neighbor connections\n"
9719 "Neighbor to display information about\n"
9720 "Neighbor to display information about\n"
9721 "Display the routes advertised to a BGP neighbor\n")
9723 DEFUN (show_bgp_view_neighbor_received_routes
,
9724 show_bgp_view_neighbor_received_routes_cmd
,
9725 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received-routes",
9730 "Detailed information on TCP and BGP neighbor connections\n"
9731 "Neighbor to display information about\n"
9732 "Neighbor to display information about\n"
9733 "Display the received routes from neighbor\n")
9738 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9740 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9745 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 1);
9748 ALIAS (show_bgp_view_neighbor_received_routes
,
9749 show_bgp_view_ipv6_neighbor_received_routes_cmd
,
9750 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
9756 "Detailed information on TCP and BGP neighbor connections\n"
9757 "Neighbor to display information about\n"
9758 "Neighbor to display information about\n"
9759 "Display the received routes from neighbor\n")
9761 ALIAS (show_bgp_view_neighbor_advertised_route
,
9762 show_bgp_neighbor_advertised_route_cmd
,
9763 "show bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9766 "Detailed information on TCP and BGP neighbor connections\n"
9767 "Neighbor to display information about\n"
9768 "Neighbor to display information about\n"
9769 "Display the routes advertised to a BGP neighbor\n")
9771 ALIAS (show_bgp_view_neighbor_advertised_route
,
9772 show_bgp_ipv6_neighbor_advertised_route_cmd
,
9773 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9777 "Detailed information on TCP and BGP neighbor connections\n"
9778 "Neighbor to display information about\n"
9779 "Neighbor to display information about\n"
9780 "Display the routes advertised to a BGP neighbor\n")
9783 ALIAS (show_bgp_view_neighbor_advertised_route
,
9784 ipv6_bgp_neighbor_advertised_route_cmd
,
9785 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9789 "Detailed information on TCP and BGP neighbor connections\n"
9790 "Neighbor to display information about\n"
9791 "Neighbor to display information about\n"
9792 "Display the routes advertised to a BGP neighbor\n")
9795 DEFUN (ipv6_mbgp_neighbor_advertised_route
,
9796 ipv6_mbgp_neighbor_advertised_route_cmd
,
9797 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9801 "Detailed information on TCP and BGP neighbor connections\n"
9802 "Neighbor to display information about\n"
9803 "Neighbor to display information about\n"
9804 "Display the routes advertised to a BGP neighbor\n")
9808 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9812 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 0);
9814 #endif /* HAVE_IPV6 */
9816 DEFUN (show_ip_bgp_neighbor_received_routes
,
9817 show_ip_bgp_neighbor_received_routes_cmd
,
9818 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
9822 "Detailed information on TCP and BGP neighbor connections\n"
9823 "Neighbor to display information about\n"
9824 "Neighbor to display information about\n"
9825 "Display the received routes from neighbor\n")
9829 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9833 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1);
9836 DEFUN (show_ip_bgp_ipv4_neighbor_received_routes
,
9837 show_ip_bgp_ipv4_neighbor_received_routes_cmd
,
9838 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received-routes",
9843 "Address Family modifier\n"
9844 "Address Family modifier\n"
9845 "Detailed information on TCP and BGP neighbor connections\n"
9846 "Neighbor to display information about\n"
9847 "Neighbor to display information about\n"
9848 "Display the received routes from neighbor\n")
9852 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
9856 if (strncmp (argv
[0], "m", 1) == 0)
9857 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 1);
9859 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1);
9862 DEFUN (show_ip_bgp_neighbor_received_prefix_filter
,
9863 show_ip_bgp_neighbor_received_prefix_filter_cmd
,
9864 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
9868 "Detailed information on TCP and BGP neighbor connections\n"
9869 "Neighbor to display information about\n"
9870 "Neighbor to display information about\n"
9871 "Display information received from a BGP neighbor\n"
9872 "Display the prefixlist filter\n")
9875 union sockunion
*su
;
9879 su
= sockunion_str2su (argv
[0]);
9883 peer
= peer_lookup (NULL
, su
);
9887 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
9888 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
9891 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
9892 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
9898 DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter
,
9899 show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
,
9900 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
9905 "Address Family modifier\n"
9906 "Address Family modifier\n"
9907 "Detailed information on TCP and BGP neighbor connections\n"
9908 "Neighbor to display information about\n"
9909 "Neighbor to display information about\n"
9910 "Display information received from a BGP neighbor\n"
9911 "Display the prefixlist filter\n")
9914 union sockunion
*su
;
9918 su
= sockunion_str2su (argv
[1]);
9922 peer
= peer_lookup (NULL
, su
);
9926 if (strncmp (argv
[0], "m", 1) == 0)
9928 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_MULTICAST
);
9929 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
9932 vty_out (vty
, "Address family: IPv4 Multicast%s", VTY_NEWLINE
);
9933 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
9938 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
9939 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
9942 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
9943 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
9952 ALIAS (show_bgp_view_neighbor_received_routes
,
9953 show_bgp_neighbor_received_routes_cmd
,
9954 "show bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
9957 "Detailed information on TCP and BGP neighbor connections\n"
9958 "Neighbor to display information about\n"
9959 "Neighbor to display information about\n"
9960 "Display the received routes from neighbor\n")
9962 ALIAS (show_bgp_view_neighbor_received_routes
,
9963 show_bgp_ipv6_neighbor_received_routes_cmd
,
9964 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
9968 "Detailed information on TCP and BGP neighbor connections\n"
9969 "Neighbor to display information about\n"
9970 "Neighbor to display information about\n"
9971 "Display the received routes from neighbor\n")
9973 DEFUN (show_bgp_neighbor_received_prefix_filter
,
9974 show_bgp_neighbor_received_prefix_filter_cmd
,
9975 "show bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
9978 "Detailed information on TCP and BGP neighbor connections\n"
9979 "Neighbor to display information about\n"
9980 "Neighbor to display information about\n"
9981 "Display information received from a BGP neighbor\n"
9982 "Display the prefixlist filter\n")
9985 union sockunion
*su
;
9989 su
= sockunion_str2su (argv
[0]);
9993 peer
= peer_lookup (NULL
, su
);
9997 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
9998 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
10001 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
10002 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
10005 return CMD_SUCCESS
;
10008 ALIAS (show_bgp_neighbor_received_prefix_filter
,
10009 show_bgp_ipv6_neighbor_received_prefix_filter_cmd
,
10010 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
10014 "Detailed information on TCP and BGP neighbor connections\n"
10015 "Neighbor to display information about\n"
10016 "Neighbor to display information about\n"
10017 "Display information received from a BGP neighbor\n"
10018 "Display the prefixlist filter\n")
10021 ALIAS (show_bgp_view_neighbor_received_routes
,
10022 ipv6_bgp_neighbor_received_routes_cmd
,
10023 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
10027 "Detailed information on TCP and BGP neighbor connections\n"
10028 "Neighbor to display information about\n"
10029 "Neighbor to display information about\n"
10030 "Display the received routes from neighbor\n")
10033 DEFUN (ipv6_mbgp_neighbor_received_routes
,
10034 ipv6_mbgp_neighbor_received_routes_cmd
,
10035 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) received-routes",
10039 "Detailed information on TCP and BGP neighbor connections\n"
10040 "Neighbor to display information about\n"
10041 "Neighbor to display information about\n"
10042 "Display the received routes from neighbor\n")
10046 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10048 return CMD_WARNING
;
10050 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 1);
10053 DEFUN (show_bgp_view_neighbor_received_prefix_filter
,
10054 show_bgp_view_neighbor_received_prefix_filter_cmd
,
10055 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
10060 "Detailed information on TCP and BGP neighbor connections\n"
10061 "Neighbor to display information about\n"
10062 "Neighbor to display information about\n"
10063 "Display information received from a BGP neighbor\n"
10064 "Display the prefixlist filter\n")
10067 union sockunion
*su
;
10072 /* BGP structure lookup. */
10073 bgp
= bgp_lookup_by_name (argv
[0]);
10076 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10077 return CMD_WARNING
;
10080 su
= sockunion_str2su (argv
[1]);
10082 return CMD_WARNING
;
10084 peer
= peer_lookup (bgp
, su
);
10086 return CMD_WARNING
;
10088 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
10089 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
10092 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
10093 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
10096 return CMD_SUCCESS
;
10099 ALIAS (show_bgp_view_neighbor_received_prefix_filter
,
10100 show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
,
10101 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
10107 "Detailed information on TCP and BGP neighbor connections\n"
10108 "Neighbor to display information about\n"
10109 "Neighbor to display information about\n"
10110 "Display information received from a BGP neighbor\n"
10111 "Display the prefixlist filter\n")
10112 #endif /* HAVE_IPV6 */
10115 bgp_show_neighbor_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
10116 safi_t safi
, enum bgp_show_type type
)
10118 if (! peer
|| ! peer
->afc
[afi
][safi
])
10120 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
10121 return CMD_WARNING
;
10124 return bgp_show (vty
, peer
->bgp
, afi
, safi
, type
, &peer
->su
);
10127 DEFUN (show_ip_bgp_neighbor_routes
,
10128 show_ip_bgp_neighbor_routes_cmd
,
10129 "show ip bgp neighbors (A.B.C.D|X:X::X:X) routes",
10133 "Detailed information on TCP and BGP neighbor connections\n"
10134 "Neighbor to display information about\n"
10135 "Neighbor to display information about\n"
10136 "Display routes learned from neighbor\n")
10140 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10142 return CMD_WARNING
;
10144 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
10145 bgp_show_type_neighbor
);
10148 DEFUN (show_ip_bgp_neighbor_flap
,
10149 show_ip_bgp_neighbor_flap_cmd
,
10150 "show ip bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
10154 "Detailed information on TCP and BGP neighbor connections\n"
10155 "Neighbor to display information about\n"
10156 "Neighbor to display information about\n"
10157 "Display flap statistics of the routes learned from neighbor\n")
10161 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10163 return CMD_WARNING
;
10165 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
10166 bgp_show_type_flap_neighbor
);
10169 DEFUN (show_ip_bgp_neighbor_damp
,
10170 show_ip_bgp_neighbor_damp_cmd
,
10171 "show ip bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
10175 "Detailed information on TCP and BGP neighbor connections\n"
10176 "Neighbor to display information about\n"
10177 "Neighbor to display information about\n"
10178 "Display the dampened routes received from neighbor\n")
10182 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10184 return CMD_WARNING
;
10186 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
10187 bgp_show_type_damp_neighbor
);
10190 DEFUN (show_ip_bgp_ipv4_neighbor_routes
,
10191 show_ip_bgp_ipv4_neighbor_routes_cmd
,
10192 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) routes",
10197 "Address Family modifier\n"
10198 "Address Family modifier\n"
10199 "Detailed information on TCP and BGP neighbor connections\n"
10200 "Neighbor to display information about\n"
10201 "Neighbor to display information about\n"
10202 "Display routes learned from neighbor\n")
10206 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
10208 return CMD_WARNING
;
10210 if (strncmp (argv
[0], "m", 1) == 0)
10211 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_MULTICAST
,
10212 bgp_show_type_neighbor
);
10214 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
10215 bgp_show_type_neighbor
);
10218 DEFUN (show_ip_bgp_view_rsclient
,
10219 show_ip_bgp_view_rsclient_cmd
,
10220 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X)",
10226 "Information about Route Server Client\n"
10229 struct bgp_table
*table
;
10233 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10235 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10238 return CMD_WARNING
;
10240 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
10242 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10244 return CMD_WARNING
;
10247 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
10248 PEER_FLAG_RSERVER_CLIENT
))
10250 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10252 return CMD_WARNING
;
10255 table
= peer
->rib
[AFI_IP
][SAFI_UNICAST
];
10257 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
10260 ALIAS (show_ip_bgp_view_rsclient
,
10261 show_ip_bgp_rsclient_cmd
,
10262 "show ip bgp rsclient (A.B.C.D|X:X::X:X)",
10266 "Information about Route Server Client\n"
10269 DEFUN (show_ip_bgp_view_rsclient_route
,
10270 show_ip_bgp_view_rsclient_route_cmd
,
10271 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
10277 "Information about Route Server Client\n"
10279 "Network in the BGP routing table to display\n")
10284 /* BGP structure lookup. */
10287 bgp
= bgp_lookup_by_name (argv
[0]);
10290 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10291 return CMD_WARNING
;
10296 bgp
= bgp_get_default ();
10299 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
10300 return CMD_WARNING
;
10305 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10307 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10310 return CMD_WARNING
;
10312 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
10314 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10316 return CMD_WARNING
;
10319 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
10320 PEER_FLAG_RSERVER_CLIENT
))
10322 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10324 return CMD_WARNING
;
10327 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
10328 (argc
== 3) ? argv
[2] : argv
[1],
10329 AFI_IP
, SAFI_UNICAST
, NULL
, 0);
10332 ALIAS (show_ip_bgp_view_rsclient_route
,
10333 show_ip_bgp_rsclient_route_cmd
,
10334 "show ip bgp rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
10338 "Information about Route Server Client\n"
10340 "Network in the BGP routing table to display\n")
10342 DEFUN (show_ip_bgp_view_rsclient_prefix
,
10343 show_ip_bgp_view_rsclient_prefix_cmd
,
10344 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
10350 "Information about Route Server Client\n"
10352 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
10357 /* BGP structure lookup. */
10360 bgp
= bgp_lookup_by_name (argv
[0]);
10363 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10364 return CMD_WARNING
;
10369 bgp
= bgp_get_default ();
10372 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
10373 return CMD_WARNING
;
10378 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10380 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10383 return CMD_WARNING
;
10385 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
10387 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10389 return CMD_WARNING
;
10392 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
10393 PEER_FLAG_RSERVER_CLIENT
))
10395 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10397 return CMD_WARNING
;
10400 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
10401 (argc
== 3) ? argv
[2] : argv
[1],
10402 AFI_IP
, SAFI_UNICAST
, NULL
, 1);
10405 ALIAS (show_ip_bgp_view_rsclient_prefix
,
10406 show_ip_bgp_rsclient_prefix_cmd
,
10407 "show ip bgp rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
10411 "Information about Route Server Client\n"
10413 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
10417 DEFUN (show_bgp_view_neighbor_routes
,
10418 show_bgp_view_neighbor_routes_cmd
,
10419 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) routes",
10424 "Detailed information on TCP and BGP neighbor connections\n"
10425 "Neighbor to display information about\n"
10426 "Neighbor to display information about\n"
10427 "Display routes learned from neighbor\n")
10432 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10434 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10437 return CMD_WARNING
;
10439 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
10440 bgp_show_type_neighbor
);
10443 ALIAS (show_bgp_view_neighbor_routes
,
10444 show_bgp_view_ipv6_neighbor_routes_cmd
,
10445 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) routes",
10451 "Detailed information on TCP and BGP neighbor connections\n"
10452 "Neighbor to display information about\n"
10453 "Neighbor to display information about\n"
10454 "Display routes learned from neighbor\n")
10456 DEFUN (show_bgp_view_neighbor_damp
,
10457 show_bgp_view_neighbor_damp_cmd
,
10458 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) dampened-routes",
10463 "Detailed information on TCP and BGP neighbor connections\n"
10464 "Neighbor to display information about\n"
10465 "Neighbor to display information about\n"
10466 "Display the dampened routes received from neighbor\n")
10471 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10473 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10476 return CMD_WARNING
;
10478 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
10479 bgp_show_type_damp_neighbor
);
10482 ALIAS (show_bgp_view_neighbor_damp
,
10483 show_bgp_view_ipv6_neighbor_damp_cmd
,
10484 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes",
10490 "Detailed information on TCP and BGP neighbor connections\n"
10491 "Neighbor to display information about\n"
10492 "Neighbor to display information about\n"
10493 "Display the dampened routes received from neighbor\n")
10495 DEFUN (show_bgp_view_neighbor_flap
,
10496 show_bgp_view_neighbor_flap_cmd
,
10497 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) flap-statistics",
10502 "Detailed information on TCP and BGP neighbor connections\n"
10503 "Neighbor to display information about\n"
10504 "Neighbor to display information about\n"
10505 "Display flap statistics of the routes learned from neighbor\n")
10510 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10512 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10515 return CMD_WARNING
;
10517 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
10518 bgp_show_type_flap_neighbor
);
10521 ALIAS (show_bgp_view_neighbor_flap
,
10522 show_bgp_view_ipv6_neighbor_flap_cmd
,
10523 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics",
10529 "Detailed information on TCP and BGP neighbor connections\n"
10530 "Neighbor to display information about\n"
10531 "Neighbor to display information about\n"
10532 "Display flap statistics of the routes learned from neighbor\n")
10534 ALIAS (show_bgp_view_neighbor_routes
,
10535 show_bgp_neighbor_routes_cmd
,
10536 "show bgp neighbors (A.B.C.D|X:X::X:X) routes",
10539 "Detailed information on TCP and BGP neighbor connections\n"
10540 "Neighbor to display information about\n"
10541 "Neighbor to display information about\n"
10542 "Display routes learned from neighbor\n")
10545 ALIAS (show_bgp_view_neighbor_routes
,
10546 show_bgp_ipv6_neighbor_routes_cmd
,
10547 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) routes",
10551 "Detailed information on TCP and BGP neighbor connections\n"
10552 "Neighbor to display information about\n"
10553 "Neighbor to display information about\n"
10554 "Display routes learned from neighbor\n")
10557 ALIAS (show_bgp_view_neighbor_routes
,
10558 ipv6_bgp_neighbor_routes_cmd
,
10559 "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X) routes",
10563 "Detailed information on TCP and BGP neighbor connections\n"
10564 "Neighbor to display information about\n"
10565 "Neighbor to display information about\n"
10566 "Display routes learned from neighbor\n")
10569 DEFUN (ipv6_mbgp_neighbor_routes
,
10570 ipv6_mbgp_neighbor_routes_cmd
,
10571 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) routes",
10575 "Detailed information on TCP and BGP neighbor connections\n"
10576 "Neighbor to display information about\n"
10577 "Neighbor to display information about\n"
10578 "Display routes learned from neighbor\n")
10582 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10584 return CMD_WARNING
;
10586 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
,
10587 bgp_show_type_neighbor
);
10590 ALIAS (show_bgp_view_neighbor_flap
,
10591 show_bgp_neighbor_flap_cmd
,
10592 "show bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
10595 "Detailed information on TCP and BGP neighbor connections\n"
10596 "Neighbor to display information about\n"
10597 "Neighbor to display information about\n"
10598 "Display flap statistics of the routes learned from neighbor\n")
10600 ALIAS (show_bgp_view_neighbor_flap
,
10601 show_bgp_ipv6_neighbor_flap_cmd
,
10602 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics",
10606 "Detailed information on TCP and BGP neighbor connections\n"
10607 "Neighbor to display information about\n"
10608 "Neighbor to display information about\n"
10609 "Display flap statistics of the routes learned from neighbor\n")
10611 ALIAS (show_bgp_view_neighbor_damp
,
10612 show_bgp_neighbor_damp_cmd
,
10613 "show bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
10616 "Detailed information on TCP and BGP neighbor connections\n"
10617 "Neighbor to display information about\n"
10618 "Neighbor to display information about\n"
10619 "Display the dampened routes received from neighbor\n")
10621 ALIAS (show_bgp_view_neighbor_damp
,
10622 show_bgp_ipv6_neighbor_damp_cmd
,
10623 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes",
10627 "Detailed information on TCP and BGP neighbor connections\n"
10628 "Neighbor to display information about\n"
10629 "Neighbor to display information about\n"
10630 "Display the dampened routes received from neighbor\n")
10632 DEFUN (show_bgp_view_rsclient
,
10633 show_bgp_view_rsclient_cmd
,
10634 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X)",
10639 "Information about Route Server Client\n"
10642 struct bgp_table
*table
;
10646 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10648 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10651 return CMD_WARNING
;
10653 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
10655 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10657 return CMD_WARNING
;
10660 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
10661 PEER_FLAG_RSERVER_CLIENT
))
10663 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10665 return CMD_WARNING
;
10668 table
= peer
->rib
[AFI_IP6
][SAFI_UNICAST
];
10670 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
10673 ALIAS (show_bgp_view_rsclient
,
10674 show_bgp_rsclient_cmd
,
10675 "show bgp rsclient (A.B.C.D|X:X::X:X)",
10678 "Information about Route Server Client\n"
10681 DEFUN (show_bgp_view_rsclient_route
,
10682 show_bgp_view_rsclient_route_cmd
,
10683 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
10688 "Information about Route Server Client\n"
10690 "Network in the BGP routing table to display\n")
10695 /* BGP structure lookup. */
10698 bgp
= bgp_lookup_by_name (argv
[0]);
10701 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10702 return CMD_WARNING
;
10707 bgp
= bgp_get_default ();
10710 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
10711 return CMD_WARNING
;
10716 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10718 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10721 return CMD_WARNING
;
10723 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
10725 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10727 return CMD_WARNING
;
10730 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
10731 PEER_FLAG_RSERVER_CLIENT
))
10733 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10735 return CMD_WARNING
;
10738 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
10739 (argc
== 3) ? argv
[2] : argv
[1],
10740 AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
10743 ALIAS (show_bgp_view_rsclient_route
,
10744 show_bgp_rsclient_route_cmd
,
10745 "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
10748 "Information about Route Server Client\n"
10750 "Network in the BGP routing table to display\n")
10752 DEFUN (show_bgp_view_rsclient_prefix
,
10753 show_bgp_view_rsclient_prefix_cmd
,
10754 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
10759 "Information about Route Server Client\n"
10761 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
10766 /* BGP structure lookup. */
10769 bgp
= bgp_lookup_by_name (argv
[0]);
10772 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10773 return CMD_WARNING
;
10778 bgp
= bgp_get_default ();
10781 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
10782 return CMD_WARNING
;
10787 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10789 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10792 return CMD_WARNING
;
10794 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
10796 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10798 return CMD_WARNING
;
10801 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
10802 PEER_FLAG_RSERVER_CLIENT
))
10804 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10806 return CMD_WARNING
;
10809 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
10810 (argc
== 3) ? argv
[2] : argv
[1],
10811 AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
10814 ALIAS (show_bgp_view_rsclient_prefix
,
10815 show_bgp_rsclient_prefix_cmd
,
10816 "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
10819 "Information about Route Server Client\n"
10821 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
10823 #endif /* HAVE_IPV6 */
10825 struct bgp_table
*bgp_distance_table
;
10827 struct bgp_distance
10829 /* Distance value for the IP source prefix. */
10832 /* Name of the access-list to be matched. */
10836 static struct bgp_distance
*
10837 bgp_distance_new (void)
10839 return XCALLOC (MTYPE_BGP_DISTANCE
, sizeof (struct bgp_distance
));
10843 bgp_distance_free (struct bgp_distance
*bdistance
)
10845 XFREE (MTYPE_BGP_DISTANCE
, bdistance
);
10849 bgp_distance_set (struct vty
*vty
, const char *distance_str
,
10850 const char *ip_str
, const char *access_list_str
)
10853 struct prefix_ipv4 p
;
10855 struct bgp_node
*rn
;
10856 struct bgp_distance
*bdistance
;
10858 ret
= str2prefix_ipv4 (ip_str
, &p
);
10861 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
10862 return CMD_WARNING
;
10865 distance
= atoi (distance_str
);
10867 /* Get BGP distance node. */
10868 rn
= bgp_node_get (bgp_distance_table
, (struct prefix
*) &p
);
10871 bdistance
= rn
->info
;
10872 bgp_unlock_node (rn
);
10876 bdistance
= bgp_distance_new ();
10877 rn
->info
= bdistance
;
10880 /* Set distance value. */
10881 bdistance
->distance
= distance
;
10883 /* Reset access-list configuration. */
10884 if (bdistance
->access_list
)
10886 free (bdistance
->access_list
);
10887 bdistance
->access_list
= NULL
;
10889 if (access_list_str
)
10890 bdistance
->access_list
= strdup (access_list_str
);
10892 return CMD_SUCCESS
;
10896 bgp_distance_unset (struct vty
*vty
, const char *distance_str
,
10897 const char *ip_str
, const char *access_list_str
)
10900 struct prefix_ipv4 p
;
10902 struct bgp_node
*rn
;
10903 struct bgp_distance
*bdistance
;
10905 ret
= str2prefix_ipv4 (ip_str
, &p
);
10908 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
10909 return CMD_WARNING
;
10912 distance
= atoi (distance_str
);
10914 rn
= bgp_node_lookup (bgp_distance_table
, (struct prefix
*)&p
);
10917 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
10918 return CMD_WARNING
;
10921 bdistance
= rn
->info
;
10923 if (bdistance
->access_list
)
10924 free (bdistance
->access_list
);
10925 bgp_distance_free (bdistance
);
10928 bgp_unlock_node (rn
);
10929 bgp_unlock_node (rn
);
10931 return CMD_SUCCESS
;
10935 bgp_distance_reset (void)
10937 struct bgp_node
*rn
;
10938 struct bgp_distance
*bdistance
;
10940 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
10941 if ((bdistance
= rn
->info
) != NULL
)
10943 if (bdistance
->access_list
)
10944 free (bdistance
->access_list
);
10945 bgp_distance_free (bdistance
);
10947 bgp_unlock_node (rn
);
10951 /* Apply BGP information to distance method. */
10953 bgp_distance_apply (struct prefix
*p
, struct bgp_info
*rinfo
, struct bgp
*bgp
)
10955 struct bgp_node
*rn
;
10956 struct prefix_ipv4 q
;
10958 struct bgp_distance
*bdistance
;
10959 struct access_list
*alist
;
10960 struct bgp_static
*bgp_static
;
10965 if (p
->family
!= AF_INET
)
10968 peer
= rinfo
->peer
;
10970 if (peer
->su
.sa
.sa_family
!= AF_INET
)
10973 memset (&q
, 0, sizeof (struct prefix_ipv4
));
10974 q
.family
= AF_INET
;
10975 q
.prefix
= peer
->su
.sin
.sin_addr
;
10976 q
.prefixlen
= IPV4_MAX_BITLEN
;
10978 /* Check source address. */
10979 rn
= bgp_node_match (bgp_distance_table
, (struct prefix
*) &q
);
10982 bdistance
= rn
->info
;
10983 bgp_unlock_node (rn
);
10985 if (bdistance
->access_list
)
10987 alist
= access_list_lookup (AFI_IP
, bdistance
->access_list
);
10988 if (alist
&& access_list_apply (alist
, p
) == FILTER_PERMIT
)
10989 return bdistance
->distance
;
10992 return bdistance
->distance
;
10995 /* Backdoor check. */
10996 rn
= bgp_node_lookup (bgp
->route
[AFI_IP
][SAFI_UNICAST
], p
);
10999 bgp_static
= rn
->info
;
11000 bgp_unlock_node (rn
);
11002 if (bgp_static
->backdoor
)
11004 if (bgp
->distance_local
)
11005 return bgp
->distance_local
;
11007 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
11011 if (peer_sort (peer
) == BGP_PEER_EBGP
)
11013 if (bgp
->distance_ebgp
)
11014 return bgp
->distance_ebgp
;
11015 return ZEBRA_EBGP_DISTANCE_DEFAULT
;
11019 if (bgp
->distance_ibgp
)
11020 return bgp
->distance_ibgp
;
11021 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
11025 DEFUN (bgp_distance
,
11027 "distance bgp <1-255> <1-255> <1-255>",
11028 "Define an administrative distance\n"
11030 "Distance for routes external to the AS\n"
11031 "Distance for routes internal to the AS\n"
11032 "Distance for local routes\n")
11038 bgp
->distance_ebgp
= atoi (argv
[0]);
11039 bgp
->distance_ibgp
= atoi (argv
[1]);
11040 bgp
->distance_local
= atoi (argv
[2]);
11041 return CMD_SUCCESS
;
11044 DEFUN (no_bgp_distance
,
11045 no_bgp_distance_cmd
,
11046 "no distance bgp <1-255> <1-255> <1-255>",
11048 "Define an administrative distance\n"
11050 "Distance for routes external to the AS\n"
11051 "Distance for routes internal to the AS\n"
11052 "Distance for local routes\n")
11058 bgp
->distance_ebgp
= 0;
11059 bgp
->distance_ibgp
= 0;
11060 bgp
->distance_local
= 0;
11061 return CMD_SUCCESS
;
11064 ALIAS (no_bgp_distance
,
11065 no_bgp_distance2_cmd
,
11068 "Define an administrative distance\n"
11071 DEFUN (bgp_distance_source
,
11072 bgp_distance_source_cmd
,
11073 "distance <1-255> A.B.C.D/M",
11074 "Define an administrative distance\n"
11075 "Administrative distance\n"
11076 "IP source prefix\n")
11078 bgp_distance_set (vty
, argv
[0], argv
[1], NULL
);
11079 return CMD_SUCCESS
;
11082 DEFUN (no_bgp_distance_source
,
11083 no_bgp_distance_source_cmd
,
11084 "no distance <1-255> A.B.C.D/M",
11086 "Define an administrative distance\n"
11087 "Administrative distance\n"
11088 "IP source prefix\n")
11090 bgp_distance_unset (vty
, argv
[0], argv
[1], NULL
);
11091 return CMD_SUCCESS
;
11094 DEFUN (bgp_distance_source_access_list
,
11095 bgp_distance_source_access_list_cmd
,
11096 "distance <1-255> A.B.C.D/M WORD",
11097 "Define an administrative distance\n"
11098 "Administrative distance\n"
11099 "IP source prefix\n"
11100 "Access list name\n")
11102 bgp_distance_set (vty
, argv
[0], argv
[1], argv
[2]);
11103 return CMD_SUCCESS
;
11106 DEFUN (no_bgp_distance_source_access_list
,
11107 no_bgp_distance_source_access_list_cmd
,
11108 "no distance <1-255> A.B.C.D/M WORD",
11110 "Define an administrative distance\n"
11111 "Administrative distance\n"
11112 "IP source prefix\n"
11113 "Access list name\n")
11115 bgp_distance_unset (vty
, argv
[0], argv
[1], argv
[2]);
11116 return CMD_SUCCESS
;
11119 DEFUN (bgp_damp_set
,
11121 "bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
11122 "BGP Specific commands\n"
11123 "Enable route-flap dampening\n"
11124 "Half-life time for the penalty\n"
11125 "Value to start reusing a route\n"
11126 "Value to start suppressing a route\n"
11127 "Maximum duration to suppress a stable route\n")
11130 int half
= DEFAULT_HALF_LIFE
* 60;
11131 int reuse
= DEFAULT_REUSE
;
11132 int suppress
= DEFAULT_SUPPRESS
;
11133 int max
= 4 * half
;
11137 half
= atoi (argv
[0]) * 60;
11138 reuse
= atoi (argv
[1]);
11139 suppress
= atoi (argv
[2]);
11140 max
= atoi (argv
[3]) * 60;
11142 else if (argc
== 1)
11144 half
= atoi (argv
[0]) * 60;
11149 return bgp_damp_enable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
),
11150 half
, reuse
, suppress
, max
);
11153 ALIAS (bgp_damp_set
,
11155 "bgp dampening <1-45>",
11156 "BGP Specific commands\n"
11157 "Enable route-flap dampening\n"
11158 "Half-life time for the penalty\n")
11160 ALIAS (bgp_damp_set
,
11163 "BGP Specific commands\n"
11164 "Enable route-flap dampening\n")
11166 DEFUN (bgp_damp_unset
,
11167 bgp_damp_unset_cmd
,
11168 "no bgp dampening",
11170 "BGP Specific commands\n"
11171 "Enable route-flap dampening\n")
11176 return bgp_damp_disable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
));
11179 ALIAS (bgp_damp_unset
,
11180 bgp_damp_unset2_cmd
,
11181 "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
11183 "BGP Specific commands\n"
11184 "Enable route-flap dampening\n"
11185 "Half-life time for the penalty\n"
11186 "Value to start reusing a route\n"
11187 "Value to start suppressing a route\n"
11188 "Maximum duration to suppress a stable route\n")
11190 DEFUN (show_ip_bgp_dampened_paths
,
11191 show_ip_bgp_dampened_paths_cmd
,
11192 "show ip bgp dampened-paths",
11196 "Display paths suppressed due to dampening\n")
11198 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_dampend_paths
,
11202 DEFUN (show_ip_bgp_flap_statistics
,
11203 show_ip_bgp_flap_statistics_cmd
,
11204 "show ip bgp flap-statistics",
11208 "Display flap statistics of routes\n")
11210 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
11211 bgp_show_type_flap_statistics
, NULL
);
11214 /* Display specified route of BGP table. */
11216 bgp_clear_damp_route (struct vty
*vty
, const char *view_name
,
11217 const char *ip_str
, afi_t afi
, safi_t safi
,
11218 struct prefix_rd
*prd
, int prefix_check
)
11221 struct prefix match
;
11222 struct bgp_node
*rn
;
11223 struct bgp_node
*rm
;
11224 struct bgp_info
*ri
;
11225 struct bgp_info
*ri_temp
;
11227 struct bgp_table
*table
;
11229 /* BGP structure lookup. */
11232 bgp
= bgp_lookup_by_name (view_name
);
11235 vty_out (vty
, "%% Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
11236 return CMD_WARNING
;
11241 bgp
= bgp_get_default ();
11244 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
11245 return CMD_WARNING
;
11249 /* Check IP address argument. */
11250 ret
= str2prefix (ip_str
, &match
);
11253 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
11254 return CMD_WARNING
;
11257 match
.family
= afi2family (afi
);
11259 if (safi
== SAFI_MPLS_VPN
)
11261 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= bgp_route_next (rn
))
11263 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
11266 if ((table
= rn
->info
) != NULL
)
11267 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
11268 if (! prefix_check
|| rm
->p
.prefixlen
== match
.prefixlen
)
11273 if (ri
->extra
&& ri
->extra
->damp_info
)
11275 ri_temp
= ri
->next
;
11276 bgp_damp_info_free (ri
->extra
->damp_info
, 1);
11287 if ((rn
= bgp_node_match (bgp
->rib
[afi
][safi
], &match
)) != NULL
)
11288 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
11293 if (ri
->extra
&& ri
->extra
->damp_info
)
11295 ri_temp
= ri
->next
;
11296 bgp_damp_info_free (ri
->extra
->damp_info
, 1);
11305 return CMD_SUCCESS
;
11308 DEFUN (clear_ip_bgp_dampening
,
11309 clear_ip_bgp_dampening_cmd
,
11310 "clear ip bgp dampening",
11314 "Clear route flap dampening information\n")
11316 bgp_damp_info_clean ();
11317 return CMD_SUCCESS
;
11320 DEFUN (clear_ip_bgp_dampening_prefix
,
11321 clear_ip_bgp_dampening_prefix_cmd
,
11322 "clear ip bgp dampening A.B.C.D/M",
11326 "Clear route flap dampening information\n"
11327 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
11329 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
11330 SAFI_UNICAST
, NULL
, 1);
11333 DEFUN (clear_ip_bgp_dampening_address
,
11334 clear_ip_bgp_dampening_address_cmd
,
11335 "clear ip bgp dampening A.B.C.D",
11339 "Clear route flap dampening information\n"
11340 "Network to clear damping information\n")
11342 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
11343 SAFI_UNICAST
, NULL
, 0);
11346 DEFUN (clear_ip_bgp_dampening_address_mask
,
11347 clear_ip_bgp_dampening_address_mask_cmd
,
11348 "clear ip bgp dampening A.B.C.D A.B.C.D",
11352 "Clear route flap dampening information\n"
11353 "Network to clear damping information\n"
11357 char prefix_str
[BUFSIZ
];
11359 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
11362 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
11363 return CMD_WARNING
;
11366 return bgp_clear_damp_route (vty
, NULL
, prefix_str
, AFI_IP
,
11367 SAFI_UNICAST
, NULL
, 0);
11371 bgp_config_write_network_vpnv4 (struct vty
*vty
, struct bgp
*bgp
,
11372 afi_t afi
, safi_t safi
, int *write
)
11374 struct bgp_node
*prn
;
11375 struct bgp_node
*rn
;
11376 struct bgp_table
*table
;
11378 struct prefix_rd
*prd
;
11379 struct bgp_static
*bgp_static
;
11381 char buf
[SU_ADDRSTRLEN
];
11382 char rdbuf
[RD_ADDRSTRLEN
];
11384 /* Network configuration. */
11385 for (prn
= bgp_table_top (bgp
->route
[afi
][safi
]); prn
; prn
= bgp_route_next (prn
))
11386 if ((table
= prn
->info
) != NULL
)
11387 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
11388 if ((bgp_static
= rn
->info
) != NULL
)
11391 prd
= (struct prefix_rd
*) &prn
->p
;
11393 /* "address-family" display. */
11394 bgp_config_write_family_header (vty
, afi
, safi
, write
);
11396 /* "network" configuration display. */
11397 prefix_rd2str (prd
, rdbuf
, RD_ADDRSTRLEN
);
11398 label
= decode_label (bgp_static
->tag
);
11400 vty_out (vty
, " network %s/%d rd %s tag %d",
11401 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
11404 vty_out (vty
, "%s", VTY_NEWLINE
);
11409 /* Configuration of static route announcement and aggregate
11412 bgp_config_write_network (struct vty
*vty
, struct bgp
*bgp
,
11413 afi_t afi
, safi_t safi
, int *write
)
11415 struct bgp_node
*rn
;
11417 struct bgp_static
*bgp_static
;
11418 struct bgp_aggregate
*bgp_aggregate
;
11419 char buf
[SU_ADDRSTRLEN
];
11421 if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
11422 return bgp_config_write_network_vpnv4 (vty
, bgp
, afi
, safi
, write
);
11424 /* Network configuration. */
11425 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
11426 if ((bgp_static
= rn
->info
) != NULL
)
11430 /* "address-family" display. */
11431 bgp_config_write_family_header (vty
, afi
, safi
, write
);
11433 /* "network" configuration display. */
11434 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
11436 u_int32_t destination
;
11437 struct in_addr netmask
;
11439 destination
= ntohl (p
->u
.prefix4
.s_addr
);
11440 masklen2ip (p
->prefixlen
, &netmask
);
11441 vty_out (vty
, " network %s",
11442 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
));
11444 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
11445 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
11446 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
11447 || p
->u
.prefix4
.s_addr
== 0)
11449 /* Natural mask is not display. */
11452 vty_out (vty
, " mask %s", inet_ntoa (netmask
));
11456 vty_out (vty
, " network %s/%d",
11457 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
11461 if (bgp_static
->rmap
.name
)
11462 vty_out (vty
, " route-map %s", bgp_static
->rmap
.name
);
11465 if (bgp_static
->backdoor
)
11466 vty_out (vty
, " backdoor");
11467 if (bgp_static
->ttl
)
11468 vty_out (vty
, " pathlimit %u", bgp_static
->ttl
);
11471 vty_out (vty
, "%s", VTY_NEWLINE
);
11474 /* Aggregate-address configuration. */
11475 for (rn
= bgp_table_top (bgp
->aggregate
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
11476 if ((bgp_aggregate
= rn
->info
) != NULL
)
11480 /* "address-family" display. */
11481 bgp_config_write_family_header (vty
, afi
, safi
, write
);
11483 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
11485 struct in_addr netmask
;
11487 masklen2ip (p
->prefixlen
, &netmask
);
11488 vty_out (vty
, " aggregate-address %s %s",
11489 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
11490 inet_ntoa (netmask
));
11494 vty_out (vty
, " aggregate-address %s/%d",
11495 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
11499 if (bgp_aggregate
->as_set
)
11500 vty_out (vty
, " as-set");
11502 if (bgp_aggregate
->summary_only
)
11503 vty_out (vty
, " summary-only");
11505 vty_out (vty
, "%s", VTY_NEWLINE
);
11512 bgp_config_write_distance (struct vty
*vty
, struct bgp
*bgp
)
11514 struct bgp_node
*rn
;
11515 struct bgp_distance
*bdistance
;
11517 /* Distance configuration. */
11518 if (bgp
->distance_ebgp
11519 && bgp
->distance_ibgp
11520 && bgp
->distance_local
11521 && (bgp
->distance_ebgp
!= ZEBRA_EBGP_DISTANCE_DEFAULT
11522 || bgp
->distance_ibgp
!= ZEBRA_IBGP_DISTANCE_DEFAULT
11523 || bgp
->distance_local
!= ZEBRA_IBGP_DISTANCE_DEFAULT
))
11524 vty_out (vty
, " distance bgp %d %d %d%s",
11525 bgp
->distance_ebgp
, bgp
->distance_ibgp
, bgp
->distance_local
,
11528 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
11529 if ((bdistance
= rn
->info
) != NULL
)
11531 vty_out (vty
, " distance %d %s/%d %s%s", bdistance
->distance
,
11532 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
11533 bdistance
->access_list
? bdistance
->access_list
: "",
11540 /* Allocate routing table structure and install commands. */
11542 bgp_route_init (void)
11544 /* Init BGP distance table. */
11545 bgp_distance_table
= bgp_table_init (AFI_IP
, SAFI_UNICAST
);
11547 /* IPv4 BGP commands. */
11548 install_element (BGP_NODE
, &bgp_network_cmd
);
11549 install_element (BGP_NODE
, &bgp_network_mask_cmd
);
11550 install_element (BGP_NODE
, &bgp_network_mask_natural_cmd
);
11551 install_element (BGP_NODE
, &bgp_network_route_map_cmd
);
11552 install_element (BGP_NODE
, &bgp_network_mask_route_map_cmd
);
11553 install_element (BGP_NODE
, &bgp_network_mask_natural_route_map_cmd
);
11554 install_element (BGP_NODE
, &bgp_network_backdoor_cmd
);
11555 install_element (BGP_NODE
, &bgp_network_mask_backdoor_cmd
);
11556 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_cmd
);
11557 install_element (BGP_NODE
, &bgp_network_ttl_cmd
);
11558 install_element (BGP_NODE
, &bgp_network_mask_ttl_cmd
);
11559 install_element (BGP_NODE
, &bgp_network_mask_natural_ttl_cmd
);
11560 install_element (BGP_NODE
, &bgp_network_backdoor_ttl_cmd
);
11561 install_element (BGP_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
11562 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
);
11563 install_element (BGP_NODE
, &no_bgp_network_cmd
);
11564 install_element (BGP_NODE
, &no_bgp_network_mask_cmd
);
11565 install_element (BGP_NODE
, &no_bgp_network_mask_natural_cmd
);
11566 install_element (BGP_NODE
, &no_bgp_network_route_map_cmd
);
11567 install_element (BGP_NODE
, &no_bgp_network_mask_route_map_cmd
);
11568 install_element (BGP_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
11569 install_element (BGP_NODE
, &no_bgp_network_backdoor_cmd
);
11570 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_cmd
);
11571 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_cmd
);
11572 install_element (BGP_NODE
, &no_bgp_network_ttl_cmd
);
11573 install_element (BGP_NODE
, &no_bgp_network_mask_ttl_cmd
);
11574 install_element (BGP_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
11575 install_element (BGP_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
11576 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
11577 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
);
11579 install_element (BGP_NODE
, &aggregate_address_cmd
);
11580 install_element (BGP_NODE
, &aggregate_address_mask_cmd
);
11581 install_element (BGP_NODE
, &aggregate_address_summary_only_cmd
);
11582 install_element (BGP_NODE
, &aggregate_address_mask_summary_only_cmd
);
11583 install_element (BGP_NODE
, &aggregate_address_as_set_cmd
);
11584 install_element (BGP_NODE
, &aggregate_address_mask_as_set_cmd
);
11585 install_element (BGP_NODE
, &aggregate_address_as_set_summary_cmd
);
11586 install_element (BGP_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
11587 install_element (BGP_NODE
, &aggregate_address_summary_as_set_cmd
);
11588 install_element (BGP_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
11589 install_element (BGP_NODE
, &no_aggregate_address_cmd
);
11590 install_element (BGP_NODE
, &no_aggregate_address_summary_only_cmd
);
11591 install_element (BGP_NODE
, &no_aggregate_address_as_set_cmd
);
11592 install_element (BGP_NODE
, &no_aggregate_address_as_set_summary_cmd
);
11593 install_element (BGP_NODE
, &no_aggregate_address_summary_as_set_cmd
);
11594 install_element (BGP_NODE
, &no_aggregate_address_mask_cmd
);
11595 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
11596 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_cmd
);
11597 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
11598 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
11600 /* IPv4 unicast configuration. */
11601 install_element (BGP_IPV4_NODE
, &bgp_network_cmd
);
11602 install_element (BGP_IPV4_NODE
, &bgp_network_mask_cmd
);
11603 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_cmd
);
11604 install_element (BGP_IPV4_NODE
, &bgp_network_route_map_cmd
);
11605 install_element (BGP_IPV4_NODE
, &bgp_network_mask_route_map_cmd
);
11606 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_route_map_cmd
);
11607 install_element (BGP_IPV4_NODE
, &bgp_network_ttl_cmd
);
11608 install_element (BGP_IPV4_NODE
, &bgp_network_mask_ttl_cmd
);
11609 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_ttl_cmd
);
11610 install_element (BGP_IPV4_NODE
, &bgp_network_backdoor_ttl_cmd
);
11611 install_element (BGP_IPV4_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
11612 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
); install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
11613 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_cmd
);
11614 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_cmd
);
11615 install_element (BGP_IPV4_NODE
, &no_bgp_network_route_map_cmd
);
11616 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_route_map_cmd
);
11617 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
11618 install_element (BGP_IPV4_NODE
, &no_bgp_network_ttl_cmd
);
11619 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_ttl_cmd
);
11620 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
11621 install_element (BGP_IPV4_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
11622 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
11623 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
); install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
11624 install_element (BGP_IPV4_NODE
, &aggregate_address_cmd
);
11625 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_cmd
);
11626 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_only_cmd
);
11627 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_only_cmd
);
11628 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_cmd
);
11629 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_cmd
);
11630 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_summary_cmd
);
11631 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
11632 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_as_set_cmd
);
11633 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
11634 install_element (BGP_IPV4_NODE
, &no_aggregate_address_cmd
);
11635 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_only_cmd
);
11636 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_cmd
);
11637 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_summary_cmd
);
11638 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_as_set_cmd
);
11639 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_cmd
);
11640 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
11641 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_cmd
);
11642 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
11643 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
11645 /* IPv4 multicast configuration. */
11646 install_element (BGP_IPV4M_NODE
, &bgp_network_cmd
);
11647 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_cmd
);
11648 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_cmd
);
11649 install_element (BGP_IPV4M_NODE
, &bgp_network_route_map_cmd
);
11650 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_route_map_cmd
);
11651 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_route_map_cmd
);
11652 install_element (BGP_IPV4M_NODE
, &bgp_network_ttl_cmd
);
11653 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_ttl_cmd
);
11654 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_ttl_cmd
);
11655 install_element (BGP_IPV4M_NODE
, &bgp_network_backdoor_ttl_cmd
);
11656 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
11657 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
); install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
11658 install_element (BGP_IPV4M_NODE
, &no_bgp_network_cmd
);
11659 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_cmd
);
11660 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_cmd
);
11661 install_element (BGP_IPV4M_NODE
, &no_bgp_network_route_map_cmd
);
11662 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_route_map_cmd
);
11663 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
11664 install_element (BGP_IPV4M_NODE
, &no_bgp_network_ttl_cmd
);
11665 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_ttl_cmd
);
11666 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
11667 install_element (BGP_IPV4M_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
11668 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
11669 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
); install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
11670 install_element (BGP_IPV4M_NODE
, &aggregate_address_cmd
);
11671 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_cmd
);
11672 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_only_cmd
);
11673 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_only_cmd
);
11674 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_cmd
);
11675 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_cmd
);
11676 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_summary_cmd
);
11677 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
11678 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_as_set_cmd
);
11679 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
11680 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_cmd
);
11681 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_only_cmd
);
11682 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_cmd
);
11683 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_summary_cmd
);
11684 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_as_set_cmd
);
11685 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_cmd
);
11686 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
11687 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_cmd
);
11688 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
11689 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
11691 install_element (VIEW_NODE
, &show_ip_bgp_cmd
);
11692 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cmd
);
11693 install_element (VIEW_NODE
, &show_ip_bgp_route_cmd
);
11694 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_cmd
);
11695 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
11696 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
11697 install_element (VIEW_NODE
, &show_ip_bgp_prefix_cmd
);
11698 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
11699 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
11700 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
11701 install_element (VIEW_NODE
, &show_ip_bgp_view_cmd
);
11702 install_element (VIEW_NODE
, &show_ip_bgp_view_route_cmd
);
11703 install_element (VIEW_NODE
, &show_ip_bgp_view_prefix_cmd
);
11704 install_element (VIEW_NODE
, &show_ip_bgp_regexp_cmd
);
11705 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
11706 install_element (VIEW_NODE
, &show_ip_bgp_prefix_list_cmd
);
11707 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
11708 install_element (VIEW_NODE
, &show_ip_bgp_filter_list_cmd
);
11709 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
11710 install_element (VIEW_NODE
, &show_ip_bgp_route_map_cmd
);
11711 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
11712 install_element (VIEW_NODE
, &show_ip_bgp_cidr_only_cmd
);
11713 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
11714 install_element (VIEW_NODE
, &show_ip_bgp_community_all_cmd
);
11715 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
11716 install_element (VIEW_NODE
, &show_ip_bgp_community_cmd
);
11717 install_element (VIEW_NODE
, &show_ip_bgp_community2_cmd
);
11718 install_element (VIEW_NODE
, &show_ip_bgp_community3_cmd
);
11719 install_element (VIEW_NODE
, &show_ip_bgp_community4_cmd
);
11720 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_cmd
);
11721 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
11722 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
11723 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
11724 install_element (VIEW_NODE
, &show_ip_bgp_community_exact_cmd
);
11725 install_element (VIEW_NODE
, &show_ip_bgp_community2_exact_cmd
);
11726 install_element (VIEW_NODE
, &show_ip_bgp_community3_exact_cmd
);
11727 install_element (VIEW_NODE
, &show_ip_bgp_community4_exact_cmd
);
11728 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
11729 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
11730 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
11731 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
11732 install_element (VIEW_NODE
, &show_ip_bgp_community_list_cmd
);
11733 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
11734 install_element (VIEW_NODE
, &show_ip_bgp_community_list_exact_cmd
);
11735 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
11736 install_element (VIEW_NODE
, &show_ip_bgp_prefix_longer_cmd
);
11737 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
11738 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
11739 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
11740 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
11741 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
11742 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
11743 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
11744 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
11745 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
11746 install_element (VIEW_NODE
, &show_ip_bgp_dampened_paths_cmd
);
11747 install_element (VIEW_NODE
, &show_ip_bgp_flap_statistics_cmd
);
11748 install_element (VIEW_NODE
, &show_ip_bgp_flap_address_cmd
);
11749 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_cmd
);
11750 install_element (VIEW_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
11751 install_element (VIEW_NODE
, &show_ip_bgp_flap_regexp_cmd
);
11752 install_element (VIEW_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
11753 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
11754 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
11755 install_element (VIEW_NODE
, &show_ip_bgp_flap_route_map_cmd
);
11756 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
11757 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
11758 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_cmd
);
11759 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_route_cmd
);
11760 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
11761 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_cmd
);
11762 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
11763 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
11765 /* Restricted node: VIEW_NODE - (set of dangerous commands) */
11766 install_element (RESTRICTED_NODE
, &show_ip_bgp_route_cmd
);
11767 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_route_cmd
);
11768 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
11769 install_element (RESTRICTED_NODE
, &show_ip_bgp_prefix_cmd
);
11770 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
11771 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
11772 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
11773 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_route_cmd
);
11774 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_prefix_cmd
);
11775 install_element (RESTRICTED_NODE
, &show_ip_bgp_community_cmd
);
11776 install_element (RESTRICTED_NODE
, &show_ip_bgp_community2_cmd
);
11777 install_element (RESTRICTED_NODE
, &show_ip_bgp_community3_cmd
);
11778 install_element (RESTRICTED_NODE
, &show_ip_bgp_community4_cmd
);
11779 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community_cmd
);
11780 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
11781 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
11782 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
11783 install_element (RESTRICTED_NODE
, &show_ip_bgp_community_exact_cmd
);
11784 install_element (RESTRICTED_NODE
, &show_ip_bgp_community2_exact_cmd
);
11785 install_element (RESTRICTED_NODE
, &show_ip_bgp_community3_exact_cmd
);
11786 install_element (RESTRICTED_NODE
, &show_ip_bgp_community4_exact_cmd
);
11787 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
11788 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
11789 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
11790 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
11791 install_element (RESTRICTED_NODE
, &show_ip_bgp_rsclient_route_cmd
);
11792 install_element (RESTRICTED_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
11793 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
11794 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
11796 install_element (ENABLE_NODE
, &show_ip_bgp_cmd
);
11797 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cmd
);
11798 install_element (ENABLE_NODE
, &show_ip_bgp_route_cmd
);
11799 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_cmd
);
11800 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
11801 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
11802 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_cmd
);
11803 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
11804 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
11805 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
11806 install_element (ENABLE_NODE
, &show_ip_bgp_view_cmd
);
11807 install_element (ENABLE_NODE
, &show_ip_bgp_view_route_cmd
);
11808 install_element (ENABLE_NODE
, &show_ip_bgp_view_prefix_cmd
);
11809 install_element (ENABLE_NODE
, &show_ip_bgp_regexp_cmd
);
11810 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
11811 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_list_cmd
);
11812 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
11813 install_element (ENABLE_NODE
, &show_ip_bgp_filter_list_cmd
);
11814 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
11815 install_element (ENABLE_NODE
, &show_ip_bgp_route_map_cmd
);
11816 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
11817 install_element (ENABLE_NODE
, &show_ip_bgp_cidr_only_cmd
);
11818 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
11819 install_element (ENABLE_NODE
, &show_ip_bgp_community_all_cmd
);
11820 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
11821 install_element (ENABLE_NODE
, &show_ip_bgp_community_cmd
);
11822 install_element (ENABLE_NODE
, &show_ip_bgp_community2_cmd
);
11823 install_element (ENABLE_NODE
, &show_ip_bgp_community3_cmd
);
11824 install_element (ENABLE_NODE
, &show_ip_bgp_community4_cmd
);
11825 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_cmd
);
11826 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
11827 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
11828 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
11829 install_element (ENABLE_NODE
, &show_ip_bgp_community_exact_cmd
);
11830 install_element (ENABLE_NODE
, &show_ip_bgp_community2_exact_cmd
);
11831 install_element (ENABLE_NODE
, &show_ip_bgp_community3_exact_cmd
);
11832 install_element (ENABLE_NODE
, &show_ip_bgp_community4_exact_cmd
);
11833 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
11834 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
11835 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
11836 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
11837 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_cmd
);
11838 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
11839 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_exact_cmd
);
11840 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
11841 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_longer_cmd
);
11842 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
11843 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
11844 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
11845 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
11846 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
11847 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
11848 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
11849 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
11850 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
11851 install_element (ENABLE_NODE
, &show_ip_bgp_dampened_paths_cmd
);
11852 install_element (ENABLE_NODE
, &show_ip_bgp_flap_statistics_cmd
);
11853 install_element (ENABLE_NODE
, &show_ip_bgp_flap_address_cmd
);
11854 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_cmd
);
11855 install_element (ENABLE_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
11856 install_element (ENABLE_NODE
, &show_ip_bgp_flap_regexp_cmd
);
11857 install_element (ENABLE_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
11858 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
11859 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
11860 install_element (ENABLE_NODE
, &show_ip_bgp_flap_route_map_cmd
);
11861 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
11862 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
11863 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_cmd
);
11864 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_route_cmd
);
11865 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
11866 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_cmd
);
11867 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
11868 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
11870 /* BGP dampening clear commands */
11871 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_cmd
);
11872 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_prefix_cmd
);
11873 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_cmd
);
11874 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_mask_cmd
);
11877 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_prefix_counts_cmd
);
11878 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_prefix_counts_cmd
);
11879 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd
);
11881 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_prefix_counts_cmd
);
11883 /* New config IPv6 BGP commands. */
11884 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_cmd
);
11885 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_route_map_cmd
);
11886 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_ttl_cmd
);
11887 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_cmd
);
11888 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_route_map_cmd
);
11889 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_ttl_cmd
);
11891 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_cmd
);
11892 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_summary_only_cmd
);
11893 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_cmd
);
11894 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_summary_only_cmd
);
11896 /* Old config IPv6 BGP commands. */
11897 install_element (BGP_NODE
, &old_ipv6_bgp_network_cmd
);
11898 install_element (BGP_NODE
, &old_no_ipv6_bgp_network_cmd
);
11900 install_element (BGP_NODE
, &old_ipv6_aggregate_address_cmd
);
11901 install_element (BGP_NODE
, &old_ipv6_aggregate_address_summary_only_cmd
);
11902 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_cmd
);
11903 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_summary_only_cmd
);
11905 install_element (VIEW_NODE
, &show_bgp_cmd
);
11906 install_element (VIEW_NODE
, &show_bgp_ipv6_cmd
);
11907 install_element (VIEW_NODE
, &show_bgp_route_cmd
);
11908 install_element (VIEW_NODE
, &show_bgp_ipv6_route_cmd
);
11909 install_element (VIEW_NODE
, &show_bgp_prefix_cmd
);
11910 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_cmd
);
11911 install_element (VIEW_NODE
, &show_bgp_regexp_cmd
);
11912 install_element (VIEW_NODE
, &show_bgp_ipv6_regexp_cmd
);
11913 install_element (VIEW_NODE
, &show_bgp_prefix_list_cmd
);
11914 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
11915 install_element (VIEW_NODE
, &show_bgp_filter_list_cmd
);
11916 install_element (VIEW_NODE
, &show_bgp_ipv6_filter_list_cmd
);
11917 install_element (VIEW_NODE
, &show_bgp_route_map_cmd
);
11918 install_element (VIEW_NODE
, &show_bgp_ipv6_route_map_cmd
);
11919 install_element (VIEW_NODE
, &show_bgp_community_all_cmd
);
11920 install_element (VIEW_NODE
, &show_bgp_ipv6_community_all_cmd
);
11921 install_element (VIEW_NODE
, &show_bgp_community_cmd
);
11922 install_element (VIEW_NODE
, &show_bgp_ipv6_community_cmd
);
11923 install_element (VIEW_NODE
, &show_bgp_community2_cmd
);
11924 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_cmd
);
11925 install_element (VIEW_NODE
, &show_bgp_community3_cmd
);
11926 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_cmd
);
11927 install_element (VIEW_NODE
, &show_bgp_community4_cmd
);
11928 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_cmd
);
11929 install_element (VIEW_NODE
, &show_bgp_community_exact_cmd
);
11930 install_element (VIEW_NODE
, &show_bgp_ipv6_community_exact_cmd
);
11931 install_element (VIEW_NODE
, &show_bgp_community2_exact_cmd
);
11932 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
11933 install_element (VIEW_NODE
, &show_bgp_community3_exact_cmd
);
11934 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
11935 install_element (VIEW_NODE
, &show_bgp_community4_exact_cmd
);
11936 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
11937 install_element (VIEW_NODE
, &show_bgp_community_list_cmd
);
11938 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_cmd
);
11939 install_element (VIEW_NODE
, &show_bgp_community_list_exact_cmd
);
11940 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
11941 install_element (VIEW_NODE
, &show_bgp_prefix_longer_cmd
);
11942 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
11943 install_element (VIEW_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
11944 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
11945 install_element (VIEW_NODE
, &show_bgp_neighbor_received_routes_cmd
);
11946 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
11947 install_element (VIEW_NODE
, &show_bgp_neighbor_routes_cmd
);
11948 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
11949 install_element (VIEW_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
11950 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
11951 install_element (VIEW_NODE
, &show_bgp_neighbor_flap_cmd
);
11952 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
11953 install_element (VIEW_NODE
, &show_bgp_neighbor_damp_cmd
);
11954 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
11955 install_element (VIEW_NODE
, &show_bgp_rsclient_cmd
);
11956 install_element (VIEW_NODE
, &show_bgp_rsclient_route_cmd
);
11957 install_element (VIEW_NODE
, &show_bgp_rsclient_prefix_cmd
);
11958 install_element (VIEW_NODE
, &show_bgp_view_cmd
);
11959 install_element (VIEW_NODE
, &show_bgp_view_ipv6_cmd
);
11960 install_element (VIEW_NODE
, &show_bgp_view_route_cmd
);
11961 install_element (VIEW_NODE
, &show_bgp_view_ipv6_route_cmd
);
11962 install_element (VIEW_NODE
, &show_bgp_view_prefix_cmd
);
11963 install_element (VIEW_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
11964 install_element (VIEW_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
11965 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
11966 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
11967 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
11968 install_element (VIEW_NODE
, &show_bgp_view_neighbor_routes_cmd
);
11969 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
11970 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
11971 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
11972 install_element (VIEW_NODE
, &show_bgp_view_neighbor_flap_cmd
);
11973 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
11974 install_element (VIEW_NODE
, &show_bgp_view_neighbor_damp_cmd
);
11975 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
11976 install_element (VIEW_NODE
, &show_bgp_view_rsclient_cmd
);
11977 install_element (VIEW_NODE
, &show_bgp_view_rsclient_route_cmd
);
11978 install_element (VIEW_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
11981 * VIEW_NODE - (set of dangerous commands) - (commands dependent on prev)
11983 install_element (RESTRICTED_NODE
, &show_bgp_route_cmd
);
11984 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_route_cmd
);
11985 install_element (RESTRICTED_NODE
, &show_bgp_prefix_cmd
);
11986 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_prefix_cmd
);
11987 install_element (RESTRICTED_NODE
, &show_bgp_community_cmd
);
11988 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community_cmd
);
11989 install_element (RESTRICTED_NODE
, &show_bgp_community2_cmd
);
11990 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community2_cmd
);
11991 install_element (RESTRICTED_NODE
, &show_bgp_community3_cmd
);
11992 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community3_cmd
);
11993 install_element (RESTRICTED_NODE
, &show_bgp_community4_cmd
);
11994 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community4_cmd
);
11995 install_element (RESTRICTED_NODE
, &show_bgp_community_exact_cmd
);
11996 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community_exact_cmd
);
11997 install_element (RESTRICTED_NODE
, &show_bgp_community2_exact_cmd
);
11998 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
11999 install_element (RESTRICTED_NODE
, &show_bgp_community3_exact_cmd
);
12000 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
12001 install_element (RESTRICTED_NODE
, &show_bgp_community4_exact_cmd
);
12002 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
12003 install_element (RESTRICTED_NODE
, &show_bgp_rsclient_route_cmd
);
12004 install_element (RESTRICTED_NODE
, &show_bgp_rsclient_prefix_cmd
);
12005 install_element (RESTRICTED_NODE
, &show_bgp_view_route_cmd
);
12006 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_route_cmd
);
12007 install_element (RESTRICTED_NODE
, &show_bgp_view_prefix_cmd
);
12008 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
12009 install_element (RESTRICTED_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
12010 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
12011 install_element (RESTRICTED_NODE
, &show_bgp_view_rsclient_route_cmd
);
12012 install_element (RESTRICTED_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
12014 install_element (ENABLE_NODE
, &show_bgp_cmd
);
12015 install_element (ENABLE_NODE
, &show_bgp_ipv6_cmd
);
12016 install_element (ENABLE_NODE
, &show_bgp_route_cmd
);
12017 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_cmd
);
12018 install_element (ENABLE_NODE
, &show_bgp_prefix_cmd
);
12019 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_cmd
);
12020 install_element (ENABLE_NODE
, &show_bgp_regexp_cmd
);
12021 install_element (ENABLE_NODE
, &show_bgp_ipv6_regexp_cmd
);
12022 install_element (ENABLE_NODE
, &show_bgp_prefix_list_cmd
);
12023 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
12024 install_element (ENABLE_NODE
, &show_bgp_filter_list_cmd
);
12025 install_element (ENABLE_NODE
, &show_bgp_ipv6_filter_list_cmd
);
12026 install_element (ENABLE_NODE
, &show_bgp_route_map_cmd
);
12027 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_map_cmd
);
12028 install_element (ENABLE_NODE
, &show_bgp_community_all_cmd
);
12029 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_all_cmd
);
12030 install_element (ENABLE_NODE
, &show_bgp_community_cmd
);
12031 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_cmd
);
12032 install_element (ENABLE_NODE
, &show_bgp_community2_cmd
);
12033 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_cmd
);
12034 install_element (ENABLE_NODE
, &show_bgp_community3_cmd
);
12035 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_cmd
);
12036 install_element (ENABLE_NODE
, &show_bgp_community4_cmd
);
12037 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_cmd
);
12038 install_element (ENABLE_NODE
, &show_bgp_community_exact_cmd
);
12039 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_exact_cmd
);
12040 install_element (ENABLE_NODE
, &show_bgp_community2_exact_cmd
);
12041 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
12042 install_element (ENABLE_NODE
, &show_bgp_community3_exact_cmd
);
12043 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
12044 install_element (ENABLE_NODE
, &show_bgp_community4_exact_cmd
);
12045 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
12046 install_element (ENABLE_NODE
, &show_bgp_community_list_cmd
);
12047 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_cmd
);
12048 install_element (ENABLE_NODE
, &show_bgp_community_list_exact_cmd
);
12049 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
12050 install_element (ENABLE_NODE
, &show_bgp_prefix_longer_cmd
);
12051 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
12052 install_element (ENABLE_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
12053 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
12054 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_routes_cmd
);
12055 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
12056 install_element (ENABLE_NODE
, &show_bgp_neighbor_routes_cmd
);
12057 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
12058 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
12059 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
12060 install_element (ENABLE_NODE
, &show_bgp_neighbor_flap_cmd
);
12061 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
12062 install_element (ENABLE_NODE
, &show_bgp_neighbor_damp_cmd
);
12063 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
12064 install_element (ENABLE_NODE
, &show_bgp_rsclient_cmd
);
12065 install_element (ENABLE_NODE
, &show_bgp_rsclient_route_cmd
);
12066 install_element (ENABLE_NODE
, &show_bgp_rsclient_prefix_cmd
);
12067 install_element (ENABLE_NODE
, &show_bgp_view_cmd
);
12068 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_cmd
);
12069 install_element (ENABLE_NODE
, &show_bgp_view_route_cmd
);
12070 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_route_cmd
);
12071 install_element (ENABLE_NODE
, &show_bgp_view_prefix_cmd
);
12072 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
12073 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
12074 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
12075 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
12076 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
12077 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_routes_cmd
);
12078 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
12079 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
12080 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
12081 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_flap_cmd
);
12082 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
12083 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_damp_cmd
);
12084 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
12085 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_cmd
);
12086 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_route_cmd
);
12087 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
12090 install_element (ENABLE_NODE
, &show_bgp_statistics_cmd
);
12091 install_element (ENABLE_NODE
, &show_bgp_statistics_vpnv4_cmd
);
12092 install_element (ENABLE_NODE
, &show_bgp_statistics_view_cmd
);
12093 install_element (ENABLE_NODE
, &show_bgp_statistics_view_vpnv4_cmd
);
12096 install_element (VIEW_NODE
, &show_ipv6_bgp_cmd
);
12097 install_element (VIEW_NODE
, &show_ipv6_bgp_route_cmd
);
12098 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_cmd
);
12099 install_element (VIEW_NODE
, &show_ipv6_bgp_regexp_cmd
);
12100 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
12101 install_element (VIEW_NODE
, &show_ipv6_bgp_filter_list_cmd
);
12102 install_element (VIEW_NODE
, &show_ipv6_bgp_community_all_cmd
);
12103 install_element (VIEW_NODE
, &show_ipv6_bgp_community_cmd
);
12104 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_cmd
);
12105 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_cmd
);
12106 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_cmd
);
12107 install_element (VIEW_NODE
, &show_ipv6_bgp_community_exact_cmd
);
12108 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
12109 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
12110 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
12111 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_cmd
);
12112 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
12113 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
12114 install_element (VIEW_NODE
, &show_ipv6_mbgp_cmd
);
12115 install_element (VIEW_NODE
, &show_ipv6_mbgp_route_cmd
);
12116 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_cmd
);
12117 install_element (VIEW_NODE
, &show_ipv6_mbgp_regexp_cmd
);
12118 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
12119 install_element (VIEW_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
12120 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_all_cmd
);
12121 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_cmd
);
12122 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_cmd
);
12123 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_cmd
);
12124 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_cmd
);
12125 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
12126 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
12127 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
12128 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
12129 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_cmd
);
12130 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
12131 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
12134 install_element (ENABLE_NODE
, &show_ipv6_bgp_cmd
);
12135 install_element (ENABLE_NODE
, &show_ipv6_bgp_route_cmd
);
12136 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_cmd
);
12137 install_element (ENABLE_NODE
, &show_ipv6_bgp_regexp_cmd
);
12138 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
12139 install_element (ENABLE_NODE
, &show_ipv6_bgp_filter_list_cmd
);
12140 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_all_cmd
);
12141 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_cmd
);
12142 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_cmd
);
12143 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_cmd
);
12144 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_cmd
);
12145 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_exact_cmd
);
12146 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
12147 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
12148 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
12149 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_cmd
);
12150 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
12151 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
12152 install_element (ENABLE_NODE
, &show_ipv6_mbgp_cmd
);
12153 install_element (ENABLE_NODE
, &show_ipv6_mbgp_route_cmd
);
12154 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_cmd
);
12155 install_element (ENABLE_NODE
, &show_ipv6_mbgp_regexp_cmd
);
12156 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
12157 install_element (ENABLE_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
12158 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_all_cmd
);
12159 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_cmd
);
12160 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_cmd
);
12161 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_cmd
);
12162 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_cmd
);
12163 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
12164 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
12165 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
12166 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
12167 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_cmd
);
12168 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
12169 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
12172 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
12173 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
12174 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
12175 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
12178 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
12179 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
12180 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
12181 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
12184 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
12185 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
12186 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
12187 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
12188 #endif /* HAVE_IPV6 */
12190 install_element (BGP_NODE
, &bgp_distance_cmd
);
12191 install_element (BGP_NODE
, &no_bgp_distance_cmd
);
12192 install_element (BGP_NODE
, &no_bgp_distance2_cmd
);
12193 install_element (BGP_NODE
, &bgp_distance_source_cmd
);
12194 install_element (BGP_NODE
, &no_bgp_distance_source_cmd
);
12195 install_element (BGP_NODE
, &bgp_distance_source_access_list_cmd
);
12196 install_element (BGP_NODE
, &no_bgp_distance_source_access_list_cmd
);
12198 install_element (BGP_NODE
, &bgp_damp_set_cmd
);
12199 install_element (BGP_NODE
, &bgp_damp_set2_cmd
);
12200 install_element (BGP_NODE
, &bgp_damp_set3_cmd
);
12201 install_element (BGP_NODE
, &bgp_damp_unset_cmd
);
12202 install_element (BGP_NODE
, &bgp_damp_unset2_cmd
);
12203 install_element (BGP_IPV4_NODE
, &bgp_damp_set_cmd
);
12204 install_element (BGP_IPV4_NODE
, &bgp_damp_set2_cmd
);
12205 install_element (BGP_IPV4_NODE
, &bgp_damp_set3_cmd
);
12206 install_element (BGP_IPV4_NODE
, &bgp_damp_unset_cmd
);
12207 install_element (BGP_IPV4_NODE
, &bgp_damp_unset2_cmd
);