]> git.proxmox.com Git - mirror_frr.git/blob - eigrpd/eigrp_vty.c
Merge pull request #476 from qlyoung/abort-select-fd
[mirror_frr.git] / eigrpd / eigrp_vty.c
1 /*
2 * EIGRP VTY Interface.
3 * Copyright (C) 2013-2016
4 * Authors:
5 * Donnie Savage
6 * Jan Janovic
7 * Matej Perina
8 * Peter Orsag
9 * Peter Paluch
10 * Frantisek Gazo
11 * Tomas Hvorkovy
12 * Martin Kontsek
13 * Lukas Koribsky
14 *
15 * This file is part of GNU Zebra.
16 *
17 * GNU Zebra is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the
19 * Free Software Foundation; either version 2, or (at your option) any
20 * later version.
21 *
22 * GNU Zebra is distributed in the hope that it will be useful, but
23 * WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with GNU Zebra; see the file COPYING. If not, write to the Free
29 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
30 * 02111-1307, USA.
31 */
32
33 #include <zebra.h>
34
35 #include "memory.h"
36 #include "thread.h"
37 #include "prefix.h"
38 #include "table.h"
39 #include "vty.h"
40 #include "command.h"
41 #include "plist.h"
42 #include "log.h"
43 #include "zclient.h"
44 #include "keychain.h"
45 #include "linklist.h"
46 #include "distribute.h"
47
48 #include "eigrpd/eigrp_structs.h"
49 #include "eigrpd/eigrpd.h"
50 #include "eigrpd/eigrp_interface.h"
51 #include "eigrpd/eigrp_neighbor.h"
52 #include "eigrpd/eigrp_packet.h"
53 #include "eigrpd/eigrp_zebra.h"
54 #include "eigrpd/eigrp_vty.h"
55 #include "eigrpd/eigrp_network.h"
56 #include "eigrpd/eigrp_dump.h"
57 #include "eigrpd/eigrp_const.h"
58
59 static int
60 config_write_network (struct vty *vty, struct eigrp *eigrp)
61 {
62 struct route_node *rn;
63
64 /* `network area' print. */
65 for (rn = route_top (eigrp->networks); rn; rn = route_next (rn))
66 if (rn->info)
67 {
68 /* Network print. */
69 vty_out (vty, " network %s/%d %s",
70 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, VTY_NEWLINE);
71 }
72
73 if (eigrp->max_paths != EIGRP_MAX_PATHS_DEFAULT)
74 vty_out (vty, " maximum-paths %d%s", eigrp->max_paths, VTY_NEWLINE);
75
76 if (eigrp->variance != EIGRP_VARIANCE_DEFAULT)
77 vty_out (vty, " variance %d%s", eigrp->variance, VTY_NEWLINE);
78
79 /*Separate EIGRP configuration from the rest of the config*/
80 vty_out (vty, "!%s", VTY_NEWLINE);
81
82 return 0;
83 }
84
85 static int
86 config_write_interfaces (struct vty *vty, struct eigrp *eigrp)
87 {
88 struct eigrp_interface *ei;
89 struct listnode *node;
90
91 for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
92 {
93 vty_out (vty, "interface %s%s", ei->ifp->name, VTY_NEWLINE);
94
95 if ((IF_DEF_PARAMS (ei->ifp)->auth_type) == EIGRP_AUTH_TYPE_MD5)
96 {
97 vty_out (vty, " ip authentication mode eigrp %d md5%s", eigrp->AS, VTY_NEWLINE);
98 }
99
100 if ((IF_DEF_PARAMS (ei->ifp)->auth_type) == EIGRP_AUTH_TYPE_SHA256)
101 {
102 vty_out (vty, " ip authentication mode eigrp %d hmac-sha-256%s", eigrp->AS, VTY_NEWLINE);
103 }
104
105 if(IF_DEF_PARAMS (ei->ifp)->auth_keychain)
106 {
107 vty_out (vty, " ip authentication key-chain eigrp %d %s%s",eigrp->AS,IF_DEF_PARAMS (ei->ifp)->auth_keychain, VTY_NEWLINE);
108 }
109
110 if ((IF_DEF_PARAMS (ei->ifp)->v_hello) != EIGRP_HELLO_INTERVAL_DEFAULT)
111 {
112 vty_out (vty, " ip hello-interval eigrp %d%s", IF_DEF_PARAMS (ei->ifp)->v_hello, VTY_NEWLINE);
113 }
114
115 if ((IF_DEF_PARAMS (ei->ifp)->v_wait) != EIGRP_HOLD_INTERVAL_DEFAULT)
116 {
117 vty_out (vty, " ip hold-time eigrp %d%s", IF_DEF_PARAMS (ei->ifp)->v_wait, VTY_NEWLINE);
118 }
119
120 /*Separate this EIGRP interface configuration from the others*/
121 vty_out (vty, "!%s", VTY_NEWLINE);
122 }
123
124 return 0;
125 }
126
127 static int
128 eigrp_write_interface (struct vty *vty)
129 {
130 int write=0;
131
132 return write;
133 }
134
135 /**
136 * Writes distribute lists to config
137 */
138 static int
139 config_write_eigrp_distribute (struct vty *vty, struct eigrp *eigrp)
140 {
141 int write=0;
142
143 /* Distribute configuration. */
144 write += config_write_distribute (vty);
145
146 return write;
147 }
148
149 /**
150 * Writes 'router eigrp' section to config
151 */
152 static int
153 config_write_eigrp_router (struct vty *vty, struct eigrp *eigrp)
154 {
155 int write=0;
156
157 /* `router eigrp' print. */
158 vty_out (vty, "router eigrp %d%s", eigrp->AS, VTY_NEWLINE);
159
160 write++;
161
162 if (!eigrp->networks)
163 return write;
164
165 /* Router ID print. */
166 if (eigrp->router_id_static != 0)
167 {
168 struct in_addr router_id_static;
169 router_id_static.s_addr = htonl(eigrp->router_id_static);
170 vty_out (vty, " eigrp router-id %s%s",
171 inet_ntoa (router_id_static), VTY_NEWLINE);
172 }
173
174 /* Network area print. */
175 config_write_network (vty, eigrp);
176
177 /* Distribute-list and default-information print. */
178 config_write_eigrp_distribute (vty, eigrp);
179
180 /*Separate EIGRP configuration from the rest of the config*/
181 vty_out (vty, "!%s", VTY_NEWLINE);
182
183 return write;
184 }
185
186 DEFUN_NOSH (router_eigrp,
187 router_eigrp_cmd,
188 "router eigrp (1-65535)",
189 "Enable a routing process\n"
190 "Start EIGRP configuration\n"
191 "AS Number to use\n")
192 {
193 struct eigrp *eigrp = eigrp_get (argv[2]->arg);
194 VTY_PUSH_CONTEXT(EIGRP_NODE, eigrp);
195
196 return CMD_SUCCESS;
197 }
198
199 DEFUN (no_router_eigrp,
200 no_router_eigrp_cmd,
201 "no router eigrp (1-65535)",
202 NO_STR
203 "Routing process\n"
204 "EIGRP configuration\n"
205 "AS number to use\n")
206 {
207 vty->node = CONFIG_NODE;
208
209 /*TODO: */
210
211 return CMD_SUCCESS;
212 }
213
214 DEFUN (eigrp_router_id,
215 eigrp_router_id_cmd,
216 "eigrp router-id A.B.C.D",
217 "EIGRP specific commands\n"
218 "Router ID for this EIGRP process\n"
219 "EIGRP Router-ID in IP address format\n")
220 {
221 //struct eigrp *eigrp = vty->index;
222 /*TODO: */
223
224 return CMD_SUCCESS;
225 }
226
227 DEFUN (no_eigrp_router_id,
228 no_eigrp_router_id_cmd,
229 "no eigrp router-id A.B.C.D",
230 NO_STR
231 "EIGRP specific commands\n"
232 "Router ID for this EIGRP process\n"
233 "EIGRP Router-ID in IP address format\n")
234 {
235 //struct eigrp *eigrp = vty->index;
236 /*TODO: */
237
238 return CMD_SUCCESS;
239 }
240
241 DEFUN (eigrp_passive_interface,
242 eigrp_passive_interface_cmd,
243 "passive-interface IFNAME",
244 "Suppress routing updates on an interface\n"
245 "Interface to suppress on\n")
246 {
247 VTY_DECLVAR_CONTEXT(eigrp, eigrp);
248 struct eigrp_interface *ei;
249 struct listnode *node;
250 char *ifname = argv[1]->arg;
251
252 for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
253 {
254 if (strcmp (ifname, ei->ifp->name) == 0)
255 SET_IF_PARAM (IF_DEF_PARAMS (ei->ifp), passive_interface);
256 }
257 return CMD_SUCCESS;
258 }
259
260 DEFUN (no_eigrp_passive_interface,
261 no_eigrp_passive_interface_cmd,
262 "no passive-interface IFNAME",
263 NO_STR
264 "Suppress routing updates on an interface\n"
265 "Interface to suppress on\n")
266 {
267 VTY_DECLVAR_CONTEXT(eigrp, eigrp);
268 struct eigrp_interface *ei;
269 struct listnode *node;
270 char *ifname = argv[2]->arg;
271
272 for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
273 {
274 if (strcmp (ifname, ei->ifp->name) == 0)
275 UNSET_IF_PARAM (IF_DEF_PARAMS (ei->ifp), passive_interface);
276 }
277
278 return CMD_SUCCESS;
279 }
280
281 DEFUN (eigrp_timers_active,
282 eigrp_timers_active_cmd,
283 "timers active-time <(1-65535)|disabled>",
284 "Adjust routing timers\n"
285 "Time limit for active state\n"
286 "Active state time limit in minutes\n"
287 "Disable time limit for active state\n")
288 {
289 //struct eigrp *eigrp = vty->index;
290 /*TODO: */
291
292 return CMD_SUCCESS;
293 }
294
295 DEFUN (no_eigrp_timers_active,
296 no_eigrp_timers_active_cmd,
297 "no timers active-time <(1-65535)|disabled>",
298 NO_STR
299 "Adjust routing timers\n"
300 "Time limit for active state\n"
301 "Active state time limit in minutes\n"
302 "Disable time limit for active state\n")
303 {
304 //struct eigrp *eigrp = vty->index;
305 /*TODO: */
306
307 return CMD_SUCCESS;
308 }
309
310
311 DEFUN (eigrp_metric_weights,
312 eigrp_metric_weights_cmd,
313 "metric weights (0-255) (0-255) (0-255) (0-255) (0-255) ",
314 "Modify metrics and parameters for advertisement\n"
315 "Modify metric coefficients\n"
316 "K1\n"
317 "K2\n"
318 "K3\n"
319 "K4\n"
320 "K5\n")
321 {
322 //struct eigrp *eigrp = vty->index;
323 /*TODO: */
324
325 return CMD_SUCCESS;
326 }
327
328 DEFUN (no_eigrp_metric_weights,
329 no_eigrp_metric_weights_cmd,
330 "no metric weights <0-255> <0-255> <0-255> <0-255> <0-255>",
331 NO_STR
332 "Modify metrics and parameters for advertisement\n"
333 "Modify metric coefficients\n"
334 "K1\n"
335 "K2\n"
336 "K3\n"
337 "K4\n"
338 "K5\n")
339 {
340 //struct eigrp *eigrp = vty->index;
341 /*TODO: */
342
343 return CMD_SUCCESS;
344 }
345
346
347 DEFUN (eigrp_network,
348 eigrp_network_cmd,
349 "network A.B.C.D/M",
350 "Enable routing on an IP network\n"
351 "EIGRP network prefix\n")
352 {
353 VTY_DECLVAR_CONTEXT(eigrp, eigrp);
354 struct prefix_ipv4 p;
355 int ret;
356
357 VTY_GET_IPV4_PREFIX ("network prefix", p, argv[1]->arg);
358
359 ret = eigrp_network_set (eigrp, &p);
360
361 if (ret == 0)
362 {
363 vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE);
364 return CMD_WARNING;
365 }
366
367 return CMD_SUCCESS;
368 }
369
370 DEFUN (no_eigrp_network,
371 no_eigrp_network_cmd,
372 "no network A.B.C.D/M",
373 NO_STR
374 "Disable routing on an IP network\n"
375 "EIGRP network prefix\n")
376 {
377 VTY_DECLVAR_CONTEXT(eigrp, eigrp);
378 struct prefix_ipv4 p;
379 int ret;
380
381 VTY_GET_IPV4_PREFIX ("network prefix", p, argv[2]->arg);
382
383 ret = eigrp_network_unset (eigrp, &p);
384
385 if (ret == 0)
386 {
387 vty_out (vty,"Can't find specified network configuration.%s", VTY_NEWLINE);
388 return CMD_WARNING;
389 }
390
391 return CMD_SUCCESS;
392 }
393
394 DEFUN (eigrp_neighbor,
395 eigrp_neighbor_cmd,
396 "neighbor A.B.C.D",
397 "Specify a neighbor router\n"
398 "Neighbor address\n")
399 {
400 //struct eigrp *eigrp = vty->index;
401
402 return CMD_SUCCESS;
403 }
404
405 DEFUN (no_eigrp_neighbor,
406 no_eigrp_neighbor_cmd,
407 "no neighbor A.B.C.D",
408 NO_STR
409 "Specify a neighbor router\n"
410 "Neighbor address\n")
411 {
412 //struct eigrp *eigrp = vty->index;
413
414 return CMD_SUCCESS;
415 }
416
417 DEFUN (show_ip_eigrp_topology,
418 show_ip_eigrp_topology_cmd,
419 "show ip eigrp topology",
420 SHOW_STR
421 IP_STR
422 "IP-EIGRP show commands\n"
423 "IP-EIGRP topology\n")
424 {
425 struct eigrp *eigrp;
426 struct listnode *node, *nnode, *node2, *nnode2;
427 struct eigrp_prefix_entry *tn;
428 struct eigrp_neighbor_entry *te;
429
430 eigrp = eigrp_lookup ();
431 if (eigrp == NULL)
432 {
433 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
434 return CMD_SUCCESS;
435 }
436
437 show_ip_eigrp_topology_header (vty, eigrp);
438
439 for (ALL_LIST_ELEMENTS (eigrp->topology_table, node, nnode, tn))
440 {
441 show_ip_eigrp_prefix_entry (vty,tn);
442 for (ALL_LIST_ELEMENTS (tn->entries, node2, nnode2, te))
443 {
444 if (((te->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)||
445 ((te->flags & EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG))
446 show_ip_eigrp_neighbor_entry (vty, eigrp, te);
447 }
448 }
449
450 return CMD_SUCCESS;
451 }
452
453 DEFUN (show_ip_eigrp_topology_all_links,
454 show_ip_eigrp_topology_all_links_cmd,
455 "show ip eigrp topology all-links",
456 SHOW_STR
457 IP_STR
458 "IP-EIGRP show commands\n"
459 "IP-EIGRP topology\n"
460 "Show all links in topology table\n")
461 {
462 struct eigrp *eigrp;
463 struct listnode *node, *nnode, *node2, *nnode2;
464 struct eigrp_prefix_entry *tn;
465 struct eigrp_neighbor_entry *te;
466
467 eigrp = eigrp_lookup ();
468 if (eigrp == NULL)
469 {
470 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
471 return CMD_SUCCESS;
472 }
473
474 show_ip_eigrp_topology_header (vty, eigrp);
475
476 for (ALL_LIST_ELEMENTS (eigrp->topology_table, node, nnode, tn))
477 {
478 show_ip_eigrp_prefix_entry (vty,tn);
479 for (ALL_LIST_ELEMENTS (tn->entries, node2, nnode2, te))
480 {
481 show_ip_eigrp_neighbor_entry (vty, eigrp, te);
482 }
483 }
484
485 return CMD_SUCCESS;
486 }
487
488 ALIAS (show_ip_eigrp_topology,
489 show_ip_eigrp_topology_detail_cmd,
490 "show ip eigrp topology <A.B.C.D|A.B.C.D/M|detail|summary>",
491 SHOW_STR
492 IP_STR
493 "IP-EIGRP show commands\n"
494 "IP-EIGRP topology\n"
495 "Netwok to display information about\n"
496 "IP prefix <network>/<length>, e.g., 192.168.0.0/16\n"
497 "Show all links in topology table\n"
498 "Show a summary of the topology table\n")
499
500 DEFUN (show_ip_eigrp_interfaces,
501 show_ip_eigrp_interfaces_cmd,
502 "show ip eigrp interfaces [IFNAME] [detail]",
503 SHOW_STR
504 IP_STR
505 "IP-EIGRP show commands\n"
506 "IP-EIGRP interfaces\n"
507 "Interface name to look at\n"
508 "Detailed information\n")
509 {
510 struct eigrp_interface *ei;
511 struct eigrp *eigrp;
512 struct listnode *node;
513 int idx = 0;
514 bool detail = false;
515 const char *ifname = NULL;
516
517 eigrp = eigrp_lookup ();
518 if (eigrp == NULL)
519 {
520 vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
521 return CMD_SUCCESS;
522 }
523
524 if (argv_find (argv, argc, "IFNAME", &idx))
525 ifname = argv[idx]->arg;
526
527 if (argv_find (argv, argc, "detail", &idx))
528 detail = true;
529
530 if (!ifname)
531 show_ip_eigrp_interface_header (vty, eigrp);
532
533 for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
534 {
535 if (!ifname || strcmp (ei->ifp->name, ifname) == 0)
536 {
537 show_ip_eigrp_interface_sub (vty, eigrp, ei);
538 if (detail)
539 show_ip_eigrp_interface_detail (vty, eigrp, ei);
540 }
541 }
542
543 return CMD_SUCCESS;
544 }
545
546 DEFUN (show_ip_eigrp_neighbors,
547 show_ip_eigrp_neighbors_cmd,
548 "show ip eigrp neighbors [IFNAME] [detail]",
549 SHOW_STR
550 IP_STR
551 "IP-EIGRP show commands\n"
552 "IP-EIGRP neighbors\n"
553 "Interface to show on\n"
554 "Detailed Information\n")
555 {
556 struct eigrp *eigrp;
557 struct eigrp_interface *ei;
558 struct listnode *node, *node2, *nnode2;
559 struct eigrp_neighbor *nbr;
560 bool detail = false;
561 int idx = 0;
562 const char *ifname = NULL;
563
564 eigrp = eigrp_lookup ();
565 if (eigrp == NULL)
566 {
567 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
568 return CMD_SUCCESS;
569 }
570
571 if (argv_find(argv, argc, "IFNAME", &idx))
572 ifname = argv[idx]->arg;
573
574 detail = (argv_find(argv, argc, "detail", &idx));
575
576 show_ip_eigrp_neighbor_header (vty, eigrp);
577
578 for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
579 {
580 if (!ifname || strcmp(ei->ifp->name, ifname) == 0)
581 {
582 for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr))
583 {
584 if (detail || (nbr->state == EIGRP_NEIGHBOR_UP))
585 show_ip_eigrp_neighbor_sub (vty, nbr, detail);
586 }
587 }
588 }
589
590 return CMD_SUCCESS;
591 }
592
593 DEFUN (eigrp_if_delay,
594 eigrp_if_delay_cmd,
595 "delay (1-16777215)",
596 "Specify interface throughput delay\n"
597 "Throughput delay (tens of microseconds)\n")
598 {
599 VTY_DECLVAR_CONTEXT(interface, ifp);
600 struct eigrp *eigrp;
601 u_int32_t delay;
602
603 eigrp = eigrp_lookup ();
604 if (eigrp == NULL)
605 {
606 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
607
608 return CMD_SUCCESS;
609 }
610
611 delay = atoi (argv[1]->arg);
612
613 IF_DEF_PARAMS (ifp)->delay = delay;
614
615 return CMD_SUCCESS;
616 }
617
618 DEFUN (no_eigrp_if_delay,
619 no_eigrp_if_delay_cmd,
620 "no delay (1-16777215)",
621 NO_STR
622 "Specify interface throughput delay\n"
623 "Throughput delay (tens of microseconds)\n")
624 {
625 VTY_DECLVAR_CONTEXT(interface, ifp);
626 struct eigrp *eigrp;
627
628 eigrp = eigrp_lookup ();
629 if (eigrp == NULL)
630 {
631 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
632
633 return CMD_SUCCESS;
634 }
635
636 IF_DEF_PARAMS (ifp)->delay = EIGRP_DELAY_DEFAULT;
637
638 return CMD_SUCCESS;
639 }
640
641 DEFUN (eigrp_if_bandwidth,
642 eigrp_if_bandwidth_cmd,
643 "bandwidth (1-10000000)",
644 "Set bandwidth informational parameter\n"
645 "Bandwidth in kilobits\n")
646 {
647 VTY_DECLVAR_CONTEXT(interface, ifp);
648 u_int32_t bandwidth;
649 struct eigrp *eigrp;
650
651 eigrp = eigrp_lookup ();
652 if (eigrp == NULL)
653 {
654 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
655 return CMD_SUCCESS;
656 }
657
658 bandwidth = atoi (argv[1]->arg);
659
660 IF_DEF_PARAMS (ifp)->bandwidth = bandwidth;
661
662 return CMD_SUCCESS;
663 }
664
665 DEFUN (no_eigrp_if_bandwidth,
666 no_eigrp_if_bandwidth_cmd,
667 "bandwidth (1-10000000)",
668 "Set bandwidth informational parameter\n"
669 "Bandwidth in kilobits\n")
670 {
671 VTY_DECLVAR_CONTEXT(interface, ifp);
672 u_int32_t bandwidth;
673 struct eigrp *eigrp;
674 struct eigrp_interface *ei;
675 struct listnode *node, *nnode, *node2, *nnode2;
676 struct eigrp_prefix_entry *pe;
677 struct eigrp_neighbor_entry *ne;
678
679 eigrp = eigrp_lookup ();
680 if (eigrp == NULL)
681 {
682 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
683 return CMD_SUCCESS;
684 }
685
686 bandwidth = atoi (argv[1]->arg);
687
688 IF_DEF_PARAMS (ifp)->bandwidth = bandwidth;
689
690 for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
691 {
692 if (ei->ifp == ifp)
693 break;
694 }
695
696 for (ALL_LIST_ELEMENTS (eigrp->topology_table, node, nnode, pe))
697 {
698 for (ALL_LIST_ELEMENTS (pe->entries, node2, nnode2, ne))
699 {
700 if (ne->ei == ei)
701 break;
702 /*TODO: */
703 }
704 }
705
706 return CMD_SUCCESS;
707 }
708
709 DEFUN (eigrp_if_ip_hellointerval,
710 eigrp_if_ip_hellointerval_cmd,
711 "ip hello-interval eigrp (1-65535)",
712 "Interface Internet Protocol config commands\n"
713 "Configures EIGRP hello interval\n"
714 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
715 "Seconds between hello transmissions\n")
716 {
717 VTY_DECLVAR_CONTEXT(interface, ifp);
718 u_int32_t hello;
719 struct eigrp *eigrp;
720
721 eigrp = eigrp_lookup ();
722 if (eigrp == NULL)
723 {
724 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
725 return CMD_SUCCESS;
726 }
727
728 hello = atoi (argv[3]->arg);
729
730 IF_DEF_PARAMS (ifp)->v_hello = hello;
731
732 return CMD_SUCCESS;
733 }
734
735 DEFUN (no_eigrp_if_ip_hellointerval,
736 no_eigrp_if_ip_hellointerval_cmd,
737 "no ip hello-interval eigrp (1-65535)",
738 NO_STR
739 "Interface Internet Protocol config commands\n"
740 "Configures EIGRP hello interval\n"
741 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
742 "Seconds between hello transmissions\n")
743 {
744 VTY_DECLVAR_CONTEXT(interface, ifp);
745 struct eigrp *eigrp;
746
747 eigrp = eigrp_lookup ();
748 if (eigrp == NULL)
749 {
750 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
751 return CMD_SUCCESS;
752 }
753
754 IF_DEF_PARAMS (ifp)->v_hello = EIGRP_HELLO_INTERVAL_DEFAULT;
755
756 return CMD_SUCCESS;
757 }
758
759 DEFUN (eigrp_if_ip_holdinterval,
760 eigrp_if_ip_holdinterval_cmd,
761 "ip hold-time eigrp (1-65535)",
762 "Interface Internet Protocol config commands\n"
763 "Configures EIGRP hello interval\n"
764 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
765 "Seconds before neighbor is considered down\n")
766 {
767 VTY_DECLVAR_CONTEXT(interface, ifp);
768 u_int32_t hold;
769 struct eigrp *eigrp;
770
771 eigrp = eigrp_lookup ();
772 if (eigrp == NULL)
773 {
774 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
775 return CMD_SUCCESS;
776 }
777
778 hold = atoi (argv[3]->arg);
779
780 IF_DEF_PARAMS (ifp)->v_wait = hold;
781
782 return CMD_SUCCESS;
783 }
784
785 DEFUN (eigrp_ip_summary_address,
786 eigrp_ip_summary_address_cmd,
787 "ip summary-address eigrp (1-65535) A.B.C.D/M",
788 "Interface Internet Protocol config commands\n"
789 "Perform address summarization\n"
790 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
791 "AS number\n"
792 "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
793 {
794 VTY_DECLVAR_CONTEXT(interface, ifp);
795 //u_int32_t AS;
796 struct eigrp *eigrp;
797
798 eigrp = eigrp_lookup ();
799 if (eigrp == NULL)
800 {
801 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
802 return CMD_SUCCESS;
803 }
804
805 //AS = atoi (argv[3]->arg);
806
807 /*TODO: */
808
809 return CMD_SUCCESS;
810 }
811
812 DEFUN (no_eigrp_ip_summary_address,
813 no_eigrp_ip_summary_address_cmd,
814 "no ip summary-address eigrp (1-65535) A.B.C.D/M",
815 NO_STR
816 "Interface Internet Protocol config commands\n"
817 "Perform address summarization\n"
818 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
819 "AS number\n"
820 "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
821 {
822 VTY_DECLVAR_CONTEXT(interface, ifp);
823 //u_int32_t AS;
824 struct eigrp *eigrp;
825
826 eigrp = eigrp_lookup ();
827 if (eigrp == NULL)
828 {
829 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
830 return CMD_SUCCESS;
831 }
832
833 //AS = atoi (argv[4]->arg);
834
835 /*TODO: */
836
837 return CMD_SUCCESS;
838 }
839
840
841
842 DEFUN (no_eigrp_if_ip_holdinterval,
843 no_eigrp_if_ip_holdinterval_cmd,
844 "no ip hold-time eigrp",
845 "No"
846 "Interface Internet Protocol config commands\n"
847 "Configures EIGRP hello interval\n"
848 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
849 "Seconds before neighbor is considered down\n")
850 {
851 VTY_DECLVAR_CONTEXT(interface, ifp);
852 struct eigrp *eigrp;
853
854 eigrp = eigrp_lookup ();
855 if (eigrp == NULL)
856 {
857 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
858 return CMD_SUCCESS;
859 }
860
861 IF_DEF_PARAMS (ifp)->v_wait = EIGRP_HOLD_INTERVAL_DEFAULT;
862
863 return CMD_SUCCESS;
864 }
865
866 static int
867 str2auth_type (const char *str, struct interface *ifp)
868 {
869 /* Sanity check. */
870 if (str == NULL)
871 return CMD_WARNING;
872
873 if(strncmp(str, "md5",3) == 0)
874 {
875 IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_MD5;
876 return CMD_SUCCESS;
877 }
878 else if(strncmp(str, "hmac-sha-256",12) == 0)
879 {
880 IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256;
881 return CMD_SUCCESS;
882 }
883
884 return CMD_WARNING;
885 }
886
887 DEFUN (eigrp_authentication_mode,
888 eigrp_authentication_mode_cmd,
889 "ip authentication mode eigrp (1-65535) <md5|hmac-sha-256>",
890 "Interface Internet Protocol config commands\n"
891 "Authentication subcommands\n"
892 "Mode\n"
893 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
894 "Autonomous system number\n"
895 "Keyed message digest\n"
896 "HMAC SHA256 algorithm \n")
897 {
898 VTY_DECLVAR_CONTEXT(interface, ifp);
899 struct eigrp *eigrp;
900
901 eigrp = eigrp_lookup ();
902 if (eigrp == NULL)
903 {
904 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
905 return CMD_SUCCESS;
906 }
907
908 // if(strncmp(argv[2], "md5",3))
909 // IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_MD5;
910 // else if(strncmp(argv[2], "hmac-sha-256",12))
911 // IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256;
912
913 return str2auth_type(argv[5]->arg, ifp);
914 }
915
916 DEFUN (no_eigrp_authentication_mode,
917 no_eigrp_authentication_mode_cmd,
918 "no ip authentication mode eigrp (1-65535) <md5|hmac-sha-256>",
919 "Disable\n"
920 "Interface Internet Protocol config commands\n"
921 "Authentication subcommands\n"
922 "Mode\n"
923 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
924 "Autonomous system number\n"
925 "Keyed message digest\n"
926 "HMAC SHA256 algorithm \n")
927 {
928 VTY_DECLVAR_CONTEXT(interface, ifp);
929 struct eigrp *eigrp;
930
931 eigrp = eigrp_lookup ();
932 if (eigrp == NULL)
933 {
934 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
935 return CMD_SUCCESS;
936 }
937
938 IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_NONE;
939
940 return CMD_SUCCESS;
941 }
942
943 DEFUN (eigrp_authentication_keychain,
944 eigrp_authentication_keychain_cmd,
945 "ip authentication key-chain eigrp (1-65535) WORD",
946 "Interface Internet Protocol config commands\n"
947 "Authentication subcommands\n"
948 "Key-chain\n"
949 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
950 "Autonomous system number\n"
951 "Name of key-chain\n")
952 {
953 VTY_DECLVAR_CONTEXT(interface, ifp);
954 struct eigrp *eigrp;
955 struct keychain *keychain;
956
957 eigrp = eigrp_lookup ();
958 if (eigrp == NULL)
959 {
960 vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
961 return CMD_SUCCESS;
962 }
963
964 keychain = keychain_lookup (argv[4]->arg);
965 if(keychain != NULL)
966 {
967 if(IF_DEF_PARAMS (ifp)->auth_keychain)
968 {
969 free (IF_DEF_PARAMS (ifp)->auth_keychain);
970 IF_DEF_PARAMS (ifp)->auth_keychain = strdup(keychain->name);
971 }
972 else
973 IF_DEF_PARAMS (ifp)->auth_keychain = strdup(keychain->name);
974 }
975 else
976 vty_out(vty,"Key chain with specified name not found%s", VTY_NEWLINE);
977
978 return CMD_SUCCESS;
979 }
980
981 DEFUN (no_eigrp_authentication_keychain,
982 no_eigrp_authentication_keychain_cmd,
983 "no ip authentication key-chain eigrp (1-65535) WORD",
984 "Disable\n"
985 "Interface Internet Protocol config commands\n"
986 "Authentication subcommands\n"
987 "Key-chain\n"
988 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
989 "Autonomous system number\n"
990 "Name of key-chain\n")
991 {
992 VTY_DECLVAR_CONTEXT(interface, ifp);
993 struct eigrp *eigrp;
994
995 eigrp = eigrp_lookup ();
996 if (eigrp == NULL)
997 {
998 vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
999 return CMD_SUCCESS;
1000 }
1001
1002 if((IF_DEF_PARAMS (ifp)->auth_keychain != NULL) &&
1003 (strcmp(IF_DEF_PARAMS (ifp)->auth_keychain,argv[5]->arg)==0))
1004 {
1005 free (IF_DEF_PARAMS (ifp)->auth_keychain);
1006 IF_DEF_PARAMS (ifp)->auth_keychain = NULL;
1007 }
1008 else
1009 vty_out(vty,"Key chain with specified name not configured on interface%s", VTY_NEWLINE);
1010
1011 return CMD_SUCCESS;
1012 }
1013
1014 DEFUN (eigrp_redistribute_source_metric,
1015 eigrp_redistribute_source_metric_cmd,
1016 "redistribute " FRR_REDIST_STR_EIGRPD
1017 " metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)",
1018 REDIST_STR
1019 FRR_REDIST_HELP_STR_EIGRPD
1020 "Metric for redistributed routes\n"
1021 "Bandwidth metric in Kbits per second\n"
1022 "EIGRP delay metric, in 10 microsecond units\n"
1023 "EIGRP reliability metric where 255 is 100% reliable2 ?\n"
1024 "EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded\n"
1025 "EIGRP MTU of the path\n")
1026 {
1027 VTY_DECLVAR_CONTEXT(eigrp, eigrp);
1028 struct eigrp_metrics metrics_from_command = { 0 };
1029 int source;
1030 int idx = 0;
1031
1032 /* Get distribute source. */
1033 argv_find (argv, argc, "redistribute", &idx);
1034 source = proto_redistnum(AFI_IP, argv[idx+1]->arg);
1035 if (source < 0 )
1036 return CMD_WARNING;
1037
1038 /* Get metrics values */
1039
1040 return eigrp_redistribute_set (eigrp, source, metrics_from_command);
1041 }
1042
1043 DEFUN (no_eigrp_redistribute_source_metric,
1044 no_eigrp_redistribute_source_metric_cmd,
1045 "no redistribute " FRR_REDIST_STR_EIGRPD
1046 " metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)",
1047 "Disable\n"
1048 REDIST_STR
1049 FRR_REDIST_HELP_STR_EIGRPD
1050 "Metric for redistributed routes\n"
1051 "Bandwidth metric in Kbits per second\n"
1052 "EIGRP delay metric, in 10 microsecond units\n"
1053 "EIGRP reliability metric where 255 is 100% reliable2 ?\n"
1054 "EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded\n"
1055 "EIGRP MTU of the path\n")
1056 {
1057 VTY_DECLVAR_CONTEXT(eigrp, eigrp);
1058 int source;
1059 int idx = 0;
1060
1061 /* Get distribute source. */
1062 argv_find (argv, argc, "redistribute", &idx);
1063 source = proto_redistnum(AFI_IP, argv[idx+1]->arg);
1064 if (source < 0 )
1065 return CMD_WARNING;
1066
1067 /* Get metrics values */
1068
1069 return eigrp_redistribute_unset (eigrp, source);
1070 }
1071
1072 DEFUN (eigrp_variance,
1073 eigrp_variance_cmd,
1074 "variance (1-128)",
1075 "Control load balancing variance\n"
1076 "Metric variance multiplier\n")
1077 {
1078 struct eigrp *eigrp;
1079 u_char variance;
1080
1081 eigrp = eigrp_lookup ();
1082 if (eigrp == NULL)
1083 {
1084 vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
1085 return CMD_SUCCESS;
1086 }
1087 variance = atoi(argv[1]->arg);
1088
1089 eigrp->variance = variance;
1090
1091 /*TODO: */
1092
1093 return CMD_SUCCESS;
1094 }
1095
1096 DEFUN (no_eigrp_variance,
1097 no_eigrp_variance_cmd,
1098 "no variance (1-128)",
1099 "Disable\n"
1100 "Control load balancing variance\n"
1101 "Metric variance multiplier\n")
1102 {
1103 struct eigrp *eigrp;
1104 eigrp = eigrp_lookup ();
1105 if (eigrp == NULL)
1106 {
1107 vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
1108 return CMD_SUCCESS;
1109 }
1110
1111 eigrp->variance = EIGRP_VARIANCE_DEFAULT;
1112
1113 /*TODO: */
1114
1115 return CMD_SUCCESS;
1116 }
1117
1118 DEFUN (eigrp_maximum_paths,
1119 eigrp_maximum_paths_cmd,
1120 "maximum-paths (1-32)",
1121 "Forward packets over multiple paths\n"
1122 "Number of paths\n")
1123 {
1124 struct eigrp *eigrp;
1125 u_char max;
1126
1127 eigrp = eigrp_lookup ();
1128 if (eigrp == NULL)
1129 {
1130 vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
1131 return CMD_SUCCESS;
1132 }
1133
1134 max = atoi(argv[1]->arg);
1135
1136 eigrp->max_paths = max;
1137
1138 /*TODO: */
1139
1140 return CMD_SUCCESS;
1141 }
1142
1143 DEFUN (no_eigrp_maximum_paths,
1144 no_eigrp_maximum_paths_cmd,
1145 "no maximum-paths <1-32>",
1146 NO_STR
1147 "Forward packets over multiple paths\n"
1148 "Number of paths\n")
1149 {
1150 struct eigrp *eigrp;
1151
1152 eigrp = eigrp_lookup ();
1153 if (eigrp == NULL)
1154 {
1155 vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
1156 return CMD_SUCCESS;
1157 }
1158
1159 eigrp->max_paths = EIGRP_MAX_PATHS_DEFAULT;
1160
1161 /*TODO: */
1162
1163 return CMD_SUCCESS;
1164 }
1165
1166 /*
1167 * Execute hard restart for all neighbors
1168 */
1169 DEFUN (clear_ip_eigrp_neighbors,
1170 clear_ip_eigrp_neighbors_cmd,
1171 "clear ip eigrp neighbors",
1172 CLEAR_STR
1173 IP_STR
1174 "Clear IP-EIGRP\n"
1175 "Clear IP-EIGRP neighbors\n")
1176 {
1177 struct eigrp *eigrp;
1178 struct eigrp_interface *ei;
1179 struct listnode *node, *node2, *nnode2;
1180 struct eigrp_neighbor *nbr;
1181
1182 /* Check if eigrp process is enabled */
1183 eigrp = eigrp_lookup ();
1184 if (eigrp == NULL)
1185 {
1186 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
1187 return CMD_SUCCESS;
1188 }
1189
1190 /* iterate over all eigrp interfaces */
1191 for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
1192 {
1193 /* send Goodbye Hello */
1194 eigrp_hello_send(ei, EIGRP_HELLO_GRACEFUL_SHUTDOWN, NULL);
1195
1196 /* iterate over all neighbors on eigrp interface */
1197 for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr))
1198 {
1199 if (nbr->state != EIGRP_NEIGHBOR_DOWN)
1200 {
1201 zlog_debug ("Neighbor %s (%s) is down: manually cleared",
1202 inet_ntoa (nbr->src),
1203 ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
1204 vty_time_print (vty, 0);
1205 vty_out (vty, "Neighbor %s (%s) is down: manually cleared%s",
1206 inet_ntoa (nbr->src),
1207 ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT),
1208 VTY_NEWLINE);
1209
1210 /* set neighbor to DOWN */
1211 nbr->state = EIGRP_NEIGHBOR_DOWN;
1212 /* delete neighbor */
1213 eigrp_nbr_delete (nbr);
1214 }
1215 }
1216 }
1217
1218 return CMD_SUCCESS;
1219 }
1220
1221 /*
1222 * Execute hard restart for all neighbors on interface
1223 */
1224 DEFUN (clear_ip_eigrp_neighbors_int,
1225 clear_ip_eigrp_neighbors_int_cmd,
1226 "clear ip eigrp neighbors IFNAME",
1227 CLEAR_STR
1228 IP_STR
1229 "Clear IP-EIGRP\n"
1230 "Clear IP-EIGRP neighbors\n"
1231 "Interface's name\n")
1232 {
1233 struct eigrp *eigrp;
1234 struct eigrp_interface *ei;
1235 struct listnode *node2, *nnode2;
1236 struct eigrp_neighbor *nbr;
1237 int idx = 0;
1238
1239 /* Check if eigrp process is enabled */
1240 eigrp = eigrp_lookup ();
1241 if (eigrp == NULL)
1242 {
1243 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
1244 return CMD_SUCCESS;
1245 }
1246
1247 /* lookup interface by specified name */
1248 argv_find(argv, argc, "IFNAME", &idx);
1249 ei = eigrp_if_lookup_by_name(eigrp, argv[idx]->arg);
1250 if(ei == NULL)
1251 {
1252 vty_out (vty, " Interface (%s) doesn't exist%s", argv[idx]->arg, VTY_NEWLINE);
1253 return CMD_WARNING;
1254 }
1255
1256 /* send Goodbye Hello */
1257 eigrp_hello_send(ei, EIGRP_HELLO_GRACEFUL_SHUTDOWN, NULL);
1258
1259 /* iterate over all neighbors on eigrp interface */
1260 for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr))
1261 {
1262 if (nbr->state != EIGRP_NEIGHBOR_DOWN)
1263 {
1264 zlog_debug ("Neighbor %s (%s) is down: manually cleared",
1265 inet_ntoa (nbr->src),
1266 ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
1267 vty_time_print (vty, 0);
1268 vty_out (vty, "Neighbor %s (%s) is down: manually cleared%s",
1269 inet_ntoa (nbr->src),
1270 ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT),
1271 VTY_NEWLINE);
1272
1273 /* set neighbor to DOWN */
1274 nbr->state = EIGRP_NEIGHBOR_DOWN;
1275 /* delete neighbor */
1276 eigrp_nbr_delete (nbr);
1277 }
1278 }
1279
1280 return CMD_SUCCESS;
1281 }
1282
1283 /*
1284 * Execute hard restart for neighbor specified by IP
1285 */
1286 DEFUN (clear_ip_eigrp_neighbors_IP,
1287 clear_ip_eigrp_neighbors_IP_cmd,
1288 "clear ip eigrp neighbors A.B.C.D",
1289 CLEAR_STR
1290 IP_STR
1291 "Clear IP-EIGRP\n"
1292 "Clear IP-EIGRP neighbors\n"
1293 "IP-EIGRP neighbor address\n")
1294 {
1295 struct eigrp *eigrp;
1296 struct eigrp_neighbor *nbr;
1297 struct in_addr nbr_addr;
1298
1299 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[4]->arg);
1300
1301 /* Check if eigrp process is enabled */
1302 eigrp = eigrp_lookup ();
1303 if (eigrp == NULL)
1304 {
1305 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
1306 return CMD_SUCCESS;
1307 }
1308
1309 /* lookup neighbor in whole process */
1310 nbr = eigrp_nbr_lookup_by_addr_process(eigrp, nbr_addr);
1311
1312 /* if neighbor doesn't exists, notify user and exit */
1313 if(nbr == NULL)
1314 {
1315 vty_out (vty, "Neighbor with entered address doesn't exists.%s", VTY_NEWLINE);
1316 return CMD_WARNING;
1317 }
1318
1319 /* execute hard reset on neighbor */
1320 eigrp_nbr_hard_restart(nbr, vty);
1321
1322 return CMD_SUCCESS;
1323 }
1324
1325 /*
1326 * Execute graceful restart for all neighbors
1327 */
1328 DEFUN (clear_ip_eigrp_neighbors_soft,
1329 clear_ip_eigrp_neighbors_soft_cmd,
1330 "clear ip eigrp neighbors soft",
1331 CLEAR_STR
1332 IP_STR
1333 "Clear IP-EIGRP\n"
1334 "Clear IP-EIGRP neighbors\n"
1335 "Resync with peers without adjacency reset\n")
1336 {
1337 struct eigrp *eigrp;
1338
1339 /* Check if eigrp process is enabled */
1340 eigrp = eigrp_lookup ();
1341 if (eigrp == NULL)
1342 {
1343 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
1344 return CMD_SUCCESS;
1345 }
1346
1347 /* execute graceful restart on all neighbors */
1348 eigrp_update_send_process_GR(eigrp, EIGRP_GR_MANUAL, vty);
1349
1350 return CMD_SUCCESS;
1351 }
1352
1353 /*
1354 * Execute graceful restart for all neighbors on interface
1355 */
1356 DEFUN (clear_ip_eigrp_neighbors_int_soft,
1357 clear_ip_eigrp_neighbors_int_soft_cmd,
1358 "clear ip eigrp neighbors IFNAME soft",
1359 CLEAR_STR
1360 IP_STR
1361 "Clear IP-EIGRP\n"
1362 "Clear IP-EIGRP neighbors\n"
1363 "Interface's name\n"
1364 "Resync with peer without adjacency reset\n")
1365 {
1366 struct eigrp *eigrp;
1367 struct eigrp_interface *ei;
1368
1369 /* Check if eigrp process is enabled */
1370 eigrp = eigrp_lookup ();
1371 if (eigrp == NULL)
1372 {
1373 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
1374 return CMD_SUCCESS;
1375 }
1376
1377 /* lookup interface by specified name */
1378 ei = eigrp_if_lookup_by_name(eigrp, argv[4]->arg);
1379 if(ei == NULL)
1380 {
1381 vty_out (vty, " Interface (%s) doesn't exist%s", argv[4]->arg, VTY_NEWLINE);
1382 return CMD_WARNING;
1383 }
1384
1385 /* execute graceful restart for all neighbors on interface */
1386 eigrp_update_send_interface_GR(ei, EIGRP_GR_MANUAL, vty);
1387 return CMD_SUCCESS;
1388 }
1389
1390 /*
1391 * Execute graceful restart for neighbor specified by IP
1392 */
1393 DEFUN (clear_ip_eigrp_neighbors_IP_soft,
1394 clear_ip_eigrp_neighbors_IP_soft_cmd,
1395 "clear ip eigrp neighbors A.B.C.D soft",
1396 CLEAR_STR
1397 IP_STR
1398 "Clear IP-EIGRP\n"
1399 "Clear IP-EIGRP neighbors\n"
1400 "IP-EIGRP neighbor address\n"
1401 "Resync with peer without adjacency reset\n")
1402 {
1403 struct eigrp *eigrp;
1404 struct eigrp_neighbor *nbr;
1405 struct in_addr nbr_addr;
1406
1407 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[4]->arg);
1408
1409 /* Check if eigrp process is enabled */
1410 eigrp = eigrp_lookup ();
1411 if (eigrp == NULL)
1412 {
1413 vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
1414 return CMD_SUCCESS;
1415 }
1416
1417 /* lookup neighbor in whole process */
1418 nbr = eigrp_nbr_lookup_by_addr_process(eigrp, nbr_addr);
1419
1420 /* if neighbor doesn't exists, notify user and exit */
1421 if(nbr == NULL)
1422 {
1423 vty_out (vty, "Neighbor with entered address doesn't exists.%s", VTY_NEWLINE);
1424 return CMD_WARNING;
1425 }
1426
1427 /* execute graceful restart on neighbor */
1428 eigrp_update_send_GR(nbr, EIGRP_GR_MANUAL, vty);
1429
1430 return CMD_SUCCESS;
1431 }
1432
1433 static struct cmd_node eigrp_node =
1434 {
1435 EIGRP_NODE,
1436 "%s(config-router)# ",
1437 1
1438 };
1439
1440 /* Save EIGRP configuration */
1441 static int
1442 eigrp_config_write (struct vty *vty)
1443 {
1444 struct eigrp *eigrp;
1445
1446 int write = 0;
1447
1448 eigrp = eigrp_lookup ();
1449 if (eigrp != NULL)
1450 {
1451 /* Writes 'router eigrp' section to config */
1452 config_write_eigrp_router (vty, eigrp);
1453
1454 /* Interface config print */
1455 config_write_interfaces (vty, eigrp);
1456 //
1457 // /* static neighbor print. */
1458 // config_write_eigrp_nbr_nbma (vty, eigrp);
1459 //
1460 // /* Virtual-Link print. */
1461 // config_write_virtual_link (vty, eigrp);
1462 //
1463 // /* Default metric configuration. */
1464 // config_write_eigrp_default_metric (vty, eigrp);
1465 //
1466 // /* Distribute-list and default-information print. */
1467 // config_write_eigrp_distribute (vty, eigrp);
1468 //
1469 // /* Distance configuration. */
1470 // config_write_eigrp_distance (vty, eigrp)
1471 }
1472
1473 return write;
1474 }
1475
1476 void
1477 eigrp_vty_show_init (void)
1478 {
1479 install_element (VIEW_NODE, &show_ip_eigrp_interfaces_cmd);
1480
1481 install_element (VIEW_NODE, &show_ip_eigrp_neighbors_cmd);
1482
1483 install_element (VIEW_NODE, &show_ip_eigrp_topology_cmd);
1484
1485 install_element (VIEW_NODE, &show_ip_eigrp_topology_all_links_cmd);
1486
1487 install_element (VIEW_NODE, &show_ip_eigrp_topology_detail_cmd);
1488
1489 }
1490
1491 /* eigrpd's interface node. */
1492 static struct cmd_node eigrp_interface_node =
1493 {
1494 INTERFACE_NODE,
1495 "%s(config-if)# ",
1496 1
1497 };
1498
1499 void
1500 eigrp_vty_if_init (void)
1501 {
1502 install_node (&eigrp_interface_node, eigrp_write_interface);
1503 if_cmd_init();
1504
1505 /* Delay and bandwidth configuration commands*/
1506 install_element (INTERFACE_NODE, &eigrp_if_delay_cmd);
1507 install_element (INTERFACE_NODE, &no_eigrp_if_delay_cmd);
1508 install_element (INTERFACE_NODE, &eigrp_if_bandwidth_cmd);
1509 install_element (INTERFACE_NODE, &no_eigrp_if_bandwidth_cmd);
1510
1511 /*Hello-interval and hold-time interval configuration commands*/
1512 install_element (INTERFACE_NODE, &eigrp_if_ip_holdinterval_cmd);
1513 install_element (INTERFACE_NODE, &no_eigrp_if_ip_holdinterval_cmd);
1514 install_element (INTERFACE_NODE, &eigrp_if_ip_hellointerval_cmd);
1515 install_element (INTERFACE_NODE, &no_eigrp_if_ip_hellointerval_cmd);
1516
1517 /* "Authentication configuration commands */
1518 install_element (INTERFACE_NODE, &eigrp_authentication_mode_cmd);
1519 install_element (INTERFACE_NODE, &no_eigrp_authentication_mode_cmd);
1520 install_element (INTERFACE_NODE, &eigrp_authentication_keychain_cmd);
1521 install_element (INTERFACE_NODE, &no_eigrp_authentication_keychain_cmd);
1522
1523 /*EIGRP Summarization commands*/
1524 install_element (INTERFACE_NODE, &eigrp_ip_summary_address_cmd);
1525 install_element (INTERFACE_NODE, &no_eigrp_ip_summary_address_cmd);
1526 }
1527
1528 static void
1529 eigrp_vty_zebra_init (void)
1530 {
1531 install_element (EIGRP_NODE, &eigrp_redistribute_source_metric_cmd);
1532 install_element (EIGRP_NODE, &no_eigrp_redistribute_source_metric_cmd);
1533 }
1534
1535 /* Install EIGRP related vty commands. */
1536 void
1537 eigrp_vty_init (void)
1538 {
1539 install_node (&eigrp_node, eigrp_config_write);
1540
1541 install_default (EIGRP_NODE);
1542
1543 install_element (CONFIG_NODE, &router_eigrp_cmd);
1544 install_element (CONFIG_NODE, &no_router_eigrp_cmd);
1545 install_element (EIGRP_NODE, &eigrp_network_cmd);
1546 install_element (EIGRP_NODE, &no_eigrp_network_cmd);
1547 install_element (EIGRP_NODE, &eigrp_variance_cmd);
1548 install_element (EIGRP_NODE, &no_eigrp_variance_cmd);
1549 install_element (EIGRP_NODE, &eigrp_router_id_cmd);
1550 install_element (EIGRP_NODE, &no_eigrp_router_id_cmd);
1551 install_element (EIGRP_NODE, &eigrp_passive_interface_cmd);
1552 install_element (EIGRP_NODE, &no_eigrp_passive_interface_cmd);
1553 install_element (EIGRP_NODE, &eigrp_timers_active_cmd);
1554 install_element (EIGRP_NODE, &no_eigrp_timers_active_cmd);
1555 install_element (EIGRP_NODE, &eigrp_metric_weights_cmd);
1556 install_element (EIGRP_NODE, &no_eigrp_metric_weights_cmd);
1557 install_element (EIGRP_NODE, &eigrp_maximum_paths_cmd);
1558 install_element (EIGRP_NODE, &no_eigrp_maximum_paths_cmd);
1559 install_element (EIGRP_NODE, &eigrp_neighbor_cmd);
1560 install_element (EIGRP_NODE, &no_eigrp_neighbor_cmd);
1561
1562 /* commands for manual hard restart */
1563 install_element (ENABLE_NODE, &clear_ip_eigrp_neighbors_cmd);
1564 install_element (ENABLE_NODE, &clear_ip_eigrp_neighbors_int_cmd);
1565 install_element (ENABLE_NODE, &clear_ip_eigrp_neighbors_IP_cmd);
1566 /* commands for manual graceful restart */
1567 install_element (ENABLE_NODE, &clear_ip_eigrp_neighbors_soft_cmd);
1568 install_element (ENABLE_NODE, &clear_ip_eigrp_neighbors_int_soft_cmd);
1569 install_element (ENABLE_NODE, &clear_ip_eigrp_neighbors_IP_soft_cmd);
1570
1571 eigrp_vty_zebra_init ();
1572 }