Non-Understood Message
Dear All,
Can someone help?
I find this message in dmesg:
MYTARGET.0 target: invalid size 65540 (kernel) != (user) 4
I've recompiled everything in site: kernel, iptables, xtables-addons, MYTARGET, to no avail. I really cannot see what's wrong. I think it means that there's a mismatch in size of between what the user-space passes and what the kernel-space expects.
Many thanks
Nicole
here are some code snippets:
from libxt_MYTARGET.c
static struct xtables_target mytarget_tg_reg[] = {
{
.version = XTABLES_VERSION,
.name = "MYTARGET",
.revision = 0,
.family = NFPROTO_IPV4,
.size = XT_ALIGN(sizeof(struct xt_mytarget_tginfo)),
.userspacesize = XT_ALIGN(sizeof(struct xt_mytarget_tginfo)),
...
},
#ifdef WITH_IPV6
{
.version = XTABLES_VERSION,
.name = "MYTARGET",
.revision = 0,
.family = NFPROTO_IPV6,
.size = XT_ALIGN(sizeof(struct xt_mytarget_tginfo)),
.userspacesize = XT_ALIGN(sizeof(struct xt_mytarget_tginfo)),
...
},
#endif
};
from xt_MYTARGET.c
static struct xt_target mytarget_tg_reg[] __read_mostly = {
{
.name = "MYTARGET",
.revision = 0,
.family = NFPROTO_IPV4,
.table = "mangle",
.target = mytarget_tg,
.checkentry = mytarget_tg_check,
.destroy = mytarget_tg_destroy,
.targetsize = XT_ALIGN(sizeof(struct xt_mytarget_tginfo)),
.me = THIS_MODULE,
},
#ifdef WITH_IPV6
{
.name = "MYTARGET",
.revision = 0,
.family = NFPROTO_IPV6,
.table = "mangle",
.target = mytarget_tg,
.checkentry = mytarget_tg_check,
.destroy = mytarget_tg_destroy,
.targetsize = XT_ALIGN(sizeof(struct xt_mytarget_tginfo)),
.me = THIS_MODULE,
},
#endif
};
from xt_MYTARGET.h
struct xt_mytarget_tginfo {
__u8 value;
__u8 mode;
bool final;
bool set_value;
__u8 by_port[USHRT_MAX];
};Florian Westphal
maintainerQuoted 1 line · Nicole
MYTARGET.0 target: invalid size 65540 (kernel) != (user) 4
[..]
Quoted 11 lines
struct xt_mytarget_tginfo {
__u8 value;
__u8 mode;
bool final;
bool set_value;
__u8 by_port[USHRT_MAX];
};Its too large. The kernel <-> userspace abi encodes size in 'u16' datatype, thus the target size sent by userspace overflows.