From 4f51efe253208cb906a31e75da21a1f718132486 Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Fri, 29 Jan 2016 00:06:27 +0200 Subject: trafgen: parser: Add syntax to build UDP header Add function 'udp()' to generate UDP header. Fields supported: sp|sport UDP source port (default 0) dp|dport UDP destination port (default 0) len|length Length of UDP header + payload (calculated automatically) csum Checksum field (calculated automatically) Example (Echo request): { udp(dport=7) } Signed-off-by: Vadim Kochan Signed-off-by: Tobias Klauser --- trafgen_lexer.l | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'trafgen_lexer.l') diff --git a/trafgen_lexer.l b/trafgen_lexer.l index eeb252f..56011a3 100644 --- a/trafgen_lexer.l +++ b/trafgen_lexer.l @@ -133,9 +133,13 @@ ip_addr ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+) "df" { return K_DF; } "mf" { return K_MF; } +"sp"|"sport" { return K_SPORT; } +"dp"|"dport" { return K_DPORT; } + "eth" { return K_ETH; } "arp" { return K_ARP; } "ip4"|"ipv4" { return K_IP4; } +"udp" { return K_UDP; } [ ]*"-"[ ]* { return '-'; } [ ]*"+"[ ]* { return '+'; } -- cgit v1.2.3-54-g00ecf