#------------------------------------------------------------------------------ # /etc/rc.d/rc130.wlan - write wlan-config to /var/run/wlan.conf __FLI4LVER__ # and configure wlan # # Creation: 05.08.2002 rresch # Last Update: $Id$ #------------------------------------------------------------------------------ begin_script WLAN case $debug_active in yes) wlanconfig_debug=-x ;; *) wlanconfig_debug= ;; esac # setup wireless tools for i in iwlist iwspy iwpriv iwgetid; do ln -s iwconfig /sbin/$i done # Saving complete WLAN-Config to CFG-File CONFIG_FILE="/var/run/wlan.conf" # Saving WLAN-Options to $CONFIG_FILE case $OPT_WLAN in yes) # Add wlan to the right place case $OPT_HTTPD$WLAN_WEBGUI in yesyes) httpd-menu.sh add -p 200 status_wlan.cgi "WLAN" '$_MT_stat' wlan ;; esac { echo "OPT_WLAN='yes'" if [ 0$WLAN_N -gt 1 ]; then cat <$CONFIG_FILE ;; *) echo "OPT_WLAN='no'" >$CONFIG_FILE ;; esac devices="`iwconfig 2>/dev/null | sed -n '/^wlan[0-9]/s/ .*$//p'`" [ "$devices" ] || log_error "No wlan devices found, skipping initialization of wlan subsystem." if [ -x /sbin/iw ] then if [ -n "$WLAN_REGDOMAIN" ] then iw reg set $WLAN_REGDOMAIN else iw reg set AT fi fi for dev in $devices do # if use bridge with wlan interface then add bridge-devname case $OPT_BRIDGE_DEV in yes) [ 0"$BRIDGE_DEV_N" -eq 0 ] || for bridge_idx in `seq 1 $BRIDGE_DEV_N` do eval bridge_devname='$BRIDGE_DEV_'$bridge_idx'_DEVNAME' eval bridge_devn='$BRIDGE_DEV_'$bridge_idx'_DEV_N' for bridge_ddx in `seq 1 $bridge_devn` do eval bridge_dev_dev='$BRIDGE_DEV_'$bridge_idx'_DEV_'$bridge_ddx'_DEV' [ "$bridge_dev_dev" = "$dev" ] && echo "BRIDGE_DEVNAME_${dev}='$bridge_devname'" >>$CONFIG_FILE done done ;; esac # Calling /usr/sbin/wlanconfig.sh for each wlan-device found log_info "configuring wlan on $dev ..." /usr/sbin/wlanconfig.sh $wlanconfig_debug $dev errorcode=$? if [ $errorcode -ne 0 ] then log_error "Error $errorcode while setting up $dev" case $errorcode in 42) log_error "Could not start hostapd - disabling device for safety reasons" ;; 43) log_error "Could not start wpa_supplicant - disabling device for safety reasons" ;; esac # error-codes 17 and above are fatal - skip this device if [ $errorcode -ge 17 ] then if [ ! -f /var/run/wlan.dontuse ]; then > /var/run/wlan.dontuse; fi echo $dev >>/var/run/wlan.dontuse ip link set dev $device down fi fi done echo >/var/run/wlanconfig.done end_script