From 7e0fa159825960d45944fa047d3791b5a3fa4b04 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Wed, 25 Jan 2023 13:37:25 +0100 Subject: [PATCH] interfaces: safeguard some shell_exec() callouts in case parameter isn't provided, also omits "Passing null to parameter" messages in debug log --- src/etc/inc/interfaces.inc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 6cda4c563..6ef7772fa 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -3886,9 +3886,11 @@ function get_interfaces_info($include_unlinked = false) } } - $aux = trim(shell_exec(exec_safe('/usr/local/sbin/ifctl -6pi %s', $ifinfo['ifv6']))); - if (!empty($aux)) { - $ifinfo['prefixv6'] = $aux; + if (!empty($ifinfo['ifv6'])) { + $aux = trim(shell_exec(exec_safe('/usr/local/sbin/ifctl -6pi %s', $ifinfo['ifv6']))); + if (!empty($aux)) { + $ifinfo['prefixv6'] = $aux; + } } $ifinfotmp = $all_intf_stats[$ifinfo['if']]; @@ -3953,7 +3955,7 @@ function get_interfaces_info($include_unlinked = false) break; } - if (file_exists("/var/run/{$link_type}_{$ifdescr}.pid")) { + if (file_exists("/var/run/{$link_type}_{$ifdescr}.pid") && !empty($ifinfo['if'])) { $sec = intval(trim(shell_exec('/usr/local/opnsense/scripts/interfaces/ppp-uptime.sh ' . escapeshellarg($ifinfo['if'])))); if ($sec) { $ifinfo['ppp_uptime'] = convert_seconds_to_hms($sec);