From 39b95ab409445ee761811e909a1742ad4985ff87 Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Wed, 21 Dec 2016 20:33:33 +0200 Subject: man: trafgen: Add short description about field offset usage Add short note about field offset syntax with an example. Signed-off-by: Vadim Kochan Signed-off-by: Tobias Klauser --- trafgen.8 | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/trafgen.8 b/trafgen.8 index 62716bb..e09b7a0 100644 --- a/trafgen.8 +++ b/trafgen.8 @@ -328,6 +328,50 @@ Example of using dynamic functions: .in -4 +.sp +Fields might be further manipulated with a function at a specific offset: +.sp +.in +4 +[] | [:] +.sp +.in +4 + - relative field offset with range 0.. - 1 +.sp + - length/size of the value which will be set; either 1, 2 or 4 bytes (default: 1) +.in -4 +.sp +The starts from the field's first byte in network order. +.sp +The syntax is similar to the one used in pcap filters (man pcap-filter) for +matching header field at a specified offset. +.sp +Examples of using field offset (showing the effect in a shortenet output from +netsniff-ng): +.sp +.in +4 +1) trafgen -o lo --cpus 1 -n 3 '{ eth(da=11:22:33:44:55:66, da[0]=dinc()), tcp() }' + +.in +4 +[ Eth MAC (00:00:00:00:00:00 => 11:22:33:44:55:66) + +[ Eth MAC (00:00:00:00:00:00 => 12:22:33:44:55:66) + +[ Eth MAC (00:00:00:00:00:00 => 13:22:33:44:55:66) +.in -4 + +2) trafgen -o lo --cpus 1 -n 3 '{ ipv4(da=1.2.3.4, da[0]=dinc()), tcp() }' + +.in +4 +[ IPv4 Addr (127.0.0.1 => 1.2.3.4) + +[ IPv4 Addr (127.0.0.1 => 2.2.3.4) + +[ IPv4 Addr (127.0.0.1 => 3.2.3.4) +.in -4 + +.in -4 +.in -4 + .sp All required lower layer headers will be filled automatically if they were not specified by the user. The headers will be filled in the order they were -- cgit v1.2.3-54-g00ecf