Skip to contentSkip to conversation

how to use regex inside new netfilter extension modules?

DISCUSSION Balaji Venkatamohan 3 participants 3 messages Mar 3, 2010 – Mar 4, 2010 netfilter

lore
Share & tools
lore
#0 lore raw

Hello,

I need to use regular expressions inside the point of decision match function. I could not use 'regex.h ' or any other standard C library inside any of xt_*.c or xt_c*.h files. I could also see that none of the netfilter match extensions have them. I would also like to know why is it so?

Is there already any regular expression definitions defined in any of linux modules?

Thanks,
Balaji

#1 lore raw
Quoted 6 lines · Balaji Venkatamohan

I need to use regular expressions inside the point of decision match function. I could not use 'regex.h ' or any other standard C library inside any of xt_*.c or xt_c*.h files. I could also see that none of the netfilter match extensions have them. I would also like to know why is it so?

Regular expressions are not the cheapest, both time and memory-wise:
you have to keep in mind NF runs in irq context. Furthermore, since you only see single packets rather than the connection stream, regexes prove to be far less useful.

#2 lore raw
Quoted 7 lines · Jan Engelhardt
Quoted 6 lines · Balaji Venkatamohan

I need to use regular expressions inside the point of decision match function. I could not use 'regex.h ' or any other standard C library inside any of xt_*.c or xt_c*.h files. I could also see that none of the netfilter match extensions have them. I would also like to know why is it so?

Please refer to the source code of l7filter. http://l7-filter.sourceforge.net/

Quoted 5 lines

Regular expressions are not the cheapest, both time and memory-wise:
you have to keep in mind NF runs in irq context. Furthermore, since you only see single packets rather than the connection stream, regexes prove to be far less useful.

REs are useful and cheapest in some conditions.

Signature · 6 lines
Regards,
Changli Gao([email protected])
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html