Currently we differentiate IPv4-subnets from IPv6-subnets in host-interfaces through subnet()
and subnet6()
methods.
This automatically leads to IPv4-subnets getting precedence over IPv6 ones in most cases, because a lot of code using interfaces is only using the subnet()
-method.
This leads to bugs like the following:
- Bug #30808: ExecutionProxy cannot be found if host only has IPv6 NIC - Foreman Remote Execution - Foreman
- Bug #30823: IPv6 subnet does not display hosts - Foreman
A way to solve this is to make all procedures in foreman (and plugins) to define its own rules of precedence and fallback, e.g. if IPv6-only hosts should be created or IPv6 should be preferred.
However, I think this would be better solved by offering theses rules centralized, maybe in the interface or even globally.
A possible solution might be to add a subnet4()
-method, which always returns the IPv4-subnet (and nil if none is configured.
The subnet()
-method could then be rewritten to either return the configured IPv4- or IPv6-subnet, based on previously set rules of precedence and fallback.