Diff for /embedaddon/quagga/ospfd/ospf_vty.c between versions 1.1.1.3 and 1.1.1.4

version 1.1.1.3, 2013/07/21 23:54:40 version 1.1.1.4, 2016/11/02 10:09:12
Line 49 Line 49
 #include "ospfd/ospf_vty.h"  #include "ospfd/ospf_vty.h"
 #include "ospfd/ospf_dump.h"  #include "ospfd/ospf_dump.h"
   
 static const char *ospf_network_type_str[] =  static const char *ospf_network_type_str[] =
 {  {
   "Null",    "Null",
Line 61  static const char *ospf_network_type_str[] = Line 61  static const char *ospf_network_type_str[] =
   "LOOPBACK"    "LOOPBACK"
 };  };
   
 /* Utility functions. */  /* Utility functions. */
 static int  static int
 ospf_str2area_id (const char *str, struct in_addr *area_id, int *format)  ospf_str2area_id (const char *str, struct in_addr *area_id, int *format)
Line 94  ospf_str2area_id (const char *str, struct in_addr *are Line 94  ospf_str2area_id (const char *str, struct in_addr *are
   return 0;    return 0;
 }  }
   
 static int  static int
 str2metric (const char *str, int *metric)  str2metric (const char *str, int *metric)
 {  {
Line 142  ospf_oi_count (struct interface *ifp) Line 142  ospf_oi_count (struct interface *ifp)
   return i;    return i;
 }  }
   
 DEFUN (router_ospf,  DEFUN (router_ospf,
        router_ospf_cmd,         router_ospf_cmd,
        "router ospf",         "router ospf",
Line 254  ospf_passive_interface_default (struct ospf *ospf, u_c Line 254  ospf_passive_interface_default (struct ospf *ospf, u_c
 }  }
   
 static void  static void
ospf_passive_interface_update (struct ospf *ospf, struct interface *ifp,ospf_passive_interface_update_addr (struct ospf *ospf, struct interface *ifp,
                               struct in_addr addr,                                struct ospf_if_params *params, u_char value,
                               struct ospf_if_params *params, u_char value)                               struct in_addr addr)
 {  {
   u_char dflt;    u_char dflt;
       
Line 276  ospf_passive_interface_update (struct ospf *ospf, stru Line 276  ospf_passive_interface_update (struct ospf *ospf, stru
       ospf_free_if_params (ifp, addr);        ospf_free_if_params (ifp, addr);
       ospf_if_update_params (ifp, addr);        ospf_if_update_params (ifp, addr);
     }      }
  else}
 
 static void
 ospf_passive_interface_update (struct ospf *ospf, struct interface *ifp,
                                struct ospf_if_params *params, u_char value)
 {
   params->passive_interface = value;
   if (params == IF_DEF_PARAMS (ifp))
     {      {
       if (value != ospf->passive_interface_default)        if (value != ospf->passive_interface_default)
         SET_IF_PARAM (params, passive_interface);          SET_IF_PARAM (params, passive_interface);
Line 285  ospf_passive_interface_update (struct ospf *ospf, stru Line 292  ospf_passive_interface_update (struct ospf *ospf, stru
     }      }
 }  }
   
   /* get the appropriate ospf parameters structure, checking if
    * there's a valid interface address at the argi'th argv index
    */
   enum {
     VTY_SET = 0,
     VTY_UNSET,
   };
   #define OSPF_VTY_GET_IF_PARAMS(ifp,params,argi,addr,set) \
     (params) = IF_DEF_PARAMS ((ifp));           \
                                                 \
     if (argc == (argi) + 1)                     \
       {                                         \
         int ret = inet_aton(argv[(argi)], &(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)); \
                                                 \
         if (set)                                \
           ospf_if_update_params ((ifp), (addr));  \
         else if ((params) == NULL)              \
           return CMD_SUCCESS;                   \
       }
   
   #define OSPF_VTY_PARAM_UNSET(params,var,ifp,addr) \
     UNSET_IF_PARAM ((params), var);               \
       if ((params) != IF_DEF_PARAMS ((ifp)))        \
       {                                             \
         ospf_free_if_params ((ifp), (addr));        \
         ospf_if_update_params ((ifp), (addr));      \
       }
   
 DEFUN (ospf_passive_interface,  DEFUN (ospf_passive_interface,
        ospf_passive_interface_addr_cmd,         ospf_passive_interface_addr_cmd,
        "passive-interface IFNAME A.B.C.D",         "passive-interface IFNAME A.B.C.D",
Line 320  DEFUN (ospf_passive_interface, Line 362  DEFUN (ospf_passive_interface,
   
       params = ospf_get_if_params (ifp, addr);        params = ospf_get_if_params (ifp, addr);
       ospf_if_update_params (ifp, addr);        ospf_if_update_params (ifp, addr);
         ospf_passive_interface_update_addr (ospf, ifp, params,
                                             OSPF_IF_PASSIVE, addr);
     }      }
  ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_PASSIVE);  
   ospf_passive_interface_update (ospf, ifp, params, OSPF_IF_PASSIVE);
   
   /* XXX We should call ospf_if_set_multicast on exactly those    /* XXX We should call ospf_if_set_multicast on exactly those
    * interfaces for which the passive property changed.  It is too much     * interfaces for which the passive property changed.  It is too much
Line 397  DEFUN (no_ospf_passive_interface, Line 442  DEFUN (no_ospf_passive_interface,
       params = ospf_lookup_if_params (ifp, addr);        params = ospf_lookup_if_params (ifp, addr);
       if (params == NULL)        if (params == NULL)
         return CMD_SUCCESS;          return CMD_SUCCESS;
         ospf_passive_interface_update_addr (ospf, ifp, params, OSPF_IF_ACTIVE, 
                                             addr);
     }      }
  ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_ACTIVE);  ospf_passive_interface_update (ospf, ifp, params, OSPF_IF_ACTIVE);
  
   /* XXX We should call ospf_if_set_multicast on exactly those    /* XXX We should call ospf_if_set_multicast on exactly those
    * interfaces for which the passive property changed.  It is too much     * interfaces for which the passive property changed.  It is too much
    * work to determine this set, so we do this for every interface.     * work to determine this set, so we do this for every interface.
Line 441  DEFUN (ospf_network_area, Line 488  DEFUN (ospf_network_area,
        "OSPF area ID in IP address format\n"         "OSPF area ID in IP address format\n"
        "OSPF area ID as a decimal value\n")         "OSPF area ID as a decimal value\n")
 {  {
  struct ospf *ospf= vty->index;  struct ospf *ospf = vty->index;
   struct prefix_ipv4 p;    struct prefix_ipv4 p;
   struct in_addr area_id;    struct in_addr area_id;
   int ret, format;    int ret, format;
Line 490  DEFUN (no_ospf_network_area, Line 537  DEFUN (no_ospf_network_area,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 DEFUN (ospf_area_range,  DEFUN (ospf_area_range,
        ospf_area_range_cmd,         ospf_area_range_cmd,
        "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",         "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
Line 634  ALIAS (no_ospf_area_range, Line 681  ALIAS (no_ospf_area_range,
        "Advertise this range (default)\n"         "Advertise this range (default)\n"
        "User specified metric for this range\n"         "User specified metric for this range\n"
        "Advertised metric for this range\n")         "Advertised metric for this range\n")
 DEFUN (ospf_area_range_substitute,  DEFUN (ospf_area_range_substitute,
        ospf_area_range_substitute_cmd,         ospf_area_range_substitute_cmd,
        "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",         "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
Line 686  DEFUN (no_ospf_area_range_substitute, Line 733  DEFUN (no_ospf_area_range_substitute,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 /* Command Handler Logic in VLink stuff is delicate!!  /* Command Handler Logic in VLink stuff is delicate!!
   
         ALTER AT YOUR OWN RISK!!!!          ALTER AT YOUR OWN RISK!!!!
Line 771  ospf_find_vl_data (struct ospf *ospf, struct ospf_vl_c Line 818  ospf_find_vl_data (struct ospf *ospf, struct ospf_vl_c
         {          {
           vl_data->vl_oi = ospf_vl_new (ospf, vl_data);            vl_data->vl_oi = ospf_vl_new (ospf, vl_data);
           ospf_vl_add (ospf, vl_data);            ospf_vl_add (ospf, vl_data);
          ospf_spf_calculate_schedule (ospf);          ospf_spf_calculate_schedule (ospf, SPF_FLAG_CONFIG_CHANGE);
         }          }
     }      }
   return vl_data;    return vl_data;
Line 1382  ALIAS (no_ospf_area_vlink, Line 1429  ALIAS (no_ospf_area_vlink,
        VLINK_HELPSTR_AUTHTYPE_SIMPLE         VLINK_HELPSTR_AUTHTYPE_SIMPLE
        VLINK_HELPSTR_AUTH_MD5)         VLINK_HELPSTR_AUTH_MD5)
   
 DEFUN (ospf_area_shortcut,  DEFUN (ospf_area_shortcut,
        ospf_area_shortcut_cmd,         ospf_area_shortcut_cmd,
        "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)",         "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)",
Line 1450  DEFUN (no_ospf_area_shortcut, Line 1497  DEFUN (no_ospf_area_shortcut,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 DEFUN (ospf_area_stub,  DEFUN (ospf_area_stub,
        ospf_area_stub_cmd,         ospf_area_stub_cmd,
        "area (A.B.C.D|<0-4294967295>) stub",         "area (A.B.C.D|<0-4294967295>) stub",
Line 1971  DEFUN (no_ospf_area_filter_list, Line 2018  DEFUN (no_ospf_area_filter_list,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 DEFUN (ospf_area_authentication_message_digest,  DEFUN (ospf_area_authentication_message_digest,
        ospf_area_authentication_message_digest_cmd,         ospf_area_authentication_message_digest_cmd,
        "area (A.B.C.D|<0-4294967295>) authentication message-digest",         "area (A.B.C.D|<0-4294967295>) authentication message-digest",
        "OSPF area parameters\n"         "OSPF area parameters\n"
          "OSPF area ID in IP address format\n"
          "OSPF area ID as a decimal value\n"
        "Enable authentication\n"         "Enable authentication\n"
        "Use message-digest authentication\n")         "Use message-digest authentication\n")
 {  {
Line 2040  DEFUN (no_ospf_area_authentication, Line 2089  DEFUN (no_ospf_area_authentication,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 DEFUN (ospf_abr_type,  DEFUN (ospf_abr_type,
        ospf_abr_type_cmd,         ospf_abr_type_cmd,
        "ospf abr-type (cisco|ibm|shortcut|standard)",         "ospf abr-type (cisco|ibm|shortcut|standard)",
Line 2170  DEFUN (ospf_compatible_rfc1583, Line 2219  DEFUN (ospf_compatible_rfc1583,
   if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))    if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
     {      {
       SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE);        SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE);
      ospf_spf_calculate_schedule (ospf);      ospf_spf_calculate_schedule (ospf, SPF_FLAG_CONFIG_CHANGE);
     }      }
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
Line 2187  DEFUN (no_ospf_compatible_rfc1583, Line 2236  DEFUN (no_ospf_compatible_rfc1583,
   if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))    if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
     {      {
       UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE);        UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE);
      ospf_spf_calculate_schedule (ospf);      ospf_spf_calculate_schedule (ospf, SPF_FLAG_CONFIG_CHANGE);
     }      }
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
Line 2204  ALIAS (no_ospf_compatible_rfc1583, Line 2253  ALIAS (no_ospf_compatible_rfc1583,
        NO_STR         NO_STR
        "OSPF specific commands\n"         "OSPF specific commands\n"
        "Disable the RFC1583Compatibility flag\n")         "Disable the RFC1583Compatibility flag\n")
 static int  static int
 ospf_timers_spf_set (struct vty *vty, unsigned int delay,  ospf_timers_spf_set (struct vty *vty, unsigned int delay,
                      unsigned int hold,                       unsigned int hold,
Line 2219  ospf_timers_spf_set (struct vty *vty, unsigned int del Line 2268  ospf_timers_spf_set (struct vty *vty, unsigned int del
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   DEFUN (ospf_timers_min_ls_interval,
          ospf_timers_min_ls_interval_cmd,
          "timers throttle lsa all <0-5000>",
          "Adjust routing timers\n"
          "Throttling adaptive timer\n"
          "LSA delay between transmissions\n"
          NO_STR
          "Delay (msec) between sending LSAs\n")
   {
     struct ospf *ospf = vty->index;
     unsigned int interval;
   
     if (argc != 1)
       {
         vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     VTY_GET_INTEGER ("LSA interval", interval, argv[0]);
   
     ospf->min_ls_interval = interval;
   
     return CMD_SUCCESS;
   }
   
   DEFUN (no_ospf_timers_min_ls_interval,
          no_ospf_timers_min_ls_interval_cmd,
          "no timers throttle lsa all",
          NO_STR
          "Adjust routing timers\n"
          "Throttling adaptive timer\n"
          "LSA delay between transmissions\n")
   {
     struct ospf *ospf = vty->index;
     ospf->min_ls_interval = OSPF_MIN_LS_INTERVAL;
   
     return CMD_SUCCESS;
   }
   
   DEFUN (ospf_timers_min_ls_arrival,
          ospf_timers_min_ls_arrival_cmd,
          "timers lsa arrival <0-1000>",
          "Adjust routing timers\n"
          "Throttling link state advertisement delays\n"
          "OSPF minimum arrival interval delay\n"
          "Delay (msec) between accepted LSAs\n")
   {
     struct ospf *ospf = vty->index;
     unsigned int arrival;
   
     if (argc != 1)
       {
         vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival, argv[0], 0, 1000);
   
     ospf->min_ls_arrival = arrival;
   
     return CMD_SUCCESS;
   }
   
   DEFUN (no_ospf_timers_min_ls_arrival,
          no_ospf_timers_min_ls_arrival_cmd,
          "no timers lsa arrival",
          NO_STR
          "Adjust routing timers\n"
          "Throttling link state advertisement delays\n"
          "OSPF minimum arrival interval delay\n")
   {
     struct ospf *ospf = vty->index;
     ospf->min_ls_arrival = OSPF_MIN_LS_ARRIVAL;
   
     return CMD_SUCCESS;
   }
   
 DEFUN (ospf_timers_throttle_spf,  DEFUN (ospf_timers_throttle_spf,
        ospf_timers_throttle_spf_cmd,         ospf_timers_throttle_spf_cmd,
        "timers throttle spf <0-600000> <0-600000> <0-600000>",         "timers throttle spf <0-600000> <0-600000> <0-600000>",
Line 2295  ALIAS_DEPRECATED (no_ospf_timers_throttle_spf, Line 2421  ALIAS_DEPRECATED (no_ospf_timers_throttle_spf,
                   NO_STR                    NO_STR
                   "Adjust routing timers\n"                    "Adjust routing timers\n"
                   "OSPF SPF timers\n")                    "OSPF SPF timers\n")
 DEFUN (ospf_neighbor,  DEFUN (ospf_neighbor,
        ospf_neighbor_cmd,         ospf_neighbor_cmd,
        "neighbor A.B.C.D",         "neighbor A.B.C.D",
Line 2428  ALIAS (no_ospf_neighbor, Line 2554  ALIAS (no_ospf_neighbor,
        "Dead Neighbor Polling interval\n"         "Dead Neighbor Polling interval\n"
        "Seconds\n")         "Seconds\n")
   
 DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd,  DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd,
        "refresh timer <10-1800>",         "refresh timer <10-1800>",
        "Adjust refresh parameters\n"         "Adjust refresh parameters\n"
Line 2546  const char *ospf_shortcut_mode_descr_str[] =  Line 2672  const char *ospf_shortcut_mode_descr_str[] = 
 };  };
   
   
 static void  static void
 show_ip_ospf_area (struct vty *vty, struct ospf_area *area)  show_ip_ospf_area (struct vty *vty, struct ospf_area *area)
 {  {
Line 2660  show_ip_ospf_area (struct vty *vty, struct ospf_area * Line 2786  show_ip_ospf_area (struct vty *vty, struct ospf_area *
   vty_out (vty, "   Number of NSSA LSA %ld. Checksum Sum 0x%08x%s",    vty_out (vty, "   Number of NSSA LSA %ld. Checksum Sum 0x%08x%s",
            ospf_lsdb_count (area->lsdb, OSPF_AS_NSSA_LSA),             ospf_lsdb_count (area->lsdb, OSPF_AS_NSSA_LSA),
            ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTY_NEWLINE);             ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTY_NEWLINE);
 #ifdef HAVE_OPAQUE_LSA  
   vty_out (vty, "   Number of opaque link LSA %ld. Checksum Sum 0x%08x%s",    vty_out (vty, "   Number of opaque link LSA %ld. Checksum Sum 0x%08x%s",
            ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_LINK_LSA),             ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_LINK_LSA),
            ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTY_NEWLINE);             ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTY_NEWLINE);
   vty_out (vty, "   Number of opaque area LSA %ld. Checksum Sum 0x%08x%s",    vty_out (vty, "   Number of opaque area LSA %ld. Checksum Sum 0x%08x%s",
            ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_AREA_LSA),             ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_AREA_LSA),
            ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTY_NEWLINE);             ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTY_NEWLINE);
 #endif /* HAVE_OPAQUE_LSA */  
   vty_out (vty, "%s", VTY_NEWLINE);    vty_out (vty, "%s", VTY_NEWLINE);
 }  }
   
Line 2708  DEFUN (show_ip_ospf, Line 2832  DEFUN (show_ip_ospf,
   vty_out (vty, " RFC1583Compatibility flag is %s%s",    vty_out (vty, " RFC1583Compatibility flag is %s%s",
            CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ?             CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ?
            "enabled" : "disabled", VTY_NEWLINE);             "enabled" : "disabled", VTY_NEWLINE);
#ifdef HAVE_OPAQUE_LSA  vty_out (vty, " OpaqueCapability flag is %s%s",
  vty_out (vty, " OpaqueCapability flag is %s%s%s", 
            CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ?             CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ?
            "enabled" : "disabled",             "enabled" : "disabled",
            IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf->opaque) ?  
            " (origination blocked)" : "",  
            VTY_NEWLINE);             VTY_NEWLINE);
 #endif /* HAVE_OPAQUE_LSA */  
       
   /* Show stub-router configuration */    /* Show stub-router configuration */
   if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED    if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED
Line 2747  DEFUN (show_ip_ospf, Line 2867  DEFUN (show_ip_ospf,
       vty_out (vty, "last executed %s ago%s",        vty_out (vty, "last executed %s ago%s",
                ospf_timeval_dump (&result, timebuf, sizeof (timebuf)),                 ospf_timeval_dump (&result, timebuf, sizeof (timebuf)),
                VTY_NEWLINE);                 VTY_NEWLINE);
         vty_out (vty, " Last SPF duration %s%s",
                  ospf_timeval_dump (&ospf->ts_spf_duration, timebuf, sizeof (timebuf)),
                  VTY_NEWLINE);
     }      }
   else    else
     vty_out (vty, "has not been run%s", VTY_NEWLINE);      vty_out (vty, "has not been run%s", VTY_NEWLINE);
Line 2772  DEFUN (show_ip_ospf, Line 2895  DEFUN (show_ip_ospf,
   vty_out (vty, " Number of external LSA %ld. Checksum Sum 0x%08x%s",    vty_out (vty, " Number of external LSA %ld. Checksum Sum 0x%08x%s",
            ospf_lsdb_count (ospf->lsdb, OSPF_AS_EXTERNAL_LSA),             ospf_lsdb_count (ospf->lsdb, OSPF_AS_EXTERNAL_LSA),
            ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTY_NEWLINE);             ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTY_NEWLINE);
 #ifdef HAVE_OPAQUE_LSA  
   vty_out (vty, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s",    vty_out (vty, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s",
            ospf_lsdb_count (ospf->lsdb, OSPF_OPAQUE_AS_LSA),             ospf_lsdb_count (ospf->lsdb, OSPF_OPAQUE_AS_LSA),
            ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTY_NEWLINE);             ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTY_NEWLINE);
 #endif /* HAVE_OPAQUE_LSA */  
   /* Show number of areas attached. */    /* Show number of areas attached. */
   vty_out (vty, " Number of areas attached to this router: %d%s",    vty_out (vty, " Number of areas attached to this router: %d%s",
            listcount (ospf->areas), VTY_NEWLINE);             listcount (ospf->areas), VTY_NEWLINE);
Line 2798  DEFUN (show_ip_ospf, Line 2919  DEFUN (show_ip_ospf,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 static void  static void
 show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf,  show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf,
                             struct interface *ifp)                              struct interface *ifp)
Line 3427  DEFUN (show_ip_ospf_neighbor_int_detail, Line 3548  DEFUN (show_ip_ospf_neighbor_int_detail,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 /* Show functions */  /* Show functions */
 static int  static int
 show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self)  show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self)
Line 3479  show_lsa_summary (struct vty *vty, struct ospf_lsa *ls Line 3600  show_lsa_summary (struct vty *vty, struct ospf_lsa *ls
             break;              break;
           case OSPF_NETWORK_LSA:            case OSPF_NETWORK_LSA:
           case OSPF_ASBR_SUMMARY_LSA:            case OSPF_ASBR_SUMMARY_LSA:
 #ifdef HAVE_OPAQUE_LSA  
           case OSPF_OPAQUE_LINK_LSA:            case OSPF_OPAQUE_LINK_LSA:
           case OSPF_OPAQUE_AREA_LSA:            case OSPF_OPAQUE_AREA_LSA:
           case OSPF_OPAQUE_AS_LSA:            case OSPF_OPAQUE_AS_LSA:
 #endif /* HAVE_OPAQUE_LSA */  
           default:            default:
             break;              break;
           }            }
Line 3503  static const char *show_database_desc[] = Line 3622  static const char *show_database_desc[] =
   "AS External Link States",    "AS External Link States",
   "Group Membership LSA",    "Group Membership LSA",
   "NSSA-external Link States",    "NSSA-external Link States",
 #ifdef HAVE_OPAQUE_LSA  
   "Type-8 LSA",    "Type-8 LSA",
   "Link-Local Opaque-LSA",    "Link-Local Opaque-LSA",
   "Area-Local Opaque-LSA",    "Area-Local Opaque-LSA",
   "AS-external Opaque-LSA",    "AS-external Opaque-LSA",
 #endif /* HAVE_OPAQUE_LSA */  
 };  };
   
 static const char *show_database_header[] =  static const char *show_database_header[] =
Line 3521  static const char *show_database_header[] = Line 3638  static const char *show_database_header[] =
   "Link ID         ADV Router      Age  Seq#       CkSum  Route",    "Link ID         ADV Router      Age  Seq#       CkSum  Route",
   " --- header for Group Member ----",    " --- header for Group Member ----",
   "Link ID         ADV Router      Age  Seq#       CkSum  Route",    "Link ID         ADV Router      Age  Seq#       CkSum  Route",
 #ifdef HAVE_OPAQUE_LSA  
   " --- type-8 ---",    " --- type-8 ---",
   "Opaque-Type/Id  ADV Router      Age  Seq#       CkSum",    "Opaque-Type/Id  ADV Router      Age  Seq#       CkSum",
   "Opaque-Type/Id  ADV Router      Age  Seq#       CkSum",    "Opaque-Type/Id  ADV Router      Age  Seq#       CkSum",
   "Opaque-Type/Id  ADV Router      Age  Seq#       CkSum",    "Opaque-Type/Id  ADV Router      Age  Seq#       CkSum",
 #endif /* HAVE_OPAQUE_LSA */  
 };  };
   
 static void  static void
