Regression #14623
closedPrimary interface address is incorrectly set to the last address on the interface
100%
Description
The fixes for #11545 seem to have introduced another regresssion when finding the primary interface address.
My WAN interface gets both a GUA and a ULA address from the upstream router. In pfSense 2.6.0 the primary interface address shown in the UI would correctly be the GUA. In pfSense 2.7.0 it now always uses the ULA as the primary interface address, breaking things like IPsec. My site-to-site tunnels would only come up again after I had manually removed the ULA from the interface.
I traced the problem to the new get_interface_addresses
function. It always returns the last IPv6 address it found for an interface (excluding VIPs). I am not sure by which logic FreeBSD sorts IP addresses, but in my case the GUA is always listed first. Maybe it's just the same order the addresses were specified in the Router Advertisement.
In any case pfSense's previous behaviour should be restored, which is to use the first address returned by the OS as the primary address rather than the last. pfSense_get_interface_addresses
, which was deprecated by get_interface_addresses
, still does exactly that. In 2.7.0 it still correctly returns the GUA while at the same time get_interface_addresses
returns the ULA.
Fixing this should be as easy replacing array_pop
with array_shift
.
Related issues