2 * Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
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
31 #include "bgpd/bgpd.h"
32 #include "bgpd/bgp_route.h"
33 #include "bgpd/bgp_attr.h"
34 #include "bgpd/bgp_mplsvpn.h"
36 int peer_activate (struct vty
*, char *, int, int);
37 int peer_deactivate (struct vty
*, char *, int, int);
38 int route_vty_out (struct vty
*, struct prefix
*, struct bgp_info
*, int, safi_t
);
39 int route_vty_out_tag (struct vty
*, struct prefix
*, struct bgp_info
*, int, safi_t
);
40 void route_vty_out_tmp (struct vty
*, struct prefix
*, struct attr
*, safi_t
);
43 decode_rd_type (u_char
*pnt
)
47 v
= ((u_int16_t
) *pnt
++ << 8);
48 v
|= (u_int16_t
) *pnt
;
53 decode_label (u_char
*pnt
)
57 l
= ((u_int32_t
) *pnt
++ << 12);
58 l
|= (u_int32_t
) *pnt
++ << 4;
59 l
|= (u_int32_t
) ((*pnt
& 0xf0) >> 4);
64 decode_rd_as (u_char
*pnt
, struct rd_as
*rd_as
)
66 rd_as
->as
= (u_int16_t
) *pnt
++ << 8;
67 rd_as
->as
|= (u_int16_t
) *pnt
++;
69 rd_as
->val
= ((u_int32_t
) *pnt
++ << 24);
70 rd_as
->val
|= ((u_int32_t
) *pnt
++ << 16);
71 rd_as
->val
|= ((u_int32_t
) *pnt
++ << 8);
72 rd_as
->val
|= (u_int32_t
) *pnt
;
76 decode_rd_ip (u_char
*pnt
, struct rd_ip
*rd_ip
)
78 memcpy (&rd_ip
->ip
, pnt
, 4);
81 rd_ip
->val
= ((u_int16_t
) *pnt
++ << 8);
82 rd_ip
->val
|= (u_int16_t
) *pnt
;
85 int bgp_update (struct peer
*, struct prefix
*, struct attr
*,
86 afi_t
, safi_t
, int, int, struct prefix_rd
*, u_char
*);
88 int bgp_withdraw (struct peer
*, struct prefix
*, struct attr
*,
89 int, int, int, int, struct prefix_rd
*, u_char
*);
91 nlri_parse_vpnv4 (struct peer
*peer
, struct attr
*attr
,
92 struct bgp_nlri
*packet
)
103 struct prefix_rd prd
;
106 /* Check peer status. */
107 if (peer
->status
!= Established
)
111 prd
.family
= AF_UNSPEC
;
115 lim
= pnt
+ packet
->length
;
117 for (; pnt
< lim
; pnt
+= psize
)
119 /* Clear prefix structure. */
120 memset (&p
, 0, sizeof (struct prefix
));
122 /* Fetch prefix length. */
125 psize
= PSIZE (prefixlen
);
129 zlog_err ("prefix length is less than 88: %d", prefixlen
);
133 label
= decode_label (pnt
);
135 /* Copyr label to prefix. */
138 /* Copy routing distinguisher to rd. */
139 memcpy (&prd
.val
, pnt
+ 3, 8);
141 /* Decode RD type. */
142 type
= decode_rd_type (pnt
+ 3);
144 /* Decode RD value. */
145 if (type
== RD_TYPE_AS
)
146 decode_rd_as (pnt
+ 5, &rd_as
);
147 else if (type
== RD_TYPE_IP
)
148 decode_rd_ip (pnt
+ 5, &rd_ip
);
151 zlog_err ("Invalid RD type %d", type
);
155 p
.prefixlen
= prefixlen
- 88;
156 memcpy (&p
.u
.prefix
, pnt
+ 11, psize
- 11);
158 if (type
== RD_TYPE_AS
)
159 zlog_info ("prefix %ld:%ld:%ld:%s/%d", label
, rd_as
.as
, rd_as
.val
,
160 inet_ntoa (p
.u
.prefix4
), p
.prefixlen
);
161 else if (type
== RD_TYPE_IP
)
162 zlog_info ("prefix %ld:%s:%ld:%s/%d", label
, inet_ntoa (rd_ip
.ip
),
163 rd_ip
.val
, inet_ntoa (p
.u
.prefix4
), p
.prefixlen
);
166 if (pnt
+ psize
> lim
)
170 bgp_update (peer
, &p
, attr
, AFI_IP
, SAFI_MPLS_VPN
,
171 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, &prd
, tagpnt
);
173 bgp_withdraw (peer
, &p
, attr
, AFI_IP
, SAFI_MPLS_VPN
,
174 ZEBRA_ROUTE_BGP
, BGP_ROUTE_NORMAL
, &prd
, tagpnt
);
177 /* Packet length consistency check. */
184 DEFUN (address_family_vpnv4
,
185 address_family_vpnv4_cmd
,
186 "address-family vpnv4",
187 "Enter Address Family command mode\n"
190 vty
->node
= BGP_VPNV4_NODE
;
194 ALIAS (address_family_vpnv4
,
195 address_family_vpnv4_unicast_cmd
,
196 "address-family vpnv4 unicast",
197 "Enter Address Family command mode\n"
199 "Address Family Modifier\n")
201 DEFUN (vpnv4_activate
,
203 "neighbor A.B.C.D activate",
206 "Enable the Address Family for this Neighbor\n")
208 return peer_activate (vty
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
);
211 DEFUN (no_vpnv4_activate
,
212 no_vpnv4_activate_cmd
,
213 "no neighbor A.B.C.D activate",
217 "Enable the Address Family for this Neighbor\n")
219 return peer_deactivate (vty
, argv
[0], AFI_IP
, SAFI_MPLS_VPN
);
222 extern struct peer
*peer_self
;
225 str2prefix_rd (u_char
*str
, struct prefix_rd
*prd
)
236 prd
->family
= AF_UNSPEC
;
239 p
= strchr (str
, ':');
243 if (! all_digit (p
+ 1))
246 half
= XMALLOC (MTYPE_TMP
, (p
- str
) + 1);
247 memcpy (half
, str
, (p
- str
));
248 half
[p
- str
] = '\0';
250 p2
= strchr (str
, '.');
254 if (! all_digit (half
))
256 XFREE (MTYPE_TMP
, half
);
259 stream_putw (s
, RD_TYPE_AS
);
260 stream_putw (s
, atoi (half
));
261 stream_putl (s
, atol (p
+ 1));
265 ret
= inet_aton (half
, &addr
);
268 XFREE (MTYPE_TMP
, half
);
271 stream_putw (s
, RD_TYPE_IP
);
272 stream_put_in_addr (s
, &addr
);
273 stream_putw (s
, atol (p
+ 1));
275 memcpy (prd
->val
, s
->data
, 8);
281 str2tag (u_char
*str
, u_char
*tag
)
287 tag
[0] = (u_char
)(l
>> 12);
288 tag
[1] = (u_char
)(l
>> 4);
289 tag
[2] = (u_char
)(l
<< 4);
295 prefix_rd2str (struct prefix_rd
*prd
, char *buf
, size_t size
)
302 if (size
< RD_ADDRSTRLEN
)
307 type
= decode_rd_type (pnt
);
309 if (type
== RD_TYPE_AS
)
311 decode_rd_as (pnt
+ 2, &rd_as
);
312 snprintf (buf
, size
, "%d:%d", rd_as
.as
, rd_as
.val
);
315 else if (type
== RD_TYPE_IP
)
317 decode_rd_ip (pnt
+ 2, &rd_ip
);
318 snprintf (buf
, size
, "%s:%d", inet_ntoa (rd_ip
.ip
), rd_ip
.val
);
325 /* For testing purpose, static route of MPLS-VPN. */
326 DEFUN (vpnv4_network
,
328 "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD",
329 "Specify a network to announce via BGP\n"
330 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
331 "Specify Route Distinguisher\n"
332 "VPN Route Distinguisher\n"
336 return bgp_static_set_vpnv4 (vty
, argv
[0], argv
[1], argv
[2]);
339 /* For testing purpose, static route of MPLS-VPN. */
340 DEFUN (no_vpnv4_network
,
341 no_vpnv4_network_cmd
,
342 "no network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD",
344 "Specify a network to announce via BGP\n"
345 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
346 "Specify Route Distinguisher\n"
347 "VPN Route Distinguisher\n"
351 return bgp_static_unset_vpnv4 (vty
, argv
[0], argv
[1], argv
[2]);
355 show_adj_route_vpn (struct vty
*vty
, struct peer
*peer
, struct prefix_rd
*prd
)
358 struct route_table
*table
;
359 struct route_node
*rn
;
360 struct route_node
*rm
;
364 char v4_header
[] = " Network Next Hop Metric LocPrf Weight Path%s";
366 bgp
= bgp_get_default ();
369 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
373 for (rn
= route_top (peer
->adj_out
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= route_next (rn
))
375 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
378 if ((table
= rn
->info
) != NULL
)
382 for (rm
= route_top (table
); rm
; rm
= route_next (rm
))
383 if ((attr
= rm
->info
) != NULL
)
387 vty_out (vty
, "BGP table version is 0, local router ID is %s%s",
388 inet_ntoa (bgp
->id
), VTY_NEWLINE
);
389 vty_out (vty
, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s",
391 vty_out (vty
, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s",
392 VTY_NEWLINE
, VTY_NEWLINE
);
393 vty_out (vty
, v4_header
, VTY_NEWLINE
);
406 /* Decode RD type. */
407 type
= decode_rd_type (pnt
);
408 /* Decode RD value. */
409 if (type
== RD_TYPE_AS
)
410 decode_rd_as (pnt
+ 2, &rd_as
);
411 else if (type
== RD_TYPE_IP
)
412 decode_rd_ip (pnt
+ 2, &rd_ip
);
414 vty_out (vty
, "Route Distinguisher: ");
416 if (type
== RD_TYPE_AS
)
417 vty_out (vty
, "%d:%d", rd_as
.as
, rd_as
.val
);
418 else if (type
== RD_TYPE_IP
)
419 vty_out (vty
, "%s:%d", inet_ntoa (rd_ip
.ip
), rd_ip
.val
);
421 vty_out (vty
, "%s", VTY_NEWLINE
);
424 route_vty_out_tmp (vty
, &rm
->p
, attr
, SAFI_MPLS_VPN
);
433 bgp_show_type_normal
,
434 bgp_show_type_regexp
,
435 bgp_show_type_prefix_list
,
436 bgp_show_type_filter_list
,
437 bgp_show_type_neighbor
,
438 bgp_show_type_cidr_only
,
439 bgp_show_type_prefix_longer
,
440 bgp_show_type_community_all
,
441 bgp_show_type_community
,
442 bgp_show_type_community_exact
,
443 bgp_show_type_community_list
,
444 bgp_show_type_community_list_exact
448 bgp_show_mpls_vpn (struct vty
*vty
, struct prefix_rd
*prd
, enum bgp_show_type type
,
449 void *output_arg
, int tags
)
452 struct route_table
*table
;
453 struct route_node
*rn
;
454 struct route_node
*rm
;
458 char v4_header
[] = " Network Next Hop Metric LocPrf Weight Path%s";
459 char v4_header_tag
[] = " Network Next Hop In tag/Out tag%s";
461 bgp
= bgp_get_default ();
464 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
468 for (rn
= route_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
; rn
= route_next (rn
))
470 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
473 if ((table
= rn
->info
) != NULL
)
477 for (rm
= route_top (table
); rm
; rm
= route_next (rm
))
478 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
480 if (type
== bgp_show_type_neighbor
)
482 union sockunion
*su
= output_arg
;
484 if (ri
->peer
->su_remote
== NULL
|| ! sockunion_same(ri
->peer
->su_remote
, su
))
490 vty_out (vty
, v4_header_tag
, VTY_NEWLINE
);
493 vty_out (vty
, "BGP table version is 0, local router ID is %s%s",
494 inet_ntoa (bgp
->id
), VTY_NEWLINE
);
495 vty_out (vty
, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s",
497 vty_out (vty
, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s",
498 VTY_NEWLINE
, VTY_NEWLINE
);
499 vty_out (vty
, v4_header
, VTY_NEWLINE
);
513 /* Decode RD type. */
514 type
= decode_rd_type (pnt
);
515 /* Decode RD value. */
516 if (type
== RD_TYPE_AS
)
517 decode_rd_as (pnt
+ 2, &rd_as
);
518 else if (type
== RD_TYPE_IP
)
519 decode_rd_ip (pnt
+ 2, &rd_ip
);
521 vty_out (vty
, "Route Distinguisher: ");
523 if (type
== RD_TYPE_AS
)
524 vty_out (vty
, "%d:%d", rd_as
.as
, rd_as
.val
);
525 else if (type
== RD_TYPE_IP
)
526 vty_out (vty
, "%s:%d", inet_ntoa (rd_ip
.ip
), rd_ip
.val
);
528 vty_out (vty
, "%s", VTY_NEWLINE
);
532 route_vty_out_tag (vty
, &rm
->p
, ri
, 0, SAFI_MPLS_VPN
);
534 route_vty_out (vty
, &rm
->p
, ri
, 0, SAFI_MPLS_VPN
);
542 bgp_show_mpls_vpn_route (struct vty
*vty
, char *ip_str
, struct prefix_rd
*prd
,
547 struct route_table
*table
;
548 struct route_node
*rn
;
549 struct route_node
*rm
;
554 char buf
[INET6_ADDRSTRLEN
];
556 /* Check IP address argument. */
557 ret
= str2prefix (ip_str
, &match
);
560 vty_out (vty
, "address is malformed%s", VTY_NEWLINE
);
564 match
.family
= AF_INET
;
565 /* match.prefixlen = IPV4_MAX_BITLEN; */
567 bgp
= bgp_get_default ();
570 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
574 for (rn
= route_top (bgp
->rib
[AFI_IP
][SAFI_MPLS_VPN
]); rn
;
575 rn
= route_next (rn
))
577 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
580 if ((table
= rn
->info
) != NULL
)
584 if ((rm
= route_node_match (table
, &match
)) != NULL
)
586 if (prefix_check
&& rm
->p
.prefixlen
!= match
.prefixlen
)
589 for (ri
= rm
->info
; ri
; ri
= ri
->next
)
600 /* Decode RD type. */
601 type
= decode_rd_type (pnt
);
602 /* Decode RD value. */
603 if (type
== RD_TYPE_AS
)
604 decode_rd_as (pnt
+ 2, &rd_as
);
605 else if (type
== RD_TYPE_IP
)
606 decode_rd_ip (pnt
+ 2, &rd_ip
);
608 vty_out (vty
, "BGP routing table entry for ");
610 if (type
== RD_TYPE_AS
)
611 vty_out (vty
, "%d:%d", rd_as
.as
, rd_as
.val
);
612 else if (type
== RD_TYPE_IP
)
613 vty_out (vty
, "%s:%d", inet_ntoa (rd_ip
.ip
), rd_ip
.val
);
615 vty_out (vty
, ":%s/%d", inet_ntop (rm
->p
.family
, &rm
->p
.u
.prefix
, buf
, INET6_ADDRSTRLEN
),
618 vty_out (vty
, "%s", VTY_NEWLINE
);
622 route_vty_out_detail (vty
, &rm
->p
, ri
, AFI_IP
, SAFI_MPLS_VPN
);
629 vty_out (vty
, "%% Network not in table%s", VTY_NEWLINE
);
636 DEFUN (show_ip_bgp_vpnv4_all
,
637 show_ip_bgp_vpnv4_all_cmd
,
638 "show ip bgp vpnv4 all",
642 "Display VPNv4 NLRI specific information\n"
643 "Display information about all VPNv4 NLRIs\n")
645 return bgp_show_mpls_vpn (vty
, NULL
, bgp_show_type_normal
, NULL
, 0);
648 DEFUN (show_ip_bgp_vpnv4_rd
,
649 show_ip_bgp_vpnv4_rd_cmd
,
650 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn",
654 "Display VPNv4 NLRI specific information\n"
655 "Display information for a route distinguisher\n"
656 "VPN Route Distinguisher\n")
659 struct prefix_rd prd
;
661 ret
= str2prefix_rd (argv
[0], &prd
);
664 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
667 return bgp_show_mpls_vpn (vty
, &prd
, bgp_show_type_normal
, NULL
, 0);
670 DEFUN (show_ip_bgp_vpnv4_all_tags
,
671 show_ip_bgp_vpnv4_all_tags_cmd
,
672 "show ip bgp vpnv4 all tags",
676 "Display VPNv4 NLRI specific information\n"
677 "Display information about all VPNv4 NLRIs\n"
678 "Display BGP tags for prefixes\n")
680 return bgp_show_mpls_vpn (vty
, NULL
, bgp_show_type_normal
, NULL
, 1);
683 DEFUN (show_ip_bgp_vpnv4_rd_tags
,
684 show_ip_bgp_vpnv4_rd_tags_cmd
,
685 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn tags",
689 "Display VPNv4 NLRI specific information\n"
690 "Display information for a route distinguisher\n"
691 "VPN Route Distinguisher\n"
692 "Display BGP tags for prefixes\n")
695 struct prefix_rd prd
;
697 ret
= str2prefix_rd (argv
[0], &prd
);
700 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
703 return bgp_show_mpls_vpn (vty
, &prd
, bgp_show_type_normal
, NULL
, 1);
706 DEFUN (show_ip_bgp_vpnv4_all_route
,
707 show_ip_bgp_vpnv4_all_route_cmd
,
708 "show ip bgp vpnv4 all A.B.C.D",
712 "Display VPNv4 NLRI specific information\n"
713 "Display information about all VPNv4 NLRIs\n"
714 "Network in the BGP routing table to display\n")
716 return bgp_show_mpls_vpn_route (vty
, argv
[0], NULL
, 0);
719 DEFUN (show_ip_bgp_vpnv4_all_prefix
,
720 show_ip_bgp_vpnv4_all_prefix_cmd
,
721 "show ip bgp vpnv4 all A.B.C.D/M",
725 "Display VPNv4 NLRI specific information\n"
726 "Display information about all VPNv4 NLRIs\n"
727 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
729 return bgp_show_mpls_vpn_route (vty
, argv
[0], NULL
, 1);
732 DEFUN (show_ip_bgp_vpnv4_rd_route
,
733 show_ip_bgp_vpnv4_rd_route_cmd
,
734 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D",
738 "Display VPNv4 NLRI specific information\n"
739 "Display information for a route distinguisher\n"
740 "VPN Route Distinguisher\n"
741 "Network in the BGP routing table to display\n")
744 struct prefix_rd prd
;
746 ret
= str2prefix_rd (argv
[0], &prd
);
749 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
752 return bgp_show_mpls_vpn_route (vty
, argv
[1], &prd
, 0);
755 DEFUN (show_ip_bgp_vpnv4_rd_prefix
,
756 show_ip_bgp_vpnv4_rd_prefix_cmd
,
757 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M",
761 "Display VPNv4 NLRI specific information\n"
762 "Display information for a route distinguisher\n"
763 "VPN Route Distinguisher\n"
764 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
767 struct prefix_rd prd
;
769 ret
= str2prefix_rd (argv
[0], &prd
);
772 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
775 return bgp_show_mpls_vpn_route (vty
, argv
[1], &prd
, 1);
778 DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes
,
779 show_ip_bgp_vpnv4_all_neighbor_routes_cmd
,
780 "show ip bgp vpnv4 all neighbors A.B.C.D routes",
784 "Display VPNv4 NLRI specific information\n"
785 "Display information about all VPNv4 NLRIs\n"
786 "Detailed information on TCP and BGP neighbor connections\n"
787 "Neighbor to display information about\n"
788 "Display routes learned from neighbor\n")
793 su
= sockunion_str2su (argv
[0]);
796 vty_out (vty
, "Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
800 peer
= peer_lookup_by_su (su
);
801 if (! peer
|| ! peer
->afc
[AFI_IP
][SAFI_MPLS_VPN
])
803 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
807 return bgp_show_mpls_vpn (vty
, NULL
, bgp_show_type_neighbor
, su
, 0);
810 DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes
,
811 show_ip_bgp_vpnv4_rd_neighbor_routes_cmd
,
812 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D routes",
816 "Display VPNv4 NLRI specific information\n"
817 "Display information for a route distinguisher\n"
818 "VPN Route Distinguisher\n"
819 "Detailed information on TCP and BGP neighbor connections\n"
820 "Neighbor to display information about\n"
821 "Display routes learned from neighbor\n")
826 struct prefix_rd prd
;
828 ret
= str2prefix_rd (argv
[0], &prd
);
831 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
835 su
= sockunion_str2su (argv
[1]);
838 vty_out (vty
, "Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
842 peer
= peer_lookup_by_su (su
);
843 if (! peer
|| ! peer
->afc
[AFI_IP
][SAFI_MPLS_VPN
])
845 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
849 return bgp_show_mpls_vpn (vty
, &prd
, bgp_show_type_neighbor
, su
, 0);
852 DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes
,
853 show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd
,
854 "show ip bgp vpnv4 all neighbors A.B.C.D advertised-routes",
858 "Display VPNv4 NLRI specific information\n"
859 "Display information about all VPNv4 NLRIs\n"
860 "Detailed information on TCP and BGP neighbor connections\n"
861 "Neighbor to display information about\n"
862 "Display the routes advertised to a BGP neighbor\n")
868 ret
= str2sockunion (argv
[0], &su
);
871 vty_out (vty
, "%% Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
874 peer
= peer_lookup_by_su (&su
);
875 if (! peer
|| ! peer
->afc
[AFI_IP
][SAFI_MPLS_VPN
])
877 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
881 return show_adj_route_vpn (vty
, peer
, NULL
);
884 DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes
,
885 show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd
,
886 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes",
890 "Display VPNv4 NLRI specific information\n"
891 "Display information for a route distinguisher\n"
892 "VPN Route Distinguisher\n"
893 "Detailed information on TCP and BGP neighbor connections\n"
894 "Neighbor to display information about\n"
895 "Display the routes advertised to a BGP neighbor\n")
899 struct prefix_rd prd
;
902 ret
= str2sockunion (argv
[1], &su
);
905 vty_out (vty
, "%% Malformed address: %s%s", argv
[0], VTY_NEWLINE
);
908 peer
= peer_lookup_by_su (&su
);
909 if (! peer
|| ! peer
->afc
[AFI_IP
][SAFI_MPLS_VPN
])
911 vty_out (vty
, "%% No such neighbor or address family%s", VTY_NEWLINE
);
915 ret
= str2prefix_rd (argv
[0], &prd
);
918 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
922 return show_adj_route_vpn (vty
, peer
, &prd
);
925 /* BGP_VPNV4_NODE. */
926 struct cmd_node bgp_vpnv4_node
=
929 "%s(config-router-af)# ",
936 install_node (&bgp_vpnv4_node
, NULL
);
937 install_default (BGP_VPNV4_NODE
);
939 install_element (BGP_NODE
, &address_family_vpnv4_cmd
);
940 install_element (BGP_NODE
, &address_family_vpnv4_unicast_cmd
);
941 install_element (BGP_VPNV4_NODE
, &vpnv4_activate_cmd
);
942 install_element (BGP_VPNV4_NODE
, &no_vpnv4_activate_cmd
);
943 install_element (BGP_VPNV4_NODE
, &exit_address_family_cmd
);
945 install_element (BGP_VPNV4_NODE
, &vpnv4_network_cmd
);
946 install_element (BGP_VPNV4_NODE
, &no_vpnv4_network_cmd
);
948 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_cmd
);
949 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
950 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
951 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_val_cmd
);
952 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_val2_cmd
);
954 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_cmd
);
955 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_cmd
);
957 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_cmd
);
958 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_type_cmd
);
959 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_cmd
);
960 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_type_cmd
);
962 install_element (BGP_VPNV4_NODE
, &neighbor_route_reflector_client_cmd
);
963 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
965 install_element (BGP_VPNV4_NODE
, &neighbor_route_server_client_cmd
);
966 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_server_client_cmd
);
968 install_element (BGP_VPNV4_NODE
, &neighbor_distribute_list_cmd
);
969 install_element (BGP_VPNV4_NODE
, &no_neighbor_distribute_list_cmd
);
970 install_element (BGP_VPNV4_NODE
, &neighbor_prefix_list_cmd
);
971 install_element (BGP_VPNV4_NODE
, &no_neighbor_prefix_list_cmd
);
972 install_element (BGP_VPNV4_NODE
, &neighbor_filter_list_cmd
);
973 install_element (BGP_VPNV4_NODE
, &no_neighbor_filter_list_cmd
);
974 install_element (BGP_VPNV4_NODE
, &neighbor_route_map_cmd
);
975 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_map_cmd
);
977 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_cmd
);
978 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_cmd
);
979 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
980 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
981 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
982 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
983 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_tags_cmd
);
984 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_tags_cmd
);
985 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_neighbor_routes_cmd
);
986 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_neighbor_routes_cmd
);
987 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd
);
988 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd
);
990 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_cmd
);
991 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_cmd
);
992 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_route_cmd
);
993 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_prefix_cmd
);
994 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_route_cmd
);
995 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_prefix_cmd
);
996 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_tags_cmd
);
997 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_tags_cmd
);
998 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_neighbor_routes_cmd
);
999 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_neighbor_routes_cmd
);
1000 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd
);
1001 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd
);