summaryrefslogtreecommitdiff
path: root/trafgen_l2.c
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2017-06-07 22:24:52 +0300
committerTobias Klauser <tklauser@distanz.ch>2017-06-09 15:50:06 +0200
commit78c13b71e196a107eaa4ec00bb40b062929a6a88 (patch)
tree39598c8a9bd49e1a3d13247c288c04ea0778d69d /trafgen_l2.c
parent322deaf9bae5dc87b174c4369e7d00b6bb0bf641 (diff)
trafgen: Allow to generate packets to output pcap file
Add trafgen_dev.c module which provides generic way of reading and writing packets to/from networking device or a pcap file. Also allow to handle output pcap file via '-o, --out, --dev' option. It might be useful in future for testing some link protocols which is not easy to capture (e.g. wlan packets) w/o having some special setup. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tklauser: fix whitespace issues] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_l2.c')
-rw-r--r--trafgen_l2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/trafgen_l2.c b/trafgen_l2.c
index 427ff9b..4858c5f 100644
--- a/trafgen_l2.c
+++ b/trafgen_l2.c
@@ -8,7 +8,9 @@
#include "die.h"
#include "built_in.h"
+#include "linktype.h"
#include "trafgen_l2.h"
+#include "trafgen_dev.h"
#include "trafgen_proto.h"
static struct proto_field eth_fields[] = {
@@ -48,6 +50,8 @@ static void eth_header_init(struct proto_hdr *hdr)
proto_header_fields_add(hdr, eth_fields, array_size(eth_fields));
proto_hdr_field_set_default_dev_mac(hdr, ETH_SRC_ADDR);
+
+ dev_io_link_type_set(proto_dev_get(), LINKTYPE_EN10MB);
}
static const struct proto_ops eth_proto_ops = {