blob: fc6bc0451ab45dc7081d153ac1a4b2f579141940 [file] [log] [blame]
Chenbo Feng51570a52017-03-22 17:27:36 -07001#!/bin/bash
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01002# SPDX-License-Identifier: GPL-2.0
Chenbo Feng51570a52017-03-22 17:27:36 -07003local_dir="$(pwd)"
4root_dir=$local_dir/../..
5mnt_dir=$(mktemp -d --tmp)
6
7on_exit() {
Chenbo Feng00f660e2017-04-05 19:00:56 -07008 iptables -D OUTPUT -m bpf --object-pinned ${mnt_dir}/bpf_prog -j ACCEPT
Chenbo Feng51570a52017-03-22 17:27:36 -07009 umount ${mnt_dir}
10 rm -r ${mnt_dir}
11}
12
13trap on_exit EXIT
14mount -t bpf bpf ${mnt_dir}
Chenbo Feng00f660e2017-04-05 19:00:56 -070015./per_socket_stats_example ${mnt_dir}/bpf_prog $1