diff options
author | Vadim Kochan <vadim4j@gmail.com> | 2016-01-26 22:25:02 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2016-01-28 16:15:03 +0100 |
commit | 11a7670eb559580885e096216a494d2c96702645 (patch) | |
tree | a6079c3685719dcafcf26719eaf7782b3d9dd09c /trafgen_proto.c | |
parent | 2ab562f1a46ffbc459146420caa86e400fa1b9e2 (diff) |
trafgen: l2: Add Ethernet protocol header generation
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 <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_proto.c')
-rw-r--r-- | trafgen_proto.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/trafgen_proto.c b/trafgen_proto.c index cf2541f..4976e54 100644 --- a/trafgen_proto.c +++ b/trafgen_proto.c @@ -10,6 +10,7 @@ #include "dev.h" #include "xmalloc.h" #include "trafgen_conf.h" +#include "trafgen_l2.h" #include "trafgen_proto.h" #define field_shift_and_mask(f, v) (((v) << (f)->shift) & \ @@ -305,7 +306,7 @@ static void __proto_field_set_dev_mac(struct proto_hdr *hdr, uint32_t fid, ret = device_hw_address(hdr->ctx->dev, mac, sizeof(mac)); if (ret < 0) - panic("Could not get device hw adress\n"); + panic("Could not get device hw address\n"); __proto_field_set_bytes(hdr, fid, mac, is_default, false); } @@ -326,6 +327,8 @@ void protos_init(const char *dev) ctx.dev = dev; + protos_l2_init(); + for (p = registered; p; p = p->next) p->ctx = &ctx; } |