Correct signatur for target
Hello,
I am currently working on an xtables-targetmodule, and have come across a thing that puzzles me a little bit. As far as I have understood it, according to both the book "Writing netfilter module" (excellent by the way, thank you Jan and Nicolas) and my x_tables.h-file, the signatur for *target is:
static unsigned int (*target) (struct sk_buff *skb,
const struct xt_target_param *par)
However, to get it working on my machine (which runs the 2.6.28.8-kernel), the first argument had to be a double pointer for my module to work as intended. I though the double pointer was there for compatibility with older kernels. Does any know where I am wrong/what I have done wrong?
-Kristian
Quoted 7 lines · Kristian Evensen
I am currently working on an xtables-targetmodule, and have come across a thing that puzzles me a little bit. As far as I have understood it, according to both the book "Writing netfilter module" (excellent by the way, thank you Jan and Nicolas) and my x_tables.h-file, the signatur for *target is:
Quoted 8 lines
static unsigned int (*target) (struct
sk_buff*skb,
const structxt_target_param*par)However, to get it working on my machine (which runs the 2.6.28.8-kernel), the first argument had to be a double pointer for my module to work as intended. I though the double pointer was there for compatibility with older kernels. Does any know where I am wrong/what I have done wrong?
To make Xtables-addons's compat_xtables.ko work with all supported kernel versions, it has to slightly deviate from the latest kernel API and use a double-pointer. So if you write your module with the help of the compat layer, you need to be aware of this minor difference. I think the latest version of the e-book also mentions this.
Quoted 6 lines
To make Xtables-addons's compat_xtables.ko work with all supported kernel versions, it has to slightly deviate from the latest kernel API and use a double-pointer. So if you write your module with the help of the compat layer, you need to be aware of this minor difference. I think the latest version of the e-book also mentions this.
Thank you very much. When I no longer included "compat_xtables.h" and changed the signature, it worked.
When I read the related paragraph (second in section 5.2) in the book again now, I see that it is mentioned. However, since I am not so familiar with xtables, I did not connect "glue code" with the "compat_xtables.h".
Thank you again,
Kristian
Quoted 7 lines · Kristian Evensen
Quoted 6 lines
To make Xtables-addons's compat_xtables.ko work with all supported kernel versions, it has to slightly deviate from the latest kernel API and use a double-pointer. So if you write your module with the help of the compat layer, you need to be aware of this minor difference. I think the latest version of the e-book also mentions this.
Quoted 7 lines
Thank you very much. When I no longer included "
compat_xtables.h" and changed the signature, it worked.When I read the related paragraph (second in section 5.2) in the book again now, I see that it is mentioned. However, since I am not so familiar with xtables, I did not connect "glue code" with the "
compat_xtables.h".
I'll try to do some editorial work on the phrasing then ;-)