summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rule-compiler/package.json2
-rw-r--r--rule-compiler/rule-compiler.js9
2 files changed, 4 insertions, 7 deletions
diff --git a/rule-compiler/package.json b/rule-compiler/package.json
index e12d3759..1def45a5 100644
--- a/rule-compiler/package.json
+++ b/rule-compiler/package.json
@@ -1,6 +1,6 @@
{
"name": "zerotier-rule-compiler",
- "version": "1.2.0-1",
+ "version": "1.2.2-1",
"description": "ZeroTier Rule Script Compiler",
"main": "cli.js",
"scripts": {
diff --git a/rule-compiler/rule-compiler.js b/rule-compiler/rule-compiler.js
index feb30f90..89936213 100644
--- a/rule-compiler/rule-compiler.js
+++ b/rule-compiler/rule-compiler.js
@@ -762,7 +762,7 @@ function compile(src,rules,caps,tags)
return [ tag[k][1],tag[k][2],'Duplicate tag default directive.' ];
if ((k + 1) >= tag.length)
return [ tag[k][1],tag[k][2],'Missing value for default.' ];
- dfl = tag[++k][0]||null;
+ dfl = tag[++k][0]||0;
} else if (tkeyword === 'flag') {
if ((k + 2) >= tag.length)
return [ tag[k][1],tag[k][2],'Missing tag flag name or bit index.' ];
@@ -806,7 +806,7 @@ function compile(src,rules,caps,tags)
if (id < 0)
return [ tag[0][1],tag[0][2],'Tag definition is missing a numeric ID.' ];
- if (dfl) {
+ if (dfl !== null) {
let dfl2 = enums[dfl];
if (typeof dfl2 === 'number') {
dfl = dfl2;
@@ -815,10 +815,7 @@ function compile(src,rules,caps,tags)
if (typeof dfl2 === 'number') {
dfl = dfl2;
} else {
- dfl = _parseNum(dfl)||0;
- if (dfl < 0)
- dfl = 0;
- else dfl &= 0xffffffff;
+ dfl = Math.abs(_parseNum(dfl)||0) & 0xffffffff;
}
}
}