interfaces: use Autoconf class to avoid raw ifctl file access

This commit is contained in:
Franco Fichtner 2024-11-08 09:47:47 +01:00
parent 270aac573d
commit b9b98f12ae
2 changed files with 2 additions and 2 deletions

View File

@ -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)) {

View File

@ -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));