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