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 #include "bgpd/rfapi/rfapi_backend.h"
53 ecom2prd(struct ecommunity
*ecom
, struct prefix_rd
*prd
)
57 memset(prd
, 0, sizeof(struct prefix_rd
));
58 prd
->family
= AF_UNSPEC
;
64 for (i
= 0; i
< (ecom
->size
* ECOMMUNITY_SIZE
); i
+= ECOMMUNITY_SIZE
) {
78 prd
->val
[1] = ep
[0] & 0x03;
79 memcpy(prd
->val
+ 2, ep
+ 2, 6);
90 struct bgp_nlri
*packet
)
94 afi_t afi
= packet
->afi
;
100 struct prefix_rd prd
;
101 struct ecommunity
*pEcom
= NULL
;
102 u_int16_t rdtype
= 0xffff;
105 /* Check peer status. */
106 if (peer
->status
!= Established
)
110 if (attr
&& attr
->extra
&& attr
->extra
->ecommunity
)
111 pEcom
= attr
->extra
->ecommunity
;
113 ecom2prd(pEcom
, &prd
);
114 memset(&rd_as
, 0, sizeof(rd_as
));
115 memset(&rd_ip
, 0, sizeof(rd_ip
));
119 rdtype
= (prd
.val
[0] << 8) | prd
.val
[1];
121 /* Decode RD value. */
122 if (rdtype
== RD_TYPE_AS
)
123 decode_rd_as (prd
.val
+ 2, &rd_as
);
124 else if (rdtype
== RD_TYPE_IP
)
125 decode_rd_ip (prd
.val
+ 2, &rd_ip
);
126 else if (rdtype
== RD_TYPE_AS4
)
127 decode_rd_as4 (prd
.val
+ 2, &rd_as
);
130 zlog_err ("Invalid RD type %d", rdtype
);
136 * NB: this code was based on the MPLS VPN code, which supported RDs.
137 * For the moment we are retaining the underlying RIB structure that
138 * keeps a per-RD radix tree, but since the RDs are not carried over
139 * the wire, we set the RD internally to 0.
141 prd
.family
= AF_UNSPEC
;
143 memset(prd
.val
, 0, sizeof(prd
.val
));
146 lim
= pnt
+ packet
->length
;
148 for (; pnt
< lim
; pnt
+= psize
)
150 /* Clear prefix structure. */
151 memset (&p
, 0, sizeof (struct prefix
));
153 /* Fetch prefix length. */
155 p
.family
= afi2family(afi
);
157 /* bad afi, shouldn't happen */
158 zlog_warn("%s: bad afi %d, dropping incoming route", __func__
, afi
);
161 psize
= PSIZE (prefixlen
);
163 p
.prefixlen
= prefixlen
;
164 memcpy (&p
.u
.prefix
, pnt
, psize
);
166 if (pnt
+ psize
> lim
)
170 if (rdtype
== RD_TYPE_AS
)
171 zlog_info ("rd-as %u:%u prefix %s/%d", rd_as
.as
, rd_as
.val
,
172 inet_ntop (p
.family
, &p
.u
.prefix
, buf
, BUFSIZ
),
174 else if (rdtype
== RD_TYPE_IP
)
175 zlog_info ("rd-ip %s:%u prefix %s/%d", inet_ntoa (rd_ip
.ip
),
177 inet_ntop (p
.family
, &p
.u
.prefix
, buf
, BUFSIZ
),
179 else if (rdtype
== RD_TYPE_AS4
)
180 zlog_info ("rd-as4 %u:%u prefix %s/%d", rd_as
.as
, rd_as
.val
,
181 inet_ntop (p
.family
, &p
.u
.prefix
, buf
, BUFSIZ
),
184 zlog_info ("rd unknown, default to 0:0 prefix %s/%d",
185 inet_ntop (p
.family
, &p
.u
.prefix
, buf
, BUFSIZ
),
189 bgp_update (peer
, &p
, 0, attr
, afi
, SAFI_ENCAP
,
190 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, &prd
, NULL
, 0);
192 rfapiProcessUpdate(peer
, NULL
, &p
, &prd
, attr
, afi
, SAFI_ENCAP
,
193 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, NULL
);
197 rfapiProcessWithdraw(peer
, NULL
, &p
, &prd
, attr
, afi
, SAFI_ENCAP
,
200 bgp_withdraw (peer
, &p
, 0, attr
, afi
, SAFI_ENCAP
,
201 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, &prd
, NULL
);
205 /* Packet length consistency check. */
213 /* TBD: these routes should probably all be host routes */
215 /* For testing purpose, static route of ENCAP. */
216 DEFUN (encap_network
,
218 "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD",
219 "Specify a network to announce via BGP\n"
220 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
221 "Specify Route Distinguisher\n"
222 "ENCAP Route Distinguisher\n"
226 return bgp_static_set_safi (SAFI_ENCAP
, vty
, argv
[0], argv
[1], argv
[2], NULL
);
229 /* For testing purpose, static route of ENCAP. */
230 DEFUN (no_encap_network
,
231 no_encap_network_cmd
,
232 "no network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD",
234 "Specify a network to announce via BGP\n"
235 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
236 "Specify Route Distinguisher\n"
237 "ENCAP Route Distinguisher\n"
241 return bgp_static_unset_safi (SAFI_ENCAP
, vty
, argv
[0], argv
[1], argv
[2]);
245 show_adj_route_encap (struct vty
*vty
, struct peer
*peer
, struct prefix_rd
*prd
)
248 struct bgp_table
*table
;
254 char v4_header
[] = " Network Next Hop Metric LocPrf Weight Path%s";
256 bgp
= bgp_get_default ();
259 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
263 for (rn
= bgp_table_top (bgp
->rib
[AFI_IP
][SAFI_ENCAP
]); rn
;
264 rn
= bgp_route_next (rn
))
266 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
269 if ((table
= rn
->info
) != NULL
)
273 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
274 if ((attr
= rm
->info
) != NULL
)
278 vty_out (vty
, "BGP table version is 0, local router ID is %s%s",
279 inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
280 vty_out (vty
, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s",
282 vty_out (vty
, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s",
283 VTY_NEWLINE
, VTY_NEWLINE
);
284 vty_out (vty
, v4_header
, VTY_NEWLINE
);
297 vty_out (vty
, "Route Distinguisher: ");
299 /* Decode RD type. */
300 type
= decode_rd_type (pnt
);
305 decode_rd_as (pnt
+ 2, &rd_as
);
306 vty_out (vty
, "%u:%d", rd_as
.as
, rd_as
.val
);
310 decode_rd_ip (pnt
+ 2, &rd_ip
);
311 vty_out (vty
, "%s:%d", inet_ntoa (rd_ip
.ip
), rd_ip
.val
);
315 vty_out (vty
, "unknown RD type");
319 vty_out (vty
, "%s", VTY_NEWLINE
);
322 route_vty_out_tmp (vty
, &rm
->p
, attr
, SAFI_ENCAP
, 0, NULL
);
331 bgp_show_type_normal
,
332 bgp_show_type_regexp
,
333 bgp_show_type_prefix_list
,
334 bgp_show_type_filter_list
,
335 bgp_show_type_neighbor
,
336 bgp_show_type_cidr_only
,
337 bgp_show_type_prefix_longer
,
338 bgp_show_type_community_all
,
339 bgp_show_type_community
,
340 bgp_show_type_community_exact
,
341 bgp_show_type_community_list
,
342 bgp_show_type_community_list_exact
349 struct prefix_rd
*prd
,
350 enum bgp_show_type type
,
355 struct bgp_table
*table
;
361 char v4_header
[] = " Network Next Hop Metric LocPrf Weight Path%s";
362 char v4_header_tag
[] = " Network Next Hop In tag/Out tag%s";
364 unsigned long output_count
= 0;
365 unsigned long total_count
= 0;
367 bgp
= bgp_get_default ();
370 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
374 if ((afi
!= AFI_IP
) && (afi
!= AFI_IP6
)) {
375 vty_out (vty
, "Afi %d not supported%s", afi
, VTY_NEWLINE
);
379 for (rn
= bgp_table_top (bgp
->rib
[afi
][SAFI_ENCAP
]); rn
; rn
= bgp_route_next (rn
))
381 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
384 if ((table
= rn
->info
) != NULL
)
388 for (rm
= bgp_table_top (table
); rm
; rm
= bgp_route_next (rm
))
389 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
392 if (type
== bgp_show_type_neighbor
)
394 union sockunion
*su
= output_arg
;
396 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
402 vty_out (vty
, v4_header_tag
, VTY_NEWLINE
);
405 vty_out (vty
, "BGP table version is 0, local router ID is %s%s",
406 inet_ntoa (bgp
->router_id
), VTY_NEWLINE
);
407 vty_out (vty
, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s",
409 vty_out (vty
, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s",
410 VTY_NEWLINE
, VTY_NEWLINE
);
411 vty_out (vty
, v4_header
, VTY_NEWLINE
);
425 /* Decode RD type. */
426 type
= decode_rd_type (pnt
);
428 vty_out (vty
, "Route Distinguisher: ");
433 decode_rd_as (pnt
+ 2, &rd_as
);
434 vty_out (vty
, "%u:%d", rd_as
.as
, rd_as
.val
);
438 decode_rd_ip (pnt
+ 2, &rd_ip
);
439 vty_out (vty
, "%s:%d", inet_ntoa (rd_ip
.ip
), rd_ip
.val
);
443 vty_out (vty
, "Unknown RD type");
447 vty_out (vty
, "%s", VTY_NEWLINE
);
451 route_vty_out_tag (vty
, &rm
->p
, ri
, 0, SAFI_ENCAP
, NULL
);
453 route_vty_out (vty
, &rm
->p
, ri
, 0, SAFI_ENCAP
, NULL
);
459 if (output_count
== 0)
461 vty_out (vty
, "No prefixes displayed, %ld exist%s", total_count
, VTY_NEWLINE
);
464 vty_out (vty
, "%sDisplayed %ld out of %ld total prefixes%s",
465 VTY_NEWLINE
, output_count
, total_count
, VTY_NEWLINE
);
470 DEFUN (show_bgp_ipv4_encap
,
471 show_bgp_ipv4_encap_cmd
,
472 "show bgp ipv4 encap",
476 "Display ENCAP NLRI specific information\n")
478 return bgp_show_encap (vty
, AFI_IP
, NULL
, bgp_show_type_normal
, NULL
, 0);
481 DEFUN (show_bgp_ipv6_encap
,
482 show_bgp_ipv6_encap_cmd
,
483 "show bgp ipv6 encap",
487 "Display ENCAP NLRI specific information\n")
489 return bgp_show_encap (vty
, AFI_IP6
, NULL
, bgp_show_type_normal
, NULL
, 0);
493 DEFUN (show_bgp_ipv4_encap_rd
,
494 show_bgp_ipv4_encap_rd_cmd
,
495 "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn",
499 "Display ENCAP NLRI specific information\n"
500 "Display information for a route distinguisher\n"
501 "ENCAP Route Distinguisher\n")
504 struct prefix_rd prd
;
506 ret
= str2prefix_rd (argv
[0], &prd
);
509 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
512 return bgp_show_encap (vty
, AFI_IP
, &prd
, bgp_show_type_normal
, NULL
, 0);
515 DEFUN (show_bgp_ipv6_encap_rd
,
516 show_bgp_ipv6_encap_rd_cmd
,
517 "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn",
521 "Display ENCAP NLRI specific information\n"
522 "Display information for a route distinguisher\n"
523 "ENCAP Route Distinguisher\n"
524 "Display BGP tags for prefixes\n")
527 struct prefix_rd prd
;
529 ret
= str2prefix_rd (argv
[0], &prd
);
532 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
535 return bgp_show_encap (vty
, AFI_IP6
, &prd
, bgp_show_type_normal
, NULL
, 0);
539 DEFUN (show_bgp_ipv4_encap_tags
,
540 show_bgp_ipv4_encap_tags_cmd
,
541 "show bgp ipv4 encap tags",
545 "Display ENCAP NLRI specific information\n"
546 "Display BGP tags for prefixes\n")
548 return bgp_show_encap (vty
, AFI_IP
, NULL
, bgp_show_type_normal
, NULL
, 1);
551 DEFUN (show_bgp_ipv6_encap_tags
,
552 show_bgp_ipv6_encap_tags_cmd
,
553 "show bgp ipv6 encap tags",
557 "Display ENCAP NLRI specific information\n"
558 "Display BGP tags for prefixes\n")
560 return bgp_show_encap (vty
, AFI_IP6
, NULL
, bgp_show_type_normal
, NULL
, 1);
564 DEFUN (show_bgp_ipv4_encap_rd_tags
,
565 show_bgp_ipv4_encap_rd_tags_cmd
,
566 "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn tags",
570 "Display ENCAP NLRI specific information\n"
571 "Display information for a route distinguisher\n"
572 "ENCAP Route Distinguisher\n"
573 "Display BGP tags for prefixes\n")
576 struct prefix_rd prd
;
578 ret
= str2prefix_rd (argv
[0], &prd
);
581 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
584 return bgp_show_encap (vty
, AFI_IP
, &prd
, bgp_show_type_normal
, NULL
, 1);
587 DEFUN (show_bgp_ipv6_encap_rd_tags
,
588 show_bgp_ipv6_encap_rd_tags_cmd
,
589 "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn tags",
593 "Display ENCAP NLRI specific information\n"
594 "Display information for a route distinguisher\n"
595 "ENCAP Route Distinguisher\n"
596 "Display BGP tags for prefixes\n")
599 struct prefix_rd prd
;
601 ret
= str2prefix_rd (argv
[0], &prd
);
604 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
607 return bgp_show_encap (vty
, AFI_IP6
, &prd
, bgp_show_type_normal
, NULL
, 1);
611 DEFUN (show_bgp_ipv4_encap_neighbor_routes
,
612 show_bgp_ipv4_encap_neighbor_routes_cmd
,
613 "show bgp ipv4 encap neighbors A.B.C.D routes",
617 "Display ENCAP NLRI specific information\n"
618 "Detailed information on TCP and BGP neighbor connections\n"
619 "Neighbor to display information about\n"
620 "Display routes learned from neighbor\n")
625 if (str2sockunion(argv
[0], &su
))
627 vty_out (vty
, "Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
631 peer
= peer_lookup (NULL
, &su
);
632 if (! peer
|| ! peer
->afc
[AFI_IP
][SAFI_ENCAP
])
634 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
638 return bgp_show_encap (vty
, AFI_IP
, NULL
, bgp_show_type_neighbor
, &su
, 0);
641 DEFUN (show_bgp_ipv6_encap_neighbor_routes
,
642 show_bgp_ipv6_encap_neighbor_routes_cmd
,
643 "show bgp ipv6 encap neighbors A.B.C.D routes",
647 "Display ENCAP NLRI specific information\n"
648 "Detailed information on TCP and BGP neighbor connections\n"
649 "Neighbor to display information about\n"
650 "Display routes learned from neighbor\n")
655 if (str2sockunion(argv
[0], &su
))
657 vty_out (vty
, "Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
661 peer
= peer_lookup (NULL
, &su
);
662 if (! peer
|| ! peer
->afc
[AFI_IP6
][SAFI_ENCAP
])
664 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
668 return bgp_show_encap (vty
, AFI_IP6
, NULL
, bgp_show_type_neighbor
, &su
, 0);
672 DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes
,
673 show_bgp_ipv4_encap_rd_neighbor_routes_cmd
,
674 "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) routes",
678 "Display ENCAP NLRI specific information\n"
679 "Display information for a route distinguisher\n"
680 "ENCAP Route Distinguisher\n"
681 "Detailed information on TCP and BGP neighbor connections\n"
682 "Neighbor to display information about\n"
683 "Neighbor to display information about\n"
684 "Display routes learned from neighbor\n")
689 struct prefix_rd prd
;
691 ret
= str2prefix_rd (argv
[0], &prd
);
694 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
698 if (str2sockunion(argv
[1], &su
))
700 vty_out (vty
, "Malformed address: %s%s", argv
[1], VTY_NEWLINE
);
704 peer
= peer_lookup (NULL
, &su
);
705 if (! peer
|| ! peer
->afc
[AFI_IP
][SAFI_ENCAP
])
707 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
711 return bgp_show_encap (vty
, AFI_IP
, &prd
, bgp_show_type_neighbor
, &su
, 0);
714 DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes
,
715 show_bgp_ipv6_encap_rd_neighbor_routes_cmd
,
716 "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) routes",
720 "Display ENCAP NLRI specific information\n"
721 "Display information for a route distinguisher\n"
722 "ENCAP Route Distinguisher\n"
723 "Detailed information on TCP and BGP neighbor connections\n"
724 "Neighbor to display information about\n"
725 "Neighbor to display information about\n"
726 "Display routes learned from neighbor\n")
731 struct prefix_rd prd
;
733 ret
= str2prefix_rd (argv
[0], &prd
);
736 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
740 if (str2sockunion(argv
[1], &su
))
742 vty_out (vty
, "Malformed address: %s%s", argv
[1], VTY_NEWLINE
);
746 peer
= peer_lookup (NULL
, &su
);
747 if (! peer
|| ! peer
->afc
[AFI_IP6
][SAFI_ENCAP
])
749 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
753 return bgp_show_encap (vty
, AFI_IP6
, &prd
, bgp_show_type_neighbor
, &su
, 0);
757 DEFUN (show_bgp_ipv4_encap_neighbor_advertised_routes
,
758 show_bgp_ipv4_encap_neighbor_advertised_routes_cmd
,
759 "show bgp ipv4 encap neighbors A.B.C.D advertised-routes",
763 "Display ENCAP NLRI specific information\n"
764 "Detailed information on TCP and BGP neighbor connections\n"
765 "Neighbor to display information about\n"
766 "Display the routes advertised to a BGP neighbor\n")
772 ret
= str2sockunion (argv
[0], &su
);
775 vty_out (vty
, "%% Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
778 peer
= peer_lookup (NULL
, &su
);
779 if (! peer
|| ! peer
->afc
[AFI_IP
][SAFI_ENCAP
])
781 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
785 return show_adj_route_encap (vty
, peer
, NULL
);
788 DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes
,
789 show_bgp_ipv6_encap_neighbor_advertised_routes_cmd
,
790 "show bgp ipv6 encap neighbors A.B.C.D advertised-routes",
794 "Display ENCAP NLRI specific information\n"
795 "Detailed information on TCP and BGP neighbor connections\n"
796 "Neighbor to display information about\n"
797 "Display the routes advertised to a BGP neighbor\n")
803 ret
= str2sockunion (argv
[0], &su
);
806 vty_out (vty
, "%% Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
809 peer
= peer_lookup (NULL
, &su
);
810 if (! peer
|| ! peer
->afc
[AFI_IP6
][SAFI_ENCAP
])
812 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
816 return show_adj_route_encap (vty
, peer
, NULL
);
820 DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes
,
821 show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd
,
822 "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) advertised-routes",
826 "Display ENCAP NLRI specific information\n"
827 "Display information for a route distinguisher\n"
828 "ENCAP Route Distinguisher\n"
829 "Detailed information on TCP and BGP neighbor connections\n"
830 "Neighbor to display information about\n"
831 "Neighbor to display information about\n"
832 "Display the routes advertised to a BGP neighbor\n")
836 struct prefix_rd prd
;
839 ret
= str2sockunion (argv
[1], &su
);
842 vty_out (vty
, "%% Malformed address: %s%s", argv
[1], VTY_NEWLINE
);
845 peer
= peer_lookup (NULL
, &su
);
846 if (! peer
|| ! peer
->afc
[AFI_IP
][SAFI_ENCAP
])
848 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
852 ret
= str2prefix_rd (argv
[0], &prd
);
855 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
859 return show_adj_route_encap (vty
, peer
, &prd
);
862 DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes
,
863 show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd
,
864 "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) advertised-routes",
868 "Display ENCAP NLRI specific information\n"
869 "Display information for a route distinguisher\n"
870 "ENCAP Route Distinguisher\n"
871 "Detailed information on TCP and BGP neighbor connections\n"
872 "Neighbor to display information about\n"
873 "Neighbor to display information about\n"
874 "Display the routes advertised to a BGP neighbor\n")
878 struct prefix_rd prd
;
881 ret
= str2sockunion (argv
[1], &su
);
884 vty_out (vty
, "%% Malformed address: %s%s", argv
[1], VTY_NEWLINE
);
887 peer
= peer_lookup (NULL
, &su
);
888 if (! peer
|| ! peer
->afc
[AFI_IP6
][SAFI_ENCAP
])
890 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
894 ret
= str2prefix_rd (argv
[0], &prd
);
897 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
901 return show_adj_route_encap (vty
, peer
, &prd
);
906 bgp_encap_init (void)
908 install_element (BGP_ENCAP_NODE
, &encap_network_cmd
);
909 install_element (BGP_ENCAP_NODE
, &no_encap_network_cmd
);
911 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_cmd
);
912 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_rd_cmd
);
913 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_tags_cmd
);
914 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_rd_tags_cmd
);
915 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_neighbor_routes_cmd
);
916 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_rd_neighbor_routes_cmd
);
917 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_neighbor_advertised_routes_cmd
);
918 install_element (VIEW_NODE
, &show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd
);
921 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_cmd
);
922 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_rd_cmd
);
923 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_tags_cmd
);
924 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_rd_tags_cmd
);
925 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_neighbor_routes_cmd
);
926 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_rd_neighbor_routes_cmd
);
927 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_neighbor_advertised_routes_cmd
);
928 install_element (VIEW_NODE
, &show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd
);