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