I found what I was looking for l7-filter.sf.net.
Subsystems (2)
Are there any plans to add this to the patch-o-matic? If nothing else could you put a link on your links page.
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
Quoted 2 lines · Mike Mestnik
Are there any plans to add this to the patch-o-matic? If nothing else could you put a link on your links page.
Since the original authors of l7-filter did never contact us, we didn't know about their project at all.
In fact, you are the first one mentioning it to me, and I'm now reading through their source.
Although I'm not a fan of doing stuff like this inside the kernel, I think it is still a valid candidate for patch-o-matic (ng). However, this is up to the original software authors.
A couple of comments:
- put all the new struct ip_conntrack members into a seperate sub-structure (like the 'nat' and 'helper' substructures do)
- think about type usage. Use unsigned int for stuff like numpackets, since it is not likely to become negative ;)
- Adhere to CodingStyle (tab-width indent, ...)
- use arch-independent types in ipt_childlevel_info, or it will break on sparc64 and other archs
- don't put regexp.c/ressub.c into linux/include/linux/regexp. This belongs together with the iptables module
- Add sufficient GPL notices to every
- Please decouple the 'childlevel' match and submit it seperately. We could even submit it to the kernel soon.
- I can't see any locking in your code, and I don't think it's SMP safe
One additional question:
- Did you consider basing your work on top of libqsearch?
(http://www.cartel-securite.fr/pbiondi/libqsearch.html)
libqsearch is IMHO the preferred (and already existing and widely deployed, even in commercial products) way of doing pattern matching inside the kernel.
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
Quoted 3 lines
Although I'm not a fan of doing stuff like this inside the kernel, I think it is still a valid candidate for patch-o-matic (ng). However, this is up to the original software authors.
We would be interested in getting l7-filter into patch-o-matic-ng.
Quoted 6 lines
- put all the new struct
ip_conntrackmembers into a seperate sub-structure (like the 'nat' and 'helper' substructures do)
- think about type usage. Use unsigned int for stuff like numpackets, since it is not likely to become negative ;)
- Adhere to CodingStyle (tab-width indent, ...)
- Add sufficient GPL notices to every
Sure.
Quoted 2 lines
- use arch-independent types in
ipt_childlevel_info, or it will break on sparc64 and other archs
I'm slightly confused here. Other include/linux/netfilter_ipv4/ipt_*.h files use "int" and "char", too. However, if the Right Thing to do is to use "u_int32_t" and "u_int8_t", I don't have a problem with that.
Quoted 2 lines
- don't put
regexp.c/ressub.cinto linux/include/linux/regexp. This belongs together with the iptables module
Ok. We put it there because we felt that it might be used by other parts of the kernel someday, but either way is fine with me. Is it ok to keep the various regexp files together in net/ipv4/netfilter/regexp ?
Quoted 2 lines
- Please decouple the 'childlevel' match and submit it seperately. We could even submit it to the kernel soon.
Ok. I'll send that along shortly.
Quoted 1 line
- I can't see any locking in your code, and I don't think it's SMP safe
I'm not experienced in this. Could you point me at some docs or examples of how to do this?
Quoted 2 lines
- Did you consider basing your work on top of libqsearch?
(http://www.cartel-securite.fr/pbiondi/libqsearch.html)
I actually hadn't heard of that before. I've now looked at the documentation for it, but I'm still not clear on whether it does regular expressions out of the box, or whether we'd have to graft that on. Given that I'd rather our patch not be dependent on another patch, I think I'll stick to the way we do it now unless that's a major barrier to getting included in patch-o-matic.
Thanks for the critique.
-Matthew
There are alot of ppl working on this it's good to see activity like this.
Quoted 5 lines · --- Matthew Strait
Quoted 1 line
- I can't see any locking in your code, and I don't think it's SMP safe
I'm not experienced in this. Could you point me at some docs or examples of how to do this?
Documentation/spinlocks.txt describes how/why/when. I have some non linux related experience with this. Basically if you do a ctr++;(on 2 CPUs) there is a read and write if one CPU reads 5 the other CPU needs to wait for the first to write 6 to memory or you will get 6 not 7.
Quoted 10 lines
Quoted 2 lines
- Did you consider basing your work on top of libqsearch?
(http://www.cartel-securite.fr/pbiondi/libqsearch.html)I actually hadn't heard of that before. I've now looked at the documentation for it, but I'm still not clear on whether it does regular expressions out of the box, or whether we'd have to graft that on. Given that I'd rather our patch not be dependent on another patch, I think I'll stick to the way we do it now unless that's a major barrier to getting included in patch-o-matic.
Looks cool, I'd be interested in seeing this implemented just for the benchmarks. It looks like it precompiles the expressions, so I guess any input could be used with the correct ?user space? interpretor.
Quoted 1 line
Thanks for the critique.
Thanks for l7.
Quoted 2 lines
-Matthew
-Mike
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
PATCH 1/1 childlevel
In reply to Harald WelteQuoted 2 lines
- Please decouple the 'childlevel' match and submit it seperately. We could even submit it to the kernel soon.
Here you go.
(This module adds support for matching on the "childlevel" of a connection. Most connections have childlevel 0. Child connections such as FTP data or IRC-DCC have childlevel 1. Children of children have childlevel 2, and so on. iptables usage: "-m childlevel --level [!] n")
-matthew
extensions/.childlevel-test +2 -0
@@ -0,0 +1,2 @@ +#! /bin/sh +[ -f $KERNEL_DIR/include/linux/netfilter_ipv4/ipt_childlevel.h ] && echo childlevel
extensions/libipt_childlevel.c +122 -0
122 lines not on this page · raw message
iptables.8 +7 -0
@@ -382,6 +382,13 @@ This module matches the SPIs in AH header of IPSec packets. .TP .BR "--ahspi " "[!] \fIspi\fP[:\fIspi\fP]" +.SS childlevel +This is an experimental module. It matches on whether the +packet is part of a master connection +or one of its children (or grandchildren, etc). For instance, most +packets are level 0. FTP data transfer is level 1. +.TP +.BR "--childlevel " "[!] \fIlevel\fP" .SS conntrack This module, when combined with connection tracking, allows access to more connection tracking information than the "state" match.
include/linux/netfilter_ipv4/ipt_childlevel.h +22 -0
@@ -0,0 +1,22 @@ +/* +By Matthew Strait <[email protected]>, Dec 2003. +http://l7-filter.sf.net + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version +2 of the License, or (at your option) any later version. +http://www.gnu.org/licenses/gpl.txt +*/ + +#ifndef _IPT_CHILDLEVEL_H +#define _IPT_CHILDLEVEL_H + +typedef char *(*proc_ipt_search ) (u_int32_t ,u_int8_t ); + +struct ipt_childlevel_info { +u_int32_t childlevel; +u_int8_t invert; +}; + +#endif /* _IPT_CHILDLEVEL_H */
net/ipv4/netfilter/Kconfig +15 -0
@@ -115,6 +115,21 @@ To compile it as a module, choose M here. If unsure, say N. +config IP_NF_MATCH_CHILDLEVEL + tristate "Child Level match support (EXPERIMENTAL)" + depends on IP_NF_IPTABLES && IP_NF_CONNTRACK && EXPERIMENTAL + help + Say Y if you want to be able to classify packets based on whether + they belong to a master connection or a child connection. Examples + of child connections are the data stream of FTP and IRC-DCC. + + In iptables, "-m childlevel --level 0" will match master connections. + '-m childlevel --level 1" will match first generation children of + masters. As of iptables 1.2.9, this requires a patch to iptables to + work. + + To compile it as a module, choose M here. If unsure, say N. + config IP_NF_MATCH_PKTTYPE tristate "Packet type match support" depends on IP_NF_IPTABLES
net/ipv4/netfilter/Makefile +2 -0
@@ -66,6 +66,8 @@ obj-$(CONFIG_IP_NF_MATCH_PHYSDEV) += ipt_physdev.o +obj-$(CONFIG_IP_NF_MATCH_CHILDLEVEL) += ipt_childlevel.o + # targets obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o
net/ipv4/netfilter/ipt_childlevel.c +76 -0
76 lines not on this page · raw message
Quoted 1 line
- I can't see any locking in your code, and I don't think it's SMP safe
A question on this. I've just read through Rusty's Unreliable Guide To Locking:
http://www.kernel.org/pub/linux/kernel/people/rusty/kernel-locking/
I mostly understand, but I'm not quite sure what kind of code the match() function is. I think it's a softirq, which means (by the "Softirq A vs. Softirq A" entry in the table in 5.1) that the appropriate spinlock to use is spin_lock(), right? But the only type of spin lock currently used in net/ipv4/netfilter/*.c currently is spin_lock_bh(), so I'm not at all sure what to do.
-matthew
Re: [PATCH] childlevel
In reply to Matthew StraitQuoted 4 lines · Matthew Strait
Quoted 2 lines
- Please decouple the 'childlevel' match and submit it seperately. We could even submit it to the kernel soon.
Here you go.
Thanks, I'm adding it to CVS right now.
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
Quoted 5 lines · Matthew Strait
Quoted 1 line
- I can't see any locking in your code, and I don't think it's SMP safe
A question on this. I've just read through Rusty's Unreliable Guide To Locking:
Quoted 8 lines
http://www.kernel.org/pub/linux/kernel/people/rusty/kernel-locking/
I mostly understand, but I'm not quite sure what kind of code the
match()function is. I think it's a softirq, which means (by the "Softirq A vs. Softirq A" entry in the table in 5.1) that the appropriate spinlock to use isspin_lock(), right? But the only type of spin lock currently used innet/ipv4/netfilter/*.ccurrently isspin_lock_bh(), so I'm not at all sure what to do.
Yes, it is softirq context. The locks you use are either spinlock_t or rwlock_t's. netfilter mostly uses rwlocks by it's own macros (DECLARE_RWLOCK, READ_LOCK/WRITE_LOCK, ...)
Quoted 1 line
-matthew
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