Add short note about field offset syntax with an example.

Signed-off-by: Vadim Kochan <>
 trafgen.8 | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/trafgen.8 b/trafgen.8
index 62716bb..d669c2a 100644
--- a/trafgen.8
+++ b/trafgen.8
@@ -329,6 +329,31 @@ Example of using dynamic functions:
 .in -4
+Field might be set with a function at a specific offset within a field:
+.sp +4
+<field>[<index>] | <field>[<index>:<length>]
+.sp +4
+<index> - relative field's offset with range 0..<field.len> - 1
+<length> - length/size of the value which will be set - 1,2 or 4 bytes 
(default: 1). -4
+The <index> starts from the 1st field's byte in the network order.
+Example of using field offset:
+{ +2
+    eth(saddr=aa:bb:cc:dd:ee:ff, saddr[0]=dinc()),
+    ipv4(saddr[0:2]=drnd()),
+    udp(), -2
+} -4
 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
 specified. Each header will be filled with some mimimum required set of fields.

You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to