This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / net / ipv4 / netfilter / ipt_helper.c
index ee9881e..bed83c7 100644 (file)
@@ -41,17 +41,17 @@ match(const struct sk_buff *skb,
        struct ip_conntrack_expect *exp;
        struct ip_conntrack *ct;
        enum ip_conntrack_info ctinfo;
-       int ret = info->invert;
+       int ret = 0;
        
        ct = ip_conntrack_get((struct sk_buff *)skb, &ctinfo);
        if (!ct) {
                DEBUGP("ipt_helper: Eek! invalid conntrack?\n");
-               return ret;
+               return 0;
        }
 
        if (!ct->master) {
                DEBUGP("ipt_helper: conntrack %p has no master\n", ct);
-               return ret;
+               return 0;
        }
 
        exp = ct->master;
@@ -71,11 +71,8 @@ match(const struct sk_buff *skb,
        DEBUGP("master's name = %s , info->name = %s\n", 
                exp->expectant->helper->name, info->name);
 
-       if (info->name[0] == '\0')
-               ret ^= 1;
-       else
-               ret ^= !strncmp(exp->expectant->helper->name, info->name, 
-                               strlen(exp->expectant->helper->name));
+       ret = !strncmp(exp->expectant->helper->name, info->name, 
+                      strlen(exp->expectant->helper->name)) ^ info->invert;
 out_unlock:
        READ_UNLOCK(&ip_conntrack_lock);
        return ret;
@@ -95,6 +92,10 @@ static int check(const char *tablename,
        if (matchsize != IPT_ALIGN(sizeof(struct ipt_helper_info)))
                return 0;
 
+       /* verify that we actually should match anything */
+       if ( strlen(info->name) == 0 )
+               return 0;
+       
        return 1;
 }
 
@@ -107,6 +108,7 @@ static struct ipt_match helper_match = {
 
 static int __init init(void)
 {
+       need_ip_conntrack();
        return ipt_register_match(&helper_match);
 }