blob: 38f61e9d27768a401201196c5f275288db6e66be [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
2124 || rib->type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00002125 {
2126 time_t uptime;
2127 struct tm *tm;
2128
2129 uptime = time (NULL);
2130 uptime -= rib->uptime;
2131 tm = gmtime (&uptime);
2132
2133 vty_out (vty, " Last update ");
2134
2135 if (uptime < ONE_DAY_SECOND)
2136 vty_out (vty, "%02d:%02d:%02d",
2137 tm->tm_hour, tm->tm_min, tm->tm_sec);
2138 else if (uptime < ONE_WEEK_SECOND)
2139 vty_out (vty, "%dd%02dh%02dm",
2140 tm->tm_yday, tm->tm_hour, tm->tm_min);
2141 else
2142 vty_out (vty, "%02dw%dd%02dh",
2143 tm->tm_yday/7,
2144 tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
2145 vty_out (vty, " ago%s", VTY_NEWLINE);
2146 }
2147
Christian Frankefa713d92013-07-05 15:35:37 +00002148 for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
Timo Teräs53a5c392015-05-23 11:08:40 +03002149 {
Timo Teräs7e73eb72016-04-09 17:22:32 +03002150 vty_out (vty, " %c%c%s",
2151 CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE) ? '>' : ' ',
Timo Teräs53a5c392015-05-23 11:08:40 +03002152 CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ',
2153 recursing ? " " : "");
Paul Jakma7514fb72007-05-02 16:05:35 +00002154
Timo Teräs53a5c392015-05-23 11:08:40 +03002155 switch (nexthop->type)
2156 {
2157 case NEXTHOP_TYPE_IPV4:
2158 case NEXTHOP_TYPE_IPV4_IFINDEX:
2159 vty_out (vty, " %s", inet_ntoa (nexthop->gate.ipv4));
2160 if (nexthop->ifindex)
Feng Lu0d0686f2015-05-22 11:40:02 +02002161 vty_out (vty, ", via %s",
2162 ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
Timo Teräs53a5c392015-05-23 11:08:40 +03002163 break;
2164 case NEXTHOP_TYPE_IPV6:
2165 case NEXTHOP_TYPE_IPV6_IFINDEX:
2166 case NEXTHOP_TYPE_IPV6_IFNAME:
2167 vty_out (vty, " %s",
2168 inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, sizeof(buf)));
2169 if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME)
2170 vty_out (vty, ", %s", nexthop->ifname);
2171 else if (nexthop->ifindex)
Feng Lu0d0686f2015-05-22 11:40:02 +02002172 vty_out (vty, ", via %s",
2173 ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
Timo Teräs53a5c392015-05-23 11:08:40 +03002174 break;
2175 case NEXTHOP_TYPE_IFINDEX:
2176 vty_out (vty, " directly connected, %s",
Feng Lu0d0686f2015-05-22 11:40:02 +02002177 ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
Timo Teräs53a5c392015-05-23 11:08:40 +03002178 break;
2179 case NEXTHOP_TYPE_IFNAME:
2180 vty_out (vty, " directly connected, %s", nexthop->ifname);
2181 break;
2182 case NEXTHOP_TYPE_BLACKHOLE:
2183 vty_out (vty, " directly connected, Null0");
2184 break;
2185 default:
2186 break;
2187 }
2188 if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
2189 vty_out (vty, " inactive");
paul718e3742002-12-13 20:15:29 +00002190
Timo Teräs53a5c392015-05-23 11:08:40 +03002191 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
2192 vty_out (vty, " onlink");
paul718e3742002-12-13 20:15:29 +00002193
Timo Teräs53a5c392015-05-23 11:08:40 +03002194 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
2195 vty_out (vty, " (recursive)");
Christian Frankee8d3d292013-07-05 15:35:39 +00002196
Timo Teräs53a5c392015-05-23 11:08:40 +03002197 switch (nexthop->type)
Paul Jakma7514fb72007-05-02 16:05:35 +00002198 {
2199 case NEXTHOP_TYPE_IPV4:
2200 case NEXTHOP_TYPE_IPV4_IFINDEX:
2201 case NEXTHOP_TYPE_IPV4_IFNAME:
2202 if (nexthop->src.ipv4.s_addr)
2203 {
Timo Teräs53a5c392015-05-23 11:08:40 +03002204 if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf))
2205 vty_out (vty, ", src %s", buf);
Paul Jakma7514fb72007-05-02 16:05:35 +00002206 }
2207 break;
Andrew J. Schorr09303312007-05-30 20:10:34 +00002208#ifdef HAVE_IPV6
Paul Jakma7514fb72007-05-02 16:05:35 +00002209 case NEXTHOP_TYPE_IPV6:
2210 case NEXTHOP_TYPE_IPV6_IFINDEX:
2211 case NEXTHOP_TYPE_IPV6_IFNAME:
2212 if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))
2213 {
Timo Teräs53a5c392015-05-23 11:08:40 +03002214 if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf))
2215 vty_out (vty, ", src %s", buf);
Paul Jakma7514fb72007-05-02 16:05:35 +00002216 }
2217 break;
Andrew J. Schorr09303312007-05-30 20:10:34 +00002218#endif /* HAVE_IPV6 */
Paul Jakma7514fb72007-05-02 16:05:35 +00002219 default:
Timo Teräs53a5c392015-05-23 11:08:40 +03002220 break;
Paul Jakma7514fb72007-05-02 16:05:35 +00002221 }
Timo Teräs53a5c392015-05-23 11:08:40 +03002222 vty_out (vty, "%s", VTY_NEWLINE);
2223 }
paul718e3742002-12-13 20:15:29 +00002224 vty_out (vty, "%s", VTY_NEWLINE);
2225 }
2226}
2227
paula1ac18c2005-06-28 17:17:12 +00002228static void
paul718e3742002-12-13 20:15:29 +00002229vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)
2230{
Christian Frankefa713d92013-07-05 15:35:37 +00002231 struct nexthop *nexthop, *tnexthop;
2232 int recursing;
paul718e3742002-12-13 20:15:29 +00002233 int len = 0;
2234 char buf[BUFSIZ];
2235
2236 /* Nexthop information. */
Christian Frankefa713d92013-07-05 15:35:37 +00002237 for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
paul718e3742002-12-13 20:15:29 +00002238 {
2239 if (nexthop == rib->nexthop)
2240 {
2241 /* Prefix information. */
Timo Teräs53a5c392015-05-23 11:08:40 +03002242 len = vty_out (vty, "%c%c%c %s",
ajsf52d13c2005-10-01 17:38:06 +00002243 zebra_route_char (rib->type),
paul718e3742002-12-13 20:15:29 +00002244 CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)
2245 ? '>' : ' ',
2246 CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
2247 ? '*' : ' ',
Timo Teräs53a5c392015-05-23 11:08:40 +03002248 prefix2str (&rn->p, buf, sizeof buf));
paul718e3742002-12-13 20:15:29 +00002249
2250 /* Distance and metric display. */
2251 if (rib->type != ZEBRA_ROUTE_CONNECT
2252 && rib->type != ZEBRA_ROUTE_KERNEL)
2253 len += vty_out (vty, " [%d/%d]", rib->distance,
2254 rib->metric);
Feng Lu4364ee52015-05-22 11:40:03 +02002255
2256 if (rib->vrf_id != VRF_DEFAULT)
2257 len += vty_out (vty, " [vrf %u]", rib->vrf_id);
paul718e3742002-12-13 20:15:29 +00002258 }
2259 else
2260 vty_out (vty, " %c%*c",
2261 CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
2262 ? '*' : ' ',
Christian Frankefa713d92013-07-05 15:35:37 +00002263 len - 3 + (2 * recursing), ' ');
paul718e3742002-12-13 20:15:29 +00002264
2265 switch (nexthop->type)
Timo Teräs53a5c392015-05-23 11:08:40 +03002266 {
2267 case NEXTHOP_TYPE_IPV4:
2268 case NEXTHOP_TYPE_IPV4_IFINDEX:
2269 vty_out (vty, " via %s", inet_ntoa (nexthop->gate.ipv4));
2270 if (nexthop->ifindex)
Feng Lu0d0686f2015-05-22 11:40:02 +02002271 vty_out (vty, ", %s",
2272 ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
Timo Teräs53a5c392015-05-23 11:08:40 +03002273 break;
2274 case NEXTHOP_TYPE_IPV6:
2275 case NEXTHOP_TYPE_IPV6_IFINDEX:
2276 case NEXTHOP_TYPE_IPV6_IFNAME:
2277 vty_out (vty, " via %s",
2278 inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ));
2279 if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME)
2280 vty_out (vty, ", %s", nexthop->ifname);
2281 else if (nexthop->ifindex)
Feng Lu0d0686f2015-05-22 11:40:02 +02002282 vty_out (vty, ", %s",
2283 ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
Timo Teräs53a5c392015-05-23 11:08:40 +03002284 break;
2285 case NEXTHOP_TYPE_IFINDEX:
2286 vty_out (vty, " is directly connected, %s",
Feng Lu0d0686f2015-05-22 11:40:02 +02002287 ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
Timo Teräs53a5c392015-05-23 11:08:40 +03002288 break;
2289 case NEXTHOP_TYPE_IFNAME:
2290 vty_out (vty, " is directly connected, %s", nexthop->ifname);
2291 break;
2292 case NEXTHOP_TYPE_BLACKHOLE:
2293 vty_out (vty, " is directly connected, Null0");
2294 break;
2295 default:
2296 break;
2297 }
paul718e3742002-12-13 20:15:29 +00002298 if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
Timo Teräs53a5c392015-05-23 11:08:40 +03002299 vty_out (vty, " inactive");
paul718e3742002-12-13 20:15:29 +00002300
Christian Frankee8d3d292013-07-05 15:35:39 +00002301 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
Timo Teräs53a5c392015-05-23 11:08:40 +03002302 vty_out (vty, " onlink");
Christian Frankee8d3d292013-07-05 15:35:39 +00002303
paul718e3742002-12-13 20:15:29 +00002304 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
Timo Teräs53a5c392015-05-23 11:08:40 +03002305 vty_out (vty, " (recursive)");
Christian Frankefa713d92013-07-05 15:35:37 +00002306
Paul Jakma7514fb72007-05-02 16:05:35 +00002307 switch (nexthop->type)
2308 {
2309 case NEXTHOP_TYPE_IPV4:
2310 case NEXTHOP_TYPE_IPV4_IFINDEX:
2311 case NEXTHOP_TYPE_IPV4_IFNAME:
2312 if (nexthop->src.ipv4.s_addr)
2313 {
Timo Teräs53a5c392015-05-23 11:08:40 +03002314 if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf))
Paul Jakma7514fb72007-05-02 16:05:35 +00002315 vty_out (vty, ", src %s", buf);
2316 }
2317 break;
Andrew J. Schorr09303312007-05-30 20:10:34 +00002318#ifdef HAVE_IPV6
Paul Jakma7514fb72007-05-02 16:05:35 +00002319 case NEXTHOP_TYPE_IPV6:
2320 case NEXTHOP_TYPE_IPV6_IFINDEX:
2321 case NEXTHOP_TYPE_IPV6_IFNAME:
2322 if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))
2323 {
Timo Teräs53a5c392015-05-23 11:08:40 +03002324 if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf))
Paul Jakma7514fb72007-05-02 16:05:35 +00002325 vty_out (vty, ", src %s", buf);
2326 }
2327 break;
Andrew J. Schorr09303312007-05-30 20:10:34 +00002328#endif /* HAVE_IPV6 */
Paul Jakma7514fb72007-05-02 16:05:35 +00002329 default:
Timo Teräs53a5c392015-05-23 11:08:40 +03002330 break;
Paul Jakma7514fb72007-05-02 16:05:35 +00002331 }
paul718e3742002-12-13 20:15:29 +00002332
hasso81dfcaa2003-05-25 19:21:25 +00002333 if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
2334 vty_out (vty, ", bh");
2335 if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
2336 vty_out (vty, ", rej");
2337
paul718e3742002-12-13 20:15:29 +00002338 if (rib->type == ZEBRA_ROUTE_RIP
Timo Teräs53a5c392015-05-23 11:08:40 +03002339 || rib->type == ZEBRA_ROUTE_RIPNG
2340 || rib->type == ZEBRA_ROUTE_OSPF
2341 || rib->type == ZEBRA_ROUTE_OSPF6
2342 || rib->type == ZEBRA_ROUTE_BABEL
2343 || rib->type == ZEBRA_ROUTE_ISIS
2344 || rib->type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00002345 {
2346 time_t uptime;
2347 struct tm *tm;
2348
2349 uptime = time (NULL);
2350 uptime -= rib->uptime;
2351 tm = gmtime (&uptime);
2352
2353#define ONE_DAY_SECOND 60*60*24
2354#define ONE_WEEK_SECOND 60*60*24*7
2355
2356 if (uptime < ONE_DAY_SECOND)
2357 vty_out (vty, ", %02d:%02d:%02d",
2358 tm->tm_hour, tm->tm_min, tm->tm_sec);
2359 else if (uptime < ONE_WEEK_SECOND)
2360 vty_out (vty, ", %dd%02dh%02dm",
2361 tm->tm_yday, tm->tm_hour, tm->tm_min);
2362 else
2363 vty_out (vty, ", %02dw%dd%02dh",
2364 tm->tm_yday/7,
2365 tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
2366 }
2367 vty_out (vty, "%s", VTY_NEWLINE);
2368 }
2369}
2370
paul718e3742002-12-13 20:15:29 +00002371DEFUN (show_ip_route,
2372 show_ip_route_cmd,
2373 "show ip route",
2374 SHOW_STR
2375 IP_STR
2376 "IP routing table\n")
2377{
Feng Lu4364ee52015-05-22 11:40:03 +02002378 vrf_id_t vrf_id = VRF_DEFAULT;
2379
2380 if (argc > 0)
2381 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
2382
2383 return do_show_ip_route(vty, SAFI_UNICAST, vrf_id);
Everton Marques33d86db2014-07-14 11:19:00 -03002384}
2385
Feng Lu4364ee52015-05-22 11:40:03 +02002386static int do_show_ip_route(struct vty *vty, safi_t safi, vrf_id_t vrf_id)
2387{
paul718e3742002-12-13 20:15:29 +00002388 struct route_table *table;
2389 struct route_node *rn;
2390 struct rib *rib;
2391 int first = 1;
2392
Feng Lu4364ee52015-05-22 11:40:03 +02002393 table = zebra_vrf_table (AFI_IP, safi, vrf_id);
paul718e3742002-12-13 20:15:29 +00002394 if (! table)
2395 return CMD_SUCCESS;
2396
2397 /* Show all IPv4 routes. */
2398 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00002399 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00002400 {
2401 if (first)
2402 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02002403 vty_out (vty, SHOW_ROUTE_V4_HEADER);
paul718e3742002-12-13 20:15:29 +00002404 first = 0;
2405 }
2406 vty_show_ip_route (vty, rn, rib);
2407 }
2408 return CMD_SUCCESS;
2409}
2410
Feng Lu4364ee52015-05-22 11:40:03 +02002411ALIAS (show_ip_route,
2412 show_ip_route_vrf_cmd,
2413 "show ip route " VRF_CMD_STR,
2414 SHOW_STR
2415 IP_STR
2416 "IP routing table\n"
2417 VRF_CMD_HELP_STR)
2418
Pradosh Mohapatra60cc9592015-11-09 20:21:41 -05002419DEFUN (show_ip_nht,
2420 show_ip_nht_cmd,
2421 "show ip nht",
2422 SHOW_STR
2423 IP_STR
2424 "IP nexthop tracking table\n")
2425{
2426 zebra_print_rnh_table(0, AF_INET, vty);
2427 return CMD_SUCCESS;
2428}
2429
2430DEFUN (show_ipv6_nht,
2431 show_ipv6_nht_cmd,
2432 "show ipv6 nht",
2433 SHOW_STR
2434 IP_STR
2435 "IPv6 nexthop tracking table\n")
2436{
2437 zebra_print_rnh_table(0, AF_INET6, vty);
2438 return CMD_SUCCESS;
2439}
2440
Piotr Chytłafb214472015-12-01 13:47:06 -05002441DEFUN (show_ip_route_tag,
2442 show_ip_route_tag_cmd,
2443 "show ip route tag <1-65535>",
2444 SHOW_STR
2445 IP_STR
2446 "IP routing table\n"
2447 "Show only routes with tag\n"
2448 "Tag value\n")
2449{
2450 struct route_table *table;
2451 struct route_node *rn;
2452 struct rib *rib;
2453 int first = 1;
Paul Jakma96d10602016-07-01 14:23:45 +01002454 route_tag_t tag = 0;
Piotr Chytłafb214472015-12-01 13:47:06 -05002455 vrf_id_t vrf_id = VRF_DEFAULT;
2456
2457 if (argv[0])
2458 tag = atoi(argv[0]);
2459
2460 if (argc == 2)
2461 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
2462
2463 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
2464 if (! table)
2465 return CMD_SUCCESS;
2466
2467 /* Show all IPv4 routes with matching tag value. */
2468 for (rn = route_top (table); rn; rn = route_next (rn))
2469 RNODE_FOREACH_RIB (rn, rib)
2470 {
2471 if (rib->tag != tag)
2472 continue;
2473
2474 if (first)
2475 {
2476 vty_out (vty, SHOW_ROUTE_V4_HEADER);
2477 first = 0;
2478 }
2479 vty_show_ip_route (vty, rn, rib);
2480 }
2481 return CMD_SUCCESS;
2482}
2483
2484ALIAS (show_ip_route_tag,
2485 show_ip_route_tag_vrf_cmd,
2486 "show ip route tag <1-65535>" VRF_CMD_STR,
2487 SHOW_STR
2488 IP_STR
2489 "IP routing table\n"
2490 "Show only routes with tag\n"
2491 "Tag value\n"
2492 VRF_CMD_HELP_STR)
2493
paul718e3742002-12-13 20:15:29 +00002494DEFUN (show_ip_route_prefix_longer,
2495 show_ip_route_prefix_longer_cmd,
2496 "show ip route A.B.C.D/M longer-prefixes",
2497 SHOW_STR
2498 IP_STR
2499 "IP routing table\n"
2500 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2501 "Show route matching the specified Network/Mask pair only\n")
2502{
2503 struct route_table *table;
2504 struct route_node *rn;
2505 struct rib *rib;
2506 struct prefix p;
2507 int ret;
2508 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02002509 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002510
2511 ret = str2prefix (argv[0], &p);
2512 if (! ret)
2513 {
2514 vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
2515 return CMD_WARNING;
2516 }
Feng Lu4364ee52015-05-22 11:40:03 +02002517
2518 if (argc > 1)
2519 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
2520
2521 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00002522 if (! table)
2523 return CMD_SUCCESS;
2524
2525 /* Show matched type IPv4 routes. */
2526 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00002527 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00002528 if (prefix_match (&p, &rn->p))
2529 {
2530 if (first)
2531 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02002532 vty_out (vty, SHOW_ROUTE_V4_HEADER);
paul718e3742002-12-13 20:15:29 +00002533 first = 0;
2534 }
2535 vty_show_ip_route (vty, rn, rib);
2536 }
2537 return CMD_SUCCESS;
2538}
2539
Feng Lu4364ee52015-05-22 11:40:03 +02002540ALIAS (show_ip_route_prefix_longer,
2541 show_ip_route_prefix_longer_vrf_cmd,
2542 "show ip route A.B.C.D/M longer-prefixes " VRF_CMD_STR,
2543 SHOW_STR
2544 IP_STR
2545 "IP routing table\n"
2546 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2547 "Show route matching the specified Network/Mask pair only\n"
2548 VRF_CMD_HELP_STR)
2549
paul718e3742002-12-13 20:15:29 +00002550DEFUN (show_ip_route_supernets,
2551 show_ip_route_supernets_cmd,
2552 "show ip route supernets-only",
2553 SHOW_STR
2554 IP_STR
2555 "IP routing table\n"
2556 "Show supernet entries only\n")
2557{
2558 struct route_table *table;
2559 struct route_node *rn;
2560 struct rib *rib;
Feng Lu4364ee52015-05-22 11:40:03 +02002561 u_int32_t addr;
paul718e3742002-12-13 20:15:29 +00002562 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02002563 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002564
Feng Lu4364ee52015-05-22 11:40:03 +02002565 if (argc > 0)
2566 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
2567
2568 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00002569 if (! table)
2570 return CMD_SUCCESS;
2571
2572 /* Show matched type IPv4 routes. */
2573 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00002574 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00002575 {
2576 addr = ntohl (rn->p.u.prefix4.s_addr);
2577
2578 if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
2579 || (IN_CLASSB (addr) && rn->p.prefixlen < 16)
Feng Lu4364ee52015-05-22 11:40:03 +02002580 || (IN_CLASSA (addr) && rn->p.prefixlen < 8))
paul718e3742002-12-13 20:15:29 +00002581 {
2582 if (first)
2583 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02002584 vty_out (vty, SHOW_ROUTE_V4_HEADER);
paul718e3742002-12-13 20:15:29 +00002585 first = 0;
2586 }
2587 vty_show_ip_route (vty, rn, rib);
2588 }
2589 }
2590 return CMD_SUCCESS;
2591}
2592
Feng Lu4364ee52015-05-22 11:40:03 +02002593ALIAS (show_ip_route_supernets,
2594 show_ip_route_supernets_vrf_cmd,
2595 "show ip route supernets-only " VRF_CMD_STR,
2596 SHOW_STR
2597 IP_STR
2598 "IP routing table\n"
2599 "Show supernet entries only\n"
2600 VRF_CMD_HELP_STR)
2601
paul718e3742002-12-13 20:15:29 +00002602DEFUN (show_ip_route_protocol,
2603 show_ip_route_protocol_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02002604 "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA,
paul718e3742002-12-13 20:15:29 +00002605 SHOW_STR
2606 IP_STR
2607 "IP routing table\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02002608 QUAGGA_IP_REDIST_HELP_STR_ZEBRA)
paul718e3742002-12-13 20:15:29 +00002609{
2610 int type;
2611 struct route_table *table;
2612 struct route_node *rn;
2613 struct rib *rib;
2614 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02002615 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002616
David Lampartere0ca5fd2009-09-16 01:52:42 +02002617 type = proto_redistnum (AFI_IP, argv[0]);
2618 if (type < 0)
paul718e3742002-12-13 20:15:29 +00002619 {
2620 vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
2621 return CMD_WARNING;
2622 }
Feng Lu4364ee52015-05-22 11:40:03 +02002623
2624 if (argc > 1)
2625 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
2626
2627 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00002628 if (! table)
2629 return CMD_SUCCESS;
2630
2631 /* Show matched type IPv4 routes. */
2632 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00002633 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00002634 if (rib->type == type)
2635 {
2636 if (first)
2637 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02002638 vty_out (vty, SHOW_ROUTE_V4_HEADER);
paul718e3742002-12-13 20:15:29 +00002639 first = 0;
2640 }
2641 vty_show_ip_route (vty, rn, rib);
2642 }
2643 return CMD_SUCCESS;
2644}
2645
Feng Lu4364ee52015-05-22 11:40:03 +02002646ALIAS (show_ip_route_protocol,
2647 show_ip_route_protocol_vrf_cmd,
2648 "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_CMD_STR,
2649 SHOW_STR
2650 IP_STR
2651 "IP routing table\n"
2652 QUAGGA_IP_REDIST_HELP_STR_ZEBRA
2653 VRF_CMD_HELP_STR)
2654
paul718e3742002-12-13 20:15:29 +00002655DEFUN (show_ip_route_addr,
2656 show_ip_route_addr_cmd,
2657 "show ip route A.B.C.D",
2658 SHOW_STR
2659 IP_STR
2660 "IP routing table\n"
2661 "Network in the IP routing table to display\n")
2662{
2663 int ret;
2664 struct prefix_ipv4 p;
2665 struct route_table *table;
2666 struct route_node *rn;
Feng Lu4364ee52015-05-22 11:40:03 +02002667 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002668
2669 ret = str2prefix_ipv4 (argv[0], &p);
2670 if (ret <= 0)
2671 {
2672 vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
2673 return CMD_WARNING;
2674 }
2675
Feng Lu4364ee52015-05-22 11:40:03 +02002676 if (argc > 1)
2677 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
2678
2679 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00002680 if (! table)
2681 return CMD_SUCCESS;
2682
2683 rn = route_node_match (table, (struct prefix *) &p);
2684 if (! rn)
2685 {
2686 vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
2687 return CMD_WARNING;
2688 }
2689
David Lamparter3b02fe82015-01-22 19:12:35 +01002690 vty_show_ip_route_detail (vty, rn, 0);
paul718e3742002-12-13 20:15:29 +00002691
2692 route_unlock_node (rn);
2693
2694 return CMD_SUCCESS;
2695}
2696
Feng Lu4364ee52015-05-22 11:40:03 +02002697ALIAS (show_ip_route_addr,
2698 show_ip_route_addr_vrf_cmd,
2699 "show ip route A.B.C.D " VRF_CMD_STR,
2700 SHOW_STR
2701 IP_STR
2702 "IP routing table\n"
2703 "Network in the IP routing table to display\n"
2704 VRF_CMD_HELP_STR)
2705
paul718e3742002-12-13 20:15:29 +00002706DEFUN (show_ip_route_prefix,
2707 show_ip_route_prefix_cmd,
2708 "show ip route A.B.C.D/M",
2709 SHOW_STR
2710 IP_STR
2711 "IP routing table\n"
2712 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
2713{
2714 int ret;
2715 struct prefix_ipv4 p;
2716 struct route_table *table;
2717 struct route_node *rn;
Feng Lu4364ee52015-05-22 11:40:03 +02002718 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002719
2720 ret = str2prefix_ipv4 (argv[0], &p);
2721 if (ret <= 0)
2722 {
2723 vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
2724 return CMD_WARNING;
2725 }
2726
Feng Lu4364ee52015-05-22 11:40:03 +02002727 if (argc > 1)
2728 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
2729
2730 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00002731 if (! table)
2732 return CMD_SUCCESS;
2733
2734 rn = route_node_match (table, (struct prefix *) &p);
2735 if (! rn || rn->p.prefixlen != p.prefixlen)
2736 {
2737 vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
Lu Feng969d3552014-10-21 06:24:07 +00002738 if (rn)
2739 route_unlock_node (rn);
paul718e3742002-12-13 20:15:29 +00002740 return CMD_WARNING;
2741 }
2742
David Lamparter3b02fe82015-01-22 19:12:35 +01002743 vty_show_ip_route_detail (vty, rn, 0);
paul718e3742002-12-13 20:15:29 +00002744
2745 route_unlock_node (rn);
2746
2747 return CMD_SUCCESS;
2748}
2749
Feng Lu4364ee52015-05-22 11:40:03 +02002750ALIAS (show_ip_route_prefix,
2751 show_ip_route_prefix_vrf_cmd,
2752 "show ip route A.B.C.D/M " VRF_CMD_STR,
2753 SHOW_STR
2754 IP_STR
2755 "IP routing table\n"
2756 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
2757 VRF_CMD_HELP_STR)
2758
paula1ac18c2005-06-28 17:17:12 +00002759static void
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002760vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
paul718e3742002-12-13 20:15:29 +00002761{
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002762 struct route_node *rn;
2763 struct rib *rib;
2764 struct nexthop *nexthop;
2765#define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
2766#define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
2767 u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
2768 u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1];
2769 u_int32_t i;
paul718e3742002-12-13 20:15:29 +00002770
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002771 memset (&rib_cnt, 0, sizeof(rib_cnt));
2772 memset (&fib_cnt, 0, sizeof(fib_cnt));
2773 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00002774 RNODE_FOREACH_RIB (rn, rib)
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002775 for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
2776 {
2777 rib_cnt[ZEBRA_ROUTE_TOTAL]++;
2778 rib_cnt[rib->type]++;
Christian Frankefa713d92013-07-05 15:35:37 +00002779 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
2780 || nexthop_has_fib_child(nexthop))
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002781 {
2782 fib_cnt[ZEBRA_ROUTE_TOTAL]++;
2783 fib_cnt[rib->type]++;
2784 }
2785 if (rib->type == ZEBRA_ROUTE_BGP &&
2786 CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP))
2787 {
2788 rib_cnt[ZEBRA_ROUTE_IBGP]++;
Christian Frankefa713d92013-07-05 15:35:37 +00002789 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
2790 || nexthop_has_fib_child(nexthop))
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002791 fib_cnt[ZEBRA_ROUTE_IBGP]++;
2792 }
2793 }
paul718e3742002-12-13 20:15:29 +00002794
Feng Lu4364ee52015-05-22 11:40:03 +02002795 vty_out (vty, "%-20s %-20s %s (vrf %u)%s",
2796 "Route Source", "Routes", "FIB",
2797 ((rib_table_info_t *)table->info)->zvrf->vrf_id,
2798 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002799
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002800 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
2801 {
2802 if (rib_cnt[i] > 0)
2803 {
2804 if (i == ZEBRA_ROUTE_BGP)
2805 {
2806 vty_out (vty, "%-20s %-20d %-20d %s", "ebgp",
2807 rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP],
2808 fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP],
2809 VTY_NEWLINE);
2810 vty_out (vty, "%-20s %-20d %-20d %s", "ibgp",
2811 rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP],
2812 VTY_NEWLINE);
2813 }
2814 else
2815 vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i),
2816 rib_cnt[i], fib_cnt[i], VTY_NEWLINE);
2817 }
2818 }
paul718e3742002-12-13 20:15:29 +00002819
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002820 vty_out (vty, "------%s", VTY_NEWLINE);
2821 vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
2822 fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);
Feng Lu4364ee52015-05-22 11:40:03 +02002823 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002824}
2825
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07002826/*
2827 * Implementation of the ip route summary prefix command.
2828 *
2829 * This command prints the primary prefixes that have been installed by various
2830 * protocols on the box.
2831 *
2832 */
2833static void
2834vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table)
2835{
2836 struct route_node *rn;
2837 struct rib *rib;
2838 struct nexthop *nexthop;
2839#define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
2840#define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
2841 u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
2842 u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1];
2843 u_int32_t i;
2844 int cnt;
2845
2846 memset (&rib_cnt, 0, sizeof(rib_cnt));
2847 memset (&fib_cnt, 0, sizeof(fib_cnt));
2848 for (rn = route_top (table); rn; rn = route_next (rn))
2849 RNODE_FOREACH_RIB (rn, rib)
2850 {
2851
2852 /*
2853 * In case of ECMP, count only once.
2854 */
2855 cnt = 0;
2856 for (nexthop = rib->nexthop; (!cnt && nexthop); nexthop = nexthop->next)
2857 {
2858 cnt++;
2859 rib_cnt[ZEBRA_ROUTE_TOTAL]++;
2860 rib_cnt[rib->type]++;
2861 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
2862 {
2863 fib_cnt[ZEBRA_ROUTE_TOTAL]++;
2864 fib_cnt[rib->type]++;
2865 }
2866 if (rib->type == ZEBRA_ROUTE_BGP &&
2867 CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP))
2868 {
2869 rib_cnt[ZEBRA_ROUTE_IBGP]++;
2870 if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
2871 fib_cnt[ZEBRA_ROUTE_IBGP]++;
2872 }
2873 }
2874 }
2875
Feng Lu4364ee52015-05-22 11:40:03 +02002876 vty_out (vty, "%-20s %-20s %s (vrf %u)%s",
2877 "Route Source", "Prefix Routes", "FIB",
2878 ((rib_table_info_t *)table->info)->zvrf->vrf_id,
2879 VTY_NEWLINE);
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07002880
2881 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
2882 {
2883 if (rib_cnt[i] > 0)
2884 {
2885 if (i == ZEBRA_ROUTE_BGP)
2886 {
2887 vty_out (vty, "%-20s %-20d %-20d %s", "ebgp",
2888 rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP],
2889 fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP],
2890 VTY_NEWLINE);
2891 vty_out (vty, "%-20s %-20d %-20d %s", "ibgp",
2892 rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP],
2893 VTY_NEWLINE);
2894 }
2895 else
2896 vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i),
2897 rib_cnt[i], fib_cnt[i], VTY_NEWLINE);
2898 }
2899 }
2900
2901 vty_out (vty, "------%s", VTY_NEWLINE);
2902 vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
2903 fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);
Feng Lu4364ee52015-05-22 11:40:03 +02002904 vty_out (vty, "%s", VTY_NEWLINE);
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07002905}
2906
paul718e3742002-12-13 20:15:29 +00002907/* Show route summary. */
2908DEFUN (show_ip_route_summary,
2909 show_ip_route_summary_cmd,
2910 "show ip route summary",
2911 SHOW_STR
2912 IP_STR
2913 "IP routing table\n"
2914 "Summary of all routes\n")
2915{
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002916 struct route_table *table;
Feng Lu4364ee52015-05-22 11:40:03 +02002917 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002918
Feng Lu4364ee52015-05-22 11:40:03 +02002919 if (argc > 0)
2920 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
2921
2922 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002923 if (! table)
2924 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002925
Stig Thormodsrud61691c92008-11-04 15:45:07 -08002926 vty_show_ip_route_summary (vty, table);
paul718e3742002-12-13 20:15:29 +00002927
2928 return CMD_SUCCESS;
2929}
2930
Feng Lu4364ee52015-05-22 11:40:03 +02002931ALIAS (show_ip_route_summary,
2932 show_ip_route_summary_vrf_cmd,
2933 "show ip route summary " VRF_CMD_STR,
2934 SHOW_STR
2935 IP_STR
2936 "IP routing table\n"
2937 "Summary of all routes\n"
2938 VRF_CMD_HELP_STR)
2939
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07002940/* Show route summary prefix. */
2941DEFUN (show_ip_route_summary_prefix,
2942 show_ip_route_summary_prefix_cmd,
2943 "show ip route summary prefix",
2944 SHOW_STR
2945 IP_STR
2946 "IP routing table\n"
2947 "Summary of all routes\n"
2948 "Prefix routes\n")
2949{
2950 struct route_table *table;
Feng Lu4364ee52015-05-22 11:40:03 +02002951 vrf_id_t vrf_id = VRF_DEFAULT;
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07002952
Feng Lu4364ee52015-05-22 11:40:03 +02002953 if (argc > 0)
2954 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
2955
2956 table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07002957 if (! table)
2958 return CMD_SUCCESS;
2959
2960 vty_show_ip_route_summary_prefix (vty, table);
2961
2962 return CMD_SUCCESS;
2963}
2964
Feng Lu4364ee52015-05-22 11:40:03 +02002965ALIAS (show_ip_route_summary_prefix,
2966 show_ip_route_summary_prefix_vrf_cmd,
2967 "show ip route summary prefix " VRF_CMD_STR,
2968 SHOW_STR
2969 IP_STR
2970 "IP routing table\n"
2971 "Summary of all routes\n"
2972 "Prefix routes\n"
2973 VRF_CMD_HELP_STR)
2974
2975DEFUN (show_ip_route_vrf_all,
2976 show_ip_route_vrf_all_cmd,
2977 "show ip route " VRF_ALL_CMD_STR,
2978 SHOW_STR
2979 IP_STR
2980 "IP routing table\n"
2981 VRF_ALL_CMD_HELP_STR)
2982{
2983 struct route_table *table;
2984 struct route_node *rn;
2985 struct rib *rib;
2986 struct zebra_vrf *zvrf;
2987 vrf_iter_t iter;
2988 int first = 1;
2989
2990 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
2991 {
2992 if ((zvrf = vrf_iter2info (iter)) == NULL ||
2993 (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
2994 continue;
2995
2996 /* Show all IPv4 routes. */
2997 for (rn = route_top (table); rn; rn = route_next (rn))
2998 RNODE_FOREACH_RIB (rn, rib)
2999 {
3000 if (first)
3001 {
3002 vty_out (vty, SHOW_ROUTE_V4_HEADER);
3003 first = 0;
3004 }
3005 vty_show_ip_route (vty, rn, rib);
3006 }
3007 }
3008
3009 return CMD_SUCCESS;
3010}
3011
3012DEFUN (show_ip_route_prefix_longer_vrf_all,
3013 show_ip_route_prefix_longer_vrf_all_cmd,
3014 "show ip route A.B.C.D/M longer-prefixes " VRF_ALL_CMD_STR,
3015 SHOW_STR
3016 IP_STR
3017 "IP routing table\n"
3018 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3019 "Show route matching the specified Network/Mask pair only\n"
3020 VRF_ALL_CMD_HELP_STR)
3021{
3022 struct route_table *table;
3023 struct route_node *rn;
3024 struct rib *rib;
3025 struct prefix p;
3026 struct zebra_vrf *zvrf;
3027 vrf_iter_t iter;
3028 int ret;
3029 int first = 1;
3030
3031 ret = str2prefix (argv[0], &p);
3032 if (! ret)
3033 {
3034 vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
3035 return CMD_WARNING;
3036 }
3037
3038 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3039 {
3040 if ((zvrf = vrf_iter2info (iter)) == NULL ||
3041 (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
3042 continue;
3043
3044 /* Show matched type IPv4 routes. */
3045 for (rn = route_top (table); rn; rn = route_next (rn))
3046 RNODE_FOREACH_RIB (rn, rib)
3047 if (prefix_match (&p, &rn->p))
3048 {
3049 if (first)
3050 {
3051 vty_out (vty, SHOW_ROUTE_V4_HEADER);
3052 first = 0;
3053 }
3054 vty_show_ip_route (vty, rn, rib);
3055 }
3056 }
3057
3058 return CMD_SUCCESS;
3059}
3060
3061DEFUN (show_ip_route_supernets_vrf_all,
3062 show_ip_route_supernets_vrf_all_cmd,
3063 "show ip route supernets-only " VRF_ALL_CMD_STR,
3064 SHOW_STR
3065 IP_STR
3066 "IP routing table\n"
3067 "Show supernet entries only\n"
3068 VRF_ALL_CMD_HELP_STR)
3069{
3070 struct route_table *table;
3071 struct route_node *rn;
3072 struct rib *rib;
3073 struct zebra_vrf *zvrf;
3074 vrf_iter_t iter;
3075 u_int32_t addr;
3076 int first = 1;
3077
3078 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3079 {
3080 if ((zvrf = vrf_iter2info (iter)) == NULL ||
3081 (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
3082 continue;
3083
3084 /* Show matched type IPv4 routes. */
3085 for (rn = route_top (table); rn; rn = route_next (rn))
3086 RNODE_FOREACH_RIB (rn, rib)
3087 {
3088 addr = ntohl (rn->p.u.prefix4.s_addr);
3089
3090 if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
3091 || (IN_CLASSB (addr) && rn->p.prefixlen < 16)
3092 || (IN_CLASSA (addr) && rn->p.prefixlen < 8))
3093 {
3094 if (first)
3095 {
3096 vty_out (vty, SHOW_ROUTE_V4_HEADER);
3097 first = 0;
3098 }
3099 vty_show_ip_route (vty, rn, rib);
3100 }
3101 }
3102 }
3103
3104 return CMD_SUCCESS;
3105}
3106
3107DEFUN (show_ip_route_protocol_vrf_all,
3108 show_ip_route_protocol_vrf_all_cmd,
3109 "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR,
3110 SHOW_STR
3111 IP_STR
3112 "IP routing table\n"
3113 QUAGGA_IP_REDIST_HELP_STR_ZEBRA
3114 VRF_ALL_CMD_HELP_STR)
3115{
3116 int type;
3117 struct route_table *table;
3118 struct route_node *rn;
3119 struct rib *rib;
3120 struct zebra_vrf *zvrf;
3121 vrf_iter_t iter;
3122 int first = 1;
3123
3124 type = proto_redistnum (AFI_IP, argv[0]);
3125 if (type < 0)
3126 {
3127 vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
3128 return CMD_WARNING;
3129 }
3130
3131 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3132 {
3133 if ((zvrf = vrf_iter2info (iter)) == NULL ||
3134 (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
3135 continue;
3136
3137 /* Show matched type IPv4 routes. */
3138 for (rn = route_top (table); rn; rn = route_next (rn))
3139 RNODE_FOREACH_RIB (rn, rib)
3140 if (rib->type == type)
3141 {
3142 if (first)
3143 {
3144 vty_out (vty, SHOW_ROUTE_V4_HEADER);
3145 first = 0;
3146 }
3147 vty_show_ip_route (vty, rn, rib);
3148 }
3149 }
3150
3151 return CMD_SUCCESS;
3152}
3153
3154DEFUN (show_ip_route_addr_vrf_all,
3155 show_ip_route_addr_vrf_all_cmd,
3156 "show ip route A.B.C.D " VRF_ALL_CMD_STR,
3157 SHOW_STR
3158 IP_STR
3159 "IP routing table\n"
3160 "Network in the IP routing table to display\n"
3161 VRF_ALL_CMD_HELP_STR)
3162{
3163 int ret;
3164 struct prefix_ipv4 p;
3165 struct route_table *table;
3166 struct route_node *rn;
3167 struct zebra_vrf *zvrf;
3168 vrf_iter_t iter;
3169
3170 ret = str2prefix_ipv4 (argv[0], &p);
3171 if (ret <= 0)
3172 {
3173 vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
3174 return CMD_WARNING;
3175 }
3176
3177 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3178 {
3179 if ((zvrf = vrf_iter2info (iter)) == NULL ||
3180 (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
3181 continue;
3182
3183 rn = route_node_match (table, (struct prefix *) &p);
3184 if (! rn)
3185 continue;
3186
3187 vty_show_ip_route_detail (vty, rn, 0);
3188
3189 route_unlock_node (rn);
3190 }
3191
3192 return CMD_SUCCESS;
3193}
3194
3195DEFUN (show_ip_route_prefix_vrf_all,
3196 show_ip_route_prefix_vrf_all_cmd,
3197 "show ip route A.B.C.D/M " VRF_ALL_CMD_STR,
3198 SHOW_STR
3199 IP_STR
3200 "IP routing table\n"
3201 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
3202 VRF_ALL_CMD_HELP_STR)
3203{
3204 int ret;
3205 struct prefix_ipv4 p;
3206 struct route_table *table;
3207 struct route_node *rn;
3208 struct zebra_vrf *zvrf;
3209 vrf_iter_t iter;
3210
3211 ret = str2prefix_ipv4 (argv[0], &p);
3212 if (ret <= 0)
3213 {
3214 vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
3215 return CMD_WARNING;
3216 }
3217
3218 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3219 {
3220 if ((zvrf = vrf_iter2info (iter)) == NULL ||
3221 (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
3222 continue;
3223
3224 rn = route_node_match (table, (struct prefix *) &p);
3225 if (! rn)
3226 continue;
3227 if (rn->p.prefixlen != p.prefixlen)
3228 {
3229 route_unlock_node (rn);
3230 continue;
3231 }
3232
3233 vty_show_ip_route_detail (vty, rn, 0);
3234
3235 route_unlock_node (rn);
3236 }
3237
3238 return CMD_SUCCESS;
3239}
3240
3241DEFUN (show_ip_route_summary_vrf_all,
3242 show_ip_route_summary_vrf_all_cmd,
3243 "show ip route summary " VRF_ALL_CMD_STR,
3244 SHOW_STR
3245 IP_STR
3246 "IP routing table\n"
3247 "Summary of all routes\n"
3248 VRF_ALL_CMD_HELP_STR)
3249{
3250 struct zebra_vrf *zvrf;
3251 vrf_iter_t iter;
3252
3253 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3254 if ((zvrf = vrf_iter2info (iter)) != NULL)
3255 vty_show_ip_route_summary (vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
3256
3257 return CMD_SUCCESS;
3258}
3259
3260DEFUN (show_ip_route_summary_prefix_vrf_all,
3261 show_ip_route_summary_prefix_vrf_all_cmd,
3262 "show ip route summary prefix " VRF_ALL_CMD_STR,
3263 SHOW_STR
3264 IP_STR
3265 "IP routing table\n"
3266 "Summary of all routes\n"
3267 "Prefix routes\n"
3268 VRF_ALL_CMD_HELP_STR)
3269{
3270 struct zebra_vrf *zvrf;
3271 vrf_iter_t iter;
3272
3273 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3274 if ((zvrf = vrf_iter2info (iter)) != NULL)
3275 vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
3276
3277 return CMD_SUCCESS;
3278}
3279
paul718e3742002-12-13 20:15:29 +00003280/* Write IPv4 static route configuration. */
paula1ac18c2005-06-28 17:17:12 +00003281static int
Everton Marques33d86db2014-07-14 11:19:00 -03003282static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
paul718e3742002-12-13 20:15:29 +00003283{
3284 struct route_node *rn;
Donald Sharpd4c27d62015-11-04 13:26:35 -05003285 struct static_route *si;
paul718e3742002-12-13 20:15:29 +00003286 struct route_table *stable;
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003287 struct zebra_vrf *zvrf;
3288 vrf_iter_t iter;
paul718e3742002-12-13 20:15:29 +00003289 int write;
3290
3291 write = 0;
3292
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003293 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
3294 {
3295 if ((zvrf = vrf_iter2info (iter)) == NULL ||
3296 (stable = zvrf->stable[AFI_IP][safi]) == NULL)
3297 continue;
paul718e3742002-12-13 20:15:29 +00003298
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003299 for (rn = route_top (stable); rn; rn = route_next (rn))
3300 for (si = rn->info; si; si = si->next)
paul7021c422003-07-15 12:52:22 +00003301 {
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003302 vty_out (vty, "%s %s/%d", cmd, inet_ntoa (rn->p.u.prefix4),
3303 rn->p.prefixlen);
3304
3305 switch (si->type)
3306 {
3307 case STATIC_IPV4_GATEWAY:
Donald Sharpd4c27d62015-11-04 13:26:35 -05003308 vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003309 break;
3310 case STATIC_IPV4_IFNAME:
Donald Sharpd4c27d62015-11-04 13:26:35 -05003311 vty_out (vty, " %s", si->ifname);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003312 break;
3313 case STATIC_IPV4_BLACKHOLE:
3314 vty_out (vty, " Null0");
3315 break;
3316 }
3317
3318 /* flags are incompatible with STATIC_IPV4_BLACKHOLE */
3319 if (si->type != STATIC_IPV4_BLACKHOLE)
3320 {
3321 if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
3322 vty_out (vty, " %s", "reject");
3323
3324 if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
3325 vty_out (vty, " %s", "blackhole");
3326 }
3327
Piotr Chytłade24f822007-06-28 00:09:28 +02003328 if (si->tag)
3329 vty_out (vty, " tag %d", si->tag);
3330
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003331 if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
3332 vty_out (vty, " %d", si->distance);
3333
3334 if (si->vrf_id != VRF_DEFAULT)
3335 vty_out (vty, " vrf %u", si->vrf_id);
3336
3337 vty_out (vty, "%s", VTY_NEWLINE);
3338
3339 write = 1;
paul7021c422003-07-15 12:52:22 +00003340 }
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003341 }
paul718e3742002-12-13 20:15:29 +00003342 return write;
3343}
Andrew J. Schorr09303312007-05-30 20:10:34 +00003344
3345DEFUN (show_ip_protocol,
3346 show_ip_protocol_cmd,
3347 "show ip protocol",
3348 SHOW_STR
3349 IP_STR
3350 "IP protocol filtering status\n")
3351{
3352 int i;
3353
3354 vty_out(vty, "Protocol : route-map %s", VTY_NEWLINE);
3355 vty_out(vty, "------------------------%s", VTY_NEWLINE);
3356 for (i=0;i<ZEBRA_ROUTE_MAX;i++)
3357 {
3358 if (proto_rm[AFI_IP][i])
3359 vty_out (vty, "%-10s : %-10s%s", zebra_route_string(i),
3360 proto_rm[AFI_IP][i],
3361 VTY_NEWLINE);
3362 else
3363 vty_out (vty, "%-10s : none%s", zebra_route_string(i), VTY_NEWLINE);
3364 }
3365 if (proto_rm[AFI_IP][i])
3366 vty_out (vty, "%-10s : %-10s%s", "any", proto_rm[AFI_IP][i],
3367 VTY_NEWLINE);
3368 else
3369 vty_out (vty, "%-10s : none%s", "any", VTY_NEWLINE);
3370
3371 return CMD_SUCCESS;
3372}
3373
paul718e3742002-12-13 20:15:29 +00003374/* General fucntion for IPv6 static route. */
paula1ac18c2005-06-28 17:17:12 +00003375static int
hasso39db97e2004-10-12 20:50:58 +00003376static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
3377 const char *gate_str, const char *ifname,
Piotr Chytłade24f822007-06-28 00:09:28 +02003378 const char *flag_str, const char *tag_str,
3379 const char *distance_str, const char *vrf_id_str)
paul718e3742002-12-13 20:15:29 +00003380{
3381 int ret;
3382 u_char distance;
3383 struct prefix p;
3384 struct in6_addr *gate = NULL;
3385 struct in6_addr gate_addr;
3386 u_char type = 0;
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003387 vrf_id_t vrf_id = VRF_DEFAULT;
hasso81dfcaa2003-05-25 19:21:25 +00003388 u_char flag = 0;
Paul Jakma96d10602016-07-01 14:23:45 +01003389 route_tag_t tag = 0;
paul718e3742002-12-13 20:15:29 +00003390
3391 ret = str2prefix (dest_str, &p);
3392 if (ret <= 0)
3393 {
3394 vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
3395 return CMD_WARNING;
3396 }
3397
3398 /* Apply mask for given prefix. */
3399 apply_mask (&p);
3400
hasso81dfcaa2003-05-25 19:21:25 +00003401 /* Route flags */
3402 if (flag_str) {
3403 switch(flag_str[0]) {
3404 case 'r':
3405 case 'R': /* XXX */
3406 SET_FLAG (flag, ZEBRA_FLAG_REJECT);
3407 break;
3408 case 'b':
3409 case 'B': /* XXX */
3410 SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE);
3411 break;
3412 default:
3413 vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE);
paul595db7f2003-05-25 21:35:06 +00003414 return CMD_WARNING;
hasso81dfcaa2003-05-25 19:21:25 +00003415 }
3416 }
3417
paul718e3742002-12-13 20:15:29 +00003418 /* Administrative distance. */
3419 if (distance_str)
3420 distance = atoi (distance_str);
3421 else
3422 distance = ZEBRA_STATIC_DISTANCE_DEFAULT;
3423
Piotr Chytłade24f822007-06-28 00:09:28 +02003424 /* tag */
3425 if (tag_str)
3426 tag = atoi (tag_str);
3427
Piotr Chytłafb214472015-12-01 13:47:06 -05003428 /* tag */
3429 if (tag_str)
3430 tag = atoi(tag_str);
3431
paul718e3742002-12-13 20:15:29 +00003432 /* When gateway is valid IPv6 addrees, then gate is treated as
3433 nexthop address other case gate is treated as interface name. */
3434 ret = inet_pton (AF_INET6, gate_str, &gate_addr);
3435
3436 if (ifname)
3437 {
3438 /* When ifname is specified. It must be come with gateway
3439 address. */
3440 if (ret != 1)
3441 {
3442 vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
3443 return CMD_WARNING;
3444 }
3445 type = STATIC_IPV6_GATEWAY_IFNAME;
3446 gate = &gate_addr;
3447 }
3448 else
3449 {
3450 if (ret == 1)
3451 {
3452 type = STATIC_IPV6_GATEWAY;
3453 gate = &gate_addr;
3454 }
3455 else
3456 {
3457 type = STATIC_IPV6_IFNAME;
3458 ifname = gate_str;
3459 }
3460 }
3461
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003462 /* VRF id */
3463 if (vrf_id_str)
3464 VTY_GET_INTEGER ("VRF ID", vrf_id, vrf_id_str);
3465
paul718e3742002-12-13 20:15:29 +00003466 if (add_cmd)
Piotr Chytłade24f822007-06-28 00:09:28 +02003467 static_add_ipv6 (&p, type, gate, ifname, flag, tag, distance, vrf_id);
paul718e3742002-12-13 20:15:29 +00003468 else
Piotr Chytłade24f822007-06-28 00:09:28 +02003469 static_delete_ipv6 (&p, type, gate, ifname, tag, distance, vrf_id);
paul718e3742002-12-13 20:15:29 +00003470
3471 return CMD_SUCCESS;
3472}
3473
3474DEFUN (ipv6_route,
3475 ipv6_route_cmd,
3476 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)",
3477 IP_STR
3478 "Establish static routes\n"
3479 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3480 "IPv6 gateway address\n"
3481 "IPv6 gateway interface name\n")
3482{
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003483 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL,
Piotr Chytłade24f822007-06-28 00:09:28 +02003484 NULL, NULL);
hasso81dfcaa2003-05-25 19:21:25 +00003485}
3486
Piotr Chytłafb214472015-12-01 13:47:06 -05003487DEFUN (ipv6_route_tag,
3488 ipv6_route_tag_cmd,
3489 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>",
3490 IP_STR
3491 "Establish static routes\n"
3492 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3493 "IPv6 gateway address\n"
3494 "IPv6 gateway interface name\n"
3495 "Set tag for this route\n"
3496 "Tag value\n")
3497{
3498 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL);
3499}
3500
3501DEFUN (ipv6_route_tag_vrf,
3502 ipv6_route_tag_vrf_cmd,
3503 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>" VRF_CMD_STR,
3504 IP_STR
3505 "Establish static routes\n"
3506 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3507 "IPv6 gateway address\n"
3508 "IPv6 gateway interface name\n"
3509 "Set tag for this route\n"
3510 "Tag value\n"
3511 VRF_CMD_HELP_STR)
3512{
3513 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]);
3514}
3515
hasso81dfcaa2003-05-25 19:21:25 +00003516DEFUN (ipv6_route_flags,
3517 ipv6_route_flags_cmd,
3518 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
3519 IP_STR
3520 "Establish static routes\n"
3521 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3522 "IPv6 gateway address\n"
3523 "IPv6 gateway interface name\n"
3524 "Emit an ICMP unreachable when matched\n"
3525 "Silently discard pkts when matched\n")
3526{
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003527 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL,
Piotr Chytłade24f822007-06-28 00:09:28 +02003528 NULL, NULL);
paul718e3742002-12-13 20:15:29 +00003529}
3530
Piotr Chytłafb214472015-12-01 13:47:06 -05003531DEFUN (ipv6_route_flags_tag,
3532 ipv6_route_flags_tag_cmd,
3533 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>",
3534 IP_STR
3535 "Establish static routes\n"
3536 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3537 "IPv6 gateway address\n"
3538 "IPv6 gateway interface name\n"
3539 "Emit an ICMP unreachable when matched\n"
3540 "Silently discard pkts when matched\n"
3541 "Set tag for this route\n"
3542 "Tag value\n")
3543{
3544 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL);
3545}
3546
3547DEFUN (ipv6_route_flags_tag_vrf,
3548 ipv6_route_flags_tag_vrf_cmd,
3549 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>" VRF_CMD_STR,
3550 IP_STR
3551 "Establish static routes\n"
3552 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3553 "IPv6 gateway address\n"
3554 "IPv6 gateway interface name\n"
3555 "Emit an ICMP unreachable when matched\n"
3556 "Silently discard pkts when matched\n"
3557 "Set tag for this route\n"
3558 "Tag value\n"
3559 VRF_CMD_HELP_STR)
3560{
3561 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]);
3562}
3563
paul718e3742002-12-13 20:15:29 +00003564DEFUN (ipv6_route_ifname,
3565 ipv6_route_ifname_cmd,
3566 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
3567 IP_STR
3568 "Establish static routes\n"
3569 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3570 "IPv6 gateway address\n"
3571 "IPv6 gateway interface name\n")
3572{
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003573 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL,
Piotr Chytłade24f822007-06-28 00:09:28 +02003574 NULL, NULL);
hasso81dfcaa2003-05-25 19:21:25 +00003575}
3576
Piotr Chytłafb214472015-12-01 13:47:06 -05003577DEFUN (ipv6_route_ifname_tag,
3578 ipv6_route_ifname_tag_cmd,
3579 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>",
3580 IP_STR
3581 "Establish static routes\n"
3582 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3583 "IPv6 gateway address\n"
3584 "IPv6 gateway interface name\n"
3585 "Set tag for this route\n"
3586 "Tag value\n")
3587{
3588 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL);
3589}
3590
3591DEFUN (ipv6_route_ifname_tag_vrf,
3592 ipv6_route_ifname_tag_vrf_cmd,
3593 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>" VRF_CMD_STR,
3594 IP_STR
3595 "Establish static routes\n"
3596 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3597 "IPv6 gateway address\n"
3598 "IPv6 gateway interface name\n"
3599 "Set tag for this route\n"
3600 "Tag value\n"
3601 VRF_CMD_HELP_STR)
3602{
3603 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]);
3604}
3605
hasso81dfcaa2003-05-25 19:21:25 +00003606DEFUN (ipv6_route_ifname_flags,
3607 ipv6_route_ifname_flags_cmd,
3608 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
3609 IP_STR
3610 "Establish static routes\n"
3611 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3612 "IPv6 gateway address\n"
3613 "IPv6 gateway interface name\n"
3614 "Emit an ICMP unreachable when matched\n"
3615 "Silently discard pkts when matched\n")
3616{
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003617 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL,
Piotr Chytłade24f822007-06-28 00:09:28 +02003618 NULL, NULL);
paul718e3742002-12-13 20:15:29 +00003619}
3620
Piotr Chytłafb214472015-12-01 13:47:06 -05003621DEFUN (ipv6_route_ifname_flags_tag,
3622 ipv6_route_ifname_flags_tag_cmd,
3623 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>",
3624 IP_STR
3625 "Establish static routes\n"
3626 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3627 "IPv6 gateway address\n"
3628 "IPv6 gateway interface name\n"
3629 "Emit an ICMP unreachable when matched\n"
3630 "Silently discard pkts when matched\n"
3631 "Set tag for this route\n"
3632 "Tag value\n")
3633{
3634 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL);
3635}
3636
3637DEFUN (ipv6_route_ifname_flags_tag_vrf,
3638 ipv6_route_ifname_flags_tag_vrf_cmd,
3639 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>" VRF_CMD_STR,
3640 IP_STR
3641 "Establish static routes\n"
3642 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3643 "IPv6 gateway address\n"
3644 "IPv6 gateway interface name\n"
3645 "Emit an ICMP unreachable when matched\n"
3646 "Silently discard pkts when matched\n"
3647 "Set tag for this route\n"
3648 "Tag value\n"
3649 VRF_CMD_HELP_STR)
3650{
3651 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]);
3652}
3653
paul718e3742002-12-13 20:15:29 +00003654DEFUN (ipv6_route_pref,
3655 ipv6_route_pref_cmd,
3656 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
3657 IP_STR
3658 "Establish static routes\n"
3659 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3660 "IPv6 gateway address\n"
3661 "IPv6 gateway interface name\n"
3662 "Distance value for this prefix\n")
3663{
Piotr Chytłade24f822007-06-28 00:09:28 +02003664 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003665 NULL);
hasso81dfcaa2003-05-25 19:21:25 +00003666}
3667
Piotr Chytłafb214472015-12-01 13:47:06 -05003668DEFUN (ipv6_route_pref_tag,
3669 ipv6_route_pref_tag_cmd,
3670 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>",
3671 IP_STR
3672 "Establish static routes\n"
3673 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3674 "IPv6 gateway address\n"
3675 "IPv6 gateway interface name\n"
3676 "Set tag for this route\n"
3677 "Tag value\n"
3678 "Distance value for this prefix\n")
3679{
3680 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL);
3681}
3682
3683DEFUN (ipv6_route_pref_tag_vrf,
3684 ipv6_route_pref_tag_vrf_cmd,
3685 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>" VRF_CMD_STR,
3686 IP_STR
3687 "Establish static routes\n"
3688 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3689 "IPv6 gateway address\n"
3690 "IPv6 gateway interface name\n"
3691 "Set tag for this route\n"
3692 "Tag value\n"
3693 "Distance value for this prefix\n"
3694 VRF_CMD_HELP_STR)
3695{
3696 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]);
3697}
3698
hasso81dfcaa2003-05-25 19:21:25 +00003699DEFUN (ipv6_route_flags_pref,
3700 ipv6_route_flags_pref_cmd,
3701 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
3702 IP_STR
3703 "Establish static routes\n"
3704 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3705 "IPv6 gateway address\n"
3706 "IPv6 gateway interface name\n"
3707 "Emit an ICMP unreachable when matched\n"
3708 "Silently discard pkts when matched\n"
3709 "Distance value for this prefix\n")
3710{
Piotr Chytłade24f822007-06-28 00:09:28 +02003711 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003712 NULL);
paul718e3742002-12-13 20:15:29 +00003713}
3714
Piotr Chytłafb214472015-12-01 13:47:06 -05003715DEFUN (ipv6_route_flags_pref_tag,
3716 ipv6_route_flags_pref_tag_cmd,
3717 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
3718 IP_STR
3719 "Establish static routes\n"
3720 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3721 "IPv6 gateway address\n"
3722 "IPv6 gateway interface name\n"
3723 "Emit an ICMP unreachable when matched\n"
3724 "Silently discard pkts when matched\n"
3725 "Set tag for this route\n"
3726 "Tag value\n"
3727 "Distance value for this prefix\n")
3728{
3729 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL);
3730}
3731
3732DEFUN (ipv6_route_flags_pref_tag_vrf,
3733 ipv6_route_flags_pref_tag_vrf_cmd,
3734 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
3735 IP_STR
3736 "Establish static routes\n"
3737 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3738 "IPv6 gateway address\n"
3739 "IPv6 gateway interface name\n"
3740 "Emit an ICMP unreachable when matched\n"
3741 "Silently discard pkts when matched\n"
3742 "Set tag for this route\n"
3743 "Tag value\n"
3744 "Distance value for this prefix\n"
3745 VRF_CMD_HELP_STR)
3746{
3747 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]);
3748}
3749
paul718e3742002-12-13 20:15:29 +00003750DEFUN (ipv6_route_ifname_pref,
3751 ipv6_route_ifname_pref_cmd,
3752 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
3753 IP_STR
3754 "Establish static routes\n"
3755 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3756 "IPv6 gateway address\n"
3757 "IPv6 gateway interface name\n"
3758 "Distance value for this prefix\n")
3759{
Piotr Chytłade24f822007-06-28 00:09:28 +02003760 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003761 NULL);
hasso81dfcaa2003-05-25 19:21:25 +00003762}
3763
Piotr Chytłafb214472015-12-01 13:47:06 -05003764DEFUN (ipv6_route_ifname_pref_tag,
3765 ipv6_route_ifname_pref_tag_cmd,
3766 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>",
3767 IP_STR
3768 "Establish static routes\n"
3769 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3770 "IPv6 gateway address\n"
3771 "IPv6 gateway interface name\n"
3772 "Set tag for this route\n"
3773 "Tag value\n"
3774 "Distance value for this prefix\n")
3775{
3776 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL);
3777}
3778
3779DEFUN (ipv6_route_ifname_pref_tag_vrf,
3780 ipv6_route_ifname_pref_tag_vrf_cmd,
3781 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>" VRF_CMD_STR,
3782 IP_STR
3783 "Establish static routes\n"
3784 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3785 "IPv6 gateway address\n"
3786 "IPv6 gateway interface name\n"
3787 "Set tag for this route\n"
3788 "Tag value\n"
3789 "Distance value for this prefix\n"
3790 VRF_CMD_HELP_STR)
3791{
3792 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]);
3793}
3794
hasso81dfcaa2003-05-25 19:21:25 +00003795DEFUN (ipv6_route_ifname_flags_pref,
3796 ipv6_route_ifname_flags_pref_cmd,
3797 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
3798 IP_STR
3799 "Establish static routes\n"
3800 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3801 "IPv6 gateway address\n"
3802 "IPv6 gateway interface name\n"
3803 "Emit an ICMP unreachable when matched\n"
3804 "Silently discard pkts when matched\n"
3805 "Distance value for this prefix\n")
3806{
Piotr Chytłade24f822007-06-28 00:09:28 +02003807 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003808 NULL);
paul718e3742002-12-13 20:15:29 +00003809}
3810
Piotr Chytłafb214472015-12-01 13:47:06 -05003811DEFUN (ipv6_route_ifname_flags_pref_tag,
3812 ipv6_route_ifname_flags_pref_tag_cmd,
3813 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>",
3814 IP_STR
3815 "Establish static routes\n"
3816 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3817 "IPv6 gateway address\n"
3818 "IPv6 gateway interface name\n"
3819 "Emit an ICMP unreachable when matched\n"
3820 "Silently discard pkts when matched\n"
3821 "Set tag for this route\n"
3822 "Tag value\n"
3823 "Distance value for this prefix\n")
3824{
3825 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL);
3826}
3827
3828DEFUN (ipv6_route_ifname_flags_pref_tag_vrf,
3829 ipv6_route_ifname_flags_pref_tag_vrf_cmd,
3830 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
3831 IP_STR
3832 "Establish static routes\n"
3833 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3834 "IPv6 gateway address\n"
3835 "IPv6 gateway interface name\n"
3836 "Emit an ICMP unreachable when matched\n"
3837 "Silently discard pkts when matched\n"
3838 "Set tag for this route\n"
3839 "Tag value\n"
3840 "Distance value for this prefix\n"
3841 VRF_CMD_HELP_STR)
3842{
3843 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
3844}
3845
paul718e3742002-12-13 20:15:29 +00003846DEFUN (no_ipv6_route,
3847 no_ipv6_route_cmd,
3848 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)",
3849 NO_STR
3850 IP_STR
3851 "Establish static routes\n"
3852 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3853 "IPv6 gateway address\n"
3854 "IPv6 gateway interface name\n")
3855{
Piotr Chytłade24f822007-06-28 00:09:28 +02003856 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003857 NULL);
paul718e3742002-12-13 20:15:29 +00003858}
3859
Piotr Chytłafb214472015-12-01 13:47:06 -05003860DEFUN (no_ipv6_route_tag,
3861 no_ipv6_route_tag_cmd,
3862 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>",
3863 NO_STR
3864 IP_STR
3865 "Establish static routes\n"
3866 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3867 "IPv6 gateway address\n"
3868 "IPv6 gateway interface name\n"
3869 "Set tag for this route\n"
3870 "Tag value\n")
3871{
3872 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL);
3873}
3874
3875DEFUN (no_ipv6_route_tag_vrf,
3876 no_ipv6_route_tag_vrf_cmd,
3877 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>" VRF_CMD_STR,
3878 NO_STR
3879 IP_STR
3880 "Establish static routes\n"
3881 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3882 "IPv6 gateway address\n"
3883 "IPv6 gateway interface name\n"
3884 "Set tag for this route\n"
3885 "Tag value\n"
3886 VRF_CMD_HELP_STR)
3887{
3888 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]);
3889}
3890
hasso81dfcaa2003-05-25 19:21:25 +00003891ALIAS (no_ipv6_route,
3892 no_ipv6_route_flags_cmd,
3893 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
3894 NO_STR
3895 IP_STR
3896 "Establish static routes\n"
3897 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3898 "IPv6 gateway address\n"
3899 "IPv6 gateway interface name\n"
3900 "Emit an ICMP unreachable when matched\n"
3901 "Silently discard pkts when matched\n")
3902
Piotr Chytłafb214472015-12-01 13:47:06 -05003903ALIAS (no_ipv6_route_tag,
3904 no_ipv6_route_flags_tag_cmd,
3905 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>",
3906 NO_STR
3907 IP_STR
3908 "Establish static routes\n"
3909 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3910 "IPv6 gateway address\n"
3911 "IPv6 gateway interface name\n"
3912 "Emit an ICMP unreachable when matched\n"
3913 "Silently discard pkts when matched\n"
3914 "Set tag for this route\n"
3915 "Tag value\n")
3916
paul718e3742002-12-13 20:15:29 +00003917DEFUN (no_ipv6_route_ifname,
3918 no_ipv6_route_ifname_cmd,
3919 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
3920 NO_STR
3921 IP_STR
3922 "Establish static routes\n"
3923 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3924 "IPv6 gateway address\n"
3925 "IPv6 gateway interface name\n")
3926{
Piotr Chytłade24f822007-06-28 00:09:28 +02003927 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02003928 NULL);
paul718e3742002-12-13 20:15:29 +00003929}
3930
Piotr Chytłafb214472015-12-01 13:47:06 -05003931DEFUN (no_ipv6_route_ifname_tag,
3932 no_ipv6_route_ifname_tag_cmd,
3933 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>",
3934 NO_STR
3935 IP_STR
3936 "Establish static routes\n"
3937 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3938 "IPv6 gateway address\n"
3939 "IPv6 gateway interface name\n"
3940 "Set tag for this route\n"
3941 "Tag value\n")
3942{
3943 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL);
3944}
3945
3946DEFUN (no_ipv6_route_ifname_tag_vrf,
3947 no_ipv6_route_ifname_tag_vrf_cmd,
3948 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>" VRF_CMD_STR,
3949 NO_STR
3950 IP_STR
3951 "Establish static routes\n"
3952 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3953 "IPv6 gateway address\n"
3954 "IPv6 gateway interface name\n"
3955 "Set tag for this route\n"
3956 "Tag value\n"
3957 VRF_CMD_HELP_STR)
3958{
3959 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]);
3960}
3961
hasso81dfcaa2003-05-25 19:21:25 +00003962ALIAS (no_ipv6_route_ifname,
3963 no_ipv6_route_ifname_flags_cmd,
3964 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
3965 NO_STR
3966 IP_STR
3967 "Establish static routes\n"
3968 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3969 "IPv6 gateway address\n"
3970 "IPv6 gateway interface name\n"
3971 "Emit an ICMP unreachable when matched\n"
3972 "Silently discard pkts when matched\n")
3973
Piotr Chytłafb214472015-12-01 13:47:06 -05003974ALIAS (no_ipv6_route_ifname_tag,
3975 no_ipv6_route_ifname_flags_tag_cmd,
3976 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>",
3977 NO_STR
3978 IP_STR
3979 "Establish static routes\n"
3980 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3981 "IPv6 gateway address\n"
3982 "IPv6 gateway interface name\n"
3983 "Emit an ICMP unreachable when matched\n"
3984 "Silently discard pkts when matched\n"
3985 "Set tag for this route\n"
3986 "Tag value\n")
3987
paul718e3742002-12-13 20:15:29 +00003988DEFUN (no_ipv6_route_pref,
3989 no_ipv6_route_pref_cmd,
3990 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
3991 NO_STR
3992 IP_STR
3993 "Establish static routes\n"
3994 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
3995 "IPv6 gateway address\n"
3996 "IPv6 gateway interface name\n"
3997 "Distance value for this prefix\n")
3998{
Piotr Chytłade24f822007-06-28 00:09:28 +02003999 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004000 NULL);
hasso81dfcaa2003-05-25 19:21:25 +00004001}
4002
Piotr Chytłafb214472015-12-01 13:47:06 -05004003DEFUN (no_ipv6_route_pref_tag,
4004 no_ipv6_route_pref_tag_cmd,
4005 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>",
4006 NO_STR
4007 IP_STR
4008 "Establish static routes\n"
4009 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4010 "IPv6 gateway address\n"
4011 "IPv6 gateway interface name\n"
4012 "Set tag for this route\n"
4013 "Tag value\n"
4014 "Distance value for this prefix\n")
4015{
4016 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL);
4017}
4018
4019DEFUN (no_ipv6_route_pref_tag_vrf,
4020 no_ipv6_route_pref_tag_vrf_cmd,
4021 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>" VRF_CMD_STR,
4022 NO_STR
4023 IP_STR
4024 "Establish static routes\n"
4025 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4026 "IPv6 gateway address\n"
4027 "IPv6 gateway interface name\n"
4028 "Set tag for this route\n"
4029 "Tag value\n"
4030 "Distance value for this prefix\n"
4031 VRF_CMD_HELP_STR)
4032{
4033 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]);
4034}
4035
hasso81dfcaa2003-05-25 19:21:25 +00004036DEFUN (no_ipv6_route_flags_pref,
4037 no_ipv6_route_flags_pref_cmd,
4038 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
4039 NO_STR
4040 IP_STR
4041 "Establish static routes\n"
4042 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4043 "IPv6 gateway address\n"
4044 "IPv6 gateway interface name\n"
4045 "Emit an ICMP unreachable when matched\n"
4046 "Silently discard pkts when matched\n"
4047 "Distance value for this prefix\n")
4048{
4049 /* We do not care about argv[2] */
Piotr Chytłade24f822007-06-28 00:09:28 +02004050 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004051 NULL);
paul718e3742002-12-13 20:15:29 +00004052}
4053
Piotr Chytłafb214472015-12-01 13:47:06 -05004054DEFUN (no_ipv6_route_flags_pref_tag,
4055 no_ipv6_route_flags_pref_tag_cmd,
4056 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>",
4057 NO_STR
4058 IP_STR
4059 "Establish static routes\n"
4060 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4061 "IPv6 gateway address\n"
4062 "IPv6 gateway interface name\n"
4063 "Emit an ICMP unreachable when matched\n"
4064 "Silently discard pkts when matched\n"
4065 "Set tag for this route\n"
4066 "Tag value\n"
4067 "Distance value for this prefix\n")
4068{
4069 /* We do not care about argv[2] */
4070 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL);
4071}
4072
4073DEFUN (no_ipv6_route_flags_pref_tag_vrf,
4074 no_ipv6_route_flags_pref_tag_vrf_cmd,
4075 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
4076 NO_STR
4077 IP_STR
4078 "Establish static routes\n"
4079 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4080 "IPv6 gateway address\n"
4081 "IPv6 gateway interface name\n"
4082 "Emit an ICMP unreachable when matched\n"
4083 "Silently discard pkts when matched\n"
4084 "Set tag for this route\n"
4085 "Tag value\n"
4086 "Distance value for this prefix\n"
4087 VRF_CMD_HELP_STR)
4088{
4089 /* We do not care about argv[2] */
4090 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]);
4091}
4092
paul718e3742002-12-13 20:15:29 +00004093DEFUN (no_ipv6_route_ifname_pref,
4094 no_ipv6_route_ifname_pref_cmd,
4095 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
4096 NO_STR
4097 IP_STR
4098 "Establish static routes\n"
4099 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4100 "IPv6 gateway address\n"
4101 "IPv6 gateway interface name\n"
4102 "Distance value for this prefix\n")
4103{
Piotr Chytłade24f822007-06-28 00:09:28 +02004104 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004105 NULL);
hasso81dfcaa2003-05-25 19:21:25 +00004106}
4107
Piotr Chytłafb214472015-12-01 13:47:06 -05004108DEFUN (no_ipv6_route_ifname_pref_tag,
4109 no_ipv6_route_ifname_pref_tag_cmd,
4110 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>",
4111 NO_STR
4112 IP_STR
4113 "Establish static routes\n"
4114 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4115 "IPv6 gateway address\n"
4116 "IPv6 gateway interface name\n"
4117 "Set tag for this route\n"
4118 "Tag value\n"
4119 "Distance value for this prefix\n")
4120{
4121 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL);
4122}
4123
4124DEFUN (no_ipv6_route_ifname_pref_tag_vrf,
4125 no_ipv6_route_ifname_pref_tag_vrf_cmd,
4126 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>" VRF_CMD_STR,
4127 NO_STR
4128 IP_STR
4129 "Establish static routes\n"
4130 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4131 "IPv6 gateway address\n"
4132 "IPv6 gateway interface name\n"
4133 "Set tag for this route\n"
4134 "Tag value\n"
4135 "Distance value for this prefix\n"
4136 VRF_CMD_HELP_STR)
4137{
4138 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]);
4139}
4140
hasso81dfcaa2003-05-25 19:21:25 +00004141DEFUN (no_ipv6_route_ifname_flags_pref,
4142 no_ipv6_route_ifname_flags_pref_cmd,
4143 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
4144 NO_STR
4145 IP_STR
4146 "Establish static routes\n"
4147 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4148 "IPv6 gateway address\n"
4149 "IPv6 gateway interface name\n"
4150 "Emit an ICMP unreachable when matched\n"
4151 "Silently discard pkts when matched\n"
4152 "Distance value for this prefix\n")
4153{
Piotr Chytłade24f822007-06-28 00:09:28 +02004154 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004155 NULL);
4156}
4157
Piotr Chytłafb214472015-12-01 13:47:06 -05004158DEFUN (no_ipv6_route_ifname_flags_pref_tag,
4159 no_ipv6_route_ifname_flags_pref_tag_cmd,
4160 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>",
4161 NO_STR
4162 IP_STR
4163 "Establish static routes\n"
4164 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4165 "IPv6 gateway address\n"
4166 "IPv6 gateway interface name\n"
4167 "Emit an ICMP unreachable when matched\n"
4168 "Silently discard pkts when matched\n"
4169 "Set tag for this route\n"
4170 "Tag value\n"
4171 "Distance value for this prefix\n")
4172{
4173 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL);
4174}
4175
4176DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf,
4177 no_ipv6_route_ifname_flags_pref_tag_vrf_cmd,
4178 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>" VRF_CMD_STR,
4179 NO_STR
4180 IP_STR
4181 "Establish static routes\n"
4182 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4183 "IPv6 gateway address\n"
4184 "IPv6 gateway interface name\n"
4185 "Emit an ICMP unreachable when matched\n"
4186 "Silently discard pkts when matched\n"
4187 "Set tag for this route\n"
4188 "Tag value\n"
4189 "Distance value for this prefix\n"
4190 VRF_CMD_HELP_STR)
4191{
4192 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
4193}
4194
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004195DEFUN (ipv6_route_vrf,
4196 ipv6_route_vrf_cmd,
4197 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR,
4198 IP_STR
4199 "Establish static routes\n"
4200 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4201 "IPv6 gateway address\n"
4202 "IPv6 gateway interface name\n"
4203 VRF_CMD_HELP_STR)
4204{
Piotr Chytłade24f822007-06-28 00:09:28 +02004205 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004206 argv[2]);
4207}
4208
4209DEFUN (ipv6_route_flags_vrf,
4210 ipv6_route_flags_vrf_cmd,
4211 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
4212 IP_STR
4213 "Establish static routes\n"
4214 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4215 "IPv6 gateway address\n"
4216 "IPv6 gateway interface name\n"
4217 "Emit an ICMP unreachable when matched\n"
4218 "Silently discard pkts when matched\n"
4219 VRF_CMD_HELP_STR)
4220{
Piotr Chytłade24f822007-06-28 00:09:28 +02004221 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004222 argv[3]);
4223}
4224
4225DEFUN (ipv6_route_ifname_vrf,
4226 ipv6_route_ifname_vrf_cmd,
4227 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR,
4228 IP_STR
4229 "Establish static routes\n"
4230 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4231 "IPv6 gateway address\n"
4232 "IPv6 gateway interface name\n"
4233 VRF_CMD_HELP_STR)
4234{
Piotr Chytłade24f822007-06-28 00:09:28 +02004235 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004236 argv[3]);
4237}
4238
4239DEFUN (ipv6_route_ifname_flags_vrf,
4240 ipv6_route_ifname_flags_vrf_cmd,
4241 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR,
4242 IP_STR
4243 "Establish static routes\n"
4244 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4245 "IPv6 gateway address\n"
4246 "IPv6 gateway interface name\n"
4247 "Emit an ICMP unreachable when matched\n"
4248 "Silently discard pkts when matched\n"
4249 VRF_CMD_HELP_STR)
4250{
Piotr Chytłade24f822007-06-28 00:09:28 +02004251 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004252 argv[4]);
4253}
4254
4255DEFUN (ipv6_route_pref_vrf,
4256 ipv6_route_pref_vrf_cmd,
4257 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR,
4258 IP_STR
4259 "Establish static routes\n"
4260 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4261 "IPv6 gateway address\n"
4262 "IPv6 gateway interface name\n"
4263 "Distance value for this prefix\n"
4264 VRF_CMD_HELP_STR)
4265{
Piotr Chytłade24f822007-06-28 00:09:28 +02004266 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004267 argv[3]);
4268}
4269
4270DEFUN (ipv6_route_flags_pref_vrf,
4271 ipv6_route_flags_pref_vrf_cmd,
4272 "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
4273 IP_STR
4274 "Establish static routes\n"
4275 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4276 "IPv6 gateway address\n"
4277 "IPv6 gateway interface name\n"
4278 "Emit an ICMP unreachable when matched\n"
4279 "Silently discard pkts when matched\n"
4280 "Distance value for this prefix\n"
4281 VRF_CMD_HELP_STR)
4282{
Piotr Chytłade24f822007-06-28 00:09:28 +02004283 return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004284 argv[4]);
4285}
4286
4287DEFUN (ipv6_route_ifname_pref_vrf,
4288 ipv6_route_ifname_pref_vrf_cmd,
4289 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR,
4290 IP_STR
4291 "Establish static routes\n"
4292 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4293 "IPv6 gateway address\n"
4294 "IPv6 gateway interface name\n"
4295 "Distance value for this prefix\n"
4296 VRF_CMD_HELP_STR)
4297{
Piotr Chytłade24f822007-06-28 00:09:28 +02004298 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004299 argv[4]);
4300}
4301
4302DEFUN (ipv6_route_ifname_flags_pref_vrf,
4303 ipv6_route_ifname_flags_pref_vrf_cmd,
4304 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR,
4305 IP_STR
4306 "Establish static routes\n"
4307 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4308 "IPv6 gateway address\n"
4309 "IPv6 gateway interface name\n"
4310 "Emit an ICMP unreachable when matched\n"
4311 "Silently discard pkts when matched\n"
4312 "Distance value for this prefix\n"
4313 VRF_CMD_HELP_STR)
4314{
Piotr Chytłade24f822007-06-28 00:09:28 +02004315 return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004316 argv[5]);
4317}
4318
4319DEFUN (no_ipv6_route_vrf,
4320 no_ipv6_route_vrf_cmd,
4321 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR,
4322 NO_STR
4323 IP_STR
4324 "Establish static routes\n"
4325 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4326 "IPv6 gateway address\n"
4327 "IPv6 gateway interface name\n"
4328 VRF_CMD_HELP_STR)
4329{
Piotr Chytłade24f822007-06-28 00:09:28 +02004330 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004331 (argc > 3) ? argv[3] : argv[2]);
4332}
4333
4334ALIAS (no_ipv6_route_vrf,
4335 no_ipv6_route_flags_vrf_cmd,
4336 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
4337 NO_STR
4338 IP_STR
4339 "Establish static routes\n"
4340 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4341 "IPv6 gateway address\n"
4342 "IPv6 gateway interface name\n"
4343 "Emit an ICMP unreachable when matched\n"
4344 "Silently discard pkts when matched\n"
4345 VRF_CMD_HELP_STR)
4346
4347DEFUN (no_ipv6_route_ifname_vrf,
4348 no_ipv6_route_ifname_vrf_cmd,
4349 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR,
4350 NO_STR
4351 IP_STR
4352 "Establish static routes\n"
4353 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4354 "IPv6 gateway address\n"
4355 "IPv6 gateway interface name\n"
4356 VRF_CMD_HELP_STR)
4357{
Piotr Chytłade24f822007-06-28 00:09:28 +02004358 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL,
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004359 (argc > 4) ? argv[4] : argv[3]);
4360}
4361
4362ALIAS (no_ipv6_route_ifname_vrf,
4363 no_ipv6_route_ifname_flags_vrf_cmd,
4364 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR,
4365 NO_STR
4366 IP_STR
4367 "Establish static routes\n"
4368 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4369 "IPv6 gateway address\n"
4370 "IPv6 gateway interface name\n"
4371 "Emit an ICMP unreachable when matched\n"
4372 "Silently discard pkts when matched\n"
4373 VRF_CMD_HELP_STR)
4374
4375DEFUN (no_ipv6_route_pref_vrf,
4376 no_ipv6_route_pref_vrf_cmd,
4377 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR,
4378 NO_STR
4379 IP_STR
4380 "Establish static routes\n"
4381 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4382 "IPv6 gateway address\n"
4383 "IPv6 gateway interface name\n"
4384 "Distance value for this prefix\n"
4385 VRF_CMD_HELP_STR)
4386{
Piotr Chytłade24f822007-06-28 00:09:28 +02004387 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004388 argv[3]);
4389}
4390
4391DEFUN (no_ipv6_route_flags_pref_vrf,
4392 no_ipv6_route_flags_pref_vrf_cmd,
4393 "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
4394 NO_STR
4395 IP_STR
4396 "Establish static routes\n"
4397 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4398 "IPv6 gateway address\n"
4399 "IPv6 gateway interface name\n"
4400 "Emit an ICMP unreachable when matched\n"
4401 "Silently discard pkts when matched\n"
4402 "Distance value for this prefix\n"
4403 VRF_CMD_HELP_STR)
4404{
4405 /* We do not care about argv[2] */
Piotr Chytłade24f822007-06-28 00:09:28 +02004406 return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004407 argv[4]);
4408}
4409
4410DEFUN (no_ipv6_route_ifname_pref_vrf,
4411 no_ipv6_route_ifname_pref_vrf_cmd,
4412 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR,
4413 NO_STR
4414 IP_STR
4415 "Establish static routes\n"
4416 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4417 "IPv6 gateway address\n"
4418 "IPv6 gateway interface name\n"
4419 "Distance value for this prefix\n"
4420 VRF_CMD_HELP_STR)
4421{
Piotr Chytłade24f822007-06-28 00:09:28 +02004422 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004423 argv[4]);
4424}
4425
4426DEFUN (no_ipv6_route_ifname_flags_pref_vrf,
4427 no_ipv6_route_ifname_flags_pref_vrf_cmd,
4428 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR,
4429 NO_STR
4430 IP_STR
4431 "Establish static routes\n"
4432 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
4433 "IPv6 gateway address\n"
4434 "IPv6 gateway interface name\n"
4435 "Emit an ICMP unreachable when matched\n"
4436 "Silently discard pkts when matched\n"
4437 "Distance value for this prefix\n"
4438 VRF_CMD_HELP_STR)
4439{
Piotr Chytłade24f822007-06-28 00:09:28 +02004440 return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4],
Feng Lu7aaf4ea2015-05-22 11:40:06 +02004441 argv[5]);
paul718e3742002-12-13 20:15:29 +00004442}
4443
paul718e3742002-12-13 20:15:29 +00004444DEFUN (show_ipv6_route,
4445 show_ipv6_route_cmd,
4446 "show ipv6 route",
4447 SHOW_STR
4448 IP_STR
4449 "IPv6 routing table\n")
4450{
4451 struct route_table *table;
4452 struct route_node *rn;
4453 struct rib *rib;
4454 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02004455 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004456
Feng Lu4364ee52015-05-22 11:40:03 +02004457 if (argc > 0)
4458 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
4459
4460 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00004461 if (! table)
4462 return CMD_SUCCESS;
4463
4464 /* Show all IPv6 route. */
4465 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00004466 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00004467 {
4468 if (first)
4469 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02004470 vty_out (vty, SHOW_ROUTE_V6_HEADER);
paul718e3742002-12-13 20:15:29 +00004471 first = 0;
4472 }
Timo Teräs53a5c392015-05-23 11:08:40 +03004473 vty_show_ip_route (vty, rn, rib);
paul718e3742002-12-13 20:15:29 +00004474 }
4475 return CMD_SUCCESS;
4476}
4477
Feng Lu4364ee52015-05-22 11:40:03 +02004478ALIAS (show_ipv6_route,
4479 show_ipv6_route_vrf_cmd,
4480 "show ipv6 route " VRF_CMD_STR,
4481 SHOW_STR
4482 IP_STR
4483 "IPv6 routing table\n"
4484 VRF_CMD_HELP_STR)
4485
Piotr Chytłafb214472015-12-01 13:47:06 -05004486DEFUN (show_ipv6_route_tag,
4487 show_ipv6_route_tag_cmd,
4488 "show ipv6 route tag <1-65535>",
4489 SHOW_STR
4490 IP_STR
4491 "IPv6 routing table\n"
4492 "Show only routes with tag\n"
4493 "Tag value\n")
4494{
4495 struct route_table *table;
4496 struct route_node *rn;
4497 struct rib *rib;
4498 int first = 1;
Paul Jakma96d10602016-07-01 14:23:45 +01004499 route_tag_t tag = 0;
Piotr Chytłafb214472015-12-01 13:47:06 -05004500 vrf_id_t vrf_id = VRF_DEFAULT;
4501
4502 if (argv[0])
4503 tag = atoi(argv[0]);
4504
4505 if (argc == 2)
4506 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
4507
4508 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
4509 if (! table)
4510 return CMD_SUCCESS;
4511
4512 /* Show all IPv6 routes with matching tag value. */
4513 for (rn = route_top (table); rn; rn = route_next (rn))
4514 RNODE_FOREACH_RIB (rn, rib)
4515 {
4516 if (rib->tag != tag)
4517 continue;
4518
4519 if (first)
4520 {
4521 vty_out (vty, SHOW_ROUTE_V6_HEADER);
4522 first = 0;
4523 }
4524 vty_show_ip_route (vty, rn, rib);
4525 }
4526 return CMD_SUCCESS;
4527}
4528
4529ALIAS (show_ipv6_route_tag,
4530 show_ipv6_route_tag_vrf_cmd,
4531 "show ipv6 route tag <1-65535>" VRF_CMD_STR,
4532 SHOW_STR
4533 IP_STR
4534 "IPv6 routing table\n"
4535 "Show only routes with tag\n"
4536 "Tag value\n"
4537 VRF_CMD_HELP_STR)
4538
paul718e3742002-12-13 20:15:29 +00004539DEFUN (show_ipv6_route_prefix_longer,
4540 show_ipv6_route_prefix_longer_cmd,
4541 "show ipv6 route X:X::X:X/M longer-prefixes",
4542 SHOW_STR
4543 IP_STR
4544 "IPv6 routing table\n"
4545 "IPv6 prefix\n"
4546 "Show route matching the specified Network/Mask pair only\n")
4547{
4548 struct route_table *table;
4549 struct route_node *rn;
4550 struct rib *rib;
4551 struct prefix p;
4552 int ret;
4553 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02004554 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004555
4556 ret = str2prefix (argv[0], &p);
4557 if (! ret)
4558 {
4559 vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
4560 return CMD_WARNING;
4561 }
4562
Feng Lu4364ee52015-05-22 11:40:03 +02004563 if (argc > 1)
4564 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
4565
4566 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
4567 if (! table)
4568 return CMD_SUCCESS;
4569
paul718e3742002-12-13 20:15:29 +00004570 /* Show matched type IPv6 routes. */
4571 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00004572 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00004573 if (prefix_match (&p, &rn->p))
4574 {
4575 if (first)
4576 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02004577 vty_out (vty, SHOW_ROUTE_V6_HEADER);
paul718e3742002-12-13 20:15:29 +00004578 first = 0;
4579 }
Timo Teräs53a5c392015-05-23 11:08:40 +03004580 vty_show_ip_route (vty, rn, rib);
paul718e3742002-12-13 20:15:29 +00004581 }
4582 return CMD_SUCCESS;
4583}
4584
Feng Lu4364ee52015-05-22 11:40:03 +02004585ALIAS (show_ipv6_route_prefix_longer,
4586 show_ipv6_route_prefix_longer_vrf_cmd,
4587 "show ipv6 route X:X::X:X/M longer-prefixes " VRF_CMD_STR,
4588 SHOW_STR
4589 IP_STR
4590 "IPv6 routing table\n"
4591 "IPv6 prefix\n"
4592 "Show route matching the specified Network/Mask pair only\n"
4593 VRF_CMD_HELP_STR)
4594
paul718e3742002-12-13 20:15:29 +00004595DEFUN (show_ipv6_route_protocol,
4596 show_ipv6_route_protocol_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02004597 "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA,
paul718e3742002-12-13 20:15:29 +00004598 SHOW_STR
4599 IP_STR
4600 "IP routing table\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02004601 QUAGGA_IP6_REDIST_HELP_STR_ZEBRA)
paul718e3742002-12-13 20:15:29 +00004602{
4603 int type;
4604 struct route_table *table;
4605 struct route_node *rn;
4606 struct rib *rib;
4607 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02004608 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004609
David Lampartere0ca5fd2009-09-16 01:52:42 +02004610 type = proto_redistnum (AFI_IP6, argv[0]);
4611 if (type < 0)
paul718e3742002-12-13 20:15:29 +00004612 {
4613 vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
4614 return CMD_WARNING;
4615 }
Feng Lu4364ee52015-05-22 11:40:03 +02004616
4617 if (argc > 1)
4618 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
4619
4620 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00004621 if (! table)
4622 return CMD_SUCCESS;
4623
4624 /* Show matched type IPv6 routes. */
4625 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00004626 RNODE_FOREACH_RIB (rn, rib)
paul718e3742002-12-13 20:15:29 +00004627 if (rib->type == type)
4628 {
4629 if (first)
4630 {
David Lampartere0ca5fd2009-09-16 01:52:42 +02004631 vty_out (vty, SHOW_ROUTE_V6_HEADER);
paul718e3742002-12-13 20:15:29 +00004632 first = 0;
4633 }
Timo Teräs53a5c392015-05-23 11:08:40 +03004634 vty_show_ip_route (vty, rn, rib);
paul718e3742002-12-13 20:15:29 +00004635 }
4636 return CMD_SUCCESS;
4637}
4638
Feng Lu4364ee52015-05-22 11:40:03 +02004639ALIAS (show_ipv6_route_protocol,
4640 show_ipv6_route_protocol_vrf_cmd,
4641 "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_CMD_STR,
4642 SHOW_STR
4643 IP_STR
4644 "IP routing table\n"
4645 QUAGGA_IP6_REDIST_HELP_STR_ZEBRA
4646 VRF_CMD_HELP_STR)
4647
paul718e3742002-12-13 20:15:29 +00004648DEFUN (show_ipv6_route_addr,
4649 show_ipv6_route_addr_cmd,
4650 "show ipv6 route X:X::X:X",
4651 SHOW_STR
4652 IP_STR
4653 "IPv6 routing table\n"
4654 "IPv6 Address\n")
4655{
4656 int ret;
4657 struct prefix_ipv6 p;
4658 struct route_table *table;
4659 struct route_node *rn;
Feng Lu4364ee52015-05-22 11:40:03 +02004660 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004661
4662 ret = str2prefix_ipv6 (argv[0], &p);
4663 if (ret <= 0)
4664 {
4665 vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
4666 return CMD_WARNING;
4667 }
4668
Feng Lu4364ee52015-05-22 11:40:03 +02004669 if (argc > 1)
4670 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
4671
4672 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00004673 if (! table)
4674 return CMD_SUCCESS;
4675
4676 rn = route_node_match (table, (struct prefix *) &p);
4677 if (! rn)
4678 {
4679 vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
4680 return CMD_WARNING;
4681 }
4682
Timo Teräs53a5c392015-05-23 11:08:40 +03004683 vty_show_ip_route_detail (vty, rn, 0);
paul718e3742002-12-13 20:15:29 +00004684
4685 route_unlock_node (rn);
4686
4687 return CMD_SUCCESS;
4688}
4689
Feng Lu4364ee52015-05-22 11:40:03 +02004690ALIAS (show_ipv6_route_addr,
4691 show_ipv6_route_addr_vrf_cmd,
4692 "show ipv6 route X:X::X:X " VRF_CMD_STR,
4693 SHOW_STR
4694 IP_STR
4695 "IPv6 routing table\n"
4696 "IPv6 Address\n"
4697 VRF_CMD_HELP_STR)
4698
paul718e3742002-12-13 20:15:29 +00004699DEFUN (show_ipv6_route_prefix,
4700 show_ipv6_route_prefix_cmd,
4701 "show ipv6 route X:X::X:X/M",
4702 SHOW_STR
4703 IP_STR
4704 "IPv6 routing table\n"
4705 "IPv6 prefix\n")
4706{
4707 int ret;
4708 struct prefix_ipv6 p;
4709 struct route_table *table;
4710 struct route_node *rn;
Feng Lu4364ee52015-05-22 11:40:03 +02004711 vrf_id_t vrf_id = VRF_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004712
4713 ret = str2prefix_ipv6 (argv[0], &p);
4714 if (ret <= 0)
4715 {
4716 vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
4717 return CMD_WARNING;
4718 }
4719
Feng Lu4364ee52015-05-22 11:40:03 +02004720 if (argc > 1)
4721 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
4722
4723 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
paul718e3742002-12-13 20:15:29 +00004724 if (! table)
4725 return CMD_SUCCESS;
4726
4727 rn = route_node_match (table, (struct prefix *) &p);
4728 if (! rn || rn->p.prefixlen != p.prefixlen)
4729 {
4730 vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
Lu Feng969d3552014-10-21 06:24:07 +00004731 if (rn)
4732 route_unlock_node (rn);
paul718e3742002-12-13 20:15:29 +00004733 return CMD_WARNING;
4734 }
4735
Timo Teräs53a5c392015-05-23 11:08:40 +03004736 vty_show_ip_route_detail (vty, rn, 0);
paul718e3742002-12-13 20:15:29 +00004737
4738 route_unlock_node (rn);
4739
4740 return CMD_SUCCESS;
4741}
4742
Feng Lu4364ee52015-05-22 11:40:03 +02004743ALIAS (show_ipv6_route_prefix,
4744 show_ipv6_route_prefix_vrf_cmd,
4745 "show ipv6 route X:X::X:X/M " VRF_CMD_STR,
4746 SHOW_STR
4747 IP_STR
4748 "IPv6 routing table\n"
4749 "IPv6 prefix\n"
4750 VRF_CMD_HELP_STR)
4751
Stig Thormodsrud61691c92008-11-04 15:45:07 -08004752/* Show route summary. */
4753DEFUN (show_ipv6_route_summary,
4754 show_ipv6_route_summary_cmd,
4755 "show ipv6 route summary",
4756 SHOW_STR
4757 IP_STR
4758 "IPv6 routing table\n"
4759 "Summary of all IPv6 routes\n")
4760{
4761 struct route_table *table;
Feng Lu4364ee52015-05-22 11:40:03 +02004762 vrf_id_t vrf_id = VRF_DEFAULT;
Stig Thormodsrud61691c92008-11-04 15:45:07 -08004763
Feng Lu4364ee52015-05-22 11:40:03 +02004764 if (argc > 0)
4765 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
4766
4767 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
Stig Thormodsrud61691c92008-11-04 15:45:07 -08004768 if (! table)
4769 return CMD_SUCCESS;
4770
4771 vty_show_ip_route_summary (vty, table);
4772
4773 return CMD_SUCCESS;
4774}
4775
Feng Lu4364ee52015-05-22 11:40:03 +02004776ALIAS (show_ipv6_route_summary,
4777 show_ipv6_route_summary_vrf_cmd,
4778 "show ipv6 route summary " VRF_CMD_STR,
4779 SHOW_STR
4780 IP_STR
4781 "IPv6 routing table\n"
4782 "Summary of all IPv6 routes\n"
4783 VRF_CMD_HELP_STR)
4784
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07004785/* Show ipv6 route summary prefix. */
4786DEFUN (show_ipv6_route_summary_prefix,
4787 show_ipv6_route_summary_prefix_cmd,
4788 "show ipv6 route summary prefix",
4789 SHOW_STR
4790 IP_STR
4791 "IPv6 routing table\n"
4792 "Summary of all IPv6 routes\n"
4793 "Prefix routes\n")
4794{
4795 struct route_table *table;
Feng Lu4364ee52015-05-22 11:40:03 +02004796 vrf_id_t vrf_id = VRF_DEFAULT;
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07004797
Feng Lu4364ee52015-05-22 11:40:03 +02004798 if (argc > 0)
4799 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
4800
4801 table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07004802 if (! table)
4803 return CMD_SUCCESS;
4804
4805 vty_show_ip_route_summary_prefix (vty, table);
4806
4807 return CMD_SUCCESS;
4808}
4809
Feng Lu4364ee52015-05-22 11:40:03 +02004810ALIAS (show_ipv6_route_summary_prefix,
4811 show_ipv6_route_summary_prefix_vrf_cmd,
4812 "show ipv6 route summary prefix " VRF_CMD_STR,
4813 SHOW_STR
4814 IP_STR
4815 "IPv6 routing table\n"
4816 "Summary of all IPv6 routes\n"
4817 "Prefix routes\n"
4818 VRF_CMD_HELP_STR)
4819
G.Balajicddf3912011-11-26 21:59:32 +04004820/*
G.Balajicddf3912011-11-26 21:59:32 +04004821 * Show IPv6 mroute command.Used to dump
4822 * the Multicast routing table.
4823 */
4824
4825DEFUN (show_ipv6_mroute,
4826 show_ipv6_mroute_cmd,
4827 "show ipv6 mroute",
4828 SHOW_STR
4829 IP_STR
4830 "IPv6 Multicast routing table\n")
4831{
4832 struct route_table *table;
4833 struct route_node *rn;
4834 struct rib *rib;
4835 int first = 1;
Feng Lu4364ee52015-05-22 11:40:03 +02004836 vrf_id_t vrf_id = VRF_DEFAULT;
G.Balajicddf3912011-11-26 21:59:32 +04004837
Feng Lu4364ee52015-05-22 11:40:03 +02004838 if (argc > 0)
4839 VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
4840
4841 table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id);
G.Balajicddf3912011-11-26 21:59:32 +04004842 if (! table)
4843 return CMD_SUCCESS;
4844
4845 /* Show all IPv6 route. */
4846 for (rn = route_top (table); rn; rn = route_next (rn))
Avneesh Sachdev9fd92e32012-11-13 22:48:53 +00004847 RNODE_FOREACH_RIB (rn, rib)
G.Balajicddf3912011-11-26 21:59:32 +04004848 {
4849 if (first)
4850 {
G.Balajicb32fd62011-11-27 20:09:40 +05304851 vty_out (vty, SHOW_ROUTE_V6_HEADER);
G.Balajicddf3912011-11-26 21:59:32 +04004852 first = 0;
4853 }
Timo Teräs53a5c392015-05-23 11:08:40 +03004854 vty_show_ip_route (vty, rn, rib);
G.Balajicddf3912011-11-26 21:59:32 +04004855 }
4856 return CMD_SUCCESS;
4857}
4858
Feng Lu4364ee52015-05-22 11:40:03 +02004859ALIAS (show_ipv6_mroute,
4860 show_ipv6_mroute_vrf_cmd,
4861 "show ipv6 mroute " VRF_CMD_STR,
4862 SHOW_STR
4863 IP_STR
4864 "IPv6 Multicast routing table\n"
4865 VRF_CMD_HELP_STR)
4866
4867DEFUN (show_ipv6_route_vrf_all,
4868 show_ipv6_route_vrf_all_cmd,
4869 "show ipv6 route " VRF_ALL_CMD_STR,
4870 SHOW_STR
4871 IP_STR
4872 "IPv6 routing table\n"
4873 VRF_ALL_CMD_HELP_STR)
4874{
4875 struct route_table *table;
4876 struct route_node *rn;
4877 struct rib *rib;
4878 struct zebra_vrf *zvrf;
4879 vrf_iter_t iter;
4880 int first = 1;
4881
4882 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
4883 {
4884 if ((zvrf = vrf_iter2info (iter)) == NULL ||
4885 (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
4886 continue;
4887
4888 /* Show all IPv6 route. */
4889 for (rn = route_top (table); rn; rn = route_next (rn))
4890 RNODE_FOREACH_RIB (rn, rib)
4891 {
4892 if (first)
4893 {
4894 vty_out (vty, SHOW_ROUTE_V6_HEADER);
4895 first = 0;
4896 }
4897 vty_show_ip_route (vty, rn, rib);
4898 }
4899 }
4900
4901 return CMD_SUCCESS;
4902}
4903
4904DEFUN (show_ipv6_route_prefix_longer_vrf_all,
4905 show_ipv6_route_prefix_longer_vrf_all_cmd,
4906 "show ipv6 route X:X::X:X/M longer-prefixes " VRF_ALL_CMD_STR,
4907 SHOW_STR
4908 IP_STR
4909 "IPv6 routing table\n"
4910 "IPv6 prefix\n"
4911 "Show route matching the specified Network/Mask pair only\n"
4912 VRF_ALL_CMD_HELP_STR)
4913{
4914 struct route_table *table;
4915 struct route_node *rn;
4916 struct rib *rib;
4917 struct prefix p;
4918 struct zebra_vrf *zvrf;
4919 vrf_iter_t iter;
4920 int ret;
4921 int first = 1;
4922
4923 ret = str2prefix (argv[0], &p);
4924 if (! ret)
4925 {
4926 vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
4927 return CMD_WARNING;
4928 }
4929
4930 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
4931 {
4932 if ((zvrf = vrf_iter2info (iter)) == NULL ||
4933 (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
4934 continue;
4935
4936 /* Show matched type IPv6 routes. */
4937 for (rn = route_top (table); rn; rn = route_next (rn))
4938 RNODE_FOREACH_RIB (rn, rib)
4939 if (prefix_match (&p, &rn->p))
4940 {
4941 if (first)
4942 {
4943 vty_out (vty, SHOW_ROUTE_V6_HEADER);
4944 first = 0;
4945 }
4946 vty_show_ip_route (vty, rn, rib);
4947 }
4948 }
4949
4950 return CMD_SUCCESS;
4951}
4952
4953DEFUN (show_ipv6_route_protocol_vrf_all,
4954 show_ipv6_route_protocol_vrf_all_cmd,
4955 "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR,
4956 SHOW_STR
4957 IP_STR
4958 "IP routing table\n"
4959 QUAGGA_IP6_REDIST_HELP_STR_ZEBRA
4960 VRF_ALL_CMD_HELP_STR)
4961{
4962 int type;
4963 struct route_table *table;
4964 struct route_node *rn;
4965 struct rib *rib;
4966 struct zebra_vrf *zvrf;
4967 vrf_iter_t iter;
4968 int first = 1;
4969
4970 type = proto_redistnum (AFI_IP6, argv[0]);
4971 if (type < 0)
4972 {
4973 vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
4974 return CMD_WARNING;
4975 }
4976
4977 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
4978 {
4979 if ((zvrf = vrf_iter2info (iter)) == NULL ||
4980 (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
4981 continue;
4982
4983 /* Show matched type IPv6 routes. */
4984 for (rn = route_top (table); rn; rn = route_next (rn))
4985 RNODE_FOREACH_RIB (rn, rib)
4986 if (rib->type == type)
4987 {
4988 if (first)
4989 {
4990 vty_out (vty, SHOW_ROUTE_V6_HEADER);
4991 first = 0;
4992 }
4993 vty_show_ip_route (vty, rn, rib);
4994 }
4995 }
4996
4997 return CMD_SUCCESS;
4998}
4999
5000DEFUN (show_ipv6_route_addr_vrf_all,
5001 show_ipv6_route_addr_vrf_all_cmd,
5002 "show ipv6 route X:X::X:X " VRF_ALL_CMD_STR,
5003 SHOW_STR
5004 IP_STR
5005 "IPv6 routing table\n"
5006 "IPv6 Address\n"
5007 VRF_ALL_CMD_HELP_STR)
5008{
5009 int ret;
5010 struct prefix_ipv6 p;
5011 struct route_table *table;
5012 struct route_node *rn;
5013 struct zebra_vrf *zvrf;
5014 vrf_iter_t iter;
5015
5016 ret = str2prefix_ipv6 (argv[0], &p);
5017 if (ret <= 0)
5018 {
5019 vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
5020 return CMD_WARNING;
5021 }
5022
5023 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
5024 {
5025 if ((zvrf = vrf_iter2info (iter)) == NULL ||
5026 (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
5027 continue;
5028
5029 rn = route_node_match (table, (struct prefix *) &p);
5030 if (! rn)
5031 continue;
5032
5033 vty_show_ip_route_detail (vty, rn, 0);
5034
5035 route_unlock_node (rn);
5036 }
5037
5038 return CMD_SUCCESS;
5039}
5040
5041DEFUN (show_ipv6_route_prefix_vrf_all,
5042 show_ipv6_route_prefix_vrf_all_cmd,
5043 "show ipv6 route X:X::X:X/M " VRF_ALL_CMD_STR,
5044 SHOW_STR
5045 IP_STR
5046 "IPv6 routing table\n"
5047 "IPv6 prefix\n"
5048 VRF_ALL_CMD_HELP_STR)
5049{
5050 int ret;
5051 struct prefix_ipv6 p;
5052 struct route_table *table;
5053 struct route_node *rn;
5054 struct zebra_vrf *zvrf;
5055 vrf_iter_t iter;
5056
5057 ret = str2prefix_ipv6 (argv[0], &p);
5058 if (ret <= 0)
5059 {
5060 vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
5061 return CMD_WARNING;
5062 }
5063
5064 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
5065 {
5066 if ((zvrf = vrf_iter2info (iter)) == NULL ||
5067 (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
5068 continue;
5069
5070 rn = route_node_match (table, (struct prefix *) &p);
5071 if (! rn)
5072 continue;
5073 if (rn->p.prefixlen != p.prefixlen)
5074 {
5075 route_unlock_node (rn);
5076 continue;
5077 }
5078
5079 vty_show_ip_route_detail (vty, rn, 0);
5080
5081 route_unlock_node (rn);
5082 }
5083
5084 return CMD_SUCCESS;
5085}
5086
5087/* Show route summary. */
5088DEFUN (show_ipv6_route_summary_vrf_all,
5089 show_ipv6_route_summary_vrf_all_cmd,
5090 "show ipv6 route summary " VRF_ALL_CMD_STR,
5091 SHOW_STR
5092 IP_STR
5093 "IPv6 routing table\n"
5094 "Summary of all IPv6 routes\n"
5095 VRF_ALL_CMD_HELP_STR)
5096{
5097 struct zebra_vrf *zvrf;
5098 vrf_iter_t iter;
5099
5100 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
5101 if ((zvrf = vrf_iter2info (iter)) != NULL)
5102 vty_show_ip_route_summary (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
5103
5104 return CMD_SUCCESS;
5105}
5106
5107DEFUN (show_ipv6_mroute_vrf_all,
5108 show_ipv6_mroute_vrf_all_cmd,
5109 "show ipv6 mroute " VRF_ALL_CMD_STR,
5110 SHOW_STR
5111 IP_STR
5112 "IPv6 Multicast routing table\n"
5113 VRF_ALL_CMD_HELP_STR)
5114{
5115 struct route_table *table;
5116 struct route_node *rn;
5117 struct rib *rib;
5118 struct zebra_vrf *zvrf;
5119 vrf_iter_t iter;
5120 int first = 1;
5121
5122 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
5123 {
5124 if ((zvrf = vrf_iter2info (iter)) == NULL ||
5125 (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
5126 continue;
5127
5128 /* Show all IPv6 route. */
5129 for (rn = route_top (table); rn; rn = route_next (rn))
5130 RNODE_FOREACH_RIB (rn, rib)
5131 {
5132 if (first)
5133 {
5134 vty_out (vty, SHOW_ROUTE_V6_HEADER);
5135 first = 0;
5136 }
5137 vty_show_ip_route (vty, rn, rib);
5138 }
5139 }
5140 return CMD_SUCCESS;
5141}
5142
5143DEFUN (show_ipv6_route_summary_prefix_vrf_all,
5144 show_ipv6_route_summary_prefix_vrf_all_cmd,
5145 "show ipv6 route summary prefix " VRF_ALL_CMD_STR,
5146 SHOW_STR
5147 IP_STR
5148 "IPv6 routing table\n"
5149 "Summary of all IPv6 routes\n"
5150 "Prefix routes\n"
5151 VRF_ALL_CMD_HELP_STR)
5152{
5153 struct zebra_vrf *zvrf;
5154 vrf_iter_t iter;
5155
5156 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
5157 if ((zvrf = vrf_iter2info (iter)) != NULL)
5158 vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
5159
5160 return CMD_SUCCESS;
5161}
5162
paul718e3742002-12-13 20:15:29 +00005163/* Write IPv6 static route configuration. */
paula1ac18c2005-06-28 17:17:12 +00005164static int
paul718e3742002-12-13 20:15:29 +00005165static_config_ipv6 (struct vty *vty)
5166{
5167 struct route_node *rn;
Donald Sharpd4c27d62015-11-04 13:26:35 -05005168 struct static_route *si;
paul718e3742002-12-13 20:15:29 +00005169 int write;
5170 char buf[BUFSIZ];
5171 struct route_table *stable;
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005172 struct zebra_vrf *zvrf;
5173 vrf_iter_t iter;
paul718e3742002-12-13 20:15:29 +00005174
5175 write = 0;
5176
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005177 for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
5178 {
5179 if ((zvrf = vrf_iter2info (iter)) == NULL ||
5180 (stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL)
5181 continue;
paul718e3742002-12-13 20:15:29 +00005182
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005183 for (rn = route_top (stable); rn; rn = route_next (rn))
5184 for (si = rn->info; si; si = si->next)
5185 {
5186 vty_out (vty, "ipv6 route %s", prefix2str (&rn->p, buf, sizeof buf));
paul718e3742002-12-13 20:15:29 +00005187
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005188 switch (si->type)
5189 {
5190 case STATIC_IPV6_GATEWAY:
5191 vty_out (vty, " %s",
Donald Sharpd4c27d62015-11-04 13:26:35 -05005192 inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005193 break;
5194 case STATIC_IPV6_IFNAME:
5195 vty_out (vty, " %s", si->ifname);
5196 break;
5197 case STATIC_IPV6_GATEWAY_IFNAME:
5198 vty_out (vty, " %s %s",
Donald Sharpd4c27d62015-11-04 13:26:35 -05005199 inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005200 si->ifname);
5201 break;
5202 }
paul718e3742002-12-13 20:15:29 +00005203
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005204 if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
5205 vty_out (vty, " %s", "reject");
hasso81dfcaa2003-05-25 19:21:25 +00005206
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005207 if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
5208 vty_out (vty, " %s", "blackhole");
hasso81dfcaa2003-05-25 19:21:25 +00005209
Piotr Chytłade24f822007-06-28 00:09:28 +02005210 if (si->tag)
5211 vty_out (vty, " tag %d", si->tag);
5212
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005213 if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
5214 vty_out (vty, " %d", si->distance);
paul718e3742002-12-13 20:15:29 +00005215
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005216 if (si->vrf_id != VRF_DEFAULT)
5217 vty_out (vty, " vrf %u", si->vrf_id);
5218
5219 vty_out (vty, "%s", VTY_NEWLINE);
5220
5221 write = 1;
5222 }
5223 }
paul718e3742002-12-13 20:15:29 +00005224 return write;
5225}
paul718e3742002-12-13 20:15:29 +00005226
5227/* Static ip route configuration write function. */
paula1ac18c2005-06-28 17:17:12 +00005228static int
paul718e3742002-12-13 20:15:29 +00005229zebra_ip_config (struct vty *vty)
5230{
5231 int write = 0;
5232
Everton Marques33d86db2014-07-14 11:19:00 -03005233 write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route");
5234 write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute");
paul718e3742002-12-13 20:15:29 +00005235#ifdef HAVE_IPV6
5236 write += static_config_ipv6 (vty);
5237#endif /* HAVE_IPV6 */
5238
5239 return write;
5240}
5241
David Lamparterbd078122015-01-06 19:53:24 +01005242static int config_write_vty(struct vty *vty)
5243{
Paul Jakma7514fb72007-05-02 16:05:35 +00005244 int i;
David Lamparterbd078122015-01-06 19:53:24 +01005245 enum multicast_mode ipv4_multicast_mode = multicast_mode_ipv4_get ();
5246
5247 if (ipv4_multicast_mode != MCAST_NO_CONFIG)
5248 vty_out (vty, "ip multicast rpf-lookup-mode %s%s",
5249 ipv4_multicast_mode == MCAST_URIB_ONLY ? "urib-only" :
5250 ipv4_multicast_mode == MCAST_MRIB_ONLY ? "mrib-only" :
5251 ipv4_multicast_mode == MCAST_MIX_MRIB_FIRST ? "mrib-then-urib" :
5252 ipv4_multicast_mode == MCAST_MIX_DISTANCE ? "lower-distance" :
5253 "longer-prefix",
5254 VTY_NEWLINE);
Paul Jakma7514fb72007-05-02 16:05:35 +00005255
5256 for (i=0;i<ZEBRA_ROUTE_MAX;i++)
5257 {
5258 if (proto_rm[AFI_IP][i])
5259 vty_out (vty, "ip protocol %s route-map %s%s", zebra_route_string(i),
5260 proto_rm[AFI_IP][i], VTY_NEWLINE);
5261 }
5262 if (proto_rm[AFI_IP][ZEBRA_ROUTE_MAX])
5263 vty_out (vty, "ip protocol %s route-map %s%s", "any",
5264 proto_rm[AFI_IP][ZEBRA_ROUTE_MAX], VTY_NEWLINE);
5265
5266 return 1;
5267}
5268
5269/* table node for protocol filtering */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08005270static struct cmd_node protocol_node = { PROTOCOL_NODE, "", 1 };
Paul Jakma7514fb72007-05-02 16:05:35 +00005271
paul718e3742002-12-13 20:15:29 +00005272/* IP node for static routes. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08005273static struct cmd_node ip_node = { IP_NODE, "", 1 };
paul718e3742002-12-13 20:15:29 +00005274
5275/* Route VTY. */
5276void
paula1ac18c2005-06-28 17:17:12 +00005277zebra_vty_init (void)
paul718e3742002-12-13 20:15:29 +00005278{
5279 install_node (&ip_node, zebra_ip_config);
David Lamparterbd078122015-01-06 19:53:24 +01005280 install_node (&protocol_node, config_write_vty);
paul718e3742002-12-13 20:15:29 +00005281
Everton Marques33d86db2014-07-14 11:19:00 -03005282 install_element (CONFIG_NODE, &ip_mroute_cmd);
David Lampartera76681b2015-01-22 19:03:53 +01005283 install_element (CONFIG_NODE, &ip_mroute_dist_cmd);
Everton Marques33d86db2014-07-14 11:19:00 -03005284 install_element (CONFIG_NODE, &no_ip_mroute_cmd);
David Lampartera76681b2015-01-22 19:03:53 +01005285 install_element (CONFIG_NODE, &no_ip_mroute_dist_cmd);
David Lamparterbd078122015-01-06 19:53:24 +01005286 install_element (CONFIG_NODE, &ip_multicast_mode_cmd);
5287 install_element (CONFIG_NODE, &no_ip_multicast_mode_cmd);
5288 install_element (CONFIG_NODE, &no_ip_multicast_mode_noarg_cmd);
Paul Jakma7514fb72007-05-02 16:05:35 +00005289 install_element (CONFIG_NODE, &ip_protocol_cmd);
5290 install_element (CONFIG_NODE, &no_ip_protocol_cmd);
5291 install_element (VIEW_NODE, &show_ip_protocol_cmd);
paul718e3742002-12-13 20:15:29 +00005292 install_element (CONFIG_NODE, &ip_route_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005293 install_element (CONFIG_NODE, &ip_route_tag_cmd);
5294 install_element (CONFIG_NODE, &ip_route_tag_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005295 install_element (CONFIG_NODE, &ip_route_flags_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005296 install_element (CONFIG_NODE, &ip_route_flags_tag_cmd);
5297 install_element (CONFIG_NODE, &ip_route_flags_tag_vrf_cmd);
hasso457ef552003-05-28 12:02:15 +00005298 install_element (CONFIG_NODE, &ip_route_flags2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005299 install_element (CONFIG_NODE, &ip_route_flags2_tag_cmd);
5300 install_element (CONFIG_NODE, &ip_route_flags2_tag_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005301 install_element (CONFIG_NODE, &ip_route_mask_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005302 install_element (CONFIG_NODE, &ip_route_mask_tag_cmd);
5303 install_element (CONFIG_NODE, &ip_route_mask_tag_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005304 install_element (CONFIG_NODE, &ip_route_mask_flags_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005305 install_element (CONFIG_NODE, &ip_route_mask_flags_tag_cmd);
5306 install_element (CONFIG_NODE, &ip_route_mask_flags_tag_vrf_cmd);
hasso457ef552003-05-28 12:02:15 +00005307 install_element (CONFIG_NODE, &ip_route_mask_flags2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005308 install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_cmd);
5309 install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005310 install_element (CONFIG_NODE, &no_ip_route_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005311 install_element (CONFIG_NODE, &no_ip_route_tag_cmd);
5312 install_element (CONFIG_NODE, &no_ip_route_tag_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005313 install_element (CONFIG_NODE, &no_ip_route_flags_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005314 install_element (CONFIG_NODE, &no_ip_route_flags_tag_cmd);
hasso457ef552003-05-28 12:02:15 +00005315 install_element (CONFIG_NODE, &no_ip_route_flags2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005316 install_element (CONFIG_NODE, &no_ip_route_flags2_tag_cmd);
5317 install_element (CONFIG_NODE, &no_ip_route_flags2_tag_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005318 install_element (CONFIG_NODE, &no_ip_route_mask_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005319 install_element (CONFIG_NODE, &no_ip_route_mask_tag_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005320 install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005321 install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_cmd);
hasso457ef552003-05-28 12:02:15 +00005322 install_element (CONFIG_NODE, &no_ip_route_mask_flags2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005323 install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_cmd);
5324 install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005325 install_element (CONFIG_NODE, &ip_route_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005326 install_element (CONFIG_NODE, &ip_route_tag_distance_cmd);
5327 install_element (CONFIG_NODE, &ip_route_tag_distance_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005328 install_element (CONFIG_NODE, &ip_route_flags_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005329 install_element (CONFIG_NODE, &ip_route_flags_tag_distance_cmd);
5330 install_element (CONFIG_NODE, &ip_route_flags_tag_distance_vrf_cmd);
hasso457ef552003-05-28 12:02:15 +00005331 install_element (CONFIG_NODE, &ip_route_flags_distance2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005332 install_element (CONFIG_NODE, &ip_route_flags_tag_distance2_cmd);
5333 install_element (CONFIG_NODE, &ip_route_flags_tag_distance2_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005334 install_element (CONFIG_NODE, &ip_route_mask_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005335 install_element (CONFIG_NODE, &ip_route_mask_tag_distance_cmd);
5336 install_element (CONFIG_NODE, &ip_route_mask_tag_distance_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005337 install_element (CONFIG_NODE, &ip_route_mask_flags_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005338 install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance_cmd);
5339 install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance_vrf_cmd);
hasso457ef552003-05-28 12:02:15 +00005340 install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005341 install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance2_cmd);
5342 install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance2_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005343 install_element (CONFIG_NODE, &no_ip_route_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005344 install_element (CONFIG_NODE, &no_ip_route_tag_distance_cmd);
5345 install_element (CONFIG_NODE, &no_ip_route_tag_distance_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005346 install_element (CONFIG_NODE, &no_ip_route_flags_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005347 install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_cmd);
5348 install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_vrf_cmd);
hasso457ef552003-05-28 12:02:15 +00005349 install_element (CONFIG_NODE, &no_ip_route_flags_distance2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005350 install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_cmd);
5351 install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_vrf_cmd);
Igor Ryzhov5f678882016-04-22 17:38:24 +03005352 install_element (CONFIG_NODE, &no_ip_route_mask_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005353 install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_cmd);
5354 install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_vrf_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005355 install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005356 install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_cmd);
5357 install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_vrf_cmd);
hasso457ef552003-05-28 12:02:15 +00005358 install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005359 install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_cmd);
5360 install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005361
5362 install_element (VIEW_NODE, &show_ip_route_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005363 install_element (VIEW_NODE, &show_ip_route_tag_cmd);
5364 install_element (VIEW_NODE, &show_ip_route_tag_vrf_cmd);
Pradosh Mohapatra60cc9592015-11-09 20:21:41 -05005365 install_element (VIEW_NODE, &show_ip_nht_cmd);
5366 install_element (VIEW_NODE, &show_ipv6_nht_cmd);
paul718e3742002-12-13 20:15:29 +00005367 install_element (VIEW_NODE, &show_ip_route_addr_cmd);
5368 install_element (VIEW_NODE, &show_ip_route_prefix_cmd);
5369 install_element (VIEW_NODE, &show_ip_route_prefix_longer_cmd);
5370 install_element (VIEW_NODE, &show_ip_route_protocol_cmd);
5371 install_element (VIEW_NODE, &show_ip_route_supernets_cmd);
Stig Thormodsrud61691c92008-11-04 15:45:07 -08005372 install_element (VIEW_NODE, &show_ip_route_summary_cmd);
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07005373 install_element (VIEW_NODE, &show_ip_route_summary_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00005374
Everton Marques33d86db2014-07-14 11:19:00 -03005375 install_element (VIEW_NODE, &show_ip_rpf_cmd);
David Lamparter3b02fe82015-01-22 19:12:35 +01005376 install_element (VIEW_NODE, &show_ip_rpf_addr_cmd);
G.Balajicddf3912011-11-26 21:59:32 +04005377
Feng Lu4364ee52015-05-22 11:40:03 +02005378 /* Commands for VRF */
5379
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005380 install_element (CONFIG_NODE, &ip_mroute_vrf_cmd);
5381 install_element (CONFIG_NODE, &ip_mroute_dist_vrf_cmd);
5382 install_element (CONFIG_NODE, &no_ip_mroute_vrf_cmd);
5383 install_element (CONFIG_NODE, &no_ip_mroute_dist_vrf_cmd);
5384
5385 install_element (CONFIG_NODE, &ip_route_vrf_cmd);
5386 install_element (CONFIG_NODE, &ip_route_flags_vrf_cmd);
5387 install_element (CONFIG_NODE, &ip_route_flags2_vrf_cmd);
5388 install_element (CONFIG_NODE, &ip_route_mask_vrf_cmd);
5389 install_element (CONFIG_NODE, &ip_route_mask_flags_vrf_cmd);
5390 install_element (CONFIG_NODE, &ip_route_mask_flags2_vrf_cmd);
5391 install_element (CONFIG_NODE, &no_ip_route_vrf_cmd);
5392 install_element (CONFIG_NODE, &no_ip_route_flags_vrf_cmd);
5393 install_element (CONFIG_NODE, &no_ip_route_flags2_vrf_cmd);
5394 install_element (CONFIG_NODE, &no_ip_route_mask_vrf_cmd);
5395 install_element (CONFIG_NODE, &no_ip_route_mask_flags_vrf_cmd);
5396 install_element (CONFIG_NODE, &no_ip_route_mask_flags2_vrf_cmd);
5397 install_element (CONFIG_NODE, &ip_route_distance_vrf_cmd);
5398 install_element (CONFIG_NODE, &ip_route_flags_distance_vrf_cmd);
5399 install_element (CONFIG_NODE, &ip_route_flags_distance2_vrf_cmd);
5400 install_element (CONFIG_NODE, &ip_route_mask_distance_vrf_cmd);
5401 install_element (CONFIG_NODE, &ip_route_mask_flags_distance_vrf_cmd);
5402 install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_vrf_cmd);
5403 install_element (CONFIG_NODE, &no_ip_route_distance_vrf_cmd);
5404 install_element (CONFIG_NODE, &no_ip_route_flags_distance_vrf_cmd);
5405 install_element (CONFIG_NODE, &no_ip_route_flags_distance2_vrf_cmd);
Igor Ryzhov5f678882016-04-22 17:38:24 +03005406 install_element (CONFIG_NODE, &no_ip_route_mask_distance_vrf_cmd);
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005407 install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_vrf_cmd);
5408 install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_vrf_cmd);
5409
Feng Lu4364ee52015-05-22 11:40:03 +02005410 install_element (VIEW_NODE, &show_ip_route_vrf_cmd);
5411 install_element (VIEW_NODE, &show_ip_route_addr_vrf_cmd);
5412 install_element (VIEW_NODE, &show_ip_route_prefix_vrf_cmd);
5413 install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_cmd);
5414 install_element (VIEW_NODE, &show_ip_route_protocol_vrf_cmd);
5415 install_element (VIEW_NODE, &show_ip_route_supernets_vrf_cmd);
5416 install_element (VIEW_NODE, &show_ip_route_summary_vrf_cmd);
5417 install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005418
5419 install_element (VIEW_NODE, &show_ip_route_vrf_all_cmd);
5420 install_element (VIEW_NODE, &show_ip_route_addr_vrf_all_cmd);
5421 install_element (VIEW_NODE, &show_ip_route_prefix_vrf_all_cmd);
5422 install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_all_cmd);
5423 install_element (VIEW_NODE, &show_ip_route_protocol_vrf_all_cmd);
5424 install_element (VIEW_NODE, &show_ip_route_supernets_vrf_all_cmd);
5425 install_element (VIEW_NODE, &show_ip_route_summary_vrf_all_cmd);
5426 install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_all_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005427
Feng Lu4364ee52015-05-22 11:40:03 +02005428 install_element (VIEW_NODE, &show_ip_rpf_vrf_cmd);
5429 install_element (VIEW_NODE, &show_ip_rpf_vrf_all_cmd);
5430 install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_cmd);
5431 install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_all_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005432
paul718e3742002-12-13 20:15:29 +00005433 install_element (CONFIG_NODE, &ipv6_route_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005434 install_element (CONFIG_NODE, &ipv6_route_flags_cmd);
paul718e3742002-12-13 20:15:29 +00005435 install_element (CONFIG_NODE, &ipv6_route_ifname_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005436 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_cmd);
paul718e3742002-12-13 20:15:29 +00005437 install_element (CONFIG_NODE, &no_ipv6_route_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005438 install_element (CONFIG_NODE, &no_ipv6_route_flags_cmd);
paul718e3742002-12-13 20:15:29 +00005439 install_element (CONFIG_NODE, &no_ipv6_route_ifname_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005440 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_cmd);
paul718e3742002-12-13 20:15:29 +00005441 install_element (CONFIG_NODE, &ipv6_route_pref_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005442 install_element (CONFIG_NODE, &ipv6_route_flags_pref_cmd);
paul718e3742002-12-13 20:15:29 +00005443 install_element (CONFIG_NODE, &ipv6_route_ifname_pref_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005444 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_cmd);
paul718e3742002-12-13 20:15:29 +00005445 install_element (CONFIG_NODE, &no_ipv6_route_pref_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005446 install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_cmd);
paul718e3742002-12-13 20:15:29 +00005447 install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_cmd);
hasso81dfcaa2003-05-25 19:21:25 +00005448 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005449 install_element (CONFIG_NODE, &ipv6_route_tag_cmd);
5450 install_element (CONFIG_NODE, &ipv6_route_tag_vrf_cmd);
5451 install_element (CONFIG_NODE, &ipv6_route_flags_tag_cmd);
5452 install_element (CONFIG_NODE, &ipv6_route_flags_tag_vrf_cmd);
5453 install_element (CONFIG_NODE, &ipv6_route_ifname_tag_cmd);
5454 install_element (CONFIG_NODE, &ipv6_route_ifname_tag_vrf_cmd);
5455 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_tag_cmd);
5456 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_tag_vrf_cmd);
5457 install_element (CONFIG_NODE, &ipv6_route_pref_tag_cmd);
5458 install_element (CONFIG_NODE, &ipv6_route_pref_tag_vrf_cmd);
5459 install_element (CONFIG_NODE, &ipv6_route_flags_pref_tag_cmd);
5460 install_element (CONFIG_NODE, &ipv6_route_flags_pref_tag_vrf_cmd);
5461 install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_cmd);
5462 install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_vrf_cmd);
5463 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_tag_cmd);
5464 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_tag_vrf_cmd);
5465 install_element (CONFIG_NODE, &no_ipv6_route_tag_cmd);
5466 install_element (CONFIG_NODE, &no_ipv6_route_tag_vrf_cmd);
5467 install_element (CONFIG_NODE, &no_ipv6_route_flags_tag_cmd);
5468 install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_cmd);
5469 install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_vrf_cmd);
5470 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_tag_cmd);
5471 install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_cmd);
5472 install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_vrf_cmd);
5473 install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_tag_cmd);
5474 install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_tag_vrf_cmd);
5475 install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_cmd);
5476 install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_vrf_cmd);
5477 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_cmd);
5478 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_vrf_cmd);
paul718e3742002-12-13 20:15:29 +00005479 install_element (VIEW_NODE, &show_ipv6_route_cmd);
Piotr Chytłafb214472015-12-01 13:47:06 -05005480 install_element (VIEW_NODE, &show_ipv6_route_tag_cmd);
5481 install_element (VIEW_NODE, &show_ipv6_route_tag_vrf_cmd);
Stig Thormodsrud61691c92008-11-04 15:45:07 -08005482 install_element (VIEW_NODE, &show_ipv6_route_summary_cmd);
Dinesh G Dutt56a5f772014-09-30 12:58:04 -07005483 install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00005484 install_element (VIEW_NODE, &show_ipv6_route_protocol_cmd);
5485 install_element (VIEW_NODE, &show_ipv6_route_addr_cmd);
5486 install_element (VIEW_NODE, &show_ipv6_route_prefix_cmd);
5487 install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_cmd);
G.Balajicddf3912011-11-26 21:59:32 +04005488
5489 install_element (VIEW_NODE, &show_ipv6_mroute_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005490
5491 /* Commands for VRF */
5492
Feng Lu7aaf4ea2015-05-22 11:40:06 +02005493 install_element (CONFIG_NODE, &ipv6_route_vrf_cmd);
5494 install_element (CONFIG_NODE, &ipv6_route_flags_vrf_cmd);
5495 install_element (CONFIG_NODE, &ipv6_route_ifname_vrf_cmd);
5496 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_vrf_cmd);
5497 install_element (CONFIG_NODE, &no_ipv6_route_vrf_cmd);
5498 install_element (CONFIG_NODE, &no_ipv6_route_flags_vrf_cmd);
5499 install_element (CONFIG_NODE, &no_ipv6_route_ifname_vrf_cmd);
5500 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_vrf_cmd);
5501 install_element (CONFIG_NODE, &ipv6_route_pref_vrf_cmd);
5502 install_element (CONFIG_NODE, &ipv6_route_flags_pref_vrf_cmd);
5503 install_element (CONFIG_NODE, &ipv6_route_ifname_pref_vrf_cmd);
5504 install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_vrf_cmd);
5505 install_element (CONFIG_NODE, &no_ipv6_route_pref_vrf_cmd);
5506 install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_vrf_cmd);
5507 install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_vrf_cmd);
5508 install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_vrf_cmd);
5509
Feng Lu4364ee52015-05-22 11:40:03 +02005510 install_element (VIEW_NODE, &show_ipv6_route_vrf_cmd);
5511 install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_cmd);
5512 install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_cmd);
5513 install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_cmd);
5514 install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_cmd);
5515 install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_cmd);
5516 install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005517
5518 install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd);
5519 install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_all_cmd);
5520 install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_all_cmd);
5521 install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_all_cmd);
5522 install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_all_cmd);
5523 install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_all_cmd);
5524 install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_all_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005525
5526 install_element (VIEW_NODE, &show_ipv6_mroute_vrf_cmd);
Feng Lu4364ee52015-05-22 11:40:03 +02005527
5528 install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd);
Piotr Chytłade24f822007-06-28 00:09:28 +02005529 install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_all_cmd);
paul718e3742002-12-13 20:15:29 +00005530}