diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-06-17 17:33:49 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-06-17 17:33:49 +0200 |
commit | 01eac366f69ba58c090ddc2cb70aeb069adbdd5a (patch) | |
tree | df8d7403334d824e27cfe56dfe8711c99852802d /modules/luci-mod-network/htdocs/luci-static/resources | |
parent | e8a6f0bb7c7c24f31ddbc36f81fa97b3a2a53b2e (diff) |
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>
Diffstat (limited to 'modules/luci-mod-network/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js b/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js index 67fe4b9cef..bba0e80f87 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js @@ -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]; - - if (spec && spec.match(/t/)) - return spec.match(/\*/) ? ['t', '*'] : ['t']; - else if (spec) - return spec.match(/\*/) ? ['u', '*'] : ['u']; - else - return ['-']; + var ports = L.toArray(uci.get('network', section_id, 'ports')); + + 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) { |