blob: c73896b3bafce6a376532503244544150e43dee0 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/* Zebra VTY functions
2 * Copyright (C) 2002 Kunihiro Ishiguro
3 *
4 * This file is part of GNU Zebra.
5 *
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
9 * later version.
10 *
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.
15 *
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
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
22#include <zebra.h>
23
Paul Jakma7514fb72007-05-02 16:05:35 +000024#include "memory.h"
paul718e3742002-12-13 20:15:29 +000025#include "if.h"
26#include "prefix.h"
27#include "command.h"
28#include "table.h"
29#include "rib.h"
Feng Lu41f44a22015-05-22 11:39:56 +020030#include "vrf.h"
Pradosh Mohapatra60cc9592015-11-09 20:21:41 -050031#include "nexthop.h"
paul718e3742002-12-13 20:15:29 +000032
paula1ac18c2005-06-28 17:17:12 +000033#include "zebra/zserv.h"
Pradosh Mohapatra60cc9592015-11-09 20:21:41 -050034#include "zebra/zebra_rnh.h"
paula1ac18c2005-06-28 17:17:12 +000035
Feng Lu4364ee52015-05-22 11:40:03 +020036static int do_show_ip_route(struct vty *vty, safi_t safi, vrf_id_t vrf_id);
David Lamparter3b02fe82015-01-22 19:12:35 +010037static void vty_show_ip_route_detail (struct vty *vty, struct route_node *rn,
38 int mcast);
Feng Lu4364ee52015-05-22 11:40:03 +020039static void vty_show_ip_route (struct vty *vty, struct route_node *rn,
40 struct rib *rib);
Everton Marques33d86db2014-07-14 11:19:00 -030041
42/* General function for static route. */
paula1ac18c2005-06-28 17:17:12 +000043static int
Everton Marques33d86db2014-07-14 11:19:00 -030044zebra_static_ipv4_safi (struct vty *vty, safi_t safi, int add_cmd,
45 const char *dest_str, const char *mask_str,
46 const char *gate_str, const char *flag_str,
Piotr Chytłade24f822007-06-28 00:09:28 +020047 const char *tag_str, const char *distance_str,
48 const char *vrf_id_str)
paul718e3742002-12-13 20:15:29 +000049{
50 int ret;
51 u_char distance;
52 struct prefix p;
53 struct in_addr gate;
54 struct in_addr mask;
hasso39db97e2004-10-12 20:50:58 +000055 const char *ifname;
hasso81dfcaa2003-05-25 19:21:25 +000056 u_char flag = 0;
Paul Jakma96d10602016-07-01 14:23:45 +010057 route_tag_t tag = 0;
Feng Lu7aaf4ea2015-05-22 11:40:06 +020058 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +000059
60 ret = str2prefix (dest_str, &p);
61 if (ret <= 0)
62 {
63 vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
64 return CMD_WARNING;
65 }
66
67 /* Cisco like mask notation. */
68 if (mask_str)
69 {
70 ret = inet_aton (mask_str, &mask);
71 if (ret == 0)
paul595db7f2003-05-25 21:35:06 +000072 {
73 vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
74 return CMD_WARNING;
75 }
paul718e3742002-12-13 20:15:29 +000076 p.prefixlen = ip_masklen (mask);
77 }
78
79 /* Apply mask for given prefix. */
80 apply_mask (&p);
81
paul595db7f2003-05-25 21:35:06 +000082 /* Administrative distance. */
83 if (distance_str)
84 distance = atoi (distance_str);
85 else
86 distance = ZEBRA_STATIC_DISTANCE_DEFAULT;
87
Piotr Chytłade24f822007-06-28 00:09:28 +020088 /* tag */
89 if (tag_str)
90 tag = atoi (tag_str);
91
Feng Lu7aaf4ea2015-05-22 11:40:06 +020092 /* VRF id */
93 if (vrf_id_str)
94 VTY_GET_INTEGER ("VRF ID", vrf_id, vrf_id_str);
95
Piotr Chytłafb214472015-12-01 13:47:06 -050096 /* tag */
97 if (tag_str)
98 tag = atoi(tag_str);
99
paul595db7f2003-05-25 21:35:06 +0000100 /* Null0 static route. */
hasso457ef552003-05-28 12:02:15 +0000101 if ((gate_str != NULL) && (strncasecmp (gate_str, "Null0", strlen (gate_str)) == 0))
paul595db7f2003-05-25 21:35:06 +0000102 {
103 if (flag_str)
104 {
105 vty_out (vty, "%% can not have flag %s with Null0%s", flag_str, VTY_NEWLINE);
106 return CMD_WARNING;
107 }
108 if (add_cmd)
Piotr Chytłade24f822007-06-28 00:09:28 +0200109 static_add_ipv4_safi (safi, &p, NULL, NULL, ZEBRA_FLAG_BLACKHOLE, tag, distance, vrf_id);
paul595db7f2003-05-25 21:35:06 +0000110 else
Piotr Chytłade24f822007-06-28 00:09:28 +0200111 static_delete_ipv4_safi (safi, &p, NULL, NULL, tag, distance, vrf_id);
paul595db7f2003-05-25 21:35:06 +0000112 return CMD_SUCCESS;
113 }
114
hasso81dfcaa2003-05-25 19:21:25 +0000115 /* Route flags */
116 if (flag_str) {
117 switch(flag_str[0]) {
118 case 'r':
119 case 'R': /* XXX */
120 SET_FLAG (flag, ZEBRA_FLAG_REJECT);
121 break;
122 case 'b':
123 case 'B': /* XXX */
124 SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE);
125 break;
126 default:
127 vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE);
paul595db7f2003-05-25 21:35:06 +0000128 return CMD_WARNING;
hasso81dfcaa2003-05-25 19:21:25 +0000129 }
130 }
131
hasso457ef552003-05-28 12:02:15 +0000132 if (gate_str == NULL)
133 {
134 if (add_cmd)
Piotr Chytłade24f822007-06-28 00:09:28 +0200135 static_add_ipv4_safi (safi, &p, NULL, NULL, flag, tag, distance, vrf_id);
hasso457ef552003-05-28 12:02:15 +0000136 else
Piotr Chytłade24f822007-06-28 00:09:28 +0200137 static_delete_ipv4_safi (safi, &p, NULL, NULL, tag, distance, vrf_id);
hasso457ef552003-05-28 12:02:15 +0000138
139 return CMD_SUCCESS;
140 }
141
paul718e3742002-12-13 20:15:29 +0000142 /* When gateway is A.B.C.D format, gate is treated as nexthop
143 address other case gate is treated as interface name. */
144 ret = inet_aton (gate_str, &gate);
145 if (ret)
146 ifname = NULL;
147 else
148 ifname = gate_str;
149
150 if (add_cmd)
Piotr Chytłade24f822007-06-28 00:09:28 +0200151 static_add_ipv4_safi (safi, &p, ifname ? NULL : &gate, ifname, flag, tag, distance, vrf_id);
paul718e3742002-12-13 20:15:29 +0000152 else
Piotr Chytłade24f822007-06-28 00:09:28 +0200153 static_delete_ipv4_safi (safi, &p, ifname ? NULL : &gate, ifname, tag, distance, vrf_id);
paul718e3742002-12-13 20:15:29 +0000154
155 return CMD_SUCCESS;
156}
157
Everton Marques33d86db2014-07-14 11:19:00 -0300158/* Static unicast routes for multicast RPF lookup. */
David Lampartera76681b2015-01-22 19:03:53 +0100159DEFUN (ip_mroute_dist,
160 ip_mroute_dist_cmd,
161 "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>",
Everton Marques33d86db2014-07-14 11:19:00 -0300162 IP_STR
163 "Configure static unicast route into MRIB for multicast RPF lookup\n"
164 "IP destination prefix (e.g. 10.0.0.0/8)\n"
165 "Nexthop address\n"
166 "Nexthop interface name\n"
167 "Distance\n")
168{
David Lamparter863f20c2015-01-27 20:24:15 +0100169 VTY_WARN_EXPERIMENTAL();
David Lampartera76681b2015-01-22 19:03:53 +0100170 return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1],
Piotr Chytłade24f822007-06-28 00:09:28 +0200171 NULL, NULL, argc > 2 ? argv[2] : NULL, NULL);
Everton Marques33d86db2014-07-14 11:19:00 -0300172}
173
David Lampartera76681b2015-01-22 19:03:53 +0100174ALIAS (ip_mroute_dist,
175 ip_mroute_cmd,
176 "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)",
177 IP_STR
178 "Configure static unicast route into MRIB for multicast RPF lookup\n"
179 "IP destination prefix (e.g. 10.0.0.0/8)\n"
180 "Nexthop address\n"
181 "Nexthop interface name\n")
182
Feng Lu7aaf4ea2015-05-22 11:40:06 +0200183DEFUN (ip_mroute_dist_vrf,
184 ip_mroute_dist_vrf_cmd,
185 "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255> " VRF_CMD_STR,
186 IP_STR
187 "Configure static unicast route into MRIB for multicast RPF lookup\n"
188 "IP destination prefix (e.g. 10.0.0.0/8)\n"
189 "Nexthop address\n"
190 "Nexthop interface name\n"
191 "Distance\n"
192 VRF_CMD_HELP_STR)
193{
194 VTY_WARN_EXPERIMENTAL();
195 return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1],
Piotr Chytłade24f822007-06-28 00:09:28 +0200196 NULL, NULL, argc > 3 ? argv[2] : NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +0200197 argc > 3 ? argv[3] : argv[2]);
198}
199
200ALIAS (ip_mroute_dist_vrf,
201 ip_mroute_vrf_cmd,
202 "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) "VRF_CMD_STR,
203 IP_STR
204 "Configure static unicast route into MRIB for multicast RPF lookup\n"
205 "IP destination prefix (e.g. 10.0.0.0/8)\n"
206 "Nexthop address\n"
207 "Nexthop interface name\n"
208 VRF_CMD_HELP_STR)
209
David Lampartera76681b2015-01-22 19:03:53 +0100210DEFUN (no_ip_mroute_dist,
211 no_ip_mroute_dist_cmd,
212 "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>",
Everton Marques33d86db2014-07-14 11:19:00 -0300213 IP_STR
214 "Configure static unicast route into MRIB for multicast RPF lookup\n"
215 "IP destination prefix (e.g. 10.0.0.0/8)\n"
216 "Nexthop address\n"
217 "Nexthop interface name\n"
218 "Distance\n")
219{
David Lamparter863f20c2015-01-27 20:24:15 +0100220 VTY_WARN_EXPERIMENTAL();
David Lampartera76681b2015-01-22 19:03:53 +0100221 return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1],
Piotr Chytłade24f822007-06-28 00:09:28 +0200222 NULL, NULL, argc > 2 ? argv[2] : NULL, NULL);
Everton Marques33d86db2014-07-14 11:19:00 -0300223}
224
David Lampartera76681b2015-01-22 19:03:53 +0100225ALIAS (no_ip_mroute_dist,
226 no_ip_mroute_cmd,
227 "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)",
228 NO_STR
229 IP_STR
230 "Configure static unicast route into MRIB for multicast RPF lookup\n"
231 "IP destination prefix (e.g. 10.0.0.0/8)\n"
232 "Nexthop address\n"
233 "Nexthop interface name\n")
234
Feng Lu7aaf4ea2015-05-22 11:40:06 +0200235DEFUN (no_ip_mroute_dist_vrf,
236 no_ip_mroute_dist_vrf_cmd,
237 "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255> " VRF_CMD_STR,
238 IP_STR
239 "Configure static unicast route into MRIB for multicast RPF lookup\n"
240 "IP destination prefix (e.g. 10.0.0.0/8)\n"
241 "Nexthop address\n"
242 "Nexthop interface name\n"
243 "Distance\n"
244 VRF_CMD_HELP_STR)
245{
246 VTY_WARN_EXPERIMENTAL();
247 return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1],
Piotr Chytłade24f822007-06-28 00:09:28 +0200248 NULL, NULL, argc > 3 ? argv[2] : NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +0200249 argc > 3 ? argv[3] : argv[2]);
250}
251
252ALIAS (no_ip_mroute_dist_vrf,
253 no_ip_mroute_vrf_cmd,
254 "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) " VRF_CMD_STR,
255 NO_STR
256 IP_STR
257 "Configure static unicast route into MRIB for multicast RPF lookup\n"
258 "IP destination prefix (e.g. 10.0.0.0/8)\n"
259 "Nexthop address\n"
260 "Nexthop interface name\n"
261 VRF_CMD_HELP_STR)
262
David Lamparterbd078122015-01-06 19:53:24 +0100263DEFUN (ip_multicast_mode,
264 ip_multicast_mode_cmd,
265 "ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)",
266 IP_STR
267 "Multicast options\n"
268 "RPF lookup behavior\n"
269 "Lookup in unicast RIB only\n"
270 "Lookup in multicast RIB only\n"
271 "Try multicast RIB first, fall back to unicast RIB\n"
272 "Lookup both, use entry with lower distance\n"
273 "Lookup both, use entry with longer prefix\n")
274{
David Lamparter863f20c2015-01-27 20:24:15 +0100275 VTY_WARN_EXPERIMENTAL();
276
David Lamparterbd078122015-01-06 19:53:24 +0100277 if (!strncmp (argv[0], "u", 1))
278 multicast_mode_ipv4_set (MCAST_URIB_ONLY);
279 else if (!strncmp (argv[0], "mrib-o", 6))
280 multicast_mode_ipv4_set (MCAST_MRIB_ONLY);
281 else if (!strncmp (argv[0], "mrib-t", 6))
282 multicast_mode_ipv4_set (MCAST_MIX_MRIB_FIRST);
283 else if (!strncmp (argv[0], "low", 3))
284 multicast_mode_ipv4_set (MCAST_MIX_DISTANCE);
285 else if (!strncmp (argv[0], "lon", 3))
286 multicast_mode_ipv4_set (MCAST_MIX_PFXLEN);
287 else
288 {
289 vty_out (vty, "Invalid mode specified%s", VTY_NEWLINE);
290 return CMD_WARNING;
291 }
292
293 return CMD_SUCCESS;
294}
295
296DEFUN (no_ip_multicast_mode,
297 no_ip_multicast_mode_cmd,
298 "no ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)",
299 NO_STR
300 IP_STR
301 "Multicast options\n"
302 "RPF lookup behavior\n"
303 "Lookup in unicast RIB only\n"
304 "Lookup in multicast RIB only\n"
305 "Try multicast RIB first, fall back to unicast RIB\n"
306 "Lookup both, use entry with lower distance\n"
307 "Lookup both, use entry with longer prefix\n")
308{
309 multicast_mode_ipv4_set (MCAST_NO_CONFIG);
310 return CMD_SUCCESS;
311}
312
313ALIAS (no_ip_multicast_mode,
314 no_ip_multicast_mode_noarg_cmd,
315 "no ip multicast rpf-lookup-mode",
316 NO_STR
317 IP_STR
318 "Multicast options\n"
319 "RPF lookup behavior\n")
320
Everton Marques33d86db2014-07-14 11:19:00 -0300321DEFUN (show_ip_rpf,
322 show_ip_rpf_cmd,
323 "show ip rpf",
324 SHOW_STR
325 IP_STR
326 "Display RPF information for multicast source\n")
327{
Feng Lu4364ee52015-05-22 11:40:03 +0200328 vrf_id_t vrf_id = VRF_DEFAULT;
329
330 if (argc > 0)
331 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
332
David Lamparter863f20c2015-01-27 20:24:15 +0100333 VTY_WARN_EXPERIMENTAL();
Feng Lu4364ee52015-05-22 11:40:03 +0200334 return do_show_ip_route(vty, SAFI_MULTICAST, vrf_id);
Everton Marques33d86db2014-07-14 11:19:00 -0300335}
336
Feng Lu4364ee52015-05-22 11:40:03 +0200337ALIAS (show_ip_rpf,
338 show_ip_rpf_vrf_cmd,
339 "show ip rpf " VRF_CMD_STR,
340 SHOW_STR
341 IP_STR
342 "Display RPF information for multicast source\n"
343 VRF_CMD_HELP_STR)
344
David Lamparter3b02fe82015-01-22 19:12:35 +0100345DEFUN (show_ip_rpf_addr,
346 show_ip_rpf_addr_cmd,
347 "show ip rpf A.B.C.D",
348 SHOW_STR
349 IP_STR
350 "Display RPF information for multicast source\n"
351 "IP multicast source address (e.g. 10.0.0.0)\n")
352{
353 struct in_addr addr;
354 struct route_node *rn;
355 struct rib *rib;
Feng Lu4364ee52015-05-22 11:40:03 +0200356 vrf_id_t vrf_id = VRF_DEFAULT;
357 int ret;
358
359 if (argc > 1)
360 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
361
362 VTY_WARN_EXPERIMENTAL();
363
364 ret = inet_aton (argv[0], &addr);
365 if (ret == 0)
366 {
367 vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
368 return CMD_WARNING;
369 }
370
371 rib = rib_match_ipv4_multicast (addr, &rn, vrf_id);
372
373 if (rib)
374 vty_show_ip_route_detail (vty, rn, 1);
375 else
376 vty_out (vty, "%% No match for RPF lookup%s", VTY_NEWLINE);
377
378 return CMD_SUCCESS;
379}
380
381ALIAS (show_ip_rpf_addr,
382 show_ip_rpf_addr_vrf_cmd,
383 "show ip rpf A.B.C.D " VRF_CMD_STR,
384 SHOW_STR
385 IP_STR
386 "Display RPF information for multicast source\n"
387 "IP multicast source address (e.g. 10.0.0.0)\n"
388 VRF_CMD_HELP_STR)
389
390DEFUN (show_ip_rpf_vrf_all,
391 show_ip_rpf_vrf_all_cmd,
392 "show ip rpf " VRF_ALL_CMD_STR,
393 SHOW_STR
394 IP_STR
395 "Display RPF information for multicast source\n"
396 VRF_ALL_CMD_HELP_STR)
397{
398 struct zebra_vrf *zvrf;
399 struct route_table *table;
400 struct route_node *rn;
401 struct rib *rib;
402 vrf_iter_t iter;
403 int first = 1;
404
405 VTY_WARN_EXPERIMENTAL();
406
407 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
408 {
409 if ((zvrf = vrf_iter2info (iter)) == NULL ||
410 (table = zvrf->table[AFI_IP][SAFI_MULTICAST]) == NULL)
411 continue;
412
413 /* Show all IPv4 routes. */
414 for (rn = route_top (table); rn; rn = route_next (rn))
415 RNODE_FOREACH_RIB (rn, rib)
416 {
417 if (first)
418 {
419 vty_out (vty, SHOW_ROUTE_V4_HEADER);
420 first = 0;
421 }
422 vty_show_ip_route (vty, rn, rib);
423 }
424 }
425
426 return CMD_SUCCESS;
427}
428
429DEFUN (show_ip_rpf_addr_vrf_all,
430 show_ip_rpf_addr_vrf_all_cmd,
431 "show ip rpf A.B.C.D " VRF_ALL_CMD_STR,
432 SHOW_STR
433 IP_STR
434 "Display RPF information for multicast source\n"
435 "IP multicast source address (e.g. 10.0.0.0)\n"
436 VRF_ALL_CMD_HELP_STR)
437{
438 struct in_addr addr;
439 struct route_node *rn;
440 vrf_iter_t iter;
David Lamparter3b02fe82015-01-22 19:12:35 +0100441 int ret;
442
David Lamparter863f20c2015-01-27 20:24:15 +0100443 VTY_WARN_EXPERIMENTAL();
444
David Lamparter3b02fe82015-01-22 19:12:35 +0100445 ret = inet_aton (argv[0], &addr);
446 if (ret == 0)
447 {
448 vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
449 return CMD_WARNING;
450 }
451
Feng Lu4364ee52015-05-22 11:40:03 +0200452 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
453 {
454 if (rib_match_ipv4_multicast (addr, &rn, vrf_iter2id (iter)))
455 vty_show_ip_route_detail (vty, rn, 1);
456 }
David Lamparter3b02fe82015-01-22 19:12:35 +0100457
458 return CMD_SUCCESS;
459}
460
paul718e3742002-12-13 20:15:29 +0000461/* Static route configuration. */
462DEFUN (ip_route,
463 ip_route_cmd,
paul595db7f2003-05-25 21:35:06 +0000464 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
hasso81dfcaa2003-05-25 19:21:25 +0000465 IP_STR
466 "Establish static routes\n"
467 "IP destination prefix (e.g. 10.0.0.0/8)\n"
468 "IP gateway address\n"
paul595db7f2003-05-25 21:35:06 +0000469 "IP gateway interface name\n"
470 "Null interface\n")
hasso81dfcaa2003-05-25 19:21:25 +0000471{
Piotr Chytłade24f822007-06-28 00:09:28 +0200472 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
473 NULL, NULL, NULL, NULL);
hasso81dfcaa2003-05-25 19:21:25 +0000474}
475
Piotr Chytłafb214472015-12-01 13:47:06 -0500476DEFUN (ip_route_tag,
477 ip_route_tag_cmd,
478 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>",
479 IP_STR
480 "Establish static routes\n"
481 "IP destination prefix (e.g. 10.0.0.0/8)\n"
482 "IP gateway address\n"
483 "IP gateway interface name\n"
484 "Null interface\n"
485 "Set tag for this route\n"
486 "Tag value\n")
487{
488 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
489 argv[1], NULL, argv[2], NULL, NULL);
490}
491
492DEFUN (ip_route_tag_vrf,
493 ip_route_tag_vrf_cmd,
494 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>" VRF_CMD_STR,
495 IP_STR
496 "Establish static routes\n"
497 "IP destination prefix (e.g. 10.0.0.0/8)\n"
498 "IP gateway address\n"
499 "IP gateway interface name\n"
500 "Null interface\n"
501 "Set tag for this route\n"
502 "Tag value\n"
503 VRF_CMD_HELP_STR)
504{
505 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
506 argv[1], NULL, argv[2], NULL, argv[3]);
507}
508
hasso81dfcaa2003-05-25 19:21:25 +0000509DEFUN (ip_route_flags,
510 ip_route_flags_cmd,
511 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
paul718e3742002-12-13 20:15:29 +0000512 IP_STR
513 "Establish static routes\n"
514 "IP destination prefix (e.g. 10.0.0.0/8)\n"
515 "IP gateway address\n"
516 "IP gateway interface name\n"
hasso81dfcaa2003-05-25 19:21:25 +0000517 "Emit an ICMP unreachable when matched\n"
518 "Silently discard pkts when matched\n")
paul718e3742002-12-13 20:15:29 +0000519{
Piotr Chytłade24f822007-06-28 00:09:28 +0200520 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
521 argv[2], NULL, NULL, NULL);
paul718e3742002-12-13 20:15:29 +0000522}
523
Piotr Chytłafb214472015-12-01 13:47:06 -0500524DEFUN (ip_route_flags_tag,
525 ip_route_flags_tag_cmd,
526 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>",
527 IP_STR
528 "Establish static routes\n"
529 "IP destination prefix (e.g. 10.0.0.0/8)\n"
530 "IP gateway address\n"
531 "IP gateway interface name\n"
532 "Emit an ICMP unreachable when matched\n"
533 "Silently discard pkts when matched\n"
534 "Set tag for this route\n"
535 "Tag value\n")
536
537{
538 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
539 argv[2], argv[3], NULL, NULL);
540}
541
542DEFUN (ip_route_flags_tag_vrf,
543 ip_route_flags_tag_vrf_cmd,
544 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>" VRF_CMD_STR,
545 IP_STR
546 "Establish static routes\n"
547 "IP destination prefix (e.g. 10.0.0.0/8)\n"
548 "IP gateway address\n"
549 "IP gateway interface name\n"
550 "Emit an ICMP unreachable when matched\n"
551 "Silently discard pkts when matched\n"
552 "Set tag for this route\n"
553 "Tag value\n"
554 VRF_CMD_HELP_STR)
555{
556 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
557 argv[2], argv[3], NULL, argv[4]);
558}
559
hasso457ef552003-05-28 12:02:15 +0000560DEFUN (ip_route_flags2,
561 ip_route_flags2_cmd,
562 "ip route A.B.C.D/M (reject|blackhole)",
563 IP_STR
564 "Establish static routes\n"
565 "IP destination prefix (e.g. 10.0.0.0/8)\n"
566 "Emit an ICMP unreachable when matched\n"
567 "Silently discard pkts when matched\n")
568{
Piotr Chytłade24f822007-06-28 00:09:28 +0200569 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
570 NULL, argv[1], NULL, NULL, NULL);
hasso457ef552003-05-28 12:02:15 +0000571}
572
Piotr Chytłafb214472015-12-01 13:47:06 -0500573DEFUN (ip_route_flags2_tag,
574 ip_route_flags2_tag_cmd,
575 "ip route A.B.C.D/M (reject|blackhole) tag <1-65535>",
576 IP_STR
577 "Establish static routes\n"
578 "IP destination prefix (e.g. 10.0.0.0/8)\n"
579 "Emit an ICMP unreachable when matched\n"
580 "Silently discard pkts when matched\n"
581 "Set tag for this route\n"
582 "Tag value\n")
583{
584 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL,
585 argv[1], argv[2], NULL, NULL);
586}
587
588DEFUN (ip_route_flags2_tag_vrf,
589 ip_route_flags2_tag_vrf_cmd,
590 "ip route A.B.C.D/M (reject|blackhole) tag <1-65535>",
591 IP_STR
592 "Establish static routes\n"
593 "IP destination prefix (e.g. 10.0.0.0/8)\n"
594 "Emit an ICMP unreachable when matched\n"
595 "Silently discard pkts when matched\n"
596 "Set tag for this route\n"
597 "Tag value\n"
598 VRF_CMD_HELP_STR)
599{
600 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL,
601 argv[1], argv[2], NULL, argv[3]);
602}
603
paul718e3742002-12-13 20:15:29 +0000604/* Mask as A.B.C.D format. */
605DEFUN (ip_route_mask,
606 ip_route_mask_cmd,
paul595db7f2003-05-25 21:35:06 +0000607 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
hasso81dfcaa2003-05-25 19:21:25 +0000608 IP_STR
609 "Establish static routes\n"
610 "IP destination prefix\n"
611 "IP destination prefix mask\n"
612 "IP gateway address\n"
paul595db7f2003-05-25 21:35:06 +0000613 "IP gateway interface name\n"
614 "Null interface\n")
hasso81dfcaa2003-05-25 19:21:25 +0000615{
Piotr Chytłade24f822007-06-28 00:09:28 +0200616 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
617 argv[2], NULL, NULL, NULL, NULL);
hasso81dfcaa2003-05-25 19:21:25 +0000618}
619
Piotr Chytłafb214472015-12-01 13:47:06 -0500620DEFUN (ip_route_mask_tag,
621 ip_route_mask_tag_cmd,
622 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>",
623 IP_STR
624 "Establish static routes\n"
625 "IP destination prefix\n"
626 "IP destination prefix mask\n"
627 "IP gateway address\n"
628 "IP gateway interface name\n"
629 "Null interface\n"
630 "Set tag for this route\n"
631 "Tag value\n")
632
633{
634 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
635 NULL, argv[3], NULL, NULL);
636}
637
638DEFUN (ip_route_mask_tag_vrf,
639 ip_route_mask_tag_vrf_cmd,
640 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>" VRF_CMD_STR,
641 IP_STR
642 "Establish static routes\n"
643 "IP destination prefix\n"
644 "IP destination prefix mask\n"
645 "IP gateway address\n"
646 "IP gateway interface name\n"
647 "Null interface\n"
648 "Set tag for this route\n"
649 "Tag value\n"
650 VRF_CMD_HELP_STR)
651{
652 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
653 NULL, argv[3], NULL, argv[4]);
654}
655
hasso81dfcaa2003-05-25 19:21:25 +0000656DEFUN (ip_route_mask_flags,
657 ip_route_mask_flags_cmd,
658 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)",
paul718e3742002-12-13 20:15:29 +0000659 IP_STR
660 "Establish static routes\n"
661 "IP destination prefix\n"
662 "IP destination prefix mask\n"
663 "IP gateway address\n"
664 "IP gateway interface name\n"
hasso81dfcaa2003-05-25 19:21:25 +0000665 "Emit an ICMP unreachable when matched\n"
666 "Silently discard pkts when matched\n")
paul718e3742002-12-13 20:15:29 +0000667{
Piotr Chytłade24f822007-06-28 00:09:28 +0200668 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
669 argv[2], argv[3], NULL, NULL, NULL);
paul718e3742002-12-13 20:15:29 +0000670}
671
Piotr Chytłafb214472015-12-01 13:47:06 -0500672DEFUN (ip_route_mask_flags_tag,
673 ip_route_mask_flags_tag_cmd,
674 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>",
675 IP_STR
676 "Establish static routes\n"
677 "IP destination prefix\n"
678 "IP destination prefix mask\n"
679 "IP gateway address\n"
680 "IP gateway interface name\n"
681 "Emit an ICMP unreachable when matched\n"
682 "Silently discard pkts when matched\n"
683 "Set tag for this route\n"
684 "Tag value\n")
685{
686 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
687 argv[2], argv[3], argv[4], NULL, NULL);
688}
689
690DEFUN (ip_route_mask_flags_tag_vrf,
691 ip_route_mask_flags_tag_vrf_cmd,
692 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>" VRF_CMD_STR,
693 IP_STR
694 "Establish static routes\n"
695 "IP destination prefix\n"
696 "IP destination prefix mask\n"
697 "IP gateway address\n"
698 "IP gateway interface name\n"
699 "Emit an ICMP unreachable when matched\n"
700 "Silently discard pkts when matched\n"
701 "Set tag for this route\n"
702 "Tag value\n"
703 VRF_CMD_HELP_STR)
704{
705 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
706 argv[2], argv[3], argv[4], NULL, argv[5]);
707}
708
hasso457ef552003-05-28 12:02:15 +0000709DEFUN (ip_route_mask_flags2,
710 ip_route_mask_flags2_cmd,
711 "ip route A.B.C.D A.B.C.D (reject|blackhole)",
712 IP_STR
713 "Establish static routes\n"
714 "IP destination prefix\n"
715 "IP destination prefix mask\n"
716 "Emit an ICMP unreachable when matched\n"
717 "Silently discard pkts when matched\n")
718{
Piotr Chytłade24f822007-06-28 00:09:28 +0200719 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
720 NULL, argv[2], NULL, NULL, NULL);
hasso457ef552003-05-28 12:02:15 +0000721}
722
Piotr Chytłafb214472015-12-01 13:47:06 -0500723DEFUN (ip_route_mask_flags2_tag,
724 ip_route_mask_flags2_tag_cmd,
725 "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535>",
726 IP_STR
727 "Establish static routes\n"
728 "IP destination prefix\n"
729 "IP destination prefix mask\n"
730 "Emit an ICMP unreachable when matched\n"
731 "Silently discard pkts when matched\n"
732 "Set tag for this route\n"
733 "Tag value\n")
734{
735 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
736 argv[2], argv[3], NULL, NULL);
737}
738
739DEFUN (ip_route_mask_flags2_tag_vrf,
740 ip_route_mask_flags2_tag_vrf_cmd,
741 "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535>" VRF_CMD_STR,
742 IP_STR
743 "Establish static routes\n"
744 "IP destination prefix\n"
745 "IP destination prefix mask\n"
746 "Emit an ICMP unreachable when matched\n"
747 "Silently discard pkts when matched\n"
748 "Set tag for this route\n"
749 "Tag value\n"
750 VRF_CMD_HELP_STR)
751{
752 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
753 argv[2], argv[3], NULL, argv[4]);
754}
755
paul718e3742002-12-13 20:15:29 +0000756/* Distance option value. */
757DEFUN (ip_route_distance,
758 ip_route_distance_cmd,
paul595db7f2003-05-25 21:35:06 +0000759 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
paul718e3742002-12-13 20:15:29 +0000760 IP_STR
761 "Establish static routes\n"
762 "IP destination prefix (e.g. 10.0.0.0/8)\n"
763 "IP gateway address\n"
764 "IP gateway interface name\n"
paul595db7f2003-05-25 21:35:06 +0000765 "Null interface\n"
paul718e3742002-12-13 20:15:29 +0000766 "Distance value for this route\n")
767{
Piotr Chytłade24f822007-06-28 00:09:28 +0200768 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
769 argv[1], NULL, NULL, argv[2], NULL);
hasso81dfcaa2003-05-25 19:21:25 +0000770}
771
Piotr Chytłafb214472015-12-01 13:47:06 -0500772DEFUN (ip_route_tag_distance,
773 ip_route_tag_distance_cmd,
774 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>",
775 IP_STR
776 "Establish static routes\n"
777 "IP destination prefix (e.g. 10.0.0.0/8)\n"
778 "IP gateway address\n"
779 "IP gateway interface name\n"
780 "Null interface\n"
781 "Set tag for this route\n"
782 "Tag value\n"
783 "Distance value for this route\n")
784{
785 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
786 argv[1], NULL, argv[2], argv[3], NULL);
787}
788
789DEFUN (ip_route_tag_distance_vrf,
790 ip_route_tag_distance_vrf_cmd,
791 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>" VRF_CMD_STR,
792 IP_STR
793 "Establish static routes\n"
794 "IP destination prefix (e.g. 10.0.0.0/8)\n"
795 "IP gateway address\n"
796 "IP gateway interface name\n"
797 "Null interface\n"
798 "Set tag for this route\n"
799 "Tag value\n"
800 "Distance value for this route\n"
801 VRF_CMD_HELP_STR)
802{
803 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
804 argv[1], NULL, argv[2], argv[3], argv[4]);
805}
806
hasso81dfcaa2003-05-25 19:21:25 +0000807DEFUN (ip_route_flags_distance,
808 ip_route_flags_distance_cmd,
809 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
810 IP_STR
811 "Establish static routes\n"
812 "IP destination prefix (e.g. 10.0.0.0/8)\n"
813 "IP gateway address\n"
814 "IP gateway interface name\n"
815 "Emit an ICMP unreachable when matched\n"
816 "Silently discard pkts when matched\n"
817 "Distance value for this route\n")
818{
Piotr Chytłade24f822007-06-28 00:09:28 +0200819 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
820 argv[2], NULL, argv[3], NULL);
paul718e3742002-12-13 20:15:29 +0000821}
822
Piotr Chytłafb214472015-12-01 13:47:06 -0500823DEFUN (ip_route_flags_tag_distance,
824 ip_route_flags_tag_distance_cmd,
825 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
826 IP_STR
827 "Establish static routes\n"
828 "IP destination prefix (e.g. 10.0.0.0/8)\n"
829 "IP gateway address\n"
830 "IP gateway interface name\n"
831 "Emit an ICMP unreachable when matched\n"
832 "Silently discard pkts when matched\n"
833 "Set tag for this route\n"
834 "Tag value\n"
835 "Distance value for this route\n")
836{
837 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
838 argv[2], argv[3], argv[4], NULL);
839}
840
841DEFUN (ip_route_flags_tag_distance_vrf,
842 ip_route_flags_tag_distance_vrf_cmd,
843 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
844 IP_STR
845 "Establish static routes\n"
846 "IP destination prefix (e.g. 10.0.0.0/8)\n"
847 "IP gateway address\n"
848 "IP gateway interface name\n"
849 "Emit an ICMP unreachable when matched\n"
850 "Silently discard pkts when matched\n"
851 "Set tag for this route\n"
852 "Tag value\n"
853 "Distance value for this route\n"
854 VRF_CMD_HELP_STR)
855{
856 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
857 argv[2], argv[3], argv[4], argv[5]);
858}
859
hasso457ef552003-05-28 12:02:15 +0000860DEFUN (ip_route_flags_distance2,
861 ip_route_flags_distance2_cmd,
862 "ip route A.B.C.D/M (reject|blackhole) <1-255>",
863 IP_STR
864 "Establish static routes\n"
865 "IP destination prefix (e.g. 10.0.0.0/8)\n"
866 "Emit an ICMP unreachable when matched\n"
867 "Silently discard pkts when matched\n"
868 "Distance value for this route\n")
869{
Piotr Chytłade24f822007-06-28 00:09:28 +0200870 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
871 NULL, argv[1], NULL, argv[2], NULL);
hasso457ef552003-05-28 12:02:15 +0000872}
873
Piotr Chytłafb214472015-12-01 13:47:06 -0500874DEFUN (ip_route_flags_tag_distance2,
875 ip_route_flags_tag_distance2_cmd,
876 "ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>",
877 IP_STR
878 "Establish static routes\n"
879 "IP destination prefix (e.g. 10.0.0.0/8)\n"
880 "Emit an ICMP unreachable when matched\n"
881 "Silently discard pkts when matched\n"
882 "Set tag for this route\n"
883 "Tag value\n"
884 "Distance value for this route\n")
885{
886 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
887 NULL, argv[1], argv[2], argv[3], NULL);
888}
889
890DEFUN (ip_route_flags_tag_distance2_vrf,
891 ip_route_flags_tag_distance2_vrf_cmd,
892 "ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
893 IP_STR
894 "Establish static routes\n"
895 "IP destination prefix (e.g. 10.0.0.0/8)\n"
896 "Emit an ICMP unreachable when matched\n"
897 "Silently discard pkts when matched\n"
898 "Set tag for this route\n"
899 "Tag value\n"
900 "Distance value for this route\n"
901 VRF_CMD_HELP_STR)
902{
903 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
904 NULL, argv[1], argv[2], argv[3], argv[4]);
905}
906
paul718e3742002-12-13 20:15:29 +0000907DEFUN (ip_route_mask_distance,
908 ip_route_mask_distance_cmd,
paul595db7f2003-05-25 21:35:06 +0000909 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
paul718e3742002-12-13 20:15:29 +0000910 IP_STR
911 "Establish static routes\n"
912 "IP destination prefix\n"
913 "IP destination prefix mask\n"
914 "IP gateway address\n"
915 "IP gateway interface name\n"
paul595db7f2003-05-25 21:35:06 +0000916 "Null interface\n"
paul718e3742002-12-13 20:15:29 +0000917 "Distance value for this route\n")
918{
Piotr Chytłade24f822007-06-28 00:09:28 +0200919 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
920 NULL, NULL, argv[3], NULL);
hasso81dfcaa2003-05-25 19:21:25 +0000921}
922
Piotr Chytłafb214472015-12-01 13:47:06 -0500923DEFUN (ip_route_mask_tag_distance,
924 ip_route_mask_tag_distance_cmd,
925 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>",
926 IP_STR
927 "Establish static routes\n"
928 "IP destination prefix\n"
929 "IP destination prefix mask\n"
930 "IP gateway address\n"
931 "IP gateway interface name\n"
932 "Null interface\n"
933 "Set tag for this route\n"
934 "Tag value\n"
935 "Distance value for this route\n")
936{
937 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
938 argv[2], NULL, argv[3], argv[4], NULL);
939}
940
941DEFUN (ip_route_mask_tag_distance_vrf,
942 ip_route_mask_tag_distance_vrf_cmd,
943 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>" VRF_CMD_STR,
944 IP_STR
945 "Establish static routes\n"
946 "IP destination prefix\n"
947 "IP destination prefix mask\n"
948 "IP gateway address\n"
949 "IP gateway interface name\n"
950 "Null interface\n"
951 "Set tag for this route\n"
952 "Tag value\n"
953 "Distance value for this route\n"
954 VRF_CMD_HELP_STR)
955{
956 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
957 argv[2], NULL, argv[3], argv[4], argv[5]);
958}
959
960
961DEFUN (ip_route_mask_flags_tag_distance,
962 ip_route_mask_flags_tag_distance_cmd,
963 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
964 IP_STR
965 "Establish static routes\n"
966 "IP destination prefix\n"
967 "IP destination prefix mask\n"
968 "IP gateway address\n"
969 "IP gateway interface name\n"
970 "Set tag for this route\n"
971 "Tag value\n"
972 "Distance value for this route\n"
973 "Emit an ICMP unreachable when matched\n"
974 "Silently discard pkts when matched\n")
975{
976 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
977 argv[3], argv[4], argv[5], NULL);
978}
979
980DEFUN (ip_route_mask_flags_tag_distance_vrf,
981 ip_route_mask_flags_tag_distance_vrf_cmd,
982 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
983 IP_STR
984 "Establish static routes\n"
985 "IP destination prefix\n"
986 "IP destination prefix mask\n"
987 "IP gateway address\n"
988 "IP gateway interface name\n"
989 "Set tag for this route\n"
990 "Tag value\n"
991 "Distance value for this route\n"
992 "Emit an ICMP unreachable when matched\n"
993 "Silently discard pkts when matched\n"
994 VRF_CMD_HELP_STR)
995{
996 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
997 argv[3], argv[4], argv[5], argv[6]);
998}
999
hasso81dfcaa2003-05-25 19:21:25 +00001000DEFUN (ip_route_mask_flags_distance,
1001 ip_route_mask_flags_distance_cmd,
1002 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
1003 IP_STR
1004 "Establish static routes\n"
1005 "IP destination prefix\n"
1006 "IP destination prefix mask\n"
1007 "IP gateway address\n"
1008 "IP gateway interface name\n"
hasso81dfcaa2003-05-25 19:21:25 +00001009 "Emit an ICMP unreachable when matched\n"
Christian Franke2b005152013-09-30 12:27:49 +00001010 "Silently discard pkts when matched\n"
1011 "Distance value for this route\n")
hasso81dfcaa2003-05-25 19:21:25 +00001012{
Piotr Chytłade24f822007-06-28 00:09:28 +02001013 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
1014 argv[3], NULL, argv[4], NULL);
paul718e3742002-12-13 20:15:29 +00001015}
1016
hasso457ef552003-05-28 12:02:15 +00001017DEFUN (ip_route_mask_flags_distance2,
1018 ip_route_mask_flags_distance2_cmd,
1019 "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>",
1020 IP_STR
1021 "Establish static routes\n"
1022 "IP destination prefix\n"
1023 "IP destination prefix mask\n"
hasso457ef552003-05-28 12:02:15 +00001024 "Emit an ICMP unreachable when matched\n"
Christian Franke2b005152013-09-30 12:27:49 +00001025 "Silently discard pkts when matched\n"
1026 "Distance value for this route\n")
hasso457ef552003-05-28 12:02:15 +00001027{
Piotr Chytłade24f822007-06-28 00:09:28 +02001028 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
1029 NULL, argv[2], NULL, argv[3], NULL);
hasso457ef552003-05-28 12:02:15 +00001030}
1031
Piotr Chytłafb214472015-12-01 13:47:06 -05001032DEFUN (ip_route_mask_flags_tag_distance2,
1033 ip_route_mask_flags_tag_distance2_cmd,
1034 "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255>",
1035 IP_STR
1036 "Establish static routes\n"
1037 "IP destination prefix\n"
1038 "IP destination prefix mask\n"
1039 "Set tag for this route\n"
1040 "Tag value\n"
1041 "Distance value for this route\n"
1042 "Emit an ICMP unreachable when matched\n"
1043 "Silently discard pkts when matched\n")
1044{
1045 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
1046 argv[2], argv[3], argv[4], NULL);
1047}
1048
1049DEFUN (ip_route_mask_flags_tag_distance2_vrf,
1050 ip_route_mask_flags_tag_distance2_vrf_cmd,
1051 "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
1052 IP_STR
1053 "Establish static routes\n"
1054 "IP destination prefix\n"
1055 "IP destination prefix mask\n"
1056 "Set tag for this route\n"
1057 "Tag value\n"
1058 "Distance value for this route\n"
1059 "Emit an ICMP unreachable when matched\n"
1060 "Silently discard pkts when matched\n"
1061 VRF_CMD_HELP_STR)
1062{
1063 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
1064 argv[2], argv[3], argv[4], argv[5]);
1065}
1066
paul718e3742002-12-13 20:15:29 +00001067DEFUN (no_ip_route,
1068 no_ip_route_cmd,
paul595db7f2003-05-25 21:35:06 +00001069 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
hasso81dfcaa2003-05-25 19:21:25 +00001070 NO_STR
1071 IP_STR
1072 "Establish static routes\n"
1073 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1074 "IP gateway address\n"
paul595db7f2003-05-25 21:35:06 +00001075 "IP gateway interface name\n"
1076 "Null interface\n")
hasso81dfcaa2003-05-25 19:21:25 +00001077{
Piotr Chytłade24f822007-06-28 00:09:28 +02001078 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL,
1079 argv[1], NULL, NULL, NULL, NULL);
hasso81dfcaa2003-05-25 19:21:25 +00001080}
1081
Piotr Chytłafb214472015-12-01 13:47:06 -05001082DEFUN (no_ip_route_tag,
1083 no_ip_route_tag_cmd,
1084 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>",
1085 NO_STR
1086 IP_STR
1087 "Establish static routes\n"
1088 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1089 "IP gateway address\n"
1090 "IP gateway interface name\n"
1091 "Null interface\n"
1092 "Tag of this route\n"
1093 "Tag value\n")
1094{
1095 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
1096 NULL, argv[2], NULL, NULL);
1097}
1098
1099DEFUN (no_ip_route_tag_vrf,
1100 no_ip_route_tag_vrf_cmd,
1101 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>" VRF_CMD_STR,
1102 NO_STR
1103 IP_STR
1104 "Establish static routes\n"
1105 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1106 "IP gateway address\n"
1107 "IP gateway interface name\n"
1108 "Null interface\n"
1109 "Tag of this route\n"
1110 "Tag value\n"
1111 VRF_CMD_HELP_STR)
1112{
1113 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
1114 NULL, argv[2], NULL, argv[3]);
1115}
1116
hasso81dfcaa2003-05-25 19:21:25 +00001117ALIAS (no_ip_route,
1118 no_ip_route_flags_cmd,
1119 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
paul718e3742002-12-13 20:15:29 +00001120 NO_STR
1121 IP_STR
1122 "Establish static routes\n"
1123 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1124 "IP gateway address\n"
1125 "IP gateway interface name\n"
hasso81dfcaa2003-05-25 19:21:25 +00001126 "Emit an ICMP unreachable when matched\n"
1127 "Silently discard pkts when matched\n")
paul718e3742002-12-13 20:15:29 +00001128
Piotr Chytłafb214472015-12-01 13:47:06 -05001129ALIAS (no_ip_route_tag,
1130 no_ip_route_flags_tag_cmd,
1131 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>",
1132 NO_STR
1133 IP_STR
1134 "Establish static routes\n"
1135 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1136 "IP gateway address\n"
1137 "IP gateway interface name\n"
1138 "Emit an ICMP unreachable when matched\n"
1139 "Silently discard pkts when matched\n"
1140 "Tag of this route\n"
1141 "Tag value\n")
1142
hasso457ef552003-05-28 12:02:15 +00001143DEFUN (no_ip_route_flags2,
1144 no_ip_route_flags2_cmd,
1145 "no ip route A.B.C.D/M (reject|blackhole)",
1146 NO_STR
1147 IP_STR
1148 "Establish static routes\n"
1149 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1150 "Emit an ICMP unreachable when matched\n"
1151 "Silently discard pkts when matched\n")
1152{
Piotr Chytłade24f822007-06-28 00:09:28 +02001153 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL,
1154 NULL, NULL, NULL, NULL, NULL);
hasso457ef552003-05-28 12:02:15 +00001155}
1156
Piotr Chytłafb214472015-12-01 13:47:06 -05001157DEFUN (no_ip_route_flags2_tag,
1158 no_ip_route_flags2_tag_cmd,
1159 "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535>",
1160 NO_STR
1161 IP_STR
1162 "Establish static routes\n"
1163 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1164 "Emit an ICMP unreachable when matched\n"
1165 "Silently discard pkts when matched\n"
1166 "Tag of this route\n"
1167 "Tag value\n")
1168{
1169 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL,
1170 NULL, argv[1], NULL, NULL);
1171}
1172
1173DEFUN (no_ip_route_flags2_tag_vrf,
1174 no_ip_route_flags2_tag_vrf_cmd,
1175 "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535>" VRF_CMD_STR,
1176 NO_STR
1177 IP_STR
1178 "Establish static routes\n"
1179 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1180 "Emit an ICMP unreachable when matched\n"
1181 "Silently discard pkts when matched\n"
1182 "Tag of this route\n"
1183 "Tag value\n"
1184 VRF_CMD_HELP_STR)
1185{
1186 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL,
1187 NULL, argv[1], NULL, argv[2]);
1188}
1189
paul718e3742002-12-13 20:15:29 +00001190DEFUN (no_ip_route_mask,
1191 no_ip_route_mask_cmd,
paul595db7f2003-05-25 21:35:06 +00001192 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
hasso81dfcaa2003-05-25 19:21:25 +00001193 NO_STR
1194 IP_STR
1195 "Establish static routes\n"
1196 "IP destination prefix\n"
1197 "IP destination prefix mask\n"
1198 "IP gateway address\n"
paul595db7f2003-05-25 21:35:06 +00001199 "IP gateway interface name\n"
1200 "Null interface\n")
hasso81dfcaa2003-05-25 19:21:25 +00001201{
Piotr Chytłade24f822007-06-28 00:09:28 +02001202 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
1203 argv[2], NULL, NULL, NULL, NULL);
hasso81dfcaa2003-05-25 19:21:25 +00001204}
1205
Piotr Chytłafb214472015-12-01 13:47:06 -05001206DEFUN (no_ip_route_mask_tag,
1207 no_ip_route_mask_tag_cmd,
1208 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>",
1209 NO_STR
1210 IP_STR
1211 "Establish static routes\n"
1212 "IP destination prefix\n"
1213 "IP destination prefix mask\n"
1214 "IP gateway address\n"
1215 "IP gateway interface name\n"
1216 "Null interface\n"
1217 "Tag of this route\n"
1218 "Tag value\n")
1219{
1220 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
1221 NULL, argv[3], NULL, NULL);
1222}
1223
hasso81dfcaa2003-05-25 19:21:25 +00001224ALIAS (no_ip_route_mask,
1225 no_ip_route_mask_flags_cmd,
1226 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)",
paul718e3742002-12-13 20:15:29 +00001227 NO_STR
1228 IP_STR
1229 "Establish static routes\n"
1230 "IP destination prefix\n"
1231 "IP destination prefix mask\n"
1232 "IP gateway address\n"
1233 "IP gateway interface name\n"
hasso81dfcaa2003-05-25 19:21:25 +00001234 "Emit an ICMP unreachable when matched\n"
1235 "Silently discard pkts when matched\n")
paul718e3742002-12-13 20:15:29 +00001236
Piotr Chytłafb214472015-12-01 13:47:06 -05001237ALIAS (no_ip_route_mask_tag,
1238 no_ip_route_mask_flags_tag_cmd,
1239 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>",
1240 NO_STR
1241 IP_STR
1242 "Establish static routes\n"
1243 "IP destination prefix\n"
1244 "IP destination prefix mask\n"
1245 "IP gateway address\n"
1246 "IP gateway interface name\n"
1247 "Emit an ICMP unreachable when matched\n"
1248 "Silently discard pkts when matched\n"
1249 "Tag of this route\n"
1250 "Tag value\n")
1251
hasso457ef552003-05-28 12:02:15 +00001252DEFUN (no_ip_route_mask_flags2,
1253 no_ip_route_mask_flags2_cmd,
1254 "no ip route A.B.C.D A.B.C.D (reject|blackhole)",
1255 NO_STR
1256 IP_STR
1257 "Establish static routes\n"
1258 "IP destination prefix\n"
1259 "IP destination prefix mask\n"
1260 "Emit an ICMP unreachable when matched\n"
1261 "Silently discard pkts when matched\n")
1262{
Piotr Chytłade24f822007-06-28 00:09:28 +02001263 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
1264 NULL, NULL, NULL, NULL, NULL);
hasso457ef552003-05-28 12:02:15 +00001265}
1266
Piotr Chytłafb214472015-12-01 13:47:06 -05001267DEFUN (no_ip_route_mask_flags2_tag,
1268 no_ip_route_mask_flags2_tag_cmd,
1269 "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535>",
1270 NO_STR
1271 IP_STR
1272 "Establish static routes\n"
1273 "IP destination prefix\n"
1274 "IP destination prefix mask\n"
1275 "Emit an ICMP unreachable when matched\n"
1276 "Silently discard pkts when matched\n"
1277 "Tag of this route\n"
1278 "Tag value\n")
1279{
1280 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
1281 NULL, NULL, argv[2], NULL, NULL);
1282}
1283
1284DEFUN (no_ip_route_mask_flags2_tag_vrf,
1285 no_ip_route_mask_flags2_tag_vrf_cmd,
1286 "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535>" VRF_CMD_STR,
1287 NO_STR
1288 IP_STR
1289 "Establish static routes\n"
1290 "IP destination prefix\n"
1291 "IP destination prefix mask\n"
1292 "Emit an ICMP unreachable when matched\n"
1293 "Silently discard pkts when matched\n"
1294 "Tag of this route\n"
1295 "Tag value\n"
1296 VRF_CMD_HELP_STR)
1297{
1298 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
1299 NULL, NULL, argv[2], NULL, argv[3]);
1300}
1301
paul718e3742002-12-13 20:15:29 +00001302DEFUN (no_ip_route_distance,
1303 no_ip_route_distance_cmd,
paul595db7f2003-05-25 21:35:06 +00001304 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
paul718e3742002-12-13 20:15:29 +00001305 NO_STR
1306 IP_STR
1307 "Establish static routes\n"
1308 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1309 "IP gateway address\n"
1310 "IP gateway interface name\n"
paul595db7f2003-05-25 21:35:06 +00001311 "Null interface\n"
paul718e3742002-12-13 20:15:29 +00001312 "Distance value for this route\n")
1313{
Piotr Chytłade24f822007-06-28 00:09:28 +02001314 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL,
1315 argv[1], NULL, NULL, argv[2], NULL);
hasso81dfcaa2003-05-25 19:21:25 +00001316}
1317
Piotr Chytłafb214472015-12-01 13:47:06 -05001318DEFUN (no_ip_route_tag_distance,
1319 no_ip_route_tag_distance_cmd,
1320 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>",
1321 NO_STR
1322 IP_STR
1323 "Establish static routes\n"
1324 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1325 "IP gateway address\n"
1326 "IP gateway interface name\n"
1327 "Null interface\n"
1328 "Tag of this route\n"
1329 "Tag value\n"
1330 "Distance value for this route\n")
1331{
1332 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
1333 NULL, argv[2], argv[3], NULL);
1334}
1335
1336DEFUN (no_ip_route_tag_distance_vrf,
1337 no_ip_route_tag_distance_vrf_cmd,
1338 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>" VRF_CMD_STR,
1339 NO_STR
1340 IP_STR
1341 "Establish static routes\n"
1342 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1343 "IP gateway address\n"
1344 "IP gateway interface name\n"
1345 "Null interface\n"
1346 "Tag of this route\n"
1347 "Tag value\n"
1348 "Distance value for this route\n"
1349 VRF_CMD_HELP_STR)
1350{
1351 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
1352 NULL, argv[2], argv[3], argv[4]);
1353}
1354
hasso81dfcaa2003-05-25 19:21:25 +00001355DEFUN (no_ip_route_flags_distance,
1356 no_ip_route_flags_distance_cmd,
1357 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
1358 NO_STR
1359 IP_STR
1360 "Establish static routes\n"
1361 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1362 "IP gateway address\n"
1363 "IP gateway interface name\n"
1364 "Emit an ICMP unreachable when matched\n"
1365 "Silently discard pkts when matched\n"
1366 "Distance value for this route\n")
1367{
Piotr Chytłade24f822007-06-28 00:09:28 +02001368 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL,
1369 argv[1], argv[2], NULL, argv[3], NULL);
paul718e3742002-12-13 20:15:29 +00001370}
1371
Piotr Chytłafb214472015-12-01 13:47:06 -05001372DEFUN (no_ip_route_flags_tag_distance,
1373 no_ip_route_flags_tag_distance_cmd,
1374 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
1375 NO_STR
1376 IP_STR
1377 "Establish static routes\n"
1378 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1379 "IP gateway address\n"
1380 "IP gateway interface name\n"
1381 "Emit an ICMP unreachable when matched\n"
1382 "Silently discard pkts when matched\n"
1383 "Tag of this route\n"
1384 "Tag value\n"
1385 "Distance value for this route\n")
1386{
1387 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
1388 argv[2], argv[3], argv[4], NULL);
1389}
1390
1391DEFUN (no_ip_route_flags_tag_distance_vrf,
1392 no_ip_route_flags_tag_distance_vrf_cmd,
1393 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
1394 NO_STR
1395 IP_STR
1396 "Establish static routes\n"
1397 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1398 "IP gateway address\n"
1399 "IP gateway interface name\n"
1400 "Emit an ICMP unreachable when matched\n"
1401 "Silently discard pkts when matched\n"
1402 "Tag of this route\n"
1403 "Tag value\n"
1404 "Distance value for this route\n"
1405 VRF_CMD_HELP_STR)
1406{
1407 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
1408 argv[2], argv[3], argv[4], argv[5]);
1409}
1410
hasso457ef552003-05-28 12:02:15 +00001411DEFUN (no_ip_route_flags_distance2,
1412 no_ip_route_flags_distance2_cmd,
1413 "no ip route A.B.C.D/M (reject|blackhole) <1-255>",
1414 NO_STR
1415 IP_STR
1416 "Establish static routes\n"
1417 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1418 "Emit an ICMP unreachable when matched\n"
1419 "Silently discard pkts when matched\n"
1420 "Distance value for this route\n")
1421{
Piotr Chytłade24f822007-06-28 00:09:28 +02001422 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL,
1423 argv[1], NULL, argv[2], NULL);
hasso457ef552003-05-28 12:02:15 +00001424}
1425
Piotr Chytłafb214472015-12-01 13:47:06 -05001426DEFUN (no_ip_route_flags_tag_distance2,
1427 no_ip_route_flags_tag_distance2_cmd,
1428 "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>",
1429 NO_STR
1430 IP_STR
1431 "Establish static routes\n"
1432 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1433 "Emit an ICMP unreachable when matched\n"
1434 "Silently discard pkts when matched\n"
1435 "Tag of this route\n"
1436 "Tag value\n"
1437 "Distance value for this route\n")
1438{
1439 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL,
1440 argv[1], argv[2] , argv[3], NULL);
1441}
1442
1443DEFUN (no_ip_route_flags_tag_distance2_vrf,
1444 no_ip_route_flags_tag_distance2_vrf_cmd,
1445 "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
1446 NO_STR
1447 IP_STR
1448 "Establish static routes\n"
1449 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1450 "Emit an ICMP unreachable when matched\n"
1451 "Silently discard pkts when matched\n"
1452 "Tag of this route\n"
1453 "Tag value\n"
1454 "Distance value for this route\n"
1455 VRF_CMD_HELP_STR)
1456{
1457 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL,
1458 argv[1], argv[2] , argv[3], argv[4]);
1459}
1460
paul718e3742002-12-13 20:15:29 +00001461DEFUN (no_ip_route_mask_distance,
1462 no_ip_route_mask_distance_cmd,
paul595db7f2003-05-25 21:35:06 +00001463 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
paul718e3742002-12-13 20:15:29 +00001464 NO_STR
1465 IP_STR
1466 "Establish static routes\n"
1467 "IP destination prefix\n"
1468 "IP destination prefix mask\n"
1469 "IP gateway address\n"
1470 "IP gateway interface name\n"
paul595db7f2003-05-25 21:35:06 +00001471 "Null interface\n"
paul718e3742002-12-13 20:15:29 +00001472 "Distance value for this route\n")
1473{
Piotr Chytłade24f822007-06-28 00:09:28 +02001474 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
1475 argv[2], NULL, NULL, argv[3], NULL);
hasso81dfcaa2003-05-25 19:21:25 +00001476}
1477
Piotr Chytłafb214472015-12-01 13:47:06 -05001478DEFUN (no_ip_route_mask_tag_distance,
1479 no_ip_route_mask_tag_distance_cmd,
1480 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>",
1481 NO_STR
1482 IP_STR
1483 "Establish static routes\n"
1484 "IP destination prefix\n"
1485 "IP destination prefix mask\n"
1486 "IP gateway address\n"
1487 "IP gateway interface name\n"
1488 "Null interface\n"
1489 "Tag of this route\n"
1490 "Tag value\n"
1491 "Distance value for this route\n")
1492{
1493 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
1494 argv[2], NULL, argv[3], argv[4], NULL);
1495}
1496
1497DEFUN (no_ip_route_mask_tag_distance_vrf,
1498 no_ip_route_mask_tag_distance_vrf_cmd,
1499 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>" VRF_CMD_STR,
1500 NO_STR
1501 IP_STR
1502 "Establish static routes\n"
1503 "IP destination prefix\n"
1504 "IP destination prefix mask\n"
1505 "IP gateway address\n"
1506 "IP gateway interface name\n"
1507 "Null interface\n"
1508 "Tag of this route\n"
1509 "Tag value\n"
1510 "Distance value for this route\n"
1511 VRF_CMD_HELP_STR)
1512{
1513 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
1514 argv[2], NULL, argv[3], argv[4], argv[5]);
1515}
1516
hasso81dfcaa2003-05-25 19:21:25 +00001517DEFUN (no_ip_route_mask_flags_distance,
1518 no_ip_route_mask_flags_distance_cmd,
1519 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
1520 NO_STR
1521 IP_STR
1522 "Establish static routes\n"
1523 "IP destination prefix\n"
1524 "IP destination prefix mask\n"
1525 "IP gateway address\n"
1526 "IP gateway interface name\n"
1527 "Emit an ICMP unreachable when matched\n"
1528 "Silently discard pkts when matched\n"
1529 "Distance value for this route\n")
1530{
Piotr Chytłade24f822007-06-28 00:09:28 +02001531 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
1532 argv[2], argv[3], NULL, argv[4], NULL);
paul718e3742002-12-13 20:15:29 +00001533}
1534
Piotr Chytłafb214472015-12-01 13:47:06 -05001535DEFUN (no_ip_route_mask_flags_tag_distance,
1536 no_ip_route_mask_flags_tag_distance_cmd,
1537 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
1538 NO_STR
1539 IP_STR
1540 "Establish static routes\n"
1541 "IP destination prefix\n"
1542 "IP destination prefix mask\n"
1543 "IP gateway address\n"
1544 "IP gateway interface name\n"
1545 "Emit an ICMP unreachable when matched\n"
1546 "Silently discard pkts when matched\n"
1547 "Tag of this route\n"
1548 "Tag value\n"
1549 "Distance value for this route\n")
1550{
1551 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3],
1552 argv[4], argv[5], NULL);
1553}
1554
1555DEFUN (no_ip_route_mask_flags_tag_distance_vrf,
1556 no_ip_route_mask_flags_tag_distance_vrf_cmd,
1557 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
1558 NO_STR
1559 IP_STR
1560 "Establish static routes\n"
1561 "IP destination prefix\n"
1562 "IP destination prefix mask\n"
1563 "IP gateway address\n"
1564 "IP gateway interface name\n"
1565 "Emit an ICMP unreachable when matched\n"
1566 "Silently discard pkts when matched\n"
1567 "Tag of this route\n"
1568 "Tag value\n"
1569 "Distance value for this route\n"
1570 VRF_CMD_HELP_STR)
1571{
1572 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3],
1573 argv[4], argv[5], argv[6]);
1574}
1575
hasso457ef552003-05-28 12:02:15 +00001576DEFUN (no_ip_route_mask_flags_distance2,
1577 no_ip_route_mask_flags_distance2_cmd,
1578 "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>",
1579 NO_STR
1580 IP_STR
1581 "Establish static routes\n"
1582 "IP destination prefix\n"
1583 "IP destination prefix mask\n"
1584 "Emit an ICMP unreachable when matched\n"
1585 "Silently discard pkts when matched\n"
1586 "Distance value for this route\n")
1587{
Piotr Chytłade24f822007-06-28 00:09:28 +02001588 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
1589 NULL, argv[2], NULL, argv[3], NULL);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001590}
1591
1592DEFUN (ip_route_vrf,
1593 ip_route_vrf_cmd,
1594 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
1595 IP_STR
1596 "Establish static routes\n"
1597 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1598 "IP gateway address\n"
1599 "IP gateway interface name\n"
1600 "Null interface\n"
1601 VRF_CMD_HELP_STR)
1602{
Piotr Chytłade24f822007-06-28 00:09:28 +02001603 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
1604 argv[1], NULL, NULL, NULL, argv[2]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001605}
1606
1607DEFUN (ip_route_flags_vrf,
1608 ip_route_flags_vrf_cmd,
1609 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
1610 IP_STR
1611 "Establish static routes\n"
1612 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1613 "IP gateway address\n"
1614 "IP gateway interface name\n"
1615 "Emit an ICMP unreachable when matched\n"
1616 "Silently discard pkts when matched\n"
1617 VRF_CMD_HELP_STR)
1618{
Piotr Chytłade24f822007-06-28 00:09:28 +02001619 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
1620 argv[1], argv[2], NULL, NULL, argv[3]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001621}
1622
1623DEFUN (ip_route_flags2_vrf,
1624 ip_route_flags2_vrf_cmd,
1625 "ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR,
1626 IP_STR
1627 "Establish static routes\n"
1628 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1629 "Emit an ICMP unreachable when matched\n"
1630 "Silently discard pkts when matched\n"
1631 VRF_CMD_HELP_STR)
1632{
Piotr Chytłade24f822007-06-28 00:09:28 +02001633 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
1634 NULL, argv[1], NULL, NULL, argv[2]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001635}
1636
1637/* Mask as A.B.C.D format. */
1638DEFUN (ip_route_mask_vrf,
1639 ip_route_mask_vrf_cmd,
1640 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
1641 IP_STR
1642 "Establish static routes\n"
1643 "IP destination prefix\n"
1644 "IP destination prefix mask\n"
1645 "IP gateway address\n"
1646 "IP gateway interface name\n"
1647 "Null interface\n"
1648 VRF_CMD_HELP_STR)
1649{
Piotr Chytłade24f822007-06-28 00:09:28 +02001650 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
1651 argv[2], NULL, NULL, NULL, argv[3]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001652}
1653
1654DEFUN (ip_route_mask_flags_vrf,
1655 ip_route_mask_flags_vrf_cmd,
1656 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
1657 IP_STR
1658 "Establish static routes\n"
1659 "IP destination prefix\n"
1660 "IP destination prefix mask\n"
1661 "IP gateway address\n"
1662 "IP gateway interface name\n"
1663 "Emit an ICMP unreachable when matched\n"
1664 "Silently discard pkts when matched\n"
1665 VRF_CMD_HELP_STR)
1666{
Piotr Chytłade24f822007-06-28 00:09:28 +02001667 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
1668 argv[2], argv[3], NULL, NULL, argv[4]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001669}
1670
1671DEFUN (ip_route_mask_flags2_vrf,
1672 ip_route_mask_flags2_vrf_cmd,
1673 "ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR,
1674 IP_STR
1675 "Establish static routes\n"
1676 "IP destination prefix\n"
1677 "IP destination prefix mask\n"
1678 "Emit an ICMP unreachable when matched\n"
1679 "Silently discard pkts when matched\n"
1680 VRF_CMD_HELP_STR)
1681{
Piotr Chytłade24f822007-06-28 00:09:28 +02001682 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
1683 NULL, argv[2], NULL, NULL, argv[3]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001684}
1685
1686/* Distance option value. */
1687DEFUN (ip_route_distance_vrf,
1688 ip_route_distance_vrf_cmd,
1689 "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
1690 IP_STR
1691 "Establish static routes\n"
1692 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1693 "IP gateway address\n"
1694 "IP gateway interface name\n"
1695 "Null interface\n"
1696 "Distance value for this route\n"
1697 VRF_CMD_HELP_STR)
1698{
Piotr Chytłade24f822007-06-28 00:09:28 +02001699 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
1700 argv[1], NULL, NULL, argv[2], argv[3]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001701}
1702
1703DEFUN (ip_route_flags_distance_vrf,
1704 ip_route_flags_distance_vrf_cmd,
1705 "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
1706 IP_STR
1707 "Establish static routes\n"
1708 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1709 "IP gateway address\n"
1710 "IP gateway interface name\n"
1711 "Emit an ICMP unreachable when matched\n"
1712 "Silently discard pkts when matched\n"
1713 "Distance value for this route\n"
1714 VRF_CMD_HELP_STR)
1715{
Piotr Chytłade24f822007-06-28 00:09:28 +02001716 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
1717 argv[1], argv[2], NULL, argv[3], argv[4]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001718}
1719
1720DEFUN (ip_route_flags_distance2_vrf,
1721 ip_route_flags_distance2_vrf_cmd,
1722 "ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR,
1723 IP_STR
1724 "Establish static routes\n"
1725 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1726 "Emit an ICMP unreachable when matched\n"
1727 "Silently discard pkts when matched\n"
1728 "Distance value for this route\n"
1729 VRF_CMD_HELP_STR)
1730{
Piotr Chytłade24f822007-06-28 00:09:28 +02001731 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
1732 NULL, argv[1], NULL, argv[2], argv[3]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001733}
1734
1735DEFUN (ip_route_mask_distance_vrf,
1736 ip_route_mask_distance_vrf_cmd,
1737 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
1738 IP_STR
1739 "Establish static routes\n"
1740 "IP destination prefix\n"
1741 "IP destination prefix mask\n"
1742 "IP gateway address\n"
1743 "IP gateway interface name\n"
1744 "Null interface\n"
1745 "Distance value for this route\n"
1746 VRF_CMD_HELP_STR)
1747{
Piotr Chytłade24f822007-06-28 00:09:28 +02001748 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
1749 argv[2], NULL, NULL, argv[3], argv[4]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001750}
1751
1752DEFUN (ip_route_mask_flags_distance_vrf,
1753 ip_route_mask_flags_distance_vrf_cmd,
1754 "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
1755 IP_STR
1756 "Establish static routes\n"
1757 "IP destination prefix\n"
1758 "IP destination prefix mask\n"
1759 "IP gateway address\n"
1760 "IP gateway interface name\n"
1761 "Emit an ICMP unreachable when matched\n"
1762 "Silently discard pkts when matched\n"
1763 "Distance value for this route\n"
1764 VRF_CMD_HELP_STR)
1765{
Piotr Chytłade24f822007-06-28 00:09:28 +02001766 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
1767 argv[2], argv[3], NULL, argv[4], argv[5]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001768}
1769
1770DEFUN (ip_route_mask_flags_distance2_vrf,
1771 ip_route_mask_flags_distance2_vrf_cmd,
1772 "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR,
1773 IP_STR
1774 "Establish static routes\n"
1775 "IP destination prefix\n"
1776 "IP destination prefix mask\n"
1777 "Emit an ICMP unreachable when matched\n"
1778 "Silently discard pkts when matched\n"
1779 "Distance value for this route\n"
1780 VRF_CMD_HELP_STR)
1781{
Piotr Chytłade24f822007-06-28 00:09:28 +02001782 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
1783 NULL, argv[2], NULL, argv[3], argv[4]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001784}
1785
1786DEFUN (no_ip_route_vrf,
1787 no_ip_route_vrf_cmd,
1788 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
1789 NO_STR
1790 IP_STR
1791 "Establish static routes\n"
1792 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1793 "IP gateway address\n"
1794 "IP gateway interface name\n"
1795 "Null interface\n"
1796 VRF_CMD_HELP_STR)
1797{
Piotr Chytłade24f822007-06-28 00:09:28 +02001798 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0],
1799 NULL, argv[1], NULL, NULL, NULL,
1800 (argc > 3) ? argv[3] : argv[2]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001801}
1802
1803ALIAS (no_ip_route_vrf,
1804 no_ip_route_flags_vrf_cmd,
1805 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
1806 NO_STR
1807 IP_STR
1808 "Establish static routes\n"
1809 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1810 "IP gateway address\n"
1811 "IP gateway interface name\n"
1812 "Emit an ICMP unreachable when matched\n"
1813 "Silently discard pkts when matched\n"
1814 VRF_CMD_HELP_STR)
1815
1816DEFUN (no_ip_route_flags2_vrf,
1817 no_ip_route_flags2_vrf_cmd,
1818 "no ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR,
1819 NO_STR
1820 IP_STR
1821 "Establish static routes\n"
1822 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1823 "Emit an ICMP unreachable when matched\n"
1824 "Silently discard pkts when matched\n"
1825 VRF_CMD_HELP_STR)
1826{
Piotr Chytłade24f822007-06-28 00:09:28 +02001827 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0],
1828 NULL, NULL, NULL, NULL, NULL, argv[2]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001829}
1830
1831DEFUN (no_ip_route_mask_vrf,
1832 no_ip_route_mask_vrf_cmd,
1833 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
1834 NO_STR
1835 IP_STR
1836 "Establish static routes\n"
1837 "IP destination prefix\n"
1838 "IP destination prefix mask\n"
1839 "IP gateway address\n"
1840 "IP gateway interface name\n"
1841 "Null interface\n"
1842 VRF_CMD_HELP_STR)
1843{
Piotr Chytłade24f822007-06-28 00:09:28 +02001844 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
1845 argv[2], NULL, NULL, NULL,
1846 (argc > 4) ? argv[4] : argv[3]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001847}
1848
1849ALIAS (no_ip_route_mask_vrf,
1850 no_ip_route_mask_flags_vrf_cmd,
1851 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
1852 NO_STR
1853 IP_STR
1854 "Establish static routes\n"
1855 "IP destination prefix\n"
1856 "IP destination prefix mask\n"
1857 "IP gateway address\n"
1858 "IP gateway interface name\n"
1859 "Emit an ICMP unreachable when matched\n"
1860 "Silently discard pkts when matched\n"
1861 VRF_CMD_HELP_STR)
1862
1863DEFUN (no_ip_route_mask_flags2_vrf,
1864 no_ip_route_mask_flags2_vrf_cmd,
1865 "no ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR,
1866 NO_STR
1867 IP_STR
1868 "Establish static routes\n"
1869 "IP destination prefix\n"
1870 "IP destination prefix mask\n"
1871 "Emit an ICMP unreachable when matched\n"
1872 "Silently discard pkts when matched\n"
1873 VRF_CMD_HELP_STR)
1874{
Piotr Chytłade24f822007-06-28 00:09:28 +02001875 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
1876 NULL, NULL, NULL, NULL, argv[2]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001877}
1878
1879DEFUN (no_ip_route_distance_vrf,
1880 no_ip_route_distance_vrf_cmd,
1881 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
1882 NO_STR
1883 IP_STR
1884 "Establish static routes\n"
1885 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1886 "IP gateway address\n"
1887 "IP gateway interface name\n"
1888 "Null interface\n"
1889 "Distance value for this route\n"
1890 VRF_CMD_HELP_STR)
1891{
Piotr Chytłade24f822007-06-28 00:09:28 +02001892 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL,
1893 argv[1], NULL, NULL, argv[2], argv[3]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001894}
1895
1896DEFUN (no_ip_route_flags_distance_vrf,
1897 no_ip_route_flags_distance_vrf_cmd,
1898 "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
1899 NO_STR
1900 IP_STR
1901 "Establish static routes\n"
1902 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1903 "IP gateway address\n"
1904 "IP gateway interface name\n"
1905 "Emit an ICMP unreachable when matched\n"
1906 "Silently discard pkts when matched\n"
1907 "Distance value for this route\n"
1908 VRF_CMD_HELP_STR)
1909{
Piotr Chytłade24f822007-06-28 00:09:28 +02001910 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
1911 argv[2], NULL, argv[3], argv[4]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001912}
1913
1914DEFUN (no_ip_route_flags_distance2_vrf,
1915 no_ip_route_flags_distance2_vrf_cmd,
1916 "no ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR,
1917 NO_STR
1918 IP_STR
1919 "Establish static routes\n"
1920 "IP destination prefix (e.g. 10.0.0.0/8)\n"
1921 "Emit an ICMP unreachable when matched\n"
1922 "Silently discard pkts when matched\n"
1923 "Distance value for this route\n"
1924 VRF_CMD_HELP_STR)
1925{
Piotr Chytłade24f822007-06-28 00:09:28 +02001926 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL,
1927 argv[1], NULL, argv[2], argv[3]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001928}
1929
1930DEFUN (no_ip_route_mask_distance_vrf,
1931 no_ip_route_mask_distance_vrf_cmd,
1932 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
1933 NO_STR
1934 IP_STR
1935 "Establish static routes\n"
1936 "IP destination prefix\n"
1937 "IP destination prefix mask\n"
1938 "IP gateway address\n"
1939 "IP gateway interface name\n"
1940 "Null interface\n"
1941 "Distance value for this route\n"
1942 VRF_CMD_HELP_STR)
1943{
Piotr Chytłade24f822007-06-28 00:09:28 +02001944 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
1945 argv[2], NULL, NULL, argv[3], argv[4]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001946}
1947
1948DEFUN (no_ip_route_mask_flags_distance_vrf,
1949 no_ip_route_mask_flags_distance_vrf_cmd,
1950 "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
1951 NO_STR
1952 IP_STR
1953 "Establish static routes\n"
1954 "IP destination prefix\n"
1955 "IP destination prefix mask\n"
1956 "IP gateway address\n"
1957 "IP gateway interface name\n"
1958 "Emit an ICMP unreachable when matched\n"
1959 "Silently discard pkts when matched\n"
1960 "Distance value for this route\n"
1961 VRF_CMD_HELP_STR)
1962{
Piotr Chytłade24f822007-06-28 00:09:28 +02001963 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
1964 argv[3], NULL, argv[4], argv[5]);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02001965}
1966
1967DEFUN (no_ip_route_mask_flags_distance2_vrf,
1968 no_ip_route_mask_flags_distance2_vrf_cmd,
1969 "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR,
1970 NO_STR
1971 IP_STR
1972 "Establish static routes\n"
1973 "IP destination prefix\n"
1974 "IP destination prefix mask\n"
1975 "Emit an ICMP unreachable when matched\n"
1976 "Silently discard pkts when matched\n"
1977 "Distance value for this route\n"
1978 VRF_CMD_HELP_STR)
1979{
Piotr Chytłade24f822007-06-28 00:09:28 +02001980 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL,
1981 argv[2], NULL, argv[3], argv[4]);
hasso457ef552003-05-28 12:02:15 +00001982}
1983
Piotr Chytłafb214472015-12-01 13:47:06 -05001984DEFUN (no_ip_route_mask_flags_tag_distance2,
1985 no_ip_route_mask_flags_tag_distance2_cmd,
1986 "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255>",
1987 NO_STR
1988 IP_STR
1989 "Establish static routes\n"
1990 "IP destination prefix\n"
1991 "IP destination prefix mask\n"
1992 "Emit an ICMP unreachable when matched\n"
1993 "Silently discard pkts when matched\n"
1994 "Tag of this route\n"
1995 "Tag value\n"
1996 "Distance value for this route\n")
1997{
1998 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL,
1999 argv[2], argv[3], argv[4], NULL);
2000}
2001
2002DEFUN (no_ip_route_mask_flags_tag_distance2_vrf,
2003 no_ip_route_mask_flags_tag_distance2_vrf_cmd,
2004 "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
2005 NO_STR
2006 IP_STR
2007 "Establish static routes\n"
2008 "IP destination prefix\n"
2009 "IP destination prefix mask\n"
2010 "Emit an ICMP unreachable when matched\n"
2011 "Silently discard pkts when matched\n"
2012 "Tag of this route\n"
2013 "Tag value\n"
2014 "Distance value for this route\n"
2015 VRF_CMD_HELP_STR)
2016{
2017 return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL,
2018 argv[2], argv[3], argv[4], argv[5]);
2019}
2020
Paul Jakma7514fb72007-05-02 16:05:35 +00002021char *proto_rm[AFI_MAX][ZEBRA_ROUTE_MAX+1]; /* "any" == ZEBRA_ROUTE_MAX */
2022
2023DEFUN (ip_protocol,
2024 ip_protocol_cmd,
2025 "ip protocol PROTO route-map ROUTE-MAP",
2026 NO_STR
2027 "Apply route map to PROTO\n"
2028 "Protocol name\n"
2029 "Route map name\n")
2030{
2031 int i;
2032
2033 if (strcasecmp(argv[0], "any") == 0)
2034 i = ZEBRA_ROUTE_MAX;
2035 else
2036 i = proto_name2num(argv[0]);
2037 if (i < 0)
2038 {
2039 vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
2040 VTY_NEWLINE);
2041 return CMD_WARNING;
2042 }
2043 if (proto_rm[AFI_IP][i])
2044 XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]);
2045 proto_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]);
2046 return CMD_SUCCESS;
2047}
2048
2049DEFUN (no_ip_protocol,
2050 no_ip_protocol_cmd,
2051 "no ip protocol PROTO",
2052 NO_STR
2053 "Remove route map from PROTO\n"
2054 "Protocol name\n")
2055{
2056 int i;
2057
2058 if (strcasecmp(argv[0], "any") == 0)
2059 i = ZEBRA_ROUTE_MAX;
2060 else
2061 i = proto_name2num(argv[0]);
2062 if (i < 0)
2063 {
2064 vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
2065 VTY_NEWLINE);
2066 return CMD_WARNING;
2067 }
2068 if (proto_rm[AFI_IP][i])
2069 XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]);
2070 proto_rm[AFI_IP][i] = NULL;
2071 return CMD_SUCCESS;
2072}
2073
paul718e3742002-12-13 20:15:29 +00002074/* New RIB. Detailed information for IPv4 route. */
paula1ac18c2005-06-28 17:17:12 +00002075static void
David Lamparter3b02fe82015-01-22 19:12:35 +01002076vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
paul718e3742002-12-13 20:15:29 +00002077{
2078 struct rib *rib;
Christian Frankefa713d92013-07-05 15:35:37 +00002079 struct nexthop *nexthop, *tnexthop;
2080 int recursing;
Timo Teräs53a5c392015-05-23 11:08:40 +03002081 char buf[PREFIX_STRLEN];
paul718e3742002-12-13 20:15:29 +00002082
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00002083 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00002084 {
David Lamparterb7cce952015-03-07 08:40:48 +01002085 const char *mcast_info = "";
David Lamparter3b02fe82015-01-22 19:12:35 +01002086 if (mcast)
2087 {
2088 rib_table_info_t *info = rn->table->info;
2089 mcast_info = (info->safi == SAFI_MULTICAST)
2090 ? " using Multicast RIB"
2091 : " using Unicast RIB";
2092 }
Timo Teräs53a5c392015-05-23 11:08:40 +03002093 vty_out (vty, "Routing entry for %s%s%s",
2094 prefix2str (&rn->p, buf, sizeof(buf)), mcast_info,
2095 VTY_NEWLINE);
ajsf52d13c2005-10-01 17:38:06 +00002096 vty_out (vty, " Known via \"%s\"", zebra_route_string (rib->type));
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02002097 vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric);
Timo Teräsb11f3b52015-11-02 16:50:07 +02002098 if (rib->mtu)
2099 vty_out (vty, ", mtu %u", rib->mtu);
Piotr Chytłade24f822007-06-28 00:09:28 +02002100 vty_out (vty, ", tag %d", rib->tag);
Feng Lu4364ee52015-05-22 11:40:03 +02002101 vty_out (vty, ", vrf %u", rib->vrf_id);
paul718e3742002-12-13 20:15:29 +00002102 if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
Timo Teräs53a5c392015-05-23 11:08:40 +03002103 vty_out (vty, ", best");
Timo Teräs325823a2016-01-15 17:36:31 +02002104 if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_FIB_OVERRIDE))
2105 vty_out (vty, ", fib-override");
2106 if (CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB))
2107 vty_out (vty, ", fib");
paul718e3742002-12-13 20:15:29 +00002108 if (rib->refcnt)
Timo Teräs53a5c392015-05-23 11:08:40 +03002109 vty_out (vty, ", refcnt %ld", rib->refcnt);
hasso81dfcaa2003-05-25 19:21:25 +00002110 if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
2111 vty_out (vty, ", blackhole");
2112 if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
2113 vty_out (vty, ", reject");
paul718e3742002-12-13 20:15:29 +00002114 vty_out (vty, "%s", VTY_NEWLINE);
2115
2116#define ONE_DAY_SECOND 60*60*24
2117#define ONE_WEEK_SECOND 60*60*24*7
2118 if (rib->type == ZEBRA_ROUTE_RIP
Timo Teräs53a5c392015-05-23 11:08:40 +03002119 || rib->type == ZEBRA_ROUTE_RIPNG
2120 || rib->type == ZEBRA_ROUTE_OSPF
2121 || rib->type == ZEBRA_ROUTE_OSPF6
2122 || rib->type == ZEBRA_ROUTE_BABEL
2123 || rib->type == ZEBRA_ROUTE_ISIS
Timo Teräsdafa05e2017-01-19 17:27:01 +02002124 || rib->type == ZEBRA_ROUTE_NHRP
Timo Teräs53a5c392015-05-23 11:08:40 +03002125 || rib->type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00002126 {
2127 time_t uptime;
2128 struct tm *tm;
2129
2130 uptime = time (NULL);
2131 uptime -= rib->uptime;
2132 tm = gmtime (&uptime);
2133
2134 vty_out (vty, " Last update ");
2135
2136 if (uptime < ONE_DAY_SECOND)
2137 vty_out (vty, "%02d:%02d:%02d",
2138 tm->tm_hour, tm->tm_min, tm->tm_sec);
2139 else if (uptime < ONE_WEEK_SECOND)
2140 vty_out (vty, "%dd%02dh%02dm",
2141 tm->tm_yday, tm->tm_hour, tm->tm_min);
2142 else
2143 vty_out (vty, "%02dw%dd%02dh",
2144 tm->tm_yday/7,
2145 tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
2146 vty_out (vty, " ago%s", VTY_NEWLINE);
2147 }
2148
Christian Frankefa713d92013-07-05 15:35:37 +00002149 for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
Timo Teräs53a5c392015-05-23 11:08:40 +03002150 {
Timo Teräs7e73eb72016-04-09 17:22:32 +03002151 vty_out (vty, " %c%c%s",
2152 CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE) ? '>' : ' ',
Timo Teräs53a5c392015-05-23 11:08:40 +03002153 CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ',
2154 recursing ? " " : "");
Paul Jakma7514fb72007-05-02 16:05:35 +00002155
Timo Teräs53a5c392015-05-23 11:08:40 +03002156 switch (nexthop->type)
2157 {
2158 case NEXTHOP_TYPE_IPV4:
2159 case NEXTHOP_TYPE_IPV4_IFINDEX:
2160 vty_out (vty, " %s", inet_ntoa (nexthop->gate.ipv4));
2161 if (nexthop->ifindex)
Feng Lu0d0686f2015-05-22 11:40:02 +02002162 vty_out (vty, ", via %s",
2163 ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
Timo Teräs53a5c392015-05-23 11:08:40 +03002164 break;
2165 case NEXTHOP_TYPE_IPV6:
2166 case NEXTHOP_TYPE_IPV6_IFINDEX:
2167 case NEXTHOP_TYPE_IPV6_IFNAME:
2168 vty_out (vty, " %s",
2169 inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, sizeof(buf)));
2170 if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME)
2171 vty_out (vty, ", %s", nexthop->ifname);
2172 else if (nexthop->ifindex)
Feng Lu0d0686f2015-05-22 11:40:02 +02002173 vty_out (vty, ", via %s",
2174 ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
Timo Teräs53a5c392015-05-23 11:08:40 +03002175 break;
2176 case NEXTHOP_TYPE_IFINDEX:
2177 vty_out (vty, " directly connected, %s",
Feng Lu0d0686f2015-05-22 11:40:02 +02002178 ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
Timo Teräs53a5c392015-05-23 11:08:40 +03002179 break;
2180 case NEXTHOP_TYPE_IFNAME:
2181 vty_out (vty, " directly connected, %s", nexthop->ifname);
2182 break;
2183 case NEXTHOP_TYPE_BLACKHOLE:
2184 vty_out (vty, " directly connected, Null0");
2185 break;
2186 default:
2187 break;
2188 }
2189 if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
2190 vty_out (vty, " inactive");
paul718e3742002-12-13 20:15:29 +00002191
Timo Teräs53a5c392015-05-23 11:08:40 +03002192 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
2193 vty_out (vty, " onlink");
paul718e3742002-12-13 20:15:29 +00002194
Timo Teräs53a5c392015-05-23 11:08:40 +03002195 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
2196 vty_out (vty, " (recursive)");
Christian Frankee8d3d292013-07-05 15:35:39 +00002197
Timo Teräs53a5c392015-05-23 11:08:40 +03002198 switch (nexthop->type)
Paul Jakma7514fb72007-05-02 16:05:35 +00002199 {
2200 case NEXTHOP_TYPE_IPV4:
2201 case NEXTHOP_TYPE_IPV4_IFINDEX:
2202 case NEXTHOP_TYPE_IPV4_IFNAME:
2203 if (nexthop->src.ipv4.s_addr)
2204 {
Timo Teräs53a5c392015-05-23 11:08:40 +03002205 if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf))
2206 vty_out (vty, ", src %s", buf);
Paul Jakma7514fb72007-05-02 16:05:35 +00002207 }
2208 break;
Andrew J. Schorr09303312007-05-30 20:10:34 +00002209#ifdef HAVE_IPV6
Paul Jakma7514fb72007-05-02 16:05:35 +00002210 case NEXTHOP_TYPE_IPV6:
2211 case NEXTHOP_TYPE_IPV6_IFINDEX:
2212 case NEXTHOP_TYPE_IPV6_IFNAME:
2213 if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))
2214 {
Timo Teräs53a5c392015-05-23 11:08:40 +03002215 if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf))
2216 vty_out (vty, ", src %s", buf);
Paul Jakma7514fb72007-05-02 16:05:35 +00002217 }
2218 break;
Andrew J. Schorr09303312007-05-30 20:10:34 +00002219#endif /* HAVE_IPV6 */
Paul Jakma7514fb72007-05-02 16:05:35 +00002220 default:
Timo Teräs53a5c392015-05-23 11:08:40 +03002221 break;
Paul Jakma7514fb72007-05-02 16:05:35 +00002222 }
Timo Teräs53a5c392015-05-23 11:08:40 +03002223 vty_out (vty, "%s", VTY_NEWLINE);
2224 }
paul718e3742002-12-13 20:15:29 +00002225 vty_out (vty, "%s", VTY_NEWLINE);
2226 }
2227}
2228
paula1ac18c2005-06-28 17:17:12 +00002229static void
paul718e3742002-12-13 20:15:29 +00002230vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)
2231{
Christian Frankefa713d92013-07-05 15:35:37 +00002232 struct nexthop *nexthop, *tnexthop;
2233 int recursing;
paul718e3742002-12-13 20:15:29 +00002234 int len = 0;
2235 char buf[BUFSIZ];
2236
2237 /* Nexthop information. */
Christian Frankefa713d92013-07-05 15:35:37 +00002238 for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
paul718e3742002-12-13 20:15:29 +00002239 {
2240 if (nexthop == rib->nexthop)
2241 {
2242 /* Prefix information. */
Timo Teräs53a5c392015-05-23 11:08:40 +03002243 len = vty_out (vty, "%c%c%c %s",
ajsf52d13c2005-10-01 17:38:06 +00002244 zebra_route_char (rib->type),
paul718e3742002-12-13 20:15:29 +00002245 CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)
2246 ? '>' : ' ',
2247 CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
2248 ? '*' : ' ',
Timo Teräs53a5c392015-05-23 11:08:40 +03002249 prefix2str (&rn->p, buf, sizeof buf));
paul718e3742002-12-13 20:15:29 +00002250
2251 /* Distance and metric display. */
2252 if (rib->type != ZEBRA_ROUTE_CONNECT
2253 && rib->type != ZEBRA_ROUTE_KERNEL)
2254 len += vty_out (vty, " [%d/%d]", rib->distance,
2255 rib->metric);
Feng Lu4364ee52015-05-22 11:40:03 +02002256
2257 if (rib->vrf_id != VRF_DEFAULT)
2258 len += vty_out (vty, " [vrf %u]", rib->vrf_id);
paul718e3742002-12-13 20:15:29 +00002259 }
2260 else
2261 vty_out (vty, " %c%*c",
2262 CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
2263 ? '*' : ' ',
Christian Frankefa713d92013-07-05 15:35:37 +00002264 len - 3 + (2 * recursing), ' ');
paul718e3742002-12-13 20:15:29 +00002265
2266 switch (nexthop->type)
Timo Teräs53a5c392015-05-23 11:08:40 +03002267 {
2268 case NEXTHOP_TYPE_IPV4:
2269 case NEXTHOP_TYPE_IPV4_IFINDEX:
2270 vty_out (vty, " via %s", inet_ntoa (nexthop->gate.ipv4));
2271 if (nexthop->ifindex)
Feng Lu0d0686f2015-05-22 11:40:02 +02002272 vty_out (vty, ", %s",
2273 ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
Timo Teräs53a5c392015-05-23 11:08:40 +03002274 break;
2275 case NEXTHOP_TYPE_IPV6:
2276 case NEXTHOP_TYPE_IPV6_IFINDEX:
2277 case NEXTHOP_TYPE_IPV6_IFNAME:
2278 vty_out (vty, " via %s",
2279 inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ));
2280 if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME)
2281 vty_out (vty, ", %s", nexthop->ifname);
2282 else if (nexthop->ifindex)
Feng Lu0d0686f2015-05-22 11:40:02 +02002283 vty_out (vty, ", %s",
2284 ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
Timo Teräs53a5c392015-05-23 11:08:40 +03002285 break;
2286 case NEXTHOP_TYPE_IFINDEX:
2287 vty_out (vty, " is directly connected, %s",
Feng Lu0d0686f2015-05-22 11:40:02 +02002288 ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
Timo Teräs53a5c392015-05-23 11:08:40 +03002289 break;
2290 case NEXTHOP_TYPE_IFNAME:
2291 vty_out (vty, " is directly connected, %s", nexthop->ifname);
2292 break;
2293 case NEXTHOP_TYPE_BLACKHOLE:
2294 vty_out (vty, " is directly connected, Null0");
2295 break;
2296 default:
2297 break;
2298 }
paul718e3742002-12-13 20:15:29 +00002299 if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
Timo Teräs53a5c392015-05-23 11:08:40 +03002300 vty_out (vty, " inactive");
paul718e3742002-12-13 20:15:29 +00002301
Christian Frankee8d3d292013-07-05 15:35:39 +00002302 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
Timo Teräs53a5c392015-05-23 11:08:40 +03002303 vty_out (vty, " onlink");
Christian Frankee8d3d292013-07-05 15:35:39 +00002304
paul718e3742002-12-13 20:15:29 +00002305 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
Timo Teräs53a5c392015-05-23 11:08:40 +03002306 vty_out (vty, " (recursive)");
Christian Frankefa713d92013-07-05 15:35:37 +00002307
Paul Jakma7514fb72007-05-02 16:05:35 +00002308 switch (nexthop->type)
2309 {
2310 case NEXTHOP_TYPE_IPV4:
2311 case NEXTHOP_TYPE_IPV4_IFINDEX:
2312 case NEXTHOP_TYPE_IPV4_IFNAME:
2313 if (nexthop->src.ipv4.s_addr)
2314 {
Timo Teräs53a5c392015-05-23 11:08:40 +03002315 if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf))
Paul Jakma7514fb72007-05-02 16:05:35 +00002316 vty_out (vty, ", src %s", buf);
2317 }
2318 break;
Andrew J. Schorr09303312007-05-30 20:10:34 +00002319#ifdef HAVE_IPV6
Paul Jakma7514fb72007-05-02 16:05:35 +00002320 case NEXTHOP_TYPE_IPV6:
2321 case NEXTHOP_TYPE_IPV6_IFINDEX:
2322 case NEXTHOP_TYPE_IPV6_IFNAME:
2323 if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))
2324 {
Timo Teräs53a5c392015-05-23 11:08:40 +03002325 if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf))
Paul Jakma7514fb72007-05-02 16:05:35 +00002326 vty_out (vty, ", src %s", buf);
2327 }
2328 break;
Andrew J. Schorr09303312007-05-30 20:10:34 +00002329#endif /* HAVE_IPV6 */
Paul Jakma7514fb72007-05-02 16:05:35 +00002330 default:
Timo Teräs53a5c392015-05-23 11:08:40 +03002331 break;
Paul Jakma7514fb72007-05-02 16:05:35 +00002332 }
paul718e3742002-12-13 20:15:29 +00002333
hasso81dfcaa2003-05-25 19:21:25 +00002334 if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
2335 vty_out (vty, ", bh");
2336 if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
2337 vty_out (vty, ", rej");
2338
paul718e3742002-12-13 20:15:29 +00002339 if (rib->type == ZEBRA_ROUTE_RIP
Timo Teräs53a5c392015-05-23 11:08:40 +03002340 || rib->type == ZEBRA_ROUTE_RIPNG
2341 || rib->type == ZEBRA_ROUTE_OSPF
2342 || rib->type == ZEBRA_ROUTE_OSPF6
2343 || rib->type == ZEBRA_ROUTE_BABEL
2344 || rib->type == ZEBRA_ROUTE_ISIS
Timo Teräsdafa05e2017-01-19 17:27:01 +02002345 || rib->type == ZEBRA_ROUTE_NHRP
Timo Teräs53a5c392015-05-23 11:08:40 +03002346 || rib->type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00002347 {
2348 time_t uptime;
2349 struct tm *tm;
2350
2351 uptime = time (NULL);
2352 uptime -= rib->uptime;
2353 tm = gmtime (&uptime);
2354
2355#define ONE_DAY_SECOND 60*60*24
2356#define ONE_WEEK_SECOND 60*60*24*7
2357
2358 if (uptime < ONE_DAY_SECOND)
2359 vty_out (vty, ", %02d:%02d:%02d",
2360 tm->tm_hour, tm->tm_min, tm->tm_sec);
2361 else if (uptime < ONE_WEEK_SECOND)
2362 vty_out (vty, ", %dd%02dh%02dm",
2363 tm->tm_yday, tm->tm_hour, tm->tm_min);
2364 else
2365 vty_out (vty, ", %02dw%dd%02dh",
2366 tm->tm_yday/7,
2367 tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
2368 }
2369 vty_out (vty, "%s", VTY_NEWLINE);
2370 }
2371}
2372
paul718e3742002-12-13 20:15:29 +00002373DEFUN (show_ip_route,
2374 show_ip_route_cmd,
2375 "show ip route",
2376 SHOW_STR
2377 IP_STR
2378 "IP routing table\n")
2379{
Feng Lu4364ee52015-05-22 11:40:03 +02002380 vrf_id_t vrf_id = VRF_DEFAULT;
2381
2382 if (argc > 0)
2383 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
2384
2385 return do_show_ip_route(vty, SAFI_UNICAST, vrf_id);
Everton Marques33d86db2014-07-14 11:19:00 -03002386}
2387
Feng Lu4364ee52015-05-22 11:40:03 +02002388static int do_show_ip_route(struct vty *vty, safi_t safi, vrf_id_t vrf_id)
2389{
paul718e3742002-12-13 20:15:29 +00002390 struct route_table *table;
2391 struct route_node *rn;
2392 struct rib *rib;
2393 int first = 1;
2394
Feng Lu4364ee52015-05-22 11:40:03 +02002395 table = zebra_vrf_table (AFI_IP, safi, vrf_id);
paul718e3742002-12-13 20:15:29 +00002396 if (! table)
2397 return CMD_SUCCESS;
2398
2399 /* Show all IPv4 routes. */
2400 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00002401 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00002402 {
2403 if (first)
2404 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02002405 vty_out (vty, SHOW_ROUTE_V4_HEADER);
paul718e3742002-12-13 20:15:29 +00002406 first = 0;
2407 }
2408 vty_show_ip_route (vty, rn, rib);
2409 }
2410 return CMD_SUCCESS;
2411}
2412
Feng Lu4364ee52015-05-22 11:40:03 +02002413ALIAS (show_ip_route,
2414 show_ip_route_vrf_cmd,
2415 "show ip route " VRF_CMD_STR,
2416 SHOW_STR
2417 IP_STR
2418 "IP routing table\n"
2419 VRF_CMD_HELP_STR)
2420
Pradosh Mohapatra60cc9592015-11-09 20:21:41 -05002421DEFUN (show_ip_nht,
2422 show_ip_nht_cmd,
2423 "show ip nht",
2424 SHOW_STR
2425 IP_STR
2426 "IP nexthop tracking table\n")
2427{
2428 zebra_print_rnh_table(0, AF_INET, vty);
2429 return CMD_SUCCESS;
2430}
2431
2432DEFUN (show_ipv6_nht,
2433 show_ipv6_nht_cmd,
2434 "show ipv6 nht",
2435 SHOW_STR
2436 IP_STR
2437 "IPv6 nexthop tracking table\n")
2438{
2439 zebra_print_rnh_table(0, AF_INET6, vty);
2440 return CMD_SUCCESS;
2441}
2442
Piotr Chytłafb214472015-12-01 13:47:06 -05002443DEFUN (show_ip_route_tag,
2444 show_ip_route_tag_cmd,
2445 "show ip route tag <1-65535>",
2446 SHOW_STR
2447 IP_STR
2448 "IP routing table\n"
2449 "Show only routes with tag\n"
2450 "Tag value\n")
2451{
2452 struct route_table *table;
2453 struct route_node *rn;
2454 struct rib *rib;
2455 int first = 1;
Paul Jakma96d10602016-07-01 14:23:45 +01002456 route_tag_t tag = 0;
Piotr Chytłafb214472015-12-01 13:47:06 -05002457 vrf_id_t vrf_id = VRF_DEFAULT;
2458
2459 if (argv[0])
2460 tag = atoi(argv[0]);
2461
2462 if (argc == 2)
2463 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
2464
2465 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
2466 if (! table)
2467 return CMD_SUCCESS;
2468
2469 /* Show all IPv4 routes with matching tag value. */
2470 for (rn = route_top (table); rn; rn = route_next (rn))
2471 RNODE_FOREACH_RIB (rn, rib)
2472 {
2473 if (rib->tag != tag)
2474 continue;
2475
2476 if (first)
2477 {
2478 vty_out (vty, SHOW_ROUTE_V4_HEADER);
2479 first = 0;
2480 }
2481 vty_show_ip_route (vty, rn, rib);
2482 }
2483 return CMD_SUCCESS;
2484}
2485
2486ALIAS (show_ip_route_tag,
2487 show_ip_route_tag_vrf_cmd,
2488 "show ip route tag <1-65535>" VRF_CMD_STR,
2489 SHOW_STR
2490 IP_STR
2491 "IP routing table\n"
2492 "Show only routes with tag\n"
2493 "Tag value\n"
2494 VRF_CMD_HELP_STR)
2495
paul718e3742002-12-13 20:15:29 +00002496DEFUN (show_ip_route_prefix_longer,
2497 show_ip_route_prefix_longer_cmd,
2498 "show ip route A.B.C.D/M longer-prefixes",
2499 SHOW_STR
2500 IP_STR
2501 "IP routing table\n"
2502 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2503 "Show route matching the specified Network/Mask pair only\n")
2504{
2505 struct route_table *table;
2506 struct route_node *rn;
2507 struct rib *rib;
2508 struct prefix p;
2509 int ret;
2510 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02002511 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002512
2513 ret = str2prefix (argv[0], &p);
2514 if (! ret)
2515 {
2516 vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
2517 return CMD_WARNING;
2518 }
Feng Lu4364ee52015-05-22 11:40:03 +02002519
2520 if (argc > 1)
2521 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
2522
2523 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00002524 if (! table)
2525 return CMD_SUCCESS;
2526
2527 /* Show matched type IPv4 routes. */
2528 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00002529 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00002530 if (prefix_match (&p, &rn->p))
2531 {
2532 if (first)
2533 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02002534 vty_out (vty, SHOW_ROUTE_V4_HEADER);
paul718e3742002-12-13 20:15:29 +00002535 first = 0;
2536 }
2537 vty_show_ip_route (vty, rn, rib);
2538 }
2539 return CMD_SUCCESS;
2540}
2541
Feng Lu4364ee52015-05-22 11:40:03 +02002542ALIAS (show_ip_route_prefix_longer,
2543 show_ip_route_prefix_longer_vrf_cmd,
2544 "show ip route A.B.C.D/M longer-prefixes " VRF_CMD_STR,
2545 SHOW_STR
2546 IP_STR
2547 "IP routing table\n"
2548 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2549 "Show route matching the specified Network/Mask pair only\n"
2550 VRF_CMD_HELP_STR)
2551
paul718e3742002-12-13 20:15:29 +00002552DEFUN (show_ip_route_supernets,
2553 show_ip_route_supernets_cmd,
2554 "show ip route supernets-only",
2555 SHOW_STR
2556 IP_STR
2557 "IP routing table\n"
2558 "Show supernet entries only\n")
2559{
2560 struct route_table *table;
2561 struct route_node *rn;
2562 struct rib *rib;
Feng Lu4364ee52015-05-22 11:40:03 +02002563 u_int32_t addr;
paul718e3742002-12-13 20:15:29 +00002564 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02002565 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002566
Feng Lu4364ee52015-05-22 11:40:03 +02002567 if (argc > 0)
2568 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
2569
2570 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00002571 if (! table)
2572 return CMD_SUCCESS;
2573
2574 /* Show matched type IPv4 routes. */
2575 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00002576 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00002577 {
2578 addr = ntohl (rn->p.u.prefix4.s_addr);
2579
2580 if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
2581 || (IN_CLASSB (addr) && rn->p.prefixlen < 16)
Feng Lu4364ee52015-05-22 11:40:03 +02002582 || (IN_CLASSA (addr) && rn->p.prefixlen < 8))
paul718e3742002-12-13 20:15:29 +00002583 {
2584 if (first)
2585 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02002586 vty_out (vty, SHOW_ROUTE_V4_HEADER);
paul718e3742002-12-13 20:15:29 +00002587 first = 0;
2588 }
2589 vty_show_ip_route (vty, rn, rib);
2590 }
2591 }
2592 return CMD_SUCCESS;
2593}
2594
Feng Lu4364ee52015-05-22 11:40:03 +02002595ALIAS (show_ip_route_supernets,
2596 show_ip_route_supernets_vrf_cmd,
2597 "show ip route supernets-only " VRF_CMD_STR,
2598 SHOW_STR
2599 IP_STR
2600 "IP routing table\n"
2601 "Show supernet entries only\n"
2602 VRF_CMD_HELP_STR)
2603
paul718e3742002-12-13 20:15:29 +00002604DEFUN (show_ip_route_protocol,
2605 show_ip_route_protocol_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02002606 "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA,
paul718e3742002-12-13 20:15:29 +00002607 SHOW_STR
2608 IP_STR
2609 "IP routing table\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02002610 QUAGGA_IP_REDIST_HELP_STR_ZEBRA)
paul718e3742002-12-13 20:15:29 +00002611{
2612 int type;
2613 struct route_table *table;
2614 struct route_node *rn;
2615 struct rib *rib;
2616 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02002617 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002618
David Lampartere0ca5fd2009-09-16 01:52:42 +02002619 type = proto_redistnum (AFI_IP, argv[0]);
2620 if (type < 0)
paul718e3742002-12-13 20:15:29 +00002621 {
2622 vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
2623 return CMD_WARNING;
2624 }
Feng Lu4364ee52015-05-22 11:40:03 +02002625
2626 if (argc > 1)
2627 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
2628
2629 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00002630 if (! table)
2631 return CMD_SUCCESS;
2632
2633 /* Show matched type IPv4 routes. */
2634 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00002635 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00002636 if (rib->type == type)
2637 {
2638 if (first)
2639 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02002640 vty_out (vty, SHOW_ROUTE_V4_HEADER);
paul718e3742002-12-13 20:15:29 +00002641 first = 0;
2642 }
2643 vty_show_ip_route (vty, rn, rib);
2644 }
2645 return CMD_SUCCESS;
2646}
2647
Feng Lu4364ee52015-05-22 11:40:03 +02002648ALIAS (show_ip_route_protocol,
2649 show_ip_route_protocol_vrf_cmd,
2650 "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_CMD_STR,
2651 SHOW_STR
2652 IP_STR
2653 "IP routing table\n"
2654 QUAGGA_IP_REDIST_HELP_STR_ZEBRA
2655 VRF_CMD_HELP_STR)
2656
paul718e3742002-12-13 20:15:29 +00002657DEFUN (show_ip_route_addr,
2658 show_ip_route_addr_cmd,
2659 "show ip route A.B.C.D",
2660 SHOW_STR
2661 IP_STR
2662 "IP routing table\n"
2663 "Network in the IP routing table to display\n")
2664{
2665 int ret;
2666 struct prefix_ipv4 p;
2667 struct route_table *table;
2668 struct route_node *rn;
Feng Lu4364ee52015-05-22 11:40:03 +02002669 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002670
2671 ret = str2prefix_ipv4 (argv[0], &p);
2672 if (ret <= 0)
2673 {
2674 vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
2675 return CMD_WARNING;
2676 }
2677
Feng Lu4364ee52015-05-22 11:40:03 +02002678 if (argc > 1)
2679 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
2680
2681 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00002682 if (! table)
2683 return CMD_SUCCESS;
2684
2685 rn = route_node_match (table, (struct prefix *) &p);
2686 if (! rn)
2687 {
2688 vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
2689 return CMD_WARNING;
2690 }
2691
David Lamparter3b02fe82015-01-22 19:12:35 +01002692 vty_show_ip_route_detail (vty, rn, 0);
paul718e3742002-12-13 20:15:29 +00002693
2694 route_unlock_node (rn);
2695
2696 return CMD_SUCCESS;
2697}
2698
Feng Lu4364ee52015-05-22 11:40:03 +02002699ALIAS (show_ip_route_addr,
2700 show_ip_route_addr_vrf_cmd,
2701 "show ip route A.B.C.D " VRF_CMD_STR,
2702 SHOW_STR
2703 IP_STR
2704 "IP routing table\n"
2705 "Network in the IP routing table to display\n"
2706 VRF_CMD_HELP_STR)
2707
paul718e3742002-12-13 20:15:29 +00002708DEFUN (show_ip_route_prefix,
2709 show_ip_route_prefix_cmd,
2710 "show ip route A.B.C.D/M",
2711 SHOW_STR
2712 IP_STR
2713 "IP routing table\n"
2714 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
2715{
2716 int ret;
2717 struct prefix_ipv4 p;
2718 struct route_table *table;
2719 struct route_node *rn;
Feng Lu4364ee52015-05-22 11:40:03 +02002720 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002721
2722 ret = str2prefix_ipv4 (argv[0], &p);
2723 if (ret <= 0)
2724 {
2725 vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
2726 return CMD_WARNING;
2727 }
2728
Feng Lu4364ee52015-05-22 11:40:03 +02002729 if (argc > 1)
2730 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
2731
2732 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00002733 if (! table)
2734 return CMD_SUCCESS;
2735
2736 rn = route_node_match (table, (struct prefix *) &p);
2737 if (! rn || rn->p.prefixlen != p.prefixlen)
2738 {
2739 vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
Lu Feng969d3552014-10-21 06:24:07 +00002740 if (rn)
2741 route_unlock_node (rn);
paul718e3742002-12-13 20:15:29 +00002742 return CMD_WARNING;
2743 }
2744
David Lamparter3b02fe82015-01-22 19:12:35 +01002745 vty_show_ip_route_detail (vty, rn, 0);
paul718e3742002-12-13 20:15:29 +00002746
2747 route_unlock_node (rn);
2748
2749 return CMD_SUCCESS;
2750}
2751
Feng Lu4364ee52015-05-22 11:40:03 +02002752ALIAS (show_ip_route_prefix,
2753 show_ip_route_prefix_vrf_cmd,
2754 "show ip route A.B.C.D/M " VRF_CMD_STR,
2755 SHOW_STR
2756 IP_STR
2757 "IP routing table\n"
2758 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2759 VRF_CMD_HELP_STR)
2760
paula1ac18c2005-06-28 17:17:12 +00002761static void
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002762vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
paul718e3742002-12-13 20:15:29 +00002763{
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002764 struct route_node *rn;
2765 struct rib *rib;
2766 struct nexthop *nexthop;
2767#define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
2768#define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
2769 u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
2770 u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1];
2771 u_int32_t i;
paul718e3742002-12-13 20:15:29 +00002772
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002773 memset (&rib_cnt, 0, sizeof(rib_cnt));
2774 memset (&fib_cnt, 0, sizeof(fib_cnt));
2775 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00002776 RNODE_FOREACH_RIB (rn, rib)
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002777 for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
2778 {
2779 rib_cnt[ZEBRA_ROUTE_TOTAL]++;
2780 rib_cnt[rib->type]++;
Christian Frankefa713d92013-07-05 15:35:37 +00002781 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
2782 || nexthop_has_fib_child(nexthop))
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002783 {
2784 fib_cnt[ZEBRA_ROUTE_TOTAL]++;
2785 fib_cnt[rib->type]++;
2786 }
2787 if (rib->type == ZEBRA_ROUTE_BGP &&
2788 CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP))
2789 {
2790 rib_cnt[ZEBRA_ROUTE_IBGP]++;
Christian Frankefa713d92013-07-05 15:35:37 +00002791 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
2792 || nexthop_has_fib_child(nexthop))
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002793 fib_cnt[ZEBRA_ROUTE_IBGP]++;
2794 }
2795 }
paul718e3742002-12-13 20:15:29 +00002796
Feng Lu4364ee52015-05-22 11:40:03 +02002797 vty_out (vty, "%-20s %-20s %s (vrf %u)%s",
2798 "Route Source", "Routes", "FIB",
2799 ((rib_table_info_t *)table->info)->zvrf->vrf_id,
2800 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002801
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002802 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
2803 {
2804 if (rib_cnt[i] > 0)
2805 {
2806 if (i == ZEBRA_ROUTE_BGP)
2807 {
2808 vty_out (vty, "%-20s %-20d %-20d %s", "ebgp",
2809 rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP],
2810 fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP],
2811 VTY_NEWLINE);
2812 vty_out (vty, "%-20s %-20d %-20d %s", "ibgp",
2813 rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP],
2814 VTY_NEWLINE);
2815 }
2816 else
2817 vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i),
2818 rib_cnt[i], fib_cnt[i], VTY_NEWLINE);
2819 }
2820 }
paul718e3742002-12-13 20:15:29 +00002821
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002822 vty_out (vty, "------%s", VTY_NEWLINE);
2823 vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
2824 fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);
Feng Lu4364ee52015-05-22 11:40:03 +02002825 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002826}
2827
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07002828/*
2829 * Implementation of the ip route summary prefix command.
2830 *
2831 * This command prints the primary prefixes that have been installed by various
2832 * protocols on the box.
2833 *
2834 */
2835static void
2836vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table)
2837{
2838 struct route_node *rn;
2839 struct rib *rib;
2840 struct nexthop *nexthop;
2841#define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
2842#define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
2843 u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
2844 u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1];
2845 u_int32_t i;
2846 int cnt;
2847
2848 memset (&rib_cnt, 0, sizeof(rib_cnt));
2849 memset (&fib_cnt, 0, sizeof(fib_cnt));
2850 for (rn = route_top (table); rn; rn = route_next (rn))
2851 RNODE_FOREACH_RIB (rn, rib)
2852 {
2853
2854 /*
2855 * In case of ECMP, count only once.
2856 */
2857 cnt = 0;
2858 for (nexthop = rib->nexthop; (!cnt && nexthop); nexthop = nexthop->next)
2859 {
2860 cnt++;
2861 rib_cnt[ZEBRA_ROUTE_TOTAL]++;
2862 rib_cnt[rib->type]++;
2863 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
2864 {
2865 fib_cnt[ZEBRA_ROUTE_TOTAL]++;
2866 fib_cnt[rib->type]++;
2867 }
2868 if (rib->type == ZEBRA_ROUTE_BGP &&
2869 CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP))
2870 {
2871 rib_cnt[ZEBRA_ROUTE_IBGP]++;
2872 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
2873 fib_cnt[ZEBRA_ROUTE_IBGP]++;
2874 }
2875 }
2876 }
2877
Feng Lu4364ee52015-05-22 11:40:03 +02002878 vty_out (vty, "%-20s %-20s %s (vrf %u)%s",
2879 "Route Source", "Prefix Routes", "FIB",
2880 ((rib_table_info_t *)table->info)->zvrf->vrf_id,
2881 VTY_NEWLINE);
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07002882
2883 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
2884 {
2885 if (rib_cnt[i] > 0)
2886 {
2887 if (i == ZEBRA_ROUTE_BGP)
2888 {
2889 vty_out (vty, "%-20s %-20d %-20d %s", "ebgp",
2890 rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP],
2891 fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP],
2892 VTY_NEWLINE);
2893 vty_out (vty, "%-20s %-20d %-20d %s", "ibgp",
2894 rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP],
2895 VTY_NEWLINE);
2896 }
2897 else
2898 vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i),
2899 rib_cnt[i], fib_cnt[i], VTY_NEWLINE);
2900 }
2901 }
2902
2903 vty_out (vty, "------%s", VTY_NEWLINE);
2904 vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
2905 fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);
Feng Lu4364ee52015-05-22 11:40:03 +02002906 vty_out (vty, "%s", VTY_NEWLINE);
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07002907}
2908
paul718e3742002-12-13 20:15:29 +00002909/* Show route summary. */
2910DEFUN (show_ip_route_summary,
2911 show_ip_route_summary_cmd,
2912 "show ip route summary",
2913 SHOW_STR
2914 IP_STR
2915 "IP routing table\n"
2916 "Summary of all routes\n")
2917{
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002918 struct route_table *table;
Feng Lu4364ee52015-05-22 11:40:03 +02002919 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002920
Feng Lu4364ee52015-05-22 11:40:03 +02002921 if (argc > 0)
2922 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
2923
2924 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002925 if (! table)
2926 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002927
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002928 vty_show_ip_route_summary (vty, table);
paul718e3742002-12-13 20:15:29 +00002929
2930 return CMD_SUCCESS;
2931}
2932
Feng Lu4364ee52015-05-22 11:40:03 +02002933ALIAS (show_ip_route_summary,
2934 show_ip_route_summary_vrf_cmd,
2935 "show ip route summary " VRF_CMD_STR,
2936 SHOW_STR
2937 IP_STR
2938 "IP routing table\n"
2939 "Summary of all routes\n"
2940 VRF_CMD_HELP_STR)
2941
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07002942/* Show route summary prefix. */
2943DEFUN (show_ip_route_summary_prefix,
2944 show_ip_route_summary_prefix_cmd,
2945 "show ip route summary prefix",
2946 SHOW_STR
2947 IP_STR
2948 "IP routing table\n"
2949 "Summary of all routes\n"
2950 "Prefix routes\n")
2951{
2952 struct route_table *table;
Feng Lu4364ee52015-05-22 11:40:03 +02002953 vrf_id_t vrf_id = VRF_DEFAULT;
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07002954
Feng Lu4364ee52015-05-22 11:40:03 +02002955 if (argc > 0)
2956 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
2957
2958 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07002959 if (! table)
2960 return CMD_SUCCESS;
2961
2962 vty_show_ip_route_summary_prefix (vty, table);
2963
2964 return CMD_SUCCESS;
2965}
2966
Feng Lu4364ee52015-05-22 11:40:03 +02002967ALIAS (show_ip_route_summary_prefix,
2968 show_ip_route_summary_prefix_vrf_cmd,
2969 "show ip route summary prefix " VRF_CMD_STR,
2970 SHOW_STR
2971 IP_STR
2972 "IP routing table\n"
2973 "Summary of all routes\n"
2974 "Prefix routes\n"
2975 VRF_CMD_HELP_STR)
2976
2977DEFUN (show_ip_route_vrf_all,
2978 show_ip_route_vrf_all_cmd,
2979 "show ip route " VRF_ALL_CMD_STR,
2980 SHOW_STR
2981 IP_STR
2982 "IP routing table\n"
2983 VRF_ALL_CMD_HELP_STR)
2984{
2985 struct route_table *table;
2986 struct route_node *rn;
2987 struct rib *rib;
2988 struct zebra_vrf *zvrf;
2989 vrf_iter_t iter;
2990 int first = 1;
2991
2992 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
2993 {
2994 if ((zvrf = vrf_iter2info (iter)) == NULL ||
2995 (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
2996 continue;
2997
2998 /* Show all IPv4 routes. */
2999 for (rn = route_top (table); rn; rn = route_next (rn))
3000 RNODE_FOREACH_RIB (rn, rib)
3001 {
3002 if (first)
3003 {
3004 vty_out (vty, SHOW_ROUTE_V4_HEADER);
3005 first = 0;
3006 }
3007 vty_show_ip_route (vty, rn, rib);
3008 }
3009 }
3010
3011 return CMD_SUCCESS;
3012}
3013
3014DEFUN (show_ip_route_prefix_longer_vrf_all,
3015 show_ip_route_prefix_longer_vrf_all_cmd,
3016 "show ip route A.B.C.D/M longer-prefixes " VRF_ALL_CMD_STR,
3017 SHOW_STR
3018 IP_STR
3019 "IP routing table\n"
3020 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3021 "Show route matching the specified Network/Mask pair only\n"
3022 VRF_ALL_CMD_HELP_STR)
3023{
3024 struct route_table *table;
3025 struct route_node *rn;
3026 struct rib *rib;
3027 struct prefix p;
3028 struct zebra_vrf *zvrf;
3029 vrf_iter_t iter;
3030 int ret;
3031 int first = 1;
3032
3033 ret = str2prefix (argv[0], &p);
3034 if (! ret)
3035 {
3036 vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
3037 return CMD_WARNING;
3038 }
3039
3040 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3041 {
3042 if ((zvrf = vrf_iter2info (iter)) == NULL ||
3043 (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
3044 continue;
3045
3046 /* Show matched type IPv4 routes. */
3047 for (rn = route_top (table); rn; rn = route_next (rn))
3048 RNODE_FOREACH_RIB (rn, rib)
3049 if (prefix_match (&p, &rn->p))
3050 {
3051 if (first)
3052 {
3053 vty_out (vty, SHOW_ROUTE_V4_HEADER);
3054 first = 0;
3055 }
3056 vty_show_ip_route (vty, rn, rib);
3057 }
3058 }
3059
3060 return CMD_SUCCESS;
3061}
3062
3063DEFUN (show_ip_route_supernets_vrf_all,
3064 show_ip_route_supernets_vrf_all_cmd,
3065 "show ip route supernets-only " VRF_ALL_CMD_STR,
3066 SHOW_STR
3067 IP_STR
3068 "IP routing table\n"
3069 "Show supernet entries only\n"
3070 VRF_ALL_CMD_HELP_STR)
3071{
3072 struct route_table *table;
3073 struct route_node *rn;
3074 struct rib *rib;
3075 struct zebra_vrf *zvrf;
3076 vrf_iter_t iter;
3077 u_int32_t addr;
3078 int first = 1;
3079
3080 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3081 {
3082 if ((zvrf = vrf_iter2info (iter)) == NULL ||
3083 (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
3084 continue;
3085
3086 /* Show matched type IPv4 routes. */
3087 for (rn = route_top (table); rn; rn = route_next (rn))
3088 RNODE_FOREACH_RIB (rn, rib)
3089 {
3090 addr = ntohl (rn->p.u.prefix4.s_addr);
3091
3092 if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
3093 || (IN_CLASSB (addr) && rn->p.prefixlen < 16)
3094 || (IN_CLASSA (addr) && rn->p.prefixlen < 8))
3095 {
3096 if (first)
3097 {
3098 vty_out (vty, SHOW_ROUTE_V4_HEADER);
3099 first = 0;
3100 }
3101 vty_show_ip_route (vty, rn, rib);
3102 }
3103 }
3104 }
3105
3106 return CMD_SUCCESS;
3107}
3108
3109DEFUN (show_ip_route_protocol_vrf_all,
3110 show_ip_route_protocol_vrf_all_cmd,
3111 "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR,
3112 SHOW_STR
3113 IP_STR
3114 "IP routing table\n"
3115 QUAGGA_IP_REDIST_HELP_STR_ZEBRA
3116 VRF_ALL_CMD_HELP_STR)
3117{
3118 int type;
3119 struct route_table *table;
3120 struct route_node *rn;
3121 struct rib *rib;
3122 struct zebra_vrf *zvrf;
3123 vrf_iter_t iter;
3124 int first = 1;
3125
3126 type = proto_redistnum (AFI_IP, argv[0]);
3127 if (type < 0)
3128 {
3129 vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
3130 return CMD_WARNING;
3131 }
3132
3133 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3134 {
3135 if ((zvrf = vrf_iter2info (iter)) == NULL ||
3136 (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
3137 continue;
3138
3139 /* Show matched type IPv4 routes. */
3140 for (rn = route_top (table); rn; rn = route_next (rn))
3141 RNODE_FOREACH_RIB (rn, rib)
3142 if (rib->type == type)
3143 {
3144 if (first)
3145 {
3146 vty_out (vty, SHOW_ROUTE_V4_HEADER);
3147 first = 0;
3148 }
3149 vty_show_ip_route (vty, rn, rib);
3150 }
3151 }
3152
3153 return CMD_SUCCESS;
3154}
3155
3156DEFUN (show_ip_route_addr_vrf_all,
3157 show_ip_route_addr_vrf_all_cmd,
3158 "show ip route A.B.C.D " VRF_ALL_CMD_STR,
3159 SHOW_STR
3160 IP_STR
3161 "IP routing table\n"
3162 "Network in the IP routing table to display\n"
3163 VRF_ALL_CMD_HELP_STR)
3164{
3165 int ret;
3166 struct prefix_ipv4 p;
3167 struct route_table *table;
3168 struct route_node *rn;
3169 struct zebra_vrf *zvrf;
3170 vrf_iter_t iter;
3171
3172 ret = str2prefix_ipv4 (argv[0], &p);
3173 if (ret <= 0)
3174 {
3175 vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
3176 return CMD_WARNING;
3177 }
3178
3179 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3180 {
3181 if ((zvrf = vrf_iter2info (iter)) == NULL ||
3182 (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
3183 continue;
3184
3185 rn = route_node_match (table, (struct prefix *) &p);
3186 if (! rn)
3187 continue;
3188
3189 vty_show_ip_route_detail (vty, rn, 0);
3190
3191 route_unlock_node (rn);
3192 }
3193
3194 return CMD_SUCCESS;
3195}
3196
3197DEFUN (show_ip_route_prefix_vrf_all,
3198 show_ip_route_prefix_vrf_all_cmd,
3199 "show ip route A.B.C.D/M " VRF_ALL_CMD_STR,
3200 SHOW_STR
3201 IP_STR
3202 "IP routing table\n"
3203 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3204 VRF_ALL_CMD_HELP_STR)
3205{
3206 int ret;
3207 struct prefix_ipv4 p;
3208 struct route_table *table;
3209 struct route_node *rn;
3210 struct zebra_vrf *zvrf;
3211 vrf_iter_t iter;
3212
3213 ret = str2prefix_ipv4 (argv[0], &p);
3214 if (ret <= 0)
3215 {
3216 vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
3217 return CMD_WARNING;
3218 }
3219
3220 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3221 {
3222 if ((zvrf = vrf_iter2info (iter)) == NULL ||
3223 (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
3224 continue;
3225
3226 rn = route_node_match (table, (struct prefix *) &p);
3227 if (! rn)
3228 continue;
3229 if (rn->p.prefixlen != p.prefixlen)
3230 {
3231 route_unlock_node (rn);
3232 continue;
3233 }
3234
3235 vty_show_ip_route_detail (vty, rn, 0);
3236
3237 route_unlock_node (rn);
3238 }
3239
3240 return CMD_SUCCESS;
3241}
3242
3243DEFUN (show_ip_route_summary_vrf_all,
3244 show_ip_route_summary_vrf_all_cmd,
3245 "show ip route summary " VRF_ALL_CMD_STR,
3246 SHOW_STR
3247 IP_STR
3248 "IP routing table\n"
3249 "Summary of all routes\n"
3250 VRF_ALL_CMD_HELP_STR)
3251{
3252 struct zebra_vrf *zvrf;
3253 vrf_iter_t iter;
3254
3255 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3256 if ((zvrf = vrf_iter2info (iter)) != NULL)
3257 vty_show_ip_route_summary (vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
3258
3259 return CMD_SUCCESS;
3260}
3261
3262DEFUN (show_ip_route_summary_prefix_vrf_all,
3263 show_ip_route_summary_prefix_vrf_all_cmd,
3264 "show ip route summary prefix " VRF_ALL_CMD_STR,
3265 SHOW_STR
3266 IP_STR
3267 "IP routing table\n"
3268 "Summary of all routes\n"
3269 "Prefix routes\n"
3270 VRF_ALL_CMD_HELP_STR)
3271{
3272 struct zebra_vrf *zvrf;
3273 vrf_iter_t iter;
3274
3275 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3276 if ((zvrf = vrf_iter2info (iter)) != NULL)
3277 vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
3278
3279 return CMD_SUCCESS;
3280}
3281
paul718e3742002-12-13 20:15:29 +00003282/* Write IPv4 static route configuration. */
paula1ac18c2005-06-28 17:17:12 +00003283static int
Everton Marques33d86db2014-07-14 11:19:00 -03003284static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
paul718e3742002-12-13 20:15:29 +00003285{
3286 struct route_node *rn;
Donald Sharpd4c27d62015-11-04 13:26:35 -05003287 struct static_route *si;
paul718e3742002-12-13 20:15:29 +00003288 struct route_table *stable;
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003289 struct zebra_vrf *zvrf;
3290 vrf_iter_t iter;
paul718e3742002-12-13 20:15:29 +00003291 int write;
3292
3293 write = 0;
3294
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003295 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3296 {
3297 if ((zvrf = vrf_iter2info (iter)) == NULL ||
3298 (stable = zvrf->stable[AFI_IP][safi]) == NULL)
3299 continue;
paul718e3742002-12-13 20:15:29 +00003300
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003301 for (rn = route_top (stable); rn; rn = route_next (rn))
3302 for (si = rn->info; si; si = si->next)
paul7021c422003-07-15 12:52:22 +00003303 {
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003304 vty_out (vty, "%s %s/%d", cmd, inet_ntoa (rn->p.u.prefix4),
3305 rn->p.prefixlen);
3306
3307 switch (si->type)
3308 {
3309 case STATIC_IPV4_GATEWAY:
Donald Sharpd4c27d62015-11-04 13:26:35 -05003310 vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003311 break;
3312 case STATIC_IPV4_IFNAME:
Donald Sharpd4c27d62015-11-04 13:26:35 -05003313 vty_out (vty, " %s", si->ifname);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003314 break;
3315 case STATIC_IPV4_BLACKHOLE:
3316 vty_out (vty, " Null0");
3317 break;
3318 }
3319
3320 /* flags are incompatible with STATIC_IPV4_BLACKHOLE */
3321 if (si->type != STATIC_IPV4_BLACKHOLE)
3322 {
3323 if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
3324 vty_out (vty, " %s", "reject");
3325
3326 if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
3327 vty_out (vty, " %s", "blackhole");
3328 }
3329
Piotr Chytłade24f822007-06-28 00:09:28 +02003330 if (si->tag)
3331 vty_out (vty, " tag %d", si->tag);
3332
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003333 if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
3334 vty_out (vty, " %d", si->distance);
3335
3336 if (si->vrf_id != VRF_DEFAULT)
3337 vty_out (vty, " vrf %u", si->vrf_id);
3338
3339 vty_out (vty, "%s", VTY_NEWLINE);
3340
3341 write = 1;
paul7021c422003-07-15 12:52:22 +00003342 }
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003343 }
paul718e3742002-12-13 20:15:29 +00003344 return write;
3345}
Andrew J. Schorr09303312007-05-30 20:10:34 +00003346
3347DEFUN (show_ip_protocol,
3348 show_ip_protocol_cmd,
3349 "show ip protocol",
3350 SHOW_STR
3351 IP_STR
3352 "IP protocol filtering status\n")
3353{
3354 int i;
3355
3356 vty_out(vty, "Protocol : route-map %s", VTY_NEWLINE);
3357 vty_out(vty, "------------------------%s", VTY_NEWLINE);
3358 for (i=0;i<ZEBRA_ROUTE_MAX;i++)
3359 {
3360 if (proto_rm[AFI_IP][i])
3361 vty_out (vty, "%-10s : %-10s%s", zebra_route_string(i),
3362 proto_rm[AFI_IP][i],
3363 VTY_NEWLINE);
3364 else
3365 vty_out (vty, "%-10s : none%s", zebra_route_string(i), VTY_NEWLINE);
3366 }
3367 if (proto_rm[AFI_IP][i])
3368 vty_out (vty, "%-10s : %-10s%s", "any", proto_rm[AFI_IP][i],
3369 VTY_NEWLINE);
3370 else
3371 vty_out (vty, "%-10s : none%s", "any", VTY_NEWLINE);
3372
3373 return CMD_SUCCESS;
3374}
3375
paul718e3742002-12-13 20:15:29 +00003376/* General fucntion for IPv6 static route. */
paula1ac18c2005-06-28 17:17:12 +00003377static int
hasso39db97e2004-10-12 20:50:58 +00003378static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
3379 const char *gate_str, const char *ifname,
Piotr Chytłade24f822007-06-28 00:09:28 +02003380 const char *flag_str, const char *tag_str,
3381 const char *distance_str, const char *vrf_id_str)
paul718e3742002-12-13 20:15:29 +00003382{
3383 int ret;
3384 u_char distance;
3385 struct prefix p;
3386 struct in6_addr *gate = NULL;
3387 struct in6_addr gate_addr;
3388 u_char type = 0;
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003389 vrf_id_t vrf_id = VRF_DEFAULT;
hasso81dfcaa2003-05-25 19:21:25 +00003390 u_char flag = 0;
Paul Jakma96d10602016-07-01 14:23:45 +01003391 route_tag_t tag = 0;
paul718e3742002-12-13 20:15:29 +00003392
3393 ret = str2prefix (dest_str, &p);
3394 if (ret <= 0)
3395 {
3396 vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
3397 return CMD_WARNING;
3398 }
3399
3400 /* Apply mask for given prefix. */
3401 apply_mask (&p);
3402
hasso81dfcaa2003-05-25 19:21:25 +00003403 /* Route flags */
3404 if (flag_str) {
3405 switch(flag_str[0]) {
3406 case 'r':
3407 case 'R': /* XXX */
3408 SET_FLAG (flag, ZEBRA_FLAG_REJECT);
3409 break;
3410 case 'b':
3411 case 'B': /* XXX */
3412 SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE);
3413 break;
3414 default:
3415 vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE);
paul595db7f2003-05-25 21:35:06 +00003416 return CMD_WARNING;
hasso81dfcaa2003-05-25 19:21:25 +00003417 }
3418 }
3419
paul718e3742002-12-13 20:15:29 +00003420 /* Administrative distance. */
3421 if (distance_str)
3422 distance = atoi (distance_str);
3423 else
3424 distance = ZEBRA_STATIC_DISTANCE_DEFAULT;
3425
Piotr Chytłade24f822007-06-28 00:09:28 +02003426 /* tag */
3427 if (tag_str)
3428 tag = atoi (tag_str);
3429
Piotr Chytłafb214472015-12-01 13:47:06 -05003430 /* tag */
3431 if (tag_str)
3432 tag = atoi(tag_str);
3433
paul718e3742002-12-13 20:15:29 +00003434 /* When gateway is valid IPv6 addrees, then gate is treated as
3435 nexthop address other case gate is treated as interface name. */
3436 ret = inet_pton (AF_INET6, gate_str, &gate_addr);
3437
3438 if (ifname)
3439 {
3440 /* When ifname is specified. It must be come with gateway
3441 address. */
3442 if (ret != 1)
3443 {
3444 vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
3445 return CMD_WARNING;
3446 }
3447 type = STATIC_IPV6_GATEWAY_IFNAME;
3448 gate = &gate_addr;
3449 }
3450 else
3451 {
3452 if (ret == 1)
3453 {
3454 type = STATIC_IPV6_GATEWAY;
3455 gate = &gate_addr;
3456 }
3457 else
3458 {
3459 type = STATIC_IPV6_IFNAME;
3460 ifname = gate_str;
3461 }
3462 }
3463
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003464 /* VRF id */
3465 if (vrf_id_str)
3466 VTY_GET_INTEGER ("VRF ID", vrf_id, vrf_id_str);
3467
paul718e3742002-12-13 20:15:29 +00003468 if (add_cmd)
Piotr Chytłade24f822007-06-28 00:09:28 +02003469 static_add_ipv6 (&p, type, gate, ifname, flag, tag, distance, vrf_id);
paul718e3742002-12-13 20:15:29 +00003470 else
Piotr Chytłade24f822007-06-28 00:09:28 +02003471 static_delete_ipv6 (&p, type, gate, ifname, tag, distance, vrf_id);
paul718e3742002-12-13 20:15:29 +00003472
3473 return CMD_SUCCESS;
3474}
3475
3476DEFUN (ipv6_route,
3477 ipv6_route_cmd,
3478 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)",
3479 IP_STR
3480 "Establish static routes\n"
3481 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3482 "IPv6 gateway address\n"
3483 "IPv6 gateway interface name\n")
3484{
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003485 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL,
Piotr Chytłade24f822007-06-28 00:09:28 +02003486 NULL, NULL);
hasso81dfcaa2003-05-25 19:21:25 +00003487}
3488
Piotr Chytłafb214472015-12-01 13:47:06 -05003489DEFUN (ipv6_route_tag,
3490 ipv6_route_tag_cmd,
3491 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>",
3492 IP_STR
3493 "Establish static routes\n"
3494 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3495 "IPv6 gateway address\n"
3496 "IPv6 gateway interface name\n"
3497 "Set tag for this route\n"
3498 "Tag value\n")
3499{
3500 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL);
3501}
3502
3503DEFUN (ipv6_route_tag_vrf,
3504 ipv6_route_tag_vrf_cmd,
3505 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>" VRF_CMD_STR,
3506 IP_STR
3507 "Establish static routes\n"
3508 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3509 "IPv6 gateway address\n"
3510 "IPv6 gateway interface name\n"
3511 "Set tag for this route\n"
3512 "Tag value\n"
3513 VRF_CMD_HELP_STR)
3514{
3515 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]);
3516}
3517
hasso81dfcaa2003-05-25 19:21:25 +00003518DEFUN (ipv6_route_flags,
3519 ipv6_route_flags_cmd,
3520 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
3521 IP_STR
3522 "Establish static routes\n"
3523 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3524 "IPv6 gateway address\n"
3525 "IPv6 gateway interface name\n"
3526 "Emit an ICMP unreachable when matched\n"
3527 "Silently discard pkts when matched\n")
3528{
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003529 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL,
Piotr Chytłade24f822007-06-28 00:09:28 +02003530 NULL, NULL);
paul718e3742002-12-13 20:15:29 +00003531}
3532
Piotr Chytłafb214472015-12-01 13:47:06 -05003533DEFUN (ipv6_route_flags_tag,
3534 ipv6_route_flags_tag_cmd,
3535 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>",
3536 IP_STR
3537 "Establish static routes\n"
3538 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3539 "IPv6 gateway address\n"
3540 "IPv6 gateway interface name\n"
3541 "Emit an ICMP unreachable when matched\n"
3542 "Silently discard pkts when matched\n"
3543 "Set tag for this route\n"
3544 "Tag value\n")
3545{
3546 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL);
3547}
3548
3549DEFUN (ipv6_route_flags_tag_vrf,
3550 ipv6_route_flags_tag_vrf_cmd,
3551 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>" VRF_CMD_STR,
3552 IP_STR
3553 "Establish static routes\n"
3554 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3555 "IPv6 gateway address\n"
3556 "IPv6 gateway interface name\n"
3557 "Emit an ICMP unreachable when matched\n"
3558 "Silently discard pkts when matched\n"
3559 "Set tag for this route\n"
3560 "Tag value\n"
3561 VRF_CMD_HELP_STR)
3562{
3563 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]);
3564}
3565
paul718e3742002-12-13 20:15:29 +00003566DEFUN (ipv6_route_ifname,
3567 ipv6_route_ifname_cmd,
3568 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
3569 IP_STR
3570 "Establish static routes\n"
3571 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3572 "IPv6 gateway address\n"
3573 "IPv6 gateway interface name\n")
3574{
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003575 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL,
Piotr Chytłade24f822007-06-28 00:09:28 +02003576 NULL, NULL);
hasso81dfcaa2003-05-25 19:21:25 +00003577}
3578
Piotr Chytłafb214472015-12-01 13:47:06 -05003579DEFUN (ipv6_route_ifname_tag,
3580 ipv6_route_ifname_tag_cmd,
3581 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>",
3582 IP_STR
3583 "Establish static routes\n"
3584 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3585 "IPv6 gateway address\n"
3586 "IPv6 gateway interface name\n"
3587 "Set tag for this route\n"
3588 "Tag value\n")
3589{
3590 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL);
3591}
3592
3593DEFUN (ipv6_route_ifname_tag_vrf,
3594 ipv6_route_ifname_tag_vrf_cmd,
3595 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>" VRF_CMD_STR,
3596 IP_STR
3597 "Establish static routes\n"
3598 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3599 "IPv6 gateway address\n"
3600 "IPv6 gateway interface name\n"
3601 "Set tag for this route\n"
3602 "Tag value\n"
3603 VRF_CMD_HELP_STR)
3604{
3605 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]);
3606}
3607
hasso81dfcaa2003-05-25 19:21:25 +00003608DEFUN (ipv6_route_ifname_flags,
3609 ipv6_route_ifname_flags_cmd,
3610 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
3611 IP_STR
3612 "Establish static routes\n"
3613 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3614 "IPv6 gateway address\n"
3615 "IPv6 gateway interface name\n"
3616 "Emit an ICMP unreachable when matched\n"
3617 "Silently discard pkts when matched\n")
3618{
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003619 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL,
Piotr Chytłade24f822007-06-28 00:09:28 +02003620 NULL, NULL);
paul718e3742002-12-13 20:15:29 +00003621}
3622
Piotr Chytłafb214472015-12-01 13:47:06 -05003623DEFUN (ipv6_route_ifname_flags_tag,
3624 ipv6_route_ifname_flags_tag_cmd,
3625 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>",
3626 IP_STR
3627 "Establish static routes\n"
3628 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3629 "IPv6 gateway address\n"
3630 "IPv6 gateway interface name\n"
3631 "Emit an ICMP unreachable when matched\n"
3632 "Silently discard pkts when matched\n"
3633 "Set tag for this route\n"
3634 "Tag value\n")
3635{
3636 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL);
3637}
3638
3639DEFUN (ipv6_route_ifname_flags_tag_vrf,
3640 ipv6_route_ifname_flags_tag_vrf_cmd,
3641 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>" VRF_CMD_STR,
3642 IP_STR
3643 "Establish static routes\n"
3644 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3645 "IPv6 gateway address\n"
3646 "IPv6 gateway interface name\n"
3647 "Emit an ICMP unreachable when matched\n"
3648 "Silently discard pkts when matched\n"
3649 "Set tag for this route\n"
3650 "Tag value\n"
3651 VRF_CMD_HELP_STR)
3652{
3653 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]);
3654}
3655
paul718e3742002-12-13 20:15:29 +00003656DEFUN (ipv6_route_pref,
3657 ipv6_route_pref_cmd,
3658 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
3659 IP_STR
3660 "Establish static routes\n"
3661 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3662 "IPv6 gateway address\n"
3663 "IPv6 gateway interface name\n"
3664 "Distance value for this prefix\n")
3665{
Piotr Chytłade24f822007-06-28 00:09:28 +02003666 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003667 NULL);
hasso81dfcaa2003-05-25 19:21:25 +00003668}
3669
Piotr Chytłafb214472015-12-01 13:47:06 -05003670DEFUN (ipv6_route_pref_tag,
3671 ipv6_route_pref_tag_cmd,
3672 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>",
3673 IP_STR
3674 "Establish static routes\n"
3675 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3676 "IPv6 gateway address\n"
3677 "IPv6 gateway interface name\n"
3678 "Set tag for this route\n"
3679 "Tag value\n"
3680 "Distance value for this prefix\n")
3681{
3682 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL);
3683}
3684
3685DEFUN (ipv6_route_pref_tag_vrf,
3686 ipv6_route_pref_tag_vrf_cmd,
3687 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>" VRF_CMD_STR,
3688 IP_STR
3689 "Establish static routes\n"
3690 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3691 "IPv6 gateway address\n"
3692 "IPv6 gateway interface name\n"
3693 "Set tag for this route\n"
3694 "Tag value\n"
3695 "Distance value for this prefix\n"
3696 VRF_CMD_HELP_STR)
3697{
3698 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]);
3699}
3700
hasso81dfcaa2003-05-25 19:21:25 +00003701DEFUN (ipv6_route_flags_pref,
3702 ipv6_route_flags_pref_cmd,
3703 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
3704 IP_STR
3705 "Establish static routes\n"
3706 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3707 "IPv6 gateway address\n"
3708 "IPv6 gateway interface name\n"
3709 "Emit an ICMP unreachable when matched\n"
3710 "Silently discard pkts when matched\n"
3711 "Distance value for this prefix\n")
3712{
Piotr Chytłade24f822007-06-28 00:09:28 +02003713 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003714 NULL);
paul718e3742002-12-13 20:15:29 +00003715}
3716
Piotr Chytłafb214472015-12-01 13:47:06 -05003717DEFUN (ipv6_route_flags_pref_tag,
3718 ipv6_route_flags_pref_tag_cmd,
3719 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
3720 IP_STR
3721 "Establish static routes\n"
3722 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3723 "IPv6 gateway address\n"
3724 "IPv6 gateway interface name\n"
3725 "Emit an ICMP unreachable when matched\n"
3726 "Silently discard pkts when matched\n"
3727 "Set tag for this route\n"
3728 "Tag value\n"
3729 "Distance value for this prefix\n")
3730{
3731 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL);
3732}
3733
3734DEFUN (ipv6_route_flags_pref_tag_vrf,
3735 ipv6_route_flags_pref_tag_vrf_cmd,
3736 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
3737 IP_STR
3738 "Establish static routes\n"
3739 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3740 "IPv6 gateway address\n"
3741 "IPv6 gateway interface name\n"
3742 "Emit an ICMP unreachable when matched\n"
3743 "Silently discard pkts when matched\n"
3744 "Set tag for this route\n"
3745 "Tag value\n"
3746 "Distance value for this prefix\n"
3747 VRF_CMD_HELP_STR)
3748{
3749 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]);
3750}
3751
paul718e3742002-12-13 20:15:29 +00003752DEFUN (ipv6_route_ifname_pref,
3753 ipv6_route_ifname_pref_cmd,
3754 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
3755 IP_STR
3756 "Establish static routes\n"
3757 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3758 "IPv6 gateway address\n"
3759 "IPv6 gateway interface name\n"
3760 "Distance value for this prefix\n")
3761{
Piotr Chytłade24f822007-06-28 00:09:28 +02003762 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003763 NULL);
hasso81dfcaa2003-05-25 19:21:25 +00003764}
3765
Piotr Chytłafb214472015-12-01 13:47:06 -05003766DEFUN (ipv6_route_ifname_pref_tag,
3767 ipv6_route_ifname_pref_tag_cmd,
3768 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>",
3769 IP_STR
3770 "Establish static routes\n"
3771 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3772 "IPv6 gateway address\n"
3773 "IPv6 gateway interface name\n"
3774 "Set tag for this route\n"
3775 "Tag value\n"
3776 "Distance value for this prefix\n")
3777{
3778 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL);
3779}
3780
3781DEFUN (ipv6_route_ifname_pref_tag_vrf,
3782 ipv6_route_ifname_pref_tag_vrf_cmd,
3783 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>" VRF_CMD_STR,
3784 IP_STR
3785 "Establish static routes\n"
3786 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3787 "IPv6 gateway address\n"
3788 "IPv6 gateway interface name\n"
3789 "Set tag for this route\n"
3790 "Tag value\n"
3791 "Distance value for this prefix\n"
3792 VRF_CMD_HELP_STR)
3793{
3794 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]);
3795}
3796
hasso81dfcaa2003-05-25 19:21:25 +00003797DEFUN (ipv6_route_ifname_flags_pref,
3798 ipv6_route_ifname_flags_pref_cmd,
3799 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
3800 IP_STR
3801 "Establish static routes\n"
3802 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3803 "IPv6 gateway address\n"
3804 "IPv6 gateway interface name\n"
3805 "Emit an ICMP unreachable when matched\n"
3806 "Silently discard pkts when matched\n"
3807 "Distance value for this prefix\n")
3808{
Piotr Chytłade24f822007-06-28 00:09:28 +02003809 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003810 NULL);
paul718e3742002-12-13 20:15:29 +00003811}
3812
Piotr Chytłafb214472015-12-01 13:47:06 -05003813DEFUN (ipv6_route_ifname_flags_pref_tag,
3814 ipv6_route_ifname_flags_pref_tag_cmd,
3815 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>",
3816 IP_STR
3817 "Establish static routes\n"
3818 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3819 "IPv6 gateway address\n"
3820 "IPv6 gateway interface name\n"
3821 "Emit an ICMP unreachable when matched\n"
3822 "Silently discard pkts when matched\n"
3823 "Set tag for this route\n"
3824 "Tag value\n"
3825 "Distance value for this prefix\n")
3826{
3827 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL);
3828}
3829
3830DEFUN (ipv6_route_ifname_flags_pref_tag_vrf,
3831 ipv6_route_ifname_flags_pref_tag_vrf_cmd,
3832 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
3833 IP_STR
3834 "Establish static routes\n"
3835 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3836 "IPv6 gateway address\n"
3837 "IPv6 gateway interface name\n"
3838 "Emit an ICMP unreachable when matched\n"
3839 "Silently discard pkts when matched\n"
3840 "Set tag for this route\n"
3841 "Tag value\n"
3842 "Distance value for this prefix\n"
3843 VRF_CMD_HELP_STR)
3844{
3845 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
3846}
3847
paul718e3742002-12-13 20:15:29 +00003848DEFUN (no_ipv6_route,
3849 no_ipv6_route_cmd,
3850 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)",
3851 NO_STR
3852 IP_STR
3853 "Establish static routes\n"
3854 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3855 "IPv6 gateway address\n"
3856 "IPv6 gateway interface name\n")
3857{
Piotr Chytłade24f822007-06-28 00:09:28 +02003858 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003859 NULL);
paul718e3742002-12-13 20:15:29 +00003860}
3861
Piotr Chytłafb214472015-12-01 13:47:06 -05003862DEFUN (no_ipv6_route_tag,
3863 no_ipv6_route_tag_cmd,
3864 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>",
3865 NO_STR
3866 IP_STR
3867 "Establish static routes\n"
3868 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3869 "IPv6 gateway address\n"
3870 "IPv6 gateway interface name\n"
3871 "Set tag for this route\n"
3872 "Tag value\n")
3873{
3874 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL);
3875}
3876
3877DEFUN (no_ipv6_route_tag_vrf,
3878 no_ipv6_route_tag_vrf_cmd,
3879 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>" VRF_CMD_STR,
3880 NO_STR
3881 IP_STR
3882 "Establish static routes\n"
3883 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3884 "IPv6 gateway address\n"
3885 "IPv6 gateway interface name\n"
3886 "Set tag for this route\n"
3887 "Tag value\n"
3888 VRF_CMD_HELP_STR)
3889{
3890 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]);
3891}
3892
hasso81dfcaa2003-05-25 19:21:25 +00003893ALIAS (no_ipv6_route,
3894 no_ipv6_route_flags_cmd,
3895 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
3896 NO_STR
3897 IP_STR
3898 "Establish static routes\n"
3899 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3900 "IPv6 gateway address\n"
3901 "IPv6 gateway interface name\n"
3902 "Emit an ICMP unreachable when matched\n"
3903 "Silently discard pkts when matched\n")
3904
Piotr Chytłafb214472015-12-01 13:47:06 -05003905ALIAS (no_ipv6_route_tag,
3906 no_ipv6_route_flags_tag_cmd,
3907 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>",
3908 NO_STR
3909 IP_STR
3910 "Establish static routes\n"
3911 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3912 "IPv6 gateway address\n"
3913 "IPv6 gateway interface name\n"
3914 "Emit an ICMP unreachable when matched\n"
3915 "Silently discard pkts when matched\n"
3916 "Set tag for this route\n"
3917 "Tag value\n")
3918
paul718e3742002-12-13 20:15:29 +00003919DEFUN (no_ipv6_route_ifname,
3920 no_ipv6_route_ifname_cmd,
3921 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
3922 NO_STR
3923 IP_STR
3924 "Establish static routes\n"
3925 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3926 "IPv6 gateway address\n"
3927 "IPv6 gateway interface name\n")
3928{
Piotr Chytłade24f822007-06-28 00:09:28 +02003929 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003930 NULL);
paul718e3742002-12-13 20:15:29 +00003931}
3932
Piotr Chytłafb214472015-12-01 13:47:06 -05003933DEFUN (no_ipv6_route_ifname_tag,
3934 no_ipv6_route_ifname_tag_cmd,
3935 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>",
3936 NO_STR
3937 IP_STR
3938 "Establish static routes\n"
3939 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3940 "IPv6 gateway address\n"
3941 "IPv6 gateway interface name\n"
3942 "Set tag for this route\n"
3943 "Tag value\n")
3944{
3945 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL);
3946}
3947
3948DEFUN (no_ipv6_route_ifname_tag_vrf,
3949 no_ipv6_route_ifname_tag_vrf_cmd,
3950 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>" VRF_CMD_STR,
3951 NO_STR
3952 IP_STR
3953 "Establish static routes\n"
3954 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3955 "IPv6 gateway address\n"
3956 "IPv6 gateway interface name\n"
3957 "Set tag for this route\n"
3958 "Tag value\n"
3959 VRF_CMD_HELP_STR)
3960{
3961 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]);
3962}
3963
hasso81dfcaa2003-05-25 19:21:25 +00003964ALIAS (no_ipv6_route_ifname,
3965 no_ipv6_route_ifname_flags_cmd,
3966 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
3967 NO_STR
3968 IP_STR
3969 "Establish static routes\n"
3970 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3971 "IPv6 gateway address\n"
3972 "IPv6 gateway interface name\n"
3973 "Emit an ICMP unreachable when matched\n"
3974 "Silently discard pkts when matched\n")
3975
Piotr Chytłafb214472015-12-01 13:47:06 -05003976ALIAS (no_ipv6_route_ifname_tag,
3977 no_ipv6_route_ifname_flags_tag_cmd,
3978 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>",
3979 NO_STR
3980 IP_STR
3981 "Establish static routes\n"
3982 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3983 "IPv6 gateway address\n"
3984 "IPv6 gateway interface name\n"
3985 "Emit an ICMP unreachable when matched\n"
3986 "Silently discard pkts when matched\n"
3987 "Set tag for this route\n"
3988 "Tag value\n")
3989
paul718e3742002-12-13 20:15:29 +00003990DEFUN (no_ipv6_route_pref,
3991 no_ipv6_route_pref_cmd,
3992 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
3993 NO_STR
3994 IP_STR
3995 "Establish static routes\n"
3996 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3997 "IPv6 gateway address\n"
3998 "IPv6 gateway interface name\n"
3999 "Distance value for this prefix\n")
4000{
Piotr Chytłade24f822007-06-28 00:09:28 +02004001 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004002 NULL);
hasso81dfcaa2003-05-25 19:21:25 +00004003}
4004
Piotr Chytłafb214472015-12-01 13:47:06 -05004005DEFUN (no_ipv6_route_pref_tag,
4006 no_ipv6_route_pref_tag_cmd,
4007 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>",
4008 NO_STR
4009 IP_STR
4010 "Establish static routes\n"
4011 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4012 "IPv6 gateway address\n"
4013 "IPv6 gateway interface name\n"
4014 "Set tag for this route\n"
4015 "Tag value\n"
4016 "Distance value for this prefix\n")
4017{
4018 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL);
4019}
4020
4021DEFUN (no_ipv6_route_pref_tag_vrf,
4022 no_ipv6_route_pref_tag_vrf_cmd,
4023 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>" VRF_CMD_STR,
4024 NO_STR
4025 IP_STR
4026 "Establish static routes\n"
4027 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4028 "IPv6 gateway address\n"
4029 "IPv6 gateway interface name\n"
4030 "Set tag for this route\n"
4031 "Tag value\n"
4032 "Distance value for this prefix\n"
4033 VRF_CMD_HELP_STR)
4034{
4035 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]);
4036}
4037
hasso81dfcaa2003-05-25 19:21:25 +00004038DEFUN (no_ipv6_route_flags_pref,
4039 no_ipv6_route_flags_pref_cmd,
4040 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
4041 NO_STR
4042 IP_STR
4043 "Establish static routes\n"
4044 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4045 "IPv6 gateway address\n"
4046 "IPv6 gateway interface name\n"
4047 "Emit an ICMP unreachable when matched\n"
4048 "Silently discard pkts when matched\n"
4049 "Distance value for this prefix\n")
4050{
4051 /* We do not care about argv[2] */
Piotr Chytłade24f822007-06-28 00:09:28 +02004052 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004053 NULL);
paul718e3742002-12-13 20:15:29 +00004054}
4055
Piotr Chytłafb214472015-12-01 13:47:06 -05004056DEFUN (no_ipv6_route_flags_pref_tag,
4057 no_ipv6_route_flags_pref_tag_cmd,
4058 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
4059 NO_STR
4060 IP_STR
4061 "Establish static routes\n"
4062 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4063 "IPv6 gateway address\n"
4064 "IPv6 gateway interface name\n"
4065 "Emit an ICMP unreachable when matched\n"
4066 "Silently discard pkts when matched\n"
4067 "Set tag for this route\n"
4068 "Tag value\n"
4069 "Distance value for this prefix\n")
4070{
4071 /* We do not care about argv[2] */
4072 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL);
4073}
4074
4075DEFUN (no_ipv6_route_flags_pref_tag_vrf,
4076 no_ipv6_route_flags_pref_tag_vrf_cmd,
4077 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
4078 NO_STR
4079 IP_STR
4080 "Establish static routes\n"
4081 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4082 "IPv6 gateway address\n"
4083 "IPv6 gateway interface name\n"
4084 "Emit an ICMP unreachable when matched\n"
4085 "Silently discard pkts when matched\n"
4086 "Set tag for this route\n"
4087 "Tag value\n"
4088 "Distance value for this prefix\n"
4089 VRF_CMD_HELP_STR)
4090{
4091 /* We do not care about argv[2] */
4092 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]);
4093}
4094
paul718e3742002-12-13 20:15:29 +00004095DEFUN (no_ipv6_route_ifname_pref,
4096 no_ipv6_route_ifname_pref_cmd,
4097 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
4098 NO_STR
4099 IP_STR
4100 "Establish static routes\n"
4101 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4102 "IPv6 gateway address\n"
4103 "IPv6 gateway interface name\n"
4104 "Distance value for this prefix\n")
4105{
Piotr Chytłade24f822007-06-28 00:09:28 +02004106 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004107 NULL);
hasso81dfcaa2003-05-25 19:21:25 +00004108}
4109
Piotr Chytłafb214472015-12-01 13:47:06 -05004110DEFUN (no_ipv6_route_ifname_pref_tag,
4111 no_ipv6_route_ifname_pref_tag_cmd,
4112 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>",
4113 NO_STR
4114 IP_STR
4115 "Establish static routes\n"
4116 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4117 "IPv6 gateway address\n"
4118 "IPv6 gateway interface name\n"
4119 "Set tag for this route\n"
4120 "Tag value\n"
4121 "Distance value for this prefix\n")
4122{
4123 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL);
4124}
4125
4126DEFUN (no_ipv6_route_ifname_pref_tag_vrf,
4127 no_ipv6_route_ifname_pref_tag_vrf_cmd,
4128 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>" VRF_CMD_STR,
4129 NO_STR
4130 IP_STR
4131 "Establish static routes\n"
4132 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4133 "IPv6 gateway address\n"
4134 "IPv6 gateway interface name\n"
4135 "Set tag for this route\n"
4136 "Tag value\n"
4137 "Distance value for this prefix\n"
4138 VRF_CMD_HELP_STR)
4139{
4140 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]);
4141}
4142
hasso81dfcaa2003-05-25 19:21:25 +00004143DEFUN (no_ipv6_route_ifname_flags_pref,
4144 no_ipv6_route_ifname_flags_pref_cmd,
4145 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
4146 NO_STR
4147 IP_STR
4148 "Establish static routes\n"
4149 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4150 "IPv6 gateway address\n"
4151 "IPv6 gateway interface name\n"
4152 "Emit an ICMP unreachable when matched\n"
4153 "Silently discard pkts when matched\n"
4154 "Distance value for this prefix\n")
4155{
Piotr Chytłade24f822007-06-28 00:09:28 +02004156 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004157 NULL);
4158}
4159
Piotr Chytłafb214472015-12-01 13:47:06 -05004160DEFUN (no_ipv6_route_ifname_flags_pref_tag,
4161 no_ipv6_route_ifname_flags_pref_tag_cmd,
4162 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>",
4163 NO_STR
4164 IP_STR
4165 "Establish static routes\n"
4166 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4167 "IPv6 gateway address\n"
4168 "IPv6 gateway interface name\n"
4169 "Emit an ICMP unreachable when matched\n"
4170 "Silently discard pkts when matched\n"
4171 "Set tag for this route\n"
4172 "Tag value\n"
4173 "Distance value for this prefix\n")
4174{
4175 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL);
4176}
4177
4178DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf,
4179 no_ipv6_route_ifname_flags_pref_tag_vrf_cmd,
4180 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
4181 NO_STR
4182 IP_STR
4183 "Establish static routes\n"
4184 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4185 "IPv6 gateway address\n"
4186 "IPv6 gateway interface name\n"
4187 "Emit an ICMP unreachable when matched\n"
4188 "Silently discard pkts when matched\n"
4189 "Set tag for this route\n"
4190 "Tag value\n"
4191 "Distance value for this prefix\n"
4192 VRF_CMD_HELP_STR)
4193{
4194 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
4195}
4196
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004197DEFUN (ipv6_route_vrf,
4198 ipv6_route_vrf_cmd,
4199 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR,
4200 IP_STR
4201 "Establish static routes\n"
4202 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4203 "IPv6 gateway address\n"
4204 "IPv6 gateway interface name\n"
4205 VRF_CMD_HELP_STR)
4206{
Piotr Chytłade24f822007-06-28 00:09:28 +02004207 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004208 argv[2]);
4209}
4210
4211DEFUN (ipv6_route_flags_vrf,
4212 ipv6_route_flags_vrf_cmd,
4213 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
4214 IP_STR
4215 "Establish static routes\n"
4216 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4217 "IPv6 gateway address\n"
4218 "IPv6 gateway interface name\n"
4219 "Emit an ICMP unreachable when matched\n"
4220 "Silently discard pkts when matched\n"
4221 VRF_CMD_HELP_STR)
4222{
Piotr Chytłade24f822007-06-28 00:09:28 +02004223 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004224 argv[3]);
4225}
4226
4227DEFUN (ipv6_route_ifname_vrf,
4228 ipv6_route_ifname_vrf_cmd,
4229 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR,
4230 IP_STR
4231 "Establish static routes\n"
4232 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4233 "IPv6 gateway address\n"
4234 "IPv6 gateway interface name\n"
4235 VRF_CMD_HELP_STR)
4236{
Piotr Chytłade24f822007-06-28 00:09:28 +02004237 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004238 argv[3]);
4239}
4240
4241DEFUN (ipv6_route_ifname_flags_vrf,
4242 ipv6_route_ifname_flags_vrf_cmd,
4243 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR,
4244 IP_STR
4245 "Establish static routes\n"
4246 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4247 "IPv6 gateway address\n"
4248 "IPv6 gateway interface name\n"
4249 "Emit an ICMP unreachable when matched\n"
4250 "Silently discard pkts when matched\n"
4251 VRF_CMD_HELP_STR)
4252{
Piotr Chytłade24f822007-06-28 00:09:28 +02004253 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004254 argv[4]);
4255}
4256
4257DEFUN (ipv6_route_pref_vrf,
4258 ipv6_route_pref_vrf_cmd,
4259 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR,
4260 IP_STR
4261 "Establish static routes\n"
4262 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4263 "IPv6 gateway address\n"
4264 "IPv6 gateway interface name\n"
4265 "Distance value for this prefix\n"
4266 VRF_CMD_HELP_STR)
4267{
Piotr Chytłade24f822007-06-28 00:09:28 +02004268 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004269 argv[3]);
4270}
4271
4272DEFUN (ipv6_route_flags_pref_vrf,
4273 ipv6_route_flags_pref_vrf_cmd,
4274 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
4275 IP_STR
4276 "Establish static routes\n"
4277 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4278 "IPv6 gateway address\n"
4279 "IPv6 gateway interface name\n"
4280 "Emit an ICMP unreachable when matched\n"
4281 "Silently discard pkts when matched\n"
4282 "Distance value for this prefix\n"
4283 VRF_CMD_HELP_STR)
4284{
Piotr Chytłade24f822007-06-28 00:09:28 +02004285 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004286 argv[4]);
4287}
4288
4289DEFUN (ipv6_route_ifname_pref_vrf,
4290 ipv6_route_ifname_pref_vrf_cmd,
4291 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR,
4292 IP_STR
4293 "Establish static routes\n"
4294 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4295 "IPv6 gateway address\n"
4296 "IPv6 gateway interface name\n"
4297 "Distance value for this prefix\n"
4298 VRF_CMD_HELP_STR)
4299{
Piotr Chytłade24f822007-06-28 00:09:28 +02004300 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004301 argv[4]);
4302}
4303
4304DEFUN (ipv6_route_ifname_flags_pref_vrf,
4305 ipv6_route_ifname_flags_pref_vrf_cmd,
4306 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR,
4307 IP_STR
4308 "Establish static routes\n"
4309 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4310 "IPv6 gateway address\n"
4311 "IPv6 gateway interface name\n"
4312 "Emit an ICMP unreachable when matched\n"
4313 "Silently discard pkts when matched\n"
4314 "Distance value for this prefix\n"
4315 VRF_CMD_HELP_STR)
4316{
Piotr Chytłade24f822007-06-28 00:09:28 +02004317 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004318 argv[5]);
4319}
4320
4321DEFUN (no_ipv6_route_vrf,
4322 no_ipv6_route_vrf_cmd,
4323 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR,
4324 NO_STR
4325 IP_STR
4326 "Establish static routes\n"
4327 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4328 "IPv6 gateway address\n"
4329 "IPv6 gateway interface name\n"
4330 VRF_CMD_HELP_STR)
4331{
Piotr Chytłade24f822007-06-28 00:09:28 +02004332 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004333 (argc > 3) ? argv[3] : argv[2]);
4334}
4335
4336ALIAS (no_ipv6_route_vrf,
4337 no_ipv6_route_flags_vrf_cmd,
4338 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
4339 NO_STR
4340 IP_STR
4341 "Establish static routes\n"
4342 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4343 "IPv6 gateway address\n"
4344 "IPv6 gateway interface name\n"
4345 "Emit an ICMP unreachable when matched\n"
4346 "Silently discard pkts when matched\n"
4347 VRF_CMD_HELP_STR)
4348
4349DEFUN (no_ipv6_route_ifname_vrf,
4350 no_ipv6_route_ifname_vrf_cmd,
4351 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR,
4352 NO_STR
4353 IP_STR
4354 "Establish static routes\n"
4355 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4356 "IPv6 gateway address\n"
4357 "IPv6 gateway interface name\n"
4358 VRF_CMD_HELP_STR)
4359{
Piotr Chytłade24f822007-06-28 00:09:28 +02004360 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004361 (argc > 4) ? argv[4] : argv[3]);
4362}
4363
4364ALIAS (no_ipv6_route_ifname_vrf,
4365 no_ipv6_route_ifname_flags_vrf_cmd,
4366 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR,
4367 NO_STR
4368 IP_STR
4369 "Establish static routes\n"
4370 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4371 "IPv6 gateway address\n"
4372 "IPv6 gateway interface name\n"
4373 "Emit an ICMP unreachable when matched\n"
4374 "Silently discard pkts when matched\n"
4375 VRF_CMD_HELP_STR)
4376
4377DEFUN (no_ipv6_route_pref_vrf,
4378 no_ipv6_route_pref_vrf_cmd,
4379 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR,
4380 NO_STR
4381 IP_STR
4382 "Establish static routes\n"
4383 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4384 "IPv6 gateway address\n"
4385 "IPv6 gateway interface name\n"
4386 "Distance value for this prefix\n"
4387 VRF_CMD_HELP_STR)
4388{
Piotr Chytłade24f822007-06-28 00:09:28 +02004389 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004390 argv[3]);
4391}
4392
4393DEFUN (no_ipv6_route_flags_pref_vrf,
4394 no_ipv6_route_flags_pref_vrf_cmd,
4395 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
4396 NO_STR
4397 IP_STR
4398 "Establish static routes\n"
4399 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4400 "IPv6 gateway address\n"
4401 "IPv6 gateway interface name\n"
4402 "Emit an ICMP unreachable when matched\n"
4403 "Silently discard pkts when matched\n"
4404 "Distance value for this prefix\n"
4405 VRF_CMD_HELP_STR)
4406{
4407 /* We do not care about argv[2] */
Piotr Chytłade24f822007-06-28 00:09:28 +02004408 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004409 argv[4]);
4410}
4411
4412DEFUN (no_ipv6_route_ifname_pref_vrf,
4413 no_ipv6_route_ifname_pref_vrf_cmd,
4414 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR,
4415 NO_STR
4416 IP_STR
4417 "Establish static routes\n"
4418 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4419 "IPv6 gateway address\n"
4420 "IPv6 gateway interface name\n"
4421 "Distance value for this prefix\n"
4422 VRF_CMD_HELP_STR)
4423{
Piotr Chytłade24f822007-06-28 00:09:28 +02004424 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004425 argv[4]);
4426}
4427
4428DEFUN (no_ipv6_route_ifname_flags_pref_vrf,
4429 no_ipv6_route_ifname_flags_pref_vrf_cmd,
4430 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR,
4431 NO_STR
4432 IP_STR
4433 "Establish static routes\n"
4434 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4435 "IPv6 gateway address\n"
4436 "IPv6 gateway interface name\n"
4437 "Emit an ICMP unreachable when matched\n"
4438 "Silently discard pkts when matched\n"
4439 "Distance value for this prefix\n"
4440 VRF_CMD_HELP_STR)
4441{
Piotr Chytłade24f822007-06-28 00:09:28 +02004442 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004443 argv[5]);
paul718e3742002-12-13 20:15:29 +00004444}
4445
paul718e3742002-12-13 20:15:29 +00004446DEFUN (show_ipv6_route,
4447 show_ipv6_route_cmd,
4448 "show ipv6 route",
4449 SHOW_STR
4450 IP_STR
4451 "IPv6 routing table\n")
4452{
4453 struct route_table *table;
4454 struct route_node *rn;
4455 struct rib *rib;
4456 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02004457 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004458
Feng Lu4364ee52015-05-22 11:40:03 +02004459 if (argc > 0)
4460 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
4461
4462 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00004463 if (! table)
4464 return CMD_SUCCESS;
4465
4466 /* Show all IPv6 route. */
4467 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00004468 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00004469 {
4470 if (first)
4471 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02004472 vty_out (vty, SHOW_ROUTE_V6_HEADER);
paul718e3742002-12-13 20:15:29 +00004473 first = 0;
4474 }
Timo Teräs53a5c392015-05-23 11:08:40 +03004475 vty_show_ip_route (vty, rn, rib);
paul718e3742002-12-13 20:15:29 +00004476 }
4477 return CMD_SUCCESS;
4478}
4479
Feng Lu4364ee52015-05-22 11:40:03 +02004480ALIAS (show_ipv6_route,
4481 show_ipv6_route_vrf_cmd,
4482 "show ipv6 route " VRF_CMD_STR,
4483 SHOW_STR
4484 IP_STR
4485 "IPv6 routing table\n"
4486 VRF_CMD_HELP_STR)
4487
Piotr Chytłafb214472015-12-01 13:47:06 -05004488DEFUN (show_ipv6_route_tag,
4489 show_ipv6_route_tag_cmd,
4490 "show ipv6 route tag <1-65535>",
4491 SHOW_STR
4492 IP_STR
4493 "IPv6 routing table\n"
4494 "Show only routes with tag\n"
4495 "Tag value\n")
4496{
4497 struct route_table *table;
4498 struct route_node *rn;
4499 struct rib *rib;
4500 int first = 1;
Paul Jakma96d10602016-07-01 14:23:45 +01004501 route_tag_t tag = 0;
Piotr Chytłafb214472015-12-01 13:47:06 -05004502 vrf_id_t vrf_id = VRF_DEFAULT;
4503
4504 if (argv[0])
4505 tag = atoi(argv[0]);
4506
4507 if (argc == 2)
4508 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
4509
4510 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
4511 if (! table)
4512 return CMD_SUCCESS;
4513
4514 /* Show all IPv6 routes with matching tag value. */
4515 for (rn = route_top (table); rn; rn = route_next (rn))
4516 RNODE_FOREACH_RIB (rn, rib)
4517 {
4518 if (rib->tag != tag)
4519 continue;
4520
4521 if (first)
4522 {
4523 vty_out (vty, SHOW_ROUTE_V6_HEADER);
4524 first = 0;
4525 }
4526 vty_show_ip_route (vty, rn, rib);
4527 }
4528 return CMD_SUCCESS;
4529}
4530
4531ALIAS (show_ipv6_route_tag,
4532 show_ipv6_route_tag_vrf_cmd,
4533 "show ipv6 route tag <1-65535>" VRF_CMD_STR,
4534 SHOW_STR
4535 IP_STR
4536 "IPv6 routing table\n"
4537 "Show only routes with tag\n"
4538 "Tag value\n"
4539 VRF_CMD_HELP_STR)
4540
paul718e3742002-12-13 20:15:29 +00004541DEFUN (show_ipv6_route_prefix_longer,
4542 show_ipv6_route_prefix_longer_cmd,
4543 "show ipv6 route X:X::X:X/M longer-prefixes",
4544 SHOW_STR
4545 IP_STR
4546 "IPv6 routing table\n"
4547 "IPv6 prefix\n"
4548 "Show route matching the specified Network/Mask pair only\n")
4549{
4550 struct route_table *table;
4551 struct route_node *rn;
4552 struct rib *rib;
4553 struct prefix p;
4554 int ret;
4555 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02004556 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004557
4558 ret = str2prefix (argv[0], &p);
4559 if (! ret)
4560 {
4561 vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
4562 return CMD_WARNING;
4563 }
4564
Feng Lu4364ee52015-05-22 11:40:03 +02004565 if (argc > 1)
4566 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
4567
4568 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
4569 if (! table)
4570 return CMD_SUCCESS;
4571
paul718e3742002-12-13 20:15:29 +00004572 /* Show matched type IPv6 routes. */
4573 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00004574 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00004575 if (prefix_match (&p, &rn->p))
4576 {
4577 if (first)
4578 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02004579 vty_out (vty, SHOW_ROUTE_V6_HEADER);
paul718e3742002-12-13 20:15:29 +00004580 first = 0;
4581 }
Timo Teräs53a5c392015-05-23 11:08:40 +03004582 vty_show_ip_route (vty, rn, rib);
paul718e3742002-12-13 20:15:29 +00004583 }
4584 return CMD_SUCCESS;
4585}
4586
Feng Lu4364ee52015-05-22 11:40:03 +02004587ALIAS (show_ipv6_route_prefix_longer,
4588 show_ipv6_route_prefix_longer_vrf_cmd,
4589 "show ipv6 route X:X::X:X/M longer-prefixes " VRF_CMD_STR,
4590 SHOW_STR
4591 IP_STR
4592 "IPv6 routing table\n"
4593 "IPv6 prefix\n"
4594 "Show route matching the specified Network/Mask pair only\n"
4595 VRF_CMD_HELP_STR)
4596
paul718e3742002-12-13 20:15:29 +00004597DEFUN (show_ipv6_route_protocol,
4598 show_ipv6_route_protocol_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02004599 "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA,
paul718e3742002-12-13 20:15:29 +00004600 SHOW_STR
4601 IP_STR
4602 "IP routing table\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02004603 QUAGGA_IP6_REDIST_HELP_STR_ZEBRA)
paul718e3742002-12-13 20:15:29 +00004604{
4605 int type;
4606 struct route_table *table;
4607 struct route_node *rn;
4608 struct rib *rib;
4609 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02004610 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004611
David Lampartere0ca5fd2009-09-16 01:52:42 +02004612 type = proto_redistnum (AFI_IP6, argv[0]);
4613 if (type < 0)
paul718e3742002-12-13 20:15:29 +00004614 {
4615 vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
4616 return CMD_WARNING;
4617 }
Feng Lu4364ee52015-05-22 11:40:03 +02004618
4619 if (argc > 1)
4620 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
4621
4622 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00004623 if (! table)
4624 return CMD_SUCCESS;
4625
4626 /* Show matched type IPv6 routes. */
4627 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00004628 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00004629 if (rib->type == type)
4630 {
4631 if (first)
4632 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02004633 vty_out (vty, SHOW_ROUTE_V6_HEADER);
paul718e3742002-12-13 20:15:29 +00004634 first = 0;
4635 }
Timo Teräs53a5c392015-05-23 11:08:40 +03004636 vty_show_ip_route (vty, rn, rib);
paul718e3742002-12-13 20:15:29 +00004637 }
4638 return CMD_SUCCESS;
4639}
4640
Feng Lu4364ee52015-05-22 11:40:03 +02004641ALIAS (show_ipv6_route_protocol,
4642 show_ipv6_route_protocol_vrf_cmd,
4643 "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_CMD_STR,
4644 SHOW_STR
4645 IP_STR
4646 "IP routing table\n"
4647 QUAGGA_IP6_REDIST_HELP_STR_ZEBRA
4648 VRF_CMD_HELP_STR)
4649
paul718e3742002-12-13 20:15:29 +00004650DEFUN (show_ipv6_route_addr,
4651 show_ipv6_route_addr_cmd,
4652 "show ipv6 route X:X::X:X",
4653 SHOW_STR
4654 IP_STR
4655 "IPv6 routing table\n"
4656 "IPv6 Address\n")
4657{
4658 int ret;
4659 struct prefix_ipv6 p;
4660 struct route_table *table;
4661 struct route_node *rn;
Feng Lu4364ee52015-05-22 11:40:03 +02004662 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004663
4664 ret = str2prefix_ipv6 (argv[0], &p);
4665 if (ret <= 0)
4666 {
4667 vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
4668 return CMD_WARNING;
4669 }
4670
Feng Lu4364ee52015-05-22 11:40:03 +02004671 if (argc > 1)
4672 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
4673
4674 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00004675 if (! table)
4676 return CMD_SUCCESS;
4677
4678 rn = route_node_match (table, (struct prefix *) &p);
4679 if (! rn)
4680 {
4681 vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
4682 return CMD_WARNING;
4683 }
4684
Timo Teräs53a5c392015-05-23 11:08:40 +03004685 vty_show_ip_route_detail (vty, rn, 0);
paul718e3742002-12-13 20:15:29 +00004686
4687 route_unlock_node (rn);
4688
4689 return CMD_SUCCESS;
4690}
4691
Feng Lu4364ee52015-05-22 11:40:03 +02004692ALIAS (show_ipv6_route_addr,
4693 show_ipv6_route_addr_vrf_cmd,
4694 "show ipv6 route X:X::X:X " VRF_CMD_STR,
4695 SHOW_STR
4696 IP_STR
4697 "IPv6 routing table\n"
4698 "IPv6 Address\n"
4699 VRF_CMD_HELP_STR)
4700
paul718e3742002-12-13 20:15:29 +00004701DEFUN (show_ipv6_route_prefix,
4702 show_ipv6_route_prefix_cmd,
4703 "show ipv6 route X:X::X:X/M",
4704 SHOW_STR
4705 IP_STR
4706 "IPv6 routing table\n"
4707 "IPv6 prefix\n")
4708{
4709 int ret;
4710 struct prefix_ipv6 p;
4711 struct route_table *table;
4712 struct route_node *rn;
Feng Lu4364ee52015-05-22 11:40:03 +02004713 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004714
4715 ret = str2prefix_ipv6 (argv[0], &p);
4716 if (ret <= 0)
4717 {
4718 vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
4719 return CMD_WARNING;
4720 }
4721
Feng Lu4364ee52015-05-22 11:40:03 +02004722 if (argc > 1)
4723 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
4724
4725 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00004726 if (! table)
4727 return CMD_SUCCESS;
4728
4729 rn = route_node_match (table, (struct prefix *) &p);
4730 if (! rn || rn->p.prefixlen != p.prefixlen)
4731 {
4732 vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
Lu Feng969d3552014-10-21 06:24:07 +00004733 if (rn)
4734 route_unlock_node (rn);
paul718e3742002-12-13 20:15:29 +00004735 return CMD_WARNING;
4736 }
4737
Timo Teräs53a5c392015-05-23 11:08:40 +03004738 vty_show_ip_route_detail (vty, rn, 0);
paul718e3742002-12-13 20:15:29 +00004739
4740 route_unlock_node (rn);
4741
4742 return CMD_SUCCESS;
4743}
4744
Feng Lu4364ee52015-05-22 11:40:03 +02004745ALIAS (show_ipv6_route_prefix,
4746 show_ipv6_route_prefix_vrf_cmd,
4747 "show ipv6 route X:X::X:X/M " VRF_CMD_STR,
4748 SHOW_STR
4749 IP_STR
4750 "IPv6 routing table\n"
4751 "IPv6 prefix\n"
4752 VRF_CMD_HELP_STR)
4753
Stig Thormodsrud61691c92008-11-04 15:45:07 -08004754/* Show route summary. */
4755DEFUN (show_ipv6_route_summary,
4756 show_ipv6_route_summary_cmd,
4757 "show ipv6 route summary",
4758 SHOW_STR
4759 IP_STR
4760 "IPv6 routing table\n"
4761 "Summary of all IPv6 routes\n")
4762{
4763 struct route_table *table;
Feng Lu4364ee52015-05-22 11:40:03 +02004764 vrf_id_t vrf_id = VRF_DEFAULT;
Stig Thormodsrud61691c92008-11-04 15:45:07 -08004765
Feng Lu4364ee52015-05-22 11:40:03 +02004766 if (argc > 0)
4767 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
4768
4769 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
Stig Thormodsrud61691c92008-11-04 15:45:07 -08004770 if (! table)
4771 return CMD_SUCCESS;
4772
4773 vty_show_ip_route_summary (vty, table);
4774
4775 return CMD_SUCCESS;
4776}
4777
Feng Lu4364ee52015-05-22 11:40:03 +02004778ALIAS (show_ipv6_route_summary,
4779 show_ipv6_route_summary_vrf_cmd,
4780 "show ipv6 route summary " VRF_CMD_STR,
4781 SHOW_STR
4782 IP_STR
4783 "IPv6 routing table\n"
4784 "Summary of all IPv6 routes\n"
4785 VRF_CMD_HELP_STR)
4786
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07004787/* Show ipv6 route summary prefix. */
4788DEFUN (show_ipv6_route_summary_prefix,
4789 show_ipv6_route_summary_prefix_cmd,
4790 "show ipv6 route summary prefix",
4791 SHOW_STR
4792 IP_STR
4793 "IPv6 routing table\n"
4794 "Summary of all IPv6 routes\n"
4795 "Prefix routes\n")
4796{
4797 struct route_table *table;
Feng Lu4364ee52015-05-22 11:40:03 +02004798 vrf_id_t vrf_id = VRF_DEFAULT;
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07004799
Feng Lu4364ee52015-05-22 11:40:03 +02004800 if (argc > 0)
4801 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
4802
4803 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07004804 if (! table)
4805 return CMD_SUCCESS;
4806
4807 vty_show_ip_route_summary_prefix (vty, table);
4808
4809 return CMD_SUCCESS;
4810}
4811
Feng Lu4364ee52015-05-22 11:40:03 +02004812ALIAS (show_ipv6_route_summary_prefix,
4813 show_ipv6_route_summary_prefix_vrf_cmd,
4814 "show ipv6 route summary prefix " VRF_CMD_STR,
4815 SHOW_STR
4816 IP_STR
4817 "IPv6 routing table\n"
4818 "Summary of all IPv6 routes\n"
4819 "Prefix routes\n"
4820 VRF_CMD_HELP_STR)
4821
G.Balajicddf3912011-11-26 21:59:32 +04004822/*
G.Balajicddf3912011-11-26 21:59:32 +04004823 * Show IPv6 mroute command.Used to dump
4824 * the Multicast routing table.
4825 */
4826
4827DEFUN (show_ipv6_mroute,
4828 show_ipv6_mroute_cmd,
4829 "show ipv6 mroute",
4830 SHOW_STR
4831 IP_STR
4832 "IPv6 Multicast routing table\n")
4833{
4834 struct route_table *table;
4835 struct route_node *rn;
4836 struct rib *rib;
4837 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02004838 vrf_id_t vrf_id = VRF_DEFAULT;
G.Balajicddf3912011-11-26 21:59:32 +04004839
Feng Lu4364ee52015-05-22 11:40:03 +02004840 if (argc > 0)
4841 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
4842
4843 table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id);
G.Balajicddf3912011-11-26 21:59:32 +04004844 if (! table)
4845 return CMD_SUCCESS;
4846
4847 /* Show all IPv6 route. */
4848 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00004849 RNODE_FOREACH_RIB (rn, rib)
G.Balajicddf3912011-11-26 21:59:32 +04004850 {
4851 if (first)
4852 {
G.Balajicb32fd62011-11-27 20:09:40 +05304853 vty_out (vty, SHOW_ROUTE_V6_HEADER);
G.Balajicddf3912011-11-26 21:59:32 +04004854 first = 0;
4855 }
Timo Teräs53a5c392015-05-23 11:08:40 +03004856 vty_show_ip_route (vty, rn, rib);
G.Balajicddf3912011-11-26 21:59:32 +04004857 }
4858 return CMD_SUCCESS;
4859}
4860
Feng Lu4364ee52015-05-22 11:40:03 +02004861ALIAS (show_ipv6_mroute,
4862 show_ipv6_mroute_vrf_cmd,
4863 "show ipv6 mroute " VRF_CMD_STR,
4864 SHOW_STR
4865 IP_STR
4866 "IPv6 Multicast routing table\n"
4867 VRF_CMD_HELP_STR)
4868
4869DEFUN (show_ipv6_route_vrf_all,
4870 show_ipv6_route_vrf_all_cmd,
4871 "show ipv6 route " VRF_ALL_CMD_STR,
4872 SHOW_STR
4873 IP_STR
4874 "IPv6 routing table\n"
4875 VRF_ALL_CMD_HELP_STR)
4876{
4877 struct route_table *table;
4878 struct route_node *rn;
4879 struct rib *rib;
4880 struct zebra_vrf *zvrf;
4881 vrf_iter_t iter;
4882 int first = 1;
4883
4884 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
4885 {
4886 if ((zvrf = vrf_iter2info (iter)) == NULL ||
4887 (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
4888 continue;
4889
4890 /* Show all IPv6 route. */
4891 for (rn = route_top (table); rn; rn = route_next (rn))
4892 RNODE_FOREACH_RIB (rn, rib)
4893 {
4894 if (first)
4895 {
4896 vty_out (vty, SHOW_ROUTE_V6_HEADER);
4897 first = 0;
4898 }
4899 vty_show_ip_route (vty, rn, rib);
4900 }
4901 }
4902
4903 return CMD_SUCCESS;
4904}
4905
4906DEFUN (show_ipv6_route_prefix_longer_vrf_all,
4907 show_ipv6_route_prefix_longer_vrf_all_cmd,
4908 "show ipv6 route X:X::X:X/M longer-prefixes " VRF_ALL_CMD_STR,
4909 SHOW_STR
4910 IP_STR
4911 "IPv6 routing table\n"
4912 "IPv6 prefix\n"
4913 "Show route matching the specified Network/Mask pair only\n"
4914 VRF_ALL_CMD_HELP_STR)
4915{
4916 struct route_table *table;
4917 struct route_node *rn;
4918 struct rib *rib;
4919 struct prefix p;
4920 struct zebra_vrf *zvrf;
4921 vrf_iter_t iter;
4922 int ret;
4923 int first = 1;
4924
4925 ret = str2prefix (argv[0], &p);
4926 if (! ret)
4927 {
4928 vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
4929 return CMD_WARNING;
4930 }
4931
4932 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
4933 {
4934 if ((zvrf = vrf_iter2info (iter)) == NULL ||
4935 (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
4936 continue;
4937
4938 /* Show matched type IPv6 routes. */
4939 for (rn = route_top (table); rn; rn = route_next (rn))
4940 RNODE_FOREACH_RIB (rn, rib)
4941 if (prefix_match (&p, &rn->p))
4942 {
4943 if (first)
4944 {
4945 vty_out (vty, SHOW_ROUTE_V6_HEADER);
4946 first = 0;
4947 }
4948 vty_show_ip_route (vty, rn, rib);
4949 }
4950 }
4951
4952 return CMD_SUCCESS;
4953}
4954
4955DEFUN (show_ipv6_route_protocol_vrf_all,
4956 show_ipv6_route_protocol_vrf_all_cmd,
4957 "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR,
4958 SHOW_STR
4959 IP_STR
4960 "IP routing table\n"
4961 QUAGGA_IP6_REDIST_HELP_STR_ZEBRA
4962 VRF_ALL_CMD_HELP_STR)
4963{
4964 int type;
4965 struct route_table *table;
4966 struct route_node *rn;
4967 struct rib *rib;
4968 struct zebra_vrf *zvrf;
4969 vrf_iter_t iter;
4970 int first = 1;
4971
4972 type = proto_redistnum (AFI_IP6, argv[0]);
4973 if (type < 0)
4974 {
4975 vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
4976 return CMD_WARNING;
4977 }
4978
4979 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
4980 {
4981 if ((zvrf = vrf_iter2info (iter)) == NULL ||
4982 (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
4983 continue;
4984
4985 /* Show matched type IPv6 routes. */
4986 for (rn = route_top (table); rn; rn = route_next (rn))
4987 RNODE_FOREACH_RIB (rn, rib)
4988 if (rib->type == type)
4989 {
4990 if (first)
4991 {
4992 vty_out (vty, SHOW_ROUTE_V6_HEADER);
4993 first = 0;
4994 }
4995 vty_show_ip_route (vty, rn, rib);
4996 }
4997 }
4998
4999 return CMD_SUCCESS;
5000}
5001
5002DEFUN (show_ipv6_route_addr_vrf_all,
5003 show_ipv6_route_addr_vrf_all_cmd,
5004 "show ipv6 route X:X::X:X " VRF_ALL_CMD_STR,
5005 SHOW_STR
5006 IP_STR
5007 "IPv6 routing table\n"
5008 "IPv6 Address\n"
5009 VRF_ALL_CMD_HELP_STR)
5010{
5011 int ret;
5012 struct prefix_ipv6 p;
5013 struct route_table *table;
5014 struct route_node *rn;
5015 struct zebra_vrf *zvrf;
5016 vrf_iter_t iter;
5017
5018 ret = str2prefix_ipv6 (argv[0], &p);
5019 if (ret <= 0)
5020 {
5021 vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
5022 return CMD_WARNING;
5023 }
5024
5025 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
5026 {
5027 if ((zvrf = vrf_iter2info (iter)) == NULL ||
5028 (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
5029 continue;
5030
5031 rn = route_node_match (table, (struct prefix *) &p);
5032 if (! rn)
5033 continue;
5034
5035 vty_show_ip_route_detail (vty, rn, 0);
5036
5037 route_unlock_node (rn);
5038 }
5039
5040 return CMD_SUCCESS;
5041}
5042
5043DEFUN (show_ipv6_route_prefix_vrf_all,
5044 show_ipv6_route_prefix_vrf_all_cmd,
5045 "show ipv6 route X:X::X:X/M " VRF_ALL_CMD_STR,
5046 SHOW_STR
5047 IP_STR
5048 "IPv6 routing table\n"
5049 "IPv6 prefix\n"
5050 VRF_ALL_CMD_HELP_STR)
5051{
5052 int ret;
5053 struct prefix_ipv6 p;
5054 struct route_table *table;
5055 struct route_node *rn;
5056 struct zebra_vrf *zvrf;
5057 vrf_iter_t iter;
5058
5059 ret = str2prefix_ipv6 (argv[0], &p);
5060 if (ret <= 0)
5061 {
5062 vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
5063 return CMD_WARNING;
5064 }
5065
5066 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
5067 {
5068 if ((zvrf = vrf_iter2info (iter)) == NULL ||
5069 (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
5070 continue;
5071
5072 rn = route_node_match (table, (struct prefix *) &p);
5073 if (! rn)
5074 continue;
5075 if (rn->p.prefixlen != p.prefixlen)
5076 {
5077 route_unlock_node (rn);
5078 continue;
5079 }
5080
5081 vty_show_ip_route_detail (vty, rn, 0);
5082
5083 route_unlock_node (rn);
5084 }
5085
5086 return CMD_SUCCESS;
5087}
5088
5089/* Show route summary. */
5090DEFUN (show_ipv6_route_summary_vrf_all,
5091 show_ipv6_route_summary_vrf_all_cmd,
5092 "show ipv6 route summary " VRF_ALL_CMD_STR,
5093 SHOW_STR
5094 IP_STR
5095 "IPv6 routing table\n"
5096 "Summary of all IPv6 routes\n"
5097 VRF_ALL_CMD_HELP_STR)
5098{
5099 struct zebra_vrf *zvrf;
5100 vrf_iter_t iter;
5101
5102 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
5103 if ((zvrf = vrf_iter2info (iter)) != NULL)
5104 vty_show_ip_route_summary (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
5105
5106 return CMD_SUCCESS;
5107}
5108
5109DEFUN (show_ipv6_mroute_vrf_all,
5110 show_ipv6_mroute_vrf_all_cmd,
5111 "show ipv6 mroute " VRF_ALL_CMD_STR,
5112 SHOW_STR
5113 IP_STR
5114 "IPv6 Multicast routing table\n"
5115 VRF_ALL_CMD_HELP_STR)
5116{
5117 struct route_table *table;
5118 struct route_node *rn;
5119 struct rib *rib;
5120 struct zebra_vrf *zvrf;
5121 vrf_iter_t iter;
5122 int first = 1;
5123
5124 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
5125 {
5126 if ((zvrf = vrf_iter2info (iter)) == NULL ||
5127 (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
5128 continue;
5129
5130 /* Show all IPv6 route. */
5131 for (rn = route_top (table); rn; rn = route_next (rn))
5132 RNODE_FOREACH_RIB (rn, rib)
5133 {
5134 if (first)
5135 {
5136 vty_out (vty, SHOW_ROUTE_V6_HEADER);
5137 first = 0;
5138 }
5139 vty_show_ip_route (vty, rn, rib);
5140 }
5141 }
5142 return CMD_SUCCESS;
5143}
5144
5145DEFUN (show_ipv6_route_summary_prefix_vrf_all,
5146 show_ipv6_route_summary_prefix_vrf_all_cmd,
5147 "show ipv6 route summary prefix " VRF_ALL_CMD_STR,
5148 SHOW_STR
5149 IP_STR
5150 "IPv6 routing table\n"
5151 "Summary of all IPv6 routes\n"
5152 "Prefix routes\n"
5153 VRF_ALL_CMD_HELP_STR)
5154{
5155 struct zebra_vrf *zvrf;
5156 vrf_iter_t iter;
5157
5158 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
5159 if ((zvrf = vrf_iter2info (iter)) != NULL)
5160 vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
5161
5162 return CMD_SUCCESS;
5163}
5164
paul718e3742002-12-13 20:15:29 +00005165/* Write IPv6 static route configuration. */
paula1ac18c2005-06-28 17:17:12 +00005166static int
paul718e3742002-12-13 20:15:29 +00005167static_config_ipv6 (struct vty *vty)
5168{
5169 struct route_node *rn;
Donald Sharpd4c27d62015-11-04 13:26:35 -05005170 struct static_route *si;
paul718e3742002-12-13 20:15:29 +00005171 int write;
5172 char buf[BUFSIZ];
5173 struct route_table *stable;
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005174 struct zebra_vrf *zvrf;
5175 vrf_iter_t iter;
paul718e3742002-12-13 20:15:29 +00005176
5177 write = 0;
5178
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005179 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
5180 {
5181 if ((zvrf = vrf_iter2info (iter)) == NULL ||
5182 (stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL)
5183 continue;
paul718e3742002-12-13 20:15:29 +00005184
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005185 for (rn = route_top (stable); rn; rn = route_next (rn))
5186 for (si = rn->info; si; si = si->next)
5187 {
5188 vty_out (vty, "ipv6 route %s", prefix2str (&rn->p, buf, sizeof buf));
paul718e3742002-12-13 20:15:29 +00005189
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005190 switch (si->type)
5191 {
5192 case STATIC_IPV6_GATEWAY:
5193 vty_out (vty, " %s",
Donald Sharpd4c27d62015-11-04 13:26:35 -05005194 inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005195 break;
5196 case STATIC_IPV6_IFNAME:
5197 vty_out (vty, " %s", si->ifname);
5198 break;
5199 case STATIC_IPV6_GATEWAY_IFNAME:
5200 vty_out (vty, " %s %s",
Donald Sharpd4c27d62015-11-04 13:26:35 -05005201 inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005202 si->ifname);
5203 break;
5204 }
paul718e3742002-12-13 20:15:29 +00005205
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005206 if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
5207 vty_out (vty, " %s", "reject");
hasso81dfcaa2003-05-25 19:21:25 +00005208
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005209 if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
5210 vty_out (vty, " %s", "blackhole");
hasso81dfcaa2003-05-25 19:21:25 +00005211
Piotr Chytłade24f822007-06-28 00:09:28 +02005212 if (si->tag)
5213 vty_out (vty, " tag %d", si->tag);
5214
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005215 if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
5216 vty_out (vty, " %d", si->distance);
paul718e3742002-12-13 20:15:29 +00005217
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005218 if (si->vrf_id != VRF_DEFAULT)
5219 vty_out (vty, " vrf %u", si->vrf_id);
5220
5221 vty_out (vty, "%s", VTY_NEWLINE);
5222
5223 write = 1;
5224 }
5225 }
paul718e3742002-12-13 20:15:29 +00005226 return write;
5227}
paul718e3742002-12-13 20:15:29 +00005228
5229/* Static ip route configuration write function. */
paula1ac18c2005-06-28 17:17:12 +00005230static int
paul718e3742002-12-13 20:15:29 +00005231zebra_ip_config (struct vty *vty)
5232{
5233 int write = 0;
5234
Everton Marques33d86db2014-07-14 11:19:00 -03005235 write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route");
5236 write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute");
paul718e3742002-12-13 20:15:29 +00005237#ifdef HAVE_IPV6
5238 write += static_config_ipv6 (vty);
5239#endif /* HAVE_IPV6 */
5240
5241 return write;
5242}
5243
David Lamparterbd078122015-01-06 19:53:24 +01005244static int config_write_vty(struct vty *vty)
5245{
Paul Jakma7514fb72007-05-02 16:05:35 +00005246 int i;
David Lamparterbd078122015-01-06 19:53:24 +01005247 enum multicast_mode ipv4_multicast_mode = multicast_mode_ipv4_get ();
5248
5249 if (ipv4_multicast_mode != MCAST_NO_CONFIG)
5250 vty_out (vty, "ip multicast rpf-lookup-mode %s%s",
5251 ipv4_multicast_mode == MCAST_URIB_ONLY ? "urib-only" :
5252 ipv4_multicast_mode == MCAST_MRIB_ONLY ? "mrib-only" :
5253 ipv4_multicast_mode == MCAST_MIX_MRIB_FIRST ? "mrib-then-urib" :
5254 ipv4_multicast_mode == MCAST_MIX_DISTANCE ? "lower-distance" :
5255 "longer-prefix",
5256 VTY_NEWLINE);
Paul Jakma7514fb72007-05-02 16:05:35 +00005257
5258 for (i=0;i<ZEBRA_ROUTE_MAX;i++)
5259 {
5260 if (proto_rm[AFI_IP][i])
5261 vty_out (vty, "ip protocol %s route-map %s%s", zebra_route_string(i),
5262 proto_rm[AFI_IP][i], VTY_NEWLINE);
5263 }
5264 if (proto_rm[AFI_IP][ZEBRA_ROUTE_MAX])
5265 vty_out (vty, "ip protocol %s route-map %s%s", "any",
5266 proto_rm[AFI_IP][ZEBRA_ROUTE_MAX], VTY_NEWLINE);
5267
5268 return 1;
5269}
5270
5271/* table node for protocol filtering */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08005272static struct cmd_node protocol_node = { PROTOCOL_NODE, "", 1 };
Paul Jakma7514fb72007-05-02 16:05:35 +00005273
paul718e3742002-12-13 20:15:29 +00005274/* IP node for static routes. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08005275static struct cmd_node ip_node = { IP_NODE, "", 1 };
paul718e3742002-12-13 20:15:29 +00005276
5277/* Route VTY. */
5278void
paula1ac18c2005-06-28 17:17:12 +00005279zebra_vty_init (void)
paul718e3742002-12-13 20:15:29 +00005280{
5281 install_node (&ip_node, zebra_ip_config);
David Lamparterbd078122015-01-06 19:53:24 +01005282 install_node (&protocol_node, config_write_vty);
paul718e3742002-12-13 20:15:29 +00005283
Everton Marques33d86db2014-07-14 11:19:00 -03005284 install_element (CONFIG_NODE, &ip_mroute_cmd);
David Lampartera76681b2015-01-22 19:03:53 +01005285 install_element (CONFIG_NODE, &ip_mroute_dist_cmd);
Everton Marques33d86db2014-07-14 11:19:00 -03005286 install_element (CONFIG_NODE, &no_ip_mroute_cmd);
David Lampartera76681b2015-01-22 19:03:53 +01005287 install_element (CONFIG_NODE, &no_ip_mroute_dist_cmd);
David Lamparterbd078122015-01-06 19:53:24 +01005288 install_element (CONFIG_NODE, &ip_multicast_mode_cmd);
5289 install_element (CONFIG_NODE, &no_ip_multicast_mode_cmd);
5290 install_element (CONFIG_NODE, &no_ip_multicast_mode_noarg_cmd);
Paul Jakma7514fb72007-05-02 16:05:35 +00005291 install_element (CONFIG_NODE, &ip_protocol_cmd);
5292 install_element (CONFIG_NODE, &no_ip_protocol_cmd);
5293 install_element (VIEW_NODE, &show_ip_protocol_cmd);
paul718e3742002-12-13 20:15:29 +00005294 install_element (CONFIG_NODE, &ip_route_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005295 install_element (CONFIG_NODE, &ip_route_tag_cmd);
5296 install_element (CONFIG_NODE, &ip_route_tag_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005297 install_element (CONFIG_NODE, &ip_route_flags_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005298 install_element (CONFIG_NODE, &ip_route_flags_tag_cmd);
5299 install_element (CONFIG_NODE, &ip_route_flags_tag_vrf_cmd);
hasso457ef552003-05-28 12:02:15 +00005300 install_element (CONFIG_NODE, &ip_route_flags2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005301 install_element (CONFIG_NODE, &ip_route_flags2_tag_cmd);
5302 install_element (CONFIG_NODE, &ip_route_flags2_tag_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005303 install_element (CONFIG_NODE, &ip_route_mask_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005304 install_element (CONFIG_NODE, &ip_route_mask_tag_cmd);
5305 install_element (CONFIG_NODE, &ip_route_mask_tag_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005306 install_element (CONFIG_NODE, &ip_route_mask_flags_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005307 install_element (CONFIG_NODE, &ip_route_mask_flags_tag_cmd);
5308 install_element (CONFIG_NODE, &ip_route_mask_flags_tag_vrf_cmd);
hasso457ef552003-05-28 12:02:15 +00005309 install_element (CONFIG_NODE, &ip_route_mask_flags2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005310 install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_cmd);
5311 install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005312 install_element (CONFIG_NODE, &no_ip_route_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005313 install_element (CONFIG_NODE, &no_ip_route_tag_cmd);
5314 install_element (CONFIG_NODE, &no_ip_route_tag_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005315 install_element (CONFIG_NODE, &no_ip_route_flags_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005316 install_element (CONFIG_NODE, &no_ip_route_flags_tag_cmd);
hasso457ef552003-05-28 12:02:15 +00005317 install_element (CONFIG_NODE, &no_ip_route_flags2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005318 install_element (CONFIG_NODE, &no_ip_route_flags2_tag_cmd);
5319 install_element (CONFIG_NODE, &no_ip_route_flags2_tag_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005320 install_element (CONFIG_NODE, &no_ip_route_mask_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005321 install_element (CONFIG_NODE, &no_ip_route_mask_tag_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005322 install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005323 install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_cmd);
hasso457ef552003-05-28 12:02:15 +00005324 install_element (CONFIG_NODE, &no_ip_route_mask_flags2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005325 install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_cmd);
5326 install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005327 install_element (CONFIG_NODE, &ip_route_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005328 install_element (CONFIG_NODE, &ip_route_tag_distance_cmd);
5329 install_element (CONFIG_NODE, &ip_route_tag_distance_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005330 install_element (CONFIG_NODE, &ip_route_flags_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005331 install_element (CONFIG_NODE, &ip_route_flags_tag_distance_cmd);
5332 install_element (CONFIG_NODE, &ip_route_flags_tag_distance_vrf_cmd);
hasso457ef552003-05-28 12:02:15 +00005333 install_element (CONFIG_NODE, &ip_route_flags_distance2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005334 install_element (CONFIG_NODE, &ip_route_flags_tag_distance2_cmd);
5335 install_element (CONFIG_NODE, &ip_route_flags_tag_distance2_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005336 install_element (CONFIG_NODE, &ip_route_mask_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005337 install_element (CONFIG_NODE, &ip_route_mask_tag_distance_cmd);
5338 install_element (CONFIG_NODE, &ip_route_mask_tag_distance_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005339 install_element (CONFIG_NODE, &ip_route_mask_flags_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005340 install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance_cmd);
5341 install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance_vrf_cmd);
hasso457ef552003-05-28 12:02:15 +00005342 install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005343 install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance2_cmd);
5344 install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance2_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005345 install_element (CONFIG_NODE, &no_ip_route_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005346 install_element (CONFIG_NODE, &no_ip_route_tag_distance_cmd);
5347 install_element (CONFIG_NODE, &no_ip_route_tag_distance_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005348 install_element (CONFIG_NODE, &no_ip_route_flags_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005349 install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_cmd);
5350 install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_vrf_cmd);
hasso457ef552003-05-28 12:02:15 +00005351 install_element (CONFIG_NODE, &no_ip_route_flags_distance2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005352 install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_cmd);
5353 install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_vrf_cmd);
Igor Ryzhov5f678882016-04-22 17:38:24 +03005354 install_element (CONFIG_NODE, &no_ip_route_mask_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005355 install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_cmd);
5356 install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005357 install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005358 install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_cmd);
5359 install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_vrf_cmd);
hasso457ef552003-05-28 12:02:15 +00005360 install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005361 install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_cmd);
5362 install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005363
5364 install_element (VIEW_NODE, &show_ip_route_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005365 install_element (VIEW_NODE, &show_ip_route_tag_cmd);
5366 install_element (VIEW_NODE, &show_ip_route_tag_vrf_cmd);
Pradosh Mohapatra60cc9592015-11-09 20:21:41 -05005367 install_element (VIEW_NODE, &show_ip_nht_cmd);
5368 install_element (VIEW_NODE, &show_ipv6_nht_cmd);
paul718e3742002-12-13 20:15:29 +00005369 install_element (VIEW_NODE, &show_ip_route_addr_cmd);
5370 install_element (VIEW_NODE, &show_ip_route_prefix_cmd);
5371 install_element (VIEW_NODE, &show_ip_route_prefix_longer_cmd);
5372 install_element (VIEW_NODE, &show_ip_route_protocol_cmd);
5373 install_element (VIEW_NODE, &show_ip_route_supernets_cmd);
Stig Thormodsrud61691c92008-11-04 15:45:07 -08005374 install_element (VIEW_NODE, &show_ip_route_summary_cmd);
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07005375 install_element (VIEW_NODE, &show_ip_route_summary_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00005376
Everton Marques33d86db2014-07-14 11:19:00 -03005377 install_element (VIEW_NODE, &show_ip_rpf_cmd);
David Lamparter3b02fe82015-01-22 19:12:35 +01005378 install_element (VIEW_NODE, &show_ip_rpf_addr_cmd);
G.Balajicddf3912011-11-26 21:59:32 +04005379
Feng Lu4364ee52015-05-22 11:40:03 +02005380 /* Commands for VRF */
5381
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005382 install_element (CONFIG_NODE, &ip_mroute_vrf_cmd);
5383 install_element (CONFIG_NODE, &ip_mroute_dist_vrf_cmd);
5384 install_element (CONFIG_NODE, &no_ip_mroute_vrf_cmd);
5385 install_element (CONFIG_NODE, &no_ip_mroute_dist_vrf_cmd);
5386
5387 install_element (CONFIG_NODE, &ip_route_vrf_cmd);
5388 install_element (CONFIG_NODE, &ip_route_flags_vrf_cmd);
5389 install_element (CONFIG_NODE, &ip_route_flags2_vrf_cmd);
5390 install_element (CONFIG_NODE, &ip_route_mask_vrf_cmd);
5391 install_element (CONFIG_NODE, &ip_route_mask_flags_vrf_cmd);
5392 install_element (CONFIG_NODE, &ip_route_mask_flags2_vrf_cmd);
5393 install_element (CONFIG_NODE, &no_ip_route_vrf_cmd);
5394 install_element (CONFIG_NODE, &no_ip_route_flags_vrf_cmd);
5395 install_element (CONFIG_NODE, &no_ip_route_flags2_vrf_cmd);
5396 install_element (CONFIG_NODE, &no_ip_route_mask_vrf_cmd);
5397 install_element (CONFIG_NODE, &no_ip_route_mask_flags_vrf_cmd);
5398 install_element (CONFIG_NODE, &no_ip_route_mask_flags2_vrf_cmd);
5399 install_element (CONFIG_NODE, &ip_route_distance_vrf_cmd);
5400 install_element (CONFIG_NODE, &ip_route_flags_distance_vrf_cmd);
5401 install_element (CONFIG_NODE, &ip_route_flags_distance2_vrf_cmd);
5402 install_element (CONFIG_NODE, &ip_route_mask_distance_vrf_cmd);
5403 install_element (CONFIG_NODE, &ip_route_mask_flags_distance_vrf_cmd);
5404 install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_vrf_cmd);
5405 install_element (CONFIG_NODE, &no_ip_route_distance_vrf_cmd);
5406 install_element (CONFIG_NODE, &no_ip_route_flags_distance_vrf_cmd);
5407 install_element (CONFIG_NODE, &no_ip_route_flags_distance2_vrf_cmd);
Igor Ryzhov5f678882016-04-22 17:38:24 +03005408 install_element (CONFIG_NODE, &no_ip_route_mask_distance_vrf_cmd);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005409 install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_vrf_cmd);
5410 install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_vrf_cmd);
5411
Feng Lu4364ee52015-05-22 11:40:03 +02005412 install_element (VIEW_NODE, &show_ip_route_vrf_cmd);
5413 install_element (VIEW_NODE, &show_ip_route_addr_vrf_cmd);
5414 install_element (VIEW_NODE, &show_ip_route_prefix_vrf_cmd);
5415 install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_cmd);
5416 install_element (VIEW_NODE, &show_ip_route_protocol_vrf_cmd);
5417 install_element (VIEW_NODE, &show_ip_route_supernets_vrf_cmd);
5418 install_element (VIEW_NODE, &show_ip_route_summary_vrf_cmd);
5419 install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005420
5421 install_element (VIEW_NODE, &show_ip_route_vrf_all_cmd);
5422 install_element (VIEW_NODE, &show_ip_route_addr_vrf_all_cmd);
5423 install_element (VIEW_NODE, &show_ip_route_prefix_vrf_all_cmd);
5424 install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_all_cmd);
5425 install_element (VIEW_NODE, &show_ip_route_protocol_vrf_all_cmd);
5426 install_element (VIEW_NODE, &show_ip_route_supernets_vrf_all_cmd);
5427 install_element (VIEW_NODE, &show_ip_route_summary_vrf_all_cmd);
5428 install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_all_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005429
Feng Lu4364ee52015-05-22 11:40:03 +02005430 install_element (VIEW_NODE, &show_ip_rpf_vrf_cmd);
5431 install_element (VIEW_NODE, &show_ip_rpf_vrf_all_cmd);
5432 install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_cmd);
5433 install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_all_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005434
paul718e3742002-12-13 20:15:29 +00005435 install_element (CONFIG_NODE, &ipv6_route_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005436 install_element (CONFIG_NODE, &ipv6_route_flags_cmd);
paul718e3742002-12-13 20:15:29 +00005437 install_element (CONFIG_NODE, &ipv6_route_ifname_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005438 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_cmd);
paul718e3742002-12-13 20:15:29 +00005439 install_element (CONFIG_NODE, &no_ipv6_route_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005440 install_element (CONFIG_NODE, &no_ipv6_route_flags_cmd);
paul718e3742002-12-13 20:15:29 +00005441 install_element (CONFIG_NODE, &no_ipv6_route_ifname_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005442 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_cmd);
paul718e3742002-12-13 20:15:29 +00005443 install_element (CONFIG_NODE, &ipv6_route_pref_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005444 install_element (CONFIG_NODE, &ipv6_route_flags_pref_cmd);
paul718e3742002-12-13 20:15:29 +00005445 install_element (CONFIG_NODE, &ipv6_route_ifname_pref_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005446 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_cmd);
paul718e3742002-12-13 20:15:29 +00005447 install_element (CONFIG_NODE, &no_ipv6_route_pref_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005448 install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_cmd);
paul718e3742002-12-13 20:15:29 +00005449 install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005450 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005451 install_element (CONFIG_NODE, &ipv6_route_tag_cmd);
5452 install_element (CONFIG_NODE, &ipv6_route_tag_vrf_cmd);
5453 install_element (CONFIG_NODE, &ipv6_route_flags_tag_cmd);
5454 install_element (CONFIG_NODE, &ipv6_route_flags_tag_vrf_cmd);
5455 install_element (CONFIG_NODE, &ipv6_route_ifname_tag_cmd);
5456 install_element (CONFIG_NODE, &ipv6_route_ifname_tag_vrf_cmd);
5457 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_tag_cmd);
5458 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_tag_vrf_cmd);
5459 install_element (CONFIG_NODE, &ipv6_route_pref_tag_cmd);
5460 install_element (CONFIG_NODE, &ipv6_route_pref_tag_vrf_cmd);
5461 install_element (CONFIG_NODE, &ipv6_route_flags_pref_tag_cmd);
5462 install_element (CONFIG_NODE, &ipv6_route_flags_pref_tag_vrf_cmd);
5463 install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_cmd);
5464 install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_vrf_cmd);
5465 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_tag_cmd);
5466 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_tag_vrf_cmd);
5467 install_element (CONFIG_NODE, &no_ipv6_route_tag_cmd);
5468 install_element (CONFIG_NODE, &no_ipv6_route_tag_vrf_cmd);
5469 install_element (CONFIG_NODE, &no_ipv6_route_flags_tag_cmd);
5470 install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_cmd);
5471 install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_vrf_cmd);
5472 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_tag_cmd);
5473 install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_cmd);
5474 install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_vrf_cmd);
5475 install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_tag_cmd);
5476 install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_tag_vrf_cmd);
5477 install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_cmd);
5478 install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_vrf_cmd);
5479 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_cmd);
5480 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005481 install_element (VIEW_NODE, &show_ipv6_route_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005482 install_element (VIEW_NODE, &show_ipv6_route_tag_cmd);
5483 install_element (VIEW_NODE, &show_ipv6_route_tag_vrf_cmd);
Stig Thormodsrud61691c92008-11-04 15:45:07 -08005484 install_element (VIEW_NODE, &show_ipv6_route_summary_cmd);
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07005485 install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00005486 install_element (VIEW_NODE, &show_ipv6_route_protocol_cmd);
5487 install_element (VIEW_NODE, &show_ipv6_route_addr_cmd);
5488 install_element (VIEW_NODE, &show_ipv6_route_prefix_cmd);
5489 install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_cmd);
G.Balajicddf3912011-11-26 21:59:32 +04005490
5491 install_element (VIEW_NODE, &show_ipv6_mroute_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005492
5493 /* Commands for VRF */
5494
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005495 install_element (CONFIG_NODE, &ipv6_route_vrf_cmd);
5496 install_element (CONFIG_NODE, &ipv6_route_flags_vrf_cmd);
5497 install_element (CONFIG_NODE, &ipv6_route_ifname_vrf_cmd);
5498 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_vrf_cmd);
5499 install_element (CONFIG_NODE, &no_ipv6_route_vrf_cmd);
5500 install_element (CONFIG_NODE, &no_ipv6_route_flags_vrf_cmd);
5501 install_element (CONFIG_NODE, &no_ipv6_route_ifname_vrf_cmd);
5502 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_vrf_cmd);
5503 install_element (CONFIG_NODE, &ipv6_route_pref_vrf_cmd);
5504 install_element (CONFIG_NODE, &ipv6_route_flags_pref_vrf_cmd);
5505 install_element (CONFIG_NODE, &ipv6_route_ifname_pref_vrf_cmd);
5506 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_vrf_cmd);
5507 install_element (CONFIG_NODE, &no_ipv6_route_pref_vrf_cmd);
5508 install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_vrf_cmd);
5509 install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_vrf_cmd);
5510 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_vrf_cmd);
5511
Feng Lu4364ee52015-05-22 11:40:03 +02005512 install_element (VIEW_NODE, &show_ipv6_route_vrf_cmd);
5513 install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_cmd);
5514 install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_cmd);
5515 install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_cmd);
5516 install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_cmd);
5517 install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_cmd);
5518 install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005519
5520 install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd);
5521 install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_all_cmd);
5522 install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_all_cmd);
5523 install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_all_cmd);
5524 install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_all_cmd);
5525 install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_all_cmd);
5526 install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_all_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005527
5528 install_element (VIEW_NODE, &show_ipv6_mroute_vrf_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005529
5530 install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd);
Piotr Chytłade24f822007-06-28 00:09:28 +02005531 install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_all_cmd);
paul718e3742002-12-13 20:15:29 +00005532}