summaryrefslogtreecommitdiff
path: root/ospfd/ospf_vty.c
diff options
context:
space:
mode:
authorAvneesh Sachdev <avneesh@opensourcerouting.org>2012-04-11 23:51:08 -0700
committerAvneesh Sachdev <avneesh@opensourcerouting.org>2012-04-11 23:51:08 -0700
commit14d2bbaa3f4aa53152472694c29f336808e47313 (patch)
treee39bdddef4ea53207dd8fb61e1fd6b54d8c7721d /ospfd/ospf_vty.c
parent51d4ef832c1e58150325630e25c442866e5a6cf5 (diff)
parente96b312150d8e376c1ef463793d1929eca3618d5 (diff)
Merge quagga mainline into the google ISIS code.
The steps were: $ git checkout google-is-is $ git merge quagga $ git checkout google-is-is -- isisd # Resolve conflicts in the following: lib/md5.h zebra/rt_netlink.c zebra/zebra_rib.c zebra/zserv.c Note that the content in the isisd directory is left unchanged in the merge. As a result, changes made to isisd as part of the following commits on the quagga mainline are dropped. # 8ced4e82 is the merge base, e96b3121 is the current quagga master $ git log --oneline --reverse 8ced4e82..e96b3121 -- isisd 5574999 isisd: fix crash on "no router isis" (BZ#536) 8998075 isisd: raise hello rate for DIS (BZ#539) 306ca83 isisd: include hash.h, not hash.c b82cdeb delete CVS keywords 2f65867 isisd: indent longopts array b511468 quagga: option "-z" ("--socket <path>") added 05e54ee build: delete .cvsignore files b4e45f6 fix zebra protocol after MP-BGP changes 7fd6cd8 isisd: fix circuit state machine 907fd95 isisd: send proper LSP after DIS election d034aa0 isisd: fix wrong next-hops from SPF c25eaff isisd: unexpected kernel routing table (BZ#544) e6b03b7 isisd: implement MD5 circuit authentication
Diffstat (limited to 'ospfd/ospf_vty.c')
-rw-r--r--ospfd/ospf_vty.c59
1 files changed, 24 insertions, 35 deletions
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 46e7ffa5..97c8e8d6 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -80,8 +80,11 @@ ospf_str2area_id (const char *str, struct in_addr *area_id, int *format)
/* match "<0-4294967295>". */
else
{
+ if (*str == '-')
+ return -1;
+ errno = 0;
ret = strtoul (str, &endptr, 10);
- if (*endptr != '\0' || (ret == ULONG_MAX && errno == ERANGE))
+ if (*endptr != '\0' || errno || ret > UINT32_MAX)
return -1;
area_id->s_addr = htonl (ret);
@@ -93,29 +96,6 @@ ospf_str2area_id (const char *str, struct in_addr *area_id, int *format)
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)
{
/* Sanity check. */
@@ -3761,7 +3741,7 @@ show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
return 0;
}
-/* N.B. This function currently seems to be unused. */
+#if 0
static int
show_as_external_lsa_stdvty (struct ospf_lsa *lsa)
{
@@ -3785,6 +3765,7 @@ show_as_external_lsa_stdvty (struct ospf_lsa *lsa)
return 0;
}
+#endif
/* Show AS-NSSA-LSA detail information. */
static int
@@ -5824,7 +5805,8 @@ DEFUN (ospf_redistribute_source_metric_type,
int metric = -1;
/* 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;
/* Get metric value. */
@@ -5885,7 +5867,8 @@ DEFUN (ospf_redistribute_source_type_metric,
int metric = -1;
/* 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;
/* Get metric value. */
@@ -5949,7 +5932,8 @@ DEFUN (ospf_redistribute_source_metric_routemap,
int metric = -1;
/* 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;
/* Get metric value. */
@@ -5982,7 +5966,8 @@ DEFUN (ospf_redistribute_source_type_routemap,
int type = -1;
/* 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;
/* Get metric value. */
@@ -6010,7 +5995,8 @@ DEFUN (ospf_redistribute_source_routemap,
int 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;
if (argc == 2)
@@ -6031,7 +6017,8 @@ DEFUN (no_ospf_redistribute_source,
struct ospf *ospf = vty->index;
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;
ospf_routemap_unset (ospf, source);
@@ -6050,7 +6037,8 @@ DEFUN (ospf_distribute_list_out,
int 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 ospf_distribute_list_out_set (ospf, source, argv[0]);
@@ -6068,7 +6056,8 @@ DEFUN (no_ospf_distribute_list_out,
struct ospf *ospf = vty->index;
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 ospf_distribute_list_out_unset (ospf, source, argv[0]);
@@ -7902,9 +7891,9 @@ config_write_ospf_distribute (struct vty *vty, struct ospf *ospf)
{
/* distribute-list print. */
for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
- if (ospf->dlist[type].name)
+ if (DISTRIBUTE_NAME (ospf, type))
vty_out (vty, " distribute-list %s out %s%s",
- ospf->dlist[type].name,
+ DISTRIBUTE_NAME (ospf, type),
zebra_route_string(type), VTY_NEWLINE);
/* default-information print. */