summaryrefslogtreecommitdiff
path: root/trafgen_l3.c
diff options
context:
space:
mode:
Diffstat (limited to 'trafgen_l3.c')
-rw-r--r--trafgen_l3.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/trafgen_l3.c b/trafgen_l3.c
index 012321f..ad58270 100644
--- a/trafgen_l3.c
+++ b/trafgen_l3.c
@@ -53,10 +53,8 @@ static void ipv4_packet_finish(struct proto_hdr *hdr)
if (!proto_field_is_set(hdr, IP4_CSUM)) {
uint16_t csum;
- uint8_t ihl;
- ihl = proto_field_get_u8(hdr, IP4_IHL);
- csum = htons(calc_csum(&pkt->payload[hdr->pkt_offset], ihl * 4));
+ csum = htons(calc_csum(&pkt->payload[hdr->pkt_offset], hdr->len));
proto_field_set_u16(hdr, IP4_CSUM, bswap_16(csum));
}
}