I am adding a hook function on a bridge.The question is: when in nf_hook_ops
struct I use pf
value like 7 (defined in PF_BRIDGE) then it DOESN'T work:
static struct nf_hook_ops nfho;nfho.hook = hook_func;nfho.owner = THIS_MODULE;nfho.hooknum = NF_IP_PRE_ROUTINGnfho.pf = PF_BRIDGE; // 7nfho.priority = INT_MAX;int rc = nf_register_hook(&nfho);
But if I use:
nfho.pf = 0x7000000;
Then it works without problems.
Linux version is 3.4.11 (Big-endian) and pf
for this case should be int32 (not u_int8_t).
Does it depend on the Linux version? And how to detect which value to use (7 or 0x7000000)? Should I use something like htonl()
or ntohl()
for Big- and Little-endian machines?
Thank you in advance for any help!