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

Signed-off-by: Vadim Kochan <[email protected]>
---
 trafgen.8 | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/trafgen.8 b/trafgen.8
index c958794..1a17113 100644
--- a/trafgen.8
+++ b/trafgen.8
@@ -284,6 +284,38 @@ 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.
 .sp
+Each field might be set with a function which generates field value in a 
specific
+way (increment or randomize). For L3/L4 protocols the checksum is calculated 
automatically
+if the field was changed dynamically by specified function.  The following 
field
+functions are supported:
+.in +4
+.sp
+.B dinc
+- increment field value at runtime. By default increment step is '1'.
+.B min
+and
+.B max
+parameters are used to increment field only in the specified range, by default 
original
+field value is used. If the field length is greater than 4 then last 4 bytes 
are
+incremented only (useful for MAC and IPv6 addresses):
+.in +4
+.sp
+<field> = dinc() | dinc(min, max) | dinc(step, min, max)
+.in -4
+.sp
+.B drnd
+- randomize field value at runtime.
+.B min
+and
+.B max
+parameters are used to randomize field only in the specified range:
+.in +4
+.sp
+<field> = drnd() | drnd(min, max)
+.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
 specified. Each header will be filled with some mimimum required set of fields.
@@ -755,7 +787,7 @@ The above example rewritten using the header generation 
functions:
      # --- ethernet header ---
      eth(da=00:1b:21:3c:9d:f8, da=90:e2:ba:0a:56:b4, proto=0x0800)
      # --- ip header ---
-     ipv4(len=40, id=drnd(2), mf, ttl=64, proto=17, sa=192.168.51.1, 
da=192.168.51.2)
+     ipv4(len=40, id=drnd(), mf, ttl=64, proto=17, sa=192.168.51.1, 
da=192.168.51.2)
      # --- udp header ---
      udp(sport=48054, dport=43514, len=20, csum=0)
      # payload
-- 
2.6.3

-- 
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 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to