diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2016-01-29 14:12:01 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2016-01-29 14:19:47 +0100 |
commit | 2ba202b8320cbec32520d347ac256c2b4caf0458 (patch) | |
tree | 1e1be887468c3a4d5a769f5d1f838537fff86d0c /trafgen_lexer.l | |
parent | 56ce71c166cdfeab7cb503d538fd176ec4548e05 (diff) |
trafgen: parser: Support "etype"/"type" keywords for Ethertype
The IEEE 802.3 standard commonly refers to the field specifying the
upper layer protocol as Ethertype, not protocol. Thus, also support the
keywords "etype" and "type" for this field.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_lexer.l')
-rw-r--r-- | trafgen_lexer.l | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/trafgen_lexer.l b/trafgen_lexer.l index 56011a3..a661922 100644 --- a/trafgen_lexer.l +++ b/trafgen_lexer.l @@ -105,10 +105,15 @@ ip_addr ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+) "const32"|"c32" { return K_CONST32; } "const64"|"c64" { return K_CONST64; } + /* IPv4 proto field (must be before more specific rule for K_ETYPE) */ +"prot"[o]? { return K_PROT; } + + /* Ethernet */ "daddr"|"da" { return K_DADDR; } "saddr"|"sa" { return K_SADDR; } -"prot"[o]? { return K_PROT; } +[e]?"type"|"prot"[o]? { return K_ETYPE; } + /* ARP */ "sha"|"smac" { return K_SHA; } "spa"|"sip" { return K_SPA; } "tha"|"tmac" { return K_THA; } @@ -119,6 +124,7 @@ ip_addr ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+) "htype" { return K_HTYPE; } "ptype" { return K_PTYPE; } + /* IPv4 */ "ihl" { return K_IHL; } "ver"|"version" { return K_VER; } "ttl" { return K_TTL; } @@ -133,6 +139,7 @@ ip_addr ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+) "df" { return K_DF; } "mf" { return K_MF; } + /* UDP */ "sp"|"sport" { return K_SPORT; } "dp"|"dport" { return K_DPORT; } |