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
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
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
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
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
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
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 +++
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 +
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
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(+)
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.
11 matches
Mail list logo