1 /* BGP routing information
2 Copyright (C) 1996, 97, 98, 99 Kunihiro Ishiguro
4 This file is part of GNU Zebra.
6 GNU Zebra is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 GNU Zebra is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Zebra; see the file COPYING. If not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
33 #include "sockunion.h"
36 #include "workqueue.h"
38 #include "bgpd/bgpd.h"
39 #include "bgpd/bgp_table.h"
40 #include "bgpd/bgp_route.h"
41 #include "bgpd/bgp_attr.h"
42 #include "bgpd/bgp_debug.h"
43 #include "bgpd/bgp_aspath.h"
44 #include "bgpd/bgp_regex.h"
45 #include "bgpd/bgp_community.h"
46 #include "bgpd/bgp_ecommunity.h"
47 #include "bgpd/bgp_clist.h"
48 #include "bgpd/bgp_packet.h"
49 #include "bgpd/bgp_filter.h"
50 #include "bgpd/bgp_fsm.h"
51 #include "bgpd/bgp_mplsvpn.h"
52 #include "bgpd/bgp_nexthop.h"
53 #include "bgpd/bgp_damp.h"
54 #include "bgpd/bgp_advertise.h"
55 #include "bgpd/bgp_zebra.h"
56 #include "bgpd/bgp_vty.h"
58 /* Extern from bgp_dump.c */
59 extern char *bgp_origin_str
[];
60 extern char *bgp_origin_long_str
[];
62 static struct bgp_node
*
63 bgp_afi_node_get (struct bgp_table
*table
, afi_t afi
, safi_t safi
, struct prefix
*p
,
64 struct prefix_rd
*prd
)
67 struct bgp_node
*prn
= NULL
;
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_node (pq
->rn
);
1566 XFREE (MTYPE_BGP_PROCESS_QUEUE
, pq
);
1570 bgp_process_queue_init (void)
1572 bm
->process_main_queue
1573 = work_queue_new (bm
->master
, "process_main_queue");
1574 bm
->process_rsclient_queue
1575 = work_queue_new (bm
->master
, "process_rsclient_queue");
1577 if ( !(bm
->process_main_queue
&& bm
->process_rsclient_queue
) )
1579 zlog_err ("%s: Failed to allocate work queue", __func__
);
1583 bm
->process_main_queue
->spec
.workfunc
= &bgp_process_main
;
1584 bm
->process_rsclient_queue
->spec
.workfunc
= &bgp_process_rsclient
;
1585 bm
->process_main_queue
->spec
.del_item_data
= &bgp_processq_del
;
1586 bm
->process_rsclient_queue
->spec
.del_item_data
1587 = bm
->process_main_queue
->spec
.del_item_data
;
1588 bm
->process_main_queue
->spec
.max_retries
1589 = bm
->process_main_queue
->spec
.max_retries
= 0;
1590 bm
->process_rsclient_queue
->spec
.hold
1591 = bm
->process_main_queue
->spec
.hold
= 50;
1595 bgp_process (struct bgp
*bgp
, struct bgp_node
*rn
, afi_t afi
, safi_t safi
)
1597 struct bgp_process_queue
*pqnode
;
1599 /* already scheduled for processing? */
1600 if (CHECK_FLAG (rn
->flags
, BGP_NODE_PROCESS_SCHEDULED
))
1603 if ( (bm
->process_main_queue
== NULL
) ||
1604 (bm
->process_rsclient_queue
== NULL
) )
1605 bgp_process_queue_init ();
1607 pqnode
= XCALLOC (MTYPE_BGP_PROCESS_QUEUE
,
1608 sizeof (struct bgp_process_queue
));
1612 pqnode
->rn
= bgp_lock_node (rn
); /* unlocked by bgp_processq_del */
1615 pqnode
->safi
= safi
;
1617 switch (rn
->table
->type
)
1619 case BGP_TABLE_MAIN
:
1620 work_queue_add (bm
->process_main_queue
, pqnode
);
1622 case BGP_TABLE_RSCLIENT
:
1623 work_queue_add (bm
->process_rsclient_queue
, pqnode
);
1631 bgp_maximum_prefix_restart_timer (struct thread
*thread
)
1635 peer
= THREAD_ARG (thread
);
1636 peer
->t_pmax_restart
= NULL
;
1638 if (BGP_DEBUG (events
, EVENTS
))
1639 zlog_debug ("%s Maximum-prefix restart timer expired, restore peering",
1648 bgp_maximum_prefix_overflow (struct peer
*peer
, afi_t afi
,
1649 safi_t safi
, int always
)
1651 if (!CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
1654 if (peer
->pcount
[afi
][safi
] > peer
->pmax
[afi
][safi
])
1656 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
)
1660 zlog (peer
->log
, LOG_INFO
,
1661 "%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, "
1662 "limit %ld", afi_safi_print (afi
, safi
), peer
->host
,
1663 peer
->pcount
[afi
][safi
], peer
->pmax
[afi
][safi
]);
1664 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1666 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
1672 if (safi
== SAFI_MPLS_VPN
)
1673 safi
= BGP_SAFI_VPNV4
;
1675 ndata
[0] = (afi
>> 8);
1678 ndata
[3] = (peer
->pmax
[afi
][safi
] >> 24);
1679 ndata
[4] = (peer
->pmax
[afi
][safi
] >> 16);
1680 ndata
[5] = (peer
->pmax
[afi
][safi
] >> 8);
1681 ndata
[6] = (peer
->pmax
[afi
][safi
]);
1683 SET_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
);
1684 bgp_notify_send_with_data (peer
, BGP_NOTIFY_CEASE
,
1685 BGP_NOTIFY_CEASE_MAX_PREFIX
, ndata
, 7);
1688 /* restart timer start */
1689 if (peer
->pmax_restart
[afi
][safi
])
1691 peer
->v_pmax_restart
= peer
->pmax_restart
[afi
][safi
] * 60;
1693 if (BGP_DEBUG (events
, EVENTS
))
1694 zlog_debug ("%s Maximum-prefix restart timer started for %d secs",
1695 peer
->host
, peer
->v_pmax_restart
);
1697 BGP_TIMER_ON (peer
->t_pmax_restart
, bgp_maximum_prefix_restart_timer
,
1698 peer
->v_pmax_restart
);
1704 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_LIMIT
);
1706 if (peer
->pcount
[afi
][safi
] > (peer
->pmax
[afi
][safi
] * peer
->pmax_threshold
[afi
][safi
] / 100))
1708 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
)
1712 zlog (peer
->log
, LOG_INFO
,
1713 "%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld",
1714 afi_safi_print (afi
, safi
), peer
->host
, peer
->pcount
[afi
][safi
],
1715 peer
->pmax
[afi
][safi
]);
1716 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
1719 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_PREFIX_THRESHOLD
);
1723 /* Unconditionally remove the route from the RIB, without taking
1724 * damping into consideration (eg, because the session went down)
1727 bgp_rib_remove (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
1728 afi_t afi
, safi_t safi
)
1730 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1732 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1733 bgp_info_delete (rn
, ri
); /* keep historical info */
1735 bgp_process (peer
->bgp
, rn
, afi
, safi
);
1739 bgp_rib_withdraw (struct bgp_node
*rn
, struct bgp_info
*ri
, struct peer
*peer
,
1740 afi_t afi
, safi_t safi
)
1742 int status
= BGP_DAMP_NONE
;
1744 /* apply dampening, if result is suppressed, we'll be retaining
1745 * the bgp_info in the RIB for historical reference.
1747 if (CHECK_FLAG (peer
->bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
1748 && peer_sort (peer
) == BGP_PEER_EBGP
)
1749 if ( (status
= bgp_damp_withdraw (ri
, rn
, afi
, safi
, 0))
1750 == BGP_DAMP_SUPPRESSED
)
1752 bgp_aggregate_decrement (peer
->bgp
, &rn
->p
, ri
, afi
, safi
);
1756 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
1760 bgp_update_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
1761 struct attr
*attr
, struct peer
*peer
, struct prefix
*p
, int type
,
1762 int sub_type
, struct prefix_rd
*prd
, u_char
*tag
)
1764 struct bgp_node
*rn
;
1766 struct attr new_attr
= { 0 };
1767 struct attr
*attr_new
;
1768 struct attr
*attr_new2
;
1769 struct bgp_info
*ri
;
1770 struct bgp_info
*new;
1772 char buf
[SU_ADDRSTRLEN
];
1774 //memset (new_attr, 0, sizeof (struct attr));
1776 /* Do not insert announces from a rsclient into its own 'bgp_table'. */
1777 if (peer
== rsclient
)
1781 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1783 /* Check previously received route. */
1784 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1785 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1788 /* AS path loop check. */
1789 if (aspath_loop_check (attr
->aspath
, rsclient
->as
) > peer
->allowas_in
[afi
][safi
])
1791 reason
= "as-path contains our own AS;";
1795 /* Route reflector originator ID check. */
1796 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
1797 && IPV4_ADDR_SAME (&rsclient
->remote_id
, &attr
->extra
->originator_id
))
1799 reason
= "originator is us;";
1803 bgp_attr_dup (&new_attr
, attr
);
1805 /* Apply export policy. */
1806 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
) &&
1807 bgp_export_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1809 reason
= "export-policy;";
1813 attr_new2
= bgp_attr_intern (&new_attr
);
1815 /* Apply import policy. */
1816 if (bgp_import_modifier (rsclient
, peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
1818 bgp_attr_unintern (attr_new2
);
1820 reason
= "import-policy;";
1824 attr_new
= bgp_attr_intern (&new_attr
);
1825 bgp_attr_unintern (attr_new2
);
1827 /* IPv4 unicast next hop check. */
1828 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
1830 /* Next hop must not be 0.0.0.0 nor Class E address. */
1831 if (new_attr
.nexthop
.s_addr
== 0
1832 || ntohl (new_attr
.nexthop
.s_addr
) >= 0xe0000000)
1834 bgp_attr_unintern (attr_new
);
1836 reason
= "martian next-hop;";
1841 /* new_attr isn't passed to any functions after here */
1842 bgp_attr_extra_free (&new_attr
);
1844 /* If the update is implicit withdraw. */
1847 ri
->uptime
= time (NULL
);
1849 /* Same attribute comes in. */
1850 if (!CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
)
1851 && attrhash_cmp (ri
->attr
, attr_new
))
1854 bgp_info_unset_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
1856 if (BGP_DEBUG (update
, UPDATE_IN
))
1857 zlog (peer
->log
, LOG_DEBUG
,
1858 "%s rcvd %s/%d for RS-client %s...duplicate ignored",
1860 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1861 p
->prefixlen
, rsclient
->host
);
1863 bgp_unlock_node (rn
);
1864 bgp_attr_unintern (attr_new
);
1869 /* Withdraw/Announce before we fully processed the withdraw */
1870 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
1871 bgp_info_restore (rn
, ri
);
1873 /* Received Logging. */
1874 if (BGP_DEBUG (update
, UPDATE_IN
))
1875 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
1877 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1878 p
->prefixlen
, rsclient
->host
);
1880 /* The attribute is changed. */
1881 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
1883 /* Update to new attribute. */
1884 bgp_attr_unintern (ri
->attr
);
1885 ri
->attr
= attr_new
;
1887 /* Update MPLS tag. */
1888 if (safi
== SAFI_MPLS_VPN
)
1889 memcpy ((bgp_info_extra_get (ri
))->tag
, tag
, 3);
1891 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
1893 /* Process change. */
1894 bgp_process (bgp
, rn
, afi
, safi
);
1895 bgp_unlock_node (rn
);
1900 /* Received Logging. */
1901 if (BGP_DEBUG (update
, UPDATE_IN
))
1903 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d for RS-client %s",
1905 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1906 p
->prefixlen
, rsclient
->host
);
1909 /* Make new BGP info. */
1910 new = bgp_info_new ();
1912 new->sub_type
= sub_type
;
1914 new->attr
= attr_new
;
1915 new->uptime
= time (NULL
);
1917 /* Update MPLS tag. */
1918 if (safi
== SAFI_MPLS_VPN
)
1919 memcpy ((bgp_info_extra_get (new))->tag
, tag
, 3);
1921 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
1923 /* Register new BGP information. */
1924 bgp_info_add (rn
, new);
1926 /* route_node_get lock */
1927 bgp_unlock_node (rn
);
1929 /* Process change. */
1930 bgp_process (bgp
, rn
, afi
, safi
);
1932 bgp_attr_extra_free (&new_attr
);
1938 /* This BGP update is filtered. Log the reason then update BGP entry. */
1939 if (BGP_DEBUG (update
, UPDATE_IN
))
1940 zlog (peer
->log
, LOG_DEBUG
,
1941 "%s rcvd UPDATE about %s/%d -- DENIED for RS-client %s due to: %s",
1943 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1944 p
->prefixlen
, rsclient
->host
, reason
);
1947 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
1949 bgp_unlock_node (rn
);
1952 bgp_attr_extra_free (&new_attr
);
1958 bgp_withdraw_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
,
1959 struct peer
*peer
, struct prefix
*p
, int type
, int sub_type
,
1960 struct prefix_rd
*prd
, u_char
*tag
)
1962 struct bgp_node
*rn
;
1963 struct bgp_info
*ri
;
1964 char buf
[SU_ADDRSTRLEN
];
1966 if (rsclient
== peer
)
1969 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
1971 /* Lookup withdrawn route. */
1972 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
1973 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
1976 /* Withdraw specified route from routing table. */
1977 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
1978 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
1979 else if (BGP_DEBUG (update
, UPDATE_IN
))
1980 zlog (peer
->log
, LOG_DEBUG
,
1981 "%s Can't find the route %s/%d", peer
->host
,
1982 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
1985 /* Unlock bgp_node_get() lock. */
1986 bgp_unlock_node (rn
);
1990 bgp_update_main (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
1991 afi_t afi
, safi_t safi
, int type
, int sub_type
,
1992 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
1995 int aspath_loop_count
= 0;
1996 struct bgp_node
*rn
;
1998 struct attr new_attr
= { 0 };
1999 struct attr
*attr_new
;
2000 struct bgp_info
*ri
;
2001 struct bgp_info
*new;
2003 char buf
[SU_ADDRSTRLEN
];
2006 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2008 /* When peer's soft reconfiguration enabled. Record input packet in
2010 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2011 && peer
!= bgp
->peer_self
&& ! soft_reconfig
)
2012 bgp_adj_in_set (rn
, peer
, attr
);
2014 /* Check previously received route. */
2015 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2016 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2019 /* AS path local-as loop check. */
2020 if (peer
->change_local_as
)
2022 if (! CHECK_FLAG (peer
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
2023 aspath_loop_count
= 1;
2025 if (aspath_loop_check (attr
->aspath
, peer
->change_local_as
) > aspath_loop_count
)
2027 reason
= "as-path contains our own AS;";
2032 /* AS path loop check. */
2033 if (aspath_loop_check (attr
->aspath
, bgp
->as
) > peer
->allowas_in
[afi
][safi
]
2034 || (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
2035 && aspath_loop_check(attr
->aspath
, bgp
->confed_id
)
2036 > peer
->allowas_in
[afi
][safi
]))
2038 reason
= "as-path contains our own AS;";
2042 /* Route reflector originator ID check. */
2043 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID
)
2044 && IPV4_ADDR_SAME (&bgp
->router_id
, &attr
->extra
->originator_id
))
2046 reason
= "originator is us;";
2050 /* Route reflector cluster ID check. */
2051 if (bgp_cluster_filter (peer
, attr
))
2053 reason
= "reflected from the same cluster;";
2057 /* Apply incoming filter. */
2058 if (bgp_input_filter (peer
, p
, attr
, afi
, safi
) == FILTER_DENY
)
2064 /* Apply incoming route-map. */
2065 bgp_attr_dup (&new_attr
, attr
);
2067 if (bgp_input_modifier (peer
, p
, &new_attr
, afi
, safi
) == RMAP_DENY
)
2069 reason
= "route-map;";
2073 /* IPv4 unicast next hop check. */
2074 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2076 /* If the peer is EBGP and nexthop is not on connected route,
2078 if (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
== 1
2079 && ! bgp_nexthop_check_ebgp (afi
, &new_attr
)
2080 && ! CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
))
2082 reason
= "non-connected next-hop;";
2086 /* Next hop must not be 0.0.0.0 nor Class E address. Next hop
2087 must not be my own address. */
2088 if (bgp_nexthop_self (afi
, &new_attr
)
2089 || new_attr
.nexthop
.s_addr
== 0
2090 || ntohl (new_attr
.nexthop
.s_addr
) >= 0xe0000000)
2092 reason
= "martian next-hop;";
2097 attr_new
= bgp_attr_intern (&new_attr
);
2099 /* If the update is implicit withdraw. */
2102 ri
->uptime
= time (NULL
);
2104 /* Same attribute comes in. */
2105 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
)
2106 && attrhash_cmp (ri
->attr
, attr_new
))
2108 bgp_info_unset_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
2110 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2111 && peer_sort (peer
) == BGP_PEER_EBGP
2112 && CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2114 if (BGP_DEBUG (update
, UPDATE_IN
))
2115 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2117 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2120 if (bgp_damp_update (ri
, rn
, afi
, safi
) != BGP_DAMP_SUPPRESSED
)
2122 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2123 bgp_process (bgp
, rn
, afi
, safi
);
2126 else /* Duplicate - odd */
2128 if (BGP_DEBUG (update
, UPDATE_IN
))
2129 zlog (peer
->log
, LOG_DEBUG
,
2130 "%s rcvd %s/%d...duplicate ignored",
2132 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2135 /* graceful restart STALE flag unset. */
2136 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2138 bgp_info_unset_flag (rn
, ri
, BGP_INFO_STALE
);
2139 bgp_process (bgp
, rn
, afi
, safi
);
2143 bgp_unlock_node (rn
);
2144 bgp_attr_unintern (attr_new
);
2145 bgp_attr_extra_free (&new_attr
);
2150 /* Withdraw/Announce before we fully processed the withdraw */
2151 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
2153 if (BGP_DEBUG (update
, UPDATE_IN
))
2154 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d, flapped quicker than processing",
2156 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2158 bgp_info_restore (rn
, ri
);
2161 /* Received Logging. */
2162 if (BGP_DEBUG (update
, UPDATE_IN
))
2163 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2165 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2168 /* graceful restart STALE flag unset. */
2169 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2170 bgp_info_unset_flag (rn
, ri
, BGP_INFO_STALE
);
2172 /* The attribute is changed. */
2173 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
2175 /* implicit withdraw, decrement aggregate and pcount here.
2176 * only if update is accepted, they'll increment below.
2178 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
2180 /* Update bgp route dampening information. */
2181 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2182 && peer_sort (peer
) == BGP_PEER_EBGP
)
2184 /* This is implicit withdraw so we should update dampening
2186 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2187 bgp_damp_withdraw (ri
, rn
, afi
, safi
, 1);
2190 /* Update to new attribute. */
2191 bgp_attr_unintern (ri
->attr
);
2192 ri
->attr
= attr_new
;
2194 /* Update MPLS tag. */
2195 if (safi
== SAFI_MPLS_VPN
)
2196 memcpy ((bgp_info_extra_get (ri
))->tag
, tag
, 3);
2198 /* Update bgp route dampening information. */
2199 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
)
2200 && peer_sort (peer
) == BGP_PEER_EBGP
)
2202 /* Now we do normal update dampening. */
2203 ret
= bgp_damp_update (ri
, rn
, afi
, safi
);
2204 if (ret
== BGP_DAMP_SUPPRESSED
)
2206 bgp_unlock_node (rn
);
2207 bgp_attr_extra_free (&new_attr
);
2212 /* Nexthop reachability check. */
2213 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
2214 && safi
== SAFI_UNICAST
2215 && (peer_sort (peer
) == BGP_PEER_IBGP
2216 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
2217 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
2219 if (bgp_nexthop_lookup (afi
, peer
, ri
, NULL
, NULL
))
2220 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
2222 bgp_info_unset_flag (rn
, ri
, BGP_INFO_VALID
);
2225 bgp_info_set_flag (rn
, ri
, BGP_INFO_VALID
);
2227 /* Process change. */
2228 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
2230 bgp_process (bgp
, rn
, afi
, safi
);
2231 bgp_unlock_node (rn
);
2232 bgp_attr_extra_free (&new_attr
);
2237 /* Received Logging. */
2238 if (BGP_DEBUG (update
, UPDATE_IN
))
2240 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd %s/%d",
2242 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2246 /* Make new BGP info. */
2247 new = bgp_info_new ();
2249 new->sub_type
= sub_type
;
2251 new->attr
= attr_new
;
2252 new->uptime
= time (NULL
);
2254 /* Update MPLS tag. */
2255 if (safi
== SAFI_MPLS_VPN
)
2256 memcpy ((bgp_info_extra_get (new))->tag
, tag
, 3);
2258 /* Nexthop reachability check. */
2259 if ((afi
== AFI_IP
|| afi
== AFI_IP6
)
2260 && safi
== SAFI_UNICAST
2261 && (peer_sort (peer
) == BGP_PEER_IBGP
2262 || (peer_sort (peer
) == BGP_PEER_EBGP
&& peer
->ttl
!= 1)
2263 || CHECK_FLAG (peer
->flags
, PEER_FLAG_DISABLE_CONNECTED_CHECK
)))
2265 if (bgp_nexthop_lookup (afi
, peer
, new, NULL
, NULL
))
2266 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2268 bgp_info_unset_flag (rn
, new, BGP_INFO_VALID
);
2271 bgp_info_set_flag (rn
, new, BGP_INFO_VALID
);
2273 /* Increment prefix */
2274 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
2276 /* Register new BGP information. */
2277 bgp_info_add (rn
, new);
2279 /* route_node_get lock */
2280 bgp_unlock_node (rn
);
2282 bgp_attr_extra_free (&new_attr
);
2284 /* If maximum prefix count is configured and current prefix
2286 if (bgp_maximum_prefix_overflow (peer
, afi
, safi
, 0))
2289 /* Process change. */
2290 bgp_process (bgp
, rn
, afi
, safi
);
2294 /* This BGP update is filtered. Log the reason then update BGP
2297 if (BGP_DEBUG (update
, UPDATE_IN
))
2298 zlog (peer
->log
, LOG_DEBUG
,
2299 "%s rcvd UPDATE about %s/%d -- DENIED due to: %s",
2301 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2302 p
->prefixlen
, reason
);
2305 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2307 bgp_unlock_node (rn
);
2309 bgp_attr_extra_free (&new_attr
);
2315 bgp_update (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2316 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2317 struct prefix_rd
*prd
, u_char
*tag
, int soft_reconfig
)
2319 struct peer
*rsclient
;
2320 struct listnode
*node
, *nnode
;
2324 ret
= bgp_update_main (peer
, p
, attr
, afi
, safi
, type
, sub_type
, prd
, tag
,
2329 /* Process the update for each RS-client. */
2330 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2332 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2333 bgp_update_rsclient (rsclient
, afi
, safi
, attr
, peer
, p
, type
,
2334 sub_type
, prd
, tag
);
2341 bgp_withdraw (struct peer
*peer
, struct prefix
*p
, struct attr
*attr
,
2342 afi_t afi
, safi_t safi
, int type
, int sub_type
,
2343 struct prefix_rd
*prd
, u_char
*tag
)
2346 char buf
[SU_ADDRSTRLEN
];
2347 struct bgp_node
*rn
;
2348 struct bgp_info
*ri
;
2349 struct peer
*rsclient
;
2350 struct listnode
*node
, *nnode
;
2354 /* Process the withdraw for each RS-client. */
2355 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
2357 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2358 bgp_withdraw_rsclient (rsclient
, afi
, safi
, peer
, p
, type
, sub_type
, prd
, tag
);
2362 if (BGP_DEBUG (update
, UPDATE_IN
))
2363 zlog (peer
->log
, LOG_DEBUG
, "%s rcvd UPDATE about %s/%d -- withdrawn",
2365 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2369 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
2371 /* If peer is soft reconfiguration enabled. Record input packet for
2372 further calculation. */
2373 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
)
2374 && peer
!= bgp
->peer_self
)
2375 bgp_adj_in_unset (rn
, peer
);
2377 /* Lookup withdrawn route. */
2378 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2379 if (ri
->peer
== peer
&& ri
->type
== type
&& ri
->sub_type
== sub_type
)
2382 /* Withdraw specified route from routing table. */
2383 if (ri
&& ! CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
2384 bgp_rib_withdraw (rn
, ri
, peer
, afi
, safi
);
2385 else if (BGP_DEBUG (update
, UPDATE_IN
))
2386 zlog (peer
->log
, LOG_DEBUG
,
2387 "%s Can't find the route %s/%d", peer
->host
,
2388 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
2391 /* Unlock bgp_node_get() lock. */
2392 bgp_unlock_node (rn
);
2398 bgp_default_originate (struct peer
*peer
, afi_t afi
, safi_t safi
, int withdraw
)
2402 struct aspath
*aspath
= { 0 };
2404 struct bgp_info binfo
;
2406 int ret
= RMAP_DENYMATCH
;
2408 if (!(afi
== AFI_IP
|| afi
== AFI_IP6
))
2412 from
= bgp
->peer_self
;
2414 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
2415 aspath
= attr
.aspath
;
2416 attr
.local_pref
= bgp
->default_local_pref
;
2417 memcpy (&attr
.nexthop
, &peer
->nexthop
.v4
, IPV4_MAX_BYTELEN
);
2420 str2prefix ("0.0.0.0/0", &p
);
2422 else if (afi
== AFI_IP6
)
2424 struct attr_extra
*ae
;
2427 ae
= bgp_attr_extra_get (&attr
);
2430 str2prefix ("::/0", &p
);
2432 /* IPv6 global nexthop must be included. */
2433 memcpy (&ae
->mp_nexthop_global
, &peer
->nexthop
.v6_global
,
2435 ae
->mp_nexthop_len
= 16;
2437 /* If the peer is on shared nextwork and we have link-local
2439 if (peer
->shared_network
2440 && !IN6_IS_ADDR_UNSPECIFIED (&peer
->nexthop
.v6_local
))
2442 memcpy (&ae
->mp_nexthop_local
, &peer
->nexthop
.v6_local
,
2444 ae
->mp_nexthop_len
= 32;
2447 #endif /* HAVE_IPV6 */
2449 if (peer
->default_rmap
[afi
][safi
].name
)
2451 binfo
.peer
= bgp
->peer_self
;
2454 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_DEFAULT
);
2456 ret
= route_map_apply (peer
->default_rmap
[afi
][safi
].map
, &p
,
2459 bgp
->peer_self
->rmap_type
= 0;
2461 if (ret
== RMAP_DENYMATCH
)
2463 bgp_attr_flush (&attr
);
2470 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
))
2471 bgp_default_withdraw_send (peer
, afi
, safi
);
2472 UNSET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2476 SET_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_DEFAULT_ORIGINATE
);
2477 bgp_default_update_send (peer
, &attr
, afi
, safi
, from
);
2480 bgp_attr_extra_free (&attr
);
2481 aspath_unintern (aspath
);
2485 bgp_announce_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2486 struct bgp_table
*table
, int rsclient
)
2488 struct bgp_node
*rn
;
2489 struct bgp_info
*ri
;
2492 memset (&attr
, 0, sizeof (struct attr
));
2495 table
= (rsclient
) ? peer
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2497 if (safi
!= SAFI_MPLS_VPN
2498 && CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
2499 bgp_default_originate (peer
, afi
, safi
, 0);
2501 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next(rn
))
2502 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2503 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
) && ri
->peer
!= peer
)
2506 (bgp_announce_check_rsclient (ri
, peer
, &rn
->p
, &attr
, afi
, safi
))
2507 : (bgp_announce_check (ri
, peer
, &rn
->p
, &attr
, afi
, safi
)))
2508 bgp_adj_out_set (rn
, peer
, &rn
->p
, &attr
, afi
, safi
, ri
);
2510 bgp_adj_out_unset (rn
, peer
, &rn
->p
, afi
, safi
);
2512 bgp_attr_extra_free (&attr
);
2517 bgp_announce_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2519 struct bgp_node
*rn
;
2520 struct bgp_table
*table
;
2522 if (peer
->status
!= Established
)
2525 if (! peer
->afc_nego
[afi
][safi
])
2528 /* First update is deferred until ORF or ROUTE-REFRESH is received */
2529 if (CHECK_FLAG (peer
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
2532 if (safi
!= SAFI_MPLS_VPN
)
2533 bgp_announce_table (peer
, afi
, safi
, NULL
, 0);
2535 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2536 rn
= bgp_route_next(rn
))
2537 if ((table
= (rn
->info
)) != NULL
)
2538 bgp_announce_table (peer
, afi
, safi
, table
, 0);
2540 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2541 bgp_announce_table (peer
, afi
, safi
, NULL
, 1);
2545 bgp_announce_route_all (struct peer
*peer
)
2550 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2551 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2552 bgp_announce_route (peer
, afi
, safi
);
2556 bgp_soft_reconfig_table_rsclient (struct peer
*rsclient
, afi_t afi
,
2557 safi_t safi
, struct bgp_table
*table
)
2559 struct bgp_node
*rn
;
2560 struct bgp_adj_in
*ain
;
2563 table
= rsclient
->bgp
->rib
[afi
][safi
];
2565 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2566 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2568 bgp_update_rsclient (rsclient
, afi
, safi
, ain
->attr
, ain
->peer
,
2569 &rn
->p
, ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
2574 bgp_soft_reconfig_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
2576 struct bgp_table
*table
;
2577 struct bgp_node
*rn
;
2579 if (safi
!= SAFI_MPLS_VPN
)
2580 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, NULL
);
2583 for (rn
= bgp_table_top (rsclient
->bgp
->rib
[afi
][safi
]); rn
;
2584 rn
= bgp_route_next (rn
))
2585 if ((table
= rn
->info
) != NULL
)
2586 bgp_soft_reconfig_table_rsclient (rsclient
, afi
, safi
, table
);
2590 bgp_soft_reconfig_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2591 struct bgp_table
*table
)
2594 struct bgp_node
*rn
;
2595 struct bgp_adj_in
*ain
;
2598 table
= peer
->bgp
->rib
[afi
][safi
];
2600 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2601 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2603 if (ain
->peer
== peer
)
2605 ret
= bgp_update (peer
, &rn
->p
, ain
->attr
, afi
, safi
,
2606 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
,
2610 bgp_unlock_node (rn
);
2619 bgp_soft_reconfig_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2621 struct bgp_node
*rn
;
2622 struct bgp_table
*table
;
2624 if (peer
->status
!= Established
)
2627 if (safi
!= SAFI_MPLS_VPN
)
2628 bgp_soft_reconfig_table (peer
, afi
, safi
, NULL
);
2630 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2631 rn
= bgp_route_next (rn
))
2632 if ((table
= rn
->info
) != NULL
)
2633 bgp_soft_reconfig_table (peer
, afi
, safi
, table
);
2636 static wq_item_status
2637 bgp_clear_route_node (struct work_queue
*wq
, void *data
)
2639 struct bgp_node
*rn
= data
;
2640 struct peer
*peer
= wq
->spec
.data
;
2641 struct bgp_info
*ri
;
2642 afi_t afi
= rn
->table
->afi
;
2643 safi_t safi
= rn
->table
->safi
;
2645 assert (rn
&& peer
);
2647 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2648 if (ri
->peer
== peer
)
2650 /* graceful restart STALE flag set. */
2651 if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_NSF_WAIT
)
2652 && peer
->nsf
[afi
][safi
]
2653 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
)
2654 && ! CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
2655 bgp_info_set_flag (rn
, ri
, BGP_INFO_STALE
);
2657 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2664 bgp_clear_node_queue_del (struct work_queue
*wq
, void *data
)
2666 struct bgp_node
*rn
= data
;
2668 bgp_unlock_node (rn
);
2672 bgp_clear_node_complete (struct work_queue
*wq
)
2674 struct peer
*peer
= wq
->spec
.data
;
2676 peer_unlock (peer
); /* bgp_clear_node_complete */
2678 /* Tickle FSM to start moving again */
2679 BGP_EVENT_ADD (peer
, Clearing_Completed
);
2683 bgp_clear_node_queue_init (struct peer
*peer
)
2685 #define CLEAR_QUEUE_NAME_LEN 26 /* "clear 2001:123:123:123::1" */
2686 char wname
[CLEAR_QUEUE_NAME_LEN
];
2688 snprintf (wname
, CLEAR_QUEUE_NAME_LEN
, "clear %s", peer
->host
);
2689 #undef CLEAR_QUEUE_NAME_LEN
2691 if ( (peer
->clear_node_queue
= work_queue_new (bm
->master
, wname
)) == NULL
)
2693 zlog_err ("%s: Failed to allocate work queue", __func__
);
2696 peer
->clear_node_queue
->spec
.hold
= 10;
2697 peer
->clear_node_queue
->spec
.workfunc
= &bgp_clear_route_node
;
2698 peer
->clear_node_queue
->spec
.del_item_data
= &bgp_clear_node_queue_del
;
2699 peer
->clear_node_queue
->spec
.completion_func
= &bgp_clear_node_complete
;
2700 peer
->clear_node_queue
->spec
.max_retries
= 0;
2702 /* we only 'lock' this peer reference when the queue is actually active */
2703 peer
->clear_node_queue
->spec
.data
= peer
;
2707 bgp_clear_route_table (struct peer
*peer
, afi_t afi
, safi_t safi
,
2708 struct bgp_table
*table
, struct peer
*rsclient
)
2710 struct bgp_node
*rn
;
2714 table
= (rsclient
) ? rsclient
->rib
[afi
][safi
] : peer
->bgp
->rib
[afi
][safi
];
2716 /* If still no table => afi/safi isn't configured at all or smth. */
2720 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2722 struct bgp_info
*ri
;
2723 struct bgp_adj_in
*ain
;
2724 struct bgp_adj_out
*aout
;
2726 if (rn
->info
== NULL
)
2729 /* XXX:TODO: This is suboptimal, every non-empty route_node is
2730 * queued for every clearing peer, regardless of whether it is
2731 * relevant to the peer at hand.
2733 * Overview: There are 3 different indices which need to be
2734 * scrubbed, potentially, when a peer is removed:
2736 * 1 peer's routes visible via the RIB (ie accepted routes)
2737 * 2 peer's routes visible by the (optional) peer's adj-in index
2738 * 3 other routes visible by the peer's adj-out index
2740 * 3 there is no hurry in scrubbing, once the struct peer is
2741 * removed from bgp->peer, we could just GC such deleted peer's
2742 * adj-outs at our leisure.
2744 * 1 and 2 must be 'scrubbed' in some way, at least made
2745 * invisible via RIB index before peer session is allowed to be
2746 * brought back up. So one needs to know when such a 'search' is
2751 * - there'd be a single global queue or a single RIB walker
2752 * - rather than tracking which route_nodes still need to be
2753 * examined on a peer basis, we'd track which peers still
2756 * Given that our per-peer prefix-counts now should be reliable,
2757 * this may actually be achievable. It doesn't seem to be a huge
2758 * problem at this time,
2760 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2761 if (ri
->peer
== peer
)
2763 bgp_lock_node (rn
); /* unlocked: bgp_clear_node_queue_del */
2764 work_queue_add (peer
->clear_node_queue
, rn
);
2767 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2768 if (ain
->peer
== peer
)
2770 bgp_adj_in_remove (rn
, ain
);
2771 bgp_unlock_node (rn
);
2774 for (aout
= rn
->adj_out
; aout
; aout
= aout
->next
)
2775 if (aout
->peer
== peer
)
2777 bgp_adj_out_remove (rn
, aout
, peer
, afi
, safi
);
2778 bgp_unlock_node (rn
);
2786 bgp_clear_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2788 struct bgp_node
*rn
;
2789 struct bgp_table
*table
;
2790 struct peer
*rsclient
;
2791 struct listnode
*node
, *nnode
;
2793 if (peer
->clear_node_queue
== NULL
)
2794 bgp_clear_node_queue_init (peer
);
2796 /* bgp_fsm.c keeps sessions in state Clearing, not transitioning to
2797 * Idle until it receives a Clearing_Completed event. This protects
2798 * against peers which flap faster than we can we clear, which could
2801 * a) race with routes from the new session being installed before
2802 * clear_route_node visits the node (to delete the route of that
2804 * b) resource exhaustion, clear_route_node likely leads to an entry
2805 * on the process_main queue. Fast-flapping could cause that queue
2808 if (!peer
->clear_node_queue
->thread
)
2809 peer_lock (peer
); /* bgp_clear_node_complete */
2811 if (safi
!= SAFI_MPLS_VPN
)
2812 bgp_clear_route_table (peer
, afi
, safi
, NULL
, NULL
);
2814 for (rn
= bgp_table_top (peer
->bgp
->rib
[afi
][safi
]); rn
;
2815 rn
= bgp_route_next (rn
))
2816 if ((table
= rn
->info
) != NULL
)
2817 bgp_clear_route_table (peer
, afi
, safi
, table
, NULL
);
2819 for (ALL_LIST_ELEMENTS (peer
->bgp
->rsclient
, node
, nnode
, rsclient
))
2821 if (CHECK_FLAG(rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
2822 bgp_clear_route_table (peer
, afi
, safi
, NULL
, rsclient
);
2825 /* If no routes were cleared, nothing was added to workqueue, the
2826 * completion function won't be run by workqueue code - call it here.
2827 * XXX: Actually, this assumption doesn't hold, see
2828 * bgp_clear_route_table(), we queue all non-empty nodes.
2830 * Additionally, there is a presumption in FSM that clearing is only
2831 * really needed if peer state is Established - peers in
2832 * pre-Established states shouldn't have any route-update state
2833 * associated with them (in or out).
2835 * We still can get here in pre-Established though, through
2836 * peer_delete -> bgp_fsm_change_status, so this is a useful sanity
2837 * check to ensure the assumption above holds.
2839 * At some future point, this check could be move to the top of the
2840 * function, and do a quick early-return when state is
2841 * pre-Established, avoiding above list and table scans. Once we're
2844 if (!peer
->clear_node_queue
->thread
)
2845 bgp_clear_node_complete (peer
->clear_node_queue
);
2848 /* clearing queue scheduled. Normal if in Established state
2849 * (and about to transition out of it), but otherwise...
2851 if (peer
->status
!= Established
)
2853 plog_err (peer
->log
, "%s [Error] State %s is not Established,"
2854 " but routes were cleared - bug!",
2855 peer
->host
, LOOKUP (bgp_status_msg
, peer
->status
));
2856 assert (peer
->status
== Established
);
2862 bgp_clear_route_all (struct peer
*peer
)
2867 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2868 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
2869 bgp_clear_route (peer
, afi
, safi
);
2873 bgp_clear_adj_in (struct peer
*peer
, afi_t afi
, safi_t safi
)
2875 struct bgp_table
*table
;
2876 struct bgp_node
*rn
;
2877 struct bgp_adj_in
*ain
;
2879 table
= peer
->bgp
->rib
[afi
][safi
];
2881 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2882 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
2883 if (ain
->peer
== peer
)
2885 bgp_adj_in_remove (rn
, ain
);
2886 bgp_unlock_node (rn
);
2892 bgp_clear_stale_route (struct peer
*peer
, afi_t afi
, safi_t safi
)
2894 struct bgp_node
*rn
;
2895 struct bgp_info
*ri
;
2896 struct bgp_table
*table
;
2898 table
= peer
->bgp
->rib
[afi
][safi
];
2900 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2902 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2903 if (ri
->peer
== peer
)
2905 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
2906 bgp_rib_remove (rn
, ri
, peer
, afi
, safi
);
2912 /* Delete all kernel routes. */
2914 bgp_cleanup_routes (void)
2917 struct listnode
*node
, *nnode
;
2918 struct bgp_node
*rn
;
2919 struct bgp_table
*table
;
2920 struct bgp_info
*ri
;
2922 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
2924 table
= bgp
->rib
[AFI_IP
][SAFI_UNICAST
];
2926 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2927 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2928 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
2929 && ri
->type
== ZEBRA_ROUTE_BGP
2930 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
2931 bgp_zebra_withdraw (&rn
->p
, ri
);
2933 table
= bgp
->rib
[AFI_IP6
][SAFI_UNICAST
];
2935 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
2936 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
2937 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
)
2938 && ri
->type
== ZEBRA_ROUTE_BGP
2939 && ri
->sub_type
== BGP_ROUTE_NORMAL
)
2940 bgp_zebra_withdraw (&rn
->p
, ri
);
2948 bgp_zclient_reset ();
2949 access_list_reset ();
2950 prefix_list_reset ();
2953 /* Parse NLRI stream. Withdraw NLRI is recognized by NULL attr
2956 bgp_nlri_parse (struct peer
*peer
, struct attr
*attr
, struct bgp_nlri
*packet
)
2964 /* Check peer status. */
2965 if (peer
->status
!= Established
)
2969 lim
= pnt
+ packet
->length
;
2971 for (; pnt
< lim
; pnt
+= psize
)
2973 /* Clear prefix structure. */
2974 memset (&p
, 0, sizeof (struct prefix
));
2976 /* Fetch prefix length. */
2977 p
.prefixlen
= *pnt
++;
2978 p
.family
= afi2family (packet
->afi
);
2980 /* Already checked in nlri_sanity_check(). We do double check
2982 if ((packet
->afi
== AFI_IP
&& p
.prefixlen
> 32)
2983 || (packet
->afi
== AFI_IP6
&& p
.prefixlen
> 128))
2986 /* Packet size overflow check. */
2987 psize
= PSIZE (p
.prefixlen
);
2989 /* When packet overflow occur return immediately. */
2990 if (pnt
+ psize
> lim
)
2993 /* Fetch prefix from NLRI packet. */
2994 memcpy (&p
.u
.prefix
, pnt
, psize
);
2996 /* Check address. */
2997 if (packet
->afi
== AFI_IP
&& packet
->safi
== SAFI_UNICAST
)
2999 if (IN_CLASSD (ntohl (p
.u
.prefix4
.s_addr
)))
3002 * From draft-ietf-idr-bgp4-22, Section 6.3:
3003 * If a BGP router receives an UPDATE message with a
3004 * semantically incorrect NLRI field, in which a prefix is
3005 * semantically incorrect (eg. an unexpected multicast IP
3006 * address), it should ignore the prefix.
3008 zlog (peer
->log
, LOG_ERR
,
3009 "IPv4 unicast NLRI is multicast address %s",
3010 inet_ntoa (p
.u
.prefix4
));
3017 /* Check address. */
3018 if (packet
->afi
== AFI_IP6
&& packet
->safi
== SAFI_UNICAST
)
3020 if (IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3024 zlog (peer
->log
, LOG_WARNING
,
3025 "IPv6 link-local NLRI received %s ignore this NLRI",
3026 inet_ntop (AF_INET6
, &p
.u
.prefix6
, buf
, BUFSIZ
));
3031 #endif /* HAVE_IPV6 */
3033 /* Normal process. */
3035 ret
= bgp_update (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
3036 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
, 0);
3038 ret
= bgp_withdraw (peer
, &p
, attr
, packet
->afi
, packet
->safi
,
3039 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
, NULL
);
3041 /* Address family configuration mismatch or maximum-prefix count
3047 /* Packet length consistency check. */
3054 /* NLRI encode syntax check routine. */
3056 bgp_nlri_sanity_check (struct peer
*peer
, int afi
, u_char
*pnt
,
3065 /* RFC1771 6.3 The NLRI field in the UPDATE message is checked for
3066 syntactic validity. If the field is syntactically incorrect,
3067 then the Error Subcode is set to Invalid Network Field. */
3073 /* Prefix length check. */
3074 if ((afi
== AFI_IP
&& prefixlen
> 32)
3075 || (afi
== AFI_IP6
&& prefixlen
> 128))
3077 plog_err (peer
->log
,
3078 "%s [Error] Update packet error (wrong prefix length %d)",
3079 peer
->host
, prefixlen
);
3080 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3081 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3085 /* Packet size overflow check. */
3086 psize
= PSIZE (prefixlen
);
3088 if (pnt
+ psize
> end
)
3090 plog_err (peer
->log
,
3091 "%s [Error] Update packet error"
3092 " (prefix data overflow prefix size is %d)",
3094 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3095 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3102 /* Packet length consistency check. */
3105 plog_err (peer
->log
,
3106 "%s [Error] Update packet error"
3107 " (prefix length mismatch with total length)",
3109 bgp_notify_send (peer
, BGP_NOTIFY_UPDATE_ERR
,
3110 BGP_NOTIFY_UPDATE_INVAL_NETWORK
);
3116 static struct bgp_static
*
3117 bgp_static_new (void)
3119 return XCALLOC (MTYPE_BGP_STATIC
, sizeof (struct bgp_static
));
3123 bgp_static_free (struct bgp_static
*bgp_static
)
3125 if (bgp_static
->rmap
.name
)
3126 free (bgp_static
->rmap
.name
);
3127 XFREE (MTYPE_BGP_STATIC
, bgp_static
);
3131 bgp_static_withdraw_rsclient (struct bgp
*bgp
, struct peer
*rsclient
,
3132 struct prefix
*p
, afi_t afi
, safi_t safi
)
3134 struct bgp_node
*rn
;
3135 struct bgp_info
*ri
;
3137 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3139 /* Check selected route and self inserted route. */
3140 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3141 if (ri
->peer
== bgp
->peer_self
3142 && ri
->type
== ZEBRA_ROUTE_BGP
3143 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3146 /* Withdraw static BGP route from routing table. */
3149 bgp_info_delete (rn
, ri
);
3150 bgp_process (bgp
, rn
, afi
, safi
);
3153 /* Unlock bgp_node_lookup. */
3154 bgp_unlock_node (rn
);
3158 bgp_static_update_rsclient (struct peer
*rsclient
, struct prefix
*p
,
3159 struct bgp_static
*bgp_static
,
3160 afi_t afi
, safi_t safi
)
3162 struct bgp_node
*rn
;
3163 struct bgp_info
*ri
;
3164 struct bgp_info
*new;
3165 struct bgp_info info
;
3166 struct attr
*attr_new
;
3167 struct attr attr
= {0 };
3168 struct attr new_attr
= { .extra
= 0 };
3171 char buf
[SU_ADDRSTRLEN
];
3173 bgp
= rsclient
->bgp
;
3175 assert (bgp_static
);
3179 rn
= bgp_afi_node_get (rsclient
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3181 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3183 attr
.nexthop
= bgp_static
->igpnexthop
;
3184 attr
.med
= bgp_static
->igpmetric
;
3185 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3187 if (bgp_static
->ttl
)
3189 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_AS_PATHLIMIT
);
3190 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3191 attr
.pathlimit
.as
= 0;
3192 attr
.pathlimit
.ttl
= bgp_static
->ttl
;
3195 if (bgp_static
->atomic
)
3196 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3198 /* Apply network route-map for export to this rsclient. */
3199 if (bgp_static
->rmap
.name
)
3201 struct attr attr_tmp
= attr
;
3202 info
.peer
= rsclient
;
3203 info
.attr
= &attr_tmp
;
3205 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_EXPORT
);
3206 SET_FLAG (rsclient
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3208 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3210 rsclient
->rmap_type
= 0;
3212 if (ret
== RMAP_DENYMATCH
)
3214 /* Free uninterned attribute. */
3215 bgp_attr_flush (&attr_tmp
);
3217 /* Unintern original. */
3218 aspath_unintern (attr
.aspath
);
3219 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
3220 bgp_attr_extra_free (&attr
);
3224 attr_new
= bgp_attr_intern (&attr_tmp
);
3227 attr_new
= bgp_attr_intern (&attr
);
3229 new_attr
= *attr_new
;
3231 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3233 if (bgp_import_modifier (rsclient
, bgp
->peer_self
, p
, &new_attr
, afi
, safi
)
3236 /* This BGP update is filtered. Log the reason then update BGP entry. */
3237 if (BGP_DEBUG (update
, UPDATE_IN
))
3238 zlog (rsclient
->log
, LOG_DEBUG
,
3239 "Static UPDATE about %s/%d -- DENIED for RS-client %s due to: import-policy",
3240 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
3241 p
->prefixlen
, rsclient
->host
);
3243 bgp
->peer_self
->rmap_type
= 0;
3245 bgp_attr_unintern (attr_new
);
3246 aspath_unintern (attr
.aspath
);
3247 bgp_attr_extra_free (&attr
);
3249 bgp_static_withdraw_rsclient (bgp
, rsclient
, p
, afi
, safi
);
3254 bgp
->peer_self
->rmap_type
= 0;
3256 bgp_attr_unintern (attr_new
);
3257 attr_new
= bgp_attr_intern (&new_attr
);
3259 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3260 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3261 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3266 if (attrhash_cmp (ri
->attr
, attr_new
) &&
3267 !CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3269 bgp_unlock_node (rn
);
3270 bgp_attr_unintern (attr_new
);
3271 aspath_unintern (attr
.aspath
);
3272 bgp_attr_extra_free (&attr
);
3277 /* The attribute is changed. */
3278 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
3280 /* Rewrite BGP route information. */
3281 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3282 bgp_info_restore(rn
, ri
);
3283 bgp_attr_unintern (ri
->attr
);
3284 ri
->attr
= attr_new
;
3285 ri
->uptime
= time (NULL
);
3287 /* Process change. */
3288 bgp_process (bgp
, rn
, afi
, safi
);
3289 bgp_unlock_node (rn
);
3290 aspath_unintern (attr
.aspath
);
3291 bgp_attr_extra_free (&attr
);
3296 /* Make new BGP info. */
3297 new = bgp_info_new ();
3298 new->type
= ZEBRA_ROUTE_BGP
;
3299 new->sub_type
= BGP_ROUTE_STATIC
;
3300 new->peer
= bgp
->peer_self
;
3301 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3302 new->attr
= attr_new
;
3303 new->uptime
= time (NULL
);
3305 /* Register new BGP information. */
3306 bgp_info_add (rn
, new);
3308 /* route_node_get lock */
3309 bgp_unlock_node (rn
);
3311 /* Process change. */
3312 bgp_process (bgp
, rn
, afi
, safi
);
3314 /* Unintern original. */
3315 aspath_unintern (attr
.aspath
);
3316 bgp_attr_extra_free (&attr
);
3320 bgp_static_update_main (struct bgp
*bgp
, struct prefix
*p
,
3321 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3323 struct bgp_node
*rn
;
3324 struct bgp_info
*ri
;
3325 struct bgp_info
*new;
3326 struct bgp_info info
;
3327 struct attr attr
= { 0 };
3328 struct attr
*attr_new
;
3331 assert (bgp_static
);
3335 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3337 bgp_attr_default_set (&attr
, BGP_ORIGIN_IGP
);
3339 attr
.nexthop
= bgp_static
->igpnexthop
;
3340 attr
.med
= bgp_static
->igpmetric
;
3341 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
3343 if (bgp_static
->ttl
)
3345 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_AS_PATHLIMIT
);
3346 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3347 attr
.pathlimit
.as
= 0;
3348 attr
.pathlimit
.ttl
= bgp_static
->ttl
;
3351 if (bgp_static
->atomic
)
3352 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
);
3354 /* Apply route-map. */
3355 if (bgp_static
->rmap
.name
)
3357 struct attr attr_tmp
= attr
;
3358 info
.peer
= bgp
->peer_self
;
3359 info
.attr
= &attr_tmp
;
3361 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_NETWORK
);
3363 ret
= route_map_apply (bgp_static
->rmap
.map
, p
, RMAP_BGP
, &info
);
3365 bgp
->peer_self
->rmap_type
= 0;
3367 if (ret
== RMAP_DENYMATCH
)
3369 /* Free uninterned attribute. */
3370 bgp_attr_flush (&attr_tmp
);
3372 /* Unintern original. */
3373 aspath_unintern (attr
.aspath
);
3374 bgp_attr_extra_free (&attr
);
3375 bgp_static_withdraw (bgp
, p
, afi
, safi
);
3378 attr_new
= bgp_attr_intern (&attr_tmp
);
3381 attr_new
= bgp_attr_intern (&attr
);
3383 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3384 if (ri
->peer
== bgp
->peer_self
&& ri
->type
== ZEBRA_ROUTE_BGP
3385 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3390 if (attrhash_cmp (ri
->attr
, attr_new
) &&
3391 !CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3393 bgp_unlock_node (rn
);
3394 bgp_attr_unintern (attr_new
);
3395 aspath_unintern (attr
.aspath
);
3396 bgp_attr_extra_free (&attr
);
3401 /* The attribute is changed. */
3402 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
3404 /* Rewrite BGP route information. */
3405 if (CHECK_FLAG(ri
->flags
, BGP_INFO_REMOVED
))
3406 bgp_info_restore(rn
, ri
);
3408 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3409 bgp_attr_unintern (ri
->attr
);
3410 ri
->attr
= attr_new
;
3411 ri
->uptime
= time (NULL
);
3413 /* Process change. */
3414 bgp_aggregate_increment (bgp
, p
, ri
, afi
, safi
);
3415 bgp_process (bgp
, rn
, afi
, safi
);
3416 bgp_unlock_node (rn
);
3417 aspath_unintern (attr
.aspath
);
3418 bgp_attr_extra_free (&attr
);
3423 /* Make new BGP info. */
3424 new = bgp_info_new ();
3425 new->type
= ZEBRA_ROUTE_BGP
;
3426 new->sub_type
= BGP_ROUTE_STATIC
;
3427 new->peer
= bgp
->peer_self
;
3428 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3429 new->attr
= attr_new
;
3430 new->uptime
= time (NULL
);
3432 /* Aggregate address increment. */
3433 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3435 /* Register new BGP information. */
3436 bgp_info_add (rn
, new);
3438 /* route_node_get lock */
3439 bgp_unlock_node (rn
);
3441 /* Process change. */
3442 bgp_process (bgp
, rn
, afi
, safi
);
3444 /* Unintern original. */
3445 aspath_unintern (attr
.aspath
);
3446 bgp_attr_extra_free (&attr
);
3450 bgp_static_update (struct bgp
*bgp
, struct prefix
*p
,
3451 struct bgp_static
*bgp_static
, afi_t afi
, safi_t safi
)
3453 struct peer
*rsclient
;
3454 struct listnode
*node
, *nnode
;
3456 bgp_static_update_main (bgp
, p
, bgp_static
, afi
, safi
);
3458 for (ALL_LIST_ELEMENTS (bgp
->rsclient
, node
, nnode
, rsclient
))
3460 if (CHECK_FLAG (rsclient
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
3461 bgp_static_update_rsclient (rsclient
, p
, bgp_static
, afi
, safi
);
3466 bgp_static_update_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
3467 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
3469 struct bgp_node
*rn
;
3470 struct bgp_info
*new;
3472 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3474 /* Make new BGP info. */
3475 new = bgp_info_new ();
3476 new->type
= ZEBRA_ROUTE_BGP
;
3477 new->sub_type
= BGP_ROUTE_STATIC
;
3478 new->peer
= bgp
->peer_self
;
3479 new->attr
= bgp_attr_default_intern (BGP_ORIGIN_IGP
);
3480 SET_FLAG (new->flags
, BGP_INFO_VALID
);
3481 new->uptime
= time (NULL
);
3482 new->extra
= bgp_info_extra_new();
3483 memcpy (new->extra
->tag
, tag
, 3);
3485 /* Aggregate address increment. */
3486 bgp_aggregate_increment (bgp
, p
, new, afi
, safi
);
3488 /* Register new BGP information. */
3489 bgp_info_add (rn
, new);
3491 /* route_node_get lock */
3492 bgp_unlock_node (rn
);
3494 /* Process change. */
3495 bgp_process (bgp
, rn
, afi
, safi
);
3499 bgp_static_withdraw (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
3502 struct bgp_node
*rn
;
3503 struct bgp_info
*ri
;
3505 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, NULL
);
3507 /* Check selected route and self inserted route. */
3508 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3509 if (ri
->peer
== bgp
->peer_self
3510 && ri
->type
== ZEBRA_ROUTE_BGP
3511 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3514 /* Withdraw static BGP route from routing table. */
3517 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3518 bgp_info_delete (rn
, ri
);
3519 bgp_process (bgp
, rn
, afi
, safi
);
3522 /* Unlock bgp_node_lookup. */
3523 bgp_unlock_node (rn
);
3527 bgp_check_local_routes_rsclient (struct peer
*rsclient
, afi_t afi
, safi_t safi
)
3529 struct bgp_static
*bgp_static
;
3531 struct bgp_node
*rn
;
3534 bgp
= rsclient
->bgp
;
3536 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3537 if ((bgp_static
= rn
->info
) != NULL
)
3541 bgp_static_update_rsclient (rsclient
, p
, bgp_static
,
3547 bgp_static_withdraw_vpnv4 (struct bgp
*bgp
, struct prefix
*p
, u_int16_t afi
,
3548 u_char safi
, struct prefix_rd
*prd
, u_char
*tag
)
3550 struct bgp_node
*rn
;
3551 struct bgp_info
*ri
;
3553 rn
= bgp_afi_node_get (bgp
->rib
[afi
][safi
], afi
, safi
, p
, prd
);
3555 /* Check selected route and self inserted route. */
3556 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
3557 if (ri
->peer
== bgp
->peer_self
3558 && ri
->type
== ZEBRA_ROUTE_BGP
3559 && ri
->sub_type
== BGP_ROUTE_STATIC
)
3562 /* Withdraw static BGP route from routing table. */
3565 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, safi
);
3566 bgp_info_delete (rn
, ri
);
3567 bgp_process (bgp
, rn
, afi
, safi
);
3570 /* Unlock bgp_node_lookup. */
3571 bgp_unlock_node (rn
);
3575 bgp_pathlimit_update_parents (struct bgp
*bgp
, struct bgp_node
*rn
,
3578 struct bgp_node
*parent
= rn
;
3579 struct bgp_static
*sp
;
3581 /* Existing static changed TTL, search parents and adjust their atomic */
3582 while ((parent
= parent
->parent
))
3583 if ((sp
= parent
->info
))
3585 int sp_level
= (sp
->atomic
? 1 : 0);
3586 ttl_edge
? sp
->atomic
++ : sp
->atomic
--;
3588 /* did we change state of parent whether atomic is set or not? */
3589 if (sp_level
!= (sp
->atomic
? 1 : 0))
3591 bgp_static_update (bgp
, &parent
->p
, sp
,
3592 rn
->table
->afi
, rn
->table
->safi
);
3597 /* Configure static BGP network. When user don't run zebra, static
3598 route should be installed as valid. */
3600 bgp_static_set (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3601 u_int16_t afi
, u_char safi
, const char *rmap
, int backdoor
,
3606 struct bgp_static
*bgp_static
;
3607 struct bgp_node
*rn
;
3608 u_char need_update
= 0;
3609 u_char ttl_change
= 0;
3610 u_char ttl_edge
= (ttl
? 1 : 0);
3613 /* Convert IP prefix string to struct prefix. */
3614 ret
= str2prefix (ip_str
, &p
);
3617 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3621 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3623 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3627 #endif /* HAVE_IPV6 */
3631 /* Set BGP static route configuration. */
3632 rn
= bgp_node_get (bgp
->route
[afi
][safi
], &p
);
3636 /* Configuration change. */
3637 bgp_static
= rn
->info
;
3639 /* Check previous routes are installed into BGP. */
3640 if (bgp_static
->valid
)
3642 if (bgp_static
->backdoor
!= backdoor
3643 || bgp_static
->ttl
!= ttl
)
3647 /* need to catch TTL set/unset transitions for handling of
3650 if ((bgp_static
->ttl
? 1 : 0) != ttl_edge
)
3653 bgp_static
->backdoor
= backdoor
;
3654 bgp_static
->ttl
= ttl
;
3658 if (bgp_static
->rmap
.name
)
3659 free (bgp_static
->rmap
.name
);
3660 bgp_static
->rmap
.name
= strdup (rmap
);
3661 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
3665 if (bgp_static
->rmap
.name
)
3666 free (bgp_static
->rmap
.name
);
3667 bgp_static
->rmap
.name
= NULL
;
3668 bgp_static
->rmap
.map
= NULL
;
3669 bgp_static
->valid
= 0;
3671 bgp_unlock_node (rn
);
3675 /* New configuration. */
3676 bgp_static
= bgp_static_new ();
3677 bgp_static
->backdoor
= backdoor
;
3678 bgp_static
->valid
= 0;
3679 bgp_static
->igpmetric
= 0;
3680 bgp_static
->igpnexthop
.s_addr
= 0;
3681 bgp_static
->ttl
= ttl
;
3682 ttl_change
= ttl_edge
;
3687 if (bgp_static
->rmap
.name
)
3688 free (bgp_static
->rmap
.name
);
3689 bgp_static
->rmap
.name
= strdup (rmap
);
3690 bgp_static
->rmap
.map
= route_map_lookup_by_name (rmap
);
3692 rn
->info
= bgp_static
;
3695 /* ".. sites that choose to advertise the
3696 * AS_PATHLIMIT path attribute SHOULD advertise the ATOMIC_AGGREGATE on
3697 * all less specific covering prefixes as well as the more specific
3701 * Prefix that has just had pathlimit set/unset:
3702 * - Must bump ATOMIC refcount on all parents.
3704 * To catch less specific prefixes:
3705 * - Must search children for ones with TTL, bump atomic refcount
3706 * (we dont care if we're deleting a less specific prefix..)
3710 /* Existing static changed TTL, search parents and adjust their atomic */
3711 bgp_pathlimit_update_parents (bgp
, rn
, ttl_edge
);
3716 struct bgp_node
*child
;
3717 struct bgp_static
*sc
;
3719 /* New static, search children and bump this statics atomic.. */
3720 child
= bgp_lock_node (rn
); /* route_next_until unlocks it.. */
3721 while ((child
= bgp_route_next_until (child
, rn
)))
3723 if ((sc
= child
->info
) && sc
->ttl
)
3724 bgp_static
->atomic
++;
3728 /* If BGP scan is not enabled, we should install this route here. */
3729 if (! bgp_flag_check (bgp
, BGP_FLAG_IMPORT_CHECK
))
3731 bgp_static
->valid
= 1;
3734 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
3736 if (! bgp_static
->backdoor
)
3737 bgp_static_update (bgp
, &p
, bgp_static
, afi
, safi
);
3743 /* Configure static BGP network. */
3745 bgp_static_unset (struct vty
*vty
, struct bgp
*bgp
, const char *ip_str
,
3746 u_int16_t afi
, u_char safi
)
3750 struct bgp_static
*bgp_static
;
3751 struct bgp_node
*rn
;
3753 /* Convert IP prefix string to struct prefix. */
3754 ret
= str2prefix (ip_str
, &p
);
3757 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3761 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&p
.u
.prefix6
))
3763 vty_out (vty
, "%% Malformed prefix (link-local address)%s",
3767 #endif /* HAVE_IPV6 */
3771 rn
= bgp_node_lookup (bgp
->route
[afi
][safi
], &p
);
3774 vty_out (vty
, "%% Can't find specified static route configuration.%s",
3779 bgp_static
= rn
->info
;
3781 /* decrement atomic in parents, see bgp_static_set */
3782 bgp_pathlimit_update_parents (bgp
, rn
, 0);
3784 /* Update BGP RIB. */
3785 if (! bgp_static
->backdoor
)
3786 bgp_static_withdraw (bgp
, &p
, afi
, safi
);
3788 /* Clear configuration. */
3789 bgp_static_free (bgp_static
);
3791 bgp_unlock_node (rn
);
3792 bgp_unlock_node (rn
);
3797 /* Called from bgp_delete(). Delete all static routes from the BGP
3800 bgp_static_delete (struct bgp
*bgp
)
3804 struct bgp_node
*rn
;
3805 struct bgp_node
*rm
;
3806 struct bgp_table
*table
;
3807 struct bgp_static
*bgp_static
;
3809 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
3810 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
3811 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
3812 if (rn
->info
!= NULL
)
3814 if (safi
== SAFI_MPLS_VPN
)
3818 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
3820 bgp_static
= rn
->info
;
3821 bgp_static_withdraw_vpnv4 (bgp
, &rm
->p
,
3822 AFI_IP
, SAFI_MPLS_VPN
,
3823 (struct prefix_rd
*)&rn
->p
,
3825 bgp_static_free (bgp_static
);
3827 bgp_unlock_node (rn
);
3832 bgp_static
= rn
->info
;
3833 bgp_static_withdraw (bgp
, &rn
->p
, afi
, safi
);
3834 bgp_static_free (bgp_static
);
3836 bgp_unlock_node (rn
);
3842 bgp_static_set_vpnv4 (struct vty
*vty
, const char *ip_str
, const char *rd_str
,
3843 const char *tag_str
)
3847 struct prefix_rd prd
;
3849 struct bgp_node
*prn
;
3850 struct bgp_node
*rn
;
3851 struct bgp_table
*table
;
3852 struct bgp_static
*bgp_static
;
3857 ret
= str2prefix (ip_str
, &p
);
3860 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3865 ret
= str2prefix_rd (rd_str
, &prd
);
3868 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
3872 ret
= str2tag (tag_str
, tag
);
3875 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
3879 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
3880 (struct prefix
*)&prd
);
3881 if (prn
->info
== NULL
)
3882 prn
->info
= bgp_table_init (AFI_IP
, SAFI_MPLS_VPN
);
3884 bgp_unlock_node (prn
);
3887 rn
= bgp_node_get (table
, &p
);
3891 vty_out (vty
, "%% Same network configuration exists%s", VTY_NEWLINE
);
3892 bgp_unlock_node (rn
);
3896 /* New configuration. */
3897 bgp_static
= bgp_static_new ();
3898 bgp_static
->valid
= 1;
3899 memcpy (bgp_static
->tag
, tag
, 3);
3900 rn
->info
= bgp_static
;
3902 bgp_static_update_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
3908 /* Configure static BGP network. */
3910 bgp_static_unset_vpnv4 (struct vty
*vty
, const char *ip_str
,
3911 const char *rd_str
, const char *tag_str
)
3916 struct prefix_rd prd
;
3917 struct bgp_node
*prn
;
3918 struct bgp_node
*rn
;
3919 struct bgp_table
*table
;
3920 struct bgp_static
*bgp_static
;
3925 /* Convert IP prefix string to struct prefix. */
3926 ret
= str2prefix (ip_str
, &p
);
3929 vty_out (vty
, "%% Malformed prefix%s", VTY_NEWLINE
);
3934 ret
= str2prefix_rd (rd_str
, &prd
);
3937 vty_out (vty
, "%% Malformed rd%s", VTY_NEWLINE
);
3941 ret
= str2tag (tag_str
, tag
);
3944 vty_out (vty
, "%% Malformed tag%s", VTY_NEWLINE
);
3948 prn
= bgp_node_get (bgp
->route
[AFI_IP
][SAFI_MPLS_VPN
],
3949 (struct prefix
*)&prd
);
3950 if (prn
->info
== NULL
)
3951 prn
->info
= bgp_table_init (AFI_IP
, SAFI_MPLS_VPN
);
3953 bgp_unlock_node (prn
);
3956 rn
= bgp_node_lookup (table
, &p
);
3960 bgp_static_withdraw_vpnv4 (bgp
, &p
, AFI_IP
, SAFI_MPLS_VPN
, &prd
, tag
);
3962 bgp_static
= rn
->info
;
3963 bgp_static_free (bgp_static
);
3965 bgp_unlock_node (rn
);
3966 bgp_unlock_node (rn
);
3969 vty_out (vty
, "%% Can't find the route%s", VTY_NEWLINE
);
3976 "network A.B.C.D/M",
3977 "Specify a network to announce via BGP\n"
3978 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
3983 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[1], 1, 255);
3985 return bgp_static_set (vty
, vty
->index
, argv
[0],
3986 AFI_IP
, bgp_node_safi (vty
), NULL
, 0, ttl
);
3990 bgp_network_ttl_cmd
,
3991 "network A.B.C.D/M pathlimit <0-255>",
3992 "Specify a network to announce via BGP\n"
3993 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3994 "AS-Path hopcount limit attribute\n"
3995 "AS-Pathlimit TTL, in number of AS-Path hops\n")
3997 DEFUN (bgp_network_route_map
,
3998 bgp_network_route_map_cmd
,
3999 "network A.B.C.D/M route-map WORD",
4000 "Specify a network to announce via BGP\n"
4001 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4002 "Route-map to modify the attributes\n"
4003 "Name of the route map\n")
4005 return bgp_static_set (vty
, vty
->index
, argv
[0],
4006 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0, 0);
4009 DEFUN (bgp_network_backdoor
,
4010 bgp_network_backdoor_cmd
,
4011 "network A.B.C.D/M backdoor",
4012 "Specify a network to announce via BGP\n"
4013 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4014 "Specify a BGP backdoor route\n")
4019 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[1], 1, 255);
4021 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP
, SAFI_UNICAST
,
4025 ALIAS (bgp_network_backdoor
,
4026 bgp_network_backdoor_ttl_cmd
,
4027 "network A.B.C.D/M backdoor pathlimit <0-255>",
4028 "Specify a network to announce via BGP\n"
4029 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4030 "Specify a BGP backdoor route\n"
4031 "AS-Path hopcount limit attribute\n"
4032 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4034 DEFUN (bgp_network_mask
,
4035 bgp_network_mask_cmd
,
4036 "network A.B.C.D mask A.B.C.D",
4037 "Specify a network to announce via BGP\n"
4043 char prefix_str
[BUFSIZ
];
4047 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[2], 1, 255);
4049 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4052 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4056 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4057 AFI_IP
, bgp_node_safi (vty
), NULL
, 0, ttl
);
4060 ALIAS (bgp_network_mask
,
4061 bgp_network_mask_ttl_cmd
,
4062 "network A.B.C.D mask A.B.C.D pathlimit <0-255>",
4063 "Specify a network to announce via BGP\n"
4067 "AS-Path hopcount limit attribute\n"
4068 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4070 DEFUN (bgp_network_mask_route_map
,
4071 bgp_network_mask_route_map_cmd
,
4072 "network A.B.C.D mask A.B.C.D route-map WORD",
4073 "Specify a network to announce via BGP\n"
4077 "Route-map to modify the attributes\n"
4078 "Name of the route map\n")
4081 char prefix_str
[BUFSIZ
];
4083 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4086 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4090 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4091 AFI_IP
, bgp_node_safi (vty
), argv
[2], 0, 0);
4094 DEFUN (bgp_network_mask_backdoor
,
4095 bgp_network_mask_backdoor_cmd
,
4096 "network A.B.C.D mask A.B.C.D backdoor",
4097 "Specify a network to announce via BGP\n"
4101 "Specify a BGP backdoor route\n")
4104 char prefix_str
[BUFSIZ
];
4108 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[2], 1, 255);
4110 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4113 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4117 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
,
4121 ALIAS (bgp_network_mask_backdoor
,
4122 bgp_network_mask_backdoor_ttl_cmd
,
4123 "network A.B.C.D mask A.B.C.D backdoor pathlimit <0-255>",
4124 "Specify a network to announce via BGP\n"
4128 "Specify a BGP backdoor route\n"
4129 "AS-Path hopcount limit attribute\n"
4130 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4132 DEFUN (bgp_network_mask_natural
,
4133 bgp_network_mask_natural_cmd
,
4135 "Specify a network to announce via BGP\n"
4139 char prefix_str
[BUFSIZ
];
4143 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[1], 1, 255);
4145 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4148 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4152 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4153 AFI_IP
, bgp_node_safi (vty
), NULL
, 0, ttl
);
4156 ALIAS (bgp_network_mask_natural
,
4157 bgp_network_mask_natural_ttl_cmd
,
4158 "network A.B.C.D pathlimit <0-255>",
4159 "Specify a network to announce via BGP\n"
4161 "AS-Path hopcount limit attribute\n"
4162 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4164 DEFUN (bgp_network_mask_natural_route_map
,
4165 bgp_network_mask_natural_route_map_cmd
,
4166 "network A.B.C.D route-map WORD",
4167 "Specify a network to announce via BGP\n"
4169 "Route-map to modify the attributes\n"
4170 "Name of the route map\n")
4173 char prefix_str
[BUFSIZ
];
4175 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4178 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4182 return bgp_static_set (vty
, vty
->index
, prefix_str
,
4183 AFI_IP
, bgp_node_safi (vty
), argv
[1], 0, 0);
4186 DEFUN (bgp_network_mask_natural_backdoor
,
4187 bgp_network_mask_natural_backdoor_cmd
,
4188 "network A.B.C.D backdoor",
4189 "Specify a network to announce via BGP\n"
4191 "Specify a BGP backdoor route\n")
4194 char prefix_str
[BUFSIZ
];
4198 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[1], 1, 255);
4200 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4203 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4207 return bgp_static_set (vty
, vty
->index
, prefix_str
, AFI_IP
, SAFI_UNICAST
,
4211 ALIAS (bgp_network_mask_natural_backdoor
,
4212 bgp_network_mask_natural_backdoor_ttl_cmd
,
4213 "network A.B.C.D backdoor pathlimit (1-255>",
4214 "Specify a network to announce via BGP\n"
4216 "Specify a BGP backdoor route\n"
4217 "AS-Path hopcount limit attribute\n"
4218 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4220 DEFUN (no_bgp_network
,
4222 "no network A.B.C.D/M",
4224 "Specify a network to announce via BGP\n"
4225 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
4227 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP
,
4228 bgp_node_safi (vty
));
4231 ALIAS (no_bgp_network
,
4232 no_bgp_network_ttl_cmd
,
4233 "no network A.B.C.D/M pathlimit <0-255>",
4235 "Specify a network to announce via BGP\n"
4236 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4237 "AS-Path hopcount limit attribute\n"
4238 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4240 ALIAS (no_bgp_network
,
4241 no_bgp_network_route_map_cmd
,
4242 "no network A.B.C.D/M route-map WORD",
4244 "Specify a network to announce via BGP\n"
4245 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4246 "Route-map to modify the attributes\n"
4247 "Name of the route map\n")
4249 ALIAS (no_bgp_network
,
4250 no_bgp_network_backdoor_cmd
,
4251 "no network A.B.C.D/M backdoor",
4253 "Specify a network to announce via BGP\n"
4254 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4255 "Specify a BGP backdoor route\n")
4257 ALIAS (no_bgp_network
,
4258 no_bgp_network_backdoor_ttl_cmd
,
4259 "no network A.B.C.D/M backdoor pathlimit <0-255>",
4261 "Specify a network to announce via BGP\n"
4262 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
4263 "Specify a BGP backdoor route\n"
4264 "AS-Path hopcount limit attribute\n"
4265 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4267 DEFUN (no_bgp_network_mask
,
4268 no_bgp_network_mask_cmd
,
4269 "no network A.B.C.D mask A.B.C.D",
4271 "Specify a network to announce via BGP\n"
4277 char prefix_str
[BUFSIZ
];
4279 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
4282 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4286 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
4287 bgp_node_safi (vty
));
4290 ALIAS (no_bgp_network
,
4291 no_bgp_network_mask_ttl_cmd
,
4292 "no network A.B.C.D mask A.B.C.D pathlimit <0-255>",
4294 "Specify a network to announce via BGP\n"
4298 "AS-Path hopcount limit attribute\n"
4299 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4301 ALIAS (no_bgp_network_mask
,
4302 no_bgp_network_mask_route_map_cmd
,
4303 "no network A.B.C.D mask A.B.C.D route-map WORD",
4305 "Specify a network to announce via BGP\n"
4309 "Route-map to modify the attributes\n"
4310 "Name of the route map\n")
4312 ALIAS (no_bgp_network_mask
,
4313 no_bgp_network_mask_backdoor_cmd
,
4314 "no network A.B.C.D mask A.B.C.D backdoor",
4316 "Specify a network to announce via BGP\n"
4320 "Specify a BGP backdoor route\n")
4322 ALIAS (no_bgp_network_mask
,
4323 no_bgp_network_mask_backdoor_ttl_cmd
,
4324 "no network A.B.C.D mask A.B.C.D backdoor pathlimit <0-255>",
4326 "Specify a network to announce via BGP\n"
4330 "Specify a BGP backdoor route\n"
4331 "AS-Path hopcount limit attribute\n"
4332 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4334 DEFUN (no_bgp_network_mask_natural
,
4335 no_bgp_network_mask_natural_cmd
,
4336 "no network A.B.C.D",
4338 "Specify a network to announce via BGP\n"
4342 char prefix_str
[BUFSIZ
];
4344 ret
= netmask_str2prefix_str (argv
[0], NULL
, prefix_str
);
4347 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
4351 return bgp_static_unset (vty
, vty
->index
, prefix_str
, AFI_IP
,
4352 bgp_node_safi (vty
));
4355 ALIAS (no_bgp_network_mask_natural
,
4356 no_bgp_network_mask_natural_route_map_cmd
,
4357 "no network A.B.C.D route-map WORD",
4359 "Specify a network to announce via BGP\n"
4361 "Route-map to modify the attributes\n"
4362 "Name of the route map\n")
4364 ALIAS (no_bgp_network_mask_natural
,
4365 no_bgp_network_mask_natural_backdoor_cmd
,
4366 "no network A.B.C.D backdoor",
4368 "Specify a network to announce via BGP\n"
4370 "Specify a BGP backdoor route\n")
4372 ALIAS (no_bgp_network_mask_natural
,
4373 no_bgp_network_mask_natural_ttl_cmd
,
4374 "no network A.B.C.D pathlimit <0-255>",
4376 "Specify a network to announce via BGP\n"
4378 "AS-Path hopcount limit attribute\n"
4379 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4381 ALIAS (no_bgp_network_mask_natural
,
4382 no_bgp_network_mask_natural_backdoor_ttl_cmd
,
4383 "no network A.B.C.D backdoor pathlimit <0-255>",
4385 "Specify a network to announce via BGP\n"
4387 "Specify a BGP backdoor route\n"
4388 "AS-Path hopcount limit attribute\n"
4389 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4392 DEFUN (ipv6_bgp_network
,
4393 ipv6_bgp_network_cmd
,
4394 "network X:X::X:X/M",
4395 "Specify a network to announce via BGP\n"
4396 "IPv6 prefix <network>/<length>\n")
4401 VTY_GET_INTEGER_RANGE ("Pathlimit TTL", ttl
, argv
[1], 1, 255);
4403 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
4407 ALIAS (ipv6_bgp_network
,
4408 ipv6_bgp_network_ttl_cmd
,
4409 "network X:X::X:X/M pathlimit <0-255>",
4410 "Specify a network to announce via BGP\n"
4411 "IPv6 prefix <network>/<length>\n"
4412 "AS-Path hopcount limit attribute\n"
4413 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4415 DEFUN (ipv6_bgp_network_route_map
,
4416 ipv6_bgp_network_route_map_cmd
,
4417 "network X:X::X:X/M route-map WORD",
4418 "Specify a network to announce via BGP\n"
4419 "IPv6 prefix <network>/<length>\n"
4420 "Route-map to modify the attributes\n"
4421 "Name of the route map\n")
4423 return bgp_static_set (vty
, vty
->index
, argv
[0], AFI_IP6
,
4424 bgp_node_safi (vty
), argv
[1], 0, 0);
4427 DEFUN (no_ipv6_bgp_network
,
4428 no_ipv6_bgp_network_cmd
,
4429 "no network X:X::X:X/M",
4431 "Specify a network to announce via BGP\n"
4432 "IPv6 prefix <network>/<length>\n")
4434 return bgp_static_unset (vty
, vty
->index
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
4437 ALIAS (no_ipv6_bgp_network
,
4438 no_ipv6_bgp_network_route_map_cmd
,
4439 "no network X:X::X:X/M route-map WORD",
4441 "Specify a network to announce via BGP\n"
4442 "IPv6 prefix <network>/<length>\n"
4443 "Route-map to modify the attributes\n"
4444 "Name of the route map\n")
4446 ALIAS (no_ipv6_bgp_network
,
4447 no_ipv6_bgp_network_ttl_cmd
,
4448 "no network X:X::X:X/M pathlimit <0-255>",
4450 "Specify a network to announce via BGP\n"
4451 "IPv6 prefix <network>/<length>\n"
4452 "AS-Path hopcount limit attribute\n"
4453 "AS-Pathlimit TTL, in number of AS-Path hops\n")
4455 ALIAS (ipv6_bgp_network
,
4456 old_ipv6_bgp_network_cmd
,
4457 "ipv6 bgp network X:X::X:X/M",
4460 "Specify a network to announce via BGP\n"
4461 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
4463 ALIAS (no_ipv6_bgp_network
,
4464 old_no_ipv6_bgp_network_cmd
,
4465 "no ipv6 bgp network X:X::X:X/M",
4469 "Specify a network to announce via BGP\n"
4470 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
4471 #endif /* HAVE_IPV6 */
4473 /* Aggreagete address:
4475 advertise-map Set condition to advertise attribute
4476 as-set Generate AS set path information
4477 attribute-map Set attributes of aggregate
4478 route-map Set parameters of aggregate
4479 summary-only Filter more specific routes from updates
4480 suppress-map Conditionally filter more specific routes from updates
4483 struct bgp_aggregate
4485 /* Summary-only flag. */
4486 u_char summary_only
;
4488 /* AS set generation. */
4491 /* Route-map for aggregated route. */
4492 struct route_map
*map
;
4494 /* Suppress-count. */
4495 unsigned long count
;
4497 /* SAFI configuration. */
4501 static struct bgp_aggregate
*
4502 bgp_aggregate_new (void)
4504 return XCALLOC (MTYPE_BGP_AGGREGATE
, sizeof (struct bgp_aggregate
));
4508 bgp_aggregate_free (struct bgp_aggregate
*aggregate
)
4510 XFREE (MTYPE_BGP_AGGREGATE
, aggregate
);
4514 bgp_aggregate_route (struct bgp
*bgp
, struct prefix
*p
, struct bgp_info
*rinew
,
4515 afi_t afi
, safi_t safi
, struct bgp_info
*del
,
4516 struct bgp_aggregate
*aggregate
)
4518 struct bgp_table
*table
;
4519 struct bgp_node
*top
;
4520 struct bgp_node
*rn
;
4522 struct aspath
*aspath
= NULL
;
4523 struct aspath
*asmerge
= NULL
;
4524 struct community
*community
= NULL
;
4525 struct community
*commerge
= NULL
;
4526 struct in_addr nexthop
;
4528 struct bgp_info
*ri
;
4529 struct bgp_info
*new;
4531 unsigned long match
= 0;
4533 /* Record adding route's nexthop and med. */
4536 nexthop
= rinew
->attr
->nexthop
;
4537 med
= rinew
->attr
->med
;
4540 /* ORIGIN attribute: If at least one route among routes that are
4541 aggregated has ORIGIN with the value INCOMPLETE, then the
4542 aggregated route must have the ORIGIN attribute with the value
4543 INCOMPLETE. Otherwise, if at least one route among routes that
4544 are aggregated has ORIGIN with the value EGP, then the aggregated
4545 route must have the origin attribute with the value EGP. In all
4546 other case the value of the ORIGIN attribute of the aggregated
4547 route is INTERNAL. */
4548 origin
= BGP_ORIGIN_IGP
;
4550 table
= bgp
->rib
[afi
][safi
];
4552 top
= bgp_node_get (table
, p
);
4553 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4554 if (rn
->p
.prefixlen
> p
->prefixlen
)
4558 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4560 if (BGP_INFO_HOLDDOWN (ri
))
4563 if (del
&& ri
== del
)
4566 if (! rinew
&& first
)
4568 nexthop
= ri
->attr
->nexthop
;
4569 med
= ri
->attr
->med
;
4573 #ifdef AGGREGATE_NEXTHOP_CHECK
4574 if (! IPV4_ADDR_SAME (&ri
->attr
->nexthop
, &nexthop
)
4575 || ri
->attr
->med
!= med
)
4578 aspath_free (aspath
);
4580 community_free (community
);
4581 bgp_unlock_node (rn
);
4582 bgp_unlock_node (top
);
4585 #endif /* AGGREGATE_NEXTHOP_CHECK */
4587 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4589 if (aggregate
->summary_only
)
4591 (bgp_info_extra_get (ri
))->suppress
++;
4592 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
4598 if (aggregate
->as_set
)
4600 if (origin
< ri
->attr
->origin
)
4601 origin
= ri
->attr
->origin
;
4605 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4606 aspath_free (aspath
);
4610 aspath
= aspath_dup (ri
->attr
->aspath
);
4612 if (ri
->attr
->community
)
4616 commerge
= community_merge (community
,
4617 ri
->attr
->community
);
4618 community
= community_uniq_sort (commerge
);
4619 community_free (commerge
);
4622 community
= community_dup (ri
->attr
->community
);
4628 bgp_process (bgp
, rn
, afi
, safi
);
4630 bgp_unlock_node (top
);
4636 if (aggregate
->summary_only
)
4637 (bgp_info_extra_get (rinew
))->suppress
++;
4639 if (aggregate
->as_set
)
4641 if (origin
< rinew
->attr
->origin
)
4642 origin
= rinew
->attr
->origin
;
4646 asmerge
= aspath_aggregate (aspath
, rinew
->attr
->aspath
);
4647 aspath_free (aspath
);
4651 aspath
= aspath_dup (rinew
->attr
->aspath
);
4653 if (rinew
->attr
->community
)
4657 commerge
= community_merge (community
,
4658 rinew
->attr
->community
);
4659 community
= community_uniq_sort (commerge
);
4660 community_free (commerge
);
4663 community
= community_dup (rinew
->attr
->community
);
4668 if (aggregate
->count
> 0)
4670 rn
= bgp_node_get (table
, p
);
4671 new = bgp_info_new ();
4672 new->type
= ZEBRA_ROUTE_BGP
;
4673 new->sub_type
= BGP_ROUTE_AGGREGATE
;
4674 new->peer
= bgp
->peer_self
;
4675 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4676 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
4677 new->uptime
= time (NULL
);
4679 bgp_info_add (rn
, new);
4680 bgp_unlock_node (rn
);
4681 bgp_process (bgp
, rn
, afi
, safi
);
4686 aspath_free (aspath
);
4688 community_free (community
);
4692 void bgp_aggregate_delete (struct bgp
*, struct prefix
*, afi_t
, safi_t
,
4693 struct bgp_aggregate
*);
4696 bgp_aggregate_increment (struct bgp
*bgp
, struct prefix
*p
,
4697 struct bgp_info
*ri
, afi_t afi
, safi_t safi
)
4699 struct bgp_node
*child
;
4700 struct bgp_node
*rn
;
4701 struct bgp_aggregate
*aggregate
;
4703 /* MPLS-VPN aggregation is not yet supported. */
4704 if (safi
== SAFI_MPLS_VPN
)
4707 if (p
->prefixlen
== 0)
4710 if (BGP_INFO_HOLDDOWN (ri
))
4713 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
4715 /* Aggregate address configuration check. */
4716 for (rn
= child
; rn
; rn
= rn
->parent
)
4717 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
4719 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
4720 bgp_aggregate_route (bgp
, &rn
->p
, ri
, afi
, safi
, NULL
, aggregate
);
4722 bgp_unlock_node (child
);
4726 bgp_aggregate_decrement (struct bgp
*bgp
, struct prefix
*p
,
4727 struct bgp_info
*del
, afi_t afi
, safi_t safi
)
4729 struct bgp_node
*child
;
4730 struct bgp_node
*rn
;
4731 struct bgp_aggregate
*aggregate
;
4733 /* MPLS-VPN aggregation is not yet supported. */
4734 if (safi
== SAFI_MPLS_VPN
)
4737 if (p
->prefixlen
== 0)
4740 child
= bgp_node_get (bgp
->aggregate
[afi
][safi
], p
);
4742 /* Aggregate address configuration check. */
4743 for (rn
= child
; rn
; rn
= rn
->parent
)
4744 if ((aggregate
= rn
->info
) != NULL
&& rn
->p
.prefixlen
< p
->prefixlen
)
4746 bgp_aggregate_delete (bgp
, &rn
->p
, afi
, safi
, aggregate
);
4747 bgp_aggregate_route (bgp
, &rn
->p
, NULL
, afi
, safi
, del
, aggregate
);
4749 bgp_unlock_node (child
);
4753 bgp_aggregate_add (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
, safi_t safi
,
4754 struct bgp_aggregate
*aggregate
)
4756 struct bgp_table
*table
;
4757 struct bgp_node
*top
;
4758 struct bgp_node
*rn
;
4759 struct bgp_info
*new;
4760 struct bgp_info
*ri
;
4761 unsigned long match
;
4762 u_char origin
= BGP_ORIGIN_IGP
;
4763 struct aspath
*aspath
= NULL
;
4764 struct aspath
*asmerge
= NULL
;
4765 struct community
*community
= NULL
;
4766 struct community
*commerge
= NULL
;
4768 table
= bgp
->rib
[afi
][safi
];
4771 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
4773 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
4776 /* If routes exists below this node, generate aggregate routes. */
4777 top
= bgp_node_get (table
, p
);
4778 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4779 if (rn
->p
.prefixlen
> p
->prefixlen
)
4783 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4785 if (BGP_INFO_HOLDDOWN (ri
))
4788 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4790 /* summary-only aggregate route suppress aggregated
4791 route announcement. */
4792 if (aggregate
->summary_only
)
4794 (bgp_info_extra_get (ri
))->suppress
++;
4795 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
4798 /* as-set aggregate route generate origin, as path,
4799 community aggregation. */
4800 if (aggregate
->as_set
)
4802 if (origin
< ri
->attr
->origin
)
4803 origin
= ri
->attr
->origin
;
4807 asmerge
= aspath_aggregate (aspath
, ri
->attr
->aspath
);
4808 aspath_free (aspath
);
4812 aspath
= aspath_dup (ri
->attr
->aspath
);
4814 if (ri
->attr
->community
)
4818 commerge
= community_merge (community
,
4819 ri
->attr
->community
);
4820 community
= community_uniq_sort (commerge
);
4821 community_free (commerge
);
4824 community
= community_dup (ri
->attr
->community
);
4831 /* If this node is suppressed, process the change. */
4833 bgp_process (bgp
, rn
, afi
, safi
);
4835 bgp_unlock_node (top
);
4837 /* Add aggregate route to BGP table. */
4838 if (aggregate
->count
)
4840 rn
= bgp_node_get (table
, p
);
4842 new = bgp_info_new ();
4843 new->type
= ZEBRA_ROUTE_BGP
;
4844 new->sub_type
= BGP_ROUTE_AGGREGATE
;
4845 new->peer
= bgp
->peer_self
;
4846 SET_FLAG (new->flags
, BGP_INFO_VALID
);
4847 new->attr
= bgp_attr_aggregate_intern (bgp
, origin
, aspath
, community
, aggregate
->as_set
);
4848 new->uptime
= time (NULL
);
4850 bgp_info_add (rn
, new);
4851 bgp_unlock_node (rn
);
4853 /* Process change. */
4854 bgp_process (bgp
, rn
, afi
, safi
);
4859 bgp_aggregate_delete (struct bgp
*bgp
, struct prefix
*p
, afi_t afi
,
4860 safi_t safi
, struct bgp_aggregate
*aggregate
)
4862 struct bgp_table
*table
;
4863 struct bgp_node
*top
;
4864 struct bgp_node
*rn
;
4865 struct bgp_info
*ri
;
4866 unsigned long match
;
4868 table
= bgp
->rib
[afi
][safi
];
4870 if (afi
== AFI_IP
&& p
->prefixlen
== IPV4_MAX_BITLEN
)
4872 if (afi
== AFI_IP6
&& p
->prefixlen
== IPV6_MAX_BITLEN
)
4875 /* If routes exists below this node, generate aggregate routes. */
4876 top
= bgp_node_get (table
, p
);
4877 for (rn
= bgp_node_get (table
, p
); rn
; rn
= bgp_route_next_until (rn
, top
))
4878 if (rn
->p
.prefixlen
> p
->prefixlen
)
4882 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4884 if (BGP_INFO_HOLDDOWN (ri
))
4887 if (ri
->sub_type
!= BGP_ROUTE_AGGREGATE
)
4889 if (aggregate
->summary_only
&& ri
->extra
)
4891 ri
->extra
->suppress
--;
4893 if (ri
->extra
->suppress
== 0)
4895 bgp_info_set_flag (rn
, ri
, BGP_INFO_ATTR_CHANGED
);
4903 /* If this node was suppressed, process the change. */
4905 bgp_process (bgp
, rn
, afi
, safi
);
4907 bgp_unlock_node (top
);
4909 /* Delete aggregate route from BGP table. */
4910 rn
= bgp_node_get (table
, p
);
4912 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
4913 if (ri
->peer
== bgp
->peer_self
4914 && ri
->type
== ZEBRA_ROUTE_BGP
4915 && ri
->sub_type
== BGP_ROUTE_AGGREGATE
)
4918 /* Withdraw static BGP route from routing table. */
4921 bgp_info_delete (rn
, ri
);
4922 bgp_process (bgp
, rn
, afi
, safi
);
4925 /* Unlock bgp_node_lookup. */
4926 bgp_unlock_node (rn
);
4929 /* Aggregate route attribute. */
4930 #define AGGREGATE_SUMMARY_ONLY 1
4931 #define AGGREGATE_AS_SET 1
4934 bgp_aggregate_set (struct vty
*vty
, const char *prefix_str
,
4935 afi_t afi
, safi_t safi
,
4936 u_char summary_only
, u_char as_set
)
4940 struct bgp_node
*rn
;
4942 struct bgp_aggregate
*aggregate
;
4944 /* Convert string to prefix structure. */
4945 ret
= str2prefix (prefix_str
, &p
);
4948 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
4953 /* Get BGP structure. */
4956 /* Old configuration check. */
4957 rn
= bgp_node_get (bgp
->aggregate
[afi
][safi
], &p
);
4961 vty_out (vty
, "There is already same aggregate network.%s", VTY_NEWLINE
);
4962 bgp_unlock_node (rn
);
4966 /* Make aggregate address structure. */
4967 aggregate
= bgp_aggregate_new ();
4968 aggregate
->summary_only
= summary_only
;
4969 aggregate
->as_set
= as_set
;
4970 aggregate
->safi
= safi
;
4971 rn
->info
= aggregate
;
4973 /* Aggregate address insert into BGP routing table. */
4974 if (safi
& SAFI_UNICAST
)
4975 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
4976 if (safi
& SAFI_MULTICAST
)
4977 bgp_aggregate_add (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
4983 bgp_aggregate_unset (struct vty
*vty
, const char *prefix_str
,
4984 afi_t afi
, safi_t safi
)
4988 struct bgp_node
*rn
;
4990 struct bgp_aggregate
*aggregate
;
4992 /* Convert string to prefix structure. */
4993 ret
= str2prefix (prefix_str
, &p
);
4996 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
5001 /* Get BGP structure. */
5004 /* Old configuration check. */
5005 rn
= bgp_node_lookup (bgp
->aggregate
[afi
][safi
], &p
);
5008 vty_out (vty
, "%% There is no aggregate-address configuration.%s",
5013 aggregate
= rn
->info
;
5014 if (aggregate
->safi
& SAFI_UNICAST
)
5015 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_UNICAST
, aggregate
);
5016 if (aggregate
->safi
& SAFI_MULTICAST
)
5017 bgp_aggregate_delete (bgp
, &p
, afi
, SAFI_MULTICAST
, aggregate
);
5019 /* Unlock aggregate address configuration. */
5021 bgp_aggregate_free (aggregate
);
5022 bgp_unlock_node (rn
);
5023 bgp_unlock_node (rn
);
5028 DEFUN (aggregate_address
,
5029 aggregate_address_cmd
,
5030 "aggregate-address A.B.C.D/M",
5031 "Configure BGP aggregate entries\n"
5032 "Aggregate prefix\n")
5034 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
), 0, 0);
5037 DEFUN (aggregate_address_mask
,
5038 aggregate_address_mask_cmd
,
5039 "aggregate-address A.B.C.D A.B.C.D",
5040 "Configure BGP aggregate entries\n"
5041 "Aggregate address\n"
5045 char prefix_str
[BUFSIZ
];
5047 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5051 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5055 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5059 DEFUN (aggregate_address_summary_only
,
5060 aggregate_address_summary_only_cmd
,
5061 "aggregate-address A.B.C.D/M summary-only",
5062 "Configure BGP aggregate entries\n"
5063 "Aggregate prefix\n"
5064 "Filter more specific routes from updates\n")
5066 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5067 AGGREGATE_SUMMARY_ONLY
, 0);
5070 DEFUN (aggregate_address_mask_summary_only
,
5071 aggregate_address_mask_summary_only_cmd
,
5072 "aggregate-address A.B.C.D A.B.C.D summary-only",
5073 "Configure BGP aggregate entries\n"
5074 "Aggregate address\n"
5076 "Filter more specific routes from updates\n")
5079 char prefix_str
[BUFSIZ
];
5081 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5085 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5089 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5090 AGGREGATE_SUMMARY_ONLY
, 0);
5093 DEFUN (aggregate_address_as_set
,
5094 aggregate_address_as_set_cmd
,
5095 "aggregate-address A.B.C.D/M as-set",
5096 "Configure BGP aggregate entries\n"
5097 "Aggregate prefix\n"
5098 "Generate AS set path information\n")
5100 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5101 0, AGGREGATE_AS_SET
);
5104 DEFUN (aggregate_address_mask_as_set
,
5105 aggregate_address_mask_as_set_cmd
,
5106 "aggregate-address A.B.C.D A.B.C.D as-set",
5107 "Configure BGP aggregate entries\n"
5108 "Aggregate address\n"
5110 "Generate AS set path information\n")
5113 char prefix_str
[BUFSIZ
];
5115 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5119 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5123 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5124 0, AGGREGATE_AS_SET
);
5128 DEFUN (aggregate_address_as_set_summary
,
5129 aggregate_address_as_set_summary_cmd
,
5130 "aggregate-address A.B.C.D/M as-set summary-only",
5131 "Configure BGP aggregate entries\n"
5132 "Aggregate prefix\n"
5133 "Generate AS set path information\n"
5134 "Filter more specific routes from updates\n")
5136 return bgp_aggregate_set (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
),
5137 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
5140 ALIAS (aggregate_address_as_set_summary
,
5141 aggregate_address_summary_as_set_cmd
,
5142 "aggregate-address A.B.C.D/M summary-only as-set",
5143 "Configure BGP aggregate entries\n"
5144 "Aggregate prefix\n"
5145 "Filter more specific routes from updates\n"
5146 "Generate AS set path information\n")
5148 DEFUN (aggregate_address_mask_as_set_summary
,
5149 aggregate_address_mask_as_set_summary_cmd
,
5150 "aggregate-address A.B.C.D A.B.C.D as-set summary-only",
5151 "Configure BGP aggregate entries\n"
5152 "Aggregate address\n"
5154 "Generate AS set path information\n"
5155 "Filter more specific routes from updates\n")
5158 char prefix_str
[BUFSIZ
];
5160 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5164 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5168 return bgp_aggregate_set (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
),
5169 AGGREGATE_SUMMARY_ONLY
, AGGREGATE_AS_SET
);
5172 ALIAS (aggregate_address_mask_as_set_summary
,
5173 aggregate_address_mask_summary_as_set_cmd
,
5174 "aggregate-address A.B.C.D A.B.C.D summary-only as-set",
5175 "Configure BGP aggregate entries\n"
5176 "Aggregate address\n"
5178 "Filter more specific routes from updates\n"
5179 "Generate AS set path information\n")
5181 DEFUN (no_aggregate_address
,
5182 no_aggregate_address_cmd
,
5183 "no aggregate-address A.B.C.D/M",
5185 "Configure BGP aggregate entries\n"
5186 "Aggregate prefix\n")
5188 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP
, bgp_node_safi (vty
));
5191 ALIAS (no_aggregate_address
,
5192 no_aggregate_address_summary_only_cmd
,
5193 "no aggregate-address A.B.C.D/M summary-only",
5195 "Configure BGP aggregate entries\n"
5196 "Aggregate prefix\n"
5197 "Filter more specific routes from updates\n")
5199 ALIAS (no_aggregate_address
,
5200 no_aggregate_address_as_set_cmd
,
5201 "no aggregate-address A.B.C.D/M as-set",
5203 "Configure BGP aggregate entries\n"
5204 "Aggregate prefix\n"
5205 "Generate AS set path information\n")
5207 ALIAS (no_aggregate_address
,
5208 no_aggregate_address_as_set_summary_cmd
,
5209 "no aggregate-address A.B.C.D/M as-set summary-only",
5211 "Configure BGP aggregate entries\n"
5212 "Aggregate prefix\n"
5213 "Generate AS set path information\n"
5214 "Filter more specific routes from updates\n")
5216 ALIAS (no_aggregate_address
,
5217 no_aggregate_address_summary_as_set_cmd
,
5218 "no aggregate-address A.B.C.D/M summary-only as-set",
5220 "Configure BGP aggregate entries\n"
5221 "Aggregate prefix\n"
5222 "Filter more specific routes from updates\n"
5223 "Generate AS set path information\n")
5225 DEFUN (no_aggregate_address_mask
,
5226 no_aggregate_address_mask_cmd
,
5227 "no aggregate-address A.B.C.D A.B.C.D",
5229 "Configure BGP aggregate entries\n"
5230 "Aggregate address\n"
5234 char prefix_str
[BUFSIZ
];
5236 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
5240 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
5244 return bgp_aggregate_unset (vty
, prefix_str
, AFI_IP
, bgp_node_safi (vty
));
5247 ALIAS (no_aggregate_address_mask
,
5248 no_aggregate_address_mask_summary_only_cmd
,
5249 "no aggregate-address A.B.C.D A.B.C.D summary-only",
5251 "Configure BGP aggregate entries\n"
5252 "Aggregate address\n"
5254 "Filter more specific routes from updates\n")
5256 ALIAS (no_aggregate_address_mask
,
5257 no_aggregate_address_mask_as_set_cmd
,
5258 "no aggregate-address A.B.C.D A.B.C.D as-set",
5260 "Configure BGP aggregate entries\n"
5261 "Aggregate address\n"
5263 "Generate AS set path information\n")
5265 ALIAS (no_aggregate_address_mask
,
5266 no_aggregate_address_mask_as_set_summary_cmd
,
5267 "no aggregate-address A.B.C.D A.B.C.D as-set summary-only",
5269 "Configure BGP aggregate entries\n"
5270 "Aggregate address\n"
5272 "Generate AS set path information\n"
5273 "Filter more specific routes from updates\n")
5275 ALIAS (no_aggregate_address_mask
,
5276 no_aggregate_address_mask_summary_as_set_cmd
,
5277 "no aggregate-address A.B.C.D A.B.C.D summary-only as-set",
5279 "Configure BGP aggregate entries\n"
5280 "Aggregate address\n"
5282 "Filter more specific routes from updates\n"
5283 "Generate AS set path information\n")
5286 DEFUN (ipv6_aggregate_address
,
5287 ipv6_aggregate_address_cmd
,
5288 "aggregate-address X:X::X:X/M",
5289 "Configure BGP aggregate entries\n"
5290 "Aggregate prefix\n")
5292 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
, 0, 0);
5295 DEFUN (ipv6_aggregate_address_summary_only
,
5296 ipv6_aggregate_address_summary_only_cmd
,
5297 "aggregate-address X:X::X:X/M summary-only",
5298 "Configure BGP aggregate entries\n"
5299 "Aggregate prefix\n"
5300 "Filter more specific routes from updates\n")
5302 return bgp_aggregate_set (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
5303 AGGREGATE_SUMMARY_ONLY
, 0);
5306 DEFUN (no_ipv6_aggregate_address
,
5307 no_ipv6_aggregate_address_cmd
,
5308 "no aggregate-address X:X::X:X/M",
5310 "Configure BGP aggregate entries\n"
5311 "Aggregate prefix\n")
5313 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
5316 DEFUN (no_ipv6_aggregate_address_summary_only
,
5317 no_ipv6_aggregate_address_summary_only_cmd
,
5318 "no aggregate-address X:X::X:X/M summary-only",
5320 "Configure BGP aggregate entries\n"
5321 "Aggregate prefix\n"
5322 "Filter more specific routes from updates\n")
5324 return bgp_aggregate_unset (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
);
5327 ALIAS (ipv6_aggregate_address
,
5328 old_ipv6_aggregate_address_cmd
,
5329 "ipv6 bgp aggregate-address X:X::X:X/M",
5332 "Configure BGP aggregate entries\n"
5333 "Aggregate prefix\n")
5335 ALIAS (ipv6_aggregate_address_summary_only
,
5336 old_ipv6_aggregate_address_summary_only_cmd
,
5337 "ipv6 bgp aggregate-address X:X::X:X/M summary-only",
5340 "Configure BGP aggregate entries\n"
5341 "Aggregate prefix\n"
5342 "Filter more specific routes from updates\n")
5344 ALIAS (no_ipv6_aggregate_address
,
5345 old_no_ipv6_aggregate_address_cmd
,
5346 "no ipv6 bgp aggregate-address X:X::X:X/M",
5350 "Configure BGP aggregate entries\n"
5351 "Aggregate prefix\n")
5353 ALIAS (no_ipv6_aggregate_address_summary_only
,
5354 old_no_ipv6_aggregate_address_summary_only_cmd
,
5355 "no ipv6 bgp aggregate-address X:X::X:X/M summary-only",
5359 "Configure BGP aggregate entries\n"
5360 "Aggregate prefix\n"
5361 "Filter more specific routes from updates\n")
5362 #endif /* HAVE_IPV6 */
5364 /* Redistribute route treatment. */
5366 bgp_redistribute_add (struct prefix
*p
, struct in_addr
*nexthop
,
5367 u_int32_t metric
, u_char type
)
5370 struct listnode
*node
, *nnode
;
5371 struct bgp_info
*new;
5372 struct bgp_info
*bi
;
5373 struct bgp_info info
;
5374 struct bgp_node
*bn
;
5375 struct attr attr
= { 0 };
5376 struct attr attr_new
= { 0 };
5377 struct attr
*new_attr
;
5381 /* Make default attribute. */
5382 bgp_attr_default_set (&attr
, BGP_ORIGIN_INCOMPLETE
);
5384 attr
.nexthop
= *nexthop
;
5387 attr
.flag
|= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
);
5389 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
5391 afi
= family2afi (p
->family
);
5393 if (bgp
->redist
[afi
][type
])
5395 /* Copy attribute for modification. */
5396 bgp_attr_dup (&attr_new
, &attr
);
5398 if (bgp
->redist_metric_flag
[afi
][type
])
5399 attr_new
.med
= bgp
->redist_metric
[afi
][type
];
5401 /* Apply route-map. */
5402 if (bgp
->rmap
[afi
][type
].map
)
5404 info
.peer
= bgp
->peer_self
;
5405 info
.attr
= &attr_new
;
5407 SET_FLAG (bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_REDISTRIBUTE
);
5409 ret
= route_map_apply (bgp
->rmap
[afi
][type
].map
, p
, RMAP_BGP
,
5412 bgp
->peer_self
->rmap_type
= 0;
5414 if (ret
== RMAP_DENYMATCH
)
5416 /* Free uninterned attribute. */
5417 bgp_attr_flush (&attr_new
);
5418 bgp_attr_extra_free (&attr_new
);
5420 /* Unintern original. */
5421 aspath_unintern (attr
.aspath
);
5422 bgp_attr_extra_free (&attr
);
5423 bgp_redistribute_delete (p
, type
);
5428 bn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
],
5429 afi
, SAFI_UNICAST
, p
, NULL
);
5431 new_attr
= bgp_attr_intern (&attr_new
);
5432 bgp_attr_extra_free (&attr_new
);
5434 for (bi
= bn
->info
; bi
; bi
= bi
->next
)
5435 if (bi
->peer
== bgp
->peer_self
5436 && bi
->sub_type
== BGP_ROUTE_REDISTRIBUTE
)
5441 if (attrhash_cmp (bi
->attr
, new_attr
) &&
5442 !CHECK_FLAG(bi
->flags
, BGP_INFO_REMOVED
))
5444 bgp_attr_unintern (new_attr
);
5445 aspath_unintern (attr
.aspath
);
5446 bgp_attr_extra_free (&attr
);
5447 bgp_unlock_node (bn
);
5452 /* The attribute is changed. */
5453 bgp_info_set_flag (bn
, bi
, BGP_INFO_ATTR_CHANGED
);
5455 /* Rewrite BGP route information. */
5456 if (CHECK_FLAG(bi
->flags
, BGP_INFO_REMOVED
))
5457 bgp_info_restore(bn
, bi
);
5459 bgp_aggregate_decrement (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
5460 bgp_attr_unintern (bi
->attr
);
5461 bi
->attr
= new_attr
;
5462 bi
->uptime
= time (NULL
);
5464 /* Process change. */
5465 bgp_aggregate_increment (bgp
, p
, bi
, afi
, SAFI_UNICAST
);
5466 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
5467 bgp_unlock_node (bn
);
5468 aspath_unintern (attr
.aspath
);
5469 bgp_attr_extra_free (&attr
);
5474 new = bgp_info_new ();
5476 new->sub_type
= BGP_ROUTE_REDISTRIBUTE
;
5477 new->peer
= bgp
->peer_self
;
5478 SET_FLAG (new->flags
, BGP_INFO_VALID
);
5479 new->attr
= new_attr
;
5480 new->uptime
= time (NULL
);
5482 bgp_aggregate_increment (bgp
, p
, new, afi
, SAFI_UNICAST
);
5483 bgp_info_add (bn
, new);
5484 bgp_unlock_node (bn
);
5485 bgp_process (bgp
, bn
, afi
, SAFI_UNICAST
);
5489 /* Unintern original. */
5490 aspath_unintern (attr
.aspath
);
5491 bgp_attr_extra_free (&attr
);
5495 bgp_redistribute_delete (struct prefix
*p
, u_char type
)
5498 struct listnode
*node
, *nnode
;
5500 struct bgp_node
*rn
;
5501 struct bgp_info
*ri
;
5503 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
5505 afi
= family2afi (p
->family
);
5507 if (bgp
->redist
[afi
][type
])
5509 rn
= bgp_afi_node_get (bgp
->rib
[afi
][SAFI_UNICAST
], afi
, SAFI_UNICAST
, p
, NULL
);
5511 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5512 if (ri
->peer
== bgp
->peer_self
5513 && ri
->type
== type
)
5518 bgp_aggregate_decrement (bgp
, p
, ri
, afi
, SAFI_UNICAST
);
5519 bgp_info_delete (rn
, ri
);
5520 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
5522 bgp_unlock_node (rn
);
5527 /* Withdraw specified route type's route. */
5529 bgp_redistribute_withdraw (struct bgp
*bgp
, afi_t afi
, int type
)
5531 struct bgp_node
*rn
;
5532 struct bgp_info
*ri
;
5533 struct bgp_table
*table
;
5535 table
= bgp
->rib
[afi
][SAFI_UNICAST
];
5537 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
5539 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
5540 if (ri
->peer
== bgp
->peer_self
5541 && ri
->type
== type
)
5546 bgp_aggregate_decrement (bgp
, &rn
->p
, ri
, afi
, SAFI_UNICAST
);
5547 bgp_info_delete (rn
, ri
);
5548 bgp_process (bgp
, rn
, afi
, SAFI_UNICAST
);
5553 /* Static function to display route. */
5555 route_vty_out_route (struct prefix
*p
, struct vty
*vty
)
5558 u_int32_t destination
;
5561 if (p
->family
== AF_INET
)
5563 len
= vty_out (vty
, "%s", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
));
5564 destination
= ntohl (p
->u
.prefix4
.s_addr
);
5566 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
5567 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
5568 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
5569 || p
->u
.prefix4
.s_addr
== 0)
5571 /* When mask is natural, mask is not displayed. */
5574 len
+= vty_out (vty
, "/%d", p
->prefixlen
);
5577 len
= vty_out (vty
, "%s/%d", inet_ntop (p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
),
5582 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 20, " ");
5584 vty_out (vty
, "%*s", len
, " ");
5587 enum bgp_display_type
5592 /* Print the short form route status for a bgp_info */
5594 route_vty_short_status_out (struct vty
*vty
, struct bgp_info
*binfo
)
5596 /* Route status display. */
5597 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
5599 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
5601 else if (binfo
->extra
&& binfo
->extra
->suppress
)
5603 else if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5609 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5611 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5613 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
5618 /* Internal route. */
5619 if ((binfo
->peer
->as
) && (binfo
->peer
->as
== binfo
->peer
->local_as
))
5625 /* called from terminal list command */
5627 route_vty_out (struct vty
*vty
, struct prefix
*p
,
5628 struct bgp_info
*binfo
, int display
, safi_t safi
)
5632 /* short status lead text */
5633 route_vty_short_status_out (vty
, binfo
);
5635 /* print prefix and mask */
5637 route_vty_out_route (p
, vty
);
5639 vty_out (vty
, "%*s", 17, " ");
5641 /* Print attribute */
5645 if (p
->family
== AF_INET
)
5647 if (safi
== SAFI_MPLS_VPN
)
5648 vty_out (vty
, "%-16s",
5649 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
5651 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5654 else if (p
->family
== AF_INET6
)
5659 len
= vty_out (vty
, "%s",
5660 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5664 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
5666 vty_out (vty
, "%*s", len
, " ");
5668 #endif /* HAVE_IPV6 */
5670 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
5671 vty_out (vty
, "%10d", attr
->med
);
5675 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
5676 vty_out (vty
, "%7d", attr
->local_pref
);
5680 vty_out (vty
, "%7u ", (attr
->extra
? attr
->extra
->weight
: 0));
5684 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
5687 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5689 vty_out (vty
, "%s", VTY_NEWLINE
);
5692 /* called from terminal list command */
5694 route_vty_out_tmp (struct vty
*vty
, struct prefix
*p
,
5695 struct attr
*attr
, safi_t safi
)
5697 /* Route status display. */
5702 /* print prefix and mask */
5703 route_vty_out_route (p
, vty
);
5705 /* Print attribute */
5708 if (p
->family
== AF_INET
)
5710 if (safi
== SAFI_MPLS_VPN
)
5711 vty_out (vty
, "%-16s",
5712 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
5714 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5717 else if (p
->family
== AF_INET6
)
5722 assert (attr
->extra
);
5724 len
= vty_out (vty
, "%s",
5725 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5729 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 36, " ");
5731 vty_out (vty
, "%*s", len
, " ");
5733 #endif /* HAVE_IPV6 */
5735 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC
))
5736 vty_out (vty
, "%10d", attr
->med
);
5740 if (attr
->flag
& ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF
))
5741 vty_out (vty
, "%7d", attr
->local_pref
);
5745 vty_out (vty
, "%7d ", (attr
->extra
? attr
->extra
->weight
: 0));
5749 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
5752 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5755 vty_out (vty
, "%s", VTY_NEWLINE
);
5759 route_vty_out_tag (struct vty
*vty
, struct prefix
*p
,
5760 struct bgp_info
*binfo
, int display
, safi_t safi
)
5763 u_int32_t label
= 0;
5768 /* short status lead text */
5769 route_vty_short_status_out (vty
, binfo
);
5771 /* print prefix and mask */
5773 route_vty_out_route (p
, vty
);
5775 vty_out (vty
, "%*s", 17, " ");
5777 /* Print attribute */
5781 if (p
->family
== AF_INET
)
5783 if (safi
== SAFI_MPLS_VPN
)
5784 vty_out (vty
, "%-16s",
5785 inet_ntoa (attr
->extra
->mp_nexthop_global_in
));
5787 vty_out (vty
, "%-16s", inet_ntoa (attr
->nexthop
));
5790 else if (p
->family
== AF_INET6
)
5792 assert (attr
->extra
);
5795 if (attr
->extra
->mp_nexthop_len
== 16)
5797 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5799 else if (attr
->extra
->mp_nexthop_len
== 32)
5800 vty_out (vty
, "%s(%s)",
5801 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5803 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_local
,
5807 #endif /* HAVE_IPV6 */
5810 label
= decode_label (binfo
->extra
->tag
);
5812 vty_out (vty
, "notag/%d", label
);
5814 vty_out (vty
, "%s", VTY_NEWLINE
);
5817 /* dampening route */
5819 damp_route_vty_out (struct vty
*vty
, struct prefix
*p
,
5820 struct bgp_info
*binfo
, int display
, safi_t safi
)
5825 /* short status lead text */
5826 route_vty_short_status_out (vty
, binfo
);
5828 /* print prefix and mask */
5830 route_vty_out_route (p
, vty
);
5832 vty_out (vty
, "%*s", 17, " ");
5834 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
5837 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 34, " ");
5839 vty_out (vty
, "%*s", len
, " ");
5841 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
));
5843 /* Print attribute */
5849 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
5852 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5854 vty_out (vty
, "%s", VTY_NEWLINE
);
5857 #define BGP_UPTIME_LEN 25
5861 flap_route_vty_out (struct vty
*vty
, struct prefix
*p
,
5862 struct bgp_info
*binfo
, int display
, safi_t safi
)
5865 struct bgp_damp_info
*bdi
;
5866 char timebuf
[BGP_UPTIME_LEN
];
5872 bdi
= binfo
->extra
->damp_info
;
5874 /* short status lead text */
5875 route_vty_short_status_out (vty
, binfo
);
5877 /* print prefix and mask */
5879 route_vty_out_route (p
, vty
);
5881 vty_out (vty
, "%*s", 17, " ");
5883 len
= vty_out (vty
, "%s", binfo
->peer
->host
);
5886 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 33, " ");
5888 vty_out (vty
, "%*s", len
, " ");
5890 len
= vty_out (vty
, "%d", bdi
->flap
);
5895 vty_out (vty
, "%*s ", len
, " ");
5897 vty_out (vty
, "%s ", peer_uptime (bdi
->start_time
,
5898 timebuf
, BGP_UPTIME_LEN
));
5900 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
)
5901 && ! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5902 vty_out (vty
, "%s ", bgp_damp_reuse_time_vty (vty
, binfo
));
5904 vty_out (vty
, "%*s ", 8, " ");
5906 /* Print attribute */
5912 aspath_print_vty (vty
, "%s", attr
->aspath
, " ");
5915 vty_out (vty
, "%s", bgp_origin_str
[attr
->origin
]);
5917 vty_out (vty
, "%s", VTY_NEWLINE
);
5921 route_vty_out_detail (struct vty
*vty
, struct bgp
*bgp
, struct prefix
*p
,
5922 struct bgp_info
*binfo
, afi_t afi
, safi_t safi
)
5924 char buf
[INET6_ADDRSTRLEN
];
5927 int sockunion_vty_out (struct vty
*, union sockunion
*);
5933 /* Line1 display AS-path, Aggregator */
5937 if (aspath_count_hops (attr
->aspath
) == 0)
5938 vty_out (vty
, "Local");
5940 aspath_print_vty (vty
, "%s", attr
->aspath
, "");
5943 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_REMOVED
))
5944 vty_out (vty
, ", (removed)");
5945 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_STALE
))
5946 vty_out (vty
, ", (stale)");
5947 if (CHECK_FLAG (attr
->flag
, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR
)))
5948 vty_out (vty
, ", (aggregated by %u %s)",
5949 attr
->extra
->aggregator_as
,
5950 inet_ntoa (attr
->extra
->aggregator_addr
));
5951 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
5952 vty_out (vty
, ", (Received from a RR-client)");
5953 if (CHECK_FLAG (binfo
->peer
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
5954 vty_out (vty
, ", (Received from a RS-client)");
5955 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
5956 vty_out (vty
, ", (history entry)");
5957 else if (CHECK_FLAG (binfo
->flags
, BGP_INFO_DAMPED
))
5958 vty_out (vty
, ", (suppressed due to dampening)");
5959 vty_out (vty
, "%s", VTY_NEWLINE
);
5961 /* Line2 display Next-hop, Neighbor, Router-id */
5962 if (p
->family
== AF_INET
)
5964 vty_out (vty
, " %s", safi
== SAFI_MPLS_VPN
?
5965 inet_ntoa (attr
->extra
->mp_nexthop_global_in
) :
5966 inet_ntoa (attr
->nexthop
));
5971 assert (attr
->extra
);
5972 vty_out (vty
, " %s",
5973 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_global
,
5974 buf
, INET6_ADDRSTRLEN
));
5976 #endif /* HAVE_IPV6 */
5978 if (binfo
->peer
== bgp
->peer_self
)
5980 vty_out (vty
, " from %s ",
5981 p
->family
== AF_INET
? "0.0.0.0" : "::");
5982 vty_out (vty
, "(%s)", inet_ntoa(bgp
->router_id
));
5986 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_VALID
))
5987 vty_out (vty
, " (inaccessible)");
5988 else if (binfo
->extra
&& binfo
->extra
->igpmetric
)
5989 vty_out (vty
, " (metric %d)", binfo
->extra
->igpmetric
);
5990 vty_out (vty
, " from %s", sockunion2str (&binfo
->peer
->su
, buf
, SU_ADDRSTRLEN
));
5991 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
5992 vty_out (vty
, " (%s)", inet_ntoa (attr
->extra
->originator_id
));
5994 vty_out (vty
, " (%s)", inet_ntop (AF_INET
, &binfo
->peer
->remote_id
, buf1
, BUFSIZ
));
5996 vty_out (vty
, "%s", VTY_NEWLINE
);
5999 /* display nexthop local */
6000 if (attr
->extra
&& attr
->extra
->mp_nexthop_len
== 32)
6002 vty_out (vty
, " (%s)%s",
6003 inet_ntop (AF_INET6
, &attr
->extra
->mp_nexthop_local
,
6004 buf
, INET6_ADDRSTRLEN
),
6007 #endif /* HAVE_IPV6 */
6009 /* Line 3 display Origin, Med, Locpref, Weight, valid, Int/Ext/Local, Atomic, best */
6010 vty_out (vty
, " Origin %s", bgp_origin_long_str
[attr
->origin
]);
6012 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
))
6013 vty_out (vty
, ", metric %d", attr
->med
);
6015 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
))
6016 vty_out (vty
, ", localpref %d", attr
->local_pref
);
6018 vty_out (vty
, ", localpref %d", bgp
->default_local_pref
);
6020 if (attr
->extra
&& attr
->extra
->weight
!= 0)
6021 vty_out (vty
, ", weight %d", attr
->extra
->weight
);
6023 if (! CHECK_FLAG (binfo
->flags
, BGP_INFO_HISTORY
))
6024 vty_out (vty
, ", valid");
6026 if (binfo
->peer
!= bgp
->peer_self
)
6028 if (binfo
->peer
->as
== binfo
->peer
->local_as
)
6029 vty_out (vty
, ", internal");
6031 vty_out (vty
, ", %s",
6032 (bgp_confederation_peers_check(bgp
, binfo
->peer
->as
) ? "confed-external" : "external"));
6034 else if (binfo
->sub_type
== BGP_ROUTE_AGGREGATE
)
6035 vty_out (vty
, ", aggregated, local");
6036 else if (binfo
->type
!= ZEBRA_ROUTE_BGP
)
6037 vty_out (vty
, ", sourced");
6039 vty_out (vty
, ", sourced, local");
6041 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
))
6042 vty_out (vty
, ", atomic-aggregate");
6044 if (CHECK_FLAG (binfo
->flags
, BGP_INFO_SELECTED
))
6045 vty_out (vty
, ", best");
6047 vty_out (vty
, "%s", VTY_NEWLINE
);
6049 /* Line 4 display Community */
6050 if (attr
->community
)
6051 vty_out (vty
, " Community: %s%s", attr
->community
->str
,
6054 /* Line 5 display Extended-community */
6055 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
))
6056 vty_out (vty
, " Extended Community: %s%s",
6057 attr
->extra
->ecommunity
->str
, VTY_NEWLINE
);
6059 /* Line 6 display Originator, Cluster-id */
6060 if ((attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)) ||
6061 (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
)))
6063 assert (attr
->extra
);
6064 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
))
6065 vty_out (vty
, " Originator: %s",
6066 inet_ntoa (attr
->extra
->originator_id
));
6068 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))
6071 vty_out (vty
, ", Cluster list: ");
6072 for (i
= 0; i
< attr
->extra
->cluster
->length
/ 4; i
++)
6073 vty_out (vty
, "%s ",
6074 inet_ntoa (attr
->extra
->cluster
->list
[i
]));
6076 vty_out (vty
, "%s", VTY_NEWLINE
);
6079 /* 7: AS Pathlimit */
6080 if (attr
->flag
& ATTR_FLAG_BIT(BGP_ATTR_AS_PATHLIMIT
))
6083 vty_out (vty
, " AS-Pathlimit: %u",
6084 attr
->pathlimit
.ttl
);
6085 if (attr
->pathlimit
.as
)
6086 vty_out (vty
, " (%u)", attr
->pathlimit
.as
);
6087 vty_out (vty
, "%s", VTY_NEWLINE
);
6090 if (binfo
->extra
&& binfo
->extra
->damp_info
)
6091 bgp_damp_info_vty (vty
, binfo
);
6093 /* Line 7 display Uptime */
6094 vty_out (vty
, " Last update: %s", ctime (&binfo
->uptime
));
6096 vty_out (vty
, "%s", VTY_NEWLINE
);
6099 #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"
6100 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s"
6101 #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s"
6102 #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s"
6103 #define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path%s"
6107 bgp_show_type_normal
,
6108 bgp_show_type_regexp
,
6109 bgp_show_type_prefix_list
,
6110 bgp_show_type_filter_list
,
6111 bgp_show_type_route_map
,
6112 bgp_show_type_neighbor
,
6113 bgp_show_type_cidr_only
,
6114 bgp_show_type_prefix_longer
,
6115 bgp_show_type_community_all
,
6116 bgp_show_type_community
,
6117 bgp_show_type_community_exact
,
6118 bgp_show_type_community_list
,
6119 bgp_show_type_community_list_exact
,
6120 bgp_show_type_flap_statistics
,
6121 bgp_show_type_flap_address
,
6122 bgp_show_type_flap_prefix
,
6123 bgp_show_type_flap_cidr_only
,
6124 bgp_show_type_flap_regexp
,
6125 bgp_show_type_flap_filter_list
,
6126 bgp_show_type_flap_prefix_list
,
6127 bgp_show_type_flap_prefix_longer
,
6128 bgp_show_type_flap_route_map
,
6129 bgp_show_type_flap_neighbor
,
6130 bgp_show_type_dampend_paths
,
6131 bgp_show_type_damp_neighbor
6135 bgp_show_table (struct vty
*vty
, struct bgp_table
*table
, struct in_addr
*router_id
,
6136 enum bgp_show_type type
, void *output_arg
)
6138 struct bgp_info
*ri
;
6139 struct bgp_node
*rn
;
6142 unsigned long output_count
;
6144 /* This is first entry point, so reset total line. */
6147 /* Start processing of routes. */
6148 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
6149 if (rn
->info
!= NULL
)
6153 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6155 if (type
== bgp_show_type_flap_statistics
6156 || type
== bgp_show_type_flap_address
6157 || type
== bgp_show_type_flap_prefix
6158 || type
== bgp_show_type_flap_cidr_only
6159 || type
== bgp_show_type_flap_regexp
6160 || type
== bgp_show_type_flap_filter_list
6161 || type
== bgp_show_type_flap_prefix_list
6162 || type
== bgp_show_type_flap_prefix_longer
6163 || type
== bgp_show_type_flap_route_map
6164 || type
== bgp_show_type_flap_neighbor
6165 || type
== bgp_show_type_dampend_paths
6166 || type
== bgp_show_type_damp_neighbor
)
6168 if (!(ri
->extra
&& ri
->extra
->damp_info
))
6171 if (type
== bgp_show_type_regexp
6172 || type
== bgp_show_type_flap_regexp
)
6174 regex_t
*regex
= output_arg
;
6176 if (bgp_regexec (regex
, ri
->attr
->aspath
) == REG_NOMATCH
)
6179 if (type
== bgp_show_type_prefix_list
6180 || type
== bgp_show_type_flap_prefix_list
)
6182 struct prefix_list
*plist
= output_arg
;
6184 if (prefix_list_apply (plist
, &rn
->p
) != PREFIX_PERMIT
)
6187 if (type
== bgp_show_type_filter_list
6188 || type
== bgp_show_type_flap_filter_list
)
6190 struct as_list
*as_list
= output_arg
;
6192 if (as_list_apply (as_list
, ri
->attr
->aspath
) != AS_FILTER_PERMIT
)
6195 if (type
== bgp_show_type_route_map
6196 || type
== bgp_show_type_flap_route_map
)
6198 struct route_map
*rmap
= output_arg
;
6199 struct bgp_info binfo
;
6200 struct attr dummy_attr
= { 0 };
6203 bgp_attr_dup (&dummy_attr
, ri
->attr
);
6204 binfo
.peer
= ri
->peer
;
6205 binfo
.attr
= &dummy_attr
;
6207 ret
= route_map_apply (rmap
, &rn
->p
, RMAP_BGP
, &binfo
);
6209 bgp_attr_extra_free (&dummy_attr
);
6211 if (ret
== RMAP_DENYMATCH
)
6214 if (type
== bgp_show_type_neighbor
6215 || type
== bgp_show_type_flap_neighbor
6216 || type
== bgp_show_type_damp_neighbor
)
6218 union sockunion
*su
= output_arg
;
6220 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
6223 if (type
== bgp_show_type_cidr_only
6224 || type
== bgp_show_type_flap_cidr_only
)
6226 u_int32_t destination
;
6228 destination
= ntohl (rn
->p
.u
.prefix4
.s_addr
);
6229 if (IN_CLASSC (destination
) && rn
->p
.prefixlen
== 24)
6231 if (IN_CLASSB (destination
) && rn
->p
.prefixlen
== 16)
6233 if (IN_CLASSA (destination
) && rn
->p
.prefixlen
== 8)
6236 if (type
== bgp_show_type_prefix_longer
6237 || type
== bgp_show_type_flap_prefix_longer
)
6239 struct prefix
*p
= output_arg
;
6241 if (! prefix_match (p
, &rn
->p
))
6244 if (type
== bgp_show_type_community_all
)
6246 if (! ri
->attr
->community
)
6249 if (type
== bgp_show_type_community
)
6251 struct community
*com
= output_arg
;
6253 if (! ri
->attr
->community
||
6254 ! community_match (ri
->attr
->community
, com
))
6257 if (type
== bgp_show_type_community_exact
)
6259 struct community
*com
= output_arg
;
6261 if (! ri
->attr
->community
||
6262 ! community_cmp (ri
->attr
->community
, com
))
6265 if (type
== bgp_show_type_community_list
)
6267 struct community_list
*list
= output_arg
;
6269 if (! community_list_match (ri
->attr
->community
, list
))
6272 if (type
== bgp_show_type_community_list_exact
)
6274 struct community_list
*list
= output_arg
;
6276 if (! community_list_exact_match (ri
->attr
->community
, list
))
6279 if (type
== bgp_show_type_flap_address
6280 || type
== bgp_show_type_flap_prefix
)
6282 struct prefix
*p
= output_arg
;
6284 if (! prefix_match (&rn
->p
, p
))
6287 if (type
== bgp_show_type_flap_prefix
)
6288 if (p
->prefixlen
!= rn
->p
.prefixlen
)
6291 if (type
== bgp_show_type_dampend_paths
6292 || type
== bgp_show_type_damp_neighbor
)
6294 if (! CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
)
6295 || CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
6301 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id
), VTY_NEWLINE
);
6302 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
6303 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
6304 if (type
== bgp_show_type_dampend_paths
6305 || type
== bgp_show_type_damp_neighbor
)
6306 vty_out (vty
, BGP_SHOW_DAMP_HEADER
, VTY_NEWLINE
);
6307 else if (type
== bgp_show_type_flap_statistics
6308 || type
== bgp_show_type_flap_address
6309 || type
== bgp_show_type_flap_prefix
6310 || type
== bgp_show_type_flap_cidr_only
6311 || type
== bgp_show_type_flap_regexp
6312 || type
== bgp_show_type_flap_filter_list
6313 || type
== bgp_show_type_flap_prefix_list
6314 || type
== bgp_show_type_flap_prefix_longer
6315 || type
== bgp_show_type_flap_route_map
6316 || type
== bgp_show_type_flap_neighbor
)
6317 vty_out (vty
, BGP_SHOW_FLAP_HEADER
, VTY_NEWLINE
);
6319 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
6323 if (type
== bgp_show_type_dampend_paths
6324 || type
== bgp_show_type_damp_neighbor
)
6325 damp_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6326 else if (type
== bgp_show_type_flap_statistics
6327 || type
== bgp_show_type_flap_address
6328 || type
== bgp_show_type_flap_prefix
6329 || type
== bgp_show_type_flap_cidr_only
6330 || type
== bgp_show_type_flap_regexp
6331 || type
== bgp_show_type_flap_filter_list
6332 || type
== bgp_show_type_flap_prefix_list
6333 || type
== bgp_show_type_flap_prefix_longer
6334 || type
== bgp_show_type_flap_route_map
6335 || type
== bgp_show_type_flap_neighbor
)
6336 flap_route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6338 route_vty_out (vty
, &rn
->p
, ri
, display
, SAFI_UNICAST
);
6345 /* No route is displayed */
6346 if (output_count
== 0)
6348 if (type
== bgp_show_type_normal
)
6349 vty_out (vty
, "No BGP network exists%s", VTY_NEWLINE
);
6352 vty_out (vty
, "%sTotal number of prefixes %ld%s",
6353 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
6359 bgp_show (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
6360 enum bgp_show_type type
, void *output_arg
)
6362 struct bgp_table
*table
;
6365 bgp
= bgp_get_default ();
6370 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
6375 table
= bgp
->rib
[afi
][safi
];
6377 return bgp_show_table (vty
, table
, &bgp
->router_id
, type
, output_arg
);
6380 /* Header of detailed BGP route information */
6382 route_vty_out_detail_header (struct vty
*vty
, struct bgp
*bgp
,
6383 struct bgp_node
*rn
,
6384 struct prefix_rd
*prd
, afi_t afi
, safi_t safi
)
6386 struct bgp_info
*ri
;
6389 struct listnode
*node
, *nnode
;
6390 char buf1
[INET6_ADDRSTRLEN
];
6391 char buf2
[INET6_ADDRSTRLEN
];
6396 int no_advertise
= 0;
6401 vty_out (vty
, "BGP routing table entry for %s%s%s/%d%s",
6402 (safi
== SAFI_MPLS_VPN
?
6403 prefix_rd2str (prd
, buf1
, RD_ADDRSTRLEN
) : ""),
6404 safi
== SAFI_MPLS_VPN
? ":" : "",
6405 inet_ntop (p
->family
, &p
->u
.prefix
, buf2
, INET6_ADDRSTRLEN
),
6406 p
->prefixlen
, VTY_NEWLINE
);
6408 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6411 if (CHECK_FLAG (ri
->flags
, BGP_INFO_SELECTED
))
6414 if (ri
->extra
&& ri
->extra
->suppress
)
6416 if (ri
->attr
->community
!= NULL
)
6418 if (community_include (ri
->attr
->community
, COMMUNITY_NO_ADVERTISE
))
6420 if (community_include (ri
->attr
->community
, COMMUNITY_NO_EXPORT
))
6422 if (community_include (ri
->attr
->community
, COMMUNITY_LOCAL_AS
))
6428 vty_out (vty
, "Paths: (%d available", count
);
6431 vty_out (vty
, ", best #%d", best
);
6432 if (safi
== SAFI_UNICAST
)
6433 vty_out (vty
, ", table Default-IP-Routing-Table");
6436 vty_out (vty
, ", no best path");
6438 vty_out (vty
, ", not advertised to any peer");
6440 vty_out (vty
, ", not advertised to EBGP peer");
6442 vty_out (vty
, ", not advertised outside local AS");
6444 vty_out (vty
, ", Advertisements suppressed by an aggregate.");
6445 vty_out (vty
, ")%s", VTY_NEWLINE
);
6447 /* advertised peer */
6448 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6450 if (bgp_adj_out_lookup (peer
, p
, afi
, safi
, rn
))
6453 vty_out (vty
, " Advertised to non peer-group peers:%s ", VTY_NEWLINE
);
6454 vty_out (vty
, " %s", sockunion2str (&peer
->su
, buf1
, SU_ADDRSTRLEN
));
6459 vty_out (vty
, " Not advertised to any peer");
6460 vty_out (vty
, "%s", VTY_NEWLINE
);
6463 /* Display specified route of BGP table. */
6465 bgp_show_route_in_table (struct vty
*vty
, struct bgp
*bgp
,
6466 struct bgp_table
*rib
, const char *ip_str
,
6467 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
6473 struct prefix match
;
6474 struct bgp_node
*rn
;
6475 struct bgp_node
*rm
;
6476 struct bgp_info
*ri
;
6477 struct bgp_table
*table
;
6479 /* Check IP address argument. */
6480 ret
= str2prefix (ip_str
, &match
);
6483 vty_out (vty
, "address is malformed%s", VTY_NEWLINE
);
6487 match
.family
= afi2family (afi
);
6489 if (safi
== SAFI_MPLS_VPN
)
6491 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
6493 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
6496 if ((table
= rn
->info
) != NULL
)
6500 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
6502 if (prefix_check
&& rm
->p
.prefixlen
!= match
.prefixlen
)
6505 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
6509 route_vty_out_detail_header (vty
, bgp
, rm
, (struct prefix_rd
*)&rn
->p
,
6510 AFI_IP
, SAFI_MPLS_VPN
);
6515 route_vty_out_detail (vty
, bgp
, &rm
->p
, ri
, AFI_IP
, SAFI_MPLS_VPN
);
6525 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
6527 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
6529 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
6533 route_vty_out_detail_header (vty
, bgp
, rn
, NULL
, afi
, safi
);
6537 route_vty_out_detail (vty
, bgp
, &rn
->p
, ri
, afi
, safi
);
6545 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
6552 /* Display specified route of Main RIB */
6554 bgp_show_route (struct vty
*vty
, const char *view_name
, const char *ip_str
,
6555 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
,
6560 /* BGP structure lookup. */
6563 bgp
= bgp_lookup_by_name (view_name
);
6566 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
6572 bgp
= bgp_get_default ();
6575 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
6580 return bgp_show_route_in_table (vty
, bgp
, bgp
->rib
[afi
][safi
], ip_str
,
6581 afi
, safi
, prd
, prefix_check
);
6584 /* BGP route print out function. */
6592 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6595 DEFUN (show_ip_bgp_ipv4
,
6596 show_ip_bgp_ipv4_cmd
,
6597 "show ip bgp ipv4 (unicast|multicast)",
6602 "Address Family modifier\n"
6603 "Address Family modifier\n")
6605 if (strncmp (argv
[0], "m", 1) == 0)
6606 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, bgp_show_type_normal
,
6609 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6612 DEFUN (show_ip_bgp_route
,
6613 show_ip_bgp_route_cmd
,
6614 "show ip bgp A.B.C.D",
6618 "Network in the BGP routing table to display\n")
6620 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6623 DEFUN (show_ip_bgp_ipv4_route
,
6624 show_ip_bgp_ipv4_route_cmd
,
6625 "show ip bgp ipv4 (unicast|multicast) A.B.C.D",
6630 "Address Family modifier\n"
6631 "Address Family modifier\n"
6632 "Network in the BGP routing table to display\n")
6634 if (strncmp (argv
[0], "m", 1) == 0)
6635 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 0);
6637 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6640 DEFUN (show_ip_bgp_vpnv4_all_route
,
6641 show_ip_bgp_vpnv4_all_route_cmd
,
6642 "show ip bgp vpnv4 all A.B.C.D",
6646 "Display VPNv4 NLRI specific information\n"
6647 "Display information about all VPNv4 NLRIs\n"
6648 "Network in the BGP routing table to display\n")
6650 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 0);
6653 DEFUN (show_ip_bgp_vpnv4_rd_route
,
6654 show_ip_bgp_vpnv4_rd_route_cmd
,
6655 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D",
6659 "Display VPNv4 NLRI specific information\n"
6660 "Display information for a route distinguisher\n"
6661 "VPN Route Distinguisher\n"
6662 "Network in the BGP routing table to display\n")
6665 struct prefix_rd prd
;
6667 ret
= str2prefix_rd (argv
[0], &prd
);
6670 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
6673 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 0);
6676 DEFUN (show_ip_bgp_prefix
,
6677 show_ip_bgp_prefix_cmd
,
6678 "show ip bgp A.B.C.D/M",
6682 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6684 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6687 DEFUN (show_ip_bgp_ipv4_prefix
,
6688 show_ip_bgp_ipv4_prefix_cmd
,
6689 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M",
6694 "Address Family modifier\n"
6695 "Address Family modifier\n"
6696 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6698 if (strncmp (argv
[0], "m", 1) == 0)
6699 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MULTICAST
, NULL
, 1);
6701 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6704 DEFUN (show_ip_bgp_vpnv4_all_prefix
,
6705 show_ip_bgp_vpnv4_all_prefix_cmd
,
6706 "show ip bgp vpnv4 all A.B.C.D/M",
6710 "Display VPNv4 NLRI specific information\n"
6711 "Display information about all VPNv4 NLRIs\n"
6712 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6714 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
, NULL
, 1);
6717 DEFUN (show_ip_bgp_vpnv4_rd_prefix
,
6718 show_ip_bgp_vpnv4_rd_prefix_cmd
,
6719 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M",
6723 "Display VPNv4 NLRI specific information\n"
6724 "Display information for a route distinguisher\n"
6725 "VPN Route Distinguisher\n"
6726 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6729 struct prefix_rd prd
;
6731 ret
= str2prefix_rd (argv
[0], &prd
);
6734 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
6737 return bgp_show_route (vty
, NULL
, argv
[1], AFI_IP
, SAFI_MPLS_VPN
, &prd
, 1);
6740 DEFUN (show_ip_bgp_view
,
6741 show_ip_bgp_view_cmd
,
6742 "show ip bgp view WORD",
6751 /* BGP structure lookup. */
6752 bgp
= bgp_lookup_by_name (argv
[0]);
6755 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
6759 return bgp_show (vty
, bgp
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6762 DEFUN (show_ip_bgp_view_route
,
6763 show_ip_bgp_view_route_cmd
,
6764 "show ip bgp view WORD A.B.C.D",
6770 "Network in the BGP routing table to display\n")
6772 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 0);
6775 DEFUN (show_ip_bgp_view_prefix
,
6776 show_ip_bgp_view_prefix_cmd
,
6777 "show ip bgp view WORD A.B.C.D/M",
6783 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6785 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
, NULL
, 1);
6795 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
6807 DEFUN (show_ipv6_bgp
,
6814 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
,
6818 DEFUN (show_bgp_route
,
6820 "show bgp X:X::X:X",
6823 "Network in the BGP routing table to display\n")
6825 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6828 ALIAS (show_bgp_route
,
6829 show_bgp_ipv6_route_cmd
,
6830 "show bgp ipv6 X:X::X:X",
6834 "Network in the BGP routing table to display\n")
6837 DEFUN (show_ipv6_bgp_route
,
6838 show_ipv6_bgp_route_cmd
,
6839 "show ipv6 bgp X:X::X:X",
6843 "Network in the BGP routing table to display\n")
6845 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6848 DEFUN (show_bgp_prefix
,
6849 show_bgp_prefix_cmd
,
6850 "show bgp X:X::X:X/M",
6853 "IPv6 prefix <network>/<length>\n")
6855 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6858 ALIAS (show_bgp_prefix
,
6859 show_bgp_ipv6_prefix_cmd
,
6860 "show bgp ipv6 X:X::X:X/M",
6864 "IPv6 prefix <network>/<length>\n")
6867 DEFUN (show_ipv6_bgp_prefix
,
6868 show_ipv6_bgp_prefix_cmd
,
6869 "show ipv6 bgp X:X::X:X/M",
6873 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6875 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6878 DEFUN (show_bgp_view
,
6880 "show bgp view WORD",
6888 /* BGP structure lookup. */
6889 bgp
= bgp_lookup_by_name (argv
[0]);
6892 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
6896 return bgp_show (vty
, bgp
, AFI_IP6
, SAFI_UNICAST
, bgp_show_type_normal
, NULL
);
6899 ALIAS (show_bgp_view
,
6900 show_bgp_view_ipv6_cmd
,
6901 "show bgp view WORD ipv6",
6908 DEFUN (show_bgp_view_route
,
6909 show_bgp_view_route_cmd
,
6910 "show bgp view WORD X:X::X:X",
6915 "Network in the BGP routing table to display\n")
6917 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
6920 ALIAS (show_bgp_view_route
,
6921 show_bgp_view_ipv6_route_cmd
,
6922 "show bgp view WORD ipv6 X:X::X:X",
6928 "Network in the BGP routing table to display\n")
6930 DEFUN (show_bgp_view_prefix
,
6931 show_bgp_view_prefix_cmd
,
6932 "show bgp view WORD X:X::X:X/M",
6937 "IPv6 prefix <network>/<length>\n")
6939 return bgp_show_route (vty
, argv
[0], argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
6942 ALIAS (show_bgp_view_prefix
,
6943 show_bgp_view_ipv6_prefix_cmd
,
6944 "show bgp view WORD ipv6 X:X::X:X/M",
6950 "IPv6 prefix <network>/<length>\n")
6953 DEFUN (show_ipv6_mbgp
,
6960 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, bgp_show_type_normal
,
6965 DEFUN (show_ipv6_mbgp_route
,
6966 show_ipv6_mbgp_route_cmd
,
6967 "show ipv6 mbgp X:X::X:X",
6971 "Network in the MBGP routing table to display\n")
6973 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 0);
6977 DEFUN (show_ipv6_mbgp_prefix
,
6978 show_ipv6_mbgp_prefix_cmd
,
6979 "show ipv6 mbgp X:X::X:X/M",
6983 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6985 return bgp_show_route (vty
, NULL
, argv
[0], AFI_IP6
, SAFI_MULTICAST
, NULL
, 1);
6991 bgp_show_regexp (struct vty
*vty
, int argc
, const char **argv
, afi_t afi
,
6992 safi_t safi
, enum bgp_show_type type
)
7002 b
= buffer_new (1024);
7003 for (i
= 0; i
< argc
; i
++)
7006 buffer_putc (b
, ' ');
7009 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
7014 buffer_putstr (b
, argv
[i
]);
7016 buffer_putc (b
, '\0');
7018 regstr
= buffer_getstr (b
);
7021 regex
= bgp_regcomp (regstr
);
7022 XFREE(MTYPE_TMP
, regstr
);
7025 vty_out (vty
, "Can't compile regexp %s%s", argv
[0],
7030 rc
= bgp_show (vty
, NULL
, afi
, safi
, type
, regex
);
7031 bgp_regex_free (regex
);
7035 DEFUN (show_ip_bgp_regexp
,
7036 show_ip_bgp_regexp_cmd
,
7037 "show ip bgp regexp .LINE",
7041 "Display routes matching the AS path regular expression\n"
7042 "A regular-expression to match the BGP AS paths\n")
7044 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7045 bgp_show_type_regexp
);
7048 DEFUN (show_ip_bgp_flap_regexp
,
7049 show_ip_bgp_flap_regexp_cmd
,
7050 "show ip bgp flap-statistics regexp .LINE",
7054 "Display flap statistics of routes\n"
7055 "Display routes matching the AS path regular expression\n"
7056 "A regular-expression to match the BGP AS paths\n")
7058 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7059 bgp_show_type_flap_regexp
);
7062 DEFUN (show_ip_bgp_ipv4_regexp
,
7063 show_ip_bgp_ipv4_regexp_cmd
,
7064 "show ip bgp ipv4 (unicast|multicast) regexp .LINE",
7069 "Address Family modifier\n"
7070 "Address Family modifier\n"
7071 "Display routes matching the AS path regular expression\n"
7072 "A regular-expression to match the BGP AS paths\n")
7074 if (strncmp (argv
[0], "m", 1) == 0)
7075 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_MULTICAST
,
7076 bgp_show_type_regexp
);
7078 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP
, SAFI_UNICAST
,
7079 bgp_show_type_regexp
);
7083 DEFUN (show_bgp_regexp
,
7084 show_bgp_regexp_cmd
,
7085 "show bgp regexp .LINE",
7088 "Display routes matching the AS path regular expression\n"
7089 "A regular-expression to match the BGP AS paths\n")
7091 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
7092 bgp_show_type_regexp
);
7095 ALIAS (show_bgp_regexp
,
7096 show_bgp_ipv6_regexp_cmd
,
7097 "show bgp ipv6 regexp .LINE",
7101 "Display routes matching the AS path regular expression\n"
7102 "A regular-expression to match the BGP AS paths\n")
7105 DEFUN (show_ipv6_bgp_regexp
,
7106 show_ipv6_bgp_regexp_cmd
,
7107 "show ipv6 bgp regexp .LINE",
7111 "Display routes matching the AS path regular expression\n"
7112 "A regular-expression to match the BGP AS paths\n")
7114 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_UNICAST
,
7115 bgp_show_type_regexp
);
7119 DEFUN (show_ipv6_mbgp_regexp
,
7120 show_ipv6_mbgp_regexp_cmd
,
7121 "show ipv6 mbgp regexp .LINE",
7125 "Display routes matching the AS path regular expression\n"
7126 "A regular-expression to match the MBGP AS paths\n")
7128 return bgp_show_regexp (vty
, argc
, argv
, AFI_IP6
, SAFI_MULTICAST
,
7129 bgp_show_type_regexp
);
7131 #endif /* HAVE_IPV6 */
7134 bgp_show_prefix_list (struct vty
*vty
, const char *prefix_list_str
, afi_t afi
,
7135 safi_t safi
, enum bgp_show_type type
)
7137 struct prefix_list
*plist
;
7139 plist
= prefix_list_lookup (afi
, prefix_list_str
);
7142 vty_out (vty
, "%% %s is not a valid prefix-list name%s",
7143 prefix_list_str
, VTY_NEWLINE
);
7147 return bgp_show (vty
, NULL
, afi
, safi
, type
, plist
);
7150 DEFUN (show_ip_bgp_prefix_list
,
7151 show_ip_bgp_prefix_list_cmd
,
7152 "show ip bgp prefix-list WORD",
7156 "Display routes conforming to the prefix-list\n"
7157 "IP prefix-list name\n")
7159 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7160 bgp_show_type_prefix_list
);
7163 DEFUN (show_ip_bgp_flap_prefix_list
,
7164 show_ip_bgp_flap_prefix_list_cmd
,
7165 "show ip bgp flap-statistics prefix-list WORD",
7169 "Display flap statistics of routes\n"
7170 "Display routes conforming to the prefix-list\n"
7171 "IP prefix-list name\n")
7173 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7174 bgp_show_type_flap_prefix_list
);
7177 DEFUN (show_ip_bgp_ipv4_prefix_list
,
7178 show_ip_bgp_ipv4_prefix_list_cmd
,
7179 "show ip bgp ipv4 (unicast|multicast) prefix-list WORD",
7184 "Address Family modifier\n"
7185 "Address Family modifier\n"
7186 "Display routes conforming to the prefix-list\n"
7187 "IP prefix-list name\n")
7189 if (strncmp (argv
[0], "m", 1) == 0)
7190 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7191 bgp_show_type_prefix_list
);
7193 return bgp_show_prefix_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7194 bgp_show_type_prefix_list
);
7198 DEFUN (show_bgp_prefix_list
,
7199 show_bgp_prefix_list_cmd
,
7200 "show bgp prefix-list WORD",
7203 "Display routes conforming to the prefix-list\n"
7204 "IPv6 prefix-list name\n")
7206 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7207 bgp_show_type_prefix_list
);
7210 ALIAS (show_bgp_prefix_list
,
7211 show_bgp_ipv6_prefix_list_cmd
,
7212 "show bgp ipv6 prefix-list WORD",
7216 "Display routes conforming to the prefix-list\n"
7217 "IPv6 prefix-list name\n")
7220 DEFUN (show_ipv6_bgp_prefix_list
,
7221 show_ipv6_bgp_prefix_list_cmd
,
7222 "show ipv6 bgp prefix-list WORD",
7226 "Display routes matching the prefix-list\n"
7227 "IPv6 prefix-list name\n")
7229 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7230 bgp_show_type_prefix_list
);
7234 DEFUN (show_ipv6_mbgp_prefix_list
,
7235 show_ipv6_mbgp_prefix_list_cmd
,
7236 "show ipv6 mbgp prefix-list WORD",
7240 "Display routes matching the prefix-list\n"
7241 "IPv6 prefix-list name\n")
7243 return bgp_show_prefix_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
7244 bgp_show_type_prefix_list
);
7246 #endif /* HAVE_IPV6 */
7249 bgp_show_filter_list (struct vty
*vty
, const char *filter
, afi_t afi
,
7250 safi_t safi
, enum bgp_show_type type
)
7252 struct as_list
*as_list
;
7254 as_list
= as_list_lookup (filter
);
7255 if (as_list
== NULL
)
7257 vty_out (vty
, "%% %s is not a valid AS-path access-list name%s", filter
, VTY_NEWLINE
);
7261 return bgp_show (vty
, NULL
, afi
, safi
, type
, as_list
);
7264 DEFUN (show_ip_bgp_filter_list
,
7265 show_ip_bgp_filter_list_cmd
,
7266 "show ip bgp filter-list WORD",
7270 "Display routes conforming to the filter-list\n"
7271 "Regular expression access list name\n")
7273 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7274 bgp_show_type_filter_list
);
7277 DEFUN (show_ip_bgp_flap_filter_list
,
7278 show_ip_bgp_flap_filter_list_cmd
,
7279 "show ip bgp flap-statistics filter-list WORD",
7283 "Display flap statistics of routes\n"
7284 "Display routes conforming to the filter-list\n"
7285 "Regular expression access list name\n")
7287 return bgp_show_filter_list (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7288 bgp_show_type_flap_filter_list
);
7291 DEFUN (show_ip_bgp_ipv4_filter_list
,
7292 show_ip_bgp_ipv4_filter_list_cmd
,
7293 "show ip bgp ipv4 (unicast|multicast) filter-list WORD",
7298 "Address Family modifier\n"
7299 "Address Family modifier\n"
7300 "Display routes conforming to the filter-list\n"
7301 "Regular expression access list name\n")
7303 if (strncmp (argv
[0], "m", 1) == 0)
7304 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7305 bgp_show_type_filter_list
);
7307 return bgp_show_filter_list (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7308 bgp_show_type_filter_list
);
7312 DEFUN (show_bgp_filter_list
,
7313 show_bgp_filter_list_cmd
,
7314 "show bgp filter-list WORD",
7317 "Display routes conforming to the filter-list\n"
7318 "Regular expression access list name\n")
7320 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7321 bgp_show_type_filter_list
);
7324 ALIAS (show_bgp_filter_list
,
7325 show_bgp_ipv6_filter_list_cmd
,
7326 "show bgp ipv6 filter-list WORD",
7330 "Display routes conforming to the filter-list\n"
7331 "Regular expression access list name\n")
7334 DEFUN (show_ipv6_bgp_filter_list
,
7335 show_ipv6_bgp_filter_list_cmd
,
7336 "show ipv6 bgp filter-list WORD",
7340 "Display routes conforming to the filter-list\n"
7341 "Regular expression access list name\n")
7343 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7344 bgp_show_type_filter_list
);
7348 DEFUN (show_ipv6_mbgp_filter_list
,
7349 show_ipv6_mbgp_filter_list_cmd
,
7350 "show ipv6 mbgp filter-list WORD",
7354 "Display routes conforming to the filter-list\n"
7355 "Regular expression access list name\n")
7357 return bgp_show_filter_list (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
7358 bgp_show_type_filter_list
);
7360 #endif /* HAVE_IPV6 */
7363 bgp_show_route_map (struct vty
*vty
, const char *rmap_str
, afi_t afi
,
7364 safi_t safi
, enum bgp_show_type type
)
7366 struct route_map
*rmap
;
7368 rmap
= route_map_lookup_by_name (rmap_str
);
7371 vty_out (vty
, "%% %s is not a valid route-map name%s",
7372 rmap_str
, VTY_NEWLINE
);
7376 return bgp_show (vty
, NULL
, afi
, safi
, type
, rmap
);
7379 DEFUN (show_ip_bgp_route_map
,
7380 show_ip_bgp_route_map_cmd
,
7381 "show ip bgp route-map WORD",
7385 "Display routes matching the route-map\n"
7386 "A route-map to match on\n")
7388 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7389 bgp_show_type_route_map
);
7392 DEFUN (show_ip_bgp_flap_route_map
,
7393 show_ip_bgp_flap_route_map_cmd
,
7394 "show ip bgp flap-statistics route-map WORD",
7398 "Display flap statistics of routes\n"
7399 "Display routes matching the route-map\n"
7400 "A route-map to match on\n")
7402 return bgp_show_route_map (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
7403 bgp_show_type_flap_route_map
);
7406 DEFUN (show_ip_bgp_ipv4_route_map
,
7407 show_ip_bgp_ipv4_route_map_cmd
,
7408 "show ip bgp ipv4 (unicast|multicast) route-map WORD",
7413 "Address Family modifier\n"
7414 "Address Family modifier\n"
7415 "Display routes matching the route-map\n"
7416 "A route-map to match on\n")
7418 if (strncmp (argv
[0], "m", 1) == 0)
7419 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
7420 bgp_show_type_route_map
);
7422 return bgp_show_route_map (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
7423 bgp_show_type_route_map
);
7426 DEFUN (show_bgp_route_map
,
7427 show_bgp_route_map_cmd
,
7428 "show bgp route-map WORD",
7431 "Display routes matching the route-map\n"
7432 "A route-map to match on\n")
7434 return bgp_show_route_map (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
7435 bgp_show_type_route_map
);
7438 ALIAS (show_bgp_route_map
,
7439 show_bgp_ipv6_route_map_cmd
,
7440 "show bgp ipv6 route-map WORD",
7444 "Display routes matching the route-map\n"
7445 "A route-map to match on\n")
7447 DEFUN (show_ip_bgp_cidr_only
,
7448 show_ip_bgp_cidr_only_cmd
,
7449 "show ip bgp cidr-only",
7453 "Display only routes with non-natural netmasks\n")
7455 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7456 bgp_show_type_cidr_only
, NULL
);
7459 DEFUN (show_ip_bgp_flap_cidr_only
,
7460 show_ip_bgp_flap_cidr_only_cmd
,
7461 "show ip bgp flap-statistics cidr-only",
7465 "Display flap statistics of routes\n"
7466 "Display only routes with non-natural netmasks\n")
7468 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7469 bgp_show_type_flap_cidr_only
, NULL
);
7472 DEFUN (show_ip_bgp_ipv4_cidr_only
,
7473 show_ip_bgp_ipv4_cidr_only_cmd
,
7474 "show ip bgp ipv4 (unicast|multicast) cidr-only",
7479 "Address Family modifier\n"
7480 "Address Family modifier\n"
7481 "Display only routes with non-natural netmasks\n")
7483 if (strncmp (argv
[0], "m", 1) == 0)
7484 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
7485 bgp_show_type_cidr_only
, NULL
);
7487 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7488 bgp_show_type_cidr_only
, NULL
);
7491 DEFUN (show_ip_bgp_community_all
,
7492 show_ip_bgp_community_all_cmd
,
7493 "show ip bgp community",
7497 "Display routes matching the communities\n")
7499 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7500 bgp_show_type_community_all
, NULL
);
7503 DEFUN (show_ip_bgp_ipv4_community_all
,
7504 show_ip_bgp_ipv4_community_all_cmd
,
7505 "show ip bgp ipv4 (unicast|multicast) community",
7510 "Address Family modifier\n"
7511 "Address Family modifier\n"
7512 "Display routes matching the communities\n")
7514 if (strncmp (argv
[0], "m", 1) == 0)
7515 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
,
7516 bgp_show_type_community_all
, NULL
);
7518 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
7519 bgp_show_type_community_all
, NULL
);
7523 DEFUN (show_bgp_community_all
,
7524 show_bgp_community_all_cmd
,
7525 "show bgp community",
7528 "Display routes matching the communities\n")
7530 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
7531 bgp_show_type_community_all
, NULL
);
7534 ALIAS (show_bgp_community_all
,
7535 show_bgp_ipv6_community_all_cmd
,
7536 "show bgp ipv6 community",
7540 "Display routes matching the communities\n")
7543 DEFUN (show_ipv6_bgp_community_all
,
7544 show_ipv6_bgp_community_all_cmd
,
7545 "show ipv6 bgp community",
7549 "Display routes matching the communities\n")
7551 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
,
7552 bgp_show_type_community_all
, NULL
);
7556 DEFUN (show_ipv6_mbgp_community_all
,
7557 show_ipv6_mbgp_community_all_cmd
,
7558 "show ipv6 mbgp community",
7562 "Display routes matching the communities\n")
7564 return bgp_show (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
,
7565 bgp_show_type_community_all
, NULL
);
7567 #endif /* HAVE_IPV6 */
7570 bgp_show_community (struct vty
*vty
, int argc
, const char **argv
, int exact
,
7571 u_int16_t afi
, u_char safi
)
7573 struct community
*com
;
7579 b
= buffer_new (1024);
7580 for (i
= 0; i
< argc
; i
++)
7583 buffer_putc (b
, ' ');
7586 if ((strcmp (argv
[i
], "unicast") == 0) || (strcmp (argv
[i
], "multicast") == 0))
7591 buffer_putstr (b
, argv
[i
]);
7593 buffer_putc (b
, '\0');
7595 str
= buffer_getstr (b
);
7598 com
= community_str2com (str
);
7599 XFREE (MTYPE_TMP
, str
);
7602 vty_out (vty
, "%% Community malformed: %s", VTY_NEWLINE
);
7606 return bgp_show (vty
, NULL
, afi
, safi
,
7607 (exact
? bgp_show_type_community_exact
:
7608 bgp_show_type_community
), com
);
7611 DEFUN (show_ip_bgp_community
,
7612 show_ip_bgp_community_cmd
,
7613 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export)",
7617 "Display routes matching the communities\n"
7618 "community number\n"
7619 "Do not send outside local AS (well-known community)\n"
7620 "Do not advertise to any peer (well-known community)\n"
7621 "Do not export to next AS (well-known community)\n")
7623 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
7626 ALIAS (show_ip_bgp_community
,
7627 show_ip_bgp_community2_cmd
,
7628 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7632 "Display routes matching the communities\n"
7633 "community number\n"
7634 "Do not send outside local AS (well-known community)\n"
7635 "Do not advertise to any peer (well-known community)\n"
7636 "Do not export to next AS (well-known community)\n"
7637 "community number\n"
7638 "Do not send outside local AS (well-known community)\n"
7639 "Do not advertise to any peer (well-known community)\n"
7640 "Do not export to next AS (well-known community)\n")
7642 ALIAS (show_ip_bgp_community
,
7643 show_ip_bgp_community3_cmd
,
7644 "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)",
7648 "Display routes matching the communities\n"
7649 "community number\n"
7650 "Do not send outside local AS (well-known community)\n"
7651 "Do not advertise to any peer (well-known community)\n"
7652 "Do not export to next AS (well-known community)\n"
7653 "community number\n"
7654 "Do not send outside local AS (well-known community)\n"
7655 "Do not advertise to any peer (well-known community)\n"
7656 "Do not export to next AS (well-known community)\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")
7662 ALIAS (show_ip_bgp_community
,
7663 show_ip_bgp_community4_cmd
,
7664 "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)",
7668 "Display routes matching the communities\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"
7673 "community number\n"
7674 "Do not send outside local AS (well-known community)\n"
7675 "Do not advertise to any peer (well-known community)\n"
7676 "Do not export to next AS (well-known community)\n"
7677 "community number\n"
7678 "Do not send outside local AS (well-known community)\n"
7679 "Do not advertise to any peer (well-known community)\n"
7680 "Do not export to next AS (well-known community)\n"
7681 "community number\n"
7682 "Do not send outside local AS (well-known community)\n"
7683 "Do not advertise to any peer (well-known community)\n"
7684 "Do not export to next AS (well-known community)\n")
7686 DEFUN (show_ip_bgp_ipv4_community
,
7687 show_ip_bgp_ipv4_community_cmd
,
7688 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
7693 "Address Family modifier\n"
7694 "Address Family modifier\n"
7695 "Display routes matching the communities\n"
7696 "community number\n"
7697 "Do not send outside local AS (well-known community)\n"
7698 "Do not advertise to any peer (well-known community)\n"
7699 "Do not export to next AS (well-known community)\n")
7701 if (strncmp (argv
[0], "m", 1) == 0)
7702 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_MULTICAST
);
7704 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP
, SAFI_UNICAST
);
7707 ALIAS (show_ip_bgp_ipv4_community
,
7708 show_ip_bgp_ipv4_community2_cmd
,
7709 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7714 "Address Family modifier\n"
7715 "Address Family modifier\n"
7716 "Display routes matching the communities\n"
7717 "community number\n"
7718 "Do not send outside local AS (well-known community)\n"
7719 "Do not advertise to any peer (well-known community)\n"
7720 "Do not export to next AS (well-known community)\n"
7721 "community number\n"
7722 "Do not send outside local AS (well-known community)\n"
7723 "Do not advertise to any peer (well-known community)\n"
7724 "Do not export to next AS (well-known community)\n")
7726 ALIAS (show_ip_bgp_ipv4_community
,
7727 show_ip_bgp_ipv4_community3_cmd
,
7728 "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)",
7733 "Address Family modifier\n"
7734 "Address Family modifier\n"
7735 "Display routes matching the communities\n"
7736 "community number\n"
7737 "Do not send outside local AS (well-known community)\n"
7738 "Do not advertise to any peer (well-known community)\n"
7739 "Do not export to next AS (well-known community)\n"
7740 "community number\n"
7741 "Do not send outside local AS (well-known community)\n"
7742 "Do not advertise to any peer (well-known community)\n"
7743 "Do not export to next AS (well-known community)\n"
7744 "community number\n"
7745 "Do not send outside local AS (well-known community)\n"
7746 "Do not advertise to any peer (well-known community)\n"
7747 "Do not export to next AS (well-known community)\n")
7749 ALIAS (show_ip_bgp_ipv4_community
,
7750 show_ip_bgp_ipv4_community4_cmd
,
7751 "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)",
7756 "Address Family modifier\n"
7757 "Address Family modifier\n"
7758 "Display routes matching the communities\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"
7763 "community number\n"
7764 "Do not send outside local AS (well-known community)\n"
7765 "Do not advertise to any peer (well-known community)\n"
7766 "Do not export to next AS (well-known community)\n"
7767 "community number\n"
7768 "Do not send outside local AS (well-known community)\n"
7769 "Do not advertise to any peer (well-known community)\n"
7770 "Do not export to next AS (well-known community)\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")
7776 DEFUN (show_ip_bgp_community_exact
,
7777 show_ip_bgp_community_exact_cmd
,
7778 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7782 "Display routes matching the communities\n"
7783 "community number\n"
7784 "Do not send outside local AS (well-known community)\n"
7785 "Do not advertise to any peer (well-known community)\n"
7786 "Do not export to next AS (well-known community)\n"
7787 "Exact match of the communities")
7789 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
7792 ALIAS (show_ip_bgp_community_exact
,
7793 show_ip_bgp_community2_exact_cmd
,
7794 "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
7798 "Display routes matching the communities\n"
7799 "community number\n"
7800 "Do not send outside local AS (well-known community)\n"
7801 "Do not advertise to any peer (well-known community)\n"
7802 "Do not export to next AS (well-known community)\n"
7803 "community number\n"
7804 "Do not send outside local AS (well-known community)\n"
7805 "Do not advertise to any peer (well-known community)\n"
7806 "Do not export to next AS (well-known community)\n"
7807 "Exact match of the communities")
7809 ALIAS (show_ip_bgp_community_exact
,
7810 show_ip_bgp_community3_exact_cmd
,
7811 "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",
7815 "Display routes matching the communities\n"
7816 "community number\n"
7817 "Do not send outside local AS (well-known community)\n"
7818 "Do not advertise to any peer (well-known community)\n"
7819 "Do not export to next AS (well-known community)\n"
7820 "community number\n"
7821 "Do not send outside local AS (well-known community)\n"
7822 "Do not advertise to any peer (well-known community)\n"
7823 "Do not export to next AS (well-known community)\n"
7824 "community number\n"
7825 "Do not send outside local AS (well-known community)\n"
7826 "Do not advertise to any peer (well-known community)\n"
7827 "Do not export to next AS (well-known community)\n"
7828 "Exact match of the communities")
7830 ALIAS (show_ip_bgp_community_exact
,
7831 show_ip_bgp_community4_exact_cmd
,
7832 "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",
7836 "Display routes matching the communities\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 "community number\n"
7842 "Do not send outside local AS (well-known community)\n"
7843 "Do not advertise to any peer (well-known community)\n"
7844 "Do not export to next AS (well-known community)\n"
7845 "community number\n"
7846 "Do not send outside local AS (well-known community)\n"
7847 "Do not advertise to any peer (well-known community)\n"
7848 "Do not export to next AS (well-known community)\n"
7849 "community number\n"
7850 "Do not send outside local AS (well-known community)\n"
7851 "Do not advertise to any peer (well-known community)\n"
7852 "Do not export to next AS (well-known community)\n"
7853 "Exact match of the communities")
7855 DEFUN (show_ip_bgp_ipv4_community_exact
,
7856 show_ip_bgp_ipv4_community_exact_cmd
,
7857 "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match",
7862 "Address Family modifier\n"
7863 "Address Family modifier\n"
7864 "Display routes matching the communities\n"
7865 "community number\n"
7866 "Do not send outside local AS (well-known community)\n"
7867 "Do not advertise to any peer (well-known community)\n"
7868 "Do not export to next AS (well-known community)\n"
7869 "Exact match of the communities")
7871 if (strncmp (argv
[0], "m", 1) == 0)
7872 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_MULTICAST
);
7874 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP
, SAFI_UNICAST
);
7877 ALIAS (show_ip_bgp_ipv4_community_exact
,
7878 show_ip_bgp_ipv4_community2_exact_cmd
,
7879 "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",
7884 "Address Family modifier\n"
7885 "Address Family modifier\n"
7886 "Display routes matching the communities\n"
7887 "community number\n"
7888 "Do not send outside local AS (well-known community)\n"
7889 "Do not advertise to any peer (well-known community)\n"
7890 "Do not export to next AS (well-known community)\n"
7891 "community number\n"
7892 "Do not send outside local AS (well-known community)\n"
7893 "Do not advertise to any peer (well-known community)\n"
7894 "Do not export to next AS (well-known community)\n"
7895 "Exact match of the communities")
7897 ALIAS (show_ip_bgp_ipv4_community_exact
,
7898 show_ip_bgp_ipv4_community3_exact_cmd
,
7899 "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",
7904 "Address Family modifier\n"
7905 "Address Family modifier\n"
7906 "Display routes matching the communities\n"
7907 "community number\n"
7908 "Do not send outside local AS (well-known community)\n"
7909 "Do not advertise to any peer (well-known community)\n"
7910 "Do not export to next AS (well-known community)\n"
7911 "community number\n"
7912 "Do not send outside local AS (well-known community)\n"
7913 "Do not advertise to any peer (well-known community)\n"
7914 "Do not export to next AS (well-known community)\n"
7915 "community number\n"
7916 "Do not send outside local AS (well-known community)\n"
7917 "Do not advertise to any peer (well-known community)\n"
7918 "Do not export to next AS (well-known community)\n"
7919 "Exact match of the communities")
7921 ALIAS (show_ip_bgp_ipv4_community_exact
,
7922 show_ip_bgp_ipv4_community4_exact_cmd
,
7923 "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",
7928 "Address Family modifier\n"
7929 "Address Family modifier\n"
7930 "Display routes matching the communities\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 "community number\n"
7936 "Do not send outside local AS (well-known community)\n"
7937 "Do not advertise to any peer (well-known community)\n"
7938 "Do not export to next AS (well-known community)\n"
7939 "community number\n"
7940 "Do not send outside local AS (well-known community)\n"
7941 "Do not advertise to any peer (well-known community)\n"
7942 "Do not export to next AS (well-known community)\n"
7943 "community number\n"
7944 "Do not send outside local AS (well-known community)\n"
7945 "Do not advertise to any peer (well-known community)\n"
7946 "Do not export to next AS (well-known community)\n"
7947 "Exact match of the communities")
7950 DEFUN (show_bgp_community
,
7951 show_bgp_community_cmd
,
7952 "show bgp community (AA:NN|local-AS|no-advertise|no-export)",
7955 "Display routes matching the communities\n"
7956 "community number\n"
7957 "Do not send outside local AS (well-known community)\n"
7958 "Do not advertise to any peer (well-known community)\n"
7959 "Do not export to next AS (well-known community)\n")
7961 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
7964 ALIAS (show_bgp_community
,
7965 show_bgp_ipv6_community_cmd
,
7966 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)",
7970 "Display routes matching the communities\n"
7971 "community number\n"
7972 "Do not send outside local AS (well-known community)\n"
7973 "Do not advertise to any peer (well-known community)\n"
7974 "Do not export to next AS (well-known community)\n")
7976 ALIAS (show_bgp_community
,
7977 show_bgp_community2_cmd
,
7978 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7981 "Display routes matching the communities\n"
7982 "community number\n"
7983 "Do not send outside local AS (well-known community)\n"
7984 "Do not advertise to any peer (well-known community)\n"
7985 "Do not export to next AS (well-known community)\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")
7991 ALIAS (show_bgp_community
,
7992 show_bgp_ipv6_community2_cmd
,
7993 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
7997 "Display routes matching the communities\n"
7998 "community number\n"
7999 "Do not send outside local AS (well-known community)\n"
8000 "Do not advertise to any peer (well-known community)\n"
8001 "Do not export to next AS (well-known community)\n"
8002 "community number\n"
8003 "Do not send outside local AS (well-known community)\n"
8004 "Do not advertise to any peer (well-known community)\n"
8005 "Do not export to next AS (well-known community)\n")
8007 ALIAS (show_bgp_community
,
8008 show_bgp_community3_cmd
,
8009 "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)",
8012 "Display routes matching the communities\n"
8013 "community number\n"
8014 "Do not send outside local AS (well-known community)\n"
8015 "Do not advertise to any peer (well-known community)\n"
8016 "Do not export to next AS (well-known community)\n"
8017 "community number\n"
8018 "Do not send outside local AS (well-known community)\n"
8019 "Do not advertise to any peer (well-known community)\n"
8020 "Do not export to next AS (well-known community)\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")
8026 ALIAS (show_bgp_community
,
8027 show_bgp_ipv6_community3_cmd
,
8028 "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)",
8032 "Display routes matching the communities\n"
8033 "community number\n"
8034 "Do not send outside local AS (well-known community)\n"
8035 "Do not advertise to any peer (well-known community)\n"
8036 "Do not export to next AS (well-known community)\n"
8037 "community number\n"
8038 "Do not send outside local AS (well-known community)\n"
8039 "Do not advertise to any peer (well-known community)\n"
8040 "Do not export to next AS (well-known community)\n"
8041 "community number\n"
8042 "Do not send outside local AS (well-known community)\n"
8043 "Do not advertise to any peer (well-known community)\n"
8044 "Do not export to next AS (well-known community)\n")
8046 ALIAS (show_bgp_community
,
8047 show_bgp_community4_cmd
,
8048 "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)",
8051 "Display routes matching the communities\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"
8056 "community number\n"
8057 "Do not send outside local AS (well-known community)\n"
8058 "Do not advertise to any peer (well-known community)\n"
8059 "Do not export to next AS (well-known community)\n"
8060 "community number\n"
8061 "Do not send outside local AS (well-known community)\n"
8062 "Do not advertise to any peer (well-known community)\n"
8063 "Do not export to next AS (well-known community)\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")
8069 ALIAS (show_bgp_community
,
8070 show_bgp_ipv6_community4_cmd
,
8071 "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)",
8075 "Display routes matching the communities\n"
8076 "community number\n"
8077 "Do not send outside local AS (well-known community)\n"
8078 "Do not advertise to any peer (well-known community)\n"
8079 "Do not export to next AS (well-known community)\n"
8080 "community number\n"
8081 "Do not send outside local AS (well-known community)\n"
8082 "Do not advertise to any peer (well-known community)\n"
8083 "Do not export to next AS (well-known community)\n"
8084 "community number\n"
8085 "Do not send outside local AS (well-known community)\n"
8086 "Do not advertise to any peer (well-known community)\n"
8087 "Do not export to next AS (well-known community)\n"
8088 "community number\n"
8089 "Do not send outside local AS (well-known community)\n"
8090 "Do not advertise to any peer (well-known community)\n"
8091 "Do not export to next AS (well-known community)\n")
8094 DEFUN (show_ipv6_bgp_community
,
8095 show_ipv6_bgp_community_cmd
,
8096 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export)",
8100 "Display routes matching the communities\n"
8101 "community number\n"
8102 "Do not send outside local AS (well-known community)\n"
8103 "Do not advertise to any peer (well-known community)\n"
8104 "Do not export to next AS (well-known community)\n")
8106 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_UNICAST
);
8110 ALIAS (show_ipv6_bgp_community
,
8111 show_ipv6_bgp_community2_cmd
,
8112 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8116 "Display routes matching the communities\n"
8117 "community number\n"
8118 "Do not send outside local AS (well-known community)\n"
8119 "Do not advertise to any peer (well-known community)\n"
8120 "Do not export to next AS (well-known community)\n"
8121 "community number\n"
8122 "Do not send outside local AS (well-known community)\n"
8123 "Do not advertise to any peer (well-known community)\n"
8124 "Do not export to next AS (well-known community)\n")
8127 ALIAS (show_ipv6_bgp_community
,
8128 show_ipv6_bgp_community3_cmd
,
8129 "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)",
8133 "Display routes matching the communities\n"
8134 "community number\n"
8135 "Do not send outside local AS (well-known community)\n"
8136 "Do not advertise to any peer (well-known community)\n"
8137 "Do not export to next AS (well-known community)\n"
8138 "community number\n"
8139 "Do not send outside local AS (well-known community)\n"
8140 "Do not advertise to any peer (well-known community)\n"
8141 "Do not export to next AS (well-known community)\n"
8142 "community number\n"
8143 "Do not send outside local AS (well-known community)\n"
8144 "Do not advertise to any peer (well-known community)\n"
8145 "Do not export to next AS (well-known community)\n")
8148 ALIAS (show_ipv6_bgp_community
,
8149 show_ipv6_bgp_community4_cmd
,
8150 "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)",
8154 "Display routes matching the communities\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"
8159 "community number\n"
8160 "Do not send outside local AS (well-known community)\n"
8161 "Do not advertise to any peer (well-known community)\n"
8162 "Do not export to next AS (well-known community)\n"
8163 "community number\n"
8164 "Do not send outside local AS (well-known community)\n"
8165 "Do not advertise to any peer (well-known community)\n"
8166 "Do not export to next AS (well-known community)\n"
8167 "community number\n"
8168 "Do not send outside local AS (well-known community)\n"
8169 "Do not advertise to any peer (well-known community)\n"
8170 "Do not export to next AS (well-known community)\n")
8172 DEFUN (show_bgp_community_exact
,
8173 show_bgp_community_exact_cmd
,
8174 "show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8177 "Display routes matching the communities\n"
8178 "community number\n"
8179 "Do not send outside local AS (well-known community)\n"
8180 "Do not advertise to any peer (well-known community)\n"
8181 "Do not export to next AS (well-known community)\n"
8182 "Exact match of the communities")
8184 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
8187 ALIAS (show_bgp_community_exact
,
8188 show_bgp_ipv6_community_exact_cmd
,
8189 "show bgp ipv6 community (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 "Exact match of the communities")
8200 ALIAS (show_bgp_community_exact
,
8201 show_bgp_community2_exact_cmd
,
8202 "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8205 "Display routes matching the communities\n"
8206 "community number\n"
8207 "Do not send outside local AS (well-known community)\n"
8208 "Do not advertise to any peer (well-known community)\n"
8209 "Do not export to next AS (well-known community)\n"
8210 "community number\n"
8211 "Do not send outside local AS (well-known community)\n"
8212 "Do not advertise to any peer (well-known community)\n"
8213 "Do not export to next AS (well-known community)\n"
8214 "Exact match of the communities")
8216 ALIAS (show_bgp_community_exact
,
8217 show_bgp_ipv6_community2_exact_cmd
,
8218 "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8222 "Display routes matching the communities\n"
8223 "community number\n"
8224 "Do not send outside local AS (well-known community)\n"
8225 "Do not advertise to any peer (well-known community)\n"
8226 "Do not export to next AS (well-known community)\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 "Exact match of the communities")
8233 ALIAS (show_bgp_community_exact
,
8234 show_bgp_community3_exact_cmd
,
8235 "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",
8238 "Display routes matching the communities\n"
8239 "community number\n"
8240 "Do not send outside local AS (well-known community)\n"
8241 "Do not advertise to any peer (well-known community)\n"
8242 "Do not export to next AS (well-known community)\n"
8243 "community number\n"
8244 "Do not send outside local AS (well-known community)\n"
8245 "Do not advertise to any peer (well-known community)\n"
8246 "Do not export to next AS (well-known community)\n"
8247 "community number\n"
8248 "Do not send outside local AS (well-known community)\n"
8249 "Do not advertise to any peer (well-known community)\n"
8250 "Do not export to next AS (well-known community)\n"
8251 "Exact match of the communities")
8253 ALIAS (show_bgp_community_exact
,
8254 show_bgp_ipv6_community3_exact_cmd
,
8255 "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",
8259 "Display routes matching the communities\n"
8260 "community number\n"
8261 "Do not send outside local AS (well-known community)\n"
8262 "Do not advertise to any peer (well-known community)\n"
8263 "Do not export to next AS (well-known community)\n"
8264 "community number\n"
8265 "Do not send outside local AS (well-known community)\n"
8266 "Do not advertise to any peer (well-known community)\n"
8267 "Do not export to next AS (well-known community)\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 "Exact match of the communities")
8274 ALIAS (show_bgp_community_exact
,
8275 show_bgp_community4_exact_cmd
,
8276 "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",
8279 "Display routes matching the communities\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 "community number\n"
8285 "Do not send outside local AS (well-known community)\n"
8286 "Do not advertise to any peer (well-known community)\n"
8287 "Do not export to next AS (well-known community)\n"
8288 "community number\n"
8289 "Do not send outside local AS (well-known community)\n"
8290 "Do not advertise to any peer (well-known community)\n"
8291 "Do not export to next AS (well-known community)\n"
8292 "community number\n"
8293 "Do not send outside local AS (well-known community)\n"
8294 "Do not advertise to any peer (well-known community)\n"
8295 "Do not export to next AS (well-known community)\n"
8296 "Exact match of the communities")
8298 ALIAS (show_bgp_community_exact
,
8299 show_bgp_ipv6_community4_exact_cmd
,
8300 "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",
8304 "Display routes matching the communities\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 "community number\n"
8310 "Do not send outside local AS (well-known community)\n"
8311 "Do not advertise to any peer (well-known community)\n"
8312 "Do not export to next AS (well-known community)\n"
8313 "community number\n"
8314 "Do not send outside local AS (well-known community)\n"
8315 "Do not advertise to any peer (well-known community)\n"
8316 "Do not export to next AS (well-known community)\n"
8317 "community number\n"
8318 "Do not send outside local AS (well-known community)\n"
8319 "Do not advertise to any peer (well-known community)\n"
8320 "Do not export to next AS (well-known community)\n"
8321 "Exact match of the communities")
8324 DEFUN (show_ipv6_bgp_community_exact
,
8325 show_ipv6_bgp_community_exact_cmd
,
8326 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8330 "Display routes matching the communities\n"
8331 "community number\n"
8332 "Do not send outside local AS (well-known community)\n"
8333 "Do not advertise to any peer (well-known community)\n"
8334 "Do not export to next AS (well-known community)\n"
8335 "Exact match of the communities")
8337 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_UNICAST
);
8341 ALIAS (show_ipv6_bgp_community_exact
,
8342 show_ipv6_bgp_community2_exact_cmd
,
8343 "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8347 "Display routes matching the communities\n"
8348 "community number\n"
8349 "Do not send outside local AS (well-known community)\n"
8350 "Do not advertise to any peer (well-known community)\n"
8351 "Do not export to next AS (well-known community)\n"
8352 "community number\n"
8353 "Do not send outside local AS (well-known community)\n"
8354 "Do not advertise to any peer (well-known community)\n"
8355 "Do not export to next AS (well-known community)\n"
8356 "Exact match of the communities")
8359 ALIAS (show_ipv6_bgp_community_exact
,
8360 show_ipv6_bgp_community3_exact_cmd
,
8361 "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",
8365 "Display routes matching the communities\n"
8366 "community number\n"
8367 "Do not send outside local AS (well-known community)\n"
8368 "Do not advertise to any peer (well-known community)\n"
8369 "Do not export to next AS (well-known community)\n"
8370 "community number\n"
8371 "Do not send outside local AS (well-known community)\n"
8372 "Do not advertise to any peer (well-known community)\n"
8373 "Do not export to next AS (well-known community)\n"
8374 "community number\n"
8375 "Do not send outside local AS (well-known community)\n"
8376 "Do not advertise to any peer (well-known community)\n"
8377 "Do not export to next AS (well-known community)\n"
8378 "Exact match of the communities")
8381 ALIAS (show_ipv6_bgp_community_exact
,
8382 show_ipv6_bgp_community4_exact_cmd
,
8383 "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",
8387 "Display routes matching the communities\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 "community number\n"
8393 "Do not send outside local AS (well-known community)\n"
8394 "Do not advertise to any peer (well-known community)\n"
8395 "Do not export to next AS (well-known community)\n"
8396 "community number\n"
8397 "Do not send outside local AS (well-known community)\n"
8398 "Do not advertise to any peer (well-known community)\n"
8399 "Do not export to next AS (well-known community)\n"
8400 "community number\n"
8401 "Do not send outside local AS (well-known community)\n"
8402 "Do not advertise to any peer (well-known community)\n"
8403 "Do not export to next AS (well-known community)\n"
8404 "Exact match of the communities")
8407 DEFUN (show_ipv6_mbgp_community
,
8408 show_ipv6_mbgp_community_cmd
,
8409 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export)",
8413 "Display routes matching the communities\n"
8414 "community number\n"
8415 "Do not send outside local AS (well-known community)\n"
8416 "Do not advertise to any peer (well-known community)\n"
8417 "Do not export to next AS (well-known community)\n")
8419 return bgp_show_community (vty
, argc
, argv
, 0, AFI_IP6
, SAFI_MULTICAST
);
8423 ALIAS (show_ipv6_mbgp_community
,
8424 show_ipv6_mbgp_community2_cmd
,
8425 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
8429 "Display routes matching the communities\n"
8430 "community number\n"
8431 "Do not send outside local AS (well-known community)\n"
8432 "Do not advertise to any peer (well-known community)\n"
8433 "Do not export to next AS (well-known community)\n"
8434 "community number\n"
8435 "Do not send outside local AS (well-known community)\n"
8436 "Do not advertise to any peer (well-known community)\n"
8437 "Do not export to next AS (well-known community)\n")
8440 ALIAS (show_ipv6_mbgp_community
,
8441 show_ipv6_mbgp_community3_cmd
,
8442 "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)",
8446 "Display routes matching the communities\n"
8447 "community number\n"
8448 "Do not send outside local AS (well-known community)\n"
8449 "Do not advertise to any peer (well-known community)\n"
8450 "Do not export to next AS (well-known community)\n"
8451 "community number\n"
8452 "Do not send outside local AS (well-known community)\n"
8453 "Do not advertise to any peer (well-known community)\n"
8454 "Do not export to next AS (well-known community)\n"
8455 "community number\n"
8456 "Do not send outside local AS (well-known community)\n"
8457 "Do not advertise to any peer (well-known community)\n"
8458 "Do not export to next AS (well-known community)\n")
8461 ALIAS (show_ipv6_mbgp_community
,
8462 show_ipv6_mbgp_community4_cmd
,
8463 "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)",
8467 "Display routes matching the communities\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"
8472 "community number\n"
8473 "Do not send outside local AS (well-known community)\n"
8474 "Do not advertise to any peer (well-known community)\n"
8475 "Do not export to next AS (well-known community)\n"
8476 "community number\n"
8477 "Do not send outside local AS (well-known community)\n"
8478 "Do not advertise to any peer (well-known community)\n"
8479 "Do not export to next AS (well-known community)\n"
8480 "community number\n"
8481 "Do not send outside local AS (well-known community)\n"
8482 "Do not advertise to any peer (well-known community)\n"
8483 "Do not export to next AS (well-known community)\n")
8486 DEFUN (show_ipv6_mbgp_community_exact
,
8487 show_ipv6_mbgp_community_exact_cmd
,
8488 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match",
8492 "Display routes matching the communities\n"
8493 "community number\n"
8494 "Do not send outside local AS (well-known community)\n"
8495 "Do not advertise to any peer (well-known community)\n"
8496 "Do not export to next AS (well-known community)\n"
8497 "Exact match of the communities")
8499 return bgp_show_community (vty
, argc
, argv
, 1, AFI_IP6
, SAFI_MULTICAST
);
8503 ALIAS (show_ipv6_mbgp_community_exact
,
8504 show_ipv6_mbgp_community2_exact_cmd
,
8505 "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
8509 "Display routes matching the communities\n"
8510 "community number\n"
8511 "Do not send outside local AS (well-known community)\n"
8512 "Do not advertise to any peer (well-known community)\n"
8513 "Do not export to next AS (well-known community)\n"
8514 "community number\n"
8515 "Do not send outside local AS (well-known community)\n"
8516 "Do not advertise to any peer (well-known community)\n"
8517 "Do not export to next AS (well-known community)\n"
8518 "Exact match of the communities")
8521 ALIAS (show_ipv6_mbgp_community_exact
,
8522 show_ipv6_mbgp_community3_exact_cmd
,
8523 "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",
8527 "Display routes matching the communities\n"
8528 "community number\n"
8529 "Do not send outside local AS (well-known community)\n"
8530 "Do not advertise to any peer (well-known community)\n"
8531 "Do not export to next AS (well-known community)\n"
8532 "community number\n"
8533 "Do not send outside local AS (well-known community)\n"
8534 "Do not advertise to any peer (well-known community)\n"
8535 "Do not export to next AS (well-known community)\n"
8536 "community number\n"
8537 "Do not send outside local AS (well-known community)\n"
8538 "Do not advertise to any peer (well-known community)\n"
8539 "Do not export to next AS (well-known community)\n"
8540 "Exact match of the communities")
8543 ALIAS (show_ipv6_mbgp_community_exact
,
8544 show_ipv6_mbgp_community4_exact_cmd
,
8545 "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",
8549 "Display routes matching the communities\n"
8550 "community number\n"
8551 "Do not send outside local AS (well-known community)\n"
8552 "Do not advertise to any peer (well-known community)\n"
8553 "Do not export to next AS (well-known community)\n"
8554 "community number\n"
8555 "Do not send outside local AS (well-known community)\n"
8556 "Do not advertise to any peer (well-known community)\n"
8557 "Do not export to next AS (well-known community)\n"
8558 "community number\n"
8559 "Do not send outside local AS (well-known community)\n"
8560 "Do not advertise to any peer (well-known community)\n"
8561 "Do not export to next AS (well-known community)\n"
8562 "community number\n"
8563 "Do not send outside local AS (well-known community)\n"
8564 "Do not advertise to any peer (well-known community)\n"
8565 "Do not export to next AS (well-known community)\n"
8566 "Exact match of the communities")
8567 #endif /* HAVE_IPV6 */
8570 bgp_show_community_list (struct vty
*vty
, const char *com
, int exact
,
8571 u_int16_t afi
, u_char safi
)
8573 struct community_list
*list
;
8575 list
= community_list_lookup (bgp_clist
, com
, COMMUNITY_LIST_MASTER
);
8578 vty_out (vty
, "%% %s is not a valid community-list name%s", com
,
8583 return bgp_show (vty
, NULL
, afi
, safi
,
8584 (exact
? bgp_show_type_community_list_exact
:
8585 bgp_show_type_community_list
), list
);
8588 DEFUN (show_ip_bgp_community_list
,
8589 show_ip_bgp_community_list_cmd
,
8590 "show ip bgp community-list (<1-500>|WORD)",
8594 "Display routes matching the community-list\n"
8595 "community-list number\n"
8596 "community-list name\n")
8598 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP
, SAFI_UNICAST
);
8601 DEFUN (show_ip_bgp_ipv4_community_list
,
8602 show_ip_bgp_ipv4_community_list_cmd
,
8603 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)",
8608 "Address Family modifier\n"
8609 "Address Family modifier\n"
8610 "Display routes matching the community-list\n"
8611 "community-list number\n"
8612 "community-list name\n")
8614 if (strncmp (argv
[0], "m", 1) == 0)
8615 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_MULTICAST
);
8617 return bgp_show_community_list (vty
, argv
[1], 0, AFI_IP
, SAFI_UNICAST
);
8620 DEFUN (show_ip_bgp_community_list_exact
,
8621 show_ip_bgp_community_list_exact_cmd
,
8622 "show ip bgp community-list (<1-500>|WORD) exact-match",
8626 "Display routes matching the community-list\n"
8627 "community-list number\n"
8628 "community-list name\n"
8629 "Exact match of the communities\n")
8631 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP
, SAFI_UNICAST
);
8634 DEFUN (show_ip_bgp_ipv4_community_list_exact
,
8635 show_ip_bgp_ipv4_community_list_exact_cmd
,
8636 "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match",
8641 "Address Family modifier\n"
8642 "Address Family modifier\n"
8643 "Display routes matching the community-list\n"
8644 "community-list number\n"
8645 "community-list name\n"
8646 "Exact match of the communities\n")
8648 if (strncmp (argv
[0], "m", 1) == 0)
8649 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_MULTICAST
);
8651 return bgp_show_community_list (vty
, argv
[1], 1, AFI_IP
, SAFI_UNICAST
);
8655 DEFUN (show_bgp_community_list
,
8656 show_bgp_community_list_cmd
,
8657 "show bgp community-list (<1-500>|WORD)",
8660 "Display routes matching the community-list\n"
8661 "community-list number\n"
8662 "community-list name\n")
8664 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
8667 ALIAS (show_bgp_community_list
,
8668 show_bgp_ipv6_community_list_cmd
,
8669 "show bgp ipv6 community-list (<1-500>|WORD)",
8673 "Display routes matching the community-list\n"
8674 "community-list number\n"
8675 "community-list name\n")
8678 DEFUN (show_ipv6_bgp_community_list
,
8679 show_ipv6_bgp_community_list_cmd
,
8680 "show ipv6 bgp community-list WORD",
8684 "Display routes matching the community-list\n"
8685 "community-list name\n")
8687 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_UNICAST
);
8691 DEFUN (show_ipv6_mbgp_community_list
,
8692 show_ipv6_mbgp_community_list_cmd
,
8693 "show ipv6 mbgp community-list WORD",
8697 "Display routes matching the community-list\n"
8698 "community-list name\n")
8700 return bgp_show_community_list (vty
, argv
[0], 0, AFI_IP6
, SAFI_MULTICAST
);
8703 DEFUN (show_bgp_community_list_exact
,
8704 show_bgp_community_list_exact_cmd
,
8705 "show bgp community-list (<1-500>|WORD) exact-match",
8708 "Display routes matching the community-list\n"
8709 "community-list number\n"
8710 "community-list name\n"
8711 "Exact match of the communities\n")
8713 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
8716 ALIAS (show_bgp_community_list_exact
,
8717 show_bgp_ipv6_community_list_exact_cmd
,
8718 "show bgp ipv6 community-list (<1-500>|WORD) exact-match",
8722 "Display routes matching the community-list\n"
8723 "community-list number\n"
8724 "community-list name\n"
8725 "Exact match of the communities\n")
8728 DEFUN (show_ipv6_bgp_community_list_exact
,
8729 show_ipv6_bgp_community_list_exact_cmd
,
8730 "show ipv6 bgp community-list WORD exact-match",
8734 "Display routes matching the community-list\n"
8735 "community-list name\n"
8736 "Exact match of the communities\n")
8738 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_UNICAST
);
8742 DEFUN (show_ipv6_mbgp_community_list_exact
,
8743 show_ipv6_mbgp_community_list_exact_cmd
,
8744 "show ipv6 mbgp community-list WORD exact-match",
8748 "Display routes matching the community-list\n"
8749 "community-list name\n"
8750 "Exact match of the communities\n")
8752 return bgp_show_community_list (vty
, argv
[0], 1, AFI_IP6
, SAFI_MULTICAST
);
8754 #endif /* HAVE_IPV6 */
8757 bgp_show_prefix_longer (struct vty
*vty
, const char *prefix
, afi_t afi
,
8758 safi_t safi
, enum bgp_show_type type
)
8765 ret
= str2prefix (prefix
, p
);
8768 vty_out (vty
, "%% Malformed Prefix%s", VTY_NEWLINE
);
8772 ret
= bgp_show (vty
, NULL
, afi
, safi
, type
, p
);
8777 DEFUN (show_ip_bgp_prefix_longer
,
8778 show_ip_bgp_prefix_longer_cmd
,
8779 "show ip bgp A.B.C.D/M longer-prefixes",
8783 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8784 "Display route and more specific routes\n")
8786 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8787 bgp_show_type_prefix_longer
);
8790 DEFUN (show_ip_bgp_flap_prefix_longer
,
8791 show_ip_bgp_flap_prefix_longer_cmd
,
8792 "show ip bgp flap-statistics A.B.C.D/M longer-prefixes",
8796 "Display flap statistics of routes\n"
8797 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8798 "Display route and more specific routes\n")
8800 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8801 bgp_show_type_flap_prefix_longer
);
8804 DEFUN (show_ip_bgp_ipv4_prefix_longer
,
8805 show_ip_bgp_ipv4_prefix_longer_cmd
,
8806 "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes",
8811 "Address Family modifier\n"
8812 "Address Family modifier\n"
8813 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
8814 "Display route and more specific routes\n")
8816 if (strncmp (argv
[0], "m", 1) == 0)
8817 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
,
8818 bgp_show_type_prefix_longer
);
8820 return bgp_show_prefix_longer (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
,
8821 bgp_show_type_prefix_longer
);
8824 DEFUN (show_ip_bgp_flap_address
,
8825 show_ip_bgp_flap_address_cmd
,
8826 "show ip bgp flap-statistics A.B.C.D",
8830 "Display flap statistics of routes\n"
8831 "Network in the BGP routing table to display\n")
8833 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8834 bgp_show_type_flap_address
);
8837 DEFUN (show_ip_bgp_flap_prefix
,
8838 show_ip_bgp_flap_prefix_cmd
,
8839 "show ip bgp flap-statistics A.B.C.D/M",
8843 "Display flap statistics of routes\n"
8844 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
8846 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
,
8847 bgp_show_type_flap_prefix
);
8850 DEFUN (show_bgp_prefix_longer
,
8851 show_bgp_prefix_longer_cmd
,
8852 "show bgp X:X::X:X/M longer-prefixes",
8855 "IPv6 prefix <network>/<length>\n"
8856 "Display route and more specific routes\n")
8858 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8859 bgp_show_type_prefix_longer
);
8862 ALIAS (show_bgp_prefix_longer
,
8863 show_bgp_ipv6_prefix_longer_cmd
,
8864 "show bgp ipv6 X:X::X:X/M longer-prefixes",
8868 "IPv6 prefix <network>/<length>\n"
8869 "Display route and more specific routes\n")
8872 DEFUN (show_ipv6_bgp_prefix_longer
,
8873 show_ipv6_bgp_prefix_longer_cmd
,
8874 "show ipv6 bgp X:X::X:X/M longer-prefixes",
8878 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
8879 "Display route and more specific routes\n")
8881 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_UNICAST
,
8882 bgp_show_type_prefix_longer
);
8886 DEFUN (show_ipv6_mbgp_prefix_longer
,
8887 show_ipv6_mbgp_prefix_longer_cmd
,
8888 "show ipv6 mbgp X:X::X:X/M longer-prefixes",
8892 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
8893 "Display route and more specific routes\n")
8895 return bgp_show_prefix_longer (vty
, argv
[0], AFI_IP6
, SAFI_MULTICAST
,
8896 bgp_show_type_prefix_longer
);
8898 #endif /* HAVE_IPV6 */
8900 static struct peer
*
8901 peer_lookup_in_view (struct vty
*vty
, const char *view_name
,
8909 /* BGP structure lookup. */
8912 bgp
= bgp_lookup_by_name (view_name
);
8915 vty_out (vty
, "Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
8921 bgp
= bgp_get_default ();
8924 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
8929 /* Get peer sockunion. */
8930 ret
= str2sockunion (ip_str
, &su
);
8933 vty_out (vty
, "Malformed address: %s%s", ip_str
, VTY_NEWLINE
);
8937 /* Peer structure lookup. */
8938 peer
= peer_lookup (bgp
, &su
);
8941 vty_out (vty
, "No such neighbor%s", VTY_NEWLINE
);
8950 BGP_STATS_MAXBITLEN
= 0,
8954 BGP_STATS_UNAGGREGATEABLE
,
8955 BGP_STATS_MAX_AGGREGATEABLE
,
8956 BGP_STATS_AGGREGATES
,
8958 BGP_STATS_ASPATH_COUNT
,
8959 BGP_STATS_ASPATH_MAXHOPS
,
8960 BGP_STATS_ASPATH_TOTHOPS
,
8961 BGP_STATS_ASPATH_MAXSIZE
,
8962 BGP_STATS_ASPATH_TOTSIZE
,
8963 BGP_STATS_ASN_HIGHEST
,
8967 static const char *table_stats_strs
[] =
8969 [BGP_STATS_PREFIXES
] = "Total Prefixes",
8970 [BGP_STATS_TOTPLEN
] = "Average prefix length",
8971 [BGP_STATS_RIB
] = "Total Advertisements",
8972 [BGP_STATS_UNAGGREGATEABLE
] = "Unaggregateable prefixes",
8973 [BGP_STATS_MAX_AGGREGATEABLE
] = "Maximum aggregateable prefixes",
8974 [BGP_STATS_AGGREGATES
] = "BGP Aggregate advertisements",
8975 [BGP_STATS_SPACE
] = "Address space advertised",
8976 [BGP_STATS_ASPATH_COUNT
] = "Advertisements with paths",
8977 [BGP_STATS_ASPATH_MAXHOPS
] = "Longest AS-Path (hops)",
8978 [BGP_STATS_ASPATH_MAXSIZE
] = "Largest AS-Path (bytes)",
8979 [BGP_STATS_ASPATH_TOTHOPS
] = "Average AS-Path length (hops)",
8980 [BGP_STATS_ASPATH_TOTSIZE
] = "Average AS-Path size (bytes)",
8981 [BGP_STATS_ASN_HIGHEST
] = "Highest public ASN",
8982 [BGP_STATS_MAX
] = NULL
,
8985 struct bgp_table_stats
8987 struct bgp_table
*table
;
8988 unsigned long long counts
[BGP_STATS_MAX
];
8992 #define TALLY_SIGFIG 100000
8993 static unsigned long
8994 ravg_tally (unsigned long count
, unsigned long oldavg
, unsigned long newval
)
8996 unsigned long newtot
= (count
-1) * oldavg
+ (newval
* TALLY_SIGFIG
);
8997 unsigned long res
= (newtot
* TALLY_SIGFIG
) / count
;
8998 unsigned long ret
= newtot
/ count
;
9000 if ((res
% TALLY_SIGFIG
) > (TALLY_SIGFIG
/2))
9008 bgp_table_stats_walker (struct thread
*t
)
9010 struct bgp_node
*rn
;
9011 struct bgp_node
*top
;
9012 struct bgp_table_stats
*ts
= THREAD_ARG (t
);
9013 unsigned int space
= 0;
9015 if (!(top
= bgp_table_top (ts
->table
)))
9018 switch (top
->p
.family
)
9021 space
= IPV4_MAX_BITLEN
;
9024 space
= IPV6_MAX_BITLEN
;
9028 ts
->counts
[BGP_STATS_MAXBITLEN
] = space
;
9030 for (rn
= top
; rn
; rn
= bgp_route_next (rn
))
9032 struct bgp_info
*ri
;
9033 struct bgp_node
*prn
= rn
->parent
;
9034 unsigned int rinum
= 0;
9042 ts
->counts
[BGP_STATS_PREFIXES
]++;
9043 ts
->counts
[BGP_STATS_TOTPLEN
] += rn
->p
.prefixlen
;
9046 ts
->counts
[BGP_STATS_AVGPLEN
]
9047 = ravg_tally (ts
->counts
[BGP_STATS_PREFIXES
],
9048 ts
->counts
[BGP_STATS_AVGPLEN
],
9052 /* check if the prefix is included by any other announcements */
9053 while (prn
&& !prn
->info
)
9056 if (prn
== NULL
|| prn
== top
)
9058 ts
->counts
[BGP_STATS_UNAGGREGATEABLE
]++;
9059 /* announced address space */
9061 ts
->counts
[BGP_STATS_SPACE
] += 1 << (space
- rn
->p
.prefixlen
);
9064 ts
->counts
[BGP_STATS_MAX_AGGREGATEABLE
]++;
9066 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
9069 ts
->counts
[BGP_STATS_RIB
]++;
9072 (CHECK_FLAG (ri
->attr
->flag
,
9073 ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE
))))
9074 ts
->counts
[BGP_STATS_AGGREGATES
]++;
9077 if (ri
->attr
&& ri
->attr
->aspath
)
9079 unsigned int hops
= aspath_count_hops (ri
->attr
->aspath
);
9080 unsigned int size
= aspath_size (ri
->attr
->aspath
);
9081 as_t highest
= aspath_highest (ri
->attr
->aspath
);
9083 ts
->counts
[BGP_STATS_ASPATH_COUNT
]++;
9085 if (hops
> ts
->counts
[BGP_STATS_ASPATH_MAXHOPS
])
9086 ts
->counts
[BGP_STATS_ASPATH_MAXHOPS
] = hops
;
9088 if (size
> ts
->counts
[BGP_STATS_ASPATH_MAXSIZE
])
9089 ts
->counts
[BGP_STATS_ASPATH_MAXSIZE
] = size
;
9091 ts
->counts
[BGP_STATS_ASPATH_TOTHOPS
] += hops
;
9092 ts
->counts
[BGP_STATS_ASPATH_TOTSIZE
] += size
;
9094 ts
->counts
[BGP_STATS_ASPATH_AVGHOPS
]
9095 = ravg_tally (ts
->counts
[BGP_STATS_ASPATH_COUNT
],
9096 ts
->counts
[BGP_STATS_ASPATH_AVGHOPS
],
9098 ts
->counts
[BGP_STATS_ASPATH_AVGSIZE
]
9099 = ravg_tally (ts
->counts
[BGP_STATS_ASPATH_COUNT
],
9100 ts
->counts
[BGP_STATS_ASPATH_AVGSIZE
],
9103 if (highest
> ts
->counts
[BGP_STATS_ASN_HIGHEST
])
9104 ts
->counts
[BGP_STATS_ASN_HIGHEST
] = highest
;
9112 bgp_table_stats (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
)
9114 struct bgp_table_stats ts
;
9117 if (!bgp
->rib
[afi
][safi
])
9119 vty_out (vty
, "%% No RIB exist for the AFI/SAFI%s", VTY_NEWLINE
);
9123 memset (&ts
, 0, sizeof (ts
));
9124 ts
.table
= bgp
->rib
[afi
][safi
];
9125 thread_execute (bm
->master
, bgp_table_stats_walker
, &ts
, 0);
9127 vty_out (vty
, "BGP %s RIB statistics%s%s",
9128 afi_safi_print (afi
, safi
), VTY_NEWLINE
, VTY_NEWLINE
);
9130 for (i
= 0; i
< BGP_STATS_MAX
; i
++)
9132 if (!table_stats_strs
[i
])
9138 case BGP_STATS_ASPATH_AVGHOPS
:
9139 case BGP_STATS_ASPATH_AVGSIZE
:
9140 case BGP_STATS_AVGPLEN
:
9141 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9142 vty_out (vty
, "%12.2f",
9143 (float)ts
.counts
[i
] / (float)TALLY_SIGFIG
);
9146 case BGP_STATS_ASPATH_TOTHOPS
:
9147 case BGP_STATS_ASPATH_TOTSIZE
:
9148 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9149 vty_out (vty
, "%12.2f",
9151 (float)ts
.counts
[i
] /
9152 (float)ts
.counts
[BGP_STATS_ASPATH_COUNT
]
9155 case BGP_STATS_TOTPLEN
:
9156 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9157 vty_out (vty
, "%12.2f",
9159 (float)ts
.counts
[i
] /
9160 (float)ts
.counts
[BGP_STATS_PREFIXES
]
9163 case BGP_STATS_SPACE
:
9164 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9165 vty_out (vty
, "%12llu%s", ts
.counts
[i
], VTY_NEWLINE
);
9166 if (ts
.counts
[BGP_STATS_MAXBITLEN
] < 9)
9168 vty_out (vty
, "%30s: ", "%% announced ");
9169 vty_out (vty
, "%12.2f%s",
9170 100 * (float)ts
.counts
[BGP_STATS_SPACE
] /
9171 (float)((uint64_t)1UL << ts
.counts
[BGP_STATS_MAXBITLEN
]),
9173 vty_out (vty
, "%30s: ", "/8 equivalent ");
9174 vty_out (vty
, "%12.2f%s",
9175 (float)ts
.counts
[BGP_STATS_SPACE
] /
9176 (float)(1UL << (ts
.counts
[BGP_STATS_MAXBITLEN
] - 8)),
9178 if (ts
.counts
[BGP_STATS_MAXBITLEN
] < 25)
9180 vty_out (vty
, "%30s: ", "/24 equivalent ");
9181 vty_out (vty
, "%12.2f",
9182 (float)ts
.counts
[BGP_STATS_SPACE
] /
9183 (float)(1UL << (ts
.counts
[BGP_STATS_MAXBITLEN
] - 24)));
9186 vty_out (vty
, "%-30s: ", table_stats_strs
[i
]);
9187 vty_out (vty
, "%12llu", ts
.counts
[i
]);
9190 vty_out (vty
, "%s", VTY_NEWLINE
);
9196 bgp_table_stats_vty (struct vty
*vty
, const char *name
,
9197 const char *afi_str
, const char *safi_str
)
9204 bgp
= bgp_lookup_by_name (name
);
9206 bgp
= bgp_get_default ();
9210 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
9213 if (strncmp (afi_str
, "ipv", 3) == 0)
9215 if (strncmp (afi_str
, "ipv4", 4) == 0)
9217 else if (strncmp (afi_str
, "ipv6", 4) == 0)
9221 vty_out (vty
, "%% Invalid address family %s%s",
9222 afi_str
, VTY_NEWLINE
);
9225 if (strncmp (safi_str
, "m", 1) == 0)
9226 safi
= SAFI_MULTICAST
;
9227 else if (strncmp (safi_str
, "u", 1) == 0)
9228 safi
= SAFI_UNICAST
;
9229 else if (strncmp (safi_str
, "vpnv4", 5) == 0)
9230 safi
= BGP_SAFI_VPNV4
;
9231 else if (strncmp (safi_str
, "vpnv6", 6) == 0)
9232 safi
= BGP_SAFI_VPNV6
;
9235 vty_out (vty
, "%% Invalid subsequent address family %s%s",
9236 safi_str
, VTY_NEWLINE
);
9242 vty_out (vty
, "%% Invalid address family %s%s",
9243 afi_str
, VTY_NEWLINE
);
9247 if ((afi
== AFI_IP
&& safi
== BGP_SAFI_VPNV6
)
9248 || (afi
== AFI_IP6
&& safi
== BGP_SAFI_VPNV4
))
9250 vty_out (vty
, "%% Invalid subsequent address family %s for %s%s",
9251 afi_str
, safi_str
, VTY_NEWLINE
);
9254 return bgp_table_stats (vty
, bgp
, afi
, safi
);
9257 DEFUN (show_bgp_statistics
,
9258 show_bgp_statistics_cmd
,
9259 "show bgp (ipv4|ipv6) (unicast|multicast) statistics",
9264 "Address Family modifier\n"
9265 "Address Family modifier\n"
9266 "BGP RIB advertisement statistics\n")
9268 return bgp_table_stats_vty (vty
, NULL
, argv
[0], argv
[1]);
9271 ALIAS (show_bgp_statistics
,
9272 show_bgp_statistics_vpnv4_cmd
,
9273 "show bgp (ipv4) (vpnv4) statistics",
9277 "Address Family modifier\n"
9278 "BGP RIB advertisement statistics\n")
9280 DEFUN (show_bgp_statistics_view
,
9281 show_bgp_statistics_view_cmd
,
9282 "show bgp view WORD (ipv4|ipv6) (unicast|multicast) statistics",
9288 "Address Family modifier\n"
9289 "Address Family modifier\n"
9290 "BGP RIB advertisement statistics\n")
9292 return bgp_table_stats_vty (vty
, NULL
, argv
[0], argv
[1]);
9295 ALIAS (show_bgp_statistics_view
,
9296 show_bgp_statistics_view_vpnv4_cmd
,
9297 "show bgp view WORD (ipv4) (vpnv4) statistics",
9302 "Address Family modifier\n"
9303 "BGP RIB advertisement statistics\n")
9315 PCOUNT_PFCNT
, /* the figure we display to users */
9319 static const char *pcount_strs
[] =
9321 [PCOUNT_ADJ_IN
] = "Adj-in",
9322 [PCOUNT_DAMPED
] = "Damped",
9323 [PCOUNT_REMOVED
] = "Removed",
9324 [PCOUNT_HISTORY
] = "History",
9325 [PCOUNT_STALE
] = "Stale",
9326 [PCOUNT_VALID
] = "Valid",
9327 [PCOUNT_ALL
] = "All RIB",
9328 [PCOUNT_COUNTED
] = "PfxCt counted",
9329 [PCOUNT_PFCNT
] = "Useable",
9330 [PCOUNT_MAX
] = NULL
,
9335 unsigned int count
[PCOUNT_MAX
];
9336 const struct peer
*peer
;
9337 const struct bgp_table
*table
;
9341 bgp_peer_count_walker (struct thread
*t
)
9343 struct bgp_node
*rn
;
9344 struct peer_pcounts
*pc
= THREAD_ARG (t
);
9345 const struct peer
*peer
= pc
->peer
;
9347 for (rn
= bgp_table_top (pc
->table
); rn
; rn
= bgp_route_next (rn
))
9349 struct bgp_adj_in
*ain
;
9350 struct bgp_info
*ri
;
9352 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
9353 if (ain
->peer
== peer
)
9354 pc
->count
[PCOUNT_ADJ_IN
]++;
9356 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
9358 char buf
[SU_ADDRSTRLEN
];
9360 if (ri
->peer
!= peer
)
9363 pc
->count
[PCOUNT_ALL
]++;
9365 if (CHECK_FLAG (ri
->flags
, BGP_INFO_DAMPED
))
9366 pc
->count
[PCOUNT_DAMPED
]++;
9367 if (CHECK_FLAG (ri
->flags
, BGP_INFO_HISTORY
))
9368 pc
->count
[PCOUNT_HISTORY
]++;
9369 if (CHECK_FLAG (ri
->flags
, BGP_INFO_REMOVED
))
9370 pc
->count
[PCOUNT_REMOVED
]++;
9371 if (CHECK_FLAG (ri
->flags
, BGP_INFO_STALE
))
9372 pc
->count
[PCOUNT_STALE
]++;
9373 if (CHECK_FLAG (ri
->flags
, BGP_INFO_VALID
))
9374 pc
->count
[PCOUNT_VALID
]++;
9375 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
9376 pc
->count
[PCOUNT_PFCNT
]++;
9378 if (CHECK_FLAG (ri
->flags
, BGP_INFO_COUNTED
))
9380 pc
->count
[PCOUNT_COUNTED
]++;
9381 if (CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
9382 plog_warn (peer
->log
,
9383 "%s [pcount] %s/%d is counted but flags 0x%x",
9385 inet_ntop(rn
->p
.family
, &rn
->p
.u
.prefix
,
9386 buf
, SU_ADDRSTRLEN
),
9392 if (!CHECK_FLAG (ri
->flags
, BGP_INFO_UNUSEABLE
))
9393 plog_warn (peer
->log
,
9394 "%s [pcount] %s/%d not counted but flags 0x%x",
9396 inet_ntop(rn
->p
.family
, &rn
->p
.u
.prefix
,
9397 buf
, SU_ADDRSTRLEN
),
9407 bgp_peer_counts (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
)
9409 struct peer_pcounts pcounts
= { .peer
= peer
};
9412 if (!peer
|| !peer
->bgp
|| !peer
->afc
[afi
][safi
]
9413 || !peer
->bgp
->rib
[afi
][safi
])
9415 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
9419 memset (&pcounts
, 0, sizeof(pcounts
));
9420 pcounts
.peer
= peer
;
9421 pcounts
.table
= peer
->bgp
->rib
[afi
][safi
];
9423 /* in-place call via thread subsystem so as to record execution time
9424 * stats for the thread-walk (i.e. ensure this can't be blamed on
9425 * on just vty_read()).
9427 thread_execute (bm
->master
, bgp_peer_count_walker
, &pcounts
, 0);
9429 vty_out (vty
, "Prefix counts for %s, %s%s",
9430 peer
->host
, afi_safi_print (afi
, safi
), VTY_NEWLINE
);
9431 vty_out (vty
, "PfxCt: %ld%s", peer
->pcount
[afi
][safi
], VTY_NEWLINE
);
9432 vty_out (vty
, "%sCounts from RIB table walk:%s%s",
9433 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
9435 for (i
= 0; i
< PCOUNT_MAX
; i
++)
9436 vty_out (vty
, "%20s: %-10d%s",
9437 pcount_strs
[i
], pcounts
.count
[i
], VTY_NEWLINE
);
9439 if (pcounts
.count
[PCOUNT_PFCNT
] != peer
->pcount
[afi
][safi
])
9441 vty_out (vty
, "%s [pcount] PfxCt drift!%s",
9442 peer
->host
, VTY_NEWLINE
);
9443 vty_out (vty
, "Please report this bug, with the above command output%s",
9450 DEFUN (show_ip_bgp_neighbor_prefix_counts
,
9451 show_ip_bgp_neighbor_prefix_counts_cmd
,
9452 "show ip bgp neighbors (A.B.C.D|X:X::X:X) prefix-counts",
9456 "Detailed information on TCP and BGP neighbor connections\n"
9457 "Neighbor to display information about\n"
9458 "Neighbor to display information about\n"
9459 "Display detailed prefix count information\n")
9463 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9467 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_UNICAST
);
9470 DEFUN (show_bgp_ipv6_neighbor_prefix_counts
,
9471 show_bgp_ipv6_neighbor_prefix_counts_cmd
,
9472 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) prefix-counts",
9476 "Detailed information on TCP and BGP neighbor connections\n"
9477 "Neighbor to display information about\n"
9478 "Neighbor to display information about\n"
9479 "Display detailed prefix count information\n")
9483 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9487 return bgp_peer_counts (vty
, peer
, AFI_IP6
, SAFI_UNICAST
);
9490 DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts
,
9491 show_ip_bgp_ipv4_neighbor_prefix_counts_cmd
,
9492 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) prefix-counts",
9497 "Address Family modifier\n"
9498 "Address Family modifier\n"
9499 "Detailed information on TCP and BGP neighbor connections\n"
9500 "Neighbor to display information about\n"
9501 "Neighbor to display information about\n"
9502 "Display detailed prefix count information\n")
9506 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
9510 if (strncmp (argv
[0], "m", 1) == 0)
9511 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_MULTICAST
);
9513 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_UNICAST
);
9516 DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts
,
9517 show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd
,
9518 "show ip bgp vpnv4 all neighbors (A.B.C.D|X:X::X:X) prefix-counts",
9523 "Address Family modifier\n"
9524 "Address Family modifier\n"
9525 "Detailed information on TCP and BGP neighbor connections\n"
9526 "Neighbor to display information about\n"
9527 "Neighbor to display information about\n"
9528 "Display detailed prefix count information\n")
9532 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9536 return bgp_peer_counts (vty
, peer
, AFI_IP
, SAFI_MPLS_VPN
);
9541 show_adj_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
,
9544 struct bgp_table
*table
;
9545 struct bgp_adj_in
*ain
;
9546 struct bgp_adj_out
*adj
;
9547 unsigned long output_count
;
9548 struct bgp_node
*rn
;
9558 table
= bgp
->rib
[afi
][safi
];
9562 if (! in
&& CHECK_FLAG (peer
->af_sflags
[afi
][safi
],
9563 PEER_STATUS_DEFAULT_ORIGINATE
))
9565 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
9566 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9567 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9569 vty_out (vty
, "Originating default network 0.0.0.0%s%s",
9570 VTY_NEWLINE
, VTY_NEWLINE
);
9574 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
9577 for (ain
= rn
->adj_in
; ain
; ain
= ain
->next
)
9578 if (ain
->peer
== peer
)
9582 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
9583 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9584 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9589 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
9594 route_vty_out_tmp (vty
, &rn
->p
, ain
->attr
, safi
);
9601 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
)
9602 if (adj
->peer
== peer
)
9606 vty_out (vty
, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
9607 vty_out (vty
, BGP_SHOW_SCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9608 vty_out (vty
, BGP_SHOW_OCODE_HEADER
, VTY_NEWLINE
, VTY_NEWLINE
);
9613 vty_out (vty
, BGP_SHOW_HEADER
, VTY_NEWLINE
);
9618 route_vty_out_tmp (vty
, &rn
->p
, adj
->attr
, safi
);
9624 if (output_count
!= 0)
9625 vty_out (vty
, "%sTotal number of prefixes %ld%s",
9626 VTY_NEWLINE
, output_count
, VTY_NEWLINE
);
9630 peer_adj_routes (struct vty
*vty
, struct peer
*peer
, afi_t afi
, safi_t safi
, int in
)
9632 if (! peer
|| ! peer
->afc
[afi
][safi
])
9634 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
9638 if (in
&& ! CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
9640 vty_out (vty
, "%% Inbound soft reconfiguration not enabled%s",
9645 show_adj_route (vty
, peer
, afi
, safi
, in
);
9650 DEFUN (show_ip_bgp_neighbor_advertised_route
,
9651 show_ip_bgp_neighbor_advertised_route_cmd
,
9652 "show ip bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9656 "Detailed information on TCP and BGP neighbor connections\n"
9657 "Neighbor to display information about\n"
9658 "Neighbor to display information about\n"
9659 "Display the routes advertised to a BGP neighbor\n")
9663 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9667 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0);
9670 DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route
,
9671 show_ip_bgp_ipv4_neighbor_advertised_route_cmd
,
9672 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9677 "Address Family modifier\n"
9678 "Address Family modifier\n"
9679 "Detailed information on TCP and BGP neighbor connections\n"
9680 "Neighbor to display information about\n"
9681 "Neighbor to display information about\n"
9682 "Display the routes advertised to a BGP neighbor\n")
9686 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
9690 if (strncmp (argv
[0], "m", 1) == 0)
9691 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 0);
9693 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 0);
9697 DEFUN (show_bgp_view_neighbor_advertised_route
,
9698 show_bgp_view_neighbor_advertised_route_cmd
,
9699 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9704 "Detailed information on TCP and BGP neighbor connections\n"
9705 "Neighbor to display information about\n"
9706 "Neighbor to display information about\n"
9707 "Display the routes advertised to a BGP neighbor\n")
9712 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9714 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9719 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 0);
9722 ALIAS (show_bgp_view_neighbor_advertised_route
,
9723 show_bgp_view_ipv6_neighbor_advertised_route_cmd
,
9724 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) advertised-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 routes advertised to a BGP neighbor\n")
9735 DEFUN (show_bgp_view_neighbor_received_routes
,
9736 show_bgp_view_neighbor_received_routes_cmd
,
9737 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received-routes",
9742 "Detailed information on TCP and BGP neighbor connections\n"
9743 "Neighbor to display information about\n"
9744 "Neighbor to display information about\n"
9745 "Display the received routes from neighbor\n")
9750 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
9752 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9757 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_UNICAST
, 1);
9760 ALIAS (show_bgp_view_neighbor_received_routes
,
9761 show_bgp_view_ipv6_neighbor_received_routes_cmd
,
9762 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
9768 "Detailed information on TCP and BGP neighbor connections\n"
9769 "Neighbor to display information about\n"
9770 "Neighbor to display information about\n"
9771 "Display the received routes from neighbor\n")
9773 ALIAS (show_bgp_view_neighbor_advertised_route
,
9774 show_bgp_neighbor_advertised_route_cmd
,
9775 "show bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9778 "Detailed information on TCP and BGP neighbor connections\n"
9779 "Neighbor to display information about\n"
9780 "Neighbor to display information about\n"
9781 "Display the routes advertised to a BGP neighbor\n")
9783 ALIAS (show_bgp_view_neighbor_advertised_route
,
9784 show_bgp_ipv6_neighbor_advertised_route_cmd
,
9785 "show bgp ipv6 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 ALIAS (show_bgp_view_neighbor_advertised_route
,
9796 ipv6_bgp_neighbor_advertised_route_cmd
,
9797 "show ipv6 bgp 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")
9807 DEFUN (ipv6_mbgp_neighbor_advertised_route
,
9808 ipv6_mbgp_neighbor_advertised_route_cmd
,
9809 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
9813 "Detailed information on TCP and BGP neighbor connections\n"
9814 "Neighbor to display information about\n"
9815 "Neighbor to display information about\n"
9816 "Display the routes advertised to a BGP neighbor\n")
9820 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9824 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 0);
9826 #endif /* HAVE_IPV6 */
9828 DEFUN (show_ip_bgp_neighbor_received_routes
,
9829 show_ip_bgp_neighbor_received_routes_cmd
,
9830 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
9834 "Detailed information on TCP and BGP neighbor connections\n"
9835 "Neighbor to display information about\n"
9836 "Neighbor to display information about\n"
9837 "Display the received routes from neighbor\n")
9841 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
9845 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1);
9848 DEFUN (show_ip_bgp_ipv4_neighbor_received_routes
,
9849 show_ip_bgp_ipv4_neighbor_received_routes_cmd
,
9850 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received-routes",
9855 "Address Family modifier\n"
9856 "Address Family modifier\n"
9857 "Detailed information on TCP and BGP neighbor connections\n"
9858 "Neighbor to display information about\n"
9859 "Neighbor to display information about\n"
9860 "Display the received routes from neighbor\n")
9864 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
9868 if (strncmp (argv
[0], "m", 1) == 0)
9869 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_MULTICAST
, 1);
9871 return peer_adj_routes (vty
, peer
, AFI_IP
, SAFI_UNICAST
, 1);
9874 DEFUN (show_ip_bgp_neighbor_received_prefix_filter
,
9875 show_ip_bgp_neighbor_received_prefix_filter_cmd
,
9876 "show ip bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
9880 "Detailed information on TCP and BGP neighbor connections\n"
9881 "Neighbor to display information about\n"
9882 "Neighbor to display information about\n"
9883 "Display information received from a BGP neighbor\n"
9884 "Display the prefixlist filter\n")
9887 union sockunion
*su
;
9891 su
= sockunion_str2su (argv
[0]);
9895 peer
= peer_lookup (NULL
, su
);
9899 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
9900 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
9903 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
9904 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
9910 DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter
,
9911 show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
,
9912 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
9917 "Address Family modifier\n"
9918 "Address Family modifier\n"
9919 "Detailed information on TCP and BGP neighbor connections\n"
9920 "Neighbor to display information about\n"
9921 "Neighbor to display information about\n"
9922 "Display information received from a BGP neighbor\n"
9923 "Display the prefixlist filter\n")
9926 union sockunion
*su
;
9930 su
= sockunion_str2su (argv
[1]);
9934 peer
= peer_lookup (NULL
, su
);
9938 if (strncmp (argv
[0], "m", 1) == 0)
9940 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_MULTICAST
);
9941 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
9944 vty_out (vty
, "Address family: IPv4 Multicast%s", VTY_NEWLINE
);
9945 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
9950 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP
, SAFI_UNICAST
);
9951 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP
, name
);
9954 vty_out (vty
, "Address family: IPv4 Unicast%s", VTY_NEWLINE
);
9955 prefix_bgp_show_prefix_list (vty
, AFI_IP
, name
);
9964 ALIAS (show_bgp_view_neighbor_received_routes
,
9965 show_bgp_neighbor_received_routes_cmd
,
9966 "show bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
9969 "Detailed information on TCP and BGP neighbor connections\n"
9970 "Neighbor to display information about\n"
9971 "Neighbor to display information about\n"
9972 "Display the received routes from neighbor\n")
9974 ALIAS (show_bgp_view_neighbor_received_routes
,
9975 show_bgp_ipv6_neighbor_received_routes_cmd
,
9976 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received-routes",
9980 "Detailed information on TCP and BGP neighbor connections\n"
9981 "Neighbor to display information about\n"
9982 "Neighbor to display information about\n"
9983 "Display the received routes from neighbor\n")
9985 DEFUN (show_bgp_neighbor_received_prefix_filter
,
9986 show_bgp_neighbor_received_prefix_filter_cmd
,
9987 "show bgp neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
9990 "Detailed information on TCP and BGP neighbor connections\n"
9991 "Neighbor to display information about\n"
9992 "Neighbor to display information about\n"
9993 "Display information received from a BGP neighbor\n"
9994 "Display the prefixlist filter\n")
9997 union sockunion
*su
;
10001 su
= sockunion_str2su (argv
[0]);
10003 return CMD_WARNING
;
10005 peer
= peer_lookup (NULL
, su
);
10007 return CMD_WARNING
;
10009 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
10010 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
10013 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
10014 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
10017 return CMD_SUCCESS
;
10020 ALIAS (show_bgp_neighbor_received_prefix_filter
,
10021 show_bgp_ipv6_neighbor_received_prefix_filter_cmd
,
10022 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
10026 "Detailed information on TCP and BGP neighbor connections\n"
10027 "Neighbor to display information about\n"
10028 "Neighbor to display information about\n"
10029 "Display information received from a BGP neighbor\n"
10030 "Display the prefixlist filter\n")
10033 ALIAS (show_bgp_view_neighbor_received_routes
,
10034 ipv6_bgp_neighbor_received_routes_cmd
,
10035 "show ipv6 bgp 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")
10045 DEFUN (ipv6_mbgp_neighbor_received_routes
,
10046 ipv6_mbgp_neighbor_received_routes_cmd
,
10047 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) received-routes",
10051 "Detailed information on TCP and BGP neighbor connections\n"
10052 "Neighbor to display information about\n"
10053 "Neighbor to display information about\n"
10054 "Display the received routes from neighbor\n")
10058 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10060 return CMD_WARNING
;
10062 return peer_adj_routes (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
, 1);
10065 DEFUN (show_bgp_view_neighbor_received_prefix_filter
,
10066 show_bgp_view_neighbor_received_prefix_filter_cmd
,
10067 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
10072 "Detailed information on TCP and BGP neighbor connections\n"
10073 "Neighbor to display information about\n"
10074 "Neighbor to display information about\n"
10075 "Display information received from a BGP neighbor\n"
10076 "Display the prefixlist filter\n")
10079 union sockunion
*su
;
10084 /* BGP structure lookup. */
10085 bgp
= bgp_lookup_by_name (argv
[0]);
10088 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10089 return CMD_WARNING
;
10092 su
= sockunion_str2su (argv
[1]);
10094 return CMD_WARNING
;
10096 peer
= peer_lookup (bgp
, su
);
10098 return CMD_WARNING
;
10100 sprintf (name
, "%s.%d.%d", peer
->host
, AFI_IP6
, SAFI_UNICAST
);
10101 count
= prefix_bgp_show_prefix_list (NULL
, AFI_IP6
, name
);
10104 vty_out (vty
, "Address family: IPv6 Unicast%s", VTY_NEWLINE
);
10105 prefix_bgp_show_prefix_list (vty
, AFI_IP6
, name
);
10108 return CMD_SUCCESS
;
10111 ALIAS (show_bgp_view_neighbor_received_prefix_filter
,
10112 show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
,
10113 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) received prefix-filter",
10119 "Detailed information on TCP and BGP neighbor connections\n"
10120 "Neighbor to display information about\n"
10121 "Neighbor to display information about\n"
10122 "Display information received from a BGP neighbor\n"
10123 "Display the prefixlist filter\n")
10124 #endif /* HAVE_IPV6 */
10127 bgp_show_neighbor_route (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
10128 safi_t safi
, enum bgp_show_type type
)
10130 if (! peer
|| ! peer
->afc
[afi
][safi
])
10132 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
10133 return CMD_WARNING
;
10136 return bgp_show (vty
, peer
->bgp
, afi
, safi
, type
, &peer
->su
);
10139 DEFUN (show_ip_bgp_neighbor_routes
,
10140 show_ip_bgp_neighbor_routes_cmd
,
10141 "show ip bgp neighbors (A.B.C.D|X:X::X:X) routes",
10145 "Detailed information on TCP and BGP neighbor connections\n"
10146 "Neighbor to display information about\n"
10147 "Neighbor to display information about\n"
10148 "Display routes learned from neighbor\n")
10152 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10154 return CMD_WARNING
;
10156 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
10157 bgp_show_type_neighbor
);
10160 DEFUN (show_ip_bgp_neighbor_flap
,
10161 show_ip_bgp_neighbor_flap_cmd
,
10162 "show ip bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
10166 "Detailed information on TCP and BGP neighbor connections\n"
10167 "Neighbor to display information about\n"
10168 "Neighbor to display information about\n"
10169 "Display flap statistics of the routes learned from neighbor\n")
10173 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10175 return CMD_WARNING
;
10177 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
10178 bgp_show_type_flap_neighbor
);
10181 DEFUN (show_ip_bgp_neighbor_damp
,
10182 show_ip_bgp_neighbor_damp_cmd
,
10183 "show ip bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
10187 "Detailed information on TCP and BGP neighbor connections\n"
10188 "Neighbor to display information about\n"
10189 "Neighbor to display information about\n"
10190 "Display the dampened routes received from neighbor\n")
10194 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10196 return CMD_WARNING
;
10198 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
10199 bgp_show_type_damp_neighbor
);
10202 DEFUN (show_ip_bgp_ipv4_neighbor_routes
,
10203 show_ip_bgp_ipv4_neighbor_routes_cmd
,
10204 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) routes",
10209 "Address Family modifier\n"
10210 "Address Family modifier\n"
10211 "Detailed information on TCP and BGP neighbor connections\n"
10212 "Neighbor to display information about\n"
10213 "Neighbor to display information about\n"
10214 "Display routes learned from neighbor\n")
10218 peer
= peer_lookup_in_view (vty
, NULL
, argv
[1]);
10220 return CMD_WARNING
;
10222 if (strncmp (argv
[0], "m", 1) == 0)
10223 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_MULTICAST
,
10224 bgp_show_type_neighbor
);
10226 return bgp_show_neighbor_route (vty
, peer
, AFI_IP
, SAFI_UNICAST
,
10227 bgp_show_type_neighbor
);
10230 DEFUN (show_ip_bgp_view_rsclient
,
10231 show_ip_bgp_view_rsclient_cmd
,
10232 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X)",
10238 "Information about Route Server Client\n"
10241 struct bgp_table
*table
;
10245 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10247 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10250 return CMD_WARNING
;
10252 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
10254 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10256 return CMD_WARNING
;
10259 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
10260 PEER_FLAG_RSERVER_CLIENT
))
10262 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10264 return CMD_WARNING
;
10267 table
= peer
->rib
[AFI_IP
][SAFI_UNICAST
];
10269 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
10272 ALIAS (show_ip_bgp_view_rsclient
,
10273 show_ip_bgp_rsclient_cmd
,
10274 "show ip bgp rsclient (A.B.C.D|X:X::X:X)",
10278 "Information about Route Server Client\n"
10281 DEFUN (show_ip_bgp_view_rsclient_route
,
10282 show_ip_bgp_view_rsclient_route_cmd
,
10283 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
10289 "Information about Route Server Client\n"
10291 "Network in the BGP routing table to display\n")
10296 /* BGP structure lookup. */
10299 bgp
= bgp_lookup_by_name (argv
[0]);
10302 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10303 return CMD_WARNING
;
10308 bgp
= bgp_get_default ();
10311 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
10312 return CMD_WARNING
;
10317 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10319 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10322 return CMD_WARNING
;
10324 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
10326 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10328 return CMD_WARNING
;
10331 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
10332 PEER_FLAG_RSERVER_CLIENT
))
10334 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10336 return CMD_WARNING
;
10339 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
10340 (argc
== 3) ? argv
[2] : argv
[1],
10341 AFI_IP
, SAFI_UNICAST
, NULL
, 0);
10344 ALIAS (show_ip_bgp_view_rsclient_route
,
10345 show_ip_bgp_rsclient_route_cmd
,
10346 "show ip bgp rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
10350 "Information about Route Server Client\n"
10352 "Network in the BGP routing table to display\n")
10354 DEFUN (show_ip_bgp_view_rsclient_prefix
,
10355 show_ip_bgp_view_rsclient_prefix_cmd
,
10356 "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
10362 "Information about Route Server Client\n"
10364 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
10369 /* BGP structure lookup. */
10372 bgp
= bgp_lookup_by_name (argv
[0]);
10375 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10376 return CMD_WARNING
;
10381 bgp
= bgp_get_default ();
10384 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
10385 return CMD_WARNING
;
10390 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10392 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10395 return CMD_WARNING
;
10397 if (! peer
->afc
[AFI_IP
][SAFI_UNICAST
])
10399 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10401 return CMD_WARNING
;
10404 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP
][SAFI_UNICAST
],
10405 PEER_FLAG_RSERVER_CLIENT
))
10407 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10409 return CMD_WARNING
;
10412 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP
][SAFI_UNICAST
],
10413 (argc
== 3) ? argv
[2] : argv
[1],
10414 AFI_IP
, SAFI_UNICAST
, NULL
, 1);
10417 ALIAS (show_ip_bgp_view_rsclient_prefix
,
10418 show_ip_bgp_rsclient_prefix_cmd
,
10419 "show ip bgp rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M",
10423 "Information about Route Server Client\n"
10425 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
10429 DEFUN (show_bgp_view_neighbor_routes
,
10430 show_bgp_view_neighbor_routes_cmd
,
10431 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) routes",
10436 "Detailed information on TCP and BGP neighbor connections\n"
10437 "Neighbor to display information about\n"
10438 "Neighbor to display information about\n"
10439 "Display routes learned from neighbor\n")
10444 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10446 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10449 return CMD_WARNING
;
10451 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
10452 bgp_show_type_neighbor
);
10455 ALIAS (show_bgp_view_neighbor_routes
,
10456 show_bgp_view_ipv6_neighbor_routes_cmd
,
10457 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) 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 routes learned from neighbor\n")
10468 DEFUN (show_bgp_view_neighbor_damp
,
10469 show_bgp_view_neighbor_damp_cmd
,
10470 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) dampened-routes",
10475 "Detailed information on TCP and BGP neighbor connections\n"
10476 "Neighbor to display information about\n"
10477 "Neighbor to display information about\n"
10478 "Display the dampened routes received from neighbor\n")
10483 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10485 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10488 return CMD_WARNING
;
10490 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
10491 bgp_show_type_damp_neighbor
);
10494 ALIAS (show_bgp_view_neighbor_damp
,
10495 show_bgp_view_ipv6_neighbor_damp_cmd
,
10496 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes",
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 the dampened routes received from neighbor\n")
10507 DEFUN (show_bgp_view_neighbor_flap
,
10508 show_bgp_view_neighbor_flap_cmd
,
10509 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X) flap-statistics",
10514 "Detailed information on TCP and BGP neighbor connections\n"
10515 "Neighbor to display information about\n"
10516 "Neighbor to display information about\n"
10517 "Display flap statistics of the routes learned from neighbor\n")
10522 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10524 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10527 return CMD_WARNING
;
10529 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_UNICAST
,
10530 bgp_show_type_flap_neighbor
);
10533 ALIAS (show_bgp_view_neighbor_flap
,
10534 show_bgp_view_ipv6_neighbor_flap_cmd
,
10535 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics",
10541 "Detailed information on TCP and BGP neighbor connections\n"
10542 "Neighbor to display information about\n"
10543 "Neighbor to display information about\n"
10544 "Display flap statistics of the routes learned from neighbor\n")
10546 ALIAS (show_bgp_view_neighbor_routes
,
10547 show_bgp_neighbor_routes_cmd
,
10548 "show bgp 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 show_bgp_ipv6_neighbor_routes_cmd
,
10559 "show bgp ipv6 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 ALIAS (show_bgp_view_neighbor_routes
,
10570 ipv6_bgp_neighbor_routes_cmd
,
10571 "show ipv6 bgp 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")
10581 DEFUN (ipv6_mbgp_neighbor_routes
,
10582 ipv6_mbgp_neighbor_routes_cmd
,
10583 "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X) routes",
10587 "Detailed information on TCP and BGP neighbor connections\n"
10588 "Neighbor to display information about\n"
10589 "Neighbor to display information about\n"
10590 "Display routes learned from neighbor\n")
10594 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10596 return CMD_WARNING
;
10598 return bgp_show_neighbor_route (vty
, peer
, AFI_IP6
, SAFI_MULTICAST
,
10599 bgp_show_type_neighbor
);
10602 ALIAS (show_bgp_view_neighbor_flap
,
10603 show_bgp_neighbor_flap_cmd
,
10604 "show bgp neighbors (A.B.C.D|X:X::X:X) flap-statistics",
10607 "Detailed information on TCP and BGP neighbor connections\n"
10608 "Neighbor to display information about\n"
10609 "Neighbor to display information about\n"
10610 "Display flap statistics of the routes learned from neighbor\n")
10612 ALIAS (show_bgp_view_neighbor_flap
,
10613 show_bgp_ipv6_neighbor_flap_cmd
,
10614 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) flap-statistics",
10618 "Detailed information on TCP and BGP neighbor connections\n"
10619 "Neighbor to display information about\n"
10620 "Neighbor to display information about\n"
10621 "Display flap statistics of the routes learned from neighbor\n")
10623 ALIAS (show_bgp_view_neighbor_damp
,
10624 show_bgp_neighbor_damp_cmd
,
10625 "show bgp neighbors (A.B.C.D|X:X::X:X) dampened-routes",
10628 "Detailed information on TCP and BGP neighbor connections\n"
10629 "Neighbor to display information about\n"
10630 "Neighbor to display information about\n"
10631 "Display the dampened routes received from neighbor\n")
10633 ALIAS (show_bgp_view_neighbor_damp
,
10634 show_bgp_ipv6_neighbor_damp_cmd
,
10635 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X) dampened-routes",
10639 "Detailed information on TCP and BGP neighbor connections\n"
10640 "Neighbor to display information about\n"
10641 "Neighbor to display information about\n"
10642 "Display the dampened routes received from neighbor\n")
10644 DEFUN (show_bgp_view_rsclient
,
10645 show_bgp_view_rsclient_cmd
,
10646 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X)",
10651 "Information about Route Server Client\n"
10654 struct bgp_table
*table
;
10658 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10660 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10663 return CMD_WARNING
;
10665 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
10667 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10669 return CMD_WARNING
;
10672 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
10673 PEER_FLAG_RSERVER_CLIENT
))
10675 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10677 return CMD_WARNING
;
10680 table
= peer
->rib
[AFI_IP6
][SAFI_UNICAST
];
10682 return bgp_show_table (vty
, table
, &peer
->remote_id
, bgp_show_type_normal
, NULL
);
10685 ALIAS (show_bgp_view_rsclient
,
10686 show_bgp_rsclient_cmd
,
10687 "show bgp rsclient (A.B.C.D|X:X::X:X)",
10690 "Information about Route Server Client\n"
10693 DEFUN (show_bgp_view_rsclient_route
,
10694 show_bgp_view_rsclient_route_cmd
,
10695 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
10700 "Information about Route Server Client\n"
10702 "Network in the BGP routing table to display\n")
10707 /* BGP structure lookup. */
10710 bgp
= bgp_lookup_by_name (argv
[0]);
10713 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10714 return CMD_WARNING
;
10719 bgp
= bgp_get_default ();
10722 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
10723 return CMD_WARNING
;
10728 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10730 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10733 return CMD_WARNING
;
10735 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
10737 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10739 return CMD_WARNING
;
10742 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
10743 PEER_FLAG_RSERVER_CLIENT
))
10745 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10747 return CMD_WARNING
;
10750 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
10751 (argc
== 3) ? argv
[2] : argv
[1],
10752 AFI_IP6
, SAFI_UNICAST
, NULL
, 0);
10755 ALIAS (show_bgp_view_rsclient_route
,
10756 show_bgp_rsclient_route_cmd
,
10757 "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X",
10760 "Information about Route Server Client\n"
10762 "Network in the BGP routing table to display\n")
10764 DEFUN (show_bgp_view_rsclient_prefix
,
10765 show_bgp_view_rsclient_prefix_cmd
,
10766 "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
10771 "Information about Route Server Client\n"
10773 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
10778 /* BGP structure lookup. */
10781 bgp
= bgp_lookup_by_name (argv
[0]);
10784 vty_out (vty
, "Can't find BGP view %s%s", argv
[0], VTY_NEWLINE
);
10785 return CMD_WARNING
;
10790 bgp
= bgp_get_default ();
10793 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
10794 return CMD_WARNING
;
10799 peer
= peer_lookup_in_view (vty
, argv
[0], argv
[1]);
10801 peer
= peer_lookup_in_view (vty
, NULL
, argv
[0]);
10804 return CMD_WARNING
;
10806 if (! peer
->afc
[AFI_IP6
][SAFI_UNICAST
])
10808 vty_out (vty
, "%% Activate the neighbor for the address family first%s",
10810 return CMD_WARNING
;
10813 if ( ! CHECK_FLAG (peer
->af_flags
[AFI_IP6
][SAFI_UNICAST
],
10814 PEER_FLAG_RSERVER_CLIENT
))
10816 vty_out (vty
, "%% Neighbor is not a Route-Server client%s",
10818 return CMD_WARNING
;
10821 return bgp_show_route_in_table (vty
, bgp
, peer
->rib
[AFI_IP6
][SAFI_UNICAST
],
10822 (argc
== 3) ? argv
[2] : argv
[1],
10823 AFI_IP6
, SAFI_UNICAST
, NULL
, 1);
10826 ALIAS (show_bgp_view_rsclient_prefix
,
10827 show_bgp_rsclient_prefix_cmd
,
10828 "show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M",
10831 "Information about Route Server Client\n"
10833 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
10835 #endif /* HAVE_IPV6 */
10837 struct bgp_table
*bgp_distance_table
;
10839 struct bgp_distance
10841 /* Distance value for the IP source prefix. */
10844 /* Name of the access-list to be matched. */
10848 static struct bgp_distance
*
10849 bgp_distance_new (void)
10851 return XCALLOC (MTYPE_BGP_DISTANCE
, sizeof (struct bgp_distance
));
10855 bgp_distance_free (struct bgp_distance
*bdistance
)
10857 XFREE (MTYPE_BGP_DISTANCE
, bdistance
);
10861 bgp_distance_set (struct vty
*vty
, const char *distance_str
,
10862 const char *ip_str
, const char *access_list_str
)
10865 struct prefix_ipv4 p
;
10867 struct bgp_node
*rn
;
10868 struct bgp_distance
*bdistance
;
10870 ret
= str2prefix_ipv4 (ip_str
, &p
);
10873 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
10874 return CMD_WARNING
;
10877 distance
= atoi (distance_str
);
10879 /* Get BGP distance node. */
10880 rn
= bgp_node_get (bgp_distance_table
, (struct prefix
*) &p
);
10883 bdistance
= rn
->info
;
10884 bgp_unlock_node (rn
);
10888 bdistance
= bgp_distance_new ();
10889 rn
->info
= bdistance
;
10892 /* Set distance value. */
10893 bdistance
->distance
= distance
;
10895 /* Reset access-list configuration. */
10896 if (bdistance
->access_list
)
10898 free (bdistance
->access_list
);
10899 bdistance
->access_list
= NULL
;
10901 if (access_list_str
)
10902 bdistance
->access_list
= strdup (access_list_str
);
10904 return CMD_SUCCESS
;
10908 bgp_distance_unset (struct vty
*vty
, const char *distance_str
,
10909 const char *ip_str
, const char *access_list_str
)
10912 struct prefix_ipv4 p
;
10914 struct bgp_node
*rn
;
10915 struct bgp_distance
*bdistance
;
10917 ret
= str2prefix_ipv4 (ip_str
, &p
);
10920 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
10921 return CMD_WARNING
;
10924 distance
= atoi (distance_str
);
10926 rn
= bgp_node_lookup (bgp_distance_table
, (struct prefix
*)&p
);
10929 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
10930 return CMD_WARNING
;
10933 bdistance
= rn
->info
;
10935 if (bdistance
->access_list
)
10936 free (bdistance
->access_list
);
10937 bgp_distance_free (bdistance
);
10940 bgp_unlock_node (rn
);
10941 bgp_unlock_node (rn
);
10943 return CMD_SUCCESS
;
10947 bgp_distance_reset (void)
10949 struct bgp_node
*rn
;
10950 struct bgp_distance
*bdistance
;
10952 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
10953 if ((bdistance
= rn
->info
) != NULL
)
10955 if (bdistance
->access_list
)
10956 free (bdistance
->access_list
);
10957 bgp_distance_free (bdistance
);
10959 bgp_unlock_node (rn
);
10963 /* Apply BGP information to distance method. */
10965 bgp_distance_apply (struct prefix
*p
, struct bgp_info
*rinfo
, struct bgp
*bgp
)
10967 struct bgp_node
*rn
;
10968 struct prefix_ipv4 q
;
10970 struct bgp_distance
*bdistance
;
10971 struct access_list
*alist
;
10972 struct bgp_static
*bgp_static
;
10977 if (p
->family
!= AF_INET
)
10980 peer
= rinfo
->peer
;
10982 if (peer
->su
.sa
.sa_family
!= AF_INET
)
10985 memset (&q
, 0, sizeof (struct prefix_ipv4
));
10986 q
.family
= AF_INET
;
10987 q
.prefix
= peer
->su
.sin
.sin_addr
;
10988 q
.prefixlen
= IPV4_MAX_BITLEN
;
10990 /* Check source address. */
10991 rn
= bgp_node_match (bgp_distance_table
, (struct prefix
*) &q
);
10994 bdistance
= rn
->info
;
10995 bgp_unlock_node (rn
);
10997 if (bdistance
->access_list
)
10999 alist
= access_list_lookup (AFI_IP
, bdistance
->access_list
);
11000 if (alist
&& access_list_apply (alist
, p
) == FILTER_PERMIT
)
11001 return bdistance
->distance
;
11004 return bdistance
->distance
;
11007 /* Backdoor check. */
11008 rn
= bgp_node_lookup (bgp
->route
[AFI_IP
][SAFI_UNICAST
], p
);
11011 bgp_static
= rn
->info
;
11012 bgp_unlock_node (rn
);
11014 if (bgp_static
->backdoor
)
11016 if (bgp
->distance_local
)
11017 return bgp
->distance_local
;
11019 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
11023 if (peer_sort (peer
) == BGP_PEER_EBGP
)
11025 if (bgp
->distance_ebgp
)
11026 return bgp
->distance_ebgp
;
11027 return ZEBRA_EBGP_DISTANCE_DEFAULT
;
11031 if (bgp
->distance_ibgp
)
11032 return bgp
->distance_ibgp
;
11033 return ZEBRA_IBGP_DISTANCE_DEFAULT
;
11037 DEFUN (bgp_distance
,
11039 "distance bgp <1-255> <1-255> <1-255>",
11040 "Define an administrative distance\n"
11042 "Distance for routes external to the AS\n"
11043 "Distance for routes internal to the AS\n"
11044 "Distance for local routes\n")
11050 bgp
->distance_ebgp
= atoi (argv
[0]);
11051 bgp
->distance_ibgp
= atoi (argv
[1]);
11052 bgp
->distance_local
= atoi (argv
[2]);
11053 return CMD_SUCCESS
;
11056 DEFUN (no_bgp_distance
,
11057 no_bgp_distance_cmd
,
11058 "no distance bgp <1-255> <1-255> <1-255>",
11060 "Define an administrative distance\n"
11062 "Distance for routes external to the AS\n"
11063 "Distance for routes internal to the AS\n"
11064 "Distance for local routes\n")
11070 bgp
->distance_ebgp
= 0;
11071 bgp
->distance_ibgp
= 0;
11072 bgp
->distance_local
= 0;
11073 return CMD_SUCCESS
;
11076 ALIAS (no_bgp_distance
,
11077 no_bgp_distance2_cmd
,
11080 "Define an administrative distance\n"
11083 DEFUN (bgp_distance_source
,
11084 bgp_distance_source_cmd
,
11085 "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_set (vty
, argv
[0], argv
[1], NULL
);
11091 return CMD_SUCCESS
;
11094 DEFUN (no_bgp_distance_source
,
11095 no_bgp_distance_source_cmd
,
11096 "no distance <1-255> A.B.C.D/M",
11098 "Define an administrative distance\n"
11099 "Administrative distance\n"
11100 "IP source prefix\n")
11102 bgp_distance_unset (vty
, argv
[0], argv
[1], NULL
);
11103 return CMD_SUCCESS
;
11106 DEFUN (bgp_distance_source_access_list
,
11107 bgp_distance_source_access_list_cmd
,
11108 "distance <1-255> A.B.C.D/M WORD",
11109 "Define an administrative distance\n"
11110 "Administrative distance\n"
11111 "IP source prefix\n"
11112 "Access list name\n")
11114 bgp_distance_set (vty
, argv
[0], argv
[1], argv
[2]);
11115 return CMD_SUCCESS
;
11118 DEFUN (no_bgp_distance_source_access_list
,
11119 no_bgp_distance_source_access_list_cmd
,
11120 "no distance <1-255> A.B.C.D/M WORD",
11122 "Define an administrative distance\n"
11123 "Administrative distance\n"
11124 "IP source prefix\n"
11125 "Access list name\n")
11127 bgp_distance_unset (vty
, argv
[0], argv
[1], argv
[2]);
11128 return CMD_SUCCESS
;
11131 DEFUN (bgp_damp_set
,
11133 "bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
11134 "BGP Specific commands\n"
11135 "Enable route-flap dampening\n"
11136 "Half-life time for the penalty\n"
11137 "Value to start reusing a route\n"
11138 "Value to start suppressing a route\n"
11139 "Maximum duration to suppress a stable route\n")
11142 int half
= DEFAULT_HALF_LIFE
* 60;
11143 int reuse
= DEFAULT_REUSE
;
11144 int suppress
= DEFAULT_SUPPRESS
;
11145 int max
= 4 * half
;
11149 half
= atoi (argv
[0]) * 60;
11150 reuse
= atoi (argv
[1]);
11151 suppress
= atoi (argv
[2]);
11152 max
= atoi (argv
[3]) * 60;
11154 else if (argc
== 1)
11156 half
= atoi (argv
[0]) * 60;
11161 return bgp_damp_enable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
),
11162 half
, reuse
, suppress
, max
);
11165 ALIAS (bgp_damp_set
,
11167 "bgp dampening <1-45>",
11168 "BGP Specific commands\n"
11169 "Enable route-flap dampening\n"
11170 "Half-life time for the penalty\n")
11172 ALIAS (bgp_damp_set
,
11175 "BGP Specific commands\n"
11176 "Enable route-flap dampening\n")
11178 DEFUN (bgp_damp_unset
,
11179 bgp_damp_unset_cmd
,
11180 "no bgp dampening",
11182 "BGP Specific commands\n"
11183 "Enable route-flap dampening\n")
11188 return bgp_damp_disable (bgp
, bgp_node_afi (vty
), bgp_node_safi (vty
));
11191 ALIAS (bgp_damp_unset
,
11192 bgp_damp_unset2_cmd
,
11193 "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>",
11195 "BGP Specific commands\n"
11196 "Enable route-flap dampening\n"
11197 "Half-life time for the penalty\n"
11198 "Value to start reusing a route\n"
11199 "Value to start suppressing a route\n"
11200 "Maximum duration to suppress a stable route\n")
11202 DEFUN (show_ip_bgp_dampened_paths
,
11203 show_ip_bgp_dampened_paths_cmd
,
11204 "show ip bgp dampened-paths",
11208 "Display paths suppressed due to dampening\n")
11210 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, bgp_show_type_dampend_paths
,
11214 DEFUN (show_ip_bgp_flap_statistics
,
11215 show_ip_bgp_flap_statistics_cmd
,
11216 "show ip bgp flap-statistics",
11220 "Display flap statistics of routes\n")
11222 return bgp_show (vty
, NULL
, AFI_IP
, SAFI_UNICAST
,
11223 bgp_show_type_flap_statistics
, NULL
);
11226 /* Display specified route of BGP table. */
11228 bgp_clear_damp_route (struct vty
*vty
, const char *view_name
,
11229 const char *ip_str
, afi_t afi
, safi_t safi
,
11230 struct prefix_rd
*prd
, int prefix_check
)
11233 struct prefix match
;
11234 struct bgp_node
*rn
;
11235 struct bgp_node
*rm
;
11236 struct bgp_info
*ri
;
11237 struct bgp_info
*ri_temp
;
11239 struct bgp_table
*table
;
11241 /* BGP structure lookup. */
11244 bgp
= bgp_lookup_by_name (view_name
);
11247 vty_out (vty
, "%% Can't find BGP view %s%s", view_name
, VTY_NEWLINE
);
11248 return CMD_WARNING
;
11253 bgp
= bgp_get_default ();
11256 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
11257 return CMD_WARNING
;
11261 /* Check IP address argument. */
11262 ret
= str2prefix (ip_str
, &match
);
11265 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
11266 return CMD_WARNING
;
11269 match
.family
= afi2family (afi
);
11271 if (safi
== SAFI_MPLS_VPN
)
11273 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= bgp_route_next (rn
))
11275 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
11278 if ((table
= rn
->info
) != NULL
)
11279 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
11280 if (! prefix_check
|| rm
->p
.prefixlen
== match
.prefixlen
)
11285 if (ri
->extra
&& ri
->extra
->damp_info
)
11287 ri_temp
= ri
->next
;
11288 bgp_damp_info_free (ri
->extra
->damp_info
, 1);
11299 if ((rn
= bgp_node_match (bgp
->rib
[afi
][safi
], &match
)) != NULL
)
11300 if (! prefix_check
|| rn
->p
.prefixlen
== match
.prefixlen
)
11305 if (ri
->extra
&& ri
->extra
->damp_info
)
11307 ri_temp
= ri
->next
;
11308 bgp_damp_info_free (ri
->extra
->damp_info
, 1);
11317 return CMD_SUCCESS
;
11320 DEFUN (clear_ip_bgp_dampening
,
11321 clear_ip_bgp_dampening_cmd
,
11322 "clear ip bgp dampening",
11326 "Clear route flap dampening information\n")
11328 bgp_damp_info_clean ();
11329 return CMD_SUCCESS
;
11332 DEFUN (clear_ip_bgp_dampening_prefix
,
11333 clear_ip_bgp_dampening_prefix_cmd
,
11334 "clear ip bgp dampening A.B.C.D/M",
11338 "Clear route flap dampening information\n"
11339 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
11341 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
11342 SAFI_UNICAST
, NULL
, 1);
11345 DEFUN (clear_ip_bgp_dampening_address
,
11346 clear_ip_bgp_dampening_address_cmd
,
11347 "clear ip bgp dampening A.B.C.D",
11351 "Clear route flap dampening information\n"
11352 "Network to clear damping information\n")
11354 return bgp_clear_damp_route (vty
, NULL
, argv
[0], AFI_IP
,
11355 SAFI_UNICAST
, NULL
, 0);
11358 DEFUN (clear_ip_bgp_dampening_address_mask
,
11359 clear_ip_bgp_dampening_address_mask_cmd
,
11360 "clear ip bgp dampening A.B.C.D A.B.C.D",
11364 "Clear route flap dampening information\n"
11365 "Network to clear damping information\n"
11369 char prefix_str
[BUFSIZ
];
11371 ret
= netmask_str2prefix_str (argv
[0], argv
[1], prefix_str
);
11374 vty_out (vty
, "%% Inconsistent address and mask%s", VTY_NEWLINE
);
11375 return CMD_WARNING
;
11378 return bgp_clear_damp_route (vty
, NULL
, prefix_str
, AFI_IP
,
11379 SAFI_UNICAST
, NULL
, 0);
11383 bgp_config_write_network_vpnv4 (struct vty
*vty
, struct bgp
*bgp
,
11384 afi_t afi
, safi_t safi
, int *write
)
11386 struct bgp_node
*prn
;
11387 struct bgp_node
*rn
;
11388 struct bgp_table
*table
;
11390 struct prefix_rd
*prd
;
11391 struct bgp_static
*bgp_static
;
11393 char buf
[SU_ADDRSTRLEN
];
11394 char rdbuf
[RD_ADDRSTRLEN
];
11396 /* Network configuration. */
11397 for (prn
= bgp_table_top (bgp
->route
[afi
][safi
]); prn
; prn
= bgp_route_next (prn
))
11398 if ((table
= prn
->info
) != NULL
)
11399 for (rn
= bgp_table_top (table
); rn
; rn
= bgp_route_next (rn
))
11400 if ((bgp_static
= rn
->info
) != NULL
)
11403 prd
= (struct prefix_rd
*) &prn
->p
;
11405 /* "address-family" display. */
11406 bgp_config_write_family_header (vty
, afi
, safi
, write
);
11408 /* "network" configuration display. */
11409 prefix_rd2str (prd
, rdbuf
, RD_ADDRSTRLEN
);
11410 label
= decode_label (bgp_static
->tag
);
11412 vty_out (vty
, " network %s/%d rd %s tag %d",
11413 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
11416 vty_out (vty
, "%s", VTY_NEWLINE
);
11421 /* Configuration of static route announcement and aggregate
11424 bgp_config_write_network (struct vty
*vty
, struct bgp
*bgp
,
11425 afi_t afi
, safi_t safi
, int *write
)
11427 struct bgp_node
*rn
;
11429 struct bgp_static
*bgp_static
;
11430 struct bgp_aggregate
*bgp_aggregate
;
11431 char buf
[SU_ADDRSTRLEN
];
11433 if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
11434 return bgp_config_write_network_vpnv4 (vty
, bgp
, afi
, safi
, write
);
11436 /* Network configuration. */
11437 for (rn
= bgp_table_top (bgp
->route
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
11438 if ((bgp_static
= rn
->info
) != NULL
)
11442 /* "address-family" display. */
11443 bgp_config_write_family_header (vty
, afi
, safi
, write
);
11445 /* "network" configuration display. */
11446 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
11448 u_int32_t destination
;
11449 struct in_addr netmask
;
11451 destination
= ntohl (p
->u
.prefix4
.s_addr
);
11452 masklen2ip (p
->prefixlen
, &netmask
);
11453 vty_out (vty
, " network %s",
11454 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
));
11456 if ((IN_CLASSC (destination
) && p
->prefixlen
== 24)
11457 || (IN_CLASSB (destination
) && p
->prefixlen
== 16)
11458 || (IN_CLASSA (destination
) && p
->prefixlen
== 8)
11459 || p
->u
.prefix4
.s_addr
== 0)
11461 /* Natural mask is not display. */
11464 vty_out (vty
, " mask %s", inet_ntoa (netmask
));
11468 vty_out (vty
, " network %s/%d",
11469 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
11473 if (bgp_static
->rmap
.name
)
11474 vty_out (vty
, " route-map %s", bgp_static
->rmap
.name
);
11477 if (bgp_static
->backdoor
)
11478 vty_out (vty
, " backdoor");
11479 if (bgp_static
->ttl
)
11480 vty_out (vty
, " pathlimit %u", bgp_static
->ttl
);
11483 vty_out (vty
, "%s", VTY_NEWLINE
);
11486 /* Aggregate-address configuration. */
11487 for (rn
= bgp_table_top (bgp
->aggregate
[afi
][safi
]); rn
; rn
= bgp_route_next (rn
))
11488 if ((bgp_aggregate
= rn
->info
) != NULL
)
11492 /* "address-family" display. */
11493 bgp_config_write_family_header (vty
, afi
, safi
, write
);
11495 if (bgp_option_check (BGP_OPT_CONFIG_CISCO
) && afi
== AFI_IP
)
11497 struct in_addr netmask
;
11499 masklen2ip (p
->prefixlen
, &netmask
);
11500 vty_out (vty
, " aggregate-address %s %s",
11501 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
11502 inet_ntoa (netmask
));
11506 vty_out (vty
, " aggregate-address %s/%d",
11507 inet_ntop (p
->family
, &p
->u
.prefix
, buf
, SU_ADDRSTRLEN
),
11511 if (bgp_aggregate
->as_set
)
11512 vty_out (vty
, " as-set");
11514 if (bgp_aggregate
->summary_only
)
11515 vty_out (vty
, " summary-only");
11517 vty_out (vty
, "%s", VTY_NEWLINE
);
11524 bgp_config_write_distance (struct vty
*vty
, struct bgp
*bgp
)
11526 struct bgp_node
*rn
;
11527 struct bgp_distance
*bdistance
;
11529 /* Distance configuration. */
11530 if (bgp
->distance_ebgp
11531 && bgp
->distance_ibgp
11532 && bgp
->distance_local
11533 && (bgp
->distance_ebgp
!= ZEBRA_EBGP_DISTANCE_DEFAULT
11534 || bgp
->distance_ibgp
!= ZEBRA_IBGP_DISTANCE_DEFAULT
11535 || bgp
->distance_local
!= ZEBRA_IBGP_DISTANCE_DEFAULT
))
11536 vty_out (vty
, " distance bgp %d %d %d%s",
11537 bgp
->distance_ebgp
, bgp
->distance_ibgp
, bgp
->distance_local
,
11540 for (rn
= bgp_table_top (bgp_distance_table
); rn
; rn
= bgp_route_next (rn
))
11541 if ((bdistance
= rn
->info
) != NULL
)
11543 vty_out (vty
, " distance %d %s/%d %s%s", bdistance
->distance
,
11544 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
11545 bdistance
->access_list
? bdistance
->access_list
: "",
11552 /* Allocate routing table structure and install commands. */
11554 bgp_route_init (void)
11556 /* Init BGP distance table. */
11557 bgp_distance_table
= bgp_table_init (AFI_IP
, SAFI_UNICAST
);
11559 /* IPv4 BGP commands. */
11560 install_element (BGP_NODE
, &bgp_network_cmd
);
11561 install_element (BGP_NODE
, &bgp_network_mask_cmd
);
11562 install_element (BGP_NODE
, &bgp_network_mask_natural_cmd
);
11563 install_element (BGP_NODE
, &bgp_network_route_map_cmd
);
11564 install_element (BGP_NODE
, &bgp_network_mask_route_map_cmd
);
11565 install_element (BGP_NODE
, &bgp_network_mask_natural_route_map_cmd
);
11566 install_element (BGP_NODE
, &bgp_network_backdoor_cmd
);
11567 install_element (BGP_NODE
, &bgp_network_mask_backdoor_cmd
);
11568 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_cmd
);
11569 install_element (BGP_NODE
, &bgp_network_ttl_cmd
);
11570 install_element (BGP_NODE
, &bgp_network_mask_ttl_cmd
);
11571 install_element (BGP_NODE
, &bgp_network_mask_natural_ttl_cmd
);
11572 install_element (BGP_NODE
, &bgp_network_backdoor_ttl_cmd
);
11573 install_element (BGP_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
11574 install_element (BGP_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
);
11575 install_element (BGP_NODE
, &no_bgp_network_cmd
);
11576 install_element (BGP_NODE
, &no_bgp_network_mask_cmd
);
11577 install_element (BGP_NODE
, &no_bgp_network_mask_natural_cmd
);
11578 install_element (BGP_NODE
, &no_bgp_network_route_map_cmd
);
11579 install_element (BGP_NODE
, &no_bgp_network_mask_route_map_cmd
);
11580 install_element (BGP_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
11581 install_element (BGP_NODE
, &no_bgp_network_backdoor_cmd
);
11582 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_cmd
);
11583 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_cmd
);
11584 install_element (BGP_NODE
, &no_bgp_network_ttl_cmd
);
11585 install_element (BGP_NODE
, &no_bgp_network_mask_ttl_cmd
);
11586 install_element (BGP_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
11587 install_element (BGP_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
11588 install_element (BGP_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
11589 install_element (BGP_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
);
11591 install_element (BGP_NODE
, &aggregate_address_cmd
);
11592 install_element (BGP_NODE
, &aggregate_address_mask_cmd
);
11593 install_element (BGP_NODE
, &aggregate_address_summary_only_cmd
);
11594 install_element (BGP_NODE
, &aggregate_address_mask_summary_only_cmd
);
11595 install_element (BGP_NODE
, &aggregate_address_as_set_cmd
);
11596 install_element (BGP_NODE
, &aggregate_address_mask_as_set_cmd
);
11597 install_element (BGP_NODE
, &aggregate_address_as_set_summary_cmd
);
11598 install_element (BGP_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
11599 install_element (BGP_NODE
, &aggregate_address_summary_as_set_cmd
);
11600 install_element (BGP_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
11601 install_element (BGP_NODE
, &no_aggregate_address_cmd
);
11602 install_element (BGP_NODE
, &no_aggregate_address_summary_only_cmd
);
11603 install_element (BGP_NODE
, &no_aggregate_address_as_set_cmd
);
11604 install_element (BGP_NODE
, &no_aggregate_address_as_set_summary_cmd
);
11605 install_element (BGP_NODE
, &no_aggregate_address_summary_as_set_cmd
);
11606 install_element (BGP_NODE
, &no_aggregate_address_mask_cmd
);
11607 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
11608 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_cmd
);
11609 install_element (BGP_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
11610 install_element (BGP_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
11612 /* IPv4 unicast configuration. */
11613 install_element (BGP_IPV4_NODE
, &bgp_network_cmd
);
11614 install_element (BGP_IPV4_NODE
, &bgp_network_mask_cmd
);
11615 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_cmd
);
11616 install_element (BGP_IPV4_NODE
, &bgp_network_route_map_cmd
);
11617 install_element (BGP_IPV4_NODE
, &bgp_network_mask_route_map_cmd
);
11618 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_route_map_cmd
);
11619 install_element (BGP_IPV4_NODE
, &bgp_network_ttl_cmd
);
11620 install_element (BGP_IPV4_NODE
, &bgp_network_mask_ttl_cmd
);
11621 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_ttl_cmd
);
11622 install_element (BGP_IPV4_NODE
, &bgp_network_backdoor_ttl_cmd
);
11623 install_element (BGP_IPV4_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
11624 install_element (BGP_IPV4_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
); install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
11625 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_cmd
);
11626 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_cmd
);
11627 install_element (BGP_IPV4_NODE
, &no_bgp_network_route_map_cmd
);
11628 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_route_map_cmd
);
11629 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
11630 install_element (BGP_IPV4_NODE
, &no_bgp_network_ttl_cmd
);
11631 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_ttl_cmd
);
11632 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
11633 install_element (BGP_IPV4_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
11634 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
11635 install_element (BGP_IPV4_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
); install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
11636 install_element (BGP_IPV4_NODE
, &aggregate_address_cmd
);
11637 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_cmd
);
11638 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_only_cmd
);
11639 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_only_cmd
);
11640 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_cmd
);
11641 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_cmd
);
11642 install_element (BGP_IPV4_NODE
, &aggregate_address_as_set_summary_cmd
);
11643 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
11644 install_element (BGP_IPV4_NODE
, &aggregate_address_summary_as_set_cmd
);
11645 install_element (BGP_IPV4_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
11646 install_element (BGP_IPV4_NODE
, &no_aggregate_address_cmd
);
11647 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_only_cmd
);
11648 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_cmd
);
11649 install_element (BGP_IPV4_NODE
, &no_aggregate_address_as_set_summary_cmd
);
11650 install_element (BGP_IPV4_NODE
, &no_aggregate_address_summary_as_set_cmd
);
11651 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_cmd
);
11652 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
11653 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_cmd
);
11654 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
11655 install_element (BGP_IPV4_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
11657 /* IPv4 multicast configuration. */
11658 install_element (BGP_IPV4M_NODE
, &bgp_network_cmd
);
11659 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_cmd
);
11660 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_cmd
);
11661 install_element (BGP_IPV4M_NODE
, &bgp_network_route_map_cmd
);
11662 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_route_map_cmd
);
11663 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_route_map_cmd
);
11664 install_element (BGP_IPV4M_NODE
, &bgp_network_ttl_cmd
);
11665 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_ttl_cmd
);
11666 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_ttl_cmd
);
11667 install_element (BGP_IPV4M_NODE
, &bgp_network_backdoor_ttl_cmd
);
11668 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_backdoor_ttl_cmd
);
11669 install_element (BGP_IPV4M_NODE
, &bgp_network_mask_natural_backdoor_ttl_cmd
); install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
11670 install_element (BGP_IPV4M_NODE
, &no_bgp_network_cmd
);
11671 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_cmd
);
11672 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_cmd
);
11673 install_element (BGP_IPV4M_NODE
, &no_bgp_network_route_map_cmd
);
11674 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_route_map_cmd
);
11675 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_route_map_cmd
);
11676 install_element (BGP_IPV4M_NODE
, &no_bgp_network_ttl_cmd
);
11677 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_ttl_cmd
);
11678 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_ttl_cmd
);
11679 install_element (BGP_IPV4M_NODE
, &no_bgp_network_backdoor_ttl_cmd
);
11680 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_backdoor_ttl_cmd
);
11681 install_element (BGP_IPV4M_NODE
, &no_bgp_network_mask_natural_backdoor_ttl_cmd
); install_element (BGP_IPV4_NODE
, &no_bgp_network_cmd
);
11682 install_element (BGP_IPV4M_NODE
, &aggregate_address_cmd
);
11683 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_cmd
);
11684 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_only_cmd
);
11685 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_only_cmd
);
11686 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_cmd
);
11687 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_cmd
);
11688 install_element (BGP_IPV4M_NODE
, &aggregate_address_as_set_summary_cmd
);
11689 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_as_set_summary_cmd
);
11690 install_element (BGP_IPV4M_NODE
, &aggregate_address_summary_as_set_cmd
);
11691 install_element (BGP_IPV4M_NODE
, &aggregate_address_mask_summary_as_set_cmd
);
11692 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_cmd
);
11693 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_only_cmd
);
11694 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_cmd
);
11695 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_as_set_summary_cmd
);
11696 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_summary_as_set_cmd
);
11697 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_cmd
);
11698 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_only_cmd
);
11699 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_cmd
);
11700 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_as_set_summary_cmd
);
11701 install_element (BGP_IPV4M_NODE
, &no_aggregate_address_mask_summary_as_set_cmd
);
11703 install_element (VIEW_NODE
, &show_ip_bgp_cmd
);
11704 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cmd
);
11705 install_element (VIEW_NODE
, &show_ip_bgp_route_cmd
);
11706 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_cmd
);
11707 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
11708 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
11709 install_element (VIEW_NODE
, &show_ip_bgp_prefix_cmd
);
11710 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
11711 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
11712 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
11713 install_element (VIEW_NODE
, &show_ip_bgp_view_cmd
);
11714 install_element (VIEW_NODE
, &show_ip_bgp_view_route_cmd
);
11715 install_element (VIEW_NODE
, &show_ip_bgp_view_prefix_cmd
);
11716 install_element (VIEW_NODE
, &show_ip_bgp_regexp_cmd
);
11717 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
11718 install_element (VIEW_NODE
, &show_ip_bgp_prefix_list_cmd
);
11719 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
11720 install_element (VIEW_NODE
, &show_ip_bgp_filter_list_cmd
);
11721 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
11722 install_element (VIEW_NODE
, &show_ip_bgp_route_map_cmd
);
11723 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
11724 install_element (VIEW_NODE
, &show_ip_bgp_cidr_only_cmd
);
11725 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
11726 install_element (VIEW_NODE
, &show_ip_bgp_community_all_cmd
);
11727 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
11728 install_element (VIEW_NODE
, &show_ip_bgp_community_cmd
);
11729 install_element (VIEW_NODE
, &show_ip_bgp_community2_cmd
);
11730 install_element (VIEW_NODE
, &show_ip_bgp_community3_cmd
);
11731 install_element (VIEW_NODE
, &show_ip_bgp_community4_cmd
);
11732 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_cmd
);
11733 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
11734 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
11735 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
11736 install_element (VIEW_NODE
, &show_ip_bgp_community_exact_cmd
);
11737 install_element (VIEW_NODE
, &show_ip_bgp_community2_exact_cmd
);
11738 install_element (VIEW_NODE
, &show_ip_bgp_community3_exact_cmd
);
11739 install_element (VIEW_NODE
, &show_ip_bgp_community4_exact_cmd
);
11740 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
11741 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
11742 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
11743 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
11744 install_element (VIEW_NODE
, &show_ip_bgp_community_list_cmd
);
11745 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
11746 install_element (VIEW_NODE
, &show_ip_bgp_community_list_exact_cmd
);
11747 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
11748 install_element (VIEW_NODE
, &show_ip_bgp_prefix_longer_cmd
);
11749 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
11750 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
11751 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
11752 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
11753 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
11754 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
11755 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
11756 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
11757 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
11758 install_element (VIEW_NODE
, &show_ip_bgp_dampened_paths_cmd
);
11759 install_element (VIEW_NODE
, &show_ip_bgp_flap_statistics_cmd
);
11760 install_element (VIEW_NODE
, &show_ip_bgp_flap_address_cmd
);
11761 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_cmd
);
11762 install_element (VIEW_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
11763 install_element (VIEW_NODE
, &show_ip_bgp_flap_regexp_cmd
);
11764 install_element (VIEW_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
11765 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
11766 install_element (VIEW_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
11767 install_element (VIEW_NODE
, &show_ip_bgp_flap_route_map_cmd
);
11768 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
11769 install_element (VIEW_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
11770 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_cmd
);
11771 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_route_cmd
);
11772 install_element (VIEW_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
11773 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_cmd
);
11774 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
11775 install_element (VIEW_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
11777 /* Restricted node: VIEW_NODE - (set of dangerous commands) */
11778 install_element (RESTRICTED_NODE
, &show_ip_bgp_route_cmd
);
11779 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_route_cmd
);
11780 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
11781 install_element (RESTRICTED_NODE
, &show_ip_bgp_prefix_cmd
);
11782 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
11783 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
11784 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
11785 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_route_cmd
);
11786 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_prefix_cmd
);
11787 install_element (RESTRICTED_NODE
, &show_ip_bgp_community_cmd
);
11788 install_element (RESTRICTED_NODE
, &show_ip_bgp_community2_cmd
);
11789 install_element (RESTRICTED_NODE
, &show_ip_bgp_community3_cmd
);
11790 install_element (RESTRICTED_NODE
, &show_ip_bgp_community4_cmd
);
11791 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community_cmd
);
11792 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
11793 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
11794 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
11795 install_element (RESTRICTED_NODE
, &show_ip_bgp_community_exact_cmd
);
11796 install_element (RESTRICTED_NODE
, &show_ip_bgp_community2_exact_cmd
);
11797 install_element (RESTRICTED_NODE
, &show_ip_bgp_community3_exact_cmd
);
11798 install_element (RESTRICTED_NODE
, &show_ip_bgp_community4_exact_cmd
);
11799 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
11800 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
11801 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
11802 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
11803 install_element (RESTRICTED_NODE
, &show_ip_bgp_rsclient_route_cmd
);
11804 install_element (RESTRICTED_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
11805 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
11806 install_element (RESTRICTED_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
11808 install_element (ENABLE_NODE
, &show_ip_bgp_cmd
);
11809 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cmd
);
11810 install_element (ENABLE_NODE
, &show_ip_bgp_route_cmd
);
11811 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_cmd
);
11812 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
11813 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
11814 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_cmd
);
11815 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_cmd
);
11816 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
11817 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
11818 install_element (ENABLE_NODE
, &show_ip_bgp_view_cmd
);
11819 install_element (ENABLE_NODE
, &show_ip_bgp_view_route_cmd
);
11820 install_element (ENABLE_NODE
, &show_ip_bgp_view_prefix_cmd
);
11821 install_element (ENABLE_NODE
, &show_ip_bgp_regexp_cmd
);
11822 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_regexp_cmd
);
11823 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_list_cmd
);
11824 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_list_cmd
);
11825 install_element (ENABLE_NODE
, &show_ip_bgp_filter_list_cmd
);
11826 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_filter_list_cmd
);
11827 install_element (ENABLE_NODE
, &show_ip_bgp_route_map_cmd
);
11828 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_route_map_cmd
);
11829 install_element (ENABLE_NODE
, &show_ip_bgp_cidr_only_cmd
);
11830 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_cidr_only_cmd
);
11831 install_element (ENABLE_NODE
, &show_ip_bgp_community_all_cmd
);
11832 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_all_cmd
);
11833 install_element (ENABLE_NODE
, &show_ip_bgp_community_cmd
);
11834 install_element (ENABLE_NODE
, &show_ip_bgp_community2_cmd
);
11835 install_element (ENABLE_NODE
, &show_ip_bgp_community3_cmd
);
11836 install_element (ENABLE_NODE
, &show_ip_bgp_community4_cmd
);
11837 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_cmd
);
11838 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_cmd
);
11839 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_cmd
);
11840 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_cmd
);
11841 install_element (ENABLE_NODE
, &show_ip_bgp_community_exact_cmd
);
11842 install_element (ENABLE_NODE
, &show_ip_bgp_community2_exact_cmd
);
11843 install_element (ENABLE_NODE
, &show_ip_bgp_community3_exact_cmd
);
11844 install_element (ENABLE_NODE
, &show_ip_bgp_community4_exact_cmd
);
11845 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_exact_cmd
);
11846 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community2_exact_cmd
);
11847 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community3_exact_cmd
);
11848 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community4_exact_cmd
);
11849 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_cmd
);
11850 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_cmd
);
11851 install_element (ENABLE_NODE
, &show_ip_bgp_community_list_exact_cmd
);
11852 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_community_list_exact_cmd
);
11853 install_element (ENABLE_NODE
, &show_ip_bgp_prefix_longer_cmd
);
11854 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_prefix_longer_cmd
);
11855 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_advertised_route_cmd
);
11856 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd
);
11857 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_routes_cmd
);
11858 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_routes_cmd
);
11859 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_routes_cmd
);
11860 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_routes_cmd
);
11861 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_received_prefix_filter_cmd
);
11862 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd
);
11863 install_element (ENABLE_NODE
, &show_ip_bgp_dampened_paths_cmd
);
11864 install_element (ENABLE_NODE
, &show_ip_bgp_flap_statistics_cmd
);
11865 install_element (ENABLE_NODE
, &show_ip_bgp_flap_address_cmd
);
11866 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_cmd
);
11867 install_element (ENABLE_NODE
, &show_ip_bgp_flap_cidr_only_cmd
);
11868 install_element (ENABLE_NODE
, &show_ip_bgp_flap_regexp_cmd
);
11869 install_element (ENABLE_NODE
, &show_ip_bgp_flap_filter_list_cmd
);
11870 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_list_cmd
);
11871 install_element (ENABLE_NODE
, &show_ip_bgp_flap_prefix_longer_cmd
);
11872 install_element (ENABLE_NODE
, &show_ip_bgp_flap_route_map_cmd
);
11873 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_flap_cmd
);
11874 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_damp_cmd
);
11875 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_cmd
);
11876 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_route_cmd
);
11877 install_element (ENABLE_NODE
, &show_ip_bgp_rsclient_prefix_cmd
);
11878 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_cmd
);
11879 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_route_cmd
);
11880 install_element (ENABLE_NODE
, &show_ip_bgp_view_rsclient_prefix_cmd
);
11882 /* BGP dampening clear commands */
11883 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_cmd
);
11884 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_prefix_cmd
);
11885 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_cmd
);
11886 install_element (ENABLE_NODE
, &clear_ip_bgp_dampening_address_mask_cmd
);
11889 install_element (ENABLE_NODE
, &show_ip_bgp_neighbor_prefix_counts_cmd
);
11890 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbor_prefix_counts_cmd
);
11891 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd
);
11893 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_prefix_counts_cmd
);
11895 /* New config IPv6 BGP commands. */
11896 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_cmd
);
11897 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_route_map_cmd
);
11898 install_element (BGP_IPV6_NODE
, &ipv6_bgp_network_ttl_cmd
);
11899 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_cmd
);
11900 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_route_map_cmd
);
11901 install_element (BGP_IPV6_NODE
, &no_ipv6_bgp_network_ttl_cmd
);
11903 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_cmd
);
11904 install_element (BGP_IPV6_NODE
, &ipv6_aggregate_address_summary_only_cmd
);
11905 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_cmd
);
11906 install_element (BGP_IPV6_NODE
, &no_ipv6_aggregate_address_summary_only_cmd
);
11908 /* Old config IPv6 BGP commands. */
11909 install_element (BGP_NODE
, &old_ipv6_bgp_network_cmd
);
11910 install_element (BGP_NODE
, &old_no_ipv6_bgp_network_cmd
);
11912 install_element (BGP_NODE
, &old_ipv6_aggregate_address_cmd
);
11913 install_element (BGP_NODE
, &old_ipv6_aggregate_address_summary_only_cmd
);
11914 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_cmd
);
11915 install_element (BGP_NODE
, &old_no_ipv6_aggregate_address_summary_only_cmd
);
11917 install_element (VIEW_NODE
, &show_bgp_cmd
);
11918 install_element (VIEW_NODE
, &show_bgp_ipv6_cmd
);
11919 install_element (VIEW_NODE
, &show_bgp_route_cmd
);
11920 install_element (VIEW_NODE
, &show_bgp_ipv6_route_cmd
);
11921 install_element (VIEW_NODE
, &show_bgp_prefix_cmd
);
11922 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_cmd
);
11923 install_element (VIEW_NODE
, &show_bgp_regexp_cmd
);
11924 install_element (VIEW_NODE
, &show_bgp_ipv6_regexp_cmd
);
11925 install_element (VIEW_NODE
, &show_bgp_prefix_list_cmd
);
11926 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
11927 install_element (VIEW_NODE
, &show_bgp_filter_list_cmd
);
11928 install_element (VIEW_NODE
, &show_bgp_ipv6_filter_list_cmd
);
11929 install_element (VIEW_NODE
, &show_bgp_route_map_cmd
);
11930 install_element (VIEW_NODE
, &show_bgp_ipv6_route_map_cmd
);
11931 install_element (VIEW_NODE
, &show_bgp_community_all_cmd
);
11932 install_element (VIEW_NODE
, &show_bgp_ipv6_community_all_cmd
);
11933 install_element (VIEW_NODE
, &show_bgp_community_cmd
);
11934 install_element (VIEW_NODE
, &show_bgp_ipv6_community_cmd
);
11935 install_element (VIEW_NODE
, &show_bgp_community2_cmd
);
11936 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_cmd
);
11937 install_element (VIEW_NODE
, &show_bgp_community3_cmd
);
11938 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_cmd
);
11939 install_element (VIEW_NODE
, &show_bgp_community4_cmd
);
11940 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_cmd
);
11941 install_element (VIEW_NODE
, &show_bgp_community_exact_cmd
);
11942 install_element (VIEW_NODE
, &show_bgp_ipv6_community_exact_cmd
);
11943 install_element (VIEW_NODE
, &show_bgp_community2_exact_cmd
);
11944 install_element (VIEW_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
11945 install_element (VIEW_NODE
, &show_bgp_community3_exact_cmd
);
11946 install_element (VIEW_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
11947 install_element (VIEW_NODE
, &show_bgp_community4_exact_cmd
);
11948 install_element (VIEW_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
11949 install_element (VIEW_NODE
, &show_bgp_community_list_cmd
);
11950 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_cmd
);
11951 install_element (VIEW_NODE
, &show_bgp_community_list_exact_cmd
);
11952 install_element (VIEW_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
11953 install_element (VIEW_NODE
, &show_bgp_prefix_longer_cmd
);
11954 install_element (VIEW_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
11955 install_element (VIEW_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
11956 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
11957 install_element (VIEW_NODE
, &show_bgp_neighbor_received_routes_cmd
);
11958 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
11959 install_element (VIEW_NODE
, &show_bgp_neighbor_routes_cmd
);
11960 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
11961 install_element (VIEW_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
11962 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
11963 install_element (VIEW_NODE
, &show_bgp_neighbor_flap_cmd
);
11964 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
11965 install_element (VIEW_NODE
, &show_bgp_neighbor_damp_cmd
);
11966 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
11967 install_element (VIEW_NODE
, &show_bgp_rsclient_cmd
);
11968 install_element (VIEW_NODE
, &show_bgp_rsclient_route_cmd
);
11969 install_element (VIEW_NODE
, &show_bgp_rsclient_prefix_cmd
);
11970 install_element (VIEW_NODE
, &show_bgp_view_cmd
);
11971 install_element (VIEW_NODE
, &show_bgp_view_ipv6_cmd
);
11972 install_element (VIEW_NODE
, &show_bgp_view_route_cmd
);
11973 install_element (VIEW_NODE
, &show_bgp_view_ipv6_route_cmd
);
11974 install_element (VIEW_NODE
, &show_bgp_view_prefix_cmd
);
11975 install_element (VIEW_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
11976 install_element (VIEW_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
11977 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
11978 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
11979 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
11980 install_element (VIEW_NODE
, &show_bgp_view_neighbor_routes_cmd
);
11981 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
11982 install_element (VIEW_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
11983 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
11984 install_element (VIEW_NODE
, &show_bgp_view_neighbor_flap_cmd
);
11985 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
11986 install_element (VIEW_NODE
, &show_bgp_view_neighbor_damp_cmd
);
11987 install_element (VIEW_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
11988 install_element (VIEW_NODE
, &show_bgp_view_rsclient_cmd
);
11989 install_element (VIEW_NODE
, &show_bgp_view_rsclient_route_cmd
);
11990 install_element (VIEW_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
11993 * VIEW_NODE - (set of dangerous commands) - (commands dependent on prev)
11995 install_element (RESTRICTED_NODE
, &show_bgp_route_cmd
);
11996 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_route_cmd
);
11997 install_element (RESTRICTED_NODE
, &show_bgp_prefix_cmd
);
11998 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_prefix_cmd
);
11999 install_element (RESTRICTED_NODE
, &show_bgp_community_cmd
);
12000 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community_cmd
);
12001 install_element (RESTRICTED_NODE
, &show_bgp_community2_cmd
);
12002 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community2_cmd
);
12003 install_element (RESTRICTED_NODE
, &show_bgp_community3_cmd
);
12004 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community3_cmd
);
12005 install_element (RESTRICTED_NODE
, &show_bgp_community4_cmd
);
12006 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community4_cmd
);
12007 install_element (RESTRICTED_NODE
, &show_bgp_community_exact_cmd
);
12008 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community_exact_cmd
);
12009 install_element (RESTRICTED_NODE
, &show_bgp_community2_exact_cmd
);
12010 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
12011 install_element (RESTRICTED_NODE
, &show_bgp_community3_exact_cmd
);
12012 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
12013 install_element (RESTRICTED_NODE
, &show_bgp_community4_exact_cmd
);
12014 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
12015 install_element (RESTRICTED_NODE
, &show_bgp_rsclient_route_cmd
);
12016 install_element (RESTRICTED_NODE
, &show_bgp_rsclient_prefix_cmd
);
12017 install_element (RESTRICTED_NODE
, &show_bgp_view_route_cmd
);
12018 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_route_cmd
);
12019 install_element (RESTRICTED_NODE
, &show_bgp_view_prefix_cmd
);
12020 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
12021 install_element (RESTRICTED_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
12022 install_element (RESTRICTED_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
12023 install_element (RESTRICTED_NODE
, &show_bgp_view_rsclient_route_cmd
);
12024 install_element (RESTRICTED_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
12026 install_element (ENABLE_NODE
, &show_bgp_cmd
);
12027 install_element (ENABLE_NODE
, &show_bgp_ipv6_cmd
);
12028 install_element (ENABLE_NODE
, &show_bgp_route_cmd
);
12029 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_cmd
);
12030 install_element (ENABLE_NODE
, &show_bgp_prefix_cmd
);
12031 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_cmd
);
12032 install_element (ENABLE_NODE
, &show_bgp_regexp_cmd
);
12033 install_element (ENABLE_NODE
, &show_bgp_ipv6_regexp_cmd
);
12034 install_element (ENABLE_NODE
, &show_bgp_prefix_list_cmd
);
12035 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_list_cmd
);
12036 install_element (ENABLE_NODE
, &show_bgp_filter_list_cmd
);
12037 install_element (ENABLE_NODE
, &show_bgp_ipv6_filter_list_cmd
);
12038 install_element (ENABLE_NODE
, &show_bgp_route_map_cmd
);
12039 install_element (ENABLE_NODE
, &show_bgp_ipv6_route_map_cmd
);
12040 install_element (ENABLE_NODE
, &show_bgp_community_all_cmd
);
12041 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_all_cmd
);
12042 install_element (ENABLE_NODE
, &show_bgp_community_cmd
);
12043 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_cmd
);
12044 install_element (ENABLE_NODE
, &show_bgp_community2_cmd
);
12045 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_cmd
);
12046 install_element (ENABLE_NODE
, &show_bgp_community3_cmd
);
12047 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_cmd
);
12048 install_element (ENABLE_NODE
, &show_bgp_community4_cmd
);
12049 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_cmd
);
12050 install_element (ENABLE_NODE
, &show_bgp_community_exact_cmd
);
12051 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_exact_cmd
);
12052 install_element (ENABLE_NODE
, &show_bgp_community2_exact_cmd
);
12053 install_element (ENABLE_NODE
, &show_bgp_ipv6_community2_exact_cmd
);
12054 install_element (ENABLE_NODE
, &show_bgp_community3_exact_cmd
);
12055 install_element (ENABLE_NODE
, &show_bgp_ipv6_community3_exact_cmd
);
12056 install_element (ENABLE_NODE
, &show_bgp_community4_exact_cmd
);
12057 install_element (ENABLE_NODE
, &show_bgp_ipv6_community4_exact_cmd
);
12058 install_element (ENABLE_NODE
, &show_bgp_community_list_cmd
);
12059 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_cmd
);
12060 install_element (ENABLE_NODE
, &show_bgp_community_list_exact_cmd
);
12061 install_element (ENABLE_NODE
, &show_bgp_ipv6_community_list_exact_cmd
);
12062 install_element (ENABLE_NODE
, &show_bgp_prefix_longer_cmd
);
12063 install_element (ENABLE_NODE
, &show_bgp_ipv6_prefix_longer_cmd
);
12064 install_element (ENABLE_NODE
, &show_bgp_neighbor_advertised_route_cmd
);
12065 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_advertised_route_cmd
);
12066 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_routes_cmd
);
12067 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_routes_cmd
);
12068 install_element (ENABLE_NODE
, &show_bgp_neighbor_routes_cmd
);
12069 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_routes_cmd
);
12070 install_element (ENABLE_NODE
, &show_bgp_neighbor_received_prefix_filter_cmd
);
12071 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd
);
12072 install_element (ENABLE_NODE
, &show_bgp_neighbor_flap_cmd
);
12073 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_flap_cmd
);
12074 install_element (ENABLE_NODE
, &show_bgp_neighbor_damp_cmd
);
12075 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbor_damp_cmd
);
12076 install_element (ENABLE_NODE
, &show_bgp_rsclient_cmd
);
12077 install_element (ENABLE_NODE
, &show_bgp_rsclient_route_cmd
);
12078 install_element (ENABLE_NODE
, &show_bgp_rsclient_prefix_cmd
);
12079 install_element (ENABLE_NODE
, &show_bgp_view_cmd
);
12080 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_cmd
);
12081 install_element (ENABLE_NODE
, &show_bgp_view_route_cmd
);
12082 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_route_cmd
);
12083 install_element (ENABLE_NODE
, &show_bgp_view_prefix_cmd
);
12084 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_prefix_cmd
);
12085 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_advertised_route_cmd
);
12086 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_advertised_route_cmd
);
12087 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_routes_cmd
);
12088 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_routes_cmd
);
12089 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_routes_cmd
);
12090 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_routes_cmd
);
12091 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_received_prefix_filter_cmd
);
12092 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_received_prefix_filter_cmd
);
12093 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_flap_cmd
);
12094 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_flap_cmd
);
12095 install_element (ENABLE_NODE
, &show_bgp_view_neighbor_damp_cmd
);
12096 install_element (ENABLE_NODE
, &show_bgp_view_ipv6_neighbor_damp_cmd
);
12097 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_cmd
);
12098 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_route_cmd
);
12099 install_element (ENABLE_NODE
, &show_bgp_view_rsclient_prefix_cmd
);
12102 install_element (ENABLE_NODE
, &show_bgp_statistics_cmd
);
12103 install_element (ENABLE_NODE
, &show_bgp_statistics_vpnv4_cmd
);
12104 install_element (ENABLE_NODE
, &show_bgp_statistics_view_cmd
);
12105 install_element (ENABLE_NODE
, &show_bgp_statistics_view_vpnv4_cmd
);
12108 install_element (VIEW_NODE
, &show_ipv6_bgp_cmd
);
12109 install_element (VIEW_NODE
, &show_ipv6_bgp_route_cmd
);
12110 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_cmd
);
12111 install_element (VIEW_NODE
, &show_ipv6_bgp_regexp_cmd
);
12112 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
12113 install_element (VIEW_NODE
, &show_ipv6_bgp_filter_list_cmd
);
12114 install_element (VIEW_NODE
, &show_ipv6_bgp_community_all_cmd
);
12115 install_element (VIEW_NODE
, &show_ipv6_bgp_community_cmd
);
12116 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_cmd
);
12117 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_cmd
);
12118 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_cmd
);
12119 install_element (VIEW_NODE
, &show_ipv6_bgp_community_exact_cmd
);
12120 install_element (VIEW_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
12121 install_element (VIEW_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
12122 install_element (VIEW_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
12123 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_cmd
);
12124 install_element (VIEW_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
12125 install_element (VIEW_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
12126 install_element (VIEW_NODE
, &show_ipv6_mbgp_cmd
);
12127 install_element (VIEW_NODE
, &show_ipv6_mbgp_route_cmd
);
12128 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_cmd
);
12129 install_element (VIEW_NODE
, &show_ipv6_mbgp_regexp_cmd
);
12130 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
12131 install_element (VIEW_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
12132 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_all_cmd
);
12133 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_cmd
);
12134 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_cmd
);
12135 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_cmd
);
12136 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_cmd
);
12137 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
12138 install_element (VIEW_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
12139 install_element (VIEW_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
12140 install_element (VIEW_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
12141 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_cmd
);
12142 install_element (VIEW_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
12143 install_element (VIEW_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
12146 install_element (ENABLE_NODE
, &show_ipv6_bgp_cmd
);
12147 install_element (ENABLE_NODE
, &show_ipv6_bgp_route_cmd
);
12148 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_cmd
);
12149 install_element (ENABLE_NODE
, &show_ipv6_bgp_regexp_cmd
);
12150 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_list_cmd
);
12151 install_element (ENABLE_NODE
, &show_ipv6_bgp_filter_list_cmd
);
12152 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_all_cmd
);
12153 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_cmd
);
12154 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_cmd
);
12155 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_cmd
);
12156 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_cmd
);
12157 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_exact_cmd
);
12158 install_element (ENABLE_NODE
, &show_ipv6_bgp_community2_exact_cmd
);
12159 install_element (ENABLE_NODE
, &show_ipv6_bgp_community3_exact_cmd
);
12160 install_element (ENABLE_NODE
, &show_ipv6_bgp_community4_exact_cmd
);
12161 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_cmd
);
12162 install_element (ENABLE_NODE
, &show_ipv6_bgp_community_list_exact_cmd
);
12163 install_element (ENABLE_NODE
, &show_ipv6_bgp_prefix_longer_cmd
);
12164 install_element (ENABLE_NODE
, &show_ipv6_mbgp_cmd
);
12165 install_element (ENABLE_NODE
, &show_ipv6_mbgp_route_cmd
);
12166 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_cmd
);
12167 install_element (ENABLE_NODE
, &show_ipv6_mbgp_regexp_cmd
);
12168 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_list_cmd
);
12169 install_element (ENABLE_NODE
, &show_ipv6_mbgp_filter_list_cmd
);
12170 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_all_cmd
);
12171 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_cmd
);
12172 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_cmd
);
12173 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_cmd
);
12174 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_cmd
);
12175 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_exact_cmd
);
12176 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community2_exact_cmd
);
12177 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community3_exact_cmd
);
12178 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community4_exact_cmd
);
12179 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_cmd
);
12180 install_element (ENABLE_NODE
, &show_ipv6_mbgp_community_list_exact_cmd
);
12181 install_element (ENABLE_NODE
, &show_ipv6_mbgp_prefix_longer_cmd
);
12184 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
12185 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_advertised_route_cmd
);
12186 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
12187 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_advertised_route_cmd
);
12190 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
12191 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_received_routes_cmd
);
12192 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
12193 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_received_routes_cmd
);
12196 install_element (VIEW_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
12197 install_element (ENABLE_NODE
, &ipv6_bgp_neighbor_routes_cmd
);
12198 install_element (VIEW_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
12199 install_element (ENABLE_NODE
, &ipv6_mbgp_neighbor_routes_cmd
);
12200 #endif /* HAVE_IPV6 */
12202 install_element (BGP_NODE
, &bgp_distance_cmd
);
12203 install_element (BGP_NODE
, &no_bgp_distance_cmd
);
12204 install_element (BGP_NODE
, &no_bgp_distance2_cmd
);
12205 install_element (BGP_NODE
, &bgp_distance_source_cmd
);
12206 install_element (BGP_NODE
, &no_bgp_distance_source_cmd
);
12207 install_element (BGP_NODE
, &bgp_distance_source_access_list_cmd
);
12208 install_element (BGP_NODE
, &no_bgp_distance_source_access_list_cmd
);
12210 install_element (BGP_NODE
, &bgp_damp_set_cmd
);
12211 install_element (BGP_NODE
, &bgp_damp_set2_cmd
);
12212 install_element (BGP_NODE
, &bgp_damp_set3_cmd
);
12213 install_element (BGP_NODE
, &bgp_damp_unset_cmd
);
12214 install_element (BGP_NODE
, &bgp_damp_unset2_cmd
);
12215 install_element (BGP_IPV4_NODE
, &bgp_damp_set_cmd
);
12216 install_element (BGP_IPV4_NODE
, &bgp_damp_set2_cmd
);
12217 install_element (BGP_IPV4_NODE
, &bgp_damp_set3_cmd
);
12218 install_element (BGP_IPV4_NODE
, &bgp_damp_unset_cmd
);
12219 install_element (BGP_IPV4_NODE
, &bgp_damp_unset2_cmd
);