mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +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
|
@ -95,7 +95,7 @@ protected:
|
|||
// Returns true if the checksum is valid, false if not (and in which
|
||||
// case also updates the status history of the endpoint).
|
||||
bool ValidateChecksum(const struct tcphdr* tp, TCP_Endpoint* endpoint,
|
||||
int len, int caplen);
|
||||
int len, int caplen, bool ipv4);
|
||||
|
||||
void SetPartialStatus(TCP_Flags flags, bool is_orig);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue