summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* libnl-3.11.0 releaselibnl3_11_0Thomas Haller2024-10-304-4/+10
|
* lib/route: add support for bridge mstiRonan Dalton2024-10-103-27/+506
| | | | https://github.com/thom311/libnl/pull/409
* lib/route: merge branch 'ronand-atl:extend-bridge-info-support'Thomas Haller2024-09-193-1/+392
|\ | | | | | | https://github.com/thom311/libnl/pull/406
| * lib/route: add support for bridge info booloptsRonan Dalton2024-09-183-0/+88
| | | | | | | | Add support for the IFLA_BR_MULTI_BOOLOPT bridge link attribute.
| * lib/route: extend bridge info supportRonan Dalton2024-09-163-0/+195
| | | | | | | | | | | | | | | | 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-163-1/+108
| | | | | | | | | | | | 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 missing entry in libnl-route-3.sym fileRonan Dalton2024-09-161-0/+1
|/ | | | | A corresponding entry for rtnl_link_bridge_set_vlan_default_pvid is missing from the libnl-route-3.sym file, so add it.
* lib/route: add rtnl_neigh ext flags supportRonan Dalton2024-09-163-6/+85
| | | | | | | | | | 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-125-0/+48
| | | | https://github.com/thom311/libnl/pull/404
* lib/route: extend bridge flagsRonan Dalton2024-09-122-29/+138
| | | | | | | | | | | | | | | | | | 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
* xfrm: remove redundant check in xfrm_sa_update_cache()Thomas Haller2024-09-121-1/+1
|
* lib,xfrm: merge branch 'bisdn:jogo_auto_nlobject'Thomas Haller2024-09-123-15/+11
|\ | | | | | | https://github.com/thom311/libnl/pull/402
| * xfrm: use the new _nl_auto_nl_object helperJonas Gorski2024-09-121-3/+1
| | | | | | | | | | | | | | | | Analogue to the change for cache_include(), use the new helper for nl_objects and initialize old to NULL since we do not use it for other messages than XFRM_MSG_EXPIRE. Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
| * cache: use the new _nl_auto_nl_object helperJonas Gorski2024-09-121-12/+4
| | | | | | | | | | | | | | | | Use the new _nl_auto_nl_object helper for cache where appropriate. Make sure to initialze *old to NULL in cache_include() as we do not initialize it in the error path for unknown actions. Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
| * 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>
* black: fix "target-version" in "pyproject.toml"Thomas Haller2024-09-121-1/+1
| | | | Fixes: 298ee58e7a84 ('python add "pyproject.toml" for configuring black')
* link/bonding: merge branch 'bisdn:jogo_bond_improvements'Thomas Haller2024-09-123-17/+261
|\ | | | | | | https://github.com/thom311/libnl/pull/401
| * link/bonding: implement parsing link typeJonas Gorski2024-08-301-0/+54
| | | | | | | | | | | | | | Now that we can compare and clone, we can implement parsing bond type links. Add parsing for all supported types. Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
| * link/bonding: implement comparing bond linksJonas Gorski2024-08-301-0/+21
| | | | | | | | | | | | Implement comparing two bond links to know if their attributes changed. Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
| * link/bonding: implement io_clone()Jonas Gorski2024-08-301-0/+21
| | | | | | | | | | | | | | Implement the missing rtnl_link_info_ops::io_clone(), so that cloning a bond link will retain its data. Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
| * link/bonding: add getters for attributesJonas Gorski2024-08-273-6/+154
| | | | | | | | | | | | | | In preparation of parsing bond link attributes, add getters for all supported attributes. Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
| * link/bonding: rename bn_mask to ce_maskJonas Gorski2024-08-271-11/+11
|/ | | | | | rename bn_mask to ce_mask to allow the use of attr macros. Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
* tests: optimize _nltst_assert_route_list_permutate() to short cut search ↵Thomas Haller2024-08-221-4/+16
| | | | through permutations
* tests: in _nltst_assert_route_list() accept arbitrary orderThomas Haller2024-08-222-51/+104
| | | | | | | | | | | | | | | | | | | | | | | | | _nltst_assert_route_list() compares the content of the cache with a list of expected routes. The cache does not have a well defined order. Well, maybe the cache *should* have a well defined order, because when we use `ip route replace`, it will replace some route that has certain similar attributes, but is otherwise another route (as far as route identity and caching is concerned). But on netlink, we are only told that one route was replaced, but not which one. Some kernel developers think that in face of that, we just iterate the cache (in the same order as kernel exports the route), find the first similar route and know that was the one that is replaced. Does that work? Dunno, I never saw anybody implementing that successfully. NetworkManager implements a similar cache and throws it's hands in the air and requests a new dump of all routes that it caches. Anyway. Unless somebody shows that the cache is always in a consistent and reproducible state, this unit test was wrong. Instead, permutate through all lists of routes, and try to find a one-to-one match with the expected routes.
* base: add _nl_swap() helper macroThomas Haller2024-08-221-0/+13
|
* tests: ensure that there are all expected routes in _nltst_assert_route_list()Thomas Haller2024-08-221-14/+24
|
* merge branch 'th/test-print-routes'Thomas Haller2024-08-223-54/+171
|\
| * tests: print route list before failure in _nltst_assert_route_list()Thomas Haller2024-08-221-8/+34
| | | | | | | | | | It's hard to debug a failure. Print what we were comparing before crashing.
| * tests: add _nltst_objects_to_string() helperThomas Haller2024-08-222-0/+47
| |
| * tests: add _nltst_malloc0() and _nltst_sprintf() helpersThomas Haller2024-08-221-0/+27
| |
| * tests: move definition of asserts in "tests/nl-test-util.h"Thomas Haller2024-08-221-38/+40
| |
| * tests: use _nl_ptrarray_len() helper in _nltst_assert_route_list()Thomas Haller2024-08-221-8/+1
| |
| * base: add _nl_ptrarray_len() helperThomas Haller2024-08-221-0/+22
|/
* link: link_msg_parser(): keep link info instead of release and reacquireJonas Gorski2024-08-191-5/+1
| | | | | | | | | | | | | | | | | | | | | | Calling release_link_info() will call io_free() for rtnl_link::l_info was allocated just a few lines before as a side effect of rtnl_link_set_type(). Apart from doing needless memory churn, this will also leave the link with l_info set to NULL if the link type does not provide a io_parse() function. Assuming the memory leak mentioned in bfee88b8b0a9 ("route: fix memory leak of l_info_ops in link_msg_parser()") was a double reference taken by calling rtnl_link_info_ops_lookup() twice, once via rtnl_link_set_type(), and once directly, replace the lookup() / release() lookup() with a single lookup() and then reuse the populated rtnl_link::l_info_ops pointer. Fixes: bfee88b8b0a9 ("route: fix memory leak of l_info_ops in link_msg_parser()") Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de> https://github.com/thom311/libnl/pull/396
* lib/attr: merge branch 'Geywn:nla_variable_length_integer'Thomas Haller2024-08-193-0/+81
|\ | | | | | | https://github.com/thom311/libnl/pull/398
| * lib/attr: add nla functions for variable-length integersWen Gu2024-08-173-0/+76
| | | | | | | | | | | | | | | | | | 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-162-0/+5
|/ | | | | | | | | 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-194-4/+10
|
* python: fix flake8 warningsThomas Haller2024-07-192-3/+3
| | | | | | ./python/netlink/route/tc.py:599:37: C408 Unnecessary dict call - rewrite as a literal. ./python/netlink/route/tc.py:610:16: C416 Unnecessary list comprehension - rewrite using list(). ./python/netlink/util.py:106:47: C408 Unnecessary dict call - rewrite as a literal.
* doc: workaround LINK_DOC with empty libnl.dictThomas Haller2024-07-191-1/+3
| | | | | | | | Seems recent asciidoc leave us with an empty "libnl.dict". This breaks the script. It's not clear to me, why this happens, or why we need to LINK_DOC at all. Just work around it, so it no longer crashes.
* lib: avoid overflow in computation of s_seq_nextChristopher Ferris2024-07-192-1/+6
| | | | | | | | | | | | | | | On some systems, the clock is reset, or is lost, so the value returned by the time function can be a very small value. In that case, the _badrandom_from_time function returns a large value close to the maximum unsigned int value for s_seq_next. This can lead to the value wrapping around fairly quickly. When compiling the library with the unsigned-integer-overflow sanitizer enabled, this causes an abort. Detect this potential wrap around condition and avoid it. https://github.com/thom311/libnl/pull/395
* all: fix and enable "-Wsign-compare" warningThomas Haller2024-05-2935-74/+103
|
* build: use AC_USE_SYSTEM_EXTENSIONS instead of defining _GNU_SOURCEThomas Haller2024-05-294-6/+8
| | | | | | | | | Don't define _GNU_SOURCE on the command line. Instead, use AC_USE_SYSTEM_EXTENSIONS which embeds it in "include/config.h". Also, fix flex files to ensure "include/config.h" is included as first, and that we get _GNU_SOURCE defined before including anything else. This is achieved by include "include/nl-default.h" as %top{}.
* build: move "-DPGKLIBDIR" and renameThomas Haller2024-05-292-2/+2
| | | | | | | | | These defines should be defined at one place ("defines_cppflags") and they should be available the same throughout the source code. Even if PKGLIBDIR is only used by "src/lib/utils.c", there is no harm in defining it for all compilation units. The point is that it is only defined at one place and the same for all compilation units.
* build: cleanup defining SYSCONFDIR on command lineThomas Haller2024-05-292-5/+9
| | | | | | | | | | | | | | | | Optimally, ./configure defines things in include/config.h. However, that does not work well with defines that contain path names (see [1]). Continue to use "-D" command line option. However, factor out the definition to one place. Also, rename from SYSCONFDIR to _NL_SYSCONFDIR_LIBNL. Note that "src_lib_libnl_cli_3_la_CPPFLAGS" defined to -DSYSCONFDIR=\"$(sysconfdir)\", without the "libnl" subdirectory. In this case, the define was never used. The change doesn't matter. [1] https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Installation-Directory-Variables.html
* build: drop unnecessary "-Wno-missing-field-initializers" from default CFLAGSThomas Haller2024-05-291-1/+0
| | | | This warning does not seem to be triggered. Don't needlessly disable it.
* build: add "-Wvla" and "-Wdeclaration-after-statement" to default CFLAGSThomas Haller2024-05-292-6/+10
| | | | | Instead of having those flags on only in the build script of github CI, add them to the default flags in "Makefile.am".
* lib: add internal _nla_len() helperThomas Haller2024-05-293-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* route: treat routes with via nexthops as universe scoped as wellJonas Gorski2024-05-291-1/+1
| | | | | | | | | RTA_VIA is a RTA_GATEWAY with added address family, so we should treat them them equivalent for guessing the scope. Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de> https://github.com/thom311/libnl/pull/389
* 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).