summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * route: move "include/netlink-private/route/tc-api.h" to lib/routeThomas Haller2023-08-0138-44/+81
| | | | | | | | | | | | | | | | 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.
| * route: move hidden symbols from "include/netlink-private/route/tc-api.h"Thomas Haller2023-08-019-75/+87
| | | | | | | | | | | | | | | | | | | | | | To new header "include/nl-hidden-route/nl-hidden-route.h". libnl-route-3 exports some symbols that are no in public headers. They are however used by other internal users in the source tree. Such usage seems bad. We should clearly see where this is done. Move the symbols to a separate header, where it's clear who may use this header, and what's its purpose.
| * build: don't add lib/route to include directory for all libsThomas Haller2023-08-011-3/+6
|/
* include: merge branch 'th/move-private-headers-1'Thomas Haller2023-07-3190-208/+332
|\ | | | | | | https://github.com/thom311/libnl/pull/353
| * include: move "include/netlink-private/route/link/api.h" to lib/routeThomas Haller2023-07-3132-31/+59
| | | | | | | | | | 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-315-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * include: move "include/netlink-private/route/mpls.h" to "lib/mpls.h"Thomas Haller2023-07-315-4/+6
| |
| * genl: add comment about wrongly exported symbol genl_resolve_id()Thomas Haller2023-07-312-0/+2
| |
| * include: move "include/netlink-private/genl.h" to "lib/genl/nl-priv-genl.h"Thomas Haller2023-07-317-6/+6
| | | | | | | | | | | | | | | | | | | | This header is entirely private to the source files in "lib/genl". It's confusing to keep it separate. Place it beside the source files, which can use it. I guess, I just disagree with this notion, that all headers must be under "include/" directory. Not, if the header is entirely local to one module.
| * nl-aux: add "include/nl-aux-{core,route}" headersThomas Haller2023-07-3117-45/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3144-45/+60
| | | | | | | | | | | | | | | | | | | | "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.
| * include/utils: move nl-auto base defines to "utils.h"Thomas Haller2023-07-313-30/+32
| | | | | | | | | | | | | | | | "utils.h" will become the internal helper "library" at the lowest level. While "nl-auto.h" contains libnl3 specific functions, "utils.h" does not. Move libnl3 specific helpers from "nl-auto.h" to "utils.h".
| * clang-format: reformat "include/netlink-private/nl-auto.h"Thomas Haller2023-07-312-37/+48
|/
* 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/nexthop: merge branch 'zstas:main'Thomas Haller2023-07-3116-38/+1154
|\ | | | | | | https://github.com/thom311/libnl/pull/332
| * cli: add nl-nh-list utilityStanislav Zaikin2023-07-316-0/+178
| |
| * route: add nh typeStanislav Zaikin2023-07-316-0/+669
| |
| * neigh: add support of NHID attributeStanislav Zaikin2023-07-314-0/+35
| |
| * include: import kernel headers "linux/{neighbour,nexthop,rtnetlink}.h"Stanislav Zaikin2023-07-314-38/+272
|/ | | | Taken from kernel v6.4 (6995e2de6891c724bfeb2db33d7b87775f913ad1).
* utils: add static-assert for signedness of arguments of _NL_CMP_DIRECT() macroThomas Haller2023-07-311-0/+2
|
* cli: use <netlink-private/utils.h> in cli and _nl_{init,exit}Thomas Haller2023-07-2810-20/+40
| | | | | | | | | "netlink-private/utils.h" is our header-only, internal helper header. We should be able to use it everywhere, not only inside the library itself. Unlike for exapmle <netlink-private/netlink.h>, which is only usable from the libraries.
* lib: use _nl_{init,exit} instead of __{init,exit}Thomas Haller2023-07-2887-167/+164
| | | | | 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
* include/private: add _nl_init/_nl_exit macrosThomas Haller2023-07-281-0/+2
|
* include/private: drop unused __deprecated macroThomas Haller2023-07-281-2/+0
| | | | Also, there is _nl_deprecated instead.
* all: use "_nl_packed" macro instead of "__attribute__((packed))"Thomas Haller2023-07-285-5/+5
|
* all: rework ATTR_DIFF() macros to not generate attribute namesThomas Haller2023-07-2824-450/+483
| | | | | | | | | | 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: merge branch 'th/add-cmp-macros'Thomas Haller2023-07-2810-159/+434
|\
| * lib: handle negative and zero size in nla_memcpy()Thomas Haller2023-07-281-2/+5
| | | | | | | | | | | | | | | | | | | | | | a negative count is a bug in the caller. Still, handle it better than just crashing. Maybe we should assert, but it doesn't seem best to assert against user input. Also, if count is zero, don't call memcpy(). Calling memcpy() requires that the source and destination pointers are valid, otherwise it's undefined behavior. I think if the caller tells us to copy zero bytes, we should never look at the destination pointer.
| * include: drop now unused min()/max()/min_t()/max_t() macrosThomas Haller2023-07-281-17/+0
| |
| * all: use _NL_{MIN,MAX}() macrosThomas Haller2023-07-286-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * utils: add various helpers to "include/netlink-private/utils.h"Thomas Haller2023-07-281-11/+299
| | | | | | | | | | These are taken from NetworkManager code and renamed. The original code is LGPL-2.1-or-later licensed, so we are good.
| * style: format "include/netlink-private/utils.h" with clang-formatThomas Haller2023-07-283-122/+123
|/
* tools: improve failure message with "tools/clang-format.sh -n"Thomas Haller2023-07-271-1/+3
|
* github: fix format checking with clang-formatThomas Haller2023-07-271-1/+1
|
* route/trivial: sort entries in "libnl-route-3.sym" asciibeticallyThomas Haller2023-07-271-2/+2
|
* route/bond: Add support for link_info for bondMallikarjun Nemagoudar2023-07-273-4/+108
| | | | | | | | | | | | | 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
* lib: accept NULL argument in nla_nest_cancel() for robustnessThomas Haller2023-07-261-0/+9
| | | | | Previously, a NULL argument would most likely also do thing, but it also hits undefined behavior.
* 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
* python: merge branch 'th/flake8'Thomas Haller2023-07-2512-26/+28
|\
| * github: update flake8 linter to not explicitly select checksThomas Haller2023-07-251-1/+1
| | | | | | | | Instead rely on the "flake8" file.
| * python: add ".flake8" file for configuring "flake8"Thomas Haller2023-07-251-0/+7
| | | | | | | | | | Add a `.flake8` file, so that running plain flake8 in the source tree does the right thing.
| * python: fix flake8 warnings E712Thomas Haller2023-07-251-1/+1
| | | | | | | | ./python/netlink/route/links/bridge.py:29:31: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
| * python: fix flake8 warnings E711Thomas Haller2023-07-251-1/+1
| | | | | | | | ./python/netlink/core.py:194:17: E711 comparison to None should be 'if cond is None:'
| * python: fix flake8 warnings E302Thomas Haller2023-07-251-0/+1
| | | | | | | | ./python/netlink/util.py:19:1: E302 expected 2 blank lines, found 1
| * python: fix flake8 warnings E741Thomas Haller2023-07-253-12/+12
| | | | | | | | | | | | | | ./python/netlink/core.py:424:9: E741 ambiguous variable name 'l' ./python/netlink/route/link.py:476:13: E741 ambiguous variable name 'l' ./python/netlink/route/tc.py:554:5: E741 ambiguous variable name 'l' ./python/netlink/route/tc.py:574:5: E741 ambiguous variable name 'l'
| * python: fix flake8 warnings F841Thomas Haller2023-07-252-4/+4
| | | | | | | | | | | | | | | | | | ./python/examples/iface.py:66:5: F841 local variable 'e' is assigned to but never used ./python/examples/iface.py:66:5: F841 local variable 'e' is assigned to but never used ./python/examples/iface.py:109:1: F841 local variable 'e' is assigned to but never used ./python/examples/wiphy.py:116:5: F841 local variable 'e' is assigned to but never used ./python/examples/wiphy.py:116:5: F841 local variable 'e' is assigned to but never used ./python/examples/wiphy.py:158:1: F841 local variable 'e' is assigned to but never used
| * python: fix flake8 warnings W605Thomas Haller2023-07-251-1/+1
| | | | | | | | | | | | | | ./doc/resolve-asciidoc-refs.py:14:22: W605 invalid escape sequence '\[' ./doc/resolve-asciidoc-refs.py:14:24: W605 invalid escape sequence '\[' ./doc/resolve-asciidoc-refs.py:14:30: W605 invalid escape sequence '\]' ./doc/resolve-asciidoc-refs.py:14:32: W605 invalid escape sequence '\]'
| * python: fix flake8 warnings F401Thomas Haller2023-07-254-6/+0
|/ | | | | | | | | ./doc/doxygen-link.py:4:1: F401 'fileinput' imported but unused ./doc/resolve-asciidoc-refs.py:5:1: F401 'fileinput' imported but unused ./python/doc/conf.py:14:1: F401 'sys' imported but unused ./python/doc/conf.py:14:1: F401 'os' imported but unused ./python/netlink/util.py:13:1: F401 '.core as netlink' imported but unused ./python/netlink/util.py:16:1: F401 'types' imported but unused
* clang-format: merge branch 'th/clang-format'Thomas Haller2023-07-253-0/+631
|\
| * clang-format: add "tools/clang-format-container.sh" scriptThomas Haller2023-07-251-0/+51
| | | | | | | | | | | | | | This helps somewhat with the problem, that we need the correct version of clang-format for the formatting script. The script runs a Fedora container. It needs a working podman setup.