From: Nepenthes Development Team <nepenthesdev@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: socket match - add wildcard option [4/4]
Date: Sun, 25 Jul 2010 16:53:17 +0200 [thread overview]
Message-ID: <AANLkTik21whM96aCB6OTedr20QxNkWoxc8EGzmWy5Ede@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 212 bytes --]
linux-netfilter-socket-wildcard.diff
- extend xt_socket by --wildcard option
Yes, I just noticed each reply to my own mail is a new thread, sorry,
but I did not get my own mail from majordomo to reply to.
[-- Attachment #2: linux-netfilter-socket-wildcard.diff --]
[-- Type: text/x-diff, Size: 1229 bytes --]
diff --git a/include/linux/netfilter/xt_socket.h b/include/linux/netfilter/xt_socket.h
index 6f475b8..9df8747 100644
--- a/include/linux/netfilter/xt_socket.h
+++ b/include/linux/netfilter/xt_socket.h
@@ -3,6 +3,7 @@
enum {
XT_SOCKET_TRANSPARENT = 1 << 0,
+ XT_SOCKET_WILDCARD = 1 << 1,
};
struct xt_socket_mtinfo1 {
diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c
index 3d54c23..6ca4622 100644
--- a/net/netfilter/xt_socket.c
+++ b/net/netfilter/xt_socket.c
@@ -144,12 +144,14 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par,
sk = nf_tproxy_get_sock_v4(dev_net(skb->dev), protocol,
saddr, daddr, sport, dport, par->in, false);
if (sk != NULL) {
- bool wildcard;
+ bool wildcard = false;
bool transparent = true;
- /* Ignore sockets listening on INADDR_ANY */
- wildcard = (sk->sk_state != TCP_TIME_WAIT &&
- inet_sk(sk)->inet_rcv_saddr == 0);
+ /* Ignore sockets listening on INADDR_ANY
+ if not specified otherwise */
+ if (!info || !(info->flags & XT_SOCKET_WILDCARD))
+ wildcard = (sk->sk_state != TCP_TIME_WAIT &&
+ inet_sk(sk)->inet_rcv_saddr == 0);
/* Ignore non-transparent sockets,
if XT_SOCKET_TRANSPARENT is used */
reply other threads:[~2010-07-25 14:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTik21whM96aCB6OTedr20QxNkWoxc8EGzmWy5Ede@mail.gmail.com \
--to=nepenthesdev@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).