summaryrefslogtreecommitdiff
path: root/node/NetworkConfig.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-04-22 15:40:53 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-04-22 15:40:53 -0700
commitd73607430131dd352cf9248f37e76c2618dd39e5 (patch)
tree0c8f53ef547bca1e90585e67cc4ac93eb9012146 /node/NetworkConfig.hpp
parent368efaa2ba68d87eaba3bce2cbc1714b8e04744c (diff)
downloadinfinitytier-d73607430131dd352cf9248f37e76c2618dd39e5.tar.gz
infinitytier-d73607430131dd352cf9248f37e76c2618dd39e5.zip
Refactor rules table in-memory structure in new NetworkConfig to permit far more rules with better space efficiency.
Diffstat (limited to 'node/NetworkConfig.hpp')
-rw-r--r--node/NetworkConfig.hpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/node/NetworkConfig.hpp b/node/NetworkConfig.hpp
index c3cc9cd4..0ed7b6a2 100644
--- a/node/NetworkConfig.hpp
+++ b/node/NetworkConfig.hpp
@@ -133,8 +133,12 @@ public:
inline bool permitsEtherType(unsigned int etherType) const
{
for(unsigned int i=0;i<_ruleCount;++i) {
- if ((_rules[i].etherType < 0)||((unsigned int)_rules[i].etherType == etherType))
- return (_rules[i].action == ZT_NETWORK_RULE_ACTION_ACCEPT);
+ if ((ZT_VirtualNetworkRuleMatches)_rules[i].matches == ZT_NETWORK_RULE_MATCHES_ETHERTYPE) {
+ if (_rules[i].datum.etherType == etherType)
+ return ((ZT_VirtualNetworkRuleAction)_rules[i].action == ZT_NETWORK_RULE_ACTION_ACCEPT);
+ } else if ((ZT_VirtualNetworkRuleMatches)_rules[i].matches == ZT_NETWORK_RULE_MATCHES_ALL) {
+ return ((ZT_VirtualNetworkRuleAction)_rules[i].action == ZT_NETWORK_RULE_ACTION_ACCEPT);
+ }
}
return false;
}