X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fnetfilter%2Fxt_limit.c;fp=net%2Fnetfilter%2Fxt_limit.c;h=15e40506bc3afb26224fab89b83ec318e9cdec38;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=ce7fdb7e4e07ce38e798d9f3f515fc30b1be79de;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/net/netfilter/xt_limit.c b/net/netfilter/xt_limit.c index ce7fdb7e4..15e40506b 100644 --- a/net/netfilter/xt_limit.c +++ b/net/netfilter/xt_limit.c @@ -68,7 +68,6 @@ static int ipt_limit_match(const struct sk_buff *skb, const struct net_device *in, const struct net_device *out, - const struct xt_match *match, const void *matchinfo, int offset, unsigned int protoff, @@ -108,13 +107,15 @@ user2credits(u_int32_t user) static int ipt_limit_checkentry(const char *tablename, const void *inf, - const struct xt_match *match, void *matchinfo, unsigned int matchsize, unsigned int hook_mask) { struct xt_rateinfo *r = matchinfo; + if (matchsize != XT_ALIGN(sizeof(struct xt_rateinfo))) + return 0; + /* Check for overflow. */ if (r->burst == 0 || user2credits(r->avg * r->burst) < user2credits(r->avg)) { @@ -139,40 +140,36 @@ ipt_limit_checkentry(const char *tablename, static struct xt_match ipt_limit_reg = { .name = "limit", .match = ipt_limit_match, - .matchsize = sizeof(struct xt_rateinfo), .checkentry = ipt_limit_checkentry, - .family = AF_INET, .me = THIS_MODULE, }; static struct xt_match limit6_reg = { .name = "limit", .match = ipt_limit_match, - .matchsize = sizeof(struct xt_rateinfo), .checkentry = ipt_limit_checkentry, - .family = AF_INET6, .me = THIS_MODULE, }; -static int __init xt_limit_init(void) +static int __init init(void) { int ret; - ret = xt_register_match(&ipt_limit_reg); + ret = xt_register_match(AF_INET, &ipt_limit_reg); if (ret) return ret; - ret = xt_register_match(&limit6_reg); + ret = xt_register_match(AF_INET6, &limit6_reg); if (ret) - xt_unregister_match(&ipt_limit_reg); + xt_unregister_match(AF_INET, &ipt_limit_reg); return ret; } -static void __exit xt_limit_fini(void) +static void __exit fini(void) { - xt_unregister_match(&ipt_limit_reg); - xt_unregister_match(&limit6_reg); + xt_unregister_match(AF_INET, &ipt_limit_reg); + xt_unregister_match(AF_INET6, &limit6_reg); } -module_init(xt_limit_init); -module_exit(xt_limit_fini); +module_init(init); +module_exit(fini);