ansible/lib
David Gwynne 8c0ab43f05 Use more route information to improve default_ipvX facts on BSDs (#64172)
* Use "default" route info to help pick the default address.

Before this change, the address information used for the "default_ipv4"
and "default_ipv6" information is whatever is first on the interface
identified by the looking up the "default" route. On OpenBSD at
least, the first IPv6 address tends to be a link-local address,
which is not useful if you want to try and put a globally routable
v6 address in a template somewhere.

OpenBSD and NetBSD list the local address used for the default
route, so we can then use that to filter the addresses on the
interface and use the right one when it is available. This should
also help in situations where the interface has a lot of aliases,
or if you're doing IP multipath.

Thanks to John-Mark Gurney and Jared McNeill for providing me output
from the route command on FreeBSD and NetBSD respectively.

* Use "route get default" to get default route information.

Using some other arbitrary address makes these facts produce
unexpected results in some situations.
2019-11-05 19:36:04 -05:00
..
ansible Use more route information to improve default_ipvX facts on BSDs (#64172) 2019-11-05 19:36:04 -05:00