netfilter: ctnetlink: nla_policy updates
authorFlorian Westphal <fw@strlen.de>
Thu, 22 Nov 2012 01:32:46 +0000 (01:32 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 3 Dec 2012 14:13:10 +0000 (15:13 +0100)
Add stricter checking for a few attributes.
Note that these changes don't fix any bug in the current code base.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_conntrack_proto_tcp.c

index c24a00a73c7b302b0a6d9534b4f3681e5e2349aa..4e078cd84d83c2c15c70ab4270b87a05e590f4ad 100644 (file)
@@ -898,7 +898,8 @@ ctnetlink_parse_zone(const struct nlattr *attr, u16 *zone)
 }
 
 static const struct nla_policy help_nla_policy[CTA_HELP_MAX+1] = {
-       [CTA_HELP_NAME]         = { .type = NLA_NUL_STRING },
+       [CTA_HELP_NAME]         = { .type = NLA_NUL_STRING,
+                                   .len = NF_CT_HELPER_NAME_LEN - 1 },
 };
 
 static inline int
@@ -932,6 +933,8 @@ static const struct nla_policy ct_nla_policy[CTA_MAX+1] = {
        [CTA_ID]                = { .type = NLA_U32 },
        [CTA_NAT_DST]           = { .type = NLA_NESTED },
        [CTA_TUPLE_MASTER]      = { .type = NLA_NESTED },
+       [CTA_NAT_SEQ_ADJ_ORIG]  = { .type = NLA_NESTED },
+       [CTA_NAT_SEQ_ADJ_REPLY] = { .type = NLA_NESTED },
        [CTA_ZONE]              = { .type = NLA_U16 },
        [CTA_MARK_MASK]         = { .type = NLA_U32 },
 };
@@ -2322,7 +2325,8 @@ static const struct nla_policy exp_nla_policy[CTA_EXPECT_MAX+1] = {
        [CTA_EXPECT_MASK]       = { .type = NLA_NESTED },
        [CTA_EXPECT_TIMEOUT]    = { .type = NLA_U32 },
        [CTA_EXPECT_ID]         = { .type = NLA_U32 },
-       [CTA_EXPECT_HELP_NAME]  = { .type = NLA_NUL_STRING },
+       [CTA_EXPECT_HELP_NAME]  = { .type = NLA_NUL_STRING,
+                                   .len = NF_CT_HELPER_NAME_LEN - 1 },
        [CTA_EXPECT_ZONE]       = { .type = NLA_U16 },
        [CTA_EXPECT_FLAGS]      = { .type = NLA_U32 },
        [CTA_EXPECT_CLASS]      = { .type = NLA_U32 },
index 61f9285111d19ae5b34c59b5d8f98366d0645086..83876e9877f1457e675dadb65a3d299e71e84165 100644 (file)
@@ -1353,6 +1353,8 @@ static const struct nla_policy tcp_timeout_nla_policy[CTA_TIMEOUT_TCP_MAX+1] = {
        [CTA_TIMEOUT_TCP_TIME_WAIT]     = { .type = NLA_U32 },
        [CTA_TIMEOUT_TCP_CLOSE]         = { .type = NLA_U32 },
        [CTA_TIMEOUT_TCP_SYN_SENT2]     = { .type = NLA_U32 },
+       [CTA_TIMEOUT_TCP_RETRANS]       = { .type = NLA_U32 },
+       [CTA_TIMEOUT_TCP_UNACK]         = { .type = NLA_U32 },
 };
 #endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */