diff -urN hotplug.orig/net.agent hotplug/net.agent
--- hotplug.orig/net.agent	2005-09-04 10:57:47.000000000 -0700
+++ hotplug/net.agent	2005-12-15 16:57:19.000000000 -0800
@@ -41,7 +41,12 @@
 	    debug_mesg assuming $INTERFACE is already up
 	    exit 0
 	    ;;
+
 	# interfaces that are registered then brought up
+	wifi*)
+            exec /etc/rc.d/rc.madwifi-ng ${INTERFACE}_start
+	    ;;
+
 	*)
 	    # NOTE:  network configuration relies on administered state,
 	    # we can't do much here without distro-specific knowledge
@@ -98,12 +103,18 @@
 	    debug_mesg assuming $INTERFACE is already down
 	    exit 0
 	    ;;
+
+        wifi*)
+            exec /etc/rc.d/rc.madwifi-ng ${INTERFACE}_stop
+	    ;;
+
 	*)
             # Does the interface use dhcpcd? If it does, we must kill the daemon.
             if [ -r /etc/dhcpc/dhcpcd-$INTERFACE.pid ]; then
               debug_mesg killing /etc/dhcpc/dhcpcd-$INTERFACE.pid
               kill -15 `cat /etc/dhcpc/dhcpcd-$INTERFACE.pid`
             fi
+            exec /etc/rc.d/rc.inet1 ${INTERFACE}_down
 	    ;;
     esac
     debug_mesg $1 $ACTION event not handled
diff -urN rc.d.orig/rc.inet1 rc.d/rc.inet1
--- rc.d.orig/rc.inet1	2005-09-07 13:44:41.000000000 -0700
+++ rc.d/rc.inet1	2005-12-15 17:04:29.000000000 -0800
@@ -9,7 +9,19 @@
 ############################
 
 # Get the configuration information from /etc/rc.d/rc.inet1.conf:
-. /etc/rc.d/rc.inet1.conf
+if [ "X$LOCATION" == "X" ]; then
+  if [ -f /var/run/pcmcia-scheme ] ; then
+    LOCATION=`cat /var/run/pcmcia-scheme`
+  elif [ -f /var/lib/pcmcia/scheme ] ; then
+    LOCATION=`cat /var/lib/pcmcia/scheme`
+  fi
+fi
+
+if [ "X$LOCATION" != "X" ]; then
+  . /etc/rc.d/rc.inet1.conf-$LOCATION
+else
+  . /etc/rc.d/rc.inet1.conf
+fi
 
 ###########
 # LOGGING #
@@ -145,18 +157,16 @@
     [ "${IFNAME[$i]}" = "${1}" ] && break
     i=$(($i+1))
   done
-  if grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then
-    if [ "${USE_DHCP[$i]}" = "yes" ]; then
-      echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -k -d ${1}" | $LOGGER
-      /sbin/dhcpcd -k -d ${1} || /sbin/ifconfig ${1} down
-      sleep 1
-    else
-      echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} down" | $LOGGER
-      /sbin/ifconfig ${1} down
-    fi
-    if [ -x /etc/rc.d/rc.wireless ]; then
-      . /etc/rc.d/rc.wireless ${1} stop # Kill wireless daemons if any.
-    fi
+  if [ "${USE_DHCP[$i]}" = "yes" ]; then
+    echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -k -d ${1}" | $LOGGER
+    /sbin/dhcpcd -k -d ${1} || /sbin/ifconfig ${1} down
+    sleep 1
+  else
+    echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} down" | $LOGGER
+    /sbin/ifconfig ${1} down
+  fi
+  if [ -x /etc/rc.d/rc.wireless ]; then
+    . /etc/rc.d/rc.wireless ${1} stop # Kill wireless daemons if any.
   fi
 }
 
diff -urN rc.d.orig/rc.madwifi-ng rc.d/rc.madwifi-ng
--- rc.d.orig/rc.madwifi-ng	1969-12-31 16:00:00.000000000 -0800
+++ rc.d/rc.madwifi-ng	2005-12-15 12:22:18.000000000 -0800
@@ -0,0 +1,123 @@
+#!/bin/sh
+# /etc/rc.d/rc.madwifi-ng
+# This script is used to bring up an Atheros wireless interface
+# Using the madwifi-ng code (http://www.madwifi.org/)
+#
+# Version 1.0
+# For Slackware 10.2 - Joe Feise 2005-Dec-15
+
+# Find the path where the madwifi tools are installed
+for IWPATH in /usr/{bin,sbin} /usr/local/{bin,sbin} /sbin /bin ; do
+    if [ -x $IWPATH/wlanconfig ] ; then break ; fi
+done
+WLANCONFIG="$IWPATH/wlanconfig ath"
+
+###########
+# LOGGING #
+###########
+
+# If possible, log events in /var/log/messages:
+if [ -f /var/run/syslogd.pid -a -x /usr/bin/logger ]; then
+  LOGGER=/usr/bin/logger
+else # output to stdout/stderr:
+  LOGGER=/bin/cat
+fi
+
+#######################
+# INTERFACE FUNCTIONS #
+#######################
+
+# Function to bring up a wireless interface.  If the interface is
+# already up or does not yet exist (perhaps because the kernel driver
+# is not loaded yet), do nothing.
+if_up() {
+  # If the interface isn't in the kernel yet (but there's an alias for it in
+  # modules.conf), then it should be loaded first:
+  if ! grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # no interface yet
+    if /sbin/modprobe -c | grep -w "alias ${1}" | grep -vw "alias ${1} off" > /dev/null ; then
+      echo "/etc/rc.d/rc.inet1:  /sbin/modprobe ${1}" | $LOGGER
+      /sbin/modprobe ${1}
+    fi
+  fi
+  if grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # interface exists
+    if ! /sbin/ifconfig | grep -w "${1}" 1>/dev/null 1> /dev/null ; then # interface not up or not configured
+      $WLANCONFIG create wlandev ${1} wlanmode sta
+    else
+      if [ "$DEBUG_ETH_UP" = "yes" ]; then
+        echo "/etc/rc.d/rc.madwifi-ng:  ${1} is already up, skipping" | $LOGGER
+      fi
+    fi 
+  else
+    if [ "$DEBUG_ETH_UP" = "yes" ]; then
+      echo "/etc/rc.d/rc.madwifi-ng:  ${1} interface does not exist (yet)" | $LOGGER
+    fi
+  fi
+}
+
+# Function to take down a wireless interface:
+if_down() {
+  # Removing the modules
+  sleep 2
+  /sbin/modprobe -r ${1}
+}
+
+
+# Function to start the network:
+start() {
+  if_up wifi0
+}
+
+# Function to stop the network:
+stop() {
+  if_down wifi0
+}
+
+
+############
+### MAIN ###
+############
+
+case "$1" in
+'start') # "start" brings up all configured interfaces:
+  start
+  ;;
+'stop') # "stop" takes down all configured interfaces:
+  stop
+  ;;
+'restart') # "restart" restarts the network:
+  stop
+  start
+  ;;
+*_start) # Example: "wifi0_start" will start the specified interface 'wifi0'
+  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
+  if_up $INTERFACE
+  ;;
+*_stop) # Example: "wifi0_stop" will stop the specified interface 'wifi0'
+  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
+  if_down $INTERFACE
+  ;;
+*_restart) # Example: "wifi0_restart" will take 'wifi0' down and up again
+  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
+  if_down $INTERFACE
+  sleep 1
+  if_up $INTERFACE
+  ;;
+'up') # "up" does the same thing as "start"
+  start
+  ;;
+'down') # "down" does the same thing as "stop"
+  stop
+  ;;
+*_up) # "*_up" does the same thing as "*_start"
+  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
+  if_up $INTERFACE
+  ;;
+*_down) # "*_down" does the same thing as "*_stop"
+  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
+  if_down $INTERFACE
+  ;;
+*) # The default is to bring up all configured interfaces:
+  if_up wifi0
+esac
+
+# End of /etc/rc.d/rc.madwifi-ng
diff -urN rc.d.orig/rc.wireless rc.d/rc.wireless
--- rc.d.orig/rc.wireless	2005-07-25 00:19:38.000000000 -0700
+++ rc.d/rc.wireless	2005-12-15 12:21:59.000000000 -0800
@@ -45,6 +45,7 @@
 IWPRIVCMD="$IWPATH/iwpriv ${INTERFACE}"
 IWSPYCMD="$IWPATH/iwspy ${INTERFACE}"
 IFCOMMAND="/sbin/ifconfig ${INTERFACE}"
+WLANCONFIG="$IWPATH/wlanconfig ${INTERFACE}"
 
 is_wireless_device ()
 {
@@ -54,190 +55,220 @@
     return 1
 }
 
-###############
-# EXIT POINTS #
-###############
+# Function to start the wireless interface
+wireless_start() {
+  # Bring interface up - for determining the HWADDR
+  $IFCOMMAND up
+  sleep 2
+
+  # Get the MAC address for the interface
+  HWADDR=`/sbin/ifconfig ${INTERFACE} | sed -ne 's/.*\(..:..:..:..:..:..\).*/\1/p'`
+  # Add the location to it for the selection in rc.wireless.conf
+  if [ "X$LOCATION" != "X" ]; then
+    ADDRESS=${LOCATION},$HWADDR
+  else
+    ADDRESS=$HWADDR
+  fi
+  # Read the configuration information for the card with address $HWADDR
+  # from /etc/rc.d/rc.wireless.conf:
+  echo "executing rc.wireless.conf $ADDRESS" | $LOGGER
+  . /etc/rc.d/rc.wireless.conf
+
+  # Let any per-interface overrides (the WLAN_xxxx parameters) that are set
+  # in /etc/rc.d/rc.inet1.conf have precedence.
+  # The reason: you might have multiple wireless cards of the same brand, or
+  # connecting to multiple networks.
+  # Position 'i' of this interface in the IFNAME array was determined in rc.inet1
+  CHANNEL=${WLAN_CHANNEL[$i]:-${CHANNEL}}
+  ESSID=${WLAN_ESSID[$i]:-${ESSID}}
+  FREQ=${WLAN_FREQ[$i]:-${FREQ}}
+  FRAG=${WLAN_FRAG[$i]:-${FRAG}}
+  IWCONFIG=${WLAN_IWCONFIG[$i]:-${IWCONFIG}}
+  IWPRIV=${WLAN_IWPRIV[$i]:-${IWPRIV}}
+  IWSPY=${WLAN_IWSPY[$i]:-${IWSPY}}
+  KEY=${WLAN_KEY[$i]:-${KEY}}
+  MODE=${WLAN_MODE[$i]:-${MODE}}
+  NICKNAME=${WLAN_NICKNAME[$i]:-${NICKNAME}}
+  NWID=${WLAN_NWID[$i]:-${NWID}}
+  RATE=${WLAN_RATE[$i]:-${RATE}}
+  RTS=${WLAN_RTS[$i]:-${RTS}}
+  SENS=${WLAN_SENS[$i]:-${SENS}}
+  WPA=${WLAN_WPA[$i]:-${WPA}}
+  WPADRIVER=${WLAN_WPADRIVER[$i]:-${WPADRIVER}}
+  WPACONF=${WLAN_WPACONF[$i]:-${WPACONF}}
+
+  [ -n "$VERBOSE" -a -n "$INFO" ] && echo "$0:  $1 is '$INFO'"
+
+  ###################
+  # WIRELESS CONFIG #
+  ###################
+
+  # Mode needs to be first : some settings apply only in a specific mode!
+  if [ -n "$MODE" ] ; then
+    echo "$0:  $IWCOMMAND mode $MODE" | $LOGGER
+    $IWCOMMAND mode $MODE
+  fi
+  # This is a bit hackish, but should do the job right...
+  if [ ! -n "$NICKNAME" ] ; then
+    NICKNAME=`/bin/hostname`
+  fi
+  if [ -n "$ESSID" -o -n "$MODE" ] ; then
+    echo "$0:  $IWCOMMAND nick $NICKNAME" | $LOGGER
+    $IWCOMMAND nick $NICKNAME
+  fi
+  # Regular stuff...
+  if [ -n "$NWID" ] ; then
+    echo "$0:  $IWCOMMAND nwid $NWID" | $LOGGER
+    $IWCOMMAND nwid $NWID
+  fi
+  if [ -n "$FREQ" ] ; then
+    echo "$0:  $IWCOMMAND freq $FREQ" | $LOGGER
+    $IWCOMMAND freq $FREQ
+  elif [ -n "$CHANNEL" ] ; then
+    echo "$0:  $IWCOMMAND channel $CHANNEL" | $LOGGER
+    $IWCOMMAND channel $CHANNEL
+  fi
+
+  # WEP keys (non-WPA) 
+  if [ -n "$KEY" -a ! -n "$WPA" ] ; then
+    if [ "$KEY" = "off" ]; then
+      echo "$0:  $IWCOMMAND key open" | $LOGGER
+      $IWCOMMAND key open
+      echo "$0:  $IWCOMMAND key off" | $LOGGER
+      $IWCOMMAND key off
+    else 
+      echo "$0:  $IWCOMMAND key restricted" | $LOGGER
+      $IWCOMMAND key restricted
+      echo "$0:  $IWCOMMAND key ************" | $LOGGER
+      $IWCOMMAND key $KEY
+    fi
+  fi
+  if [ -n "$SENS" ] ; then
+    echo "$0:  $IWCOMMAND sens $SENS" | $LOGGER
+    $IWCOMMAND sens $SENS
+  fi
+  if [ -n "$RATE" ] ; then
+    echo "$0:  $IWCOMMAND rate $RATE" | $LOGGER
+    $IWCOMMAND rate $RATE
+  fi
+  if [ -n "$RTS" ] ; then
+    echo "$0:  $IWCOMMAND rts $RTS" | $LOGGER
+    $IWCOMMAND rts $RTS
+  fi
+  if [ -n "$FRAG" ] ; then
+    echo "$0:  $IWCOMMAND frag $FRAG" | $LOGGER
+    $IWCOMMAND frag $FRAG
+  fi
+  # More specific parameters
+  if [ -n "$IWCONFIG" ] ; then
+    echo "$0:  $IWCOMMAND $IWCONFIG" | $LOGGER
+    $IWCOMMAND $IWCONFIG
+  fi
+  if [ -n "$IWSPY" ] ; then
+    echo "$0:  $IWSPYCMD $IWSPY" | $LOGGER
+    $IWSPYCMD $IWSPY
+  fi
+  # The iwpriv can set one private IOCTL at the time, so if the $IWPRIV
+  # variable contqins multiple space separated settings, we split them here:
+  # WARNING: if your iwpriv commands contain a WEP/WPA key, these can be logged
+  # in /var/log/messages!
+  if [ -n "$IWPRIV" ] ; then
+    for iwi in $IWPRIV; do
+      echo "$0:  $IWPRIVCMD set $iwi" | $LOGGER
+      $IWPRIVCMD set $iwi
+    done
+  fi
+
+  ##################
+  # WPA_SUPPLICANT #
+  ##################
+
+  # Support for WPA (wireless protected access) is provided by wpa_supplicant
+  # for those drivers that support it (and it looks like wpa_supplicant is
+  # the future for WPA support in Linux anyway)
+  if [ "$WPA" = "wpa_supplicant" ] || [ "$WPA" = "wpaxsupplicant" ] && [ -x ${SUPPATH}/wpa_supplicant ]; then
+    # Interface down, so wpa_supplicant can associate with the AP
+    $IFCOMMAND down
+    WPACONF=${WPACONF:-/etc/wpa_supplicant.conf}
+    WPA_OPTIONS=""
+    [ ${WPADRIVER} ] && WPA_OPTIONS="-D${WPADRIVER}" # specify the driver
+    [ ${WPA} = "wpaxsupplicant" ] && WPA_OPTIONS="${WPA_OPTIONS} -e" # Use external xsupplicant (disables the internal supplicant)
+    echo "$0:  wpa_supplicant -Bw -c${WPACONF} ${WPA_OPTIONS} -i$INTERFACE" | $LOGGER
+    ${SUPPATH}/wpa_supplicant -Bw -c${WPACONF} ${WPA_OPTIONS} -i$INTERFACE
+    # Buy wpa_supplicant some time to authenticate before bringing the
+    # interface back up... but we don't wait forever:
+    # You can increase this value if your card takes longer to associate:
+    WPAWAIT=10
+    wi=0
+    while [ $wi -lt $WPAWAIT ]; do
+      if (grep -q "^ctrl_interface=" ${WPACONF}); then
+        if (LC_ALL=C ${SUPPATH}/wpa_cli -i$INTERFACE status|grep -q "^wpa_state=COMPLETED"); then break; fi
+      else
+        if (LC_ALL=C ${IWCOMMAND}|grep -Eq "Encryption key:....-"); then break; fi
+      fi
+      wi=$(($wi+1)); sleep 1
+    done
+    if [ $wi -eq $WPAWAIT ]; then
+      echo "WPA authentication did not complete, try running '/etc/rc.d/rc.inet1 ${INTERFACE}_start' in a few seconds." | $LOGGER
+    fi
+    # Bring interface up to avoid 'not ready' errors when calling iwconfig
+    $IFCOMMAND up
+    sleep 1
+  else
+    # ESSID need to be last: most devices re-perform the scanning/discovery
+    # when this is set, and things like encryption keys had better be
+    # defined if we want to discover the right set of APs/nodes.
+    # NOTE: when automatic association does not work, but you manage to get
+    # an IP address by manually setting the ESSID and then calling dhcpcd,
+    # then the cause might be the incorrect definition of your ESSID="bla"
+    # parameter in rc.wireless.conf.
+    # Debug your wireless problems by running 'iwevent' while the card
+    # is being configured.
+    if [ -n "$ESSID" ] ; then
+      echo "$0:  $IWCOMMAND essid $ESSID" | $LOGGER
+      $IWCOMMAND essid $ESSID
+    fi
+  fi
+}
+
+# Function to stop the wireless interface
+wireless_stop() {
+  # If we stop a wireless interface using wpa_supplicant,
+  # we'll kill its wpa_supplicant daemon too and exit this script:
+  WPAPID=`echo \`ps axww|grep wpa_supplicant |grep i${INTERFACE}\` |cut -f1 -d' '`
+  [ ${WPAPID} ] &&  kill ${WPAPID}
+
+  # madwifi-ng specific
+  $WLANCONFIG destroy
+}
+
+
+############
+### MAIN ###
+############
 
 # Is the device wireless?  If not, exit this script.
 is_wireless_device ${INTERFACE} || return 0 2> /dev/null || exit 0
 
-# If we stop a wireless interface using wpa_supplicant,
-# we'll kill its wpa_supplicant daemon too and exit this script:
-if [ "$2" = "stop" ]; then
-	WPAPID=`echo \`ps axww|grep wpa_supplicant |grep i${INTERFACE}\` |cut -f1 -d' '`
-	[ ${WPAPID} ] &&  kill ${WPAPID}
-	return 0
-fi
-
-# -----------------------------------------------------
-# Continue with the script - bringing the interface UP.
-# -----------------------------------------------------
-
-# Bring interface up - for determining the HWADDR
-$IFCOMMAND up
-sleep 2
-
-# Get the MAC address for the interface
-HWADDR=`/sbin/ifconfig ${INTERFACE} | sed -ne 's/.*\(..:..:..:..:..:..\).*/\1/p'`
-# Read the configuration information for the card with address $HWADDR
-# from /etc/rc.d/rc.wireless.conf:
-. /etc/rc.d/rc.wireless.conf
-
-# Let any per-interface overrides (the WLAN_xxxx parameters) that are set
-# in /etc/rc.d/rc.inet1.conf have precedence.
-# The reason: you might have multiple wireless cards of the same brand, or
-# connecting to multiple networks.
-# Position 'i' of this interface in the IFNAME array was determined in rc.inet1
-CHANNEL=${WLAN_CHANNEL[$i]:-${CHANNEL}}
-ESSID=${WLAN_ESSID[$i]:-${ESSID}}
-FREQ=${WLAN_FREQ[$i]:-${FREQ}}
-FRAG=${WLAN_FRAG[$i]:-${FRAG}}
-IWCONFIG=${WLAN_IWCONFIG[$i]:-${IWCONFIG}}
-IWPRIV=${WLAN_IWPRIV[$i]:-${IWPRIV}}
-IWSPY=${WLAN_IWSPY[$i]:-${IWSPY}}
-KEY=${WLAN_KEY[$i]:-${KEY}}
-MODE=${WLAN_MODE[$i]:-${MODE}}
-NICKNAME=${WLAN_NICKNAME[$i]:-${NICKNAME}}
-NWID=${WLAN_NWID[$i]:-${NWID}}
-RATE=${WLAN_RATE[$i]:-${RATE}}
-RTS=${WLAN_RTS[$i]:-${RTS}}
-SENS=${WLAN_SENS[$i]:-${SENS}}
-WPA=${WLAN_WPA[$i]:-${WPA}}
-WPADRIVER=${WLAN_WPADRIVER[$i]:-${WPADRIVER}}
-WPACONF=${WLAN_WPACONF[$i]:-${WPACONF}}
-
-[ -n "$VERBOSE" -a -n "$INFO" ] && echo "$0:  $1 is '$INFO'"
-
-###################
-# WIRELESS CONFIG #
-###################
-
-# Mode needs to be first : some settings apply only in a specific mode!
-if [ -n "$MODE" ] ; then
-	echo "$0:  $IWCOMMAND mode $MODE" | $LOGGER
-	$IWCOMMAND mode $MODE
-fi
-# This is a bit hackish, but should do the job right...
-if [ ! -n "$NICKNAME" ] ; then
-    NICKNAME=`/bin/hostname`
-fi
-if [ -n "$ESSID" -o -n "$MODE" ] ; then
-	echo "$0:  $IWCOMMAND nick $NICKNAME" | $LOGGER
-	$IWCOMMAND nick $NICKNAME
-fi
-# Regular stuff...
-if [ -n "$NWID" ] ; then
-	echo "$0:  $IWCOMMAND nwid $NWID" | $LOGGER
-	$IWCOMMAND nwid $NWID
-fi
-if [ -n "$FREQ" ] ; then
-	echo "$0:  $IWCOMMAND freq $FREQ" | $LOGGER
-	$IWCOMMAND freq $FREQ
-elif [ -n "$CHANNEL" ] ; then
-	echo "$0:  $IWCOMMAND channel $CHANNEL" | $LOGGER
-	$IWCOMMAND channel $CHANNEL
-fi
-
-# WEP keys (non-WPA) 
-if [ -n "$KEY" -a ! -n "$WPA" ] ; then
-	if [ "$KEY" = "off" ]; then
-	  echo "$0:  $IWCOMMAND key open" | $LOGGER
-	  $IWCOMMAND key open
-	  echo "$0:  $IWCOMMAND key off" | $LOGGER
-	  $IWCOMMAND key off
-	else 
-	  echo "$0:  $IWCOMMAND key restricted" | $LOGGER
-	  $IWCOMMAND key restricted
-	  echo "$0:  $IWCOMMAND key ************" | $LOGGER
-	  $IWCOMMAND key $KEY
-	fi
-fi
-if [ -n "$SENS" ] ; then
-	echo "$0:  $IWCOMMAND sens $SENS" | $LOGGER
-	$IWCOMMAND sens $SENS
-fi
-if [ -n "$RATE" ] ; then
-	echo "$0:  $IWCOMMAND rate $RATE" | $LOGGER
-	$IWCOMMAND rate $RATE
-fi
-if [ -n "$RTS" ] ; then
-	echo "$0:  $IWCOMMAND rts $RTS" | $LOGGER
-	$IWCOMMAND rts $RTS
-fi
-if [ -n "$FRAG" ] ; then
-	echo "$0:  $IWCOMMAND frag $FRAG" | $LOGGER
-	$IWCOMMAND frag $FRAG
-fi
-# More specific parameters
-if [ -n "$IWCONFIG" ] ; then
-	echo "$0:  $IWCOMMAND $IWCONFIG" | $LOGGER
-	$IWCOMMAND $IWCONFIG
-fi
-if [ -n "$IWSPY" ] ; then
-	echo "$0:  $IWSPYCMD $IWSPY" | $LOGGER
-	$IWSPYCMD $IWSPY
-fi
-# The iwpriv can set one private IOCTL at the time, so if the $IWPRIV
-# variable contqins multiple space separated settings, we split them here:
-# WARNING: if your iwpriv commands contain a WEP/WPA key, these can be logged
-# in /var/log/messages!
-if [ -n "$IWPRIV" ] ; then
-	for iwi in $IWPRIV; do
-	  echo "$0:  $IWPRIVCMD set $iwi" | $LOGGER
-	  $IWPRIVCMD set $iwi
-	done
-fi
-
-##################
-# WPA_SUPPLICANT #
-##################
-
-# Support for WPA (wireless protected access) is provided by wpa_supplicant
-# for those drivers that support it (and it looks like wpa_supplicant is
-# the future for WPA support in Linux anyway)
-if [ "$WPA" = "wpa_supplicant" ] || [ "$WPA" = "wpaxsupplicant" ] && [ -x ${SUPPATH}/wpa_supplicant ]; then
-	# Interface down, so wpa_supplicant can associate with the AP
-	$IFCOMMAND down
-	WPACONF=${WPACONF:-/etc/wpa_supplicant.conf}
-	WPA_OPTIONS=""
-	[ ${WPADRIVER} ] && WPA_OPTIONS="-D${WPADRIVER}" # specify the driver
-	[ ${WPA} = "wpaxsupplicant" ] && WPA_OPTIONS="${WPA_OPTIONS} -e" # Use external xsupplicant (disables the internal supplicant)
-	echo "$0:  wpa_supplicant -Bw -c${WPACONF} ${WPA_OPTIONS} -i$INTERFACE" | $LOGGER
-	${SUPPATH}/wpa_supplicant -Bw -c${WPACONF} ${WPA_OPTIONS} -i$INTERFACE
-	# Buy wpa_supplicant some time to authenticate before bringing the
-	# interface back up... but we don't wait forever:
-	# You can increase this value if your card takes longer to associate:
-	WPAWAIT=10
-	wi=0
-	while [ $wi -lt $WPAWAIT ]; do
-	  if (grep -q "^ctrl_interface=" ${WPACONF}); then
-	    if (LC_ALL=C ${SUPPATH}/wpa_cli -i$INTERFACE status|grep -q "^wpa_state=COMPLETED"); then break; fi
-	  else
-	    if (LC_ALL=C ${IWCOMMAND}|grep -Eq "Encryption key:....-"); then break; fi
-	  fi
-	  wi=$(($wi+1)); sleep 1
-	done
-	if [ $wi -eq $WPAWAIT ]; then
-	  echo "WPA authentication did not complete, try running '/etc/rc.d/rc.inet1 ${INTERFACE}_start' in a few seconds." | $LOGGER
-	fi
-	# Bring interface up to avoid 'not ready' errors when calling iwconfig
-	$IFCOMMAND up
-	sleep 1
-
-else
-
-	# ESSID need to be last: most devices re-perform the scanning/discovery
-	# when this is set, and things like encryption keys had better be
-	# defined if we want to discover the right set of APs/nodes.
-	# NOTE: when automatic association does not work, but you manage to get
-	# an IP address by manually setting the ESSID and then calling dhcpcd,
-	# then the cause might be the incorrect definition of your ESSID="bla"
-	# parameter in rc.wireless.conf.
-	# Debug your wireless problems by running 'iwevent' while the card
-	# is being configured.
-	if [ -n "$ESSID" ] ; then
-	  echo "$0:  $IWCOMMAND essid $ESSID" | $LOGGER
-	  $IWCOMMAND essid $ESSID
-	fi
+case "$2" in
+  'start') # "start" brings up the wireless interface
+    wireless_start
+    ;;
+  'stop') # "stop" takes down the wireless interface
+    wireless_stop
+    ;;
+  'restart') # "restart" restarts the wireless interface
+    wireless_stop
+    wireless_start
+    ;;
+  'up') # "up" does the same thing as "start"
+    wireless_start
+    ;;
+  'down') # "down" does the same thing as "stop"
+    wireless_stop
+    ;;
+  *) # The default is to bring up the wireless interface
+    wireless_start
+    ;;
+esac
 
