| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| |
|
|
| |
Avoid non-threadsafe libc API.
|
| | |
|
| |
|
|
| |
$ ./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.
|
| |
|
|
| |
Taken from v6.4 (6995e2de6891c724bfeb2db33d7b87775f913ad1).
|
| |
|
|
|
| |
libnl3 itself needs to be build with a C compiler. Drop the unnecessary
"extern "C"" parts from internal code.
|
| | |
|
| |
|
|
|
|
|
| |
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".
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
In an autotools project, <config.h> should be included as very first thing
in almost all cases. We also want include other stuff, in particular
"include/base", which contains our own extensions on top of plain C (it
is thus applicable to all our C modules).
Add a "nl-default.h", which can be included as first and prepares a base
for each C source.
Additionally, since header files are never compiled directly (only indirectly
by being included), they can rely that "nl-default.h" is always available.
|
| |
|
|
|
|
|
| |
It seems "config.h" is the more common name for the autotools generated
header. In any case, it should not be under "lib", because lib is
specifically about libnl-3 and similar libraries. It's awkward for
modules under src to include from lib.
|
| |
|
|
|
| |
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.
|
| |
|
|
|
| |
Naming is just so important to understand what this is.
This name is better.
|
| |
|
|
|
|
| |
The filename is still unique (which is the important part). Otherwise,
the "priv" is redundant, since the header being inside "lib/genl" is clearly
private.
|
| | |
|
| |
|
|
|
|
|
|
| |
https://github.com/thom311/libnl/issues/343
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
https://github.com/thom311/libnl/pull/346
|
| |
|
|
| |
lib/route/link-sriov.h
|
| | |
|
| | |
|
| |
|
|
|
| |
It's a private header only for lib/route (libnl-route-3). We already
have a similar header. Move the content to "lib/route/tc-api.h".
|
| |
|
|
|
|
| |
This symbols is (wronly) exposed on the ABI of libnl-route-3.
Move the declaration to "tc-api.h", where there are similar
symbols of this kind.
|
| |
|
|
|
|
|
|
| |
This header is entirely private to lib/route (libnl-route-3).
Move the header there, it should not be used by anybody else.
Note that libnl-route-3 exports symbols from this private header. That
is ugly, make that clearer by adding comments.
|
| |
|
|
|
| |
This header is entirely private to compiling libnl-route-3 under
lib/route. Move the header there.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
This header is entirely private to the source files in "lib/genl".
It's confusing to keep it separate. Place it beside the source files,
which can use it.
I guess, I just disagree with this notion, that all headers must be
under "include/" directory. Not, if the header is entirely local to one
module.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
- use consistent name _DIFF() for macro
- spell out the full attribute, and don't join the name via ##.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
"netlink-private/utils.h" is our header-only, internal helper header.
We should be able to use it everywhere, not only inside the library
itself.
Unlike for exapmle <netlink-private/netlink.h>, which is only
usable from the libraries.
|
| |
|
|
|
| |
We should have things with "nl" prefix in our headers. Also, netlink-private/netlink.h
is not header-only, preferably header-only stuff is in netlink-private/utils.h
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
I find macros that stitch together names like "FAMILY_ATTR_##ATTR"
very confusing, because we no longer see where a certain name is used.
It breaks grepping for symbols, and it breaks cscope.
Yes, it's more verbose to not do that. If you really think that those
names are too verbose, then maybe they should get a shorter name. And
not use macros to make them palatable.
|
| |
|
|
|
|
|
|
|
|
|
| |
a negative count is a bug in the caller. Still, handle it better than
just crashing. Maybe we should assert, but it doesn't seem best to
assert against user input.
Also, if count is zero, don't call memcpy(). Calling memcpy() requires
that the source and destination pointers are valid, otherwise it's
undefined behavior. I think if the caller tells us to copy zero bytes,
we should never look at the destination pointer.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace the use of the previous min()/min_t()/max()/max_t().
- min_t()/max_t() required a type, and would do plain assignment, which
C would not complain about. It is thus a cumbersome and not very safe
pattern. Avoid it.
- min()/max() did better, it used typeof() to preserve the argument types
and automatically detect it. However, it also required that both
arguments had the same integer type, which is unnecessarily strict.
_NL_MIN()/_NL_MAX() does better. It accepts arguments of any integer
types, but has a static assertions that they match in signedness.
So it's more flexible to use than min()/max() and still quite safe.
Prefer the new macros.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
following API has been added to bonding
bond_alloc
bond_free
rtnl_link_bond_set_activeslave
rtnl_link_bond_set_mode
bond_put_attrs
Signed-off-by: Mallikarjun Nemagoudar <MallikarjunRamappa.Nemagoudar@infineon.com>
https://github.com/thom311/libnl/pull/349
|
| |
|
|
|
| |
Previously, a NULL argument would most likely also do thing, but it also
hits undefined behavior.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, rtnl_link_macsec_set_offload rejects any value
greater than 1 limiting the MACSEC_ATTR_OFFLOAD attribute
to the values 0 and 1 where other values are also legal.
Drop such a check since it is redundant, eventually the user
will send the netlink message to kernel, and whether the
message is valid depends on kernel.
Fixes: b6cc13d76b29 ('Supporting Hardware offload capability for MACsec')
Signed-off-by: Emeel Hakim <ehakim@nvidia.com>
http://lists.infradead.org/pipermail/libnl/2023-February/002417.html
http://lists.infradead.org/pipermail/libnl/2023-February/002420.html
http://lists.infradead.org/pipermail/libnl/2023-February/002424.html
https://github.com/thom311/libnl/pull/336
https://github.com/thom311/libnl/pull/341
|
| |
|
|
|
|
| |
Fixes: 1a4031d6db73 ('lib/route: Support IFLA_BRIDGE_MODE')
https://github.com/thom311/libnl/pull/339
|
| |
|
|
|
|
|
|
|
| |
Check that ops->ao_override_rtm() is set before using it,
which prevents a segfault whenever af_request_type() is
called with a type that has ops but that does not initialize
said function in their ops struct.
https://github.com/thom311/libnl/pull/333
|
| |
|
|
| |
https://github.com/thom311/libnl/pull/345
|
| |
|
|
|
|
|
|
|
|
| |
On the netlink API, IFLA_INET6_CONF is a list of uint32_t integers, but
the number of actually provided values depends on the kernel version (and
the DEVCONF_MAX value that it was compiled with.
We clone the kernel header in our source tree, so DEVCONF_MAX from the
libnl3 build may differ from the running kernel. We need to keep track
how many values kernel actually provides.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's not clear how this API is useful. I don't think that kernel accepts
netlink requests to change the settings. So constructing a libnl3 object
in the user application seems not useful.
Also, because of the difficulty that DEVCONF_MAX is depending on the
current kernel, and changing. We need to improve how to handle the
option, and a rtnl_link_inet6_set_conf() only makes that more confusing.
The same is the case for rtnl_link_inet6_set_flags(), but that API
already exists, while rtnl_link_inet6_set_conf() is still new and
unreleased.
|