summaryrefslogtreecommitdiffstats
path: root/include/netlink/route/route.h
Commit message (Collapse)AuthorAgeFilesLines
* 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
* route/route: support FIB lookups using rtnlTobias Waldekranz2022-03-111-0/+3
| | | | | | | Using the flnl_* family of functions to perform FIB lookups is rather limited. In particular, there seems to be no way of resolving the nexthop. By hooking into RTM_GETROUTE, a regular rtnl route object is returned instead.
* license: fix and add SPDX license identifiers and drop license commentsThomas Haller2020-04-161-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also fixes a few wrong SPDX license identifiers, where the original license comment indicates GPL-2.0-only. This is not done manually, but by running the following script: --- #!/bin/bash # Tool to drop license comments, adding SPDX license identifiers, while preserving # copyright comments. The point is not to manually do this task, but perform some # hacked up string replacement. _cp() { /bin/cp "$@" } _cat() { /bin/cat "$@" } in_file() { local T=$(mktemp) _cp -f "$1" "$T" _cat "$T" rm -f "$T" } out_file() { local T=$(mktemp) _cat - > "$T" _cp -f "$T" "$1" rm -f "$T" } join() { _cat "$@" | awk '{ printf("%s#x#", $0)}' } unjoin() { _cat - | sed 's/#x#/\n/g' } files_all() { git ls-files | grep -v '\.png$' | grep -v '^include/linux-private/' } adjust() { NEWLINES='\(#x#\)\+' COPYRIGHTS='\(\( \* Copyright (c) 20..\(-20..\|, 20..\)\? [^#]\+#x#\)\+\( \*#x# \* \(Stolen[^#]*\|Based on [^#]*\)#x#\)\?\)' _cat - | \ sed '1s%^\(/\* SPDX-License-Identifier: LGPL-2.1-only \*/\|\)#x#/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU Lesser General Public#x# \*[ ]\+License as published by the Free Software Foundation version 2.1#x# \*[ ]\+of the License.#x# \*#x#'"$COPYRIGHTS"' \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: LGPL-2.1-only \*/#x#/*#x#\2 */#x##x#%' | \ sed '1s%^/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU Lesser General Public#x# \*[ ]\+License as published by the Free Software Foundation version 2.1#x# \*[ ]\+of the License.#x# \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: LGPL-2.1-only \*/#x##x#%' | \ sed '1s%^\(\)/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU Lesser General Public#x# \*[ ]\+License as published by the Free Software Foundation version 2.1#x# \*[ ]\+of the License.#x# \*#x#'"$COPYRIGHTS"' \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: LGPL-2.1-only \*/#x#/*#x#\2 */#x##x#%' | \ sed '1s%^\(/\* SPDX-License-Identifier: LGPL-2.1-only \*/\|\)#x#/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU General Public License as#x# \*[ ]\+published by the Free Software Foundation version 2 of the License.#x# \*#x#'"$COPYRIGHTS"' \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: GPL-2.0-only \*/#x#/*#x#\2 */#x##x#%' } FILES=( $(files_all) ) for f in "${FILES[@]}"; do echo "processing \"$f\"..." in_file "$f" | join | adjust | unjoin | out_file "$f" done
* route: Add support for ttl propagation in MPLS routesDavid Ahern2017-08-181-0/+3
| | | | | | | Add support for RTA_TTL_PROPAGATE attribute on a per-route basis. Used to enable/disable TTL propagation at LSP egress. Signed-off-by: David Ahern <dsahern@gmail.com>
* Remove superfluous declaration of rtnl_route_put()Tony Cheneau2013-03-171-1/+0
| | | | | | | rtnl_route_put() is declared twice in the same header file Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>
* route: Document ROUTE_CACHE_CONTENT flagThomas Graf2012-08-301-2/+7
| | | | Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Need <linux/in_route.h>Thomas Graf2008-06-161-0/+1
|
* Rename struct nl_handle to struct nl_sockThomas Graf2008-05-151-3/+3
| | | | | | | | The idea of a common handle is long revised and only misleading, nl_handle really represents a socket with some additional action handlers assigned to it. Alias for nl_handle is kept for backwards compatibility.
* Thread-safe error handlingThomas Graf2008-05-141-69/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order for the interface to become more thread safe, the error handling was revised to no longer depend on a static errno and error string buffer. This patch converts all error paths to return a libnl specific error code which can be translated to a error message using nl_geterror(int error). The functions nl_error() and nl_get_errno() are therefore obsolete. This change required various sets of function prototypes to be changed in order to return an error code, the most prominent are: struct nl_cache *foo_alloc_cache(...); changed to: int foo_alloc_cache(..., struct nl_cache **); struct nl_msg *foo_build_request(...); changed to: int foo_build_request(..., struct nl_msg **); struct foo *foo_parse(...); changed to: int foo_parse(..., struct foo **); This pretty much only leaves trivial allocation functions to still return a pointer object which can still return NULL to signal out of memory. This change is a serious API and ABI breaker, sorry!
* Added two new functions to facilitate processing the nexthop entries for routes.Ben Gamsa2008-05-081-0/+6
| | | | | | Added rtnl_route_foreach_nexthop() to walk the list of nexthops invoking a caller-provided callback for each nexthop entry, and added rtnl_route_nexthop_n() to retrieve the Nth nexthop entry in the list.
* Route cache supportThomas Graf2008-05-051-1/+5
| | | | | | This changesets adds the possibility to fill a nl_cache with the contents of the route cache. It also adds the possibility to limit route caches to certain address families.
* Big routing code rework (API/ABI BREAK!)Thomas Graf2008-04-291-41/+34
| | | | | | | | | | Adds all missing routing attributes and brings the routing related code to a working state. In the process the API was broken several times with the justification that nobody is using this code yet. The changes include new example code which is also a prototype for how plain CLI tools could look like to control routes.
* Initial importThomas Graf2007-09-141-0/+125