]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* |
508e53e2 | 2 | * Copyright (C) 2003 Yasuhiro Ohara |
718e3744 | 3 | * |
4 | * This file is part of GNU Zebra. | |
5 | * | |
6 | * GNU Zebra is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation; either version 2, or (at your option) any | |
9 | * later version. | |
10 | * | |
11 | * GNU Zebra is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * General Public License for more details. | |
15 | * | |
896014f4 DL |
16 | * You should have received a copy of the GNU General Public License along |
17 | * with this program; see the file COPYING; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
718e3744 | 19 | */ |
20 | ||
508e53e2 | 21 | #include <zebra.h> |
718e3744 | 22 | |
508e53e2 | 23 | #include "thread.h" |
24 | #include "linklist.h" | |
25 | #include "vty.h" | |
26 | #include "command.h" | |
718e3744 | 27 | |
508e53e2 | 28 | #include "ospf6_proto.h" |
29 | #include "ospf6_network.h" | |
30 | #include "ospf6_lsa.h" | |
31 | #include "ospf6_lsdb.h" | |
32 | #include "ospf6_message.h" | |
33 | #include "ospf6_route.h" | |
34 | #include "ospf6_zebra.h" | |
35 | #include "ospf6_spf.h" | |
36 | #include "ospf6_top.h" | |
37 | #include "ospf6_area.h" | |
38 | #include "ospf6_interface.h" | |
39 | #include "ospf6_neighbor.h" | |
40 | #include "ospf6_intra.h" | |
41 | #include "ospf6_asbr.h" | |
049207c3 | 42 | #include "ospf6_abr.h" |
1e05838a | 43 | #include "ospf6_flood.h" |
049207c3 | 44 | #include "ospf6d.h" |
7f342629 | 45 | #include "ospf6_bfd.h" |
718e3744 | 46 | |
d62a17ae | 47 | struct route_node *route_prev(struct route_node *node) |
718e3744 | 48 | { |
d62a17ae | 49 | struct route_node *end; |
50 | struct route_node *prev = NULL; | |
51 | ||
52 | end = node; | |
53 | node = node->parent; | |
54 | if (node) | |
55 | route_lock_node(node); | |
56 | while (node) { | |
57 | prev = node; | |
58 | node = route_next(node); | |
59 | if (node == end) { | |
60 | route_unlock_node(node); | |
61 | node = NULL; | |
62 | } | |
63 | } | |
64 | route_unlock_node(end); | |
65 | if (prev) | |
66 | route_lock_node(prev); | |
67 | ||
68 | return prev; | |
718e3744 | 69 | } |
70 | ||
d62a17ae | 71 | static struct cmd_node debug_node = { |
72 | DEBUG_NODE, "", 1 /* VTYSH */ | |
508e53e2 | 73 | }; |
718e3744 | 74 | |
d62a17ae | 75 | static int config_write_ospf6_debug(struct vty *vty) |
508e53e2 | 76 | { |
d62a17ae | 77 | config_write_ospf6_debug_message(vty); |
78 | config_write_ospf6_debug_lsa(vty); | |
79 | config_write_ospf6_debug_zebra(vty); | |
80 | config_write_ospf6_debug_interface(vty); | |
81 | config_write_ospf6_debug_neighbor(vty); | |
82 | config_write_ospf6_debug_spf(vty); | |
83 | config_write_ospf6_debug_route(vty); | |
84 | config_write_ospf6_debug_brouter(vty); | |
85 | config_write_ospf6_debug_asbr(vty); | |
86 | config_write_ospf6_debug_abr(vty); | |
87 | config_write_ospf6_debug_flood(vty); | |
87f6dc50 | 88 | |
d62a17ae | 89 | return 0; |
718e3744 | 90 | } |
91 | ||
87f6dc50 DS |
92 | DEFUN_NOSH (show_debugging_ospf6, |
93 | show_debugging_ospf6_cmd, | |
94 | "show debugging [ospf6]", | |
95 | SHOW_STR | |
96 | DEBUG_STR | |
97 | OSPF6_STR) | |
98 | { | |
99 | vty_out(vty, "OSPF6 debugging status:"); | |
100 | ||
101 | config_write_ospf6_debug(vty); | |
102 | ||
103 | return CMD_SUCCESS; | |
104 | } | |
105 | ||
d62a17ae | 106 | #define AREA_LSDB_TITLE_FORMAT \ |
107 | "\n Area Scoped Link State Database (Area %s)\n\n" | |
108 | #define IF_LSDB_TITLE_FORMAT \ | |
109 | "\n I/F Scoped Link State Database (I/F %s in Area %s)\n\n" | |
110 | #define AS_LSDB_TITLE_FORMAT "\n AS Scoped Link State Database\n\n" | |
049207c3 | 111 | |
d62a17ae | 112 | static int parse_show_level(int idx_level, int argc, struct cmd_token **argv) |
049207c3 | 113 | { |
d62a17ae | 114 | int level = OSPF6_LSDB_SHOW_LEVEL_NORMAL; |
115 | ||
116 | if (argc > idx_level) { | |
117 | if (strmatch(argv[idx_level]->text, "detail")) | |
118 | level = OSPF6_LSDB_SHOW_LEVEL_DETAIL; | |
119 | else if (strmatch(argv[idx_level]->text, "dump")) | |
120 | level = OSPF6_LSDB_SHOW_LEVEL_DUMP; | |
121 | else if (strmatch(argv[idx_level]->text, "internal")) | |
122 | level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL; | |
123 | } | |
124 | ||
125 | return level; | |
049207c3 | 126 | } |
127 | ||
d62a17ae | 128 | static u_int16_t parse_type_spec(int idx_lsa, int argc, struct cmd_token **argv) |
049207c3 | 129 | { |
d62a17ae | 130 | u_int16_t type = 0; |
131 | ||
132 | if (argc > idx_lsa) { | |
133 | if (strmatch(argv[idx_lsa]->text, "router")) | |
134 | type = htons(OSPF6_LSTYPE_ROUTER); | |
135 | else if (strmatch(argv[idx_lsa]->text, "network")) | |
136 | type = htons(OSPF6_LSTYPE_NETWORK); | |
137 | else if (strmatch(argv[idx_lsa]->text, "as-external")) | |
138 | type = htons(OSPF6_LSTYPE_AS_EXTERNAL); | |
139 | else if (strmatch(argv[idx_lsa]->text, "intra-prefix")) | |
140 | type = htons(OSPF6_LSTYPE_INTRA_PREFIX); | |
141 | else if (strmatch(argv[idx_lsa]->text, "inter-router")) | |
142 | type = htons(OSPF6_LSTYPE_INTER_ROUTER); | |
143 | else if (strmatch(argv[idx_lsa]->text, "inter-prefix")) | |
144 | type = htons(OSPF6_LSTYPE_INTER_PREFIX); | |
145 | else if (strmatch(argv[idx_lsa]->text, "link")) | |
146 | type = htons(OSPF6_LSTYPE_LINK); | |
147 | } | |
148 | ||
149 | return type; | |
049207c3 | 150 | } |
151 | ||
508e53e2 | 152 | DEFUN (show_ipv6_ospf6_database, |
153 | show_ipv6_ospf6_database_cmd, | |
6de69f83 | 154 | "show ipv6 ospf6 database [<detail|dump|internal>]", |
508e53e2 | 155 | SHOW_STR |
156 | IPV6_STR | |
157 | OSPF6_STR | |
158 | "Display Link state database\n" | |
14b16482 DW |
159 | "Display details of LSAs\n" |
160 | "Dump LSAs\n" | |
161 | "Display LSA's internal information\n") | |
718e3744 | 162 | { |
d62a17ae | 163 | int idx_level = 4; |
164 | int level; | |
165 | struct listnode *i, *j; | |
166 | struct ospf6 *o = ospf6; | |
167 | struct ospf6_area *oa; | |
168 | struct ospf6_interface *oi; | |
169 | ||
170 | OSPF6_CMD_CHECK_RUNNING(); | |
171 | ||
172 | level = parse_show_level(idx_level, argc, argv); | |
173 | ||
174 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
175 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
176 | ospf6_lsdb_show(vty, level, NULL, NULL, NULL, oa->lsdb); | |
177 | } | |
178 | ||
179 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
180 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
181 | vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, | |
182 | oa->name); | |
183 | ospf6_lsdb_show(vty, level, NULL, NULL, NULL, oi->lsdb); | |
184 | } | |
185 | } | |
186 | ||
187 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
188 | ospf6_lsdb_show(vty, level, NULL, NULL, NULL, o->lsdb); | |
189 | ||
190 | vty_out(vty, "\n"); | |
191 | return CMD_SUCCESS; | |
718e3744 | 192 | } |
193 | ||
508e53e2 | 194 | DEFUN (show_ipv6_ospf6_database_type, |
195 | show_ipv6_ospf6_database_type_cmd, | |
14b16482 | 196 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> [<detail|dump|internal>]", |
718e3744 | 197 | SHOW_STR |
508e53e2 | 198 | IPV6_STR |
199 | OSPF6_STR | |
200 | "Display Link state database\n" | |
201 | "Display Router LSAs\n" | |
202 | "Display Network LSAs\n" | |
203 | "Display Inter-Area-Prefix LSAs\n" | |
204 | "Display Inter-Area-Router LSAs\n" | |
205 | "Display As-External LSAs\n" | |
206 | "Display Group-Membership LSAs\n" | |
207 | "Display Type-7 LSAs\n" | |
208 | "Display Link LSAs\n" | |
209 | "Display Intra-Area-Prefix LSAs\n" | |
14b16482 DW |
210 | "Display details of LSAs\n" |
211 | "Dump LSAs\n" | |
212 | "Display LSA's internal information\n" | |
508e53e2 | 213 | ) |
718e3744 | 214 | { |
d62a17ae | 215 | int idx_lsa = 4; |
216 | int idx_level = 5; | |
217 | int level; | |
218 | struct listnode *i, *j; | |
219 | struct ospf6 *o = ospf6; | |
220 | struct ospf6_area *oa; | |
221 | struct ospf6_interface *oi; | |
222 | u_int16_t type = 0; | |
223 | ||
224 | OSPF6_CMD_CHECK_RUNNING(); | |
225 | ||
226 | type = parse_type_spec(idx_lsa, argc, argv); | |
227 | level = parse_show_level(idx_level, argc, argv); | |
228 | ||
229 | switch (OSPF6_LSA_SCOPE(type)) { | |
230 | case OSPF6_SCOPE_AREA: | |
231 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
232 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
233 | ospf6_lsdb_show(vty, level, &type, NULL, NULL, | |
234 | oa->lsdb); | |
235 | } | |
236 | break; | |
237 | ||
238 | case OSPF6_SCOPE_LINKLOCAL: | |
239 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
240 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
241 | vty_out(vty, IF_LSDB_TITLE_FORMAT, | |
242 | oi->interface->name, oa->name); | |
243 | ospf6_lsdb_show(vty, level, &type, NULL, NULL, | |
244 | oi->lsdb); | |
245 | } | |
246 | } | |
247 | break; | |
248 | ||
249 | case OSPF6_SCOPE_AS: | |
250 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
251 | ospf6_lsdb_show(vty, level, &type, NULL, NULL, o->lsdb); | |
252 | break; | |
253 | ||
254 | default: | |
255 | assert(0); | |
256 | break; | |
257 | } | |
258 | ||
259 | vty_out(vty, "\n"); | |
260 | return CMD_SUCCESS; | |
718e3744 | 261 | } |
262 | ||
508e53e2 | 263 | DEFUN (show_ipv6_ospf6_database_id, |
264 | show_ipv6_ospf6_database_id_cmd, | |
093d7a3a | 265 | "show ipv6 ospf6 database <*|linkstate-id> A.B.C.D [<detail|dump|internal>]", |
718e3744 | 266 | SHOW_STR |
508e53e2 | 267 | IPV6_STR |
718e3744 | 268 | OSPF6_STR |
508e53e2 | 269 | "Display Link state database\n" |
270 | "Any Link state Type\n" | |
093d7a3a | 271 | "Search by Link state ID\n" |
508e53e2 | 272 | "Specify Link state ID as IPv4 address notation\n" |
093d7a3a DW |
273 | "Display details of LSAs\n" |
274 | "Dump LSAs\n" | |
275 | "Display LSA's internal information\n") | |
718e3744 | 276 | { |
d62a17ae | 277 | int idx_ipv4 = 5; |
278 | int idx_level = 6; | |
279 | int level; | |
280 | struct listnode *i, *j; | |
281 | struct ospf6 *o = ospf6; | |
282 | struct ospf6_area *oa; | |
283 | struct ospf6_interface *oi; | |
284 | u_int32_t id = 0; | |
285 | ||
286 | OSPF6_CMD_CHECK_RUNNING(); | |
287 | ||
288 | if (argv[idx_ipv4]->type == IPV4_TKN) | |
289 | inet_pton(AF_INET, argv[idx_ipv4]->arg, &id); | |
290 | ||
291 | level = parse_show_level(idx_level, argc, argv); | |
292 | ||
293 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
294 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
295 | ospf6_lsdb_show(vty, level, NULL, &id, NULL, oa->lsdb); | |
296 | } | |
297 | ||
298 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
299 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
300 | vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, | |
301 | oa->name); | |
302 | ospf6_lsdb_show(vty, level, NULL, &id, NULL, oi->lsdb); | |
303 | } | |
304 | } | |
305 | ||
306 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
307 | ospf6_lsdb_show(vty, level, NULL, &id, NULL, o->lsdb); | |
308 | ||
309 | vty_out(vty, "\n"); | |
310 | return CMD_SUCCESS; | |
718e3744 | 311 | } |
312 | ||
508e53e2 | 313 | DEFUN (show_ipv6_ospf6_database_router, |
314 | show_ipv6_ospf6_database_router_cmd, | |
093d7a3a | 315 | "show ipv6 ospf6 database <*|adv-router> * A.B.C.D <detail|dump|internal>", |
508e53e2 | 316 | SHOW_STR |
317 | IPV6_STR | |
318 | OSPF6_STR | |
319 | "Display Link state database\n" | |
320 | "Any Link state Type\n" | |
093d7a3a | 321 | "Search by Advertising Router\n" |
508e53e2 | 322 | "Any Link state ID\n" |
323 | "Specify Advertising Router as IPv4 address notation\n" | |
093d7a3a DW |
324 | "Display details of LSAs\n" |
325 | "Dump LSAs\n" | |
326 | "Display LSA's internal information\n") | |
718e3744 | 327 | { |
d62a17ae | 328 | int idx_ipv4 = 6; |
329 | int idx_level = 7; | |
330 | int level; | |
331 | struct listnode *i, *j; | |
332 | struct ospf6 *o = ospf6; | |
333 | struct ospf6_area *oa; | |
334 | struct ospf6_interface *oi; | |
335 | u_int32_t adv_router = 0; | |
336 | ||
337 | OSPF6_CMD_CHECK_RUNNING(); | |
338 | inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); | |
339 | level = parse_show_level(idx_level, argc, argv); | |
340 | ||
341 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
342 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
343 | ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, oa->lsdb); | |
344 | } | |
345 | ||
346 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
347 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
348 | vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, | |
349 | oa->name); | |
350 | ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, | |
351 | oi->lsdb); | |
352 | } | |
353 | } | |
354 | ||
355 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
356 | ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, o->lsdb); | |
357 | ||
358 | vty_out(vty, "\n"); | |
359 | return CMD_SUCCESS; | |
508e53e2 | 360 | } |
361 | ||
508e53e2 | 362 | DEFUN (show_ipv6_ospf6_database_type_id, |
363 | show_ipv6_ospf6_database_type_id_cmd, | |
373886ab | 364 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> linkstate-id A.B.C.D [<detail|dump|internal>]", |
508e53e2 | 365 | SHOW_STR |
366 | IPV6_STR | |
367 | OSPF6_STR | |
368 | "Display Link state database\n" | |
369 | "Display Router LSAs\n" | |
370 | "Display Network LSAs\n" | |
371 | "Display Inter-Area-Prefix LSAs\n" | |
372 | "Display Inter-Area-Router LSAs\n" | |
373 | "Display As-External LSAs\n" | |
374 | "Display Group-Membership LSAs\n" | |
375 | "Display Type-7 LSAs\n" | |
376 | "Display Link LSAs\n" | |
377 | "Display Intra-Area-Prefix LSAs\n" | |
093d7a3a | 378 | "Search by Link state ID\n" |
508e53e2 | 379 | "Specify Link state ID as IPv4 address notation\n" |
093d7a3a DW |
380 | "Display details of LSAs\n" |
381 | "Dump LSAs\n" | |
382 | "Display LSA's internal information\n" | |
508e53e2 | 383 | ) |
384 | { | |
d62a17ae | 385 | int idx_lsa = 4; |
386 | int idx_ipv4 = 6; | |
387 | int idx_level = 7; | |
388 | int level; | |
389 | struct listnode *i, *j; | |
390 | struct ospf6 *o = ospf6; | |
391 | struct ospf6_area *oa; | |
392 | struct ospf6_interface *oi; | |
393 | u_int16_t type = 0; | |
394 | u_int32_t id = 0; | |
395 | ||
396 | OSPF6_CMD_CHECK_RUNNING(); | |
397 | ||
398 | type = parse_type_spec(idx_lsa, argc, argv); | |
399 | inet_pton(AF_INET, argv[idx_ipv4]->arg, &id); | |
400 | level = parse_show_level(idx_level, argc, argv); | |
401 | ||
402 | switch (OSPF6_LSA_SCOPE(type)) { | |
403 | case OSPF6_SCOPE_AREA: | |
404 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
405 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
406 | ospf6_lsdb_show(vty, level, &type, &id, NULL, oa->lsdb); | |
407 | } | |
408 | break; | |
409 | ||
410 | case OSPF6_SCOPE_LINKLOCAL: | |
411 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
412 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
413 | vty_out(vty, IF_LSDB_TITLE_FORMAT, | |
414 | oi->interface->name, oa->name); | |
415 | ospf6_lsdb_show(vty, level, &type, &id, NULL, | |
416 | oi->lsdb); | |
417 | } | |
418 | } | |
419 | break; | |
420 | ||
421 | case OSPF6_SCOPE_AS: | |
422 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
423 | ospf6_lsdb_show(vty, level, &type, &id, NULL, o->lsdb); | |
424 | break; | |
425 | ||
426 | default: | |
427 | assert(0); | |
428 | break; | |
429 | } | |
430 | ||
431 | vty_out(vty, "\n"); | |
432 | return CMD_SUCCESS; | |
718e3744 | 433 | } |
434 | ||
508e53e2 | 435 | DEFUN (show_ipv6_ospf6_database_type_router, |
436 | show_ipv6_ospf6_database_type_router_cmd, | |
093d7a3a | 437 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> <*|adv-router> A.B.C.D [<detail|dump|internal>]", |
508e53e2 | 438 | SHOW_STR |
439 | IPV6_STR | |
440 | OSPF6_STR | |
441 | "Display Link state database\n" | |
442 | "Display Router LSAs\n" | |
443 | "Display Network LSAs\n" | |
444 | "Display Inter-Area-Prefix LSAs\n" | |
445 | "Display Inter-Area-Router LSAs\n" | |
446 | "Display As-External LSAs\n" | |
447 | "Display Group-Membership LSAs\n" | |
448 | "Display Type-7 LSAs\n" | |
449 | "Display Link LSAs\n" | |
450 | "Display Intra-Area-Prefix LSAs\n" | |
451 | "Any Link state ID\n" | |
093d7a3a | 452 | "Search by Advertising Router\n" |
508e53e2 | 453 | "Specify Advertising Router as IPv4 address notation\n" |
093d7a3a DW |
454 | "Display details of LSAs\n" |
455 | "Dump LSAs\n" | |
456 | "Display LSA's internal information\n" | |
718e3744 | 457 | ) |
458 | { | |
d62a17ae | 459 | int idx_lsa = 4; |
460 | int idx_ipv4 = 6; | |
461 | int idx_level = 7; | |
462 | int level; | |
463 | struct listnode *i, *j; | |
464 | struct ospf6 *o = ospf6; | |
465 | struct ospf6_area *oa; | |
466 | struct ospf6_interface *oi; | |
467 | u_int16_t type = 0; | |
468 | u_int32_t adv_router = 0; | |
469 | ||
470 | OSPF6_CMD_CHECK_RUNNING(); | |
471 | ||
472 | type = parse_type_spec(idx_lsa, argc, argv); | |
473 | inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); | |
474 | level = parse_show_level(idx_level, argc, argv); | |
475 | ||
476 | switch (OSPF6_LSA_SCOPE(type)) { | |
477 | case OSPF6_SCOPE_AREA: | |
478 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
479 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
480 | ospf6_lsdb_show(vty, level, &type, NULL, &adv_router, | |
481 | oa->lsdb); | |
482 | } | |
483 | break; | |
484 | ||
485 | case OSPF6_SCOPE_LINKLOCAL: | |
486 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
487 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
488 | vty_out(vty, IF_LSDB_TITLE_FORMAT, | |
489 | oi->interface->name, oa->name); | |
490 | ospf6_lsdb_show(vty, level, &type, NULL, | |
491 | &adv_router, oi->lsdb); | |
492 | } | |
493 | } | |
494 | break; | |
495 | ||
496 | case OSPF6_SCOPE_AS: | |
497 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
498 | ospf6_lsdb_show(vty, level, &type, NULL, &adv_router, o->lsdb); | |
499 | break; | |
500 | ||
501 | default: | |
502 | assert(0); | |
503 | break; | |
504 | } | |
505 | ||
506 | vty_out(vty, "\n"); | |
507 | return CMD_SUCCESS; | |
718e3744 | 508 | } |
509 | ||
508e53e2 | 510 | |
049207c3 | 511 | DEFUN (show_ipv6_ospf6_database_id_router, |
512 | show_ipv6_ospf6_database_id_router_cmd, | |
14b16482 | 513 | "show ipv6 ospf6 database * A.B.C.D A.B.C.D [<detail|dump|internal>]", |
049207c3 | 514 | SHOW_STR |
515 | IPV6_STR | |
516 | OSPF6_STR | |
517 | "Display Link state database\n" | |
518 | "Any Link state Type\n" | |
519 | "Specify Link state ID as IPv4 address notation\n" | |
520 | "Specify Advertising Router as IPv4 address notation\n" | |
14b16482 DW |
521 | "Display details of LSAs\n" |
522 | "Dump LSAs\n" | |
523 | "Display LSA's internal information\n" | |
049207c3 | 524 | ) |
525 | { | |
d62a17ae | 526 | int idx_ls_id = 5; |
527 | int idx_adv_rtr = 6; | |
528 | int idx_level = 7; | |
529 | int level; | |
530 | struct listnode *i, *j; | |
531 | struct ospf6 *o = ospf6; | |
532 | struct ospf6_area *oa; | |
533 | struct ospf6_interface *oi; | |
534 | u_int32_t id = 0; | |
535 | u_int32_t adv_router = 0; | |
536 | ||
537 | OSPF6_CMD_CHECK_RUNNING(); | |
538 | inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); | |
539 | inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); | |
540 | level = parse_show_level(idx_level, argc, argv); | |
541 | ||
542 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
543 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
544 | ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, oa->lsdb); | |
545 | } | |
546 | ||
547 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
548 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
549 | vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, | |
550 | oa->name); | |
551 | ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, | |
552 | oi->lsdb); | |
553 | } | |
554 | } | |
555 | ||
556 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
557 | ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, o->lsdb); | |
558 | ||
559 | vty_out(vty, "\n"); | |
560 | return CMD_SUCCESS; | |
718e3744 | 561 | } |
562 | ||
508e53e2 | 563 | |
049207c3 | 564 | DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, |
565 | show_ipv6_ospf6_database_adv_router_linkstate_id_cmd, | |
14b16482 | 566 | "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>]", |
049207c3 | 567 | SHOW_STR |
568 | IPV6_STR | |
569 | OSPF6_STR | |
570 | "Display Link state database\n" | |
571 | "Search by Advertising Router\n" | |
572 | "Specify Advertising Router as IPv4 address notation\n" | |
573 | "Search by Link state ID\n" | |
574 | "Specify Link state ID as IPv4 address notation\n" | |
14b16482 DW |
575 | "Display details of LSAs\n" |
576 | "Dump LSAs\n" | |
577 | "Display LSA's internal information\n") | |
049207c3 | 578 | { |
d62a17ae | 579 | int idx_adv_rtr = 5; |
580 | int idx_ls_id = 7; | |
581 | int idx_level = 8; | |
582 | int level; | |
583 | struct listnode *i, *j; | |
584 | struct ospf6 *o = ospf6; | |
585 | struct ospf6_area *oa; | |
586 | struct ospf6_interface *oi; | |
587 | u_int32_t id = 0; | |
588 | u_int32_t adv_router = 0; | |
589 | ||
590 | OSPF6_CMD_CHECK_RUNNING(); | |
591 | inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); | |
592 | inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); | |
593 | level = parse_show_level(idx_level, argc, argv); | |
594 | ||
595 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
596 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
597 | ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, oa->lsdb); | |
598 | } | |
599 | ||
600 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
601 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
602 | vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, | |
603 | oa->name); | |
604 | ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, | |
605 | oi->lsdb); | |
606 | } | |
607 | } | |
608 | ||
609 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
610 | ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, o->lsdb); | |
611 | ||
612 | vty_out(vty, "\n"); | |
613 | return CMD_SUCCESS; | |
049207c3 | 614 | } |
615 | ||
508e53e2 | 616 | DEFUN (show_ipv6_ospf6_database_type_id_router, |
617 | show_ipv6_ospf6_database_type_id_router_cmd, | |
14b16482 | 618 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D A.B.C.D [<dump|internal>]", |
508e53e2 | 619 | SHOW_STR |
620 | IPV6_STR | |
621 | OSPF6_STR | |
622 | "Display Link state database\n" | |
623 | "Display Router LSAs\n" | |
624 | "Display Network LSAs\n" | |
625 | "Display Inter-Area-Prefix LSAs\n" | |
626 | "Display Inter-Area-Router LSAs\n" | |
627 | "Display As-External LSAs\n" | |
628 | "Display Group-Membership LSAs\n" | |
629 | "Display Type-7 LSAs\n" | |
630 | "Display Link LSAs\n" | |
631 | "Display Intra-Area-Prefix LSAs\n" | |
632 | "Specify Link state ID as IPv4 address notation\n" | |
633 | "Specify Advertising Router as IPv4 address notation\n" | |
14b16482 DW |
634 | "Dump LSAs\n" |
635 | "Display LSA's internal information\n") | |
718e3744 | 636 | { |
d62a17ae | 637 | int idx_lsa = 4; |
638 | int idx_ls_id = 5; | |
639 | int idx_adv_rtr = 6; | |
640 | int idx_level = 7; | |
641 | int level; | |
642 | struct listnode *i, *j; | |
643 | struct ospf6 *o = ospf6; | |
644 | struct ospf6_area *oa; | |
645 | struct ospf6_interface *oi; | |
646 | u_int16_t type = 0; | |
647 | u_int32_t id = 0; | |
648 | u_int32_t adv_router = 0; | |
649 | ||
650 | OSPF6_CMD_CHECK_RUNNING(); | |
651 | ||
652 | type = parse_type_spec(idx_lsa, argc, argv); | |
653 | inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); | |
654 | inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); | |
655 | level = parse_show_level(idx_level, argc, argv); | |
656 | ||
657 | switch (OSPF6_LSA_SCOPE(type)) { | |
658 | case OSPF6_SCOPE_AREA: | |
659 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
660 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
661 | ospf6_lsdb_show(vty, level, &type, &id, &adv_router, | |
662 | oa->lsdb); | |
663 | } | |
664 | break; | |
665 | ||
666 | case OSPF6_SCOPE_LINKLOCAL: | |
667 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
668 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
669 | vty_out(vty, IF_LSDB_TITLE_FORMAT, | |
670 | oi->interface->name, oa->name); | |
671 | ospf6_lsdb_show(vty, level, &type, &id, | |
672 | &adv_router, oi->lsdb); | |
673 | } | |
674 | } | |
675 | break; | |
676 | ||
677 | case OSPF6_SCOPE_AS: | |
678 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
679 | ospf6_lsdb_show(vty, level, &type, &id, &adv_router, o->lsdb); | |
680 | break; | |
681 | ||
682 | default: | |
683 | assert(0); | |
684 | break; | |
685 | } | |
686 | ||
687 | vty_out(vty, "\n"); | |
688 | return CMD_SUCCESS; | |
718e3744 | 689 | } |
690 | ||
049207c3 | 691 | |
692 | DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, | |
693 | show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd, | |
14b16482 | 694 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> adv-router A.B.C.D linkstate-id A.B.C.D [<dump|internal>]", |
049207c3 | 695 | SHOW_STR |
696 | IPV6_STR | |
697 | OSPF6_STR | |
698 | "Display Link state database\n" | |
699 | "Display Router LSAs\n" | |
700 | "Display Network LSAs\n" | |
701 | "Display Inter-Area-Prefix LSAs\n" | |
702 | "Display Inter-Area-Router LSAs\n" | |
703 | "Display As-External LSAs\n" | |
704 | "Display Group-Membership LSAs\n" | |
705 | "Display Type-7 LSAs\n" | |
706 | "Display Link LSAs\n" | |
707 | "Display Intra-Area-Prefix LSAs\n" | |
708 | "Search by Advertising Router\n" | |
709 | "Specify Advertising Router as IPv4 address notation\n" | |
710 | "Search by Link state ID\n" | |
711 | "Specify Link state ID as IPv4 address notation\n" | |
14b16482 DW |
712 | "Dump LSAs\n" |
713 | "Display LSA's internal information\n") | |
049207c3 | 714 | { |
d62a17ae | 715 | int idx_lsa = 4; |
716 | int idx_adv_rtr = 6; | |
717 | int idx_ls_id = 8; | |
718 | int idx_level = 9; | |
719 | int level; | |
720 | struct listnode *i, *j; | |
721 | struct ospf6 *o = ospf6; | |
722 | struct ospf6_area *oa; | |
723 | struct ospf6_interface *oi; | |
724 | u_int16_t type = 0; | |
725 | u_int32_t id = 0; | |
726 | u_int32_t adv_router = 0; | |
727 | ||
728 | OSPF6_CMD_CHECK_RUNNING(); | |
729 | ||
730 | type = parse_type_spec(idx_lsa, argc, argv); | |
731 | inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); | |
732 | inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); | |
733 | level = parse_show_level(idx_level, argc, argv); | |
734 | ||
735 | switch (OSPF6_LSA_SCOPE(type)) { | |
736 | case OSPF6_SCOPE_AREA: | |
737 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
738 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
739 | ospf6_lsdb_show(vty, level, &type, &id, &adv_router, | |
740 | oa->lsdb); | |
741 | } | |
742 | break; | |
743 | ||
744 | case OSPF6_SCOPE_LINKLOCAL: | |
745 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
746 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
747 | vty_out(vty, IF_LSDB_TITLE_FORMAT, | |
748 | oi->interface->name, oa->name); | |
749 | ospf6_lsdb_show(vty, level, &type, &id, | |
750 | &adv_router, oi->lsdb); | |
751 | } | |
752 | } | |
753 | break; | |
754 | ||
755 | case OSPF6_SCOPE_AS: | |
756 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
757 | ospf6_lsdb_show(vty, level, &type, &id, &adv_router, o->lsdb); | |
758 | break; | |
759 | ||
760 | default: | |
761 | assert(0); | |
762 | break; | |
763 | } | |
764 | ||
765 | vty_out(vty, "\n"); | |
766 | return CMD_SUCCESS; | |
049207c3 | 767 | } |
768 | ||
508e53e2 | 769 | DEFUN (show_ipv6_ospf6_database_self_originated, |
770 | show_ipv6_ospf6_database_self_originated_cmd, | |
14b16482 | 771 | "show ipv6 ospf6 database self-originated [<detail|dump|internal>]", |
508e53e2 | 772 | SHOW_STR |
773 | IPV6_STR | |
774 | OSPF6_STR | |
16cedbb0 | 775 | "Display Link state database\n" |
508e53e2 | 776 | "Display Self-originated LSAs\n" |
14b16482 DW |
777 | "Display details of LSAs\n" |
778 | "Dump LSAs\n" | |
779 | "Display LSA's internal information\n") | |
718e3744 | 780 | { |
d62a17ae | 781 | int idx_level = 5; |
782 | int level; | |
783 | struct listnode *i, *j; | |
784 | struct ospf6 *o = ospf6; | |
785 | struct ospf6_area *oa; | |
786 | struct ospf6_interface *oi; | |
787 | u_int32_t adv_router = 0; | |
788 | ||
789 | OSPF6_CMD_CHECK_RUNNING(); | |
790 | level = parse_show_level(idx_level, argc, argv); | |
791 | adv_router = o->router_id; | |
792 | ||
793 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
794 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
795 | ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, oa->lsdb); | |
796 | } | |
797 | ||
798 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
799 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
800 | vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, | |
801 | oa->name); | |
802 | ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, | |
803 | oi->lsdb); | |
804 | } | |
805 | } | |
806 | ||
807 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
808 | ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, o->lsdb); | |
809 | ||
810 | vty_out(vty, "\n"); | |
811 | return CMD_SUCCESS; | |
718e3744 | 812 | } |
813 | ||
508e53e2 | 814 | |
815 | DEFUN (show_ipv6_ospf6_database_type_self_originated, | |
816 | show_ipv6_ospf6_database_type_self_originated_cmd, | |
14b16482 | 817 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>]", |
508e53e2 | 818 | SHOW_STR |
819 | IPV6_STR | |
820 | OSPF6_STR | |
821 | "Display Link state database\n" | |
822 | "Display Router LSAs\n" | |
823 | "Display Network LSAs\n" | |
824 | "Display Inter-Area-Prefix LSAs\n" | |
825 | "Display Inter-Area-Router LSAs\n" | |
826 | "Display As-External LSAs\n" | |
827 | "Display Group-Membership LSAs\n" | |
828 | "Display Type-7 LSAs\n" | |
829 | "Display Link LSAs\n" | |
830 | "Display Intra-Area-Prefix LSAs\n" | |
831 | "Display Self-originated LSAs\n" | |
14b16482 DW |
832 | "Display details of LSAs\n" |
833 | "Dump LSAs\n" | |
834 | "Display LSA's internal information\n") | |
718e3744 | 835 | { |
d62a17ae | 836 | int idx_lsa = 4; |
837 | int idx_level = 6; | |
838 | int level; | |
839 | struct listnode *i, *j; | |
840 | struct ospf6 *o = ospf6; | |
841 | struct ospf6_area *oa; | |
842 | struct ospf6_interface *oi; | |
843 | u_int16_t type = 0; | |
844 | u_int32_t adv_router = 0; | |
845 | ||
846 | OSPF6_CMD_CHECK_RUNNING(); | |
847 | ||
848 | type = parse_type_spec(idx_lsa, argc, argv); | |
849 | level = parse_show_level(idx_level, argc, argv); | |
850 | ||
851 | adv_router = o->router_id; | |
852 | ||
853 | switch (OSPF6_LSA_SCOPE(type)) { | |
854 | case OSPF6_SCOPE_AREA: | |
855 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
856 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
857 | ospf6_lsdb_show(vty, level, &type, NULL, &adv_router, | |
858 | oa->lsdb); | |
859 | } | |
860 | break; | |
861 | ||
862 | case OSPF6_SCOPE_LINKLOCAL: | |
863 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
864 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
865 | vty_out(vty, IF_LSDB_TITLE_FORMAT, | |
866 | oi->interface->name, oa->name); | |
867 | ospf6_lsdb_show(vty, level, &type, NULL, | |
868 | &adv_router, oi->lsdb); | |
869 | } | |
870 | } | |
871 | break; | |
872 | ||
873 | case OSPF6_SCOPE_AS: | |
874 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
875 | ospf6_lsdb_show(vty, level, &type, NULL, &adv_router, o->lsdb); | |
876 | break; | |
877 | ||
878 | default: | |
879 | assert(0); | |
880 | break; | |
881 | } | |
882 | ||
883 | vty_out(vty, "\n"); | |
884 | return CMD_SUCCESS; | |
049207c3 | 885 | } |
508e53e2 | 886 | |
049207c3 | 887 | DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, |
888 | show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd, | |
14b16482 | 889 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated linkstate-id A.B.C.D [<detail|dump|internal>]", |
049207c3 | 890 | SHOW_STR |
891 | IPV6_STR | |
892 | OSPF6_STR | |
893 | "Display Link state database\n" | |
894 | "Display Router LSAs\n" | |
895 | "Display Network LSAs\n" | |
896 | "Display Inter-Area-Prefix LSAs\n" | |
897 | "Display Inter-Area-Router LSAs\n" | |
898 | "Display As-External LSAs\n" | |
899 | "Display Group-Membership LSAs\n" | |
900 | "Display Type-7 LSAs\n" | |
901 | "Display Link LSAs\n" | |
902 | "Display Intra-Area-Prefix LSAs\n" | |
903 | "Display Self-originated LSAs\n" | |
904 | "Search by Link state ID\n" | |
905 | "Specify Link state ID as IPv4 address notation\n" | |
14b16482 DW |
906 | "Display details of LSAs\n" |
907 | "Dump LSAs\n" | |
908 | "Display LSA's internal information\n") | |
049207c3 | 909 | { |
d62a17ae | 910 | int idx_lsa = 4; |
911 | int idx_ls_id = 7; | |
912 | int idx_level = 8; | |
913 | int level; | |
914 | struct listnode *i, *j; | |
915 | struct ospf6 *o = ospf6; | |
916 | struct ospf6_area *oa; | |
917 | struct ospf6_interface *oi; | |
918 | u_int16_t type = 0; | |
919 | u_int32_t adv_router = 0; | |
920 | u_int32_t id = 0; | |
921 | ||
922 | OSPF6_CMD_CHECK_RUNNING(); | |
923 | ||
924 | type = parse_type_spec(idx_lsa, argc, argv); | |
925 | inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); | |
926 | level = parse_show_level(idx_level, argc, argv); | |
927 | adv_router = o->router_id; | |
928 | ||
929 | switch (OSPF6_LSA_SCOPE(type)) { | |
930 | case OSPF6_SCOPE_AREA: | |
931 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
932 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
933 | ospf6_lsdb_show(vty, level, &type, &id, &adv_router, | |
934 | oa->lsdb); | |
935 | } | |
936 | break; | |
937 | ||
938 | case OSPF6_SCOPE_LINKLOCAL: | |
939 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
940 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
941 | vty_out(vty, IF_LSDB_TITLE_FORMAT, | |
942 | oi->interface->name, oa->name); | |
943 | ospf6_lsdb_show(vty, level, &type, &id, | |
944 | &adv_router, oi->lsdb); | |
945 | } | |
946 | } | |
947 | break; | |
948 | ||
949 | case OSPF6_SCOPE_AS: | |
950 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
951 | ospf6_lsdb_show(vty, level, &type, &id, &adv_router, o->lsdb); | |
952 | break; | |
953 | ||
954 | default: | |
955 | assert(0); | |
956 | break; | |
957 | } | |
958 | ||
959 | vty_out(vty, "\n"); | |
960 | return CMD_SUCCESS; | |
718e3744 | 961 | } |
718e3744 | 962 | |
508e53e2 | 963 | DEFUN (show_ipv6_ospf6_database_type_id_self_originated, |
964 | show_ipv6_ospf6_database_type_id_self_originated_cmd, | |
14b16482 | 965 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D self-originated [<detail|dump|internal>]", |
508e53e2 | 966 | SHOW_STR |
967 | IPV6_STR | |
968 | OSPF6_STR | |
969 | "Display Link state database\n" | |
970 | "Display Router LSAs\n" | |
971 | "Display Network LSAs\n" | |
972 | "Display Inter-Area-Prefix LSAs\n" | |
973 | "Display Inter-Area-Router LSAs\n" | |
974 | "Display As-External LSAs\n" | |
975 | "Display Group-Membership LSAs\n" | |
976 | "Display Type-7 LSAs\n" | |
977 | "Display Link LSAs\n" | |
978 | "Display Intra-Area-Prefix LSAs\n" | |
979 | "Specify Link state ID as IPv4 address notation\n" | |
980 | "Display Self-originated LSAs\n" | |
14b16482 DW |
981 | "Display details of LSAs\n" |
982 | "Dump LSAs\n" | |
983 | "Display LSA's internal information\n") | |
718e3744 | 984 | { |
d62a17ae | 985 | int idx_lsa = 4; |
986 | int idx_ls_id = 5; | |
987 | int idx_level = 7; | |
988 | int level; | |
989 | struct listnode *i, *j; | |
990 | struct ospf6 *o = ospf6; | |
991 | struct ospf6_area *oa; | |
992 | struct ospf6_interface *oi; | |
993 | u_int16_t type = 0; | |
994 | u_int32_t adv_router = 0; | |
995 | u_int32_t id = 0; | |
996 | ||
997 | OSPF6_CMD_CHECK_RUNNING(); | |
998 | ||
999 | type = parse_type_spec(idx_lsa, argc, argv); | |
1000 | inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); | |
1001 | level = parse_show_level(idx_level, argc, argv); | |
1002 | adv_router = o->router_id; | |
1003 | ||
1004 | switch (OSPF6_LSA_SCOPE(type)) { | |
1005 | case OSPF6_SCOPE_AREA: | |
1006 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
1007 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
1008 | ospf6_lsdb_show(vty, level, &type, &id, &adv_router, | |
1009 | oa->lsdb); | |
1010 | } | |
1011 | break; | |
1012 | ||
1013 | case OSPF6_SCOPE_LINKLOCAL: | |
1014 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
1015 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
1016 | vty_out(vty, IF_LSDB_TITLE_FORMAT, | |
1017 | oi->interface->name, oa->name); | |
1018 | ospf6_lsdb_show(vty, level, &type, &id, | |
1019 | &adv_router, oi->lsdb); | |
1020 | } | |
1021 | } | |
1022 | break; | |
1023 | ||
1024 | case OSPF6_SCOPE_AS: | |
1025 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
1026 | ospf6_lsdb_show(vty, level, &type, &id, &adv_router, o->lsdb); | |
1027 | break; | |
1028 | ||
1029 | default: | |
1030 | assert(0); | |
1031 | break; | |
1032 | } | |
1033 | ||
1034 | vty_out(vty, "\n"); | |
1035 | return CMD_SUCCESS; | |
718e3744 | 1036 | } |
1037 | ||
6452df09 | 1038 | DEFUN (show_ipv6_ospf6_border_routers, |
1039 | show_ipv6_ospf6_border_routers_cmd, | |
14b16482 | 1040 | "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]", |
6452df09 | 1041 | SHOW_STR |
1042 | IP6_STR | |
1043 | OSPF6_STR | |
1044 | "Display routing table for ABR and ASBR\n" | |
16cedbb0 QY |
1045 | "Router ID\n" |
1046 | "Show detailed output\n") | |
6452df09 | 1047 | { |
d62a17ae | 1048 | int idx_ipv4 = 4; |
1049 | u_int32_t adv_router; | |
1050 | struct ospf6_route *ro; | |
1051 | struct prefix prefix; | |
1052 | ||
1053 | OSPF6_CMD_CHECK_RUNNING(); | |
1054 | ||
1055 | if (argc == 5) { | |
1056 | if (strmatch(argv[idx_ipv4]->text, "detail")) { | |
1057 | for (ro = ospf6_route_head(ospf6->brouter_table); ro; | |
1058 | ro = ospf6_route_next(ro)) | |
1059 | ospf6_route_show_detail(vty, ro); | |
1060 | } else { | |
1061 | inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); | |
1062 | ||
1063 | ospf6_linkstate_prefix(adv_router, 0, &prefix); | |
1064 | ro = ospf6_route_lookup(&prefix, ospf6->brouter_table); | |
1065 | if (!ro) { | |
1066 | vty_out(vty, | |
1067 | "No Route found for Router ID: %s\n", | |
1068 | argv[4]->arg); | |
1069 | return CMD_SUCCESS; | |
1070 | } | |
1071 | ||
1072 | ospf6_route_show_detail(vty, ro); | |
1073 | return CMD_SUCCESS; | |
1074 | } | |
1075 | } else { | |
1076 | ospf6_brouter_show_header(vty); | |
1077 | ||
1078 | for (ro = ospf6_route_head(ospf6->brouter_table); ro; | |
1079 | ro = ospf6_route_next(ro)) | |
1080 | ospf6_brouter_show(vty, ro); | |
1081 | } | |
1082 | ||
1083 | return CMD_SUCCESS; | |
6452df09 | 1084 | } |
1085 | ||
6452df09 | 1086 | |
4846ef64 | 1087 | DEFUN (show_ipv6_ospf6_linkstate, |
1088 | show_ipv6_ospf6_linkstate_cmd, | |
093d7a3a | 1089 | "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>", |
4846ef64 | 1090 | SHOW_STR |
1091 | IP6_STR | |
1092 | OSPF6_STR | |
1093 | "Display linkstate routing table\n" | |
093d7a3a DW |
1094 | "Display Router Entry\n" |
1095 | "Specify Router ID as IPv4 address notation\n" | |
1096 | "Display Network Entry\n" | |
1097 | "Specify Router ID as IPv4 address notation\n" | |
3a2d747c | 1098 | "Specify Link state ID as IPv4 address notation\n") |
4846ef64 | 1099 | { |
d62a17ae | 1100 | int idx_ipv4 = 4; |
1101 | struct listnode *node; | |
1102 | struct ospf6_area *oa; | |
4846ef64 | 1103 | |
d62a17ae | 1104 | OSPF6_CMD_CHECK_RUNNING(); |
b52a8a52 | 1105 | |
d62a17ae | 1106 | for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { |
1107 | vty_out(vty, "\n SPF Result in Area %s\n\n", oa->name); | |
1108 | ospf6_linkstate_table_show(vty, idx_ipv4, argc, argv, | |
1109 | oa->spf_table); | |
1110 | } | |
4846ef64 | 1111 | |
d62a17ae | 1112 | vty_out(vty, "\n"); |
1113 | return CMD_SUCCESS; | |
4846ef64 | 1114 | } |
1115 | ||
4846ef64 | 1116 | |
4846ef64 | 1117 | DEFUN (show_ipv6_ospf6_linkstate_detail, |
1118 | show_ipv6_ospf6_linkstate_detail_cmd, | |
1119 | "show ipv6 ospf6 linkstate detail", | |
1120 | SHOW_STR | |
1121 | IP6_STR | |
1122 | OSPF6_STR | |
1123 | "Display linkstate routing table\n" | |
3a2d747c | 1124 | "Display detailed information\n") |
4846ef64 | 1125 | { |
d62a17ae | 1126 | int idx_detail = 4; |
1127 | struct listnode *node; | |
1128 | struct ospf6_area *oa; | |
4846ef64 | 1129 | |
d62a17ae | 1130 | OSPF6_CMD_CHECK_RUNNING(); |
b52a8a52 | 1131 | |
d62a17ae | 1132 | for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { |
1133 | vty_out(vty, "\n SPF Result in Area %s\n\n", oa->name); | |
1134 | ospf6_linkstate_table_show(vty, idx_detail, argc, argv, | |
1135 | oa->spf_table); | |
1136 | } | |
4846ef64 | 1137 | |
d62a17ae | 1138 | vty_out(vty, "\n"); |
1139 | return CMD_SUCCESS; | |
4846ef64 | 1140 | } |
6452df09 | 1141 | |
718e3744 | 1142 | /* Install ospf related commands. */ |
d62a17ae | 1143 | void ospf6_init(void) |
718e3744 | 1144 | { |
d62a17ae | 1145 | ospf6_top_init(); |
1146 | ospf6_area_init(); | |
1147 | ospf6_interface_init(); | |
1148 | ospf6_neighbor_init(); | |
1149 | ospf6_zebra_init(master); | |
1150 | ||
1151 | ospf6_lsa_init(); | |
1152 | ospf6_spf_init(); | |
1153 | ospf6_intra_init(); | |
1154 | ospf6_asbr_init(); | |
1155 | ospf6_abr_init(); | |
1156 | ||
1157 | ospf6_bfd_init(); | |
1158 | install_node(&debug_node, config_write_ospf6_debug); | |
1159 | ||
1160 | install_element_ospf6_debug_message(); | |
1161 | install_element_ospf6_debug_lsa(); | |
1162 | install_element_ospf6_debug_interface(); | |
1163 | install_element_ospf6_debug_neighbor(); | |
1164 | install_element_ospf6_debug_zebra(); | |
1165 | install_element_ospf6_debug_spf(); | |
1166 | install_element_ospf6_debug_route(); | |
1167 | install_element_ospf6_debug_brouter(); | |
1168 | install_element_ospf6_debug_asbr(); | |
1169 | install_element_ospf6_debug_abr(); | |
1170 | install_element_ospf6_debug_flood(); | |
1171 | ||
1172 | install_element_ospf6_clear_interface(); | |
1173 | ||
87f6dc50 DS |
1174 | install_element(VIEW_NODE, &show_debugging_ospf6_cmd); |
1175 | ||
d62a17ae | 1176 | install_element(VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd); |
1177 | ||
1178 | install_element(VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd); | |
1179 | install_element(VIEW_NODE, &show_ipv6_ospf6_linkstate_detail_cmd); | |
1180 | ||
1181 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_cmd); | |
1182 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_type_cmd); | |
1183 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_id_cmd); | |
1184 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_router_cmd); | |
1185 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_type_id_cmd); | |
1186 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_type_router_cmd); | |
1187 | install_element(VIEW_NODE, | |
1188 | &show_ipv6_ospf6_database_adv_router_linkstate_id_cmd); | |
1189 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_id_router_cmd); | |
1190 | install_element(VIEW_NODE, | |
1191 | &show_ipv6_ospf6_database_type_id_router_cmd); | |
1192 | install_element( | |
1193 | VIEW_NODE, | |
1194 | &show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd); | |
1195 | install_element(VIEW_NODE, | |
1196 | &show_ipv6_ospf6_database_self_originated_cmd); | |
1197 | install_element(VIEW_NODE, | |
1198 | &show_ipv6_ospf6_database_type_self_originated_cmd); | |
1199 | install_element(VIEW_NODE, | |
1200 | &show_ipv6_ospf6_database_type_id_self_originated_cmd); | |
1201 | install_element( | |
1202 | VIEW_NODE, | |
1203 | &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd); | |
1204 | ||
1205 | /* Make ospf protocol socket. */ | |
1206 | ospf6_serv_sock(); | |
1207 | thread_add_read(master, ospf6_receive, NULL, ospf6_sock, NULL); | |
92300491 DW |
1208 | } |
1209 | ||
d62a17ae | 1210 | void ospf6_clean(void) |
92300491 | 1211 | { |
d62a17ae | 1212 | if (!ospf6) |
1213 | return; | |
1214 | if (ospf6->route_table) | |
1215 | ospf6_route_remove_all(ospf6->route_table); | |
1216 | if (ospf6->brouter_table) | |
1217 | ospf6_route_remove_all(ospf6->brouter_table); | |
92300491 | 1218 | } |