get_route_to: an IPv6 next hop of an IPv4 route ('via inet6 fe80::1') is read as 'inet6' #65

Closed
opened 2026-11-02 07:46:33 +00:00 by christianmanivong · 0 comments
Owner

What happens

_routes.py reads the next hop with

_VIA = re.compile(r"via\s+(\S+)")

For an IPv4 route with an IPv6 next hop (RFC 5549 / RFC 8950, common with BGP unnumbered and FRR), iproute2 prints default via inet6 fe80::1 dev eth0 proto bgp metric 20 (nexthop via inet6 … for multipath). The next hop is then read as the literal inet6.

Expected

An optional address family word after via (inet, inet6) is skipped; the next hop is the address. Test-first: ip -4 route show output with via inet6 fe80::1 yields next hop fe80::1.

Priority: P4 — wrong next hop on hosts with IPv6-next-hop IPv4 routes.

Found during the bug sweep of 2026-11-02.

## What happens `_routes.py` reads the next hop with ```python _VIA = re.compile(r"via\s+(\S+)") ``` For an IPv4 route with an IPv6 next hop (RFC 5549 / RFC 8950, common with BGP unnumbered and FRR), iproute2 prints `default via inet6 fe80::1 dev eth0 proto bgp metric 20` (`nexthop via inet6 …` for multipath). The next hop is then read as the literal `inet6`. ## Expected An optional address family word after `via` (`inet`, `inet6`) is skipped; the next hop is the address. Test-first: `ip -4 route show` output with `via inet6 fe80::1` yields next hop `fe80::1`. Priority: P4 — wrong next hop on hosts with IPv6-next-hop IPv4 routes. Found during the bug sweep of 2026-11-02.
christianmanivong added the
prio
P4
bug
labels 2026-11-02 07:46:33 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-linux#65