blob: c24a3e8660db5fe33dc6754117ba050b1e9e7bee [file] [log] [blame]
Ratan Gupta82549cc2017-04-21 08:45:23 +05301#include "config.h"
Ratan Gupta91a99cc2017-04-14 16:32:09 +05302#include "ethernet_interface.hpp"
Ratan Gupta2b106532017-07-25 16:05:02 +05303#include "ipaddress.hpp"
Ratan Gupta4f1c18b2017-05-25 12:59:35 +05304#include "network_manager.hpp"
Ratan Guptafc2c7242017-05-29 08:46:06 +05305#include "routing_table.hpp"
Ratan Gupta2b106532017-07-25 16:05:02 +05306#include "vlan_interface.hpp"
7#include "xyz/openbmc_project/Common/error.hpp"
Ratan Gupta91a99cc2017-04-14 16:32:09 +05308
Ratan Gupta2b106532017-07-25 16:05:02 +05309#include <phosphor-logging/elog-errors.hpp>
Ratan Gupta91a99cc2017-04-14 16:32:09 +053010#include <phosphor-logging/log.hpp>
11
Ratan Gupta82549cc2017-04-21 08:45:23 +053012#include <arpa/inet.h>
Ratan Gupta91a99cc2017-04-14 16:32:09 +053013#include <linux/ethtool.h>
Ratan Gupta91a99cc2017-04-14 16:32:09 +053014#include <linux/sockios.h>
Ratan Gupta2b106532017-07-25 16:05:02 +053015#include <net/if.h>
Ratan Gupta91a99cc2017-04-14 16:32:09 +053016#include <netinet/in.h>
17#include <sys/ioctl.h>
18#include <sys/socket.h>
19#include <unistd.h>
20
Ratan Gupta2b106532017-07-25 16:05:02 +053021
Ratan Gupta82549cc2017-04-21 08:45:23 +053022#include <algorithm>
23#include <experimental/filesystem>
Ratan Gupta2b106532017-07-25 16:05:02 +053024#include <fstream>
25#include <sstream>
26#include <string>
Ratan Gupta82549cc2017-04-21 08:45:23 +053027
Ratan Gupta91a99cc2017-04-14 16:32:09 +053028namespace phosphor
29{
30namespace network
31{
32
33using namespace phosphor::logging;
Ratan Gupta2b106532017-07-25 16:05:02 +053034using namespace sdbusplus::xyz::openbmc_project::Common::Error;
35
Ratan Guptada7d3af2017-08-13 17:49:56 +053036constexpr auto MAC_ADDRESS_FORMAT = "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx";
Ratan Gupta91a99cc2017-04-14 16:32:09 +053037constexpr size_t SIZE_MAC = 18;
38constexpr size_t SIZE_BUFF = 512;
39
40EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus,
41 const std::string& objPath,
Ratan Gupta4f1c18b2017-05-25 12:59:35 +053042 bool dhcpEnabled,
Ratan Gupta3d3e4fc2017-07-25 13:38:19 +053043 Manager& parent,
44 bool emitSignal) :
Ratan Gupta82549cc2017-04-21 08:45:23 +053045 Ifaces(bus, objPath.c_str(), true),
Ratan Gupta4f1c18b2017-05-25 12:59:35 +053046 bus(bus),
Ratan Gupta47722dc2017-05-26 18:32:23 +053047 manager(parent),
48 objPath(objPath)
Ratan Gupta91a99cc2017-04-14 16:32:09 +053049{
50 auto intfName = objPath.substr(objPath.rfind("/") + 1);
Ratan Gupta5978dd12017-07-25 13:47:13 +053051 std::replace(intfName.begin(), intfName.end(), '_', '.');
Ratan Gupta91a99cc2017-04-14 16:32:09 +053052 interfaceName(intfName);
Ratan Guptac35481d2017-08-18 06:12:26 +053053 EthernetInterfaceIntf::dHCPEnabled(dhcpEnabled);
Ratan Guptada7d3af2017-08-13 17:49:56 +053054 mACAddress(getMACAddress(intfName));
Ratan Gupta5978dd12017-07-25 13:47:13 +053055
Ratan Gupta29b0e432017-05-25 12:51:40 +053056 // Emit deferred signal.
Ratan Gupta3d3e4fc2017-07-25 13:38:19 +053057 if (emitSignal)
58 {
59 this->emit_object_added();
60 }
Ratan Gupta29b0e432017-05-25 12:51:40 +053061}
62
Ratan Gupta87c13982017-06-15 09:27:27 +053063void EthernetInterface::createIPAddressObjects()
Ratan Gupta29b0e432017-05-25 12:51:40 +053064{
Ratan Gupta82549cc2017-04-21 08:45:23 +053065 std::string gateway;
Ratan Gupta87c13982017-06-15 09:27:27 +053066 addrs.clear();
Ratan Gupta82549cc2017-04-21 08:45:23 +053067
Ratan Gupta87c13982017-06-15 09:27:27 +053068 auto addrs = getInterfaceAddrs()[interfaceName()];
Ratan Gupta5978dd12017-07-25 13:47:13 +053069
Ratan Gupta82549cc2017-04-21 08:45:23 +053070 IP::Protocol addressType = IP::Protocol::IPv4;
Ratan Gupta29b0e432017-05-25 12:51:40 +053071 IP::AddressOrigin origin = IP::AddressOrigin::Static;
Ratan Guptafc2c7242017-05-29 08:46:06 +053072 route::Table routingTable;
Ratan Gupta5978dd12017-07-25 13:47:13 +053073
Ratan Gupta6a387c12017-08-03 13:26:19 +053074 for (auto& addr : addrs)
Ratan Gupta82549cc2017-04-21 08:45:23 +053075 {
76 if (addr.addrType == AF_INET6)
77 {
78 addressType = IP::Protocol::IPv6;
79 }
Ratan Guptafc2c7242017-05-29 08:46:06 +053080 if (dHCPEnabled())
81 {
82 origin = IP::AddressOrigin::DHCP;
83 }
84 else if (isLinkLocal(addr.ipaddress))
85 {
86 origin = IP::AddressOrigin::LinkLocal;
87 }
88 gateway = routingTable.getGateway(addr.addrType, addr.ipaddress, addr.prefix);
Ratan Gupta82549cc2017-04-21 08:45:23 +053089
Ratan Gupta65e5abe2017-05-23 13:20:44 +053090 std::string ipAddressObjectPath = generateObjectPath(addressType,
91 addr.ipaddress,
92 addr.prefix,
93 gateway);
Ratan Guptafc2c7242017-05-29 08:46:06 +053094
Ratan Gupta82549cc2017-04-21 08:45:23 +053095 this->addrs.emplace(
Ratan Guptae578d562017-08-02 07:04:16 +053096 std::move(addr.ipaddress),
97 std::make_shared<phosphor::network::IPAddress>(
Ratan Gupta719f83a2017-06-02 11:54:53 +053098 bus,
99 ipAddressObjectPath.c_str(),
100 *this,
101 addressType,
Ratan Gupta82549cc2017-04-21 08:45:23 +0530102 addr.ipaddress,
Ratan Gupta29b0e432017-05-25 12:51:40 +0530103 origin,
Ratan Gupta719f83a2017-06-02 11:54:53 +0530104 addr.prefix,
Ratan Guptae578d562017-08-02 07:04:16 +0530105 gateway));
Ratan Gupta82549cc2017-04-21 08:45:23 +0530106 }
Ratan Guptafc2c7242017-05-29 08:46:06 +0530107
Ratan Gupta91a99cc2017-04-14 16:32:09 +0530108}
109
Ratan Gupta82549cc2017-04-21 08:45:23 +0530110void EthernetInterface::iP(IP::Protocol protType,
111 std::string ipaddress,
112 uint8_t prefixLength,
113 std::string gateway)
114{
Ratan Guptafc2c7242017-05-29 08:46:06 +0530115
116 if (dHCPEnabled())
117 {
Ratan Gupta82e1ef92017-06-15 08:39:15 +0530118 log<level::INFO>("DHCP enabled on the interface"),
119 entry("INTERFACE=%s",interfaceName());
Ratan Guptafc2c7242017-05-29 08:46:06 +0530120 return;
121 }
122
Ratan Gupta29b0e432017-05-25 12:51:40 +0530123 IP::AddressOrigin origin = IP::AddressOrigin::Static;
124
Ratan Gupta65e5abe2017-05-23 13:20:44 +0530125 std::string objectPath = generateObjectPath(protType,
126 ipaddress,
127 prefixLength,
128 gateway);
Ratan Gupta82549cc2017-04-21 08:45:23 +0530129 this->addrs.emplace(
Ratan Guptae578d562017-08-02 07:04:16 +0530130 std::move(ipaddress),
131 std::make_shared<phosphor::network::IPAddress>(
132 bus,
133 objectPath.c_str(),
134 *this,
135 protType,
136 ipaddress,
137 origin,
138 prefixLength,
139 gateway));
Ratan Gupta4f1c18b2017-05-25 12:59:35 +0530140
Ratan Gupta2b106532017-07-25 16:05:02 +0530141 writeConfigurationFile();
Ratan Gupta82549cc2017-04-21 08:45:23 +0530142}
143
144
Ratan Gupta91a99cc2017-04-14 16:32:09 +0530145/*
146Note: We don't have support for ethtool now
147will enable this code once we bring the ethtool
148in the image.
149TODO: https://github.com/openbmc/openbmc/issues/1484
150*/
Ratan Gupta82549cc2017-04-21 08:45:23 +0530151
Ratan Gupta91a99cc2017-04-14 16:32:09 +0530152InterfaceInfo EthernetInterface::getInterfaceInfo() const
153{
154 int sock{-1};
155 struct ifreq ifr{0};
156 struct ethtool_cmd edata{0};
157 LinkSpeed speed {0};
158 Autoneg autoneg {0};
159 DuplexMode duplex {0};
160 do
161 {
162 sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
163 if (sock < 0)
164 {
165 log<level::ERR>("socket creation failed:",
166 entry("ERROR=%s", strerror(errno)));
167 break;
168 }
169
170 strncpy(ifr.ifr_name, interfaceName().c_str(), sizeof(ifr.ifr_name));
171 ifr.ifr_data = reinterpret_cast<char*>(&edata);
172
173 edata.cmd = ETHTOOL_GSET;
174
175 if (ioctl(sock, SIOCETHTOOL, &ifr) < 0)
176 {
177 log<level::ERR>("ioctl failed for SIOCETHTOOL:",
178 entry("ERROR=%s", strerror(errno)));
179 break;
180
181 }
182 speed = edata.speed;
183 duplex = edata.duplex;
184 autoneg = edata.autoneg;
185 }
186 while (0);
187
188 if (sock)
189 {
190 close(sock);
191 }
192 return std::make_tuple(speed, duplex, autoneg);
193}
194
195/** @brief get the mac address of the interface.
196 * @return macaddress on success
197 */
198
Ratan Guptada7d3af2017-08-13 17:49:56 +0530199std::string EthernetInterface::getMACAddress(
200 const std::string& interfaceName) const
Ratan Gupta91a99cc2017-04-14 16:32:09 +0530201{
Ratan Guptada7d3af2017-08-13 17:49:56 +0530202 struct ifreq ifr{};
203 char macAddress[SIZE_MAC] {};
Ratan Gupta91a99cc2017-04-14 16:32:09 +0530204
205 int sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
206 if (sock < 0)
207 {
208 log<level::ERR>("socket creation failed:",
209 entry("ERROR=%s", strerror(errno)));
210 return macAddress;
211 }
212
Ratan Guptada7d3af2017-08-13 17:49:56 +0530213 strcpy(ifr.ifr_name, interfaceName.c_str());
214 if (ioctl(sock, SIOCGIFHWADDR, &ifr) != 0)
Ratan Gupta91a99cc2017-04-14 16:32:09 +0530215 {
Ratan Guptada7d3af2017-08-13 17:49:56 +0530216 log<level::ERR>("ioctl failed for SIOCGIFHWADDR:",
217 entry("ERROR=%s", strerror(errno)));
Ratan Gupta91a99cc2017-04-14 16:32:09 +0530218 return macAddress;
219 }
220
Ratan Guptada7d3af2017-08-13 17:49:56 +0530221 snprintf(macAddress, SIZE_MAC, MAC_ADDRESS_FORMAT,
222 ifr.ifr_hwaddr.sa_data[0], ifr.ifr_hwaddr.sa_data[1],
223 ifr.ifr_hwaddr.sa_data[2], ifr.ifr_hwaddr.sa_data[3],
224 ifr.ifr_hwaddr.sa_data[4], ifr.ifr_hwaddr.sa_data[5]);
Ratan Gupta91a99cc2017-04-14 16:32:09 +0530225
Ratan Gupta91a99cc2017-04-14 16:32:09 +0530226 return macAddress;
227}
Ratan Gupta2eff84f2017-04-20 19:19:15 +0530228
Ratan Gupta65e5abe2017-05-23 13:20:44 +0530229std::string EthernetInterface::generateId(const std::string& ipaddress,
230 uint8_t prefixLength,
231 const std::string& gateway)
Ratan Gupta82549cc2017-04-21 08:45:23 +0530232{
Ratan Gupta65e5abe2017-05-23 13:20:44 +0530233 std::stringstream hexId;
234 std::string hashString = ipaddress;
235 hashString += std::to_string(prefixLength);
236 hashString += gateway;
Ratan Gupta82549cc2017-04-21 08:45:23 +0530237
Ratan Gupta65e5abe2017-05-23 13:20:44 +0530238 // Only want 8 hex digits.
239 hexId << std::hex << ((std::hash<std::string> {}(
Ratan Guptafc2c7242017-05-29 08:46:06 +0530240 hashString)) & 0xFFFFFFFF);
Ratan Gupta65e5abe2017-05-23 13:20:44 +0530241 return hexId.str();
Ratan Gupta82549cc2017-04-21 08:45:23 +0530242}
243
Ratan Gupta2eff84f2017-04-20 19:19:15 +0530244void EthernetInterface::deleteObject(const std::string& ipaddress)
245{
Ratan Gupta29b0e432017-05-25 12:51:40 +0530246 auto it = addrs.find(ipaddress);
Ratan Guptafc2c7242017-05-29 08:46:06 +0530247 if (it == addrs.end())
Ratan Gupta29b0e432017-05-25 12:51:40 +0530248 {
Ratan Guptafc2c7242017-05-29 08:46:06 +0530249 log<level::ERR>("DeleteObject:Unable to find the object.");
250 return;
Ratan Gupta29b0e432017-05-25 12:51:40 +0530251 }
252 this->addrs.erase(it);
Ratan Gupta2b106532017-07-25 16:05:02 +0530253 writeConfigurationFile();
Ratan Gupta82549cc2017-04-21 08:45:23 +0530254}
255
Ratan Guptabc886292017-07-25 18:29:57 +0530256void EthernetInterface::deleteVLANObject(const std::string& interface)
257{
258 using namespace std::string_literals;
259
260 auto it = vlanInterfaces.find(interface);
261 if (it == vlanInterfaces.end())
262 {
263 log<level::ERR>("DeleteVLANObject:Unable to find the object",
264 entry("INTERFACE=%s",interface.c_str()));
265 return;
266 }
267
268 auto confDir = manager.getConfDir();
269 fs::path networkFile = confDir;
270 networkFile /= systemd::config::networkFilePrefix + interface +
271 systemd::config::networkFileSuffix;
272
273 fs::path deviceFile = confDir;
274 deviceFile /= interface + systemd::config::deviceFileSuffix;
275
276 // delete the vlan network file
277 if (fs::is_regular_file(networkFile))
278 {
279 fs::remove(networkFile);
280 }
281
282 // delete the vlan device file
283 if (fs::is_regular_file(deviceFile))
284 {
285 fs::remove(deviceFile);
286 }
287 // delete the interface
288 vlanInterfaces.erase(it);
289 // restart the systemd-networkd
290
291 restartSystemdUnit("systemd-networkd.service");
292
293 // TODO systemd doesn't delete the virtual network interface
294 // even after deleting all the related configuartion.
295 // https://github.com/systemd/systemd/issues/6600
296 try
297 {
298 deleteInterface(interface);
299 }
300 catch (InternalFailure& e)
301 {
302 commit<InternalFailure>();
303 }
304}
305
Ratan Gupta65e5abe2017-05-23 13:20:44 +0530306std::string EthernetInterface::generateObjectPath(IP::Protocol addressType,
307 const std::string& ipaddress,
308 uint8_t prefixLength,
309 const std::string& gateway) const
Ratan Gupta82549cc2017-04-21 08:45:23 +0530310{
Ratan Gupta82549cc2017-04-21 08:45:23 +0530311 std::string type = convertForMessage(addressType);
Ratan Gupta29b0e432017-05-25 12:51:40 +0530312 type = type.substr(type.rfind('.') + 1);
Ratan Gupta82549cc2017-04-21 08:45:23 +0530313 std::transform(type.begin(), type.end(), type.begin(), ::tolower);
314
315 std::experimental::filesystem::path objectPath;
Ratan Gupta47722dc2017-05-26 18:32:23 +0530316 objectPath /= objPath;
Ratan Gupta82549cc2017-04-21 08:45:23 +0530317 objectPath /= type;
Ratan Gupta29b0e432017-05-25 12:51:40 +0530318 objectPath /= generateId(ipaddress, prefixLength, gateway);
Ratan Gupta82549cc2017-04-21 08:45:23 +0530319 return objectPath.string();
Ratan Gupta2eff84f2017-04-20 19:19:15 +0530320}
321
Ratan Gupta87c13982017-06-15 09:27:27 +0530322bool EthernetInterface::dHCPEnabled(bool value)
323{
Ratan Gupta5978dd12017-07-25 13:47:13 +0530324 if (value == EthernetInterfaceIntf::dHCPEnabled())
325 {
326 return value;
327 }
328
Ratan Gupta87c13982017-06-15 09:27:27 +0530329 EthernetInterfaceIntf::dHCPEnabled(value);
Ratan Gupta4f67dac2017-08-28 22:18:21 +0530330 writeConfigurationFile();
331 createIPAddressObjects();
Ratan Gupta92bc2fe2017-07-26 22:40:21 +0530332
Ratan Gupta87c13982017-06-15 09:27:27 +0530333 return value;
334}
335
Ratan Gupta92bc2fe2017-07-26 22:40:21 +0530336void EthernetInterface::loadVLAN(VlanId id)
337{
338 std::string vlanInterfaceName = interfaceName() + "." +
339 std::to_string(id);
340 std::string path = objPath;
341 path += "_" + std::to_string(id);
342
Ratan Gupta6e8df632017-08-13 09:41:58 +0530343 auto dhcpEnabled = getDHCPValue(manager.getConfDir().string(),
344 vlanInterfaceName);
345
Ratan Gupta92bc2fe2017-07-26 22:40:21 +0530346 auto vlanIntf = std::make_unique<phosphor::network::VlanInterface>(
347 bus,
348 path.c_str(),
Ratan Gupta6e8df632017-08-13 09:41:58 +0530349 dhcpEnabled,
Ratan Gupta92bc2fe2017-07-26 22:40:21 +0530350 id,
351 *this,
352 manager);
353
354 // Fetch the ip address from the system
355 // and create the dbus object.
356 vlanIntf->createIPAddressObjects();
357
358 this->vlanInterfaces.emplace(std::move(vlanInterfaceName),
359 std::move(vlanIntf));
360}
361
Ratan Gupta5978dd12017-07-25 13:47:13 +0530362void EthernetInterface::createVLAN(VlanId id)
363{
364 std::string vlanInterfaceName = interfaceName() + "." +
365 std::to_string(id);
366 std::string path = objPath;
367 path += "_" + std::to_string(id);
368
369
370 auto vlanIntf = std::make_unique<phosphor::network::VlanInterface>(
371 bus,
372 path.c_str(),
373 EthernetInterfaceIntf::dHCPEnabled(),
374 id,
375 *this,
376 manager);
377
378 // write the device file for the vlan interface.
379 vlanIntf->writeDeviceFile();
380
Ratan Gupta6e8df632017-08-13 09:41:58 +0530381 this->vlanInterfaces.emplace(vlanInterfaceName,
Ratan Gupta5978dd12017-07-25 13:47:13 +0530382 std::move(vlanIntf));
383 // write the new vlan device entry to the configuration(network) file.
Ratan Gupta2b106532017-07-25 16:05:02 +0530384 writeConfigurationFile();
Ratan Gupta6e8df632017-08-13 09:41:58 +0530385
386 // Create the dbus object for the link local ipv6 address.
387 vlanInterfaces[vlanInterfaceName]->createIPAddressObjects();
388
Ratan Gupta5978dd12017-07-25 13:47:13 +0530389}
Ratan Gupta2b106532017-07-25 16:05:02 +0530390
391// Need to merge the below function with the code which writes the
392// config file during factory reset.
393// TODO openbmc/openbmc#1751
394
395void EthernetInterface::writeConfigurationFile()
396{
397 // write all the static ip address in the systemd-network conf file
398
399 using namespace std::string_literals;
400 using AddressOrigin =
401 sdbusplus::xyz::openbmc_project::Network::server::IP::AddressOrigin;
402 namespace fs = std::experimental::filesystem;
403 fs::path confPath = manager.getConfDir();
404
Ratan Guptabc886292017-07-25 18:29:57 +0530405 std::string fileName = systemd::config::networkFilePrefix + interfaceName() +
406 systemd::config::networkFileSuffix;
Ratan Gupta2b106532017-07-25 16:05:02 +0530407 confPath /= fileName;
408 std::fstream stream;
409
410 stream.open(confPath.c_str(), std::fstream::out);
411 if (!stream.is_open())
412 {
413 log<level::ERR>("Unable to open the file",
414 entry("FILE=%s", confPath.c_str()));
415 elog<InternalFailure>();
416 }
417
418 // Write the device
419 stream << "[" << "Match" << "]\n";
420 stream << "Name=" << interfaceName() << "\n";
421
422 auto addrs = getAddresses();
423
424 // write the network section
425 stream << "[" << "Network" << "]\n";
Ratan Gupta4f67dac2017-08-28 22:18:21 +0530426
427 // Add the VLAN entry
428 for (const auto& intf: vlanInterfaces)
429 {
430 stream << "VLAN=" << intf.second->EthernetInterface::interfaceName()
431 << "\n";
432 }
433
Ratan Gupta2b106532017-07-25 16:05:02 +0530434 // DHCP
435 if (dHCPEnabled() == true)
436 {
437 // write the dhcp section if interface is
438 // configured as dhcp.
439 writeDHCPSection(stream);
440 stream.close();
Ratan Gupta4f67dac2017-08-28 22:18:21 +0530441 restartSystemdUnit("systemd-networkd.service");
Ratan Gupta2b106532017-07-25 16:05:02 +0530442 return;
443 }
Ratan Gupta2b106532017-07-25 16:05:02 +0530444
445 // Static
446 for (const auto& addr : addrs)
447 {
448 if (addr.second->origin() == AddressOrigin::Static)
449 {
450 std::string address = addr.second->address() + "/" + std::to_string(
451 addr.second->prefixLength());
452
453 stream << "Address=" << address << "\n";
454 }
455 }
456
457 if (manager.getSystemConf())
458 {
459 stream << "Gateway=" << manager.getSystemConf()->defaultGateway()
460 << "\n";
461 }
462 // write the route section
463 stream << "[" << "Route" << "]\n";
464 for(const auto& addr : addrs)
465 {
466 if (addr.second->origin() == AddressOrigin::Static)
467 {
468 int addressFamily = addr.second->type() == IP::Protocol::IPv4 ? AF_INET : AF_INET6;
469 std::string destination = getNetworkID(
470 addressFamily,
471 addr.second->address(),
472 addr.second->prefixLength());
473
474 if (addr.second->gateway() != "0.0.0.0" &&
475 addr.second->gateway() != "" &&
476 destination != "0.0.0.0" &&
477 destination != "")
478 {
479 stream << "Gateway=" << addr.second->gateway() << "\n";
480 stream << "Destination=" << destination << "\n";
481 }
482
483 }
484 }
485
486 stream.close();
487 restartSystemdUnit("systemd-networkd.service");
488}
489
490void EthernetInterface::writeDHCPSection(std::fstream& stream)
491{
492 using namespace std::string_literals;
493 stream << "DHCP=true\n";
494 // write the dhcp section
495 stream << "[DHCP]\n";
496
497 // Hardcoding the client identifier to mac, to address below issue
498 // https://github.com/openbmc/openbmc/issues/1280
499 stream << "ClientIdentifier=mac\n";
500 if (manager.getDHCPConf())
501 {
502 auto value = manager.getDHCPConf()->dNSEnabled() ? "true"s : "false"s;
503 stream << "UseDNS="s + value + "\n";
504
505 value = manager.getDHCPConf()->nTPEnabled() ? "true"s : "false"s;
506 stream << "UseNTP="s + value + "\n";
507
508 value = manager.getDHCPConf()->hostNameEnabled() ? "true"s : "false"s;
509 stream << "UseHostname="s + value + "\n";
510 }
511}
512
Ratan Gupta91a99cc2017-04-14 16:32:09 +0530513}//namespace network
514}//namespace phosphor