tc-filter

command module
v0.0.0-...-d05ee1c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 20 Imported by: 0

README

tc-filter

Linux network filter base on ebpf tc

Usage

./tc-filter --help

Usage of ./tc-filter:
  -drop-skb
        drop filtered skb
  -filter-dst-ip string
        filter destination IP addr
  -filter-dst-port value
        filter destination port
  -filter-if string
        filter net interface
  -filter-port value
        filter either destination or source port
  -filter-proto string
        filter L4 protocol (tcp, udp, icmp)
  -filter-src-ip string
        filter source IP addr
  -filter-src-port value
        filter source port
  -kernel-btf string
        specify kernel BTF file

how to run

tc-filter requires >= 5.8 kernel to run.

install bpf2go

go install github.com/cilium/ebpf/cmd/bpf2go@latest

mount kernel debug folder

mount -t debugfs debugfs /sys/kernel/debug

re-generate bpf header files

ebpf/headers/update.sh

re-generate go file

make 

run program

sudo ./tc-filter

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL