Snap for 8603585 from 0e0e43bb5cb6479983df328bc5911fd6a4b1ce51 to mainline-scheduling-release

Change-Id: Iaa063079607e22f640e2d9cce202be92d5b1157a
diff --git a/net/netlink_manager.cpp b/net/netlink_manager.cpp
index 22154a7..64db5d8 100644
--- a/net/netlink_manager.cpp
+++ b/net/netlink_manager.cpp
@@ -48,7 +48,7 @@
 // netlink.h suggests NLMSG_GOODSIZE to be at most 8192 bytes.
 constexpr int kReceiveBufferSize = 8 * 1024;
 constexpr uint32_t kBroadcastSequenceNumber = 0;
-constexpr int kMaximumNetlinkMessageWaitMilliSeconds = 300;
+constexpr int kMaximumNetlinkMessageWaitMilliSeconds = 1000;
 uint8_t ReceiveBuffer[kReceiveBufferSize];
 
 void AppendPacket(vector<unique_ptr<const NL80211Packet>>* vec,
@@ -99,7 +99,8 @@
 void NetlinkManager::ReceivePacketAndRunHandler(int fd) {
   ssize_t len = read(fd, ReceiveBuffer, kReceiveBufferSize);
   if (len == -1) {
-    LOG(ERROR) << "Failed to read packet from buffer";
+    LOG(ERROR) << "Failed to read packet from buffer on fd: " << fd;
+    perror(" netlink error ");
     return;
   }
   if (len == 0) {
@@ -307,7 +308,7 @@
                            time_remaining);
 
     if (poll_return == 0) {
-      LOG(ERROR) << "Failed to poll netlink fd: time out ";
+      LOG(ERROR) << "Failed to poll netlink fd:" << sync_netlink_fd_.get() << "time out ";
       message_handlers_.erase(sequence);
       return false;
     } else if (poll_return == -1) {
diff --git a/net/netlink_utils.cpp b/net/netlink_utils.cpp
index 73901ca..dc2e4be 100644
--- a/net/netlink_utils.cpp
+++ b/net/netlink_utils.cpp
@@ -135,8 +135,9 @@
       netlink_manager_->GetSequenceNumber(),
       getpid());
   get_wiphy.AddFlag(NLM_F_DUMP);
+  int ifindex;
   if (!iface_name.empty()) {
-    int ifindex = if_nametoindex(iface_name.c_str());
+    ifindex = if_nametoindex(iface_name.c_str());
     if (ifindex == 0) {
       PLOG(ERROR) << "Can't get " << iface_name << " index";
       return false;
@@ -145,7 +146,8 @@
   }
   vector<unique_ptr<const NL80211Packet>> response;
   if (!netlink_manager_->SendMessageAndGetResponses(get_wiphy, &response))  {
-    LOG(ERROR) << "NL80211_CMD_GET_WIPHY dump failed";
+    LOG(ERROR) << "NL80211_CMD_GET_WIPHY dump failed, ifindex: "
+               << ifindex << " and name: " << iface_name.c_str();
     return false;
   }
   if (response.empty()) {