mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-12 20:28:27 +00:00
Refactor rules table in-memory structure in new NetworkConfig to permit far more rules with better space efficiency.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user