mark: the rule's connections send with a mark (#846)

mark <number> extends the allow or deny rule above it, as nolog and
weight do: a connection the rule lets through carries the mark on its
outgoing sockets, towards the destination and towards the parents, so
policy routing and firewall rules can tell its packets apart (SO_MARK
of Linux, SO_USER_COOKIE of FreeBSD; on a system with no mark the
command sets it to nothing). The UDP sockets of a session towards a
destination are marked the same, the SOCKS UDP ASSOCIATE relays among
them, for the rule that let the session through is looked up for each
destination. A mark with no rule above it, or not a number, is refused.
This commit is contained in:
Vladimir Dubrovin committed 2026-11-21 16:40:53 +03:00
1 parent e193732fcd
commit a2e400622b
9 files changed
+127 -9

No files matched your search

+18
View File
@@ -1269,6 +1269,24 @@ nolog
Weight may be used for different purposes.
.br
.BR mark
\fI<number>\fR
.br
extends last allow or deny command to set a mark for this request: the
sockets it goes out on, towards the destination and towards the parents,
carry the mark (SO_MARK of Linux, SO_USER_COOKIE of FreeBSD), so that
the packets of the request can be told apart by it in policy routing and
firewall rules. A number is written as in C. UDP is marked the same: the
sockets towards a destination, and the SOCKS UDP ASSOCIATE relays. On a
system with no mark the command sets it to nothing. The mark of a kept
alive request follows the rule which allowed the request (#846).
.br
allow * * 192.168.1.0/24
.br
mark 20
.br
.B force
.br