]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6d.c
This patch changes ospfd from only listening mode for BFD status updates to interacti...
[mirror_frr.git] / ospf6d / ospf6d.c
index 8b50b5ab74e9c4b7ec26843a521fcce19c26fd65..98d4e1787d66ae675a1ba944094b37eab1f13f6e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1999 Yasuhiro Ohara
+ * Copyright (C) 2003 Yasuhiro Ohara
  *
  * This file is part of GNU Zebra.
  *
  * Boston, MA 02111-1307, USA.  
  */
 
+#include <zebra.h>
+
+#include "thread.h"
+#include "linklist.h"
+#include "vty.h"
+#include "command.h"
+
+#include "ospf6_proto.h"
+#include "ospf6_network.h"
+#include "ospf6_lsa.h"
+#include "ospf6_lsdb.h"
+#include "ospf6_message.h"
+#include "ospf6_route.h"
+#include "ospf6_zebra.h"
+#include "ospf6_spf.h"
+#include "ospf6_top.h"
+#include "ospf6_area.h"
+#include "ospf6_interface.h"
+#include "ospf6_neighbor.h"
+#include "ospf6_intra.h"
+#include "ospf6_asbr.h"
+#include "ospf6_abr.h"
+#include "ospf6_flood.h"
 #include "ospf6d.h"
+#include "ospf6_bfd.h"
 
-#include "ospf6_damp.h"
-
-/* global ospf6d variable */
-int  ospf6_sock;
-list iflist;
-list nexthoplist = NULL;
-struct sockaddr_in6 allspfrouters6;
-struct sockaddr_in6 alldrouters6;
-char *recent_reason; /* set by ospf6_lsa_check_recent () */
-int proctitle_mode = 0;
+#ifdef HAVE_SNMP
+#include "ospf6_snmp.h"
+#endif /*HAVE_SNMP*/
 
 char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION;
 
-\f
-#define TIMER_SEC_MICRO 1000000
-
-void
-ospf6_timeval_sub (const struct timeval *t1, const struct timeval *t2,
-                   struct timeval *result)
+struct route_node *
+route_prev (struct route_node *node)
 {
-  long usec, movedown = 0;
-
-  if (t1->tv_sec < t2->tv_sec ||
-      (t1->tv_sec == t2->tv_sec && t1->tv_usec < t2->tv_usec))
-    {
-      result->tv_sec = 0;
-      result->tv_usec = 0;
-      return;
-    }
-
-  if (t1->tv_usec < t2->tv_usec)
+  struct route_node *end;
+  struct route_node *prev = NULL;
+
+  end = node;
+  node = node->parent;
+  if (node)
+    route_lock_node (node);
+  while (node)
     {
-      usec = t1->tv_usec + TIMER_SEC_MICRO;
-      movedown++;
+      prev = node;
+      node = route_next (node);
+      if (node == end)
+        {
+          route_unlock_node (node);
+          node = NULL;
+        }
     }
-  else
-    usec = t1->tv_usec;
-  result->tv_usec = usec - t2->tv_usec;
+  route_unlock_node (end);
+  if (prev)
+    route_lock_node (prev);
 
-  result->tv_sec = t1->tv_sec - t2->tv_sec - movedown;
+  return prev;
 }
 
-void
-ospf6_timeval_div (const struct timeval *t1, u_int by,
-                   struct timeval *result)
-{
-  long movedown;
 
-  if (by == 0)
-    {
-      result->tv_sec = 0;
-      result->tv_usec = 0;
-      return;
-    }
+/* show database functions */
+DEFUN (show_version_ospf6,
+       show_version_ospf6_cmd,
+       "show version ospf6",
+       SHOW_STR
+       "Displays ospf6d version\n"
+      )
+{
+  vty_out (vty, "Zebra OSPF6d Version: %s%s",
+           ospf6_daemon_version, VNL);
 
-  movedown = t1->tv_sec % by;
-  result->tv_sec = t1->tv_sec / by;
-  result->tv_usec = (t1->tv_usec + movedown * TIMER_SEC_MICRO) / by;
+  return CMD_SUCCESS;
 }
 
-void
-ospf6_timeval_decode (const struct timeval *t, long *dayp, long *hourp,
-                      long *minp, long *secp, long *msecp, long *usecp)
+static struct cmd_node debug_node =
 {
-  long day, hour, min, sec, msec, usec, left;
-
-  left = t->tv_sec;
-  day = left / 86400; left -= day * 86400;
-  hour = left / 3600; left -= hour * 3600;
-  min = left / 60; left -= min * 60;
-  sec = left;
-  left = t->tv_usec;
-  msec = left / 1000; left -= msec * 1000;
-  usec = left;
-
-  if (dayp) *dayp = day;
-  if (hourp) *hourp = hour;
-  if (minp) *minp = min;
-  if (secp) *secp = sec;
-  if (msecp) *msecp = msec;
-  if (usecp) *usecp = usec;
-}
+  DEBUG_NODE,
+  "",
+  1 /* VTYSH */
+};
 
-void
-ospf6_timeval_string (struct timeval *tv, char *buf, int size)
+static int
+config_write_ospf6_debug (struct vty *vty)
 {
-  char days[16], hours[16], mins[16], secs[16], msecs[16], usecs[16];
-  long day, hour, min, sec, msec, usec;
-
-  ospf6_timeval_decode (tv, &day, &hour, &min, &sec, &msec, &usec);
-  snprintf (days, sizeof (days), "%ld days ", day);
-  snprintf (hours, sizeof (hours), "%ld hours ", hour);
-  snprintf (mins, sizeof (mins), "%ld mins ", min);
-  snprintf (secs, sizeof (secs), "%ld secs ", sec);
-  snprintf (msecs, sizeof (msecs), "%ld msecs ", msec);
-  snprintf (usecs, sizeof (usecs), "%ld usecs ", usec);
-
-  snprintf (buf, size, "%s%s%s%s%s%s",
-            (day ? days : ""), (hour ? hours : ""),
-            (min ? mins : ""), (sec ? secs : ""),
-            (msec ? msecs : ""), (usec ? usecs : ""));
+  config_write_ospf6_debug_message (vty);
+  config_write_ospf6_debug_lsa (vty);
+  config_write_ospf6_debug_zebra (vty);
+  config_write_ospf6_debug_interface (vty);
+  config_write_ospf6_debug_neighbor (vty);
+  config_write_ospf6_debug_spf (vty);
+  config_write_ospf6_debug_route (vty);
+  config_write_ospf6_debug_brouter (vty);
+  config_write_ospf6_debug_asbr (vty);
+  config_write_ospf6_debug_abr (vty);
+  config_write_ospf6_debug_flood (vty);
+  vty_out (vty, "!%s", VNL);
+  return 0;
 }
 
-void
-ospf6_timeval_string_summary (struct timeval *tv, char *buf, int size)
-{
-  char days[16], hours[16], mins[16], secs[16], msecs[16], usecs[16];
-  long day, hour, min, sec, msec, usec;
-
-  ospf6_timeval_decode (tv, &day, &hour, &min, &sec, &msec, &usec);
-  snprintf (days, sizeof (days), "%02ldd", day);
-  snprintf (hours, sizeof (hours), "%ldh", hour);
-  snprintf (mins, sizeof (mins), "%ldm", min);
-  snprintf (secs, sizeof (secs), "%lds", sec);
-  snprintf (msecs, sizeof (msecs), "%ldms", msec);
-  snprintf (usecs, sizeof (usecs), "%ldus", usec);
-
-  snprintf (buf, size, "%s%02ld:%02ld:%02ld",
-            (day ? days : ""), hour, min, sec);
-}
+#define AREA_LSDB_TITLE_FORMAT \
+  "%s        Area Scoped Link State Database (Area %s)%s%s"
+#define IF_LSDB_TITLE_FORMAT \
+  "%s        I/F Scoped Link State Database (I/F %s in Area %s)%s%s"
+#define AS_LSDB_TITLE_FORMAT \
+  "%s        AS Scoped Link State Database%s%s"
 
