Add explanation about 'drnd' and 'dinc' functions which might
be used for proto field functions.

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

diff --git a/trafgen.8 b/trafgen.8
index c958794..d8ff36f 100644
--- a/trafgen.8
+++ b/trafgen.8
@@ -284,6 +284,49 @@ If a field is not specified, then a default value will be 
used (usually 0).
 Protocol fields might be set in any order. However, the offset of the fields in
 the resulting packet is according to the respective protocol.
+Each field might be set with a function which generates field value at runtime 
+increment or randomize it. For L3/L4 protocols the checksum is calculated 
+if the field was changed dynamically by specified function.  The following 
+functions are supported: +4
+.B dinc
+- increment field value at runtime. By default increment step is '1'.
+.B min
+.B max
+parameters are used to increment field only in the specified range, by default 
+field value is used. If the field length is greater than 4 then last 4 bytes 
+incremented only (useful for MAC and IPv6 addresses): +4
+<field> = dinc() | dinc(min, max) | dinc(min, max, step) -4
+.B drnd
+- randomize field value at runtime.
+.B min
+.B max
+parameters are used to randomize field only in the specified range: +4
+<field> = drnd() | drnd(min, max) -4
+Example of using dynamic functions:
+{ +2
+    eth(saddr=aa:bb:cc:dd:ee:ff, saddr=dinc()),
+    ipv4(saddr=dinc()),
+    udp(sport=dinc(1, 13, 2), dport=drnd(80, 100)) -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