From 88b359d2aa7e3a2bcbe166ca39d93cfd7e04ef08 Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Mon, 1 Feb 2016 19:01:35 +0200 Subject: trafgen: proto: Simplify getting lower protocol after init Change proto_header_init(...) and proto_lower_default_add(...) functions to return struct proto_hdr * to do not call proto_current_header(...) after, so it makes more sense to get struct proto_hdr * right after initializing protocol by id. Signed-off-by: Vadim Kochan Signed-off-by: Tobias Klauser --- trafgen_l2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'trafgen_l2.c') diff --git a/trafgen_l2.c b/trafgen_l2.c index 60da411..5600c24 100644 --- a/trafgen_l2.c +++ b/trafgen_l2.c @@ -45,9 +45,7 @@ static void arp_header_init(struct proto_hdr *hdr) { struct proto_hdr *lower; - proto_lower_default_add(PROTO_ETH); - - lower = proto_current_header(); + lower = proto_lower_default_add(PROTO_ETH); if (lower->id == PROTO_ETH) { uint8_t bcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -- cgit v1.2.3-54-g00ecf