[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20220425165733.240902-2-mdr@ashroe.eu>
Date: Mon, 25 Apr 2022 17:57:33 +0100
From: Ray Kinsella <mdr@...roe.eu>
To: netdev@...r.kernel.org
Cc: daniel@...earbox.net, stephen@...workplumber.org,
Ray Kinsella <mdr@...roe.eu>
Subject: [PATCH 1/1] tc-bpf: added instructions to build cbpf generator
Updated the man page for tc-bpf, detailing how to build to the cbpf
generator and using it in the subsequent example.
Signed-off-by: Ray Kinsella <mdr@...roe.eu>
---
man/man8/tc-bpf.8 | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/man/man8/tc-bpf.8 b/man/man8/tc-bpf.8
index e4f68aaa..1d3ab633 100644
--- a/man/man8/tc-bpf.8
+++ b/man/man8/tc-bpf.8
@@ -892,13 +892,21 @@ int main(int argc, char **argv)
.fi
.in
+Build this helper by compiling the source above, and linking with
+.B libpcap
+as follows:
+
+.in +4n
+.B clang -g -O2 cbpf-gen.c -lpcap -o cbpf-gen
+.in
+
Given this small helper, any
.B tcpdump(8)
filter expression can be abused as a classifier where a match will
result in the default classid:
.in +4n
-.B bpftool EN10MB 'tcp[tcpflags] & tcp-syn != 0' > /var/bpf/tcp-syn
+.B cbpf-gen 'tcp[tcpflags] & tcp-syn != 0' > /var/bpf/tcp-syn
.br
.B tc filter add dev em1 parent 1: bpf bytecode-file /var/bpf/tcp-syn flowid 1:1
.in
--
2.26.2
Powered by blists - more mailing lists