system: Perform initial change callbacks from libnl later
libnl's managed cache can monitor changes in specified caches. However,
it doesn't fire any events in the first population of the cache. We
acknowledged that and fired the events manually in the Rtnetlink
constructor.
However, if the handler for the event calls some Rtnetlink methods back,
the instance is not yet fully constructed and segfaults happen.
Change-Id: I80e2536cfae1444b242900918ee6647f0489f6f1
diff --git a/src/system/Rtnetlink.h b/src/system/Rtnetlink.h
index df73680..1b409cb 100644
--- a/src/system/Rtnetlink.h
+++ b/src/system/Rtnetlink.h
@@ -39,12 +39,16 @@
std::vector<nlLink> getLinks();
std::vector<std::pair<nlNeigh, nlLink>> getNeighbours();
+ void invokeInitialCallbacks();
+
private:
void resyncCache(const nlCache& cache);
velia::Log m_log;
std::unique_ptr<nl_sock, std::function<void(nl_sock*)>> m_nlSocket;
nlCacheManager m_nlCacheManager; // for updates
+ nl_cache* m_nlManagedCacheLink;
+ nl_cache* m_nlManagedCacheAddr;
nlCache m_nlCacheLink; // for getLinks, getNeighbours
nlCache m_nlCacheNeighbour; // for getNeighbours
LinkCB m_cbLink;