-fi
diff -urN rc.d.orig/rc.wireless.conf rc.d/rc.wireless.conf
--- rc.d.orig/rc.wireless.conf	2005-07-25 00:19:38.000000000 -0700
+++ rc.d/rc.wireless.conf	2005-12-15 17:09:34.000000000 -0800
@@ -30,12 +30,12 @@
 
 VERBOSE=1
 
-case "$HWADDR" in
+case "$ADDRESS" in
 
 ## NOTE : Comment out the following five lines to activate the samples below ...
 ## --------- START SECTION TO REMOVE -----------
 ## Pick up any Access Point, should work on most 802.11 cards
-*)
+*,*)
     INFO="Any ESSID"
     ESSID="any"
     ;;
@@ -46,7 +46,7 @@
 # The matching is done on the first 3 bytes of the MAC address
 
 # SMC2835W EZ Connect g 2.4GHz 54 Mbps Wireless Cardbus Adapter 
-00:04:E2:*)
+office,00:04:E2:*)
     INFO="SMC2835W EZ Connect g 2.4GHz 54 Mbps Wireless Cardbus Adapter"
     # ESSID (extended network name) : My Network, any
     ESSID="any"
@@ -80,7 +80,7 @@
 ;;
 
 # Multiband Atheros based 802.11a/b/g universal NIC cards
