[PATCH] hostap: Ensure netlink recv buf size is large enough.

greearb at candelatech.com greearb
Tue Apr 3 22:06:45 PDT 2012


From: Ben Greear <greearb at candelatech.com>

I was getting this error on wpa_supplicant startup when configured
for 200+ stations:

1333514002.074458: netlink: recvfrom failed: No buffer space available

So, increase rcv buffer size to 1MB so we don't drop netlink
packets.

Signed-hostap: Ben Greear <greearb at candelatech.com>
Signed-off-by: Ben Greear <greearb at candelatech.com>
---
:100644 100644 dd662f3... 930acc4... M	src/drivers/netlink.c
 src/drivers/netlink.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/drivers/netlink.c b/src/drivers/netlink.c
index dd662f3..930acc4 100644
--- a/src/drivers/netlink.c
+++ b/src/drivers/netlink.c
@@ -92,6 +92,7 @@ struct netlink_data * netlink_init(struct netlink_config *cfg)
 {
 	struct netlink_data *netlink;
 	struct sockaddr_nl local;
+	int rsize;
 
 	netlink = os_zalloc(sizeof(*netlink));
 	if (netlink == NULL)
@@ -118,6 +119,18 @@ struct netlink_data * netlink_init(struct netlink_config *cfg)
 		return NULL;
 	}
 
+	/* Set the rcv buffer large so we don't drop netlink messages
+	 * on heavily loaded systems.
+	 */
+	rsize = 1024 * 1024;
+	if (setsockopt(netlink->sock, SOL_SOCKET, SO_RCVBUF,
+		       (char *)&rsize, sizeof(rsize)) < 0) {
+		wpa_printf(MSG_ERROR,
+			   "netlink: Failed setting rcv buffer to: %i: %s\n",
+			   rsize, strerror(errno));
+		/* Not the end of the world..continue */
+	}
+
 	eloop_register_read_sock(netlink->sock, netlink_receive, netlink,
 				 NULL);
 
-- 
1.7.3.4




More information about the Hostap mailing list