| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Users of mnl_cb_run2() would typically pass a 'static const' array as
cb_ctl_array parameter. Unfortunately this triggers a compiler warning
because the prototype doesn't declare cb_ctl_array with the 'const'
qualifier.
Since mnl_cb_run2() and __mnl_cb_run() don't modify cb_ctl_array (and
don't have any reason to do so in the future), we can mark this
parameter as 'const'.
There should be no impact on existing users beyond removing the
compiler warning when using a constant array.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
|
| |
Place the returned value, function name and parameters (as many as can
fit) in the same line.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When compiling with clang, the visibility attributes are ignored
since they are after the definition of the exported function.
Fix this by moving the attribute declaration before the function.
attr.c:439:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
EXPORT_SYMBOL(mnl_attr_put_u8);
^
./internal.h:7:41: note: expanded from macro 'EXPORT_SYMBOL'
^
./internal.h:6:35: note: expanded from macro '__visible'
^
attr.c:435:6: note: previous definition is here
void mnl_attr_put_u8(struct nlmsghdr *nlh, uint16_t type, uint8_t data)
^
Signed-off-by: Peter Foley <pefoley2@pefoley.com>
|
|
|
|
|
|
|
|
|
|
| |
Propagate the error to the user-space application, that should retry.
[ I have mangled this patch to document EINTR in mnl_cb_run. --pablo ]
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Because in most cases, it won't be a nul-terminated string :)
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
|
|
|
|
| |
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
| |
This includes renaming get_tail() to get_payload_tail()
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
the use of unsigned int in the number of bytes affects other message
handling helper function, hold on with this.
|
| |
|
|
|
|
|
|
| |
This library is distributed under GPLv2+.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
| |
|
|
|
|
|
|
| |
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.
|
|
|