Improve DHCP tracing

This commit is contained in:
Baptiste Wicht 2018-03-20 11:21:21 +01:00
parent e8c3d5addc
commit b6794a15e9
2 changed files with 8 additions and 0 deletions

View File

@ -134,6 +134,8 @@ std::expected<network::dhcp::dhcp_configuration> network::dhcp::layer::request_i
} }
} }
logging::logf(logging::log_level::TRACE, "dhcp: Sent request\n");
// 2. Receive DHCP Offer // 2. Receive DHCP Offer
network::ip::address offer_address; network::ip::address offer_address;
@ -146,6 +148,8 @@ std::expected<network::dhcp::dhcp_configuration> network::dhcp::layer::request_i
{ {
while (true) { while (true) {
logging::logf(logging::log_level::TRACE, "dhcp: Wait for answer\n");
if (packets.empty()) { if (packets.empty()) {
listen_queue.wait(); listen_queue.wait();
} }
@ -372,5 +376,7 @@ std::expected<network::dhcp::dhcp_configuration> network::dhcp::layer::request_i
conf.gateway_address = gateway_address; conf.gateway_address = gateway_address;
} }
logging::logf(logging::log_level::TRACE, "dhcp: Finished discovery\n");
return {conf}; return {conf};
} }

View File

@ -206,6 +206,8 @@ void network_discovery() {
dns_address = network::ip::make_address(10, 0, 2, 2); dns_address = network::ip::make_address(10, 0, 2, 2);
} }
} else { } else {
logging::logf(logging::log_level::TRACE, "network: impossible to acquire address for interface %u\n", interface.id);
// Defaults for Qemu (better than nothing) // Defaults for Qemu (better than nothing)
interface.ip_address = network::ip::make_address(10, 0, 2, 15); interface.ip_address = network::ip::make_address(10, 0, 2, 15);
interface.gateway = network::ip::make_address(10, 0, 2, 2); interface.gateway = network::ip::make_address(10, 0, 2, 2);