Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
6ae4da98
Commit
6ae4da98
authored
Nov 11, 2015
by
Francis Dupont
Browse files
[4088fd] Moved option code range check to the parser, freeing INTEGER tokens
parent
4730bc64
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/lib/eval/lexer.cc
View file @
6ae4da98
...
...
@@ -478,14 +478,14 @@ struct yy_trans_info
flex_int32_t
yy_verify
;
flex_int32_t
yy_nxt
;
};
static
yyconst
flex_int16_t
yy_accept
[
5
5
]
=
static
yyconst
flex_int16_t
yy_accept
[
5
6
]
=
{
0
,
0
,
0
,
19
,
17
,
1
,
2
,
17
,
12
,
13
,
16
,
7
,
7
,
17
,
14
,
15
,
17
,
17
,
17
,
1
,
2
,
0
,
5
,
0
,
0
,
0
,
7
,
0
,
8
,
0
,
0
,
0
,
3
,
0
,
6
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
4
,
0
,
0
,
0
,
9
,
0
,
0
,
0
,
0
,
0
,
11
,
10
,
0
17
,
7
,
7
,
17
,
14
,
15
,
17
,
17
,
17
,
1
,
2
,
0
,
5
,
0
,
0
,
0
,
7
,
0
,
8
,
0
,
0
,
0
,
3
,
0
,
6
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
4
,
0
,
0
,
0
,
9
,
0
,
0
,
0
,
0
,
0
,
11
,
10
,
0
}
;
static
yyconst
flex_int32_t
yy_ec
[
256
]
=
...
...
@@ -528,58 +528,58 @@ static yyconst flex_int32_t yy_meta[32] =
1
}
;
static
yyconst
flex_int16_t
yy_base
[
5
7
]
=
static
yyconst
flex_int16_t
yy_base
[
5
8
]
=
{
0
,
0
,
0
,
8
4
,
8
5
,
8
1
,
79
,
28
,
8
5
,
8
5
,
8
5
,
2
5
,
3
1
,
69
,
85
,
8
5
,
54
,
49
,
5
4
,
7
5
,
7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
4
,
5
4
,
5
4
,
5
4
,
5
4
,
5
4
,
5
4
,
5
4
1
,
7
,
11
,
11
,
26
,
7
,
7
,
7
,
1
2
,
12
,
1
3
,
1
3
,
24
,
1
2
,
7
,
2
5
,
3
4
,
2
4
,
24
,
57
,
2
5
,
25
,
5
2
,
26
,
27
,
27
,
51
,
50
,
4
9
,
4
8
,
4
6
,
45
,
44
,
4
2
,
41
,
3
4
,
56
,
40
,
56
,
3
9
,
3
8
,
3
7
,
3
6
,
3
2
,
3
1
,
3
0
,
22
,
2
1
,
20
,
1
9
,
1
8
,
17
,
14
,
6
,
5
,
3
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
5
5
,
55
,
55
}
;
/* Table of booleans, true if rule could match eol. */
...
...
@@ -595,8 +595,8 @@ int yy_flex_debug = 1;
static
yyconst
flex_int16_t
yy_rule_linenum
[
18
]
=
{
0
,
83
,
87
,
93
,
101
,
107
,
117
,
123
,
1
46
,
1
47
,
1
48
,
14
9
,
15
0
,
1
5
1
,
1
5
2
,
1
5
3
,
1
5
4
,
1
56
83
,
87
,
93
,
101
,
107
,
117
,
123
,
1
37
,
1
38
,
1
39
,
140
,
1
4
1
,
1
4
2
,
1
4
3
,
1
4
4
,
1
45
,
147
}
;
/* The intent behind this definition is that it'll catch
...
...
@@ -975,13 +975,13 @@ yy_match:
while
(
yy_chk
[
yy_base
[
yy_current_state
]
+
yy_c
]
!=
yy_current_state
)
{
yy_current_state
=
(
int
)
yy_def
[
yy_current_state
];
if
(
yy_current_state
>=
5
5
)
if
(
yy_current_state
>=
5
6
)
yy_c
=
yy_meta
[(
unsigned
int
)
yy_c
];
}
yy_current_state
=
yy_nxt
[
yy_base
[
yy_current_state
]
+
(
unsigned
int
)
yy_c
];
++
yy_cp
;
}
while
(
yy_current_state
!=
5
4
);
while
(
yy_current_state
!=
5
5
);
yy_cp
=
(
yy_last_accepting_cpos
);
yy_current_state
=
(
yy_last_accepting_state
);
...
...
@@ -1096,88 +1096,79 @@ case 7:
YY_RULE_SETUP
#line 123 "lexer.ll"
{
// A
code (16 bit unsigned
integer
)
was found.
// A
n
integer was found.
std
::
string
tmp
(
yytext
);
int
n
;
try
{
n
=
boost
::
lexical_cast
<
int
>
(
tmp
);
}
catch
(
const
boost
::
bad_lexical_cast
&
)
{
driver
.
error
(
loc
,
"Failed to convert specified option code to "
"number in "
+
tmp
+
"."
);
driver
.
error
(
loc
,
"Failed to convert "
+
tmp
+
" to an integer."
);
}
// 65535 is the maximum value of the option code in DHCPv6. We want the
// code to be the same for v4 and v6, so let's ignore for a moment that
// max. option code in DHCPv4 is 255.
if
(
n
<
0
||
n
>
65535
)
{
driver
.
error
(
loc
,
"Option code has invalid value in "
+
std
::
string
(
yytext
)
+
". Allowed range: 0..65535"
);
}
return
isc
::
eval
::
EvalParser
::
make_CODE
(
static_cast
<
uint16_t
>
(
n
),
loc
);
return
isc
::
eval
::
EvalParser
::
make_INTEGER
(
n
,
loc
);
}
YY_BREAK
case
8
:
YY_RULE_SETUP
#line 1
46
"lexer.ll"
#line 1
37
"lexer.ll"
return
isc
::
eval
::
EvalParser
::
make_EQUAL
(
loc
);
YY_BREAK
case
9
:
YY_RULE_SETUP
#line 1
47
"lexer.ll"
#line 1
38
"lexer.ll"
return
isc
::
eval
::
EvalParser
::
make_OPTION
(
loc
);
YY_BREAK
case
10
:
YY_RULE_SETUP
#line 1
48
"lexer.ll"
#line 1
39
"lexer.ll"
return
isc
::
eval
::
EvalParser
::
make_SUBSTRING
(
loc
);
YY_BREAK
case
11
:
YY_RULE_SETUP
#line 14
9
"lexer.ll"
#line 14
0
"lexer.ll"
return
isc
::
eval
::
EvalParser
::
make_UNTYPED
(
loc
);
YY_BREAK
case
12
:
YY_RULE_SETUP
#line 1
50
"lexer.ll"
#line 1
41
"lexer.ll"
return
isc
::
eval
::
EvalParser
::
make_LPAREN
(
loc
);
YY_BREAK
case
13
:
YY_RULE_SETUP
#line 1
51
"lexer.ll"
#line 1
42
"lexer.ll"
return
isc
::
eval
::
EvalParser
::
make_RPAREN
(
loc
);
YY_BREAK
case
14
:
YY_RULE_SETUP
#line 1
52
"lexer.ll"
#line 1
43
"lexer.ll"
return
isc
::
eval
::
EvalParser
::
make_LBRACKET
(
loc
);
YY_BREAK
case
15
:
YY_RULE_SETUP
#line 1
53
"lexer.ll"
#line 1
44
"lexer.ll"
return
isc
::
eval
::
EvalParser
::
make_RBRACKET
(
loc
);
YY_BREAK
case
16
:
YY_RULE_SETUP
#line 1
5
4 "lexer.ll"
#line 14
5
"lexer.ll"
return
isc
::
eval
::
EvalParser
::
make_COMA
(
loc
);
YY_BREAK
case
17
:
YY_RULE_SETUP
#line 1
56
"lexer.ll"
#line 1
47
"lexer.ll"
driver
.
error
(
loc
,
"Invalid character: "
+
std
::
string
(
yytext
));
YY_BREAK
case
YY_STATE_EOF
(
INITIAL
):
#line 1
57
"lexer.ll"
#line 1
48
"lexer.ll"
return
isc
::
eval
::
EvalParser
::
make_END
(
loc
);
YY_BREAK
case
18
:
YY_RULE_SETUP
#line 1
58
"lexer.ll"
#line 1
49
"lexer.ll"
ECHO
;
YY_BREAK
#line 11
81
"lexer.cc"
#line 11
72
"lexer.cc"
case
YY_END_OF_BUFFER
:
{
...
...
@@ -1490,7 +1481,7 @@ static int yy_get_next_buffer (void)
while
(
yy_chk
[
yy_base
[
yy_current_state
]
+
yy_c
]
!=
yy_current_state
)
{
yy_current_state
=
(
int
)
yy_def
[
yy_current_state
];
if
(
yy_current_state
>=
5
5
)
if
(
yy_current_state
>=
5
6
)
yy_c
=
yy_meta
[(
unsigned
int
)
yy_c
];
}
yy_current_state
=
yy_nxt
[
yy_base
[
yy_current_state
]
+
(
unsigned
int
)
yy_c
];
...
...
@@ -1523,11 +1514,11 @@ static int yy_get_next_buffer (void)
while
(
yy_chk
[
yy_base
[
yy_current_state
]
+
yy_c
]
!=
yy_current_state
)
{
yy_current_state
=
(
int
)
yy_def
[
yy_current_state
];
if
(
yy_current_state
>=
5
5
)
if
(
yy_current_state
>=
5
6
)
yy_c
=
yy_meta
[(
unsigned
int
)
yy_c
];
}
yy_current_state
=
yy_nxt
[
yy_base
[
yy_current_state
]
+
(
unsigned
int
)
yy_c
];
yy_is_jam
=
(
yy_current_state
==
5
4
);
yy_is_jam
=
(
yy_current_state
==
5
5
);
return
yy_is_jam
?
0
:
yy_current_state
;
}
...
...
@@ -2265,7 +2256,7 @@ void yyfree (void * ptr )
/* %ok-for-header */
#line 1
58
"lexer.ll"
#line 1
49
"lexer.ll"
...
...
src/lib/eval/lexer.ll
View file @
6ae4da98
...
...
@@ -62,7 +62,7 @@ static isc::eval::location loc;
/
*
These
are
not
token
expressions
yet
,
just
convenience
expressions
that
can
be
used
during
actual
token
definitions
.
*
/
int
[
0-9
]
+
int
\-?
[
0-9
]
+
hex
[
0-9
a-fA-F
]
+
blank
[
\t
]
...
...
@@ -90,7 +90,7 @@ blank [ \t]
loc
.
step
()
;
}
\'
\-?
{
int
}
\'
{
\'
{
int
}
\'
{
//
A
string
containing
a
number
.
Quotes
should
be
removed
,
see
below
.
std:
:string
tmp
(
yytext+
1
)
;
tmp
.
resize
(
tmp
.
size
()
-
1
)
;
...
...
@@ -121,26 +121,17 @@ blank [ \t]
}
{
int
}
{
//
A
code
(
16
bit
unsigned
integer
)
was
found
.
//
A
n
integer
was
found
.
std:
:string
tmp
(
yytext
)
;
int
n
;
try
{
n
=
boost:
:lexical_cast
<
int
>(
tmp
)
;
}
catch
(
const
boost:
:bad_lexical_cast
&
)
{
driver
.
error
(
loc
,
"Failed to convert specified option code to "
"number in "
+
tmp
+
"."
)
;
driver
.
error
(
loc
,
"Failed to convert "
+
tmp
+
" to an integer."
)
;
}
//
65535
is
the
maximum
value
of
the
option
code
in
DHCPv6
.
We
want
the
//
code
to
be
the
same
for
v4
and
v6
,
so
let's
ignore
for
a
moment
that
//
max
.
option
code
in
DHCPv4
is
255
.
if
(
n
<
0
||
n
>
65535
)
{
driver
.
error
(
loc
,
"Option code has invalid value in "
+
std:
:string
(
yytext
)
+
". Allowed range: 0..65535"
)
;
}
return
isc:
:
eval:
:
EvalParser:
:make_CODE
(
static_cast
<
uint16_t
>(
n
),
loc
)
;
return
isc:
:
eval:
:
EvalParser:
:make_INTEGER
(
n
,
loc
)
;
}
"=="
return
isc:
:
eval:
:
EvalParser:
:make_EQUAL
(
loc
)
;
...
...
src/lib/eval/parser.cc
View file @
6ae4da98
...
...
@@ -251,6 +251,10 @@ namespace isc { namespace eval {
{
switch
(
that
.
type_get
())
{
case
16
:
// "integer"
value
.
move
<
int
>
(
that
.
value
);
break
;
case
12
:
// "a number in a constant string"
case
13
:
// "the all constant string"
case
14
:
// "constant string"
...
...
@@ -258,10 +262,6 @@ namespace isc { namespace eval {
value
.
move
<
std
::
string
>
(
that
.
value
);
break
;
case
16
:
// "option code"
value
.
move
<
uint16_t
>
(
that
.
value
);
break
;
default:
break
;
}
...
...
@@ -277,6 +277,10 @@ namespace isc { namespace eval {
state
=
that
.
state
;
switch
(
that
.
type_get
())
{
case
16
:
// "integer"
value
.
copy
<
int
>
(
that
.
value
);
break
;
case
12
:
// "a number in a constant string"
case
13
:
// "the all constant string"
case
14
:
// "constant string"
...
...
@@ -284,10 +288,6 @@ namespace isc { namespace eval {
value
.
copy
<
std
::
string
>
(
that
.
value
);
break
;
case
16
:
// "option code"
value
.
copy
<
uint16_t
>
(
that
.
value
);
break
;
default:
break
;
}
...
...
@@ -352,10 +352,10 @@ namespace isc { namespace eval {
#line 353 "parser.cc" // lalr1.cc:636
break
;
case
16
:
// "
option code
"
case
16
:
// "
integer
"
#line 59 "parser.yy" // lalr1.cc:636
{
yyoutput
<<
yysym
.
value
.
template
as
<
u
int
16_t
>
();
}
{
yyoutput
<<
yysym
.
value
.
template
as
<
int
>
();
}
#line 360 "parser.cc" // lalr1.cc:636
break
;
...
...
@@ -556,6 +556,10 @@ namespace isc { namespace eval {
when using variants. */
switch
(
yyr1_
[
yyn
])
{
case
16
:
// "integer"
yylhs
.
value
.
build
<
int
>
();
break
;
case
12
:
// "a number in a constant string"
case
13
:
// "the all constant string"
case
14
:
// "constant string"
...
...
@@ -563,10 +567,6 @@ namespace isc { namespace eval {
yylhs
.
value
.
build
<
std
::
string
>
();
break
;
case
16
:
// "option code"
yylhs
.
value
.
build
<
uint16_t
>
();
break
;
default:
break
;
}
...
...
@@ -632,113 +632,127 @@ namespace isc { namespace eval {
case
10
:
#line 97 "parser.yy" // lalr1.cc:859
{
TokenPtr
opt
(
new
TokenOption
(
yystack_
[
1
].
value
.
as
<
uint16_t
>
()));
int
n
=
yystack_
[
1
].
value
.
as
<
int
>
();
if
(
n
<
0
||
n
>
65535
)
{
std
::
ostringstream
oss
;
oss
<<
"Option code has invalid value in "
<<
n
<<
". Allowed range: 0..65535"
;
ctx
.
error
(
yystack_
[
1
].
location
,
oss
.
str
());
}
TokenPtr
opt
(
new
TokenOption
(
static_cast
<
uint16_t
>
(
n
)));
ctx
.
expression
.
push_back
(
opt
);
}
#line 6
39
"parser.cc" // lalr1.cc:859
#line 6
46
"parser.cc" // lalr1.cc:859
break
;
case
11
:
#line 10
1
"parser.yy" // lalr1.cc:859
#line 10
8
"parser.yy" // lalr1.cc:859
{
TokenPtr
sub
(
new
TokenSubstring
());
ctx
.
expression
.
push_back
(
sub
);
}
#line 6
48
"parser.cc" // lalr1.cc:859
#line 6
55
"parser.cc" // lalr1.cc:859
break
;
case
12
:
#line 1
08
"parser.yy" // lalr1.cc:859
#line 1
15
"parser.yy" // lalr1.cc:859
{
TokenPtr
eq
(
new
TokenEqual
());
ctx
.
expression
.
push_back
(
eq
);
}
#line 6
57
"parser.cc" // lalr1.cc:859
#line 6
64
"parser.cc" // lalr1.cc:859
break
;
case
13
:
#line 1
15
"parser.yy" // lalr1.cc:859
#line 1
22
"parser.yy" // lalr1.cc:859
{
TokenPtr
str
(
new
TokenString
(
yystack_
[
0
].
value
.
as
<
std
::
string
>
()));
ctx
.
expression
.
push_back
(
str
);
}
#line 6
66
"parser.cc" // lalr1.cc:859
#line 6
73
"parser.cc" // lalr1.cc:859
break
;
case
14
:
#line 1
19
"parser.yy" // lalr1.cc:859
#line 1
26
"parser.yy" // lalr1.cc:859
{
TokenPtr
str
(
new
TokenString
(
yystack_
[
0
].
value
.
as
<
std
::
string
>
()));
ctx
.
expression
.
push_back
(
str
);
}
#line 6
75
"parser.cc" // lalr1.cc:859
#line 6
82
"parser.cc" // lalr1.cc:859
break
;
case
15
:
#line 1
2
3 "parser.yy" // lalr1.cc:859
#line 13
0
"parser.yy" // lalr1.cc:859
{
TokenPtr
str
(
new
TokenString
(
"all"
));
ctx
.
expression
.
push_back
(
str
);
}
#line 6
84
"parser.cc" // lalr1.cc:859
#line 6
91
"parser.cc" // lalr1.cc:859
break
;
case
16
:
#line 1
27
"parser.yy" // lalr1.cc:859
#line 1
34
"parser.yy" // lalr1.cc:859
{
TokenPtr
hex
(
new
TokenHexString
(
yystack_
[
0
].
value
.
as
<
std
::
string
>
()));
ctx
.
expression
.
push_back
(
hex
);
}
#line
693
"parser.cc" // lalr1.cc:859
#line
700
"parser.cc" // lalr1.cc:859
break
;
case
17
:
#line 13
1
"parser.yy" // lalr1.cc:859
#line 13
8
"parser.yy" // lalr1.cc:859
{
TokenPtr
opt
(
new
TokenOption
(
yystack_
[
1
].
value
.
as
<
uint16_t
>
()));
int
n
=
yystack_
[
1
].
value
.
as
<
int
>
();
if
(
n
<
0
||
n
>
65535
)
{
std
::
ostringstream
oss
;
oss
<<
"Option code has invalid value in "
<<
n
<<
". Allowed range: 0..65535"
;
ctx
.
error
(
yystack_
[
1
].
location
,
oss
.
str
());
}
TokenPtr
opt
(
new
TokenOption
(
static_cast
<
uint16_t
>
(
n
)));
ctx
.
expression
.
push_back
(
opt
);
}
#line 7
02
"parser.cc" // lalr1.cc:859
#line 7
16
"parser.cc" // lalr1.cc:859
break
;
case
18
:
#line 1
35
"parser.yy" // lalr1.cc:859
#line 1
49
"parser.yy" // lalr1.cc:859
{
TokenPtr
sub
(
new
TokenSubstring
());
ctx
.
expression
.
push_back
(
sub
);
}
#line 7
11
"parser.cc" // lalr1.cc:859
#line 7
25
"parser.cc" // lalr1.cc:859
break
;
case
19
:
#line 1
42
"parser.yy" // lalr1.cc:859
#line 1
56
"parser.yy" // lalr1.cc:859
{
TokenPtr
str
(
new
TokenString
(
yystack_
[
0
].
value
.
as
<
std
::
string
>
()));
ctx
.
expression
.
push_back
(
str
);
}
#line 7
20
"parser.cc" // lalr1.cc:859
#line 7
34
"parser.cc" // lalr1.cc:859
break
;
case
20
:
#line 1
49
"parser.yy" // lalr1.cc:859
#line 1
63
"parser.yy" // lalr1.cc:859
{
TokenPtr
str
(
new
TokenString
(
yystack_
[
0
].
value
.
as
<
std
::
string
>
()));
ctx
.
expression
.
push_back
(
str
);
}
#line 7
29
"parser.cc" // lalr1.cc:859
#line 7
43
"parser.cc" // lalr1.cc:859
break
;
case
21
:
#line 1
53
"parser.yy" // lalr1.cc:859
#line 1
67
"parser.yy" // lalr1.cc:859
{
TokenPtr
str
(
new
TokenString
(
"all"
));
ctx
.
expression
.
push_back
(
str
);
}
#line 7
38
"parser.cc" // lalr1.cc:859
#line 7
52
"parser.cc" // lalr1.cc:859
break
;
#line 7
42
"parser.cc" // lalr1.cc:859
#line 7
56
"parser.cc" // lalr1.cc:859
default:
break
;
}
...
...
@@ -1086,7 +1100,7 @@ namespace isc { namespace eval {
"
\"
substring
\"
"
,
"
\"
untyped:
\"
"
,
"
\"
,
\"
"
,
"
\"
(
\"
"
,
"
\"
)
\"
"
,
"
\"
[
\"
"
,
"
\"
]
\"
"
,
"
\"
a number in a constant string
\"
"
,
"
\"
the all constant string
\"
"
,
"
\"
constant string
\"
"
,
"
\"
constant hexstring
\"
"
,
"
\"
option code
\"
"
,
"$accept"
,
"expression"
,
"
\"
constant hexstring
\"
"
,
"
\"
integer
\"
"
,
"$accept"
,
"expression"
,
"untyped_expr"
,
"token"
,
"bool_expr"
,
"string_expr"
,
"start_expr"
,
"length_expr"
,
YY_NULLPTR
};
...
...
@@ -1096,8 +1110,8 @@ namespace isc { namespace eval {
EvalParser
::
yyrline_
[]
=
{
0
,
68
,
68
,
69
,
73
,
77
,
81
,
85
,
89
,
93
,
97
,
101
,
108
,
115
,
1
19
,
12
3
,
1
27
,
13
1
,
13
5
,
14
2
,
1
49
,
1
53
97
,
108
,
115
,
1
22
,
12
6
,
1
30
,
13
4
,
13
8
,
14
9
,
156
,
1
63
,
1
67
};
// Print the state stack on the debug stream.
...
...
@@ -1132,8 +1146,8 @@ namespace isc { namespace eval {
#line 21 "parser.yy" // lalr1.cc:1167
}
}
// isc::eval
#line 11
36
"parser.cc" // lalr1.cc:1167
#line 1
59
"parser.yy" // lalr1.cc:1168
#line 11
50
"parser.cc" // lalr1.cc:1167
#line 1
73
"parser.yy" // lalr1.cc:1168
void
isc
::
eval
::
EvalParser
::
error
(
const
location_type
&
loc
,
...
...
src/lib/eval/parser.h
View file @
6ae4da98
...
...
@@ -293,14 +293,14 @@ namespace isc { namespace eval {
/// An auxiliary type to compute the largest semantic type.
union
union_type