-/* foreach function */
-void
-ospf6_count_state (void *arg, int val, void *obj)
+static int
+parse_show_level (int argc, const char *argv[])
 {
-  int *count = (int *) arg;
-  u_char state = val;
-  struct ospf6_neighbor *nei = (struct ospf6_neighbor *) obj;
-
-  if (nei->state == state)
-    (*count)++;
+  int level = 0;
+  if (argc)
+    {
+      if (! strncmp (argv[0], "de", 2))
+        level = OSPF6_LSDB_SHOW_LEVEL_DETAIL;
+      else if (! strncmp (argv[0], "du", 2))
+        level = OSPF6_LSDB_SHOW_LEVEL_DUMP;
+      else if (! strncmp (argv[0], "in", 2))
+        level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL;
+    }
+  else
+    level = OSPF6_LSDB_SHOW_LEVEL_NORMAL;
+  return level;
 }
-\f
-/* VTY commands.  */
-DEFUN (reload,
-       reload_cmd,
-       "reload",
-       "Reloads\n")
+
+static u_int16_t
+parse_type_spec (int argc, const char *argv[])
 {
-  extern void _reload ();
-  _reload ();
-  return CMD_SUCCESS;
+  u_int16_t type = 0;
+  assert (argc);
+  if (! strcmp (argv[0], "router"))
+    type = htons (OSPF6_LSTYPE_ROUTER);
+  else if (! strcmp (argv[0], "network"))
+    type = htons (OSPF6_LSTYPE_NETWORK);
+  else if (! strcmp (argv[0], "as-external"))
+    type = htons (OSPF6_LSTYPE_AS_EXTERNAL);
+  else if (! strcmp (argv[0], "intra-prefix"))
+    type = htons (OSPF6_LSTYPE_INTRA_PREFIX);
+  else if (! strcmp (argv[0], "inter-router"))
+    type = htons (OSPF6_LSTYPE_INTER_ROUTER);
+  else if (! strcmp (argv[0], "inter-prefix"))
+    type = htons (OSPF6_LSTYPE_INTER_PREFIX);
+  else if (! strcmp (argv[0], "link"))
+    type = htons (OSPF6_LSTYPE_LINK);
+  return type;
 }
 
-DEFUN (garbage_collection,
-       garbage_collection_cmd,
-       "ipv6 ospf6 garbage collect",
+DEFUN (show_ipv6_ospf6_database,
+       show_ipv6_ospf6_database_cmd,
+       "show ipv6 ospf6 database",
+       SHOW_STR
        IPV6_STR
        OSPF6_STR
-       "garbage collection by hand\n"
-       "Remove Maxages if possible and recalculate routes\n")
+       "Display Link state database\n"
+      )
 {
-  ospf6_maxage_remover ();
-#if 0
-  ospf6_route_calculation_schedule ();
-#endif
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+
+  OSPF6_CMD_CHECK_RUNNING ();
+
+  level = parse_show_level (argc, argv);
+
+  for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+    {
+      vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+      ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oa->lsdb);
+    }
+
+  for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+    {
+      for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+        {
+          vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                   oi->interface->name, oa->name, VNL, VNL);
+          ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oi->lsdb);
+        }
+    }
+
+  vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+  ospf6_lsdb_show (vty, level, NULL, NULL, NULL, o->lsdb);
+
+  vty_out (vty, "%s", VNL);
   return CMD_SUCCESS;
 }
 
-/* Show version. */
-DEFUN (show_version_ospf6,
-       show_version_ospf6_cmd,
-       "show version ospf6",
+ALIAS (show_ipv6_ospf6_database,
+       show_ipv6_ospf6_database_detail_cmd,
+       "show ipv6 ospf6 database (detail|dump|internal)",
        SHOW_STR
-       "Displays ospf6d version\n")
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+DEFUN (show_ipv6_ospf6_database_type,
+       show_ipv6_ospf6_database_type_cmd,
+       "show ipv6 ospf6 database "
+       "(router|network|inter-prefix|inter-router|as-external|"
+       "group-membership|type-7|link|intra-prefix)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+      )
 {
-  vty_out (vty, "Zebra OSPF6d Version: %s%s",
-           ospf6_daemon_version, VTY_NEWLINE);
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int16_t type = 0;
 
-  return CMD_SUCCESS;
-}
+  OSPF6_CMD_CHECK_RUNNING ();
 
-/* start ospf6 */
-DEFUN (router_ospf6,
-       router_ospf6_cmd,
-       "router ospf6",
-       OSPF6_ROUTER_STR
-       OSPF6_STR)
-{
-  if (ospf6 == NULL)
-    ospf6_start ();
+  type = parse_type_spec (argc, argv);
+  argc--;
+  argv++;
+  level = parse_show_level (argc, argv);
 
-  /* set current ospf point. */
-  vty->node = OSPF6_NODE;
-  vty->index = ospf6;
+  switch (OSPF6_LSA_SCOPE (type))
+    {
+      case OSPF6_SCOPE_AREA:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+            ospf6_lsdb_show (vty, level, &type, NULL, NULL, oa->lsdb);
+          }
+        break;
+
+      case OSPF6_SCOPE_LINKLOCAL:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+              {
+                vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                         oi->interface->name, oa->name, VNL, VNL);
+                ospf6_lsdb_show (vty, level, &type, NULL, NULL, oi->lsdb);
+              }
+          }
+        break;
+
+      case OSPF6_SCOPE_AS:
+        vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+        ospf6_lsdb_show (vty, level, &type, NULL, NULL, o->lsdb);
+        break;
+
+      default:
+        assert (0);
+        break;
+    }
 
+  vty_out (vty, "%s", VNL);
   return CMD_SUCCESS;
 }
 
-/* stop ospf6 */
-DEFUN (no_router_ospf6,
-       no_router_ospf6_cmd,
-       "no router ospf6",
-       NO_STR
-       OSPF6_ROUTER_STR)
+ALIAS (show_ipv6_ospf6_database_type,
+       show_ipv6_ospf6_database_type_detail_cmd,
+       "show ipv6 ospf6 database "
+       "(router|network|inter-prefix|inter-router|as-external|"
+       "group-membership|type-7|link|intra-prefix) "
+       "(detail|dump|internal)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+DEFUN (show_ipv6_ospf6_database_id,
+       show_ipv6_ospf6_database_id_cmd,
+       "show ipv6 ospf6 database * A.B.C.D",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Any Link state Type\n"
+       "Specify Link state ID as IPv4 address notation\n"
+      )
 {
-  if (!ospf6)
-    vty_out (vty, "OSPFv3 is not running%s", VTY_NEWLINE);
-  else
-    ospf6_stop ();
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int32_t id = 0;
 
-  /* return to config node . */
-  vty->node = CONFIG_NODE;
-  vty->index = NULL;
+  OSPF6_CMD_CHECK_RUNNING ();
+
+  if ((inet_pton (AF_INET, argv[0], &id)) != 1)
+    {
+      vty_out (vty, "Link State ID is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
+    }
+
+  argc--;
+  argv++;
+  level = parse_show_level (argc, argv);
+
+  for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+    {
+      vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+      ospf6_lsdb_show (vty, level, NULL, &id, NULL, oa->lsdb);
+    }
+
+  for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+    {
+      for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+        {
+          vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                   oi->interface->name, oa->name, VNL, VNL);
+          ospf6_lsdb_show (vty, level, NULL, &id, NULL, oi->lsdb);
+        }
+    }
 
+  vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+  ospf6_lsdb_show (vty, level, NULL, &id, NULL, o->lsdb);
+
+  vty_out (vty, "%s", VNL);
   return CMD_SUCCESS;
 }
 
-/* show top level structures */
-DEFUN (show_ipv6_ospf6,
-       show_ipv6_ospf6_cmd,
-       "show ipv6 ospf6",
+ALIAS (show_ipv6_ospf6_database_id,
+       show_ipv6_ospf6_database_id_detail_cmd,
+       "show ipv6 ospf6 database * A.B.C.D "
+       "(detail|dump|internal)",
        SHOW_STR
-       IP6_STR
-       OSPF6_STR)
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Any Link state Type\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+ALIAS (show_ipv6_ospf6_database_id,
+       show_ipv6_ospf6_database_linkstate_id_cmd,
+       "show ipv6 ospf6 database linkstate-id A.B.C.D",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Search by Link state ID\n"
+       "Specify Link state ID as IPv4 address notation\n"
+      )
+
+ALIAS (show_ipv6_ospf6_database_id,
+       show_ipv6_ospf6_database_linkstate_id_detail_cmd,
+       "show ipv6 ospf6 database linkstate-id A.B.C.D "
+       "(detail|dump|internal)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Search by Link state ID\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+DEFUN (show_ipv6_ospf6_database_router,
+       show_ipv6_ospf6_database_router_cmd,
+       "show ipv6 ospf6 database * * A.B.C.D",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Any Link state Type\n"
+       "Any Link state ID\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+      )
 {
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int32_t adv_router = 0;
+
   OSPF6_CMD_CHECK_RUNNING ();
 
-  ospf6_show (vty);
+  if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
+    {
+      vty_out (vty, "Advertising Router is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
+    }
+
+  argc--;
+  argv++;
+  level = parse_show_level (argc, argv);
+
+  for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+    {
+      vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+      ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
+    }
+
+  for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+    {
+      for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+        {
+          vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                   oi->interface->name, oa->name, VNL, VNL);
+          ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
+        }
+    }
+
+  vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+  ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
+
+  vty_out (vty, "%s", VNL);
   return CMD_SUCCESS;
 }
 
-DEFUN (show_ipv6_ospf6_nexthoplist,
-       show_ipv6_ospf6_nexthoplist_cmd,
-       "show ipv6 ospf6 nexthop-list",
+ALIAS (show_ipv6_ospf6_database_router,
+       show_ipv6_ospf6_database_router_detail_cmd,
+       "show ipv6 ospf6 database * * A.B.C.D "
+       "(detail|dump|internal)",
        SHOW_STR
-       IP6_STR
+       IPV6_STR
        OSPF6_STR
-       "List of nexthop\n")
-{
-#if 0
-  listnode i;
-  struct ospf6_nexthop *nh;
-  char buf[128];
-  for (i = listhead (nexthoplist); i; nextnode (i))
-    {
-      nh = (struct ospf6_nexthop *) getdata (i);
-      nexthop_str (nh, buf, sizeof (buf));
-      vty_out (vty, "%s%s", buf,
-              VTY_NEWLINE);
-    }
-#endif
-  return CMD_SUCCESS;
-}
+       "Display Link state database\n"
+       "Any Link state Type\n"
+       "Any Link state ID\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
 
-DEFUN (show_ipv6_ospf6_statistics,
-       show_ipv6_ospf6_statistics_cmd,
-       "show ipv6 ospf6 statistics",
+ALIAS (show_ipv6_ospf6_database_router,
+       show_ipv6_ospf6_database_adv_router_cmd,
+       "show ipv6 ospf6 database adv-router A.B.C.D",
        SHOW_STR
-       IP6_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Search by Advertising Router\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+      )
+
+ALIAS (show_ipv6_ospf6_database_router,
+       show_ipv6_ospf6_database_adv_router_detail_cmd,
+       "show ipv6 ospf6 database adv-router A.B.C.D "
+       "(detail|dump|internal)",
+       SHOW_STR
+       IPV6_STR
        OSPF6_STR
-       "Statistics\n")
+       "Display Link state database\n"
+       "Search by Advertising Router\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+DEFUN (show_ipv6_ospf6_database_type_id,
+       show_ipv6_ospf6_database_type_id_cmd,
+       "show ipv6 ospf6 database "
+       "(router|network|inter-prefix|inter-router|as-external|"
+       "group-membership|type-7|link|intra-prefix) A.B.C.D",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Specify Link state ID as IPv4 address notation\n"
+      )
 {
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int16_t type = 0;
+  u_int32_t id = 0;
+
   OSPF6_CMD_CHECK_RUNNING ();
 
-  ospf6_statistics_show (vty, ospf6);
+  type = parse_type_spec (argc, argv);
+  argc--;
+  argv++;
+
+  if ((inet_pton (AF_INET, argv[0], &id)) != 1)
+    {
+      vty_out (vty, "Link state ID is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
+    }
+
+  argc--;
+  argv++;
+  level = parse_show_level (argc, argv);
+
+  switch (OSPF6_LSA_SCOPE (type))
+    {
+      case OSPF6_SCOPE_AREA:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+            ospf6_lsdb_show (vty, level, &type, &id, NULL, oa->lsdb);
+          }
+        break;
+
+      case OSPF6_SCOPE_LINKLOCAL:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+              {
+                vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                         oi->interface->name, oa->name, VNL, VNL);
+                ospf6_lsdb_show (vty, level, &type, &id, NULL, oi->lsdb);
+              }
+          }
+        break;
+
+      case OSPF6_SCOPE_AS:
+        vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+        ospf6_lsdb_show (vty, level, &type, &id, NULL, o->lsdb);
+        break;
+
+      default:
+        assert (0);
+        break;
+    }
+
+  vty_out (vty, "%s", VNL);
   return CMD_SUCCESS;
 }
 
-/* change Router_ID commands. */
-DEFUN (ospf6_router_id,
-       ospf6_router_id_cmd,
-       "router-id ROUTER_ID",
-       "Configure ospf Router-ID.\n"
-       V4NOTATION_STR)
+ALIAS (show_ipv6_ospf6_database_type_id,
+       show_ipv6_ospf6_database_type_id_detail_cmd,
+       "show ipv6 ospf6 database "
+       "(router|network|inter-prefix|inter-router|as-external|"
+       "group-membership|type-7|link|intra-prefix) A.B.C.D "
+       "(detail|dump|internal)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+ALIAS (show_ipv6_ospf6_database_type_id,
+       show_ipv6_ospf6_database_type_linkstate_id_cmd,
+       "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",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Search by Link state ID\n"
+       "Specify Link state ID as IPv4 address notation\n"
+      )
+
+ALIAS (show_ipv6_ospf6_database_type_id,
+       show_ipv6_ospf6_database_type_linkstate_id_detail_cmd,
+       "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)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Search by Link state ID\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+DEFUN (show_ipv6_ospf6_database_type_router,
+       show_ipv6_ospf6_database_type_router_cmd,
+       "show ipv6 ospf6 database "
+       "(router|network|inter-prefix|inter-router|as-external|"
+       "group-membership|type-7|link|intra-prefix) * A.B.C.D",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Any Link state ID\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+      )
 {
-  int ret;
-  u_int32_t router_id;
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int16_t type = 0;
+  u_int32_t adv_router = 0;
 
-  ret = inet_pton (AF_INET, argv[0], &router_id);
-  if (!ret)
+  OSPF6_CMD_CHECK_RUNNING ();
+
+  type = parse_type_spec (argc, argv);
+  argc--;
+  argv++;
+
+  if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
     {
-      vty_out (vty, "malformed ospf router identifier%s", VTY_NEWLINE);
-      vty_out (vty, "%s", VTY_NEWLINE);
-      return CMD_WARNING;
+      vty_out (vty, "Advertising Router is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
     }
 
-  if (IS_OSPF6_DUMP_CONFIG)
-    zlog_info ("CONFIG: router-id %s", argv[0]);
-  ospf6->router_id = router_id;
+  argc--;
+  argv++;
+  level = parse_show_level (argc, argv);
 
+  switch (OSPF6_LSA_SCOPE (type))
+    {
+      case OSPF6_SCOPE_AREA:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+            ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
+          }
+        break;
+
+      case OSPF6_SCOPE_LINKLOCAL:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+              {
+                vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                         oi->interface->name, oa->name, VNL, VNL);
+                ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
+              }
+          }
+        break;
+
+      case OSPF6_SCOPE_AS:
+        vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+        ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
+        break;
+
+      default:
+        assert (0);
+        break;
+    }
+
+  vty_out (vty, "%s", VNL);
   return CMD_SUCCESS;
 }
 
