summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2007-12-03 19:10:19 +0000
committerFrancis Dupont <fdupont@isc.org>2007-12-03 19:10:19 +0000
commitc54db7086897e80266fed1814705cc0321b4b4f9 (patch)
treeb80599e243ad832a38664071a023538c95d2e687 /common
parent6f76de588439036a7a7a96c5f22d3417fc7dbd9e (diff)
downloadisc-dhcp-c54db7086897e80266fed1814705cc0321b4b4f9.tar.gz
fix dhcp6.status-code success parsing
Diffstat (limited to 'common')
-rw-r--r--common/parse.c19
-rw-r--r--common/tables.c2
2 files changed, 15 insertions, 6 deletions
diff --git a/common/parse.c b/common/parse.c
index befebd75..ba53584f 100644
--- a/common/parse.c
+++ b/common/parse.c
@@ -59,6 +59,7 @@ struct enumeration *find_enumeration (const char *name, int length)
struct enumeration_value *find_enumeration_value (const char *name,
int length,
+ unsigned *widthp,
const char *value)
{
struct enumeration *e;
@@ -66,6 +67,8 @@ struct enumeration_value *find_enumeration_value (const char *name,
e = find_enumeration (name, length);
if (e) {
+ if (widthp != NULL)
+ *widthp = e->width;
for (i = 0; e -> values [i].name; i++) {
if (!strcmp (value, e -> values [i].name))
return &e -> values [i];
@@ -5103,12 +5106,12 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups)
"identifier expected");
goto foo;
}
- e = find_enumeration_value (f, (*fmt) - f, val);
+ e = find_enumeration_value (f, (*fmt) - f, &len, val);
if (!e) {
parse_warn (cfile, "unknown value");
goto foo;
}
- if (!make_const_data (&t, &e -> value, 1, 0, 1, MDL))
+ if (!make_const_data (&t, &e -> value, len, 0, 1, MDL))
return 0;
break;
@@ -5284,6 +5287,12 @@ int parse_option_decl (oc, cfile)
break;
case 't': /* Text string... */
+ token = peek_token (&val,
+ &len, cfile);
+ if (token == SEMI && fmt[1] == 'o') {
+ fmt++;
+ break;
+ }
token = next_token (&val,
&len, cfile);
if (token != STRING) {
@@ -5335,7 +5344,7 @@ int parse_option_decl (oc, cfile)
break;
case 'N':
- f = fmt;
+ f = fmt + 1;
fmt = strchr (fmt, '.');
if (!fmt) {
parse_warn (cfile,
@@ -5350,13 +5359,13 @@ int parse_option_decl (oc, cfile)
"identifier expected");
goto parse_exit;
}
- e = find_enumeration_value (f, fmt - f, val);
+ e = find_enumeration_value (f, fmt - f,
+ &len, val);
if (!e) {
parse_warn (cfile,
"unknown value");
goto parse_exit;
}
- len = 1;
dp = &e -> value;
goto alloc;
diff --git a/common/tables.c b/common/tables.c
index b4e95939..d9cefea9 100644
--- a/common/tables.c
+++ b/common/tables.c
@@ -335,7 +335,7 @@ static struct option dhcpv6_options[] = {
&dhcpv6_universe, 11, 1 },
#endif
{ "unicast", "6", &dhcpv6_universe, 12, 1 },
- { "status-code", "Nstatus-codes.t", &dhcpv6_universe, 13, 1 },
+ { "status-code", "Nstatus-codes.to", &dhcpv6_universe, 13, 1 },
{ "rapid-commit", "", &dhcpv6_universe, 14, 1 },
#if 0
/* XXX: user-class contents are of the form "StA" where the