Age | Commit message (Collapse) | Author |
|
values.h is not present on other systems, and the glibc copy reads
right away: Old compatibility names for <limits.h> and <float.h>
constants.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
|
|
Patrick reports that the doxygen output shows up EXPORT_SYMBOL
and tells how to fix this:
> I just noticed the EXPORT_SYMBOLs in libmnl showing up in
> the doxygen output. Just in case you want to avoid this,
> what I'm doing in libdect is (besides the appopriate linker
> flags):
>
> #define __visible __attribute__((visibility("default")))
>
> #define EXPORT_SYMBOL(x) typeof(x) (x) __visible
>
>
> This allows to use EXPORT_SYMBOL as in the kernel, IOW
> after the function definition.
This patch also removes -Wredundant-decls to avoid a warning in every
single use of this new approach.
Now, this looks more like the Linux kernel way of exporting symbols.
Reported-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
This patch adds the new message batching infrastructure that allows to
store several messages into one single datagram.
This patch includes an example for ctnetlink.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
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>
|
|
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>
|
|
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>
|
|
This fixes `make distcheck'.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
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>
|
|
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
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>
|
|
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>
|
|
sendto/recvfrom return ssize_t, so libmnl should not truncate the
result range.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
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>
|
|
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>
|
|
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
groups, being a bitmask, should be unsigned; and let's also use pid_t
for pid.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
|
|
Because in most cases, it won't be a nul-terminated string :)
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
|
|
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>
|
|
Spelling, grammer, and synchronization of the readme.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
|
|
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
|
|
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
|
|
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
I like this quote.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
If the portID/sequence number that we specify is zero, we skip
the sequence tracking. This is useful if we use the same socket
to listen to events and to send commands and receive their
result.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
These functions are too simple wrappers that bloat the library.
We can use mnl_socket_get_fd() to obtain the file descriptor
and invoke message-oriented system call instead.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
This patch relaxes strict attribute checkings in the example files.
I have also changed the errno value, now it's EOPNOTSUPP instead of
EINVAL.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
This patch changes the errno value of mnl_cb_run[2]() in the
following two cases:
* Invalid expected portID: ESRCH.
* Invalid sequence number: EPROTO.
I didn't find any better generic errno value. EINVAL is reserved
for malformed messages, to avoid confusions.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
Based on code from Jozsef Kadlecsik and its ipset-5 implementation.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
AM_CFLAGS=-fPIC -Wall -Wextra -Wno-unused-parameter
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
callback.c: In function ‘mnl_cb_run2’:
callback.c:106: warning: pointer targets in passing argument 2 of ‘mnl_nlmsg_next’ differ in signednes
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
MNL_NLMSG_HDRLEN already provides the aligned size of the netlink header.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
This patch includes the following changes:
* use uint16_t for attribute types in mnl_attr_put_*() function
* use uint16_t for maximun type in mnl_attr_type_valid(...)
* use size_t for attribute size validation in mnl_attr_validate2(...)
* use unsigned int for offset in mnl_attr_parse(...) instead of int
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
mnl_attr_parse does not take into account the length of the netlink
message header and the offset. Thus when validating attributes, it
goes over the end of the real attribute stream and catches invalid
data areas.
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org
|
|
This function is still quite preliminary, comments welcome!
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
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>
|