From 6ff93279f8fff9a12f5005e7a7b1c9c25e5b7a39 Mon Sep 17 00:00:00 2001 From: travisladuke Date: Thu, 21 Dec 2023 15:55:50 -0800 Subject: [PATCH] handle "not" --- node/Network.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/node/Network.cpp b/node/Network.cpp index d80170d79..0f7a7cd96 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -117,7 +117,7 @@ static _doZtFilterResult _doZtFilter( // First check if this is an ACTION if ((unsigned int)rt <= (unsigned int)ZT_NETWORK_RULE_ACTION__MAX_ID) { if (thisSetMatches) { - fprintf(stderr, "%02u %02u thisSetMatches. inTagRule: %u\n\n", rn, rt, inTagRule); + fprintf(stderr, "%02u %02d thisSetMatches. inTagRule: %u\n\n", rn, rt, inTagRule); switch(rt) { case ZT_NETWORK_RULE_ACTION_PRIORITY: qosBucket = (rules[rn].v.qosBucket >= 0 || rules[rn].v.qosBucket <= 8) ? rules[rn].v.qosBucket : 4; // 4 = default bucket (no priority) @@ -467,21 +467,22 @@ static _doZtFilterResult _doZtFilter( } } else { if ((inbound)&&(!superAccept)) { - thisRuleMatches = 0; + thisRuleMatches = (rules[rn].t >> 7) ^ 0; + fprintf(stderr, "%02u %02u inbound, no remote tag %u %u. match %u\n", rn, rt, localTag->id(), localTag->value(), thisRuleMatches); } else { // Outbound side is not strict since if we have to match both tags and // we are sending a first packet to a recipient, we probably do not know // about their tags yet. They will filter on inbound and we will filter // once we get their tag. If we are a tee/redirect target we are also // not strict since we likely do not have these tags. - fprintf(stderr, "%02u %02u outbound, no remote tag %u %u\n", rn, rt, localTag->id(), localTag->value()); inTagRule = 1; - thisRuleMatches = 1; + thisRuleMatches = (rules[rn].t >> 7) ^ 1; + fprintf(stderr, "%02u %02u outbound, no remote tag %u %u. match %u\n", rn, rt, localTag->id(), localTag->value(), thisRuleMatches); } } } else { fprintf(stderr, "%02u %u02 no local tag?\n", rn, rt); - thisRuleMatches = 0; + thisRuleMatches = (rules[rn].t >> 7) ^ 0; } } break; case ZT_NETWORK_RULE_MATCH_TAG_SENDER: