[netsniff-ng] Re: [RFC PATCH] trafgen: proto: Split static protocol definition out of struct proto_hdr

2016-08-12 Thread Tobias Klauser
On 2016-08-11 at 20:11:02 +0200, Vadim Kochan wrote: > On Thu, Aug 11, 2016 at 06:16:27PM +0200, Tobias Klauser wrote: > > Currently struct proto_hdr is used twofold: > > > > 1) Statically define protocol behavior, i.e. all the *_hdr definitions in > >

[netsniff-ng] Re: [PATCH] colorize: Squash into colors.h

2016-08-12 Thread Tobias Klauser
On 2016-08-12 at 00:42:24 +0200, Vadim Kochan wrote: > Move colorize_xxx macroses to colors.h, the reason > is to have one file for coloring stuff and have less > files as possible in the source tree. > > Signed-off-by: Vadim Kochan Applied, thanks! --

[netsniff-ng] [PATCH v3 01/15] trafgen: proto: Update field value at runtime

2016-08-12 Thread Vadim Kochan
Add basic infrastructure for update proto field value at runtime by dynamic field function. Extended 'struct packet_dyn' with proto fields which has dynamically changing values at runtime. Added 'field_changed' callback for proto header which may be used for check if csum updating is needed.

[netsniff-ng] [PATCH v3 08/15] trafgen: proto: Introduce proto_upper_header() function

2016-08-12 Thread Vadim Kochan
Added proto_upper_header() function to fetch upper proto header. It will be used by IPv4/IPv6 proto header to notify UDP/TCP proto headers to invalidate L4 csum when L3 pseudo header field was changed. Signed-off-by: Vadim Kochan --- trafgen_proto.c | 12

[netsniff-ng] [PATCH v3 10/15] trafgen: tcp: Update csum at runtime if it needed

2016-08-12 Thread Vadim Kochan
Update TCP checksum field if any TCP of fields was changed. Use same checksum update function on 'packet_finish' and 'header update'. Set 'is_csum_valid = false' if lower IPv4/IPv6 pseudo header was changed. Signed-off-by: Vadim Kochan --- trafgen_l3.c | 4 ++--

[netsniff-ng] [PATCH v3 07/15] trafgen: proto: Improve to find lower header by index

2016-08-12 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 | 25 +++-- trafgen_proto.h | 1 + 2 files changed, 12 insertions(+), 14 deletions(-) diff

[netsniff-ng] [PATCH v3 11/15] trafgen: parser: Unify proto field value parsing

2016-08-12 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 | 361

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

2016-08-12 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 +++---

[netsniff-ng] [PATCH v3 02/15] trafgen: proto: Increment proto field at runtime

2016-08-12 Thread Vadim Kochan
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 - last 4 bytes are incremented as 4 byte value (this trick is used for increment MAC/IPv6 addresses).

[netsniff-ng] [PATCH v3 14/15] trafgen: man: Add description for 'dinc' and 'drnd' field functions

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

[netsniff-ng] [PATCH v3 04/15] trafgen: ipv4: Update csum at runtime if needed

2016-08-12 Thread Vadim Kochan
Handle 'field_changed' callback to check if IPv4 csum is needed to be recalculated, if so - update it on 'packet_update' event. Added 'is_csum_valid' to proto_hdr struct to check if csum needs to be updated. Signed-off-by: Vadim Kochan --- trafgen_l3.c| 33

[netsniff-ng] [PATCH v3 13/15] trafgen: parser: Add 'drnd()' function for proto fields

2016-08-12 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 v3 06/15] trafgen: icmpv6: Update csum at runtime if needed

2016-08-12 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 | 32 +++- 1 file changed, 19 insertions(+), 13

[netsniff-ng] [PATCH v3 09/15] trafgen: udp: Update csum at runtime if needed

2016-08-12 Thread Vadim Kochan
Update UDP csum field at runtime if: 1) UDP field was changed. 2) IPv4/6 source/destination addresses were changed (which is a part of UDP pseudo header), this is handled by IPv4/6 protocols. Signed-off-by: Vadim Kochan --- trafgen_l3.c | 18

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

2016-08-12 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 v3 03/15] trafgen: proto: Randomize proto field at runtime

2016-08-12 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] tstamping: Move code to the sock.c

2016-08-12 Thread Vadim Kochan
Move hw timestamp enable/disable code to sock.c as it is a socket related functionality, and it makes have less files in source tree. Move tstamping related includes under HAVE_TSTAMPING config to compile them only if hw timestamping is suported. Signed-off-by: Vadim Kochan