fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / net / netfilter / xt_policy.c
index ba1ca03..46bde2b 100644 (file)
@@ -135,8 +135,7 @@ static int match(const struct sk_buff *skb,
 
 static int checkentry(const char *tablename, const void *ip_void,
                       const struct xt_match *match,
-                      void *matchinfo, unsigned int matchsize,
-                      unsigned int hook_mask)
+                      void *matchinfo, unsigned int hook_mask)
 {
        struct xt_policy_info *info = matchinfo;
 
@@ -165,43 +164,34 @@ static int checkentry(const char *tablename, const void *ip_void,
        return 1;
 }
 
-static struct xt_match policy_match = {
-       .name           = "policy",
-       .family         = AF_INET,
-       .match          = match,
-       .matchsize      = sizeof(struct xt_policy_info),
-       .checkentry     = checkentry,
-       .family         = AF_INET,
-       .me             = THIS_MODULE,
-};
-
-static struct xt_match policy6_match = {
-       .name           = "policy",
-       .family         = AF_INET6,
-       .match          = match,
-       .matchsize      = sizeof(struct xt_policy_info),
-       .checkentry     = checkentry,
-       .family         = AF_INET6,
-       .me             = THIS_MODULE,
+static struct xt_match xt_policy_match[] = {
+       {
+               .name           = "policy",
+               .family         = AF_INET,
+               .checkentry     = checkentry,
+               .match          = match,
+               .matchsize      = sizeof(struct xt_policy_info),
+               .me             = THIS_MODULE,
+       },
+       {
+               .name           = "policy",
+               .family         = AF_INET6,
+               .checkentry     = checkentry,
+               .match          = match,
+               .matchsize      = sizeof(struct xt_policy_info),
+               .me             = THIS_MODULE,
+       },
 };
 
 static int __init init(void)
 {
-       int ret;
-
-       ret = xt_register_match(&policy_match);
-       if (ret)
-               return ret;
-       ret = xt_register_match(&policy6_match);
-       if (ret)
-               xt_unregister_match(&policy_match);
-       return ret;
+       return xt_register_matches(xt_policy_match,
+                                  ARRAY_SIZE(xt_policy_match));
 }
 
 static void __exit fini(void)
 {
-       xt_unregister_match(&policy6_match);
-       xt_unregister_match(&policy_match);
+       xt_unregister_matches(xt_policy_match, ARRAY_SIZE(xt_policy_match));
 }
 
 module_init(init);