Line 3602  static void Line 3717  static void
 show_ip_ospf_database_router_links (struct vty *vty,  show_ip_ospf_database_router_links (struct vty *vty,
                                     struct router_lsa *rl)                                      struct router_lsa *rl)
 {  {
  int len, i, type;  int len, type;
   unsigned int i;
   
   len = ntohs (rl->header.length) - 4;    len = ntohs (rl->header.length) - 4;
   for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++)    for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++)
Line 3797  show_func_dummy (struct vty *vty, struct ospf_lsa *lsa Line 3913  show_func_dummy (struct vty *vty, struct ospf_lsa *lsa
   return 0;    return 0;
 }  }
   
 #ifdef HAVE_OPAQUE_LSA  
 static int  static int
 show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)  show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
 {  {
Line 3810  show_opaque_lsa_detail (struct vty *vty, struct ospf_l Line 3925  show_opaque_lsa_detail (struct vty *vty, struct ospf_l
     }      }
   return 0;    return 0;
 }  }
 #endif /* HAVE_OPAQUE_LSA */  
   
 int (*show_function[])(struct vty *, struct ospf_lsa *) =  int (*show_function[])(struct vty *, struct ospf_lsa *) =
 {  {
Line 3822  int (*show_function[])(struct vty *, struct ospf_lsa * Line 3936  int (*show_function[])(struct vty *, struct ospf_lsa *
   show_as_external_lsa_detail,    show_as_external_lsa_detail,
   show_func_dummy,    show_func_dummy,
   show_as_nssa_lsa_detail,  /* almost same as external */    show_as_nssa_lsa_detail,  /* almost same as external */
 #ifdef HAVE_OPAQUE_LSA  
   NULL,                         /* type-8 */    NULL,                         /* type-8 */
   show_opaque_lsa_detail,    show_opaque_lsa_detail,
   show_opaque_lsa_detail,    show_opaque_lsa_detail,
   show_opaque_lsa_detail,    show_opaque_lsa_detail,
 #endif /* HAVE_OPAQUE_LSA */  
 };  };
   
 static void  static void
Line 3886  show_lsa_detail (struct vty *vty, struct ospf *ospf, i Line 3998  show_lsa_detail (struct vty *vty, struct ospf *ospf, i
   switch (type)    switch (type)
     {      {
     case OSPF_AS_EXTERNAL_LSA:      case OSPF_AS_EXTERNAL_LSA:
 #ifdef HAVE_OPAQUE_LSA  
     case OSPF_OPAQUE_AS_LSA:      case OSPF_OPAQUE_AS_LSA:
 #endif /* HAVE_OPAQUE_LSA */  
       vty_out (vty, "                %s %s%s",        vty_out (vty, "                %s %s%s",
                show_database_desc[type],                 show_database_desc[type],
                VTY_NEWLINE, VTY_NEWLINE);                 VTY_NEWLINE, VTY_NEWLINE);
Line 3935  show_lsa_detail_adv_router (struct vty *vty, struct os Line 4045  show_lsa_detail_adv_router (struct vty *vty, struct os
   switch (type)    switch (type)
     {      {
     case OSPF_AS_EXTERNAL_LSA:      case OSPF_AS_EXTERNAL_LSA:
 #ifdef HAVE_OPAQUE_LSA  
     case OSPF_OPAQUE_AS_LSA:      case OSPF_OPAQUE_AS_LSA:
 #endif /* HAVE_OPAQUE_LSA */  
       vty_out (vty, "                %s %s%s",        vty_out (vty, "                %s %s%s",
                show_database_desc[type],                 show_database_desc[type],
                VTY_NEWLINE, VTY_NEWLINE);                 VTY_NEWLINE, VTY_NEWLINE);
Line 3973  show_ip_ospf_database_summary (struct vty *vty, struct Line 4081  show_ip_ospf_database_summary (struct vty *vty, struct
           switch (type)            switch (type)
             {              {
             case OSPF_AS_EXTERNAL_LSA:              case OSPF_AS_EXTERNAL_LSA:
 #ifdef HAVE_OPAQUE_LSA  
             case OSPF_OPAQUE_AS_LSA:              case OSPF_OPAQUE_AS_LSA:
 #endif /* HAVE_OPAQUE_LSA */  
               continue;                continue;
             default:              default:
               break;                break;
Line 4002  show_ip_ospf_database_summary (struct vty *vty, struct Line 4108  show_ip_ospf_database_summary (struct vty *vty, struct
       switch (type)        switch (type)
         {          {
           case OSPF_AS_EXTERNAL_LSA:            case OSPF_AS_EXTERNAL_LSA:
 #ifdef HAVE_OPAQUE_LSA  
           case OSPF_OPAQUE_AS_LSA:            case OSPF_OPAQUE_AS_LSA:
 #endif /* HAVE_OPAQUE_LSA */  
             break;              break;
           default:            default:
             continue;              continue;
Line 4032  static void Line 4136  static void
 show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf)  show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf)
 {  {
   struct route_node *rn;    struct route_node *rn;
   struct ospf_lsa *lsa;  
   
   vty_out (vty, "%s                MaxAge Link States:%s%s",    vty_out (vty, "%s                MaxAge Link States:%s%s",
            VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);             VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
Line 4057  show_ip_ospf_database_maxage (struct vty *vty, struct  Line 4160  show_ip_ospf_database_maxage (struct vty *vty, struct 
 #define OSPF_LSA_TYPE_NSSA_DESC      "NSSA external link state\n"  #define OSPF_LSA_TYPE_NSSA_DESC      "NSSA external link state\n"
 #define OSPF_LSA_TYPE_NSSA_CMD_STR   "|nssa-external"  #define OSPF_LSA_TYPE_NSSA_CMD_STR   "|nssa-external"
   
 #ifdef HAVE_OPAQUE_LSA  
 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"  #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"  #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC   "Link AS Opaque-LSA\n"  #define OSPF_LSA_TYPE_OPAQUE_AS_DESC   "Link AS Opaque-LSA\n"
 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR   "|opaque-link|opaque-area|opaque-as"  #define OSPF_LSA_TYPE_OPAQUE_CMD_STR   "|opaque-link|opaque-area|opaque-as"
 #else /* HAVE_OPAQUE_LSA */  
 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC ""  
 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC ""  
 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC   ""  
 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR   ""  
 #endif /* HAVE_OPAQUE_LSA */  
   
 #define OSPF_LSA_TYPES_CMD_STR                                                \  #define OSPF_LSA_TYPES_CMD_STR                                                \
     "asbr-summary|external|network|router|summary"                            \      "asbr-summary|external|network|router|summary"                            \
Line 4137  DEFUN (show_ip_ospf_database, Line 4233  DEFUN (show_ip_ospf_database,
       show_ip_ospf_database_maxage (vty, ospf);        show_ip_ospf_database_maxage (vty, ospf);
       return CMD_SUCCESS;        return CMD_SUCCESS;
     }      }
 #ifdef HAVE_OPAQUE_LSA  
   else if (strncmp (argv[0], "opaque-l", 8) == 0)    else if (strncmp (argv[0], "opaque-l", 8) == 0)
     type = OSPF_OPAQUE_LINK_LSA;      type = OSPF_OPAQUE_LINK_LSA;
   else if (strncmp (argv[0], "opaque-ar", 9) == 0)    else if (strncmp (argv[0], "opaque-ar", 9) == 0)
     type = OSPF_OPAQUE_AREA_LSA;      type = OSPF_OPAQUE_AREA_LSA;
   else if (strncmp (argv[0], "opaque-as", 9) == 0)    else if (strncmp (argv[0], "opaque-as", 9) == 0)
     type = OSPF_OPAQUE_AS_LSA;      type = OSPF_OPAQUE_AS_LSA;
 #endif /* HAVE_OPAQUE_LSA */  
   else    else
     return CMD_WARNING;      return CMD_WARNING;
   
Line 4264  DEFUN (show_ip_ospf_database_type_adv_router, Line 4358  DEFUN (show_ip_ospf_database_type_adv_router,
     type = OSPF_ASBR_SUMMARY_LSA;      type = OSPF_ASBR_SUMMARY_LSA;
   else if (strncmp (argv[0], "e", 1) == 0)    else if (strncmp (argv[0], "e", 1) == 0)
     type = OSPF_AS_EXTERNAL_LSA;      type = OSPF_AS_EXTERNAL_LSA;
 #ifdef HAVE_OPAQUE_LSA  
   else if (strncmp (argv[0], "opaque-l", 8) == 0)    else if (strncmp (argv[0], "opaque-l", 8) == 0)
     type = OSPF_OPAQUE_LINK_LSA;      type = OSPF_OPAQUE_LINK_LSA;
   else if (strncmp (argv[0], "opaque-ar", 9) == 0)    else if (strncmp (argv[0], "opaque-ar", 9) == 0)
     type = OSPF_OPAQUE_AREA_LSA;      type = OSPF_OPAQUE_AREA_LSA;
   else if (strncmp (argv[0], "opaque-as", 9) == 0)    else if (strncmp (argv[0], "opaque-as", 9) == 0)
     type = OSPF_OPAQUE_AS_LSA;      type = OSPF_OPAQUE_AS_LSA;
 #endif /* HAVE_OPAQUE_LSA */  
   else    else
     return CMD_WARNING;      return CMD_WARNING;
   
Line 4300  ALIAS (show_ip_ospf_database_type_adv_router, Line 4392  ALIAS (show_ip_ospf_database_type_adv_router,
        OSPF_LSA_TYPES_DESC         OSPF_LSA_TYPES_DESC
        "Self-originated link states\n")         "Self-originated link states\n")
   
 DEFUN (ip_ospf_authentication_args,  DEFUN (ip_ospf_authentication_args,
        ip_ospf_authentication_args_addr_cmd,         ip_ospf_authentication_args_addr_cmd,
        "ip ospf authentication (null|message-digest) A.B.C.D",         "ip ospf authentication (null|message-digest) A.B.C.D",
Line 5307  DEFUN (ip_ospf_network, Line 5399  DEFUN (ip_ospf_network,
   struct interface *ifp = vty->index;    struct interface *ifp = vty->index;
   int old_type = IF_DEF_PARAMS (ifp)->type;    int old_type = IF_DEF_PARAMS (ifp)->type;
   struct route_node *rn;    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[0], "b", 1) == 0)    if (strncmp (argv[0], "b", 1) == 0)
     IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;      IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
   else if (strncmp (argv[0], "n", 1) == 0)    else if (strncmp (argv[0], "n", 1) == 0)
Line 5785  ALIAS (no_ip_ospf_transmit_delay, Line 5883  ALIAS (no_ip_ospf_transmit_delay,
        "OSPF interface commands\n"         "OSPF interface commands\n"
        "Link state transmit delay\n")         "Link state transmit delay\n")
   
DEFUN (ip_ospf_area,
DEFUN (ospf_redistribute_source_metric_type,       ip_ospf_area_cmd,
       ospf_redistribute_source_metric_type_routemap_cmd,       "ip ospf area (A.B.C.D|<0-4294967295>) [A.B.C.D]",
       "redistribute " QUAGGA_REDIST_STR_OSPFD        "IP Information\n"
         " metric <0-16777214> metric-type (1|2) route-map WORD",       "OSPF interface commands\n"
       REDIST_STR       "Enable OSPF on this interface\n"
       QUAGGA_REDIST_HELP_STR_OSPFD       "OSPF area ID in IP address format\n"
       "Metric for redistributed routes\n"       "OSPF area ID as a decimal value\n"
       "OSPF default metric\n"       "Address of interface\n")
       "OSPF exterior metric type for redistributed routes\n" 
       "Set OSPF External Type 1 metrics\n" 
       "Set OSPF External Type 2 metrics\n" 
       "Route map reference\n" 
       "Pointer to route-map entries\n") 
 {  {
  struct ospf *ospf = vty->index;  struct interface *ifp = vty->index;
  int source;  struct in_addr area_id;
  int type = -1;  struct in_addr addr;
  int metric = -1;  int format;
   struct ospf_if_params *params;
   
  /* Get distribute source. */  VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
  source = proto_redistnum(AFI_IP, argv[0]); 
  if (source < 0 || source == ZEBRA_ROUTE_OSPF) 
    return CMD_WARNING; 
   
  /* Get metric value. */  OSPF_VTY_GET_IF_PARAMS(ifp, params, 1, addr, VTY_SET);
  if (argc >= 2)  
    if (!str2metric (argv[1], &metric))  if (OSPF_IF_PARAM_CONFIGURED(params, if_area))
     {
       vty_out (vty, "There is already an interface area statement.%s",
               VTY_NEWLINE);
       return CMD_WARNING;        return CMD_WARNING;
    }
  /* Get metric type. */  if (memcmp (ifp->name, "VLINK", 5) == 0)
  if (argc >= 3)    {
    if (!str2metric_type (argv[2], &type))      vty_out (vty, "Cannot enable OSPF on a virtual link.%s", VTY_NEWLINE);
       return CMD_WARNING;        return CMD_WARNING;
       }
     
     SET_IF_PARAM (params, if_area);
     params->if_area = area_id;
     ospf_interface_area_set (ifp);
   
  if (argc == 4)  return CMD_SUCCESS;
    ospf_routemap_set (ospf, source, argv[3]);}
  else
    ospf_routemap_unset (ospf, source);DEFUN (no_ip_ospf_area,
        no_ip_ospf_area_cmd,
        "no ip ospf area [A.B.C.D]",
        NO_STR
        "IP Information\n"
        "OSPF interface commands\n"
        "Disable OSPF on this interface\n"
        "Address of interface\n")
 {
   struct interface *ifp = vty->index;
   struct ospf_if_params *params;
   struct in_addr addr;
 
   OSPF_VTY_GET_IF_PARAMS(ifp, params, 0, addr, VTY_UNSET);
       
  return ospf_redistribute_set (ospf, source, type, metric);  if (!OSPF_IF_PARAM_CONFIGURED(params, if_area))
     return CMD_SUCCESS;
   
   OSPF_VTY_PARAM_UNSET(params, if_area, ifp, addr);
   
   ospf_interface_area_unset (ifp);
 
   return CMD_SUCCESS;
 }  }
   
ALIAS (ospf_redistribute_source_metric_type,DEFUN (ospf_redistribute_source,
       ospf_redistribute_source_metric_type_cmd,       ospf_redistribute_source_cmd,
       "redistribute " QUAGGA_REDIST_STR_OSPFD        "redistribute " QUAGGA_REDIST_STR_OSPFD
       " metric <0-16777214> metric-type (1|2)",         " {metric <0-16777214>|metric-type (1|2)|route-map WORD}",
        REDIST_STR         REDIST_STR
        QUAGGA_REDIST_HELP_STR_OSPFD         QUAGGA_REDIST_HELP_STR_OSPFD
        "Metric for redistributed routes\n"         "Metric for redistributed routes\n"
        "OSPF default metric\n"         "OSPF default metric\n"
        "OSPF exterior metric type for redistributed routes\n"         "OSPF exterior metric type for redistributed routes\n"
        "Set OSPF External Type 1 metrics\n"         "Set OSPF External Type 1 metrics\n"
        "Set OSPF External Type 2 metrics\n")  
   
 ALIAS (ospf_redistribute_source_metric_type,  
        ospf_redistribute_source_metric_cmd,  
        "redistribute " QUAGGA_REDIST_STR_OSPFD " metric <0-16777214>",  
        REDIST_STR  
        QUAGGA_REDIST_HELP_STR_OSPFD  
        "Metric for redistributed routes\n"  
        "OSPF default metric\n")  
   
 DEFUN (ospf_redistribute_source_type_metric,  
        ospf_redistribute_source_type_metric_routemap_cmd,  
        "redistribute " QUAGGA_REDIST_STR_OSPFD   
          " metric-type (1|2) metric <0-16777214> route-map WORD",  
        REDIST_STR  
        QUAGGA_REDIST_HELP_STR_OSPFD  
        "OSPF exterior metric type for redistributed routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n"         "Set OSPF External Type 2 metrics\n"
        "Metric for redistributed routes\n"  
        "OSPF default metric\n"  
        "Route map reference\n"         "Route map reference\n"
        "Pointer to route-map entries\n")         "Pointer to route-map entries\n")
 {  {
Line 5867  DEFUN (ospf_redistribute_source_type_metric, Line 5966  DEFUN (ospf_redistribute_source_type_metric,
   int type = -1;    int type = -1;
   int metric = -1;    int metric = -1;
   
     if (argc < 4)
       return CMD_WARNING; /* should not happen */
   
   /* Get distribute source. */    /* Get distribute source. */
   source = proto_redistnum(AFI_IP, argv[0]);    source = proto_redistnum(AFI_IP, argv[0]);
   if (source < 0 || source == ZEBRA_ROUTE_OSPF)    if (source < 0 || source == ZEBRA_ROUTE_OSPF)
     return CMD_WARNING;      return CMD_WARNING;
   
   /* Get metric value. */    /* Get metric value. */
  if (argc >= 2)  if (argv[1] != NULL)
    if (!str2metric_type (argv[1], &type))    if (!str2metric (argv[1], &metric))
       return CMD_WARNING;        return CMD_WARNING;
   
   /* Get metric type. */    /* Get metric type. */
  if (argc >= 3)  if (argv[2] != NULL)
    if (!str2metric (argv[2], &metric))    if (!str2metric_type (argv[2], &type))
       return CMD_WARNING;        return CMD_WARNING;
   
  if (argc == 4)  if (argv[3] != NULL)
     ospf_routemap_set (ospf, source, argv[3]);      ospf_routemap_set (ospf, source, argv[3]);
   else    else
     ospf_routemap_unset (ospf, source);      ospf_routemap_unset (ospf, source);
Line 5890  DEFUN (ospf_redistribute_source_type_metric, Line 5992  DEFUN (ospf_redistribute_source_type_metric,
   return ospf_redistribute_set (ospf, source, type, metric);    return ospf_redistribute_set (ospf, source, type, metric);
 }  }
   
 ALIAS (ospf_redistribute_source_type_metric,  
        ospf_redistribute_source_type_metric_cmd,  
        "redistribute " QUAGGA_REDIST_STR_OSPFD   
          " metric-type (1|2) metric <0-16777214>",  
        REDIST_STR  
        QUAGGA_REDIST_HELP_STR_OSPFD  
        "OSPF exterior metric type for redistributed routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n"  
        "Metric for redistributed routes\n"  
        "OSPF default metric\n")  
   
 ALIAS (ospf_redistribute_source_type_metric,  
        ospf_redistribute_source_type_cmd,  
        "redistribute " QUAGGA_REDIST_STR_OSPFD " metric-type (1|2)",  
        REDIST_STR  
        QUAGGA_REDIST_HELP_STR_OSPFD  
        "OSPF exterior metric type for redistributed routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n")  
   
 ALIAS (ospf_redistribute_source_type_metric,  
        ospf_redistribute_source_cmd,  
        "redistribute " QUAGGA_REDIST_STR_OSPFD,  
        REDIST_STR  
        QUAGGA_REDIST_HELP_STR_OSPFD)  
   
 DEFUN (ospf_redistribute_source_metric_routemap,  
        ospf_redistribute_source_metric_routemap_cmd,  
        "redistribute " QUAGGA_REDIST_STR_OSPFD   
          " metric <0-16777214> route-map WORD",  
        REDIST_STR  
        QUAGGA_REDIST_HELP_STR_OSPFD  
        "Metric for redistributed routes\n"  
        "OSPF default metric\n"  
        "Route map reference\n"  
        "Pointer to route-map entries\n")  
 {  
   struct ospf *ospf = vty->index;  
   int source;  
   int metric = -1;  
   
   /* Get distribute source. */  
   source = proto_redistnum(AFI_IP, argv[0]);  
   if (source < 0 || source == ZEBRA_ROUTE_OSPF)  
     return CMD_WARNING;  
   
   /* Get metric value. */  
   if (argc >= 2)  
     if (!str2metric (argv[1], &metric))  
       return CMD_WARNING;  
   
   if (argc == 3)  
     ospf_routemap_set (ospf, source, argv[2]);  
   else  
     ospf_routemap_unset (ospf, source);  
     
   return ospf_redistribute_set (ospf, source, -1, metric);  
 }  
   
 DEFUN (ospf_redistribute_source_type_routemap,  
        ospf_redistribute_source_type_routemap_cmd,  
        "redistribute " QUAGGA_REDIST_STR_OSPFD   
          " metric-type (1|2) route-map WORD",  
        REDIST_STR  
        QUAGGA_REDIST_HELP_STR_OSPFD  
        "OSPF exterior metric type for redistributed routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n"  
        "Route map reference\n"  
        "Pointer to route-map entries\n")  
 {  
   struct ospf *ospf = vty->index;  
   int source;  
   int type = -1;  
   
   /* Get distribute source. */  
   source = proto_redistnum(AFI_IP, argv[0]);  
   if (source < 0 || source == ZEBRA_ROUTE_OSPF)  
     return CMD_WARNING;  
   
   /* Get metric value. */  
   if (argc >= 2)  
     if (!str2metric_type (argv[1], &type))  
       return CMD_WARNING;  
   
   if (argc == 3)  
     ospf_routemap_set (ospf, source, argv[2]);  
   else  
     ospf_routemap_unset (ospf, source);  
   
   return ospf_redistribute_set (ospf, source, type, -1);  
 }  
   
 DEFUN (ospf_redistribute_source_routemap,  
        ospf_redistribute_source_routemap_cmd,  
        "redistribute " QUAGGA_REDIST_STR_OSPFD " route-map WORD",  
        REDIST_STR  
        QUAGGA_REDIST_HELP_STR_OSPFD  
        "Route map reference\n"  
        "Pointer to route-map entries\n")  
 {  
   struct ospf *ospf = vty->index;  
   int source;  
   
   /* Get distribute source. */  
   source = proto_redistnum(AFI_IP, argv[0]);  
   if (source < 0 || source == ZEBRA_ROUTE_OSPF)  
     return CMD_WARNING;  
   
   if (argc == 2)  
     ospf_routemap_set (ospf, source, argv[1]);  
   else  
     ospf_routemap_unset (ospf, source);  
   
   return ospf_redistribute_set (ospf, source, -1, -1);  
 }  
   
 DEFUN (no_ospf_redistribute_source,  DEFUN (no_ospf_redistribute_source,
        no_ospf_redistribute_source_cmd,         no_ospf_redistribute_source_cmd,
        "no redistribute " QUAGGA_REDIST_STR_OSPFD,         "no redistribute " QUAGGA_REDIST_STR_OSPFD,
Line 6065  DEFUN (no_ospf_distribute_list_out, Line 6049  DEFUN (no_ospf_distribute_list_out,
 }  }
   
 /* Default information originate. */  /* Default information originate. */
DEFUN (ospf_default_information_originate_metric_type_routemap,DEFUN (ospf_default_information_originate,
       ospf_default_information_originate_metric_type_routemap_cmd, 
       "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD", 
       "Control distribution of default information\n" 
       "Distribute a default route\n" 
       "OSPF default metric\n" 
       "OSPF metric\n" 
       "OSPF metric type for default routes\n" 
       "Set OSPF External Type 1 metrics\n" 
       "Set OSPF External Type 2 metrics\n" 
       "Route map reference\n" 
       "Pointer to route-map entries\n") 
{ 
  struct ospf *ospf = vty->index; 
  int type = -1; 
  int metric = -1; 
 
  /* Get metric value. */ 
  if (argc >= 1) 
    if (!str2metric (argv[0], &metric)) 
      return CMD_WARNING; 
 
  /* Get metric type. */ 
  if (argc >= 2) 
    if (!str2metric_type (argv[1], &type)) 
      return CMD_WARNING; 
 
  if (argc == 3) 
    ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); 
  else 
    ospf_routemap_unset (ospf, DEFAULT_ROUTE); 
 
  return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, 
                                        type, metric); 
} 
 
ALIAS (ospf_default_information_originate_metric_type_routemap, 
       ospf_default_information_originate_metric_type_cmd, 
       "default-information originate metric <0-16777214> metric-type (1|2)", 
       "Control distribution of default information\n" 
       "Distribute a default route\n" 
       "OSPF default metric\n" 
       "OSPF metric\n" 
       "OSPF metric type for default routes\n" 
       "Set OSPF External Type 1 metrics\n" 
       "Set OSPF External Type 2 metrics\n") 
 
ALIAS (ospf_default_information_originate_metric_type_routemap, 
       ospf_default_information_originate_metric_cmd, 
       "default-information originate metric <0-16777214>", 
       "Control distribution of default information\n" 
       "Distribute a default route\n" 
       "OSPF default metric\n" 
       "OSPF metric\n") 
 
ALIAS (ospf_default_information_originate_metric_type_routemap, 
        ospf_default_information_originate_cmd,         ospf_default_information_originate_cmd,
       "default-information originate",       "default-information originate "
          "{always|metric <0-16777214>|metric-type (1|2)|route-map WORD}",
        "Control distribution of default information\n"         "Control distribution of default information\n"
        "Distribute a default route\n")  
   
 /* Default information originate. */  
 DEFUN (ospf_default_information_originate_metric_routemap,  
        ospf_default_information_originate_metric_routemap_cmd,  
        "default-information originate metric <0-16777214> route-map WORD",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"         "Distribute a default route\n"
        "OSPF default metric\n"  
        "OSPF metric\n"  
        "Route map reference\n"  
        "Pointer to route-map entries\n")  
 {  
   struct ospf *ospf = vty->index;  
   int metric = -1;  
   
   /* Get metric value. */  
   if (argc >= 1)  
     if (!str2metric (argv[0], &metric))  
       return CMD_WARNING;  
   
   if (argc == 2)  
     ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);  
   else  
     ospf_routemap_unset (ospf, DEFAULT_ROUTE);  
   
   return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,  
                                         -1, metric);  
 }  
   
 /* Default information originate. */  
 DEFUN (ospf_default_information_originate_routemap,  
        ospf_default_information_originate_routemap_cmd,  
        "default-information originate route-map WORD",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "Route map reference\n"  
        "Pointer to route-map entries\n")  
 {  
   struct ospf *ospf = vty->index;  
   
   if (argc == 1)  
     ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]);  
   else  
     ospf_routemap_unset (ospf, DEFAULT_ROUTE);  
   
   return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1);  
 }  
   
 DEFUN (ospf_default_information_originate_type_metric_routemap,  
        ospf_default_information_originate_type_metric_routemap_cmd,  
        "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "OSPF metric type for default routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n"  
        "OSPF default metric\n"  
        "OSPF metric\n"  
        "Route map reference\n"  
        "Pointer to route-map entries\n")  
 {  
   struct ospf *ospf = vty->index;  
   int type = -1;  
   int metric = -1;  
   
   /* Get metric type. */  
   if (argc >= 1)  
     if (!str2metric_type (argv[0], &type))  
       return CMD_WARNING;  
   
   /* Get metric value. */  
   if (argc >= 2)  
     if (!str2metric (argv[1], &metric))  
       return CMD_WARNING;  
   
   if (argc == 3)  
     ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);  
   else  
     ospf_routemap_unset (ospf, DEFAULT_ROUTE);  
   
   return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,  
                                         type, metric);  
 }  
   
 ALIAS (ospf_default_information_originate_type_metric_routemap,  
        ospf_default_information_originate_type_metric_cmd,  
        "default-information originate metric-type (1|2) metric <0-16777214>",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "OSPF metric type for default routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n"  
        "OSPF default metric\n"  
        "OSPF metric\n")  
   
 ALIAS (ospf_default_information_originate_type_metric_routemap,  
        ospf_default_information_originate_type_cmd,  
        "default-information originate metric-type (1|2)",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "OSPF metric type for default routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n")  
   
 DEFUN (ospf_default_information_originate_type_routemap,  
        ospf_default_information_originate_type_routemap_cmd,  
        "default-information originate metric-type (1|2) route-map WORD",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "OSPF metric type for default routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n"  
        "Route map reference\n"  
        "Pointer to route-map entries\n")  
 {  
   struct ospf *ospf = vty->index;  
   int type = -1;  
   
   /* Get metric type. */  
   if (argc >= 1)  
     if (!str2metric_type (argv[0], &type))  
       return CMD_WARNING;  
   
   if (argc == 2)  
     ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);  
   else  
     ospf_routemap_unset (ospf, DEFAULT_ROUTE);  
   
   return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,  
                                         type, -1);  
 }  
   
 DEFUN (ospf_default_information_originate_always_metric_type_routemap,  
        ospf_default_information_originate_always_metric_type_routemap_cmd,  
        "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "Always advertise default route\n"         "Always advertise default route\n"
        "OSPF default metric\n"         "OSPF default metric\n"
        "OSPF metric\n"         "OSPF metric\n"
Line 6272  DEFUN (ospf_default_information_originate_always_metri Line 6065  DEFUN (ospf_default_information_originate_always_metri
        "Pointer to route-map entries\n")         "Pointer to route-map entries\n")
 {  {
   struct ospf *ospf = vty->index;    struct ospf *ospf = vty->index;
     int default_originate = DEFAULT_ORIGINATE_ZEBRA;
   int type = -1;    int type = -1;
   int metric = -1;    int metric = -1;
   
  /* Get metric value. */  if (argc < 4)
  if (argc >= 1)    return CMD_WARNING; /* this should not happen */
    if (!str2metric (argv[0], &metric)) 
      return CMD_WARNING; 
   
  /* Get metric type. */  /* Check whether "always" was specified */
  if (argc >= 2)  if (argv[0] != NULL)
    if (!str2metric_type (argv[1], &type))    default_originate = DEFAULT_ORIGINATE_ALWAYS;
      return CMD_WARNING; 
   
   if (argc == 3)  
     ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);  
   else  
     ospf_routemap_unset (ospf, DEFAULT_ROUTE);  
   
   return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,  
                                         type, metric);  
 }  
   
 ALIAS (ospf_default_information_originate_always_metric_type_routemap,  
        ospf_default_information_originate_always_metric_type_cmd,  
        "default-information originate always metric <0-16777214> metric-type (1|2)",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "Always advertise default route\n"  
        "OSPF default metric\n"  
        "OSPF metric\n"  
        "OSPF metric type for default routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n")  
   
 ALIAS (ospf_default_information_originate_always_metric_type_routemap,  
        ospf_default_information_originate_always_metric_cmd,  
        "default-information originate always metric <0-16777214>",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "Always advertise default route\n"  
        "OSPF default metric\n"  
        "OSPF metric\n"  
        "OSPF metric type for default routes\n")  
   
 ALIAS (ospf_default_information_originate_always_metric_type_routemap,  
        ospf_default_information_originate_always_cmd,  
        "default-information originate always",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "Always advertise default route\n")  
   
 DEFUN (ospf_default_information_originate_always_metric_routemap,  
        ospf_default_information_originate_always_metric_routemap_cmd,  
        "default-information originate always metric <0-16777214> route-map WORD",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "Always advertise default route\n"  
        "OSPF default metric\n"  
        "OSPF metric\n"  
        "Route map reference\n"  
        "Pointer to route-map entries\n")  
 {  
   struct ospf *ospf = vty->index;  
   int metric = -1;  
   
   /* Get metric value. */    /* Get metric value. */
  if (argc >= 1)  if (argv[1] != NULL)
    if (!str2metric (argv[0], &metric))    if (!str2metric (argv[1], &metric))
       return CMD_WARNING;        return CMD_WARNING;
   
   if (argc == 2)  
     ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);  
   else  
     ospf_routemap_unset (ospf, DEFAULT_ROUTE);  
   
   return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,  
                                         -1, metric);  
 }  
   
 DEFUN (ospf_default_information_originate_always_routemap,  
        ospf_default_information_originate_always_routemap_cmd,  
        "default-information originate always route-map WORD",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "Always advertise default route\n"  
        "Route map reference\n"  
        "Pointer to route-map entries\n")  
 {  
   struct ospf *ospf = vty->index;  
   
   if (argc == 1)  
     ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]);  
   else  
     ospf_routemap_unset (ospf, DEFAULT_ROUTE);  
   
   return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1);  
 }  
   
 DEFUN (ospf_default_information_originate_always_type_metric_routemap,  
        ospf_default_information_originate_always_type_metric_routemap_cmd,  
        "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "Always advertise default route\n"  
        "OSPF metric type for default routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n"  
        "OSPF default metric\n"  
        "OSPF metric\n"  
        "Route map reference\n"  
        "Pointer to route-map entries\n")  
 {  
   struct ospf *ospf = vty->index;  
   int type = -1;  
   int metric = -1;  
   
   /* Get metric type. */    /* Get metric type. */
  if (argc >= 1)  if (argv[2] != NULL)
    if (!str2metric_type (argv[0], &type))    if (!str2metric_type (argv[2], &type))
       return CMD_WARNING;        return CMD_WARNING;
   
  /* Get metric value. */  if (argv[3] != NULL)
  if (argc >= 2)    ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[3]);
    if (!str2metric (argv[1], &metric)) 
      return CMD_WARNING; 
 
  if (argc == 3) 
    ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); 
   else    else
     ospf_routemap_unset (ospf, DEFAULT_ROUTE);      ospf_routemap_unset (ospf, DEFAULT_ROUTE);
   
  return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,  return ospf_redistribute_default_set (ospf, default_originate,
                                         type, metric);                                          type, metric);
 }  }
   
 ALIAS (ospf_default_information_originate_always_type_metric_routemap,  
        ospf_default_information_originate_always_type_metric_cmd,  
        "default-information originate always metric-type (1|2) metric <0-16777214>",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "Always advertise default route\n"  
        "OSPF metric type for default routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n"  
        "OSPF default metric\n"  
        "OSPF metric\n")  
   
 ALIAS (ospf_default_information_originate_always_type_metric_routemap,  
        ospf_default_information_originate_always_type_cmd,  
        "default-information originate always metric-type (1|2)",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "Always advertise default route\n"  
        "OSPF metric type for default routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n")  
   
 DEFUN (ospf_default_information_originate_always_type_routemap,  
        ospf_default_information_originate_always_type_routemap_cmd,  
        "default-information originate always metric-type (1|2) route-map WORD",  
        "Control distribution of default information\n"  
        "Distribute a default route\n"  
        "Always advertise default route\n"  
        "OSPF metric type for default routes\n"  
        "Set OSPF External Type 1 metrics\n"  
        "Set OSPF External Type 2 metrics\n"  
        "Route map reference\n"  
        "Pointer to route-map entries\n")  
 {  
   struct ospf *ospf = vty->index;  
   int type = -1;  
   
   /* Get metric type. */  
   if (argc >= 1)  
     if (!str2metric_type (argv[0], &type))  
       return CMD_WARNING;  
   
   if (argc == 2)  
     ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);  
   else  
     ospf_routemap_unset (ospf, DEFAULT_ROUTE);  
   
   return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,  
                                         type, -1);  
 }  
   
 DEFUN (no_ospf_default_information_originate,  DEFUN (no_ospf_default_information_originate,
        no_ospf_default_information_originate_cmd,         no_ospf_default_information_originate_cmd,
        "no default-information originate",         "no default-information originate",
Line 6550  DEFUN (no_ospf_distance, Line 6187  DEFUN (no_ospf_distance,
   
 DEFUN (no_ospf_distance_ospf,  DEFUN (no_ospf_distance_ospf,
        no_ospf_distance_ospf_cmd,         no_ospf_distance_ospf_cmd,
       "no distance ospf",       "no distance ospf {intra-area|inter-area|external}",
        NO_STR         NO_STR
        "Define an administrative distance\n"         "Define an administrative distance\n"
        "OSPF Administrative distance\n"         "OSPF Administrative distance\n"
       "OSPF Distance\n")       "OSPF Distance\n"
{ 
  struct ospf *ospf = vty->index; 
 
  ospf->distance_intra = 0; 
  ospf->distance_inter = 0; 
  ospf->distance_external = 0; 
 
  return CMD_SUCCESS; 
} 
 
DEFUN (ospf_distance_ospf_intra, 
       ospf_distance_ospf_intra_cmd, 
       "distance ospf intra-area <1-255>", 
       "Define an administrative distance\n" 
       "OSPF Administrative distance\n" 
        "Intra-area routes\n"         "Intra-area routes\n"
        "Distance for intra-area routes\n")  
 {  
   struct ospf *ospf = vty->index;  
   
   ospf->distance_intra = atoi (argv[0]);  
   
   return CMD_SUCCESS;  
 }  
   
 DEFUN (ospf_distance_ospf_intra_inter,  
        ospf_distance_ospf_intra_inter_cmd,  
        "distance ospf intra-area <1-255> inter-area <1-255>",  
        "Define an administrative distance\n"  
        "OSPF Administrative distance\n"  
        "Intra-area routes\n"  
        "Distance for intra-area routes\n"  
        "Inter-area routes\n"         "Inter-area routes\n"
       "Distance for inter-area routes\n")       "External routes\n")
 {  {
   struct ospf *ospf = vty->index;    struct ospf *ospf = vty->index;
   
  ospf->distance_intra = atoi (argv[0]);  if (argc < 3)
  ospf->distance_inter = atoi (argv[1]);    return CMD_WARNING;
   
  return CMD_SUCCESS;  if (argv[0] != NULL)
}    ospf->distance_intra = 0;
   
DEFUN (ospf_distance_ospf_intra_external,  if (argv[1] != NULL)
       ospf_distance_ospf_intra_external_cmd,    ospf->distance_inter = 0;
       "distance ospf intra-area <1-255> external <1-255>", 
       "Define an administrative distance\n" 
       "OSPF Administrative distance\n" 
       "Intra-area routes\n" 
       "Distance for intra-area routes\n" 
       "External routes\n" 
       "Distance for external routes\n") 
{ 
  struct ospf *ospf = vty->index; 
   
  ospf->distance_intra = atoi (argv[0]);  if (argv[2] != NULL)
  ospf->distance_external = atoi (argv[1]);    ospf->distance_external = 0;
   
  return CMD_SUCCESS;  if (argv[0] || argv[1] || argv[2])
}    return CMD_SUCCESS;
   
DEFUN (ospf_distance_ospf_intra_inter_external,  /* If no arguments are given, clear all distance information */
       ospf_distance_ospf_intra_inter_external_cmd,  ospf->distance_intra = 0;
       "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>",  ospf->distance_inter = 0;
       "Define an administrative distance\n"  ospf->distance_external = 0;
       "OSPF Administrative distance\n" 
       "Intra-area routes\n" 
       "Distance for intra-area routes\n" 
       "Inter-area routes\n" 
       "Distance for inter-area routes\n" 
       "External routes\n" 
       "Distance for external routes\n") 
{ 
  struct ospf *ospf = vty->index; 
   
   ospf->distance_intra = atoi (argv[0]);  
   ospf->distance_inter = atoi (argv[1]);  
   ospf->distance_external = atoi (argv[2]);  
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
DEFUN (ospf_distance_ospf_intra_external_inter,DEFUN (ospf_distance_ospf,
       ospf_distance_ospf_intra_external_inter_cmd,       ospf_distance_ospf_cmd,
       "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>",       "distance ospf "
          "{intra-area <1-255>|inter-area <1-255>|external <1-255>}",
        "Define an administrative distance\n"         "Define an administrative distance\n"
        "OSPF Administrative distance\n"         "OSPF Administrative distance\n"
        "Intra-area routes\n"         "Intra-area routes\n"
        "Distance for intra-area routes\n"         "Distance for intra-area routes\n"
        "External routes\n"  
        "Distance for external routes\n"  
        "Inter-area routes\n"         "Inter-area routes\n"
        "Distance for inter-area routes\n")  
 {  
   struct ospf *ospf = vty->index;  
   
   ospf->distance_intra = atoi (argv[0]);  
   ospf->distance_external = atoi (argv[1]);  
   ospf->distance_inter = atoi (argv[2]);  
   
   return CMD_SUCCESS;  
 }  
   
 DEFUN (ospf_distance_ospf_inter,  
        ospf_distance_ospf_inter_cmd,  
        "distance ospf inter-area <1-255>",  
        "Define an administrative distance\n"  
        "OSPF Administrative distance\n"  
        "Inter-area routes\n"  
        "Distance for inter-area routes\n")  
 {  
   struct ospf *ospf = vty->index;  
   
   ospf->distance_inter = atoi (argv[0]);  
   
   return CMD_SUCCESS;  
 }  
   
 DEFUN (ospf_distance_ospf_inter_intra,  
        ospf_distance_ospf_inter_intra_cmd,  
        "distance ospf inter-area <1-255> intra-area <1-255>",  
        "Define an administrative distance\n"  
        "OSPF Administrative distance\n"  
        "Inter-area routes\n"  
        "Distance for inter-area routes\n"         "Distance for inter-area routes\n"
        "Intra-area routes\n"  
        "Distance for intra-area routes\n")  
 {  
   struct ospf *ospf = vty->index;  
   
   ospf->distance_inter = atoi (argv[0]);  
   ospf->distance_intra = atoi (argv[1]);  
   
   return CMD_SUCCESS;  
 }  
   
 DEFUN (ospf_distance_ospf_inter_external,  
        ospf_distance_ospf_inter_external_cmd,  
        "distance ospf inter-area <1-255> external <1-255>",  
        "Define an administrative distance\n"  
        "OSPF Administrative distance\n"  
        "Inter-area routes\n"  
        "Distance for inter-area routes\n"  
        "External routes\n"         "External routes\n"
        "Distance for external routes\n")         "Distance for external routes\n")
 {  {
   struct ospf *ospf = vty->index;    struct ospf *ospf = vty->index;
   
  ospf->distance_inter = atoi (argv[0]);  if (argc < 3) /* should not happen */
  ospf->distance_external = atoi (argv[1]);    return CMD_WARNING;
   
  return CMD_SUCCESS;  if (!argv[0] && !argv[1] && !argv[2])
}    {
       vty_out(vty, "%% Command incomplete. (Arguments required)%s",
               VTY_NEWLINE);
       return CMD_WARNING;
     }
   
DEFUN (ospf_distance_ospf_inter_intra_external,  if (argv[0] != NULL)
       ospf_distance_ospf_inter_intra_external_cmd,    ospf->distance_intra = atoi(argv[0]);
       "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>", 
       "Define an administrative distance\n" 
       "OSPF Administrative distance\n" 
       "Inter-area routes\n" 
       "Distance for inter-area routes\n" 
       "Intra-area routes\n" 
       "Distance for intra-area routes\n" 
       "External routes\n" 
       "Distance for external routes\n") 
{ 
  struct ospf *ospf = vty->index; 
   
  ospf->distance_inter = atoi (argv[0]);  if (argv[1] != NULL)
  ospf->distance_intra = atoi (argv[1]);    ospf->distance_inter = atoi(argv[1]);
  ospf->distance_external = atoi (argv[2]); 
   
  return CMD_SUCCESS;  if (argv[2] != NULL)
}    ospf->distance_external = atoi(argv[2]);
   
 DEFUN (ospf_distance_ospf_inter_external_intra,  
        ospf_distance_ospf_inter_external_intra_cmd,  
        "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>",  
        "Define an administrative distance\n"  
        "OSPF Administrative distance\n"  
        "Inter-area routes\n"  
        "Distance for inter-area routes\n"  
        "External routes\n"  
        "Distance for external routes\n"  
        "Intra-area routes\n"  
        "Distance for intra-area routes\n")  
 {  
   struct ospf *ospf = vty->index;  
   
   ospf->distance_inter = atoi (argv[0]);  
   ospf->distance_external = atoi (argv[1]);  
   ospf->distance_intra = atoi (argv[2]);  
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 DEFUN (ospf_distance_ospf_external,  
        ospf_distance_ospf_external_cmd,  
        "distance ospf external <1-255>",  
        "Define an administrative distance\n"  
        "OSPF Administrative distance\n"  
        "External routes\n"  
        "Distance for external routes\n")  
 {  
   struct ospf *ospf = vty->index;  
   
   ospf->distance_external = atoi (argv[0]);  
   
   return CMD_SUCCESS;  
 }  
   
 DEFUN (ospf_distance_ospf_external_intra,  
        ospf_distance_ospf_external_intra_cmd,  
        "distance ospf external <1-255> intra-area <1-255>",  
        "Define an administrative distance\n"  
        "OSPF Administrative distance\n"  
        "External routes\n"  
        "Distance for external routes\n"  
        "Intra-area routes\n"  
        "Distance for intra-area routes\n")  
 {  
   struct ospf *ospf = vty->index;  
   
   ospf->distance_external = atoi (argv[0]);  
   ospf->distance_intra = atoi (argv[1]);  
   
   return CMD_SUCCESS;  
 }  
   
 DEFUN (ospf_distance_ospf_external_inter,  
        ospf_distance_ospf_external_inter_cmd,  
        "distance ospf external <1-255> inter-area <1-255>",  
        "Define an administrative distance\n"  
        "OSPF Administrative distance\n"  
        "External routes\n"  
        "Distance for external routes\n"  
        "Inter-area routes\n"  
        "Distance for inter-area routes\n")  
 {  
   struct ospf *ospf = vty->index;  
   
   ospf->distance_external = atoi (argv[0]);  
   ospf->distance_inter = atoi (argv[1]);  
   
   return CMD_SUCCESS;  
 }  
   
 DEFUN (ospf_distance_ospf_external_intra_inter,  
        ospf_distance_ospf_external_intra_inter_cmd,  
        "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>",  
        "Define an administrative distance\n"  
        "OSPF Administrative distance\n"  
        "External routes\n"  
        "Distance for external routes\n"  
        "Intra-area routes\n"  
        "Distance for intra-area routes\n"  
        "Inter-area routes\n"  
        "Distance for inter-area routes\n")  
 {  
   struct ospf *ospf = vty->index;  
   
   ospf->distance_external = atoi (argv[0]);  
   ospf->distance_intra = atoi (argv[1]);  
   ospf->distance_inter = atoi (argv[2]);  
   
   return CMD_SUCCESS;  
 }  
   
 DEFUN (ospf_distance_ospf_external_inter_intra,  
        ospf_distance_ospf_external_inter_intra_cmd,  
        "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>",  
        "Define an administrative distance\n"  
        "OSPF Administrative distance\n"  
        "External routes\n"  
        "Distance for external routes\n"  
        "Inter-area routes\n"  
        "Distance for inter-area routes\n"  
        "Intra-area routes\n"  
        "Distance for intra-area routes\n")  
 {  
   struct ospf *ospf = vty->index;  
   
   ospf->distance_external = atoi (argv[0]);  
   ospf->distance_inter = atoi (argv[1]);  
   ospf->distance_intra = atoi (argv[2]);  
   
   return CMD_SUCCESS;  
 }  
   
 DEFUN (ospf_distance_source,  DEFUN (ospf_distance_source,
        ospf_distance_source_cmd,         ospf_distance_source_cmd,
        "distance <1-255> A.B.C.D/M",         "distance <1-255> A.B.C.D/M",
Line 7002  ALIAS (no_ip_ospf_mtu_ignore, Line 6416  ALIAS (no_ip_ospf_mtu_ignore,
       "IP Information\n"        "IP Information\n"
       "OSPF interface commands\n"        "OSPF interface commands\n"
       "Disable mtu mismatch detection\n")        "Disable mtu mismatch detection\n")
 DEFUN (ospf_max_metric_router_lsa_admin,  DEFUN (ospf_max_metric_router_lsa_admin,
        ospf_max_metric_router_lsa_admin_cmd,         ospf_max_metric_router_lsa_admin_cmd,
        "max-metric router-lsa administrative",         "max-metric router-lsa administrative",
Line 7171  config_write_stub_router (struct vty *vty, struct ospf Line 6585  config_write_stub_router (struct vty *vty, struct ospf
     }      }
   return;    return;
 }  }
 static void  static void
 show_ip_ospf_route_network (struct vty *vty, struct route_table *rt)  show_ip_ospf_route_network (struct vty *vty, struct route_table *rt)
 {  {
Line 7390  DEFUN (show_ip_ospf_route, Line 6804  DEFUN (show_ip_ospf_route,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 const char *ospf_abr_type_str[] =   const char *ospf_abr_type_str[] = 
 {  {
   "unknown",    "unknown",
Line 7419  area_id2str (char *buf, int length, struct ospf_area * Line 6833  area_id2str (char *buf, int length, struct ospf_area *
     sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr));      sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr));
 }  }
   
 const char *ospf_int_type_str[] =   const char *ospf_int_type_str[] = 
 {  {
   "unknown",            /* should never be used. */    "unknown",            /* should never be used. */
Line 7597  config_write_interface (struct vty *vty) Line 7011  config_write_interface (struct vty *vty)
             vty_out (vty, "%s", VTY_NEWLINE);              vty_out (vty, "%s", VTY_NEWLINE);
           }            }
   
           /* Area  print. */
           if (OSPF_IF_PARAM_CONFIGURED (params, if_area))
             {
               vty_out (vty, " ip ospf area %s", inet_ntoa (params->if_area));
               if (params != IF_DEF_PARAMS (ifp))
                 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
               vty_out (vty, "%s", VTY_NEWLINE);
             }
   
     /* MTU ignore print. */      /* MTU ignore print. */
     if (OSPF_IF_PARAM_CONFIGURED (params, mtu_ignore) &&      if (OSPF_IF_PARAM_CONFIGURED (params, mtu_ignore) &&
        params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT)         params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT)
Line 7626  config_write_interface (struct vty *vty) Line 7049  config_write_interface (struct vty *vty)
           }            }
       } while (rn);        } while (rn);
               
 #ifdef HAVE_OPAQUE_LSA  
       ospf_opaque_config_write_if (vty, ifp);        ospf_opaque_config_write_if (vty, ifp);
 #endif /* HAVE_OPAQUE_LSA */  
     }      }
   
   return write;    return write;
Line 7853  config_write_virtual_link (struct vty *vty, struct osp Line 7274  config_write_virtual_link (struct vty *vty, struct osp
   return 0;    return 0;
 }  }
   
 static int  static int
 config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf)  config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf)
 {  {
Line 7861  config_write_ospf_redistribute (struct vty *vty, struc Line 7282  config_write_ospf_redistribute (struct vty *vty, struc
   
   /* redistribute print. */    /* redistribute print. */
   for (type = 0; type < ZEBRA_ROUTE_MAX; type++)    for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
    if (type != zclient->redist_default && zclient->redist[type])    if (type != zclient->redist_default &&
         vrf_bitmap_check (zclient->redist[type], VRF_DEFAULT))
       {        {
         vty_out (vty, " redistribute %s", zebra_route_string(type));          vty_out (vty, " redistribute %s", zebra_route_string(type));
         if (ospf->dmetric[type].value >= 0)          if (ospf->dmetric[type].value >= 0)
Line 8016  ospf_config_write (struct vty *vty) Line 7438  ospf_config_write (struct vty *vty)
                    ospf->ref_bandwidth / 1000, VTY_NEWLINE);                     ospf->ref_bandwidth / 1000, VTY_NEWLINE);
         }          }
   
         /* LSA timers */
         if (ospf->min_ls_interval != OSPF_MIN_LS_INTERVAL)
     vty_out (vty, " timers throttle lsa all %d%s",
        ospf->min_ls_interval, VTY_NEWLINE);
         if (ospf->min_ls_arrival != OSPF_MIN_LS_ARRIVAL)
     vty_out (vty, " timers lsa arrival %d%s",
        ospf->min_ls_arrival, VTY_NEWLINE);
   
       /* SPF timers print. */        /* SPF timers print. */
       if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT ||        if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT ||
           ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT ||            ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT ||
Line 8088  ospf_config_write (struct vty *vty) Line 7518  ospf_config_write (struct vty *vty)
       /* Distance configuration. */        /* Distance configuration. */
       config_write_ospf_distance (vty, ospf);        config_write_ospf_distance (vty, ospf);
   
 #ifdef HAVE_OPAQUE_LSA  
       ospf_opaque_config_write_router (vty, ospf);        ospf_opaque_config_write_router (vty, ospf);
 #endif /* HAVE_OPAQUE_LSA */  
     }      }
   
   return write;    return write;
Line 8146  ospf_vty_show_init (void) Line 7574  ospf_vty_show_init (void)
   install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd);    install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd);
 }  }
   
 /* ospfd's interface node. */  /* ospfd's interface node. */
 static struct cmd_node interface_node =  static struct cmd_node interface_node =
 {  {
Line 8238  ospf_vty_if_init (void) Line 7666  ospf_vty_if_init (void)
   install_element (INTERFACE_NODE, &no_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_cmd);    install_element (INTERFACE_NODE, &no_ip_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);
   
   /* These commands are compatibitliy for previous version. */    /* These commands are compatibitliy for previous version. */
   install_element (INTERFACE_NODE, &ospf_authentication_key_cmd);    install_element (INTERFACE_NODE, &ospf_authentication_key_cmd);
   install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd);    install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd);
Line 8266  ospf_vty_if_init (void) Line 7698  ospf_vty_if_init (void)
 static void  static void
 ospf_vty_zebra_init (void)  ospf_vty_zebra_init (void)
 {  {
   install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd);  
   install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd);  
   install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd);  
   install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd);  
   install_element (OSPF_NODE, &ospf_redistribute_source_cmd);    install_element (OSPF_NODE, &ospf_redistribute_source_cmd);
   install_element (OSPF_NODE,  
                    &ospf_redistribute_source_metric_type_routemap_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_redistribute_source_type_metric_routemap_cmd);  
   install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd);  
   install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd);  
   install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd);  
     
   install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd);    install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd);
   
   install_element (OSPF_NODE, &ospf_distribute_list_out_cmd);    install_element (OSPF_NODE, &ospf_distribute_list_out_cmd);
   install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd);    install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd);
   
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_metric_type_cmd);  
   install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_type_metric_cmd);  
   install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd);  
   install_element (OSPF_NODE, &ospf_default_information_originate_cmd);    install_element (OSPF_NODE, &ospf_default_information_originate_cmd);
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_always_metric_type_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_always_metric_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_always_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_always_type_metric_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_always_type_cmd);  
   
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_metric_type_routemap_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_metric_routemap_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_routemap_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_type_metric_routemap_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_type_routemap_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_always_metric_type_routemap_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_always_metric_routemap_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_always_routemap_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_always_type_metric_routemap_cmd);  
   install_element (OSPF_NODE,  
                    &ospf_default_information_originate_always_type_routemap_cmd);  
   
   install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd);    install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd);
   
   install_element (OSPF_NODE, &ospf_default_metric_cmd);    install_element (OSPF_NODE, &ospf_default_metric_cmd);
