]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxt_RATEEST: fix userspacesize field
authorMassimo Maggi <massimo@mmmm.it>
Wed, 15 Jun 2011 00:52:00 +0000 (02:52 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Fri, 24 Jun 2011 18:01:47 +0000 (20:01 +0200)
I cannot delete a rule by matching it if the target of the rule is
RATEEST.

Copy-paste from terminal:

# iptables -t mangle -A PREROUTING -j RATEEST
--rateest-name somename --rateest-interval 250ms
--rateest-ewmalog 4s
# iptables -t mangle -D PREROUTING -j RATEEST
--rateest-name somename --rateest-interval 250ms
--rateest-ewmalog 4s
iptables: No chain/target/match by that name.

I saw in comments of the kernel code that the last part of the struct
xt_rateest_target_info is used only by kernel:

struct xt_rateest_target_info {
char name[IFNAMSIZ];
__s8 interval;
__u8 ewma_log;

/* Used internally by the kernel */
struct xt_rateest *est __attribute__((aligned(8)));
};

but in struct xtables_target, .size and .userspacesize are equal.
Simply correcting this solved the problem.

References: http://bugzilla.netfilter.org/show_bug.cgi?id=724
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
extensions/libxt_RATEEST.c

index 62bcb5e81292e440d8387ecaa4f4829168852b20..acdefb90cede422024add3272a685b20b064d225 100644 (file)
@@ -167,7 +167,7 @@ static struct xtables_target rateest_tg_reg = {
        .name           = "RATEEST",
        .version        = XTABLES_VERSION,
        .size           = XT_ALIGN(sizeof(struct xt_rateest_target_info)),
-       .userspacesize  = XT_ALIGN(sizeof(struct xt_rateest_target_info)),
+       .userspacesize  = offsetof(struct xt_rateest_target_info, est),
        .help           = RATEEST_help,
        .x6_parse       = RATEEST_parse,
        .x6_fcheck      = RATEEST_final_check,