zeek/testing/btest/core/expired-conn-weird.zeek
Jon Siwek 51e738a1c0 GH-998: Fix Reporter::conn_weird() to handle expired connections
This introduces a new sampling state-map for expired connections to fix
segfaults that previously occured when passing in a `connection` record
to `Reporter::conn_weird()` for which the internal `Connection` object
had already been expired and deleted.  This also introduces a new event
called `expired_conn_weird`, which is similar to `conn_weird`, except
the full `connection` record is no longer available, just the `conn_id`
and UID string.
2020-06-15 12:57:47 -07:00

22 lines
565 B
Text

# @TEST-EXEC: zeek -b -r $TRACES/rdp/rdp-to-ssl.pcap %INPUT >out
# @TEST-EXEC: btest-diff out
redef Weird::sampling_threshold = 2;
event my_event(c: connection)
{
Reporter::conn_weird("test!", c, "test2");
Reporter::conn_weird("test!", c, "test2");
Reporter::conn_weird("test!", c, "test2");
Reporter::conn_weird("test!", c, "test2");
}
event connection_state_remove(c: connection)
{
schedule 1sec { my_event(c) };
}
event expired_conn_weird(name: string, id: conn_id, uid: string, addl: string)
{
print "expired_conn_weird", name, id, uid, addl;
}