Added some more logging to the ctl around deauths

This commit is contained in:
Grant Limberg
2025-10-27 09:44:36 +01:00
parent 76ba89060b
commit c21ff23477
2 changed files with 12 additions and 1 deletions

View File

@@ -511,9 +511,14 @@ void DB::_networkChanged(nlohmann::json& old, nlohmann::json& networkConfig, boo
this->get(networkId, network, members);
for (auto i = members.begin(); i != members.end(); ++i) {
const std::string nodeID = (*i)["id"];
fprintf(
stderr, "Deauthorizing member %s on network %s due to network deletion\n", nodeID.c_str(),
ids.c_str());
const uint64_t memberId = Utils::hexStrToU64(nodeID.c_str());
std::unique_lock<std::shared_mutex> ll(_changeListeners_l);
for (auto j = _changeListeners.begin(); j != _changeListeners.end(); ++j) {
fprintf(
stderr, "Notifying listener of deauthorization of %s on %s\n", nodeID.c_str(), ids.c_str());
(*j)->onNetworkMemberDeauthorize(this, networkId, memberId);
}
}

View File

@@ -1655,6 +1655,7 @@ void EmbeddedNetworkController::onNetworkMemberDeauthorize(const void* db, uint6
auto span = tracer->StartSpan("embedded_controller::onNetworkMemberDeauthorize");
auto scope = tracer->WithActiveSpan(span);
fprintf(stderr, "Member Deauthorized: nwid=%.16llx, nodeid=%.10llx\n", networkId, memberId);
const int64_t now = OSUtils::now();
Revocation rev(
(uint32_t)_node->prng(), networkId, 0, now, ZT_REVOCATION_FLAG_FAST_PROPAGATE, Address(memberId),
@@ -1663,8 +1664,13 @@ void EmbeddedNetworkController::onNetworkMemberDeauthorize(const void* db, uint6
{
std::lock_guard<std::mutex> l(_memberStatus_l);
for (auto i = _memberStatus.begin(); i != _memberStatus.end(); ++i) {
if ((i->first.networkId == networkId) && (i->second.online(now)))
if ((i->first.networkId == networkId) && (i->second.online(now))) {
_node->ncSendRevocation(Address(i->first.nodeId), rev);
fprintf(stderr, " Sent revocation to %.10llx\n", i->first.nodeId);
}
else {
fprintf(stderr, " Not sending revocation to %.10llx\n", i->first.nodeId);
}
}
}
}