fix MAC address rule parsing as even/uneven switches at every colon

This commit is contained in:
Karsten Elfenbein 2018-05-26 21:00:09 +02:00
parent c0efba79c7
commit dfe426e4e0

View File

@ -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;