shill: rtnl: Add payload dumps

Include payloads when verbosity is turned up.

BUG=None
TEST=Run and monitor logs

Change-Id: Id731c1a2ef714399f4559993bfaed3e66723ea01
Reviewed-on: https://gerrit.chromium.org/gerrit/21418
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/rtnl_handler.cc b/rtnl_handler.cc
index 032b0c8..d166b07 100644
--- a/rtnl_handler.cc
+++ b/rtnl_handler.cc
@@ -231,10 +231,15 @@
     SLOG(RTNL, 3) << __func__ << ": received payload (" << end - buf << ")";
 
     RTNLMessage msg;
-    if (!msg.Decode(ByteString(reinterpret_cast<unsigned char *>(hdr),
-                               hdr->nlmsg_len))) {
+    ByteString payload(reinterpret_cast<unsigned char *>(hdr), hdr->nlmsg_len);
+    SLOG(RTNL, 5) << "RTNL received payload length " << payload.GetLength()
+                  << ": \"" << payload.HexEncode() << "\"";
+    if (!msg.Decode(payload)) {
       SLOG(RTNL, 3) << __func__ << ": rtnl packet type "
-                    << hdr->nlmsg_type << " length " << hdr->nlmsg_len;
+                    << hdr->nlmsg_type
+                    << " length " << hdr->nlmsg_len
+                    << " sequence " << hdr->nlmsg_seq;
+
       switch (hdr->nlmsg_type) {
         case NLMSG_NOOP:
         case NLMSG_OVERRUN:
@@ -367,13 +372,19 @@
 }
 
 bool RTNLHandler::SendMessage(RTNLMessage *message) {
-  message->set_seq(request_sequence_++);
+  message->set_seq(request_sequence_);
   ByteString msgdata = message->Encode();
 
   if (msgdata.GetLength() == 0) {
     return false;
   }
 
+  SLOG(RTNL, 5) << "RTNL sending payload with request sequence "
+                << request_sequence_ << ", length " << msgdata.GetLength()
+                << ": \"" << msgdata.HexEncode() << "\"";
+
+  request_sequence_++;
+
   if (sockets_->Send(rtnl_socket_,
                      msgdata.GetConstData(),
                      msgdata.GetLength(),