Issue #3486 has been reported by sigttou.
----------------------------------------
Bug #3486: IPv4 /32 interface address fails with EEXIST
http://bugs.dragonflybsd.org/issues/3486
* Author: sigttou
* Status: New
* Priority: Normal
* Target version: 6.6
* Start date: 2026-11-29
----------------------------------------
Since 9ac2060abb ("net: Normalize IPv4 /32 route to a host route"), adding an
IPv4 /32 address to a non-loopback interface fails:
<pre>
# ifconfig tap0 create
# ifconfig tap0 inet 10.9.9.9/32 10.9.9.9
ifconfig: ioctl (SIOCAIFADDR): File exists
</pre>
A /24 address on the same interface works. tailscaled adds exactly such an
address to its tap device (@ifconfig tailscale0 inet 100.x.y.z/32 100.x.y.z@),
so the node gets no tailnet address on a kernel with the commit.
@in_addprefix()@ first adds the loopback host route for the address, then
@rtinit(RTM_ADD)@ reaches @rtrequest1()@, where @rt_hostroute_normalize()@
turns the /32 interface route into the same host route key (netmask dropped,
RTF_HOST); the add collides and returns @EEXIST@. Before the commit both routes
existed (@A UH lo0@ and @A/32 UC tap0@).
Two patches, either fixes it.
*0001-netinet-Do-not-add-an-interface-route-for-a-32-address.patch* (my
preference): @in_addprefix()@ does not add the interface route for a /32
address on a non-loopback, non-point-to-point interface, because the loopback
host route it has just added already routes the address. No /32 network route
is created, which matches 5a47208162. Costs: the address has no interface route
(@IFA_ROUTE@ unset), so @route delete x/32@ removes the only route and the
address becomes unreachable (the loopback route is the host route now, local
delivery and ARP do not depend on the interface route, ifa lookups use the
ifaddr list), no @RTM_NEWADDR@/@RTM_DELADDR@ is sent for such an address (those
come from the @rtinit()@ callback), as for an address that shares the prefix
route of another one; and a host-route address whose destination equals the /32
(e.g. @ifconfig lo0 alias A@ after @tap0 A/32@) no longer finds an owner of the
prefix in the duplicate scan and hits @EEXIST@, which worked before the commit.
*0002-net-Only-normalize-32-routes-without-an-interface-address.patch* (smaller
alternative): @rtrequest1()@ normalizes only requests that do not carry an
interface address (@rti_ifa == NULL@), so @rtinit()@ keeps the /32 prefix route
and the route table is exactly the pre-9ac2060abb one. route(8) still gets a
host route. The /32 network route that 5a47208162 considers pointless stays,
and routing-socket GET/CHANGE/LOCK/DELETE for x/32 select the loopback host
route instead of the interface route.
I prefer the first one because it removes the /32 network route instead of
working around the collision and fits 5a47208162, but the second one restores
the previous behaviour exactly (routes, address messages, shared-prefix cases),
so it is the safer one if you do not want to change the interface route
handling.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://bugs.dragonflybsd.org/my/account