Patch for socket table size

Shriram Jandhyala sjandhyala at paloaltonetworks.com
Wed Jan 24 18:00:41 PST 2018


Hi,

I notice that the socket table is not increased in size correctly when the first fd given is larger than 16.
Please consider the following patch.

--- src/utils/eloop.c.orig	2017-10-18 15:22:01.473499000 -0700
+++ src/utils/eloop.c	2018-01-24 17:41:37.494113000 -0800
@@ -301,7 +301,7 @@
 #endif /* CONFIG_ELOOP_POLL */
 #if defined(CONFIG_ELOOP_EPOLL) || defined(CONFIG_ELOOP_KQUEUE)
 	if (new_max_sock >= eloop.max_fd) {
-		next = eloop.max_fd == 0 ? 16 : eloop.max_fd * 2;
+		next = 1 << (32 - __builtin_clz(new_max_sock));
 		temp_table = os_realloc_array(eloop.fd_table, next,
 					      sizeof(struct eloop_sock));
 		if (temp_table == NULL)


Thanks.
Shriram





More information about the Hostap mailing list