Create the default network file during startup of network manager
if network file is not on the system then create the default network
file with dhcp enabled.
Resolves openbmc/openbmc#2332
Change-Id: I9e523c76f684dcb2951a0a730f94b11f326b5489
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/network_manager_main.cpp b/network_manager_main.cpp
index 7fa3b05..969b705 100644
--- a/network_manager_main.cpp
+++ b/network_manager_main.cpp
@@ -63,8 +63,20 @@
phosphor::network::rtnetlink::Server svr(eventPtr);
+ // create the network interface dbus objects and system config
phosphor::network::manager->createChildObjects();
+ // create the default network files if the network file
+ // is not there for any interface.
+ // Parameter false means don't create the network
+ // files forcefully.
+ if (phosphor::network::manager->createDefaultNetworkFiles(false))
+ {
+ // if files created restart the network.
+ // don't need to call the create child objects as eventhandler
+ // will create it.
+ phosphor::network::manager->restartNetwork();
+ }
return svr.run();
}