blob: e83b16c50430289464073968020e20f85e2ee9e0 [file] [log] [blame]
Patrick Venture189d44e2018-07-09 12:30:59 -07001#include "config.h"
2
Gunnar Mills57d9c502018-09-14 14:42:34 -05003#include "network_config.hpp"
4
Michael Tritz29f2fd62017-05-22 15:27:26 -05005#include <fstream>
6#include <string>
7
8namespace phosphor
9{
10namespace network
11{
12
13namespace bmc
14{
Gunnar Mills57d9c502018-09-14 14:42:34 -050015void writeDHCPDefault(const std::string& filename, const std::string& interface)
16{
17 std::ofstream filestream;
Michael Tritz29f2fd62017-05-22 15:27:26 -050018
Gunnar Mills57d9c502018-09-14 14:42:34 -050019 filestream.open(filename);
20 filestream << "[Match]\nName=" << interface <<
Oskar Senftad21fc22018-07-26 16:32:23 -040021 "\n[Network]\nDHCP=true\n"
22#ifdef LINK_LOCAL_AUTOCONFIGURATION
23 "LinkLocalAddressing=yes\n"
24#else
25 "LinkLocalAddressing=no\n"
26#endif
Ratan Guptae9629412017-12-21 08:20:25 +053027 "IPv6AcceptRA=false\n"
Ratan Guptac35481d2017-08-18 06:12:26 +053028 "[DHCP]\nClientIdentifier=mac\n";
Gunnar Mills57d9c502018-09-14 14:42:34 -050029 filestream.close();
Michael Tritz29f2fd62017-05-22 15:27:26 -050030}
Gunnar Mills57d9c502018-09-14 14:42:34 -050031} // namespace bmc
Michael Tritz29f2fd62017-05-22 15:27:26 -050032
Gunnar Mills57d9c502018-09-14 14:42:34 -050033} // namespace network
34} // namespace phosphor