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); |
Johnathan Mantey | 200678a | 2021-04-28 13:59:46 -0700 | [diff] [blame] | 20 | // Add the following line to your phosphor-network bbappend file |
| 21 | // to control IPV6_ACCEPT_RA |
| 22 | // EXTRA_OECONF_append = " --enable-ipv6-accept-ra=yes" |
| 23 | // If this switch is not present or set to 'no' |
| 24 | // ENABLE_IPV6_ACCEPT_RA will be undefined. |
| 25 | // The new value is only assigned on first boot, when the default |
| 26 | // file is not present, or after the default file has been |
| 27 | // manually removed. |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 28 | filestream << "[Match]\nName=" << interface << |
Oskar Senft | ad21fc2 | 2018-07-26 16:32:23 -0400 | [diff] [blame] | 29 | "\n[Network]\nDHCP=true\n" |
| 30 | #ifdef LINK_LOCAL_AUTOCONFIGURATION |
| 31 | "LinkLocalAddressing=yes\n" |
| 32 | #else |
| 33 | "LinkLocalAddressing=no\n" |
| 34 | #endif |
Johnathan Mantey | 200678a | 2021-04-28 13:59:46 -0700 | [diff] [blame] | 35 | #ifdef ENABLE_IPV6_ACCEPT_RA |
| 36 | "IPv6AcceptRA=true\n" |
| 37 | #else |
Ratan Gupta | e962941 | 2017-12-21 08:20:25 +0530 | [diff] [blame] | 38 | "IPv6AcceptRA=false\n" |
Johnathan Mantey | 200678a | 2021-04-28 13:59:46 -0700 | [diff] [blame] | 39 | |
| 40 | #endif |
sunharis | a91c654 | 2022-04-05 05:59:18 -0500 | [diff] [blame] | 41 | "[DHCP]\nClientIdentifier=mac\n" |
| 42 | "UseDNS=true\nUseDomains=true\n" |
| 43 | "UseNTP=true\nUseHostname=true\n" |
| 44 | "SendHostname=true\n"; |
| 45 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 46 | filestream.close(); |
Michael Tritz | 29f2fd6 | 2017-05-22 15:27:26 -0500 | [diff] [blame] | 47 | } |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 48 | } // namespace bmc |
Michael Tritz | 29f2fd6 | 2017-05-22 15:27:26 -0500 | [diff] [blame] | 49 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 50 | } // namespace network |
| 51 | } // namespace phosphor |