Extended 'struct packet_dyn' with proto fields which has
dynamically changing values at runtime.
Implement incrementing of proto field at runtime with min & max
parameters, by default if the 'min' parameter is not specified
then original value is used. For fields which len is greater
than 4 -
Update csum if any of ICMPv4 field was chaned.
Signed-off-by: Vadim Kochan
---
trafgen_l4.c | 20
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/trafgen_l4.c b/trafgen_l4.c
index 79c5914..19ebb37 100644
--- a/trafgen_l4.c
+++
Extended struct proto_hdr with 'index' field which is used for
faster lookup of lower header w/o doing a loop.
Signed-off-by: Vadim Kochan
---
trafgen_proto.c | 26 --
trafgen_proto.h | 1 +
2 files changed, 13 insertions(+), 14 deletions(-)
diff
Implemented 'dinc' and 'drnd' functions to be used for proto fields,
and generate values at runtime. Parsing of proto field values
for unified to make extending of field functions more easier w/o
copy/paste similar rules for each proto field. Instead of that
the field_expr struct is used to keep
Use same function to calculate csum for packet_update
and for packet_finish events.
Allow update csum if one of the ICMPv6 fields was changed.
Signed-off-by: Vadim Kochan
---
trafgen_l4.c | 26 +++---
1 file changed, 15 insertions(+), 11 deletions(-)
Add dynamic proto field function which can generate
random value in specified range (default 0 - MAX_UINT32).
Signed-off-by: Vadim Kochan
---
trafgen_proto.c | 27 +++
trafgen_proto.h | 1 +
2 files changed, 28 insertions(+)
diff --git
Add syntax for specify dynamic random function for proto field:
drnd() | drnd(min, max)
EXAMPLE:
{ udp(sport=drnd()) }
{ udp(sport=drnd(1000, 2000)) }
Signed-off-by: Vadim Kochan
---
trafgen_parser.y | 9 +
1 file changed, 9 insertions(+)
diff --git
Changed parsing logic of field value expression to
be more generic. Such approach will allow to easy
extend field value expression to support dynamic field functions.
Signed-off-by: Vadim Kochan
---
trafgen_parser.y | 358
Add 'dinc()' function in 'field_expr' rules to be used for dynamically
incrementing of any specified field:
SYNTAX := dinc() | dinc(step) | dinc(min, max) | dinc(min, max, step)
EXAMPLES:
{ udp(sport=dinc() }
{ udp(sport=dinc(1) }
{ udp(sport=dinc(100, 125, 5) }
Signed-off-by: Vadim
Removed unneeded fields which are calcuated by default:
Fixed field by changing drnd(2) -> drnd() as proto field
function does not support bytes length value but randomizes
specified field by its length.
Signed-off-by: Vadim Kochan
---
trafgen.8 | 6 +++---
10 matches
Mail list logo