|
| ricardo schmidt (10) | |||||
| Hello all, I'm facing a problem when compiling a new module to the Linux kernel 2.6 (Ubuntu 8.04), through the command 'make myfile.ko'. I have the following structure inside the files: linux/netfilter.h
myfile.c
When I execute the 'make myfile.ko' to compile the module, it gives me the following warning: ... warning: initialization from incompatible pointer type This warning is pointing the line '9. my_nf_hook' inside the struct nfh_pre initialization. Well, after compiling, the ko file is generated. However, when I execute the command 'insmod myfile.ko' to load the module, it results in kernel panic. I believe that the warning is directed related to the problem. Finally, my question: does anybody know where is the problem in the code above? What could be missing? Thanks a lot in advance for repliers. | |||||
| jsmith (3099) | |
| Your second parameter is a double pointer, but the typedef requires it to be a single pointer. | |
| ricardo schmidt (10) | |
| Actually that's right... according to tutorials I followed it must be ** | |
| jsmith (3099) | |
| If that is the case (I have not verified) then the nf_hookfn typedef is stupid and the warning can be ignored. In that case, you have to post your module's init_module() function or equivalent. What does the panic say? | |
| ricardo schmidt (10) | |
| hey jsmith... indeed you were right! I was confused by the recently changes in netfilter.h From kernel version 2.6.20 (i guess) and higher ones, the "struct sk_buff skb" parameter in the my_nf_hook function is a single pointer. However, for lower versions (< 2.6.20), it is a double pointer to the skb sk_buff struct. Thanks for your help! | |
| jsmith (3099) | |
| you're welcome. i learned something here too. been a while since i've been into the netfilter code in the kernel. | |
This topic is archived - New replies not allowed.
