mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
![Chenbo Feng](/assets/img/avatar_default.png)
Added a per socket traffic monitoring option to illustrate the usage of new getsockopt SO_COOKIE. The program is based on the socket traffic monitoring program using xt_eBPF and in the new option the data entry can be directly accessed using socket cookie. The cookie retrieved allow us to lookup an element in the eBPF for a specific socket. Signed-off-by: Chenbo Feng <fengc@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
14 lines
306 B
Bash
Executable file
14 lines
306 B
Bash
Executable file
#!/bin/bash
|
|
local_dir="$(pwd)"
|
|
root_dir=$local_dir/../..
|
|
mnt_dir=$(mktemp -d --tmp)
|
|
|
|
on_exit() {
|
|
iptables -D OUTPUT -m bpf --object-pinned ${mnt_dir}/bpf_prog -j ACCEPT
|
|
umount ${mnt_dir}
|
|
rm -r ${mnt_dir}
|
|
}
|
|
|
|
trap on_exit EXIT
|
|
mount -t bpf bpf ${mnt_dir}
|
|
./per_socket_stats_example ${mnt_dir}/bpf_prog $1
|