Loading drivers/staging/wlan-ng/prism2mgmt.c +387 −376 Original line number Diff line number Diff line Loading @@ -57,9 +57,6 @@ * -------------------------------------------------------------------- */ /*================================================================*/ /* System Includes */ #include <linux/if_arp.h> #include <linux/module.h> #include <linux/kernel.h> Loading Loading @@ -138,7 +135,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) hw->ident_sta_fw.minor, hw->ident_sta_fw.variant) < HFA384x_FIRMWARE_VERSION(1, 3, 2)) { printk(KERN_ERR "HostScan not supported with current firmware (<1.3.2).\n"); printk(KERN_ERR "HostScan not supported with current firmware (<1.3.2).\n"); result = 1; msg->resultcode.data = P80211ENUM_resultcode_not_supported; goto exit; Loading @@ -148,7 +146,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) /* save current roaming mode */ result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_CNFROAMINGMODE, &roamingmode); HFA384x_RID_CNFROAMINGMODE, &roamingmode); if (result) { printk(KERN_ERR "getconfig(ROAMMODE) failed. result=%d\n", result); Loading @@ -174,12 +173,14 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) hw->ident_sta_fw.minor, hw->ident_sta_fw.variant) > HFA384x_FIRMWARE_VERSION(1, 5, 0)) { if (msg->scantype.data != P80211ENUM_scantype_active) { if (msg->scantype.data != P80211ENUM_scantype_active) word = host2hfa384x_16(msg->maxchanneltime.data); } else { else word = 0; } result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPASSIVESCANCTRL, word); result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPASSIVESCANCTRL, word); if (result) { printk(KERN_WARNING "Passive scan not supported with " "current firmware. (<1.5.1)\n"); Loading @@ -194,7 +195,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) word = 0; for (i = 0; i < msg->channellist.data.len; i++) { u8 channel = msg->channellist.data.data[i]; if (channel > 14) continue; if (channel > 14) continue; /* channel 1 is BIT 0 ... channel 14 is BIT 13 */ word |= (1 << (channel - 1)); } Loading @@ -220,7 +222,9 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) HFA384x_RID_CNFROAMINGMODE, HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM); if (result) { printk(KERN_ERR "setconfig(ROAMINGMODE) failed. result=%d\n", result); printk(KERN_ERR "setconfig(ROAMINGMODE) failed. result=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; Loading @@ -231,7 +235,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) wordbuf[0] = host2hfa384x_16(WLAN_SSID_MAXLEN); get_random_bytes(&wordbuf[1], WLAN_SSID_MAXLEN); result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFOWNSSID, wordbuf, HFA384x_RID_CNFOWNSSID_LEN); wordbuf, HFA384x_RID_CNFOWNSSID_LEN); if (result) { printk(KERN_ERR "Failed to set OwnSSID.\n"); msg->resultcode.data = Loading @@ -239,7 +244,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) goto exit; } result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFDESIREDSSID, wordbuf, HFA384x_RID_CNFDESIREDSSID_LEN); wordbuf, HFA384x_RID_CNFDESIREDSSID_LEN); if (result) { printk(KERN_ERR "Failed to set DesiredSSID.\n"); msg->resultcode.data = Loading Loading @@ -338,7 +344,6 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) return result; } /*---------------------------------------------------------------- * prism2mgmt_scan_results * Loading Loading @@ -373,14 +378,16 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) req->resultcode.status = P80211ENUM_msgitem_status_data_ok; if (!hw->scanresults) { printk(KERN_ERR "dot11req_scan_results can only be used after a successful dot11req_scan.\n"); printk(KERN_ERR "dot11req_scan_results can only be used after a successful dot11req_scan.\n"); result = 2; req->resultcode.data = P80211ENUM_resultcode_invalid_parameters; goto exit; } count = (hw->scanresults->framelen - 3) / 32; if (count > 32) count = 32; if (count > 32) count = 32; if (req->bssindex.data >= count) { pr_debug("requested index (%d) out of range (%d)\n", Loading Loading @@ -478,17 +485,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) /* bsstype */ req->bsstype.status = P80211ENUM_msgitem_status_data_ok; req->bsstype.data = (WLAN_GET_MGMT_CAP_INFO_ESS(count)) ? P80211ENUM_bsstype_infrastructure : P80211ENUM_bsstype_independent; // item->proberesp_rate /* req->fhdwelltime req->fhhopset req->fhhoppattern req->fhhopindex req->cfpdurremaining */ P80211ENUM_bsstype_infrastructure : P80211ENUM_bsstype_independent; result = 0; req->resultcode.data = P80211ENUM_resultcode_success; Loading Loading @@ -558,7 +555,8 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) goto failed; } result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFDESIREDSSID, bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); if (result) { printk(KERN_ERR "Failed to set CnfDesiredSSID\n"); goto failed; Loading @@ -585,27 +583,27 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) } /* Basic rates */ word = p80211rate_to_p2bit(msg->basicrate1.data); if ( msg->basicrate2.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate2.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate2.data); } if ( msg->basicrate3.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate3.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate3.data); } if ( msg->basicrate4.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate4.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate4.data); } if ( msg->basicrate5.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate5.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate5.data); } if ( msg->basicrate6.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate6.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate6.data); } if ( msg->basicrate7.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate7.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate7.data); } if ( msg->basicrate8.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate8.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate8.data); } result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFBASICRATES, word); if (result) { printk(KERN_ERR "Failed to set basicrates=%d.\n", word); Loading @@ -614,27 +612,27 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) /* Operational rates (supprates and txratecontrol) */ word = p80211rate_to_p2bit(msg->operationalrate1.data); if ( msg->operationalrate2.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate2.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate2.data); } if ( msg->operationalrate3.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate3.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate3.data); } if ( msg->operationalrate4.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate4.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate4.data); } if ( msg->operationalrate5.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate5.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate5.data); } if ( msg->operationalrate6.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate6.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate6.data); } if ( msg->operationalrate7.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate7.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate7.data); } if ( msg->operationalrate8.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate8.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate8.data); } result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, word); if (result) { printk(KERN_ERR "Failed to set supprates=%d.\n", word); Loading Loading @@ -703,8 +701,7 @@ int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp) */ if (wlandev->msdstate != WLAN_MSD_FWLOAD) { printk(KERN_ERR "PDA may only be read " "in the fwload state.\n"); "PDA may only be read " "in the fwload state.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; Loading @@ -712,15 +709,13 @@ int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp) /* Call drvr_readpda(), it handles the auxport enable * and validating the returned PDA. */ result = hfa384x_drvr_readpda( hw, result = hfa384x_drvr_readpda(hw, msg->pda.data, HFA384x_PDA_LEN_MAX); if (result) { printk(KERN_ERR "hfa384x_drvr_readpda() failed, " "result=%d\n", result); "result=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; Loading Loading @@ -784,7 +779,8 @@ int prism2mgmt_ramdl_state(wlandevice_t *wlandev, void *msgp) msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; if (msg->enable.data == P80211ENUM_truth_true) { if (hfa384x_drvr_ramdl_enable(hw, msg->exeaddr.data)) { msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; } else { msg->resultcode.data = P80211ENUM_resultcode_success; } Loading @@ -796,7 +792,6 @@ int prism2mgmt_ramdl_state(wlandevice_t *wlandev, void *msgp) return 0; } /*---------------------------------------------------------------- * prism2mgmt_ramdl_write * Loading Loading @@ -838,23 +833,22 @@ int prism2mgmt_ramdl_write(wlandevice_t *wlandev, void *msgp) msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; /* first validate the length */ if (msg->len.data > sizeof(msg->data.data)) { msg->resultcode.status = P80211ENUM_resultcode_invalid_parameters; msg->resultcode.status = P80211ENUM_resultcode_invalid_parameters; return 0; } /* call the hfa384x function to do the write */ addr = msg->addr.data; len = msg->len.data; buf = msg->data.data; if ( hfa384x_drvr_ramdl_write(hw, addr, buf, len) ) { if (hfa384x_drvr_ramdl_write(hw, addr, buf, len)) msg->resultcode.data = P80211ENUM_resultcode_refused; } msg->resultcode.data = P80211ENUM_resultcode_success; return 0; } /*---------------------------------------------------------------- * prism2mgmt_flashdl_state * Loading Loading @@ -904,7 +898,8 @@ int prism2mgmt_flashdl_state(wlandevice_t *wlandev, void *msgp) msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; if (msg->enable.data == P80211ENUM_truth_true) { if (hfa384x_drvr_flashdl_enable(hw)) { msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; } else { msg->resultcode.data = P80211ENUM_resultcode_success; } Loading Loading @@ -932,7 +927,6 @@ int prism2mgmt_flashdl_state(wlandevice_t *wlandev, void *msgp) return 0; } /*---------------------------------------------------------------- * prism2mgmt_flashdl_write * Loading Loading @@ -985,10 +979,9 @@ int prism2mgmt_flashdl_write(wlandevice_t *wlandev, void *msgp) addr = msg->addr.data; len = msg->len.data; buf = msg->data.data; if ( hfa384x_drvr_flashdl_write(hw, addr, buf, len) ) { if (hfa384x_drvr_flashdl_write(hw, addr, buf, len)) msg->resultcode.data = P80211ENUM_resultcode_refused; } msg->resultcode.data = P80211ENUM_resultcode_success; return 0; Loading Loading @@ -1037,20 +1030,20 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp) hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, 0x000f); /* Set the auth type */ if ( msg->authtype.data == P80211ENUM_authalg_sharedkey ) { if (msg->authtype.data == P80211ENUM_authalg_sharedkey) reg = HFA384x_CNFAUTHENTICATION_SHAREDKEY; } else { else reg = HFA384x_CNFAUTHENTICATION_OPENSYSTEM; } hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAUTHENTICATION, reg); /* Set the ssid */ memset(bytebuf, 0, 256); pstr = (p80211pstrd_t *)&(msg->ssid.data); prism2mgmt_pstr2bytestr(p2bytestr, pstr); result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFDESIREDSSID, bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFDESIREDSSID, bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); port_type = HFA384x_PORTTYPE_BSS; /* Set the PortType */ hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, port_type); Loading @@ -1065,7 +1058,6 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp) return result; } /*---------------------------------------------------------------- * prism2mgmt_wlansniff * Loading Loading @@ -1094,19 +1086,19 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) u16 word; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; switch (msg->enable.data) { switch (msg->enable.data) { case P80211ENUM_truth_false: /* Confirm that we're in monitor mode */ if (wlandev->netdev->type == ARPHRD_ETHER) { msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; result = 0; goto exit; } /* Disable monitor mode */ result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_DISABLE); if (result) { pr_debug( printk(KERN_DEBUG "failed to disable monitor mode, result=%d\n", result); goto failed; Loading @@ -1114,7 +1106,7 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Disable port 0 */ result = hfa384x_drvr_disable(hw, 0); if (result) { pr_debug( printk(KERN_DEBUG "failed to disable port 0 after sniffing, result=%d\n", result); goto failed; Loading @@ -1127,10 +1119,9 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) HFA384x_RID_CNFWEPFLAGS, hw->presniff_wepflags); if (result) { pr_debug( printk(KERN_DEBUG "failed to restore wepflags=0x%04x, result=%d\n", hw->presniff_wepflags, result); hw->presniff_wepflags, result); goto failed; } Loading @@ -1138,9 +1129,10 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) if (hw->presniff_port_type != 0) { word = hw->presniff_port_type; result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, word); HFA384x_RID_CNFPORTTYPE, word); if (result) { pr_debug( printk(KERN_DEBUG "failed to restore porttype, result=%d\n", result); goto failed; Loading @@ -1149,7 +1141,9 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Enable the port */ result = hfa384x_drvr_enable(hw, 0); if (result) { pr_debug("failed to enable port to presniff setting, result=%d\n", result); printk(KERN_DEBUG "failed to enable port to presniff setting, result=%d\n", result); goto failed; } } else { Loading @@ -1169,23 +1163,29 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Save macport 0 state */ result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_CNFPORTTYPE, &(hw->presniff_port_type)); &(hw-> presniff_port_type)); if (result) { pr_debug("failed to read porttype, result=%d\n", result); printk(KERN_DEBUG "failed to read porttype, result=%d\n", result); goto failed; } /* Save the wepflags state */ result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_CNFWEPFLAGS, &(hw->presniff_wepflags)); &(hw-> presniff_wepflags)); if (result) { pr_debug("failed to read wepflags, result=%d\n", result); printk(KERN_DEBUG "failed to read wepflags, result=%d\n", result); goto failed; } hfa384x_drvr_stop(hw); result = hfa384x_drvr_start(hw); if (result) { pr_debug( printk(KERN_DEBUG "failed to restart the card for sniffing, result=%d\n", result); goto failed; Loading @@ -1194,7 +1194,7 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Disable the port */ result = hfa384x_drvr_disable(hw, 0); if (result) { pr_debug( printk(KERN_DEBUG "failed to enable port for sniffing, result=%d\n", result); goto failed; Loading @@ -1207,14 +1207,14 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Set the channel we wish to sniff */ word = msg->channel.data; result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNCHANNEL, word); HFA384x_RID_CNFOWNCHANNEL, word); hw->sniff_channel = word; if (result) { pr_debug( printk(KERN_DEBUG "failed to set channel %d, result=%d\n", word, result); word, result); goto failed; } Loading @@ -1223,39 +1223,46 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Set the port type to pIbss */ word = HFA384x_PORTTYPE_PSUEDOIBSS; result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, word); HFA384x_RID_CNFPORTTYPE, word); if (result) { pr_debug( printk(KERN_DEBUG "failed to set porttype %d, result=%d\n", word, result); word, result); goto failed; } if ((msg->keepwepflags.status == P80211ENUM_msgitem_status_data_ok) && (msg->keepwepflags.data != P80211ENUM_truth_true)) { if ((msg->keepwepflags.status == P80211ENUM_msgitem_status_data_ok) && (msg->keepwepflags.data != P80211ENUM_truth_true)) { /* Set the wepflags for no decryption */ word = HFA384x_WEPFLAGS_DISABLE_TXCRYPT | HFA384x_WEPFLAGS_DISABLE_RXCRYPT; result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFWEPFLAGS, word); result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFWEPFLAGS, word); } if (result) { pr_debug( printk(KERN_DEBUG "failed to set wepflags=0x%04x, result=%d\n", word, result); word, result); goto failed; } } /* Do we want to strip the FCS in monitor mode? */ if ((msg->stripfcs.status == P80211ENUM_msgitem_status_data_ok) && (msg->stripfcs.data == P80211ENUM_truth_true)) { if ((msg->stripfcs.status == P80211ENUM_msgitem_status_data_ok) && (msg->stripfcs.data == P80211ENUM_truth_true)) { hw->sniff_fcs = 0; } else { hw->sniff_fcs = 1; } /* Do we want to truncate the packets? */ if (msg->packet_trunc.status == P80211ENUM_msgitem_status_data_ok) { if (msg->packet_trunc.status == P80211ENUM_msgitem_status_data_ok) { hw->sniff_truncate = msg->packet_trunc.data; } else { hw->sniff_truncate = 0; Loading @@ -1264,7 +1271,7 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Enable the port */ result = hfa384x_drvr_enable(hw, 0); if (result) { pr_debug( printk(KERN_DEBUG "failed to enable port for sniffing, result=%d\n", result); goto failed; Loading @@ -1272,22 +1279,26 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Enable monitor mode */ result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_ENABLE); if (result) { pr_debug( printk(KERN_DEBUG "failed to enable monitor mode, result=%d\n", result); goto failed; } if (wlandev->netdev->type == ARPHRD_ETHER) { if (wlandev->netdev->type == ARPHRD_ETHER) printk(KERN_INFO "monitor mode enabled\n"); } /* Set the driver state */ /* Do we want the prism2 header? */ if ((msg->prismheader.status == P80211ENUM_msgitem_status_data_ok) && (msg->prismheader.data == P80211ENUM_truth_true)) { if ((msg->prismheader.status == P80211ENUM_msgitem_status_data_ok) && (msg->prismheader.data == P80211ENUM_truth_true)) { hw->sniffhdr = 0; wlandev->netdev->type = ARPHRD_IEEE80211_PRISM; } else if ((msg->wlanheader.status == P80211ENUM_msgitem_status_data_ok) && (msg->wlanheader.data == P80211ENUM_truth_true)) { } else if ((msg->wlanheader.status == P80211ENUM_msgitem_status_data_ok) && (msg->wlanheader.data == P80211ENUM_truth_true)) { hw->sniffhdr = 1; wlandev->netdev->type = ARPHRD_IEEE80211_PRISM; } else { Loading Loading
drivers/staging/wlan-ng/prism2mgmt.c +387 −376 Original line number Diff line number Diff line Loading @@ -57,9 +57,6 @@ * -------------------------------------------------------------------- */ /*================================================================*/ /* System Includes */ #include <linux/if_arp.h> #include <linux/module.h> #include <linux/kernel.h> Loading Loading @@ -138,7 +135,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) hw->ident_sta_fw.minor, hw->ident_sta_fw.variant) < HFA384x_FIRMWARE_VERSION(1, 3, 2)) { printk(KERN_ERR "HostScan not supported with current firmware (<1.3.2).\n"); printk(KERN_ERR "HostScan not supported with current firmware (<1.3.2).\n"); result = 1; msg->resultcode.data = P80211ENUM_resultcode_not_supported; goto exit; Loading @@ -148,7 +146,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) /* save current roaming mode */ result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_CNFROAMINGMODE, &roamingmode); HFA384x_RID_CNFROAMINGMODE, &roamingmode); if (result) { printk(KERN_ERR "getconfig(ROAMMODE) failed. result=%d\n", result); Loading @@ -174,12 +173,14 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) hw->ident_sta_fw.minor, hw->ident_sta_fw.variant) > HFA384x_FIRMWARE_VERSION(1, 5, 0)) { if (msg->scantype.data != P80211ENUM_scantype_active) { if (msg->scantype.data != P80211ENUM_scantype_active) word = host2hfa384x_16(msg->maxchanneltime.data); } else { else word = 0; } result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPASSIVESCANCTRL, word); result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPASSIVESCANCTRL, word); if (result) { printk(KERN_WARNING "Passive scan not supported with " "current firmware. (<1.5.1)\n"); Loading @@ -194,7 +195,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) word = 0; for (i = 0; i < msg->channellist.data.len; i++) { u8 channel = msg->channellist.data.data[i]; if (channel > 14) continue; if (channel > 14) continue; /* channel 1 is BIT 0 ... channel 14 is BIT 13 */ word |= (1 << (channel - 1)); } Loading @@ -220,7 +222,9 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) HFA384x_RID_CNFROAMINGMODE, HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM); if (result) { printk(KERN_ERR "setconfig(ROAMINGMODE) failed. result=%d\n", result); printk(KERN_ERR "setconfig(ROAMINGMODE) failed. result=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; Loading @@ -231,7 +235,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) wordbuf[0] = host2hfa384x_16(WLAN_SSID_MAXLEN); get_random_bytes(&wordbuf[1], WLAN_SSID_MAXLEN); result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFOWNSSID, wordbuf, HFA384x_RID_CNFOWNSSID_LEN); wordbuf, HFA384x_RID_CNFOWNSSID_LEN); if (result) { printk(KERN_ERR "Failed to set OwnSSID.\n"); msg->resultcode.data = Loading @@ -239,7 +244,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) goto exit; } result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFDESIREDSSID, wordbuf, HFA384x_RID_CNFDESIREDSSID_LEN); wordbuf, HFA384x_RID_CNFDESIREDSSID_LEN); if (result) { printk(KERN_ERR "Failed to set DesiredSSID.\n"); msg->resultcode.data = Loading Loading @@ -338,7 +344,6 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) return result; } /*---------------------------------------------------------------- * prism2mgmt_scan_results * Loading Loading @@ -373,14 +378,16 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) req->resultcode.status = P80211ENUM_msgitem_status_data_ok; if (!hw->scanresults) { printk(KERN_ERR "dot11req_scan_results can only be used after a successful dot11req_scan.\n"); printk(KERN_ERR "dot11req_scan_results can only be used after a successful dot11req_scan.\n"); result = 2; req->resultcode.data = P80211ENUM_resultcode_invalid_parameters; goto exit; } count = (hw->scanresults->framelen - 3) / 32; if (count > 32) count = 32; if (count > 32) count = 32; if (req->bssindex.data >= count) { pr_debug("requested index (%d) out of range (%d)\n", Loading Loading @@ -478,17 +485,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) /* bsstype */ req->bsstype.status = P80211ENUM_msgitem_status_data_ok; req->bsstype.data = (WLAN_GET_MGMT_CAP_INFO_ESS(count)) ? P80211ENUM_bsstype_infrastructure : P80211ENUM_bsstype_independent; // item->proberesp_rate /* req->fhdwelltime req->fhhopset req->fhhoppattern req->fhhopindex req->cfpdurremaining */ P80211ENUM_bsstype_infrastructure : P80211ENUM_bsstype_independent; result = 0; req->resultcode.data = P80211ENUM_resultcode_success; Loading Loading @@ -558,7 +555,8 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) goto failed; } result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFDESIREDSSID, bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); if (result) { printk(KERN_ERR "Failed to set CnfDesiredSSID\n"); goto failed; Loading @@ -585,27 +583,27 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) } /* Basic rates */ word = p80211rate_to_p2bit(msg->basicrate1.data); if ( msg->basicrate2.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate2.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate2.data); } if ( msg->basicrate3.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate3.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate3.data); } if ( msg->basicrate4.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate4.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate4.data); } if ( msg->basicrate5.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate5.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate5.data); } if ( msg->basicrate6.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate6.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate6.data); } if ( msg->basicrate7.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate7.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate7.data); } if ( msg->basicrate8.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->basicrate8.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->basicrate8.data); } result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFBASICRATES, word); if (result) { printk(KERN_ERR "Failed to set basicrates=%d.\n", word); Loading @@ -614,27 +612,27 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) /* Operational rates (supprates and txratecontrol) */ word = p80211rate_to_p2bit(msg->operationalrate1.data); if ( msg->operationalrate2.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate2.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate2.data); } if ( msg->operationalrate3.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate3.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate3.data); } if ( msg->operationalrate4.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate4.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate4.data); } if ( msg->operationalrate5.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate5.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate5.data); } if ( msg->operationalrate6.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate6.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate6.data); } if ( msg->operationalrate7.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate7.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate7.data); } if ( msg->operationalrate8.status == P80211ENUM_msgitem_status_data_ok ) { if (msg->operationalrate8.status == P80211ENUM_msgitem_status_data_ok) word |= p80211rate_to_p2bit(msg->operationalrate8.data); } result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, word); if (result) { printk(KERN_ERR "Failed to set supprates=%d.\n", word); Loading Loading @@ -703,8 +701,7 @@ int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp) */ if (wlandev->msdstate != WLAN_MSD_FWLOAD) { printk(KERN_ERR "PDA may only be read " "in the fwload state.\n"); "PDA may only be read " "in the fwload state.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; Loading @@ -712,15 +709,13 @@ int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp) /* Call drvr_readpda(), it handles the auxport enable * and validating the returned PDA. */ result = hfa384x_drvr_readpda( hw, result = hfa384x_drvr_readpda(hw, msg->pda.data, HFA384x_PDA_LEN_MAX); if (result) { printk(KERN_ERR "hfa384x_drvr_readpda() failed, " "result=%d\n", result); "result=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; Loading Loading @@ -784,7 +779,8 @@ int prism2mgmt_ramdl_state(wlandevice_t *wlandev, void *msgp) msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; if (msg->enable.data == P80211ENUM_truth_true) { if (hfa384x_drvr_ramdl_enable(hw, msg->exeaddr.data)) { msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; } else { msg->resultcode.data = P80211ENUM_resultcode_success; } Loading @@ -796,7 +792,6 @@ int prism2mgmt_ramdl_state(wlandevice_t *wlandev, void *msgp) return 0; } /*---------------------------------------------------------------- * prism2mgmt_ramdl_write * Loading Loading @@ -838,23 +833,22 @@ int prism2mgmt_ramdl_write(wlandevice_t *wlandev, void *msgp) msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; /* first validate the length */ if (msg->len.data > sizeof(msg->data.data)) { msg->resultcode.status = P80211ENUM_resultcode_invalid_parameters; msg->resultcode.status = P80211ENUM_resultcode_invalid_parameters; return 0; } /* call the hfa384x function to do the write */ addr = msg->addr.data; len = msg->len.data; buf = msg->data.data; if ( hfa384x_drvr_ramdl_write(hw, addr, buf, len) ) { if (hfa384x_drvr_ramdl_write(hw, addr, buf, len)) msg->resultcode.data = P80211ENUM_resultcode_refused; } msg->resultcode.data = P80211ENUM_resultcode_success; return 0; } /*---------------------------------------------------------------- * prism2mgmt_flashdl_state * Loading Loading @@ -904,7 +898,8 @@ int prism2mgmt_flashdl_state(wlandevice_t *wlandev, void *msgp) msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; if (msg->enable.data == P80211ENUM_truth_true) { if (hfa384x_drvr_flashdl_enable(hw)) { msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; } else { msg->resultcode.data = P80211ENUM_resultcode_success; } Loading Loading @@ -932,7 +927,6 @@ int prism2mgmt_flashdl_state(wlandevice_t *wlandev, void *msgp) return 0; } /*---------------------------------------------------------------- * prism2mgmt_flashdl_write * Loading Loading @@ -985,10 +979,9 @@ int prism2mgmt_flashdl_write(wlandevice_t *wlandev, void *msgp) addr = msg->addr.data; len = msg->len.data; buf = msg->data.data; if ( hfa384x_drvr_flashdl_write(hw, addr, buf, len) ) { if (hfa384x_drvr_flashdl_write(hw, addr, buf, len)) msg->resultcode.data = P80211ENUM_resultcode_refused; } msg->resultcode.data = P80211ENUM_resultcode_success; return 0; Loading Loading @@ -1037,20 +1030,20 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp) hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, 0x000f); /* Set the auth type */ if ( msg->authtype.data == P80211ENUM_authalg_sharedkey ) { if (msg->authtype.data == P80211ENUM_authalg_sharedkey) reg = HFA384x_CNFAUTHENTICATION_SHAREDKEY; } else { else reg = HFA384x_CNFAUTHENTICATION_OPENSYSTEM; } hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAUTHENTICATION, reg); /* Set the ssid */ memset(bytebuf, 0, 256); pstr = (p80211pstrd_t *)&(msg->ssid.data); prism2mgmt_pstr2bytestr(p2bytestr, pstr); result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFDESIREDSSID, bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFDESIREDSSID, bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); port_type = HFA384x_PORTTYPE_BSS; /* Set the PortType */ hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, port_type); Loading @@ -1065,7 +1058,6 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp) return result; } /*---------------------------------------------------------------- * prism2mgmt_wlansniff * Loading Loading @@ -1094,19 +1086,19 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) u16 word; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; switch (msg->enable.data) { switch (msg->enable.data) { case P80211ENUM_truth_false: /* Confirm that we're in monitor mode */ if (wlandev->netdev->type == ARPHRD_ETHER) { msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; result = 0; goto exit; } /* Disable monitor mode */ result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_DISABLE); if (result) { pr_debug( printk(KERN_DEBUG "failed to disable monitor mode, result=%d\n", result); goto failed; Loading @@ -1114,7 +1106,7 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Disable port 0 */ result = hfa384x_drvr_disable(hw, 0); if (result) { pr_debug( printk(KERN_DEBUG "failed to disable port 0 after sniffing, result=%d\n", result); goto failed; Loading @@ -1127,10 +1119,9 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) HFA384x_RID_CNFWEPFLAGS, hw->presniff_wepflags); if (result) { pr_debug( printk(KERN_DEBUG "failed to restore wepflags=0x%04x, result=%d\n", hw->presniff_wepflags, result); hw->presniff_wepflags, result); goto failed; } Loading @@ -1138,9 +1129,10 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) if (hw->presniff_port_type != 0) { word = hw->presniff_port_type; result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, word); HFA384x_RID_CNFPORTTYPE, word); if (result) { pr_debug( printk(KERN_DEBUG "failed to restore porttype, result=%d\n", result); goto failed; Loading @@ -1149,7 +1141,9 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Enable the port */ result = hfa384x_drvr_enable(hw, 0); if (result) { pr_debug("failed to enable port to presniff setting, result=%d\n", result); printk(KERN_DEBUG "failed to enable port to presniff setting, result=%d\n", result); goto failed; } } else { Loading @@ -1169,23 +1163,29 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Save macport 0 state */ result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_CNFPORTTYPE, &(hw->presniff_port_type)); &(hw-> presniff_port_type)); if (result) { pr_debug("failed to read porttype, result=%d\n", result); printk(KERN_DEBUG "failed to read porttype, result=%d\n", result); goto failed; } /* Save the wepflags state */ result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_CNFWEPFLAGS, &(hw->presniff_wepflags)); &(hw-> presniff_wepflags)); if (result) { pr_debug("failed to read wepflags, result=%d\n", result); printk(KERN_DEBUG "failed to read wepflags, result=%d\n", result); goto failed; } hfa384x_drvr_stop(hw); result = hfa384x_drvr_start(hw); if (result) { pr_debug( printk(KERN_DEBUG "failed to restart the card for sniffing, result=%d\n", result); goto failed; Loading @@ -1194,7 +1194,7 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Disable the port */ result = hfa384x_drvr_disable(hw, 0); if (result) { pr_debug( printk(KERN_DEBUG "failed to enable port for sniffing, result=%d\n", result); goto failed; Loading @@ -1207,14 +1207,14 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Set the channel we wish to sniff */ word = msg->channel.data; result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNCHANNEL, word); HFA384x_RID_CNFOWNCHANNEL, word); hw->sniff_channel = word; if (result) { pr_debug( printk(KERN_DEBUG "failed to set channel %d, result=%d\n", word, result); word, result); goto failed; } Loading @@ -1223,39 +1223,46 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Set the port type to pIbss */ word = HFA384x_PORTTYPE_PSUEDOIBSS; result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, word); HFA384x_RID_CNFPORTTYPE, word); if (result) { pr_debug( printk(KERN_DEBUG "failed to set porttype %d, result=%d\n", word, result); word, result); goto failed; } if ((msg->keepwepflags.status == P80211ENUM_msgitem_status_data_ok) && (msg->keepwepflags.data != P80211ENUM_truth_true)) { if ((msg->keepwepflags.status == P80211ENUM_msgitem_status_data_ok) && (msg->keepwepflags.data != P80211ENUM_truth_true)) { /* Set the wepflags for no decryption */ word = HFA384x_WEPFLAGS_DISABLE_TXCRYPT | HFA384x_WEPFLAGS_DISABLE_RXCRYPT; result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFWEPFLAGS, word); result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFWEPFLAGS, word); } if (result) { pr_debug( printk(KERN_DEBUG "failed to set wepflags=0x%04x, result=%d\n", word, result); word, result); goto failed; } } /* Do we want to strip the FCS in monitor mode? */ if ((msg->stripfcs.status == P80211ENUM_msgitem_status_data_ok) && (msg->stripfcs.data == P80211ENUM_truth_true)) { if ((msg->stripfcs.status == P80211ENUM_msgitem_status_data_ok) && (msg->stripfcs.data == P80211ENUM_truth_true)) { hw->sniff_fcs = 0; } else { hw->sniff_fcs = 1; } /* Do we want to truncate the packets? */ if (msg->packet_trunc.status == P80211ENUM_msgitem_status_data_ok) { if (msg->packet_trunc.status == P80211ENUM_msgitem_status_data_ok) { hw->sniff_truncate = msg->packet_trunc.data; } else { hw->sniff_truncate = 0; Loading @@ -1264,7 +1271,7 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Enable the port */ result = hfa384x_drvr_enable(hw, 0); if (result) { pr_debug( printk(KERN_DEBUG "failed to enable port for sniffing, result=%d\n", result); goto failed; Loading @@ -1272,22 +1279,26 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) /* Enable monitor mode */ result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_ENABLE); if (result) { pr_debug( printk(KERN_DEBUG "failed to enable monitor mode, result=%d\n", result); goto failed; } if (wlandev->netdev->type == ARPHRD_ETHER) { if (wlandev->netdev->type == ARPHRD_ETHER) printk(KERN_INFO "monitor mode enabled\n"); } /* Set the driver state */ /* Do we want the prism2 header? */ if ((msg->prismheader.status == P80211ENUM_msgitem_status_data_ok) && (msg->prismheader.data == P80211ENUM_truth_true)) { if ((msg->prismheader.status == P80211ENUM_msgitem_status_data_ok) && (msg->prismheader.data == P80211ENUM_truth_true)) { hw->sniffhdr = 0; wlandev->netdev->type = ARPHRD_IEEE80211_PRISM; } else if ((msg->wlanheader.status == P80211ENUM_msgitem_status_data_ok) && (msg->wlanheader.data == P80211ENUM_truth_true)) { } else if ((msg->wlanheader.status == P80211ENUM_msgitem_status_data_ok) && (msg->wlanheader.data == P80211ENUM_truth_true)) { hw->sniffhdr = 1; wlandev->netdev->type = ARPHRD_IEEE80211_PRISM; } else { Loading