From: Patrick McHardy <kaber@trash.net>
To: Yasuyuki KOZAKAI <yasuyuki.kozakai@toshiba.co.jp>
Cc: rusty@rustcorp.com.au, netfilter-devel@lists.netfilter.org,
pablo@netfilter.org, kadlec@blackhole.kfki.hu
Subject: Re: [RFC][PATCH 0/7]: ct_extend
Date: Tue, 08 May 2007 11:46:40 +0200 [thread overview]
Message-ID: <46404700.40609@trash.net> (raw)
In-Reply-To: <200705071200.l47C0UoM006287@toshiba.co.jp>
Yasuyuki KOZAKAI wrote:
> I'm re-writing ct_extend patchset. This patchset is a snapshot.
> Like Rusty's original one, it allocates memory area by kmem_cache_alloc()
> to store basic informations about a connection, but it uses kmalloc() to
> allocate memory area for extension (currently helper and NAT).
>
> Some concepts are following.
> - 'struct ct_extend' keeps offsets to each area and the total size of them,
> instead of identifiers of extensions. This scheme can eliminate loops and
> make codes simple, but limits the total size of area to 256 bytes. Is it
> too small ? If so, we can be back to the original ct_extend.
I think this will do, I believe we're somewhere in the 40-50 byte range
now with both NAT and helpers.
> - To add a new area, it reallocates ct_extend. To fix the pointer to it from
> other objects, the 'move' operation defined by extension is used.
>
> - It does not have the operation to remove a memory area from
> ct_extend. Because it causes reallocating and restructuring ct_extend.
> It is complicated operation. And removing extension from all conntracks
> would require heavy processing. I prefer to leave unused area.
Agreed.
> - I added 'destroy' operation which is called in destroy_conntrack(). It
> can kill global operation 'nf_conntrack_destroyed' used by NAT.
Nice work :)
> The issues I noticed are following.
> - This patchset does not consider locking. The places calling nfct_help() or
> nfct_nat() must be protected with new read-write lock. It will add
> some processing time and complexities.
This will add quite some overhead since at least nfct_help is looked at
for every packet (we might avoid this using a status flag though).
I'm guessing the locks are needed to protect against concurrent
reallocations. Maybe we can avoid this by adding the limitation that
only unconfirmed entries may add new extensions?
> - ct_extend_add() reallocates memory area for all extensions. All helpers
> and NAT codes are necessary to take care that the pointer nfct_help(ct)
> and nfct_nat(ct) might be changed. It would make difficult to find bugs
> caused by this issue.
Thats something we'll have to live with I guess. The same is true for
the skb reallocation functions, maybe we can get a sparse check for
this some day.
> And some improvements can be considered/are necessary.
> - Introducing new locking
> - 'move' operation might be better to have a argument 'struct nf_conn *ct'.
> - Moving other stuff in 'struct nf_conn' to ct_extend
> - Spliting nf_conn_nat into helper parts and others
> - Fixes of function names (nf_ct_ext_, nfct_ext_, nf_cte_, or ?)
I prefer nf_ct_ext_ or nfct_ext_.
> Comments are welcome.
I'm thinking we could probably avoid some reallocations by doing
a more accurate CT_EXTEND_MIN_SIZE calculation by taking
nf_nat_module_is_loaded into account. Only makes sense if it
currently is smaller than the space needed for NAT+MASQUERADE
of course.
next prev parent reply other threads:[~2007-05-08 9:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-07 12:00 [RFC][PATCH 0/7]: ct_extend Yasuyuki KOZAKAI
2007-05-08 9:46 ` Patrick McHardy [this message]
2007-05-09 11:05 ` Yasuyuki KOZAKAI
[not found] ` <200705091105.l49B5DTu023689@toshiba.co.jp>
2007-05-10 12:34 ` Patrick McHardy
2007-05-11 1:51 ` Yasuyuki KOZAKAI
2007-05-30 23:43 ` Mohammad Mohsenzadeh
2007-05-31 4:38 ` Patrick McHardy
2007-05-31 9:02 ` Yasuyuki KOZAKAI
[not found] ` <200705310902.l4V9212d010654@toshiba.co.jp>
2007-06-01 15:33 ` Patrick McHardy
2007-06-04 0:45 ` Yasuyuki KOZAKAI
[not found] ` <200706040045.l540jnhh008964@toshiba.co.jp>
2007-06-04 11:58 ` 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=46404700.40609@trash.net \
--to=kaber@trash.net \
--cc=kadlec@blackhole.kfki.hu \
--cc=netfilter-devel@lists.netfilter.org \
--cc=pablo@netfilter.org \
--cc=rusty@rustcorp.com.au \
--cc=yasuyuki.kozakai@toshiba.co.jp \
/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.