blob: 99e86b43d5bebadef5b76f65cd291d9ef4c73106 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/* MPLS-VPN
2 Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
3
4This file is part of GNU Zebra.
5
6GNU Zebra is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the
8Free Software Foundation; either version 2, or (at your option) any
9later version.
10
11GNU Zebra is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Zebra; see the file COPYING. If not, write to the Free
18Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1902111-1307, USA. */
20
21#include <zebra.h>
22
23#include "command.h"
24#include "prefix.h"
25#include "log.h"
26#include "memory.h"
27#include "stream.h"
Donald Sharp04907292016-01-07 10:03:01 -050028#include "filter.h"
paul718e3742002-12-13 20:15:29 +000029
30#include "bgpd/bgpd.h"
31#include "bgpd/bgp_table.h"
32#include "bgpd/bgp_route.h"
33#include "bgpd/bgp_attr.h"
34#include "bgpd/bgp_mplsvpn.h"
35
paul94f2b392005-06-28 12:44:16 +000036static u_int16_t
paul718e3742002-12-13 20:15:29 +000037decode_rd_type (u_char *pnt)
38{
39 u_int16_t v;
40
41 v = ((u_int16_t) *pnt++ << 8);
42 v |= (u_int16_t) *pnt;
43 return v;
44}
45
46u_int32_t
47decode_label (u_char *pnt)
48{
49 u_int32_t l;
50
51 l = ((u_int32_t) *pnt++ << 12);
52 l |= (u_int32_t) *pnt++ << 4;
53 l |= (u_int32_t) ((*pnt & 0xf0) >> 4);
54 return l;
55}
56
Lou Bergera03bd162016-01-12 13:41:54 -050057/* type == RD_TYPE_AS */
paul94f2b392005-06-28 12:44:16 +000058static void
paul718e3742002-12-13 20:15:29 +000059decode_rd_as (u_char *pnt, struct rd_as *rd_as)
60{
61 rd_as->as = (u_int16_t) *pnt++ << 8;
62 rd_as->as |= (u_int16_t) *pnt++;
63
64 rd_as->val = ((u_int32_t) *pnt++ << 24);
65 rd_as->val |= ((u_int32_t) *pnt++ << 16);
66 rd_as->val |= ((u_int32_t) *pnt++ << 8);
67 rd_as->val |= (u_int32_t) *pnt;
68}
69
Lou Bergera03bd162016-01-12 13:41:54 -050070/* type == RD_TYPE_AS4 */
71static void
72decode_rd_as4 (u_char *pnt, struct rd_as *rd_as)
73{
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++;
78
79 rd_as->val = ((u_int16_t) *pnt++ << 8);
80 rd_as->val |= (u_int16_t) *pnt;
81}
82
83/* type == RD_TYPE_IP */
paul94f2b392005-06-28 12:44:16 +000084static void
paul718e3742002-12-13 20:15:29 +000085decode_rd_ip (u_char *pnt, struct rd_ip *rd_ip)
86{
87 memcpy (&rd_ip->ip, pnt, 4);
88 pnt += 4;
89
90 rd_ip->val = ((u_int16_t) *pnt++ << 8);
91 rd_ip->val |= (u_int16_t) *pnt;
92}
93
paul718e3742002-12-13 20:15:29 +000094int
Lou Berger9da04bc2016-01-12 13:41:55 -050095bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
96 struct bgp_nlri *packet)
paul718e3742002-12-13 20:15:29 +000097{
98 u_char *pnt;
99 u_char *lim;
100 struct prefix p;
Lou Berger9da04bc2016-01-12 13:41:55 -0500101 int psize = 0;
paul718e3742002-12-13 20:15:29 +0000102 int prefixlen;
paul718e3742002-12-13 20:15:29 +0000103 u_int16_t type;
104 struct rd_as rd_as;
105 struct rd_ip rd_ip;
106 struct prefix_rd prd;
107 u_char *tagpnt;
108
109 /* Check peer status. */
110 if (peer->status != Established)
111 return 0;
112
113 /* Make prefix_rd */
114 prd.family = AF_UNSPEC;
115 prd.prefixlen = 64;
116
117 pnt = packet->nlri;
118 lim = pnt + packet->length;
119
Donald Sharpa3bc7e92016-01-27 16:54:45 +0000120#define VPN_PREFIXLEN_MIN_BYTES (3 + 8) /* label + RD */
paul718e3742002-12-13 20:15:29 +0000121 for (; pnt < lim; pnt += psize)
122 {
123 /* Clear prefix structure. */
124 memset (&p, 0, sizeof (struct prefix));
125
126 /* Fetch prefix length. */
127 prefixlen = *pnt++;
Donald Sharpa3bc7e92016-01-27 16:54:45 +0000128 p.family = afi2family (packet->afi);
paul718e3742002-12-13 20:15:29 +0000129 psize = PSIZE (prefixlen);
Donald Sharpa3bc7e92016-01-27 16:54:45 +0000130
131 /* sanity check against packet data */
132 if (prefixlen < VPN_PREFIXLEN_MIN_BYTES*8 || (pnt + psize) > lim)
133 {
134 zlog_err ("prefix length (%d) is less than 88"
135 " or larger than received (%u)",
136 prefixlen, (uint)(lim-pnt));
137 return -1;
138 }
139
140 /* sanity check against storage for the IP address portion */
141 if ((psize - VPN_PREFIXLEN_MIN_BYTES) > (ssize_t) sizeof(p.u))
142 {
143 zlog_err ("prefix length (%d) exceeds prefix storage (%zu)",
144 prefixlen - VPN_PREFIXLEN_MIN_BYTES*8, sizeof(p.u));
145 return -1;
146 }
147
148 /* Sanity check against max bitlen of the address family */
149 if ((psize - VPN_PREFIXLEN_MIN_BYTES) > prefix_blen (&p))
150 {
151 zlog_err ("prefix length (%d) exceeds family (%u) max byte length (%u)",
152 prefixlen - VPN_PREFIXLEN_MIN_BYTES*8,
153 p.family, prefix_blen (&p));
154 return -1;
155
156 }
157
paul718e3742002-12-13 20:15:29 +0000158 /* Copyr label to prefix. */
Donald Sharpa3bc7e92016-01-27 16:54:45 +0000159 tagpnt = pnt;
paul718e3742002-12-13 20:15:29 +0000160
161 /* Copy routing distinguisher to rd. */
162 memcpy (&prd.val, pnt + 3, 8);
163
164 /* Decode RD type. */
165 type = decode_rd_type (pnt + 3);
166
Lou Bergera03bd162016-01-12 13:41:54 -0500167 switch (type)
168 {
169 case RD_TYPE_AS:
170 decode_rd_as (pnt + 5, &rd_as);
171 break;
172
173 case RD_TYPE_AS4:
174 decode_rd_as4 (pnt + 5, &rd_as);
175 break;
176
177 case RD_TYPE_IP:
178 decode_rd_ip (pnt + 5, &rd_ip);
179 break;
180
Lou Berger050defe2016-01-12 13:41:59 -0500181 default:
182 zlog_err ("Unknown RD type %d", type);
183 break; /* just report */
184 }
paul718e3742002-12-13 20:15:29 +0000185
Donald Sharpa3bc7e92016-01-27 16:54:45 +0000186 p.prefixlen = prefixlen - VPN_PREFIXLEN_MIN_BYTES*8;
187 memcpy (&p.u.prefix, pnt + VPN_PREFIXLEN_MIN_BYTES,
188 psize - VPN_PREFIXLEN_MIN_BYTES);
paul718e3742002-12-13 20:15:29 +0000189
paul718e3742002-12-13 20:15:29 +0000190 if (attr)
Lou Berger9da04bc2016-01-12 13:41:55 -0500191 bgp_update (peer, &p, attr, packet->afi, SAFI_MPLS_VPN,
192 ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt, 0);
paul718e3742002-12-13 20:15:29 +0000193 else
Lou Berger9da04bc2016-01-12 13:41:55 -0500194 bgp_withdraw (peer, &p, attr, packet->afi, SAFI_MPLS_VPN,
195 ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt);
paul718e3742002-12-13 20:15:29 +0000196 }
paul718e3742002-12-13 20:15:29 +0000197 /* Packet length consistency check. */
198 if (pnt != lim)
199 return -1;
Donald Sharpa3bc7e92016-01-27 16:54:45 +0000200
paul718e3742002-12-13 20:15:29 +0000201 return 0;
Donald Sharpa3bc7e92016-01-27 16:54:45 +0000202#undef VPN_PREFIXLEN_MIN_BYTES
paul718e3742002-12-13 20:15:29 +0000203}
204
205int
paulfd79ac92004-10-13 05:06:08 +0000206str2prefix_rd (const char *str, struct prefix_rd *prd)
paul718e3742002-12-13 20:15:29 +0000207{
Lou Berger056f3762013-04-10 12:30:04 -0700208 int ret; /* ret of called functions */
209 int lret; /* local ret, of this func */
paul5228ad22004-06-04 17:58:18 +0000210 char *p;
211 char *p2;
Lou Berger056f3762013-04-10 12:30:04 -0700212 struct stream *s = NULL;
213 char *half = NULL;
paul718e3742002-12-13 20:15:29 +0000214 struct in_addr addr;
215
216 s = stream_new (8);
217
218 prd->family = AF_UNSPEC;
219 prd->prefixlen = 64;
220
Lou Berger056f3762013-04-10 12:30:04 -0700221 lret = 0;
paul718e3742002-12-13 20:15:29 +0000222 p = strchr (str, ':');
223 if (! p)
Lou Berger056f3762013-04-10 12:30:04 -0700224 goto out;
paul718e3742002-12-13 20:15:29 +0000225
226 if (! all_digit (p + 1))
Lou Berger056f3762013-04-10 12:30:04 -0700227 goto out;
paul718e3742002-12-13 20:15:29 +0000228
229 half = XMALLOC (MTYPE_TMP, (p - str) + 1);
230 memcpy (half, str, (p - str));
231 half[p - str] = '\0';
232
233 p2 = strchr (str, '.');
234
235 if (! p2)
236 {
237 if (! all_digit (half))
Lou Berger056f3762013-04-10 12:30:04 -0700238 goto out;
239
paul718e3742002-12-13 20:15:29 +0000240 stream_putw (s, RD_TYPE_AS);
241 stream_putw (s, atoi (half));
242 stream_putl (s, atol (p + 1));
243 }
244 else
245 {
246 ret = inet_aton (half, &addr);
247 if (! ret)
Lou Berger056f3762013-04-10 12:30:04 -0700248 goto out;
249
paul718e3742002-12-13 20:15:29 +0000250 stream_putw (s, RD_TYPE_IP);
251 stream_put_in_addr (s, &addr);
252 stream_putw (s, atol (p + 1));
253 }
254 memcpy (prd->val, s->data, 8);
Lou Berger056f3762013-04-10 12:30:04 -0700255 lret = 1;
paul718e3742002-12-13 20:15:29 +0000256
Lou Berger056f3762013-04-10 12:30:04 -0700257out:
258 if (s)
259 stream_free (s);
260 if (half)
261 XFREE(MTYPE_TMP, half);
262 return lret;
paul718e3742002-12-13 20:15:29 +0000263}
264
265int
paulfd79ac92004-10-13 05:06:08 +0000266str2tag (const char *str, u_char *tag)
paul718e3742002-12-13 20:15:29 +0000267{
paulfd79ac92004-10-13 05:06:08 +0000268 unsigned long l;
269 char *endptr;
270 u_int32_t t;
paul718e3742002-12-13 20:15:29 +0000271
Ulrich Weber664711c2011-12-21 02:24:11 +0400272 if (*str == '-')
273 return 0;
paulfd79ac92004-10-13 05:06:08 +0000274
Ulrich Weber664711c2011-12-21 02:24:11 +0400275 errno = 0;
276 l = strtoul (str, &endptr, 10);
277
278 if (*endptr != '\0' || errno || l > UINT32_MAX)
paulfd79ac92004-10-13 05:06:08 +0000279 return 0;
paul718e3742002-12-13 20:15:29 +0000280
paulfd79ac92004-10-13 05:06:08 +0000281 t = (u_int32_t) l;
282
283 tag[0] = (u_char)(t >> 12);
284 tag[1] = (u_char)(t >> 4);
285 tag[2] = (u_char)(t << 4);
paul718e3742002-12-13 20:15:29 +0000286
287 return 1;
288}
289
290char *
291prefix_rd2str (struct prefix_rd *prd, char *buf, size_t size)
292{
293 u_char *pnt;
294 u_int16_t type;
295 struct rd_as rd_as;
296 struct rd_ip rd_ip;
297
298 if (size < RD_ADDRSTRLEN)
299 return NULL;
300
301 pnt = prd->val;
302
303 type = decode_rd_type (pnt);
304
305 if (type == RD_TYPE_AS)
306 {
307 decode_rd_as (pnt + 2, &rd_as);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400308 snprintf (buf, size, "%u:%d", rd_as.as, rd_as.val);
paul718e3742002-12-13 20:15:29 +0000309 return buf;
310 }
Lou Bergera03bd162016-01-12 13:41:54 -0500311 else if (type == RD_TYPE_AS4)
312 {
313 decode_rd_as4 (pnt + 2, &rd_as);
314 snprintf (buf, size, "%u:%d", rd_as.as, rd_as.val);
315 return buf;
316 }
paul718e3742002-12-13 20:15:29 +0000317 else if (type == RD_TYPE_IP)
318 {
319 decode_rd_ip (pnt + 2, &rd_ip);
320 snprintf (buf, size, "%s:%d", inet_ntoa (rd_ip.ip), rd_ip.val);
321 return buf;
322 }
paul718e3742002-12-13 20:15:29 +0000323 return NULL;
324}
325
326/* For testing purpose, static route of MPLS-VPN. */
327DEFUN (vpnv4_network,
328 vpnv4_network_cmd,
329 "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD",
330 "Specify a network to announce via BGP\n"
331 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
332 "Specify Route Distinguisher\n"
333 "VPN Route Distinguisher\n"
334 "BGP tag\n"
335 "tag value\n")
336{
Lou Bergera76d9ca2016-01-12 13:41:53 -0500337 return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[0], argv[1], argv[2], NULL);
338}
339
340DEFUN (vpnv4_network_route_map,
341 vpnv4_network_route_map_cmd,
342 "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD route-map WORD",
343 "Specify a network to announce via BGP\n"
344 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
345 "Specify Route Distinguisher\n"
346 "VPN Route Distinguisher\n"
347 "BGP tag\n"
348 "tag value\n"
349 "route map\n"
350 "route map name\n")
351{
352 return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[0], argv[1], argv[2], argv[3]);
paul718e3742002-12-13 20:15:29 +0000353}
354
355/* For testing purpose, static route of MPLS-VPN. */
356DEFUN (no_vpnv4_network,
357 no_vpnv4_network_cmd,
358 "no network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD",
359 NO_STR
360 "Specify a network to announce via BGP\n"
361 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
362 "Specify Route Distinguisher\n"
363 "VPN Route Distinguisher\n"
364 "BGP tag\n"
365 "tag value\n")
366{
Lou Bergera76d9ca2016-01-12 13:41:53 -0500367 return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[0], argv[1], argv[2]);
paul718e3742002-12-13 20:15:29 +0000368}
369
paul94f2b392005-06-28 12:44:16 +0000370static int
paul718e3742002-12-13 20:15:29 +0000371show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd)
372{
373 struct bgp *bgp;
374 struct bgp_table *table;
375 struct bgp_node *rn;
376 struct bgp_node *rm;
377 struct attr *attr;
378 int rd_header;
379 int header = 1;
380 char v4_header[] = " Network Next Hop Metric LocPrf Weight Path%s";
381
382 bgp = bgp_get_default ();
383 if (bgp == NULL)
384 {
385 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
386 return CMD_WARNING;
387 }
388
389 for (rn = bgp_table_top (bgp->rib[AFI_IP][SAFI_MPLS_VPN]); rn;
390 rn = bgp_route_next (rn))
391 {
392 if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
393 continue;
394
395 if ((table = rn->info) != NULL)
396 {
397 rd_header = 1;
398
399 for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm))
400 if ((attr = rm->info) != NULL)
401 {
402 if (header)
403 {
404 vty_out (vty, "BGP table version is 0, local router ID is %s%s",
405 inet_ntoa (bgp->router_id), VTY_NEWLINE);
406 vty_out (vty, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s",
407 VTY_NEWLINE);
408 vty_out (vty, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s",
409 VTY_NEWLINE, VTY_NEWLINE);
410 vty_out (vty, v4_header, VTY_NEWLINE);
411 header = 0;
412 }
413
414 if (rd_header)
415 {
416 u_int16_t type;
417 struct rd_as rd_as;
418 struct rd_ip rd_ip;
419 u_char *pnt;
420
421 pnt = rn->p.u.val;
422
423 /* Decode RD type. */
424 type = decode_rd_type (pnt);
425 /* Decode RD value. */
426 if (type == RD_TYPE_AS)
427 decode_rd_as (pnt + 2, &rd_as);
Lou Bergera03bd162016-01-12 13:41:54 -0500428 else if (type == RD_TYPE_AS4)
429 decode_rd_as4 (pnt + 2, &rd_as);
paul718e3742002-12-13 20:15:29 +0000430 else if (type == RD_TYPE_IP)
431 decode_rd_ip (pnt + 2, &rd_ip);
432
433 vty_out (vty, "Route Distinguisher: ");
434
435 if (type == RD_TYPE_AS)
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400436 vty_out (vty, "%u:%d", rd_as.as, rd_as.val);
Lou Bergera03bd162016-01-12 13:41:54 -0500437 else if (type == RD_TYPE_AS4)
438 vty_out (vty, "%u:%d", rd_as.as, rd_as.val);
paul718e3742002-12-13 20:15:29 +0000439 else if (type == RD_TYPE_IP)
440 vty_out (vty, "%s:%d", inet_ntoa (rd_ip.ip), rd_ip.val);
441
442 vty_out (vty, "%s", VTY_NEWLINE);
443 rd_header = 0;
444 }
445 route_vty_out_tmp (vty, &rm->p, attr, SAFI_MPLS_VPN);
446 }
447 }
448 }
449 return CMD_SUCCESS;
450}
451
452enum bgp_show_type
453{
454 bgp_show_type_normal,
455 bgp_show_type_regexp,
456 bgp_show_type_prefix_list,
457 bgp_show_type_filter_list,
458 bgp_show_type_neighbor,
459 bgp_show_type_cidr_only,
460 bgp_show_type_prefix_longer,
461 bgp_show_type_community_all,
462 bgp_show_type_community,
463 bgp_show_type_community_exact,
464 bgp_show_type_community_list,
465 bgp_show_type_community_list_exact
466};
467
paul94f2b392005-06-28 12:44:16 +0000468static int
Lou Berger35c36862016-01-12 13:42:06 -0500469bgp_show_mpls_vpn(
470 struct vty *vty,
471 afi_t afi,
472 struct prefix_rd *prd,
473 enum bgp_show_type type,
474 void *output_arg,
475 int tags)
paul718e3742002-12-13 20:15:29 +0000476{
477 struct bgp *bgp;
478 struct bgp_table *table;
479 struct bgp_node *rn;
480 struct bgp_node *rm;
481 struct bgp_info *ri;
482 int rd_header;
483 int header = 1;
484 char v4_header[] = " Network Next Hop Metric LocPrf Weight Path%s";
485 char v4_header_tag[] = " Network Next Hop In tag/Out tag%s";
486
Lou Bergerbf1ae6c2016-01-12 13:42:08 -0500487 unsigned long output_count = 0;
488 unsigned long total_count = 0;
489
paul718e3742002-12-13 20:15:29 +0000490 bgp = bgp_get_default ();
491 if (bgp == NULL)
492 {
493 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
494 return CMD_WARNING;
495 }
496
Lou Berger9da04bc2016-01-12 13:41:55 -0500497 if ((afi != AFI_IP) && (afi != AFI_IP6))
498 {
499 vty_out (vty, "Afi %d not supported%s", afi, VTY_NEWLINE);
500 return CMD_WARNING;
501 }
502
503 for (rn = bgp_table_top (bgp->rib[afi][SAFI_MPLS_VPN]); rn; rn = bgp_route_next (rn))
paul718e3742002-12-13 20:15:29 +0000504 {
505 if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
506 continue;
507
508 if ((table = rn->info) != NULL)
509 {
510 rd_header = 1;
511
512 for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm))
513 for (ri = rm->info; ri; ri = ri->next)
514 {
Lou Bergerbf1ae6c2016-01-12 13:42:08 -0500515 total_count++;
paul718e3742002-12-13 20:15:29 +0000516 if (type == bgp_show_type_neighbor)
517 {
518 union sockunion *su = output_arg;
519
520 if (ri->peer->su_remote == NULL || ! sockunion_same(ri->peer->su_remote, su))
521 continue;
522 }
523 if (header)
524 {
525 if (tags)
526 vty_out (vty, v4_header_tag, VTY_NEWLINE);
527 else
528 {
529 vty_out (vty, "BGP table version is 0, local router ID is %s%s",
530 inet_ntoa (bgp->router_id), VTY_NEWLINE);
531 vty_out (vty, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s",
532 VTY_NEWLINE);
533 vty_out (vty, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s",
534 VTY_NEWLINE, VTY_NEWLINE);
535 vty_out (vty, v4_header, VTY_NEWLINE);
536 }
537 header = 0;
538 }
539
540 if (rd_header)
541 {
542 u_int16_t type;
543 struct rd_as rd_as;
544 struct rd_ip rd_ip;
545 u_char *pnt;
546
547 pnt = rn->p.u.val;
548
549 /* Decode RD type. */
550 type = decode_rd_type (pnt);
551 /* Decode RD value. */
552 if (type == RD_TYPE_AS)
553 decode_rd_as (pnt + 2, &rd_as);
Lou Bergera03bd162016-01-12 13:41:54 -0500554 else if (type == RD_TYPE_AS4)
555 decode_rd_as4 (pnt + 2, &rd_as);
paul718e3742002-12-13 20:15:29 +0000556 else if (type == RD_TYPE_IP)
557 decode_rd_ip (pnt + 2, &rd_ip);
558
559 vty_out (vty, "Route Distinguisher: ");
560
561 if (type == RD_TYPE_AS)
Lou Bergera03bd162016-01-12 13:41:54 -0500562 vty_out (vty, "as2 %u:%d", rd_as.as, rd_as.val);
563 else if (type == RD_TYPE_AS4)
564 vty_out (vty, "as4 %u:%d", rd_as.as, rd_as.val);
paul718e3742002-12-13 20:15:29 +0000565 else if (type == RD_TYPE_IP)
Lou Bergera03bd162016-01-12 13:41:54 -0500566 vty_out (vty, "ip %s:%d", inet_ntoa (rd_ip.ip), rd_ip.val);
paul718e3742002-12-13 20:15:29 +0000567
568 vty_out (vty, "%s", VTY_NEWLINE);
569 rd_header = 0;
570 }
571 if (tags)
572 route_vty_out_tag (vty, &rm->p, ri, 0, SAFI_MPLS_VPN);
573 else
574 route_vty_out (vty, &rm->p, ri, 0, SAFI_MPLS_VPN);
Lou Bergerbf1ae6c2016-01-12 13:42:08 -0500575 output_count++;
paul718e3742002-12-13 20:15:29 +0000576 }
577 }
578 }
Lou Bergerbf1ae6c2016-01-12 13:42:08 -0500579
580 if (output_count == 0)
581 {
582 vty_out (vty, "No prefixes displayed, %ld exist%s", total_count, VTY_NEWLINE);
583 }
584 else
585 vty_out (vty, "%sDisplayed %ld out of %ld total prefixes%s",
586 VTY_NEWLINE, output_count, total_count, VTY_NEWLINE);
587
paul718e3742002-12-13 20:15:29 +0000588 return CMD_SUCCESS;
589}
590
Lou Berger35c36862016-01-12 13:42:06 -0500591DEFUN (show_bgp_ipv4_vpn,
592 show_bgp_ipv4_vpn_cmd,
593 "show bgp ipv4 vpn",
paul718e3742002-12-13 20:15:29 +0000594 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000595 BGP_STR
Lou Berger35c36862016-01-12 13:42:06 -0500596 "Address Family\n"
597 "Display VPN NLRI specific information\n")
paul718e3742002-12-13 20:15:29 +0000598{
Lou Berger35c36862016-01-12 13:42:06 -0500599 return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0);
paul718e3742002-12-13 20:15:29 +0000600}
601
Lou Berger35c36862016-01-12 13:42:06 -0500602#ifdef HAVE_IPV6
603DEFUN (show_bgp_ipv6_vpn,
604 show_bgp_ipv6_vpn_cmd,
605 "show bgp ipv6 vpn",
paul718e3742002-12-13 20:15:29 +0000606 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000607 BGP_STR
Lou Berger35c36862016-01-12 13:42:06 -0500608 "Address Family\n"
609 "Display VPN NLRI specific information\n")
610{
611 return bgp_show_mpls_vpn (vty, AFI_IP6, NULL, bgp_show_type_normal, NULL, 0);
612}
613#endif
614
615DEFUN (show_bgp_ipv4_vpn_rd,
616 show_bgp_ipv4_vpn_rd_cmd,
617 "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn",
618 SHOW_STR
619 BGP_STR
620 "Address Family\n"
621 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +0000622 "Display information for a route distinguisher\n"
623 "VPN Route Distinguisher\n")
624{
625 int ret;
626 struct prefix_rd prd;
627
628 ret = str2prefix_rd (argv[0], &prd);
629 if (! ret)
630 {
631 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
632 return CMD_WARNING;
633 }
Lou Berger35c36862016-01-12 13:42:06 -0500634 return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0);
paul718e3742002-12-13 20:15:29 +0000635}
636
Lou Berger35c36862016-01-12 13:42:06 -0500637DEFUN (show_bgp_ipv6_vpn_rd,
638 show_bgp_ipv6_vpn_rd_cmd,
639 "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn",
paul718e3742002-12-13 20:15:29 +0000640 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000641 BGP_STR
Lou Berger35c36862016-01-12 13:42:06 -0500642 "Address Family\n"
643 "Display VPN NLRI specific information\n"
644 "Display information for a route distinguisher\n"
645 "VPN Route Distinguisher\n")
646{
647 int ret;
648 struct prefix_rd prd;
649
650 ret = str2prefix_rd (argv[0], &prd);
651 if (! ret)
652 {
653 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
654 return CMD_WARNING;
655 }
656 return bgp_show_mpls_vpn (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 0);
657}
658
659
660DEFUN (show_bgp_ipv4_vpn_tags,
661 show_bgp_ipv4_vpn_tags_cmd,
662 "show bgp ipv4 vpn tags",
663 SHOW_STR
664 BGP_STR
665 "Address Family\n"
666 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +0000667 "Display BGP tags for prefixes\n")
668{
Lou Berger35c36862016-01-12 13:42:06 -0500669 return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 1);
670}
671DEFUN (show_bgp_ipv6_vpn_tags,
672 show_bgp_ipv6_vpn_tags_cmd,
673 "show bgp ipv6 vpn tags",
674 SHOW_STR
675 BGP_STR
676 "Address Family\n"
677 "Display VPN NLRI specific information\n"
678 "Display BGP tags for prefixes\n")
679{
680 return bgp_show_mpls_vpn (vty, AFI_IP6, NULL, bgp_show_type_normal, NULL, 1);
paul718e3742002-12-13 20:15:29 +0000681}
682
Lou Berger35c36862016-01-12 13:42:06 -0500683DEFUN (show_bgp_ipv4_vpn_rd_tags,
684 show_bgp_ipv4_vpn_rd_tags_cmd,
685 "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn tags",
paul718e3742002-12-13 20:15:29 +0000686 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000687 BGP_STR
Lou Berger35c36862016-01-12 13:42:06 -0500688 "Address Family\n"
689 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +0000690 "Display information for a route distinguisher\n"
691 "VPN Route Distinguisher\n"
692 "Display BGP tags for prefixes\n")
693{
694 int ret;
695 struct prefix_rd prd;
696
697 ret = str2prefix_rd (argv[0], &prd);
698 if (! ret)
699 {
700 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
701 return CMD_WARNING;
702 }
Lou Berger35c36862016-01-12 13:42:06 -0500703 return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 1);
704}
705DEFUN (show_bgp_ipv6_vpn_rd_tags,
706 show_bgp_ipv6_vpn_rd_tags_cmd,
707 "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn tags",
708 SHOW_STR
709 BGP_STR
710 "Address Family\n"
711 "Display VPN NLRI specific information\n"
712 "Display information for a route distinguisher\n"
713 "VPN Route Distinguisher\n"
714 "Display BGP tags for prefixes\n")
715{
716 int ret;
717 struct prefix_rd prd;
718
719 ret = str2prefix_rd (argv[0], &prd);
720 if (! ret)
721 {
722 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
723 return CMD_WARNING;
724 }
725 return bgp_show_mpls_vpn (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 1);
paul718e3742002-12-13 20:15:29 +0000726}
727
Lou Berger35c36862016-01-12 13:42:06 -0500728DEFUN (show_bgp_ipv4_vpn_neighbor_routes,
729 show_bgp_ipv4_vpn_neighbor_routes_cmd,
730 "show bgp ipv4 vpn neighbors (A.B.C.D|X:X::X:X) routes",
paul718e3742002-12-13 20:15:29 +0000731 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000732 BGP_STR
Lou Berger35c36862016-01-12 13:42:06 -0500733 "Address Family\n"
734 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +0000735 "Detailed information on TCP and BGP neighbor connections\n"
736 "Neighbor to display information about\n"
Lou Berger35c36862016-01-12 13:42:06 -0500737 "Neighbor to display information about\n"
paul718e3742002-12-13 20:15:29 +0000738 "Display routes learned from neighbor\n")
739{
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +0200740 union sockunion su;
paul718e3742002-12-13 20:15:29 +0000741 struct peer *peer;
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +0200742 int ret;
743
744 ret = str2sockunion (argv[0], &su);
745 if (ret < 0)
paul718e3742002-12-13 20:15:29 +0000746 {
747 vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +0200748 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000749 }
750
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +0200751 peer = peer_lookup (NULL, &su);
paul718e3742002-12-13 20:15:29 +0000752 if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
753 {
754 vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
755 return CMD_WARNING;
756 }
757
Lou Berger35c36862016-01-12 13:42:06 -0500758 return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_neighbor, &su, 0);
paul718e3742002-12-13 20:15:29 +0000759}
760
Lou Berger35c36862016-01-12 13:42:06 -0500761#ifdef HAVE_IPV6
762DEFUN (show_bgp_ipv6_vpn_neighbor_routes,
763 show_bgp_ipv6_vpn_neighbor_routes_cmd,
764 "show bgp ipv6 vpn neighbors (A.B.C.D|X:X::X:X) routes",
paul718e3742002-12-13 20:15:29 +0000765 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000766 BGP_STR
Lou Berger35c36862016-01-12 13:42:06 -0500767 "Address Family\n"
768 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +0000769 "Detailed information on TCP and BGP neighbor connections\n"
770 "Neighbor to display information about\n"
Lou Berger35c36862016-01-12 13:42:06 -0500771 "Neighbor to display information about\n"
paul718e3742002-12-13 20:15:29 +0000772 "Display routes learned from neighbor\n")
773{
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +0200774 union sockunion su;
paul718e3742002-12-13 20:15:29 +0000775 struct peer *peer;
paul718e3742002-12-13 20:15:29 +0000776
Lou Berger35c36862016-01-12 13:42:06 -0500777 int ret;
paul718e3742002-12-13 20:15:29 +0000778
Lou Berger35c36862016-01-12 13:42:06 -0500779 ret = str2sockunion (argv[0], &su);
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +0200780 if (ret < 0)
paul718e3742002-12-13 20:15:29 +0000781 {
782 vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +0200783 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000784 }
785
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +0200786 peer = peer_lookup (NULL, &su);
Lou Berger35c36862016-01-12 13:42:06 -0500787 if (! peer || ! peer->afc[AFI_IP6][SAFI_MPLS_VPN])
paul718e3742002-12-13 20:15:29 +0000788 {
789 vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
790 return CMD_WARNING;
791 }
792
Lou Berger35c36862016-01-12 13:42:06 -0500793 return bgp_show_mpls_vpn (vty, AFI_IP6, NULL, bgp_show_type_neighbor, &su, 0);
paul718e3742002-12-13 20:15:29 +0000794}
Lou Berger35c36862016-01-12 13:42:06 -0500795#endif
paul718e3742002-12-13 20:15:29 +0000796
Lou Berger35c36862016-01-12 13:42:06 -0500797DEFUN (show_bgp_ipv4_vpn_neighbor_advertised_routes,
798 show_bgp_ipv4_vpn_neighbor_advertised_routes_cmd,
799 "show bgp ipv4 vpn neighbors (A.B.C.D|X:X::X:X) advertised-routes",
paul718e3742002-12-13 20:15:29 +0000800 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000801 BGP_STR
Lou Berger35c36862016-01-12 13:42:06 -0500802 "Address Family\n"
803 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +0000804 "Detailed information on TCP and BGP neighbor connections\n"
805 "Neighbor to display information about\n"
806 "Display the routes advertised to a BGP neighbor\n")
807{
808 int ret;
809 struct peer *peer;
810 union sockunion su;
811
812 ret = str2sockunion (argv[0], &su);
813 if (ret < 0)
814 {
815 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
816 return CMD_WARNING;
817 }
818 peer = peer_lookup (NULL, &su);
819 if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
820 {
821 vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
822 return CMD_WARNING;
823 }
824
825 return show_adj_route_vpn (vty, peer, NULL);
826}
Lou Berger35c36862016-01-12 13:42:06 -0500827DEFUN (show_bgp_ipv6_vpn_neighbor_advertised_routes,
828 show_bgp_ipv6_vpn_neighbor_advertised_routes_cmd,
829 "show bgp ipv6 vpn neighbors (A.B.C.D|X:X::X:X) advertised-routes",
830 SHOW_STR
831 BGP_STR
832 "Address Family\n"
833 "Display VPN NLRI specific information\n"
834 "Detailed information on TCP and BGP neighbor connections\n"
835 "Neighbor to display information about\n"
836 "Display the routes advertised to a BGP neighbor\n")
837{
838 int ret;
839 struct peer *peer;
840 union sockunion su;
841
842 ret = str2sockunion (argv[0], &su);
843 if (ret < 0)
844 {
845 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
846 return CMD_WARNING;
847 }
848 peer = peer_lookup (NULL, &su);
849 if (! peer || ! peer->afc[AFI_IP6][SAFI_MPLS_VPN])
850 {
851 vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
852 return CMD_WARNING;
853 }
854
855 return show_adj_route_vpn (vty, peer, NULL);
856}
paul718e3742002-12-13 20:15:29 +0000857
858DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
Lou Berger35c36862016-01-12 13:42:06 -0500859 show_bgp_ipv4_vpn_rd_neighbor_advertised_routes_cmd,
860 "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) advertised-routes",
paul718e3742002-12-13 20:15:29 +0000861 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000862 BGP_STR
Lou Berger35c36862016-01-12 13:42:06 -0500863 "Address Family\n"
864 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +0000865 "Display information for a route distinguisher\n"
866 "VPN Route Distinguisher\n"
867 "Detailed information on TCP and BGP neighbor connections\n"
868 "Neighbor to display information about\n"
Lou Berger35c36862016-01-12 13:42:06 -0500869 "Neighbor to display information about\n"
paul718e3742002-12-13 20:15:29 +0000870 "Display the routes advertised to a BGP neighbor\n")
871{
872 int ret;
873 struct peer *peer;
874 struct prefix_rd prd;
875 union sockunion su;
paul718e3742002-12-13 20:15:29 +0000876 ret = str2sockunion (argv[1], &su);
877 if (ret < 0)
878 {
Lou Berger35c36862016-01-12 13:42:06 -0500879 vty_out (vty, "%% Malformed address: %s%s", argv[1], VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000880 return CMD_WARNING;
881 }
882 peer = peer_lookup (NULL, &su);
883 if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
884 {
885 vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
886 return CMD_WARNING;
887 }
888
889 ret = str2prefix_rd (argv[0], &prd);
890 if (! ret)
891 {
892 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
893 return CMD_WARNING;
894 }
895
896 return show_adj_route_vpn (vty, peer, &prd);
897}
Lou Berger35c36862016-01-12 13:42:06 -0500898DEFUN (show_ip_bgp_vpnv6_rd_neighbor_advertised_routes,
899 show_bgp_ipv6_vpn_rd_neighbor_advertised_routes_cmd,
900 "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) advertised-routes",
901 SHOW_STR
902 BGP_STR
903 "Address Family\n"
904 "Display VPN NLRI specific information\n"
905 "Display information for a route distinguisher\n"
906 "VPN Route Distinguisher\n"
907 "Detailed information on TCP and BGP neighbor connections\n"
908 "Neighbor to display information about\n"
909 "Neighbor to display information about\n"
910 "Display the routes advertised to a BGP neighbor\n")
911{
912 int ret;
913 struct peer *peer;
914 struct prefix_rd prd;
915 union sockunion su;
916 ret = str2sockunion (argv[1], &su);
917 if (ret < 0)
918 {
919 vty_out (vty, "%% Malformed address: %s%s", argv[1], VTY_NEWLINE);
920 return CMD_WARNING;
921 }
922 peer = peer_lookup (NULL, &su);
923 if (! peer || ! peer->afc[AFI_IP6][SAFI_MPLS_VPN])
924 {
925 vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
926 return CMD_WARNING;
927 }
928
929 ret = str2prefix_rd (argv[0], &prd);
930 if (! ret)
931 {
932 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
933 return CMD_WARNING;
934 }
935
936 return show_adj_route_vpn (vty, peer, &prd);
937}
938
939DEFUN (show_bgp_ipv4_vpn_rd_neighbor_routes,
940 show_bgp_ipv4_vpn_rd_neighbor_routes_cmd,
941 "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) routes",
942 SHOW_STR
943 BGP_STR
944 "Address Family\n"
945 "Address Family modifier\n"
946 "Display information for a route distinguisher\n"
947 "VPN Route Distinguisher\n"
948 "Detailed information on TCP and BGP neighbor connections\n"
949 "Neighbor to display information about\n"
950 "Display routes learned from neighbor\n")
951{
952 int ret;
953 union sockunion *su;
954 struct peer *peer;
955 struct prefix_rd prd;
956
957 ret = str2prefix_rd (argv[0], &prd);
958 if (! ret)
959 {
960 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
961 return CMD_WARNING;
962 }
963
964 su = sockunion_str2su (argv[1]);
965 if (su == NULL)
966 {
967 vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE);
968 return CMD_WARNING;
969 }
970
971 peer = peer_lookup (NULL, su);
972 if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
973 {
974 vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
975 return CMD_WARNING;
976 }
977
978 return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_neighbor, su, 0);
979}
980DEFUN (show_bgp_ipv6_vpn_rd_neighbor_routes,
981 show_bgp_ipv6_vpn_rd_neighbor_routes_cmd,
982 "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) routes",
983 SHOW_STR
984 BGP_STR
985 "Address Family\n"
986 "Address Family modifier\n"
987 "Display information for a route distinguisher\n"
988 "VPN Route Distinguisher\n"
989 "Detailed information on TCP and BGP neighbor connections\n"
990 "Neighbor to display information about\n"
991 "Display routes learned from neighbor\n")
992{
993 int ret;
994 union sockunion *su;
995 struct peer *peer;
996 struct prefix_rd prd;
997
998 ret = str2prefix_rd (argv[0], &prd);
999 if (! ret)
1000 {
1001 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
1002 return CMD_WARNING;
1003 }
1004
1005 su = sockunion_str2su (argv[1]);
1006 if (su == NULL)
1007 {
1008 vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE);
1009 return CMD_WARNING;
1010 }
1011
1012 peer = peer_lookup (NULL, su);
1013 if (! peer || ! peer->afc[AFI_IP6][SAFI_MPLS_VPN])
1014 {
1015 vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
1016 return CMD_WARNING;
1017 }
1018
1019 return bgp_show_mpls_vpn (vty, AFI_IP6, &prd, bgp_show_type_neighbor, su, 0);
1020}
paul718e3742002-12-13 20:15:29 +00001021
1022void
paul94f2b392005-06-28 12:44:16 +00001023bgp_mplsvpn_init (void)
paul718e3742002-12-13 20:15:29 +00001024{
1025 install_element (BGP_VPNV4_NODE, &vpnv4_network_cmd);
Lou Bergera76d9ca2016-01-12 13:41:53 -05001026 install_element (BGP_VPNV4_NODE, &vpnv4_network_route_map_cmd);
paul718e3742002-12-13 20:15:29 +00001027 install_element (BGP_VPNV4_NODE, &no_vpnv4_network_cmd);
1028
Lou Berger35c36862016-01-12 13:42:06 -05001029 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_cmd);
1030 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_cmd);
1031 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_tags_cmd);
1032 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_tags_cmd);
1033 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_neighbor_routes_cmd);
1034 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_neighbor_advertised_routes_cmd);
1035 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_neighbor_advertised_routes_cmd);
1036 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_neighbor_routes_cmd);
paul718e3742002-12-13 20:15:29 +00001037
Lou Berger35c36862016-01-12 13:42:06 -05001038#ifdef HAVE_IPV6
1039 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_cmd);
1040 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_cmd);
1041 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_tags_cmd);
1042 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_tags_cmd);
1043 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_neighbor_routes_cmd);
1044 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_neighbor_advertised_routes_cmd);
1045 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_neighbor_advertised_routes_cmd);
1046 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_neighbor_routes_cmd);
1047#endif
paul718e3742002-12-13 20:15:29 +00001048
Lou Berger35c36862016-01-12 13:42:06 -05001049 install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_cmd);
1050 install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_rd_cmd);
1051 install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_tags_cmd);
1052 install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_rd_tags_cmd);
1053 install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_neighbor_routes_cmd);
1054 install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_neighbor_advertised_routes_cmd);
1055 install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_rd_neighbor_advertised_routes_cmd);
1056 install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_rd_neighbor_routes_cmd);
1057
1058#ifdef HAVE_IPV6
1059 install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_cmd);
1060 install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_rd_cmd);
1061 install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_tags_cmd);
1062 install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_rd_tags_cmd);
1063 install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_neighbor_routes_cmd);
1064 install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_neighbor_advertised_routes_cmd);
1065 install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_rd_neighbor_advertised_routes_cmd);
1066 install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_rd_neighbor_routes_cmd);
1067#endif
paul718e3742002-12-13 20:15:29 +00001068}