summaryrefslogtreecommitdiffstats
path: root/network_manager_main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'network_manager_main.cpp')
-rw-r--r--network_manager_main.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/network_manager_main.cpp b/network_manager_main.cpp
index 0c95c8d..b08d5ac 100644
--- a/network_manager_main.cpp
+++ b/network_manager_main.cpp
@@ -2,6 +2,8 @@
#include "network_manager.hpp"
#include "rtnetlink_server.hpp"
#include "timer.hpp"
+#include "watch.hpp"
+#include "dns_updater.hpp"
#include <memory>
@@ -83,8 +85,6 @@ int main(int argc, char *argv[])
OBJ_NETWORK,
NETWORK_CONF_DIR);
- phosphor::network::rtnetlink::Server svr(eventPtr);
-
// create the network interface dbus objects and system config
phosphor::network::manager->createChildObjects();
@@ -99,6 +99,22 @@ int main(int argc, char *argv[])
// will create it.
phosphor::network::restartNetwork();
}
- return svr.run();
+
+ // RTNETLINK event handler
+ phosphor::network::rtnetlink::Server svr(eventPtr);
+
+ // DNS entry handler
+ phosphor::network::inotify::Watch watch(eventPtr, DNS_ENTRY_FILE,
+ std::bind(&phosphor::network::dns::updater::processDNSEntries,
+ std::placeholders::_1));
+
+ // At this point, we have registered for the notifications for future
+ // events. However, if the file is already populated before this, then
+ // they won't ever get notified and thus we need to read once before
+ // waiting on change events
+ phosphor::network::dns::updater::processDNSEntries(DNS_ENTRY_FILE);
+
+ // Run the server
+ sd_event_loop(eventPtr.get());
}
OpenPOWER on IntegriCloud