]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
utils: Add a manpage for nfbpf_compile
authorPhil Sutter <phil@nwl.cc>
Wed, 16 Jan 2019 21:47:59 +0000 (22:47 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 18 Jan 2019 01:52:30 +0000 (02:52 +0100)
Content is rather sparse, but still better than no manpage at all.

Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
configure.ac
utils/.gitignore
utils/Makefile.am
utils/nfbpf_compile.8.in [new file with mode: 0644]

index 448ec918fd89b1e6a0469c9fa8f4d0a2f51ca4a9..e6c9832fa43bad6fa1280141deed1dd11e9c8e56 100644 (file)
@@ -252,7 +252,8 @@ AC_CONFIG_FILES([Makefile extensions/GNUmakefile include/Makefile
        libxtables/Makefile utils/Makefile
        include/xtables-version.h include/iptables/internal.h
        iptables/xtables-monitor.8
-       utils/nfnl_osf.8])
+       utils/nfnl_osf.8
+       utils/nfbpf_compile.8])
 AC_OUTPUT
 
 
index 7c6afbf4e6a527949be6e549a13040d36e3fe4fa..6300812b1701bae7b29e0fc3182e5703bca2bfda 100644 (file)
@@ -1,3 +1,4 @@
 /nfnl_osf
 /nfnl_osf.8
 /nfbpf_compile
+/nfbpf_compile.8
index 80029e303ff3b801bdb3d60cd8619be54cd98a0f..d09a69749b85fbf0ef650d345dcd6a75262d0fbd 100644 (file)
@@ -17,6 +17,7 @@ nfnl_osf_LDADD = ${libnfnetlink_LIBS}
 endif
 
 if ENABLE_BPFC
+man_MANS += nfbpf_compile.8
 sbin_PROGRAMS += nfbpf_compile
 nfbpf_compile_LDADD = -lpcap
 endif
@@ -26,4 +27,4 @@ sbin_PROGRAMS += nfsynproxy
 nfsynproxy_LDADD = -lpcap
 endif
 
-CLEANFILES = nfnl_osf.8
+CLEANFILES = nfnl_osf.8 nfbpf_compile.8
diff --git a/utils/nfbpf_compile.8.in b/utils/nfbpf_compile.8.in
new file mode 100644 (file)
index 0000000..d02979a
--- /dev/null
@@ -0,0 +1,70 @@
+.TH NFBPF_COMPILE 8 "" "@PACKAGE_STRING@" "@PACKAGE_STRING@"
+
+.SH NAME
+nfbpf_compile \- generate bytecode for use with xt_bpf
+.SH SYNOPSIS
+
+.ad l
+.in +8
+.ti -8
+.B nfbpf_compile
+[
+.I LLTYPE
+]
+.I PROGRAM
+
+.ti -8
+.I LLTYPE
+:= {
+.BR EN10MB " | " RAW " | " SLIP " | "
+.I ...
+}
+
+.SH DESCRIPTION
+The
+.B nfbpf_compile
+utility aids in generating BPF byte code suitable for passing to
+the iptables
+.B bpf
+match.
+
+.SH OPTIONS
+
+.TP
+.I LLTYPE
+Link-layer header type to operate on. This is a name as defined in
+.RB < pcap/dlt.h >
+but with the leading
+.B DLT_
+prefix stripped. For use with iptables,
+.B RAW
+should be the right choice (it's also the default if not specified).
+
+.TP
+.I PROGRAM
+The BPF expression to compile, see
+.BR pcap-filter (7)
+for a description of the language.
+
+.SH EXIT STATUS
+The program returns 0 on success, 1 otherwise.
+
+.SH EXAMPLE
+Match incoming TCP packets with size bigger than 100 bytes:
+.P
+.in +8
+.EE
+bpf=$(nfbpf_compile 'tcp and greater 100')
+.br
+iptables -A INPUT -m bpf --bytecode "$bpf" -j ACCEPT
+.RE
+.P
+The description of
+.B bpf
+match in
+.BR iptables-extensions (8)
+lists a few more examples.
+
+.SH SEE ALSO
+.BR iptables-extensions (8),
+.BR pcap-filter (7)