]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Add debug prints on nl_recvmsgs() failure
authorJouni Malinen <j@w1.fi>
Sat, 26 Oct 2013 13:13:34 +0000 (16:13 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 26 Oct 2013 14:48:28 +0000 (17:48 +0300)
These libnl calls could potentially fail and it is useful to know if
that has happened.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/drivers/driver_nl80211.c

index 608e96517f1446718b6bf1dc332d0168dc4b8ce2..ced5fd480c6fb0e03abf78d3e734573b6fb64a95 100644 (file)
@@ -593,8 +593,14 @@ static int send_and_recv(struct nl80211_global *global,
                nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM,
                          valid_handler, valid_data);
 
-       while (err > 0)
-               nl_recvmsgs(nl_handle, cb);
+       while (err > 0) {
+               int res = nl_recvmsgs(nl_handle, cb);
+               if (res) {
+                       wpa_printf(MSG_INFO,
+                                  "nl80211: %s->nl_recvmsgs failed: %d",
+                                  __func__, res);
+               }
+       }
  out:
        nl_cb_put(cb);
        nlmsg_free(msg);
@@ -844,10 +850,15 @@ nla_put_failure:
 static void nl80211_recv_beacons(int sock, void *eloop_ctx, void *handle)
 {
        struct nl80211_wiphy_data *w = eloop_ctx;
+       int res;
 
        wpa_printf(MSG_EXCESSIVE, "nl80211: Beacon event message available");
 
-       nl_recvmsgs(handle, w->nl_cb);
+       res = nl_recvmsgs(handle, w->nl_cb);
+       if (res) {
+               wpa_printf(MSG_INFO, "nl80211: %s->nl_recvmsgs failed: %d",
+                          __func__, res);
+       }
 }
 
 
@@ -2870,10 +2881,15 @@ static void wpa_driver_nl80211_event_receive(int sock, void *eloop_ctx,
                                             void *handle)
 {
        struct nl_cb *cb = eloop_ctx;
+       int res;
 
        wpa_printf(MSG_MSGDUMP, "nl80211: Event message available");
 
-       nl_recvmsgs(handle, cb);
+       res = nl_recvmsgs(handle, cb);
+       if (res) {
+               wpa_printf(MSG_INFO, "nl80211: %s->nl_recvmsgs failed: %d",
+                          __func__, res);
+       }
 }