Skip to contentSkip to conversation

stream-like interface by netfilter?

DISCUSSION Haibin Wang 2 participants 2 messages Mar 31, 2009 – Apr 6, 2009 netfilter

lore
Share & tools
lore
#0 lore raw

Hi Netfilter folks,

Some questions on netfilter interface in kernel space.

First, Does netfilter provide a stream-like interface in kernel space, in addition to packets?
Second, if not, is there a way that netfilter provides packets of a TCP connection in right order ( maybe also duplications free)? Third, if so, what would be the best place to put in TCP reassembly code to collect packets and present a stream-like interface? I used NAT helper and CONNTRACK helper before, but not sure that is the right place to fulfill such a function.

Essentially we are doing a project that requires inspecting contents of TCP connections, our current approach requires patch to kernel TCP/IP stack, which isn't that convenient to end users. So we want to explore the idea whether we could do it using Netfilter. But so far I haven't found such an interface from Netfilter documentation.

I did read another open source project Layer 7 Netfilter,
http://l7-filter.sourceforge.net/

, but since it also applies patch to the kernel, it isn't exactly what we want, though a good place to start with.

Thanks for your attention.

Haibin

#1 lore raw
Quoted 3 lines · Haibin Wang

First, Does netfilter provide a stream-like interface in kernel space, in addition to packets?

Even STREAMS is quite message-based and you need to collect packets/messages before you can linearize them to form a stream of sorts.

Quoted 2 lines

Second, if not, is there a way that netfilter provides packets of a TCP connection in right order ( maybe also duplications free)?

No.

Quoted 4 lines

Third, if so, what would be the best place to put in TCP reassembly code to collect packets and present a stream-like interface? I used NAT helper and CONNTRACK helper before, but not sure that is the right place to fulfill such a function.

A hyphothetical tcp "defrag" or "ordering" module should be run after nf_defrag_ipv4.

Quoted 6 lines

Essentially we are doing a project that requires inspecting contents of TCP connections, our current approach requires patch to kernel TCP/IP stack, which isn't that convenient to end users. So we want to explore the idea whether we could do it using Netfilter. But so far I haven't found such an interface from Netfilter documentation.

You could be using libnetfilter_queue to do it in userspace instead.