-int
-ospf6_interface_bind_area (struct vty *vty,
-                           char *if_name, char *area_name,
-                           char *plist_name, int passive)
+ALIAS (show_ipv6_ospf6_database_type_router,
+       show_ipv6_ospf6_database_type_router_detail_cmd,
+       "show ipv6 ospf6 database "
+       "(router|network|inter-prefix|inter-router|as-external|"
+       "group-membership|type-7|link|intra-prefix) * A.B.C.D "
+       "(detail|dump|internal)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Any Link state ID\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+ALIAS (show_ipv6_ospf6_database_type_router,
+       show_ipv6_ospf6_database_type_adv_router_cmd,
+       "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",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Search by Advertising Router\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+      )
+
+ALIAS (show_ipv6_ospf6_database_type_router,
+       show_ipv6_ospf6_database_type_adv_router_detail_cmd,
+       "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)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Search by Advertising Router\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+DEFUN (show_ipv6_ospf6_database_id_router,
+       show_ipv6_ospf6_database_id_router_cmd,
+       "show ipv6 ospf6 database * A.B.C.D A.B.C.D",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Any Link state Type\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+      )
 {
-  struct interface *ifp;
-  struct ospf6_interface *o6i;
-  struct ospf6_area *o6a;
-  u_int32_t area_id;
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int32_t id = 0;
+  u_int32_t adv_router = 0;
+
+  OSPF6_CMD_CHECK_RUNNING ();
+
+  if ((inet_pton (AF_INET, argv[0], &id)) != 1)
+    {
+      vty_out (vty, "Link state ID is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
+    }
 
-  /* find/create ospf6 interface */
-  ifp = if_get_by_name (if_name);
-  o6i = (struct ospf6_interface *) ifp->info;
-  if (! o6i)
-    o6i = ospf6_interface_create (ifp);
+  argc--;
+  argv++;
 
-  /* parse Area-ID */
-  if (inet_pton (AF_INET, area_name, &area_id) != 1)
+  if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
     {
-      vty_out (vty, "Invalid Area-ID: %s%s", area_name, VTY_NEWLINE);
-      return CMD_ERR_AMBIGUOUS;
+      vty_out (vty, "Advertising Router is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
     }
 
-  /* find/create ospf6 area */
-  o6a = ospf6_area_lookup (area_id, ospf6);
-  if (!o6a)
+  argc--;
+  argv++;
+  level = parse_show_level (argc, argv);
+
+  for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
     {
-      o6a = ospf6_area_create (area_id);
-      o6a->ospf6 = ospf6;
-      listnode_add (ospf6->area_list, o6a);
+      vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+      ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
     }
 
-  if (o6i->area)
+  for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
     {
-      if (o6i->area != o6a)
+      for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
         {
-          vty_out (vty, "Aready attached to area %s%s",
-                   o6i->area->str, VTY_NEWLINE);
-          return CMD_ERR_NOTHING_TODO;
+          vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                   oi->interface->name, oa->name, VNL, VNL);
+          ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
         }
     }
-  else
+
+  vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+  ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
+
+  vty_out (vty, "%s", VNL);
+  return CMD_SUCCESS;
+}
+
+ALIAS (show_ipv6_ospf6_database_id_router,
+       show_ipv6_ospf6_database_id_router_detail_cmd,
+       "show ipv6 ospf6 database * A.B.C.D A.B.C.D "
+       "(detail|dump|internal)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Any Link state Type\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
+       show_ipv6_ospf6_database_adv_router_linkstate_id_cmd,
+       "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Search by Advertising Router\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+       "Search by Link state ID\n"
+       "Specify Link state ID as IPv4 address notation\n"
+      )
+{
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int32_t id = 0;
+  u_int32_t adv_router = 0;
+
+  OSPF6_CMD_CHECK_RUNNING ();
+
+  if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
     {
-      listnode_add (o6a->if_list, o6i);
-      o6i->area = o6a;
+      vty_out (vty, "Advertising Router is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
     }
 
-  /* prefix-list name */
-  if (plist_name)
+  argc--;
+  argv++;
+
+  if ((inet_pton (AF_INET, argv[0], &id)) != 1)
     {
-      if (o6i->plist_name)
-        XFREE (MTYPE_PREFIX_LIST_STR, o6i->plist_name);
-      o6i->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, plist_name);
+      vty_out (vty, "Link state ID is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
     }
-  else
+
+  argc--;
+  argv++;
+  level = parse_show_level (argc, argv);
+
+  for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
     {
-      if (o6i->plist_name)
-        XFREE (MTYPE_PREFIX_LIST_STR, o6i->plist_name);
-      o6i->plist_name = NULL;
+      vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+      ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
     }
 
-  if (passive)
+  for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
     {
-      listnode node;
-      struct ospf6_neighbor *o6n;
-
-      SET_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE);
-      if (o6i->thread_send_hello)
+      for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
         {
-          thread_cancel (o6i->thread_send_hello);
-          o6i->thread_send_hello = (struct thread *) NULL;
-        }
-
-      for (node = listhead (o6i->neighbor_list); node; nextnode (node))
-        {
-          o6n = getdata (node);
-          if (o6n->inactivity_timer)
-            thread_cancel (o6n->inactivity_timer);
-          thread_execute (master, inactivity_timer, o6n, 0);
+          vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                   oi->interface->name, oa->name, VNL, VNL);
+          ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
         }
     }
-  else
-    {
-      UNSET_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE);
-      if (o6i->thread_send_hello == NULL)
-        thread_add_event (master, ospf6_send_hello, o6i, 0);
-    }
 
-  /* enable I/F if it's not enabled still */
-  if (! ospf6_interface_is_enabled (o6i->interface->ifindex))
-    thread_add_event (master, interface_up, o6i, 0);
-  else
-    CALL_FOREACH_LSA_HOOK (hook_interface, hook_change, o6i);
+  vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+  ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
 
-  CALL_CHANGE_HOOK (&interface_hook, o6i);
+  vty_out (vty, "%s", VNL);
   return CMD_SUCCESS;
 }
 
-DEFUN (ospf6_interface_area_plist,
-       ospf6_interface_area_plist_cmd,
-       "interface IFNAME area A.B.C.D prefix-list WORD",
-       "Enable routing on an IPv6 interface\n"
-       IFNAME_STR
-       "Set the OSPF6 area ID\n"
-       "OSPF6 area ID in IPv4 address notation\n"
-       OSPF6_PREFIX_LIST_STR
-       "IPv6 prefix-list name\n"
+ALIAS (show_ipv6_ospf6_database_adv_router_linkstate_id,
+       show_ipv6_ospf6_database_adv_router_linkstate_id_detail_cmd,
+       "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D "
+       "(detail|dump|internal)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Search by Advertising Router\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+       "Search by Link state ID\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
       )
-{
-  if (IS_OSPF6_DUMP_CONFIG)
-    zlog_info ("CONFIG: interface %s area %s prefix-list %s",
-               argv[0], argv[1], argv[2]);
 
-  return ospf6_interface_bind_area (vty, argv[0], argv[1], argv[2], 0);
-}
-
-DEFUN (ospf6_interface_area_plist_passive,
-       ospf6_interface_area_plist_passive_cmd,
-       "interface IFNAME area A.B.C.D prefix-list WORD passive",
-       "Enable routing on an IPv6 interface\n"
-       IFNAME_STR
-       "Set the OSPF6 area ID\n"
-       "OSPF6 area ID in IPv4 address notation\n"
-       OSPF6_PREFIX_LIST_STR
-       "IPv6 prefix-list name\n"
-       "IPv6 prefix-list name\n"
-       OSPF6_PASSIVE_STR
+DEFUN (show_ipv6_ospf6_database_type_id_router,
+       show_ipv6_ospf6_database_type_id_router_cmd,
+       "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",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Specify Advertising Router as IPv4 address notation\n"
       )
 {
-  if (IS_OSPF6_DUMP_CONFIG)
-    zlog_info ("CONFIG: interface %s area %s prefix-list %s passive",
-               argv[0], argv[1], argv[2]);
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int16_t type = 0;
+  u_int32_t id = 0;
+  u_int32_t adv_router = 0;
 
-  return ospf6_interface_bind_area (vty, argv[0], argv[1], argv[2], 1);
-}
+  OSPF6_CMD_CHECK_RUNNING ();
 
-DEFUN (ospf6_interface_area,
-       ospf6_interface_area_cmd,
-       "interface IFNAME area A.B.C.D",
-       "Enable routing on an IPv6 interface\n"
-       IFNAME_STR
-       "Set the OSPF6 area ID\n"
-       "OSPF6 area ID in IPv4 address notation\n"
-      )
-{
-  struct interface *ifp;
-  struct ospf6_interface *o6i;
-  int passive;
-  char *plist_name;
+  type = parse_type_spec (argc, argv);
+  argc--;
+  argv++;
 
-  if (IS_OSPF6_DUMP_CONFIG)
-    zlog_info ("CONFIG: interface %s area %s",
-               argv[0], argv[1]);
+  if ((inet_pton (AF_INET, argv[0], &id)) != 1)
+    {
+      vty_out (vty, "Link state ID is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
+    }
 
-  ifp = if_get_by_name (argv[0]);
-  o6i = (struct ospf6_interface *) ifp->info;
-  if (o6i)
+  argc--;
+  argv++;
+
+  if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
     {
-      passive = CHECK_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE);
-      plist_name = o6i->plist_name;
+      vty_out (vty, "Advertising Router is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
     }
-  else
+
+  argc--;
+  argv++;
+  level = parse_show_level (argc, argv);
+
+  switch (OSPF6_LSA_SCOPE (type))
     {
-      passive = 0;
-      plist_name = NULL;
+      case OSPF6_SCOPE_AREA:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+            ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
+          }
+        break;
+
+      case OSPF6_SCOPE_LINKLOCAL:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+              {
+                vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                         oi->interface->name, oa->name, VNL, VNL);
+                ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
+              }
+          }
+        break;
+
+      case OSPF6_SCOPE_AS:
+        vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+        ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
+        break;
+
+      default:
+        assert (0);
+        break;
     }
 
-  return ospf6_interface_bind_area (vty, argv[0], argv[1],
-                                    plist_name, passive);
+  vty_out (vty, "%s", VNL);
+  return CMD_SUCCESS;
 }
 
