aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2003-07-12 15:20:47 (GMT)
committerJouni Malinen <j@w1.fi>2003-07-12 15:20:47 (GMT)
commiteceec7d303e38301df246277ea675f90b3adc1e4 (patch)
treee5e69a7ea538297d173ff2cb7456dc72551c597d
parentbd20ece5eb96d8d4e0682a0a98ccf203ad31cb97 (diff)
downloadhostap-history-eceec7d303e38301df246277ea675f90b3adc1e4.zip
hostap-history-eceec7d303e38301df246277ea675f90b3adc1e4.tar.gz
hostap-history-eceec7d303e38301df246277ea675f90b3adc1e4.tar.bz2
Added support for manual scan and roaming mode (managed/ad-hoc);
prism2_param host_roaming 2; this disabled automatic IEEE 802.11 scans and gives more control to user space programs using Linux wireless extensions.
-rw-r--r--ChangeLog5
-rw-r--r--README65
-rw-r--r--driver/modules/hostap.c22
-rw-r--r--driver/modules/hostap.h1
-rw-r--r--driver/modules/hostap_hw.c4
-rw-r--r--driver/modules/hostap_info.c2
-rw-r--r--driver/modules/hostap_ioctl.c55
-rwxr-xr-xutils/prism2_param3
8 files changed, 144 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index d56e721..a723682 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,11 @@ ChangeLog for Host AP driver for Intersil Prism2/2.5/3
2 = shared key (requires WEP), 3 = both, default)
(ap_auth_algs was previously used only in AP/Master mode, but it is
now also used for STA mode configuration)
+ * added support for manual scan and roaming mode (managed/ad-hoc);
+ prism2_param host_roaming 2; this disabled automatic IEEE 802.11
+ scans and gives more control to user space programs using Linux
+ wireless extensions (see 'Roaming in station mode' section in
+ README file for more information)
2003-05-18 - v0.0.3
* redesigned RADIUS client implementation
diff --git a/README b/README
index 0dc6010..b0ded5a 100644
--- a/README
+++ b/README
@@ -334,7 +334,8 @@ parameter:
(only used with hostap_pci.o and if PRISM2_BUS_MASTER is set)
host_roaming:
0 = use station firmware for roaming decision (default)
- 1 = use host driver roaming decision
+ 1 = use host driver roaming decision (automatic scan)
+ 2 = manual scan and roaming
bcrx_sta_key:
0 = use station specific key (WEP key mapping) to override
default keys only for RX frames sent to unicast address
@@ -935,3 +936,65 @@ WEP keys can be automatically updated by configuring rekeying. This
will improve security of the network since same WEP key will only be
used for a limited period of time. wep_rekey_period option sets the
interval for rekeying in seconds.
+
+
+Roaming in station mode
+=======================
+
+Host AP driver supports three different modes for roaming in station
+modes (Managed/Ad-hoc). These are configured with prism2_param
+host_roaming.
+
+Firmware-based roaming (mode 0; default)
+----------------------
+
+Station firmware decides when to scan channels for APs and which AP to
+use. Host AP driver only configured SSID and possible WEP keys, but
+does not control AP selection in any other ways.
+
+Host-based roaming (mode 1)
+------------------
+
+Station firmware decides when to scan channels for APs and informs
+Host AP driver about scan results. Host AP driver will then select
+which AP to use. Current version of the selection code is quite
+simple, the driver just selects the first entry in the list of APs
+(which should be sorted by signal quality). In addition, this mode
+allows user to specify preferred AP with 'iwconfig wlan0 ap
+<bssid>'. This preferred AP will be used if it is in the list of scan
+results. User will also need to set SSID.
+
+Manual scan and roaming (mode 2)
+-----------------------
+
+Both scanning and AP selection are left to user; neither firmware nor
+Host AP driver initialize scanning automatically. User space programs
+can use Linux wireless extensions to initialize scanning and joining
+an AP. Active IEEE 802.11 scanning is not required; any other external
+mean can be used to get knowledge about the AP configuration.
+
+Example commands:
+
+# enable manual scan and roaming in managed (infra/BSS) mode
+iwpriv wlan0 host_roaming 2
+iwconfig wlan0 mode managed
+
+# scan channels; set broadcast SSID ('Any') to accept all SSIDs in scan
+# results. Optionally, could also set WEP keys, if needed.
+iwconfig wlan0 essid any
+iwlist wlan0 scan
+
+# Select AP with SSID foobar and BSSID 00:11:22:33:44:55
+iwconfig wlan0 essid foobar
+iwconfig wlan0 ap 00:11:22:33:44:55
+
+Note: both SSID and BSSID must be set in order to make association
+work. Setting BSSID with 'ap' command must be done after SSID is set
+since this commands triggers join request for Prism2 firmware.
+
+Note: scanning is limited to current SSID. If information about other
+APs is required, SSID must be set to 'Any'. However, this will remove
+current association. Alternatively, host scan command, 'iwpriv wlan0
+hostscan 1', can be used without breaking the connection. This command
+requires STA f/w version 1.3.1 or newer. In addition, current version
+of the driver shows hostscan results only in the kernel log ('dmesg').
diff --git a/driver/modules/hostap.c b/driver/modules/hostap.c
index 8c067d0..49a5ab1 100644
--- a/driver/modules/hostap.c
+++ b/driver/modules/hostap.c
@@ -490,6 +490,27 @@ int hostap_set_antsel(local_info_t *local)
}
+int hostap_set_roaming(local_info_t *local)
+{
+ u16 val;
+
+ switch (local->host_roaming) {
+ case 1:
+ val = HFA384X_ROAMING_HOST;
+ break;
+ case 2:
+ val = HFA384X_ROAMING_DISABLED;
+ break;
+ case 0:
+ default:
+ val = HFA384X_ROAMING_FIRMWARE;
+ break;
+ }
+
+ return hostap_set_word(local->dev, HFA384X_RID_CNFROAMINGMODE, val);
+}
+
+
void hostap_dump_rx_header(const char *name, const struct hfa384x_rx_frame *rx)
{
u16 status, fc;
@@ -1028,6 +1049,7 @@ EXPORT_SYMBOL(hostap_set_string);
EXPORT_SYMBOL(hostap_get_porttype);
EXPORT_SYMBOL(hostap_set_encryption);
EXPORT_SYMBOL(hostap_set_antsel);
+EXPORT_SYMBOL(hostap_set_roaming);
EXPORT_SYMBOL(hostap_dump_rx_header);
EXPORT_SYMBOL(hostap_dump_tx_header);
EXPORT_SYMBOL(hostap_netif_wake_queues);
diff --git a/driver/modules/hostap.h b/driver/modules/hostap.h
index 17e7e2f..764dd8b 100644
--- a/driver/modules/hostap.h
+++ b/driver/modules/hostap.h
@@ -14,6 +14,7 @@ int hostap_set_string(struct net_device *dev, int rid, const char *val);
u16 hostap_get_porttype(local_info_t *local);
int hostap_set_encryption(local_info_t *local);
int hostap_set_antsel(local_info_t *local);
+int hostap_set_roaming(local_info_t *local);
void hostap_dump_rx_header(const char *name,
const struct hfa384x_rx_frame *rx);
void hostap_dump_tx_header(const char *name,
diff --git a/driver/modules/hostap_hw.c b/driver/modules/hostap_hw.c
index d40e4a1..8de3123 100644
--- a/driver/modules/hostap_hw.c
+++ b/driver/modules/hostap_hw.c
@@ -998,9 +998,7 @@ static int prism2_setup_rids(struct net_device *dev)
(void) hostap_set_antsel(local);
- if (local->host_roaming &&
- hostap_set_word(dev, HFA384X_RID_CNFROAMINGMODE,
- HFA384X_ROAMING_HOST)) {
+ if (hostap_set_roaming(local)) {
printk(KERN_INFO "%s: could not set host roaming\n",
dev->name);
}
diff --git a/driver/modules/hostap_info.c b/driver/modules/hostap_info.c
index 5c7133e..40db2a3 100644
--- a/driver/modules/hostap_info.c
+++ b/driver/modules/hostap_info.c
@@ -395,7 +395,7 @@ static void handle_info_queue_linkstatus(local_info_t *local)
static void handle_info_queue_scanresults(local_info_t *local)
{
- if (local->host_roaming && local->iw_mode == IW_MODE_INFRA)
+ if (local->host_roaming == 1 && local->iw_mode == IW_MODE_INFRA)
prism2_host_roaming(local);
#if WIRELESS_EXT > 13
diff --git a/driver/modules/hostap_ioctl.c b/driver/modules/hostap_ioctl.c
index 715b241..bf378f1 100644
--- a/driver/modules/hostap_ioctl.c
+++ b/driver/modules/hostap_ioctl.c
@@ -599,6 +599,44 @@ static int prism2_ioctl_giwfrag(struct net_device *dev,
}
+static int hostap_join_ap(struct net_device *dev)
+{
+ local_info_t *local = (local_info_t *) dev->priv;
+ struct hfa384x_join_request req;
+ unsigned long flags;
+ int i;
+ struct hfa384x_scan_result *entry;
+
+ memcpy(req.bssid, local->preferred_ap, ETH_ALEN);
+ req.channel = 0;
+
+ spin_lock_irqsave(&local->lock, flags);
+ for (i = 0; i < local->last_scan_results_count; i++) {
+ if (!local->last_scan_results)
+ break;
+ entry = &local->last_scan_results[i];
+ if (memcmp(local->preferred_ap, entry->bssid, ETH_ALEN) == 0) {
+ req.channel = entry->chid;
+ break;
+ }
+ }
+ spin_unlock_irqrestore(&local->lock, flags);
+
+ if (local->func->set_rid(dev, HFA384X_RID_JOINREQUEST, &req,
+ sizeof(req))) {
+ printk(KERN_DEBUG "%s: JoinRequest " MACSTR
+ " failed\n",
+ dev->name, MAC2STR(local->preferred_ap));
+ return -1;
+ }
+
+ printk(KERN_DEBUG "%s: Trying to join BSSID " MACSTR "\n",
+ dev->name, MAC2STR(local->preferred_ap));
+
+ return 0;
+}
+
+
static int prism2_ioctl_siwap(struct net_device *dev,
struct iw_request_info *info,
struct sockaddr *ap_addr, char *extra)
@@ -610,7 +648,7 @@ static int prism2_ioctl_siwap(struct net_device *dev,
memcpy(local->preferred_ap, &ap_addr->sa_data, ETH_ALEN);
- if (local->host_roaming && local->iw_mode == IW_MODE_INFRA) {
+ if (local->host_roaming == 1 && local->iw_mode == IW_MODE_INFRA) {
struct hfa384x_scan_request scan_req;
memset(&scan_req, 0, sizeof(scan_req));
scan_req.channel_list = __constant_cpu_to_le16(0x3fff);
@@ -621,6 +659,10 @@ static int prism2_ioctl_siwap(struct net_device *dev,
"preferred AP delayed to next unsolicited "
"scan\n", dev->name);
}
+ } else if (local->host_roaming == 2 &&
+ local->iw_mode == IW_MODE_INFRA) {
+ if (hostap_join_ap(dev))
+ return -EINVAL;
} else {
printk(KERN_DEBUG "%s: Preferred AP (SIOCSIWAP) is used only "
"in Managed mode when host_roaming is enabled\n",
@@ -2127,14 +2169,13 @@ static int prism2_ioctl_priv_prism2_param(struct net_device *dev,
#ifndef PRISM2_NO_STATION_MODES
case PRISM2_PARAM_HOST_ROAMING:
+ if (value < 0 || value > 2) {
+ ret = -EINVAL;
+ break;
+ }
local->host_roaming = value;
- if (hostap_set_word(dev, HFA384X_RID_CNFROAMINGMODE,
- value ? HFA384X_ROAMING_HOST :
- HFA384X_ROAMING_FIRMWARE) ||
- local->func->reset_port(dev))
+ if (hostap_set_roaming(local) || local->func->reset_port(dev))
ret = -EINVAL;
- else
- local->host_roaming = value;
break;
#endif /* PRISM2_NO_STATION_MODES */
diff --git a/utils/prism2_param b/utils/prism2_param
index 46fe2a6..1ba0da5 100755
--- a/utils/prism2_param
+++ b/utils/prism2_param
@@ -78,7 +78,8 @@ parameter:
(only used with hostap_pci.o and if PRISM2_BUS_MASTER is set)
host_roaming:
0 = use station firmware for roaming decision (default)
- 1 = use host driver roaming decision
+ 1 = use host driver roaming decision (automatic scan)
+ 2 = manual scan and roaming
bcrx_sta_key:
0 = use station specific key (WEP key mapping) to override
default keys only for RX frames sent to unicast address