All of lore.kernel.org
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <zbr@ioremap.net>
To: Patrick McHardy <kaber@trash.net>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Netfilter Development Mailinglist
	<netfilter-devel@vger.kernel.org>,
	Jan Engelhardt <jengelh@medozas.de>
Subject: Re: [resend] Passive OS fingerprint xtables match.
Date: Thu, 4 Jun 2009 17:11:53 +0400	[thread overview]
Message-ID: <20090604131153.GA18251@ioremap.net> (raw)
In-Reply-To: <4A27B9EC.2010301@trash.net>

On Thu, Jun 04, 2009 at 02:11:24PM +0200, Patrick McHardy (kaber@trash.net) wrote:
> Thats not what I meant. struct xt_match_param is passed to the
> ->match() callbacks from *t_do_table(). This is where you can
> add the real hook number to have it available in ->match().
> 
> (Forgot to mention earlier: please in a seperate patch and adjusting
>  all *tables copies)

Kind of this (for ipv4 only so far, also reorderd a field to fill the
gap):

diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 7b1a652..65a08ae 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -184,9 +184,10 @@ struct xt_counters_info
  * @matchinfo:	per-match data
  * @fragoff:	packet is a fragment, this is the data offset
  * @thoff:	position of transport header relative to skb->data
- * @hotdrop:	drop packet if we had inspection problems
+ * @hook:	hook number given packet came from
  * @family:	Actual NFPROTO_* through which the function is invoked
  * 		(helpful when match->family == NFPROTO_UNSPEC)
+ * @hotdrop:	drop packet if we had inspection problems
  */
 struct xt_match_param {
 	const struct net_device *in, *out;
@@ -194,8 +195,9 @@ struct xt_match_param {
 	const void *matchinfo;
 	int fragoff;
 	unsigned int thoff;
-	bool *hotdrop;
+	unsigned int hooknum;
 	u_int8_t family;
+	bool *hotdrop;
 };
 
 /**
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 810c0b6..385e4a0 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -335,7 +335,7 @@ ipt_do_table(struct sk_buff *skb,
 	mtpar.in      = tgpar.in  = in;
 	mtpar.out     = tgpar.out = out;
 	mtpar.family  = tgpar.family = NFPROTO_IPV4;
-	tgpar.hooknum = hook;
+	mtpar.hooknum = tgpar.hooknum = hook;
 
 	IP_NF_ASSERT(table->valid_hooks & (1 << hook));
 

-- 
	Evgeniy Polyakov

  reply	other threads:[~2009-06-04 13:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-11  9:53 [resend] Passive OS fingerprint xtables match Evgeniy Polyakov
2009-05-27 16:28 ` Patrick McHardy
2009-05-29  8:59   ` Evgeniy Polyakov
2009-05-29  9:49     ` Jan Engelhardt
2009-05-29 10:20       ` Evgeniy Polyakov
2009-06-02 12:40     ` Patrick McHardy
2009-06-04 11:37   ` Evgeniy Polyakov
2009-06-04 11:53     ` Patrick McHardy
2009-06-04 12:07       ` Evgeniy Polyakov
2009-06-04 12:11         ` Patrick McHardy
2009-06-04 13:11           ` Evgeniy Polyakov [this message]
2009-06-04 13:16             ` Patrick McHardy
2009-06-04 13:30               ` Jan Engelhardt
2009-06-04 13:35                 ` Patrick McHardy
2009-06-04 14:50               ` Evgeniy Polyakov
2009-06-04 14:55                 ` Patrick McHardy

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=20090604131153.GA18251@ioremap.net \
    --to=zbr@ioremap.net \
    --cc=davem@davemloft.net \
    --cc=jengelh@medozas.de \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.