diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index a5bca3b9c..3df7011df 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -567,7 +567,7 @@ function system_interface_route($gw, $routes) if (!$far) { /* special case tries to turn on far gateway when required for dynamic gateway */ - $dynamicgw = trim(@file_get_contents("/tmp/{$device}_router") ?? ''); + $dynamicgw = OPNsense\Interface\Autoconf::getRouter($device, 'inet'); if (!empty($dynamicgw) && $gateway === $dynamicgw) { list (, $network) = interfaces_primary_address($interface); if (!empty($network) && !ip_in_subnet($gateway, $network)) { diff --git a/src/etc/rc.newwanip b/src/etc/rc.newwanip index aa60bdbf3..812664c1c 100755 --- a/src/etc/rc.newwanip +++ b/src/etc/rc.newwanip @@ -66,7 +66,7 @@ if (!is_ipaddr($ip)) { return; } -$gw = trim(@file_get_contents("/tmp/{$device}_router") ?? ''); +$gw = OPNsense\Interface\Autoconf::getRouter($device, 'inet'); $cacheip_file = "/tmp/{$device}_oldip"; $cacheip = trim(@file_get_contents($cacheip_file));