From owner-freebsd-net@FreeBSD.ORG Thu Sep 24 19:10:23 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A33B106566B for ; Thu, 24 Sep 2009 19:10:23 +0000 (UTC) (envelope-from dhorn2000@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.241]) by mx1.freebsd.org (Postfix) with ESMTP id 27D038FC16 for ; Thu, 24 Sep 2009 19:10:22 +0000 (UTC) Received: by an-out-0708.google.com with SMTP id d14so722593and.13 for ; Thu, 24 Sep 2009 12:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type; bh=mrog7rxX7e1/7GwpHimxa9MyqqTMqtlUBcqN6UfF6ag=; b=jtuG3AaGa8u3ffgbqX8Gcs0q+11XMpJQYLeEEB+1Fj5QwdafcVn+YBSS224bJ6H1nT MdhcOQQYqfXYzMCjQOQVQe5uQVfwOl0l/MCvQSxexG4i9fJ8pKxN6NAfFdS21zNZW3yk XkqZhk/sqPjlck2mUhkGs5wMFbWZduy/Qc6WM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=eqZaOek1BQzEJZXCpAZ7D4jhwFo3L5UNgO8xokejrpx/s7g6AFNpIE6qyQCGE8dbRD zXzbUWsrBHDeHOnr3yRc95euU/GNzgCsPb5qOyZ3kSIrjPe0uEUrKCrO2xWHy6bKeDE6 J9IBpavDzCApWzFAT/Spop7/rlPZLzhEjQOYA= MIME-Version: 1.0 Received: by 10.100.76.3 with SMTP id y3mr4601536ana.76.1253817886266; Thu, 24 Sep 2009 11:44:46 -0700 (PDT) Date: Thu, 24 Sep 2009 14:44:46 -0400 Message-ID: <25ff90d60909241144i321c39bdj71e1d1b7e0ba51e8@mail.gmail.com> From: David Horn To: freebsd-net@freebsd.org Content-Type: multipart/mixed; boundary=0050450295a6b9567104745739f8 Cc: sam@frebsd.org Subject: wpa_supplicant signal quality vs level X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Sep 2009 19:10:23 -0000 --0050450295a6b9567104745739f8 Content-Type: text/plain; charset=ISO-8859-1 I have noticed that 'wpa_cli scan_results' always reported a signal level of 0 for every bssid found during a scan. I found this a bit odd (especially since ifconfig wlan0 list scan reported good signal level data) FreeBSD 8.0-RC1 r197417 amd64 Looking at the /usr/src/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c source, I found: in wpa_driver_bsd_get_scan_results() wsr->qual = sr->isr_rssi; wsr->level = 0; /* XXX? */ This hardcodes the signal level to 0, and sets the signal quality to the rssi value. Looking around at the source, it seems that wpa_supplicant does not ever use the quality variable, but instead looks at the level variable in wpa_scan_result_compar (). In an attempt to try to figure out what signal level vs signal quality in wpa_supplicant context means, I found this: http://lists.shmoo.com/pipermail/hostap/2006-December/014831.html, and a feb-2009 change to scan_helpers.c (which drivers_freebsd.c seems to be partially based upon) http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=e1b525c3560614cc56c85b7d060f540900c4da34 So, it seems that some wpa_supplicant drivers use quality, and some use level. Since quality(wsr->qual) does not seem to be used in current wpa_supplicant in freebsd, should it instead look like ?: (attached as an SVN diff with some debug as well) wsr->ssid_len = sr->isr_ssid_len; wsr->freq = sr->isr_freq; wsr->noise = sr->isr_noise; - wsr->qual = sr->isr_rssi; - wsr->level = 0; /* XXX? */ + wsr->qual = 0; /* XXX? */ + wsr->level = sr->isr_rssi; wsr->caps = sr->isr_capinfo; wsr->maxrate = getmaxrate(sr->isr_rates, sr->isr_nrates); vp = ((u_int8_t *)sr) + sr->isr_ie_off; Should we just set qual to 0, or should we set qual to rssi/rssi_max*100 (if we can determine rssi_max for a particular wlan interface) In any case, do you want me to file a PR on this ? --Thanks! ---Dave H --0050450295a6b9567104745739f8 Content-Type: text/plain; charset=US-ASCII; name="wpa_supplicant.patch.txt" Content-Disposition: attachment; filename="wpa_supplicant.patch.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_fzzuperh0 SW5kZXg6IGRyaXZlcl9mcmVlYnNkLmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gZHJpdmVyX2ZyZWVic2QuYwko cmV2aXNpb24gMTk3NDM5KQorKysgZHJpdmVyX2ZyZWVic2QuYwkod29ya2luZyBjb3B5KQpAQCAt NjQxLDYgKzY0MSw4IEBACiAJLyogdXNlIGZyZXEgZm9yIGNoYW5uZWwgcHJlZmVyZW5jZSAqLwog CiAJLyogYWxsIHRoaW5ncyBiZWluZyBlcXVhbCwgdXNlIHNpZ25hbCBsZXZlbCAqLworCXdwYV9w cmludGYoTVNHX0RFQlVHLCAiJXM6IHNpZ25hbCBsZXZlbHM7ICVkOiMxKHdhKSAgJWQ6IzIod2Ip IiwKKwkgICAgICAgICAgIF9fZnVuY19fLCB3YS0+bGV2ZWwsIHdiLT5sZXZlbCk7CiAJcmV0dXJu IHdiLT5sZXZlbCAtIHdhLT5sZXZlbDsKIH0KIApAQCAtNjk3LDggKzY5OSw4IEBACiAJCXdzci0+ c3NpZF9sZW4gPSBzci0+aXNyX3NzaWRfbGVuOwogCQl3c3ItPmZyZXEgPSBzci0+aXNyX2ZyZXE7 CiAJCXdzci0+bm9pc2UgPSBzci0+aXNyX25vaXNlOwotCQl3c3ItPnF1YWwgPSBzci0+aXNyX3Jz c2k7Ci0JCXdzci0+bGV2ZWwgPSAwOwkJLyogWFhYPyAqLworCQl3c3ItPnF1YWwgPSAwOyAgLyog WFhYPyAqLworCQl3c3ItPmxldmVsID0gc3ItPmlzcl9yc3NpOwkKIAkJd3NyLT5jYXBzID0gc3It Pmlzcl9jYXBpbmZvOwogCQl3c3ItPm1heHJhdGUgPSBnZXRtYXhyYXRlKHNyLT5pc3JfcmF0ZXMs IHNyLT5pc3JfbnJhdGVzKTsKIAkJdnAgPSAoKHVfaW50OF90ICopc3IpICsgc3ItPmlzcl9pZV9v ZmY7Cg== --0050450295a6b9567104745739f8--