From b1c7f371fa052eb7b0c01bc7e58a3bed9c4a2d66 Mon Sep 17 00:00:00 2001 From: Muhammad Asim Jamshed Date: Thu, 28 May 2020 14:15:35 -0700 Subject: [PATCH] Bypass l4/ip4 csum compute/validate for !tcp/!udp Signed-off-by: Muhammad Asim Jamshed igned-off-by: Saikrishna Edupuganti Signed-off-by: Hyunsun Moon --- core/modules/l4_checksum.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/modules/l4_checksum.cc b/core/modules/l4_checksum.cc index 3ad1f23d6..381eca821 100644 --- a/core/modules/l4_checksum.cc +++ b/core/modules/l4_checksum.cc @@ -76,8 +76,12 @@ void L4Checksum::ProcessBatch(Context *ctx, bess::PacketBatch *batch) { if (verify_) EmitPacket(ctx, batch->pkts()[i], (VerifyIpv4TcpChecksum(*ip, *tcp)) ? FORWARD_GATE : FAIL_GATE); - else + else { tcp->checksum = CalculateIpv4TcpChecksum(*ip, *tcp); + EmitPacket(ctx, batch->pkts()[i], FORWARD_GATE); + } + } else { /* fail-safe condition. */ + EmitPacket(ctx, batch->pkts()[i], FORWARD_GATE); } } }