[PATCH 1/2] nl80211: allocate more memory for channel_switch cmd

Bartosz Markowski bartosz.markowski
Fri Jan 31 07:45:39 PST 2014


From: Michal Kazior <michal.kazior at tieto.com>

Once a certain threshold was reached (depending on
number of IEs and BSSes) channel switch was
failing with -ENOBUFS meaning nlmsg was too small
to fit the whole command.

Pre-allocate a big buffer for channel switch to
avoid this. 64KiB seems reasonable from a
practical point of view as it should handle at
least 8 BSSes.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 src/drivers/driver_nl80211.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 81f20b3..77149ba 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -11596,7 +11596,11 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings)
 	      settings->cs_count)))
 		return -EINVAL;
 
-	msg = nlmsg_alloc();
+	/* each interface channel switch request can be sizable as it contains
+	 * a beacon and possibly a probe response. this size varies depending
+	 * on the number of IEs. pre-allocate memory for the nlmsg. this could
+	 * be probably caculated/estimated but 64KiB seems like a sane value */
+	msg = nlmsg_alloc_size(64 * 1024);
 	if (!msg)
 		return -ENOMEM;
 
-- 
1.7.9.5




More information about the Hostap mailing list