zeek/testing/btest/core/connection_flipped.zeek
Arne Welzel a2214ad611 Conn: In-place val flip and connection_flipped()
Avoids loosing state on a connection value when a connection is flipped.

Fixes up the NTP baseline as well where this was visible: analyzer_confirmation_info()
was raised for a connection value which was immediately forgotten due to
the subsequent connection flipping.

Closed #3028
2023-07-04 20:01:17 +02:00

29 lines
765 B
Text

# @TEST-DOC: A connection flip does not reset the ConnVal. Regression test for #3028.
# @TEST-EXEC: zeek -b -r $TRACES/tcp/handshake-reorder.trace %INPUT >out
# @TEST-EXEC: TEST_DIFF_CANONIFIER= btest-diff out
redef record conn_id += {
extra_id: count &optional;
};
redef record connection += {
my_timestamp: time &optional;
};
event new_connection(c: connection)
{
c$id$extra_id = 42;
c$my_timestamp = network_time();
print network_time(), "new_connection", c$id, c$history, c$my_timestamp;
}
event connection_flipped(c: connection)
{
print network_time(), "connection_flipped", c$id, c$history, c$my_timestamp;
}
event connection_state_remove(c: connection)
{
print network_time(), "connection_state_remove", c$id, c$history, c$my_timestamp;
}