I propose the following fix on /etc/int/system.inc line 755:
if (!empty($interface) && $interface != $interfacegw) {
;
} else if (is_ipaddrv4($gatewayip)) {
$realgwif = get_real_interface($interfacegw);
log_error(sprintf(gettext("ROUTING: setting default route to %s via %s"), $gatewayip, $realgwif));
route_add_or_change("-inet default {$gatewayip} -ifp {$realgwif}");
}
For reference, pre change:
if (!empty($interface) && $interface != $interfacegw) {
;
} else if (is_ipaddrv4($gatewayip)) {
log_error(sprintf(gettext("ROUTING: setting default route to %s"), $gatewayip));
route_add_or_change("-inet default {$gatewayip}");
}
The default behavior of the route add command if an IP is specified is to pick the lowest numbered interface. If both interfaces have the same IP addresses it will always pick xn0, causing this bug. This fix just specifies forces the interface to be set.
Might want to do this a little further down for ipv6 as well...
if (!empty($interface) && $interface != $interfacegwv6) {
;
} else if (is_ipaddrv6($gatewayipv6)) {
$ifscope = "";
if (is_linklocal($gatewayipv6) && !strpos($gatewayipv6, '%')) {
$ifscope = "%{$defaultifv6}";
}
log_error(sprintf(gettext("ROUTING: setting IPv6 default route to %s"), $gatewayipv6 . $ifscope));
route_add_or_change("-inet6 default {$gatewayipv6}{$ifscope}");
}