summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-10-05 12:54:46 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-10-05 12:54:46 -0700
commitadeb7e7da0e5d1e267c272a4f1d1c9b731e291d9 (patch)
treeaa2612cfc32b82a43fdb1c977396fd61ffcc5e94 /node
parentf1c8706485bf0c6b63b677c79109e93bb769824a (diff)
downloadinfinitytier-adeb7e7da0e5d1e267c272a4f1d1c9b731e291d9.tar.gz
infinitytier-adeb7e7da0e5d1e267c272a4f1d1c9b731e291d9.zip
Make capability flags match more user-friendly and appropriate since "match any flag" is generally what we want.
Diffstat (limited to 'node')
-rw-r--r--node/Capability.hpp8
-rw-r--r--node/Network.cpp2
2 files changed, 4 insertions, 6 deletions
diff --git a/node/Capability.hpp b/node/Capability.hpp
index e808ad40..f757639d 100644
--- a/node/Capability.hpp
+++ b/node/Capability.hpp
@@ -240,9 +240,8 @@ public:
b.append((uint16_t)rules[i].v.port[1]);
break;
case ZT_NETWORK_RULE_MATCH_CHARACTERISTICS:
- b.append((uint8_t)16);
- b.append((uint64_t)rules[i].v.characteristics[0]);
- b.append((uint64_t)rules[i].v.characteristics[1]);
+ b.append((uint8_t)8);
+ b.append((uint64_t)rules[i].v.characteristics);
break;
case ZT_NETWORK_RULE_MATCH_FRAME_SIZE_RANGE:
b.append((uint8_t)4);
@@ -328,8 +327,7 @@ public:
rules[ruleCount].v.port[1] = b.template at<uint16_t>(p + 2);
break;
case ZT_NETWORK_RULE_MATCH_CHARACTERISTICS:
- rules[ruleCount].v.characteristics[0] = b.template at<uint64_t>(p);
- rules[ruleCount].v.characteristics[1] = b.template at<uint64_t>(p + 8);
+ rules[ruleCount].v.characteristics = b.template at<uint64_t>(p);
break;
case ZT_NETWORK_RULE_MATCH_FRAME_SIZE_RANGE:
rules[ruleCount].v.frameSize[0] = b.template at<uint16_t>(p);
diff --git a/node/Network.cpp b/node/Network.cpp
index fe899dcc..8b9f6e3d 100644
--- a/node/Network.cpp
+++ b/node/Network.cpp
@@ -497,7 +497,7 @@ static _doZtFilterResult _doZtFilter(
}
}
}
- thisRuleMatches = (uint8_t)((cf & rules[rn].v.characteristics[0]) == rules[rn].v.characteristics[1]);
+ thisRuleMatches = (uint8_t)((cf | rules[rn].v.characteristics) != 0);
FILTER_TRACE("%u %s %c (%.16llx & %.16llx)==%.16llx -> %u",rn,_rtn(rt),(((rules[rn].t & 0x80) != 0) ? '!' : '='),cf,rules[rn].v.characteristics[0],rules[rn].v.characteristics[1],(unsigned int)thisRuleMatches);
} break;
case ZT_NETWORK_RULE_MATCH_FRAME_SIZE_RANGE: