summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* update READMEHEADmasterrofl0r2022-09-161-5/+6
|
* genl_family: explicitly null terminate strncpy destination bufferPetr Štetiar2022-09-162-0/+2
| | | | | | | | | | | | | | | | 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>
* netlink: add NLA_F_NESTED to all nested attributesFelix Fietkau2022-09-162-1/+3
| | | | | | | Newer generic netlink APIs (e.g. wireguard) require this to be able to parse nested attributes Signed-off-by: Felix Fietkau <nbd@nbd.name>
* attr.h: Add NLA_PUT_S32Hauke Mehrtens2022-09-161-0/+34
| | | | | | | | This function is used by iw 5.16. These new headers were copied from the mainline libnl. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* unl: add support for connecting to rtnlFelix Fietkau2022-09-162-11/+54
| | | | | | | | | 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>
* remove never used err variable assignment disliked by scan-buildPetr Štetiar2022-09-161-1/+0
| | | | | | | | | | 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>
* silence use after the free clang analyzer warningPetr Štetiar2022-09-161-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* use offsetof macro to make scan-build happyPetr Štetiar2022-09-161-1/+3
| | | | | | | | | | | | | | | | | | | scan-build from clang version 9 complains about following: cache.c:106:2: warning: Dereference of null pointer nl_list_for_each_entry_safe(obj, tmp, &cache->c_items, ce_list) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/netlink/list.h:83:20: note: expanded from macro 'nl_list_for_each_entry_safe' pos = n, n = nl_list_entry(n->member.next, typeof(*n), member)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/netlink/list.h:60:2: note: expanded from macro 'nl_list_entry' nl_container_of(ptr, type, member) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/netlink/list.h:56:55: note: expanded from macro 'nl_container_of' const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^~~~~ Signed-off-by: Petr Štetiar <ynezz@true.cz>
* iron out all extra compiler warningsPetr Štetiar2022-09-165-9/+13
| | | | | | | | | | | | | | | 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>
* libnl-tiny: use fixed message size instead of using the page sizeFelix Fietkau2022-09-161-6/+1
| | | | | | Simplifies the code and reduces size Signed-off-by: Felix Fietkau <nbd@nbd.name>
* libnl-tiny: define _GNU_SOURCE if not definedAlexandru Ardelean2022-09-161-0/+2
| | | | | | | | 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>
* libnl-tiny: Generic Netlink multicast groups supportHauke Mehrtens2022-09-167-1/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds this commit from normal libnl to libnl-tiny: https://github.com/tgraf/libnl/commit/2dbc1ca76c5b82c40749e609eb83877418abb006 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]
* libnl-tiny: fix receiving netlink messages larger than 4KJonas Gorski2022-09-161-1/+1
| | | | | | | | | | | | | | 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
* libnl-tiny: remove dead codeFelix Fietkau2022-09-165-801/+0
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 43599
* genl/family.h: hardcode GENL_ID_GENERATE constant valuerofl0r2018-12-031-1/+1
| | | | | | | | | apparently this constant has been removed from recent kernel headers, even though it's supposed to be UAPI. https://www.spinics.net/lists/netdev/msg423041.html closes #2
* fix install command for retarded OS's (Mac OS X)rofl0r2018-06-172-3/+71
| | | | install.sh taken from https://github.com/rofl0r/install.sh
* Makefile: make AR and RANLIB customizablerofl0r2015-11-221-2/+4
|
* remove linux header copy from include/rofl0r2015-04-305-481/+0
| | | | | | | | | better fix for issue #1 the removal of the net/if.h inclusion led to issues compiling libpcap because the include guard of the linux header copy prevented the real linux header to get used and so the definition of struct ifreq was missing.
* fix compilation on ubuntu 14.04rofl0r2015-04-291-2/+0
| | | | closes #1
* README: fix typorofl0r2014-07-111-1/+1
|
* update .gitignorev1.0.1rofl0r2014-07-111-0/+1
|
* add READMErofl0r2014-07-112-3/+52
|
* libnl-tiny: ensure compatibility to libnl version 3 and highernbd2014-07-112-1/+14
| | | | | | | | | | | 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> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39991 3c298f89-4303-0410-b956-a3cf2f4a3e73
* make libnl 1.0 compat macros available when LIBNL1_COMPAT is setrofl0r2014-07-111-0/+7
|
* pkg-config file: force _GNU_SOURCErofl0r2014-07-101-1/+1
| | | | | | it's required that this is passed on the command line, otherwise apps including <sys/socket.h> before including a netlink header will not see the definition of struct ucred in musl.
* add .gitignorev1.0.0rofl0r2014-07-101-0/+5
|
* complete Makefile with install targetsrofl0r2014-07-101-10/+42
| | | | | | the include files must be installed into a separate dir, other- wise linux kernel headers could become overwritten or newer kernel headers could conflict with the version used by nl-tiny.
* fix incorrect include causing warningrofl0r2014-07-101-1/+1
|
* move files into toplevel dirrofl0r2014-07-1048-80/+28
|
* use user-supplied prefix for .pc generationrofl0r2014-07-102-2/+6
|
* Makefile: include user-supplied config.makrofl0r2014-07-101-0/+2
|
* libnl-tiny.pc.in: pass includedir for --cflags callrofl0r2014-07-101-1/+1
|
* rename libnl-tiny.pc to libnl-tiny.pc.in, move to src/rofl0r2014-07-101-0/+0
|
* Makefile: add libnl-tiny.a targetrofl0r2014-07-101-1/+6
|
* apply libnl-tiny_if_h.patch from sabotagerofl0r2014-07-101-11/+1
|
* import libnl-tiny rev 49d9e43e from openwrtrofl0r2014-07-1049-0/+9562