diff --git a/CHANGES b/CHANGES index b692f64..28c59d2 100644 --- a/CHANGES +++ b/CHANGES @@ -41,7 +41,7 @@ * Intersil Corporation as part of PRISM(R) chipset product development. * * -------------------------------------------------------------------- - - Refactored the common code in the pcmcia/rc/hotplug scripts. + - Complete rewrite of the configuration files and startup scripts. - Fix the TMD7160/ncp130 support so it acually works. :) - Make the BUG() call in cmd_access enabled only in debug builds. - Minor makefile fixes. diff --git a/etc/Makefile b/etc/Makefile index b6e773c..e8db728 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -73,13 +73,6 @@ ifeq ($(INSTFIXED), y) fi; \ cp rc.wlan $(TARGET_ROOT_ON_HOST)$(RC_DIR)/init.d/wlan; \ chmod 755 $(TARGET_ROOT_ON_HOST)$(RC_DIR)/init.d/wlan ;\ - if [ ! -f $(TARGET_ROOT_ON_HOST)/etc/wlan.conf ]; then \ - if [ ! -d $(TARGET_ROOT_ON_HOST)/etc ]; then \ - mkdir -p $(TARGET_ROOT_ON_HOST)/etc; \ - fi; \ - cp wlan.conf $(TARGET_ROOT_ON_HOST)/etc && \ - chmod 700 $(TARGET_ROOT_ON_HOST)/etc/wlan.conf; \ - fi; if [ -d $(TARGET_ROOT_ON_HOST)/etc/hotplug ]; then \ mkdir -p $(TARGET_ROOT_ON_HOST)/etc/hotplug/usb; \ mkdir -p $(TARGET_ROOT_ON_HOST)/etc/hotplug/pci; \ diff --git a/etc/pcmcia/wlan-ng b/etc/pcmcia/wlan-ng index 5ad6223..af8b900 100755 --- a/etc/pcmcia/wlan-ng +++ b/etc/pcmcia/wlan-ng @@ -81,13 +81,8 @@ if [ $# -lt 2 ]; then wlan_usage ; fi # ACTION=$1 and DEVICE=$2 are assigned in pcmcia/shared if [ -f /etc/pcmcia/shared ] ; then . /etc/pcmcia/shared ; fi -# Get device attributes -get_info $DEVICE -HWADDR=`/sbin/ifconfig $DEVICE | sed -ne 's/.*\(..:..:..:..:..:..\).*/\1/p'` - -# Load site-specific settings -ADDRESS="$SCHEME,$SOCKET,$INSTANCE,$HWADDR" -. $0.opts +# XXXX we can do stuff with $SCHEME still..? +wlan_source_config $DEVICE case "$ACTION" in @@ -131,15 +126,10 @@ case "$ACTION" in ;; 'stop'|'suspend') - if is_true $IS_ADHOC; then - WLAN_SCHEMESSID="$SSID" - else - WLAN_SCHEMESSID="$DesiredSSID" - fi # ==========PCMCIA NETDEVICE============================= # Append the SSID to the pcmcia scheme name - wlan_set_ssid_schemefile "$WLAN_SCHEMESSID" + wlan_set_ssid_schemefile "$DesiredSSID" # Call the normal network initialization ./network $1 $2 diff --git a/etc/pcmcia/wlan-ng.opts b/etc/pcmcia/wlan-ng.opts deleted file mode 100755 index 5f25ea7..0000000 --- a/etc/pcmcia/wlan-ng.opts +++ /dev/null @@ -1,119 +0,0 @@ -#! /bin/sh -# Wireless LAN adapter configuration -# -# etc/pcmcia/wlan-ng.opts -# -# Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. -# -------------------------------------------------------------------- -# -# linux-wlan -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# Alternatively, the contents of this file may be used under the -# terms of the GNU Public License version 2 (the "GPL"), in which -# case the provisions of the GPL are applicable instead of the -# above. If you wish to allow the use of your version of this file -# only under the terms of the GPL and not to allow others to use -# your version of this file under the MPL, indicate your decision -# by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL. If you do not delete -# the provisions above, a recipient may use your version of this -# file under either the MPL or the GPL. -# -# -------------------------------------------------------------------- -# -# Inquiries regarding the linux-wlan Open Source project can be -# made directly to: -# -# AbsoluteValue Systems Inc. -# info@linux-wlan.com -# http://www.linux-wlan.com -# -# -------------------------------------------------------------------- -# -# Portions of the development of this software were funded by -# Intersil Corporation as part of PRISM(R) chipset product development. -# -# -------------------------------------------------------------------- -# -# The address format is "scheme,socket,instance,hwaddr". -# -# -------------------------------------------------------------------- - -WLAN_VERSION= -WLAN_PATCHLEVEL= -WLAN_SUBLEVEL= -WLAN_EXTRAVERSION= - -case "$ADDRESS" in -wlannoenable,*,*,*) - #=======ENABLE======================================== - # Do we want to enable the card at all? Set to 'n' if you don't - # want the card initialized for normal operation. Helpful for - # (re)loading flash or for test purposes. - WLAN_ENABLE=n -;; -*,*,*,*) - #=======ENABLE======================================== - # Do we want to enable the card at all? Set to 'n' if you don't - # want the card initialized for normal operation. Helpful for - # (re)loading flash or for test purposes. - WLAN_ENABLE=y - - #=======USER MIB SETTINGS============================= - # You can add the assignments for various MIB items - # of your choosing to this variable, separated by - # whitespace. The wlan-ng script will then set each one. - # Just uncomment the variable and set the assignments - # the way you want them. - - #USER_MIBS="p2CnfRoamingMode=1 p2CnfShortPreamble=mixed" - - #=======WEP=========================================== - # [Dis/En]able WEP. Settings only matter if PrivacyInvoked is true - lnxreq_hostWEPEncrypt=false # true|false - lnxreq_hostWEPDecrypt=false # true|false - dot11PrivacyInvoked=false # true|false - dot11WEPDefaultKeyID=0 # 0|1|2|3 - dot11ExcludeUnencrypted=true # true|false, in AP this means WEP - # is required for all STAs - - # If PRIV_GENSTR is not empty, use PRIV_GENTSTR to generate - # keys (just a convenience) - PRIV_GENERATOR=/sbin/nwepgen # nwepgen, Neesus compatible - PRIV_KEY128=false # keylength to generate - PRIV_GENSTR="" - - # or set them explicitly. Set genstr or keys, not both. - dot11WEPDefaultKey0= # format: xx:xx:xx:xx:xx or - dot11WEPDefaultKey1= # xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx - dot11WEPDefaultKey2= # e.g. 01:20:03:40:05 or - dot11WEPDefaultKey3= # 01:02:03:04:05:06:07:08:09:0a:0b:0c:0d - - #=======SELECT STATION MODE=================== - IS_ADHOC=n # y|n, y - adhoc, n - infrastructure - - #=======INFRASTRUCTURE STATION START=================== - # SSID is all we have for now - AuthType="opensystem" # opensystem | sharedkey (requires WEP) - # Use DesiredSSID="" to associate with any AP in range - DesiredSSID="linux-wlan" - - #=======ADHOC STATION START============================ - SSID="linux-wlan" # SSID - BCNINT=100 # Beacon interval (in Kus) - CHANNEL=6 # DS channel for BSS (1-14, depends - # on regulatory domain) - BASICRATES="2 4" # Rates for mgmt&ctl frames (in 500Kb/s) - OPRATES="2 4 11 22" # Supported rates in BSS (in 500Kb/s) - ;; -esac diff --git a/etc/rc.wlan b/etc/rc.wlan index 2d9df6f..02077b5 100755 --- a/etc/rc.wlan +++ b/etc/rc.wlan @@ -36,7 +36,7 @@ start) # the kernel module autoload stuff will take over. for i in $WLAN_DEVICES; do - wlandevice_config $i + wlan_source_config $i #=======ENABLE======================================== # Do we want to init the card at all? diff --git a/etc/wlan.hotplug b/etc/wlan.hotplug index c945e1a..f9f5ca9 100755 --- a/etc/wlan.hotplug +++ b/etc/wlan.hotplug @@ -20,7 +20,8 @@ WLAN_DEVICES="wlan8 wlan7 wlan6 wlan5 wlan4 wlan3 wlan2 wlan1 wlan0" for i in $WLAN_DEVICES ; do result = `$WLANCTL $i dot11req_mibget mibattribute=p80211_ifstate` if [ $result = 0 ] ; then - wlandevice_config $i + + wlan_source_config $i #=======ENABLE======================================== # Do we want to init the card at all? diff --git a/etc/wlan/Makefile b/etc/wlan/Makefile index 6a161ed..835f619 100644 --- a/etc/wlan/Makefile +++ b/etc/wlan/Makefile @@ -49,8 +49,10 @@ all: clean: echo "Nothing to do" - + install: mkdir -p $(TARGET_ROOT_ON_HOST)/etc/wlan - cp shared $(TARGET_ROOT_ON_HOST)/etc/wlan/shared + cp shared wlan.conf wlancfg-DEFAULT wlancfg-wlannoenable \ + $(TARGET_ROOT_ON_HOST)/etc/wlan/shared + diff --git a/etc/wlan/shared b/etc/wlan/shared index 3bf82ca..fbda76f 100644 --- a/etc/wlan/shared +++ b/etc/wlan/shared @@ -50,10 +50,10 @@ else fi # Source the wlan configuration -if [ -f /etc/wlan.conf ] ; then - . /etc/wlan.conf +if [ -f /etc/wlan/wlan.conf ] ; then + . /etc/wlan/wlan.conf else - echo "/etc/wlan.conf not found." + echo "/etc/wlan/wlan.conf not found." exit 0 fi @@ -91,6 +91,24 @@ wlan_enable () done } +wlan_source_config () +{ +# $1 == wlandev $2 == ssid $3 == bssid + + eval "GOSSID=SSID_$1" + if [ $GOSSID = "" ] ; then + echo "SSID_$1 not set in /etc/wlan/wlan.conf. Using default." + GOSSID=DEFAULT + fi + + if [ -f "/etc/wlan/wlancfg-$GOSSID" ] ; then + . "/etc/wlan/wlancfg-$GOSSID" + else + echo "Failed to open network config file /etc/wlan/wlancfg-$GOSSID, using default." + . "/etc/wlan/wlancfg-DEFAULT" + fi +} + wlan_disable () { $WLANCTL $1 lnxreq_ifstate ifstate=disable @@ -195,7 +213,7 @@ wlan_adhoc () { #=======IBSS STARTUP================================== startcmd="$WLANCTL $1 dot11req_start " - startcmd="$startcmd ssid=$SSID" + startcmd="$startcmd ssid=$DesiredSSID" startcmd="$startcmd bsstype=independent" startcmd="$startcmd beaconperiod=$BCNINT" startcmd="$startcmd dtimperiod=3" @@ -230,7 +248,7 @@ wlan_adhoc () echo FAILED: $startcmd exit 1 fi - WLAN_SCHEMESSID="$SSID" + WLAN_SCHEMESSID="$DesiredSSID" } wlan_infra () @@ -246,6 +264,8 @@ wlan_infra () exit 1; fi fi + + WLAN_SCHEMESSID="$DesiredSSID" } wlan_set_ssid_schemefile () diff --git a/etc/wlan.conf b/etc/wlan/wlan.conf old mode 100755 new mode 100644 similarity index 50% rename from etc/wlan.conf rename to etc/wlan/wlan.conf index 776d0c3..a825838 --- a/etc/wlan.conf +++ b/etc/wlan/wlan.conf @@ -1,7 +1,7 @@ #! /bin/sh # Wireless LAN adapter configuration # -# etc/wlan.conf +# etc/wlan/wlan.conf # # Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. # -------------------------------------------------------------------- @@ -55,63 +55,7 @@ # setup for each device, just add an appropriate case section. WLAN_DEVICES="wlan0" -wlandevice_config() -{ -case "$1" in -*) - #=======ENABLE======================================== - # Do we want to enable the card at all? Set to 'n' if you don't - # want the card initialized for normal operation. Helpful for - # (re)loading flash or for test purposes. - WLAN_ENABLE=y - - #=======USER MIB SETTINGS============================= - # You can add the assignments for various MIB items - # of your choosing to this variable, separated by - # whitespace. The wlan-ng script will then set each one. - # Just uncomment the variable and set the assignments - # the way you want them. - - #USER_MIBS="p2CnfRoamingMode=1 p2CnfShortPreamble=mixed" - - #=======WEP=========================================== - # [Dis/En]able WEP. Settings only matter if PrivacyInvoked is true - lnxreq_hostWEPEncrypt=false # true|false - lnxreq_hostWEPDecrypt=false # true|false - dot11PrivacyInvoked=false # true|false - dot11WEPDefaultKeyID=0 # 0|1|2|3 - dot11ExcludeUnencrypted=true # true|false, in AP this means WEP - # is required for all STAs - - # If PRIV_GENSTR is not empty, use PRIV_GENTSTR to generate - # keys (just a convenience) - PRIV_GENERATOR=/sbin/nwepgen # nwepgen, Neesus compatible - PRIV_KEY128=false # keylength to generate - PRIV_GENSTR="" - - # or set them explicitly. Set genstr or keys, not both. - dot11WEPDefaultKey0= # format: xx:xx:xx:xx:xx or - dot11WEPDefaultKey1= # xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx - dot11WEPDefaultKey2= # e.g. 01:20:03:40:05 or - dot11WEPDefaultKey3= # 01:02:03:04:05:06:07:08:09:0a:0b:0c:0d - - #=======SELECT STATION MODE=================== - IS_ADHOC=n # y|n, y - adhoc, n - infrastructure - - #=======INFRASTRUCTURE STATION START=================== - # SSID is all we have for now - AuthType="opensystem" # opensystem | sharedkey (requires WEP) - # Use DesiredSSID="" to associate with any AP in range - DesiredSSID="linux-wlan" - - #=======ADHOC STATION START============================ - SSID="linux-wlan" # SSID - BCNINT=100 # Beacon interval (in Kus) - CHANNEL=6 # DS channel for BSS (1-14, depends - # on regulatory domain) - BASICRATES="2 4" # Rates for mgmt&ctl frames (in 500Kb/s) - OPRATES="2 4 11 22" # Supported rates in BSS (in 500Kb/s) - ;; -esac -} +SSID_wlan0="linux-wlan" +#SSID_wlan1="" +#SSID_wlan2="" diff --git a/etc/wlan/wlancfg-DEFAULT b/etc/wlan/wlancfg-DEFAULT new file mode 100644 index 0000000..edb67cb --- /dev/null +++ b/etc/wlan/wlancfg-DEFAULT @@ -0,0 +1,52 @@ +#=======ENABLE======================================== +# Do we want to enable the card at all? Set to 'n' if you don't +# want the card initialized for normal operation. Helpful for +# (re)loading flash or for test purposes. +WLAN_ENABLE=y + +#=======USER MIB SETTINGS============================= +# You can add the assignments for various MIB items +# of your choosing to this variable, separated by +# whitespace. The wlan-ng script will then set each one. +# Just uncomment the variable and set the assignments +# the way you want them. + +#USER_MIBS="p2CnfRoamingMode=1 p2CnfShortPreamble=mixed" + +#=======WEP=========================================== +# [Dis/En]able WEP. Settings only matter if PrivacyInvoked is true +lnxreq_hostWEPEncrypt=false # true|false +lnxreq_hostWEPDecrypt=false # true|false +dot11PrivacyInvoked=false # true|false +dot11WEPDefaultKeyID=0 # 0|1|2|3 +dot11ExcludeUnencrypted=true # true|false, in AP this means WEP is required. + +# If PRIV_GENSTR is not empty, use PRIV_GENTSTR to generate +# keys (just a convenience) +PRIV_GENERATOR=/sbin/nwepgen # nwepgen, Neesus compatible +PRIV_KEY128=false # keylength to generate +PRIV_GENSTR="" + +# or set them explicitly. Set genstr or keys, not both. +dot11WEPDefaultKey0= # format: xx:xx:xx:xx:xx or +dot11WEPDefaultKey1= # xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx +dot11WEPDefaultKey2= # e.g. 01:20:03:40:05 or +dot11WEPDefaultKey3= # 01:02:03:04:05:06:07:08:09:0a:0b:0c:0d +#=======SELECT STATION MODE=================== +IS_ADHOC=n # y|n, y - adhoc, n - infrastructure + +#============ BOTH ADHOC AND INFRASTRUCTURE =========== +# Use DesiredSSID="" to associate with any AP in range +DesiredSSID="linux-wlan" + +#======= INFRASTRUCTURE STATION =================== +# SSID is all we have for now +AuthType="opensystem" # opensystem | sharedkey (requires WEP) + +#======= ADHOC STATION ============================ +BCNINT=100 # Beacon interval (in Kus) +CHANNEL=6 # DS channel for BSS (1-14, depends + # on regulatory domain) +BASICRATES="2 4" # Rates for mgmt&ctl frames (in 500Kb/s) +OPRATES="2 4 11 22" # Supported rates in BSS (in 500Kb/s) + diff --git a/etc/wlan/wlancfg-wlannoenable b/etc/wlan/wlancfg-wlannoenable new file mode 100644 index 0000000..0c1125f --- /dev/null +++ b/etc/wlan/wlancfg-wlannoenable @@ -0,0 +1,5 @@ +#=======ENABLE======================================== +# Do we want to enable the card at all? Set to 'n' if you don't +# want the card initialized for normal operation. Helpful for +# (re)loading flash or for test purposes. +WLAN_ENABLE=n