Scoped addresses are handled specially in the kernel. In kernel structures like routing tables or interface structures,
a scoped address will have its interface index embedded into the address. Therefore, the address in some kernel
structures is not the same as that on the wire. The embedded index will become visible through a PF_ROUTE socket,
kernel memory accesses via kvm(3) and on some other occasions. HOWEVER, users should never use the embedded form.
For details please consult IMPLEMENTATION supplied with KAME kit.
In our case the embedded addresses are being reported from sysctl/PF_ROUTE. Mostly they work fine, except that they
leak into HTTP URLs passed to Windows. Which doesn't know how to handle them.
From
man inet6
on FreeBSD/macOSIn our case the embedded addresses are being reported from sysctl/PF_ROUTE. Mostly they work fine, except that they leak into HTTP URLs passed to Windows. Which doesn't know how to handle them.
Following to KAME kit (e.g. https://github.com/kame/kame/blob/master/IMPLEMENTATION) one discovers function
in6_clearscope
that can be used to clear the embedded scope.This change applies its ported implementation to the addresses we get.