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