summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* header: use getpagesize() for MNL_SOCKET_BUFFER_SIZEPablo Neira Ayuso2010-12-171-1/+1
| | | | | | | | This system call returns PAGE_SIZE which depends on the architecture. See linux/netlink.h for more information on the appropriate datagram size for netlink. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* attr: add put function that allows to check buffer sizePablo Neira Ayuso2010-12-173-0/+192
| | | | | | | | | | This patch adds a set of function that allows to check the size of the buffer. This is useful for attribute batching. This is strongly based on a patch from Jozsef. Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* callback: use of inline in mnl_cb_run*() functionPablo Neira Ayuso2010-12-121-35/+44
| | | | | | | | | This patch defines a new function __mnl_cb_run() which is inlined in mnl_cb_run() and mnl_cb_run2(). This patch increases the size of the library in ~1KB. IIRC, Davem suggested this during the Netfilter Workshop. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* header: add MNL_ARRAY_SIZE(x)Pablo Neira Ayuso2010-12-091-0/+4
| | | | | | | This patch adds MNL_ARRAY_SIZE(x) which likely to defined over and over again if you use mnl_cb_run2(...). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* attr: add mnl_attr_nest_cancel()Pablo Neira Ayuso2010-11-223-0/+15
| | | | | | | This patch adds mnl_attr_nest_cancel() that allows to cancel the current nest that we are building. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* add libmnl.map file to src/Makefile.amPablo Neira Ayuso2010-11-191-1/+1
| | | | | | | This fixes `make distcheck'. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* nlmsg: remove unused function mnl_nlmsg_aligned_size()Jan Engelhardt2010-11-191-12/+0
| | | | | | | | | | | | | With the new CFLAGS, a notification pops up: nlmsg.c:64:8: warning: no previous prototype for "mnl_nlmsg_aligned_size" Marking it thus as static reveals it can be removed. nlmsg.c:64:15: warning: "mnl_nlmsg_aligned_size" defined but not used Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* ld: add some more precautionary CFLAGSJan Engelhardt2010-11-192-1/+6
| | | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* build: tag function headers rather than decls as exportedJan Engelhardt2010-11-1911-171/+169
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* nlmsg: remove unexisting mnl_nlmsg_total_sizePablo Neira Ayuso2010-11-192-2/+0
| | | | | | | Remove function whose implementation does not exist. It seems to me like a leftover from the early days of the library. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* license: change licensing terms from GPLv2+ to LGPLv2.1+Pablo Neira Ayuso2010-11-195-275/+400
| | | | | | | | | | Existing contributors ACK'ed the license change via email: * Jozsef Kadlecsik * Jan Engelhardt * Cristian Rodríguez Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* Update .gitignoreJan Engelhardt2010-11-161-0/+1
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* socket: propagate sendto/recvmsg's return typesJan Engelhardt2010-11-162-5/+7
| | | | | | | sendto/recvfrom return ssize_t, so libmnl should not truncate the result range. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* attr: avoid multiple definition of hidden variableJan Engelhardt2010-11-162-25/+16
| | | | | | | | | | When nesting two mnl_attr_for_each loops, the __len__ variable will be declared twice, eliciting a warning when -Wshadow is turned on. There can also be warnings in pre-C99 because declarations and code are mixed. Do without any temporaries that are not explicitly specified as macro parameters. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* include: use C++ headers in C++ modeJan Engelhardt2010-11-151-5/+8
| | | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* src: implement both GCC visibility support and export scriptCristian Rodríguez2010-11-156-53/+170
| | | | | | | | | Read "How to write shared libraries" from Ulrich Drepper for more information on this patch. Specifically section 2.2: Export control and section 3: Maintaining APIs and ABIs. Signed-off-by: Cristian Rodríguez <cristian.rodriguez@opensuse.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* attr: remove redundant check for NULLJan Engelhardt2010-11-111-2/+2
| | | | | | | | Calling mnl_attr_parse with cb==NULL is pointless, because the function will do nothing else. Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* nlmsg: use bool for mnl_nlmsg_ok()Jan Engelhardt2010-11-113-4/+4
| | | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* socket: constify a struct sockaddr_nlJan Engelhardt2010-11-111-1/+1
| | | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* Merge branch 'master' of git://dev.medozas.de/libmnlPablo Neira Ayuso2010-11-073-6/+1
|\
| * build: remove statements without obvious effectJan Engelhardt2010-11-052-5/+0
| |
| * build: remove -fPIC flagJan Engelhardt2010-10-311-1/+1
| | | | | | | | | | | | libtool automatically adds PIC flags as needed. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* | nlmsg: rework mnl_nlmsg_fprintfPablo Neira Ayuso2010-11-073-27/+136
| | | | | | | | | | | | | | | | This patch reworks mnl_nlmsg_fprintf. It breaks backward compatibility of this function, there was no way to improve it without doing so (and we are still in time to break thing, BTW). Signed-off-bu: Pablo Neira Ayuso <pablo@netfilter.org>
* | examples: add nflog examplePablo Neira Ayuso2010-11-072-0/+233
|/ | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: remove redundant castsJan Engelhardt2010-10-306-11/+11
|
* attr: rename str_null from NULL awayJan Engelhardt2010-10-253-6/+6
| | | | | | | | | | A small little pedantism: NULL (as in, the pointer) isn't NUL (as in, the character with value zero, '\0'). I propose to rename it to strz, for the zero-terminated string (sometimes referred to as ASCIZ string, but of course C isn't tied to ASCII). Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* nlmsg: use bool return type for yes-no functionsJan Engelhardt2010-10-252-11/+14
| | | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* include: add cplusplus guards for externJan Engelhardt2010-10-221-0/+8
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* socket: use more appropriate types for mnl_socket_bindJan Engelhardt2010-10-222-2/+2
| | | | | | | groups, being a bitmask, should be unsigned; and let's also use pid_t for pid. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* callback: mnl_cb_run should use a void *Jan Engelhardt2010-10-222-5/+5
| | | | | | Because in most cases, it won't be a nul-terminated string :) Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* attr: string functions should take char *Jan Engelhardt2010-10-222-4/+4
| | | | | | | | I do not quite see the point of using strlen in conjunction with non-string data; so let's use char * as argument types to catch misuses. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* include: consistent usage of "extern"Jan Engelhardt2010-10-221-1/+1
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* doc: documentation updatesJan Engelhardt2010-10-224-26/+27
| | | | | | Spelling, grammer, and synchronization of the readme. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* socket: remove statement with no effectJan Engelhardt2010-10-221-1/+0
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* src: remove redundant castsJan Engelhardt2010-10-222-2/+2
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* src: add const qualifiersJan Engelhardt2010-10-222-5/+5
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* src: avoid using deprecated unspecified argument listsJan Engelhardt2010-10-226-6/+6
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* build: fix disable_static functionalityJan Engelhardt2010-10-221-1/+1
| | | | | | | Small slip on my part. AC_DISABLE_STATIC must actually come before LT_INIT to have any effect. (This is even documented.) Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* doc: git tree update (now at netfilter.org) and fix listing in doxygenPablo Neira Ayuso2010-10-211-7/+7
| | | | | | | | This patch update the git tree address (now at netfilter.org) and it also fixes a minor problem with the doxygen output in one of the socket helpers. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* src: define MNL_SOCKET_BUFFER_SIZE to 8192ULPablo Neira Ayuso2010-10-2112-12/+16
| | | | | | | | | | | | | | | | Davem spotted during the Netfilter Workshop that user-space applications should use 8KB buffers for recv(). I accidentally found that NFLOG is not following this approach (in this case we're using 131072 bytes messages), we have to document this. Anyway, according to linux/netlink.h (and to complete this log message): "skb should fit one page. This choice is good for headerless malloc. But we should limit to 8K so that userspace does not have to use enormous buffer sizes on recvmsg() calls just to avoid MSG_TRUNC when PAGE_SIZE is very large." Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* Add .gitignore filesJan Engelhardt2010-10-194-0/+33
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* build: default to not build static librariesJan Engelhardt2010-10-191-0/+1
| | | | | | | Users wanting static libraries can just use ./configure --enable-static. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* build: remove unneeded -dynamic -ldl -nostartfiles flagsJan Engelhardt2010-10-194-11/+1
| | | | | | | | | Besides that -ldl should be in _LDADD (not _LDFLAGS), I do not see any dlopen calls at all that would make the library a requirement. I also see no reason to use -Wc,-nostartfiles. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* build: resolve compiler warningsJan Engelhardt2010-10-191-1/+1
| | | | | | | | nlmsg.c: In function "mnl_nlmsg_fprintf": nlmsg.c:260:4: warning: format "%.3d" expects type "int", but argument 3 has type "size_t" Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* build: rebuild .pc files when configure status changedJan Engelhardt2010-10-191-0/+2
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* build: run autoupdateJan Engelhardt2010-10-193-6/+5
| | | | | | | | | | | | Macro usage has changed over the last few years. Update it to the current specification using autoupdate(1). Manually update INCLUDES -> CPPFLAGS, because autoupdate did not catch that. Remove $(all_includes) and $(LIBS) because it is not used anywhere. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* build: use subdir-objects and CC_C_OJan Engelhardt2010-10-191-1/+2
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* build: automake options should be in AM_INIT_AUTOMAKEJan Engelhardt2010-10-192-2/+1
| | | | | | | Automake options set in Makefile.am are not always propagated to subdirecties. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* build: do not abuse AM_INIT_AUTOMAKE for autoconf optionsJan Engelhardt2010-10-191-2/+2
| | | | | | Also rename the file to its standard designated name. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* build: just use autoreconfJan Engelhardt2010-10-191-16/+2
| | | | | | | This is the recommended way to regenerate the GNU build system files these days. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>