All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emmanuel Guiton <emmanuel@netlab.hut.fi>
To: netfilter-devel@lists.netfilter.org
Cc: Jesse Peng <jesse@deansoft.com.tw>,
	Henrik Nordstrom <hno@marasystems.com>,
	KOVACS Krisztian <hidden@balabit.hu>
Subject: Re: Counter problem in a new nat target.
Date: Wed, 10 Dec 2003 13:00:05 +0200	[thread overview]
Message-ID: <3FD6FCB5.20205@netlab.hut.fi> (raw)
In-Reply-To: 3FD6DAE8.5040205@deansoft.com.tw

>
> 1.You maintain a hash struture which list any of your concerning 
> conntrack, and while a conntrack facing destroyed then looking  up 
> this hash list if it is on the list.
> 2.I don't think you need any real helper no matter how simple it can 
> be.But just to extend your target module while matching ip_ct_new put 
> some flags in the help 
> information(conntrack->help.Your_patched_private_help_info)indecate 
> that this is the conntrack you care. And then while a conntrack facing 
> destroyed then looking  up its help info if it is flaged. But if the 
> traffic you wanna filter overlaps with other helpers(eg. 
> ip_conntrack_ftp),then a somewhat dirty way regarding where you put 
> your flags(because help info is only for one helper)is to put them in 
> conntrack->nat.help.Your_patched_private_help_info(for this is 
> relatively a virgin place seldom touched by famous helpers except as I 
> know the pptp helper)
>
> But no matter which above you choose, You can't avoid patching your 
> private destroying code like how ip_conntrack_destroyed(destroying 
> code for NATed conntrack) been called.Because so far we never see any 
> extending conntrack destroying machenism concerning helper's private 
> functionality(like helper->destroy).
> Hope this can help ;)!
>
> Regards
> Jesse


I think the conntrack->help data can be very useful to identify the 
counter to which the conntack belongs. that's a good idea, thanks.

However, the counters' "storage place" is still an unsolved issue. The 
main function that uses these counters is my nat target function. Only 
the decrease operation cannot be performed in this function. As Jesse 
and Krisztian metioned, I see so far two possibilities to decrease the 
counter:
 - in nat's ip_conntrack_destroyed
 - in a function in a struct notifier_block called upon the receipt of 
an IPCT_DESTROY notifier.
These two possibilities only offer to modify the conntrack structure, 
which does not work in my case.The counters are used to count the number 
of conntrack and the information in one conntrack is not related to the 
information in another conntrack.
In my target function, as Henrik pointed out, I can - easily, for want 
of cleanly - modify my counters in they are in the user data. In fact, I 
had originally placed the counters there, so that they were initialized 
when adding a new rule in the nat table.
Thus, if I could get a pointer to this user data when decreasinging my 
counters, the problem would be solved. I don't think it really fits in 
the ip_conntrack_destroyed function but why not in the notifier 
function? What about modifying the conntrack notifier system so that it 
includes also a pointer to the user data, or then make a brand new 
notifier system (because at first sight I don't see how to include a 
pointer to the user data in the current conntrack notifier system)?

What do you think about that?

             Emmanuel

PS: thanks for your comments, it's very precious help.

  reply	other threads:[~2003-12-10 11:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-08 11:53 Counter problem in a new nat target Emmanuel Guiton
2003-12-08 12:28 ` Henrik Nordstrom
2003-12-09 10:01   ` Emmanuel Guiton
2003-12-09 10:15     ` Henrik Nordstrom
2003-12-09 13:48       ` Emmanuel Guiton
2003-12-09 16:16         ` Henrik Nordstrom
2003-12-10  8:35       ` Jesse Peng
2003-12-10 11:00         ` Emmanuel Guiton [this message]
2003-12-10 11:15           ` Henrik Nordstrom
2003-12-10 12:52             ` Emmanuel Guiton
2003-12-10 14:19               ` Henrik Nordstrom
2003-12-11  3:20                 ` Jesse Peng
2003-12-11  8:20                   ` Henrik Nordstrom

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=3FD6FCB5.20205@netlab.hut.fi \
    --to=emmanuel@netlab.hut.fi \
    --cc=hidden@balabit.hu \
    --cc=hno@marasystems.com \
    --cc=jesse@deansoft.com.tw \
    --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 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.