Netfilter hooks
Hi folks,
I would like to register a module that I am writing to the NF_IP_FORWARD Hook in netfilter. The struct used for register is : struct nf_hook_ops { struct list_head list; /* User fills in from here down. */ nf_hookfn *hook; int pf; int hooknum; /* Hooks are ordered in ascending priority. */ int priority; }; And the hook function is a nf_hookfn, which is a typedef : typedef unsigned int nf_hookfn(unsigned int hooknum, struct sk_buff **skb, const struct net_device *in, const struct net_device *out, int (*okfn)(struct sk_buff *)); What is the parameter int (*okfn)(struct sk_buff *) which is passed to the hook ? Any help would be greatly appreciated. Thank you so much for your time! Ramirez |
Quote:
Otherwise if its a netfilter question, have a look at this very simple example: http://whatisthekernel.blogspot.com/...ter-hooks.html How to obtain the declaration of a variable or a function:
Example: int (*okfn)(struct sk_buff *) Thats a pointer to a "function which takes as param a pointer to sk_buff , and returns int" so: left: the type , right the identifier (alone!)
As an exercise to the reader :) void (*signal(int sig,int (*func)(int)))(int); |
Hi,
Thanks for the link. I went to the link, but it does not define the use of the (*okfn) function pointer. Is it some pointer to a function that gets executed after the hook function returns? And if so, could I use this function for other purporses as well (instead of just after the hook function returns, like could i use it somewhere inside the hook function). Thanks alot! Ramirez |
All times are GMT -5. The time now is 11:09 AM. |