testsuite/systemtap.examples/network/who_sent_it.stp
raw| 1 | #! /usr/bin/env stap |
| 2 | |
| 3 | # Print a trace of threads sending IP packets (UDP or TCP) to a given |
| 4 | # destination port and/or address. Default is unfiltered. |
| 5 | |
| 6 | global the_dport = 0 # override with -G the_dport=53 |
| 7 | global the_daddr = "" # override with -G the_daddr=127.0.0.1 |
| 8 | |
| 9 | probe netfilter.ip.local_out { |
| 10 | if ((the_dport == 0 || the_dport == dport) && |
| 11 | (the_daddr == "" || the_daddr == daddr)) |
| 12 | printf("%s[%d] sent packet to %s:%d\n", execname(), tid(), daddr, dport) |
| 13 | } |