netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amin Azez <azez@ufomechanic.net>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: "Łukasz Stosik" <litestep@o2.pl>, netfilter-devel@lists.netfilter.org
Subject: Re: Sharing information for many rules using same module
Date: Fri, 31 Aug 2007 11:39:22 +0100	[thread overview]
Message-ID: <46D7EFDA.8080202@ufomechanic.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0708211713130.5333@fbirervta.pbzchgretzou.qr>

* Jan Engelhardt wrote, On 21/08/07 16:15:
> On Aug 21 2007 16:54, Łukasz Stosik wrote:
> 
>> I am working on simple netfilter match extension. It takes packet,
>> analyzes it, and puts all info in structure. Then it looks at fields
>> in matchinfo and decides if there is a match or not.
> 
>> The problem is there will be probably many rules, and each time
>> module will repeat the first part of process- where it would be
>> enought to use same structure as in first rule. Is there any way to
>> share info between rules?
> 
> Use a global variable (hash, linked list, whatever) in
> xt_yourmatch.c.

Unless the information is specific to the packet (skb) or flow
(conntrack) in which case you could consider extending the skb or
conntrack structs so you can store that information there.

Jan's answer is a neccessity if you are correlating information over
multiple flows, and is perhaps a good idea anyway to avoid conntrack/skb
bloat at the expense of some efficiency.

However you may want to look at the new ct_extend which could help here.

>> I would also like to know if netfilter is processing packetss in
>> pararell - or maybe i can be sure that until packet gets dropped or
>> reaches NIC driver, netfilter wont start to process another one -
>> that would solve my problem as i could simply keep that info inside
>> matching module.
> 
> You have to assume that it does things in parallel, and hence need
> proper locking around your global variable.

And possibly also out-of-order in some cases.

Sam

      reply	other threads:[~2007-08-31 10:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-21 14:54 Sharing information for many rules using same module Łukasz Stosik
2007-08-21 15:15 ` Jan Engelhardt
2007-08-31 10:39   ` Amin Azez [this message]

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=46D7EFDA.8080202@ufomechanic.net \
    --to=azez@ufomechanic.net \
    --cc=jengelh@computergmbh.de \
    --cc=litestep@o2.pl \
    --cc=netfilter-devel@lists.netfilter.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).