linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / net / ipv6 / netfilter / ip6t_frag.c
index 06768c8..185f583 100644 (file)
@@ -43,7 +43,6 @@ static int
 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,
@@ -52,9 +51,14 @@ match(const struct sk_buff *skb,
        struct frag_hdr _frag, *fh;
        const struct ip6t_frag *fraginfo = matchinfo;
        unsigned int ptr;
+       int err;
 
-       if (ipv6_find_hdr(skb, &ptr, NEXTHDR_FRAGMENT, NULL) < 0)
+       err = ipv6_find_hdr(skb, &ptr, NEXTHDR_FRAGMENT, NULL);
+       if (err < 0) {
+               if (err != -ENOENT)
+                       *hotdrop = 1;
                return 0;
+       }
 
        fh = skb_header_pointer(skb, ptr, sizeof(_frag), &_frag);
        if (fh == NULL) {
@@ -117,37 +121,41 @@ match(const struct sk_buff *skb,
 static int
 checkentry(const char *tablename,
           const void *ip,
-          const struct xt_match *match,
           void *matchinfo,
           unsigned int matchinfosize,
           unsigned int hook_mask)
 {
        const struct ip6t_frag *fraginfo = matchinfo;
 
+       if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_frag))) {
+               DEBUGP("ip6t_frag: matchsize %u != %u\n",
+                      matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_frag)));
+               return 0;
+       }
        if (fraginfo->invflags & ~IP6T_FRAG_INV_MASK) {
                DEBUGP("ip6t_frag: unknown flags %X\n", fraginfo->invflags);
                return 0;
        }
+
        return 1;
 }
 
 static struct ip6t_match frag_match = {
        .name           = "frag",
-       .match          = match,
-       .matchsize      = sizeof(struct ip6t_frag),
-       .checkentry     = checkentry,
+       .match          = &match,
+       .checkentry     = &checkentry,
        .me             = THIS_MODULE,
 };
 
-static int __init ip6t_frag_init(void)
+static int __init init(void)
 {
        return ip6t_register_match(&frag_match);
 }
 
-static void __exit ip6t_frag_fini(void)
+static void __exit cleanup(void)
 {
        ip6t_unregister_match(&frag_match);
 }
 
-module_init(ip6t_frag_init);
-module_exit(ip6t_frag_fini);
+module_init(init);
+module_exit(cleanup);