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