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