diff options
author | Patrick McHardy <kaber@trash.net> | 2007-06-25 16:49:35 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 01:15:38 -0400 |
commit | 1092cb219774a82b1f16781aec7b8d4ec727c981 (patch) | |
tree | dddd1d559e08c07b41715d8cf2678ff7d45d5230 /net/netlink | |
parent | 334a8132d9950f769f390f0f35c233d099688e7a (diff) |
[NETLINK]: attr: add nested compat attribute type
Add a nested compat attribute type that can be used to convert
attributes that contain a structure to nested attributes in a
backwards compatible way.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
-rw-r--r-- | net/netlink/attr.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/netlink/attr.c b/net/netlink/attr.c index c591212793ee..e4d7bed99c2e 100644 --- a/net/netlink/attr.c +++ b/net/netlink/attr.c | |||
@@ -72,6 +72,17 @@ static int validate_nla(struct nlattr *nla, int maxtype, | |||
72 | return -ERANGE; | 72 | return -ERANGE; |
73 | break; | 73 | break; |
74 | 74 | ||
75 | case NLA_NESTED_COMPAT: | ||
76 | if (attrlen < pt->len) | ||
77 | return -ERANGE; | ||
78 | if (attrlen < NLA_ALIGN(pt->len)) | ||
79 | break; | ||
80 | if (attrlen < NLA_ALIGN(pt->len) + NLA_HDRLEN) | ||
81 | return -ERANGE; | ||
82 | nla = nla_data(nla) + NLA_ALIGN(pt->len); | ||
83 | if (attrlen < NLA_ALIGN(pt->len) + NLA_HDRLEN + nla_len(nla)) | ||
84 | return -ERANGE; | ||
85 | break; | ||
75 | default: | 86 | default: |
76 | if (pt->len) | 87 | if (pt->len) |
77 | minlen = pt->len; | 88 | minlen = pt->len; |