-00:05:4E:*)
+office,00:05:4E:*)
     INFO="Multiband Atheros based 802.11a/b/g universal NIC"
     # ESSID (extended network name) : My Network, any
     ESSID=""
@@ -107,7 +107,7 @@
 
 # Lucent Wavelan IEEE (+ Orinoco, RoamAbout and ELSA)
 # Note : wvlan_cs driver only, and version 1.0.4+ for encryption support
-00:60:1D:*|00:02:2D:*)
+office,00:60:1D:*|office,00:02:2D:*)
     INFO="Wavelan IEEE example (Lucent default settings)"
     ESSID="Wavelan Network"
     MODE="Managed"
@@ -123,7 +123,7 @@
 
 # Cisco/Aironet 4800/3x0
 # Note : MPL driver only (airo/airo_cs), version 1.3 or later
-00:40:96:*|00:02:8A:*)
+office,00:40:96:*|office,00:02:8A:*)
     INFO="Cisco/Aironet example (Cisco default settings)"
     ESSID="any"
     # To set all four ESSID, use iwconfig v21 and the same trick as above
@@ -135,7 +135,7 @@
 
 # Samsung MagicLan (+ some other PrismII cards)
 # Note : Samsung binary library driver, version 1.20 or later
-00:00:F0:*|00:02:78:*)
+office,00:00:F0:*|office,00:02:78:*)
     INFO="Samsung MagicLan example (Samsung default settings)"
     ESSID="any"
     MODE="Managed"
