Newbie Question: Locking in Netfilter hook module?
Hi,
This maybe a silly question. I'm wondering for hook modules that I write for netfilter, is it necessary to do locking (critical section) when accessing my own global structures? This is regarding SINGLE CPU systems, is there anything that would preempt my module while it's at it such as interrupt etc?
Thank you!
please reply to my email addr as well: [email protected]
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
Quoted 5 lines · Ned Ren
Hi,
This maybe a silly question. I'm wondering for hook modules that I write for netfilter, is it necessary to do locking (critical section) when accessing my own global structures?
Yes, it is always necessarry to lock your global structures. All of netfilter is running in softirq context.
Quoted 2 lines
This is regarding SINGLE CPU systems, is there anything that would preempt my module while it's at it such as interrupt etc?
hard interrupts can always interrupt a softirq - but a softirq doesn't interrupt another softirq (on single cpu).
However, all kernel code _has_ to be SMP safe.
Quoted 1 line
Thank you!
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