| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
srandom() and random() are a code smell, because they are not thread safe.
Avoid its usage, even if this was only for testing. Even in testing code,
we don't want to find those functions and have to reason why they are fine
for testing. Just don't.
Arguably, _nltst_rand_u32() calls jrand48(), which (in glibc) is
possibly not thread-safe either. But that is only one place for
investigation, instead of 3.
Also, _nltst_rand_u32() honors NLTST_SEED_RAND to generate a
reproducible sequence of random numbers.
|
| | |
|
| | |
|
| |
|
|
| |
$ ./tools/clang-format.sh
|
| |
|
|
|
|
| |
As we now copy all linux headers, and we have include/linux-private
in our include search path, just include the linux headers as we commonly
do.
|
| | |
|
| |
|
|
|
| |
For no strong reason, we include the public netlink headers with
<> instead of "". Be consistent.
|
| |
|
|
|
|
|
| |
We have copies of the linux headers in include/linux-private.
For those files, include the copies explicitly.
No practice there is no difference, since we build with :-Ilinux-private".
|
| | |
|
| | |
|
| |
|
|
|
| |
Move all the declarations from "netlink-private/types.h" to places
closer to where they are used.
|
| |
|
|
|
| |
Naming is just so important to understand what this is.
This name is better.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
To new header "include/nl-hidden-route/nl-hidden-route.h".
libnl-route-3 exports some symbols that are no in public headers.
They are however used by other internal users in the source tree.
Such usage seems bad. We should clearly see where this is done.
Move the symbols to a separate header, where it's clear who may
use this header, and what's its purpose.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This header has a very specific purpose. To give access to the unit
tests to some internals.
It only is usable to parts that statically link with libnl-route-3
sources (e.g. "tests/check-direct") and libnl-route-3 itself.
The point is that the symbol there is not exported by the libnl-route-3
shared library, so a test that dynamically links against libnl-route-3
couldn't access them. Hence the internal purpose of static linking the
test with libnl-route-3 sources, and a special header for that.
Move "include/netlink-private/route/utils.h" to a separate place, to
make that usage clearer.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have "include/netlink-private/netlink.h", which is private
API used internally.
However, it's confusing where "include/netlink-private/netlink.h" can be
used. For example, it contains some "libnl-route-3.so" specific
extensions like "link_lookup()", hence you would think that it
can only be used with libraries that also use "libnl-route-3.so".
Well, since it's a header, you actually can also use it for example
under "lib/xfrm/", you couldn't just use those declarations because they
are implemented and accessible only under "lib/route/"
In a first step to clean this up, and move helper to separate headers,
add "include/nl-aux-{core,route}" headers with certain clear usage.
Clear in the sense who may use those headers, and what the
implementation of those headers may use.
|
| |
|
|
|
|
|
|
|
|
| |
"base/nl-base-utils.h" (formerly "netlink-private/utils.h") contains
no libnl3 specific references, just a bunch of C helpers.
It's also a header-only "library", so it can be freely used by all our
C-code.
Move it to a separate directory, to make that clear.
|
| |
|
|
|
|
| |
Flush stdout after object dumps to have complete and immediate output when
stdout is not line buffered, such as when piping the test-cache-mngr output
to grep.
|
| |
|
|
| |
The format is the same as `ip -ts monitor` so the two can be compared.
|
| |
|
|
|
| |
Useful for some caches with multiple families in co_groups, such as the
"route/link" cache.
|
| |
|
|
|
| |
Some problems are related to change callbacks and those are much easier to
see when they're not mixed with the cache dump.
|
| |
|
|
| |
Many problems are only apparent when printing at level "details".
|
| |
|
|
|
|
| |
Based-on-patch-by: Susant Sahani <susant@redhat.com>
https://src.fedoraproject.org/rpms/libnl3/pull-request/4
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
Seems this can happen, but we probably can just continue with the
unit test. Just ignore the error.
https://github.com/thom311/libnl/issues/308
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
This suite has fixture/teardown which creates a new netns for the test.
No tests implemented yet.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
We run the unit tests as non-root user, so usually we wouldn't have
CAP_NET_ADMIN permissions to change networking. Also, we wouldn't want
that our unit tests depend on the networking of the test host (or
changes it).
For each test, enter a new network namespace (and user/mnt namespace).
There we will have the necessary permissions, and we are in full control
of the things in the namespace.
Note yet used.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- we have "check-all.c" and "check-direct.c", which contains the
main functions of the actual tests.
On the other hand, the other "check-{addr,attr,ematch-tree-clone}.c"
files only contained the test suites for "check-all.c". Rename
the latter to have a separate name prefix.
- rename "tests/util.h" to "tests/cksuite-all.h". It's really the
header that declares all the suites.
- add a "tests/nl-test-util.c" as a static helper library with
test code.
|
| | |
|
| |
|
|
|
|
|
| |
It's important to have no leaks in tests. Otherwise, we cannot
distinguish irrelevant leaks from actual bugs in valgrind.
Do some cleanup.
|
| |
|
|
|
|
| |
fail_if() is deprecated. See also commit 3d1fb006c859
('tests/check-addr: replace deprecated fail_if() macro from libcheck
with ck_assert_msg()').
|
| |
|
|
|
|
|
|
|
| |
ck_assert_msg()
fail_if() is long deprecated. Worse, it triggers a "-Wformat-extra-args"
warning due to a trailing NULL. See [1].
[1] https://github.com/libcheck/check/commit/82540c5428d3818b64d6a8aefb601e722520651f
|
| |
|
|
| |
Signed-off-by: Leonard Crestez <cdleonard@gmail.com>
|
| |
|
|
|
| |
When updating the linux header, it's easy to miss updating the type
mapping. Add a test to avoid that.
|
| |
|
|
|
|
|
| |
We already have check-all unit test, which links dynamically to the libraries.
That means, certain symbols won't be accessible, because they are hidden
by the linker symbol versioning file. Add "check-direct", which links statically
against the libraries.
|
| |
|
|
|
|
|
| |
The source tree of libnl3 is fairly simple. We can afford thinking
and reasoning about it as one. Don't spread out the .gitignore files,
instead ignore all files consistently via the ignore file in the top
level directory.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This also fixes a few wrong SPDX license identifiers, where the original
license comment indicates GPL-2.0-only.
This is not done manually, but by running the following script:
---
#!/bin/bash
# Tool to drop license comments, adding SPDX license identifiers, while preserving
# copyright comments. The point is not to manually do this task, but perform some
# hacked up string replacement.
_cp() {
/bin/cp "$@"
}
_cat() {
/bin/cat "$@"
}
in_file() {
local T=$(mktemp)
_cp -f "$1" "$T"
_cat "$T"
rm -f "$T"
}
out_file() {
local T=$(mktemp)
_cat - > "$T"
_cp -f "$T" "$1"
rm -f "$T"
}
join() {
_cat "$@" | awk '{ printf("%s#x#", $0)}'
}
unjoin() {
_cat - | sed 's/#x#/\n/g'
}
files_all() {
git ls-files |
grep -v '\.png$' |
grep -v '^include/linux-private/'
}
adjust() {
NEWLINES='\(#x#\)\+'
COPYRIGHTS='\(\( \* Copyright (c) 20..\(-20..\|, 20..\)\? [^#]\+#x#\)\+\( \*#x# \* \(Stolen[^#]*\|Based on [^#]*\)#x#\)\?\)'
_cat - |
\
sed '1s%^\(/\* SPDX-License-Identifier: LGPL-2.1-only \*/\|\)#x#/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU Lesser General Public#x# \*[ ]\+License as published by the Free Software Foundation version 2.1#x# \*[ ]\+of the License.#x# \*#x#'"$COPYRIGHTS"' \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: LGPL-2.1-only \*/#x#/*#x#\2 */#x##x#%' |
\
sed '1s%^/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU Lesser General Public#x# \*[ ]\+License as published by the Free Software Foundation version 2.1#x# \*[ ]\+of the License.#x# \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: LGPL-2.1-only \*/#x##x#%' |
\
sed '1s%^\(\)/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU Lesser General Public#x# \*[ ]\+License as published by the Free Software Foundation version 2.1#x# \*[ ]\+of the License.#x# \*#x#'"$COPYRIGHTS"' \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: LGPL-2.1-only \*/#x#/*#x#\2 */#x##x#%' |
\
sed '1s%^\(/\* SPDX-License-Identifier: LGPL-2.1-only \*/\|\)#x#/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU General Public License as#x# \*[ ]\+published by the Free Software Foundation version 2 of the License.#x# \*#x#'"$COPYRIGHTS"' \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: GPL-2.0-only \*/#x#/*#x#\2 */#x##x#%'
}
FILES=( $(files_all) )
for f in "${FILES[@]}"; do
echo "processing \"$f\"..."
in_file "$f" | join | adjust | unjoin | out_file "$f"
done
|
| |
|
|
| |
Manually make copyright comments in a consistent format.
|
| |
|
|
|
|
|
| |
XFRM interfaces were introduced in kernel 4.19.
This commit adds link support for these interfaces.
Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
|
| |
|
|
|
|
| |
test-genl.c
https://github.com/thom311/libnl/pull/213
|
| |
|
|
|
|
|
|
|
|
|
| |
In this commit, we implement ematch_tree_clone(), which is basis of
cgroup_clone() interface. The whole ematch tree is deep-copied except
the e_ops filed.
Also, a new unit test is added for testing the interface, which named as
check-ematch-tree-clone.c located in tests directory.
https://github.com/thom311/libnl/pull/176
|
| |
|
|
|
| |
Public defines must have a libnl3 related prefix. Rename
GENEVE_ID_MAX to RTNL_GENEVE_ID_MAX.
|
| |
|
|
| |
Signed-off-by: Wang Jian <jianjian.wang1@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
This tests is much more like an example of how to do it, and also works
as a test to check if rtnl_link_change is working as expected when it
comes to loopback interface.
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
https://github.com/thom311/libnl/pull/161
|