Module working on 2 Hooks
Hello,
i have 2 questions, about which i'm not sure if they work like i think they do.
1. I wanna write a small module which does some checks on packets in NF_IP_LOCAL_IN, NF_IP_LOCAL_OUT and maintains a connection-table. I would like to know if it's ok to do that in 1 Module (and 1 function), or should that be done for any reason in seperate modules?
static int __init init(void) {
return nf_register_hook(&first);
return nf_register_hook(&second);
}static struct nf_hook_ops first
= { { NULL, NULL }, example_hook, PF_INET, NF_IP_LOCAL_IN, NF_IP_PRI_FILTER-1 };
static struct nf_hook_ops first
= { { NULL, NULL }, example_hook, PF_INET, NF_IP_LOCAL_OUT, NF_IP_PRI_FILTER-1 };example_hook(unsigned int hook, struct sk_buff **skb,
const struct net_device *indev, const struct net_device *outdev, int (*okfn)(struct sk_buff *))
{
..
}
2. I wanna look at tunneled packets in LOCAL_IN after they got decapsulated, can i see that by looking at the "const struct net_device *indev" which should be the tunlX device?
Regards,
Nikos