summaryrefslogtreecommitdiffstats
path: root/lib/route/nh.c
Commit message (Collapse)AuthorAgeFilesLines
* all: fix and enable "-Wsign-compare" warningThomas Haller2024-05-291-1/+1
|
* lib: add internal _nla_len() helperThomas Haller2024-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* all: use defines for attributesThomas Haller2024-04-221-1/+1
| | | | We have those defines. Use them throughout.
* clang-format: reformat files with new formatThomas Haller2023-08-171-1/+1
| | | | $ ./tools/clang-format.sh
* include: use <linux/$file> instead of <linux-private/linux/$file>Thomas Haller2023-08-081-1/+1
| | | | | | As we now copy all linux headers, and we have include/linux-private in our include search path, just include the linux headers as we commonly do.
* include: drop "netlink-private/netlink.h" and move declarationsThomas Haller2023-08-021-2/+1
|
* all: cleanup includes and use "nm-default.h"Thomas Haller2023-08-021-1/+4
|
* include: split and drop "netlink-private/types.h"Thomas Haller2023-08-021-0/+17
| | | | | Move all the declarations from "netlink-private/types.h" to places closer to where they are used.
* nl-aux: add "include/nl-aux-{core,route}" headersThomas Haller2023-07-311-0/+2
| | | | | | | | | | | | | | | | | | | We have "include/netlink-private/netlink.h", which is private API used internally. However, it's confusing where "include/netlink-private/netlink.h" can be used. For example, it contains some "libnl-route-3.so" specific extensions like "link_lookup()", hence you would think that it can only be used with libraries that also use "libnl-route-3.so". Well, since it's a header, you actually can also use it for example under "lib/xfrm/", you couldn't just use those declarations because they are implemented and accessible only under "lib/route/" In a first step to clean this up, and move helper to separate headers, add "include/nl-aux-{core,route}" headers with certain clear usage. Clear in the sense who may use those headers, and what the implementation of those headers may use.
* route: cleanup ATTR_DIFF() macrosThomas Haller2023-07-311-10/+11
| | | | | | - use consistent name _DIFF() for macro - spell out the full attribute, and don't join the name via ##.
* route: add nh typeStanislav Zaikin2023-07-311-0/+568