get_route_to: IPv6 default route stored as 0.0.0.0/0 #6

Open
opened 2026-10-04 10:04:31 +00:00 by christianmanivong · 0 comments
Owner

What happens

get_route_to stores the IPv6 default route as 0.0.0.0/0.

linux.py:655:

network = "0.0.0.0/0" if raw_dest == "default" else ("::/0" if raw_dest == "default6" else raw_dest)

ip -6 route show prints its default route as default ..., the same word as IPv4. default6 never occurs, so the ::/0 branch can never match. _make_entry then derives family = "ipv6" from the next hop. The result is an entry with network="0.0.0.0/0" and family="ipv6".

Effect

netOrk shows two 0.0.0.0/0 routes on a dual-stack host. Any consumer that filters default routes by network alone (for example counting static routes without the default route, as netOrk's gateway rule for NetOrk/netork#472 will) misclassifies the IPv6 default route.

Fix

Map default by family: the output of ip -6 route show gives ::/0. Either parse the two commands separately or decide by the next hop / dev family.

Test first

A host whose ip -6 route show contains default via fe80::1 dev eth0 proto ra yields ::/0 with family="ipv6".

**What happens** `get_route_to` stores the IPv6 default route as `0.0.0.0/0`. `linux.py:655`: ```python network = "0.0.0.0/0" if raw_dest == "default" else ("::/0" if raw_dest == "default6" else raw_dest) ``` `ip -6 route show` prints its default route as `default ...`, the same word as IPv4. `default6` never occurs, so the `::/0` branch can never match. `_make_entry` then derives `family = "ipv6"` from the next hop. The result is an entry with `network="0.0.0.0/0"` and `family="ipv6"`. **Effect** netOrk shows two `0.0.0.0/0` routes on a dual-stack host. Any consumer that filters default routes by network alone (for example counting static routes without the default route, as netOrk's gateway rule for NetOrk/netork#472 will) misclassifies the IPv6 default route. **Fix** Map `default` by family: the output of `ip -6 route show` gives `::/0`. Either parse the two commands separately or decide by the next hop / `dev` family. **Test first** A host whose `ip -6 route show` contains `default via fe80::1 dev eth0 proto ra` yields `::/0` with `family="ipv6"`.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-linux#6