-DEFUN (ospf6_interface_area_passive,
-       ospf6_interface_area_passive_cmd,
-       "interface IFNAME area A.B.C.D passive",
-       "Enable routing on an IPv6 interface\n"
-       IFNAME_STR
-       "Set the OSPF6 area ID\n"
-       "OSPF6 area ID in IPv4 address notation\n"
-       OSPF6_PASSIVE_STR
+ALIAS (show_ipv6_ospf6_database_type_id_router,
+       show_ipv6_ospf6_database_type_id_router_detail_cmd,
+       "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)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
       )
-{
-  if (IS_OSPF6_DUMP_CONFIG)
-    zlog_info ("CONFIG: interface %s area %s passive",
-               argv[0], argv[1]);
 
-  return ospf6_interface_bind_area (vty, argv[0], argv[1], NULL, 1);
-}
-
-DEFUN (no_ospf6_interface_area,
-       no_ospf6_interface_area_cmd,
-       "no interface IFNAME area A.B.C.D",
-       NO_STR
-       "Disable routing on an IPv6 interface\n"
-       IFNAME_STR)
+DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
+       show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd,
+       "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",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Search by Advertising Router\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+       "Search by Link state ID\n"
+       "Specify Link state ID as IPv4 address notation\n"
+      )
 {
-  struct interface *ifp;
-  struct ospf6_interface *o6i;
-  struct ospf6 *o6;
-  u_int32_t area_id;
-
-  o6 = (struct ospf6 *) vty->index;
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int16_t type = 0;
+  u_int32_t id = 0;
+  u_int32_t adv_router = 0;
 
-  ifp = if_lookup_by_name (argv[0]);
-  if (!ifp)
-    return CMD_ERR_NO_MATCH;
+  OSPF6_CMD_CHECK_RUNNING ();
 
-  o6i = (struct ospf6_interface *) ifp->info;
-  if (!o6i)
-    return CMD_SUCCESS;
+  type = parse_type_spec (argc, argv);
+  argc--;
+  argv++;
 
-  /* parse Area-ID */
-  if (inet_pton (AF_INET, argv[1], &area_id) != 1)
+  if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
     {
-      vty_out (vty, "Invalid Area-ID: %s%s", argv[1], VTY_NEWLINE);
-      return CMD_ERR_AMBIGUOUS;
+      vty_out (vty, "Advertising Router is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
     }
 
-  if (o6i->area->area_id != area_id)
+  argc--;
+  argv++;
+
+  if ((inet_pton (AF_INET, argv[0], &id)) != 1)
     {
-      vty_out (vty, "Wrong Area-ID: %s aready attached to area %s%s",
-               o6i->interface->name, o6i->area->str, VTY_NEWLINE);
-      return CMD_ERR_NOTHING_TODO;
+      vty_out (vty, "Link state ID is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
     }
 
-  if (o6i->area)
-    thread_execute (master, interface_down, o6i, 0);
+  argc--;
+  argv++;
+  level = parse_show_level (argc, argv);
 
-  listnode_delete (o6i->area->if_list, o6i);
-  o6i->area = (struct ospf6_area *) NULL;
+  switch (OSPF6_LSA_SCOPE (type))
+    {
+      case OSPF6_SCOPE_AREA:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+            ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
+          }
+        break;
+
+      case OSPF6_SCOPE_LINKLOCAL:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+              {
+                vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                         oi->interface->name, oa->name, VNL, VNL);
+                ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
+              }
+          }
+        break;
+
+      case OSPF6_SCOPE_AS:
+        vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+        ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
+        break;
+
+      default:
+        assert (0);
+        break;
+    }
 
+  vty_out (vty, "%s", VNL);
   return CMD_SUCCESS;
 }
 
-DEFUN (ospf6_area_range,
-       ospf6_area_range_cmd,
-       "area A.B.C.D range X:X::X:X/M",
-       "OSPFv3 area parameters\n"
-       "OSPFv3 area ID in IPv4 address format\n"
-       "Summarize routes matching address/mask (border routers only)\n"
-       "IPv6 address range\n")
+ALIAS (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
+       show_ipv6_ospf6_database_type_adv_router_linkstate_id_detail_cmd,
+       "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)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Search by Advertising Router\n"
+       "Specify Advertising Router as IPv4 address notation\n"
+       "Search by Link state ID\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+DEFUN (show_ipv6_ospf6_database_self_originated,
+       show_ipv6_ospf6_database_self_originated_cmd,
+       "show ipv6 ospf6 database self-originated",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Self-originated LSAs\n"
+      )
 {
-  struct ospf6 *o6;
-  struct ospf6_area *o6a;
-  u_int32_t area_id;
-  int ret;
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int32_t adv_router = 0;
 
-  o6 = (struct ospf6 *) vty->index;
-  inet_pton (AF_INET, argv[0], &area_id);
-  o6a = ospf6_area_lookup (area_id, o6);
-  if (! o6a)
+  OSPF6_CMD_CHECK_RUNNING ();
+
+  level = parse_show_level (argc, argv);
+
+  adv_router = o->router_id;
+
+  for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
     {
-      vty_out (vty, "No such area%s", VTY_NEWLINE);
-      return CMD_ERR_NO_MATCH;
+      vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+      ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
     }
 
-  ret = str2prefix_ipv6 (argv[1], &o6a->area_range);
-  if (ret <= 0)
+  for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
     {
-      vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
-      return CMD_WARNING;
+      for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+        {
+          vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                   oi->interface->name, oa->name, VNL, VNL);
+          ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
+        }
     }
 
+  vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+  ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
+
+  vty_out (vty, "%s", VNL);
   return CMD_SUCCESS;
 }
 
-DEFUN (ospf6_passive_interface,
-       ospf6_passive_interface_cmd,
-       "passive-interface IFNAME",
-       OSPF6_PASSIVE_STR
-       IFNAME_STR)
+ALIAS (show_ipv6_ospf6_database_self_originated,
+       show_ipv6_ospf6_database_self_originated_detail_cmd,
+       "show ipv6 ospf6 database self-originated "
+       "(detail|dump|internal)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Self-originated LSAs\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+DEFUN (show_ipv6_ospf6_database_type_self_originated,
+       show_ipv6_ospf6_database_type_self_originated_cmd,
+       "show ipv6 ospf6 database "
+       "(router|network|inter-prefix|inter-router|as-external|"
+       "group-membership|type-7|link|intra-prefix) self-originated",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Display Self-originated LSAs\n"
+      )
 {
-  struct interface *ifp;
-  struct ospf6_interface *o6i;
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int16_t type = 0;
+  u_int32_t adv_router = 0;
 
-  ifp = if_get_by_name (argv[0]);
-  if (ifp->info)
-    o6i = (struct ospf6_interface *) ifp->info;
-  else
-    o6i = ospf6_interface_create (ifp);
+  OSPF6_CMD_CHECK_RUNNING ();
 
-  SET_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE);
+  type = parse_type_spec (argc, argv);
+  argc--;
+  argv++;
+  level = parse_show_level (argc, argv);
 
