Skip to contentSkip to conversation

extensions: libxt_socket: update man pages and tests for --restore-skmark

PATCH Applied Harout Hedeshian 2 participants 2 messages Jul 13, 2015 – Jul 15, 2015 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 extensions: libxt_socket: update man pages and tests for --restore-skmark

Update the man pages for libxt_socket with a description and example usage of the --restore-skmark option.

Also added tests for libxt_socket with various combinations of --restore-skmark and the existing options.

---
 extensions/libxt_socket.man | 14 ++++++++++++++
 extensions/libxt_socket.t   |  4 ++++
 2 files changed, 18 insertions(+)
extensions/libxt_socket.man +14 -0
index 2ef32ce..f809df6 100644
@@ -20,3 +20,17 @@ option instead.
 Example (assuming packets with mark 1 are delivered locally):
 .IP
 \-t mangle \-A PREROUTING \-m socket \-\-transparent \-j MARK \-\-set\-mark 1
+.TP
+\fB\-\-restore\-skmark\fP
+Set the packet mark to the matching socket's mark. Can be combined with the
+\fB\-\-transparent\fP and \fB\-\-nowildcard\fP options to restrict the sockets
+to be matched when restoring the packet mark.
+.PP
+Example: An application opens 2 transparent (\fBIP_TRANSPARENT\fP) sockets and
+sets a mark on them with \fBSO_MARK\fP socket option. We can filter matching packets:
+.IP
+\-t mangle \-I PREROUTING \-m socket \-\-transparent \-\-restore-skmark \-j action
+.IP
+\-t mangle \-A action \-m mark \-\-mark 10 \-j action2
+.IP
+\-t mangle \-A action \-m mark \-\-mark 11 \-j action3
extensions/libxt_socket.t +4 -0
index 8c0036e..fe4eb3e 100644
@@ -2,3 +2,7 @@
 *mangle
 -m socket;=;OK
 -m socket --transparent --nowildcard;=;OK
+-m socket --transparent --nowildcard --restore-skmark;=;OK
+-m socket --transparent --restore-skmark;=;OK
+-m socket --nowildcard --restore-skmark;=;OK
+-m socket --restore-skmark;=;OK
Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
maintainer Applied
#1 lore raw
Quoted 5 lines · Harout Hedeshian

Update the man pages for libxt_socket with a description and example usage of the --restore-skmark option.

Also added tests for libxt_socket with various combinations of --restore-skmark and the existing options.

Applied, thanks Harout.