From b9b98f12ae8bc4a13e262acecfac193f7b87e1e8 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 8 Nov 2024 09:47:47 +0100 Subject: [PATCH] interfaces: use Autoconf class to avoid raw ifctl file access --- src/etc/inc/system.inc | 2 +- src/etc/rc.newwanip | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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));