]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
netfilter: CONFIG_COMPAT: allow delta to exceed 32767
authorFlorian Westphal <fwestphal@astaro.com>
Mon, 15 Feb 2010 17:17:10 +0000 (18:17 +0100)
committerPatrick McHardy <kaber@trash.net>
Mon, 15 Feb 2010 17:17:10 +0000 (18:17 +0100)
with 32 bit userland and 64 bit kernels, it is unlikely but possible
that insertion of new rules fails even tough there are only about 2000
iptables rules.

This happens because the compat delta is using a short int.
Easily reproducible via "iptables -m limit" ; after about 2050
rules inserting new ones fails with -ELOOP.

Note that compat_delta included 2 bytes of padding on x86_64, so
structure size remains the same.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
include/linux/netfilter/x_tables.h
net/netfilter/x_tables.c

index c61758f4be31ce557fbb88b30230113c3df8e335..a18119fb88f07cd450599495e7daafadf97fea4c 100644 (file)
@@ -588,7 +588,7 @@ extern void xt_compat_unlock(u_int8_t af);
 
 extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta);
 extern void xt_compat_flush_offsets(u_int8_t af);
-extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset);
+extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
 
 extern int xt_compat_match_offset(const struct xt_match *match);
 extern int xt_compat_match_from_user(struct xt_entry_match *m,
index 69c56287d518d0fc1566d98552a1c9732dff1f5f..0a12cedfe9e3da547981cb6b5251a72a663ece2a 100644 (file)
@@ -39,7 +39,7 @@ MODULE_DESCRIPTION("{ip,ip6,arp,eb}_tables backend module");
 struct compat_delta {
        struct compat_delta *next;
        unsigned int offset;
-       short delta;
+       int delta;
 };
 
 struct xt_af {
@@ -439,10 +439,10 @@ void xt_compat_flush_offsets(u_int8_t af)
 }
 EXPORT_SYMBOL_GPL(xt_compat_flush_offsets);
 
-short xt_compat_calc_jump(u_int8_t af, unsigned int offset)
+int xt_compat_calc_jump(u_int8_t af, unsigned int offset)
 {
        struct compat_delta *tmp;
-       short delta;
+       int delta;
 
        for (tmp = xt[af].compat_offsets, delta = 0; tmp; tmp = tmp->next)
                if (tmp->offset < offset)