First version of the new rc.wlan and wlan.conf files.

This commit is contained in:
mark 2001-08-28 18:27:39 +00:00
parent 2eaaa74381
commit 807206bea8
3 changed files with 281 additions and 2 deletions

View File

@ -45,11 +45,13 @@
include ../../config.mk
all:
echo "Nothing to do"
@echo "Nothing to do"
clean:
echo "Nothing to do"
@echo "Nothing to do"
ifeq ($(PRISM2_PCMCIA), y)
install:
mkdir -p $(TARGET_PCMCIA_DIR) ; \
if [ -f $(TARGET_PCMCIA_DIR)/wlan-ng ]; then \
@ -96,3 +98,11 @@ install:
fi ; \
fi ; \
fi
else
install:
@echo "Nothing to do"
endif

161
etc/rc.wlan Executable file
View File

@ -0,0 +1,161 @@
#!/bin/sh
# rc.wlan
#
# Source the wlan configuration
if [ -f /etc/wlan.conf ] ; then
. /etc/wlan.conf
else
exit 0
fi
usage()
{
echo "Usage: $0 {start|stop|status|restart|reload}"
}
if [ -x /sbin/wlanctl-ng ] ; then
WLANCTL=/sbin/wlanctl-ng
else
echo wlanctl-ng not found.
exit 1
fi
if [ $# -lt 1 ] ; then usage ; exit 1 ; fi
action=$1
case "$action" in
start)
echo -n "Starting WLAN Devices:"
if ! insmod p80211; then
echo "Failed to load p80211.o."
exit 1
fi
# NOTE: We don't explicitly insmod the card driver here. The
# best thing to do is to specify an alias in /etc/modules.conf.
# Then, the first time we call wlanctl with the named device,
# the kernel module autoload stuff will take over.
for i in $WLAN_DEVICES; do
wlandevice_config $i
DEVICE=$i
#=======ENABLE========================================
# Do we want to init the card at all?
if ! is_true $WLAN_ENABLE ; then
exit 0
fi
#=======USER MIB SETTINGS=============================
# Set the user specified MIB items.
for i in $USER_MIBS ; do
result=`$WLANCTL $DEVICE dot11req_mibset "mibattribute=$i"`
if [ $? = 0 ] ; then
eval $result
if [ $resultcode != "success" ] ; then
echo "Failed to set user MIB $i."
exit 1
fi
else
echo "Failed to set user MIB $i."
exit 1
fi
done
#=======WEP===========================================
# Setup privacy
result=`$WLANCTL $DEVICE dot11req_mibget mibattribute=dot11PrivacyOptionImplemented`
if [ $? = 0 ] ; then
eval $result
eval $mibattribute
else
echo "mibget failed."
exit 1
fi
if [ $dot11PrivacyOptionImplemented = "false" -a \
$dot11PrivacyInvoked = "true" ] ; then
echo "Cannot enable privacy, dot11PrivacyOptionImplemented=false."
exit 1
fi
if [ $dot11PrivacyOptionImplemented = "true" -a \
$dot11PrivacyInvoked = "true" ] ; then
$WLANCTL $DEVICE dot11req_mibset \
mibattribute=dot11WEPDefaultKeyID=$dot11WEPDefaultKeyID
$WLANCTL $DEVICE dot11req_mibset \
mibattribute=dot11ExcludeUnencrypted=$dot11ExcludeUnencrypted
$WLANCTL $DEVICE dot11req_mibset \
mibattribute=dot11PrivacyInvoked=$dot11PrivacyInvoked
if [ ${PRIV_GENSTR:-"empty"} != "empty" ] ; then
if [ ${PRIV_KEY128:-"false"} = "false" ]; then
keys=`$PRIV_GENERATOR $PRIV_GENSTR 5`
else
keys=`$PRIV_GENERATOR $PRIV_GENSTR 13`
fi
knum=0
for i in $keys ; do
$WLANCTL $DEVICE dot11req_mibset \
mibattribute=dot11WEPDefaultKey$knum=$i
knum=$[$knum + 1]
done
else
$WLANCTL $DEVICE dot11req_mibset \
mibattribute=dot11WEPDefaultKey0=$dot11WEPDefaultKey0
$WLANCTL $DEVICE dot11req_mibset \
mibattribute=dot11WEPDefaultKey1=$dot11WEPDefaultKey1
$WLANCTL $DEVICE dot11req_mibset \
mibattribute=dot11WEPDefaultKey2=$dot11WEPDefaultKey2
$WLANCTL $DEVICE dot11req_mibset \
mibattribute=dot11WEPDefaultKey3=$dot11WEPDefaultKey3
fi
fi
#=======STA STARTUP==================================
results=`$WLANCTL $DEVICE lnxreq_autojoin \
"ssid=$DesiredSSID" authtype=${AuthType:="opensystem"}`
if [ $? = 0 ]; then
eval $results
if [ ${resultcode:-"failure"} != "success" ]; then
echo 'error: Autojoin indicated failure!'
exit 1;
fi
fi
done
;;
stop)
echo -n "Shutting Down WLAN Devices:"
# Do a reset on each device to make sure none of them are still
# trying to generate interrupts.
for i in $WLAN_DEVICES; do
$WLANCTL $i dot11req_reset setdefaultmib=false
done
# If you want to manage modules by hand, put your rmmod's here.
# Otherwise we'll rely on autoclean.
;;
status)
echo -n "Hmmm, some kind of status would be nice."
;;
restart|reload)
$0 stop
$0 start
EXITCODE=$?
;;
*)
usage
;;
esac
done

108
etc/wlan.conf Executable file
View File

@ -0,0 +1,108 @@
#! /bin/sh
# Wireless LAN adapter configuration
#
# etc/wlan.conf
#
# 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.
#
# --------------------------------------------------------------------
# This file is sourced by the init.d/wlan script.
#
# The WLAN_DEVICES variable identifies the device names of each WLAN device.
# If you have more than one, make sure each one is identified in a whitespace
# separated list that's assigned to WLAN_DEVICES.
#
# For each device named in WLAN_DEVICES, the function wlandevice_config will
# be called with $1 set to the name of the device. To specify the
# 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 script will then set each one.
# Just uncomment the variable and set the assignments
# the way you want them.
# USER_MIBS="p2CnfRoamingMode=1"
#=======WEP===========================================
# [Dis/En]able WEP. Settings only matter if PrivacyInvoked is true
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=""
# If you don't want a GENSTR, Set them explicitly. Just make sure
# you set genstr or keys, not both. Note that to enable 128 bit wep,
# all you have to do is set the keys to values longer than 40 bits,
# specifically, 104 bits. See the format examples below.
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
#=======STA START=====================================
# SSID and authtype are all we have for now
AuthType="opensystem" # opensystem | sharedkey
DesiredSSID="linux-wlan"
;;
esac
}
wlandevice_config wlan0