Chenbo Feng | 51570a5 | 2017-03-22 17:27:36 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | local_dir="$(pwd)" |
| 3 | root_dir=$local_dir/../.. |
| 4 | mnt_dir=$(mktemp -d --tmp) |
| 5 | |
| 6 | on_exit() { |
Chenbo Feng | 00f660e | 2017-04-05 19:00:56 -0700 | [diff] [blame] | 7 | iptables -D OUTPUT -m bpf --object-pinned ${mnt_dir}/bpf_prog -j ACCEPT |
Chenbo Feng | 51570a5 | 2017-03-22 17:27:36 -0700 | [diff] [blame] | 8 | umount ${mnt_dir} |
| 9 | rm -r ${mnt_dir} |
| 10 | } |
| 11 | |
| 12 | trap on_exit EXIT |
| 13 | mount -t bpf bpf ${mnt_dir} |
Chenbo Feng | 00f660e | 2017-04-05 19:00:56 -0700 | [diff] [blame] | 14 | ./per_socket_stats_example ${mnt_dir}/bpf_prog $1 |