Hello,

I've noticed that hostapd wpa_supplicant/wpa_cli produce truncated
scan results due to 2048-byte buffers.
Attached patch raises the buffer length to 4096 which fixes the
problem (at least here...).

To reproduce:

#!/bin/sh
CLI="wpa_cli -p /var/run/wpa_supplicant-wlan1"
for i in `seq 1 9`; do
  $CLI scan
  sleep 10s
  $CLI scan_results > res$i
end

Now let's have a look:

# wc -c res*
     1864 res1
     2074 res2
     2074 res3
     2074 res4
     2074 res6
     ...

Quick 'cat' shows truncation of the last line (by far not the last
scan result available here).

koniu

PS. Maybe this is upstream matter? CC-d to hostap ml. Note that patch
is against OpenWRT trunk's hostapd package.
From ca622a92a2f1dfc659d5242de1a1b1d4ef0fe8f3 Mon Sep 17 00:00:00 2001
From: koniu <gkusni...@gmail.com>
Date: Wed, 29 Dec 2010 15:45:31 +0000
Subject: [PATCH] hostapd: fix truncated wpa_supp/wpa_cli scan results

Signed-off-by: koniu <gkusni...@gmail.com>
---
 .../patches/610-scan-result-trunc-fix.patch        |   22 ++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100644 package/hostapd/patches/610-scan-result-trunc-fix.patch

diff --git a/package/hostapd/patches/610-scan-result-trunc-fix.patch b/package/hostapd/patches/610-scan-result-trunc-fix.patch
new file mode 100644
index 0000000..dcb1bfc
--- /dev/null
+++ b/package/hostapd/patches/610-scan-result-trunc-fix.patch
@@ -0,0 +1,22 @@
+--- a/wpa_supplicant/wpa_cli.c  2010-12-29 15:31:48.052000000 +0000
++++ b/wpa_supplicant/wpa_cli.c	2010-12-29 15:31:57.960000000 +0000
+@@ -326,7 +326,7 @@
+ 
+ static int _wpa_ctrl_command(struct wpa_ctrl *ctrl, char *cmd, int print)
+ {
+-	char buf[2048];
++	char buf[4096];
+ 	size_t len;
+ 	int ret;
+ 
+--- a/wpa_supplicant/ctrl_iface.c	2010-12-29 15:32:23.376000000 +0000
++++ b/wpa_supplicant/ctrl_iface.c	2010-12-29 15:32:46.204000000 +0000
+@@ -3232,7 +3232,7 @@
+ 						char *buf, size_t *resp_len)
+ {
+ 	char *reply;
+-	const int reply_size = 2048;
++	const int reply_size = 4096;
+ 	int reply_len;
+ 
+ 	wpa_hexdump_ascii(MSG_DEBUG, "RX global ctrl_iface",
-- 
1.7.2.3

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to