summaryrefslogtreecommitdiff
path: root/src/attr.c
AgeCommit message (Collapse)Author
2010-04-05more consistency name issues: rename get_data*() to get_payload*()Pablo Neira Ayuso
This includes renaming get_tail() to get_payload_tail() Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2010-04-05xPablo Neira Ayuso
2010-04-05rename mnl_attr_type_ok() by mnl_attr_type_valid() for consistencyPablo Neira Ayuso
better to rename this function since its return value is not similar to other _ok() functions, for consistency. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2010-04-05fix warning in compilation due to different signessPablo Neira Ayuso
msg.c: In function ‘mnl_nlmsg_ok’: msg.c:136: warning: comparison between signed and unsigned msg.c:138: warning: comparison between signed and unsigned attr.c: In function ‘mnl_attr_ok’: attr.c:79: warning: comparison between signed and unsigned Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2010-04-04remove bogus checking in mnl_attr_validate() and mnl_attr_validate2()Pablo Neira Ayuso
attr.c: In function ‘mnl_attr_validate’: attr.c:189: warning: comparison of unsigned expression < 0 is always false attr.c: In function ‘mnl_attr_validate2’: attr.c:210: warning: comparison of unsigned expression < 0 is always false Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2010-04-04rename mnl_attr_type_invalid() by mnl_attr_type_ok()Pablo Neira Ayuso
And include the prototype in libmnl.h, since it was missing Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2010-04-04remove mnl_align() as it's been replaced by MNL_ALIGN()Pablo Neira Ayuso
We remove mnl_align() since it has been replaced by the macro MNL_ALIGN(). The macro allows its use in static arrays and such. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2010-04-03add validation infrastructure and rework attribute parsingPablo Neira Ayuso
This patch includes the new validation infrastructure which is decoupled from the attribute parsing. It is composed of: - mnl_attr_type_invalid: that allows to check if the attribute type is valid (ie. the type is not higher than WXYZ_MAX). - mnl_attr_validate: that allows to validate that there's enough room for the attribute data. The patch includes the rework of the attribute parsers. Now, you don't have to use an array of pointer to store the result of the parsing, you can use whatever data structure instead. The prototype as it follows: typedef int (*mnl_attr_cb_t)(const struct nlattr *attr, void *data); extern int mnl_attr_parse(const struct nlmsghdr *nlh, int offset, mnl_attr_cb_t cb, void *data) There are three versions of rtnl-link-dump.c that show how attribute parsing can be done now. Probably that many examples are not good idea, I may remove some of them from the tree in the future. This patch also merges mnl_attr_parse_at_offset into mnl_attr_parse. This patch modifies MNL_ALIGN so that we can use it in static arrays (the use of mnl_align() is not allowed in compilation time to initialize an array field). I have added the mnl_attr_for_each() macro and I have changed mnl_attr_for_each_nested() to declare the length variable internally. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2010-04-03use C99 types uintXX_t instead of POSIX u_intXX_tPablo Neira Ayuso
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2010-03-26add COPYING filePablo Neira Ayuso
This library is distributed under GPLv2+. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2010-03-22finish API documentationPablo Neira Ayuso
This patch may contain errors but we can review them and fix them later, better to have it in the tree (to allow others to contribute) to keep it in my local tree.
2010-03-19initial libmnl importPablo Neira Ayuso