mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 15:18:20 +00:00

Previously, a single `icmp_conn` record was built per ICMP "connection" and re-used for all events generated from it. This may have been a historical attempt at performance optimization, but: * By default, Zeek does not load any scripts that handle ICMP events. * The one script Zeek ships with that does handle ICMP events, "detect-traceroute", is already noted as being disabled due to potential performance problems of doing that kind of analysis. * Re-use of the original `icmp_conn` record tends to misreport TTL and length values since they come from original packet instead of the current one. * Even if we chose to still re-use `icmp_conn` records and just fill in a new TTL and length value each packet, a user script could have stored a reference to the record and not be expecting those values to be changed out from underneath them. Now, a new `icmp_info` record is created/populated in all ICMP events and should be used instead of `icmp_conn`. It also removes the orig_h/resp_h fields as those are redundant with what's already available in the connection record.
44 lines
1.7 KiB
Text
44 lines
1.7 KiB
Text
# These tests all check that ICMP6 events get raised with correct arguments.
|
|
|
|
# @TEST-EXEC: zeek -b -r $TRACES/icmp/icmp-destunreach-udp.pcap %INPUT >>output 2>&1
|
|
# @TEST-EXEC: zeek -b -r $TRACES/icmp/icmp-timeexceeded.pcap %INPUT >>output 2>&1
|
|
# @TEST-EXEC: zeek -b -r $TRACES/icmp/icmp-ping.pcap %INPUT >>output 2>&1
|
|
|
|
# @TEST-EXEC: btest-diff output
|
|
|
|
event icmp_sent(c: connection, info: icmp_info)
|
|
{
|
|
print "icmp_sent";
|
|
print " conn_id: " + fmt("%s", c$id);
|
|
print " icmp_info: " + fmt("%s", info);
|
|
}
|
|
|
|
event icmp_echo_request(c: connection, info: icmp_info, id: count, seq: count, payload: string)
|
|
{
|
|
print "icmp_echo_request (id=" + fmt("%d", id) + ", seq=" + fmt("%d", seq) + ", payload=" + payload + ")";
|
|
print " conn_id: " + fmt("%s", c$id);
|
|
print " icmp_info: " + fmt("%s", info);
|
|
}
|
|
|
|
event icmp_echo_reply(c: connection, info: icmp_info, id: count, seq: count, payload: string)
|
|
{
|
|
print "icmp_echo_reply (id=" + fmt("%d", id) + ", seq=" + fmt("%d", seq) + ", payload=" + payload + ")";
|
|
print " conn_id: " + fmt("%s", c$id);
|
|
print " icmp_info: " + fmt("%s", info);
|
|
}
|
|
|
|
event icmp_unreachable(c: connection, info: icmp_info, code: count, context: icmp_context)
|
|
{
|
|
print "icmp_unreachable (code=" + fmt("%d", code) + ")";
|
|
print " conn_id: " + fmt("%s", c$id);
|
|
print " icmp_info: " + fmt("%s", info);
|
|
print " icmp_context: " + fmt("%s", context);
|
|
}
|
|
|
|
event icmp_time_exceeded(c: connection, info: icmp_info, code: count, context: icmp_context)
|
|
{
|
|
print "icmp_time_exceeded (code=" + fmt("%d", code) + ")";
|
|
print " conn_id: " + fmt("%s", c$id);
|
|
print " icmp_info: " + fmt("%s", info);
|
|
print " icmp_context: " + fmt("%s", context);
|
|
}
|