summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--trafgen_l2.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/trafgen_l2.c b/trafgen_l2.c
index f09b2a6..866559c 100644
--- a/trafgen_l2.c
+++ b/trafgen_l2.c
@@ -67,11 +67,9 @@ static struct proto_field vlan_fields[] = {
static void vlan_header_init(struct proto_hdr *hdr)
{
- struct proto_hdr *lower;
+ struct proto_hdr *lower = proto_lower_default_add(hdr, PROTO_ETH);
uint16_t lower_etype = 0;
- lower = proto_lower_default_add(hdr, PROTO_ETH);
-
proto_header_fields_add(hdr, vlan_fields, array_size(vlan_fields));
if (lower->ops->id == PROTO_ETH)
@@ -110,9 +108,7 @@ static struct proto_field arp_fields[] = {
static void arp_header_init(struct proto_hdr *hdr)
{
- struct proto_hdr *lower;
-
- lower = proto_lower_default_add(hdr, PROTO_ETH);
+ struct proto_hdr *lower = proto_lower_default_add(hdr, PROTO_ETH);
if (lower->ops->id == PROTO_ETH) {
const uint8_t bcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };