Skip to contentSkip to conversation

patch-o-matic

PATCH Harald Welte 1 participant 1 message Jul 30, 2003 2 messages not in the archive netfilter

lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive
Quoted 4 lines · Henrik Nordstrom

Problem is that the common ip_conntrack structure includes helper and protocol specific data, and there is no way of registering new variants without patching include/linux/netfilter_ipv4/ip_conntrack.h and recompile everything dependent on conntrack.

yes. I remember having a discussion with Rusty about this in 2001. We den decided to consider this as a feature. If you could add any conntrcak/nat helper without recompiling the kernel code, you make it too easy for 3rd parties to ship binary-only conntrack/nat helpers.

Quoted 4 lines

This could be solved by separating the helper and protocol data from the main conntrac structure (use opaqueue pointers instead of unions). Probably a good idea as it would lessen the memory usage for "plain" entries, but it adds some extra memory and CPU overhead when there is helpers involved,

Yes, this is certainly an interesting idea. But it would definitely make the code more complex. We would then have struct ip_conntrack, struct ip_conntrack_expect - and again something else.

The helper could tell the core how many bytes it needs. The core would then create a slab cache for objects of this size.

Alternatively you could also glue the variable sized part to the end of the structure and then have slab caches for 'plain conntrack' and 'conntrack+helper'. This would get the number of allocations down to one. However, we would need some flag inside struct ip_conntrack to know to which slab cache we return the object when calling kmem_cache_free().

Quoted 2 lines

plus it makes it slightly harder to write helpers (one have to typecast to get access to the helper data).

I wouldn't care about that. You also need to do this in case of writing iptables matches/targets (matchinfo). And somebody diving into the complexity of writing conntrack/nat helpers certainly has no problem with adding a typecast to their code.

Quoted 3 lines

Henrik Nordstrom
MARA Systems AB
Sweden

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie