mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 03:58:20 +00:00
Add UDP support to the checksum offload detection script.
This commit is contained in:
parent
08e6b6b4b4
commit
1cfb3a38e0
1 changed files with 15 additions and 1 deletions
|
@ -16,6 +16,7 @@ export {
|
||||||
# Keep track of how many bad checksums have been seen.
|
# Keep track of how many bad checksums have been seen.
|
||||||
global bad_ip_checksums = 0;
|
global bad_ip_checksums = 0;
|
||||||
global bad_tcp_checksums = 0;
|
global bad_tcp_checksums = 0;
|
||||||
|
global bad_udp_checksums = 0;
|
||||||
|
|
||||||
# Track to see if this script is done so that messages aren't created multiple times.
|
# Track to see if this script is done so that messages aren't created multiple times.
|
||||||
global done = F;
|
global done = F;
|
||||||
|
@ -28,7 +29,11 @@ event ChecksumOffloading::check()
|
||||||
local pkts_recvd = net_stats()$pkts_recvd;
|
local pkts_recvd = net_stats()$pkts_recvd;
|
||||||
local bad_ip_checksum_pct = (pkts_recvd != 0) ? (bad_ip_checksums*1.0 / pkts_recvd*1.0) : 0;
|
local bad_ip_checksum_pct = (pkts_recvd != 0) ? (bad_ip_checksums*1.0 / pkts_recvd*1.0) : 0;
|
||||||
local bad_tcp_checksum_pct = (pkts_recvd != 0) ? (bad_tcp_checksums*1.0 / pkts_recvd*1.0) : 0;
|
local bad_tcp_checksum_pct = (pkts_recvd != 0) ? (bad_tcp_checksums*1.0 / pkts_recvd*1.0) : 0;
|
||||||
if ( bad_ip_checksum_pct > 0.05 || bad_tcp_checksum_pct > 0.05 )
|
local bad_udp_checksum_pct = (pkts_recvd != 0) ? (bad_udp_checksums*1.0 / pkts_recvd*1.0) : 0;
|
||||||
|
|
||||||
|
if ( bad_ip_checksum_pct > 0.05 ||
|
||||||
|
bad_tcp_checksum_pct > 0.05 ||
|
||||||
|
bad_udp_checksum_pct > 0.05 )
|
||||||
{
|
{
|
||||||
local packet_src = reading_traces() ? "trace file likely has" : "interface is likely receiving";
|
local packet_src = reading_traces() ? "trace file likely has" : "interface is likely receiving";
|
||||||
local bad_checksum_msg = (bad_ip_checksum_pct > 0.0) ? "IP" : "";
|
local bad_checksum_msg = (bad_ip_checksum_pct > 0.0) ? "IP" : "";
|
||||||
|
@ -38,6 +43,13 @@ event ChecksumOffloading::check()
|
||||||
bad_checksum_msg += " and ";
|
bad_checksum_msg += " and ";
|
||||||
bad_checksum_msg += "TCP";
|
bad_checksum_msg += "TCP";
|
||||||
}
|
}
|
||||||
|
if ( bad_udp_checksum_pct > 0.0 )
|
||||||
|
{
|
||||||
|
if ( |bad_checksum_msg| > 0 )
|
||||||
|
bad_checksum_msg += " and ";
|
||||||
|
bad_checksum_msg += "UDP";
|
||||||
|
}
|
||||||
|
|
||||||
local message = fmt("Your %s invalid %s checksums, most likely from NIC checksum offloading.", packet_src, bad_checksum_msg);
|
local message = fmt("Your %s invalid %s checksums, most likely from NIC checksum offloading.", packet_src, bad_checksum_msg);
|
||||||
Reporter::warning(message);
|
Reporter::warning(message);
|
||||||
done = T;
|
done = T;
|
||||||
|
@ -65,6 +77,8 @@ event conn_weird(name: string, c: connection, addl: string)
|
||||||
{
|
{
|
||||||
if ( name == "bad_TCP_checksum" )
|
if ( name == "bad_TCP_checksum" )
|
||||||
++bad_tcp_checksums;
|
++bad_tcp_checksums;
|
||||||
|
else if ( name == "bad_UDP_checksum" )
|
||||||
|
++bad_udp_checksums;
|
||||||
}
|
}
|
||||||
|
|
||||||
event bro_done()
|
event bro_done()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue