diff options
author | Adam Ierymenko <adam.ierymenko@zerotier.com> | 2018-06-12 09:37:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-12 09:37:28 -0700 |
commit | d55c732e1915affd2f40321261bb8178fa28f95a (patch) | |
tree | 08efd83ac6a1e671ba4af12d90464e7e16b89d01 | |
parent | d223427e22de474c618e5d8f609d90255cb0e80c (diff) | |
parent | dfe426e4e03b15fb2d7211d8e5837bb0e669f5fb (diff) | |
download | infinitytier-d55c732e1915affd2f40321261bb8178fa28f95a.tar.gz infinitytier-d55c732e1915affd2f40321261bb8178fa28f95a.zip |
Merge pull request #764 from Elfe/master
fix MAC address rule parsing as even/uneven switches at every colon
-rw-r--r-- | rule-compiler/rule-compiler.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/rule-compiler/rule-compiler.js b/rule-compiler/rule-compiler.js index bd84824e..9cc4f76a 100644 --- a/rule-compiler/rule-compiler.js +++ b/rule-compiler/rule-compiler.js @@ -226,12 +226,16 @@ function _cleanMac(m) { m = m.toLowerCase(); var m2 = ''; + let charcount = 0; for(let i=0;((i<m.length)&&(m2.length<17));++i) { let c = m.charAt(i); if ("0123456789abcdef".indexOf(c) >= 0) { m2 += c; - if ((m2.length > 0)&&(m2.length !== 17)&&((m2.length & 1) === 0)) + charcount++; + if ((m2.length > 0)&&(m2.length !== 17)&&(charcount >= 2) ) { m2 += ':'; + charcount=0; + } } } return m2; |