From: Jouni Malinen Date: Sun, 23 Feb 2025 14:27:03 +0000 (+0200) Subject: nl80211: Debug print setsockopt() failures for NETLINK_EXT_ACK X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41398a8737bccbd4e22e0f2cd2292f8a04e250ef;p=thirdparty%2Fhostap.git nl80211: Debug print setsockopt() failures for NETLINK_EXT_ACK 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 --- diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index bc92d45ae..60a7ae5ea 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -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) {