-  if (o6i->thread_send_hello)
+  adv_router = o->router_id;
+
+  switch (OSPF6_LSA_SCOPE (type))
     {
-      thread_cancel (o6i->thread_send_hello);
-      o6i->thread_send_hello = (struct thread *) NULL;
+      case OSPF6_SCOPE_AREA:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+            ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
+          }
+        break;
+
+      case OSPF6_SCOPE_LINKLOCAL:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+              {
+                vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                         oi->interface->name, oa->name, VNL, VNL);
+                ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
+              }
+          }
+        break;
+
+      case OSPF6_SCOPE_AS:
+        vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+        ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
+        break;
+
+      default:
+        assert (0);
+        break;
     }
 
+  vty_out (vty, "%s", VNL);
   return CMD_SUCCESS;
 }
 
-DEFUN (no_ospf6_passive_interface,
-       no_ospf6_passive_interface_cmd,
-       "no passive-interface IFNAME",
-       NO_STR
-       OSPF6_PASSIVE_STR
-       IFNAME_STR)
+ALIAS (show_ipv6_ospf6_database_type_self_originated,
+       show_ipv6_ospf6_database_type_self_originated_detail_cmd,
+       "show ipv6 ospf6 database "
+       "(router|network|inter-prefix|inter-router|as-external|"
+       "group-membership|type-7|link|intra-prefix) self-originated "
+       "(detail|dump|internal)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Display Self-originated LSAs\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
+       show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd,
+       "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",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Display Self-originated LSAs\n"
+       "Search by Link state ID\n"
+       "Specify Link state ID as IPv4 address notation\n"
+      )
 {
-  struct interface *ifp;
-  struct ospf6_interface *o6i;
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int16_t type = 0;
+  u_int32_t adv_router = 0;
+  u_int32_t id = 0;
+
+  OSPF6_CMD_CHECK_RUNNING ();
+
+  type = parse_type_spec (argc, argv);
+  argc--;
+  argv++;
+
+  if ((inet_pton (AF_INET, argv[0], &id)) != 1)
+    {
+      vty_out (vty, "Link State ID is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
+    }
 
-  ifp = if_lookup_by_name (argv[0]);
-  if (! ifp)
-    return CMD_ERR_NO_MATCH;
+  argc--;
+  argv++;
+  level = parse_show_level (argc, argv);
 
-  o6i = (struct ospf6_interface *) ifp->info;
-  UNSET_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE);
-  if (o6i->thread_send_hello == NULL)
-    thread_add_event (master, ospf6_send_hello, o6i, 0);
+  adv_router = o->router_id;
 
+  switch (OSPF6_LSA_SCOPE (type))
+    {
+      case OSPF6_SCOPE_AREA:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+            ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
+          }
+        break;
+
+      case OSPF6_SCOPE_LINKLOCAL:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+              {
+                vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                         oi->interface->name, oa->name, VNL, VNL);
+                ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
+              }
+          }
+        break;
+
+      case OSPF6_SCOPE_AS:
+        vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+        ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
+        break;
+
+      default:
+        assert (0);
+        break;
+    }
+
+  vty_out (vty, "%s", VNL);
   return CMD_SUCCESS;
 }
 
-#ifdef HAVE_SETPROCTITLE
-extern int _argc;
-extern char **_argv;
-
-DEFUN (set_proctitle,
-       set_proctitle_cmd,
-       "set proctitle (version|normal|none)",
-       "Set command\n"
-       "Process title\n"
-       "Version information\n"
-       "Normal command-line options\n"
-       "Just program name\n")
+ALIAS (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
+       show_ipv6_ospf6_database_type_self_originated_linkstate_id_detail_cmd,
+       "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)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Display Self-originated LSAs\n"
+       "Search by Link state ID\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
+       show_ipv6_ospf6_database_type_id_self_originated_cmd,
+       "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",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Display Self-originated LSAs\n"
+      )
 {
-  int i;
-  char buf[64], tmp[64];
+  int level;
+  struct listnode *i, *j;
+  struct ospf6 *o = ospf6;
+  struct ospf6_area *oa;
+  struct ospf6_interface *oi;
+  u_int16_t type = 0;
+  u_int32_t adv_router = 0;
+  u_int32_t id = 0;
+
+  OSPF6_CMD_CHECK_RUNNING ();
+
+  type = parse_type_spec (argc, argv);
+  argc--;
+  argv++;
 
-  if (strncmp (argv[0], "v", 1) == 0)
+  if ((inet_pton (AF_INET, argv[0], &id)) != 1)
     {
-      proctitle_mode = 1;
-      setproctitle ("%s Zebra: %s", OSPF6_DAEMON_VERSION, ZEBRA_VERSION);
+      vty_out (vty, "Link State ID is not parsable: %s%s",
+               argv[0], VNL);
+      return CMD_SUCCESS;
     }
-  else if (strncmp (argv[0], "nor", 3) == 0)
+
+  argc--;
+  argv++;
+  level = parse_show_level (argc, argv);
+
+  adv_router = o->router_id;
+
+  switch (OSPF6_LSA_SCOPE (type))
     {
-      proctitle_mode = 0;
-      memset (tmp, 0, sizeof (tmp));
-      memset (buf, 0, sizeof (buf));
-      for (i = 0; i < _argc; i++)
-        {
-          snprintf (buf, sizeof (buf), "%s%s ", tmp, _argv[i]);
-          memcpy (&tmp, &buf, sizeof (tmp));
-        }
-      setproctitle (buf);
+      case OSPF6_SCOPE_AREA:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
+            ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
+          }
+        break;
+
+      case OSPF6_SCOPE_LINKLOCAL:
+        for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
+          {
+            for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+              {
+                vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
+                         oi->interface->name, oa->name, VNL, VNL);
+                ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
+              }
+          }
+        break;
+
+      case OSPF6_SCOPE_AS:
+        vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
+        ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
+        break;
+
+      default:
+        assert (0);
+        break;
     }
-  else if (strncmp (argv[0], "non", 3) == 0)
+
+  vty_out (vty, "%s", VNL);
+  return CMD_SUCCESS;
+}
+
+ALIAS (show_ipv6_ospf6_database_type_id_self_originated,
+       show_ipv6_ospf6_database_type_id_self_originated_detail_cmd,
+       "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)",
+       SHOW_STR
+       IPV6_STR
+       OSPF6_STR
+       "Display Link state database\n"
+       "Display Router LSAs\n"
+       "Display Network LSAs\n"
+       "Display Inter-Area-Prefix LSAs\n"
+       "Display Inter-Area-Router LSAs\n"
+       "Display As-External LSAs\n"
+       "Display Group-Membership LSAs\n"
+       "Display Type-7 LSAs\n"
+       "Display Link LSAs\n"
+       "Display Intra-Area-Prefix LSAs\n"
+       "Display Self-originated LSAs\n"
+       "Search by Link state ID\n"
+       "Specify Link state ID as IPv4 address notation\n"
+       "Display details of LSAs\n"
+       "Dump LSAs\n"
+       "Display LSA's internal information\n"
+      )
+
+
+DEFUN (show_ipv6_ospf6_border_routers,
+       show_ipv6_ospf6_border_routers_cmd,
+       "show ipv6 ospf6 border-routers",
+       SHOW_STR
+       IP6_STR
+       OSPF6_STR
+       "Display routing table for ABR and ASBR\n"
+      )
+{
+  u_int32_t adv_router;
+  void (*showfunc) (struct vty *, struct ospf6_route *);
+  struct ospf6_route *ro;
+  struct prefix prefix;
+
+  OSPF6_CMD_CHECK_RUNNING ();
+
+  if (argc && ! strcmp ("detail", argv[0]))
     {
-      proctitle_mode = -1;
-      setproctitle (NULL);
+      showfunc = ospf6_route_show_detail;
+      argc--;
+      argv++;
     }
   else
-    return CMD_ERR_NO_MATCH;
+    showfunc = ospf6_brouter_show;
+
+  if (argc)
+    {
+      if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
+        {
+          vty_out (vty, "Router ID is not parsable: %s%s", argv[0], VNL);
+          return CMD_SUCCESS;
+        }
+
+      ospf6_linkstate_prefix (adv_router, 0, &prefix);
+      ro = ospf6_route_lookup (&prefix, ospf6->brouter_table);
+      if (!ro)
+        {
+          vty_out (vty, "No Route found for Router ID: %s%s", argv[0], VNL);
+          return CMD_SUCCESS;
+        }
+
+      ospf6_route_show_detail (vty, ro);
+      return CMD_SUCCESS;
+    }
+
+  if (showfunc == ospf6_brouter_show)
+    ospf6_brouter_show_header (vty);
+
+  for (ro = ospf6_route_head (ospf6->brouter_table); ro;
+       ro = ospf6_route_next (ro))
+    (*showfunc) (vty, ro);
 
   return CMD_SUCCESS;
 }
