11
If I write a few kernel modules, and in all of them specify they should be the first (or last) netfilter hook called, in what order will they actually be called?
netfilter_ops_out.hook = hook_func_out;
netfilter_ops_out.pf = PF_INET;
netfilter_ops_out.hooknum = NF_IP_LOCAL_OUT;
netfilter_ops_out.priority = NF_IP_PRI_FIRST;
ret = nf_register_hook(&netfilter_ops_out);
if (0 > ret) {
printk("Error registering netfilter hook: %d\n", ret);
return ret;
}
netfilter_ops_in.hook = hook_func_in;
netfilter_ops_in.pf = PF_INET;
netfilter_ops_in.hooknum = NF_IP_LOCAL_IN;
netfilter_ops_in.priority = NF_IP_PRI_LAST;
ret = nf_register_hook(&netfilter_ops_in);
if (0 > ret) {
printk("Error registering netfilter hook: %d\n", ret);
return ret;
}
Experimentally, I made two modules, insmoded them in the two different orders - but they gave the same result, implying there's some suborder that's not just 'first come first serve'. (It's also not alphabetical...)