]> git.ipfire.org Git - thirdparty/iptables.git/commit
extensions: xt_socket: add txlate support for socket match
authorFlorian Westphal <fw@strlen.de>
Wed, 6 Mar 2024 10:11:25 +0000 (11:11 +0100)
committerFlorian Westphal <fw@strlen.de>
Wed, 6 Mar 2024 20:06:58 +0000 (21:06 +0100)
commit494eae37f2690be4a86fd6516264979afbfe95ca
treef1a4445f249e896f677e3f11a94231ec4700a3b1
parentfcaa99ca9e3c18f831fe523a0ad79fb1da34b0ec
extensions: xt_socket: add txlate support for socket match

v2: document the match semantics of -m socket.

Ignore --nowildcard if used with other options when translating
and add "wildcard 0" if the option is missing.

"-m socket" will ignore sockets bound to 0.0.0.0/:: by default,
unless --nowildcard is given.

So, xlate must always append "wildcard 0", can elide "wildcard"
if other options are present along with --nowildcard.

To emulate "-m socket --nowildcard", check for "wildcard <= 1" to
get a "socket exists" type matching.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Phil Sutter <phil@nwl.cc>
extensions/libxt_socket.c
extensions/libxt_socket.txlate [new file with mode: 0644]