@@ -147,7 +147,7 @@
 
 # Raytheon Raylink/WebGear Aviator2.4
 # Note : doesn't work yet, please use for debugging only :-(
-00:00:8F:*|00:00:F1:*)
+office,00:00:8F:*|office,00:00:F1:*)
     INFO="Raylink/Aviator2.4 example (Aviator default ad-hoc setting)"
     ESSID="ADHOC_ESSID"
     MODE="Ad-Hoc"
@@ -156,7 +156,7 @@
     ;;
 
 # Old Lucent Wavelan
-08:00:0E:*)
+office,08:00:0E:*)
     INFO="Wavelan example (Lucent default settings)"
     NWID="0100"
     MODE="Ad-Hoc"
@@ -165,14 +165,14 @@
     ;;
 
 # Netwave (Xircom Netwave/Netwave Airsurfer)
-00:80:C7:*)
+office,00:80:C7:*)
     INFO="Netwave example (Netwave default settings)"
     NWID="100"
     KEY="00"
     ;;
 
 # Proxim RangeLan2/Symphony (what is the MAC address ???)
-XX:XX:XX:*)
+office,XX:XX:XX:*)
     INFO="Proxim RangeLan2/Symphony example"
     NWID="0"
     MODE="Master"
@@ -181,20 +181,20 @@
     ;;
 
 # No Wires Needed Swallow 550 and 1100 setting (what is the MAC address ???)
-XX:XX:XX:*)
+office,XX:XX:XX:*)
     INFO="NWN Swallow example"
     ESSID="session"
     KEY="0000-0000-00 open"
     ;;
 
 # Symbol Spectrum24 setting (what is the MAC address ???)
-XX:XX:XX:*)
+office,XX:XX:XX:*)
     INFO="Symbol Spectrum24 example"
     ESSID="Essid string"
     ;;
 
 # Generic example (decribe all possible settings)
-*)
+*,*)
     INFO="Fill with your own settings..."
     # ESSID (extended network name) : My Network, any
     ESSID=""
diff -urN rc.d.orig/rc.pcmcia rc.d/rc.pcmcia
--- rc.d.orig/rc.pcmcia	2005-12-15 18:53:16.000000000 -0800
+++ rc.d/rc.pcmcia	2005-12-15 18:53:26.000000000 -0800
@@ -49,7 +49,11 @@
     # Put cardmgr options here
     CARDMGR_OPTS=
     # To set the PCMCIA scheme at startup...
-    SCHEME=
+    if [ "X$LOCATION" != "X" ]; then
+        SCHEME=$LOCATION
+    else
+        SCHEME=
+    fi
 fi
 
 EXITCODE=1
