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