aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-07-30 02:12:53 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-16 15:26:13 -0400
commit4083858c8b309068024ba43672d831999d69ba3f (patch)
treeb46dae7fca5e83a160d61f2c0ec4846b9b54068e
parent1e51b2ff0a33797476932a68d36136921e4e1b05 (diff)
libertas: better scan response debugging
Make it a bit easier to debug scan results in the future. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/libertas/cfg.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 51a96f5a342d..8bf88fa43690 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -524,20 +524,31 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy,
524 524
525 pos = scanresp->bssdesc_and_tlvbuffer; 525 pos = scanresp->bssdesc_and_tlvbuffer;
526 526
527 lbs_deb_hex(LBS_DEB_SCAN, "SCAN_RSP", scanresp->bssdesc_and_tlvbuffer,
528 scanresp->bssdescriptsize);
529
527 tsfdesc = pos + bsssize; 530 tsfdesc = pos + bsssize;
528 tsfsize = 4 + 8 * scanresp->nr_sets; 531 tsfsize = 4 + 8 * scanresp->nr_sets;
532 lbs_deb_hex(LBS_DEB_SCAN, "SCAN_TSF", (u8 *) tsfdesc, tsfsize);
529 533
530 /* Validity check: we expect a Marvell-Local TLV */ 534 /* Validity check: we expect a Marvell-Local TLV */
531 i = get_unaligned_le16(tsfdesc); 535 i = get_unaligned_le16(tsfdesc);
532 tsfdesc += 2; 536 tsfdesc += 2;
533 if (i != TLV_TYPE_TSFTIMESTAMP) 537 if (i != TLV_TYPE_TSFTIMESTAMP) {
538 lbs_deb_scan("scan response: invalid TSF Timestamp %d\n", i);
534 goto done; 539 goto done;
540 }
541
535 /* Validity check: the TLV holds TSF values with 8 bytes each, so 542 /* Validity check: the TLV holds TSF values with 8 bytes each, so
536 * the size in the TLV must match the nr_sets value */ 543 * the size in the TLV must match the nr_sets value */
537 i = get_unaligned_le16(tsfdesc); 544 i = get_unaligned_le16(tsfdesc);
538 tsfdesc += 2; 545 tsfdesc += 2;
539 if (i / 8 != scanresp->nr_sets) 546 if (i / 8 != scanresp->nr_sets) {
547 lbs_deb_scan("scan response: invalid number of TSF timestamp "
548 "sets (expected %d got %d)\n", scanresp->nr_sets,
549 i / 8);
540 goto done; 550 goto done;
551 }
541 552
542 for (i = 0; i < scanresp->nr_sets; i++) { 553 for (i = 0; i < scanresp->nr_sets; i++) {
543 const u8 *bssid; 554 const u8 *bssid;
@@ -579,8 +590,11 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy,
579 id = *pos++; 590 id = *pos++;
580 elen = *pos++; 591 elen = *pos++;
581 left -= 2; 592 left -= 2;
582 if (elen > left || elen == 0) 593 if (elen > left || elen == 0) {
594 lbs_deb_scan("scan response: invalid IE fmt\n");
583 goto done; 595 goto done;
596 }
597
584 if (id == WLAN_EID_DS_PARAMS) 598 if (id == WLAN_EID_DS_PARAMS)
585 chan_no = *pos; 599 chan_no = *pos;
586 if (id == WLAN_EID_SSID) { 600 if (id == WLAN_EID_SSID) {
@@ -611,7 +625,9 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy,
611 capa, intvl, ie, ielen, 625 capa, intvl, ie, ielen,
612 LBS_SCAN_RSSI_TO_MBM(rssi), 626 LBS_SCAN_RSSI_TO_MBM(rssi),
613 GFP_KERNEL); 627 GFP_KERNEL);
614 } 628 } else
629 lbs_deb_scan("scan response: missing BSS channel IE\n");
630
615 tsfdesc += 8; 631 tsfdesc += 8;
616 } 632 }
617 ret = 0; 633 ret = 0;