-#endif /* HAVE_SETPROCTITLE */
 
-/* OSPF configuration write function. */
-int
-ospf6_config_write (struct vty *vty)
+ALIAS (show_ipv6_ospf6_border_routers,
+       show_ipv6_ospf6_border_routers_detail_cmd,
+       "show ipv6 ospf6 border-routers (A.B.C.D|detail)",
+       SHOW_STR
+       IP6_STR
+       OSPF6_STR
+       "Display routing table for ABR and ASBR\n"
+       "Specify Router-ID\n"
+       "Display Detail\n"
+      )
+
+DEFUN (show_ipv6_ospf6_linkstate,
+       show_ipv6_ospf6_linkstate_cmd,
+       "show ipv6 ospf6 linkstate",
+       SHOW_STR
+       IP6_STR
+       OSPF6_STR
+       "Display linkstate routing table\n"
+      )
 {
-  listnode j, k;
-  char buf[64];
-  struct ospf6_area *area;
-  struct ospf6_interface *o6i;
+  struct listnode *node;
+  struct ospf6_area *oa;
 
-  if (proctitle_mode == 1)
-    vty_out (vty, "set proctitle version%s", VTY_NEWLINE);
-  else if (proctitle_mode == -1)
-    vty_out (vty, "set proctitle none%s", VTY_NEWLINE);
+  OSPF6_CMD_CHECK_RUNNING ();
 
-  vty_out (vty, "!%s", VTY_NEWLINE);
+  for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
+    {
+      vty_out (vty, "%s        SPF Result in Area %s%s%s",
+               VNL, oa->name, VNL, VNL);
+      ospf6_linkstate_table_show (vty, argc, argv, oa->spf_table);
+    }
 
-  if (! ospf6)
-    return 0;
+  vty_out (vty, "%s", VNL);
+  return CMD_SUCCESS;
+}
 
-  /* OSPFv6 configuration. */
-  if (!ospf6)
-    return CMD_SUCCESS;
+ALIAS (show_ipv6_ospf6_linkstate,
+       show_ipv6_ospf6_linkstate_router_cmd,
+       "show ipv6 ospf6 linkstate router A.B.C.D",
+       SHOW_STR
+       IP6_STR
+       OSPF6_STR
+       "Display linkstate routing table\n"
+       "Display Router Entry\n"
+       "Specify Router ID as IPv4 address notation\n"
+      )
 
-  inet_ntop (AF_INET, &ospf6->router_id, buf, sizeof (buf));
-  vty_out (vty, "router ospf6%s", VTY_NEWLINE);
-  vty_out (vty, " router-id %s%s", buf, VTY_NEWLINE);
+ALIAS (show_ipv6_ospf6_linkstate,
+       show_ipv6_ospf6_linkstate_network_cmd,
+       "show ipv6 ospf6 linkstate network A.B.C.D A.B.C.D",
+       SHOW_STR
+       IP6_STR
+       OSPF6_STR
+       "Display linkstate routing table\n"
+       "Display Network Entry\n"
+       "Specify Router ID as IPv4 address notation\n"
+       "Specify Link state ID as IPv4 address notation\n"
+      )
 
-  ospf6_redistribute_config_write (vty);
-  ospf6_damp_config_write (vty);
+DEFUN (show_ipv6_ospf6_linkstate_detail,
+       show_ipv6_ospf6_linkstate_detail_cmd,
+       "show ipv6 ospf6 linkstate detail",
+       SHOW_STR
+       IP6_STR
+       OSPF6_STR
+       "Display linkstate routing table\n"
+      )
+{
+  const char *sargv[CMD_ARGC_MAX];
+  int i, sargc;
+  struct listnode *node;
+  struct ospf6_area *oa;
 
-  for (j = listhead (ospf6->area_list); j; nextnode (j))
+  OSPF6_CMD_CHECK_RUNNING ();
+
+  /* copy argv to sargv and then append "detail" */
+  for (i = 0; i < argc; i++)
+    sargv[i] = argv[i];
+  sargc = argc;
+  sargv[sargc++] = "detail";
+  sargv[sargc] = NULL;
+
+  for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
     {
-      area = (struct ospf6_area *)getdata (j);
-      for (k = listhead (area->if_list); k; nextnode (k))
-        {
-          o6i = (struct ospf6_interface *) getdata (k);
-          vty_out (vty, " interface %s area %s%s",
-                   o6i->interface->name, area->str, VTY_NEWLINE);
-        }
+      vty_out (vty, "%s        SPF Result in Area %s%s%s",
+               VNL, oa->name, VNL, VNL);
+      ospf6_linkstate_table_show (vty, sargc, sargv, oa->spf_table);
     }
-  vty_out (vty, "!%s", VTY_NEWLINE);
-  return 0;
-}
 
-/* OSPF6 node structure. */
-struct cmd_node ospf6_node =
-{
-  OSPF6_NODE,
-  "%s(config-ospf6)# ",
-  vtysh: 1
-};
+  vty_out (vty, "%s", VNL);
+  return CMD_SUCCESS;
+}
 
 /* Install ospf related commands. */
 void
-ospf6_init ()
+ospf6_init (void)
 {
-  /* Install ospf6 top node. */
-  install_node (&ospf6_node, ospf6_config_write);
-
-  install_element (VIEW_NODE, &show_ipv6_ospf6_cmd);
-  install_element (VIEW_NODE, &show_version_ospf6_cmd);
-  install_element (ENABLE_NODE, &show_ipv6_ospf6_cmd);
-  install_element (ENABLE_NODE, &show_version_ospf6_cmd);
-  install_element (ENABLE_NODE, &reload_cmd);
-  install_element (CONFIG_NODE, &router_ospf6_cmd);
-  install_element (CONFIG_NODE, &interface_cmd);
-#ifdef OSPF6_STATISTICS
-  install_element (VIEW_NODE, &show_ipv6_ospf6_statistics_cmd);
-  install_element (ENABLE_NODE, &show_ipv6_ospf6_statistics_cmd);
-#endif /* OSPF6_STATISTICS */
-#ifdef OSPF6_GARBAGE_COLLECT
-  install_element (ENABLE_NODE, &garbage_collection_cmd);
-#endif /* OSPF6_GARBAGE_COLLECT */
-#ifdef HAVE_SETPROCTITLE
-  install_element (CONFIG_NODE, &set_proctitle_cmd);
-#endif /* HAVE_SETPROCTITLE */
-
-  install_default (OSPF6_NODE);
-  install_element (OSPF6_NODE, &ospf6_router_id_cmd);
-  install_element (OSPF6_NODE, &ospf6_interface_area_cmd);
-  install_element (OSPF6_NODE, &ospf6_interface_area_passive_cmd);
-  install_element (OSPF6_NODE, &ospf6_interface_area_plist_cmd);
-  install_element (OSPF6_NODE, &ospf6_interface_area_plist_passive_cmd);
-  install_element (OSPF6_NODE, &no_ospf6_interface_area_cmd);
-  install_element (OSPF6_NODE, &ospf6_passive_interface_cmd);
-  install_element (OSPF6_NODE, &no_ospf6_passive_interface_cmd);
-  install_element (OSPF6_NODE, &ospf6_area_range_cmd);
-
-  /* Make empty list of top list. */
-  if_init ();
-
-  /* Install access list */
-  access_list_init ();
-
-  /* Install prefix list */
-  prefix_list_init ();
-
-  ospf6_dump_init ();
-
-#ifdef HAVE_OSPF6_DAMP
-  ospf6_damp_init ();
-#endif /*HAVE_OSPF6_DAMP*/
-
-  ospf6_hook_init ();
-  ospf6_lsa_init ();
-
   ospf6_top_init ();
   ospf6_area_init ();
   ospf6_interface_init ();
   ospf6_neighbor_init ();
   ospf6_zebra_init ();
 
-  ospf6_routemap_init ();
-  ospf6_lsdb_init ();
-
+  ospf6_lsa_init ();
   ospf6_spf_init ();
-
   ospf6_intra_init ();
-  ospf6_abr_init ();
   ospf6_asbr_init ();
-}
+  ospf6_abr_init ();
 
