Skip to content

Commit

Permalink
Emit the packet after calculating TCP checksum
Browse files Browse the repository at this point in the history
This should be the same as the UDP checksum, otherwise calculating the
TCP checksum results in all packets being discarded.
  • Loading branch information
Aaron Sinclair committed Mar 19, 2021
1 parent ae52fc5 commit 97a8f86
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/modules/l4_checksum.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ void L4Checksum::ProcessBatch(Context *ctx, bess::PacketBatch *batch) {
if (verify_)
EmitPacket(ctx, batch->pkts()[i],
(VerifyIpv4TcpChecksum(*ip, *tcp)) ? FORWARD_GATE : FAIL_GATE);
else
tcp->checksum = CalculateIpv4TcpChecksum(*ip, *tcp);
else {
tcp->checksum = CalculateIpv4TcpChecksum(*ip, *tcp);
EmitPacket(ctx, batch->pkts()[i], FORWARD_GATE);
}
}
}
}
Expand Down

0 comments on commit 97a8f86

Please sign in to comment.