Last active
January 2, 2016 22:28
-
-
Save sethhall/b85d48e4edab57e84fc0 to your computer and use it in GitHub Desktop.
ICMP Latency Measurement with Bro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global watching_icmp: table[conn_id, count] of time &create_expire=3secs; | |
event icmp_echo_request(c: connection, icmp: icmp_conn, id: count, seq: count, payload: string) | |
{ | |
watching_icmp[c$id, seq] = network_time(); | |
} | |
event icmp_echo_reply(c: connection, icmp: icmp_conn, id: count, seq: count, payload: string) | |
{ | |
if ( [c$id, seq] !in watching_icmp ) | |
return; | |
print fmt("%s: %d bytes from %s: icmp_seq=%d ttl=%d time=%.3f ms", | |
c$id$orig_h, | |
|payload|, | |
c$id$resp_h, | |
seq, | |
icmp$hlim, | |
1000 * (network_time() - watching_icmp[c$id, seq])); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment