From: Patrick McHardy <kaber@trash.net>
To: Harald Welte <laforge@netfilter.org>
Cc: netfilter-devel@lists.netfilter.org,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH 3/3] NETFILTER: New PPTP helper
Date: Sun, 18 Sep 2005 16:26:09 +0200 [thread overview]
Message-ID: <432D7901.1080609@trash.net> (raw)
In-Reply-To: <20050918132837.GI8413@sunbeam.de.gnumonks.org>
Harald Welte wrote:
> On Sat, Sep 17, 2005 at 07:45:33PM +0200, Patrick McHardy wrote:
>
>>First, wouldn't it make sense to make ip_{conntrack,nat}_proto_gre
>>usable without pptp as well?
>
> That's how all helpers up to kernel 2.6.12 looked like. However, you
> cannot track GRE without some higher-level module. The reason is that
> GRE (if at all) uses a single KEY instead of source destination port.
>
> In netfilter-speak, the "key" is part of tuple.dst.u, and if
> pkt_to_tuple() has to resolve the full tuple. Without some higher level
> module (such as pptp) telling the GRE tracking code which key belongs to
> the key in the opposite direction, there is no way it could work.
>
> Since a lot of GRE applications (such as ip-over-gre) don't even use the
> optional key, you're back to the good old "generic" conntrack, and you
> can't distinguish multiple sessions between two IP's.
>
> Since for PPTP the "four modules" approach caused many user problems,
> and there was no other sensible use of the GRE code in sight, I dropped
> that idea.
Thanks for the explanation.
>>diff --git a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
>>b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
>>new file mode 100644
>>--- /dev/null
>>+++ b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
>>
>>I would prefer the name ip_conntrack_pptp.c for consisteny with
>>other helpers. Same for ip_nat_helper_pptp.c.
>
> AFAIK, that's not possible, since the resulting module is called
> ip_conntrack_pptp.ko , but it is a multi-object module. Again, this
> change was only introduced in the 2.6.13 version when gre and pptp files
> were linked together for a single kernel module.
>
> I don't think that consistency in soucre file naming is a valid reason
> to abandon this combination, though.
>
> And if at all, I would argue that the existing code is inconsistently
> named and that we should introduce _helper into the existing ones [like
> we have _proto for protocoks] ;)
That would make even more sense, but would cause incompatiblities.
I agree its not important, so lets just leave it for now.
>>+static int timeout_ct_or_exp(const struct ip_conntrack_tuple *t)
>>+{
>>+ struct ip_conntrack_tuple_hash *h;
>>+ struct ip_conntrack_expect *exp;
>>+
>>+ DEBUGP("trying to timeout ct or exp for tuple ");
>>+ DUMP_TUPLE(t);
>>+
>>+ h = __ip_conntrack_find(t, NULL);
>>+ if (h) {
>>+ struct ip_conntrack *sibling = tuplehash_to_ctrack(h);
>>+ DEBUGP("setting timeout of conntrack %p to 0\n", sibling);
>>+ sibling->proto.gre.timeout = 0;
>>+ sibling->proto.gre.stream_timeout = 0;
>>+ /* refresh_acct will not modify counters if skb == NULL */
>>+ ip_ct_refresh_acct(sibling, 0, NULL, 0);
>>
>>The regular way of doing this (del_timer, call ct->timeout.function)
>>seems cleaner too me.
>
> ok, no problem with that. I thought it was better to not expose
> conntrack details into the helper, but I'll change it.
As a cleanup for other helpers as well we can put this in a function.
>>+void __exit ip_ct_proto_gre_fini(void)
>>+{
>>+ struct list_head *pos, *n;
>>+
>>+ /* delete all keymap entries */
>>+ write_lock_bh(&ip_ct_gre_lock);
>>+ list_for_each_safe(pos, n, &gre_keymap_list) {
>>+ DEBUGP("deleting keymap %p at module unload time\n", pos);
>>+ list_del(pos);
>>+ kfree(pos);
>>
>>break;
>>
>>+ }
>>+ write_unlock_bh(&ip_ct_gre_lock);
>
> Why would you want to have a break statement? We really want to iterate
> over the list and delete all (for some strange reason) not yet kfree'd
> keymaps at module unload time.
Sorry, that was a misunderstanding, I somehow thought it wanted
to clean up a single entry. The break is wrong of course.
> I originally added the code during development to notify me of (and
> clean up) any keymap memory leaks. I don't know of any such leaks
> being left for quite some time, so we could make the whole block #ifdef
> DEBUG_PPTP. However, it doesn't hurt to make sure by leaving it in.
> What do you think?
Maybe a BUG_ON(!list_empty(&gre_keymap_list)) then?
> The resulting code is now in my netfilter-2.6.14 tree. I'll submit
> later today.
Great, nice to finally see this going in.
next prev parent reply other threads:[~2005-09-18 14:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-15 14:54 [PATCH 3/3] NETFILTER: New PPTP helper Harald Welte
2005-09-15 22:44 ` Patrick McHardy
2005-09-16 9:15 ` Harald Welte
2005-09-16 22:45 ` David S. Miller
2005-09-16 22:51 ` Harald Welte
2005-09-17 16:28 ` Patrick McHardy
2005-09-17 17:45 ` Patrick McHardy
2005-09-18 13:28 ` Harald Welte
2005-09-18 14:26 ` Patrick McHardy [this message]
2005-09-17 18:33 ` Harald Welte
2005-09-17 19:05 ` Patrick McHardy
2005-09-18 9:14 ` Harald Welte
2005-09-18 14:37 ` Patrick McHardy
2005-09-18 6:46 ` David S. Miller
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=432D7901.1080609@trash.net \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=laforge@netfilter.org \
--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.