[NETFILTER]: ctnetlink: use netlink policy
[linux-2.6.git] / net / ipv6 / netfilter / nf_conntrack_l3proto_ipv6.c
index 567fbe2..37a3db9 100644 (file)
@@ -350,9 +350,9 @@ nla_put_failure:
        return -1;
 }
 
-static const size_t cta_min_ip[CTA_IP_MAX+1] = {
-       [CTA_IP_V6_SRC] = sizeof(u_int32_t)*4,
-       [CTA_IP_V6_DST] = sizeof(u_int32_t)*4,
+static const struct nla_policy ipv6_nla_policy[CTA_IP_MAX+1] = {
+       [CTA_IP_V6_SRC] = { .len = sizeof(u_int32_t)*4 },
+       [CTA_IP_V6_DST] = { .len = sizeof(u_int32_t)*4 },
 };
 
 static int ipv6_nlattr_to_tuple(struct nlattr *tb[],
@@ -361,9 +361,6 @@ static int ipv6_nlattr_to_tuple(struct nlattr *tb[],
        if (!tb[CTA_IP_V6_SRC] || !tb[CTA_IP_V6_DST])
                return -EINVAL;
 
-       if (nlattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
-               return -EINVAL;
-
        memcpy(&t->src.u3.ip6, nla_data(tb[CTA_IP_V6_SRC]),
               sizeof(u_int32_t) * 4);
        memcpy(&t->dst.u3.ip6, nla_data(tb[CTA_IP_V6_DST]),
@@ -384,6 +381,7 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6 __read_mostly = {
 #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
        .tuple_to_nlattr        = ipv6_tuple_to_nlattr,
        .nlattr_to_tuple        = ipv6_nlattr_to_tuple,
+       .nla_policy             = ipv6_nla_policy,
 #endif
 #ifdef CONFIG_SYSCTL
        .ctl_table_path         = nf_net_netfilter_sysctl_path,