]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_vty.c
Revert "lib: Macroize CLI matcher tracing"
[mirror_frr.git] / ospfd / ospf_vty.c
index f5f07944c5a72ce074baf719e934c6241a9cc230..12ae94210f3f8be64f76b51c335e3148c6b17e3f 100644 (file)
@@ -1029,7 +1029,7 @@ ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config)
        "Time between HELLO packets\n" \
        "Time between retransmitting lost link state advertisements\n" \
        "Link state transmit delay\n" \
-       "Interval after which a neighbor is declared dead\n"
+       "Interval time after which a neighbor is declared down\n"
 
 #define VLINK_HELPSTR_TIME_PARAM \
        VLINK_HELPSTR_TIME_PARAM_NOSECS \
@@ -1163,101 +1163,63 @@ DEFUN (ospf_area_vlink,
 
 DEFUN (ospf_area_vlink_intervals,
        ospf_area_vlink_intervals_cmd,
-       "area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D [<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)] [<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)] [<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)] [<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)] ",
+       "area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D"
+       "<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+       "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+       "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+       "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+       "]]]",
        VLINK_HELPSTR_IPADDR
        VLINK_HELPSTR_TIME_PARAM
        VLINK_HELPSTR_TIME_PARAM
        VLINK_HELPSTR_TIME_PARAM
        VLINK_HELPSTR_TIME_PARAM)
 {
-  int idx_ipv4_number = 1;
-  int idx_ipv4 = 3;
   struct ospf *ospf = vty->index;
   struct ospf_vl_config_data vl_config;
-  int i;
-  int ret;
+  int ret = 0;
 
   if (!ospf)
     return CMD_SUCCESS;
 
   ospf_vl_config_data_init(&vl_config, vty);
 
-  /* Read off first 2 parameters and check them */
-  ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &vl_config.format);
+  char *area_id   = argv[1]->arg;
+  char *router_id = argv[3]->arg;
+
+  ret = ospf_str2area_id (area_id, &vl_config.area_id, &vl_config.format);
   if (ret < 0)
     {
       vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
       return CMD_WARNING;
     }
 
-  ret = inet_aton (argv[idx_ipv4]->arg, &vl_config.vl_peer);
+  ret = inet_aton (router_id, &vl_config.vl_peer);
   if (! ret)
     {
-      vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
-               VTY_NEWLINE);
+      vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", VTY_NEWLINE);
       return CMD_WARNING;
     }
-
-  if (argc <=4)
-    {
-      /* Thats all folks! - BUGS B. strikes again!!!*/
-
-      return  ospf_vl_set (ospf, &vl_config);
-    }
-
-  /* Deal with other parameters */
-  for (i=5; i < argc; i++)
+  for (unsigned int i = 0; i < 4; i++)
     {
-
-      /* vty_out (vty, "argv[%d]->arg - %s%s", i, argv[i]->arg, VTY_NEWLINE); */
-
-      switch (argv[i]->arg[0])
-       {
-
-       case 'h':
-         /* Hello interval */
-         i++;
-         vl_config.hello_interval = strtol (argv[i]->arg, NULL, 10);
-         if (vl_config.hello_interval < 0) 
-           return CMD_WARNING;
-         break;
-
-       case 'r':
-         /* Retransmit Interval */
-         i++;
-         vl_config.retransmit_interval = strtol (argv[i]->arg, NULL, 10);
-         if (vl_config.retransmit_interval < 0)
-           return CMD_WARNING;
-         break;
-
-       case 't':
-         /* Transmit Delay */
-         i++;
-         vl_config.transmit_delay = strtol (argv[i]->arg, NULL, 10);
-         if (vl_config.transmit_delay < 0)
-           return CMD_WARNING;
-         break;
-
-       case 'd':
-         /* Dead Interval */
-         i++;
-         vl_config.dead_interval = strtol (argv[i]->arg, NULL, 10);
-         if (vl_config.dead_interval < 0)
-           return CMD_WARNING;
-         break;
-       }
+      int idx = 0;
+      if (argv_find (argv, argc, "hello-interval", &idx))
+        vl_config.hello_interval = strtol(argv[idx+1]->arg, NULL, 10);
+      else if (argv_find (argv, argc, "retransmit-interval", &idx))
+        vl_config.retransmit_interval = strtol(argv[idx+1]->arg, NULL, 10);
+      else if (argv_find (argv, argc, "transmit-delay", &idx))
+        vl_config.transmit_delay = strtol(argv[idx+1]->arg, NULL, 10);
+      else if (argv_find (argv, argc, "dead-interval", &idx))
+        vl_config.dead_interval = strtol(argv[idx+1]->arg, NULL, 10);
     }
 
-
   /* Action configuration */
-
   return ospf_vl_set (ospf, &vl_config);
