aboutsummaryrefslogtreecommitdiff
path: root/security/wpa_supplicant-devel/files/patch-wpa__supplicant_ctrl__iface__unix.c
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2023-11-29 16:16:49 +0000
committerCy Schubert <cy@FreeBSD.org>2023-11-29 16:18:11 +0000
commit60c99d3a93081cc603e104c0e6c9fe389e774657 (patch)
tree53070bcb3cee0373c67939fb41abaaffb5367815 /security/wpa_supplicant-devel/files/patch-wpa__supplicant_ctrl__iface__unix.c
parentb118f66e4c1af43b0dbb0580122e119890886b76 (diff)
downloadports-60c99d3a93081cc603e104c0e6c9fe389e774657.tar.gz
ports-60c99d3a93081cc603e104c0e6c9fe389e774657.zip
security/wpa_supplicant*: 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. The problem occured, e.g., when the scan_list result had enough BSSIDs so the text output would exceed 2048 bytes. Written by: bz PR: 274990 Obtained from: https://reviews.freebsd.org/D42558
Diffstat (limited to 'security/wpa_supplicant-devel/files/patch-wpa__supplicant_ctrl__iface__unix.c')
-rw-r--r--security/wpa_supplicant-devel/files/patch-wpa__supplicant_ctrl__iface__unix.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/security/wpa_supplicant-devel/files/patch-wpa__supplicant_ctrl__iface__unix.c b/security/wpa_supplicant-devel/files/patch-wpa__supplicant_ctrl__iface__unix.c
new file mode 100644
index 000000000000..cc73ac35cd35
--- /dev/null
+++ b/security/wpa_supplicant-devel/files/patch-wpa__supplicant_ctrl__iface__unix.c
@@ -0,0 +1,36 @@
+--- wpa_supplicant/ctrl_iface_unix.c.orig 2022-01-16 12:51:29.000000000 -0800
++++ wpa_supplicant/ctrl_iface_unix.c 2023-11-29 08:12:07.843443000 -0800
+@@ -506,6 +506,10 @@
+ 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)
+@@ -678,6 +682,22 @@
+ /* Not fatal, continue on.*/
+ }
+ }
++
++#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);