Line 8332  ospf_vty_zebra_init (void) Line 7714  ospf_vty_zebra_init (void)
   install_element (OSPF_NODE, &ospf_distance_cmd);    install_element (OSPF_NODE, &ospf_distance_cmd);
   install_element (OSPF_NODE, &no_ospf_distance_cmd);    install_element (OSPF_NODE, &no_ospf_distance_cmd);
   install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd);    install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd);
  install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd);  install_element (OSPF_NODE, &ospf_distance_ospf_cmd);
  install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd); 
  install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd); 
 #if 0  #if 0
   install_element (OSPF_NODE, &ospf_distance_source_cmd);    install_element (OSPF_NODE, &ospf_distance_source_cmd);
   install_element (OSPF_NODE, &no_ospf_distance_source_cmd);    install_element (OSPF_NODE, &no_ospf_distance_source_cmd);
Line 8362  static struct cmd_node ospf_node = Line 7730  static struct cmd_node ospf_node =
   1    1
 };  };
   
 /* Install OSPF related vty commands. */  /* Install OSPF related vty commands. */
 void  void
 ospf_vty_init (void)  ospf_vty_init (void)
Line 8491  ospf_vty_init (void) Line 7859  ospf_vty_init (void)
   install_element (OSPF_NODE, &ospf_area_import_list_cmd);    install_element (OSPF_NODE, &ospf_area_import_list_cmd);
   install_element (OSPF_NODE, &no_ospf_area_import_list_cmd);    install_element (OSPF_NODE, &no_ospf_area_import_list_cmd);
       
     /* LSA timer commands */
     install_element (OSPF_NODE, &ospf_timers_min_ls_interval_cmd);
     install_element (OSPF_NODE, &no_ospf_timers_min_ls_interval_cmd);
     install_element (OSPF_NODE, &ospf_timers_min_ls_arrival_cmd);
     install_element (OSPF_NODE, &no_ospf_timers_min_ls_arrival_cmd);
   
   /* SPF timer commands */    /* SPF timer commands */
   install_element (OSPF_NODE, &ospf_timers_spf_cmd);    install_element (OSPF_NODE, &ospf_timers_spf_cmd);
   install_element (OSPF_NODE, &no_ospf_timers_spf_cmd);    install_element (OSPF_NODE, &no_ospf_timers_spf_cmd);

Removed from v.1.1.1.3  
changed lines
  Added in v.1.1.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>