[netsniff-ng] [RFC 7/7] trafgen: parser: Add syntax to generate DNS header

2017-01-30 Thread Vadim Kochan
Add new syntax for DNS header generation via 'dns()' proto function. The fields are supported: id - 16 bit identifier qr - message is a query(0) or response(1) op|oper - specified kind of query aanswer - authoritative answe

[netsniff-ng] [RFC 6/7] trafgen: l7: Add DNS header generation API

2017-01-30 Thread Vadim Kochan
Add trafgen_l7.c module with DNS proto header generation with support of filling DNS query/answer/authority/additional sections as sub headers. Introcuded new concept as 'sub header' which is needed to easy handle DNS sections which might be added on-demand, and to simplify using sub-header as reg

[netsniff-ng] [RFC 4/7] trafgen: parser: Use proto_field_set_xxx where it is possible

2017-01-30 Thread Vadim Kochan
Use proto_field_set_xxx(field, ...) instead of proto_hdr_field_set_xxx(hdr, fid, ...) to be more generic and do not depent on 'hdr' variable. Signed-off-by: Vadim Kochan --- trafgen_parser.y | 13 ++--- trafgen_proto.c | 5 + trafgen_proto.h | 1 + 3 files changed, 12 insertions

[netsniff-ng] [RFC 1/7] trafgen: parser: Rename bytes -> mac

2017-01-30 Thread Vadim Kochan
Rename token member to as it is used only for MAC address parsing, for dynamic sized bytes array we have an . Signed-off-by: Vadim Kochan --- trafgen_lexer.l | 2 +- trafgen_parser.y | 12 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/trafgen_lexer.l b/trafgen_le

[netsniff-ng] [RFC 0/7] Add DNS proto header support

2017-01-30 Thread Vadim Kochan
Add trafgen_l7.c module with DNS proto header generation with support of filling DNS query/answer/authority/additional sections as sub headers. Introcuded new concept as 'sub header' which is needed to easy handle DNS sections which might be added on-demand, and to simplify using sub-header as reg

[netsniff-ng] [RFC 3/7] trafgen: proto: Allow to set field with variable length

2017-01-30 Thread Vadim Kochan
It is quite tricky to set field value with a variable length (i.e. DNS query name), to make it possible the field needs to be added to header with 'len=0' in that case there will be no any payload allocation, but only while setting the field value the packet will be appended with a real length byte

[netsniff-ng] [RFC 2/7] trafgen: proto: Add 'len' parameter to *_set_bytes(...) functions

2017-01-30 Thread Vadim Kochan
Add 'len' parameter to *_set_bytes(...) functoins to have better control over it. Signed-off-by: Vadim Kochan --- trafgen_l2.c | 6 +++--- trafgen_parser.y | 4 ++-- trafgen_proto.c | 48 trafgen_proto.h | 4 ++-- 4 files changed, 31 inse

[netsniff-ng] [RFC 5/7] str: Add function for converting string into DNS name

2017-01-30 Thread Vadim Kochan
Add str2fqdn for converting hostname string into DNS name notation: www..yy.com -> 3www42yy3com0 Returned string must be freed after use by the caller. Signed-off-by: Vadim Kochan --- str.c | 37 + str.h | 1 + 2 files changed, 38 insertions(+)