diff options
author | João Valverde <j@v6e.pt> | 2023-01-02 01:42:55 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2023-01-02 02:54:38 +0000 |
commit | f37c7c4062db513bd4dc6fffa36a0c90c74a4339 (patch) | |
tree | ed985dcb6337e44dcb7d8d7cc275fc6af629d852 /epan/dfilter | |
parent | c762d8492bea567241268d5bcbff64b8ded7596a (diff) |
dfilter: Tweak representation for length-1 byte array
Make dfilter byte representation always use ':' for consistency.
Make 1 byte be represented as "XX:" with the colon suffix to
make it nonambiguous that is is a byte and not other type,
like a protocol.
The difference is can be seen in the following programs. In the
before representation it is not obvious at all that the second
"fc" value is a literal bytes value and not the value of the
protocol "fc", although it can be inferred from the lack of
a READ_TREE instruction. In the After we know that "fc:" must
be bytes and not a protocol.
Note that a leading colon is a syntactical expedient to say
"this value with any type is a literal value and not a protocol
field." A terminating colon is just a part of the dfilter
literal bytes syntax.
Before:
Filter: fc == :fc
Syntax tree:
0 TEST_ANY_EQ:
1 FIELD(fc <FT_PROTOCOL>)
1 FVALUE(fc <FT_PROTOCOL>)
Instructions:
00000 READ_TREE fc <FT_PROTOCOL> -> reg#0
00001 IF_FALSE_GOTO 3
00002 ANY_EQ reg#0 == fc <FT_PROTOCOL>
After:
Filter: fc == :fc
Syntax tree:
0 TEST_ANY_EQ:
1 FIELD(fc <FT_PROTOCOL>)
1 FVALUE(fc: <FT_PROTOCOL>)
Instructions:
00000 READ_TREE fc <FT_PROTOCOL> -> reg#0
00001 IF_FALSE_GOTO 3
00002 ANY_EQ reg#0 == fc: <FT_PROTOCOL>
Diffstat (limited to 'epan/dfilter')
-rw-r--r-- | epan/dfilter/scanner.l | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/dfilter/scanner.l b/epan/dfilter/scanner.l index a273e99d81..1943f2acc4 100644 --- a/epan/dfilter/scanner.l +++ b/epan/dfilter/scanner.l @@ -121,7 +121,7 @@ IPv6Address ({h16}:){6}{ls32}|::({h16}:){5}{ls32}|({h16})?::({h16}:){4}{ls32}|(( V4CidrPrefix \/[[:digit:]]{1,2} V6CidrPrefix \/[[:digit:]]{1,3} -ColonBytes {hex2}(:{hex2})+ +ColonBytes ({hex2}:)|({hex2}(:{hex2})+) DotBytes {hex2}(\.{hex2})+ HyphenBytes {hex2}(-{hex2})+ |