[netsniff-ng] [PATCH v2 01/14] trafgen: proto: Increment proto field at runtime

2016-08-10 Thread Vadim Kochan
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 -

[netsniff-ng] [PATCH v2 04/14] trafgen: icmpv4: Update csum at runtime if needed

2016-08-10 Thread Vadim Kochan
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 +++

[netsniff-ng] [PATCH v2 06/14] trafgen: proto: Improve to find lower header by index

2016-08-10 Thread Vadim Kochan
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

[netsniff-ng] [PATCH v2 00/14] trafgen: Support dinc & drnd for proto fields

2016-08-10 Thread Vadim Kochan
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

[netsniff-ng] [PATCH v2 05/14] trafgen: icmpv6: Update csum at runtime if needed

2016-08-10 Thread Vadim Kochan
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(-)

[netsniff-ng] [PATCH v2 02/14] trafgen: proto: Randomize proto field at runtime

2016-08-10 Thread Vadim Kochan
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

[netsniff-ng] [PATCH v2 12/14] trafgen: parser: Add 'drnd()' function for proto fields

2016-08-10 Thread Vadim Kochan
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

[netsniff-ng] [PATCH v2 10/14] trafgen: parser: Unify proto field value parsing

2016-08-10 Thread Vadim Kochan
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

[netsniff-ng] [PATCH v2 11/14] trafgen: parser: Add support of 'dinc' function for proto fields

2016-08-10 Thread Vadim Kochan
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

[netsniff-ng] [PATCH v2 14/14] trafgen: man: Simplify example of Jasper's UDP packet by proto functions

2016-08-10 Thread Vadim Kochan
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 +++---