summaryrefslogtreecommitdiff
path: root/trafgen_l3.c
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2016-02-01 19:01:35 +0200
committerTobias Klauser <tklauser@distanz.ch>2016-02-02 16:54:47 +0100
commit88b359d2aa7e3a2bcbe166ca39d93cfd7e04ef08 (patch)
tree95b88829a6e0ee18174da5bc31efce7d896c1a9f /trafgen_l3.c
parent47609a34c17979251668c54a4e0895112f5d68bc (diff)
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 <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_l3.c')
-rw-r--r--trafgen_l3.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/trafgen_l3.c b/trafgen_l3.c
index 1771908..5e47a36 100644
--- a/trafgen_l3.c
+++ b/trafgen_l3.c
@@ -35,9 +35,8 @@ static void ipv4_header_init(struct proto_hdr *hdr)
{
struct proto_hdr *lower;
- proto_lower_default_add(PROTO_ETH);
+ lower = proto_lower_default_add(PROTO_ETH);
- lower = proto_current_header();
if (lower->id == PROTO_ETH)
proto_field_set_default_be16(lower, ETH_TYPE, ETH_P_IP);
else if (lower->id == PROTO_IP4)