Diff for /embedaddon/quagga/ospfd/ospf_vty.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 17:26:12 version 1.1.1.2, 2012/10/09 09:22:29
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 3761  show_as_external_lsa_detail (struct vty *vty, struct o Line 3741  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 3765  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 5824  DEFUN (ospf_redistribute_source_metric_type, Line 5805  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 5867  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 5932  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 5966  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 5995  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 6017  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 6037  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[0]);
   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 6056  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[0]);
   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]);

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


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