3 * Copyright (C) 2013-2016
15 * This file is part of GNU Zebra.
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
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.
27 * You should have received a copy of the GNU General Public License along
28 * with this program; see the file COPYING; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
45 #include "distribute.h"
47 #include "eigrpd/eigrp_structs.h"
48 #include "eigrpd/eigrpd.h"
49 #include "eigrpd/eigrp_interface.h"
50 #include "eigrpd/eigrp_neighbor.h"
51 #include "eigrpd/eigrp_packet.h"
52 #include "eigrpd/eigrp_zebra.h"
53 #include "eigrpd/eigrp_vty.h"
54 #include "eigrpd/eigrp_network.h"
55 #include "eigrpd/eigrp_dump.h"
56 #include "eigrpd/eigrp_const.h"
59 config_write_network (struct vty
*vty
, struct eigrp
*eigrp
)
61 struct route_node
*rn
;
63 /* `network area' print. */
64 for (rn
= route_top (eigrp
->networks
); rn
; rn
= route_next (rn
))
68 vty_out (vty
, " network %s/%d %s",
69 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
, VTY_NEWLINE
);
72 if (eigrp
->max_paths
!= EIGRP_MAX_PATHS_DEFAULT
)
73 vty_out (vty
, " maximum-paths %d%s", eigrp
->max_paths
, VTY_NEWLINE
);
75 if (eigrp
->variance
!= EIGRP_VARIANCE_DEFAULT
)
76 vty_out (vty
, " variance %d%s", eigrp
->variance
, VTY_NEWLINE
);
78 /*Separate EIGRP configuration from the rest of the config*/
79 vty_out (vty
, "!%s", VTY_NEWLINE
);
85 config_write_interfaces (struct vty
*vty
, struct eigrp
*eigrp
)
87 struct eigrp_interface
*ei
;
88 struct listnode
*node
;
90 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
92 vty_out (vty
, "interface %s%s", ei
->ifp
->name
, VTY_NEWLINE
);
94 if ((IF_DEF_PARAMS (ei
->ifp
)->auth_type
) == EIGRP_AUTH_TYPE_MD5
)
96 vty_out (vty
, " ip authentication mode eigrp %d md5%s", eigrp
->AS
, VTY_NEWLINE
);
99 if ((IF_DEF_PARAMS (ei
->ifp
)->auth_type
) == EIGRP_AUTH_TYPE_SHA256
)
101 vty_out (vty
, " ip authentication mode eigrp %d hmac-sha-256%s", eigrp
->AS
, VTY_NEWLINE
);
104 if(IF_DEF_PARAMS (ei
->ifp
)->auth_keychain
)
106 vty_out (vty
, " ip authentication key-chain eigrp %d %s%s",eigrp
->AS
,IF_DEF_PARAMS (ei
->ifp
)->auth_keychain
, VTY_NEWLINE
);
109 if ((IF_DEF_PARAMS (ei
->ifp
)->v_hello
) != EIGRP_HELLO_INTERVAL_DEFAULT
)
111 vty_out (vty
, " ip hello-interval eigrp %d%s", IF_DEF_PARAMS (ei
->ifp
)->v_hello
, VTY_NEWLINE
);
114 if ((IF_DEF_PARAMS (ei
->ifp
)->v_wait
) != EIGRP_HOLD_INTERVAL_DEFAULT
)
116 vty_out (vty
, " ip hold-time eigrp %d%s", IF_DEF_PARAMS (ei
->ifp
)->v_wait
, VTY_NEWLINE
);
119 /*Separate this EIGRP interface configuration from the others*/
120 vty_out (vty
, "!%s", VTY_NEWLINE
);
127 eigrp_write_interface (struct vty
*vty
)
129 struct listnode
*node
;
130 struct interface
*ifp
;
132 for (ALL_LIST_ELEMENTS_RO (vrf_iflist(VRF_DEFAULT
), node
, ifp
)) {
133 vty_out (vty
, "interface %s%s", ifp
->name
,
137 vty_out (vty
, " description %s%s", ifp
->desc
,
140 if (IF_DEF_PARAMS (ifp
)->bandwidth
!= EIGRP_BANDWIDTH_DEFAULT
)
141 vty_out (vty
, " bandwidth %u%s", IF_DEF_PARAMS (ifp
)->bandwidth
,
143 if (IF_DEF_PARAMS (ifp
)->delay
!= EIGRP_DELAY_DEFAULT
)
144 vty_out (vty
, " delay %u%s", IF_DEF_PARAMS (ifp
)->delay
, VTY_NEWLINE
);
145 if (IF_DEF_PARAMS (ifp
)->v_hello
!= EIGRP_HELLO_INTERVAL_DEFAULT
)
146 vty_out (vty
, " ip hello-interval eigrp %u%s",
147 IF_DEF_PARAMS (ifp
)->v_hello
, VTY_NEWLINE
);
148 if (IF_DEF_PARAMS (ifp
)->v_wait
!= EIGRP_HOLD_INTERVAL_DEFAULT
)
149 vty_out (vty
, " ip hold-time eigrp %u%s",
150 IF_DEF_PARAMS (ifp
)->v_wait
, VTY_NEWLINE
);
152 vty_out (vty
, "!%s", VTY_NEWLINE
);
159 * Writes distribute lists to config
162 config_write_eigrp_distribute (struct vty
*vty
, struct eigrp
*eigrp
)
166 /* Distribute configuration. */
167 write
+= config_write_distribute (vty
);
173 * Writes 'router eigrp' section to config
176 config_write_eigrp_router (struct vty
*vty
, struct eigrp
*eigrp
)
180 /* `router eigrp' print. */
181 vty_out (vty
, "router eigrp %d%s", eigrp
->AS
, VTY_NEWLINE
);
185 if (!eigrp
->networks
)
188 /* Router ID print. */
189 if (eigrp
->router_id_static
!= 0)
191 struct in_addr router_id_static
;
192 router_id_static
.s_addr
= htonl(eigrp
->router_id_static
);
193 vty_out (vty
, " eigrp router-id %s%s",
194 inet_ntoa (router_id_static
), VTY_NEWLINE
);
197 /* Network area print. */
198 config_write_network (vty
, eigrp
);
200 /* Distribute-list and default-information print. */
201 config_write_eigrp_distribute (vty
, eigrp
);
203 /*Separate EIGRP configuration from the rest of the config*/
204 vty_out (vty
, "!%s", VTY_NEWLINE
);
209 DEFUN_NOSH (router_eigrp
,
211 "router eigrp (1-65535)",
212 "Enable a routing process\n"
213 "Start EIGRP configuration\n"
214 "AS Number to use\n")
216 struct eigrp
*eigrp
= eigrp_get (argv
[2]->arg
);
217 VTY_PUSH_CONTEXT(EIGRP_NODE
, eigrp
);
222 DEFUN (no_router_eigrp
,
224 "no router eigrp (1-65535)",
227 "EIGRP configuration\n"
228 "AS number to use\n")
230 vty
->node
= CONFIG_NODE
;
234 eigrp
= eigrp_lookup ();
235 if (eigrp
->AS
!= atoi (argv
[3]->arg
))
237 vty_out (vty
, "%% Attempting to deconfigure non-existent AS%s",
242 eigrp_finish_final (eigrp
);
247 DEFUN (eigrp_router_id
,
249 "eigrp router-id A.B.C.D",
250 "EIGRP specific commands\n"
251 "Router ID for this EIGRP process\n"
252 "EIGRP Router-ID in IP address format\n")
254 //struct eigrp *eigrp = vty->index;
260 DEFUN (no_eigrp_router_id
,
261 no_eigrp_router_id_cmd
,
262 "no eigrp router-id A.B.C.D",
264 "EIGRP specific commands\n"
265 "Router ID for this EIGRP process\n"
266 "EIGRP Router-ID in IP address format\n")
268 //struct eigrp *eigrp = vty->index;
274 DEFUN (eigrp_passive_interface
,
275 eigrp_passive_interface_cmd
,
276 "passive-interface IFNAME",
277 "Suppress routing updates on an interface\n"
278 "Interface to suppress on\n")
280 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
281 struct eigrp_interface
*ei
;
282 struct listnode
*node
;
283 char *ifname
= argv
[1]->arg
;
285 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
287 if (strcmp (ifname
, ei
->ifp
->name
) == 0)
288 SET_IF_PARAM (IF_DEF_PARAMS (ei
->ifp
), passive_interface
);
293 DEFUN (no_eigrp_passive_interface
,
294 no_eigrp_passive_interface_cmd
,
295 "no passive-interface IFNAME",
297 "Suppress routing updates on an interface\n"
298 "Interface to suppress on\n")
300 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
301 struct eigrp_interface
*ei
;
302 struct listnode
*node
;
303 char *ifname
= argv
[2]->arg
;
305 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
307 if (strcmp (ifname
, ei
->ifp
->name
) == 0)
308 UNSET_IF_PARAM (IF_DEF_PARAMS (ei
->ifp
), passive_interface
);
314 DEFUN (eigrp_timers_active
,
315 eigrp_timers_active_cmd
,
316 "timers active-time <(1-65535)|disabled>",
317 "Adjust routing timers\n"
318 "Time limit for active state\n"
319 "Active state time limit in minutes\n"
320 "Disable time limit for active state\n")
322 //struct eigrp *eigrp = vty->index;
328 DEFUN (no_eigrp_timers_active
,
329 no_eigrp_timers_active_cmd
,
330 "no timers active-time <(1-65535)|disabled>",
332 "Adjust routing timers\n"
333 "Time limit for active state\n"
334 "Active state time limit in minutes\n"
335 "Disable time limit for active state\n")
337 //struct eigrp *eigrp = vty->index;
344 DEFUN (eigrp_metric_weights
,
345 eigrp_metric_weights_cmd
,
346 "metric weights (0-255) (0-255) (0-255) (0-255) (0-255) ",
347 "Modify metrics and parameters for advertisement\n"
348 "Modify metric coefficients\n"
355 //struct eigrp *eigrp = vty->index;
361 DEFUN (no_eigrp_metric_weights
,
362 no_eigrp_metric_weights_cmd
,
363 "no metric weights <0-255> <0-255> <0-255> <0-255> <0-255>",
365 "Modify metrics and parameters for advertisement\n"
366 "Modify metric coefficients\n"
373 //struct eigrp *eigrp = vty->index;
380 DEFUN (eigrp_network
,
383 "Enable routing on an IP network\n"
384 "EIGRP network prefix\n")
386 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
387 struct prefix_ipv4 p
;
390 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[1]->arg
);
392 ret
= eigrp_network_set (eigrp
, &p
);
396 vty_out (vty
, "There is already same network statement.%s", VTY_NEWLINE
);
403 DEFUN (no_eigrp_network
,
404 no_eigrp_network_cmd
,
405 "no network A.B.C.D/M",
407 "Disable routing on an IP network\n"
408 "EIGRP network prefix\n")
410 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
411 struct prefix_ipv4 p
;
414 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[2]->arg
);
416 ret
= eigrp_network_unset (eigrp
, &p
);
420 vty_out (vty
,"Can't find specified network configuration.%s", VTY_NEWLINE
);
427 DEFUN (eigrp_neighbor
,
430 "Specify a neighbor router\n"
431 "Neighbor address\n")
433 //struct eigrp *eigrp = vty->index;
438 DEFUN (no_eigrp_neighbor
,
439 no_eigrp_neighbor_cmd
,
440 "no neighbor A.B.C.D",
442 "Specify a neighbor router\n"
443 "Neighbor address\n")
445 //struct eigrp *eigrp = vty->index;
450 DEFUN (show_ip_eigrp_topology
,
451 show_ip_eigrp_topology_cmd
,
452 "show ip eigrp topology [all-links]",
455 "IP-EIGRP show commands\n"
456 "IP-EIGRP topology\n"
457 "Show all links in topology table\n")
460 struct listnode
*node
, *node2
;
461 struct eigrp_prefix_entry
*tn
;
462 struct eigrp_neighbor_entry
*te
;
465 eigrp
= eigrp_lookup ();
468 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
472 show_ip_eigrp_topology_header (vty
, eigrp
);
474 for (ALL_LIST_ELEMENTS_RO (eigrp
->topology_table
, node
, tn
))
477 for (ALL_LIST_ELEMENTS_RO (tn
->entries
, node2
, te
))
480 (((te
->flags
& EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG
) == EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG
)||
481 ((te
->flags
& EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG
) == EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG
)))
483 show_ip_eigrp_neighbor_entry (vty
, eigrp
, te
, &first
);
492 ALIAS (show_ip_eigrp_topology
,
493 show_ip_eigrp_topology_detail_cmd
,
494 "show ip eigrp topology <A.B.C.D|A.B.C.D/M|detail|summary>",
497 "IP-EIGRP show commands\n"
498 "IP-EIGRP topology\n"
499 "Netwok to display information about\n"
500 "IP prefix <network>/<length>, e.g., 192.168.0.0/16\n"
501 "Show all links in topology table\n"
502 "Show a summary of the topology table\n")
504 DEFUN (show_ip_eigrp_interfaces
,
505 show_ip_eigrp_interfaces_cmd
,
506 "show ip eigrp interfaces [IFNAME] [detail]",
509 "IP-EIGRP show commands\n"
510 "IP-EIGRP interfaces\n"
511 "Interface name to look at\n"
512 "Detailed information\n")
514 struct eigrp_interface
*ei
;
516 struct listnode
*node
;
519 const char *ifname
= NULL
;
521 eigrp
= eigrp_lookup ();
524 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
528 if (argv_find (argv
, argc
, "IFNAME", &idx
))
529 ifname
= argv
[idx
]->arg
;
531 if (argv_find (argv
, argc
, "detail", &idx
))
535 show_ip_eigrp_interface_header (vty
, eigrp
);
537 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
539 if (!ifname
|| strcmp (ei
->ifp
->name
, ifname
) == 0)
541 show_ip_eigrp_interface_sub (vty
, eigrp
, ei
);
543 show_ip_eigrp_interface_detail (vty
, eigrp
, ei
);
550 DEFUN (show_ip_eigrp_neighbors
,
551 show_ip_eigrp_neighbors_cmd
,
552 "show ip eigrp neighbors [IFNAME] [detail]",
555 "IP-EIGRP show commands\n"
556 "IP-EIGRP neighbors\n"
557 "Interface to show on\n"
558 "Detailed Information\n")
561 struct eigrp_interface
*ei
;
562 struct listnode
*node
, *node2
, *nnode2
;
563 struct eigrp_neighbor
*nbr
;
566 const char *ifname
= NULL
;
568 eigrp
= eigrp_lookup ();
571 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
575 if (argv_find(argv
, argc
, "IFNAME", &idx
))
576 ifname
= argv
[idx
]->arg
;
578 detail
= (argv_find(argv
, argc
, "detail", &idx
));
580 show_ip_eigrp_neighbor_header (vty
, eigrp
);
582 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
584 if (!ifname
|| strcmp(ei
->ifp
->name
, ifname
) == 0)
586 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
588 if (detail
|| (nbr
->state
== EIGRP_NEIGHBOR_UP
))
589 show_ip_eigrp_neighbor_sub (vty
, nbr
, detail
);
597 DEFUN (eigrp_if_delay
,
599 "delay (1-16777215)",
600 "Specify interface throughput delay\n"
601 "Throughput delay (tens of microseconds)\n")
603 VTY_DECLVAR_CONTEXT(interface
, ifp
);
607 eigrp
= eigrp_lookup ();
610 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
615 delay
= atoi (argv
[1]->arg
);
617 IF_DEF_PARAMS (ifp
)->delay
= delay
;
618 eigrp_if_reset (ifp
);
623 DEFUN (no_eigrp_if_delay
,
624 no_eigrp_if_delay_cmd
,
625 "no delay (1-16777215)",
627 "Specify interface throughput delay\n"
628 "Throughput delay (tens of microseconds)\n")
630 VTY_DECLVAR_CONTEXT(interface
, ifp
);
633 eigrp
= eigrp_lookup ();
636 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
641 IF_DEF_PARAMS (ifp
)->delay
= EIGRP_DELAY_DEFAULT
;
642 eigrp_if_reset (ifp
);
647 DEFUN (eigrp_if_bandwidth
,
648 eigrp_if_bandwidth_cmd
,
649 "eigrp bandwidth (1-10000000)",
650 "EIGRP specific commands\n"
651 "Set bandwidth informational parameter\n"
652 "Bandwidth in kilobits\n")
654 VTY_DECLVAR_CONTEXT(interface
, ifp
);
658 eigrp
= eigrp_lookup ();
661 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
665 bandwidth
= atoi (argv
[1]->arg
);
667 IF_DEF_PARAMS (ifp
)->bandwidth
= bandwidth
;
668 eigrp_if_reset (ifp
);
673 DEFUN (no_eigrp_if_bandwidth
,
674 no_eigrp_if_bandwidth_cmd
,
675 "no eigrp bandwidth [(1-10000000)]",
677 "EIGRP specific commands\n"
678 "Set bandwidth informational parameter\n"
679 "Bandwidth in kilobits\n")
681 VTY_DECLVAR_CONTEXT(interface
, ifp
);
684 eigrp
= eigrp_lookup ();
687 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
691 IF_DEF_PARAMS (ifp
)->bandwidth
= EIGRP_BANDWIDTH_DEFAULT
;
692 eigrp_if_reset (ifp
);
697 DEFUN (eigrp_if_ip_hellointerval
,
698 eigrp_if_ip_hellointerval_cmd
,
699 "ip hello-interval eigrp (1-65535)",
700 "Interface Internet Protocol config commands\n"
701 "Configures EIGRP hello interval\n"
702 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
703 "Seconds between hello transmissions\n")
705 VTY_DECLVAR_CONTEXT(interface
, ifp
);
709 eigrp
= eigrp_lookup ();
712 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
716 hello
= atoi (argv
[3]->arg
);
718 IF_DEF_PARAMS (ifp
)->v_hello
= hello
;
723 DEFUN (no_eigrp_if_ip_hellointerval
,
724 no_eigrp_if_ip_hellointerval_cmd
,
725 "no ip hello-interval eigrp [(1-65535)]",
727 "Interface Internet Protocol config commands\n"
728 "Configures EIGRP hello interval\n"
729 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
730 "Seconds between hello transmissions\n")
732 VTY_DECLVAR_CONTEXT(interface
, ifp
);
734 struct eigrp_interface
*ei
;
735 struct listnode
*node
, *nnode
;
737 eigrp
= eigrp_lookup ();
740 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
744 IF_DEF_PARAMS (ifp
)->v_hello
= EIGRP_HELLO_INTERVAL_DEFAULT
;
746 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
750 THREAD_TIMER_OFF (ei
->t_hello
);
751 thread_add_timer (master
, eigrp_hello_timer
, ei
, 1, &ei
->t_hello
);
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 IPv4 hold time\n"
764 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
765 "Seconds before neighbor is considered down\n")
767 VTY_DECLVAR_CONTEXT(interface
, ifp
);
771 eigrp
= eigrp_lookup ();
774 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
778 hold
= atoi (argv
[3]->arg
);
780 IF_DEF_PARAMS (ifp
)->v_wait
= hold
;
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"
792 "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
794 //VTY_DECLVAR_CONTEXT(interface, ifp);
798 eigrp
= eigrp_lookup ();
801 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
805 //AS = atoi (argv[3]->arg);
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",
816 "Interface Internet Protocol config commands\n"
817 "Perform address summarization\n"
818 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
820 "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
822 //VTY_DECLVAR_CONTEXT(interface, ifp);
826 eigrp
= eigrp_lookup ();
829 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
833 //AS = atoi (argv[4]->arg);
840 DEFUN (no_eigrp_if_ip_holdinterval
,
841 no_eigrp_if_ip_holdinterval_cmd
,
842 "no ip hold-time eigrp",
844 "Interface Internet Protocol config commands\n"
845 "Configures EIGRP hello interval\n"
846 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
847 "Seconds before neighbor is considered down\n")
849 VTY_DECLVAR_CONTEXT(interface
, ifp
);
852 eigrp
= eigrp_lookup ();
855 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
859 IF_DEF_PARAMS (ifp
)->v_wait
= EIGRP_HOLD_INTERVAL_DEFAULT
;
865 str2auth_type (const char *str
, struct interface
*ifp
)
871 if(strncmp(str
, "md5",3) == 0)
873 IF_DEF_PARAMS (ifp
)->auth_type
= EIGRP_AUTH_TYPE_MD5
;
876 else if(strncmp(str
, "hmac-sha-256",12) == 0)
878 IF_DEF_PARAMS (ifp
)->auth_type
= EIGRP_AUTH_TYPE_SHA256
;
885 DEFUN (eigrp_authentication_mode
,
886 eigrp_authentication_mode_cmd
,
887 "ip authentication mode eigrp (1-65535) <md5|hmac-sha-256>",
888 "Interface Internet Protocol config commands\n"
889 "Authentication subcommands\n"
891 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
892 "Autonomous system number\n"
893 "Keyed message digest\n"
894 "HMAC SHA256 algorithm \n")
896 VTY_DECLVAR_CONTEXT(interface
, ifp
);
899 eigrp
= eigrp_lookup ();
902 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
906 // if(strncmp(argv[2], "md5",3))
907 // IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_MD5;
908 // else if(strncmp(argv[2], "hmac-sha-256",12))
909 // IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256;
911 return str2auth_type(argv
[5]->arg
, ifp
);
914 DEFUN (no_eigrp_authentication_mode
,
915 no_eigrp_authentication_mode_cmd
,
916 "no ip authentication mode eigrp (1-65535) <md5|hmac-sha-256>",
918 "Interface Internet Protocol config commands\n"
919 "Authentication subcommands\n"
921 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
922 "Autonomous system number\n"
923 "Keyed message digest\n"
924 "HMAC SHA256 algorithm \n")
926 VTY_DECLVAR_CONTEXT(interface
, ifp
);
929 eigrp
= eigrp_lookup ();
932 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
936 IF_DEF_PARAMS (ifp
)->auth_type
= EIGRP_AUTH_TYPE_NONE
;
941 DEFUN (eigrp_authentication_keychain
,
942 eigrp_authentication_keychain_cmd
,
943 "ip authentication key-chain eigrp (1-65535) WORD",
944 "Interface Internet Protocol config commands\n"
945 "Authentication subcommands\n"
947 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
948 "Autonomous system number\n"
949 "Name of key-chain\n")
951 VTY_DECLVAR_CONTEXT(interface
, ifp
);
953 struct keychain
*keychain
;
955 eigrp
= eigrp_lookup ();
958 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
962 keychain
= keychain_lookup (argv
[4]->arg
);
965 if(IF_DEF_PARAMS (ifp
)->auth_keychain
)
967 free (IF_DEF_PARAMS (ifp
)->auth_keychain
);
968 IF_DEF_PARAMS (ifp
)->auth_keychain
= strdup(keychain
->name
);
971 IF_DEF_PARAMS (ifp
)->auth_keychain
= strdup(keychain
->name
);
974 vty_out(vty
,"Key chain with specified name not found%s", VTY_NEWLINE
);
979 DEFUN (no_eigrp_authentication_keychain
,
980 no_eigrp_authentication_keychain_cmd
,
981 "no ip authentication key-chain eigrp (1-65535) WORD",
983 "Interface Internet Protocol config commands\n"
984 "Authentication subcommands\n"
986 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
987 "Autonomous system number\n"
988 "Name of key-chain\n")
990 VTY_DECLVAR_CONTEXT(interface
, ifp
);
993 eigrp
= eigrp_lookup ();
996 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1000 if((IF_DEF_PARAMS (ifp
)->auth_keychain
!= NULL
) &&
1001 (strcmp(IF_DEF_PARAMS (ifp
)->auth_keychain
,argv
[5]->arg
)==0))
1003 free (IF_DEF_PARAMS (ifp
)->auth_keychain
);
1004 IF_DEF_PARAMS (ifp
)->auth_keychain
= NULL
;
1007 vty_out(vty
,"Key chain with specified name not configured on interface%s", VTY_NEWLINE
);
1012 DEFUN (eigrp_redistribute_source_metric
,
1013 eigrp_redistribute_source_metric_cmd
,
1014 "redistribute " FRR_REDIST_STR_EIGRPD
1015 " [metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)]",
1017 FRR_REDIST_HELP_STR_EIGRPD
1018 "Metric for redistributed routes\n"
1019 "Bandwidth metric in Kbits per second\n"
1020 "EIGRP delay metric, in 10 microsecond units\n"
1021 "EIGRP reliability metric where 255 is 100% reliable2 ?\n"
1022 "EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded\n"
1023 "EIGRP MTU of the path\n")
1025 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
1026 struct eigrp_metrics metrics_from_command
= { 0 };
1030 /* Get distribute source. */
1031 argv_find (argv
, argc
, "redistribute", &idx
);
1032 source
= proto_redistnum(AFI_IP
, argv
[idx
+1]->arg
);
1036 /* Get metrics values */
1038 return eigrp_redistribute_set (eigrp
, source
, metrics_from_command
);
1041 DEFUN (no_eigrp_redistribute_source_metric
,
1042 no_eigrp_redistribute_source_metric_cmd
,
1043 "no redistribute " FRR_REDIST_STR_EIGRPD
1044 " metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)",
1047 FRR_REDIST_HELP_STR_EIGRPD
1048 "Metric for redistributed routes\n"
1049 "Bandwidth metric in Kbits per second\n"
1050 "EIGRP delay metric, in 10 microsecond units\n"
1051 "EIGRP reliability metric where 255 is 100% reliable2 ?\n"
1052 "EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded\n"
1053 "EIGRP MTU of the path\n")
1055 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
1059 /* Get distribute source. */
1060 argv_find (argv
, argc
, "redistribute", &idx
);
1061 source
= proto_redistnum(AFI_IP
, argv
[idx
+1]->arg
);
1065 /* Get metrics values */
1067 return eigrp_redistribute_unset (eigrp
, source
);
1070 DEFUN (eigrp_variance
,
1073 "Control load balancing variance\n"
1074 "Metric variance multiplier\n")
1076 struct eigrp
*eigrp
;
1079 eigrp
= eigrp_lookup ();
1082 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1085 variance
= atoi(argv
[1]->arg
);
1087 eigrp
->variance
= variance
;
1094 DEFUN (no_eigrp_variance
,
1095 no_eigrp_variance_cmd
,
1096 "no variance (1-128)",
1098 "Control load balancing variance\n"
1099 "Metric variance multiplier\n")
1101 struct eigrp
*eigrp
;
1102 eigrp
= eigrp_lookup ();
1105 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1109 eigrp
->variance
= EIGRP_VARIANCE_DEFAULT
;
1116 DEFUN (eigrp_maximum_paths
,
1117 eigrp_maximum_paths_cmd
,
1118 "maximum-paths (1-32)",
1119 "Forward packets over multiple paths\n"
1120 "Number of paths\n")
1122 struct eigrp
*eigrp
;
1125 eigrp
= eigrp_lookup ();
1128 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1132 max
= atoi(argv
[1]->arg
);
1134 eigrp
->max_paths
= max
;
1141 DEFUN (no_eigrp_maximum_paths
,
1142 no_eigrp_maximum_paths_cmd
,
1143 "no maximum-paths <1-32>",
1145 "Forward packets over multiple paths\n"
1146 "Number of paths\n")
1148 struct eigrp
*eigrp
;
1150 eigrp
= eigrp_lookup ();
1153 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1157 eigrp
->max_paths
= EIGRP_MAX_PATHS_DEFAULT
;
1165 * Execute hard restart for all neighbors
1167 DEFUN (clear_ip_eigrp_neighbors
,
1168 clear_ip_eigrp_neighbors_cmd
,
1169 "clear ip eigrp neighbors",
1173 "Clear IP-EIGRP neighbors\n")
1175 struct eigrp
*eigrp
;
1176 struct eigrp_interface
*ei
;
1177 struct listnode
*node
, *node2
, *nnode2
;
1178 struct eigrp_neighbor
*nbr
;
1180 /* Check if eigrp process is enabled */
1181 eigrp
= eigrp_lookup ();
1184 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1188 /* iterate over all eigrp interfaces */
1189 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
1191 /* send Goodbye Hello */
1192 eigrp_hello_send(ei
, EIGRP_HELLO_GRACEFUL_SHUTDOWN
, NULL
);
1194 /* iterate over all neighbors on eigrp interface */
1195 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
1197 if (nbr
->state
!= EIGRP_NEIGHBOR_DOWN
)
1199 zlog_debug ("Neighbor %s (%s) is down: manually cleared",
1200 inet_ntoa (nbr
->src
),
1201 ifindex2ifname (nbr
->ei
->ifp
->ifindex
, VRF_DEFAULT
));
1202 vty_time_print (vty
, 0);
1203 vty_out (vty
, "Neighbor %s (%s) is down: manually cleared%s",
1204 inet_ntoa (nbr
->src
),
1205 ifindex2ifname (nbr
->ei
->ifp
->ifindex
, VRF_DEFAULT
),
1208 /* set neighbor to DOWN */
1209 nbr
->state
= EIGRP_NEIGHBOR_DOWN
;
1210 /* delete neighbor */
1211 eigrp_nbr_delete (nbr
);
1220 * Execute hard restart for all neighbors on interface
1222 DEFUN (clear_ip_eigrp_neighbors_int
,
1223 clear_ip_eigrp_neighbors_int_cmd
,
1224 "clear ip eigrp neighbors IFNAME",
1228 "Clear IP-EIGRP neighbors\n"
1229 "Interface's name\n")
1231 struct eigrp
*eigrp
;
1232 struct eigrp_interface
*ei
;
1233 struct listnode
*node2
, *nnode2
;
1234 struct eigrp_neighbor
*nbr
;
1237 /* Check if eigrp process is enabled */
1238 eigrp
= eigrp_lookup ();
1241 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1245 /* lookup interface by specified name */
1246 argv_find(argv
, argc
, "IFNAME", &idx
);
1247 ei
= eigrp_if_lookup_by_name(eigrp
, argv
[idx
]->arg
);
1250 vty_out (vty
, " Interface (%s) doesn't exist%s", argv
[idx
]->arg
, VTY_NEWLINE
);
1254 /* send Goodbye Hello */
1255 eigrp_hello_send(ei
, EIGRP_HELLO_GRACEFUL_SHUTDOWN
, NULL
);
1257 /* iterate over all neighbors on eigrp interface */
1258 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
1260 if (nbr
->state
!= EIGRP_NEIGHBOR_DOWN
)
1262 zlog_debug ("Neighbor %s (%s) is down: manually cleared",
1263 inet_ntoa (nbr
->src
),
1264 ifindex2ifname (nbr
->ei
->ifp
->ifindex
, VRF_DEFAULT
));
1265 vty_time_print (vty
, 0);
1266 vty_out (vty
, "Neighbor %s (%s) is down: manually cleared%s",
1267 inet_ntoa (nbr
->src
),
1268 ifindex2ifname (nbr
->ei
->ifp
->ifindex
, VRF_DEFAULT
),
1271 /* set neighbor to DOWN */
1272 nbr
->state
= EIGRP_NEIGHBOR_DOWN
;
1273 /* delete neighbor */
1274 eigrp_nbr_delete (nbr
);
1282 * Execute hard restart for neighbor specified by IP
1284 DEFUN (clear_ip_eigrp_neighbors_IP
,
1285 clear_ip_eigrp_neighbors_IP_cmd
,
1286 "clear ip eigrp neighbors A.B.C.D",
1290 "Clear IP-EIGRP neighbors\n"
1291 "IP-EIGRP neighbor address\n")
1293 struct eigrp
*eigrp
;
1294 struct eigrp_neighbor
*nbr
;
1295 struct in_addr nbr_addr
;
1297 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[4]->arg
);
1299 /* Check if eigrp process is enabled */
1300 eigrp
= eigrp_lookup ();
1303 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1307 /* lookup neighbor in whole process */
1308 nbr
= eigrp_nbr_lookup_by_addr_process(eigrp
, nbr_addr
);
1310 /* if neighbor doesn't exists, notify user and exit */
1313 vty_out (vty
, "Neighbor with entered address doesn't exists.%s", VTY_NEWLINE
);
1317 /* execute hard reset on neighbor */
1318 eigrp_nbr_hard_restart(nbr
, vty
);
1324 * Execute graceful restart for all neighbors
1326 DEFUN (clear_ip_eigrp_neighbors_soft
,
1327 clear_ip_eigrp_neighbors_soft_cmd
,
1328 "clear ip eigrp neighbors soft",
1332 "Clear IP-EIGRP neighbors\n"
1333 "Resync with peers without adjacency reset\n")
1335 struct eigrp
*eigrp
;
1337 /* Check if eigrp process is enabled */
1338 eigrp
= eigrp_lookup ();
1341 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1345 /* execute graceful restart on all neighbors */
1346 eigrp_update_send_process_GR(eigrp
, EIGRP_GR_MANUAL
, vty
);
1352 * Execute graceful restart for all neighbors on interface
1354 DEFUN (clear_ip_eigrp_neighbors_int_soft
,
1355 clear_ip_eigrp_neighbors_int_soft_cmd
,
1356 "clear ip eigrp neighbors IFNAME soft",
1360 "Clear IP-EIGRP neighbors\n"
1361 "Interface's name\n"
1362 "Resync with peer without adjacency reset\n")
1364 struct eigrp
*eigrp
;
1365 struct eigrp_interface
*ei
;
1367 /* Check if eigrp process is enabled */
1368 eigrp
= eigrp_lookup ();
1371 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1375 /* lookup interface by specified name */
1376 ei
= eigrp_if_lookup_by_name(eigrp
, argv
[4]->arg
);
1379 vty_out (vty
, " Interface (%s) doesn't exist%s", argv
[4]->arg
, VTY_NEWLINE
);
1383 /* execute graceful restart for all neighbors on interface */
1384 eigrp_update_send_interface_GR(ei
, EIGRP_GR_MANUAL
, vty
);
1389 * Execute graceful restart for neighbor specified by IP
1391 DEFUN (clear_ip_eigrp_neighbors_IP_soft
,
1392 clear_ip_eigrp_neighbors_IP_soft_cmd
,
1393 "clear ip eigrp neighbors A.B.C.D soft",
1397 "Clear IP-EIGRP neighbors\n"
1398 "IP-EIGRP neighbor address\n"
1399 "Resync with peer without adjacency reset\n")
1401 struct eigrp
*eigrp
;
1402 struct eigrp_neighbor
*nbr
;
1403 struct in_addr nbr_addr
;
1405 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[4]->arg
);
1407 /* Check if eigrp process is enabled */
1408 eigrp
= eigrp_lookup ();
1411 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1415 /* lookup neighbor in whole process */
1416 nbr
= eigrp_nbr_lookup_by_addr_process(eigrp
, nbr_addr
);
1418 /* if neighbor doesn't exists, notify user and exit */
1421 vty_out (vty
, "Neighbor with entered address doesn't exists.%s", VTY_NEWLINE
);
1425 /* execute graceful restart on neighbor */
1426 eigrp_update_send_GR(nbr
, EIGRP_GR_MANUAL
, vty
);
1431 static struct cmd_node eigrp_node
=
1434 "%s(config-router)# ",
1438 /* Save EIGRP configuration */
1440 eigrp_config_write (struct vty
*vty
)
1442 struct eigrp
*eigrp
;
1446 eigrp
= eigrp_lookup ();
1449 /* Writes 'router eigrp' section to config */
1450 config_write_eigrp_router (vty
, eigrp
);
1452 /* Interface config print */
1453 config_write_interfaces (vty
, eigrp
);
1455 // /* static neighbor print. */
1456 // config_write_eigrp_nbr_nbma (vty, eigrp);
1458 // /* Virtual-Link print. */
1459 // config_write_virtual_link (vty, eigrp);
1461 // /* Default metric configuration. */
1462 // config_write_eigrp_default_metric (vty, eigrp);
1464 // /* Distribute-list and default-information print. */
1465 // config_write_eigrp_distribute (vty, eigrp);
1467 // /* Distance configuration. */
1468 // config_write_eigrp_distance (vty, eigrp)
1475 eigrp_vty_show_init (void)
1477 install_element (VIEW_NODE
, &show_ip_eigrp_interfaces_cmd
);
1479 install_element (VIEW_NODE
, &show_ip_eigrp_neighbors_cmd
);
1481 install_element (VIEW_NODE
, &show_ip_eigrp_topology_cmd
);
1483 install_element (VIEW_NODE
, &show_ip_eigrp_topology_detail_cmd
);
1487 /* eigrpd's interface node. */
1488 static struct cmd_node eigrp_interface_node
=
1496 eigrp_vty_if_init (void)
1498 install_node (&eigrp_interface_node
, eigrp_write_interface
);
1501 /* Delay and bandwidth configuration commands*/
1502 install_element (INTERFACE_NODE
, &eigrp_if_delay_cmd
);
1503 install_element (INTERFACE_NODE
, &no_eigrp_if_delay_cmd
);
1504 install_element (INTERFACE_NODE
, &eigrp_if_bandwidth_cmd
);
1505 install_element (INTERFACE_NODE
, &no_eigrp_if_bandwidth_cmd
);
1507 /*Hello-interval and hold-time interval configuration commands*/
1508 install_element (INTERFACE_NODE
, &eigrp_if_ip_holdinterval_cmd
);
1509 install_element (INTERFACE_NODE
, &no_eigrp_if_ip_holdinterval_cmd
);
1510 install_element (INTERFACE_NODE
, &eigrp_if_ip_hellointerval_cmd
);
1511 install_element (INTERFACE_NODE
, &no_eigrp_if_ip_hellointerval_cmd
);
1513 /* "Authentication configuration commands */
1514 install_element (INTERFACE_NODE
, &eigrp_authentication_mode_cmd
);
1515 install_element (INTERFACE_NODE
, &no_eigrp_authentication_mode_cmd
);
1516 install_element (INTERFACE_NODE
, &eigrp_authentication_keychain_cmd
);
1517 install_element (INTERFACE_NODE
, &no_eigrp_authentication_keychain_cmd
);
1519 /*EIGRP Summarization commands*/
1520 install_element (INTERFACE_NODE
, &eigrp_ip_summary_address_cmd
);
1521 install_element (INTERFACE_NODE
, &no_eigrp_ip_summary_address_cmd
);
1525 eigrp_vty_zebra_init (void)
1527 install_element (EIGRP_NODE
, &eigrp_redistribute_source_metric_cmd
);
1528 install_element (EIGRP_NODE
, &no_eigrp_redistribute_source_metric_cmd
);
1531 /* Install EIGRP related vty commands. */
1533 eigrp_vty_init (void)
1535 install_node (&eigrp_node
, eigrp_config_write
);
1537 install_default (EIGRP_NODE
);
1539 install_element (CONFIG_NODE
, &router_eigrp_cmd
);
1540 install_element (CONFIG_NODE
, &no_router_eigrp_cmd
);
1541 install_element (EIGRP_NODE
, &eigrp_network_cmd
);
1542 install_element (EIGRP_NODE
, &no_eigrp_network_cmd
);
1543 install_element (EIGRP_NODE
, &eigrp_variance_cmd
);
1544 install_element (EIGRP_NODE
, &no_eigrp_variance_cmd
);
1545 install_element (EIGRP_NODE
, &eigrp_router_id_cmd
);
1546 install_element (EIGRP_NODE
, &no_eigrp_router_id_cmd
);
1547 install_element (EIGRP_NODE
, &eigrp_passive_interface_cmd
);
1548 install_element (EIGRP_NODE
, &no_eigrp_passive_interface_cmd
);
1549 install_element (EIGRP_NODE
, &eigrp_timers_active_cmd
);
1550 install_element (EIGRP_NODE
, &no_eigrp_timers_active_cmd
);
1551 install_element (EIGRP_NODE
, &eigrp_metric_weights_cmd
);
1552 install_element (EIGRP_NODE
, &no_eigrp_metric_weights_cmd
);
1553 install_element (EIGRP_NODE
, &eigrp_maximum_paths_cmd
);
1554 install_element (EIGRP_NODE
, &no_eigrp_maximum_paths_cmd
);
1555 install_element (EIGRP_NODE
, &eigrp_neighbor_cmd
);
1556 install_element (EIGRP_NODE
, &no_eigrp_neighbor_cmd
);
1558 /* commands for manual hard restart */
1559 install_element (ENABLE_NODE
, &clear_ip_eigrp_neighbors_cmd
);
1560 install_element (ENABLE_NODE
, &clear_ip_eigrp_neighbors_int_cmd
);
1561 install_element (ENABLE_NODE
, &clear_ip_eigrp_neighbors_IP_cmd
);
1562 /* commands for manual graceful restart */
1563 install_element (ENABLE_NODE
, &clear_ip_eigrp_neighbors_soft_cmd
);
1564 install_element (ENABLE_NODE
, &clear_ip_eigrp_neighbors_int_soft_cmd
);
1565 install_element (ENABLE_NODE
, &clear_ip_eigrp_neighbors_IP_soft_cmd
);
1567 eigrp_vty_zebra_init ();