| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The `len` parameter of `mnl_nlmsg_ok`, which holds the buffer length and
is compared to the size of the object expected to fit into the buffer,
is signed because the function validates the length, and it can be
negative in the case of malformed messages. Comparing it to unsigned
operands used to lead to compiler warnings:
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
and so commit 73661922bc3b ("fix warning in compilation due to different
signess") added casts of the unsigned operands to `int`. However, the
comparison to `nlh->nlmsg_len`:
(int)nlh->nlmsg_len <= len
is problematic, since `nlh->nlmsg_len` is of type `__u32` and so may
hold values greater than `INT_MAX`. In the case where `len` is positive
and `nlh->nlmsg_len` is greater than `INT_MAX`, the cast will yield a
negative value and `mnl_nlmsg_ok` will incorrectly return true.
Instead, assign `len` to an unsigned local variable, check for a
negative value first, then use the unsigned local for the other
comparisons, and remove the casts.
Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1691
Fixes: 73661922bc3b ("fix warning in compilation due to different signess")
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
|
|
| |
"allows to" -> "allows ${pronoun} to". We use "you" if that appears in context,
"one" otherwise.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Check isatty() to skip colors for non-terminals.
Add mnl_fprintf_attr_color() and mnl_fprintf_attr_raw() helper function.
Joint work with Pablo.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
|
| |
Put the diagram in a *verbatim* block (like all the other diagrams)
Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This corrects an oddity in the web doco (and presumably in the man pages as
well) whereby "Netlink message batch helpers" was showing up as a sub-topic of
"Netlink message helpers".
This was included in my original (rejected) patch "Enable doxygen to generate
Function Documentation" with a comment "(didn't think it warrantied an extra
patch)" - clearly wrong
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently clang requires EXPORT_SYMBOL() to be above the function
implementation. At the same time doxygen is not generating the proper
documentation because of that.
This patch solves that problem but EXPORT_SYMBOL looks less like the Linux
kernel way exporting symbols.
Reported-by: Duncan Roe <duncan_roe@optusnet.com.au>
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It makes more sense to use isprint() than isalnum() because we use non
alphanumeric characters like '%', '_', etc. And, in case of non
printable character, print a space is preferable to print a NULL (0) in
order to keep alignment.
Before:
...
|00012|--|00002| |len |flags| type|
| 5f 5f 73 65 | | data | s e
| 74 25 64 00 | | data | t d
...
After:
...
|00012|--|00002| |len |flags| type|
| 5f 5f 73 65 | | data | _ _ s e
| 74 25 64 00 | | data | t % d
...
Signed-off-by: Carlos Falgueras García <carlosfg@riseup.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
|
|
|
|
|
| |
mnl_attr_ok(): fix return value type
mnl_attr_put_u8(): remove unused param - len
mnl_attr_put_u8_check(): remove unused param - len
mnl_nlmsg_ok(): fix return value type
mnl_nlmsg_batch_stop(): not return batch size, but release it
Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
Signed-off-by: Florian Westphal <fw@strlen.de>
|
|
|
|
|
|
| |
Variable name in doxygen description was not correct.
Signed-off-by: Eric Leblond <eric@regit.org>
|
|
|
|
|
|
|
|
|
| |
When using mnl_nlmsg_put_extra_header() it pads out the addtional
header but only zeros the original size not the padded value. Which
cause valgrind to complain about sendto() with uninitialized byte.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Sean says: "I did find a discrepancy in the comments versus
practice in one function and I have attached a patch fixing those
comments to this message."
Sligtly mangled by myself.
Signed-off-by: Sean Robinson <seankrobinson@gmail.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 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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
|
|
|
| |
Spelling, grammer, and synchronization of the readme.
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>
|
|
|
|
| |
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>
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
This function is still quite preliminary, comments welcome!
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>
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|