summaryrefslogtreecommitdiffstats
path: root/lib/route
Commit message (Collapse)AuthorAgeFilesLines
...
* include: split and drop "netlink-private/types.h"Thomas Haller2023-08-0268-9/+776
| | | | | Move all the declarations from "netlink-private/types.h" to places closer to where they are used.
* include: rename "nl-hidden-route" to "nl-priv-dynamic-route"Thomas Haller2023-08-021-1/+1
| | | | | Naming is just so important to understand what this is. This name is better.
* include: rename "nl-intern-route" to "nl-priv-static-route"Thomas Haller2023-08-021-1/+1
| | | | | Naming is just so important to understand what this is. This name is better.
* route/tc: avoid unalinged access in rtnl_tc_msg_parse()Thomas Haller2023-08-021-14/+15
|
* add support for TC action statisticsDavide Caratti2023-08-021-0/+46
| | | | | | | | https://github.com/thom311/libnl/issues/343 Signed-off-by: Davide Caratti <dcaratti@redhat.com> https://github.com/thom311/libnl/pull/346
* route: move "include/netlink-private/route/link/sriov.h" to ↵Thomas Haller2023-08-013-2/+30
| | | | lib/route/link-sriov.h
* route: move "include/netlink-private/route/nexthop-encap.h" to lib/routeThomas Haller2023-08-015-4/+42
|
* route: merge "include/netlink-private/tc.h" to lib/route/tc-api.hThomas Haller2023-08-0144-45/+33
| | | | | It's a private header only for lib/route (libnl-route-3). We already have a similar header. Move the content to "lib/route/tc-api.h".
* route: move rtnl_tc_build_rate_table() to "tc-api.h"Thomas Haller2023-08-011-0/+4
| | | | | | This symbols is (wronly) exposed on the ABI of libnl-route-3. Move the declaration to "tc-api.h", where there are similar symbols of this kind.
* route: move "include/netlink-private/route/tc-api.h" to lib/routeThomas Haller2023-08-0133-32/+121
| | | | | | | | This header is entirely private to lib/route (libnl-route-3). Move the header there, it should not be used by anybody else. Note that libnl-route-3 exports symbols from this private header. That is ugly, make that clearer by adding comments.
* include: move "include/netlink-private/route/link/api.h" to lib/routeThomas Haller2023-07-3130-29/+251
| | | | | This header is entirely private to compiling libnl-route-3 under lib/route. Move the header there.
* include: move "include/netlink-private/route/utils.h" to nl-intern-routeThomas Haller2023-07-311-1/+1
| | | | | | | | | | | | | | | | This header has a very specific purpose. To give access to the unit tests to some internals. It only is usable to parts that statically link with libnl-route-3 sources (e.g. "tests/check-direct") and libnl-route-3 itself. The point is that the symbol there is not exported by the libnl-route-3 shared library, so a test that dynamically links against libnl-route-3 couldn't access them. Hence the internal purpose of static linking the test with libnl-route-3 sources, and a special header for that. Move "include/netlink-private/route/utils.h" to a separate place, to make that usage clearer.
* nl-aux: add "include/nl-aux-{core,route}" headersThomas Haller2023-07-316-6/+15
| | | | | | | | | | | | | | | | | | | 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.
* base: move "netlink-private/utils.h" to "base/nl-base-utils.h"Thomas Haller2023-07-3110-10/+10
| | | | | | | | | | "base/nl-base-utils.h" (formerly "netlink-private/utils.h") contains no libnl3 specific references, just a bunch of C helpers. It's also a header-only "library", so it can be freely used by all our C-code. Move it to a separate directory, to make that clear.
* route: cleanup ATTR_DIFF() macrosThomas Haller2023-07-312-36/+36
| | | | | | - 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
|
* neigh: add support of NHID attributeStanislav Zaikin2023-07-311-0/+29
|
* lib: use _nl_{init,exit} instead of __{init,exit}Thomas Haller2023-07-2874-143/+143
| | | | | We should have things with "nl" prefix in our headers. Also, netlink-private/netlink.h is not header-only, preferably header-only stuff is in netlink-private/utils.h
* all: use "_nl_packed" macro instead of "__attribute__((packed))"Thomas Haller2023-07-284-4/+4
|
* all: rework ATTR_DIFF() macros to not generate attribute namesThomas Haller2023-07-2813-216/+221
| | | | | | | | | | I find macros that stitch together names like "FAMILY_ATTR_##ATTR" very confusing, because we no longer see where a certain name is used. It breaks grepping for symbols, and it breaks cscope. Yes, it's more verbose to not do that. If you really think that those names are too verbose, then maybe they should get a shorter name. And not use macros to make them palatable.
* all: use _NL_{MIN,MAX}() macrosThomas Haller2023-07-283-5/+5
| | | | | | | | | | | | | | | | | | Replace the use of the previous min()/min_t()/max()/max_t(). - min_t()/max_t() required a type, and would do plain assignment, which C would not complain about. It is thus a cumbersome and not very safe pattern. Avoid it. - min()/max() did better, it used typeof() to preserve the argument types and automatically detect it. However, it also required that both arguments had the same integer type, which is unnecessarily strict. _NL_MIN()/_NL_MAX() does better. It accepts arguments of any integer types, but has a static assertions that they match in signedness. So it's more flexible to use than min()/max() and still quite safe. Prefer the new macros.
* route/bond: Add support for link_info for bondMallikarjun Nemagoudar2023-07-271-4/+103
| | | | | | | | | | | | | following API has been added to bonding bond_alloc bond_free rtnl_link_bond_set_activeslave rtnl_link_bond_set_mode bond_put_attrs Signed-off-by: Mallikarjun Nemagoudar <MallikarjunRamappa.Nemagoudar@infineon.com> https://github.com/thom311/libnl/pull/349
* macsec: Drop offload capability validation checkEmeel Hakim2023-07-261-3/+0
| | | | | | | | | | | | | | | | | | | | | Currently, rtnl_link_macsec_set_offload rejects any value greater than 1 limiting the MACSEC_ATTR_OFFLOAD attribute to the values 0 and 1 where other values are also legal. Drop such a check since it is redundant, eventually the user will send the netlink message to kernel, and whether the message is valid depends on kernel. Fixes: b6cc13d76b29 ('Supporting Hardware offload capability for MACsec') Signed-off-by: Emeel Hakim <ehakim@nvidia.com> http://lists.infradead.org/pipermail/libnl/2023-February/002417.html http://lists.infradead.org/pipermail/libnl/2023-February/002420.html http://lists.infradead.org/pipermail/libnl/2023-February/002424.html https://github.com/thom311/libnl/pull/336 https://github.com/thom311/libnl/pull/341
* bridge: fix bridge info parsingStanislav Zaikin2023-07-241-0/+1
| | | | | | Fixes: 1a4031d6db73 ('lib/route: Support IFLA_BRIDGE_MODE') https://github.com/thom311/libnl/pull/339
* route/link: prevent segfault in af_request_type()Thorben Römer2023-07-241-1/+1
| | | | | | | | | Check that ops->ao_override_rtm() is set before using it, which prevents a segfault whenever af_request_type() is called with a type that has ops but that does not initialize said function in their ops struct. https://github.com/thom311/libnl/pull/333
* docs: rtnl_link_put() 'releases' instead of 'returns'Antonio Prcela2023-07-241-1/+1
| | | | https://github.com/thom311/libnl/pull/345
* route/link: improve handling of IFLA_INET6_CONFThomas Haller2023-07-241-7/+12
| | | | | | | | | | On the netlink API, IFLA_INET6_CONF is a list of uint32_t integers, but the number of actually provided values depends on the kernel version (and the DEVCONF_MAX value that it was compiled with. We clone the kernel header in our source tree, so DEVCONF_MAX from the libnl3 build may differ from the running kernel. We need to keep track how many values kernel actually provides.
* route/link: remove rtnl_link_inet6_set_conf() APIThomas Haller2023-07-241-28/+0
| | | | | | | | | | | | | | It's not clear how this API is useful. I don't think that kernel accepts netlink requests to change the settings. So constructing a libnl3 object in the user application seems not useful. Also, because of the difficulty that DEVCONF_MAX is depending on the current kernel, and changing. We need to improve how to handle the option, and a rtnl_link_inet6_set_conf() only makes that more confusing. The same is the case for rtnl_link_inet6_set_flags(), but that API already exists, while rtnl_link_inet6_set_conf() is still new and unreleased.
* route/link: various fixes for rtnl_link_inet6_get_conf() APIThomas Haller2023-07-241-2/+2
|
* route/link: add accessor API for IPv6 DEVCONFAbdurrahman Hussain2023-03-291-0/+58
| | | | Signed-off-by: Abdurrahman Hussain <abdurrahman@hussain.rocks>
* bridge: drop unnecessary goto in bridge_info_parse()Thomas Haller2022-08-241-5/+4
|
* bridge: don't normalize the u8 argument in ↵Thomas Haller2022-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | rtnl_link_bridge_set_vlan_filtering() to boolean In bridge-info, we have two u8 attributes (vlan-filtering and stats-enabled). In both cases, kernel only expects there a boolean value (either zero or one). In case of vlan-filtering, I think kernel actually doesn't care, and would treat any non-zero value as true. In case of stats-enabled, kernel would reject values outside the values zero or one. Previously, libnl3 would normalize the boolean value for vlan-filtering, but not for stats-enabled. That is at least inconsistent, in particular considering that kernel requires a normalized value for stats-enabled, but not for vlan-filtering. Our public API has uint8_t parameters (and not bool). That makes sense, as it follows the netlink API. It's not clear how to handle these boolean u8 attributes best. Should the API be bool or uint8_t? Should we normalize the boolean values? In any case, do something consistently. For no particular reason, choose to not add additional logic. The user can set any value, whether that value makes sense, it's up to them.
* bridge: expose rtnl_link_bridge_get_vlan_protocol() in host byte orderThomas Haller2022-08-241-4/+7
| | | | | On netlink, IFLA_BR_VLAN_PROTOCOL attribute is be16. In the libnl3 API, expose the number in native endianness.
* bridge: fix parsing vlan-protocol in bridge_info_parse()Thomas Haller2022-08-241-1/+1
|
* bridge: minor cleanups in "bridge_info.c"Thomas Haller2022-08-241-8/+7
|
* bridge: use SPDX license identifiers in bridge_info filesThomas Haller2022-08-241-7/+1
|
* bridge: reformat bridge_info file with clang-formatThomas Haller2022-08-241-42/+40
|
* bridge: extend libnl with options needed for VLAN aware forwardingRobert Dabrowski2022-08-241-1/+192
| | | | | | Signed-off-by: Robert Dabrowski <rdabrowski@maxlinear.com> Co-Authored-By: Kacper Ludwinski <kludwinski@maxlinear.com>
* bridge: Add support for link_info of a bridgeLanger, Thomas2022-08-241-0/+119
| | | | | | | | And functions to access some new bridge attributes. Signed-off-by: Langer Thomas <tlanger@maxlinear.com> Co-Authored-By: Kacper Ludwinski <kludwinski@maxlinear.com>
* route/vlan: drop unnecessary "else" in vlan_put_attrs()Thomas Haller2022-08-241-10/+8
|
* route/vlan: fix error handling in 'lib/route/link/vlan.c'Thomas Langer2022-08-241-3/+16
| | | | | | | | related to goto label nla_put_failure Signed-off-by: Langer Thomas <tlanger@maxlinear.com> Co-Authored-By: Kacper Ludwinski <kludwinski@maxlinear.com>
* doc: fix typoThomas Haller2022-08-241-2/+2
|
* doc: fix typoLeon M. George2022-08-246-9/+9
|
* route: construct all-zero addresses for default route destinationJonas Gorski2022-07-071-3/+18
| | | | | | | | | | | | | | A default route is equivalent to a 0.0.0.0/0 or ::/0 route, so we should construct the dst as such with a all-zero address. Since this breaks the assumption that a dst with a 0 address length is a default route, switch to checking the prefix length being 0, and make sure that there is an address part that is all-zero. This ensures we will print the actual dst in case the address is not zero, or does not exist. Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
* route: act: Allow full set of actions on gact,skbedit,mirredVolodymyr Bendiuga2022-07-063-28/+3
| | | | | | Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@westermo.com> https://github.com/thom311/libnl/pull/319
* sriov: fix setting ce_mask when parsing VF stat counterkyolee2022-07-061-1/+1
| | | | | | https://github.com/thom311/libnl/pull/324 Fixes: 5d6e43ebef12 ('lib/route: SRIOV Parse and Read support')
* route: format recently added code with clang-formatThomas Haller2022-05-271-13/+13
|
* route/act: add NAT actionMagnus Öberg2022-05-271-0/+288
| | | | | | | Signed-off-by: Magnus Öberg <magnus.oberg@westermo.se> Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com> https://github.com/thom311/libnl/pull/317
* route: format recently added code with clang-formatThomas Haller2022-05-271-7/+13
|
* cls: flower: extend flower APIVolodymyr Bendiuga2022-05-271-0/+174
| | | | | | | | | | | | | The following API has been added: rtnl_flower_set_ipv4_src rtnl_flower_get_ipv4_src rtnl_flower_set_ipv4_dst rtnl_flower_get_ipv4_dst Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@westermo.com> https://github.com/thom311/libnl/pull/309