]>
Commit | Line | Data |
---|---|---|
eb5d44eb | 1 | /* |
2 | * IS-IS Rout(e)ing protocol - isisd.c | |
3 | * | |
4 | * Copyright (C) 2001,2002 Sampo Saaristo | |
d62a17ae | 5 | * Tampere University of Technology |
eb5d44eb | 6 | * Institute of Communications Engineering |
7 | * | |
d62a17ae | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public Licenseas published by the Free | |
10 | * Software Foundation; either version 2 of the License, or (at your option) | |
eb5d44eb | 11 | * any later version. |
12 | * | |
d62a17ae | 13 | * This program is distributed in the hope that it will be useful,but WITHOUT |
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
eb5d44eb | 16 | * more details. |
896014f4 DL |
17 | * |
18 | * You should have received a copy of the GNU General Public License along | |
19 | * with this program; see the file COPYING; if not, write to the Free Software | |
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
eb5d44eb | 21 | */ |
22 | ||
eb5d44eb | 23 | #include <zebra.h> |
eb5d44eb | 24 | |
25 | #include "thread.h" | |
26 | #include "vty.h" | |
27 | #include "command.h" | |
28 | #include "log.h" | |
29 | #include "memory.h" | |
3f045a08 | 30 | #include "time.h" |
eb5d44eb | 31 | #include "linklist.h" |
32 | #include "if.h" | |
33 | #include "hash.h" | |
34 | #include "stream.h" | |
35 | #include "prefix.h" | |
36 | #include "table.h" | |
676a4ea3 | 37 | #include "qobj.h" |
03f7e182 | 38 | #include "spf_backoff.h" |
eb5d44eb | 39 | |
40 | #include "isisd/dict.h" | |
eb5d44eb | 41 | #include "isisd/isis_constants.h" |
42 | #include "isisd/isis_common.h" | |
eb5d44eb | 43 | #include "isisd/isis_flags.h" |
3f045a08 JB |
44 | #include "isisd/isis_circuit.h" |
45 | #include "isisd/isis_csm.h" | |
eb5d44eb | 46 | #include "isisd/isisd.h" |
47 | #include "isisd/isis_dynhn.h" | |
48 | #include "isisd/isis_adjacency.h" | |
49 | #include "isisd/isis_pdu.h" | |
50 | #include "isisd/isis_misc.h" | |
51 | #include "isisd/isis_constants.h" | |
eb5d44eb | 52 | #include "isisd/isis_lsp.h" |
53 | #include "isisd/isis_spf.h" | |
54 | #include "isisd/isis_route.h" | |
55 | #include "isisd/isis_zebra.h" | |
56 | #include "isisd/isis_events.h" | |
f8c06e2c | 57 | #include "isisd/isis_te.h" |
064f4896 | 58 | #include "isisd/isis_mt.h" |
eb5d44eb | 59 | |
eb5d44eb | 60 | struct isis *isis = NULL; |
eb5d44eb | 61 | |
676a4ea3 DL |
62 | DEFINE_QOBJ_TYPE(isis) |
63 | DEFINE_QOBJ_TYPE(isis_area) | |
64 | ||
41b36e90 PJ |
65 | /* |
66 | * Prototypes. | |
67 | */ | |
41b36e90 PJ |
68 | int isis_area_get(struct vty *, const char *); |
69 | int isis_area_destroy(struct vty *, const char *); | |
3f045a08 JB |
70 | int area_net_title(struct vty *, const char *); |
71 | int area_clear_net_title(struct vty *, const char *); | |
72 | int show_isis_interface_common(struct vty *, const char *ifname, char); | |
73 | int show_isis_neighbor_common(struct vty *, const char *id, char); | |
74 | int clear_isis_neighbor_common(struct vty *, const char *id); | |
41b36e90 PJ |
75 | int isis_config_write(struct vty *); |
76 | ||
77 | ||
d62a17ae | 78 | void isis_new(unsigned long process_id) |
79 | { | |
80 | isis = XCALLOC(MTYPE_ISIS, sizeof(struct isis)); | |
81 | /* | |
82 | * Default values | |
83 | */ | |
84 | isis->max_area_addrs = 3; | |
85 | isis->process_id = process_id; | |
86 | isis->router_id = 0; | |
87 | isis->area_list = list_new(); | |
88 | isis->init_circ_list = list_new(); | |
89 | isis->uptime = time(NULL); | |
90 | isis->nexthops = list_new(); | |
91 | isis->nexthops6 = list_new(); | |
92 | dyn_cache_init(); | |
93 | /* | |
94 | * uncomment the next line for full debugs | |
95 | */ | |
96 | /* isis->debugs = 0xFFFF; */ | |
97 | isisMplsTE.status = disable; /* Only support TE metric */ | |
98 | QOBJ_REG(isis, isis); | |
99 | } | |
100 | ||
101 | struct isis_area *isis_area_create(const char *area_tag) | |
102 | { | |
103 | struct isis_area *area; | |
104 | ||
105 | area = XCALLOC(MTYPE_ISIS_AREA, sizeof(struct isis_area)); | |
106 | ||
107 | /* | |
108 | * The first instance is level-1-2 rest are level-1, unless otherwise | |
109 | * configured | |
110 | */ | |
111 | if (listcount(isis->area_list) > 0) | |
112 | area->is_type = IS_LEVEL_1; | |
113 | else | |
114 | area->is_type = IS_LEVEL_1_AND_2; | |
115 | ||
116 | /* | |
117 | * intialize the databases | |
118 | */ | |
119 | if (area->is_type & IS_LEVEL_1) { | |
120 | area->lspdb[0] = lsp_db_init(); | |
121 | area->route_table[0] = route_table_init(); | |
122 | area->route_table6[0] = route_table_init(); | |
123 | } | |
124 | if (area->is_type & IS_LEVEL_2) { | |
125 | area->lspdb[1] = lsp_db_init(); | |
126 | area->route_table[1] = route_table_init(); | |
127 | area->route_table6[1] = route_table_init(); | |
128 | } | |
129 | ||
130 | spftree_area_init(area); | |
131 | ||
132 | area->circuit_list = list_new(); | |
133 | area->area_addrs = list_new(); | |
134 | thread_add_timer(master, lsp_tick, area, 1, &area->t_tick); | |
135 | flags_initialize(&area->flags); | |
136 | ||
137 | /* | |
138 | * Default values | |
139 | */ | |
140 | area->max_lsp_lifetime[0] = DEFAULT_LSP_LIFETIME; /* 1200 */ | |
141 | area->max_lsp_lifetime[1] = DEFAULT_LSP_LIFETIME; /* 1200 */ | |
142 | area->lsp_refresh[0] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */ | |
143 | area->lsp_refresh[1] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */ | |
144 | area->lsp_gen_interval[0] = DEFAULT_MIN_LSP_GEN_INTERVAL; | |
145 | area->lsp_gen_interval[1] = DEFAULT_MIN_LSP_GEN_INTERVAL; | |
146 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; | |
147 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; | |
148 | area->dynhostname = 1; | |
149 | area->oldmetric = 0; | |
150 | area->newmetric = 1; | |
151 | area->lsp_frag_threshold = 90; | |
152 | area->lsp_mtu = DEFAULT_LSP_MTU; | |
153 | ||
154 | area_mt_init(area); | |
41b36e90 | 155 | |
d62a17ae | 156 | area->area_tag = strdup(area_tag); |
157 | listnode_add(isis->area_list, area); | |
158 | area->isis = isis; | |
f390d2c7 | 159 | |
d62a17ae | 160 | QOBJ_REG(area, isis_area); |
eb5d44eb | 161 | |
d62a17ae | 162 | return area; |
163 | } | |
3f045a08 | 164 | |
d62a17ae | 165 | struct isis_area *isis_area_lookup(const char *area_tag) |
166 | { | |
167 | struct isis_area *area; | |
168 | struct listnode *node; | |
3f045a08 | 169 | |
d62a17ae | 170 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) |
171 | if ((area->area_tag == NULL && area_tag == NULL) | |
172 | || (area->area_tag && area_tag | |
173 | && strcmp(area->area_tag, area_tag) == 0)) | |
174 | return area; | |
3f045a08 | 175 | |
d62a17ae | 176 | return NULL; |
177 | } | |
3f045a08 | 178 | |
d62a17ae | 179 | int isis_area_get(struct vty *vty, const char *area_tag) |
180 | { | |
181 | struct isis_area *area; | |
5475ecf7 | 182 | |
d62a17ae | 183 | area = isis_area_lookup(area_tag); |
03f7e182 | 184 | |
d62a17ae | 185 | if (area) { |
186 | VTY_PUSH_CONTEXT(ISIS_NODE, area); | |
187 | return CMD_SUCCESS; | |
188 | } | |
189 | ||
190 | area = isis_area_create(area_tag); | |
3f045a08 | 191 | |
d62a17ae | 192 | if (isis->debugs & DEBUG_EVENTS) |
193 | zlog_debug("New IS-IS area instance %s", area->area_tag); | |
3f045a08 | 194 | |
d62a17ae | 195 | VTY_PUSH_CONTEXT(ISIS_NODE, area); |
f3ccedaa | 196 | |
d62a17ae | 197 | return CMD_SUCCESS; |
198 | } | |
3f045a08 | 199 | |
d62a17ae | 200 | int isis_area_destroy(struct vty *vty, const char *area_tag) |
eb5d44eb | 201 | { |
d62a17ae | 202 | struct isis_area *area; |
203 | struct listnode *node, *nnode; | |
204 | struct isis_circuit *circuit; | |
205 | struct area_addr *addr; | |
eb5d44eb | 206 | |
d62a17ae | 207 | area = isis_area_lookup(area_tag); |
208 | ||
209 | if (area == NULL) { | |
210 | vty_out(vty, "Can't find ISIS instance \n"); | |
211 | return CMD_ERR_NO_MATCH; | |
212 | } | |
213 | ||
214 | QOBJ_UNREG(area); | |
215 | ||
216 | if (area->circuit_list) { | |
217 | for (ALL_LIST_ELEMENTS(area->circuit_list, node, nnode, | |
218 | circuit)) { | |
219 | circuit->ip_router = 0; | |
220 | circuit->ipv6_router = 0; | |
221 | isis_csm_state_change(ISIS_DISABLE, circuit, area); | |
222 | } | |
223 | list_delete(area->circuit_list); | |
224 | area->circuit_list = NULL; | |
225 | } | |
226 | ||
227 | if (area->lspdb[0] != NULL) { | |
228 | lsp_db_destroy(area->lspdb[0]); | |
229 | area->lspdb[0] = NULL; | |
230 | } | |
231 | if (area->lspdb[1] != NULL) { | |
232 | lsp_db_destroy(area->lspdb[1]); | |
233 | area->lspdb[1] = NULL; | |
234 | } | |
235 | ||
236 | spftree_area_del(area); | |
237 | ||
238 | THREAD_TIMER_OFF(area->spf_timer[0]); | |
239 | THREAD_TIMER_OFF(area->spf_timer[1]); | |
240 | ||
241 | spf_backoff_free(area->spf_delay_ietf[0]); | |
242 | spf_backoff_free(area->spf_delay_ietf[1]); | |
243 | ||
244 | /* invalidate and validate would delete all routes from zebra */ | |
245 | isis_route_invalidate(area); | |
246 | isis_route_validate(area); | |
247 | ||
248 | if (area->route_table[0]) { | |
249 | route_table_finish(area->route_table[0]); | |
250 | area->route_table[0] = NULL; | |
251 | } | |
252 | if (area->route_table[1]) { | |
253 | route_table_finish(area->route_table[1]); | |
254 | area->route_table[1] = NULL; | |
255 | } | |
256 | if (area->route_table6[0]) { | |
257 | route_table_finish(area->route_table6[0]); | |
258 | area->route_table6[0] = NULL; | |
259 | } | |
260 | if (area->route_table6[1]) { | |
261 | route_table_finish(area->route_table6[1]); | |
262 | area->route_table6[1] = NULL; | |
263 | } | |
264 | ||
265 | isis_redist_area_finish(area); | |
266 | ||
267 | for (ALL_LIST_ELEMENTS(area->area_addrs, node, nnode, addr)) { | |
268 | list_delete_node(area->area_addrs, node); | |
269 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
270 | } | |
271 | area->area_addrs = NULL; | |
272 | ||
273 | THREAD_TIMER_OFF(area->t_tick); | |
274 | THREAD_TIMER_OFF(area->t_lsp_refresh[0]); | |
275 | THREAD_TIMER_OFF(area->t_lsp_refresh[1]); | |
276 | ||
277 | thread_cancel_event(master, area); | |
278 | ||
279 | listnode_delete(isis->area_list, area); | |
280 | ||
281 | free(area->area_tag); | |
282 | ||
283 | area_mt_finish(area); | |
284 | ||
285 | XFREE(MTYPE_ISIS_AREA, area); | |
286 | ||
287 | if (listcount(isis->area_list) == 0) { | |
288 | memset(isis->sysid, 0, ISIS_SYS_ID_LEN); | |
289 | isis->sysid_set = 0; | |
290 | } | |
291 | ||
292 | return CMD_SUCCESS; | |
293 | } | |
294 | ||
295 | static void area_set_mt_enabled(struct isis_area *area, uint16_t mtid, | |
296 | bool enabled) | |
297 | { | |
298 | struct isis_area_mt_setting *setting; | |
299 | ||
300 | setting = area_get_mt_setting(area, mtid); | |
301 | if (setting->enabled != enabled) { | |
302 | setting->enabled = enabled; | |
303 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0); | |
304 | } | |
305 | } | |
306 | ||
307 | static void area_set_mt_overload(struct isis_area *area, uint16_t mtid, | |
308 | bool overload) | |
309 | { | |
310 | struct isis_area_mt_setting *setting; | |
311 | ||
312 | setting = area_get_mt_setting(area, mtid); | |
313 | if (setting->overload != overload) { | |
314 | setting->overload = overload; | |
315 | if (setting->enabled) | |
316 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, | |
317 | 0); | |
318 | } | |
319 | } | |
320 | ||
321 | int area_net_title(struct vty *vty, const char *net_title) | |
322 | { | |
323 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
324 | struct area_addr *addr; | |
325 | struct area_addr *addrp; | |
326 | struct listnode *node; | |
eb5d44eb | 327 | |
d62a17ae | 328 | u_char buff[255]; |
329 | ||
330 | /* We check that we are not over the maximal number of addresses */ | |
331 | if (listcount(area->area_addrs) >= isis->max_area_addrs) { | |
332 | vty_out(vty, | |
333 | "Maximum of area addresses (%d) already reached \n", | |
334 | isis->max_area_addrs); | |
335 | return CMD_ERR_NOTHING_TODO; | |
336 | } | |
337 | ||
338 | addr = XMALLOC(MTYPE_ISIS_AREA_ADDR, sizeof(struct area_addr)); | |
339 | addr->addr_len = dotformat2buff(buff, net_title); | |
340 | memcpy(addr->area_addr, buff, addr->addr_len); | |
eb5d44eb | 341 | #ifdef EXTREME_DEBUG |
d62a17ae | 342 | zlog_debug("added area address %s for area %s (address length %d)", |
343 | net_title, area->area_tag, addr->addr_len); | |
eb5d44eb | 344 | #endif /* EXTREME_DEBUG */ |
d62a17ae | 345 | if (addr->addr_len < 8 || addr->addr_len > 20) { |
346 | vty_out(vty, | |
347 | "area address must be at least 8..20 octets long (%d)\n", | |
348 | addr->addr_len); | |
349 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
350 | return CMD_ERR_AMBIGUOUS; | |
351 | } | |
352 | ||
353 | if (addr->area_addr[addr->addr_len - 1] != 0) { | |
354 | vty_out(vty, | |
355 | "nsel byte (last byte) in area address must be 0\n"); | |
356 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
357 | return CMD_ERR_AMBIGUOUS; | |
358 | } | |
359 | ||
360 | if (isis->sysid_set == 0) { | |
361 | /* | |
362 | * First area address - get the SystemID for this router | |
363 | */ | |
364 | memcpy(isis->sysid, GETSYSID(addr), ISIS_SYS_ID_LEN); | |
365 | isis->sysid_set = 1; | |
366 | if (isis->debugs & DEBUG_EVENTS) | |
367 | zlog_debug("Router has SystemID %s", | |
368 | sysid_print(isis->sysid)); | |
369 | } else { | |
370 | /* | |
371 | * Check that the SystemID portions match | |
372 | */ | |
373 | if (memcmp(isis->sysid, GETSYSID(addr), ISIS_SYS_ID_LEN)) { | |
374 | vty_out(vty, | |
375 | "System ID must not change when defining additional area addresses\n"); | |
376 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
377 | return CMD_ERR_AMBIGUOUS; | |
378 | } | |
379 | ||
380 | /* now we see that we don't already have this address */ | |
381 | for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node, addrp)) { | |
382 | if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN) | |
383 | != (addr->addr_len)) | |
384 | continue; | |
385 | if (!memcmp(addrp->area_addr, addr->area_addr, | |
386 | addr->addr_len)) { | |
387 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
388 | return CMD_SUCCESS; /* silent fail */ | |
389 | } | |
390 | } | |
391 | } | |
392 | ||
393 | /* | |
394 | * Forget the systemID part of the address | |
395 | */ | |
396 | addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN); | |
397 | listnode_add(area->area_addrs, addr); | |
398 | ||
399 | /* only now we can safely generate our LSPs for this area */ | |
400 | if (listcount(area->area_addrs) > 0) { | |
401 | if (area->is_type & IS_LEVEL_1) | |
402 | lsp_generate(area, IS_LEVEL_1); | |
403 | if (area->is_type & IS_LEVEL_2) | |
404 | lsp_generate(area, IS_LEVEL_2); | |
405 | } | |
406 | ||
407 | return CMD_SUCCESS; | |
408 | } | |
409 | ||
410 | int area_clear_net_title(struct vty *vty, const char *net_title) | |
411 | { | |
412 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
413 | struct area_addr addr, *addrp = NULL; | |
414 | struct listnode *node; | |
415 | u_char buff[255]; | |
416 | ||
417 | addr.addr_len = dotformat2buff(buff, net_title); | |
418 | if (addr.addr_len < 8 || addr.addr_len > 20) { | |
419 | vty_out(vty, | |
420 | "Unsupported area address length %d, should be 8...20 \n", | |
421 | addr.addr_len); | |
422 | return CMD_ERR_AMBIGUOUS; | |
423 | } | |
424 | ||
425 | memcpy(addr.area_addr, buff, (int)addr.addr_len); | |
426 | ||
427 | for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node, addrp)) | |
428 | if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len | |
429 | && !memcmp(addrp->area_addr, addr.area_addr, addr.addr_len)) | |
430 | break; | |
431 | ||
432 | if (!addrp) { | |
433 | vty_out(vty, "No area address %s for area %s \n", net_title, | |
434 | area->area_tag); | |
435 | return CMD_ERR_NO_MATCH; | |
436 | } | |
437 | ||
438 | listnode_delete(area->area_addrs, addrp); | |
439 | XFREE(MTYPE_ISIS_AREA_ADDR, addrp); | |
440 | ||
441 | /* | |
442 | * Last area address - reset the SystemID for this router | |
443 | */ | |
444 | if (listcount(area->area_addrs) == 0) { | |
445 | memset(isis->sysid, 0, ISIS_SYS_ID_LEN); | |
446 | isis->sysid_set = 0; | |
447 | if (isis->debugs & DEBUG_EVENTS) | |
448 | zlog_debug("Router has no SystemID"); | |
449 | } | |
450 | ||
451 | return CMD_SUCCESS; | |
eb5d44eb | 452 | } |
453 | ||
eb5d44eb | 454 | /* |
3f045a08 | 455 | * 'show isis interface' command |
eb5d44eb | 456 | */ |
457 | ||
d62a17ae | 458 | int show_isis_interface_common(struct vty *vty, const char *ifname, char detail) |
eb5d44eb | 459 | { |
d62a17ae | 460 | struct listnode *anode, *cnode; |
461 | struct isis_area *area; | |
462 | struct isis_circuit *circuit; | |
eb5d44eb | 463 | |
d62a17ae | 464 | if (!isis) { |
465 | vty_out(vty, "IS-IS Routing Process not enabled\n"); | |
466 | return CMD_SUCCESS; | |
467 | } | |
eb5d44eb | 468 | |
d62a17ae | 469 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) { |
470 | vty_out(vty, "Area %s:\n", area->area_tag); | |
f390d2c7 | 471 | |
d62a17ae | 472 | if (detail == ISIS_UI_LEVEL_BRIEF) |
473 | vty_out(vty, | |
474 | " Interface CircId State Type Level\n"); | |
f390d2c7 | 475 | |
d62a17ae | 476 | for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) |
477 | if (!ifname) | |
478 | isis_circuit_print_vty(circuit, vty, detail); | |
479 | else if (strcmp(circuit->interface->name, ifname) == 0) | |
480 | isis_circuit_print_vty(circuit, vty, detail); | |
481 | } | |
f390d2c7 | 482 | |
d62a17ae | 483 | return CMD_SUCCESS; |
eb5d44eb | 484 | } |
485 | ||
3f045a08 JB |
486 | DEFUN (show_isis_interface, |
487 | show_isis_interface_cmd, | |
488 | "show isis interface", | |
eb5d44eb | 489 | SHOW_STR |
3f045a08 JB |
490 | "ISIS network information\n" |
491 | "ISIS interface\n") | |
eb5d44eb | 492 | { |
d62a17ae | 493 | return show_isis_interface_common(vty, NULL, ISIS_UI_LEVEL_BRIEF); |
eb5d44eb | 494 | } |
495 | ||
3f045a08 JB |
496 | DEFUN (show_isis_interface_detail, |
497 | show_isis_interface_detail_cmd, | |
498 | "show isis interface detail", | |
eb5d44eb | 499 | SHOW_STR |
3f045a08 JB |
500 | "ISIS network information\n" |
501 | "ISIS interface\n" | |
502 | "show detailed information\n") | |
503 | { | |
d62a17ae | 504 | return show_isis_interface_common(vty, NULL, ISIS_UI_LEVEL_DETAIL); |
3f045a08 | 505 | } |
eb5d44eb | 506 | |
3f045a08 JB |
507 | DEFUN (show_isis_interface_arg, |
508 | show_isis_interface_arg_cmd, | |
509 | "show isis interface WORD", | |
eb5d44eb | 510 | SHOW_STR |
3f045a08 JB |
511 | "ISIS network information\n" |
512 | "ISIS interface\n" | |
513 | "ISIS interface name\n") | |
514 | { | |
d62a17ae | 515 | int idx_word = 3; |
516 | return show_isis_interface_common(vty, argv[idx_word]->arg, | |
517 | ISIS_UI_LEVEL_DETAIL); | |
3f045a08 JB |
518 | } |
519 | ||
520 | /* | |
521 | * 'show isis neighbor' command | |
522 | */ | |
523 | ||
d62a17ae | 524 | int show_isis_neighbor_common(struct vty *vty, const char *id, char detail) |
525 | { | |
526 | struct listnode *anode, *cnode, *node; | |
527 | struct isis_area *area; | |
528 | struct isis_circuit *circuit; | |
529 | struct list *adjdb; | |
530 | struct isis_adjacency *adj; | |
531 | struct isis_dynhn *dynhn; | |
532 | u_char sysid[ISIS_SYS_ID_LEN]; | |
533 | int i; | |
534 | ||
535 | if (!isis) { | |
536 | vty_out(vty, "IS-IS Routing Process not enabled\n"); | |
537 | return CMD_SUCCESS; | |
538 | } | |
539 | ||
540 | memset(sysid, 0, ISIS_SYS_ID_LEN); | |
541 | if (id) { | |
542 | if (sysid2buff(sysid, id) == 0) { | |
543 | dynhn = dynhn_find_by_name(id); | |
544 | if (dynhn == NULL) { | |
545 | vty_out(vty, "Invalid system id %s\n", id); | |
546 | return CMD_SUCCESS; | |
547 | } | |
548 | memcpy(sysid, dynhn->id, ISIS_SYS_ID_LEN); | |
549 | } | |
550 | } | |
551 | ||
552 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) { | |
553 | vty_out(vty, "Area %s:\n", area->area_tag); | |
554 | ||
555 | if (detail == ISIS_UI_LEVEL_BRIEF) | |
556 | vty_out(vty, | |
557 | " System Id Interface L State Holdtime SNPA\n"); | |
558 | ||
559 | for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) { | |
560 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) { | |
561 | for (i = 0; i < 2; i++) { | |
562 | adjdb = circuit->u.bc.adjdb[i]; | |
563 | if (adjdb && adjdb->count) { | |
564 | for (ALL_LIST_ELEMENTS_RO( | |
565 | adjdb, node, adj)) | |
566 | if (!id | |
567 | || !memcmp(adj->sysid, | |
568 | sysid, | |
569 | ISIS_SYS_ID_LEN)) | |
570 | isis_adj_print_vty( | |
571 | adj, | |
572 | vty, | |
573 | detail); | |
574 | } | |
575 | } | |
576 | } else if (circuit->circ_type == CIRCUIT_T_P2P | |
577 | && circuit->u.p2p.neighbor) { | |
578 | adj = circuit->u.p2p.neighbor; | |
579 | if (!id | |
580 | || !memcmp(adj->sysid, sysid, | |
581 | ISIS_SYS_ID_LEN)) | |
582 | isis_adj_print_vty(adj, vty, detail); | |
583 | } | |
584 | } | |
585 | } | |
586 | ||
587 | return CMD_SUCCESS; | |
3f045a08 JB |
588 | } |
589 | ||
590 | /* | |
591 | * 'clear isis neighbor' command | |
592 | */ | |
d62a17ae | 593 | int clear_isis_neighbor_common(struct vty *vty, const char *id) |
594 | { | |
595 | struct listnode *anode, *cnode, *cnextnode, *node, *nnode; | |
596 | struct isis_area *area; | |
597 | struct isis_circuit *circuit; | |
598 | struct list *adjdb; | |
599 | struct isis_adjacency *adj; | |
600 | struct isis_dynhn *dynhn; | |
601 | u_char sysid[ISIS_SYS_ID_LEN]; | |
602 | int i; | |
603 | ||
604 | if (!isis) { | |
605 | vty_out(vty, "IS-IS Routing Process not enabled\n"); | |
606 | return CMD_SUCCESS; | |
607 | } | |
608 | ||
609 | memset(sysid, 0, ISIS_SYS_ID_LEN); | |
610 | if (id) { | |
611 | if (sysid2buff(sysid, id) == 0) { | |
612 | dynhn = dynhn_find_by_name(id); | |
613 | if (dynhn == NULL) { | |
614 | vty_out(vty, "Invalid system id %s\n", id); | |
615 | return CMD_SUCCESS; | |
616 | } | |
617 | memcpy(sysid, dynhn->id, ISIS_SYS_ID_LEN); | |
618 | } | |
619 | } | |
620 | ||
621 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) { | |
622 | for (ALL_LIST_ELEMENTS(area->circuit_list, cnode, cnextnode, | |
623 | circuit)) { | |
624 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) { | |
625 | for (i = 0; i < 2; i++) { | |
626 | adjdb = circuit->u.bc.adjdb[i]; | |
627 | if (adjdb && adjdb->count) { | |
628 | for (ALL_LIST_ELEMENTS( | |
629 | adjdb, node, nnode, | |
630 | adj)) | |
631 | if (!id | |
632 | || !memcmp(adj->sysid, | |
633 | sysid, | |
634 | ISIS_SYS_ID_LEN)) | |
635 | isis_adj_state_change( | |
636 | adj, | |
637 | ISIS_ADJ_DOWN, | |
638 | "clear user request"); | |
639 | } | |
640 | } | |
641 | } else if (circuit->circ_type == CIRCUIT_T_P2P | |
642 | && circuit->u.p2p.neighbor) { | |
643 | adj = circuit->u.p2p.neighbor; | |
644 | if (!id | |
645 | || !memcmp(adj->sysid, sysid, | |
646 | ISIS_SYS_ID_LEN)) | |
647 | isis_adj_state_change( | |
648 | adj, ISIS_ADJ_DOWN, | |
649 | "clear user request"); | |
650 | } | |
651 | } | |
652 | } | |
653 | ||
654 | return CMD_SUCCESS; | |
3f045a08 JB |
655 | } |
656 | ||
657 | DEFUN (show_isis_neighbor, | |
658 | show_isis_neighbor_cmd, | |
659 | "show isis neighbor", | |
660 | SHOW_STR | |
661 | "ISIS network information\n" | |
662 | "ISIS neighbor adjacencies\n") | |
eb5d44eb | 663 | { |
d62a17ae | 664 | return show_isis_neighbor_common(vty, NULL, ISIS_UI_LEVEL_BRIEF); |
eb5d44eb | 665 | } |
666 | ||
3f045a08 JB |
667 | DEFUN (show_isis_neighbor_detail, |
668 | show_isis_neighbor_detail_cmd, | |
669 | "show isis neighbor detail", | |
eb5d44eb | 670 | SHOW_STR |
3f045a08 JB |
671 | "ISIS network information\n" |
672 | "ISIS neighbor adjacencies\n" | |
eb5d44eb | 673 | "show detailed information\n") |
3f045a08 | 674 | { |
d62a17ae | 675 | return show_isis_neighbor_common(vty, NULL, ISIS_UI_LEVEL_DETAIL); |
3f045a08 JB |
676 | } |
677 | ||
678 | DEFUN (show_isis_neighbor_arg, | |
679 | show_isis_neighbor_arg_cmd, | |
680 | "show isis neighbor WORD", | |
681 | SHOW_STR | |
682 | "ISIS network information\n" | |
683 | "ISIS neighbor adjacencies\n" | |
684 | "System id\n") | |
685 | { | |
d62a17ae | 686 | int idx_word = 3; |
687 | return show_isis_neighbor_common(vty, argv[idx_word]->arg, | |
688 | ISIS_UI_LEVEL_DETAIL); | |
3f045a08 JB |
689 | } |
690 | ||
691 | DEFUN (clear_isis_neighbor, | |
692 | clear_isis_neighbor_cmd, | |
693 | "clear isis neighbor", | |
694 | CLEAR_STR | |
695 | "Reset ISIS network information\n" | |
696 | "Reset ISIS neighbor adjacencies\n") | |
697 | { | |
d62a17ae | 698 | return clear_isis_neighbor_common(vty, NULL); |
3f045a08 JB |
699 | } |
700 | ||
701 | DEFUN (clear_isis_neighbor_arg, | |
702 | clear_isis_neighbor_arg_cmd, | |
e38e0df0 | 703 | "clear isis neighbor WORD", |
3f045a08 JB |
704 | CLEAR_STR |
705 | "ISIS network information\n" | |
706 | "ISIS neighbor adjacencies\n" | |
707 | "System id\n") | |
708 | { | |
d62a17ae | 709 | int idx_word = 3; |
710 | return clear_isis_neighbor_common(vty, argv[idx_word]->arg); | |
3f045a08 JB |
711 | } |
712 | ||
eb5d44eb | 713 | /* |
714 | * 'isis debug', 'show debugging' | |
715 | */ | |
d62a17ae | 716 | void print_debug(struct vty *vty, int flags, int onoff) |
717 | { | |
718 | char onoffs[4]; | |
719 | if (onoff) | |
720 | strcpy(onoffs, "on"); | |
721 | else | |
722 | strcpy(onoffs, "off"); | |
723 | ||
724 | if (flags & DEBUG_ADJ_PACKETS) | |
725 | vty_out(vty, | |
726 | "IS-IS Adjacency related packets debugging is %s\n", | |
727 | onoffs); | |
728 | if (flags & DEBUG_CHECKSUM_ERRORS) | |
729 | vty_out(vty, "IS-IS checksum errors debugging is %s\n", onoffs); | |
730 | if (flags & DEBUG_LOCAL_UPDATES) | |
731 | vty_out(vty, "IS-IS local updates debugging is %s\n", onoffs); | |
732 | if (flags & DEBUG_PROTOCOL_ERRORS) | |
733 | vty_out(vty, "IS-IS protocol errors debugging is %s\n", onoffs); | |
734 | if (flags & DEBUG_SNP_PACKETS) | |
735 | vty_out(vty, "IS-IS CSNP/PSNP packets debugging is %s\n", | |
736 | onoffs); | |
737 | if (flags & DEBUG_SPF_EVENTS) | |
738 | vty_out(vty, "IS-IS SPF events debugging is %s\n", onoffs); | |
739 | if (flags & DEBUG_SPF_STATS) | |
740 | vty_out(vty, | |
741 | "IS-IS SPF Timing and Statistics Data debugging is %s\n", | |
742 | onoffs); | |
743 | if (flags & DEBUG_SPF_TRIGGERS) | |
744 | vty_out(vty, "IS-IS SPF triggering events debugging is %s\n", | |
745 | onoffs); | |
746 | if (flags & DEBUG_UPDATE_PACKETS) | |
747 | vty_out(vty, "IS-IS Update related packet debugging is %s\n", | |
748 | onoffs); | |
749 | if (flags & DEBUG_RTE_EVENTS) | |
750 | vty_out(vty, "IS-IS Route related debuggin is %s\n", onoffs); | |
751 | if (flags & DEBUG_EVENTS) | |
752 | vty_out(vty, "IS-IS Event debugging is %s\n", onoffs); | |
753 | if (flags & DEBUG_PACKET_DUMP) | |
754 | vty_out(vty, "IS-IS Packet dump debugging is %s\n", onoffs); | |
755 | if (flags & DEBUG_LSP_GEN) | |
756 | vty_out(vty, "IS-IS LSP generation debugging is %s\n", onoffs); | |
757 | if (flags & DEBUG_LSP_SCHED) | |
758 | vty_out(vty, "IS-IS LSP scheduling debugging is %s\n", onoffs); | |
eb5d44eb | 759 | } |
760 | ||
87f6dc50 DS |
761 | DEFUN_NOSH (show_debugging, |
762 | show_debugging_isis_cmd, | |
763 | "show debugging [isis]", | |
764 | SHOW_STR | |
765 | "State of each debugging option\n" | |
766 | ISIS_STR) | |
eb5d44eb | 767 | { |
87f6dc50 DS |
768 | vty_out (vty, "IS-IS debugging status:\n"); |
769 | ||
770 | if (isis->debugs) | |
d62a17ae | 771 | print_debug(vty, isis->debugs, 1); |
87f6dc50 | 772 | |
d62a17ae | 773 | return CMD_SUCCESS; |
eb5d44eb | 774 | } |
775 | ||
9e867fe6 | 776 | /* Debug node. */ |
d62a17ae | 777 | static struct cmd_node debug_node = {DEBUG_NODE, "", 1}; |
778 | ||
779 | static int config_write_debug(struct vty *vty) | |
780 | { | |
781 | int write = 0; | |
782 | int flags = isis->debugs; | |
783 | ||
784 | if (flags & DEBUG_ADJ_PACKETS) { | |
785 | vty_out(vty, "debug isis adj-packets\n"); | |
786 | write++; | |
787 | } | |
788 | if (flags & DEBUG_CHECKSUM_ERRORS) { | |
789 | vty_out(vty, "debug isis checksum-errors\n"); | |
790 | write++; | |
791 | } | |
792 | if (flags & DEBUG_LOCAL_UPDATES) { | |
793 | vty_out(vty, "debug isis local-updates\n"); | |
794 | write++; | |
795 | } | |
796 | if (flags & DEBUG_PROTOCOL_ERRORS) { | |
797 | vty_out(vty, "debug isis protocol-errors\n"); | |
798 | write++; | |
799 | } | |
800 | if (flags & DEBUG_SNP_PACKETS) { | |
801 | vty_out(vty, "debug isis snp-packets\n"); | |
802 | write++; | |
803 | } | |
804 | if (flags & DEBUG_SPF_EVENTS) { | |
805 | vty_out(vty, "debug isis spf-events\n"); | |
806 | write++; | |
807 | } | |
808 | if (flags & DEBUG_SPF_STATS) { | |
809 | vty_out(vty, "debug isis spf-statistics\n"); | |
810 | write++; | |
811 | } | |
812 | if (flags & DEBUG_SPF_TRIGGERS) { | |
813 | vty_out(vty, "debug isis spf-triggers\n"); | |
814 | write++; | |
815 | } | |
816 | if (flags & DEBUG_UPDATE_PACKETS) { | |
817 | vty_out(vty, "debug isis update-packets\n"); | |
818 | write++; | |
819 | } | |
820 | if (flags & DEBUG_RTE_EVENTS) { | |
821 | vty_out(vty, "debug isis route-events\n"); | |
822 | write++; | |
823 | } | |
824 | if (flags & DEBUG_EVENTS) { | |
825 | vty_out(vty, "debug isis events\n"); | |
826 | write++; | |
827 | } | |
828 | if (flags & DEBUG_PACKET_DUMP) { | |
829 | vty_out(vty, "debug isis packet-dump\n"); | |
830 | write++; | |
831 | } | |
832 | if (flags & DEBUG_LSP_GEN) { | |
833 | vty_out(vty, "debug isis lsp-gen\n"); | |
834 | write++; | |
835 | } | |
836 | if (flags & DEBUG_LSP_SCHED) { | |
837 | vty_out(vty, "debug isis lsp-sched\n"); | |
838 | write++; | |
839 | } | |
840 | write += spf_backoff_write_config(vty); | |
841 | ||
842 | return write; | |
9e867fe6 | 843 | } |
844 | ||
eb5d44eb | 845 | DEFUN (debug_isis_adj, |
846 | debug_isis_adj_cmd, | |
847 | "debug isis adj-packets", | |
848 | DEBUG_STR | |
849 | "IS-IS information\n" | |
f390d2c7 | 850 | "IS-IS Adjacency related packets\n") |
eb5d44eb | 851 | { |
d62a17ae | 852 | isis->debugs |= DEBUG_ADJ_PACKETS; |
853 | print_debug(vty, DEBUG_ADJ_PACKETS, 1); | |
eb5d44eb | 854 | |
d62a17ae | 855 | return CMD_SUCCESS; |
eb5d44eb | 856 | } |
857 | ||
858 | DEFUN (no_debug_isis_adj, | |
859 | no_debug_isis_adj_cmd, | |
860 | "no debug isis adj-packets", | |
16cedbb0 | 861 | NO_STR |
eb5d44eb | 862 | UNDEBUG_STR |
863 | "IS-IS information\n" | |
f390d2c7 | 864 | "IS-IS Adjacency related packets\n") |
eb5d44eb | 865 | { |
d62a17ae | 866 | isis->debugs &= ~DEBUG_ADJ_PACKETS; |
867 | print_debug(vty, DEBUG_ADJ_PACKETS, 0); | |
eb5d44eb | 868 | |
d62a17ae | 869 | return CMD_SUCCESS; |
eb5d44eb | 870 | } |
871 | ||
eb5d44eb | 872 | DEFUN (debug_isis_csum, |
873 | debug_isis_csum_cmd, | |
874 | "debug isis checksum-errors", | |
875 | DEBUG_STR | |
876 | "IS-IS information\n" | |
f390d2c7 | 877 | "IS-IS LSP checksum errors\n") |
eb5d44eb | 878 | { |
d62a17ae | 879 | isis->debugs |= DEBUG_CHECKSUM_ERRORS; |
880 | print_debug(vty, DEBUG_CHECKSUM_ERRORS, 1); | |
eb5d44eb | 881 | |
d62a17ae | 882 | return CMD_SUCCESS; |
eb5d44eb | 883 | } |
884 | ||
885 | DEFUN (no_debug_isis_csum, | |
886 | no_debug_isis_csum_cmd, | |
887 | "no debug isis checksum-errors", | |
16cedbb0 | 888 | NO_STR |
eb5d44eb | 889 | UNDEBUG_STR |
890 | "IS-IS information\n" | |
f390d2c7 | 891 | "IS-IS LSP checksum errors\n") |
eb5d44eb | 892 | { |
d62a17ae | 893 | isis->debugs &= ~DEBUG_CHECKSUM_ERRORS; |
894 | print_debug(vty, DEBUG_CHECKSUM_ERRORS, 0); | |
f390d2c7 | 895 | |
d62a17ae | 896 | return CMD_SUCCESS; |
eb5d44eb | 897 | } |
898 | ||
899 | DEFUN (debug_isis_lupd, | |
900 | debug_isis_lupd_cmd, | |
901 | "debug isis local-updates", | |
902 | DEBUG_STR | |
903 | "IS-IS information\n" | |
f390d2c7 | 904 | "IS-IS local update packets\n") |
eb5d44eb | 905 | { |
d62a17ae | 906 | isis->debugs |= DEBUG_LOCAL_UPDATES; |
907 | print_debug(vty, DEBUG_LOCAL_UPDATES, 1); | |
eb5d44eb | 908 | |
d62a17ae | 909 | return CMD_SUCCESS; |
eb5d44eb | 910 | } |
911 | ||
912 | DEFUN (no_debug_isis_lupd, | |
913 | no_debug_isis_lupd_cmd, | |
914 | "no debug isis local-updates", | |
16cedbb0 | 915 | NO_STR |
eb5d44eb | 916 | UNDEBUG_STR |
917 | "IS-IS information\n" | |
f390d2c7 | 918 | "IS-IS local update packets\n") |
eb5d44eb | 919 | { |
d62a17ae | 920 | isis->debugs &= ~DEBUG_LOCAL_UPDATES; |
921 | print_debug(vty, DEBUG_LOCAL_UPDATES, 0); | |
f390d2c7 | 922 | |
d62a17ae | 923 | return CMD_SUCCESS; |
eb5d44eb | 924 | } |
925 | ||
926 | DEFUN (debug_isis_err, | |
927 | debug_isis_err_cmd, | |
f390d2c7 | 928 | "debug isis protocol-errors", |
eb5d44eb | 929 | DEBUG_STR |
930 | "IS-IS information\n" | |
f390d2c7 | 931 | "IS-IS LSP protocol errors\n") |
eb5d44eb | 932 | { |
d62a17ae | 933 | isis->debugs |= DEBUG_PROTOCOL_ERRORS; |
934 | print_debug(vty, DEBUG_PROTOCOL_ERRORS, 1); | |
eb5d44eb | 935 | |
d62a17ae | 936 | return CMD_SUCCESS; |
eb5d44eb | 937 | } |
938 | ||
939 | DEFUN (no_debug_isis_err, | |
940 | no_debug_isis_err_cmd, | |
941 | "no debug isis protocol-errors", | |
16cedbb0 | 942 | NO_STR |
eb5d44eb | 943 | UNDEBUG_STR |
944 | "IS-IS information\n" | |
f390d2c7 | 945 | "IS-IS LSP protocol errors\n") |
eb5d44eb | 946 | { |
d62a17ae | 947 | isis->debugs &= ~DEBUG_PROTOCOL_ERRORS; |
948 | print_debug(vty, DEBUG_PROTOCOL_ERRORS, 0); | |
f390d2c7 | 949 | |
d62a17ae | 950 | return CMD_SUCCESS; |
eb5d44eb | 951 | } |
952 | ||
953 | DEFUN (debug_isis_snp, | |
954 | debug_isis_snp_cmd, | |
955 | "debug isis snp-packets", | |
956 | DEBUG_STR | |
957 | "IS-IS information\n" | |
f390d2c7 | 958 | "IS-IS CSNP/PSNP packets\n") |
eb5d44eb | 959 | { |
d62a17ae | 960 | isis->debugs |= DEBUG_SNP_PACKETS; |
961 | print_debug(vty, DEBUG_SNP_PACKETS, 1); | |
eb5d44eb | 962 | |
d62a17ae | 963 | return CMD_SUCCESS; |
eb5d44eb | 964 | } |
965 | ||
966 | DEFUN (no_debug_isis_snp, | |
967 | no_debug_isis_snp_cmd, | |
968 | "no debug isis snp-packets", | |
16cedbb0 | 969 | NO_STR |
eb5d44eb | 970 | UNDEBUG_STR |
971 | "IS-IS information\n" | |
f390d2c7 | 972 | "IS-IS CSNP/PSNP packets\n") |
eb5d44eb | 973 | { |
d62a17ae | 974 | isis->debugs &= ~DEBUG_SNP_PACKETS; |
975 | print_debug(vty, DEBUG_SNP_PACKETS, 0); | |
f390d2c7 | 976 | |
d62a17ae | 977 | return CMD_SUCCESS; |
eb5d44eb | 978 | } |
979 | ||
eb5d44eb | 980 | DEFUN (debug_isis_upd, |
981 | debug_isis_upd_cmd, | |
982 | "debug isis update-packets", | |
983 | DEBUG_STR | |
984 | "IS-IS information\n" | |
f390d2c7 | 985 | "IS-IS Update related packets\n") |
eb5d44eb | 986 | { |
d62a17ae | 987 | isis->debugs |= DEBUG_UPDATE_PACKETS; |
988 | print_debug(vty, DEBUG_UPDATE_PACKETS, 1); | |
eb5d44eb | 989 | |
d62a17ae | 990 | return CMD_SUCCESS; |
eb5d44eb | 991 | } |
992 | ||
993 | DEFUN (no_debug_isis_upd, | |
994 | no_debug_isis_upd_cmd, | |
995 | "no debug isis update-packets", | |
16cedbb0 | 996 | NO_STR |
eb5d44eb | 997 | UNDEBUG_STR |
998 | "IS-IS information\n" | |
f390d2c7 | 999 | "IS-IS Update related packets\n") |
eb5d44eb | 1000 | { |
d62a17ae | 1001 | isis->debugs &= ~DEBUG_UPDATE_PACKETS; |
1002 | print_debug(vty, DEBUG_UPDATE_PACKETS, 0); | |
f390d2c7 | 1003 | |
d62a17ae | 1004 | return CMD_SUCCESS; |
eb5d44eb | 1005 | } |
1006 | ||
eb5d44eb | 1007 | DEFUN (debug_isis_spfevents, |
1008 | debug_isis_spfevents_cmd, | |
1009 | "debug isis spf-events", | |
1010 | DEBUG_STR | |
1011 | "IS-IS information\n" | |
f390d2c7 | 1012 | "IS-IS Shortest Path First Events\n") |
eb5d44eb | 1013 | { |
d62a17ae | 1014 | isis->debugs |= DEBUG_SPF_EVENTS; |
1015 | print_debug(vty, DEBUG_SPF_EVENTS, 1); | |
eb5d44eb | 1016 | |
d62a17ae | 1017 | return CMD_SUCCESS; |
eb5d44eb | 1018 | } |
1019 | ||
1020 | DEFUN (no_debug_isis_spfevents, | |
1021 | no_debug_isis_spfevents_cmd, | |
1022 | "no debug isis spf-events", | |
16cedbb0 | 1023 | NO_STR |
eb5d44eb | 1024 | UNDEBUG_STR |
1025 | "IS-IS information\n" | |
f390d2c7 | 1026 | "IS-IS Shortest Path First Events\n") |
eb5d44eb | 1027 | { |
d62a17ae | 1028 | isis->debugs &= ~DEBUG_SPF_EVENTS; |
1029 | print_debug(vty, DEBUG_SPF_EVENTS, 0); | |
f390d2c7 | 1030 | |
d62a17ae | 1031 | return CMD_SUCCESS; |
eb5d44eb | 1032 | } |
1033 | ||
eb5d44eb | 1034 | DEFUN (debug_isis_spfstats, |
1035 | debug_isis_spfstats_cmd, | |
1036 | "debug isis spf-statistics ", | |
1037 | DEBUG_STR | |
1038 | "IS-IS information\n" | |
f390d2c7 | 1039 | "IS-IS SPF Timing and Statistic Data\n") |
eb5d44eb | 1040 | { |
d62a17ae | 1041 | isis->debugs |= DEBUG_SPF_STATS; |
1042 | print_debug(vty, DEBUG_SPF_STATS, 1); | |
eb5d44eb | 1043 | |
d62a17ae | 1044 | return CMD_SUCCESS; |
eb5d44eb | 1045 | } |
1046 | ||
1047 | DEFUN (no_debug_isis_spfstats, | |
1048 | no_debug_isis_spfstats_cmd, | |
1049 | "no debug isis spf-statistics", | |
16cedbb0 | 1050 | NO_STR |
eb5d44eb | 1051 | UNDEBUG_STR |
1052 | "IS-IS information\n" | |
f390d2c7 | 1053 | "IS-IS SPF Timing and Statistic Data\n") |
eb5d44eb | 1054 | { |
d62a17ae | 1055 | isis->debugs &= ~DEBUG_SPF_STATS; |
1056 | print_debug(vty, DEBUG_SPF_STATS, 0); | |
f390d2c7 | 1057 | |
d62a17ae | 1058 | return CMD_SUCCESS; |
eb5d44eb | 1059 | } |
1060 | ||
1061 | DEFUN (debug_isis_spftrigg, | |
1062 | debug_isis_spftrigg_cmd, | |
1063 | "debug isis spf-triggers", | |
1064 | DEBUG_STR | |
1065 | "IS-IS information\n" | |
f390d2c7 | 1066 | "IS-IS SPF triggering events\n") |
eb5d44eb | 1067 | { |
d62a17ae | 1068 | isis->debugs |= DEBUG_SPF_TRIGGERS; |
1069 | print_debug(vty, DEBUG_SPF_TRIGGERS, 1); | |
eb5d44eb | 1070 | |
d62a17ae | 1071 | return CMD_SUCCESS; |
eb5d44eb | 1072 | } |
1073 | ||
1074 | DEFUN (no_debug_isis_spftrigg, | |
1075 | no_debug_isis_spftrigg_cmd, | |
1076 | "no debug isis spf-triggers", | |
16cedbb0 | 1077 | NO_STR |
eb5d44eb | 1078 | UNDEBUG_STR |
1079 | "IS-IS information\n" | |
f390d2c7 | 1080 | "IS-IS SPF triggering events\n") |
eb5d44eb | 1081 | { |
d62a17ae | 1082 | isis->debugs &= ~DEBUG_SPF_TRIGGERS; |
1083 | print_debug(vty, DEBUG_SPF_TRIGGERS, 0); | |
f390d2c7 | 1084 | |
d62a17ae | 1085 | return CMD_SUCCESS; |
eb5d44eb | 1086 | } |
1087 | ||
1088 | DEFUN (debug_isis_rtevents, | |
1089 | debug_isis_rtevents_cmd, | |
1090 | "debug isis route-events", | |
1091 | DEBUG_STR | |
1092 | "IS-IS information\n" | |
f390d2c7 | 1093 | "IS-IS Route related events\n") |
eb5d44eb | 1094 | { |
d62a17ae | 1095 | isis->debugs |= DEBUG_RTE_EVENTS; |
1096 | print_debug(vty, DEBUG_RTE_EVENTS, 1); | |
eb5d44eb | 1097 | |
d62a17ae | 1098 | return CMD_SUCCESS; |
eb5d44eb | 1099 | } |
1100 | ||
1101 | DEFUN (no_debug_isis_rtevents, | |
1102 | no_debug_isis_rtevents_cmd, | |
1103 | "no debug isis route-events", | |
16cedbb0 | 1104 | NO_STR |
eb5d44eb | 1105 | UNDEBUG_STR |
1106 | "IS-IS information\n" | |
f390d2c7 | 1107 | "IS-IS Route related events\n") |
eb5d44eb | 1108 | { |
d62a17ae | 1109 | isis->debugs &= ~DEBUG_RTE_EVENTS; |
1110 | print_debug(vty, DEBUG_RTE_EVENTS, 0); | |
f390d2c7 | 1111 | |
d62a17ae | 1112 | return CMD_SUCCESS; |
eb5d44eb | 1113 | } |
1114 | ||
1115 | DEFUN (debug_isis_events, | |
1116 | debug_isis_events_cmd, | |
1117 | "debug isis events", | |
1118 | DEBUG_STR | |
1119 | "IS-IS information\n" | |
f1082d19 | 1120 | "IS-IS Events\n") |
eb5d44eb | 1121 | { |
d62a17ae | 1122 | isis->debugs |= DEBUG_EVENTS; |
1123 | print_debug(vty, DEBUG_EVENTS, 1); | |
eb5d44eb | 1124 | |
d62a17ae | 1125 | return CMD_SUCCESS; |
eb5d44eb | 1126 | } |
1127 | ||
1128 | DEFUN (no_debug_isis_events, | |
1129 | no_debug_isis_events_cmd, | |
1130 | "no debug isis events", | |
16cedbb0 | 1131 | NO_STR |
eb5d44eb | 1132 | UNDEBUG_STR |
1133 | "IS-IS information\n" | |
f390d2c7 | 1134 | "IS-IS Events\n") |
eb5d44eb | 1135 | { |
d62a17ae | 1136 | isis->debugs &= ~DEBUG_EVENTS; |
1137 | print_debug(vty, DEBUG_EVENTS, 0); | |
f390d2c7 | 1138 | |
d62a17ae | 1139 | return CMD_SUCCESS; |
eb5d44eb | 1140 | } |
1141 | ||
3f045a08 JB |
1142 | DEFUN (debug_isis_packet_dump, |
1143 | debug_isis_packet_dump_cmd, | |
1144 | "debug isis packet-dump", | |
1145 | DEBUG_STR | |
1146 | "IS-IS information\n" | |
1147 | "IS-IS packet dump\n") | |
1148 | { | |
d62a17ae | 1149 | isis->debugs |= DEBUG_PACKET_DUMP; |
1150 | print_debug(vty, DEBUG_PACKET_DUMP, 1); | |
3f045a08 | 1151 | |
d62a17ae | 1152 | return CMD_SUCCESS; |
3f045a08 JB |
1153 | } |
1154 | ||
1155 | DEFUN (no_debug_isis_packet_dump, | |
1156 | no_debug_isis_packet_dump_cmd, | |
1157 | "no debug isis packet-dump", | |
16cedbb0 | 1158 | NO_STR |
3f045a08 JB |
1159 | UNDEBUG_STR |
1160 | "IS-IS information\n" | |
1161 | "IS-IS packet dump\n") | |
1162 | { | |
d62a17ae | 1163 | isis->debugs &= ~DEBUG_PACKET_DUMP; |
1164 | print_debug(vty, DEBUG_PACKET_DUMP, 0); | |
3f045a08 | 1165 | |
d62a17ae | 1166 | return CMD_SUCCESS; |
3f045a08 JB |
1167 | } |
1168 | ||
14872644 CF |
1169 | DEFUN (debug_isis_lsp_gen, |
1170 | debug_isis_lsp_gen_cmd, | |
1171 | "debug isis lsp-gen", | |
1172 | DEBUG_STR | |
1173 | "IS-IS information\n" | |
1174 | "IS-IS generation of own LSPs\n") | |
1175 | { | |
d62a17ae | 1176 | isis->debugs |= DEBUG_LSP_GEN; |
1177 | print_debug(vty, DEBUG_LSP_GEN, 1); | |
14872644 | 1178 | |
d62a17ae | 1179 | return CMD_SUCCESS; |
14872644 CF |
1180 | } |
1181 | ||
1182 | DEFUN (no_debug_isis_lsp_gen, | |
1183 | no_debug_isis_lsp_gen_cmd, | |
1184 | "no debug isis lsp-gen", | |
16cedbb0 | 1185 | NO_STR |
14872644 CF |
1186 | UNDEBUG_STR |
1187 | "IS-IS information\n" | |
1188 | "IS-IS generation of own LSPs\n") | |
1189 | { | |
d62a17ae | 1190 | isis->debugs &= ~DEBUG_LSP_GEN; |
1191 | print_debug(vty, DEBUG_LSP_GEN, 0); | |
14872644 | 1192 | |
d62a17ae | 1193 | return CMD_SUCCESS; |
14872644 CF |
1194 | } |
1195 | ||
414766a1 CF |
1196 | DEFUN (debug_isis_lsp_sched, |
1197 | debug_isis_lsp_sched_cmd, | |
1198 | "debug isis lsp-sched", | |
1199 | DEBUG_STR | |
1200 | "IS-IS information\n" | |
1201 | "IS-IS scheduling of LSP generation\n") | |
1202 | { | |
d62a17ae | 1203 | isis->debugs |= DEBUG_LSP_SCHED; |
1204 | print_debug(vty, DEBUG_LSP_SCHED, 1); | |
414766a1 | 1205 | |
d62a17ae | 1206 | return CMD_SUCCESS; |
414766a1 CF |
1207 | } |
1208 | ||
49d41a26 DS |
1209 | DEFUN (no_debug_isis_lsp_sched, |
1210 | no_debug_isis_lsp_sched_cmd, | |
1211 | "no debug isis lsp-sched", | |
16cedbb0 | 1212 | NO_STR |
49d41a26 DS |
1213 | UNDEBUG_STR |
1214 | "IS-IS information\n" | |
1215 | "IS-IS scheduling of LSP generation\n") | |
1216 | { | |
d62a17ae | 1217 | isis->debugs &= ~DEBUG_LSP_SCHED; |
1218 | print_debug(vty, DEBUG_LSP_SCHED, 0); | |
49d41a26 | 1219 | |
d62a17ae | 1220 | return CMD_SUCCESS; |
49d41a26 DS |
1221 | } |
1222 | ||
eb5d44eb | 1223 | DEFUN (show_hostname, |
1224 | show_hostname_cmd, | |
1225 | "show isis hostname", | |
1226 | SHOW_STR | |
1227 | "IS-IS information\n" | |
1228 | "IS-IS Dynamic hostname mapping\n") | |
1229 | { | |
d62a17ae | 1230 | dynhn_print_all(vty); |
f390d2c7 | 1231 | |
d62a17ae | 1232 | return CMD_SUCCESS; |
eb5d44eb | 1233 | } |
1234 | ||
03f7e182 SL |
1235 | DEFUN (show_isis_spf_ietf, |
1236 | show_isis_spf_ietf_cmd, | |
1237 | "show isis spf-delay-ietf", | |
1238 | SHOW_STR | |
1239 | "IS-IS information\n" | |
1240 | "IS-IS SPF delay IETF information\n") | |
1241 | { | |
d62a17ae | 1242 | if (!isis) { |
1243 | vty_out(vty, "ISIS is not running\n"); | |
1244 | return CMD_SUCCESS; | |
1245 | } | |
1246 | ||
1247 | struct listnode *node; | |
1248 | struct isis_area *area; | |
1249 | ||
1250 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { | |
1251 | vty_out(vty, "Area %s:\n", | |
1252 | area->area_tag ? area->area_tag : "null"); | |
1253 | ||
1254 | for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) { | |
1255 | if ((area->is_type & level) == 0) | |
1256 | continue; | |
1257 | ||
1258 | vty_out(vty, " Level-%d:\n", level); | |
1259 | vty_out(vty, " SPF delay status: "); | |
1260 | if (area->spf_timer[level - 1]) { | |
1261 | struct timeval remain = thread_timer_remain( | |
1262 | area->spf_timer[level - 1]); | |
1263 | vty_out(vty, "Pending, due in %ld msec\n", | |
1264 | remain.tv_sec * 1000 | |
1265 | + remain.tv_usec / 1000); | |
1266 | } else { | |
1267 | vty_out(vty, "Not scheduled\n"); | |
1268 | } | |
1269 | ||
1270 | if (area->spf_delay_ietf[level - 1]) { | |
1271 | vty_out(vty, | |
1272 | " Using draft-ietf-rtgwg-backoff-algo-04\n"); | |
1273 | spf_backoff_show( | |
1274 | area->spf_delay_ietf[level - 1], vty, | |
1275 | " "); | |
1276 | } else { | |
1277 | vty_out(vty, " Using legacy backoff algo\n"); | |
1278 | } | |
1279 | } | |
1280 | } | |
1281 | return CMD_SUCCESS; | |
03f7e182 SL |
1282 | } |
1283 | ||
3f045a08 JB |
1284 | DEFUN (show_isis_summary, |
1285 | show_isis_summary_cmd, | |
1286 | "show isis summary", | |
1287 | SHOW_STR "IS-IS information\n" "IS-IS summary\n") | |
1288 | { | |
d62a17ae | 1289 | struct listnode *node, *node2; |
1290 | struct isis_area *area; | |
d62a17ae | 1291 | int level; |
1292 | ||
1293 | if (isis == NULL) { | |
1294 | vty_out(vty, "ISIS is not running\n"); | |
1295 | return CMD_SUCCESS; | |
1296 | } | |
1297 | ||
1298 | vty_out(vty, "Process Id : %ld\n", isis->process_id); | |
1299 | if (isis->sysid_set) | |
1300 | vty_out(vty, "System Id : %s\n", | |
1301 | sysid_print(isis->sysid)); | |
1302 | ||
1303 | vty_out(vty, "Up time : "); | |
1304 | vty_out_timestr(vty, isis->uptime); | |
1305 | vty_out(vty, "\n"); | |
1306 | ||
1307 | if (isis->area_list) | |
1308 | vty_out(vty, "Number of areas : %d\n", isis->area_list->count); | |
1309 | ||
1310 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { | |
1311 | vty_out(vty, "Area %s:\n", | |
1312 | area->area_tag ? area->area_tag : "null"); | |
1313 | ||
1314 | if (listcount(area->area_addrs) > 0) { | |
1315 | struct area_addr *area_addr; | |
1316 | for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node2, | |
1317 | area_addr)) { | |
1318 | vty_out(vty, " Net: %s\n", | |
1319 | isonet_print(area_addr->area_addr, | |
1320 | area_addr->addr_len | |
1321 | + ISIS_SYS_ID_LEN | |
1322 | + 1)); | |
1323 | } | |
1324 | } | |
1325 | ||
1326 | for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) { | |
1327 | if ((area->is_type & level) == 0) | |
1328 | continue; | |
1329 | ||
1330 | vty_out(vty, " Level-%d:\n", level); | |
d62a17ae | 1331 | if (area->spf_timer[level - 1]) |
1332 | vty_out(vty, " SPF: (pending)\n"); | |
1333 | else | |
1334 | vty_out(vty, " SPF:\n"); | |
1335 | ||
1336 | vty_out(vty, " minimum interval : %d", | |
1337 | area->min_spf_interval[level - 1]); | |
1338 | if (area->spf_delay_ietf[level - 1]) | |
1339 | vty_out(vty, | |
1340 | " (not used, IETF SPF delay activated)"); | |
1341 | vty_out(vty, "\n"); | |
1342 | ||
1343 | vty_out(vty, " IPv4 route computation:\n"); | |
02cd317e | 1344 | isis_spf_print(area->spftree[level - 1], vty); |
d62a17ae | 1345 | |
d62a17ae | 1346 | vty_out(vty, " IPv6 route computation:\n"); |
02cd317e | 1347 | isis_spf_print(area->spftree6[level - 1], vty); |
d62a17ae | 1348 | } |
1349 | } | |
1350 | vty_out(vty, "\n"); | |
1351 | ||
1352 | return CMD_SUCCESS; | |
eb5d44eb | 1353 | } |
1354 | ||
3f045a08 JB |
1355 | /* |
1356 | * This function supports following display options: | |
1357 | * [ show isis database [detail] ] | |
1358 | * [ show isis database <sysid> [detail] ] | |
1359 | * [ show isis database <hostname> [detail] ] | |
1360 | * [ show isis database <sysid>.<pseudo-id> [detail] ] | |
1361 | * [ show isis database <hostname>.<pseudo-id> [detail] ] | |
1362 | * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ] | |
1363 | * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ] | |
1364 | * [ show isis database detail <sysid> ] | |
1365 | * [ show isis database detail <hostname> ] | |
1366 | * [ show isis database detail <sysid>.<pseudo-id> ] | |
1367 | * [ show isis database detail <hostname>.<pseudo-id> ] | |
1368 | * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ] | |
1369 | * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ] | |
1370 | */ | |
d62a17ae | 1371 | static int show_isis_database(struct vty *vty, const char *argv, int ui_level) |
1372 | { | |
1373 | struct listnode *node; | |
1374 | struct isis_area *area; | |
1375 | struct isis_lsp *lsp; | |
1376 | struct isis_dynhn *dynhn; | |
1377 | const char *pos = argv; | |
1378 | u_char lspid[ISIS_SYS_ID_LEN + 2]; | |
1379 | char sysid[255]; | |
1380 | u_char number[3]; | |
1381 | int level, lsp_count; | |
1382 | ||
1383 | if (isis->area_list->count == 0) | |
1384 | return CMD_SUCCESS; | |
1385 | ||
1386 | memset(&lspid, 0, ISIS_SYS_ID_LEN); | |
1387 | memset(&sysid, 0, 255); | |
1388 | ||
1389 | /* | |
1390 | * extract fragment and pseudo id from the string argv | |
1391 | * in the forms: | |
1392 | * (a) <systemid/hostname>.<pseudo-id>-<framenent> or | |
1393 | * (b) <systemid/hostname>.<pseudo-id> or | |
1394 | * (c) <systemid/hostname> or | |
1395 | * Where systemid is in the form: | |
1396 | * xxxx.xxxx.xxxx | |
1397 | */ | |
1398 | if (argv) | |
1399 | strncpy(sysid, argv, 254); | |
1400 | if (argv && strlen(argv) > 3) { | |
1401 | pos = argv + strlen(argv) - 3; | |
1402 | if (strncmp(pos, "-", 1) == 0) { | |
1403 | memcpy(number, ++pos, 2); | |
1404 | lspid[ISIS_SYS_ID_LEN + 1] = | |
1405 | (u_char)strtol((char *)number, NULL, 16); | |
1406 | pos -= 4; | |
1407 | if (strncmp(pos, ".", 1) != 0) | |
1408 | return CMD_ERR_AMBIGUOUS; | |
1409 | } | |
1410 | if (strncmp(pos, ".", 1) == 0) { | |
1411 | memcpy(number, ++pos, 2); | |
1412 | lspid[ISIS_SYS_ID_LEN] = | |
1413 | (u_char)strtol((char *)number, NULL, 16); | |
1414 | sysid[pos - argv - 1] = '\0'; | |
1415 | } | |
1416 | } | |
1417 | ||
1418 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { | |
1419 | vty_out(vty, "Area %s:\n", | |
1420 | area->area_tag ? area->area_tag : "null"); | |
1421 | ||
1422 | for (level = 0; level < ISIS_LEVELS; level++) { | |
1423 | if (area->lspdb[level] | |
1424 | && dict_count(area->lspdb[level]) > 0) { | |
1425 | lsp = NULL; | |
1426 | if (argv != NULL) { | |
1427 | /* | |
1428 | * Try to find the lsp-id if the argv | |
1429 | * string is in | |
1430 | * the form | |
1431 | * hostname.<pseudo-id>-<fragment> | |
1432 | */ | |
1433 | if (sysid2buff(lspid, sysid)) { | |
1434 | lsp = lsp_search( | |
1435 | lspid, | |
1436 | area->lspdb[level]); | |
1437 | } else if ((dynhn = dynhn_find_by_name( | |
1438 | sysid))) { | |
1439 | memcpy(lspid, dynhn->id, | |
1440 | ISIS_SYS_ID_LEN); | |
1441 | lsp = lsp_search( | |
1442 | lspid, | |
1443 | area->lspdb[level]); | |
1444 | } else if (strncmp(unix_hostname(), | |
1445 | sysid, 15) | |
1446 | == 0) { | |
1447 | memcpy(lspid, isis->sysid, | |
1448 | ISIS_SYS_ID_LEN); | |
1449 | lsp = lsp_search( | |
1450 | lspid, | |
1451 | area->lspdb[level]); | |
1452 | } | |
1453 | } | |
1454 | ||
1455 | if (lsp != NULL || argv == NULL) { | |
1456 | vty_out(vty, | |
1457 | "IS-IS Level-%d link-state database:\n", | |
1458 | level + 1); | |
1459 | ||
1460 | /* print the title in all cases */ | |
1461 | vty_out(vty, | |
1462 | "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n"); | |
1463 | } | |
1464 | ||
1465 | if (lsp) { | |
1466 | if (ui_level == ISIS_UI_LEVEL_DETAIL) | |
1467 | lsp_print_detail( | |
1468 | lsp, vty, | |
1469 | area->dynhostname); | |
1470 | else | |
1471 | lsp_print(lsp, vty, | |
1472 | area->dynhostname); | |
1473 | } else if (argv == NULL) { | |
1474 | lsp_count = lsp_print_all( | |
1475 | vty, area->lspdb[level], | |
1476 | ui_level, area->dynhostname); | |
1477 | ||
1478 | vty_out(vty, " %u LSPs\n\n", | |
1479 | lsp_count); | |
1480 | } | |
1481 | } | |
1482 | } | |
1483 | } | |
1484 | ||
1485 | return CMD_SUCCESS; | |
eb5d44eb | 1486 | } |
1487 | ||
3a2d747c | 1488 | DEFUN (show_database, |
3f045a08 | 1489 | show_database_cmd, |
3a2d747c | 1490 | "show isis database [detail] [WORD]", |
3f045a08 JB |
1491 | SHOW_STR |
1492 | "IS-IS information\n" | |
1493 | "IS-IS link state database\n" | |
1494 | "Detailed information\n" | |
1495 | "LSP ID\n") | |
1496 | { | |
d62a17ae | 1497 | int idx = 0; |
1498 | int uilevel = argv_find(argv, argc, "detail", &idx) | |
1499 | ? ISIS_UI_LEVEL_DETAIL | |
1500 | : ISIS_UI_LEVEL_BRIEF; | |
1501 | char *id = argv_find(argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL; | |
1502 | return show_isis_database(vty, id, uilevel); | |
3f045a08 JB |
1503 | } |
1504 | ||
d62a17ae | 1505 | /* |
1506 | * 'router isis' command | |
3f045a08 | 1507 | */ |
505e5056 | 1508 | DEFUN_NOSH (router_isis, |
3f045a08 JB |
1509 | router_isis_cmd, |
1510 | "router isis WORD", | |
1511 | ROUTER_STR | |
1512 | "ISO IS-IS\n" | |
1513 | "ISO Routing area tag") | |
1514 | { | |
d62a17ae | 1515 | int idx_word = 2; |
1516 | return isis_area_get(vty, argv[idx_word]->arg); | |
3f045a08 JB |
1517 | } |
1518 | ||
d62a17ae | 1519 | /* |
1520 | *'no router isis' command | |
3f045a08 JB |
1521 | */ |
1522 | DEFUN (no_router_isis, | |
1523 | no_router_isis_cmd, | |
1524 | "no router isis WORD", | |
f390d2c7 | 1525 | "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag") |
eb5d44eb | 1526 | { |
d62a17ae | 1527 | int idx_word = 3; |
1528 | return isis_area_destroy(vty, argv[idx_word]->arg); | |
eb5d44eb | 1529 | } |
1530 | ||
1531 | /* | |
1532 | * 'net' command | |
1533 | */ | |
1534 | DEFUN (net, | |
1535 | net_cmd, | |
1536 | "net WORD", | |
1537 | "A Network Entity Title for this process (OSI only)\n" | |
f390d2c7 | 1538 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") |
eb5d44eb | 1539 | { |
d62a17ae | 1540 | int idx_word = 1; |
1541 | return area_net_title(vty, argv[idx_word]->arg); | |
eb5d44eb | 1542 | } |
1543 | ||
eb5d44eb | 1544 | /* |
1545 | * 'no net' command | |
1546 | */ | |
1547 | DEFUN (no_net, | |
1548 | no_net_cmd, | |
1549 | "no net WORD", | |
1550 | NO_STR | |
1551 | "A Network Entity Title for this process (OSI only)\n" | |
f390d2c7 | 1552 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") |
eb5d44eb | 1553 | { |
d62a17ae | 1554 | int idx_word = 2; |
1555 | return area_clear_net_title(vty, argv[idx_word]->arg); | |
eb5d44eb | 1556 | } |
1557 | ||
064f4896 CF |
1558 | DEFUN (isis_topology, |
1559 | isis_topology_cmd, | |
1560 | "topology " ISIS_MT_NAMES " [overload]", | |
1561 | "Configure IS-IS topologies\n" | |
1562 | ISIS_MT_DESCRIPTIONS | |
1563 | "Set overload bit for topology\n") | |
1564 | { | |
d62a17ae | 1565 | VTY_DECLVAR_CONTEXT(isis_area, area); |
064f4896 | 1566 | |
d62a17ae | 1567 | const char *arg = argv[1]->arg; |
1568 | uint16_t mtid = isis_str2mtid(arg); | |
c3ea3906 | 1569 | |
d62a17ae | 1570 | if (area->oldmetric) { |
1571 | vty_out(vty, | |
1572 | "Multi topology IS-IS can only be used with wide metrics\n"); | |
1573 | return CMD_ERR_AMBIGUOUS; | |
1574 | } | |
c3ea3906 | 1575 | |
d62a17ae | 1576 | if (mtid == (uint16_t)-1) { |
1577 | vty_out(vty, "Don't know topology '%s'\n", arg); | |
1578 | return CMD_ERR_AMBIGUOUS; | |
1579 | } | |
1580 | if (mtid == ISIS_MT_IPV4_UNICAST) { | |
1581 | vty_out(vty, "Cannot configure IPv4 unicast topology\n"); | |
1582 | return CMD_ERR_AMBIGUOUS; | |
1583 | } | |
064f4896 | 1584 | |
d62a17ae | 1585 | area_set_mt_enabled(area, mtid, true); |
1586 | area_set_mt_overload(area, mtid, (argc == 3)); | |
1587 | return CMD_SUCCESS; | |
064f4896 CF |
1588 | } |
1589 | ||
1590 | DEFUN (no_isis_topology, | |
1591 | no_isis_topology_cmd, | |
1592 | "no topology " ISIS_MT_NAMES " [overload]", | |
1593 | NO_STR | |
1594 | "Configure IS-IS topologies\n" | |
1595 | ISIS_MT_DESCRIPTIONS | |
1596 | "Set overload bit for topology\n") | |
1597 | { | |
d62a17ae | 1598 | VTY_DECLVAR_CONTEXT(isis_area, area); |
064f4896 | 1599 | |
d62a17ae | 1600 | const char *arg = argv[2]->arg; |
1601 | uint16_t mtid = isis_str2mtid(arg); | |
c3ea3906 | 1602 | |
d62a17ae | 1603 | if (area->oldmetric) { |
1604 | vty_out(vty, | |
1605 | "Multi topology IS-IS can only be used with wide metrics\n"); | |
1606 | return CMD_ERR_AMBIGUOUS; | |
1607 | } | |
c3ea3906 | 1608 | |
d62a17ae | 1609 | if (mtid == (uint16_t)-1) { |
1610 | vty_out(vty, "Don't know topology '%s'\n", arg); | |
1611 | return CMD_ERR_AMBIGUOUS; | |
1612 | } | |
1613 | if (mtid == ISIS_MT_IPV4_UNICAST) { | |
1614 | vty_out(vty, "Cannot configure IPv4 unicast topology\n"); | |
1615 | return CMD_ERR_AMBIGUOUS; | |
1616 | } | |
064f4896 | 1617 | |
d62a17ae | 1618 | area_set_mt_enabled(area, mtid, false); |
1619 | area_set_mt_overload(area, mtid, false); | |
1620 | return CMD_SUCCESS; | |
064f4896 CF |
1621 | } |
1622 | ||
6754fc66 | 1623 | void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu) |
b20ccb3a | 1624 | { |
d62a17ae | 1625 | area->lsp_mtu = lsp_mtu; |
1626 | lsp_regenerate_schedule(area, IS_LEVEL_1_AND_2, 1); | |
1627 | } | |
1628 | ||
1629 | static int isis_area_passwd_set(struct isis_area *area, int level, | |
1630 | u_char passwd_type, const char *passwd, | |
1631 | u_char snp_auth) | |
1632 | { | |
1633 | struct isis_passwd *dest; | |
1634 | struct isis_passwd modified; | |
1635 | int len; | |
1636 | ||
1637 | assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2)); | |
1638 | dest = (level == IS_LEVEL_1) ? &area->area_passwd | |
1639 | : &area->domain_passwd; | |
1640 | memset(&modified, 0, sizeof(modified)); | |
1641 | ||
1642 | if (passwd_type != ISIS_PASSWD_TYPE_UNUSED) { | |
1643 | if (!passwd) | |
1644 | return -1; | |
1645 | ||
1646 | len = strlen(passwd); | |
1647 | if (len > 254) | |
1648 | return -1; | |
1649 | ||
1650 | modified.len = len; | |
1651 | strncpy((char *)modified.passwd, passwd, 255); | |
1652 | modified.type = passwd_type; | |
1653 | modified.snp_auth = snp_auth; | |
1654 | } | |
1655 | ||
1656 | if (memcmp(&modified, dest, sizeof(modified))) { | |
1657 | memcpy(dest, &modified, sizeof(modified)); | |
1658 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
1659 | } | |
1660 | ||
1661 | return 0; | |
1662 | } | |
1663 | ||
1664 | int isis_area_passwd_unset(struct isis_area *area, int level) | |
1665 | { | |
1666 | return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_UNUSED, NULL, | |
1667 | 0); | |
1668 | } | |
1669 | ||
1670 | int isis_area_passwd_cleartext_set(struct isis_area *area, int level, | |
1671 | const char *passwd, u_char snp_auth) | |
1672 | { | |
1673 | return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_CLEARTXT, | |
1674 | passwd, snp_auth); | |
1675 | } | |
1676 | ||
1677 | int isis_area_passwd_hmac_md5_set(struct isis_area *area, int level, | |
1678 | const char *passwd, u_char snp_auth) | |
1679 | { | |
1680 | return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_HMAC_MD5, | |
1681 | passwd, snp_auth); | |
b20ccb3a CF |
1682 | } |
1683 | ||
d62a17ae | 1684 | static void area_resign_level(struct isis_area *area, int level) |
3f045a08 | 1685 | { |
d62a17ae | 1686 | if (area->lspdb[level - 1]) { |
1687 | lsp_db_destroy(area->lspdb[level - 1]); | |
1688 | area->lspdb[level - 1] = NULL; | |
1689 | } | |
1690 | if (area->spftree[level - 1]) { | |
1691 | isis_spftree_del(area->spftree[level - 1]); | |
1692 | area->spftree[level - 1] = NULL; | |
1693 | } | |
1694 | if (area->spftree6[level - 1]) { | |
1695 | isis_spftree_del(area->spftree6[level - 1]); | |
1696 | area->spftree6[level - 1] = NULL; | |
1697 | } | |
1698 | THREAD_TIMER_OFF(area->spf_timer[level - 1]); | |
1699 | if (area->route_table[level - 1]) { | |
1700 | route_table_finish(area->route_table[level - 1]); | |
1701 | area->route_table[level - 1] = NULL; | |
1702 | } | |
1703 | if (area->route_table6[level - 1]) { | |
1704 | route_table_finish(area->route_table6[level - 1]); | |
1705 | area->route_table6[level - 1] = NULL; | |
1706 | } | |
3f045a08 | 1707 | |
d62a17ae | 1708 | sched_debug( |
1709 | "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.", | |
1710 | area->area_tag, level); | |
1711 | THREAD_TIMER_OFF(area->t_lsp_refresh[level - 1]); | |
1712 | area->lsp_regenerate_pending[level - 1] = 0; | |
1713 | } | |
3f045a08 | 1714 | |
d62a17ae | 1715 | void isis_area_is_type_set(struct isis_area *area, int is_type) |
1716 | { | |
1717 | struct listnode *node; | |
1718 | struct isis_circuit *circuit; | |
3f045a08 | 1719 | |
d62a17ae | 1720 | if (isis->debugs & DEBUG_EVENTS) |
1721 | zlog_debug("ISIS-Evt (%s) system type change %s -> %s", | |
1722 | area->area_tag, circuit_t2string(area->is_type), | |
1723 | circuit_t2string(is_type)); | |
f390d2c7 | 1724 | |
d62a17ae | 1725 | if (area->is_type == is_type) |
1726 | return; /* No change */ | |
1727 | ||
1728 | switch (area->is_type) { | |
1729 | case IS_LEVEL_1: | |
1730 | if (is_type == IS_LEVEL_2) | |
1731 | area_resign_level(area, IS_LEVEL_1); | |
1732 | ||
1733 | if (area->lspdb[1] == NULL) | |
1734 | area->lspdb[1] = lsp_db_init(); | |
1735 | if (area->route_table[1] == NULL) | |
1736 | area->route_table[1] = route_table_init(); | |
1737 | if (area->route_table6[1] == NULL) | |
1738 | area->route_table6[1] = route_table_init(); | |
1739 | break; | |
1740 | ||
1741 | case IS_LEVEL_1_AND_2: | |
1742 | if (is_type == IS_LEVEL_1) | |
1743 | area_resign_level(area, IS_LEVEL_2); | |
1744 | else | |
1745 | area_resign_level(area, IS_LEVEL_1); | |
1746 | break; | |
1747 | ||
1748 | case IS_LEVEL_2: | |
1749 | if (is_type == IS_LEVEL_1) | |
1750 | area_resign_level(area, IS_LEVEL_2); | |
1751 | ||
1752 | if (area->lspdb[0] == NULL) | |
1753 | area->lspdb[0] = lsp_db_init(); | |
1754 | if (area->route_table[0] == NULL) | |
1755 | area->route_table[0] = route_table_init(); | |
1756 | if (area->route_table6[0] == NULL) | |
1757 | area->route_table6[0] = route_table_init(); | |
1758 | break; | |
1759 | ||
1760 | default: | |
1761 | break; | |
1762 | } | |
1763 | ||
1764 | area->is_type = is_type; | |
1765 | ||
1766 | /* override circuit's is_type */ | |
1767 | if (area->is_type != IS_LEVEL_1_AND_2) { | |
1768 | for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) | |
1769 | isis_circuit_is_type_set(circuit, is_type); | |
1770 | } | |
1771 | ||
1772 | spftree_area_init(area); | |
1773 | ||
1774 | if (listcount(area->area_addrs) > 0) { | |
1775 | if (is_type & IS_LEVEL_1) | |
1776 | lsp_generate(area, IS_LEVEL_1); | |
1777 | if (is_type & IS_LEVEL_2) | |
1778 | lsp_generate(area, IS_LEVEL_2); | |
1779 | } | |
1780 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
1781 | ||
1782 | return; | |
eb5d44eb | 1783 | } |
1784 | ||
a38a72db CF |
1785 | void isis_area_metricstyle_set(struct isis_area *area, bool old_metric, |
1786 | bool new_metric) | |
e38e0df0 | 1787 | { |
d62a17ae | 1788 | if (area->oldmetric != old_metric || area->newmetric != new_metric) { |
1789 | area->oldmetric = old_metric; | |
1790 | area->newmetric = new_metric; | |
1791 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
1792 | } | |
e38e0df0 SV |
1793 | } |
1794 | ||
a38a72db | 1795 | void isis_area_overload_bit_set(struct isis_area *area, bool overload_bit) |
eb5d44eb | 1796 | { |
d62a17ae | 1797 | char new_overload_bit = overload_bit ? LSPBIT_OL : 0; |
eb5d44eb | 1798 | |
d62a17ae | 1799 | if (new_overload_bit != area->overload_bit) { |
1800 | area->overload_bit = new_overload_bit; | |
1801 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
1802 | } | |
3f045a08 JB |
1803 | } |
1804 | ||
a38a72db | 1805 | void isis_area_attached_bit_set(struct isis_area *area, bool attached_bit) |
3f045a08 | 1806 | { |
d62a17ae | 1807 | char new_attached_bit = attached_bit ? LSPBIT_ATT : 0; |
3f045a08 | 1808 | |
d62a17ae | 1809 | if (new_attached_bit != area->attached_bit) { |
1810 | area->attached_bit = new_attached_bit; | |
1811 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
1812 | } | |
eb5d44eb | 1813 | } |
1814 | ||
a38a72db | 1815 | void isis_area_dynhostname_set(struct isis_area *area, bool dynhostname) |
eb5d44eb | 1816 | { |
d62a17ae | 1817 | if (area->dynhostname != dynhostname) { |
1818 | area->dynhostname = dynhostname; | |
1819 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0); | |
1820 | } | |
eb5d44eb | 1821 | } |
1822 | ||
d62a17ae | 1823 | void isis_area_max_lsp_lifetime_set(struct isis_area *area, int level, |
1824 | uint16_t max_lsp_lifetime) | |
eb5d44eb | 1825 | { |
d62a17ae | 1826 | assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2)); |
eb5d44eb | 1827 | |
d62a17ae | 1828 | if (area->max_lsp_lifetime[level - 1] == max_lsp_lifetime) |
1829 | return; | |
3f045a08 | 1830 | |
d62a17ae | 1831 | area->max_lsp_lifetime[level - 1] = max_lsp_lifetime; |
1832 | lsp_regenerate_schedule(area, level, 1); | |
3f045a08 JB |
1833 | } |
1834 | ||
d62a17ae | 1835 | void isis_area_lsp_refresh_set(struct isis_area *area, int level, |
1836 | uint16_t lsp_refresh) | |
3f045a08 | 1837 | { |
d62a17ae | 1838 | assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2)); |
eb5d44eb | 1839 | |
d62a17ae | 1840 | if (area->lsp_refresh[level - 1] == lsp_refresh) |
1841 | return; | |
eb5d44eb | 1842 | |
d62a17ae | 1843 | area->lsp_refresh[level - 1] = lsp_refresh; |
1844 | lsp_regenerate_schedule(area, level, 1); | |
3f045a08 JB |
1845 | } |
1846 | ||
3f045a08 JB |
1847 | DEFUN (log_adj_changes, |
1848 | log_adj_changes_cmd, | |
1849 | "log-adjacency-changes", | |
1850 | "Log changes in adjacency state\n") | |
1851 | { | |
d62a17ae | 1852 | VTY_DECLVAR_CONTEXT(isis_area, area); |
eb5d44eb | 1853 | |
d62a17ae | 1854 | area->log_adj_changes = 1; |
eb5d44eb | 1855 | |
d62a17ae | 1856 | return CMD_SUCCESS; |
eb5d44eb | 1857 | } |
1858 | ||
3f045a08 JB |
1859 | DEFUN (no_log_adj_changes, |
1860 | no_log_adj_changes_cmd, | |
1861 | "no log-adjacency-changes", | |
d7fa34c1 | 1862 | NO_STR |
3f045a08 | 1863 | "Stop logging changes in adjacency state\n") |
eb5d44eb | 1864 | { |
d62a17ae | 1865 | VTY_DECLVAR_CONTEXT(isis_area, area); |
f390d2c7 | 1866 | |
d62a17ae | 1867 | area->log_adj_changes = 0; |
eb5d44eb | 1868 | |
d62a17ae | 1869 | return CMD_SUCCESS; |
eb5d44eb | 1870 | } |
1871 | ||
eb5d44eb | 1872 | /* IS-IS configuration write function */ |
d62a17ae | 1873 | int isis_config_write(struct vty *vty) |
1874 | { | |
1875 | int write = 0; | |
1876 | ||
1877 | if (isis != NULL) { | |
1878 | struct isis_area *area; | |
1879 | struct listnode *node, *node2; | |
1880 | ||
1881 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { | |
1882 | /* ISIS - Area name */ | |
1883 | vty_out(vty, "router isis %s\n", area->area_tag); | |
1884 | write++; | |
1885 | /* ISIS - Net */ | |
1886 | if (listcount(area->area_addrs) > 0) { | |
1887 | struct area_addr *area_addr; | |
1888 | for (ALL_LIST_ELEMENTS_RO(area->area_addrs, | |
1889 | node2, area_addr)) { | |
1890 | vty_out(vty, " net %s\n", | |
1891 | isonet_print( | |
1892 | area_addr->area_addr, | |
1893 | area_addr->addr_len | |
1894 | + ISIS_SYS_ID_LEN | |
1895 | + 1)); | |
1896 | write++; | |
1897 | } | |
1898 | } | |
1899 | /* ISIS - Dynamic hostname - Defaults to true so only | |
1900 | * display if | |
1901 | * false. */ | |
1902 | if (!area->dynhostname) { | |
1903 | vty_out(vty, " no hostname dynamic\n"); | |
1904 | write++; | |
1905 | } | |
1906 | /* ISIS - Metric-Style - when true displays wide */ | |
1907 | if (area->newmetric) { | |
1908 | if (!area->oldmetric) | |
1909 | vty_out(vty, " metric-style wide\n"); | |
1910 | else | |
1911 | vty_out(vty, | |
1912 | " metric-style transition\n"); | |
1913 | write++; | |
1914 | } else { | |
1915 | vty_out(vty, " metric-style narrow\n"); | |
1916 | write++; | |
1917 | } | |
1918 | /* ISIS - overload-bit */ | |
1919 | if (area->overload_bit) { | |
1920 | vty_out(vty, " set-overload-bit\n"); | |
1921 | write++; | |
1922 | } | |
1923 | /* ISIS - Area is-type (level-1-2 is default) */ | |
1924 | if (area->is_type == IS_LEVEL_1) { | |
1925 | vty_out(vty, " is-type level-1\n"); | |
1926 | write++; | |
1927 | } else if (area->is_type == IS_LEVEL_2) { | |
1928 | vty_out(vty, " is-type level-2-only\n"); | |
1929 | write++; | |
1930 | } | |
1931 | write += isis_redist_config_write(vty, area, AF_INET); | |
1932 | write += isis_redist_config_write(vty, area, AF_INET6); | |
1933 | /* ISIS - Lsp generation interval */ | |
1934 | if (area->lsp_gen_interval[0] | |
1935 | == area->lsp_gen_interval[1]) { | |
1936 | if (area->lsp_gen_interval[0] | |
1937 | != DEFAULT_MIN_LSP_GEN_INTERVAL) { | |
1938 | vty_out(vty, " lsp-gen-interval %d\n", | |
1939 | area->lsp_gen_interval[0]); | |
1940 | write++; | |
1941 | } | |
1942 | } else { | |
1943 | if (area->lsp_gen_interval[0] | |
1944 | != DEFAULT_MIN_LSP_GEN_INTERVAL) { | |
1945 | vty_out(vty, | |
1946 | " lsp-gen-interval level-1 %d\n", | |
1947 | area->lsp_gen_interval[0]); | |
1948 | write++; | |
1949 | } | |
1950 | if (area->lsp_gen_interval[1] | |
1951 | != DEFAULT_MIN_LSP_GEN_INTERVAL) { | |
1952 | vty_out(vty, | |
1953 | " lsp-gen-interval level-2 %d\n", | |
1954 | area->lsp_gen_interval[1]); | |
1955 | write++; | |
1956 | } | |
1957 | } | |
1958 | /* ISIS - LSP lifetime */ | |
1959 | if (area->max_lsp_lifetime[0] | |
1960 | == area->max_lsp_lifetime[1]) { | |
1961 | if (area->max_lsp_lifetime[0] | |
1962 | != DEFAULT_LSP_LIFETIME) { | |
1963 | vty_out(vty, " max-lsp-lifetime %u\n", | |
1964 | area->max_lsp_lifetime[0]); | |
1965 | write++; | |
1966 | } | |
1967 | } else { | |
1968 | if (area->max_lsp_lifetime[0] | |
1969 | != DEFAULT_LSP_LIFETIME) { | |
1970 | vty_out(vty, | |
1971 | " max-lsp-lifetime level-1 %u\n", | |
1972 | area->max_lsp_lifetime[0]); | |
1973 | write++; | |
1974 | } | |
1975 | if (area->max_lsp_lifetime[1] | |
1976 | != DEFAULT_LSP_LIFETIME) { | |
1977 | vty_out(vty, | |
1978 | " max-lsp-lifetime level-2 %u\n", | |
1979 | area->max_lsp_lifetime[1]); | |
1980 | write++; | |
1981 | } | |
1982 | } | |
1983 | /* ISIS - LSP refresh interval */ | |
1984 | if (area->lsp_refresh[0] == area->lsp_refresh[1]) { | |
1985 | if (area->lsp_refresh[0] | |
1986 | != DEFAULT_MAX_LSP_GEN_INTERVAL) { | |
1987 | vty_out(vty, | |
1988 | " lsp-refresh-interval %u\n", | |
1989 | area->lsp_refresh[0]); | |
1990 | write++; | |
1991 | } | |
1992 | } else { | |
1993 | if (area->lsp_refresh[0] | |
1994 | != DEFAULT_MAX_LSP_GEN_INTERVAL) { | |
1995 | vty_out(vty, | |
1996 | " lsp-refresh-interval level-1 %u\n", | |
1997 | area->lsp_refresh[0]); | |
1998 | write++; | |
1999 | } | |
2000 | if (area->lsp_refresh[1] | |
2001 | != DEFAULT_MAX_LSP_GEN_INTERVAL) { | |
2002 | vty_out(vty, | |
2003 | " lsp-refresh-interval level-2 %u\n", | |
2004 | area->lsp_refresh[1]); | |
2005 | write++; | |
2006 | } | |
2007 | } | |
2008 | if (area->lsp_mtu != DEFAULT_LSP_MTU) { | |
2009 | vty_out(vty, " lsp-mtu %u\n", area->lsp_mtu); | |
2010 | write++; | |
2011 | } | |
2012 | ||
2013 | /* Minimum SPF interval. */ | |
2014 | if (area->min_spf_interval[0] | |
2015 | == area->min_spf_interval[1]) { | |
2016 | if (area->min_spf_interval[0] | |
2017 | != MINIMUM_SPF_INTERVAL) { | |
2018 | vty_out(vty, " spf-interval %d\n", | |
2019 | area->min_spf_interval[0]); | |
2020 | write++; | |
2021 | } | |
2022 | } else { | |
2023 | if (area->min_spf_interval[0] | |
2024 | != MINIMUM_SPF_INTERVAL) { | |
2025 | vty_out(vty, | |
2026 | " spf-interval level-1 %d\n", | |
2027 | area->min_spf_interval[0]); | |
2028 | write++; | |
2029 | } | |
2030 | if (area->min_spf_interval[1] | |
2031 | != MINIMUM_SPF_INTERVAL) { | |
2032 | vty_out(vty, | |
2033 | " spf-interval level-2 %d\n", | |
2034 | area->min_spf_interval[1]); | |
2035 | write++; | |
2036 | } | |
2037 | } | |
2038 | ||
2039 | /* IETF SPF interval */ | |
2040 | if (area->spf_delay_ietf[0]) { | |
2041 | vty_out(vty, | |
2042 | " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n", | |
2043 | spf_backoff_init_delay( | |
2044 | area->spf_delay_ietf[0]), | |
2045 | spf_backoff_short_delay( | |
2046 | area->spf_delay_ietf[0]), | |
2047 | spf_backoff_long_delay( | |
2048 | area->spf_delay_ietf[0]), | |
2049 | spf_backoff_holddown( | |
2050 | area->spf_delay_ietf[0]), | |
2051 | spf_backoff_timetolearn( | |
2052 | area->spf_delay_ietf[0])); | |
2053 | write++; | |
2054 | } | |
2055 | ||
2056 | /* Authentication passwords. */ | |
2057 | if (area->area_passwd.type | |
2058 | == ISIS_PASSWD_TYPE_HMAC_MD5) { | |
2059 | vty_out(vty, " area-password md5 %s", | |
2060 | area->area_passwd.passwd); | |
2061 | if (CHECK_FLAG(area->area_passwd.snp_auth, | |
2062 | SNP_AUTH_SEND)) { | |
2063 | vty_out(vty, " authenticate snp "); | |
2064 | if (CHECK_FLAG( | |
2065 | area->area_passwd.snp_auth, | |
2066 | SNP_AUTH_RECV)) | |
2067 | vty_out(vty, "validate"); | |
2068 | else | |
2069 | vty_out(vty, "send-only"); | |
2070 | } | |
2071 | vty_out(vty, "\n"); | |
2072 | write++; | |
2073 | } else if (area->area_passwd.type | |
2074 | == ISIS_PASSWD_TYPE_CLEARTXT) { | |
2075 | vty_out(vty, " area-password clear %s", | |
2076 | area->area_passwd.passwd); | |
2077 | if (CHECK_FLAG(area->area_passwd.snp_auth, | |
2078 | SNP_AUTH_SEND)) { | |
2079 | vty_out(vty, " authenticate snp "); | |
2080 | if (CHECK_FLAG( | |
2081 | area->area_passwd.snp_auth, | |
2082 | SNP_AUTH_RECV)) | |
2083 | vty_out(vty, "validate"); | |
2084 | else | |
2085 | vty_out(vty, "send-only"); | |
2086 | } | |
2087 | vty_out(vty, "\n"); | |
2088 | write++; | |
2089 | } | |
2090 | if (area->domain_passwd.type | |
2091 | == ISIS_PASSWD_TYPE_HMAC_MD5) { | |
2092 | vty_out(vty, " domain-password md5 %s", | |
2093 | area->domain_passwd.passwd); | |
2094 | if (CHECK_FLAG(area->domain_passwd.snp_auth, | |
2095 | SNP_AUTH_SEND)) { | |
2096 | vty_out(vty, " authenticate snp "); | |
2097 | if (CHECK_FLAG(area->domain_passwd | |
2098 | .snp_auth, | |
2099 | SNP_AUTH_RECV)) | |
2100 | vty_out(vty, "validate"); | |
2101 | else | |
2102 | vty_out(vty, "send-only"); | |
2103 | } | |
2104 | vty_out(vty, "\n"); | |
2105 | write++; | |
2106 | } else if (area->domain_passwd.type | |
2107 | == ISIS_PASSWD_TYPE_CLEARTXT) { | |
2108 | vty_out(vty, " domain-password clear %s", | |
2109 | area->domain_passwd.passwd); | |
2110 | if (CHECK_FLAG(area->domain_passwd.snp_auth, | |
2111 | SNP_AUTH_SEND)) { | |
2112 | vty_out(vty, " authenticate snp "); | |
2113 | if (CHECK_FLAG(area->domain_passwd | |
2114 | .snp_auth, | |
2115 | SNP_AUTH_RECV)) | |
2116 | vty_out(vty, "validate"); | |
2117 | else | |
2118 | vty_out(vty, "send-only"); | |
2119 | } | |
2120 | vty_out(vty, "\n"); | |
2121 | write++; | |
2122 | } | |
2123 | ||
2124 | if (area->log_adj_changes) { | |
2125 | vty_out(vty, " log-adjacency-changes\n"); | |
2126 | write++; | |
2127 | } | |
2128 | ||
2129 | write += area_write_mt_settings(area, vty); | |
2130 | } | |
2131 | isis_mpls_te_config_write_router(vty); | |
2132 | } | |
2133 | ||
2134 | return write; | |
2135 | } | |
2136 | ||
2137 | struct cmd_node isis_node = {ISIS_NODE, "%s(config-router)# ", 1}; | |
2138 | ||
2139 | void isis_init() | |
2140 | { | |
2141 | /* Install IS-IS top node */ | |
2142 | install_node(&isis_node, isis_config_write); | |
2143 | ||
2144 | install_element(VIEW_NODE, &show_isis_summary_cmd); | |
2145 | ||
2146 | install_element(VIEW_NODE, &show_isis_spf_ietf_cmd); | |
2147 | ||
2148 | install_element(VIEW_NODE, &show_isis_interface_cmd); | |
2149 | install_element(VIEW_NODE, &show_isis_interface_detail_cmd); | |
2150 | install_element(VIEW_NODE, &show_isis_interface_arg_cmd); | |
2151 | ||
2152 | install_element(VIEW_NODE, &show_isis_neighbor_cmd); | |
2153 | install_element(VIEW_NODE, &show_isis_neighbor_detail_cmd); | |
2154 | install_element(VIEW_NODE, &show_isis_neighbor_arg_cmd); | |
2155 | install_element(VIEW_NODE, &clear_isis_neighbor_cmd); | |
2156 | install_element(VIEW_NODE, &clear_isis_neighbor_arg_cmd); | |
2157 | ||
2158 | install_element(VIEW_NODE, &show_hostname_cmd); | |
2159 | install_element(VIEW_NODE, &show_database_cmd); | |
2160 | ||
2161 | install_element(ENABLE_NODE, &show_debugging_isis_cmd); | |
2162 | ||
2163 | install_node(&debug_node, config_write_debug); | |
2164 | ||
2165 | install_element(ENABLE_NODE, &debug_isis_adj_cmd); | |
2166 | install_element(ENABLE_NODE, &no_debug_isis_adj_cmd); | |
2167 | install_element(ENABLE_NODE, &debug_isis_csum_cmd); | |
2168 | install_element(ENABLE_NODE, &no_debug_isis_csum_cmd); | |
2169 | install_element(ENABLE_NODE, &debug_isis_lupd_cmd); | |
2170 | install_element(ENABLE_NODE, &no_debug_isis_lupd_cmd); | |
2171 | install_element(ENABLE_NODE, &debug_isis_err_cmd); | |
2172 | install_element(ENABLE_NODE, &no_debug_isis_err_cmd); | |
2173 | install_element(ENABLE_NODE, &debug_isis_snp_cmd); | |
2174 | install_element(ENABLE_NODE, &no_debug_isis_snp_cmd); | |
2175 | install_element(ENABLE_NODE, &debug_isis_upd_cmd); | |
2176 | install_element(ENABLE_NODE, &no_debug_isis_upd_cmd); | |
2177 | install_element(ENABLE_NODE, &debug_isis_spfevents_cmd); | |
2178 | install_element(ENABLE_NODE, &no_debug_isis_spfevents_cmd); | |
2179 | install_element(ENABLE_NODE, &debug_isis_spfstats_cmd); | |
2180 | install_element(ENABLE_NODE, &no_debug_isis_spfstats_cmd); | |
2181 | install_element(ENABLE_NODE, &debug_isis_spftrigg_cmd); | |
2182 | install_element(ENABLE_NODE, &no_debug_isis_spftrigg_cmd); | |
2183 | install_element(ENABLE_NODE, &debug_isis_rtevents_cmd); | |
2184 | install_element(ENABLE_NODE, &no_debug_isis_rtevents_cmd); | |
2185 | install_element(ENABLE_NODE, &debug_isis_events_cmd); | |
2186 | install_element(ENABLE_NODE, &no_debug_isis_events_cmd); | |
2187 | install_element(ENABLE_NODE, &debug_isis_packet_dump_cmd); | |
2188 | install_element(ENABLE_NODE, &no_debug_isis_packet_dump_cmd); | |
2189 | install_element(ENABLE_NODE, &debug_isis_lsp_gen_cmd); | |
2190 | install_element(ENABLE_NODE, &no_debug_isis_lsp_gen_cmd); | |
2191 | install_element(ENABLE_NODE, &debug_isis_lsp_sched_cmd); | |
2192 | install_element(ENABLE_NODE, &no_debug_isis_lsp_sched_cmd); | |
2193 | ||
2194 | install_element(CONFIG_NODE, &debug_isis_adj_cmd); | |
2195 | install_element(CONFIG_NODE, &no_debug_isis_adj_cmd); | |
2196 | install_element(CONFIG_NODE, &debug_isis_csum_cmd); | |
2197 | install_element(CONFIG_NODE, &no_debug_isis_csum_cmd); | |
2198 | install_element(CONFIG_NODE, &debug_isis_lupd_cmd); | |
2199 | install_element(CONFIG_NODE, &no_debug_isis_lupd_cmd); | |
2200 | install_element(CONFIG_NODE, &debug_isis_err_cmd); | |
2201 | install_element(CONFIG_NODE, &no_debug_isis_err_cmd); | |
2202 | install_element(CONFIG_NODE, &debug_isis_snp_cmd); | |
2203 | install_element(CONFIG_NODE, &no_debug_isis_snp_cmd); | |
2204 | install_element(CONFIG_NODE, &debug_isis_upd_cmd); | |
2205 | install_element(CONFIG_NODE, &no_debug_isis_upd_cmd); | |
2206 | install_element(CONFIG_NODE, &debug_isis_spfevents_cmd); | |
2207 | install_element(CONFIG_NODE, &no_debug_isis_spfevents_cmd); | |
2208 | install_element(CONFIG_NODE, &debug_isis_spfstats_cmd); | |
2209 | install_element(CONFIG_NODE, &no_debug_isis_spfstats_cmd); | |
2210 | install_element(CONFIG_NODE, &debug_isis_spftrigg_cmd); | |
2211 | install_element(CONFIG_NODE, &no_debug_isis_spftrigg_cmd); | |
2212 | install_element(CONFIG_NODE, &debug_isis_rtevents_cmd); | |
2213 | install_element(CONFIG_NODE, &no_debug_isis_rtevents_cmd); | |
2214 | install_element(CONFIG_NODE, &debug_isis_events_cmd); | |
2215 | install_element(CONFIG_NODE, &no_debug_isis_events_cmd); | |
2216 | install_element(CONFIG_NODE, &debug_isis_packet_dump_cmd); | |
2217 | install_element(CONFIG_NODE, &no_debug_isis_packet_dump_cmd); | |
2218 | install_element(CONFIG_NODE, &debug_isis_lsp_gen_cmd); | |
2219 | install_element(CONFIG_NODE, &no_debug_isis_lsp_gen_cmd); | |
2220 | install_element(CONFIG_NODE, &debug_isis_lsp_sched_cmd); | |
2221 | install_element(CONFIG_NODE, &no_debug_isis_lsp_sched_cmd); | |
2222 | ||
2223 | install_element(CONFIG_NODE, &router_isis_cmd); | |
2224 | install_element(CONFIG_NODE, &no_router_isis_cmd); | |
2225 | ||
2226 | install_default(ISIS_NODE); | |
2227 | ||
2228 | install_element(ISIS_NODE, &net_cmd); | |
2229 | install_element(ISIS_NODE, &no_net_cmd); | |
2230 | ||
2231 | install_element(ISIS_NODE, &isis_topology_cmd); | |
2232 | install_element(ISIS_NODE, &no_isis_topology_cmd); | |
2233 | ||
2234 | install_element(ISIS_NODE, &log_adj_changes_cmd); | |
2235 | install_element(ISIS_NODE, &no_log_adj_changes_cmd); | |
2236 | ||
2237 | spf_backoff_cmd_init(); | |
eb5d44eb | 2238 | } |