mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Switch one's complement checksum implementation
Borrows the `in_cksum` code from tcpdump, which borrowed from FreeBSD. It handles unaligned data better and also unrolls the inner loop to process 16 two-byte values at a time versus 2 one-byte values at a time in the previous version. Generally measured as ~1.5x faster in a release build. The new API should generally be more amenable to any future optimization explorations since all relevant data blocks are available within a single call rather than spread across multiple.
This commit is contained in:
parent
8feca7291b
commit
d070709c57
12 changed files with 283 additions and 74 deletions
|
@ -165,7 +165,7 @@ public:
|
|||
// WARNING: this is an O(n) operation and potentially very slow.
|
||||
void SizeBufferedData(uint64_t& waiting_on_hole, uint64_t& waiting_on_ack);
|
||||
|
||||
bool ValidChecksum(const struct tcphdr* tp, int len) const;
|
||||
bool ValidChecksum(const struct tcphdr* tp, int len, bool ipv4) const;
|
||||
|
||||
// Called to inform endpoint that it has generated a checksum error.
|
||||
void ChecksumError();
|
||||
|
@ -211,7 +211,6 @@ public:
|
|||
TCP_Reassembler* contents_processor;
|
||||
TCP_Analyzer* tcp_analyzer;
|
||||
FilePtr contents_file;
|
||||
uint32_t checksum_base;
|
||||
|
||||
double start_time, last_time;
|
||||
IPAddr src_addr; // the other endpoint
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue