]> err.no Git - linux-2.6/blobdiff - net/netfilter/xt_helper.c
[NETFILTER]: x_tables: replace IPv4/IPv6 policy match by address family independant...
[linux-2.6] / net / netfilter / xt_helper.c
index 38b6715e1db41e4aff52c1a2a046bb886fc35c11..ef8e54d40c9225afbe95d99e702f7136d56c7e29 100644 (file)
@@ -42,6 +42,7 @@ 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,
@@ -89,6 +90,7 @@ 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,
@@ -96,6 +98,7 @@ match(const struct sk_buff *skb,
 {
        const struct xt_helper_info *info = matchinfo;
        struct nf_conn *ct;
+       struct nf_conn_help *master_help;
        enum ip_conntrack_info ctinfo;
        int ret = info->invert;
        
@@ -111,7 +114,8 @@ match(const struct sk_buff *skb,
        }
 
        read_lock_bh(&nf_conntrack_lock);
-       if (!ct->master->helper) {
+       master_help = nfct_help(ct->master);
+       if (!master_help || !master_help->helper) {
                DEBUGP("xt_helper: master ct %p has no helper\n", 
                        exp->expectant);
                goto out_unlock;
@@ -123,8 +127,8 @@ match(const struct sk_buff *skb,
        if (info->name[0] == '\0')
                ret ^= 1;
        else
-               ret ^= !strncmp(ct->master->helper->name, info->name, 
-                               strlen(ct->master->helper->name));
+               ret ^= !strncmp(master_help->helper->name, info->name,
+                               strlen(master_help->helper->name));
 out_unlock:
        read_unlock_bh(&nf_conntrack_lock);
        return ret;
@@ -133,6 +137,7 @@ out_unlock:
 
 static int check(const char *tablename,
                 const void *inf,
+                const struct xt_match *match,
                 void *matchinfo,
                 unsigned int matchsize,
                 unsigned int hook_mask)
@@ -140,24 +145,21 @@ static int check(const char *tablename,
        struct xt_helper_info *info = matchinfo;
 
        info->name[29] = '\0';
-
-       /* verify size */
-       if (matchsize != XT_ALIGN(sizeof(struct xt_helper_info)))
-               return 0;
-
        return 1;
 }
 
 static struct xt_match helper_match = {
        .name           = "helper",
-       .match          = &match,
-       .checkentry     = &check,
+       .match          = match,
+       .matchsize      = sizeof(struct xt_helper_info),
+       .checkentry     = check,
        .me             = THIS_MODULE,
 };
 static struct xt_match helper6_match = {
        .name           = "helper",
-       .match          = &match,
-       .checkentry     = &check,
+       .match          = match,
+       .matchsize      = sizeof(struct xt_helper_info),
+       .checkentry     = check,
        .me             = THIS_MODULE,
 };