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
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
46 #include "distribute.h"
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"
61 config_write_network (struct vty
*vty
, struct eigrp
*eigrp
)
63 struct route_node
*rn
;
65 /* `network area' print. */
66 for (rn
= route_top (eigrp
->networks
); rn
; rn
= route_next (rn
))
70 vty_out (vty
, " network %s/%d %s",
71 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
, VTY_NEWLINE
);
74 if (eigrp
->max_paths
!= EIGRP_MAX_PATHS_DEFAULT
)
75 vty_out (vty
, " maximum-paths %d%s", eigrp
->max_paths
, VTY_NEWLINE
);
77 if (eigrp
->variance
!= EIGRP_VARIANCE_DEFAULT
)
78 vty_out (vty
, " variance %d%s", eigrp
->variance
, VTY_NEWLINE
);
80 /*Separate EIGRP configuration from the rest of the config*/
81 vty_out (vty
, "!%s", VTY_NEWLINE
);
87 config_write_interfaces (struct vty
*vty
, struct eigrp
*eigrp
)
89 struct eigrp_interface
*ei
;
90 struct listnode
*node
;
92 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
94 vty_out (vty
, "interface %s%s", ei
->ifp
->name
, VTY_NEWLINE
);
96 if ((IF_DEF_PARAMS (ei
->ifp
)->auth_type
) == EIGRP_AUTH_TYPE_MD5
)
98 vty_out (vty
, " ip authentication mode eigrp %d md5%s", eigrp
->AS
, VTY_NEWLINE
);
101 if ((IF_DEF_PARAMS (ei
->ifp
)->auth_type
) == EIGRP_AUTH_TYPE_SHA256
)
103 vty_out (vty
, " ip authentication mode eigrp %d hmac-sha-256%s", eigrp
->AS
, VTY_NEWLINE
);
106 if(IF_DEF_PARAMS (ei
->ifp
)->auth_keychain
)
108 vty_out (vty
, " ip authentication key-chain eigrp %d %s%s",eigrp
->AS
,IF_DEF_PARAMS (ei
->ifp
)->auth_keychain
, VTY_NEWLINE
);
111 if ((IF_DEF_PARAMS (ei
->ifp
)->v_hello
) != EIGRP_HELLO_INTERVAL_DEFAULT
)
113 vty_out (vty
, " ip hello-interval eigrp %d%s", IF_DEF_PARAMS (ei
->ifp
)->v_hello
, VTY_NEWLINE
);
116 if ((IF_DEF_PARAMS (ei
->ifp
)->v_wait
) != EIGRP_HOLD_INTERVAL_DEFAULT
)
118 vty_out (vty
, " ip hold-time eigrp %d%s", IF_DEF_PARAMS (ei
->ifp
)->v_wait
, VTY_NEWLINE
);
121 /*Separate this EIGRP interface configuration from the others*/
122 vty_out (vty
, "!%s", VTY_NEWLINE
);
129 eigrp_write_interface (struct vty
*vty
)
137 * Writes distribute lists to config
140 config_write_eigrp_distribute (struct vty
*vty
, struct eigrp
*eigrp
)
144 /* Distribute configuration. */
145 write
+= config_write_distribute (vty
);
151 * Writes 'router eigrp' section to config
154 config_write_eigrp_router (struct vty
*vty
, struct eigrp
*eigrp
)
158 /* `router eigrp' print. */
159 vty_out (vty
, "router eigrp %d%s", eigrp
->AS
, VTY_NEWLINE
);
163 if (!eigrp
->networks
)
166 /* Router ID print. */
167 if (eigrp
->router_id_static
!= 0)
169 struct in_addr router_id_static
;
170 router_id_static
.s_addr
= htonl(eigrp
->router_id_static
);
171 vty_out (vty
, " eigrp router-id %s%s",
172 inet_ntoa (router_id_static
), VTY_NEWLINE
);
175 /* Network area print. */
176 config_write_network (vty
, eigrp
);
178 /* Distribute-list and default-information print. */
179 config_write_eigrp_distribute (vty
, eigrp
);
181 /*Separate EIGRP configuration from the rest of the config*/
182 vty_out (vty
, "!%s", VTY_NEWLINE
);
189 "router eigrp (1-65535)",
190 "Enable a routing process\n"
191 "Start EIGRP configuration\n"
192 "AS Number to use\n")
194 struct eigrp
*eigrp
= eigrp_get (argv
[2]->arg
);
195 VTY_PUSH_CONTEXT(EIGRP_NODE
, eigrp
);
201 DEFUN (no_router_eigrp
,
203 "no router eigrp (1-65535)",
206 "EIGRP configuration\n"
207 "AS number to use\n")
209 vty
->node
= CONFIG_NODE
;
216 DEFUN (eigrp_router_id
,
218 "eigrp router-id A.B.C.D",
219 "EIGRP specific commands\n"
220 "Router ID for this EIGRP process\n"
221 "EIGRP Router-ID in IP address format\n")
223 //struct eigrp *eigrp = vty->index;
229 DEFUN (no_eigrp_router_id
,
230 no_eigrp_router_id_cmd
,
231 "no eigrp router-id A.B.C.D",
233 "EIGRP specific commands\n"
234 "Router ID for this EIGRP process\n"
235 "EIGRP Router-ID in IP address format\n")
237 //struct eigrp *eigrp = vty->index;
243 DEFUN (eigrp_passive_interface
,
244 eigrp_passive_interface_cmd
,
245 "passive-interface <" INT_TYPES_CMD_STR
">",
246 "Suppress routing updates on an interface\n"
249 //struct eigrp *eigrp = vty->index;
255 DEFUN (no_eigrp_passive_interface
,
256 no_eigrp_passive_interface_cmd
,
257 "no passive-interface <" INT_TYPES_CMD_STR
">",
259 "Suppress routing updates on an interface\n"
262 //struct eigrp *eigrp = vty->index;
268 DEFUN (eigrp_timers_active
,
269 eigrp_timers_active_cmd
,
270 "timers active-time <(1-65535)|disabled>",
271 "Adjust routing timers\n"
272 "Time limit for active state\n"
273 "Active state time limit in minutes\n"
274 "Disable time limit for active state\n")
276 //struct eigrp *eigrp = vty->index;
282 DEFUN (no_eigrp_timers_active
,
283 no_eigrp_timers_active_cmd
,
284 "no timers active-time <(1-65535)|disabled>",
286 "Adjust routing timers\n"
287 "Time limit for active state\n"
288 "Active state time limit in minutes\n"
289 "Disable time limit for active state\n")
291 //struct eigrp *eigrp = vty->index;
298 DEFUN (eigrp_metric_weights
,
299 eigrp_metric_weights_cmd
,
300 "metric weights (0-255) (0-255) (0-255) (0-255) (0-255) ",
301 "Modify metrics and parameters for advertisement\n"
302 "Modify metric coefficients\n"
309 //struct eigrp *eigrp = vty->index;
315 DEFUN (no_eigrp_metric_weights
,
316 no_eigrp_metric_weights_cmd
,
317 "no metric weights <0-255> <0-255> <0-255> <0-255> <0-255>",
319 "Modify metrics and parameters for advertisement\n"
320 "Modify metric coefficients\n"
327 //struct eigrp *eigrp = vty->index;
334 DEFUN (eigrp_network
,
337 "Enable routing on an IP network\n"
338 "EIGRP network prefix\n")
340 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
)
341 struct prefix_ipv4 p
;
344 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[1]->arg
);
346 ret
= eigrp_network_set (eigrp
, &p
);
350 vty_out (vty
, "There is already same network statement.%s", VTY_NEWLINE
);
357 DEFUN (no_eigrp_network
,
358 no_eigrp_network_cmd
,
359 "no network A.B.C.D/M",
361 "Disable routing on an IP network\n"
362 "EIGRP network prefix\n")
364 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
365 struct prefix_ipv4 p
;
368 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[2]->arg
);
370 ret
= eigrp_network_unset (eigrp
, &p
);
374 vty_out (vty
,"Can't find specified network configuration.%s", VTY_NEWLINE
);
381 DEFUN (eigrp_neighbor
,
383 "neighbor A.B.C.D <" INT_TYPES_CMD_STR
">",
384 "Specify a neighbor router\n"
388 //struct eigrp *eigrp = vty->index;
393 DEFUN (no_eigrp_neighbor
,
394 no_eigrp_neighbor_cmd
,
395 "no neighbor A.B.C.D <" INT_TYPES_CMD_STR
">",
397 "Specify a neighbor router\n"
401 //struct eigrp *eigrp = vty->index;
406 DEFUN (show_ip_eigrp_topology
,
407 show_ip_eigrp_topology_cmd
,
408 "show ip eigrp topology",
411 "IP-EIGRP show commands\n"
412 "IP-EIGRP topology\n")
415 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
416 struct eigrp_prefix_entry
*tn
;
417 struct eigrp_neighbor_entry
*te
;
419 eigrp
= eigrp_lookup ();
422 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
426 show_ip_eigrp_topology_header (vty
, eigrp
);
428 for (ALL_LIST_ELEMENTS (eigrp
->topology_table
, node
, nnode
, tn
))
430 show_ip_eigrp_prefix_entry (vty
,tn
);
431 for (ALL_LIST_ELEMENTS (tn
->entries
, node2
, nnode2
, te
))
433 if (((te
->flags
& EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG
) == EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG
)||
434 ((te
->flags
& EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG
) == EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG
))
435 show_ip_eigrp_neighbor_entry (vty
, eigrp
, te
);
442 DEFUN (show_ip_eigrp_topology_all_links
,
443 show_ip_eigrp_topology_all_links_cmd
,
444 "show ip eigrp topology all-links",
447 "IP-EIGRP show commands\n"
448 "IP-EIGRP topology\n"
449 "Show all links in topology table\n")
452 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
453 struct eigrp_prefix_entry
*tn
;
454 struct eigrp_neighbor_entry
*te
;
456 eigrp
= eigrp_lookup ();
459 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
463 show_ip_eigrp_topology_header (vty
, eigrp
);
465 for (ALL_LIST_ELEMENTS (eigrp
->topology_table
, node
, nnode
, tn
))
467 show_ip_eigrp_prefix_entry (vty
,tn
);
468 for (ALL_LIST_ELEMENTS (tn
->entries
, node2
, nnode2
, te
))
470 show_ip_eigrp_neighbor_entry (vty
, eigrp
, te
);
477 ALIAS (show_ip_eigrp_topology
,
478 show_ip_eigrp_topology_detail_cmd
,
479 "show ip eigrp topology <A.B.C.D|A.B.C.D/M|detail|summary>",
482 "IP-EIGRP show commands\n"
483 "IP-EIGRP topology\n"
484 "Netwok to display information about\n"
485 "IP prefix <network>/<length>, e.g., 192.168.0.0/16\n"
486 "Show all links in topology table\n"
487 "Show a summary of the topology table\n")
489 DEFUN (show_ip_eigrp_interfaces
,
490 show_ip_eigrp_interfaces_cmd
,
491 "show ip eigrp interfaces",
494 "IP-EIGRP show commands\n"
495 "IP-EIGRP interfaces\n")
497 struct eigrp_interface
*ei
;
499 struct listnode
*node
;
501 eigrp
= eigrp_lookup ();
504 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
510 show_ip_eigrp_interface_header (vty
, eigrp
);
514 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
516 if (argv_find (argv
, argc
, "detail", &idx
))
518 show_ip_eigrp_interface_header (vty
, eigrp
);
521 // if ((strncmp (argv[1], "f", 1) == 0 && strncmp (eigrp_if_name_string (ei), "F",1) == 0) ||
522 // (strncmp (argv[1], "l", 1) == 0 && strncmp (eigrp_if_name_string (ei), "L",1) == 0) ||
523 // (strncmp (argv[1], "s", 1) == 0 && strncmp (eigrp_if_name_string (ei), "S",1) == 0))
525 show_ip_eigrp_interface_sub (vty
, eigrp
, ei
);
528 if (argv_find (argv
, argc
, "detail", &idx
))
530 show_ip_eigrp_interface_detail (vty
, eigrp
, ei
);
537 ALIAS (show_ip_eigrp_interfaces
,
538 show_ip_eigrp_interfaces_detail_cmd
,
539 "show ip eigrp interfaces <" INT_TYPES_CMD_STR
">",
542 "IP-EIGRP show commands\n"
543 "IP-EIGRP interfaces\n"
546 DEFUN (show_ip_eigrp_neighbors
,
547 show_ip_eigrp_neighbors_cmd
,
548 "show ip eigrp neighbors",
551 "IP-EIGRP show commands\n"
552 "IP-EIGRP neighbors\n")
555 struct eigrp_interface
*ei
;
556 struct listnode
*node
, *node2
, *nnode2
;
557 struct eigrp_neighbor
*nbr
;
561 eigrp
= eigrp_lookup ();
564 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
568 detail
= (argv_find(argv
, argc
, "detail", &idx
));
569 show_ip_eigrp_neighbor_header (vty
, eigrp
);
571 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
573 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
575 if (detail
|| (nbr
->state
== EIGRP_NEIGHBOR_UP
))
576 show_ip_eigrp_neighbor_sub (vty
, nbr
, detail
);
583 ALIAS (show_ip_eigrp_neighbors
,
584 show_ip_eigrp_neighbors_detail_cmd
,
585 "show ip eigrp neighbors <" INT_TYPES_CMD_STR
">",
588 "IP-EIGRP show commands\n"
589 "IP-EIGRP neighbors\n"
592 DEFUN (eigrp_if_delay
,
594 "delay (1-16777215)",
595 "Specify interface throughput delay\n"
596 "Throughput delay (tens of microseconds)\n")
598 VTY_DECLVAR_CONTEXT(interface
, ifp
);
602 eigrp
= eigrp_lookup ();
605 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
610 delay
= atoi (argv
[1]->arg
);
612 IF_DEF_PARAMS (ifp
)->delay
= delay
;
617 DEFUN (no_eigrp_if_delay
,
618 no_eigrp_if_delay_cmd
,
619 "no delay (1-16777215)",
621 "Specify interface throughput delay\n"
622 "Throughput delay (tens of microseconds)\n")
624 VTY_DECLVAR_CONTEXT(interface
, ifp
);
627 eigrp
= eigrp_lookup ();
630 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
635 IF_DEF_PARAMS (ifp
)->delay
= EIGRP_DELAY_DEFAULT
;
640 DEFUN (eigrp_if_bandwidth
,
641 eigrp_if_bandwidth_cmd
,
642 "bandwidth (1-10000000)",
643 "Set bandwidth informational parameter\n"
644 "Bandwidth in kilobits\n")
646 VTY_DECLVAR_CONTEXT(interface
, ifp
);
650 eigrp
= eigrp_lookup ();
653 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
657 bandwidth
= atoi (argv
[1]->arg
);
659 IF_DEF_PARAMS (ifp
)->bandwidth
= bandwidth
;
664 DEFUN (no_eigrp_if_bandwidth
,
665 no_eigrp_if_bandwidth_cmd
,
666 "bandwidth (1-10000000)",
667 "Set bandwidth informational parameter\n"
668 "Bandwidth in kilobits\n")
670 VTY_DECLVAR_CONTEXT(interface
, ifp
);
673 struct eigrp_interface
*ei
;
674 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
675 struct eigrp_prefix_entry
*pe
;
676 struct eigrp_neighbor_entry
*ne
;
678 eigrp
= eigrp_lookup ();
681 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
685 bandwidth
= atoi (argv
[1]->arg
);
687 IF_DEF_PARAMS (ifp
)->bandwidth
= bandwidth
;
689 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
695 for (ALL_LIST_ELEMENTS (eigrp
->topology_table
, node
, nnode
, pe
))
697 for (ALL_LIST_ELEMENTS (pe
->entries
, node2
, nnode2
, ne
))
708 DEFUN (eigrp_if_ip_hellointerval
,
709 eigrp_if_ip_hellointerval_cmd
,
710 "ip hello-interval eigrp (1-65535)",
711 "Interface Internet Protocol config commands\n"
712 "Configures EIGRP hello interval\n"
713 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
714 "Seconds between hello transmissions\n")
716 VTY_DECLVAR_CONTEXT(interface
, ifp
);
720 eigrp
= eigrp_lookup ();
723 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
727 hello
= atoi (argv
[3]->arg
);
729 IF_DEF_PARAMS (ifp
)->v_hello
= hello
;
734 DEFUN (no_eigrp_if_ip_hellointerval
,
735 no_eigrp_if_ip_hellointerval_cmd
,
736 "no ip hello-interval eigrp (1-65535)",
738 "Interface Internet Protocol config commands\n"
739 "Configures EIGRP hello interval\n"
740 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
741 "Seconds between hello transmissions\n")
743 VTY_DECLVAR_CONTEXT(interface
, ifp
);
746 eigrp
= eigrp_lookup ();
749 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
753 IF_DEF_PARAMS (ifp
)->v_hello
= EIGRP_HELLO_INTERVAL_DEFAULT
;
760 DEFUN (eigrp_if_ip_holdinterval
,
761 eigrp_if_ip_holdinterval_cmd
,
762 "ip hold-time eigrp (1-65535)",
763 "Interface Internet Protocol config commands\n"
764 "Configures EIGRP hello interval\n"
765 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
766 "Seconds before neighbor is considered down\n")
768 VTY_DECLVAR_CONTEXT(interface
, ifp
);
772 eigrp
= eigrp_lookup ();
775 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
779 hold
= atoi (argv
[3]->arg
);
781 IF_DEF_PARAMS (ifp
)->v_wait
= hold
;
786 DEFUN (eigrp_ip_summary_address
,
787 eigrp_ip_summary_address_cmd
,
788 "ip summary-address eigrp (1-65535) A.B.C.D/M",
789 "Interface Internet Protocol config commands\n"
790 "Perform address summarization\n"
791 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
793 "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
795 VTY_DECLVAR_CONTEXT(interface
, ifp
);
799 eigrp
= eigrp_lookup ();
802 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
806 AS
= atoi (argv
[3]->arg
);
813 DEFUN (no_eigrp_ip_summary_address
,
814 no_eigrp_ip_summary_address_cmd
,
815 "no ip summary-address eigrp (1-65535) A.B.C.D/M",
817 "Interface Internet Protocol config commands\n"
818 "Perform address summarization\n"
819 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
821 "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
823 VTY_DECLVAR_CONTEXT(interface
, ifp
);
827 eigrp
= eigrp_lookup ();
830 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
834 AS
= atoi (argv
[4]->arg
);
843 DEFUN (no_eigrp_if_ip_holdinterval
,
844 no_eigrp_if_ip_holdinterval_cmd
,
845 "no ip hold-time eigrp",
847 "Interface Internet Protocol config commands\n"
848 "Configures EIGRP hello interval\n"
849 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
850 "Seconds before neighbor is considered down\n")
852 VTY_DECLVAR_CONTEXT(interface
, ifp
);
855 eigrp
= eigrp_lookup ();
858 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
862 IF_DEF_PARAMS (ifp
)->v_wait
= EIGRP_HOLD_INTERVAL_DEFAULT
;
868 str2auth_type (const char *str
, struct interface
*ifp
)
874 if(strncmp(str
, "md5",3) == 0)
876 IF_DEF_PARAMS (ifp
)->auth_type
= EIGRP_AUTH_TYPE_MD5
;
879 else if(strncmp(str
, "hmac-sha-256",12) == 0)
881 IF_DEF_PARAMS (ifp
)->auth_type
= EIGRP_AUTH_TYPE_SHA256
;
889 DEFUN (eigrp_authentication_mode
,
890 eigrp_authentication_mode_cmd
,
891 "ip authentication mode eigrp (1-65535) <md5|hmac-sha-256>",
892 "Interface Internet Protocol config commands\n"
893 "Authentication subcommands\n"
895 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
896 "Autonomous system number\n"
897 "Keyed message digest\n"
898 "HMAC SHA256 algorithm \n")
900 VTY_DECLVAR_CONTEXT(interface
, ifp
);
903 eigrp
= eigrp_lookup ();
906 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
910 // if(strncmp(argv[2], "md5",3))
911 // IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_MD5;
912 // else if(strncmp(argv[2], "hmac-sha-256",12))
913 // IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256;
915 return str2auth_type(argv
[5]->arg
, ifp
);
918 DEFUN (no_eigrp_authentication_mode
,
919 no_eigrp_authentication_mode_cmd
,
920 "no ip authentication mode eigrp (1-65535) <md5|hmac-sha-256>",
922 "Interface Internet Protocol config commands\n"
923 "Authentication subcommands\n"
925 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
926 "Autonomous system number\n"
927 "Keyed message digest\n"
928 "HMAC SHA256 algorithm \n")
930 VTY_DECLVAR_CONTEXT(interface
, ifp
);
933 eigrp
= eigrp_lookup ();
936 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
940 IF_DEF_PARAMS (ifp
)->auth_type
= EIGRP_AUTH_TYPE_NONE
;
945 DEFUN (eigrp_authentication_keychain
,
946 eigrp_authentication_keychain_cmd
,
947 "ip authentication key-chain eigrp (1-65535) WORD",
948 "Interface Internet Protocol config commands\n"
949 "Authentication subcommands\n"
951 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
952 "Autonomous system number\n"
953 "Name of key-chain\n")
955 VTY_DECLVAR_CONTEXT(interface
, ifp
);
957 struct keychain
*keychain
;
959 eigrp
= eigrp_lookup ();
962 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
966 keychain
= keychain_lookup (argv
[4]->arg
);
969 if(IF_DEF_PARAMS (ifp
)->auth_keychain
)
971 free (IF_DEF_PARAMS (ifp
)->auth_keychain
);
972 IF_DEF_PARAMS (ifp
)->auth_keychain
= strdup(keychain
->name
);
975 IF_DEF_PARAMS (ifp
)->auth_keychain
= strdup(keychain
->name
);
978 vty_out(vty
,"Key chain with specified name not found%s", VTY_NEWLINE
);
983 DEFUN (no_eigrp_authentication_keychain
,
984 no_eigrp_authentication_keychain_cmd
,
985 "no ip authentication key-chain eigrp (1-65535) WORD",
987 "Interface Internet Protocol config commands\n"
988 "Authentication subcommands\n"
990 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
991 "Autonomous system number\n"
992 "Name of key-chain\n")
994 VTY_DECLVAR_CONTEXT(interface
, ifp
);
997 eigrp
= eigrp_lookup ();
1000 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1004 if((IF_DEF_PARAMS (ifp
)->auth_keychain
!= NULL
) && (strcmp(IF_DEF_PARAMS (ifp
)->auth_keychain
,argv
[5]->arg
)==0))
1006 free (IF_DEF_PARAMS (ifp
)->auth_keychain
);
1007 IF_DEF_PARAMS (ifp
)->auth_keychain
= NULL
;
1010 vty_out(vty
,"Key chain with specified name not configured on interface%s", VTY_NEWLINE
);
1016 DEFUN (eigrp_redistribute_source_metric
,
1017 eigrp_redistribute_source_metric_cmd
,
1018 "redistribute " FRR_REDIST_STR_EIGRPD
1019 " metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)",
1021 FRR_REDIST_HELP_STR_EIGRPD
1022 "Metric for redistributed routes\n"
1023 "Bandwidth metric in Kbits per second\n"
1024 "EIGRP delay metric, in 10 microsecond units\n"
1025 "EIGRP reliability metric where 255 is 100% reliable2 ?\n"
1026 "EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded\n"
1027 "EIGRP MTU of the path\n")
1029 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
1030 struct eigrp_metrics metrics_from_command
= { 0 };
1034 /* Get distribute source. */
1035 argv_find (argv
, argc
, "redistribute", &idx
);
1036 source
= proto_redistnum(AFI_IP
, argv
[idx
+1]->arg
);
1040 /* Get metrics values */
1042 return eigrp_redistribute_set (eigrp
, source
, metrics_from_command
);
1046 DEFUN (no_eigrp_redistribute_source_metric
,
1047 no_eigrp_redistribute_source_metric_cmd
,
1048 "no redistribute " FRR_REDIST_STR_EIGRPD
1049 " metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)",
1052 FRR_REDIST_HELP_STR_EIGRPD
1053 "Metric for redistributed routes\n"
1054 "Bandwidth metric in Kbits per second\n"
1055 "EIGRP delay metric, in 10 microsecond units\n"
1056 "EIGRP reliability metric where 255 is 100% reliable2 ?\n"
1057 "EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded\n"
1058 "EIGRP MTU of the path\n")
1060 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
1064 /* Get distribute source. */
1065 argv_find (argv
, argc
, "redistribute", &idx
);
1066 source
= proto_redistnum(AFI_IP
, argv
[idx
+1]->arg
);
1070 /* Get metrics values */
1072 return eigrp_redistribute_unset (eigrp
, source
);
1075 DEFUN (eigrp_variance
,
1078 "Control load balancing variance\n"
1079 "Metric variance multiplier\n")
1081 struct eigrp
*eigrp
;
1084 eigrp
= eigrp_lookup ();
1087 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1090 variance
= atoi(argv
[1]->arg
);
1092 eigrp
->variance
= variance
;
1100 DEFUN (no_eigrp_variance
,
1101 no_eigrp_variance_cmd
,
1102 "no variance (1-128)",
1104 "Control load balancing variance\n"
1105 "Metric variance multiplier\n")
1107 struct eigrp
*eigrp
;
1108 eigrp
= eigrp_lookup ();
1111 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1115 eigrp
->variance
= EIGRP_VARIANCE_DEFAULT
;
1122 DEFUN (eigrp_maximum_paths
,
1123 eigrp_maximum_paths_cmd
,
1124 "maximum-paths (1-32)",
1125 "Forward packets over multiple paths\n"
1126 "Number of paths\n")
1128 struct eigrp
*eigrp
;
1131 eigrp
= eigrp_lookup ();
1134 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1138 max
= atoi(argv
[1]->arg
);
1140 eigrp
->max_paths
= max
;
1148 DEFUN (no_eigrp_maximum_paths
,
1149 no_eigrp_maximum_paths_cmd
,
1150 "no maximum-paths <1-32>",
1152 "Forward packets over multiple paths\n"
1153 "Number of paths\n")
1155 struct eigrp
*eigrp
;
1157 eigrp
= eigrp_lookup ();
1160 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1164 eigrp
->max_paths
= EIGRP_MAX_PATHS_DEFAULT
;
1172 * Execute hard restart for all neighbors
1174 DEFUN (clear_ip_eigrp_neighbors
,
1175 clear_ip_eigrp_neighbors_cmd
,
1176 "clear ip eigrp neighbors",
1180 "Clear IP-EIGRP neighbors\n")
1182 struct eigrp
*eigrp
;
1183 struct eigrp_interface
*ei
;
1184 struct listnode
*node
, *node2
, *nnode2
;
1185 struct eigrp_neighbor
*nbr
;
1187 /* Check if eigrp process is enabled */
1188 eigrp
= eigrp_lookup ();
1191 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1195 /* iterate over all eigrp interfaces */
1196 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
1198 /* send Goodbye Hello */
1199 eigrp_hello_send(ei
, EIGRP_HELLO_GRACEFUL_SHUTDOWN
, NULL
);
1201 /* iterate over all neighbors on eigrp interface */
1202 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
1204 if (nbr
->state
!= EIGRP_NEIGHBOR_DOWN
)
1206 zlog_debug ("Neighbor %s (%s) is down: manually cleared",
1207 inet_ntoa (nbr
->src
),
1208 ifindex2ifname (nbr
->ei
->ifp
->ifindex
));
1209 vty_time_print (vty
, 0);
1210 vty_out (vty
, "Neighbor %s (%s) is down: manually cleared%s",
1211 inet_ntoa (nbr
->src
),
1212 ifindex2ifname (nbr
->ei
->ifp
->ifindex
),
1215 /* set neighbor to DOWN */
1216 nbr
->state
= EIGRP_NEIGHBOR_DOWN
;
1217 /* delete neighbor */
1218 eigrp_nbr_delete (nbr
);
1227 * Execute hard restart for all neighbors on interface
1229 DEFUN (clear_ip_eigrp_neighbors_int
,
1230 clear_ip_eigrp_neighbors_int_cmd
,
1231 "clear ip eigrp neighbors IFNAME",
1235 "Clear IP-EIGRP neighbors\n"
1236 "Interface's name\n")
1238 struct eigrp
*eigrp
;
1239 struct eigrp_interface
*ei
;
1240 struct listnode
*node2
, *nnode2
;
1241 struct eigrp_neighbor
*nbr
;
1244 /* Check if eigrp process is enabled */
1245 eigrp
= eigrp_lookup ();
1248 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1252 /* lookup interface by specified name */
1253 argv_find(argv
, argc
, "IFNAME", &idx
);
1254 ei
= eigrp_if_lookup_by_name(eigrp
, argv
[idx
]->arg
);
1257 vty_out (vty
, " Interface (%s) doesn't exist%s", argv
[idx
]->arg
, VTY_NEWLINE
);
1261 /* send Goodbye Hello */
1262 eigrp_hello_send(ei
, EIGRP_HELLO_GRACEFUL_SHUTDOWN
, NULL
);
1264 /* iterate over all neighbors on eigrp interface */
1265 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
1267 if (nbr
->state
!= EIGRP_NEIGHBOR_DOWN
)
1269 zlog_debug ("Neighbor %s (%s) is down: manually cleared",
1270 inet_ntoa (nbr
->src
),
1271 ifindex2ifname (nbr
->ei
->ifp
->ifindex
));
1272 vty_time_print (vty
, 0);
1273 vty_out (vty
, "Neighbor %s (%s) is down: manually cleared%s",
1274 inet_ntoa (nbr
->src
),
1275 ifindex2ifname (nbr
->ei
->ifp
->ifindex
),
1278 /* set neighbor to DOWN */
1279 nbr
->state
= EIGRP_NEIGHBOR_DOWN
;
1280 /* delete neighbor */
1281 eigrp_nbr_delete (nbr
);
1289 * Execute hard restart for neighbor specified by IP
1291 DEFUN (clear_ip_eigrp_neighbors_IP
,
1292 clear_ip_eigrp_neighbors_IP_cmd
,
1293 "clear ip eigrp neighbors A.B.C.D",
1297 "Clear IP-EIGRP neighbors\n"
1298 "IP-EIGRP neighbor address\n")
1300 struct eigrp
*eigrp
;
1301 struct eigrp_neighbor
*nbr
;
1302 struct in_addr nbr_addr
;
1304 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[4]->arg
);
1306 /* Check if eigrp process is enabled */
1307 eigrp
= eigrp_lookup ();
1310 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1314 /* lookup neighbor in whole process */
1315 nbr
= eigrp_nbr_lookup_by_addr_process(eigrp
, nbr_addr
);
1317 /* if neighbor doesn't exists, notify user and exit */
1320 vty_out (vty
, "Neighbor with entered address doesn't exists.%s", VTY_NEWLINE
);
1324 /* execute hard reset on neighbor */
1325 eigrp_nbr_hard_restart(nbr
, vty
);
1331 * Execute graceful restart for all neighbors
1333 DEFUN (clear_ip_eigrp_neighbors_soft
,
1334 clear_ip_eigrp_neighbors_soft_cmd
,
1335 "clear ip eigrp neighbors soft",
1339 "Clear IP-EIGRP neighbors\n"
1340 "Resync with peers without adjacency reset\n")
1342 struct eigrp
*eigrp
;
1344 /* Check if eigrp process is enabled */
1345 eigrp
= eigrp_lookup ();
1348 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1352 /* execute graceful restart on all neighbors */
1353 eigrp_update_send_process_GR(eigrp
, EIGRP_GR_MANUAL
, vty
);
1359 * Execute graceful restart for all neighbors on interface
1361 DEFUN (clear_ip_eigrp_neighbors_int_soft
,
1362 clear_ip_eigrp_neighbors_int_soft_cmd
,
1363 "clear ip eigrp neighbors IFNAME soft",
1367 "Clear IP-EIGRP neighbors\n"
1368 "Interface's name\n"
1369 "Resync with peer without adjacency reset\n")
1371 struct eigrp
*eigrp
;
1372 struct eigrp_interface
*ei
;
1374 /* Check if eigrp process is enabled */
1375 eigrp
= eigrp_lookup ();
1378 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1382 /* lookup interface by specified name */
1383 ei
= eigrp_if_lookup_by_name(eigrp
, argv
[4]->arg
);
1386 vty_out (vty
, " Interface (%s) doesn't exist%s", argv
[4]->arg
, VTY_NEWLINE
);
1390 /* execute graceful restart for all neighbors on interface */
1391 eigrp_update_send_interface_GR(ei
, EIGRP_GR_MANUAL
, vty
);
1396 * Execute graceful restart for neighbor specified by IP
1398 DEFUN (clear_ip_eigrp_neighbors_IP_soft
,
1399 clear_ip_eigrp_neighbors_IP_soft_cmd
,
1400 "clear ip eigrp neighbors A.B.C.D soft",
1404 "Clear IP-EIGRP neighbors\n"
1405 "IP-EIGRP neighbor address\n"
1406 "Resync with peer without adjacency reset\n")
1408 struct eigrp
*eigrp
;
1409 struct eigrp_neighbor
*nbr
;
1410 struct in_addr nbr_addr
;
1412 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[4]->arg
);
1414 /* Check if eigrp process is enabled */
1415 eigrp
= eigrp_lookup ();
1418 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1422 /* lookup neighbor in whole process */
1423 nbr
= eigrp_nbr_lookup_by_addr_process(eigrp
, nbr_addr
);
1425 /* if neighbor doesn't exists, notify user and exit */
1428 vty_out (vty
, "Neighbor with entered address doesn't exists.%s", VTY_NEWLINE
);
1432 /* execute graceful restart on neighbor */
1433 eigrp_update_send_GR(nbr
, EIGRP_GR_MANUAL
, vty
);
1438 static struct cmd_node eigrp_node
=
1441 "%s(config-router)# ",
1445 /* Save EIGRP configuration */
1447 eigrp_config_write (struct vty
*vty
)
1449 struct eigrp
*eigrp
;
1453 eigrp
= eigrp_lookup ();
1456 /* Writes 'router eigrp' section to config */
1457 config_write_eigrp_router (vty
, eigrp
);
1459 /* Interface config print */
1460 config_write_interfaces (vty
, eigrp
);
1462 // /* static neighbor print. */
1463 // config_write_eigrp_nbr_nbma (vty, eigrp);
1465 // /* Virtual-Link print. */
1466 // config_write_virtual_link (vty, eigrp);
1468 // /* Default metric configuration. */
1469 // config_write_eigrp_default_metric (vty, eigrp);
1471 // /* Distribute-list and default-information print. */
1472 // config_write_eigrp_distribute (vty, eigrp);
1474 // /* Distance configuration. */
1475 // config_write_eigrp_distance (vty, eigrp)
1482 eigrp_vty_show_init (void)
1484 install_element (VIEW_NODE
, &show_ip_eigrp_interfaces_cmd
);
1486 install_element (VIEW_NODE
, &show_ip_eigrp_neighbors_cmd
);
1488 install_element (VIEW_NODE
, &show_ip_eigrp_topology_cmd
);
1490 install_element (VIEW_NODE
, &show_ip_eigrp_neighbors_detail_cmd
);
1492 install_element (VIEW_NODE
, &show_ip_eigrp_interfaces_detail_cmd
);
1494 install_element (VIEW_NODE
, &show_ip_eigrp_topology_all_links_cmd
);
1496 install_element (VIEW_NODE
, &show_ip_eigrp_topology_detail_cmd
);
1500 /* eigrpd's interface node. */
1501 static struct cmd_node eigrp_interface_node
=
1509 eigrp_vty_if_init (void)
1511 install_node (&eigrp_interface_node
, eigrp_write_interface
);
1514 /* Delay and bandwidth configuration commands*/
1515 install_element (INTERFACE_NODE
, &eigrp_if_delay_cmd
);
1516 install_element (INTERFACE_NODE
, &no_eigrp_if_delay_cmd
);
1517 install_element (INTERFACE_NODE
, &eigrp_if_bandwidth_cmd
);
1518 install_element (INTERFACE_NODE
, &no_eigrp_if_bandwidth_cmd
);
1520 /*Hello-interval and hold-time interval configuration commands*/
1521 install_element (INTERFACE_NODE
, &eigrp_if_ip_holdinterval_cmd
);
1522 install_element (INTERFACE_NODE
, &no_eigrp_if_ip_holdinterval_cmd
);
1523 install_element (INTERFACE_NODE
, &eigrp_if_ip_hellointerval_cmd
);
1524 install_element (INTERFACE_NODE
, &no_eigrp_if_ip_hellointerval_cmd
);
1526 /* "Authentication configuration commands */
1527 install_element (INTERFACE_NODE
, &eigrp_authentication_mode_cmd
);
1528 install_element (INTERFACE_NODE
, &no_eigrp_authentication_mode_cmd
);
1529 install_element (INTERFACE_NODE
, &eigrp_authentication_keychain_cmd
);
1530 install_element (INTERFACE_NODE
, &no_eigrp_authentication_keychain_cmd
);
1532 /*EIGRP Summarization commands*/
1533 install_element (INTERFACE_NODE
, &eigrp_ip_summary_address_cmd
);
1534 install_element (INTERFACE_NODE
, &no_eigrp_ip_summary_address_cmd
);
1540 eigrp_vty_zebra_init (void)
1542 install_element (EIGRP_NODE
, &eigrp_redistribute_source_metric_cmd
);
1543 install_element (EIGRP_NODE
, &no_eigrp_redistribute_source_metric_cmd
);
1547 /* Install EIGRP related vty commands. */
1549 eigrp_vty_init (void)
1551 install_node (&eigrp_node
, eigrp_config_write
);
1553 install_default (EIGRP_NODE
);
1555 install_element (CONFIG_NODE
, &router_eigrp_cmd
);
1556 install_element (CONFIG_NODE
, &no_router_eigrp_cmd
);
1557 install_element (EIGRP_NODE
, &eigrp_network_cmd
);
1558 install_element (EIGRP_NODE
, &no_eigrp_network_cmd
);
1559 install_element (EIGRP_NODE
, &eigrp_variance_cmd
);
1560 install_element (EIGRP_NODE
, &no_eigrp_variance_cmd
);
1561 install_element (EIGRP_NODE
, &eigrp_router_id_cmd
);
1562 install_element (EIGRP_NODE
, &no_eigrp_router_id_cmd
);
1563 install_element (EIGRP_NODE
, &eigrp_passive_interface_cmd
);
1564 install_element (EIGRP_NODE
, &no_eigrp_passive_interface_cmd
);
1565 install_element (EIGRP_NODE
, &eigrp_timers_active_cmd
);
1566 install_element (EIGRP_NODE
, &no_eigrp_timers_active_cmd
);
1567 install_element (EIGRP_NODE
, &eigrp_metric_weights_cmd
);
1568 install_element (EIGRP_NODE
, &no_eigrp_metric_weights_cmd
);
1569 install_element (EIGRP_NODE
, &eigrp_maximum_paths_cmd
);
1570 install_element (EIGRP_NODE
, &no_eigrp_maximum_paths_cmd
);
1571 install_element (EIGRP_NODE
, &eigrp_neighbor_cmd
);
1572 install_element (EIGRP_NODE
, &no_eigrp_neighbor_cmd
);
1574 /* commands for manual hard restart */
1575 install_element (ENABLE_NODE
, &clear_ip_eigrp_neighbors_cmd
);
1576 install_element (ENABLE_NODE
, &clear_ip_eigrp_neighbors_int_cmd
);
1577 install_element (ENABLE_NODE
, &clear_ip_eigrp_neighbors_IP_cmd
);
1578 /* commands for manual graceful restart */
1579 install_element (ENABLE_NODE
, &clear_ip_eigrp_neighbors_soft_cmd
);
1580 install_element (ENABLE_NODE
, &clear_ip_eigrp_neighbors_int_soft_cmd
);
1581 install_element (ENABLE_NODE
, &clear_ip_eigrp_neighbors_IP_soft_cmd
);
1583 eigrp_vty_zebra_init ();