From 52b1f5dd3c60aa008e0538d7f8abda4727b6a9df Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 1 Feb 2016 17:45:39 +0100 Subject: trafgen: parser: Fix parsing of "prot[o]" field in eth() Commit 2ba202b introduced the [e]type field for specifiying the Ethertype, but at the same time made the existing "prot[o]" field name not work anymore. Fix it by providing a specific parser rule as it cannot be solved in the lexer grammar alone (which will always use the first matching token). Fixes: 2ba202b ("trafgen: parser: Support "etype"/"type" keywords for Ethertype") Reported-by: Vadim Kochan Signed-off-by: Tobias Klauser --- trafgen_lexer.l | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'trafgen_lexer.l') diff --git a/trafgen_lexer.l b/trafgen_lexer.l index 83e7602..ef7ec2a 100644 --- a/trafgen_lexer.l +++ b/trafgen_lexer.l @@ -105,13 +105,12 @@ ip4_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; } -[e]?"type"|"prot"[o]? { return K_ETYPE; } +[e]?"type" { return K_ETYPE; } /* ARP */ "sha"|"smac" { return K_SHA; } -- cgit v1.2.3-54-g00ecf