luci-mod-network: fix tagging/pvid state parsing in bridge-vlan ports
The previous code naively looked for a `t` in the entire port spec, wrongly matching untagged ports having a `t` in their name, such as `eth0`. Rework the logic to be more strict when parsing the port member specification to avoid this issue. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
e8a6f0bb7c
commit
01eac366f6
1 changed files with 13 additions and 8 deletions
|
@ -264,15 +264,20 @@ var cbiTagValue = form.Value.extend({
|
|||
},
|
||||
|
||||
cfgvalue: function(section_id) {
|
||||
var pname = this.port,
|
||||
spec = L.toArray(uci.get('network', section_id, 'ports')).filter(function(p) { return p.replace(/:[ut*]+$/, '') == pname })[0];
|
||||
var ports = L.toArray(uci.get('network', section_id, 'ports'));
|
||||
|
||||
if (spec && spec.match(/t/))
|
||||
return spec.match(/\*/) ? ['t', '*'] : ['t'];
|
||||
else if (spec)
|
||||
return spec.match(/\*/) ? ['u', '*'] : ['u'];
|
||||
else
|
||||
return ['-'];
|
||||
for (var i = 0; i < ports.length; i++) {
|
||||
var s = ports[i].split(/:/);
|
||||
|
||||
if (s[0] != this.port)
|
||||
continue;
|
||||
|
||||
var t = s[1].match(/t/) ? 't' : 'u';
|
||||
|
||||
return s[1].match(/\*/) ? [t, '*'] : [t];
|
||||
}
|
||||
|
||||
return ['-'];
|
||||
},
|
||||
|
||||
write: function(section_id, value) {
|
||||
|
|
Loading…
Reference in a new issue