]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Debug print setsockopt() failures for NETLINK_EXT_ACK
authorJouni Malinen <j@w1.fi>
Sun, 23 Feb 2025 14:27:03 +0000 (16:27 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 23 Feb 2025 14:27:03 +0000 (16:27 +0200)
Even though we explicitly ignore these errors, it is better to print
them into the debug log if for no other reason than to get rid of some
static analyzer warnings about unchecked reutrn values.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/drivers/driver_nl80211.c

index bc92d45aedcdf06be073a12989faeac2f0886e1c..60a7ae5eaa2227acdf8b27d6fc4de260d289001b 100644 (file)
@@ -521,13 +521,19 @@ int send_and_recv_glb(struct nl80211_global *global,
 
        /* try to set NETLINK_EXT_ACK to 1, ignoring errors */
        opt = 1;
-       setsockopt(nl_socket_get_fd(nl_handle), SOL_NETLINK,
-                  NETLINK_EXT_ACK, &opt, sizeof(opt));
+       if (setsockopt(nl_socket_get_fd(nl_handle), SOL_NETLINK,
+                      NETLINK_EXT_ACK, &opt, sizeof(opt)) < 0)
+               wpa_printf(MSG_DEBUG,
+                          "nl80211: setsockopt(NETLINK_EXT_ACK) failed: %s (ignored)",
+                          strerror(errno));
 
        /* try to set NETLINK_CAP_ACK to 1, ignoring errors */
        opt = 1;
-       setsockopt(nl_socket_get_fd(nl_handle), SOL_NETLINK,
-                  NETLINK_CAP_ACK, &opt, sizeof(opt));
+       if (setsockopt(nl_socket_get_fd(nl_handle), SOL_NETLINK,
+                      NETLINK_CAP_ACK, &opt, sizeof(opt)) < 0)
+               wpa_printf(MSG_DEBUG,
+                          "nl80211: setsockopt(NETLINK_CAP_ACK) failed: %s (ignored)",
+                          strerror(errno));
 
        err.err = nl_send_auto_complete(nl_handle, msg);
        if (err.err < 0) {