3 * This file created by LabN Consulting, L.L.C.
6 * This file is based on bgp_mplsvpn.c which is Copyright (C) 2000
7 * Kunihiro Ishiguro <kunihiro@zebra.org>
13 This file is part of GNU Zebra.
15 GNU Zebra is free software; you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by the
17 Free Software Foundation; either version 2, or (at your option) any
20 GNU Zebra is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 General Public License for more details.
25 You should have received a copy of the GNU General Public License
26 along with GNU Zebra; see the file COPYING. If not, write to the Free
27 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
39 #include "bgpd/bgpd.h"
40 #include "bgpd/bgp_table.h"
41 #include "bgpd/bgp_route.h"
42 #include "bgpd/bgp_attr.h"
43 #include "bgpd/bgp_ecommunity.h"
44 #include "bgpd/bgp_mplsvpn.h"
45 #include "bgpd/bgp_vty.h"
46 #include "bgpd/bgp_encap.h"
49 decode_rd_type (u_char
*pnt
)
53 v
= ((u_int16_t
) *pnt
++ << 8);
54 v
|= (u_int16_t
) *pnt
;
60 decode_rd_as (u_char
*pnt
, struct rd_as
*rd_as
)
62 rd_as
->as
= (u_int16_t
) *pnt
++ << 8;
63 rd_as
->as
|= (u_int16_t
) *pnt
++;
65 rd_as
->val
= ((u_int32_t
) *pnt
++) << 24;
66 rd_as
->val
|= ((u_int32_t
) *pnt
++) << 16;
67 rd_as
->val
|= ((u_int32_t
) *pnt
++) << 8;
68 rd_as
->val
|= (u_int32_t
) *pnt
;
72 decode_rd_as4 (u_char
*pnt
, struct rd_as
*rd_as
)
74 rd_as
->as
= (u_int32_t
) *pnt
++ << 24;
75 rd_as
->as
|= (u_int32_t
) *pnt
++ << 16;
76 rd_as
->as
|= (u_int32_t
) *pnt
++ << 8;
77 rd_as
->as
|= (u_int32_t
) *pnt
++;
79 rd_as
->val
= ((u_int32_t
) *pnt
++ << 8);
80 rd_as
->val
|= (u_int32_t
) *pnt
;
84 decode_rd_ip (u_char
*pnt
, struct rd_ip
*rd_ip
)
86 memcpy (&rd_ip
->ip
, pnt
, 4);
89 rd_ip
->val
= ((u_int16_t
) *pnt
++ << 8);
90 rd_ip
->val
|= (u_int16_t
) *pnt
;
94 ecom2prd(struct ecommunity
*ecom
, struct prefix_rd
*prd
)
98 memset(prd
, 0, sizeof(struct prefix_rd
));
99 prd
->family
= AF_UNSPEC
;
105 for (i
= 0; i
< (ecom
->size
* ECOMMUNITY_SIZE
); i
+= ECOMMUNITY_SIZE
) {
119 prd
->val
[1] = ep
[0] & 0x03;
120 memcpy(prd
->val
+ 2, ep
+ 2, 6);
128 bgp_nlri_parse_encap(
131 struct attr
*attr
, /* Need even for withdraw */
132 struct bgp_nlri
*packet
,
133 int withdraw
) /* 0=update, !0 = withdraw */
142 struct prefix_rd prd
;
143 struct ecommunity
*pEcom
= NULL
;
144 u_int16_t rdtype
= 0xffff;
147 /* Check peer status. */
148 if (peer
->status
!= Established
)
152 if (attr
&& attr
->extra
&& attr
->extra
->ecommunity
)
153 pEcom
= attr
->extra
->ecommunity
;
155 ecom2prd(pEcom
, &prd
);
156 memset(&rd_as
, 0, sizeof(rd_as
));
157 memset(&rd_ip
, 0, sizeof(rd_ip
));
161 rdtype
= (prd
.val
[0] << 8) | prd
.val
[1];
163 /* Decode RD value. */
164 if (rdtype
== RD_TYPE_AS
)
165 decode_rd_as (prd
.val
+ 2, &rd_as
);
166 else if (rdtype
== RD_TYPE_IP
)
167 decode_rd_ip (prd
.val
+ 2, &rd_ip
);
168 else if (rdtype
== RD_TYPE_AS4
)
169 decode_rd_as4 (prd
.val
+ 2, &rd_as
);
172 zlog_err ("Invalid RD type %d", rdtype
);
178 * NB: this code was based on the MPLS VPN code, which supported RDs.
179 * For the moment we are retaining the underlying RIB structure that
180 * keeps a per-RD radix tree, but since the RDs are not carried over
181 * the wire, we set the RD internally to 0.
183 prd
.family
= AF_UNSPEC
;
185 memset(prd
.val
, 0, sizeof(prd
.val
));
188 lim
= pnt
+ packet
->length
;
190 for (; pnt
< lim
; pnt
+= psize
)
192 /* Clear prefix structure. */
193 memset (&p
, 0, sizeof (struct prefix
));
195 /* Fetch prefix length. */
197 p
.family
= afi2family(afi
);
199 /* bad afi, shouldn't happen */
200 zlog_warn("%s: bad afi %d, dropping incoming route", __func__
, afi
);
203 psize
= PSIZE (prefixlen
);
205 p
.prefixlen
= prefixlen
;
206 memcpy (&p
.u
.prefix
, pnt
, psize
);
208 if (pnt
+ psize
> lim
)
212 if (rdtype
== RD_TYPE_AS
)
213 zlog_info ("rd-as %u:%u prefix %s/%d", rd_as
.as
, rd_as
.val
,
214 inet_ntop (p
.family
, &p
.u
.prefix
, buf
, BUFSIZ
),
216 else if (rdtype
== RD_TYPE_IP
)
217 zlog_info ("rd-ip %s:%u prefix %s/%d", inet_ntoa (rd_ip
.ip
),
219 inet_ntop (p
.family
, &p
.u
.prefix
, buf
, BUFSIZ
),
221 else if (rdtype
== RD_TYPE_AS4
)
222 zlog_info ("rd-as4 %u:%u prefix %s/%d", rd_as
.as
, rd_as
.val
,
223 inet_ntop (p
.family
, &p
.u
.prefix
, buf
, BUFSIZ
),
226 zlog_info ("rd unknown, default to 0:0 prefix %s/%d",
227 inet_ntop (p
.family
, &p
.u
.prefix
, buf
, BUFSIZ
),
231 bgp_update (peer
, &p
, 0, attr
, afi
, SAFI_ENCAP
,
232 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, &prd
, NULL
, 0);
234 bgp_withdraw (peer
, &p
, 0, attr
, afi
, SAFI_ENCAP
,
235 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, &prd
, NULL
);
239 /* Packet length consistency check. */
247 /* TBD: these routes should probably all be host routes */
249 /* For testing purpose, static route of ENCAP. */
250 DEFUN (encap_network
,
252 "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD",
253 "Specify a network to announce via BGP\n"
254 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
255 "Specify Route Distinguisher\n"
256 "ENCAP Route Distinguisher\n"
260 return bgp_static_set_safi (SAFI_ENCAP
, vty
, argv
[0], argv
[1], argv
[2], NULL
);
263 /* For testing purpose, static route of ENCAP. */
264 DEFUN (no_encap_network
,
265 no_encap_network_cmd
,
266 "no network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD",
268 "Specify a network to announce via BGP\n"
269 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
270 "Specify Route Distinguisher\n"
271 "ENCAP Route Distinguisher\n"
275 return bgp_static_unset_safi (SAFI_ENCAP
, vty
, argv
[0], argv
[1], argv
[2]);
279 show_adj_route_encap (struct vty
*vty
, struct peer
*peer
, struct prefix_rd
*prd
)
282 struct bgp_table
*table
;
288 char v4_header
[] = " Network Next Hop Metric LocPrf Weight Path%s";
290 bgp
= bgp_get_default ();
293 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
297 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_ENCAP
]); rn
;
298 rn
= bgp_route_next (rn
))
300 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
303 if ((table
= rn
->info
) != NULL
)
307 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
308 if ((attr
= rm
->info
) != NULL
)
312 vty_out (vty
, "BGP table version is 0, local router ID is %s%s",
313 inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
314 vty_out (vty
, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s",
316 vty_out (vty
, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s",
317 VTY_NEWLINE
, VTY_NEWLINE
);
318 vty_out (vty
, v4_header
, VTY_NEWLINE
);
331 vty_out (vty
, "Route Distinguisher: ");
333 /* Decode RD type. */
334 type
= decode_rd_type (pnt
);
339 decode_rd_as (pnt
+ 2, &rd_as
);
340 vty_out (vty
, "%u:%d", rd_as
.as
, rd_as
.val
);
344 decode_rd_ip (pnt
+ 2, &rd_ip
);
345 vty_out (vty
, "%s:%d", inet_ntoa (rd_ip
.ip
), rd_ip
.val
);
349 vty_out (vty
, "unknown RD type");
353 vty_out (vty
, "%s", VTY_NEWLINE
);
356 route_vty_out_tmp (vty
, &rm
->p
, attr
, SAFI_ENCAP
, 0, NULL
);
365 bgp_show_type_normal
,
366 bgp_show_type_regexp
,
367 bgp_show_type_prefix_list
,
368 bgp_show_type_filter_list
,
369 bgp_show_type_neighbor
,
370 bgp_show_type_cidr_only
,
371 bgp_show_type_prefix_longer
,
372 bgp_show_type_community_all
,
373 bgp_show_type_community
,
374 bgp_show_type_community_exact
,
375 bgp_show_type_community_list
,
376 bgp_show_type_community_list_exact
383 struct prefix_rd
*prd
,
384 enum bgp_show_type type
,
389 struct bgp_table
*table
;
395 char v4_header
[] = " Network Next Hop Metric LocPrf Weight Path%s";
396 char v4_header_tag
[] = " Network Next Hop In tag/Out tag%s";
398 unsigned long output_count
= 0;
399 unsigned long total_count
= 0;
401 bgp
= bgp_get_default ();
404 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
408 if ((afi
!= AFI_IP
) && (afi
!= AFI_IP6
)) {
409 vty_out (vty
, "Afi %d not supported%s", afi
, VTY_NEWLINE
);
413 for (rn
= bgp_table_top (bgp
->rib
[afi
][SAFI_ENCAP
]); rn
; rn
= bgp_route_next (rn
))
415 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
418 if ((table
= rn
->info
) != NULL
)
422 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
423 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
426 if (type
== bgp_show_type_neighbor
)
428 union sockunion
*su
= output_arg
;
430 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
436 vty_out (vty
, v4_header_tag
, VTY_NEWLINE
);
439 vty_out (vty
, "BGP table version is 0, local router ID is %s%s",
440 inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
441 vty_out (vty
, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s",
443 vty_out (vty
, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s",
444 VTY_NEWLINE
, VTY_NEWLINE
);
445 vty_out (vty
, v4_header
, VTY_NEWLINE
);
459 /* Decode RD type. */
460 type
= decode_rd_type (pnt
);
462 vty_out (vty
, "Route Distinguisher: ");
467 decode_rd_as (pnt
+ 2, &rd_as
);
468 vty_out (vty
, "%u:%d", rd_as
.as
, rd_as
.val
);
472 decode_rd_ip (pnt
+ 2, &rd_ip
);
473 vty_out (vty
, "%s:%d", inet_ntoa (rd_ip
.ip
), rd_ip
.val
);
477 vty_out (vty
, "Unknown RD type");
481 vty_out (vty
, "%s", VTY_NEWLINE
);
485 route_vty_out_tag (vty
, &rm
->p
, ri
, 0, SAFI_ENCAP
, NULL
);
487 route_vty_out (vty
, &rm
->p
, ri
, 0, SAFI_ENCAP
, NULL
);
493 if (output_count
== 0)
495 vty_out (vty
, "No prefixes displayed, %ld exist%s", total_count
, VTY_NEWLINE
);
498 vty_out (vty
, "%sDisplayed %ld out of %ld total prefixes%s",
499 VTY_NEWLINE
, output_count
, total_count
, VTY_NEWLINE
);
504 DEFUN (show_bgp_ipv4_encap
,
505 show_bgp_ipv4_encap_cmd
,
506 "show bgp ipv4 encap",
510 "Display ENCAP NLRI specific information\n")
512 return bgp_show_encap (vty
, AFI_IP
, NULL
, bgp_show_type_normal
, NULL
, 0);
515 DEFUN (show_bgp_ipv6_encap
,
516 show_bgp_ipv6_encap_cmd
,
517 "show bgp ipv6 encap",
521 "Display ENCAP NLRI specific information\n")
523 return bgp_show_encap (vty
, AFI_IP6
, NULL
, bgp_show_type_normal
, NULL
, 0);
527 DEFUN (show_bgp_ipv4_encap_rd
,
528 show_bgp_ipv4_encap_rd_cmd
,
529 "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn",
533 "Display ENCAP NLRI specific information\n"
534 "Display information for a route distinguisher\n"
535 "ENCAP Route Distinguisher\n")
538 struct prefix_rd prd
;
540 ret
= str2prefix_rd (argv
[0], &prd
);
543 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
546 return bgp_show_encap (vty
, AFI_IP
, &prd
, bgp_show_type_normal
, NULL
, 0);
549 DEFUN (show_bgp_ipv6_encap_rd
,
550 show_bgp_ipv6_encap_rd_cmd
,
551 "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn",
555 "Display ENCAP NLRI specific information\n"
556 "Display information for a route distinguisher\n"
557 "ENCAP Route Distinguisher\n"
558 "Display BGP tags for prefixes\n")
561 struct prefix_rd prd
;
563 ret
= str2prefix_rd (argv
[0], &prd
);
566 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
569 return bgp_show_encap (vty
, AFI_IP6
, &prd
, bgp_show_type_normal
, NULL
, 0);
573 DEFUN (show_bgp_ipv4_encap_tags
,
574 show_bgp_ipv4_encap_tags_cmd
,
575 "show bgp ipv4 encap tags",
579 "Display ENCAP NLRI specific information\n"
580 "Display BGP tags for prefixes\n")
582 return bgp_show_encap (vty
, AFI_IP
, NULL
, bgp_show_type_normal
, NULL
, 1);
585 DEFUN (show_bgp_ipv6_encap_tags
,
586 show_bgp_ipv6_encap_tags_cmd
,
587 "show bgp ipv6 encap tags",
591 "Display ENCAP NLRI specific information\n"
592 "Display BGP tags for prefixes\n")
594 return bgp_show_encap (vty
, AFI_IP6
, NULL
, bgp_show_type_normal
, NULL
, 1);
598 DEFUN (show_bgp_ipv4_encap_rd_tags
,
599 show_bgp_ipv4_encap_rd_tags_cmd
,
600 "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn tags",
604 "Display ENCAP NLRI specific information\n"
605 "Display information for a route distinguisher\n"
606 "ENCAP Route Distinguisher\n"
607 "Display BGP tags for prefixes\n")
610 struct prefix_rd prd
;
612 ret
= str2prefix_rd (argv
[0], &prd
);
615 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
618 return bgp_show_encap (vty
, AFI_IP
, &prd
, bgp_show_type_normal
, NULL
, 1);
621 DEFUN (show_bgp_ipv6_encap_rd_tags
,
622 show_bgp_ipv6_encap_rd_tags_cmd
,
623 "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn tags",
627 "Display ENCAP NLRI specific information\n"
628 "Display information for a route distinguisher\n"
629 "ENCAP Route Distinguisher\n"
630 "Display BGP tags for prefixes\n")
633 struct prefix_rd prd
;
635 ret
= str2prefix_rd (argv
[0], &prd
);
638 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
641 return bgp_show_encap (vty
, AFI_IP6
, &prd
, bgp_show_type_normal
, NULL
, 1);
645 DEFUN (show_bgp_ipv4_encap_neighbor_routes
,
646 show_bgp_ipv4_encap_neighbor_routes_cmd
,
647 "show bgp ipv4 encap neighbors A.B.C.D routes",
651 "Display ENCAP NLRI specific information\n"
652 "Detailed information on TCP and BGP neighbor connections\n"
653 "Neighbor to display information about\n"
654 "Display routes learned from neighbor\n")
659 su
= sockunion_str2su (argv
[0]);
662 vty_out (vty
, "Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
666 peer
= peer_lookup (NULL
, su
);
667 if (! peer
|| ! peer
->afc
[AFI_IP
][SAFI_ENCAP
])
669 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
673 return bgp_show_encap (vty
, AFI_IP
, NULL
, bgp_show_type_neighbor
, su
, 0);
676 DEFUN (show_bgp_ipv6_encap_neighbor_routes
,
677 show_bgp_ipv6_encap_neighbor_routes_cmd
,
678 "show bgp ipv6 encap neighbors A.B.C.D routes",
682 "Display ENCAP NLRI specific information\n"
683 "Detailed information on TCP and BGP neighbor connections\n"
684 "Neighbor to display information about\n"
685 "Display routes learned from neighbor\n")
690 su
= sockunion_str2su (argv
[0]);
693 vty_out (vty
, "Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
697 peer
= peer_lookup (NULL
, su
);
698 if (! peer
|| ! peer
->afc
[AFI_IP6
][SAFI_ENCAP
])
700 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
704 return bgp_show_encap (vty
, AFI_IP6
, NULL
, bgp_show_type_neighbor
, su
, 0);
708 DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes
,
709 show_bgp_ipv4_encap_rd_neighbor_routes_cmd
,
710 "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) routes",
714 "Display ENCAP NLRI specific information\n"
715 "Display information for a route distinguisher\n"
716 "ENCAP Route Distinguisher\n"
717 "Detailed information on TCP and BGP neighbor connections\n"
718 "Neighbor to display information about\n"
719 "Neighbor to display information about\n"
720 "Display routes learned from neighbor\n")
725 struct prefix_rd prd
;
727 ret
= str2prefix_rd (argv
[0], &prd
);
730 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
734 su
= sockunion_str2su (argv
[1]);
737 vty_out (vty
, "Malformed address: %s%s", argv
[1], VTY_NEWLINE
);
741 peer
= peer_lookup (NULL
, su
);
742 if (! peer
|| ! peer
->afc
[AFI_IP
][SAFI_ENCAP
])
744 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
748 return bgp_show_encap (vty
, AFI_IP
, &prd
, bgp_show_type_neighbor
, su
, 0);
751 DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes
,
752 show_bgp_ipv6_encap_rd_neighbor_routes_cmd
,
753 "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) routes",
757 "Display ENCAP NLRI specific information\n"
758 "Display information for a route distinguisher\n"
759 "ENCAP Route Distinguisher\n"
760 "Detailed information on TCP and BGP neighbor connections\n"
761 "Neighbor to display information about\n"
762 "Neighbor to display information about\n"
763 "Display routes learned from neighbor\n")
768 struct prefix_rd prd
;
770 ret
= str2prefix_rd (argv
[0], &prd
);
773 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
777 su
= sockunion_str2su (argv
[1]);
780 vty_out (vty
, "Malformed address: %s%s", argv
[1], VTY_NEWLINE
);
784 peer
= peer_lookup (NULL
, su
);
785 if (! peer
|| ! peer
->afc
[AFI_IP6
][SAFI_ENCAP
])
787 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
791 return bgp_show_encap (vty
, AFI_IP6
, &prd
, bgp_show_type_neighbor
, su
, 0);
795 DEFUN (show_bgp_ipv4_encap_neighbor_advertised_routes
,
796 show_bgp_ipv4_encap_neighbor_advertised_routes_cmd
,
797 "show bgp ipv4 encap neighbors A.B.C.D advertised-routes",
801 "Display ENCAP NLRI specific information\n"
802 "Detailed information on TCP and BGP neighbor connections\n"
803 "Neighbor to display information about\n"
804 "Display the routes advertised to a BGP neighbor\n")
810 ret
= str2sockunion (argv
[0], &su
);
813 vty_out (vty
, "%% Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
816 peer
= peer_lookup (NULL
, &su
);
817 if (! peer
|| ! peer
->afc
[AFI_IP
][SAFI_ENCAP
])
819 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
823 return show_adj_route_encap (vty
, peer
, NULL
);
826 DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes
,
827 show_bgp_ipv6_encap_neighbor_advertised_routes_cmd
,
828 "show bgp ipv6 encap neighbors A.B.C.D advertised-routes",
832 "Display ENCAP NLRI specific information\n"
833 "Detailed information on TCP and BGP neighbor connections\n"
834 "Neighbor to display information about\n"
835 "Display the routes advertised to a BGP neighbor\n")
841 ret
= str2sockunion (argv
[0], &su
);
844 vty_out (vty
, "%% Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
847 peer
= peer_lookup (NULL
, &su
);
848 if (! peer
|| ! peer
->afc
[AFI_IP6
][SAFI_ENCAP
])
850 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
854 return show_adj_route_encap (vty
, peer
, NULL
);
858 DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes
,
859 show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd
,
860 "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) advertised-routes",
864 "Display ENCAP NLRI specific information\n"
865 "Display information for a route distinguisher\n"
866 "ENCAP Route Distinguisher\n"
867 "Detailed information on TCP and BGP neighbor connections\n"
868 "Neighbor to display information about\n"
869 "Neighbor to display information about\n"
870 "Display the routes advertised to a BGP neighbor\n")
874 struct prefix_rd prd
;
877 ret
= str2sockunion (argv
[1], &su
);
880 vty_out (vty
, "%% Malformed address: %s%s", argv
[1], VTY_NEWLINE
);
883 peer
= peer_lookup (NULL
, &su
);
884 if (! peer
|| ! peer
->afc
[AFI_IP
][SAFI_ENCAP
])
886 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
890 ret
= str2prefix_rd (argv
[0], &prd
);
893 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
897 return show_adj_route_encap (vty
, peer
, &prd
);
900 DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes
,
901 show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd
,
902 "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) advertised-routes",
906 "Display ENCAP NLRI specific information\n"
907 "Display information for a route distinguisher\n"
908 "ENCAP Route Distinguisher\n"
909 "Detailed information on TCP and BGP neighbor connections\n"
910 "Neighbor to display information about\n"
911 "Neighbor to display information about\n"
912 "Display the routes advertised to a BGP neighbor\n")
916 struct prefix_rd prd
;
919 ret
= str2sockunion (argv
[1], &su
);
922 vty_out (vty
, "%% Malformed address: %s%s", argv
[1], VTY_NEWLINE
);
925 peer
= peer_lookup (NULL
, &su
);
926 if (! peer
|| ! peer
->afc
[AFI_IP6
][SAFI_ENCAP
])
928 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
932 ret
= str2prefix_rd (argv
[0], &prd
);
935 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
939 return show_adj_route_encap (vty
, peer
, &prd
);
944 bgp_encap_init (void)
946 install_element (BGP_ENCAP_NODE
, &encap_network_cmd
);
947 install_element (BGP_ENCAP_NODE
, &no_encap_network_cmd
);
949 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_cmd
);
950 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_rd_cmd
);
951 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_tags_cmd
);
952 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_rd_tags_cmd
);
953 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_neighbor_routes_cmd
);
954 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_rd_neighbor_routes_cmd
);
955 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_neighbor_advertised_routes_cmd
);
956 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd
);
959 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_cmd
);
960 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_rd_cmd
);
961 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_tags_cmd
);
962 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_rd_tags_cmd
);
963 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_neighbor_routes_cmd
);
964 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_rd_neighbor_routes_cmd
);
965 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_neighbor_advertised_routes_cmd
);
966 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd
);
970 install_element (ENABLE_NODE
, &show_bgp_ipv4_encap_cmd
);
971 install_element (ENABLE_NODE
, &show_bgp_ipv4_encap_rd_cmd
);
972 install_element (ENABLE_NODE
, &show_bgp_ipv4_encap_tags_cmd
);
973 install_element (ENABLE_NODE
, &show_bgp_ipv4_encap_rd_tags_cmd
);
974 install_element (ENABLE_NODE
, &show_bgp_ipv4_encap_neighbor_routes_cmd
);
975 install_element (ENABLE_NODE
, &show_bgp_ipv4_encap_rd_neighbor_routes_cmd
);
976 install_element (ENABLE_NODE
, &show_bgp_ipv4_encap_neighbor_advertised_routes_cmd
);
977 install_element (ENABLE_NODE
, &show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd
);
980 install_element (ENABLE_NODE
, &show_bgp_ipv6_encap_cmd
);
981 install_element (ENABLE_NODE
, &show_bgp_ipv6_encap_rd_cmd
);
982 install_element (ENABLE_NODE
, &show_bgp_ipv6_encap_tags_cmd
);
983 install_element (ENABLE_NODE
, &show_bgp_ipv6_encap_rd_tags_cmd
);
984 install_element (ENABLE_NODE
, &show_bgp_ipv6_encap_neighbor_routes_cmd
);
985 install_element (ENABLE_NODE
, &show_bgp_ipv6_encap_rd_neighbor_routes_cmd
);
986 install_element (ENABLE_NODE
, &show_bgp_ipv6_encap_neighbor_advertised_routes_cmd
);
987 install_element (ENABLE_NODE
, &show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd
);