| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
through permutations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
_nltst_assert_route_list() compares the content of the cache with a list
of expected routes.
The cache does not have a well defined order.
Well, maybe the cache *should* have a well defined order, because when
we use `ip route replace`, it will replace some route that has certain
similar attributes, but is otherwise another route (as far as route
identity and caching is concerned). But on netlink, we are only told
that one route was replaced, but not which one. Some kernel developers
think that in face of that, we just iterate the cache (in the same order
as kernel exports the route), find the first similar route and know that
was the one that is replaced. Does that work? Dunno, I never saw anybody
implementing that successfully. NetworkManager implements a similar
cache and throws it's hands in the air and requests a new dump of all
routes that it caches.
Anyway. Unless somebody shows that the cache is always in a consistent and
reproducible state, this unit test was wrong.
Instead, permutate through all lists of routes, and try to find a
one-to-one match with the expected routes.
|
| |
|
|
|
|
|
| |
It's hard to debug a failure. Print what we were comparing before
crashing.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Hopefully more to come, and more to improve.
|
|
|
|
|
| |
Add functions for matching a route. Currently only a few trivial options
are supported, like the destination address and the ifindex.
|
|
|
|
|
| |
In CI, we know which tests should be skipped. Let github actions set
NLTST_IN_CI=1, and disable certain skip checks.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|