NFS: Kill the obsolete NFS_PARANOIA
[powerpc.git] / net / netfilter / xt_dccp.c
index dfb10b6..2c9c0de 100644 (file)
@@ -26,7 +26,7 @@ MODULE_DESCRIPTION("Match for DCCP protocol packets");
 MODULE_ALIAS("ipt_dccp");
 
 #define DCCHECK(cond, option, flag, invflag) (!((flag) & (option)) \
-                                 || (!!((invflag) & (option)) ^ (cond)))
+                                 || (!!((invflag) & (option)) ^ (cond)))
 
 static unsigned char *dccp_optbuf;
 static DEFINE_SPINLOCK(dccp_buflock);
@@ -67,9 +67,9 @@ dccp_find_option(u_int8_t option,
                        return 1;
                }
 
-               if (op[i] < 2) 
+               if (op[i] < 2)
                        i++;
-               else 
+               else
                        i += op[i+1]?:1;
        }
 
@@ -101,24 +101,23 @@ match(const struct sk_buff *skb,
       unsigned int protoff,
       int *hotdrop)
 {
-       const struct xt_dccp_info *info = 
-                               (const struct xt_dccp_info *)matchinfo;
+       const struct xt_dccp_info *info = matchinfo;
        struct dccp_hdr _dh, *dh;
 
        if (offset)
                return 0;
-       
+
        dh = skb_header_pointer(skb, protoff, sizeof(_dh), &_dh);
        if (dh == NULL) {
                *hotdrop = 1;
                return 0;
-               }
+       }
 
-       return  DCCHECK(((ntohs(dh->dccph_sport) >= info->spts[0]) 
-                       && (ntohs(dh->dccph_sport) <= info->spts[1])), 
-                       XT_DCCP_SRC_PORTS, info->flags, info->invflags)
-               && DCCHECK(((ntohs(dh->dccph_dport) >= info->dpts[0]) 
-                       && (ntohs(dh->dccph_dport) <= info->dpts[1])), 
+       return  DCCHECK(((ntohs(dh->dccph_sport) >= info->spts[0])
+                       && (ntohs(dh->dccph_sport) <= info->spts[1])),
+                       XT_DCCP_SRC_PORTS, info->flags, info->invflags)
+               && DCCHECK(((ntohs(dh->dccph_dport) >= info->dpts[0])
+                       && (ntohs(dh->dccph_dport) <= info->dpts[1])),
                        XT_DCCP_DEST_PORTS, info->flags, info->invflags)
                && DCCHECK(match_types(dh, info->typemask),
                           XT_DCCP_TYPE, info->flags, info->invflags)
@@ -132,7 +131,6 @@ checkentry(const char *tablename,
           const void *inf,
           const struct xt_match *match,
           void *matchinfo,
-          unsigned int matchsize,
           unsigned int hook_mask)
 {
        const struct xt_dccp_info *info = matchinfo;
@@ -142,28 +140,27 @@ checkentry(const char *tablename,
                && !(info->invflags & ~info->flags);
 }
 
-static struct xt_match dccp_match = 
-{ 
-       .name           = "dccp",
-       .match          = match,
-       .matchsize      = sizeof(struct xt_dccp_info),
-       .proto          = IPPROTO_DCCP,
-       .checkentry     = checkentry,
-       .family         = AF_INET,
-       .me             = THIS_MODULE,
-};
-static struct xt_match dccp6_match = 
-{ 
-       .name           = "dccp",
-       .match          = match,
-       .matchsize      = sizeof(struct xt_dccp_info),
-       .proto          = IPPROTO_DCCP,
-       .checkentry     = checkentry,
-       .family         = AF_INET6,
-       .me             = THIS_MODULE,
+static struct xt_match xt_dccp_match[] = {
+       {
+               .name           = "dccp",
+               .family         = AF_INET,
+               .checkentry     = checkentry,
+               .match          = match,
+               .matchsize      = sizeof(struct xt_dccp_info),
+               .proto          = IPPROTO_DCCP,
+               .me             = THIS_MODULE,
+       },
+       {
+               .name           = "dccp",
+               .family         = AF_INET6,
+               .checkentry     = checkentry,
+               .match          = match,
+               .matchsize      = sizeof(struct xt_dccp_info),
+               .proto          = IPPROTO_DCCP,
+               .me             = THIS_MODULE,
+       },
 };
 
-
 static int __init xt_dccp_init(void)
 {
        int ret;
@@ -174,27 +171,19 @@ static int __init xt_dccp_init(void)
        dccp_optbuf = kmalloc(256 * 4, GFP_KERNEL);
        if (!dccp_optbuf)
                return -ENOMEM;
-       ret = xt_register_match(&dccp_match);
+       ret = xt_register_matches(xt_dccp_match, ARRAY_SIZE(xt_dccp_match));
        if (ret)
                goto out_kfree;
-       ret = xt_register_match(&dccp6_match);
-       if (ret)
-               goto out_unreg;
-
        return ret;
 
-out_unreg:
-       xt_unregister_match(&dccp_match);
 out_kfree:
        kfree(dccp_optbuf);
-
        return ret;
 }
 
 static void __exit xt_dccp_fini(void)
 {
-       xt_unregister_match(&dccp6_match);
-       xt_unregister_match(&dccp_match);
+       xt_unregister_matches(xt_dccp_match, ARRAY_SIZE(xt_dccp_match));
        kfree(dccp_optbuf);
 }