diff mbox

[ovs-dev] ovn: log dhcp responses at INFO for debugging

Message ID 1472689246-13644-1-git-send-email-ramu.ramamurthy@us.ibm.com
State Superseded
Headers show

Commit Message

Ramu Ramamurthy Sept. 1, 2016, 12:20 a.m. UTC
Since dhcp responses are important for debugging the vif lifecycle,
we want to log them at info level which is the default log level.
A logsearch (on macaddr) can quickly tell the dhcp status using 
such messages. There is no need to rate limit such logs
because, we expect dhcp messages to be at low rate normally.

Logs appear like this:

2016-09-01T00:08:16Z|00014|pinctrl|INFO|DHCPOFFER fa:16:3e:25:b0:78 10.0.0.5
2016-09-01T00:08:16Z|00015|pinctrl|INFO|DHCPACK fa:16:3e:25:b0:78 10.0.0.5

Signed-off-by: Ramu Ramamurthy <ramu.ramamurthy@us.ibm.com>
---
 ovn/controller/pinctrl.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Ben Pfaff Sept. 1, 2016, 4:34 a.m. UTC | #1
On Thu, Sep 01, 2016 at 12:20:46AM +0000, Ramu Ramamurthy wrote:
> Since dhcp responses are important for debugging the vif lifecycle,
> we want to log them at info level which is the default log level.
> A logsearch (on macaddr) can quickly tell the dhcp status using 
> such messages. There is no need to rate limit such logs
> because, we expect dhcp messages to be at low rate normally.

Any log message that can be generated by receiving a network packet
needs to be rate-limited.  If the messages are actually received at a
low rate, then there's no disadvantage.
diff mbox

Patch

diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index d65e213..ad42fe9 100644
--- a/ovn/controller/pinctrl.c
+++ b/ovn/controller/pinctrl.c
@@ -354,6 +354,12 @@  pinctrl_handle_put_dhcp_opts(
     pin->packet = dp_packet_data(&pkt_out);
     pin->packet_len = dp_packet_size(&pkt_out);
 
+    /* Log the response. */
+    const struct eth_header *l2 = dp_packet_l2(&pkt_out);
+    VLOG_INFO("DHCP%s "ETH_ADDR_FMT" "IP_FMT"",
+	      msg_type == DHCP_MSG_OFFER ? "OFFER" : "ACK",
+	      ETH_ADDR_ARGS(l2->eth_src), IP_ARGS(*offer_ip));
+
     success = 1;
 exit:
     if (!ofperr) {