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
This commit is contained in:
parent
b118f66e4c
commit
60c99d3a93
|
@ -1,5 +1,6 @@
|
|||
PORTNAME= wpa_supplicant
|
||||
PORTVERSION= ${COMMIT_DATE}
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= security net
|
||||
PKGNAMESUFFIX= -devel
|
||||
|
||||
|
|
|
@ -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);
|
|
@ -1,6 +1,6 @@
|
|||
PORTNAME= wpa_supplicant
|
||||
PORTVERSION= 2.10
|
||||
PORTREVISION= 9
|
||||
PORTREVISION= 10
|
||||
CATEGORIES= security net
|
||||
MASTER_SITES= https://w1.fi/releases/
|
||||
|
||||
|
|
|
@ -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);
|
Loading…
Reference in New Issue