blob: d492bf32de8913dea5026bc753a1f272ffae61e6 [file] [log] [blame]
Oskar Senftad21fc22018-07-26 16:32:23 -04001#include "config.h"
Michael Tritz29f2fd62017-05-22 15:27:26 -05002#include "network_config.hpp"
3#include <fstream>
4#include <string>
5
6namespace phosphor
7{
8namespace network
9{
10
11namespace bmc
12{
13 void writeDHCPDefault(const std::string& filename,
14 const std::string& interface)
15 {
16 std::ofstream filestream;
17
18 filestream.open(filename);
19 filestream << "[Match]\nName=" << interface <<
Oskar Senftad21fc22018-07-26 16:32:23 -040020 "\n[Network]\nDHCP=true\n"
21#ifdef LINK_LOCAL_AUTOCONFIGURATION
22 "LinkLocalAddressing=yes\n"
23#else
24 "LinkLocalAddressing=no\n"
25#endif
Ratan Guptae9629412017-12-21 08:20:25 +053026 "IPv6AcceptRA=false\n"
Ratan Guptac35481d2017-08-18 06:12:26 +053027 "[DHCP]\nClientIdentifier=mac\n";
Michael Tritz29f2fd62017-05-22 15:27:26 -050028 filestream.close();
29 }
30}
31
32}//namespace network
33}//namespace phosphor