dhcpcd: log basic send and receive at INFO level
When we send or receive a DHCP packet, log the type and the
transaction ID at level LOG_INFO. This will help to diagnose
problems in the field, and in the lab.
BUG=chromium:291284
TEST=network_DhcpNegotiationSuccess, manual
Manual test:
- ran the autotest
- ran egrep 'dhcpcd.+(sending|received) DHCP' /var/log/net.log on the DUT
- saw matching lines
Change-Id: Idce7d1156164384ed6aa87fc899708e81bf8b498
Reviewed-on: https://chromium-review.googlesource.com/186593
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
diff --git a/dhcpcd.c b/dhcpcd.c
index dcf642f..272d784 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -281,7 +281,7 @@
struct timeval tv;
if (!callback)
- syslog(LOG_DEBUG, "%s: sending %s with xid 0x%x",
+ syslog(LOG_INFO, "%s: sending %s with xid 0x%x",
iface->name, get_dhcp_op(type), state->xid);
else {
if (state->interval == 0)
@@ -293,7 +293,7 @@
}
tv.tv_sec = state->interval + DHCP_RAND_MIN;
tv.tv_usec = arc4random() % (DHCP_RAND_MAX_U - DHCP_RAND_MIN_U);
- syslog(LOG_DEBUG,
+ syslog(LOG_INFO,
"%s: sending %s (xid 0x%x), next in %0.2f seconds",
iface->name, get_dhcp_op(type), state->xid,
timeval_to_double(&tv));
@@ -487,6 +487,9 @@
if (get_option_uint8(&type, dhcp, DHO_MESSAGETYPE) == -1)
type = 0;
+ syslog(LOG_INFO, "%s: received %s with xid 0x%x",
+ iface->name, get_dhcp_op(type), dhcp->xid);
+
if (type == DHCP_NAK) {
/* For NAK, only check if we require the ServerID */
if (has_option_mask(ifo->requiremask, DHO_SERVERID) &&