-
 }
 
 DEFUN (no_ospf_area_vlink,
        no_ospf_area_vlink_cmd,
-       "area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D [authentication] [<message-digest|null>] [<message-digest-key (1-255) md5 KEY|authentication-key AUTH_KEY>]",
+       "no area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D [authentication] [<message-digest|null>] [<message-digest-key (1-255) md5 KEY|authentication-key AUTH_KEY>]",
        NO_STR
        VLINK_HELPSTR_IPADDR
        "Enable authentication on this virtual link\n" \
@@ -1365,97 +1327,58 @@ DEFUN (no_ospf_area_vlink,
 
 DEFUN (no_ospf_area_vlink_intervals,
        no_ospf_area_vlink_intervals_cmd,
-       "area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D [<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)] [<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)] [<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)] [<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)]",
+       "no area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D"
+       "<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+       "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+       "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+       "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+       "]]]",
        VLINK_HELPSTR_IPADDR
        VLINK_HELPSTR_TIME_PARAM
        VLINK_HELPSTR_TIME_PARAM
        VLINK_HELPSTR_TIME_PARAM
        VLINK_HELPSTR_TIME_PARAM)
 {
-  int idx_ipv4_number = 2;
-  int idx_ipv4 = 4;
   struct ospf *ospf = vty->index;
-  struct ospf_area *area;
   struct ospf_vl_config_data vl_config;
-  struct ospf_vl_data *vl_data = NULL;
-  int i;
-  int ret, format;
+  int ret = 0;
 
   if (!ospf)
     return CMD_SUCCESS;
 
   ospf_vl_config_data_init(&vl_config, vty);
 
-  ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &format);
+  char *area_id   = argv[2]->arg;
+  char *router_id = argv[4]->arg;
+
+  ret = ospf_str2area_id (area_id, &vl_config.area_id, &vl_config.format);
   if (ret < 0)
     {
       vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
       return CMD_WARNING;
     }
 
-  area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id);
-  if (!area)
-    {
-      vty_out (vty, "Area does not exist%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  ret = inet_aton (argv[idx_ipv4]->arg, &vl_config.vl_peer);
+  ret = inet_aton (router_id, &vl_config.vl_peer);
   if (! ret)
     {
-      vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
-               VTY_NEWLINE);
+      vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", VTY_NEWLINE);
       return CMD_WARNING;
     }
 
-  if (argc <=5)
-    {
-      /* Basic VLink no command */
-      /* Thats all folks! - BUGS B. strikes again!!!*/
-      if ((vl_data = ospf_vl_lookup (ospf, area, vl_config.vl_peer)))
-       ospf_vl_delete (ospf, vl_data);
-
-      ospf_area_check_free (ospf, vl_config.area_id);
-
-      return CMD_SUCCESS;
-    }
-
-  /* If we are down here, we are reseting parameters */
-
-  /* Deal with other parameters */
-  for (i=6; i < argc; i++)
+  for (unsigned int i = 0; i < 4; i++)
     {
-      /* vty_out (vty, "argv[%d] - %s%s", i, argv[i]->arg, VTY_NEWLINE); */
-
-      switch (argv[i]->arg[0])
-       {
-
-       case 'h':
-         /* Hello interval */
-         vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT;
-         break;
-
-       case 'r':
-         /* Retransmit Interval */
-         vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
-         break;
-
-       case 't':
-         /* Transmit Delay */
-         vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
-         break;
-
-       case 'd':
-         /* Dead Interval */
-         i++;
-         vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
-         break;
-       }
+      int idx = 0;
+      if (argv_find (argv, argc, "hello-interval", &idx))
+        vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT;
+      else if (argv_find (argv, argc, "retransmit-interval", &idx))
+        vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
+      else if (argv_find (argv, argc, "transmit-delay", &idx))
+        vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
+      else if (argv_find (argv, argc, "dead-interval", &idx))
+        vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
     }
 
-
   /* Action configuration */
-
   return ospf_vl_set (ospf, &vl_config);
 }
 
@@ -3174,8 +3097,10 @@ show_ip_ospf_common (struct vty *vty, struct ospf *ospf, u_char use_json)
   json_object *json_areas = NULL;
 
   if (use_json)
-    json = json_object_new_object();
-    json_areas = json_object_new_object();
+    {
+      json = json_object_new_object();
+      json_areas = json_object_new_object();
+    }
 
   if (ospf->instance)
     {
@@ -4468,10 +4393,15 @@ show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi,
   /* Show Router Dead interval timer. */
   if (use_json)
     {
-      struct timeval res = tv_sub (nbr->t_inactivity->u.sands, recent_relative_time ());
-      unsigned long time_store = 0;
-      time_store = (1000 * res.tv_sec) + (res.tv_usec / 1000);
-      json_object_int_add(json_sub, "routerDeadIntervalTimerDueMsec", time_store);
+      if (nbr->t_inactivity)
+       {
+         struct timeval res = tv_sub (nbr->t_inactivity->u.sands, recent_relative_time ());
+         unsigned long time_store = 0;
+         time_store = (1000 * res.tv_sec) + (res.tv_usec / 1000);
+         json_object_int_add(json_sub, "routerDeadIntervalTimerDueMsec", time_store);
+       }
+      else
+       json_object_int_add(json_sub, "routerDeadIntervalTimerDueMsec", -1);
     }
   else
     vty_out (vty, "    Dead timer due in %s%s",
@@ -5799,7 +5729,8 @@ DEFUN (show_ip_ospf_database_type_adv_router,
        "Database summary\n"
        OSPF_LSA_TYPES_DESC
        "Advertising Router link states\n"
-       "Advertising Router (as an IP address)\n")
+       "Advertising Router (as an IP address)\n"
+       "Self-originated link states\n")
 {
   struct ospf *ospf;
 
@@ -6102,6 +6033,7 @@ DEFUN (no_ip_ospf_authentication,
   return CMD_SUCCESS;
 }
 
+
 DEFUN (ip_ospf_authentication_key,
        ip_ospf_authentication_key_addr_cmd,
        "ip ospf authentication-key AUTH_KEY [A.B.C.D]",
@@ -6111,19 +6043,17 @@ DEFUN (ip_ospf_authentication_key,
        "The OSPF password (key)\n"
        "Address of interface")
 {
-  int idx_ipv4 = 4;
+  int idx = 0;
   struct interface *ifp;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
   
   ifp = vty->index;
   params = IF_DEF_PARAMS (ifp);
 
-  if (argc == 5)
+  if (argv_find (argv, argc, "A.B.C.D", &idx))
     {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
+      if (!inet_aton(argv[idx]->arg, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
@@ -6141,67 +6071,15 @@ DEFUN (ip_ospf_authentication_key,
   return CMD_SUCCESS;
 }
 
-
 DEFUN_HIDDEN (ospf_authentication_key,
               ospf_authentication_key_cmd,
-              "ospf authentication-key AUTH_KEY",
+              "ospf authentication-key AUTH_KEY [A.B.C.D]",
               "OSPF interface commands\n"
               "Authentication password (key)\n"
-              "The OSPF password (key)")
-{
-  struct interface *ifp;
-  struct ospf_if_params *params;
-
-  ifp = vty->index;
-  params = IF_DEF_PARAMS (ifp);
-  memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
-  strncpy ((char *) params->auth_simple, argv[2]->arg, OSPF_AUTH_SIMPLE_SIZE);
-  SET_IF_PARAM (params, auth_simple);
-
-  return CMD_SUCCESS;
-}
-
-DEFUN (no_ospf_authentication_key,
-       no_ospf_authentication_key_authkey_addr_cmd,
-       "no ospf authentication-key [AUTH_KEY [A.B.C.D]]",
-       NO_STR
-       "OSPF interface commands\n"
-       "Authentication password (key)\n"
-       "The OSPF password (key)")
+              "The OSPF password (key)\n"
+              "Address of interface\n")
 {
-  struct interface *ifp;
-  struct in_addr addr;
-  struct ospf_if_params *params;
-  int ret;
-  
-  ifp = vty->index;
-  params = IF_DEF_PARAMS (ifp);
-
-  if (argc == 5)
-    {
-      ret = inet_aton(argv[4]->arg, &addr);
-      if (!ret)
-       {
-         vty_out (vty, "Please specify interface address by A.B.C.D%s",
-                  VTY_NEWLINE);
-         return CMD_WARNING;
-       }
-
-      params = ospf_lookup_if_params (ifp, addr);
-      if (params == NULL)
-       return CMD_SUCCESS;
-    }
-
-  memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE);
-  UNSET_IF_PARAM (params, auth_simple);
-  
-  if (params != IF_DEF_PARAMS (ifp))
-    {
-      ospf_free_if_params (ifp, addr);
-      ospf_if_update_params (ifp, addr);
-    }
-  
-  return CMD_SUCCESS;
+  return ip_ospf_authentication_key (self, vty, argc, argv);
 }
 
 DEFUN (no_ip_ospf_authentication_key,
@@ -6213,18 +6091,16 @@ DEFUN (no_ip_ospf_authentication_key,
        "Authentication password (key)\n"
        "The OSPF password (key)")
 {
+  int idx = 0;
   struct interface *ifp;
   struct in_addr addr;
   struct ospf_if_params *params;
-  int ret;
-
   ifp = vty->index;
   params = IF_DEF_PARAMS (ifp);
 
-  if (argc == 6)
+  if (argv_find (argv, argc, "A.B.C.D", &idx))
     {
-      ret = inet_aton(argv[5]->arg, &addr);
-      if (!ret)
+      if (!inet_aton(argv[idx]->arg, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
@@ -6248,33 +6124,46 @@ DEFUN (no_ip_ospf_authentication_key,
   return CMD_SUCCESS;
 }
 
+DEFUN_HIDDEN (no_ospf_authentication_key,
+              no_ospf_authentication_key_authkey_addr_cmd,
+              "no ospf authentication-key [AUTH_KEY [A.B.C.D]]",
+              NO_STR
+              "OSPF interface commands\n"
+              "Authentication password (key)\n"
+              "The OSPF password (key)")
+{
+  return no_ip_ospf_authentication_key (self, vty, argc, argv);
+}
+
 DEFUN (ip_ospf_message_digest_key,
-       ip_ospf_message_digest_key_addr_cmd,
+       ip_ospf_message_digest_key_cmd,
        "ip ospf message-digest-key (1-255) md5 KEY [A.B.C.D]",
        "IP Information\n"
        "OSPF interface commands\n"
        "Message digest authentication password (key)\n"
        "Key ID\n"
        "Use MD5 algorithm\n"
-       "The OSPF password (key)"
-       "Address of interface")
+       "The OSPF password (key)\n"
+       "Address of interface\n")
 {
-  int idx_number = 3;
-  int idx_ipv4 = 6;
   struct interface *ifp;
   struct crypt_key *ck;
   u_char key_id;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
   
   ifp = vty->index;
   params = IF_DEF_PARAMS (ifp);
+  int idx = 0;
 
-  if (argc == 7)
+  argv_find (argv, argc, "(1-255)", &idx);
+  char *keyid = argv[idx]->arg;
+  argv_find (argv, argc, "KEY", &idx);
+  char *cryptkey = argv[idx]->arg;
+
+  if (argv_find (argv, argc, "A.B.C.D", &idx))
     {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
+      if (!inet_aton(argv[idx]->arg, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
@@ -6285,7 +6174,7 @@ DEFUN (ip_ospf_message_digest_key,
       ospf_if_update_params (ifp, addr);
     }
 
-  key_id = strtol (argv[idx_number]->arg, NULL, 10);
+  key_id = strtol (keyid, NULL, 10);
   if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL)
     {
       vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE);
@@ -6295,7 +6184,7 @@ DEFUN (ip_ospf_message_digest_key,
   ck = ospf_crypt_key_new ();
   ck->key_id = (u_char) key_id;
   memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1);
-  strncpy ((char *) ck->auth_key, argv[idx_ipv4]->arg, OSPF_AUTH_MD5_SIZE);
+  strncpy ((char *) ck->auth_key, cryptkey, OSPF_AUTH_MD5_SIZE);
 
   ospf_crypt_key_add (params->auth_crypt, ck);
   SET_IF_PARAM (params, auth_crypt);
@@ -6303,69 +6192,46 @@ DEFUN (ip_ospf_message_digest_key,
   return CMD_SUCCESS;
 }
 
-
 DEFUN_HIDDEN (ospf_message_digest_key,
               ospf_message_digest_key_cmd,
-              "ospf message-digest-key (1-255) md5 KEY",
+              "ospf message-digest-key (1-255) md5 KEY [A.B.C.D]",
               "OSPF interface commands\n"
               "Message digest authentication password (key)\n"
               "Key ID\n"
               "Use MD5 algorithm\n"
-              "The OSPF password (key)")
+              "The OSPF password (key)\n"
+              "Address of interface\n")
 {
-  int idx_number = 2;
-  struct interface *ifp;
-  struct crypt_key *ck;
-  u_char key_id;
-  struct ospf_if_params *params;
-
-  ifp = vty->index;
-  params = IF_DEF_PARAMS (ifp);
-  key_id = strtol (argv[idx_number]->arg, NULL, 10);
-  if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL)
-    {
-      vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  ck = ospf_crypt_key_new ();
-  ck->key_id = (u_char) key_id;
-  memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1);
-  strncpy ((char *) ck->auth_key, argv[idx_number]->arg, OSPF_AUTH_MD5_SIZE);
-
-  ospf_crypt_key_add (params->auth_crypt, ck);
-  SET_IF_PARAM (params, auth_crypt);
-
-  return CMD_SUCCESS;
+  return ip_ospf_message_digest_key (self, vty, argc, argv);
 }
 
-DEFUN (no_ip_ospf_message_digest_key_md5,
-       no_ip_ospf_message_digest_key_md5_addr_cmd,
-       "no ip ospf message-digest-key (1-255) md5 KEY [A.B.C.D]",
+DEFUN (no_ip_ospf_message_digest_key,
+       no_ip_ospf_message_digest_key_cmd,
+       "no ip ospf message-digest-key (1-255) [md5 KEY] [A.B.C.D]",
         NO_STR
        "IP Information\n"
        "OSPF interface commands\n"
        "Message digest authentication password (key)\n"
        "Key ID\n"
        "Use MD5 algorithm\n"
-       "The OSPF password (key)"
-       "Address of interface")
+       "The OSPF password (key)\n"
+       "Address of interface\n")
 {
-  int idx_number = 4;
+  int idx = 0;
   struct interface *ifp;
   struct crypt_key *ck;
   int key_id;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
-
   ifp = vty->index;
   params = IF_DEF_PARAMS (ifp);
 
-  if (argc == 8)
+  argv_find (argv, argc, "(1-255)", &idx);
+  char *keyid  = argv[idx]->arg;
+
+  if (argv_find (argv, argc, "A.B.C.D", &idx))
     {
-      ret = inet_aton(argv[7]->arg, &addr);
-      if (!ret)
+      if (!inet_aton(argv[idx]->arg, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
@@ -6377,7 +6243,7 @@ DEFUN (no_ip_ospf_message_digest_key_md5,
        return CMD_SUCCESS;
     }
 
-  key_id = strtol (argv[idx_number]->arg, NULL, 10);
+  key_id = strtol (keyid, NULL, 10);
   ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
   if (ck == NULL)
     {
@@ -6396,404 +6262,100 @@ DEFUN (no_ip_ospf_message_digest_key_md5,
   return CMD_SUCCESS;
 }
 
-DEFUN (no_ospf_message_digest_key,
-       no_ospf_message_digest_key_addr_cmd,
-       "no ospf message-digest-key (1-255) [A.B.C.D]",
-       NO_STR
+DEFUN_HIDDEN (no_ospf_message_digest_key,
+              no_ospf_message_digest_key_cmd,
+              "no ospf message-digest-key (1-255) [md5 KEY] [A.B.C.D]",
+              NO_STR
+              "OSPF interface commands\n"
+              "Message digest authentication password (key)\n"
+              "Key ID\n"
+              "Address of interface")
+{
+  return no_ip_ospf_message_digest_key (self, vty, argc, argv);
+}
+
+DEFUN (ip_ospf_cost,
+       ip_ospf_cost_cmd,
+       "ip ospf cost (1-65535) [A.B.C.D]",
+       "IP Information\n"
        "OSPF interface commands\n"
-       "Message digest authentication password (key)\n"
-       "Key ID\n"
-       "Address of interface")
+       "Interface cost\n"
+       "Cost\n"
+       "Address of interface\n")
 {
-  int idx_number = 3;
-  int idx_ipv4 = 4;
-  struct interface *ifp;
-  struct crypt_key *ck;
-  int key_id;
+  int idx = 0;
+  struct interface *ifp = vty->index;
+  u_int32_t cost;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
-
-  ifp = vty->index;
   params = IF_DEF_PARAMS (ifp);
 
-  if (argc == 5)
+  // get arguments
+  char *coststr = NULL, *ifaddr = NULL;
+  coststr = argv_find (argv, argc, "(1-65535)", &idx) ? argv[idx]->arg : NULL;
+  ifaddr = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL;
+
+  cost = strtol (coststr, NULL, 10);
+
+  if (ifaddr)
     {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
+      if(!inet_aton(ifaddr, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
          return CMD_WARNING;
        }
 
-      params = ospf_lookup_if_params (ifp, addr);
-      if (params == NULL)
-       return CMD_SUCCESS;
-    }
-
-  key_id = strtol (argv[idx_number]->arg, NULL, 10);
-  ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
-  if (ck == NULL)
-    {
-      vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  ospf_crypt_key_delete (params->auth_crypt, key_id);
-
-  if (params != IF_DEF_PARAMS (ifp))
-    {
-      ospf_free_if_params (ifp, addr);
-      ospf_if_update_params (ifp, addr);
-    }
-
-  return CMD_SUCCESS;
-}
-
-DEFUN (no_ip_ospf_message_digest_key,
-       no_ip_ospf_message_digest_key_addr_cmd,
-       "no ip ospf message-digest-key (1-255) [A.B.C.D]",
-       NO_STR
-       "IP Information\n"
-       "OSPF interface commands\n"
-       "Message digest authentication password (key)\n"
-       "Key ID\n"
-       "Address of interface")
-{
-  int idx_number = 4;
-  int idx_ipv4 = 5;
-  struct interface *ifp;
-  struct crypt_key *ck;
-  int key_id;
-  struct in_addr addr;
-  int ret;
-  struct ospf_if_params *params;
-
-  ifp = vty->index;
-  params = IF_DEF_PARAMS (ifp);
-
-  if (argc == 6)
-    {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
-       {
-         vty_out (vty, "Please specify interface address by A.B.C.D%s",
-                  VTY_NEWLINE);
-         return CMD_WARNING;
-       }
-
-      params = ospf_lookup_if_params (ifp, addr);
-      if (params == NULL)
-       return CMD_SUCCESS;
-    }
-
-  key_id = strtol (argv[idx_number]->arg, NULL, 10);
-  ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
-  if (ck == NULL)
-    {
-      vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  ospf_crypt_key_delete (params->auth_crypt, key_id);
-
-  if (params != IF_DEF_PARAMS (ifp))
-    {
-      ospf_free_if_params (ifp, addr);
-      ospf_if_update_params (ifp, addr);
-    }
-
-  return CMD_SUCCESS;
-}
-
-DEFUN (ip_ospf_cost,
-       ip_ospf_cost_u32_inet4_cmd,
-       "ip ospf cost (1-65535) [A.B.C.D]",
-       "IP Information\n"
-       "OSPF interface commands\n"
-       "Interface cost\n"
-       "Cost\n"
-       "Address of interface")
-{
-  int idx_number = 3;
-  int idx_ipv4 = 4;
-  struct interface *ifp = vty->index;
-  u_int32_t cost;
-  struct in_addr addr;
-  int ret;
-  struct ospf_if_params *params;
-
-  params = IF_DEF_PARAMS (ifp);
-
-  cost = strtol (argv[idx_number]->arg, NULL, 10);
-
-  /* cost range is <1-65535>. */
-  if (cost < 1 || cost > 65535)
-    {
-      vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  if (argc == 5)
-    {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
-       {
-         vty_out (vty, "Please specify interface address by A.B.C.D%s",
-                  VTY_NEWLINE);
-         return CMD_WARNING;
-       }
-
-      params = ospf_get_if_params (ifp, addr);
-      ospf_if_update_params (ifp, addr);
+      params = ospf_get_if_params (ifp, addr);
+      ospf_if_update_params (ifp, addr);
     }
 
   SET_IF_PARAM (params, output_cost_cmd);
   params->output_cost_cmd = cost;
 
   ospf_if_recalculate_output_cost (ifp);
-    
+
   return CMD_SUCCESS;
 }
 
 DEFUN_HIDDEN (ospf_cost,
-              ospf_cost_u32_inet4_cmd,
-              "ospf cost (1-65535) A.B.C.D",
+              ospf_cost_cmd,
+              "ospf cost (1-65535) [A.B.C.D]",
               "OSPF interface commands\n"
               "Interface cost\n"
               "Cost\n"
-              "Address of interface")
+              "Address of interface\n")
 {
-  int idx_number = 2;
-  int idx_ipv4 = 3;
-  struct interface *ifp = vty->index;
-  u_int32_t cost;
-  struct in_addr addr;
-  int ret;
-  struct ospf_if_params *params;
-
-  params = IF_DEF_PARAMS (ifp);
-
-  cost = strtol (argv[idx_number]->arg, NULL, 10);
-
-  /* cost range is <1-65535>. */
-  if (cost < 1 || cost > 65535)
-    {
-      vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  if (argc == 5)
-    {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
-        {
-          vty_out (vty, "Please specify interface address by A.B.C.D%s",
-                   VTY_NEWLINE);
-          return CMD_WARNING;
-        }
-
-      params = ospf_get_if_params (ifp, addr);
-      ospf_if_update_params (ifp, addr);
-    }
-
-  SET_IF_PARAM (params, output_cost_cmd);
-  params->output_cost_cmd = cost;
-
-  ospf_if_recalculate_output_cost (ifp);
-
-  return CMD_SUCCESS;
-}
-
-DEFUN (no_ospf_cost,
-       no_ospf_cost_inet4_cmd,
-       "no ospf cost [A.B.C.D]",
-       NO_STR
-       "OSPF interface commands\n"
-       "Interface cost\n"
-       "Address of interface")
-{
-  int idx_ipv4 = 3;
-  struct interface *ifp = vty->index;
-  struct in_addr addr;
-  int ret;
-  struct ospf_if_params *params;
-
-  ifp = vty->index;
-  params = IF_DEF_PARAMS (ifp);
-
-  if (argc == 4)
-    {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
-       {
-         vty_out (vty, "Please specify interface address by A.B.C.D%s",
-                  VTY_NEWLINE);
-         return CMD_WARNING;
-       }
-
-      params = ospf_lookup_if_params (ifp, addr);
-      if (params == NULL)
-       return CMD_SUCCESS;
-    }
-
-  UNSET_IF_PARAM (params, output_cost_cmd);
-
-  if (params != IF_DEF_PARAMS (ifp))
-    {
-      ospf_free_if_params (ifp, addr);
-      ospf_if_update_params (ifp, addr);
-    }
-
-  ospf_if_recalculate_output_cost (ifp);
-
-  return CMD_SUCCESS;
+  return ip_ospf_cost (self, vty, argc, argv);
 }
 
 DEFUN (no_ip_ospf_cost,
-       no_ip_ospf_cost_inet4_cmd,
-       "no ip ospf cost [A.B.C.D]",
+       no_ip_ospf_cost_cmd,
+       "no ip ospf cost [(1-65535)] [A.B.C.D]",
        NO_STR
-       "IP Information\n"
        "OSPF interface commands\n"
        "Interface cost\n"
        "Address of interface")
 {
-  int idx_ipv4 = 4;
+  int idx = 0;
   struct interface *ifp = vty->index;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
 
   ifp = vty->index;
   params = IF_DEF_PARAMS (ifp);
 
-  if (argc == 5)
-    {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
-       {
-         vty_out (vty, "Please specify interface address by A.B.C.D%s",
-                  VTY_NEWLINE);
-         return CMD_WARNING;
-       }
-
-      params = ospf_lookup_if_params (ifp, addr);
-      if (params == NULL)
-       return CMD_SUCCESS;
-    }
-
-  UNSET_IF_PARAM (params, output_cost_cmd);
-
-  if (params != IF_DEF_PARAMS (ifp))
-    {
-      ospf_free_if_params (ifp, addr);
-      ospf_if_update_params (ifp, addr);
-    }
-
-  ospf_if_recalculate_output_cost (ifp);
-  
-  return CMD_SUCCESS;
-}
-
-DEFUN (no_ospf_cost2,
-       no_ospf_cost_u32_cmd,
-       "no ospf cost [(1-65535) [A.B.C.D]]",
-       NO_STR
-       "OSPF interface commands\n"
-       "Interface cost\n"
-       "Cost\n"
-       "Address of interface\n")
-{
-  int idx_number = 3;
-  int idx_ipv4 = 4;
-  struct interface *ifp = vty->index;
-  struct in_addr addr;
-  u_int32_t cost;
-  int ret;
-  struct ospf_if_params *params;
-
-  ifp = vty->index;
-  params = IF_DEF_PARAMS (ifp);
-
-  /* According to the semantics we are mimicking "no ip ospf cost N" is
-   * always treated as "no ip ospf cost" regardless of the actual value
-   * of N already configured for the interface. Thus the first argument
-   * is always checked to be a number, but is ignored after that.
-   */
-  cost = strtol (argv[idx_number]->arg, NULL, 10);
-  if (cost < 1 || cost > 65535)
-    {
-      vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  if (argc == 5)
-    {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
-       {
-         vty_out (vty, "Please specify interface address by A.B.C.D%s",
-                  VTY_NEWLINE);
-         return CMD_WARNING;
-       }
-
-      params = ospf_lookup_if_params (ifp, addr);
-      if (params == NULL)
-       return CMD_SUCCESS;
-    }
-
-  UNSET_IF_PARAM (params, output_cost_cmd);
-
-  if (params != IF_DEF_PARAMS (ifp))
-    {
-      ospf_free_if_params (ifp, addr);
-      ospf_if_update_params (ifp, addr);
-    }
-
-  ospf_if_recalculate_output_cost (ifp);
-
-  return CMD_SUCCESS;
-}
-
-DEFUN (no_ip_ospf_cost2,
-       no_ip_ospf_cost_u32_cmd,
-       "no ip ospf cost (1-65535) [A.B.C.D]",
-       NO_STR
-       "IP Information\n"
-       "OSPF interface commands\n"
-       "Interface cost\n"
-       "Cost\n"
-       "Address of interface\n")
-{
-  int idx_number = 4;
-  int idx_ipv4 = 5;
-  struct interface *ifp = vty->index;
-  struct in_addr addr;
-  u_int32_t cost;
-  int ret;
-  struct ospf_if_params *params;
-
-  ifp = vty->index;
-  params = IF_DEF_PARAMS (ifp);
+  // get arguments
+  char *ifaddr = NULL;
+  ifaddr = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL;
 
   /* According to the semantics we are mimicking "no ip ospf cost N" is
    * always treated as "no ip ospf cost" regardless of the actual value
-   * of N already configured for the interface. Thus the first argument
-   * is always checked to be a number, but is ignored after that.
-   */
-  cost = strtol (argv[idx_number]->arg, NULL, 10);
-  if (cost < 1 || cost > 65535)
-    {
-      vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
+   * of N already configured for the interface. Thus ignore cost. */
 
-  if (argc == 5)
+  if (ifaddr)
     {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
+      if (!inet_aton(ifaddr, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
@@ -6818,8 +6380,17 @@ DEFUN (no_ip_ospf_cost2,
   return CMD_SUCCESS;
 }
 
-
-
+DEFUN_HIDDEN (no_ospf_cost,
+              no_ospf_cost_cmd,
+              "no ospf cost [(1-65535)] [A.B.C.D]",
+              NO_STR
+              "OSPF interface commands\n"
+              "Interface cost\n"
+              "Cost\n"
+              "Address of interface\n")
+{
+  return no_ip_ospf_cost (self, vty, argc, argv);
+}
 
 static void
 ospf_nbr_timer_update (struct ospf_interface *oi)
@@ -6917,33 +6488,30 @@ ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str,
 }
 
 DEFUN (ip_ospf_dead_interval,
-       ip_ospf_dead_interval_addr_cmd,
+       ip_ospf_dead_interval_cmd,
        "ip ospf dead-interval (1-65535) [A.B.C.D]",
        "IP Information\n"
        "OSPF interface commands\n"
-       "Interval after which a neighbor is declared dead\n"
+       "Interval time after which a neighbor is declared down\n"
        "Seconds\n"
        "Address of interface\n")
 {
-  int idx_number = 3;
-  int idx_ipv4 = 4;
-  if (argc == 5)
-    return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, argv[idx_ipv4]->arg, NULL);
-  else
-    return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, NULL, NULL);
+  int idx = 0;
+  char *interval = argv_find (argv, argc, "(1-65535)", &idx) ? argv[idx]->arg : NULL;
+  char *ifaddr = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL;
+  return ospf_vty_dead_interval_set (vty, interval, ifaddr, NULL);
 }
 
 
 DEFUN_HIDDEN (ospf_dead_interval,
               ospf_dead_interval_cmd,
-              "ospf dead-interval (1-65535)",
+              "ospf dead-interval (1-65535) [A.B.C.D]",
               "OSPF interface commands\n"
-              "Interval after which a neighbor is declared dead\n"
-              "Seconds\n")
+              "Interval time after which a neighbor is declared down\n"
+              "Seconds\n"
+              "Address of interface\n")
 {
-  int idx_number = 2;
-
-  return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, NULL, NULL);
+  return ip_ospf_dead_interval (self, vty, argc, argv);
 }
 
 DEFUN (ip_ospf_dead_interval_minimal,
@@ -6951,7 +6519,7 @@ DEFUN (ip_ospf_dead_interval_minimal,
        "ip ospf dead-interval minimal hello-multiplier (1-10) [A.B.C.D]",
        "IP Information\n"
        "OSPF interface commands\n"
-       "Interval after which a neighbor is declared dead\n"
+       "Interval time after which a neighbor is declared down\n"
        "Minimal 1s dead-interval with fast sub-second hellos\n"
        "Hello multiplier factor\n"
        "Number of Hellos to send each second\n"
@@ -6965,35 +6533,13 @@ DEFUN (ip_ospf_dead_interval_minimal,
     return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[idx_number]->arg);
 }
 
-DEFUN (no_ospf_dead_interval,
-       no_ospf_dead_interval_cmd,
-       "no ospf dead-interval",
-       NO_STR
-       "OSPF interface commands\n"
-       "Interval after which a neighbor is declared dead\n")
-{
-  struct interface *ifp = vty->index;
-  struct ospf_if_params *params;
-
-  ifp = vty->index;
-  params = IF_DEF_PARAMS (ifp);
-
-  UNSET_IF_PARAM (params, v_wait);
-  params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
-
-  UNSET_IF_PARAM (params, fast_hello);
-  params->fast_hello = OSPF_FAST_HELLO_DEFAULT;
-
-  return CMD_SUCCESS;
-}
-
 DEFUN (no_ip_ospf_dead_interval,
-       no_ip_ospf_dead_interval_addr_cmd,
+       no_ip_ospf_dead_interval_cmd,
        "no ip ospf dead-interval [<(1-65535)|minimal hello-multiplier (1-10)> [A.B.C.D]]",
        NO_STR
        "IP Information\n"
        "OSPF interface commands\n"
-       "Interval after which a neighbor is declared dead\n"
+       "Interval time after which a neighbor is declared down\n"
        "Seconds\n"
        "Address of interface")
 {
@@ -7057,38 +6603,40 @@ DEFUN (no_ip_ospf_dead_interval,
   return CMD_SUCCESS;
 }
 
+DEFUN_HIDDEN (no_ospf_dead_interval,
+              no_ospf_dead_interval_cmd,
+              "no ospf dead-interval [<(1-65535)|minimal hello-multiplier (1-10)> [A.B.C.D]]",
+              NO_STR
+              "OSPF interface commands\n"
+              "Interval time after which a neighbor is declared down\n"
+              "Seconds\n"
+              "Address of interface")
+{
+  return no_ip_ospf_dead_interval (self, vty, argc, argv);
+}
+
 DEFUN (ip_ospf_hello_interval,
-       ip_ospf_hello_interval_addr_cmd,
+       ip_ospf_hello_interval_cmd,
        "ip ospf hello-interval (1-65535) [A.B.C.D]",
        "IP Information\n"
        "OSPF interface commands\n"
        "Time between HELLO packets\n"
        "Seconds\n"
-       "Address of interface")
+       "Address of interface\n")
 {
-  int idx_number = 3;
-  int idx_ipv4 = 4;
+  int idx = 0;
   struct interface *ifp = vty->index;
-  u_int32_t seconds;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
-      
   params = IF_DEF_PARAMS (ifp);
+  u_int32_t seconds = 0;
 
-  seconds = strtol (argv[idx_number]->arg, NULL, 10);
+  argv_find (argv, argc, "(1-65535)", &idx);
+  seconds = strtol (argv[idx]->arg, NULL, 10);
   
-  /* HelloInterval range is <1-65535>. */
-  if (seconds < 1 || seconds > 65535)
-    {
-      vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  if (argc == 5)
+  if (argv_find (argv, argc, "A.B.C.D", &idx))
     {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
+      if(!inet_aton(argv[idx]->arg, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
@@ -7105,62 +6653,36 @@ DEFUN (ip_ospf_hello_interval,
   return CMD_SUCCESS;
 }
 
-
 DEFUN_HIDDEN (ospf_hello_interval,
               ospf_hello_interval_cmd,
-              "ospf hello-interval (1-65535)",
+              "ospf hello-interval (1-65535) [A.B.C.D]",
               "OSPF interface commands\n"
               "Time between HELLO packets\n"
-              "Seconds\n")
+              "Seconds\n"
+              "Address of interface\n")
 {
-  int idx_number = 2;
-  struct interface *ifp = vty->index;
-  u_int32_t seconds;
-  struct ospf_if_params *params;
-
-  params = IF_DEF_PARAMS (ifp);
-
-  seconds = strtol (argv[idx_number]->arg, NULL, 10);
-
-  /* HelloInterval range is <1-65535>. */
-  if (seconds < 1 || seconds > 65535)
-    {
-      vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  SET_IF_PARAM (params, v_hello);
-  params->v_hello = seconds;
-
-  return CMD_SUCCESS;
+  return ip_ospf_hello_interval (self, vty, argc, argv);
 }
 
 DEFUN (no_ip_ospf_hello_interval,
-       no_ip_ospf_hello_interval_addr_cmd,
-       "no [ip] ospf hello-interval [(1-65535) [A.B.C.D]]",
+       no_ip_ospf_hello_interval_cmd,
+       "no ip ospf hello-interval [(1-65535) [A.B.C.D]]",
        NO_STR
        "IP Information\n"
        "OSPF interface commands\n"
-       "Time between HELLO packets\n"
+       "Time between HELLO packets\n" // ignored
        "Seconds\n"
-       "Address of interface")
+       "Address of interface\n")
 {
-  int idx_ipv4 = 5;
+  int idx = 0;
   struct interface *ifp = vty->index;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
-  
-  ifp = vty->index;
   params = IF_DEF_PARAMS (ifp);
 
-  if (strcmp (argv[1]->arg, "ip") == 0)
-    idx_ipv4 = 4; 
-
-  if (argc == idx_ipv4+1)
+  if (argv_find (argv, argc, "A.B.C.D", &idx))
     {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
+      if(!inet_aton(argv[idx]->arg, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
@@ -7184,8 +6706,17 @@ DEFUN (no_ip_ospf_hello_interval,
   return CMD_SUCCESS;
 }
 
-
-
+DEFUN_HIDDEN (no_ospf_hello_interval,
+              no_ospf_hello_interval_cmd,
+              "no ospf hello-interval [(1-65535) [A.B.C.D]]",
+              NO_STR
+              "OSPF interface commands\n"
+              "Time between HELLO packets\n" // ignored
+              "Seconds\n"
+              "Address of interface\n")
+{
+  return no_ip_ospf_hello_interval (self, vty, argc, argv);
+}
 
 DEFUN (ip_ospf_network,
        ip_ospf_network_cmd,
@@ -7198,7 +6729,7 @@ DEFUN (ip_ospf_network,
        "Specify OSPF point-to-multipoint network\n"
        "Specify OSPF point-to-point network\n")
 {
-  int idx_network = 3;
+  int idx = 0;
   struct interface *ifp = vty->index;
   int old_type = IF_DEF_PARAMS (ifp)->type;
   struct route_node *rn;
@@ -7209,13 +6740,13 @@ DEFUN (ip_ospf_network,
       return CMD_WARNING;
     }
 
-  if (strncmp (argv[idx_network]->arg, "b", 1) == 0)
+  if (argv_find (argv, argc, "broadcast", &idx))
     IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
-  else if (strncmp (argv[idx_network]->arg, "n", 1) == 0)
+  else if (argv_find (argv, argc, "non-broadcast", &idx))
     IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA;
-  else if (strncmp (argv[idx_network]->arg, "point-to-m", 10) == 0)
+  else if (argv_find (argv, argc, "point-to-multipoint", &idx))
     IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT;
-  else if (strncmp (argv[idx_network]->arg, "point-to-p", 10) == 0)
+  else if (argv_find (argv, argc, "point-to-point", &idx))
     IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT;
 
   if (IF_DEF_PARAMS (ifp)->type == old_type)
@@ -7252,288 +6783,105 @@ DEFUN_HIDDEN (ospf_network,
               "Specify OSPF point-to-multipoint network\n"
               "Specify OSPF point-to-point network\n")
 {
-  int idx_network = 2;
-  struct interface *ifp = vty->index;
-  int old_type = IF_DEF_PARAMS (ifp)->type;
-  struct route_node *rn;
-
-  if (old_type == OSPF_IFTYPE_LOOPBACK)
-    {
-      vty_out (vty, "This is a loopback interface. Can't set network type.%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  if (strncmp (argv[idx_network]->arg, "b", 1) == 0)
-    IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
-  else if (strncmp (argv[idx_network]->arg, "n", 1) == 0)
-    IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA;
-  else if (strncmp (argv[idx_network]->arg, "point-to-m", 10) == 0)
-    IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT;
-  else if (strncmp (argv[idx_network]->arg, "point-to-p", 10) == 0)
-    IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT;
-
-  if (IF_DEF_PARAMS (ifp)->type == old_type)
-    return CMD_SUCCESS;
-
-  SET_IF_PARAM (IF_DEF_PARAMS (ifp), type);
-
-  for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
-    {
-      struct ospf_interface *oi = rn->info;
-
-      if (!oi)
-        continue;
-
-      oi->type = IF_DEF_PARAMS (ifp)->type;
-
-      if (oi->state > ISM_Down)
-        {
-          OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
-          OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
-        }
-    }
-
-  return CMD_SUCCESS;
-}
-
-DEFUN (no_ospf_network,
-       no_ospf_network_cmd,
-       "no ospf network [<broadcast|non-broadcast|point-to-multipoint|point-to-point>]",
-       NO_STR
-       "OSPF interface commands\n"
-       "Network type\n"
-       "Specify OSPF broadcast multi-access network\n"
-       "Specify OSPF NBMA network\n"
-       "Specify OSPF point-to-multipoint network\n"
-       "Specify OSPF point-to-point network\n")
-{
-  struct interface *ifp = vty->index;
-  int old_type = IF_DEF_PARAMS (ifp)->type;
-  struct route_node *rn;
-
-  IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp);
-
-  if (IF_DEF_PARAMS (ifp)->type == old_type)
-    return CMD_SUCCESS;
-
-  for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
-    {
-      struct ospf_interface *oi = rn->info;
-
-      if (!oi)
-       continue;
-
-      oi->type = IF_DEF_PARAMS (ifp)->type;
-
-      if (oi->state > ISM_Down)
-       {
-         OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
-         OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
-       }
-    }
-
-  return CMD_SUCCESS;
+  return ip_ospf_network (self, vty, argc, argv);
 }
 
 DEFUN (no_ip_ospf_network,
        no_ip_ospf_network_cmd,
        "no ip ospf network [<broadcast|non-broadcast|point-to-multipoint|point-to-point>]",
-       NO_STR
-       "IP Information\n"
-       "OSPF interface commands\n"
-       "Network type\n"
-       "Specify OSPF broadcast multi-access network\n"
-       "Specify OSPF NBMA network\n"
-       "Specify OSPF point-to-multipoint network\n"
-       "Specify OSPF point-to-point network\n")
-{
-  struct interface *ifp = vty->index;
-  int old_type = IF_DEF_PARAMS (ifp)->type;
-  struct route_node *rn;
-
-  IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp);
-
-  if (IF_DEF_PARAMS (ifp)->type == old_type)
-    return CMD_SUCCESS;
-
-  for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
-    {
-      struct ospf_interface *oi = rn->info;
-
-      if (!oi)
-       continue;
-
-      oi->type = IF_DEF_PARAMS (ifp)->type;
-
-      if (oi->state > ISM_Down)
-       {
-         OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
-         OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
-       }
-    }
-
-  return CMD_SUCCESS;
-}
-
-DEFUN (ip_ospf_priority,
-       ip_ospf_priority_addr_cmd,
-       "ip ospf priority (0-255) [A.B.C.D]",
-       "IP Information\n"
-       "OSPF interface commands\n"
-       "Router priority\n"
-       "Priority\n"
-       "Address of interface")
-{
-  int idx_number = 3;
-  int idx_ipv4 = 4;
-  struct interface *ifp = vty->index;
-  long priority;
-  struct route_node *rn;
-  struct in_addr addr;
-  int ret;
-  struct ospf_if_params *params;
-
-  params = IF_DEF_PARAMS (ifp);
-
-  priority = strtol (argv[idx_number]->arg, NULL, 10);
-
-  /* Router Priority range is <0-255>. */
-  if (priority < 0 || priority > 255)
-    {
-      vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  if (argc == 5)
-    {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
-       {
-         vty_out (vty, "Please specify interface address by A.B.C.D%s",
-                  VTY_NEWLINE);
-         return CMD_WARNING;
-       }
-
-      params = ospf_get_if_params (ifp, addr);
-      ospf_if_update_params (ifp, addr);
-    }
-
-  SET_IF_PARAM (params, priority);
-  params->priority = priority;
-
-  for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
-    {
-      struct ospf_interface *oi = rn->info;
-
-      if (!oi)
-       continue;
-
-      if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
-       {
-         PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
-         OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
-       }
-    }
-
-  return CMD_SUCCESS;
-}
-
-
-DEFUN_HIDDEN (ospf_priority,
-              ospf_priority_cmd,
-              "ospf priority (0-255)",
-              "OSPF interface commands\n"
-              "Router priority\n"
-              "Priority\n")
+       NO_STR
+       "IP Information\n"
+       "OSPF interface commands\n"
+       "Network type\n"
+       "Specify OSPF broadcast multi-access network\n"
+       "Specify OSPF NBMA network\n"
+       "Specify OSPF point-to-multipoint network\n"
+       "Specify OSPF point-to-point network\n")
 {
-  int idx_number = 2;
   struct interface *ifp = vty->index;
-  long priority;
+  int old_type = IF_DEF_PARAMS (ifp)->type;
   struct route_node *rn;
-  struct ospf_if_params *params;
 
-  params = IF_DEF_PARAMS (ifp);
-
-  priority = strtol (argv[idx_number]->arg, NULL, 10);
-
-  /* Router Priority range is <0-255>. */
-  if (priority < 0 || priority > 255)
-    {
-      vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
+  IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp);
 
-  SET_IF_PARAM (params, priority);
-  params->priority = priority;
+  if (IF_DEF_PARAMS (ifp)->type == old_type)
+    return CMD_SUCCESS;
 
   for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
     {
       struct ospf_interface *oi = rn->info;
 
       if (!oi)
-        continue;
+       continue;
 
+      oi->type = IF_DEF_PARAMS (ifp)->type;
 
-      if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
-        {
-          PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
-          OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
-        }
+      if (oi->state > ISM_Down)
+       {
+         OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
+         OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
+       }
     }
 
   return CMD_SUCCESS;
 }
 
-DEFUN (no_ospf_priority,
-       no_ospf_priority_addr_cmd,
-       "no ospf priority [(0-255) [A.B.C.D]]",
-       NO_STR
+DEFUN_HIDDEN (no_ospf_network,
+              no_ospf_network_cmd,
+              "no ospf network [<broadcast|non-broadcast|point-to-multipoint|point-to-point>]",
+              NO_STR
+              "OSPF interface commands\n"
+              "Network type\n"
+              "Specify OSPF broadcast multi-access network\n"
+              "Specify OSPF NBMA network\n"
+              "Specify OSPF point-to-multipoint network\n"
+              "Specify OSPF point-to-point network\n")
+{
+  return no_ip_ospf_network (self, vty, argc, argv);
+}
+
+DEFUN (ip_ospf_priority,
+       ip_ospf_priority_cmd,
+       "ip ospf priority (0-255) [A.B.C.D]",
+       "IP Information\n"
        "OSPF interface commands\n"
        "Router priority\n"
        "Priority\n"
        "Address of interface")
 {
-  int idx_ipv4 = 4;
+  int idx = 0;
   struct interface *ifp = vty->index;
+  long priority;
   struct route_node *rn;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
-  
-  ifp = vty->index;
   params = IF_DEF_PARAMS (ifp);
 
-  if (argc == 5)
+  argv_find (argv, argc, "(0-255)", &idx);
+  priority = strtol (argv[idx]->arg, NULL, 10);
+
+  if (argv_find (argv, argc, "A.B.C.D", &idx))
     {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
+      if (!inet_aton(argv[idx]->arg, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
          return CMD_WARNING;
        }
 
-      params = ospf_lookup_if_params (ifp, addr);
-      if (params == NULL)
-       return CMD_SUCCESS;
+      params = ospf_get_if_params (ifp, addr);
+      ospf_if_update_params (ifp, addr);
     }
 
-  UNSET_IF_PARAM (params, priority);
-  params->priority = OSPF_ROUTER_PRIORITY_DEFAULT;
+  SET_IF_PARAM (params, priority);
+  params->priority = priority;
 
-  if (params != IF_DEF_PARAMS (ifp))
-    {
-      ospf_free_if_params (ifp, addr);
-      ospf_if_update_params (ifp, addr);
-    }
-  
   for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
     {
       struct ospf_interface *oi = rn->info;
-      
+
       if (!oi)
        continue;
-      
 
       if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
        {
@@ -7541,34 +6889,42 @@ DEFUN (no_ospf_priority,
          OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
        }
     }
-  
+
   return CMD_SUCCESS;
 }
 
+DEFUN_HIDDEN (ospf_priority,
+              ospf_priority_cmd,
+              "ospf priority (0-255) [A.B.C.D]",
+              "OSPF interface commands\n"
+              "Router priority\n"
+              "Priority\n")
+{
+  return ip_ospf_priority (self, vty, argc, argv);
+}
+
 DEFUN (no_ip_ospf_priority,
-       no_ip_ospf_priority_addr_cmd,
+       no_ip_ospf_priority_cmd,
        "no ip ospf priority [(0-255) [A.B.C.D]]",
        NO_STR
        "IP Information\n"
        "OSPF interface commands\n"
-       "Router priority\n"
+       "Router priority\n" // ignored
        "Priority\n"
        "Address of interface")
 {
-  int idx_ipv4 = 5;
+  int idx = 0;
   struct interface *ifp = vty->index;
   struct route_node *rn;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
   
   ifp = vty->index;
   params = IF_DEF_PARAMS (ifp);
 
-  if (argc == 6)
+  if (argv_find (argv, argc, "A.B.C.D", &idx))
     {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
+      if (!inet_aton(argv[idx]->arg, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
@@ -7596,7 +6952,6 @@ DEFUN (no_ip_ospf_priority,
       if (!oi)
        continue;
       
-      
       if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
        {
          PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
@@ -7607,6 +6962,17 @@ DEFUN (no_ip_ospf_priority,
   return CMD_SUCCESS;
 }
 
+DEFUN_HIDDEN (no_ospf_priority,
+              no_ospf_priority_cmd,
+              "no ospf priority [(0-255) [A.B.C.D]]",
+              NO_STR
+              "OSPF interface commands\n"
+              "Router priority\n"
+              "Priority\n"
+              "Address of interface")
+{
+  return no_ip_ospf_priority (self, vty, argc, argv);
+}
 
 DEFUN (ip_ospf_retransmit_interval,
        ip_ospf_retransmit_interval_addr_cmd,
@@ -7617,29 +6983,19 @@ DEFUN (ip_ospf_retransmit_interval,
        "Seconds\n"
        "Address of interface")
 {
-  int idx_number = 3;
-  int idx_ipv4 = 4;
+  int idx = 0;
   struct interface *ifp = vty->index;
   u_int32_t seconds;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
-      
   params = IF_DEF_PARAMS (ifp);
-  seconds = strtol (argv[idx_number]->arg, NULL, 10);
-
-  /* Retransmit Interval range is <3-65535>. */
-  if (seconds < 3 || seconds > 65535)
-    {
-      vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
 
+  argv_find (argv, argc, "(3-65535)", &idx);
+  seconds = strtol (argv[idx]->arg, NULL, 10);
 
-  if (argc == 5)
+  if (argv_find (argv, argc, "A.B.C.D", &idx))
     {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
+      if (!inet_aton(argv[idx]->arg, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
@@ -7658,77 +7014,34 @@ DEFUN (ip_ospf_retransmit_interval,
 
 DEFUN_HIDDEN (ospf_retransmit_interval,
               ospf_retransmit_interval_cmd,
-              "ospf retransmit-interval (3-65535)",
+              "ospf retransmit-interval (3-65535) [A.B.C.D]",
               "OSPF interface commands\n"
               "Time between retransmitting lost link state advertisements\n"
               "Seconds\n")
 {
-  int idx_number = 2;
-  struct interface *ifp = vty->index;
-  u_int32_t seconds;
-  struct ospf_if_params *params;
-
-  params = IF_DEF_PARAMS (ifp);
-  seconds = strtol (argv[idx_number]->arg, NULL, 10);
-
-  /* Retransmit Interval range is <3-65535>. */
-  if (seconds < 3 || seconds > 65535)
-    {
-      vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  SET_IF_PARAM (params, retransmit_interval);
-  params->retransmit_interval = seconds;
-
-  return CMD_SUCCESS;
-}
-
-DEFUN (no_ospf_retransmit_interval,
-       no_ospf_retransmit_interval_cmd,
-       "no ospf retransmit-interval",
-       NO_STR
-       "OSPF interface commands\n"
-       "Time between retransmitting lost link state advertisements\n")
-{
-  struct interface *ifp = vty->index;
-  struct ospf_if_params *params;
-
-  ifp = vty->index;
-  params = IF_DEF_PARAMS (ifp);
-  UNSET_IF_PARAM (params, retransmit_interval);
-  params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
-
-  return CMD_SUCCESS;
+  return ip_ospf_retransmit_interval (self, vty, argc, argv);
 }
 
 DEFUN (no_ip_ospf_retransmit_interval,
        no_ip_ospf_retransmit_interval_addr_cmd,
-       "no ip ospf retransmit-interval [<(3-65535) [A.B.C.D]|A.B.C.D>]",
+       "no ip ospf retransmit-interval [(3-65535)] [A.B.C.D]",
        NO_STR
        "IP Information\n"
        "OSPF interface commands\n"
-       "Time between retransmitting lost link state advertisements\n"
-       "Address of interface")
+       "Time between retransmitting lost link state advertisements\n" //ignored
+       "Address of interface\n")
 {
+  int idx = 0;
   struct interface *ifp = vty->index;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
-  int addr_index;
-  
+
   ifp = vty->index;
   params = IF_DEF_PARAMS (ifp);
 
-  if (argc >= 5)
+  if (argv_find (argv, argc, "A.B.C.D", &idx))
     {
-      if (argc == 5)
-        addr_index = 4;
-      else
-        addr_index = 5;
-
-      ret = inet_aton(argv[addr_index]->arg, &addr);
-      if (!ret)
+      if (!inet_aton(argv[idx]->arg, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
@@ -7752,6 +7065,15 @@ DEFUN (no_ip_ospf_retransmit_interval,
   return CMD_SUCCESS;
 }
 
+DEFUN_HIDDEN (no_ospf_retransmit_interval,
+       no_ospf_retransmit_interval_cmd,
+       "no ospf retransmit-interval [(3-65535)] [A.B.C.D]",
+       NO_STR
+       "OSPF interface commands\n"
+       "Time between retransmitting lost link state advertisements\n")
+{
+  return no_ip_ospf_retransmit_interval (self, vty, argc, argv);
+}
 
 DEFUN (ip_ospf_transmit_delay,
        ip_ospf_transmit_delay_addr_cmd,
@@ -7762,28 +7084,19 @@ DEFUN (ip_ospf_transmit_delay,
        "Seconds\n"
        "Address of interface")
 {
-  int idx_number = 3;
-  int idx_ipv4 = 4;
+  int idx = 0;
   struct interface *ifp = vty->index;
   u_int32_t seconds;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
-      
-  params = IF_DEF_PARAMS (ifp);
-  seconds = strtol (argv[idx_number]->arg, NULL, 10);
 
-  /* Transmit Delay range is <1-65535>. */
-  if (seconds < 1 || seconds > 65535)
-    {
-      vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
+  params = IF_DEF_PARAMS (ifp);
+  argv_find (argv, argc, "(1-65535)", &idx);
+  seconds = strtol (argv[idx]->arg, NULL, 10);
 
-  if (argc == 5)
+  if (argv_find (argv, argc, "A.B.C.D", &idx))
     {
-      ret = inet_aton(argv[idx_ipv4]->arg, &addr);
-      if (!ret)
+      if (!inet_aton(argv[idx]->arg, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
@@ -7794,68 +7107,42 @@ DEFUN (ip_ospf_transmit_delay,
       ospf_if_update_params (ifp, addr);
     }
 
-  SET_IF_PARAM (params, transmit_delay); 
+  SET_IF_PARAM (params, transmit_delay);
   params->transmit_delay = seconds;
 
   return CMD_SUCCESS;
 }
 
-
 DEFUN_HIDDEN (ospf_transmit_delay,
               ospf_transmit_delay_cmd,
-              "ospf transmit-delay (1-65535)",
+              "ospf transmit-delay (1-65535) [A.B.C.D]",
               "OSPF interface commands\n"
               "Link state transmit delay\n"
               "Seconds\n")
 {
-  int idx_number = 2;
-  struct interface *ifp = vty->index;
-  u_int32_t seconds;
-  struct ospf_if_params *params;
-
-  params = IF_DEF_PARAMS (ifp);
-  seconds = strtol (argv[idx_number]->arg, NULL, 10);
-
-  /* Transmit Delay range is <1-65535>. */
-  if (seconds < 1 || seconds > 65535)
-    {
-      vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  SET_IF_PARAM (params, transmit_delay);
-  params->transmit_delay = seconds;
-
-  return CMD_SUCCESS;
+  return ip_ospf_transmit_delay (self, vty, argc, argv);
 }
 
 DEFUN (no_ip_ospf_transmit_delay,
        no_ip_ospf_transmit_delay_addr_cmd,
-       "no ip ospf transmit-delay [<A.B.C.D|(1-65535) A.B.C.D>]",
+       "no ip ospf transmit-delay [(1-65535)] [A.B.C.D]",
        NO_STR
        "IP Information\n"
        "OSPF interface commands\n"
        "Link state transmit delay\n"
        "Address of interface")
 {
+  int idx = 0;
   struct interface *ifp = vty->index;
   struct in_addr addr;
-  int ret;
   struct ospf_if_params *params;
-  int addr_index;
   
   ifp = vty->index;
   params = IF_DEF_PARAMS (ifp);
 
-  if (argc >= 5)
+  if (argv_find (argv, argc, "A.B.C.D", &idx))
     {
-      if (argc == 5)
-        addr_index = 4;
-      else
-        addr_index = 5;
-
-      ret = inet_aton(argv[addr_index]->arg, &addr);
-      if (!ret)
+      if (!inet_aton(argv[idx]->arg, &addr))
        {
          vty_out (vty, "Please specify interface address by A.B.C.D%s",
                   VTY_NEWLINE);
@@ -7880,45 +7167,14 @@ DEFUN (no_ip_ospf_transmit_delay,
 }
 
 
-DEFUN (no_ospf_transmit_delay,
-       no_ospf_transmit_delay_cmd,
-       "no ospf transmit-delay",
-       NO_STR
-       "OSPF interface commands\n"
-       "Link state transmit delay\n")
-{
-  struct interface *ifp = vty->index;
-  struct ospf_if_params *params;
-
-  ifp = vty->index;
-  params = IF_DEF_PARAMS (ifp);
-
-  UNSET_IF_PARAM (params, transmit_delay);
-  params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
-
-  return CMD_SUCCESS;
-}
-
-DEFUN (no_ip_ospf_transmit_delay_sec,
-       no_ip_ospf_transmit_delay_sec_cmd,
-       "no ip ospf transmit-delay (1-65535)",
-       NO_STR
-       "IP Information\n"
-       "OSPF interface commands\n"
-       "Link state transmit delay\n"
-       "Seconds\n"
-       "Address of interface")
+DEFUN_HIDDEN (no_ospf_transmit_delay,
+              no_ospf_transmit_delay_cmd,
+              "no ospf transmit-delay",
+              NO_STR
+              "OSPF interface commands\n"
+              "Link state transmit delay\n")
 {
-  struct interface *ifp = vty->index;
-  struct ospf_if_params *params;
-
-  ifp = vty->index;
-  params = IF_DEF_PARAMS (ifp);
-
-  UNSET_IF_PARAM (params, transmit_delay);
-  params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
-
-  return CMD_SUCCESS;
+  return no_ip_ospf_transmit_delay (self, vty, argc, argv);
 }
 
 DEFUN (ip_ospf_area,
@@ -7931,7 +7187,7 @@ DEFUN (ip_ospf_area,
        "OSPF area ID in IP address format\n"
        "OSPF area ID as a decimal value\n")
 {
-  int idx_ipv4_number = 2;
+  int idx = 0;
   struct interface *ifp = vty->index;
   int format, ret;
   struct in_addr area_id;
@@ -7940,8 +7196,9 @@ DEFUN (ip_ospf_area,
   struct route_node *rn;
   u_short instance = 0;
 
-  if (argc == 5)
-    VTY_GET_INTEGER ("Instance", instance, argv[idx_ipv4_number]->arg);
+  if (argv_find (argv, argc, "(1-65535)", &idx))
+    instance = strtol (argv[idx]->arg, NULL, 10);
+  char *areaid = argv[argc - 1]->arg;
 
   ospf = ospf_lookup_instance (instance);
   if (ospf == NULL)
@@ -7956,7 +7213,7 @@ DEFUN (ip_ospf_area,
       return CMD_SUCCESS;
     }
 
-  ret = ospf_str2area_id (argv[instance ? 4 : 3]->arg, &area_id, &format);
+  ret = ospf_str2area_id (areaid, &area_id, &format);
   if (ret < 0)
     {
       vty_out (vty, "Please specify area by A.B.C.D|<0-4294967295>%s",
@@ -7996,7 +7253,7 @@ DEFUN (ip_ospf_area,
 
 DEFUN (no_ip_ospf_area,
        no_ip_ospf_area_cmd,
-       "no ip ospf area [<A.B.C.D|(0-4294967295)>]",
+       "no ip ospf [(1-65535)] area [<A.B.C.D|(0-4294967295)>]",
        NO_STR
        "IP Information\n"
        "OSPF interface commands\n"
@@ -8004,42 +7261,14 @@ DEFUN (no_ip_ospf_area,
        "OSPF area ID in IP address format\n"
        "OSPF area ID as a decimal value\n")
 {
+  int idx = 0;
   struct interface *ifp = vty->index;
   struct ospf *ospf;
   struct ospf_if_params *params;
   u_short instance = 0;
 
-  if ((ospf = ospf_lookup_instance (instance)) == NULL)
-    return CMD_SUCCESS;
-
-  params = IF_DEF_PARAMS (ifp);
-  if (!OSPF_IF_PARAM_CONFIGURED(params, if_area))
-    {
-      vty_out (vty, "Can't find specified inteface area configuration.%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  ospf_interface_unset (ifp);
-  ospf->if_ospf_cli_count--;
-  return CMD_SUCCESS;
-}
-
-DEFUN (no_ip_ospf_instance_area,
-       no_ip_ospf_instance_area_cmd,
-       "no ip ospf (1-65535) area [<A.B.C.D|(0-4294967295)>]",
-       NO_STR
-       "IP Information\n"
-       "OSPF interface commands\n"
-       "Instance ID\n"
-       "Disable OSPF on this interface\n")
-{
-  int idx_number = 3;
-  struct interface *ifp = vty->index;
-  struct ospf *ospf;
-  struct ospf_if_params *params;
-  u_short instance = 0;
-
-  VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+  if (argv_find (argv, argc, "(1-65535)", &idx))
+    instance = strtol (argv[idx]->arg, NULL, 10);
 
   if ((ospf = ospf_lookup_instance (instance)) == NULL)
     return CMD_SUCCESS;
@@ -8047,7 +7276,7 @@ DEFUN (no_ip_ospf_instance_area,
   params = IF_DEF_PARAMS (ifp);
   if (!OSPF_IF_PARAM_CONFIGURED(params, if_area))
     {
-      vty_out (vty, "Can't find specified inteface area configuration.%s", VTY_NEWLINE);
+      vty_out (vty, "Can't find specified interface area configuration.%s", VTY_NEWLINE);
       return CMD_WARNING;
     }
 
@@ -8571,6 +7800,7 @@ DEFUN (ospf_distance_ospf,
   return CMD_SUCCESS;
 }
 
+#if 0
 DEFUN (ospf_distance_source,
        ospf_distance_source_cmd,
        "distance (1-255) A.B.C.D/M",
@@ -8652,13 +7882,14 @@ DEFUN (no_ospf_distance_source_access_list,
 
   return CMD_SUCCESS;
 }
+#endif
 
 DEFUN (ip_ospf_mtu_ignore,
        ip_ospf_mtu_ignore_addr_cmd,
        "ip ospf mtu-ignore [A.B.C.D]",
        "IP Information\n"
        "OSPF interface commands\n"
-       "Disable mtu mismatch detection\n"
+       "Disable MTU mismatch detection on this interface\n"
        "Address of interface")
 {
   int idx_ipv4 = 3;
@@ -8701,7 +7932,7 @@ DEFUN (no_ip_ospf_mtu_ignore,
        "no ip ospf mtu-ignore [A.B.C.D]",
        "IP Information\n"
        "OSPF interface commands\n"
-       "Disable mtu mismatch detection\n"
+       "Disable MTU mismatch detection on this interface\n"
        "Address of interface")
 {
   int idx_ipv4 = 4;
@@ -10026,14 +9257,7 @@ ospf_vty_if_init (void)
 {
   /* Install interface node. */
   install_node (&interface_node, config_write_interface);
-
-  install_element (CONFIG_NODE, &interface_cmd);
-  install_element (CONFIG_NODE, &no_interface_cmd);
-  install_default (INTERFACE_NODE);
-
-  /* "description" commands. */
-  install_element (INTERFACE_NODE, &interface_desc_cmd);
-  install_element (INTERFACE_NODE, &no_interface_desc_cmd);
+  if_cmd_init ();
 
   /* "ip ospf authentication" commands. */
   install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd);
@@ -10045,67 +9269,64 @@ ospf_vty_if_init (void)
   install_element (INTERFACE_NODE, &no_ospf_authentication_key_authkey_addr_cmd);
 
   /* "ip ospf message-digest-key" commands. */
-  install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd);
-  install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd);
-  install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_md5_addr_cmd);
-  install_element (INTERFACE_NODE, &no_ospf_message_digest_key_addr_cmd);
+  install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd);
+  install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd);
 
   /* "ip ospf cost" commands. */
-  install_element (INTERFACE_NODE, &ip_ospf_cost_u32_inet4_cmd);
-  install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_cmd);
-  install_element (INTERFACE_NODE, &no_ip_ospf_cost_inet4_cmd);
-  install_element (INTERFACE_NODE, &no_ospf_cost_inet4_cmd);
-  install_element (INTERFACE_NODE, &no_ospf_cost_u32_cmd);
+  install_element (INTERFACE_NODE, &ip_ospf_cost_cmd);
+  install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd);
 
   /* "ip ospf mtu-ignore" commands. */
   install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd);
   install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_addr_cmd);
 
   /* "ip ospf dead-interval" commands. */
-  install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd);
+  install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd);
   install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_addr_cmd);
-  install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd);
+  install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd);
   
   /* "ip ospf hello-interval" commands. */
-  install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd);
-  install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd);
+  install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd);
+  install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd);
 
   /* "ip ospf network" commands. */
   install_element (INTERFACE_NODE, &ip_ospf_network_cmd);
   install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd);
-  install_element (INTERFACE_NODE, &no_ospf_network_cmd);
 
   /* "ip ospf priority" commands. */
-  install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd);
-  install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd);
-  install_element (INTERFACE_NODE, &no_ospf_priority_addr_cmd);
+  install_element (INTERFACE_NODE, &ip_ospf_priority_cmd);
+  install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd);
 
   /* "ip ospf retransmit-interval" commands. */
   install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd);
   install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd);
-  install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd);
 
   /* "ip ospf transmit-delay" commands. */
   install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd);
   install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd);
-  install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_sec_cmd);
-  install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd);
 
   /* "ip ospf area" commands. */
   install_element (INTERFACE_NODE, &ip_ospf_area_cmd);
   install_element (INTERFACE_NODE, &no_ip_ospf_area_cmd);
-  install_element (INTERFACE_NODE, &no_ip_ospf_instance_area_cmd);
 
   /* These commands are compatibitliy for previous version. */
   install_element (INTERFACE_NODE, &ospf_authentication_key_cmd);
   install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd);
-  install_element (INTERFACE_NODE, &ospf_cost_u32_inet4_cmd);
+  install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd);
   install_element (INTERFACE_NODE, &ospf_dead_interval_cmd);
+  install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd);
   install_element (INTERFACE_NODE, &ospf_hello_interval_cmd);
+  install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd);
+  install_element (INTERFACE_NODE, &ospf_cost_cmd);
+  install_element (INTERFACE_NODE, &no_ospf_cost_cmd);
   install_element (INTERFACE_NODE, &ospf_network_cmd);
+  install_element (INTERFACE_NODE, &no_ospf_network_cmd);
   install_element (INTERFACE_NODE, &ospf_priority_cmd);
+  install_element (INTERFACE_NODE, &no_ospf_priority_cmd);
   install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd);
+  install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd);
   install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd);
+  install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd);
 }
 
 static void