Message ID | 4dc93c21c962fce0f9790615c2b184f427cbc613.1400823852.git.jithu@broadcom.com |
---|---|
State | Accepted |
Headers | show |
On Fri, May 23, 2014 at 11:21:07AM +0530, Jithu Jance wrote: > I got the below prints on a particluar Android platform. > > I/wpa_supplicant( 2637): nl80211: send_and_recv->nl_recvmsgs failed: 20 > I/wpa_supplicant( 2637): nl80211: send_and_recv->nl_recvmsgs failed: 20 > > In JellyBean libnl_2 code, I see that the nl_recvmsgs returns postive values > too. In some cases, nl_recvmgs return the output of nl_recv function. nl_recv > function can return Number of bytes read, 0 or a negative error code. > > Looks like this postive return value for nl_recvmsgs may be specific to Android. This sounds like an incorrect nl_recvmsgs() re-implementation.. It would probably make more sense to fix that in Android libnl clone rather than make wpa_supplicant assume something about the libnl API use that does not match documented main implementation. The changes here would seem safe in general, but the justification for wpa_supplicant to work around something like this in Android is somewhat weak. What I'm more worried about is in there being something else about nl_recvmsgs() behavior that could result in more significant issues than unexpected debug messages, though.
On Fri, May 23, 2014 at 11:21:07AM +0530, Jithu Jance wrote: > I got the below prints on a particluar Android platform. > > I/wpa_supplicant( 2637): nl80211: send_and_recv->nl_recvmsgs failed: 20 > I/wpa_supplicant( 2637): nl80211: send_and_recv->nl_recvmsgs failed: 20 > > In JellyBean libnl_2 code, I see that the nl_recvmsgs returns postive values > too. In some cases, nl_recvmgs return the output of nl_recv function. nl_recv > function can return Number of bytes read, 0 or a negative error code. > > Looks like this postive return value for nl_recvmsgs may be specific to Android. I applied this patch now since it can clean up debug results on Android and does not cause any real issues with the standard libnl implementation either.
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 709e13a..1ca1592 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -652,7 +652,7 @@ static int send_and_recv(struct nl80211_global *global, while (err > 0) { int res = nl_recvmsgs(nl_handle, cb); - if (res) { + if (res < 0) { wpa_printf(MSG_INFO, "nl80211: %s->nl_recvmsgs failed: %d", __func__, res); @@ -910,7 +910,7 @@ static void nl80211_recv_beacons(int sock, void *eloop_ctx, void *handle) wpa_printf(MSG_EXCESSIVE, "nl80211: Beacon event message available"); res = nl_recvmsgs(handle, w->nl_cb); - if (res) { + if (res < 0) { wpa_printf(MSG_INFO, "nl80211: %s->nl_recvmsgs failed: %d", __func__, res); } @@ -3276,7 +3276,7 @@ static void wpa_driver_nl80211_event_receive(int sock, void *eloop_ctx, wpa_printf(MSG_MSGDUMP, "nl80211: Event message available"); res = nl_recvmsgs(handle, cb); - if (res) { + if (res < 0) { wpa_printf(MSG_INFO, "nl80211: %s->nl_recvmsgs failed: %d", __func__, res); }