fix(routes): read route types and multipath next hops in ip route
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m16s
driver / test (3.12) (pull_request) Successful in 1m11s
driver / test (3.13) (pull_request) Successful in 1m5s
driver / lowest (pull_request) Successful in 32s
driver / build (pull_request) Successful in 36s
driver / security (pull_request) Successful in 1m19s
CI / driver (pull_request) Successful in 2m57s
driver / publish (pull_request) Skipped

get_route_to took the first word of every "ip route show" line as the
destination. For unreachable, blackhole, prohibit and throw routes that
word is the route type, so they came back as "unreachable/32" and the
like; a multipath route's continuation lines became "nexthop/32"
routes, and the route itself had no next hop.

The type word is now read as the type and reported in
protocol_attributes, without a next hop or outgoing interface for the
types that forward nothing (IPv6 names lo for them). nexthop lines
attach to the route before them, one entry per next hop. The test
fixture is ip's output (iproute2 6.1.0) recorded in a network
namespace set up with these routes.

Closes #57
This commit is contained in:
Christian Manivong committed 2026-11-02 08:41:56 +01:00
1 parent d3134c83b8
commit e4c65945b9
4 files changed
+205 -20

No files matched your search

+7
View File
@@ -45,6 +45,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
on 3.12, so 3.10 and 3.11 are no longer tested (NAPALM/driver-standard#6).
### Fixed
- `get_route_to()` reads unreachable, blackhole, prohibit and throw routes and
multipath routes (#57). Their destinations came back as `unreachable/32`,
`blackhole/32` or `nexthop/32`, and a multipath route as one entry without a next
hop. A typed route now has its real prefix and its type in
`protocol_attributes` (`{"type": "blackhole"}`), with no next hop and no outgoing
interface, since it sends nothing out. A multipath route has one entry per next hop,
each with its gateway and interface.
- `get_available_updates()` works on dnf and yum hosts whose login user has
passwordless sudo (NOPASSWD), as netOrk's own account does, and marks the security
fixes there (#56). The security-advisory query did not parse under `sudo -n`, so no