MIPS64, PowerPC64 and RISCV64 are popular OpenWrt archs.
Refactor the sizes build step to generate the table programatically.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Add cmake build and source directories to suppress the following warning:
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
New cmake version 4.0 requires at least 3.5 version as the minimum
required version with it increased to 3.10 in to-be-released cmake
versions.
Set the minimum required version to 3.10 to future-proof for future
cmake version.
Suggested-by: Hannu Nyman <hannu.nyman@iki.fi>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
In order to prepare for proper ABI handling in the OpenWrt package of
libnl-tiny, add an option to specify the library SOVERSION value when
invoking CMake.
Let the library SOVERSION default to `1` as first ABI version as the
library is stable and there's been no incompatible changes since it's
inception in 2009.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Make the struct nla_policy and the struct nlattr const in many places
like it is done in full libnl. This brings our libnl-tiny closer to the
upstream version.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Duplicated branch in function genl_family_get_maxattr().
Detected by gcc with -Werror=duplicated-branches.
libnl-tiny/netlink/genl/family.h:118:5: error: this condition has
identical branches [-Werror=duplicated-branches]
if (family->ce_mask & FAMILY_ATTR_MAXATTR)
Signed-off-by: Jesus Fernandez Manzano <jesus.manzano@galgus.net>
If CLOEXEC is not set on the netlink socket, restarting netifd using ubus
fails with "Failed to initialize system control", because the bind call
in nl_connect fails with EADDRINUSE, due to the inherited socket handle.
Also it does not make sense, to leak the handle to child processes.
See libnl3: ca0fc7558 ("socket: Set SOCK_CLOEXEC if available")
Signed-off-by: Joerg Vehlow <joerg.vehlow@aox.de>
The strncpy() function doesn't null terminate the destination string if
the source string is at least as long as the destination. (This behavior
is defined by the C99 specification.) As a result, the destination
string must be null terminated after calling strncpy().
And clang11 static analyzer thus reports following:
genl_family.c:148:2: error: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 15 [-Werror=stringop-truncation]
148 | strncpy(grp->name, name, GENL_NAMSIZ - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
References: https://gitlab.com/openwrt/project/libnl-tiny/-/jobs/2495301251#L197
Signed-off-by: Petr Štetiar <ynezz@true.cz>
The API is almost the same and some unl_genl_* functions are renamed to unl_*
with compat #define in place
The only thing different between genl and rtnl is the init function and the
function for allocating a message
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This will allow getting rid of InstallDev in the Makefile.
It also allows compilation with CMAKE_BINARY_SUBDIR.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
scan-build from clang version 9 complains about following:
nl.c:648:3: warning: Value stored to 'err' is never read
err = 0;
^ ~
Signed-off-by: Petr Štetiar <ynezz@true.cz>
scan-build from clang version 9 complains about following:
nl.c:507:9: warning: Use of memory after it is freed
while (nlmsg_ok(hdr, n)) {
^~~~~~~~~~~~~~~~
which seems to be impossible codepath as clang analyzer doesn't somehow
account properly nl_syserr2nlerr(errno) return value:
} else {
free(msg.msg_control);
free(*buf);
return -nl_syserr2nlerr(errno);
}
which should be always < 0, but analyzer is still checking for > 0 code
path as well for some reason. So in order to make the analyzer happy,
set the buf pointer to NULL explicitly and add assert to make it clear,
that this codepath should never happen.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Uses currently proof-of-concept openwrt-ci[1] in order to:
* improve the quality of the codebase in various areas
* decrease code review time and help merging contributions faster
* get automagic feedback loop on various platforms and tools
- out of tree build with OpenWrt SDK on following targets:
* ath79-generic
* imx6-generic
* malta-be
* mvebu-cortexa53
- out of tree native build on x86/64 with GCC (versions 7, 8, 9) and Clang 9
- out of tree native x86/64 static code analysis with cppcheck and
scan-build from Clang 9
1. https://gitlab.com/ynezz/openwrt-ci/
Signed-off-by: Petr Štetiar <ynezz@true.cz>
gcc 9.1 on x86/64 has reported following:
attr.c:403:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
genl.c:154:24: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare]
genl_mngt.c:157:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
msg.c:190:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
msg.c:192:18: error: comparison of integer expressions of different signedness: ‘__u32’ {aka ‘const unsigned int’} and ‘int’ [-Werror=sign-compare]
msg.c:361:10: error: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Werror=sign-compare]
nl.c:428:18: error: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Werror=sign-compare]
nl.c:602:23: error: comparison of integer expressions of different signedness: ‘__u32’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Let's enforce additional automatic checks enforced by the compiler in
order to catch possible errors during compilation.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
If _GNU_SOURCE was added as part of a package's TARGET_CFLAGS,
then compilation would fail for that module (especially if
warnings get treated as errors).
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This constant was always defined to 0, and recently got removed in
upstream commit a07ea4d9941af5a0c6f0be2a71b51ac9c083c5e5 ("genetlink: no
longer support using static family IDs")
Fixes libnl-tiny builds with latest upstream kernels.
Fixes: d723f2573af3 ("libnl-tiny: remove include/linux overrides to fix various build issues")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
This adds this commit from normal libnl to libnl-tiny:
2dbc1ca76c
commit 2dbc1ca76c5b82c40749e609eb83877418abb006
Author: dima <dima.ky@gmail.com>
Date: Wed Oct 13 17:53:34 2010 +0300
Generic Netlink multicast groups support
I have a patch against commit d378220c96c3c8b6f27dca33e7d8ba03318f9c2d
extending libnl with a facility to receive generic netlink messages sent
to multicast groups.
Essentially it add one new function genl_ctrl_resolve_grp which
prototype looks like this
int genl_ctrl_resolve_grp(struct nl_sock *sk, const char *family_name,
const char *grp_name)
It resolves the family name and the group name to group id. Then
the returned id can be used in nl_socket_add_membership to subscribe
to multicast messages.
Besides that it adds two more functions
uint32_t nl_socket_get_peer_groups(struct nl_sock *sk)
void nl_socket_set_peer_groups(struct nl_sock *sk, uint32_t groups)
allowing to modify the socket peer groups field. So it's possible to
multicast messages from the user space using the legacy interface.
Looks like there is no way (or I was not able to find one?) to modify
the netlink socket destination group from the user space, when the
group id is greater then 32.
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@intel.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name> [cosmetic style fix]
This has been added to the kernel uapi for a while, and makes
sense to have it here too.
At the moment we're using it for query-ing qdisc via netlink
using libnl-tiny.
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
SVN-Revision: 49188
Currently some libnl headers require application code to include
dependencies on its own. E.g. a simple include of <linux/netlink.h>
will trigger an error:
/usr/include/libnl-tiny/linux/netlink.h:32:2: error: unknown type name 'sa_family_t'
Similarly including <netlink/handlers.h> causes:
/usr/include/libnl-tiny/netlink/handlers.h:133:19: warning: 'struct ucred' declared inside parameter list [enabled by default]
Fix it by including <sys/socket.h> where needed in libnl headers.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
SVN-Revision: 47456
Apply libnl commit 807fddc4cd9ecb12ba64e1b7fa26d86b6c2f19b0 ("nl:
Increase receive buffer size to 4 pages") also to libnl-tiny to ensure
netlink messages larger than 4KiB can be received, as the restart logic
seems to be broken.
This fixes iwinfo accessing info on dual band b43 cards, as they can
support a lot of channels, breaking the 4K default limit (seen was >5k).
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
SVN-Revision: 43633
To be prepared to support keepalived 1.2.10 and higher we need libnl3 or
higher. The attached patch
add some defines so that it can be build be libnl-tiny.
Patch by Thomas Heil
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 39991