-void
-ospf6_terminate ()
-{
-  /* stop ospf6 */
-  ospf6_stop ();
+#ifdef HAVE_SNMP
+  ospf6_snmp_init (master);
+#endif /*HAVE_SNMP*/
 
-  /* log */
-  zlog (NULL, LOG_INFO, "OSPF6d terminated");
-}
+  ospf6_bfd_init();
+  install_node (&debug_node, config_write_ospf6_debug);
 
-void
-ospf6_maxage_remover ()
-{
-#if 0
-  if (IS_OSPF6_DUMP_LSDB)
-    zlog_info ("MaxAge Remover");
-#endif
-
-  ospf6_top_schedule_maxage_remover (NULL, 0, ospf6);
-  (*ospf6->foreach_area) (ospf6, NULL, 0,
-                          ospf6_area_schedule_maxage_remover);
-  (*ospf6->foreach_if) (ospf6, NULL, 0,
-                        ospf6_interface_schedule_maxage_remover);
-}
+  install_element_ospf6_debug_message ();
+  install_element_ospf6_debug_lsa ();
+  install_element_ospf6_debug_interface ();
+  install_element_ospf6_debug_neighbor ();
+  install_element_ospf6_debug_zebra ();
+  install_element_ospf6_debug_spf ();
+  install_element_ospf6_debug_route ();
+  install_element_ospf6_debug_brouter ();
+  install_element_ospf6_debug_asbr ();
+  install_element_ospf6_debug_abr ();
+  install_element_ospf6_debug_flood ();
 
+  install_element_ospf6_clear_interface ();
 
+  install_element (VIEW_NODE, &show_version_ospf6_cmd);
+  install_element (ENABLE_NODE, &show_version_ospf6_cmd);
 
-void *
-ospf6_lsa_get_scope (u_int16_t type, struct ospf6_interface *o6i)
-{
-  if (OSPF6_LSA_IS_SCOPE_LINKLOCAL (ntohs (type)))
-    return o6i;
-  else if (OSPF6_LSA_IS_SCOPE_AREA (ntohs (type)))
-    return o6i->area;
-  else if (OSPF6_LSA_IS_SCOPE_AS (ntohs (type)))
-    return o6i->area->ospf6;
-  else
-    return NULL;
+  install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd);
+  install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
+  install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_cmd);
+  install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
+
+  install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd);
+  install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_router_cmd);
+  install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_network_cmd);
+  install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_detail_cmd);
+  install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_cmd);
+  install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_router_cmd);
+  install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_network_cmd);
+  install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_detail_cmd);
+
+#define INSTALL(n,c) \
+  install_element (n ## _NODE, &show_ipv6_ospf6_ ## c)
+
+  INSTALL (VIEW, database_cmd);
+  INSTALL (VIEW, database_detail_cmd);
+  INSTALL (VIEW, database_type_cmd);
+  INSTALL (VIEW, database_type_detail_cmd);
+  INSTALL (VIEW, database_id_cmd);
+  INSTALL (VIEW, database_id_detail_cmd);
+  INSTALL (VIEW, database_linkstate_id_cmd);
+  INSTALL (VIEW, database_linkstate_id_detail_cmd);
+  INSTALL (VIEW, database_router_cmd);
+  INSTALL (VIEW, database_router_detail_cmd);
+  INSTALL (VIEW, database_adv_router_cmd);
+  INSTALL (VIEW, database_adv_router_detail_cmd);
+  INSTALL (VIEW, database_type_id_cmd);
+  INSTALL (VIEW, database_type_id_detail_cmd);
+  INSTALL (VIEW, database_type_linkstate_id_cmd);
+  INSTALL (VIEW, database_type_linkstate_id_detail_cmd);
+  INSTALL (VIEW, database_type_router_cmd);
+  INSTALL (VIEW, database_type_router_detail_cmd);
+  INSTALL (VIEW, database_type_adv_router_cmd);
+  INSTALL (VIEW, database_type_adv_router_detail_cmd);
+  INSTALL (VIEW, database_adv_router_linkstate_id_cmd);
+  INSTALL (VIEW, database_adv_router_linkstate_id_detail_cmd);
+  INSTALL (VIEW, database_id_router_cmd);
+  INSTALL (VIEW, database_id_router_detail_cmd);
+  INSTALL (VIEW, database_type_id_router_cmd);
+  INSTALL (VIEW, database_type_id_router_detail_cmd);
+  INSTALL (VIEW, database_type_adv_router_linkstate_id_cmd);
+  INSTALL (VIEW, database_type_adv_router_linkstate_id_detail_cmd);
+  INSTALL (VIEW, database_self_originated_cmd);
+  INSTALL (VIEW, database_self_originated_detail_cmd);
+  INSTALL (VIEW, database_type_self_originated_cmd);
+  INSTALL (VIEW, database_type_self_originated_detail_cmd);
+  INSTALL (VIEW, database_type_id_self_originated_cmd);
+  INSTALL (VIEW, database_type_id_self_originated_detail_cmd);
+  INSTALL (VIEW, database_type_self_originated_linkstate_id_cmd);
+  INSTALL (VIEW, database_type_self_originated_linkstate_id_detail_cmd);
+
+  INSTALL (ENABLE, database_cmd);
+  INSTALL (ENABLE, database_detail_cmd);
+  INSTALL (ENABLE, database_type_cmd);
+  INSTALL (ENABLE, database_type_detail_cmd);
+  INSTALL (ENABLE, database_id_cmd);
+  INSTALL (ENABLE, database_id_detail_cmd);
+  INSTALL (ENABLE, database_linkstate_id_cmd);
+  INSTALL (ENABLE, database_linkstate_id_detail_cmd);
+  INSTALL (ENABLE, database_router_cmd);
+  INSTALL (ENABLE, database_router_detail_cmd);
+  INSTALL (ENABLE, database_adv_router_cmd);
+  INSTALL (ENABLE, database_adv_router_detail_cmd);
+  INSTALL (ENABLE, database_type_id_cmd);
+  INSTALL (ENABLE, database_type_id_detail_cmd);
+  INSTALL (ENABLE, database_type_linkstate_id_cmd);
+  INSTALL (ENABLE, database_type_linkstate_id_detail_cmd);
+  INSTALL (ENABLE, database_type_router_cmd);
+  INSTALL (ENABLE, database_type_router_detail_cmd);
+  INSTALL (ENABLE, database_type_adv_router_cmd);
+  INSTALL (ENABLE, database_type_adv_router_detail_cmd);
+  INSTALL (ENABLE, database_adv_router_linkstate_id_cmd);
+  INSTALL (ENABLE, database_adv_router_linkstate_id_detail_cmd);
+  INSTALL (ENABLE, database_id_router_cmd);
+  INSTALL (ENABLE, database_id_router_detail_cmd);
+  INSTALL (ENABLE, database_type_id_router_cmd);
+  INSTALL (ENABLE, database_type_id_router_detail_cmd);
+  INSTALL (ENABLE, database_type_adv_router_linkstate_id_cmd);
+  INSTALL (ENABLE, database_type_adv_router_linkstate_id_detail_cmd);
+  INSTALL (ENABLE, database_self_originated_cmd);
+  INSTALL (ENABLE, database_self_originated_detail_cmd);
+  INSTALL (ENABLE, database_type_self_originated_cmd);
+  INSTALL (ENABLE, database_type_self_originated_detail_cmd);
+  INSTALL (ENABLE, database_type_id_self_originated_cmd);
+  INSTALL (ENABLE, database_type_id_self_originated_detail_cmd);
+  INSTALL (ENABLE, database_type_self_originated_linkstate_id_cmd);
+  INSTALL (ENABLE, database_type_self_originated_linkstate_id_detail_cmd);
+
+  /* Make ospf protocol socket. */
+  ospf6_serv_sock ();
+  thread_add_read (master, ospf6_receive, NULL, ospf6_sock);
 }
 
+void
+ospf6_clean (void)
+{
+  if (!ospf6)
+    return;
+  if (ospf6->route_table)
+    ospf6_route_remove_all (ospf6->route_table);
+  if (ospf6->brouter_table)
+    ospf6_route_remove_all (ospf6->brouter_table);
+}