[netsniff-ng] [PATCH 00/13] trafgen: Add proto header generation

2016-01-20 Thread Vadim Kochan
Add new trafgen proto generation framework which allows to describe proto header fields and easy build the proto header by set/get proto header fields value. Meanwhile implemented Ethernet, ARP & IPv4 proto headers generation, with fixed header size. Each proto has its own syntax rules to specify

[netsniff-ng] [PATCH 07/13] str: Add str2mac helper function

2016-01-20 Thread Vadim Kochan
Add func for convert string to MAC address. Signed-off-by: Vadim Kochan --- str.c | 25 + str.h | 1 + 2 files changed, 26 insertions(+) diff --git a/str.c b/str.c index e4d8722..aca069a 100644 --- a/str.c +++ b/str.c @@ -7,6 +7,7 @@ #include

[netsniff-ng] [PATCH 05/13] trafgen: proto: Add func for set device mac to field

2016-01-20 Thread Vadim Kochan
Add helper function for easy set device's MAC address to proto field which may be used by Ethernet & ARP protos generation. Signed-off-by: Vadim Kochan --- trafgen_proto.c | 32 trafgen_proto.h | 3 +++ 2 files changed, 35 insertions(+) diff

[netsniff-ng] [PATCH 02/13] trafgen: Add helper to get current packet

2016-01-20 Thread Vadim Kochan
Add current_packet() helper for getting current used packet and make it public to other modules. It will be used by proto generation logic. Signed-off-by: Vadim Kochan --- trafgen_conf.h | 2 ++ trafgen_parser.y | 5 + 2 files changed, 7 insertions(+) diff --git

[netsniff-ng] [PATCH 12/13] trafgen: l3: Add IPv4 header generation backend

2016-01-20 Thread Vadim Kochan
Add L3 module for implement L3 layer protos generation. Implemented generating of IPv4 header with all fields except options. By default IPv4 address of output device is used as src ip address. On finish (after packet is specified) - total len & checksum is calculated. Meanwhile Ethernet proto

[netsniff-ng] [PATCH 11/13] trafgen: parser: Add syntax to generate ARP header fields

2016-01-20 Thread Vadim Kochan
Add syntax to generate ARP header fields: { arp(op=req, sip=1.1.1.1, smac=11:22:33:44:55:66) } { arp() } Signed-off-by: Vadim Kochan --- trafgen_lexer.l | 15 +++ trafgen_parser.y | 38 +- 2 files changed, 52

[netsniff-ng] [PATCH 06/13] trafgen: l2: Add Ethernet proto header generation

2016-01-20 Thread Vadim Kochan
Add trafgen_l2.c module for generating L2 related headers. Add Ethernet header generating. By default source MAC address is used from the specified output device. Signed-off-by: Vadim Kochan --- trafgen/Makefile | 1 + trafgen_l2.c | 31 +++

[netsniff-ng] [PATCH 10/13] trafgen: l2: Add ARP header generation logic

2016-01-20 Thread Vadim Kochan
Add ARP proto header fields generation via src mac, src ip, dst mac, dst ip & operaion. By default Ethernet proto will be initialized, and ARP probe request is filled. Signed-off-by: Vadim Kochan --- trafgen_l2.c | 45 +

[netsniff-ng] [PATCH 13/13] trafgen: parser: Add syntax for IPv4 proto

2016-01-20 Thread Vadim Kochan
Add syntax to specify IPv4 header fields: { ip(df, mf, frag=100, prot=0x1, ecn=2, dscp=20) } Signed-off-by: Vadim Kochan --- trafgen_lexer.l | 15 +++ trafgen_parser.y | 51 +++ 2 files changed, 66

[netsniff-ng] [PATCH 09/13] trafgen: proto: Add func to fill field with device ipv4 addr

2016-01-20 Thread Vadim Kochan
Add helper which fill device's ipv4 addr to the specified proto field. It will be used by such protos like ARP, IPv4, etc. Signed-off-by: Vadim Kochan --- trafgen_proto.c | 35 +++ trafgen_proto.h | 3 +++ 2 files changed, 38 insertions(+)

[netsniff-ng] [PATCH 08/13] trafgen: parser: Add syntax to generate Ethernet header

2016-01-20 Thread Vadim Kochan
Add syntax for generating Ethernet header fields like: { eth(prot=0x0800, da=11:22:33:44:55:66), fill(0xff, 60) } { eth(prot=0x0800) } { eth() } It is important that proto_init is called before fields will be filled to initialize the specified proto with header fields.