summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLes Lee <lesl@google.com>2022-05-10 08:00:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2022-05-10 08:00:35 +0000
commit0ad7df11176eacd42be6540fedd62954f896da48 (patch)
tree734c56465f8cbbb712358d13f8e4b8d2055ca3ee
parentfa78442ca958269054291c789b3270afd4be73fc (diff)
parent0b5049a20105239044bc88d8540176d874539f73 (diff)
downloadwificond-0ad7df11176eacd42be6540fedd62954f896da48.tar.gz
Merge "wifi: Extend netlink message timout value" into tm-devandroid13-dev
-rw-r--r--net/netlink_manager.cpp7
-rw-r--r--net/netlink_utils.cpp6
2 files changed, 8 insertions, 5 deletions
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 @@ namespace {
// 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 @@ uint32_t NetlinkManager::GetSequenceNumber() {
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 @@ bool NetlinkManager::SendMessageAndGetResponses(
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 @@ bool NetlinkUtils::GetWiphyIndex(uint32_t* out_wiphy_index,
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 @@ bool NetlinkUtils::GetWiphyIndex(uint32_t* out_wiphy_index,
}
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()) {