netfilter: xtables: move extension arguments into compound structure (3/6)
[deliverable/linux.git] / net / netfilter / xt_hashlimit.c
index 7bae369603d7220171ac79f164479d39cb4e128d..6fc4292d46e6b33e18863878285af99ef34af3e7 100644 (file)
@@ -563,19 +563,16 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
 }
 
 static bool
-hashlimit_mt_v0(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,
-                bool *hotdrop)
+hashlimit_mt_v0(const struct sk_buff *skb, const struct xt_match_param *par)
 {
        const struct xt_hashlimit_info *r =
-               ((const struct xt_hashlimit_info *)matchinfo)->u.master;
+               ((const struct xt_hashlimit_info *)par->matchinfo)->u.master;
        struct xt_hashlimit_htable *hinfo = r->hinfo;
        unsigned long now = jiffies;
        struct dsthash_ent *dh;
        struct dsthash_dst dst;
 
-       if (hashlimit_init_dst(hinfo, &dst, skb, protoff) < 0)
+       if (hashlimit_init_dst(hinfo, &dst, skb, par->thoff) < 0)
                goto hotdrop;
 
        spin_lock_bh(&hinfo->lock);
@@ -613,23 +610,20 @@ hashlimit_mt_v0(const struct sk_buff *skb, const struct net_device *in,
        return false;
 
 hotdrop:
-       *hotdrop = true;
+       *par->hotdrop = true;
        return false;
 }
 
 static bool
-hashlimit_mt(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,
-             bool *hotdrop)
+hashlimit_mt(const struct sk_buff *skb, const struct xt_match_param *par)
 {
-       const struct xt_hashlimit_mtinfo1 *info = matchinfo;
+       const struct xt_hashlimit_mtinfo1 *info = par->matchinfo;
        struct xt_hashlimit_htable *hinfo = info->hinfo;
        unsigned long now = jiffies;
        struct dsthash_ent *dh;
        struct dsthash_dst dst;
 
-       if (hashlimit_init_dst(hinfo, &dst, skb, protoff) < 0)
+       if (hashlimit_init_dst(hinfo, &dst, skb, par->thoff) < 0)
                goto hotdrop;
 
        spin_lock_bh(&hinfo->lock);
@@ -666,16 +660,13 @@ hashlimit_mt(const struct sk_buff *skb, const struct net_device *in,
        return info->cfg.mode & XT_HASHLIMIT_INVERT;
 
  hotdrop:
-       *hotdrop = true;
+       *par->hotdrop = true;
        return false;
 }
 
-static bool
-hashlimit_mt_check_v0(const char *tablename, const void *inf,
-                      const struct xt_match *match, void *matchinfo,
-                      unsigned int hook_mask)
+static bool hashlimit_mt_check_v0(const struct xt_mtchk_param *par)
 {
-       struct xt_hashlimit_info *r = matchinfo;
+       struct xt_hashlimit_info *r = par->matchinfo;
 
        /* Check for overflow. */
        if (r->cfg.burst == 0 ||
@@ -704,8 +695,8 @@ hashlimit_mt_check_v0(const char *tablename, const void *inf,
         * the list of htable's in htable_create(), since then we would
         * create duplicate proc files. -HW */
        mutex_lock(&hlimit_mutex);
-       r->hinfo = htable_find_get(r->name, match->family);
-       if (!r->hinfo && htable_create_v0(r, match->family) != 0) {
+       r->hinfo = htable_find_get(r->name, par->match->family);
+       if (!r->hinfo && htable_create_v0(r, par->match->family) != 0) {
                mutex_unlock(&hlimit_mutex);
                return false;
        }
@@ -716,12 +707,9 @@ hashlimit_mt_check_v0(const char *tablename, const void *inf,
        return true;
 }
 
-static bool
-hashlimit_mt_check(const char *tablename, const void *inf,
-                   const struct xt_match *match, void *matchinfo,
-                   unsigned int hook_mask)
+static bool hashlimit_mt_check(const struct xt_mtchk_param *par)
 {
-       struct xt_hashlimit_mtinfo1 *info = matchinfo;
+       struct xt_hashlimit_mtinfo1 *info = par->matchinfo;
 
        /* Check for overflow. */
        if (info->cfg.burst == 0 ||
@@ -735,7 +723,7 @@ hashlimit_mt_check(const char *tablename, const void *inf,
                return false;
        if (info->name[sizeof(info->name)-1] != '\0')
                return false;
-       if (match->family == NFPROTO_IPV4) {
+       if (par->match->family == NFPROTO_IPV4) {
                if (info->cfg.srcmask > 32 || info->cfg.dstmask > 32)
                        return false;
        } else {
@@ -750,8 +738,8 @@ hashlimit_mt_check(const char *tablename, const void *inf,
         * the list of htable's in htable_create(), since then we would
         * create duplicate proc files. -HW */
        mutex_lock(&hlimit_mutex);
-       info->hinfo = htable_find_get(info->name, match->family);
-       if (!info->hinfo && htable_create(info, match->family) != 0) {
+       info->hinfo = htable_find_get(info->name, par->match->family);
+       if (!info->hinfo && htable_create(info, par->match->family) != 0) {
                mutex_unlock(&hlimit_mutex);
                return false;
        }
@@ -760,17 +748,16 @@ hashlimit_mt_check(const char *tablename, const void *inf,
 }
 
 static void
-hashlimit_mt_destroy_v0(const struct xt_match *match, void *matchinfo)
+hashlimit_mt_destroy_v0(const struct xt_mtdtor_param *par)
 {
-       const struct xt_hashlimit_info *r = matchinfo;
+       const struct xt_hashlimit_info *r = par->matchinfo;
 
        htable_put(r->hinfo);
 }
 
-static void
-hashlimit_mt_destroy(const struct xt_match *match, void *matchinfo)
+static void hashlimit_mt_destroy(const struct xt_mtdtor_param *par)
 {
-       const struct xt_hashlimit_mtinfo1 *info = matchinfo;
+       const struct xt_hashlimit_mtinfo1 *info = par->matchinfo;
 
        htable_put(info->hinfo);
 }
This page took 0.040801 seconds and 5 git commands to generate.