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"
60 config_write_network (struct vty
*vty
, struct eigrp
*eigrp
)
62 struct route_node
*rn
;
64 /* `network area' print. */
65 for (rn
= route_top (eigrp
->networks
); rn
; rn
= route_next (rn
))
69 vty_out (vty
, " network %s/%d %s",
70 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
, VTY_NEWLINE
);
73 if (eigrp
->max_paths
!= EIGRP_MAX_PATHS_DEFAULT
)
74 vty_out (vty
, " maximum-paths %d%s", eigrp
->max_paths
, VTY_NEWLINE
);
76 if (eigrp
->variance
!= EIGRP_VARIANCE_DEFAULT
)
77 vty_out (vty
, " variance %d%s", eigrp
->variance
, VTY_NEWLINE
);
79 /*Separate EIGRP configuration from the rest of the config*/
80 vty_out (vty
, "!%s", VTY_NEWLINE
);
86 config_write_interfaces (struct vty
*vty
, struct eigrp
*eigrp
)
88 struct eigrp_interface
*ei
;
89 struct listnode
*node
;
91 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
93 vty_out (vty
, "interface %s%s", ei
->ifp
->name
, VTY_NEWLINE
);
95 if ((IF_DEF_PARAMS (ei
->ifp
)->auth_type
) == EIGRP_AUTH_TYPE_MD5
)
97 vty_out (vty
, " ip authentication mode eigrp %d md5%s", eigrp
->AS
, VTY_NEWLINE
);
100 if ((IF_DEF_PARAMS (ei
->ifp
)->auth_type
) == EIGRP_AUTH_TYPE_SHA256
)
102 vty_out (vty
, " ip authentication mode eigrp %d hmac-sha-256%s", eigrp
->AS
, VTY_NEWLINE
);
105 if(IF_DEF_PARAMS (ei
->ifp
)->auth_keychain
)
107 vty_out (vty
, " ip authentication key-chain eigrp %d %s%s",eigrp
->AS
,IF_DEF_PARAMS (ei
->ifp
)->auth_keychain
, VTY_NEWLINE
);
110 if ((IF_DEF_PARAMS (ei
->ifp
)->v_hello
) != EIGRP_HELLO_INTERVAL_DEFAULT
)
112 vty_out (vty
, " ip hello-interval eigrp %d%s", IF_DEF_PARAMS (ei
->ifp
)->v_hello
, VTY_NEWLINE
);
115 if ((IF_DEF_PARAMS (ei
->ifp
)->v_wait
) != EIGRP_HOLD_INTERVAL_DEFAULT
)
117 vty_out (vty
, " ip hold-time eigrp %d%s", IF_DEF_PARAMS (ei
->ifp
)->v_wait
, VTY_NEWLINE
);
120 /*Separate this EIGRP interface configuration from the others*/
121 vty_out (vty
, "!%s", VTY_NEWLINE
);
128 eigrp_write_interface (struct vty
*vty
)
136 * Writes distribute lists to config
139 config_write_eigrp_distribute (struct vty
*vty
, struct eigrp
*eigrp
)
143 /* Distribute configuration. */
144 write
+= config_write_distribute (vty
);
150 * Writes 'router eigrp' section to config
153 config_write_eigrp_router (struct vty
*vty
, struct eigrp
*eigrp
)
157 /* `router eigrp' print. */
158 vty_out (vty
, "router eigrp %d%s", eigrp
->AS
, VTY_NEWLINE
);
162 if (!eigrp
->networks
)
165 /* Router ID print. */
166 if (eigrp
->router_id_static
!= 0)
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
);
174 /* Network area print. */
175 config_write_network (vty
, eigrp
);
177 /* Distribute-list and default-information print. */
178 config_write_eigrp_distribute (vty
, eigrp
);
180 /*Separate EIGRP configuration from the rest of the config*/
181 vty_out (vty
, "!%s", VTY_NEWLINE
);
186 DEFUN_NOSH (router_eigrp
,
188 "router eigrp (1-65535)",
189 "Enable a routing process\n"
190 "Start EIGRP configuration\n"
191 "AS Number to use\n")
193 struct eigrp
*eigrp
= eigrp_get (argv
[2]->arg
);
194 VTY_PUSH_CONTEXT(EIGRP_NODE
, eigrp
);
199 DEFUN (no_router_eigrp
,
201 "no router eigrp (1-65535)",
204 "EIGRP configuration\n"
205 "AS number to use\n")
207 vty
->node
= CONFIG_NODE
;
214 DEFUN (eigrp_router_id
,
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")
221 //struct eigrp *eigrp = vty->index;
227 DEFUN (no_eigrp_router_id
,
228 no_eigrp_router_id_cmd
,
229 "no eigrp router-id A.B.C.D",
231 "EIGRP specific commands\n"
232 "Router ID for this EIGRP process\n"
233 "EIGRP Router-ID in IP address format\n")
235 //struct eigrp *eigrp = vty->index;
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")
247 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
248 struct eigrp_interface
*ei
;
249 struct listnode
*node
;
250 char *ifname
= argv
[1]->arg
;
252 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
254 if (strcmp (ifname
, ei
->ifp
->name
) == 0)
255 SET_IF_PARAM (IF_DEF_PARAMS (ei
->ifp
), passive_interface
);
260 DEFUN (no_eigrp_passive_interface
,
261 no_eigrp_passive_interface_cmd
,
262 "no passive-interface IFNAME",
264 "Suppress routing updates on an interface\n"
265 "Interface to suppress on\n")
267 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
268 struct eigrp_interface
*ei
;
269 struct listnode
*node
;
270 char *ifname
= argv
[2]->arg
;
272 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
274 if (strcmp (ifname
, ei
->ifp
->name
) == 0)
275 UNSET_IF_PARAM (IF_DEF_PARAMS (ei
->ifp
), passive_interface
);
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")
289 //struct eigrp *eigrp = vty->index;
295 DEFUN (no_eigrp_timers_active
,
296 no_eigrp_timers_active_cmd
,
297 "no timers active-time <(1-65535)|disabled>",
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")
304 //struct eigrp *eigrp = vty->index;
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"
322 //struct eigrp *eigrp = vty->index;
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>",
332 "Modify metrics and parameters for advertisement\n"
333 "Modify metric coefficients\n"
340 //struct eigrp *eigrp = vty->index;
347 DEFUN (eigrp_network
,
350 "Enable routing on an IP network\n"
351 "EIGRP network prefix\n")
353 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
354 struct prefix_ipv4 p
;
357 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[1]->arg
);
359 ret
= eigrp_network_set (eigrp
, &p
);
363 vty_out (vty
, "There is already same network statement.%s", VTY_NEWLINE
);
370 DEFUN (no_eigrp_network
,
371 no_eigrp_network_cmd
,
372 "no network A.B.C.D/M",
374 "Disable routing on an IP network\n"
375 "EIGRP network prefix\n")
377 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
378 struct prefix_ipv4 p
;
381 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[2]->arg
);
383 ret
= eigrp_network_unset (eigrp
, &p
);
387 vty_out (vty
,"Can't find specified network configuration.%s", VTY_NEWLINE
);
394 DEFUN (eigrp_neighbor
,
397 "Specify a neighbor router\n"
398 "Neighbor address\n")
400 //struct eigrp *eigrp = vty->index;
405 DEFUN (no_eigrp_neighbor
,
406 no_eigrp_neighbor_cmd
,
407 "no neighbor A.B.C.D",
409 "Specify a neighbor router\n"
410 "Neighbor address\n")
412 //struct eigrp *eigrp = vty->index;
417 DEFUN (show_ip_eigrp_topology
,
418 show_ip_eigrp_topology_cmd
,
419 "show ip eigrp topology",
422 "IP-EIGRP show commands\n"
423 "IP-EIGRP topology\n")
426 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
427 struct eigrp_prefix_entry
*tn
;
428 struct eigrp_neighbor_entry
*te
;
430 eigrp
= eigrp_lookup ();
433 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
437 show_ip_eigrp_topology_header (vty
, eigrp
);
439 for (ALL_LIST_ELEMENTS (eigrp
->topology_table
, node
, nnode
, tn
))
441 show_ip_eigrp_prefix_entry (vty
,tn
);
442 for (ALL_LIST_ELEMENTS (tn
->entries
, node2
, nnode2
, te
))
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
);
453 DEFUN (show_ip_eigrp_topology_all_links
,
454 show_ip_eigrp_topology_all_links_cmd
,
455 "show ip eigrp topology all-links",
458 "IP-EIGRP show commands\n"
459 "IP-EIGRP topology\n"
460 "Show all links in topology table\n")
463 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
464 struct eigrp_prefix_entry
*tn
;
465 struct eigrp_neighbor_entry
*te
;
467 eigrp
= eigrp_lookup ();
470 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
474 show_ip_eigrp_topology_header (vty
, eigrp
);
476 for (ALL_LIST_ELEMENTS (eigrp
->topology_table
, node
, nnode
, tn
))
478 show_ip_eigrp_prefix_entry (vty
,tn
);
479 for (ALL_LIST_ELEMENTS (tn
->entries
, node2
, nnode2
, te
))
481 show_ip_eigrp_neighbor_entry (vty
, eigrp
, te
);
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>",
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")
500 DEFUN (show_ip_eigrp_interfaces
,
501 show_ip_eigrp_interfaces_cmd
,
502 "show ip eigrp interfaces [IFNAME] [detail]",
505 "IP-EIGRP show commands\n"
506 "IP-EIGRP interfaces\n"
507 "Interface name to look at\n"
508 "Detailed information\n")
510 struct eigrp_interface
*ei
;
512 struct listnode
*node
;
515 const char *ifname
= NULL
;
517 eigrp
= eigrp_lookup ();
520 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
524 if (argv_find (argv
, argc
, "IFNAME", &idx
))
525 ifname
= argv
[idx
]->arg
;
527 if (argv_find (argv
, argc
, "detail", &idx
))
531 show_ip_eigrp_interface_header (vty
, eigrp
);
533 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
535 if (!ifname
|| strcmp (ei
->ifp
->name
, ifname
) == 0)
537 show_ip_eigrp_interface_sub (vty
, eigrp
, ei
);
539 show_ip_eigrp_interface_detail (vty
, eigrp
, ei
);
546 DEFUN (show_ip_eigrp_neighbors
,
547 show_ip_eigrp_neighbors_cmd
,
548 "show ip eigrp neighbors [IFNAME] [detail]",
551 "IP-EIGRP show commands\n"
552 "IP-EIGRP neighbors\n"
553 "Interface to show on\n"
554 "Detailed Information\n")
557 struct eigrp_interface
*ei
;
558 struct listnode
*node
, *node2
, *nnode2
;
559 struct eigrp_neighbor
*nbr
;
562 const char *ifname
= NULL
;
564 eigrp
= eigrp_lookup ();
567 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
571 if (argv_find(argv
, argc
, "IFNAME", &idx
))
572 ifname
= argv
[idx
]->arg
;
574 detail
= (argv_find(argv
, argc
, "detail", &idx
));
576 show_ip_eigrp_neighbor_header (vty
, eigrp
);
578 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
580 if (!ifname
|| strcmp(ei
->ifp
->name
, ifname
) == 0)
582 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
584 if (detail
|| (nbr
->state
== EIGRP_NEIGHBOR_UP
))
585 show_ip_eigrp_neighbor_sub (vty
, nbr
, detail
);
593 DEFUN (eigrp_if_delay
,
595 "delay (1-16777215)",
596 "Specify interface throughput delay\n"
597 "Throughput delay (tens of microseconds)\n")
599 VTY_DECLVAR_CONTEXT(interface
, ifp
);
603 eigrp
= eigrp_lookup ();
606 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
611 delay
= atoi (argv
[1]->arg
);
613 IF_DEF_PARAMS (ifp
)->delay
= delay
;
618 DEFUN (no_eigrp_if_delay
,
619 no_eigrp_if_delay_cmd
,
620 "no delay (1-16777215)",
622 "Specify interface throughput delay\n"
623 "Throughput delay (tens of microseconds)\n")
625 VTY_DECLVAR_CONTEXT(interface
, ifp
);
628 eigrp
= eigrp_lookup ();
631 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
636 IF_DEF_PARAMS (ifp
)->delay
= EIGRP_DELAY_DEFAULT
;
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")
647 VTY_DECLVAR_CONTEXT(interface
, ifp
);
651 eigrp
= eigrp_lookup ();
654 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
658 bandwidth
= atoi (argv
[1]->arg
);
660 IF_DEF_PARAMS (ifp
)->bandwidth
= bandwidth
;
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")
671 VTY_DECLVAR_CONTEXT(interface
, ifp
);
674 struct eigrp_interface
*ei
;
675 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
676 struct eigrp_prefix_entry
*pe
;
677 struct eigrp_neighbor_entry
*ne
;
679 eigrp
= eigrp_lookup ();
682 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
686 bandwidth
= atoi (argv
[1]->arg
);
688 IF_DEF_PARAMS (ifp
)->bandwidth
= bandwidth
;
690 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
696 for (ALL_LIST_ELEMENTS (eigrp
->topology_table
, node
, nnode
, pe
))
698 for (ALL_LIST_ELEMENTS (pe
->entries
, node2
, nnode2
, ne
))
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")
717 VTY_DECLVAR_CONTEXT(interface
, ifp
);
721 eigrp
= eigrp_lookup ();
724 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
728 hello
= atoi (argv
[3]->arg
);
730 IF_DEF_PARAMS (ifp
)->v_hello
= hello
;
735 DEFUN (no_eigrp_if_ip_hellointerval
,
736 no_eigrp_if_ip_hellointerval_cmd
,
737 "no ip hello-interval eigrp (1-65535)",
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")
744 VTY_DECLVAR_CONTEXT(interface
, ifp
);
747 eigrp
= eigrp_lookup ();
750 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
754 IF_DEF_PARAMS (ifp
)->v_hello
= EIGRP_HELLO_INTERVAL_DEFAULT
;
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")
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);
842 DEFUN (no_eigrp_if_ip_holdinterval
,
843 no_eigrp_if_ip_holdinterval_cmd
,
844 "no ip hold-time eigrp",
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")
851 VTY_DECLVAR_CONTEXT(interface
, ifp
);
854 eigrp
= eigrp_lookup ();
857 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
861 IF_DEF_PARAMS (ifp
)->v_wait
= EIGRP_HOLD_INTERVAL_DEFAULT
;
867 str2auth_type (const char *str
, struct interface
*ifp
)
873 if(strncmp(str
, "md5",3) == 0)
875 IF_DEF_PARAMS (ifp
)->auth_type
= EIGRP_AUTH_TYPE_MD5
;
878 else if(strncmp(str
, "hmac-sha-256",12) == 0)
880 IF_DEF_PARAMS (ifp
)->auth_type
= EIGRP_AUTH_TYPE_SHA256
;
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"
893 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
894 "Autonomous system number\n"
895 "Keyed message digest\n"
896 "HMAC SHA256 algorithm \n")
898 VTY_DECLVAR_CONTEXT(interface
, ifp
);
901 eigrp
= eigrp_lookup ();
904 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
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;
913 return str2auth_type(argv
[5]->arg
, ifp
);
916 DEFUN (no_eigrp_authentication_mode
,
917 no_eigrp_authentication_mode_cmd
,
918 "no ip authentication mode eigrp (1-65535) <md5|hmac-sha-256>",
920 "Interface Internet Protocol config commands\n"
921 "Authentication subcommands\n"
923 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
924 "Autonomous system number\n"
925 "Keyed message digest\n"
926 "HMAC SHA256 algorithm \n")
928 VTY_DECLVAR_CONTEXT(interface
, ifp
);
931 eigrp
= eigrp_lookup ();
934 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
938 IF_DEF_PARAMS (ifp
)->auth_type
= EIGRP_AUTH_TYPE_NONE
;
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"
949 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
950 "Autonomous system number\n"
951 "Name of key-chain\n")
953 VTY_DECLVAR_CONTEXT(interface
, ifp
);
955 struct keychain
*keychain
;
957 eigrp
= eigrp_lookup ();
960 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
964 keychain
= keychain_lookup (argv
[4]->arg
);
967 if(IF_DEF_PARAMS (ifp
)->auth_keychain
)
969 free (IF_DEF_PARAMS (ifp
)->auth_keychain
);
970 IF_DEF_PARAMS (ifp
)->auth_keychain
= strdup(keychain
->name
);
973 IF_DEF_PARAMS (ifp
)->auth_keychain
= strdup(keychain
->name
);
976 vty_out(vty
,"Key chain with specified name not found%s", VTY_NEWLINE
);
981 DEFUN (no_eigrp_authentication_keychain
,
982 no_eigrp_authentication_keychain_cmd
,
983 "no ip authentication key-chain eigrp (1-65535) WORD",
985 "Interface Internet Protocol config commands\n"
986 "Authentication subcommands\n"
988 "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
989 "Autonomous system number\n"
990 "Name of key-chain\n")
992 VTY_DECLVAR_CONTEXT(interface
, ifp
);
995 eigrp
= eigrp_lookup ();
998 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1002 if((IF_DEF_PARAMS (ifp
)->auth_keychain
!= NULL
) &&
1003 (strcmp(IF_DEF_PARAMS (ifp
)->auth_keychain
,argv
[5]->arg
)==0))
1005 free (IF_DEF_PARAMS (ifp
)->auth_keychain
);
1006 IF_DEF_PARAMS (ifp
)->auth_keychain
= NULL
;
1009 vty_out(vty
,"Key chain with specified name not configured on interface%s", VTY_NEWLINE
);
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)",
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")
1027 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
1028 struct eigrp_metrics metrics_from_command
= { 0 };
1032 /* Get distribute source. */
1033 argv_find (argv
, argc
, "redistribute", &idx
);
1034 source
= proto_redistnum(AFI_IP
, argv
[idx
+1]->arg
);
1038 /* Get metrics values */
1040 return eigrp_redistribute_set (eigrp
, source
, metrics_from_command
);
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)",
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")
1057 VTY_DECLVAR_CONTEXT(eigrp
, eigrp
);
1061 /* Get distribute source. */
1062 argv_find (argv
, argc
, "redistribute", &idx
);
1063 source
= proto_redistnum(AFI_IP
, argv
[idx
+1]->arg
);
1067 /* Get metrics values */
1069 return eigrp_redistribute_unset (eigrp
, source
);
1072 DEFUN (eigrp_variance
,
1075 "Control load balancing variance\n"
1076 "Metric variance multiplier\n")
1078 struct eigrp
*eigrp
;
1081 eigrp
= eigrp_lookup ();
1084 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1087 variance
= atoi(argv
[1]->arg
);
1089 eigrp
->variance
= variance
;
1096 DEFUN (no_eigrp_variance
,
1097 no_eigrp_variance_cmd
,
1098 "no variance (1-128)",
1100 "Control load balancing variance\n"
1101 "Metric variance multiplier\n")
1103 struct eigrp
*eigrp
;
1104 eigrp
= eigrp_lookup ();
1107 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1111 eigrp
->variance
= EIGRP_VARIANCE_DEFAULT
;
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")
1124 struct eigrp
*eigrp
;
1127 eigrp
= eigrp_lookup ();
1130 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1134 max
= atoi(argv
[1]->arg
);
1136 eigrp
->max_paths
= max
;
1143 DEFUN (no_eigrp_maximum_paths
,
1144 no_eigrp_maximum_paths_cmd
,
1145 "no maximum-paths <1-32>",
1147 "Forward packets over multiple paths\n"
1148 "Number of paths\n")
1150 struct eigrp
*eigrp
;
1152 eigrp
= eigrp_lookup ();
1155 vty_out (vty
, "EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1159 eigrp
->max_paths
= EIGRP_MAX_PATHS_DEFAULT
;
1167 * Execute hard restart for all neighbors
1169 DEFUN (clear_ip_eigrp_neighbors
,
1170 clear_ip_eigrp_neighbors_cmd
,
1171 "clear ip eigrp neighbors",
1175 "Clear IP-EIGRP neighbors\n")
1177 struct eigrp
*eigrp
;
1178 struct eigrp_interface
*ei
;
1179 struct listnode
*node
, *node2
, *nnode2
;
1180 struct eigrp_neighbor
*nbr
;
1182 /* Check if eigrp process is enabled */
1183 eigrp
= eigrp_lookup ();
1186 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1190 /* iterate over all eigrp interfaces */
1191 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
1193 /* send Goodbye Hello */
1194 eigrp_hello_send(ei
, EIGRP_HELLO_GRACEFUL_SHUTDOWN
, NULL
);
1196 /* iterate over all neighbors on eigrp interface */
1197 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
1199 if (nbr
->state
!= EIGRP_NEIGHBOR_DOWN
)
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
),
1210 /* set neighbor to DOWN */
1211 nbr
->state
= EIGRP_NEIGHBOR_DOWN
;
1212 /* delete neighbor */
1213 eigrp_nbr_delete (nbr
);
1222 * Execute hard restart for all neighbors on interface
1224 DEFUN (clear_ip_eigrp_neighbors_int
,
1225 clear_ip_eigrp_neighbors_int_cmd
,
1226 "clear ip eigrp neighbors IFNAME",
1230 "Clear IP-EIGRP neighbors\n"
1231 "Interface's name\n")
1233 struct eigrp
*eigrp
;
1234 struct eigrp_interface
*ei
;
1235 struct listnode
*node2
, *nnode2
;
1236 struct eigrp_neighbor
*nbr
;
1239 /* Check if eigrp process is enabled */
1240 eigrp
= eigrp_lookup ();
1243 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1247 /* lookup interface by specified name */
1248 argv_find(argv
, argc
, "IFNAME", &idx
);
1249 ei
= eigrp_if_lookup_by_name(eigrp
, argv
[idx
]->arg
);
1252 vty_out (vty
, " Interface (%s) doesn't exist%s", argv
[idx
]->arg
, VTY_NEWLINE
);
1256 /* send Goodbye Hello */
1257 eigrp_hello_send(ei
, EIGRP_HELLO_GRACEFUL_SHUTDOWN
, NULL
);
1259 /* iterate over all neighbors on eigrp interface */
1260 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
1262 if (nbr
->state
!= EIGRP_NEIGHBOR_DOWN
)
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
),
1273 /* set neighbor to DOWN */
1274 nbr
->state
= EIGRP_NEIGHBOR_DOWN
;
1275 /* delete neighbor */
1276 eigrp_nbr_delete (nbr
);
1284 * Execute hard restart for neighbor specified by IP
1286 DEFUN (clear_ip_eigrp_neighbors_IP
,
1287 clear_ip_eigrp_neighbors_IP_cmd
,
1288 "clear ip eigrp neighbors A.B.C.D",
1292 "Clear IP-EIGRP neighbors\n"
1293 "IP-EIGRP neighbor address\n")
1295 struct eigrp
*eigrp
;
1296 struct eigrp_neighbor
*nbr
;
1297 struct in_addr nbr_addr
;
1299 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[4]->arg
);
1301 /* Check if eigrp process is enabled */
1302 eigrp
= eigrp_lookup ();
1305 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1309 /* lookup neighbor in whole process */
1310 nbr
= eigrp_nbr_lookup_by_addr_process(eigrp
, nbr_addr
);
1312 /* if neighbor doesn't exists, notify user and exit */
1315 vty_out (vty
, "Neighbor with entered address doesn't exists.%s", VTY_NEWLINE
);
1319 /* execute hard reset on neighbor */
1320 eigrp_nbr_hard_restart(nbr
, vty
);
1326 * Execute graceful restart for all neighbors
1328 DEFUN (clear_ip_eigrp_neighbors_soft
,
1329 clear_ip_eigrp_neighbors_soft_cmd
,
1330 "clear ip eigrp neighbors soft",
1334 "Clear IP-EIGRP neighbors\n"
1335 "Resync with peers without adjacency reset\n")
1337 struct eigrp
*eigrp
;
1339 /* Check if eigrp process is enabled */
1340 eigrp
= eigrp_lookup ();
1343 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1347 /* execute graceful restart on all neighbors */
1348 eigrp_update_send_process_GR(eigrp
, EIGRP_GR_MANUAL
, vty
);
1354 * Execute graceful restart for all neighbors on interface
1356 DEFUN (clear_ip_eigrp_neighbors_int_soft
,
1357 clear_ip_eigrp_neighbors_int_soft_cmd
,
1358 "clear ip eigrp neighbors IFNAME soft",
1362 "Clear IP-EIGRP neighbors\n"
1363 "Interface's name\n"
1364 "Resync with peer without adjacency reset\n")
1366 struct eigrp
*eigrp
;
1367 struct eigrp_interface
*ei
;
1369 /* Check if eigrp process is enabled */
1370 eigrp
= eigrp_lookup ();
1373 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1377 /* lookup interface by specified name */
1378 ei
= eigrp_if_lookup_by_name(eigrp
, argv
[4]->arg
);
1381 vty_out (vty
, " Interface (%s) doesn't exist%s", argv
[4]->arg
, VTY_NEWLINE
);
1385 /* execute graceful restart for all neighbors on interface */
1386 eigrp_update_send_interface_GR(ei
, EIGRP_GR_MANUAL
, vty
);
1391 * Execute graceful restart for neighbor specified by IP
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",
1399 "Clear IP-EIGRP neighbors\n"
1400 "IP-EIGRP neighbor address\n"
1401 "Resync with peer without adjacency reset\n")
1403 struct eigrp
*eigrp
;
1404 struct eigrp_neighbor
*nbr
;
1405 struct in_addr nbr_addr
;
1407 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[4]->arg
);
1409 /* Check if eigrp process is enabled */
1410 eigrp
= eigrp_lookup ();
1413 vty_out (vty
, " EIGRP Routing Process not enabled%s", VTY_NEWLINE
);
1417 /* lookup neighbor in whole process */
1418 nbr
= eigrp_nbr_lookup_by_addr_process(eigrp
, nbr_addr
);
1420 /* if neighbor doesn't exists, notify user and exit */
1423 vty_out (vty
, "Neighbor with entered address doesn't exists.%s", VTY_NEWLINE
);
1427 /* execute graceful restart on neighbor */
1428 eigrp_update_send_GR(nbr
, EIGRP_GR_MANUAL
, vty
);
1433 static struct cmd_node eigrp_node
=
1436 "%s(config-router)# ",
1440 /* Save EIGRP configuration */
1442 eigrp_config_write (struct vty
*vty
)
1444 struct eigrp
*eigrp
;
1448 eigrp
= eigrp_lookup ();
1451 /* Writes 'router eigrp' section to config */
1452 config_write_eigrp_router (vty
, eigrp
);
1454 /* Interface config print */
1455 config_write_interfaces (vty
, eigrp
);
1457 // /* static neighbor print. */
1458 // config_write_eigrp_nbr_nbma (vty, eigrp);
1460 // /* Virtual-Link print. */
1461 // config_write_virtual_link (vty, eigrp);
1463 // /* Default metric configuration. */
1464 // config_write_eigrp_default_metric (vty, eigrp);
1466 // /* Distribute-list and default-information print. */
1467 // config_write_eigrp_distribute (vty, eigrp);
1469 // /* Distance configuration. */
1470 // config_write_eigrp_distance (vty, eigrp)
1477 eigrp_vty_show_init (void)
1479 install_element (VIEW_NODE
, &show_ip_eigrp_interfaces_cmd
);
1481 install_element (VIEW_NODE
, &show_ip_eigrp_neighbors_cmd
);
1483 install_element (VIEW_NODE
, &show_ip_eigrp_topology_cmd
);
1485 install_element (VIEW_NODE
, &show_ip_eigrp_topology_all_links_cmd
);
1487 install_element (VIEW_NODE
, &show_ip_eigrp_topology_detail_cmd
);
1491 /* eigrpd's interface node. */
1492 static struct cmd_node eigrp_interface_node
=
1500 eigrp_vty_if_init (void)
1502 install_node (&eigrp_interface_node
, eigrp_write_interface
);
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
);
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
);
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
);
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
);
1529 eigrp_vty_zebra_init (void)
1531 install_element (EIGRP_NODE
, &eigrp_redistribute_source_metric_cmd
);
1532 install_element (EIGRP_NODE
, &no_eigrp_redistribute_source_metric_cmd
);
1535 /* Install EIGRP related vty commands. */
1537 eigrp_vty_init (void)
1539 install_node (&eigrp_node
, eigrp_config_write
);
1541 install_default (EIGRP_NODE
);
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
);
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
);
1571 eigrp_vty_zebra_init ();