aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Moore <paul.moore@hp.com>2006-09-25 18:54:03 -0400
committerDavid S. Miller <davem@davemloft.net>2006-09-25 18:54:03 -0400
commit4fe5d5c07ab615a52fd1b0ceba5aeed7c612821a (patch)
tree245e504bb1049e86f9f6dc369b679c5a5ca495ec
parent22acb19a91d2b551ea37647747972e5286284b22 (diff)
[Netlink]: add nla_validate_nested()
Add a new function, nla_validate_nested(), to validate nested Netlink attributes. Signed-off-by: Paul Moore <paul.moore@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/netlink.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 2897a73f81eb..4ab68a7a636a 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -146,6 +146,7 @@
146 * nla_ok(nla, remaining) does nla fit into remaining bytes? 146 * nla_ok(nla, remaining) does nla fit into remaining bytes?
147 * nla_next(nla, remaining) get next netlink attribute 147 * nla_next(nla, remaining) get next netlink attribute
148 * nla_validate() validate a stream of attributes 148 * nla_validate() validate a stream of attributes
149 * nla_validate_nested() validate a stream of nested attributes
149 * nla_find() find attribute in stream of attributes 150 * nla_find() find attribute in stream of attributes
150 * nla_find_nested() find attribute in nested attributes 151 * nla_find_nested() find attribute in nested attributes
151 * nla_parse() parse and validate stream of attrs 152 * nla_parse() parse and validate stream of attrs
@@ -951,6 +952,24 @@ static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start)
951} 952}
952 953
953/** 954/**
955 * nla_validate_nested - Validate a stream of nested attributes
956 * @start: container attribute
957 * @maxtype: maximum attribute type to be expected
958 * @policy: validation policy
959 *
960 * Validates all attributes in the nested attribute stream against the
961 * specified policy. Attributes with a type exceeding maxtype will be
962 * ignored. See documenation of struct nla_policy for more details.
963 *
964 * Returns 0 on success or a negative error code.
965 */
966static inline int nla_validate_nested(struct nlattr *start, int maxtype,
967 struct nla_policy *policy)
968{
969 return nla_validate(nla_data(start), nla_len(start), maxtype, policy);
970}
971
972/**
954 * nla_for_each_attr - iterate over a stream of attributes 973 * nla_for_each_attr - iterate over a stream of attributes
955 * @pos: loop counter, set to current attribute 974 * @pos: loop counter, set to current attribute
956 * @head: head of attribute stream 975 * @head: head of attribute stream