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>
(cherry picked from commit 01eac366f6
)
This commit is contained in:
parent
ccf7c1e036
commit
4c05263573
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