summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* libnl-3.11.0 releaselibnl3_11_0Thomas Haller2024-10-301-0/+6
|
* lib/route: add support for bridge mstiRonan Dalton2024-10-101-0/+7
| | | | https://github.com/thom311/libnl/pull/409
* lib/route: add support for bridge info booloptsRonan Dalton2024-09-181-0/+5
| | | | Add support for the IFLA_BR_MULTI_BOOLOPT bridge link attribute.
* lib/route: extend bridge info supportRonan Dalton2024-09-161-0/+15
| | | | | | | | Add support for the following attributes for bridge links: IFLA_BR_STP_STATE IFLA_BR_MCAST_ROUTER IFLA_BR_MCAST_SNOOPING
* lib/route: add missing bridge info getter functionsRonan Dalton2024-09-161-0/+9
| | | | | | 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.
* lib/route: add rtnl_neigh ext flags supportRonan Dalton2024-09-161-0/+10
| | | | | | | | | | 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
* route: add support for getting permanent mac address of linkAntonio Prcela2024-09-121-0/+2
| | | | https://github.com/thom311/libnl/pull/404
* lib/route: extend bridge flagsRonan Dalton2024-09-121-7/+18
| | | | | | | | | | | | | | | | | | 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 _nl_auto_nl_object helperJonas Gorski2024-09-121-0/+6
| | | | | | Add a helper for automatically cleaning up a nl_object reference. Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
* link/bonding: add getters for attributesJonas Gorski2024-08-271-3/+12
| | | | | | | In preparation of parsing bond link attributes, add getters for all supported attributes. Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
* base: add _nl_swap() helper macroThomas Haller2024-08-221-0/+13
|
* base: add _nl_ptrarray_len() helperThomas Haller2024-08-221-0/+22
|
* lib/attr: add nla functions for variable-length integersWen Gu2024-08-171-0/+4
| | | | | | | | | 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>
* lib/attr: add NLA_{SINT|UINT} attribute typesWen Gu2024-08-161-0/+3
| | | | | | | | | 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>
* libnl-3.10.0 releaselibnl3_10_0Thomas Haller2024-07-191-0/+6
|
* lib: add internal _nla_len() helperThomas Haller2024-05-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* format: reformat "include/base/nl-base-utils.h"Thomas Haller2024-05-291-4/+1
| | | | This is necessary to comply with current clang-format (18.1.6-3.fc40).
* route: move "struct rtnl_nexthop" to "nl-priv-dynamic-route"Thomas Haller2024-05-171-0/+15
| | | | | | | | 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).
* route: expose nexthop id attributeJonas Gorski2024-05-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* nexthop: add a identical helper functionJonas Gorski2024-05-141-0/+3
| | | | | | | | | | | | | | | 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>
* utils: reserve the nl_has_capabiliy numbers for releases 3.10 - 3.12Thomas Haller2024-05-071-0/+18
| | | | | Fix the capability numbers for the next few releases already. While not yet in use, the number is reserved and stable.
* cache: use cleanup attribute in nl_cache_mngr_alloc_ex()Thomas Haller2024-05-061-0/+6
| | | | No "goto errout".
* cache: cleanup nl_cache_mngr_alloc_ex()Thomas Haller2024-05-061-4/+3
| | | | | | | | | | | | - 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: allow to allocate cache manager with custom refill socketIlya A. Evenbach2024-05-061-2/+7
| | | | | | | | | | | 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.
* include: add _NL_NO_WARN_DEPRECATED_HEADER for suppressing warning about ↵Thomas Haller2024-05-064-0/+8
| | | | | | | | | | | | | | | | 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
* core: always define statements for NL_DBG()Thomas Haller2024-04-221-8/+3
| | | | | | | | | | 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.
* build: always define NL_DEBUGThomas Haller2024-04-221-1/+1
| | | | | | | | | | 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).
* all: use defines for attributesThomas Haller2024-04-221-2/+2
| | | | We have those defines. Use them throughout.
* route: add support for layer 3 filtering on bridgesCordell O'Leary2024-04-031-0/+6
| | | | https://github.com/thom311/libnl/pull/373
* tests: add test for bridge vlan attributes.Cordell O'Leary2024-02-291-0/+4
|
* route: add support for vlan filtering on bridge ports.Cordell O'Leary2024-02-292-0/+10
|
* route: Add support to set ageing time for dynamic bridge table entriesCordell O'Leary2024-02-291-0/+5
|
* libnl-3.9.0 releaselibnl3_9_0Thomas Haller2023-12-041-0/+6
|
* include/linux-private: import 'seg6 local' headers from kernel treeKonstantin Kogdenko2023-12-044-0/+257
| | | | Add headers from 6995e2de6891c724bfeb2db33d7b87775f913ad1 (tag: v6.4).
* xfrm: fix leaking usertemplate in xfrmnl_sp_parse()Thomas Haller2023-12-041-0/+7
| | | | Fixes: 49c20efaa783 ('xfrm: fix crashes in case of ENOMEM')
* route/cls: add get/take wrappers for rtnl_act_append()Thomas Haller2023-12-011-3/+26
| | | | | | | | | | | | 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.
* nl-aux-route: add cleanup macro for rtnl_act_put_all()Thomas Haller2023-12-011-0/+5
|
* base: add _NL_AUTO_DEFINE_FCN_INDIRECT0() macroThomas Haller2023-12-011-0/+8
| | | | | | | 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`.
* base: don't use static array indices for buffer argument of _nl_inet_ntop()Thomas Haller2023-12-011-2/+1
| | | | | | | | | | | | 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);
* route/can: implement can_device_statsJob Feikens2023-12-011-0/+3
| | | | | | | 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
* include: add "nl-aux-xfrm" helpersThomas Haller2023-11-292-0/+44
|
* nl-aux-core: add _nl_addr_build() helperThomas Haller2023-11-291-0/+7
|
* nl-base-utils: add _nl_addr_family_to_size() helperThomas Haller2023-11-291-0/+11
|
* route/link: add bonding interface options set rtnl apisLokesh Dhoundiyal2023-10-301-0/+3
| | | | | | | [thaller@redhat.com: fixed wrong variable name in code and reworded commit message.] https://github.com/thom311/libnl/pull/363
* libnl-3.8.0 releaselibnl3_8_0Thomas Haller2023-08-291-0/+6
|
* lib: use getprotobyname_r(), getprotobynumber_r() if availableThomas Haller2023-08-181-0/+4
| | | | Avoid non-threadsafe libc API.
* route: fix documentation comment for nl_nh_group_infoThomas Haller2023-08-171-2/+2
| | | | | | https://github.com/thom311/libnl/issues/356 Fixes: 780d06ae8bee ('route: add nh type')
* clang-format: reformat files with new formatThomas Haller2023-08-172-222/+222
| | | | $ ./tools/clang-format.sh
* include/linux: add all linux headers that we useThomas Haller2023-08-0825-0/+4266
| | | | | | | | | | | | | | | | | | | | | | | 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
* include/linux: update all linux headersThomas Haller2023-08-0833-157/+1974
| | | | Taken from v6.4 (6995e2de6891c724bfeb2db33d7b87775f913ad1).