summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* add mnl_nlmsg_fprintf() function for debugging purposesPablo Neira Ayuso2010-04-193-13/+20
| | | | | | This function is still quite preliminary, comments welcome! Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* fix for mnl_attr_for_each_nested()Jozsef Kadlecsik2010-04-161-2/+2
| | | | | Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* update socket helper documentationPablo Neira Ayuso2010-04-121-5/+6
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* minor update in README (library is around 30KB here, not 20KB)Pablo Neira Ayuso2010-04-121-1/+1
|
* remove mnl_nlmsg_get_len() functionPablo Neira Ayuso2010-04-1210-30/+14
| | | | | | | | | Remove mnl_nlmsg_get_len() since it returns a field of a structure that is public (struct nlmsghdr). We can directly access the header fields and they are not likely to change in the future (at least for this version of Netlink I think). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* remove bogus casting in mnl_nlmsg_get_payload_tail()Pablo Neira Ayuso2010-04-121-1/+1
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* improve documentation of netlink message helpersPablo Neira Ayuso2010-04-121-21/+55
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* review documentation on netlink attribute helpersPablo Neira Ayuso2010-04-121-32/+68
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* add new README filePablo Neira Ayuso2010-04-081-8/+22
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* more consistency name issues: rename get_data*() to get_payload*()Pablo Neira Ayuso2010-04-0510-31/+31
| | | | | | This includes renaming get_tail() to get_payload_tail() Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* xPablo Neira Ayuso2010-04-051-1/+5
|
* rename mnl_nlmsg_payload_size() to mnl_nlmsg_get_payload_len() for consistencyPablo Neira Ayuso2010-04-052-4/+4
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* rename msg.c to nlmsg.cPablo Neira Ayuso2010-04-052-1/+4
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* rename mnl_attr_type_ok() by mnl_attr_type_valid() for consistencyPablo Neira Ayuso2010-04-058-23/+23
| | | | | | | 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>
* fix warning in compilation due to different signessPablo Neira Ayuso2010-04-052-4/+10
| | | | | | | | | | | 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>
* add -Wextra to spot more errors in compilationPablo Neira Ayuso2010-04-041-1/+1
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* remove bogus checking in mnl_attr_validate() and mnl_attr_validate2()Pablo Neira Ayuso2010-04-041-2/+2
| | | | | | | | | 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>
* rename mnl_attr_type_invalid() by mnl_attr_type_ok()Pablo Neira Ayuso2010-04-048-20/+22
| | | | | | And include the prototype in libmnl.h, since it was missing Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* remove mnl_align() as it's been replaced by MNL_ALIGN()Pablo Neira Ayuso2010-04-043-25/+12
| | | | | | | | 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>
* check source of the netlink message and fix sequence tracking logicPablo Neira Ayuso2010-04-0410-25/+55
| | | | | | | | | | | | This patch changes the callback handlers to include netlink portID checking. Thus, we avoid that any malicious process can spoof messages. If portid, sequence number of the message is != 0, we check if the message is what we expect. This allows to use the same netlink channel for dumps (portid, seq != 0) and event-based notifications (portid, seq == 0). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* add validation infrastructure and rework attribute parsingPablo Neira Ayuso2010-04-039-75/+617
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* revert abcaad6b65ed368c13c353ed71619332f76d9c2aPablo Neira Ayuso2010-04-034-16/+0
| | | | it's deeply broken 8-)
* check portid of received messages in examplesPablo Neira Ayuso2010-04-034-0/+16
| | | | | | | netlink is not connection-oriented, we have to check the origin of the message. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* use C99 types uintXX_t instead of POSIX u_intXX_tPablo Neira Ayuso2010-04-033-32/+33
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* constify several mnl_socket_* parameters and use size_t instead of intPablo Neira Ayuso2010-04-032-13/+13
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* fix mnl_socket_bind() to support the selection of the netlink portIDPablo Neira Ayuso2010-03-281-0/+1
|
* partially revert previous commitPablo Neira Ayuso2010-03-282-4/+4
| | | | | the use of unsigned int in the number of bytes affects other message handling helper function, hold on with this.
* use `unsigned int' for number of bytes and array size in callback APIPablo Neira Ayuso2010-03-282-7/+7
|
* add COPYING filePablo Neira Ayuso2010-03-265-8/+355
| | | | | | This library is distributed under GPLv2+. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* fix mnl_cb_run() and mnl_cb_run2() return value logicPablo Neira Ayuso2010-03-261-5/+13
|
* finish API documentationPablo Neira Ayuso2010-03-223-19/+129
| | | | | | 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.
* remove libnfnetlink stuff from autogen.shPablo Neira Ayuso2010-03-191-35/+0
|
* fix leak in mnl_socket_open()Pablo Neira Ayuso2010-03-191-1/+3
|
* initial libmnl importPablo Neira Ayuso2010-03-1920-0/+1635