mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
Merge pull request #633 from bloqaudio/fix/save-merge-lldp
web: keep LLDP lines from piling up in the saved configuration
This commit is contained in:
1 file changed
+4
-3
+4
-3
@@ -2243,14 +2243,14 @@ var CONF_OVERWRITE=[
|
|||||||
/^ntp\s+server\b/,/^ntp\s+interval\b/,/^ntp\s+timezone\b/,/^ntp\s+dst\b/,
|
/^ntp\s+server\b/,/^ntp\s+interval\b/,/^ntp\s+timezone\b/,/^ntp\s+dst\b/,
|
||||||
/^vlan\s+\d{1,4}\s+mgmt$/,/^vlan\s+\d{1,4}(?!\s+mgmt\b)/,
|
/^vlan\s+\d{1,4}\s+mgmt$/,/^vlan\s+\d{1,4}(?!\s+mgmt\b)/,
|
||||||
/^pvid\s+\d{1,2}\b/,
|
/^pvid\s+\d{1,2}\b/,
|
||||||
/^port\s+\d{1,2}(?!\s+name\b)/,/^port\s+\d{1,2}\s+name\b/,
|
/^port\s+\d{1,2}(?!\s+(name|lldp)\b)/,/^port\s+\d{1,2}\s+name\b/,
|
||||||
/^mirror\b/,
|
/^mirror\b/,
|
||||||
/^lag\s+\d\b/,/^laghash\s+\d\b/,/^isolate\s+\d{1,2}\b/,
|
/^lag\s+\d\b/,/^laghash\s+\d\b/,/^isolate\s+\d{1,2}\b/,
|
||||||
/^stp\s+(prio|hello|maxage|fwd|txhold|version)\b/,
|
/^stp\s+(prio|hello|maxage|fwd|txhold|version)\b/,
|
||||||
/^stp\s+(port\s+\d{1,2}|lag\s+[1-4])\s+(edge|cost|prio|guard|filter|p2p)\b/,
|
/^stp\s+(port\s+\d{1,2}|lag\s+[1-4])\s+(edge|cost|prio|guard|filter|p2p)\b/,
|
||||||
/^igmp\b/,/^mtu\s+\d{1,2}\b/,/^storm\s+\d{1,2}\s+(bcast|mcast|ucast|umcast)\b/,
|
/^igmp\b/,/^mtu\s+\d{1,2}\b/,/^storm\s+\d{1,2}\s+(bcast|mcast|ucast|umcast)\b/,
|
||||||
];
|
];
|
||||||
var CONF_TOGGLE=[/^(syslog)\s+(on|off)$/,/^(ntp)\s+(on|off)$/,/^(stp)\s+(on|off)$/,/^(stp\s+(port\s+\d{1,2}|lag\s+[1-4]))\s+(on|off)$/];
|
var CONF_TOGGLE=[/^(syslog)\s+(on|off)$/,/^(ntp)\s+(on|off)$/,/^(stp)\s+(on|off)$/,/^(lldp)\s+(on|off)$/,/^(stp\s+(port\s+\d{1,2}|lag\s+[1-4]))\s+(on|off)$/];
|
||||||
function mergeConf(base,texts){
|
function mergeConf(base,texts){
|
||||||
var conf=base.slice();
|
var conf=base.slice();
|
||||||
function drop(rx){conf=conf.filter(function(c){return!rx.test(c)})}
|
function drop(rx){conf=conf.filter(function(c){return!rx.test(c)})}
|
||||||
@@ -2268,6 +2268,7 @@ function mergeConf(base,texts){
|
|||||||
}
|
}
|
||||||
if((m=line.match(/^lag (\d) lacp off$/))){drop(new RegExp("^lag "+m[1]+" lacp( |$)"));return;}
|
if((m=line.match(/^lag (\d) lacp off$/))){drop(new RegExp("^lag "+m[1]+" lacp( |$)"));return;}
|
||||||
if(line==="mirror off"){drop(/^mirror /);return;}
|
if(line==="mirror off"){drop(/^mirror /);return;}
|
||||||
|
if((m=line.match(/^(port \d{1,2} lldp) (permit|block)$/))){drop(new RegExp("^"+m[1]+" (permit|block)$"));conf.push(line);return;}
|
||||||
if(!isConfCmd(line))return;
|
if(!isConfCmd(line))return;
|
||||||
if((m=line.match(/^ingress (.+)$/))){
|
if((m=line.match(/^ingress (.+)$/))){
|
||||||
if(/^[tua]$/.test(m[1])){drop(/^ingress /);conf.push(line);return;}
|
if(/^[tua]$/.test(m[1])){drop(/^ingress /);conf.push(line);return;}
|
||||||
@@ -2300,7 +2301,7 @@ function mergeConf(base,texts){
|
|||||||
var key=line.match(rx)[0];
|
var key=line.match(rx)[0];
|
||||||
conf=conf.filter(function(item){
|
conf=conf.filter(function(item){
|
||||||
return!(item===key||(item.indexOf(key+" ")===0
|
return!(item===key||(item.indexOf(key+" ")===0
|
||||||
&&!/\smgmt$/.test(item)&&item.indexOf(key+" name ")!==0));
|
&&!/\smgmt$/.test(item)&&item.indexOf(key+" name ")!==0&&item.indexOf(key+" lldp ")!==0));
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user