netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Non-Understood Message
@ 2012-11-13 19:48 Nicole
  2012-11-13 22:53 ` Florian Westphal
  0 siblings, 1 reply; 2+ messages in thread
From: Nicole @ 2012-11-13 19:48 UTC (permalink / raw)
  To: netfilter-devel

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];
};

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Non-Understood Message
  2012-11-13 19:48 Non-Understood Message Nicole
@ 2012-11-13 22:53 ` Florian Westphal
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2012-11-13 22:53 UTC (permalink / raw)
  To: Nicole; +Cc: netfilter-devel

Nicole <nicole@cats-muvva.net> wrote:
> MYTARGET.0 target: invalid size 65540 (kernel) != (user) 4

[..]

> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-13 22:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-13 19:48 Non-Understood Message Nicole
2012-11-13 22:53 ` Florian Westphal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).