ospf6_top.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. /*
  2. * Copyright (C) 2003 Yasuhiro Ohara
  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. #include <zebra.h>
  22. #include "log.h"
  23. #include "memory.h"
  24. #include "vty.h"
  25. #include "linklist.h"
  26. #include "prefix.h"
  27. #include "table.h"
  28. #include "thread.h"
  29. #include "command.h"
  30. #include "ospf6_proto.h"
  31. #include "ospf6_message.h"
  32. #include "ospf6_lsa.h"
  33. #include "ospf6_lsdb.h"
  34. #include "ospf6_route.h"
  35. #include "ospf6_zebra.h"
  36. #include "ospf6_top.h"
  37. #include "ospf6_area.h"
  38. #include "ospf6_interface.h"
  39. #include "ospf6_neighbor.h"
  40. #include "ospf6_flood.h"
  41. #include "ospf6_asbr.h"
  42. #include "ospf6_abr.h"
  43. #include "ospf6_intra.h"
  44. #include "ospf6d.h"
  45. /* global ospf6d variable */
  46. struct ospf6 *ospf6;
  47. static void
  48. ospf6_top_lsdb_hook_add (struct ospf6_lsa *lsa)
  49. {
  50. switch (ntohs (lsa->header->type))
  51. {
  52. case OSPF6_LSTYPE_AS_EXTERNAL:
  53. ospf6_asbr_lsa_add (lsa);
  54. break;
  55. default:
  56. break;
  57. }
  58. }
  59. static void
  60. ospf6_top_lsdb_hook_remove (struct ospf6_lsa *lsa)
  61. {
  62. switch (ntohs (lsa->header->type))
  63. {
  64. case OSPF6_LSTYPE_AS_EXTERNAL:
  65. ospf6_asbr_lsa_remove (lsa);
  66. break;
  67. default:
  68. break;
  69. }
  70. }
  71. static void
  72. ospf6_top_route_hook_add (struct ospf6_route *route)
  73. {
  74. ospf6_abr_originate_summary (route);
  75. ospf6_zebra_route_update_add (route);
  76. }
  77. static void
  78. ospf6_top_route_hook_remove (struct ospf6_route *route)
  79. {
  80. ospf6_abr_originate_summary (route);
  81. ospf6_zebra_route_update_remove (route);
  82. }
  83. static void
  84. ospf6_top_brouter_hook_add (struct ospf6_route *route)
  85. {
  86. ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix));
  87. ospf6_asbr_lsentry_add (route);
  88. ospf6_abr_originate_summary (route);
  89. }
  90. static void
  91. ospf6_top_brouter_hook_remove (struct ospf6_route *route)
  92. {
  93. ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix));
  94. ospf6_asbr_lsentry_remove (route);
  95. ospf6_abr_originate_summary (route);
  96. }
  97. static struct ospf6 *
  98. ospf6_create (void)
  99. {
  100. struct ospf6 *o;
  101. o = XCALLOC (MTYPE_OSPF6_TOP, sizeof (struct ospf6));
  102. /* initialize */
  103. quagga_gettime (QUAGGA_CLK_MONOTONIC, &o->starttime);
  104. o->area_list = list_new ();
  105. o->area_list->cmp = ospf6_area_cmp;
  106. o->lsdb = ospf6_lsdb_create (o);
  107. o->lsdb_self = ospf6_lsdb_create (o);
  108. o->lsdb->hook_add = ospf6_top_lsdb_hook_add;
  109. o->lsdb->hook_remove = ospf6_top_lsdb_hook_remove;
  110. o->route_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, ROUTES);
  111. o->route_table->scope = o;
  112. o->route_table->hook_add = ospf6_top_route_hook_add;
  113. o->route_table->hook_remove = ospf6_top_route_hook_remove;
  114. o->brouter_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, BORDER_ROUTERS);
  115. o->brouter_table->scope = o;
  116. o->brouter_table->hook_add = ospf6_top_brouter_hook_add;
  117. o->brouter_table->hook_remove = ospf6_top_brouter_hook_remove;
  118. o->external_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, EXTERNAL_ROUTES);
  119. o->external_table->scope = o;
  120. o->external_id_table = route_table_init ();
  121. return o;
  122. }
  123. static void
  124. ospf6_delete (struct ospf6 *o)
  125. {
  126. struct listnode *node, *nnode;
  127. struct ospf6_area *oa;
  128. for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa))
  129. ospf6_area_delete (oa);
  130. ospf6_lsdb_delete (o->lsdb);
  131. ospf6_lsdb_delete (o->lsdb_self);
  132. ospf6_route_table_delete (o->route_table);
  133. ospf6_route_table_delete (o->brouter_table);
  134. ospf6_route_table_delete (o->external_table);
  135. route_table_finish (o->external_id_table);
  136. XFREE (MTYPE_OSPF6_TOP, o);
  137. }
  138. static void
  139. ospf6_enable (struct ospf6 *o)
  140. {
  141. struct listnode *node, *nnode;
  142. struct ospf6_area *oa;
  143. if (CHECK_FLAG (o->flag, OSPF6_DISABLED))
  144. {
  145. UNSET_FLAG (o->flag, OSPF6_DISABLED);
  146. for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa))
  147. ospf6_area_enable (oa);
  148. }
  149. }
  150. static void
  151. ospf6_disable (struct ospf6 *o)
  152. {
  153. struct listnode *node, *nnode;
  154. struct ospf6_area *oa;
  155. if (! CHECK_FLAG (o->flag, OSPF6_DISABLED))
  156. {
  157. SET_FLAG (o->flag, OSPF6_DISABLED);
  158. for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa))
  159. ospf6_area_disable (oa);
  160. ospf6_lsdb_remove_all (o->lsdb);
  161. ospf6_route_remove_all (o->route_table);
  162. ospf6_route_remove_all (o->brouter_table);
  163. }
  164. }
  165. static int
  166. ospf6_maxage_remover (struct thread *thread)
  167. {
  168. struct ospf6 *o = (struct ospf6 *) THREAD_ARG (thread);
  169. struct ospf6_area *oa;
  170. struct ospf6_interface *oi;
  171. struct ospf6_neighbor *on;
  172. struct listnode *i, *j, *k;
  173. o->maxage_remover = (struct thread *) NULL;
  174. for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
  175. {
  176. for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
  177. {
  178. for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, k, on))
  179. {
  180. if (on->state != OSPF6_NEIGHBOR_EXCHANGE &&
  181. on->state != OSPF6_NEIGHBOR_LOADING)
  182. continue;
  183. return 0;
  184. }
  185. }
  186. }
  187. for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
  188. {
  189. for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
  190. OSPF6_LSDB_MAXAGE_REMOVER (oi->lsdb);
  191. OSPF6_LSDB_MAXAGE_REMOVER (oa->lsdb);
  192. }
  193. OSPF6_LSDB_MAXAGE_REMOVER (o->lsdb);
  194. return 0;
  195. }
  196. void
  197. ospf6_maxage_remove (struct ospf6 *o)
  198. {
  199. if (o && ! o->maxage_remover)
  200. o->maxage_remover = thread_add_event (master, ospf6_maxage_remover, o, 0);
  201. }
  202. /* start ospf6 */
  203. DEFUN (router_ospf6,
  204. router_ospf6_cmd,
  205. "router ospf6",
  206. ROUTER_STR
  207. OSPF6_STR)
  208. {
  209. if (ospf6 == NULL)
  210. ospf6 = ospf6_create ();
  211. if (CHECK_FLAG (ospf6->flag, OSPF6_DISABLED))
  212. ospf6_enable (ospf6);
  213. /* set current ospf point. */
  214. vty->node = OSPF6_NODE;
  215. vty->index = ospf6;
  216. return CMD_SUCCESS;
  217. }
  218. /* stop ospf6 */
  219. DEFUN (no_router_ospf6,
  220. no_router_ospf6_cmd,
  221. "no router ospf6",
  222. NO_STR
  223. OSPF6_ROUTER_STR)
  224. {
  225. if (ospf6 == NULL || CHECK_FLAG (ospf6->flag, OSPF6_DISABLED))
  226. vty_out (vty, "OSPFv3 is not running%s", VNL);
  227. else
  228. ospf6_disable (ospf6);
  229. /* return to config node . */
  230. vty->node = CONFIG_NODE;
  231. vty->index = NULL;
  232. return CMD_SUCCESS;
  233. }
  234. /* change Router_ID commands. */
  235. DEFUN (ospf6_router_id,
  236. ospf6_router_id_cmd,
  237. "router-id A.B.C.D",
  238. "Configure OSPF Router-ID\n"
  239. V4NOTATION_STR)
  240. {
  241. int ret;
  242. u_int32_t router_id;
  243. struct ospf6 *o;
  244. o = (struct ospf6 *) vty->index;
  245. ret = inet_pton (AF_INET, argv[0], &router_id);
  246. if (ret == 0)
  247. {
  248. vty_out (vty, "malformed OSPF Router-ID: %s%s", argv[0], VNL);
  249. return CMD_SUCCESS;
  250. }
  251. o->router_id_static = router_id;
  252. if (o->router_id == 0)
  253. o->router_id = router_id;
  254. return CMD_SUCCESS;
  255. }
  256. DEFUN (ospf6_interface_area,
  257. ospf6_interface_area_cmd,
  258. "interface IFNAME area A.B.C.D",
  259. "Enable routing on an IPv6 interface\n"
  260. IFNAME_STR
  261. "Specify the OSPF6 area ID\n"
  262. "OSPF6 area ID in IPv4 address notation\n"
  263. )
  264. {
  265. struct ospf6 *o;
  266. struct ospf6_area *oa;
  267. struct ospf6_interface *oi;
  268. struct interface *ifp;
  269. u_int32_t area_id;
  270. o = (struct ospf6 *) vty->index;
  271. /* find/create ospf6 interface */
  272. ifp = if_get_by_name (argv[0]);
  273. oi = (struct ospf6_interface *) ifp->info;
  274. if (oi == NULL)
  275. oi = ospf6_interface_create (ifp);
  276. if (oi->area)
  277. {
  278. vty_out (vty, "%s already attached to Area %s%s",
  279. oi->interface->name, oi->area->name, VNL);
  280. return CMD_SUCCESS;
  281. }
  282. /* parse Area-ID */
  283. if (inet_pton (AF_INET, argv[1], &area_id) != 1)
  284. {
  285. vty_out (vty, "Invalid Area-ID: %s%s", argv[1], VNL);
  286. return CMD_SUCCESS;
  287. }
  288. /* find/create ospf6 area */
  289. oa = ospf6_area_lookup (area_id, o);
  290. if (oa == NULL)
  291. oa = ospf6_area_create (area_id, o);
  292. /* attach interface to area */
  293. listnode_add (oa->if_list, oi); /* sort ?? */
  294. oi->area = oa;
  295. SET_FLAG (oa->flag, OSPF6_AREA_ENABLE);
  296. /* start up */
  297. thread_add_event (master, interface_up, oi, 0);
  298. /* If the router is ABR, originate summary routes */
  299. if (ospf6_is_router_abr (o))
  300. ospf6_abr_enable_area (oa);
  301. return CMD_SUCCESS;
  302. }
  303. DEFUN (no_ospf6_interface_area,
  304. no_ospf6_interface_area_cmd,
  305. "no interface IFNAME area A.B.C.D",
  306. NO_STR
  307. "Disable routing on an IPv6 interface\n"
  308. IFNAME_STR
  309. "Specify the OSPF6 area ID\n"
  310. "OSPF6 area ID in IPv4 address notation\n"
  311. )
  312. {
  313. struct ospf6 *o;
  314. struct ospf6_interface *oi;
  315. struct ospf6_area *oa;
  316. struct interface *ifp;
  317. u_int32_t area_id;
  318. o = (struct ospf6 *) vty->index;
  319. ifp = if_lookup_by_name (argv[0]);
  320. if (ifp == NULL)
  321. {
  322. vty_out (vty, "No such interface %s%s", argv[0], VNL);
  323. return CMD_SUCCESS;
  324. }
  325. oi = (struct ospf6_interface *) ifp->info;
  326. if (oi == NULL)
  327. {
  328. vty_out (vty, "Interface %s not enabled%s", ifp->name, VNL);
  329. return CMD_SUCCESS;
  330. }
  331. /* parse Area-ID */
  332. if (inet_pton (AF_INET, argv[1], &area_id) != 1)
  333. {
  334. vty_out (vty, "Invalid Area-ID: %s%s", argv[1], VNL);
  335. return CMD_SUCCESS;
  336. }
  337. /* Verify Area */
  338. if (oi->area == NULL)
  339. {
  340. vty_out (vty, "No such Area-ID: %s%s", argv[1], VNL);
  341. return CMD_SUCCESS;
  342. }
  343. if (oi->area->area_id != area_id)
  344. {
  345. vty_out (vty, "Wrong Area-ID: %s is attached to area %s%s",
  346. oi->interface->name, oi->area->name, VNL);
  347. return CMD_SUCCESS;
  348. }
  349. thread_execute (master, interface_down, oi, 0);
  350. oa = oi->area;
  351. listnode_delete (oi->area->if_list, oi);
  352. oi->area = (struct ospf6_area *) NULL;
  353. /* Withdraw inter-area routes from this area, if necessary */
  354. if (oa->if_list->count == 0)
  355. {
  356. UNSET_FLAG (oa->flag, OSPF6_AREA_ENABLE);
  357. ospf6_abr_disable_area (oa);
  358. }
  359. return CMD_SUCCESS;
  360. }
  361. static void
  362. ospf6_show (struct vty *vty, struct ospf6 *o)
  363. {
  364. struct listnode *n;
  365. struct ospf6_area *oa;
  366. char router_id[16], duration[32];
  367. struct timeval now, running;
  368. /* process id, router id */
  369. inet_ntop (AF_INET, &o->router_id, router_id, sizeof (router_id));
  370. vty_out (vty, " OSPFv3 Routing Process (0) with Router-ID %s%s",
  371. router_id, VNL);
  372. /* running time */
  373. quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
  374. timersub (&now, &o->starttime, &running);
  375. timerstring (&running, duration, sizeof (duration));
  376. vty_out (vty, " Running %s%s", duration, VNL);
  377. /* Redistribute configuration */
  378. /* XXX */
  379. /* LSAs */
  380. vty_out (vty, " Number of AS scoped LSAs is %u%s",
  381. o->lsdb->count, VNL);
  382. /* Areas */
  383. vty_out (vty, " Number of areas in this router is %u%s",
  384. listcount (o->area_list), VNL);
  385. for (ALL_LIST_ELEMENTS_RO (o->area_list, n, oa))
  386. ospf6_area_show (vty, oa);
  387. }
  388. /* show top level structures */
  389. DEFUN (show_ipv6_ospf6,
  390. show_ipv6_ospf6_cmd,
  391. "show ipv6 ospf6",
  392. SHOW_STR
  393. IP6_STR
  394. OSPF6_STR)
  395. {
  396. OSPF6_CMD_CHECK_RUNNING ();
  397. ospf6_show (vty, ospf6);
  398. return CMD_SUCCESS;
  399. }
  400. DEFUN (show_ipv6_ospf6_route,
  401. show_ipv6_ospf6_route_cmd,
  402. "show ipv6 ospf6 route",
  403. SHOW_STR
  404. IP6_STR
  405. OSPF6_STR
  406. ROUTE_STR
  407. )
  408. {
  409. ospf6_route_table_show (vty, argc, argv, ospf6->route_table);
  410. return CMD_SUCCESS;
  411. }
  412. ALIAS (show_ipv6_ospf6_route,
  413. show_ipv6_ospf6_route_detail_cmd,
  414. "show ipv6 ospf6 route (X:X::X:X|X:X::X:X/M|detail|summary)",
  415. SHOW_STR
  416. IP6_STR
  417. OSPF6_STR
  418. ROUTE_STR
  419. "Specify IPv6 address\n"
  420. "Specify IPv6 prefix\n"
  421. "Detailed information\n"
  422. "Summary of route table\n"
  423. )
  424. DEFUN (show_ipv6_ospf6_route_match,
  425. show_ipv6_ospf6_route_match_cmd,
  426. "show ipv6 ospf6 route X:X::X:X/M match",
  427. SHOW_STR
  428. IP6_STR
  429. OSPF6_STR
  430. ROUTE_STR
  431. "Specify IPv6 prefix\n"
  432. "Display routes which match the specified route\n"
  433. )
  434. {
  435. const char *sargv[CMD_ARGC_MAX];
  436. int i, sargc;
  437. /* copy argv to sargv and then append "match" */
  438. for (i = 0; i < argc; i++)
  439. sargv[i] = argv[i];
  440. sargc = argc;
  441. sargv[sargc++] = "match";
  442. sargv[sargc] = NULL;
  443. ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table);
  444. return CMD_SUCCESS;
  445. }
  446. DEFUN (show_ipv6_ospf6_route_match_detail,
  447. show_ipv6_ospf6_route_match_detail_cmd,
  448. "show ipv6 ospf6 route X:X::X:X/M match detail",
  449. SHOW_STR
  450. IP6_STR
  451. OSPF6_STR
  452. ROUTE_STR
  453. "Specify IPv6 prefix\n"
  454. "Display routes which match the specified route\n"
  455. "Detailed information\n"
  456. )
  457. {
  458. const char *sargv[CMD_ARGC_MAX];
  459. int i, sargc;
  460. /* copy argv to sargv and then append "match" and "detail" */
  461. for (i = 0; i < argc; i++)
  462. sargv[i] = argv[i];
  463. sargc = argc;
  464. sargv[sargc++] = "match";
  465. sargv[sargc++] = "detail";
  466. sargv[sargc] = NULL;
  467. ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table);
  468. return CMD_SUCCESS;
  469. }
  470. ALIAS (show_ipv6_ospf6_route_match,
  471. show_ipv6_ospf6_route_longer_cmd,
  472. "show ipv6 ospf6 route X:X::X:X/M longer",
  473. SHOW_STR
  474. IP6_STR
  475. OSPF6_STR
  476. ROUTE_STR
  477. "Specify IPv6 prefix\n"
  478. "Display routes longer than the specified route\n"
  479. )
  480. DEFUN (show_ipv6_ospf6_route_match_detail,
  481. show_ipv6_ospf6_route_longer_detail_cmd,
  482. "show ipv6 ospf6 route X:X::X:X/M longer detail",
  483. SHOW_STR
  484. IP6_STR
  485. OSPF6_STR
  486. ROUTE_STR
  487. "Specify IPv6 prefix\n"
  488. "Display routes longer than the specified route\n"
  489. "Detailed information\n"
  490. );
  491. ALIAS (show_ipv6_ospf6_route,
  492. show_ipv6_ospf6_route_type_cmd,
  493. "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2)",
  494. SHOW_STR
  495. IP6_STR
  496. OSPF6_STR
  497. ROUTE_STR
  498. "Dispaly Intra-Area routes\n"
  499. "Dispaly Inter-Area routes\n"
  500. "Dispaly Type-1 External routes\n"
  501. "Dispaly Type-2 External routes\n"
  502. )
  503. DEFUN (show_ipv6_ospf6_route_type_detail,
  504. show_ipv6_ospf6_route_type_detail_cmd,
  505. "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2) detail",
  506. SHOW_STR
  507. IP6_STR
  508. OSPF6_STR
  509. ROUTE_STR
  510. "Dispaly Intra-Area routes\n"
  511. "Dispaly Inter-Area routes\n"
  512. "Dispaly Type-1 External routes\n"
  513. "Dispaly Type-2 External routes\n"
  514. "Detailed information\n"
  515. )
  516. {
  517. const char *sargv[CMD_ARGC_MAX];
  518. int i, sargc;
  519. /* copy argv to sargv and then append "detail" */
  520. for (i = 0; i < argc; i++)
  521. sargv[i] = argv[i];
  522. sargc = argc;
  523. sargv[sargc++] = "detail";
  524. sargv[sargc] = NULL;
  525. ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table);
  526. return CMD_SUCCESS;
  527. }
  528. /* OSPF configuration write function. */
  529. static int
  530. config_write_ospf6 (struct vty *vty)
  531. {
  532. char router_id[16];
  533. struct listnode *j, *k;
  534. struct ospf6_area *oa;
  535. struct ospf6_interface *oi;
  536. /* OSPFv6 configuration. */
  537. if (ospf6 == NULL)
  538. return CMD_SUCCESS;
  539. if (CHECK_FLAG (ospf6->flag, OSPF6_DISABLED))
  540. return CMD_SUCCESS;
  541. inet_ntop (AF_INET, &ospf6->router_id_static, router_id, sizeof (router_id));
  542. vty_out (vty, "router ospf6%s", VNL);
  543. if (ospf6->router_id_static != 0)
  544. vty_out (vty, " router-id %s%s", router_id, VNL);
  545. ospf6_redistribute_config_write (vty);
  546. ospf6_area_config_write (vty);
  547. for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, j, oa))
  548. {
  549. for (ALL_LIST_ELEMENTS_RO (oa->if_list, k, oi))
  550. vty_out (vty, " interface %s area %s%s",
  551. oi->interface->name, oa->name, VNL);
  552. }
  553. vty_out (vty, "!%s", VNL);
  554. return 0;
  555. }
  556. /* OSPF6 node structure. */
  557. static struct cmd_node ospf6_node =
  558. {
  559. OSPF6_NODE,
  560. "%s(config-ospf6)# ",
  561. 1 /* VTYSH */
  562. };
  563. /* Install ospf related commands. */
  564. void
  565. ospf6_top_init (void)
  566. {
  567. /* Install ospf6 top node. */
  568. install_node (&ospf6_node, config_write_ospf6);
  569. install_element (VIEW_NODE, &show_ipv6_ospf6_cmd);
  570. install_element (ENABLE_NODE, &show_ipv6_ospf6_cmd);
  571. install_element (CONFIG_NODE, &router_ospf6_cmd);
  572. install_element (CONFIG_NODE, &no_router_ospf6_cmd);
  573. install_element (VIEW_NODE, &show_ipv6_ospf6_route_cmd);
  574. install_element (VIEW_NODE, &show_ipv6_ospf6_route_detail_cmd);
  575. install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_cmd);
  576. install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_detail_cmd);
  577. install_element (VIEW_NODE, &show_ipv6_ospf6_route_longer_cmd);
  578. install_element (VIEW_NODE, &show_ipv6_ospf6_route_longer_detail_cmd);
  579. install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_cmd);
  580. install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_detail_cmd);
  581. install_element (ENABLE_NODE, &show_ipv6_ospf6_route_cmd);
  582. install_element (ENABLE_NODE, &show_ipv6_ospf6_route_detail_cmd);
  583. install_element (ENABLE_NODE, &show_ipv6_ospf6_route_match_cmd);
  584. install_element (ENABLE_NODE, &show_ipv6_ospf6_route_match_detail_cmd);
  585. install_element (ENABLE_NODE, &show_ipv6_ospf6_route_longer_cmd);
  586. install_element (ENABLE_NODE, &show_ipv6_ospf6_route_longer_detail_cmd);
  587. install_element (ENABLE_NODE, &show_ipv6_ospf6_route_type_cmd);
  588. install_element (ENABLE_NODE, &show_ipv6_ospf6_route_type_detail_cmd);
  589. install_default (OSPF6_NODE);
  590. install_element (OSPF6_NODE, &ospf6_router_id_cmd);
  591. install_element (OSPF6_NODE, &ospf6_interface_area_cmd);
  592. install_element (OSPF6_NODE, &no_ospf6_interface_area_cmd);
  593. }