X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fipv4%2Fnetfilter%2Fipt_helper.c;h=ee9881ece49fe6896aa4aea7de3897764a58e256;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=bed83c79e3ccefab7259c3360f55ef34820e48fc;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/net/ipv4/netfilter/ipt_helper.c b/net/ipv4/netfilter/ipt_helper.c index bed83c79e..ee9881ece 100644 --- a/net/ipv4/netfilter/ipt_helper.c +++ b/net/ipv4/netfilter/ipt_helper.c @@ -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 = 0; + int ret = info->invert; ct = ip_conntrack_get((struct sk_buff *)skb, &ctinfo); if (!ct) { DEBUGP("ipt_helper: Eek! invalid conntrack?\n"); - return 0; + return ret; } if (!ct->master) { DEBUGP("ipt_helper: conntrack %p has no master\n", ct); - return 0; + return ret; } exp = ct->master; @@ -71,8 +71,11 @@ match(const struct sk_buff *skb, DEBUGP("master's name = %s , info->name = %s\n", exp->expectant->helper->name, info->name); - ret = !strncmp(exp->expectant->helper->name, info->name, - strlen(exp->expectant->helper->name)) ^ info->invert; + if (info->name[0] == '\0') + ret ^= 1; + else + ret ^= !strncmp(exp->expectant->helper->name, info->name, + strlen(exp->expectant->helper->name)); out_unlock: READ_UNLOCK(&ip_conntrack_lock); return ret; @@ -92,10 +95,6 @@ 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; } @@ -108,7 +107,6 @@ static struct ipt_match helper_match = { static int __init init(void) { - need_ip_conntrack(); return ipt_register_match(&helper_match); }