From de5ff59ff38bd4b1f272962bf37cec67b5a41ad6 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Sun, 28 May 2017 12:12:21 +0200 Subject: [PATCH] interfaces.lib.inc, extend ifconfig parsing in legacy_interfaces_details(), for https://github.com/opnsense/core/issues/1662 --- src/etc/inc/interfaces.lib.inc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/etc/inc/interfaces.lib.inc b/src/etc/inc/interfaces.lib.inc index 0183a0b35..4714f82c8 100644 --- a/src/etc/inc/interfaces.lib.inc +++ b/src/etc/inc/interfaces.lib.inc @@ -273,8 +273,26 @@ function legacy_interfaces_details($intf = null) return $a['link-local'] - $b['link-local']; }); } + } elseif (preg_match("/media: (.*)/", $line, $matches)) { + // media, when link is between parenthesis grep only the link part + $result[$current_interface]['media'] = $matches[1]; + if (preg_match("/media: .*? \((.*?)\)/", $line, $matches)) { + $result[$current_interface]['media'] = $matches[1]; + } + } elseif (preg_match("/status: (.*)$/", $line, $matches)) { + $result[$current_interface]['status'] = $matches[1]; + } elseif (preg_match("/channel (\S*)/", $line, $matches)) { + $result[$current_interface]['channel'] = $matches[1]; + } elseif (preg_match("/ssid (\".*?\"|\S*)/", $line, $matches)) { + $result[$current_interface]['ssid'] = $matches[1]; + } elseif (preg_match("/laggproto (.*)$/", $line, $matches)) { + $result[$current_interface]['laggproto'] = $matches[1]; + } elseif (preg_match("/laggport: (.*)$/", $line, $matches)) { + if (empty($result[$current_interface]['laggport'])) { + $result[$current_interface]['laggport'] = array(); + } + $result[$current_interface]['laggport'][] = $matches[1]; } - } return $result;