Michael Tritz | 29f2fd6 | 2017-05-22 15:27:26 -0500 | [diff] [blame] | 1 | #include "network_config.hpp" |
Patrick Venture | 189d44e | 2018-07-09 12:30:59 -0700 | [diff] [blame^] | 2 | |
| 3 | #include "config.h" |
| 4 | |
Michael Tritz | 29f2fd6 | 2017-05-22 15:27:26 -0500 | [diff] [blame] | 5 | #include <fstream> |
| 6 | #include <string> |
| 7 | |
| 8 | namespace phosphor |
| 9 | { |
| 10 | namespace network |
| 11 | { |
| 12 | |
| 13 | namespace bmc |
| 14 | { |
| 15 | void writeDHCPDefault(const std::string& filename, |
| 16 | const std::string& interface) |
| 17 | { |
| 18 | std::ofstream filestream; |
| 19 | |
| 20 | filestream.open(filename); |
| 21 | filestream << "[Match]\nName=" << interface << |
Oskar Senft | ad21fc2 | 2018-07-26 16:32:23 -0400 | [diff] [blame] | 22 | "\n[Network]\nDHCP=true\n" |
| 23 | #ifdef LINK_LOCAL_AUTOCONFIGURATION |
| 24 | "LinkLocalAddressing=yes\n" |
| 25 | #else |
| 26 | "LinkLocalAddressing=no\n" |
| 27 | #endif |
Ratan Gupta | e962941 | 2017-12-21 08:20:25 +0530 | [diff] [blame] | 28 | "IPv6AcceptRA=false\n" |
Ratan Gupta | c35481d | 2017-08-18 06:12:26 +0530 | [diff] [blame] | 29 | "[DHCP]\nClientIdentifier=mac\n"; |
Michael Tritz | 29f2fd6 | 2017-05-22 15:27:26 -0500 | [diff] [blame] | 30 | filestream.close(); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | }//namespace network |
| 35 | }//namespace phosphor |