DHCPClient: Tweaks to logging.

* "timeout" is in usecs, so / 1000 and say "msecs" not "secs"
 *  Debug-log messages that are not for us received while waiting for
    a message that is for us. Hopefully this will not flood the syslog
    (DHCP renegotiation is, after all, rare), and it might help diagnose
    some of the DHCP failures.
This commit is contained in:
Augustin Cavalier 2018-07-03 16:14:22 -04:00
parent a7abbdae77
commit 42080aceac
1 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006-2011, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2018, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -460,8 +460,8 @@ socket_timeout::Shift(int socket, bigtime_t stateMaxTime, const char* device)
timeout = std::max(remaining, bigtime_t(60));
}
syslog(LOG_DEBUG, "%s: Timeout shift: %lu secs (try %lu)\n",
device, timeout, tries);
syslog(LOG_DEBUG, "%s: Timeout shift: %lu msecs (try %lu)\n",
device, timeout / 1000, tries);
UpdateSocket(socket);
return true;
@ -746,6 +746,9 @@ DHCPClient::_StateTransition(int socket, dhcp_state& state)
|| memcmp(message->mac_address, discover.mac_address,
discover.hardware_address_length)) {
// this message is not for us
syslog(LOG_DEBUG, "%s: Ignoring %s not for us from %s\n",
Device(), dhcp_message::TypeToString(message->Type()),
_AddressToString(from.sin_addr.s_addr).String());
continue;
}