Hi Amit, On Thu, Jun 03, 2004 at 07:01:22PM +0530, aksingh@xxxxxxxxxxx told us: > > Hi, > > In my module I do not want my hook functions to start capturing packets > when it is inserted using insmod(i.e i do not want my hook registration > functions to be called in init_module(). I want to register them when > someone writes onto my char device, so then I cannot unregister my hook > functions in the cleanup_module() because I do not know if they are > registered or not in the first place. > > So my question is, is there a way to find out before calling the > unregister functions in cleanup_module whether or not they are > registered. Something like this in the cleanup module : > cleanup_module() > if (registered(nfho1)) unregister(nfho1) ; > I don't know if there's a function to find out if a particular function is registered with the netfilter hooks. But the simplest method to accomplish what you want would be to have a variable in your module which is initialized to 0 and when you register set it to 1. Then, in your cleanup_module(), only unregister iff the variable is set to 1. Don't know if there's a better way to do it. HTH Sven > ?? > > thanks > Amit -- Linux zion 2.6.7-rc2 #2 Mon May 31 22:58:01 CEST 2004 i686 athlon i386 GNU/Linux 15:55:33 up 2 days, 16:55, 3 users, load average: 0.14, 0.05, 0.01
Attachment:
pgp00886.pgp
Description: PGP signature