| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
https://github.com/thom311/libnl/pull/409
|
|
|
|
| |
Add support for the IFLA_BR_MULTI_BOOLOPT bridge link attribute.
|
|
|
|
|
|
|
|
| |
Add support for the following attributes for bridge links:
IFLA_BR_STP_STATE
IFLA_BR_MCAST_ROUTER
IFLA_BR_MCAST_SNOOPING
|
|
|
|
|
|
| |
There are bridge info setter functions for nf_call_iptables,
nf_call_ip6tables and nf_call_arptables, but no corresponding getter
functions, so add them.
|
|
|
|
|
|
|
|
|
|
| |
The amount of flags that could be stored in the ndm_flags field of ndmsg
was limited to 8, so the kernel introduced a new attribute so more flags
could be represented in netlink messages.
Add support for the extended neighbour flags.
https://github.com/thom311/libnl/pull/405
|
|
|
|
| |
https://github.com/thom311/libnl/pull/404
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for the following bridge flags:
IFLA_BRPORT_PROXYARP
IFLA_BRPORT_PROXYARP_WIFI
IFLA_BRPORT_MCAST_FLOOD
IFLA_BRPORT_MCAST_TO_UCAST
IFLA_BRPORT_VLAN_TUNNEL
IFLA_BRPORT_BCAST_FLOOD
IFLA_BRPORT_NEIGH_SUPPRESS
IFLA_BRPORT_ISOLATED
IFLA_BRPORT_LOCKED
IFLA_BRPORT_MAB
IFLA_BRPORT_NEIGH_VLAN_SUPPRESS
https://github.com/thom311/libnl/pull/403
|
|
|
|
|
|
| |
Add a helper for automatically cleaning up a nl_object reference.
Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
|
|
|
|
|
|
|
| |
In preparation of parsing bond link attributes, add getters for all
supported attributes.
Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
The NLA_{UINT|SINT} attributes are introduced for variable-length
integers, whose length are 32bits or 64bits.
So add appropriate functions to get or put NLA_{UINT|SINT} attributes.
Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
|
|
|
|
|
|
|
|
|
| |
The NLA_{SINT|UINT} were introduced to kernel (see [1]). So add the
corresponding enum value to attr.h.
[1] https://lore.kernel.org/r/20231018213921.2694459-3-kuba@kernel.org/
Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
nla_len() has no valid reason to fail or return a negative number.
Callers are not allowed to call this on an invalid structure. They
usually would call nla_validate() first.
However, as it returns a signed "int", coverity assumes that in some
cases the value could be negative. That results in coverity warning like
Error: INTEGER_OVERFLOW (CWE-190):
libnl-3.9.0/lib/route/nh.c:339: tainted_data_return: Called function "nla_len(tb[NHA_GROUP])", and a possible return value may be less than zero.
libnl-3.9.0/lib/route/nh.c:339: cast_underflow: An assign of a possibly negative number to an unsigned type, which might trigger an underflow.
libnl-3.9.0/lib/route/nh.c:340: overflow: The expression "len / 8UL" is deemed underflowed because at least one of its arguments has underflowed.
libnl-3.9.0/lib/route/nh.c:340: cast_overflow: An assign that casts to a different type, which might trigger an overflow.
libnl-3.9.0/lib/route/nh.c:342: overflow_sink: "size", which might have underflowed, is passed to "rtnl_nh_grp_info(size, (struct nexthop_grp const *)data, &nh_group)".
# 340| size = len / sizeof(struct nexthop_grp);
# 341|
# 342|-> err = rtnl_nh_grp_info(size, (const struct nexthop_grp *)data,
# 343| &nh_group);
# 344| if (err < 0) {
Add an internal _nla_len() with an API that clearly cannot return
negative values. Also, add _nl_assert() which in debug builds do some
consistency checks on the argument.
https://issues.redhat.com/browse/RHEL-34299
|
|
|
|
| |
This is necessary to comply with current clang-format (18.1.6-3.fc40).
|
|
|
|
|
|
|
|
| |
rtnl_route_get_nexthops() returns the list of nexthops, but that is not
usable without access to the rtnh_list field.
We want to use that from tests. Move to another header (but still not
public API).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Routes may reference a nexthop (group) via the new nexthop API by its
ID, so add accessors for setting and getting it.
Referencing a nexthop is mutually exclusive to specifiying nexthops in
the route, so make sure we do not do that when creating netlink
messages (which may exist both, since netlink messages from the kernel
contain both unless 'nexthop_compat_mode' is disabled).
$ ip -6 r
2001:db8:3::/64 nhid 20 metric 1024 pref medium
nexthop via 2001:db8:1::2 dev v0 weight 1
nexthop via 2001:db8:2::2 dev v1 weight 1
Before:
$ nl-route-list
inet6 2001:db8:3::/64 table main type unicast via 2001:db8:1::2 dev v0 via 2001:db8:2::2 dev v1
After:
$ nl-route-list
inet6 2001:db8:3::/64 table main type unicast nhid 20 via 2001:db8:1::2 dev v0 via 2001:db8:2::2 dev v1
Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
https://github.com/thom311/libnl/pull/386
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Not all attributes of a nexthop are id attributes, e.g. the flags will
contain state (LINKDOWN, DEAD) of the attached link about which the
kernel will not send route updates.
Likewise, the weight may not exist when processing an ECMP IPv6 route
update which only contains a single nexthop.
Since rtnl_nexthop isn't a first class cache object, we cannot use
nl_object_identical(), so add a separate identical helper function which
compares only fixed attributes.
Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
|
|
|
|
|
| |
Fix the capability numbers for the next few releases already. While not
yet in use, the number is reserved and stable.
|
|
|
|
| |
No "goto errout".
|
|
|
|
|
|
|
|
|
|
|
|
| |
- mngr->cm_flags must be set together when assigning the socket.
Otherwise, a `goto errout` in the middle will cause a leak.
- normalize the flags variable to not contain unexpected values.
- NL_ALLOCATED_SYNC_SOCK is private API. No need to expose that to
public headers.
Fixes: 1dbdc30a6b9f ('cache: allow to allocate cache manager with custom refill socket')
|
|
|
|
|
|
|
|
|
|
|
| |
Cache managers use two sockets: one for cache refill operation,
and another one for notifications.
In order to simulate NETLINK events by reading data from files,
we need to be able to overwrite callbacks for both sockets.
This new function allows us to set up refill socket any way we want.
It does have requirement that the refill socket be blocking.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
deprecated headers
Header files are part of a stable API. Warning about using deprecated
API is cumbersome, albeit often useful to force the user to migrate
away from the API.
But it also requires that the unit test disables "-Wcpp". That is
problematic on its own, because we don't want to disable any warnings.
As we only have 4 such header files, instead guard the warnings with
a
#ifndef _NL_NO_WARN_DEPRECATED_HEADER
|
|
|
|
|
|
|
|
|
|
| |
Conditionally defining to nothing, means that the compiler doesn't see
the print statement without NL_DEBUG. In turn, we lack checking of the
statement by the compiler.
Instead, add an "if (NL_DEBUG)" around it. Since NL_DEBUG is a constant, the
compiler will optimize out all the code of the statement, while still
checking it.
|
|
|
|
|
|
|
|
|
|
| |
Checking conditional defines with #ifdef is error prone because we don't
get a compiler warning when the define wrongly is missing.
Instead, always define it to either 0 or 1.
The benefit is also that now we can use NL_DEBUG in C (not only in the
preprocessor).
|
|
|
|
| |
We have those defines. Use them throughout.
|
|
|
|
| |
https://github.com/thom311/libnl/pull/373
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Add headers from 6995e2de6891c724bfeb2db33d7b87775f913ad1 (tag: v6.4).
|
|
|
|
| |
Fixes: 49c20efaa783 ('xfrm: fix crashes in case of ENOMEM')
|
|
|
|
|
|
|
|
|
|
|
|
| |
rtnl_act_append() either takes ownership of the argument, or does
nothing (on error). This pattern is hard to get right. In the past,
there were various bugs at this place.
Add two wrappers _rtnl_act_append_get() and _rtnl_act_append_take()
which consistently don't take ownership of the pointer or take it.
Also, in functions like rtnl_flower_append_action() only set the mask
after successfully modifying the data.
|
| |
|
|
|
|
|
|
|
| |
This is useful for a very special case. For a cleanup macro
that calls rtnl_act_put_all(). In that case, we have a auto
variable `struct rtnl_act *head`, but the cleanup function
expects as argument `&head`.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Seems the static array indices can confuse coverity. I think coverity is wrong
here, regardless, change it.
libnl-3.8.0/include/base/nl-base-utils.h:683: overrun-buffer-arg: Overrunning buffer pointed to by "buf" of 16 bytes by passing it to a function which accesses it at byte offset 45 using argument "(addr_family == 2) ? 16 : 46" (which evaluates to 46).
# 681| * and a suitably large buffer, it cannot. Assert for that. */
# 682|
# 683|-> r = (char *)inet_ntop(addr_family, addr, buf,
# 684| (addr_family == AF_INET) ? INET_ADDRSTRLEN :
# 685| INET6_ADDRSTRLEN);
|
|
|
|
|
|
|
| |
Adds the rtnl_link_can_get_device_stats function to get xstats of a
CAN-bus link as a can_device_stats struct.
https://github.com/thom311/libnl/pull/368
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
[thaller@redhat.com: fixed wrong variable name in code and reworded
commit message.]
https://github.com/thom311/libnl/pull/363
|
| |
|
|
|
|
| |
Avoid non-threadsafe libc API.
|
|
|
|
|
|
| |
https://github.com/thom311/libnl/issues/356
Fixes: 780d06ae8bee ('route: add nh type')
|
|
|
|
| |
$ ./tools/clang-format.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It doesn't work well, to only include some parts of the linux headers.
For example, <linux/ipv6.h> includes <linux/stddef.h>, which previously
wasn't copied. Worse, <linux/ipv6.h> depends on some recent defines in
<linux/stddef.h>, so we cannot just mix kernel headers from different
versions.
Import all the used <linux/*> kernel headers. Note that architecture
specific headers from "<asm/*" and "<asm-generic/*" are not copied.
Taken from v6.4 (6995e2de6891c724bfeb2db33d7b87775f913ad1).
Reimport via
cd /data/src/linux
make headers_install ARCH=i386 INSTALL_HDR_PATH=/tmp/Linux/
cd /data/src/libnl3
for h in $(cd include/linux-private/; git ls-files .); do \
/bin/cp /tmp/Linux/include/$h include/linux-private/$h ; \
done
|
|
|
|
| |
Taken from v6.4 (6995e2de6891c724bfeb2db33d7b87775f913ad1).
|