Re: Invalid size of target

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



OK.  That makes sense for what I'm seeing.

What I have is the following struct:

struct ipt_CSUM_info {
    u_int32_t       address;
    u_int8_t        addressCount;
    u_int16_t       port;
    u_int8_t        portCount;
    u_int8_t        interval;
    u_int8_t        maxFailures;
};

and I register the following target in lib*.c:

static struct iptables_target CSUM = {
    .next       = NULL,
    .name       = "CSUM",
    .version    = NETFILTER_VERSION,
    .size       = IPT_ALIGN(sizeof(struct ipt_CSUM_info)),
    .userspacesize  = IPT_ALIGN(sizeof(struct ipt_CSUM_info)),
    .help       = &help,
    .parse      = &parse,
    .final_check    = &final_check,
    .print      = &print,
    .save       = &save,
    .extra_opts = opts
};

void _init(void)
{
    register_target(&CSUM);
}

Then I try and register the target in the kernel C file which is where
it seems to fail:

static struct ipt_target ipt_CSUM = {
    .name       = "CSUM",
    .target     = ipt_csum_target,
    .checkentry = ipt_csum_checkentry,
};

static int __init init(void)
{
    ipt_char_major = register_chrdev(0,"ipt_CSUM_char",&char_fops);
    init_timer(&csum_timer);
    csum_timer.function = timer_callback;
    init_waitqueue_head(&inqMSG);
    printk("register target\n");
    return ipt_register_target(&ipt_CSUM);
}




On Mon, Jul 14, 2008 at 4:07 PM, Jan Engelhardt <jengelh@xxxxxxxxxx> wrote:
>
> On Monday 2008-07-14 21:26, Kevin Sookocheff wrote:
>
>>Hi everyone,
>>
>>I am having a problem developing an IPTables module.
>>
>>I get the following error (CSUM is the name of my module):
>>
>>ip_tables: CSUM target: invalid size 0 != 12
>>
>>The first question is why this error appears,
>
> Because your xt_CSUM.c file and libxt_CSUM.c do not agree on
> the private structure (size).
>
>>and why does it only appear for SMP kernels?
>
> Perhaps you only have a specific change in an SMP kernel?
> Or maybe because your private structure contains bad members.
> Nobody knows until code is seen.
>
> Read more about the process in
> http://jengelh.medozas.de/documents/Netfilter_Modules.pdf
>
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux