aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/nf_conntrack_core.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-09-28 17:39:55 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:53:35 -0400
commitf73e924cdd166360e8cc9a1b193008fdc9b3e3e2 (patch)
tree48fbf4b0f9101359e05fb53eabe194495f8214d1 /net/netfilter/nf_conntrack_core.c
parent5bf758539388fa9383afd539d052ae93229544b9 (diff)
[NETFILTER]: ctnetlink: use netlink policy
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netfilter/nf_conntrack_core.c')
-rw-r--r--net/netfilter/nf_conntrack_core.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 9edaaf2d57e..f9d36cab70f 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -844,10 +844,11 @@ nla_put_failure:
844} 844}
845EXPORT_SYMBOL_GPL(nf_ct_port_tuple_to_nlattr); 845EXPORT_SYMBOL_GPL(nf_ct_port_tuple_to_nlattr);
846 846
847static const size_t cta_min_proto[CTA_PROTO_MAX+1] = { 847const struct nla_policy nf_ct_port_nla_policy[CTA_PROTO_MAX+1] = {
848 [CTA_PROTO_SRC_PORT] = sizeof(u_int16_t), 848 [CTA_PROTO_SRC_PORT] = { .type = NLA_U16 },
849 [CTA_PROTO_DST_PORT] = sizeof(u_int16_t) 849 [CTA_PROTO_DST_PORT] = { .type = NLA_U16 },
850}; 850};
851EXPORT_SYMBOL_GPL(nf_ct_port_nla_policy);
851 852
852int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[], 853int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
853 struct nf_conntrack_tuple *t) 854 struct nf_conntrack_tuple *t)
@@ -855,9 +856,6 @@ int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
855 if (!tb[CTA_PROTO_SRC_PORT] || !tb[CTA_PROTO_DST_PORT]) 856 if (!tb[CTA_PROTO_SRC_PORT] || !tb[CTA_PROTO_DST_PORT])
856 return -EINVAL; 857 return -EINVAL;
857 858
858 if (nlattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto))
859 return -EINVAL;
860
861 t->src.u.tcp.port = *(__be16 *)nla_data(tb[CTA_PROTO_SRC_PORT]); 859 t->src.u.tcp.port = *(__be16 *)nla_data(tb[CTA_PROTO_SRC_PORT]);
862 t->dst.u.tcp.port = *(__be16 *)nla_data(tb[CTA_PROTO_DST_PORT]); 860 t->dst.u.tcp.port = *(__be16 *)nla_data(tb[CTA_PROTO_DST_PORT]);
863 861