From c1eccd205cb688da2ef1f57178fc6cf726a05484 Mon Sep 17 00:00:00 2001 From: adrien Date: Wed, 4 Oct 2023 18:05:55 +0200 Subject: [PATCH] all interface config in class --- vlans.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/vlans.php b/vlans.php index e31adec..820343e 100644 --- a/vlans.php +++ b/vlans.php @@ -11,17 +11,21 @@ $conf = file_get_contents($path); preg_match("/ sysname ([\w-]+)/", $conf, $sysname); preg_match("/ip address ([\d.]+)/", $conf, $address); preg_match_all("/(?<=\n)vlan (?P\d+)[\r\n]+(?: name (?P.+)[\r\n]+| description (?P.+)[\r\n]+| .*[\r\n]+)*/", $conf, $vlans, PREG_SET_ORDER); -preg_match_all("/(?<=\n)interface [\w-]+(?P\d+)\/0\/(?P\d+)[\r\n]+(?: port hybrid (?:pvid )?vlan (?P\d+) tagged[\r\n]+| port hybrid vlan (?P\d+)(?: \d+)* untagged[\r\n]+| port (?P(?:access |trunk |hybrid |pvid |vlan )*)(?P\d+)[\r\n]+| (?Ppoe) enable[\r\n]+| (?Pshutdown)[\r\n]+| .*[\r\n]+)*/", $conf, $interfaces, PREG_SET_ORDER); +preg_match_all("/(?<=\n)interface [\w-]+(?P\d+)\/0\/(?P\d+)[\r\n]+(?: port hybrid (?:pvid )?vlan (?:(?P\d+) tagged|(?P\d+)(?: \d+)* untagged)[\r\n]+| port (?:access |trunk |hybrid |pvid |vlan )*(?P\d+)[\r\n]+| .*[\r\n]+)*(?"); +echo ("-->"); */ + ?> @@ -43,7 +47,7 @@ echo ("-->"); ${interface["port"]}\n"; + echo "${interface["port"]}\n"; } }