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