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

version 1.1, 2012/02/21 17:26:12 version 1.1.1.3, 2013/07/21 23:54:40
Line 80  ospf_str2area_id (const char *str, struct in_addr *are Line 80  ospf_str2area_id (const char *str, struct in_addr *are
   /* match "<0-4294967295>". */    /* match "<0-4294967295>". */
   else    else
     {      {
         if (*str == '-')
           return -1;
         errno = 0;
       ret = strtoul (str, &endptr, 10);        ret = strtoul (str, &endptr, 10);
      if (*endptr != '\0' || (ret == ULONG_MAX && errno == ERANGE))      if (*endptr != '\0' || errno || ret > UINT32_MAX)
         return -1;          return -1;
   
       area_id->s_addr = htonl (ret);        area_id->s_addr = htonl (ret);
Line 93  ospf_str2area_id (const char *str, struct in_addr *are Line 96  ospf_str2area_id (const char *str, struct in_addr *are
   
   
 static int  static int
 str2distribute_source (const char *str, int *source)  
 {  
   /* Sanity check. */  
   if (str == NULL)  
     return 0;  
   
   if (strncmp (str, "k", 1) == 0)  
     *source = ZEBRA_ROUTE_KERNEL;  
   else if (strncmp (str, "c", 1) == 0)  
     *source = ZEBRA_ROUTE_CONNECT;  
   else if (strncmp (str, "s", 1) == 0)  
     *source = ZEBRA_ROUTE_STATIC;  
   else if (strncmp (str, "r", 1) == 0)  
     *source = ZEBRA_ROUTE_RIP;  
   else if (strncmp (str, "b", 1) == 0)  
     *source = ZEBRA_ROUTE_BGP;  
   else  
     return 0;  
   
   return 1;  
 }  
   
 static int  
 str2metric (const char *str, int *metric)  str2metric (const char *str, int *metric)
 {  {
   /* Sanity check. */    /* Sanity check. */
Line 1762  DEFUN (no_ospf_area_default_cost, Line 1742  DEFUN (no_ospf_area_default_cost,
   struct ospf *ospf = vty->index;    struct ospf *ospf = vty->index;
   struct ospf_area *area;    struct ospf_area *area;
   struct in_addr area_id;    struct in_addr area_id;
   u_int32_t cost;  
   int format;    int format;
   struct prefix_ipv4 p;    struct prefix_ipv4 p;
   
   VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]);    VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]);
  VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215);  VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[1], 0, OSPF_LS_INFINITY);
   
   area = ospf_area_lookup_by_area_id (ospf, area_id);    area = ospf_area_lookup_by_area_id (ospf, area_id);
   if (area == NULL)    if (area == NULL)
Line 1953  DEFUN (no_ospf_area_filter_list, Line 1932  DEFUN (no_ospf_area_filter_list,
   struct ospf *ospf = vty->index;    struct ospf *ospf = vty->index;
   struct ospf_area *area;    struct ospf_area *area;
   struct in_addr area_id;    struct in_addr area_id;
   struct prefix_list *plist;  
   int format;    int format;
   
   VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);    VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
Line 1961  DEFUN (no_ospf_area_filter_list, Line 1939  DEFUN (no_ospf_area_filter_list,
   if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL)    if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL)
     return CMD_SUCCESS;      return CMD_SUCCESS;
       
   plist = prefix_list_lookup (AFI_IP, argv[1]);  
   if (strncmp (argv[2], "in", 2) == 0)    if (strncmp (argv[2], "in", 2) == 0)
     {      {
       if (PREFIX_NAME_IN (area))        if (PREFIX_NAME_IN (area))
Line 2342  DEFUN (ospf_neighbor, Line 2319  DEFUN (ospf_neighbor,
   if (argc > 1)    if (argc > 1)
     ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);      ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);
   if (argc > 2)    if (argc > 2)
    ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, priority);    ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
Line 2414  DEFUN (no_ospf_neighbor, Line 2391  DEFUN (no_ospf_neighbor,
 {  {
   struct ospf *ospf = vty->index;    struct ospf *ospf = vty->index;
   struct in_addr nbr_addr;    struct in_addr nbr_addr;
   int ret;  
   
   VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);    VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
   
  ret = ospf_nbr_nbma_unset (ospf, nbr_addr);  (void)ospf_nbr_nbma_unset (ospf, nbr_addr);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
Line 3761  show_as_external_lsa_detail (struct vty *vty, struct o Line 3737  show_as_external_lsa_detail (struct vty *vty, struct o
   return 0;    return 0;
 }  }
   
/* N.B. This function currently seems to be unused. */#if 0
 static int  static int
 show_as_external_lsa_stdvty (struct ospf_lsa *lsa)  show_as_external_lsa_stdvty (struct ospf_lsa *lsa)
 {  {
Line 3785  show_as_external_lsa_stdvty (struct ospf_lsa *lsa) Line 3761  show_as_external_lsa_stdvty (struct ospf_lsa *lsa)
   
   return 0;    return 0;
 }  }
   #endif
   
 /* Show AS-NSSA-LSA detail information. */  /* Show AS-NSSA-LSA detail information. */
 static int  static int
Line 4054  show_ip_ospf_database_summary (struct vty *vty, struct Line 4031  show_ip_ospf_database_summary (struct vty *vty, struct
 static void  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 listnode *node;  struct route_node *rn;
   struct ospf_lsa *lsa;    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);
   
  for (ALL_LIST_ELEMENTS_RO (ospf->maxage_lsa, node, lsa))  for (rn = route_top (ospf->maxage_lsa); rn; rn = route_next (rn))
     {      {
      vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE);      struct ospf_lsa *lsa;
      vty_out (vty, "Link State ID: %s%s",
               inet_ntoa (lsa->data->id), VTY_NEWLINE);      if ((lsa = rn->info) != NULL)
      vty_out (vty, "Advertising Router: %s%s",        {
               inet_ntoa (lsa->data->adv_router), VTY_NEWLINE);          vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE);
      vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE);          vty_out (vty, "Link State ID: %s%s",
      vty_out (vty, "%s", VTY_NEWLINE);                   inet_ntoa (lsa->data->id), VTY_NEWLINE);
           vty_out (vty, "Advertising Router: %s%s",
                    inet_ntoa (lsa->data->adv_router), VTY_NEWLINE);
           vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE);
           vty_out (vty, "%s", VTY_NEWLINE);
         }
     }      }
 }  }
   
Line 5422  DEFUN (ip_ospf_priority, Line 5404  DEFUN (ip_ospf_priority,
        "Address of interface")         "Address of interface")
 {  {
   struct interface *ifp = vty->index;    struct interface *ifp = vty->index;
  u_int32_t priority;  long priority;
   struct route_node *rn;    struct route_node *rn;
   struct in_addr addr;    struct in_addr addr;
   int ret;    int ret;
Line 5824  DEFUN (ospf_redistribute_source_metric_type, Line 5806  DEFUN (ospf_redistribute_source_metric_type,
   int metric = -1;    int metric = -1;
   
   /* Get distribute source. */    /* Get distribute source. */
  if (!str2distribute_source (argv[0], &source))  source = proto_redistnum(AFI_IP, argv[0]);
   if (source < 0 || source == ZEBRA_ROUTE_OSPF)
     return CMD_WARNING;      return CMD_WARNING;
   
   /* Get metric value. */    /* Get metric value. */
Line 5885  DEFUN (ospf_redistribute_source_type_metric, Line 5868  DEFUN (ospf_redistribute_source_type_metric,
   int metric = -1;    int metric = -1;
   
   /* Get distribute source. */    /* Get distribute source. */
  if (!str2distribute_source (argv[0], &source))  source = proto_redistnum(AFI_IP, argv[0]);
   if (source < 0 || source == ZEBRA_ROUTE_OSPF)
     return CMD_WARNING;      return CMD_WARNING;
   
   /* Get metric value. */    /* Get metric value. */
Line 5949  DEFUN (ospf_redistribute_source_metric_routemap, Line 5933  DEFUN (ospf_redistribute_source_metric_routemap,
   int metric = -1;    int metric = -1;
   
   /* Get distribute source. */    /* Get distribute source. */
  if (!str2distribute_source (argv[0], &source))  source = proto_redistnum(AFI_IP, argv[0]);
   if (source < 0 || source == ZEBRA_ROUTE_OSPF)
     return CMD_WARNING;      return CMD_WARNING;
   
   /* Get metric value. */    /* Get metric value. */
Line 5982  DEFUN (ospf_redistribute_source_type_routemap, Line 5967  DEFUN (ospf_redistribute_source_type_routemap,
   int type = -1;    int type = -1;
   
   /* Get distribute source. */    /* Get distribute source. */
  if (!str2distribute_source (argv[0], &source))  source = proto_redistnum(AFI_IP, argv[0]);
   if (source < 0 || source == ZEBRA_ROUTE_OSPF)
     return CMD_WARNING;      return CMD_WARNING;
   
   /* Get metric value. */    /* Get metric value. */
Line 6010  DEFUN (ospf_redistribute_source_routemap, Line 5996  DEFUN (ospf_redistribute_source_routemap,
   int source;    int source;
   
   /* Get distribute source. */    /* Get distribute source. */
  if (!str2distribute_source (argv[0], &source))  source = proto_redistnum(AFI_IP, argv[0]);
   if (source < 0 || source == ZEBRA_ROUTE_OSPF)
     return CMD_WARNING;      return CMD_WARNING;
   
   if (argc == 2)    if (argc == 2)
Line 6031  DEFUN (no_ospf_redistribute_source, Line 6018  DEFUN (no_ospf_redistribute_source,
   struct ospf *ospf = vty->index;    struct ospf *ospf = vty->index;
   int source;    int source;
   
  if (!str2distribute_source (argv[0], &source))  source = proto_redistnum(AFI_IP, argv[0]);
   if (source < 0 || source == ZEBRA_ROUTE_OSPF)
     return CMD_WARNING;      return CMD_WARNING;
   
   ospf_routemap_unset (ospf, source);    ospf_routemap_unset (ospf, source);
Line 6050  DEFUN (ospf_distribute_list_out, Line 6038  DEFUN (ospf_distribute_list_out,
   int source;    int source;
   
   /* Get distribute source. */    /* Get distribute source. */
  if (!str2distribute_source (argv[1], &source))  source = proto_redistnum(AFI_IP, argv[1]);
   if (source < 0 || source == ZEBRA_ROUTE_OSPF)
     return CMD_WARNING;      return CMD_WARNING;
   
   return ospf_distribute_list_out_set (ospf, source, argv[0]);    return ospf_distribute_list_out_set (ospf, source, argv[0]);
Line 6068  DEFUN (no_ospf_distribute_list_out, Line 6057  DEFUN (no_ospf_distribute_list_out,
   struct ospf *ospf = vty->index;    struct ospf *ospf = vty->index;
   int source;    int source;
   
  if (!str2distribute_source (argv[1], &source))  source = proto_redistnum(AFI_IP, argv[1]);
   if (source < 0 || source == ZEBRA_ROUTE_OSPF)
     return CMD_WARNING;      return CMD_WARNING;
   
   return ospf_distribute_list_out_unset (ospf, source, argv[0]);    return ospf_distribute_list_out_unset (ospf, source, argv[0]);
Line 7031  DEFUN (ospf_max_metric_router_lsa_admin, Line 7021  DEFUN (ospf_max_metric_router_lsa_admin,
       if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED))        if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED))
           ospf_router_lsa_update_area (area);            ospf_router_lsa_update_area (area);
     }      }
   
     /* Allows for areas configured later to get the property */
     ospf->stub_router_admin_set = OSPF_STUB_ROUTER_ADMINISTRATIVE_SET;
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
Line 7058  DEFUN (no_ospf_max_metric_router_lsa_admin, Line 7052  DEFUN (no_ospf_max_metric_router_lsa_admin,
           ospf_router_lsa_update_area (area);            ospf_router_lsa_update_area (area);
         }          }
     }      }
     ospf->stub_router_admin_set = OSPF_STUB_ROUTER_ADMINISTRATIVE_UNSET;
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   

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


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