From 25db944ae5ce3a05643331e5fbaf085c422089be Mon Sep 17 00:00:00 2001 From: adrien Date: Mon, 19 May 2025 16:21:50 +0200 Subject: [PATCH] fix trunk vlan --- show.php | 26 +++++++++++++------------- style.css | 5 ++++- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/show.php b/show.php index 938dfe4..2cc3ddb 100644 --- a/show.php +++ b/show.php @@ -13,17 +13,17 @@ $conf = file_get_contents($path); preg_match("/ sysname ([\w-]+)/", $conf, $sysname); preg_match("/ip address ([\d.]+)/", $conf, $address); $startPattern = "(?<=\n)"; -$NLP = "[\r\n]+"; -$vlanPvidPattern = "vlan (?P\d+)$NLP"; -$vlanNamePattern = " name (?P.+)$NLP"; -$vlanDescriptionPattern = " description (?P.+)$NLP"; -$otherPattern = " .*$NLP"; +$NL = "[\r\n]+"; +$vlanPvidPattern = "vlan (?P\d+)$NL"; +$vlanNamePattern = " name (?P.+)$NL"; +$vlanDescriptionPattern = " description (?P.+)$NL"; +$otherPattern = " .*$NL"; $endPattern = "(?\d+)\/0\/(?P\d+)$NLP"; -$pvidPattern = " port (?:access vlan|trunk pvid) (?P\d+)$NLP"; -$portHybridPattern = " port hybrid (?:pvid )?vlan (?:(?P\d+)(?: [0-9a-z ]*)? tagged|(?P\d+)(?: \d+)* untagged)$NLP"; -$voiceVlanPattern = " voice-vlan (?P\d+) enable$NLP"; +$interfaceAddressPattern = "interface [\w-]+(?P\d+)\/0\/(?P\d+)$NL"; +$pvidPattern = " port (?:access|trunk pvid) vlan (?P\d+)$NL"; +$portHybridPattern = " port hybrid (?:pvid )?vlan (?:(?P\d+)(?: [0-9a-z ]*)? tagged|(?P\d+)(?: \d+)* untagged)$NL"; +$voiceVlanPattern = " voice-vlan (?P\d+) enable$NL"; preg_match_all("/$startPattern$interfaceAddressPattern(?:$pvidPattern|$portHybridPattern|$voiceVlanPattern|$otherPattern)*$endPattern/", $conf, $interfaces, PREG_SET_ORDER); $stack = array(); @@ -94,7 +94,7 @@ echo ("-->");*/ if (isset($vlan["pvid"]) and $vlan["pvid"] != 1) { $name = $vlan["name"] ?? ""; $description = $vlan["description"] ?? ""; - echo "{$vlan["pvid"]}$name$description"; + echo "{$vlan["pvid"]}$name$description"; } } ?> @@ -122,7 +122,7 @@ echo ("-->");*/