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