feat(reflector): explicit routable prefixes join m_all_prefixes for transit (excludes *)

This commit is contained in:
Audric committed 2026-06-15 17:07:00 +02:00
1 parent 1e1d477957
commit ce08a9886c
2 files changed
+25

No files matched your search

+21
View File
@@ -2368,6 +2368,23 @@ void Reflector::initTrunkLinks(void)
if (!token.empty()) all_prefixes.push_back(token);
}
}
// Explicit routable prefixes are reachable via this peer and must
// participate in mesh-wide longest-prefix-match + hasPrefixRoute so
// transit fanout fires for them. "*" is intentionally NOT added — a
// wildcard route never transits (loop guard, spec section 5).
std::string routable_str;
m_cfg->getValue(section, "ROUTABLE_PREFIXES", routable_str);
{
std::istringstream rs(routable_str);
std::string token;
while (std::getline(rs, token, ','))
{
token.erase(0, token.find_first_not_of(" \t"));
token.erase(token.find_last_not_of(" \t") + 1);
if (!token.empty() && token != "*") all_prefixes.push_back(token);
}
}
}
// Cache the mesh-wide prefix set for owner-relay decisions.
@@ -3099,6 +3116,10 @@ std::vector<std::string> Reflector::collectAllTrunkPrefixes(void) const
std::vector<std::string> all;
for (const auto* link : m_trunk_links) {
for (const std::string& p : link->remotePrefix()) all.push_back(p);
// Explicit routable prefixes (never "*" — m_routable_prefixes excludes it)
// must also join the mesh-wide set so hasPrefixRoute / shouldRelayInbound
// fire correctly for transit on reload.
for (const std::string& p : link->routablePrefixes()) all.push_back(p);
}
return all;
}
+4
View File
@@ -121,6 +121,10 @@ class TrunkLink : public sigc::trackable
{
return m_remote_prefix;
}
const std::vector<std::string>& routablePrefixes(void) const
{
return m_routable_prefixes;
}
// Read-only view of TGs the peer is interested in (TalkerStart activity
// or MsgPeerTgInterest advertisement). Used by Reflector to aggregate
// interest for re-advertisement toward the prefix owner.