mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00

- Add more guards against trying to analyze captured packets with a truncated IPv6 static header or extension header chain. - Add back in the ICMP payload tracking for ICMP "connections". - Fix 'icmp_context' record construction. Some field assignments were mismatched for ICMP and ICMP6. Source and destination addresses were set incorrectly for context packets that don't contain a full IP header. Some fields for ICMP6 weren't filled out. - Changed ICMP Time Exceeded packets to raise the 'icmp_time_exceeded' event instead of 'icmp_error_message'. - Add unit tests for truncation and the main types of ICMP/ICMP6 that have specific events. - Documentation clarifications.
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: bro -b -r $TRACES/icmp/icmp-destunreach-udp.pcap %INPUT >>output 2>&1
|
|
# @TEST-EXEC: bro -b -r $TRACES/icmp/icmp-timeexceeded.pcap %INPUT >>output 2>&1
|
|
# @TEST-EXEC: bro -b -r $TRACES/icmp/icmp-ping.pcap %INPUT >>output 2>&1
|
|
|
|
# @TEST-EXEC: btest-diff output
|
|
|
|
event icmp_sent(c: connection, icmp: icmp_conn)
|
|
{
|
|
print "icmp_sent";
|
|
print " conn_id: " + fmt("%s", c$id);
|
|
print " icmp_conn: " + fmt("%s", icmp);
|
|
}
|
|
|
|
event icmp_echo_request(c: connection, icmp: icmp_conn, 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_conn: " + fmt("%s", icmp);
|
|
}
|
|
|
|
event icmp_echo_reply(c: connection, icmp: icmp_conn, 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_conn: " + fmt("%s", icmp);
|
|
}
|
|
|
|
event icmp_unreachable(c: connection, icmp: icmp_conn, code: count, context: icmp_context)
|
|
{
|
|
print "icmp_unreachable (code=" + fmt("%d", code) + ")";
|
|
print " conn_id: " + fmt("%s", c$id);
|
|
print " icmp_conn: " + fmt("%s", icmp);
|
|
print " icmp_context: " + fmt("%s", context);
|
|
}
|
|
|
|
event icmp_time_exceeded(c: connection, icmp: icmp_conn, code: count, context: icmp_context)
|
|
{
|
|
print "icmp_time_exceeded (code=" + fmt("%d", code) + ")";
|
|
print " conn_id: " + fmt("%s", c$id);
|
|
print " icmp_conn: " + fmt("%s", icmp);
|
|
print " icmp_context: " + fmt("%s", context);
|
|
}
|