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