Support overlapping TG prefixes with longest-prefix-match routing

isSharedTG now finds the longest matching remote prefix and verifies
no other prefix in the mesh is more specific. Each TrunkLink receives
the full set of all prefixes at startup via setAllPrefixes().
initTrunkLinks is split into two passes: collect all prefixes first,
then create links with full knowledge.
This commit is contained in:
Audric committed 2026-03-26 10:55:47 +01:00
1 parent dda6ac5531
commit 53a9a6fc75
4 files changed
+60 -6

No files matched your search

+5
View File
@@ -92,6 +92,10 @@ class TrunkLink : public sigc::trackable
bool initialize(void);
bool isSharedTG(uint32_t tg) const;
void setAllPrefixes(const std::vector<std::string>& all_prefixes)
{
m_all_prefixes = all_prefixes;
}
const std::string& section(void) const { return m_section; }
Json::Value statusJson(void) const;
@@ -128,6 +132,7 @@ class TrunkLink : public sigc::trackable
Async::Timer m_heartbeat_timer;
unsigned m_hb_tx_cnt;
unsigned m_hb_rx_cnt;
std::vector<std::string> m_all_prefixes; // all prefixes in the mesh
// TGs where we suppressed our local talker to defer to the peer
std::set<uint32_t> m_yielded_tgs;
// TGs currently held by this specific trunk peer (for scoped cleanup)