Blame view

samples/bpf/run_cookie_uid_helper_example.sh 341 Bytes
51570a5ab   Chenbo Feng   A Sample of using...
1
  #!/bin/bash
b24413180   Greg Kroah-Hartman   License cleanup: ...
2
  # SPDX-License-Identifier: GPL-2.0
51570a5ab   Chenbo Feng   A Sample of using...
3
4
5
6
7
  local_dir="$(pwd)"
  root_dir=$local_dir/../..
  mnt_dir=$(mktemp -d --tmp)
  
  on_exit() {
00f660eaf   Chenbo Feng   Sample program us...
8
  	iptables -D OUTPUT -m bpf --object-pinned ${mnt_dir}/bpf_prog -j ACCEPT
51570a5ab   Chenbo Feng   A Sample of using...
9
10
11
12
13
14
  	umount ${mnt_dir}
  	rm -r ${mnt_dir}
  }
  
  trap on_exit EXIT
  mount -t bpf bpf ${mnt_dir}
00f660eaf   Chenbo Feng   Sample program us...
15
  ./per_socket_stats_example ${mnt_dir}/bpf_prog $1