From nobody Sun Feb 18 21:11:17 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TdJHq3Jmtz5Bm8f; Sun, 18 Feb 2024 21:11:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TdJHn2tl1z42DN; Sun, 18 Feb 2024 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708290677; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AOgVVGNnDGx5Fiqcwh4Ap0pYneFpMp9vAxyEOGx2M6w=; b=AHrBCpZjdAUdFThMPUhw8gGJXdGJKtB8ELK75+/s0ukfgou3dzYbrrwLCGwou+qkt9nQwm l/5wNWhOTbI0OVzHSEJB0QyKD5wQ6qpm3LF3L5qeG2/UkY+epxqpEnAc5ufKh25uq2cqHI azPDIseGB5hc8feCGyDaszJMlCEeaqW5m72YCAHm5yRoB9dD/2innN/R5XGMio892ASALD L7bvxra+IIohMd9mgv7FMwlIwWBUsE+gyciO55cjFa/b3FVgIJCvSSQqF1+JxtOB82IHgi WaJ2M9dFBmfyn0EVMPScp3CZugD2B96Mu2DymoK4TbjBxl/rs6T3jAEvUYKmwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708290677; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AOgVVGNnDGx5Fiqcwh4Ap0pYneFpMp9vAxyEOGx2M6w=; b=WDOl7Ld5aUSuAtwtd+IJOF4lc5Ctzn7InntBdpN0tMA/WJHCjrh31ufgNLIYvD9CIypN2e e5Q/betmL0H4d8P5P42itv6OO/3eobSH2tfJuWS9dT+QsfgBoXu9vncuyABCAQGE/rtHO1 1UMa3seFEHA1LpVxU8XjRMmWkhMwpYdYkA535Ztlk82vOWM76tUs8CjTYOaLpUXQ/tKX0f G6i82yoeISQJ5S13YR72FzB6vJqMTF2g285kHWr9fX+5VsExGo+seTXOK0vZekLtEhpPRf 520V4Gyk2JQt8NyBPTAXKx3LfhBO9ma+8rMWIK+mDIES8wzjkZ690u9naD2n0A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708290677; a=rsa-sha256; cv=none; b=lXWF1fdYZrAU8rCZAMiCT3Q934M7uAhbJdNeuYUwvM56wLD+fUvawpFmkzNlDxCtZJ50p+ wb50z3v6XbQSIcvQoZ5aUyiu7JxVEQMDEKbkYfdXlIQIqvk1/wzKOTOlQErlbuChNpT+fs hzrcSeNa9pWzVnbmSob3nF0B3ut7v6Vgr3qbYw3T0AlBB5ey/QWupjsqgDHkYWVGnG25J4 hZWjY289+jGSd7pVwnVMEP1xx3Rjq9Ija01BSyp7brCKdDcRtRs544wnWPfLsg3+4G0YGc Ipb4DMbTdnCVGEdB9hn5CRYgFKt0UTUzP0GKrwcnNumCAMvczJgaCueXBnVN0Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TdJHn1f0Qz16kZ; Sun, 18 Feb 2024 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41ILBHW5014411; Sun, 18 Feb 2024 21:11:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41ILBHwL014408; Sun, 18 Feb 2024 21:11:17 GMT (envelope-from git) Date: Sun, 18 Feb 2024 21:11:17 GMT Message-Id: <202402182111.41ILBHwL014408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 64f1df32cf68 - stable/14 - wpa: ctrl_iface set sendbuf size List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 64f1df32cf68d8a912fe1fb8d9dbe0e777163b5e Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=64f1df32cf68d8a912fe1fb8d9dbe0e777163b5e commit 64f1df32cf68d8a912fe1fb8d9dbe0e777163b5e Author: Bjoern A. Zeeb AuthorDate: 2023-11-12 20:33:41 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-02-18 18:31:14 +0000 wpa: ctrl_iface set sendbuf size In order to avoid running into the default net.local.dgram.maxdgram of 2K currently when calling sendto(2) try to set the sndbuf size to the maximum ctrl message size. While on 14 and 15 this does not actually raise the limit anymore (and be7c095ac99ad29fd72b780c7d58949a38656c66 raised it for syslogd and this), FreeBSD 13 still requires this change and it will work as expected there. In addition we always ensure a large enough send buffer this way independent of kernel defaults. The problem occured, e.g., when the scan_list result had enough BSSIDs so the text output would exceed 2048 bytes. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: cy, adrian (with previous comment) Differential Revision: https://reviews.freebsd.org/D42558 (cherry picked from commit 1edc20b76953d9ef571b0bcf89b206b98ed13d9b) --- contrib/wpa/wpa_supplicant/ctrl_iface_unix.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c b/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c index 639573dae75e..deeed2b11833 100644 --- a/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c +++ b/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c @@ -506,6 +506,10 @@ static int wpas_ctrl_iface_open_sock(struct wpa_supplicant *wpa_s, struct group *grp; char *endp; int flags; +#if defined(__FreeBSD__) + int optval, rc; + socklen_t optlen; +#endif buf = os_strdup(wpa_s->conf->ctrl_interface); if (buf == NULL) @@ -679,6 +683,22 @@ havesock: } } +#if defined(__FreeBSD__) + /* Ensure we can send a full length message atomically. */ + optval = 0; + optlen = sizeof(optval); + if (getsockopt(priv->sock, SOL_SOCKET, SO_SNDBUF, &optval, &optlen) == -1) { + wpa_printf(MSG_INFO, "failed to get sndbuf for sock=%d: %s", + priv->sock, strerror(errno)); + } else if (optval < CTRL_IFACE_MAX_LEN) { + optval = CTRL_IFACE_MAX_LEN; + if (setsockopt(priv->sock, SOL_SOCKET, SO_SNDBUF, &optval, + sizeof(optval)) == -1) + wpa_printf(MSG_ERROR, "failed to set sndbuf for " + "sock=%d: %s", priv->sock, strerror(errno)); + } +#endif + eloop_register_read_sock(priv->sock, wpa_supplicant_ctrl_iface_receive, wpa_s, priv); wpa_msg_register_cb(wpa_supplicant_ctrl_iface_msg_cb);