Oskar Senft | ad21fc2 | 2018-07-26 16:32:23 -0400 | [diff] [blame^] | 1 | #include "config.h" |
Michael Tritz | 29f2fd6 | 2017-05-22 15:27:26 -0500 | [diff] [blame] | 2 | #include "network_config.hpp" |
| 3 | #include <fstream> |
| 4 | #include <string> |
| 5 | |
| 6 | namespace phosphor |
| 7 | { |
| 8 | namespace network |
| 9 | { |
| 10 | |
| 11 | namespace 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 Senft | ad21fc2 | 2018-07-26 16:32:23 -0400 | [diff] [blame^] | 20 | "\n[Network]\nDHCP=true\n" |
| 21 | #ifdef LINK_LOCAL_AUTOCONFIGURATION |
| 22 | "LinkLocalAddressing=yes\n" |
| 23 | #else |
| 24 | "LinkLocalAddressing=no\n" |
| 25 | #endif |
Ratan Gupta | e962941 | 2017-12-21 08:20:25 +0530 | [diff] [blame] | 26 | "IPv6AcceptRA=false\n" |
Ratan Gupta | c35481d | 2017-08-18 06:12:26 +0530 | [diff] [blame] | 27 | "[DHCP]\nClientIdentifier=mac\n"; |
Michael Tritz | 29f2fd6 | 2017-05-22 15:27:26 -0500 | [diff] [blame] | 28 | filestream.close(); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | }//namespace network |
| 33 | }//namespace phosphor |