From 423bb070d372341aa178849a9479099b95c7d352 Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Wed, 13 Jul 2016 01:01:53 +0300 Subject: trafgen: proto: Add ICMPv4 header generation Support for generating ICMPv4 headers using the 'icmp4()/icmpv4()' trafgen generation functions. Fields supported: type Set type field (default 0: Echo reply) Supported keywords: echorequest, echoreply code Set code field (default 0) csum Set checksum field (calculated by default) mtu Set mtu field for destination unreachable (default 0) seq Set sequence field (default 0) id Set identifier field (default 0) addr Set redirect address (default 0.0.0.0) Example (send ping request): { icmpv4(echorequest, seq=1, id=1326) } Signed-off-by: Vadim Kochan [tk: squash commits, consistency between functionality and docu] Signed-off-by: Tobias Klauser --- trafgen_lexer.l | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'trafgen_lexer.l') diff --git a/trafgen_lexer.l b/trafgen_lexer.l index 87db504..5873eec 100644 --- a/trafgen_lexer.l +++ b/trafgen_lexer.l @@ -162,6 +162,11 @@ ip6_addr (({a_hex}?:)?({a_hex}?:)?({a_hex}?:)?({a_hex}?:)?({a_hex}?:)?({a_hex}?: "nh"|"nexthdr" { return K_NEXT_HDR; } "hl"|"hoplimit" { return K_HOP_LIMIT; } + + /* ICMPv4 */ +"addr" { return K_ADDR; } +"mtu" { return K_MTU; } + /* ICMPv6 */ "code" { return K_CODE; } "echorequest" { return K_ECHO_REQUEST; } @@ -192,6 +197,7 @@ ip6_addr (({a_hex}?:)?({a_hex}?:)?({a_hex}?:)?({a_hex}?:)?({a_hex}?:)?({a_hex}?: "arp" { return K_ARP; } "ip4"|"ipv4" { return K_IP4; } "ip6"|"ipv6" { return K_IP6; } +"icmp4"|"icmpv4" { return K_ICMP4; } "icmp6"|"icmpv6" { return K_ICMP6; } "udp" { return K_UDP; } "tcp" { return K_TCP; } -- cgit v1.2.3-54-g00ecf