trafgen: ipv4: Do not use user-provided 'ihl' field to calculate csum
commit9ad5ccd66e89778e33cd1be3cd8887ec4a03d177
authorVadim Kochan <vadim4j@gmail.com>
Sat, 16 Jul 2016 09:39:43 +0000 (16 12:39 +0300)
committerTobias Klauser <tklauser@distanz.ch>
Mon, 18 Jul 2016 12:43:45 +0000 (18 14:43 +0200)
treec4e804dd8f4f6795ca505ccd0b0ee69acf1dfe7c
parentc11d67bf8ce5666b454ba34c004c264d5cfae24a
trafgen: ipv4: Do not use user-provided 'ihl' field to calculate csum

It is potentially dangerous to use the user specified IHL field for
csum calculation, as it might lead to read buffer overflows.

Instead introduce and use the len field in struct proto_hdr which is
calculated automatically after the header is built.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
[tk: reword commit message]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
trafgen_l3.c
trafgen_proto.c
trafgen_proto.h