On Wed, Mar 12, 2003 at 04:48:46PM -0800, James Sparenberg wrote:
> How have any of you solved this?  

I agree with your experience: Mandrake does not provide nice support
for roaming with your laptop (perhaps Starbucks is not widespread
enough in France :-) ).  What makes it even more depressing is that
Linux pcmcia package actually comes pretty much with the tools you
need through the command cardctl.  However, Mandrake insists on having
only one setting of the encryption key.

So here is my solution:
1) I have installed the pcmcia-cs package
2) I have replaced /etc/sysconfig/network-scripts/ifup-wireless with
   the attached script which incorporates a few bits from pcmcia-cs
   package
3) I have changed /etc/pcmcia/wireless.opts to include settings for
   two schemes: a default unencrypted and my home zone.  This is done
   with the following setting:

    # Lucent Wavelan IEEE (+ Orinoco, RoamAbout and ELSA)
    # Melco/Buffalo Networks WLI-PCM-L11
    # Note : wvlan_cs driver only, and version 1.0.4+ for encryption support
    home,*,*,00:60:1D:*|home,*,*,00:02:2D:*)
        INFO="Wavelan IEEE example (Lucent default settings)"
        ESSID="any"
        MODE="Managed"
        KEY="XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX open"
        ;;
    
    *,*,*,00:60:1D:*|*,*,*,00:02:2D:*)
        INFO="Wavelan IEEE example (Lucent default settings)"
        ESSID="any"
        MODE="Managed"
        KEY="off"
        ;;

After this, all I need to do to change between the two keys are 

  cardctl scheme home

or

  cardctl scheme default

as root and then of course ifdown, ifup on the card.

This is as seamless as I have been able to get it.  I can however
still envy Micro$oft user's the ability for the driver to recognize
the name of the network and set the key accordingly.

/Peter
-- 
http://www.linearity.org/turtle/contact.html 
``Power tends to corrupt, and absolute power corrupts
absolutely. Great men are almost always bad men''---Lord Acton, 1887
#!/bin/bash
# Network Interface Configuration System
# Copyright (c) 1996-2002 Red Hat, Inc. all rights reserved.
#
# Based on PCMCIA wireless script by (David Hinds/Jean Tourrilhes)
#
# This software may be freely redistributed under the terms of the GNU
# public license.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Configure wireless network device options.  See iwconfig(8) for more info.
# Valid variables:
#    MODE: Ad-Hoc, Managed, etc.
#    ESSID: Name of the wireless network
#    NWID: Name of this machine on the network.  Hostname is default
#    FREQ: Frequency to operate on.  See CHANNEL
#    CHANNEL: Numbered frequency to operate on.  See FREQ
#    SENS: Sensitivity threshold for packet rejection.
#    RATE: Transfer rate.  Usually one of Auto, 11, 5, 2, or 1.
#    KEY: Encryption key for WEP.
#    RTS: Explicit RTS handshake.  Usually not specified (auto)
#    FRAG: Fragmentation threshold to split packets.  Usually not specified.
#    SPYIPS: List of IP addresses to "spy" on for link performance stats.
#    IWCONFIG: Extra parameters to pass directly to IWCONFIG
#    IWPRIV: Extra parameters to pass directly to IWPRIV

# Only meant to be called from ifup.

# Implement the scheme of cardctl taken from the pcmcia package
# The following is copy-and-paste from pcmcia/shared and is used to obtain 
# various parameters for the card
grep_stab ()
{
    # this should be cheaper than invoking "grep"
    local CLASS DEV
    while read SOCKET CLASS DRIVER INSTANCE DEV MAJOR MINOR ; do
        if [ "$1" = "$DEV" ] ; then return 0 ; fi
    done
    return 1
}

get_info ()
{
    if [ -d /var/lib/pcmcia ] ; then
        STAB=/var/lib/pcmcia/stab
    else
        STAB=/var/run/stab
    fi
    if [ -f /var/lib/pcmcia/scheme ] ; then
        SCHEME=`cat /var/lib/pcmcia/scheme`
    elif [ -f /var/run/pcmcia-scheme ] ; then
        SCHEME=`cat /var/run/pcmcia-scheme`
    fi  
    if [ -z "$SCHEME" ] ; then SCHEME="default" ; fi
    grep_stab $1 < $STAB || usage
}
WI_HWADDR=`/sbin/ifconfig $DEVICE | sed -n -e 's/.*addr \([^ ]*\) */\1/p'`
get_info $DEVICE
ADDRESS="$SCHEME,$SOCKET,$INSTANCE,$WI_HWADDR"
if [ -r ./wireless.opts ] ; then
    . ./wireless.opts
else
    . /etc/pcmcia/wireless.opts
fi

echo "$MODE # $KEY # $ESSID"


# Mode need to be first : some settings apply only in a specific mode !
if [ -n "$MODE" ] ; then
    iwconfig $DEVICE mode $MODE
fi
# This is a bit hackish, but should do the job right...
if [ -n "$ESSID" -o -n "$MODE" ] ; then
    NICKNAME=`/bin/hostname`
    iwconfig $DEVICE nick "$NICKNAME" >/dev/null 2>&1
fi
# Regular stuff...
if [ -n "$NWID" ] ; then
    iwconfig $DEVICE nwid $NWID
fi
if [ -n "$FREQ" -a "$MODE" != "Managed" ] ; then
    iwconfig $DEVICE freq $FREQ
elif [ -n "$CHANNEL" -a "$MODE" != "Managed" ] ; then
    iwconfig $DEVICE channel $CHANNEL
fi
if [ -n "$SENS" ] ; then
    iwconfig $DEVICE sens $SENS
fi
if [ -n "$RATE" ] ; then
    iwconfig $DEVICE rate $RATE
fi
if [ -n "$KEY" ] ; then
    iwconfig $DEVICE key $KEY
else
    iwconfig $DEVICE key off
fi
if [ -n "$RTS" ] ; then
    iwconfig $DEVICE rts $RTS
fi
if [ -n "$FRAG" ] ; then
    iwconfig $DEVICE frag $FRAG
fi

# More specific parameters passed directly to IWCONFIG
if [ -n "$IWCONFIG" ] ; then
    iwconfig $DEVICE $IWCONFIG
fi

if [ -n "$SPYIPS" ] ; then
    for IP in $SPYIPS; do
        iwspy $DEVICE + $IP
    done
fi
if [ -n "$IWPRIV" ] ; then
    iwpriv $DEVICE $IWPRIV
fi

# ESSID need to be last : most device re-perform the scanning/discovery
# when this is set, and things like encryption keys are better be
# defined if we want to discover the right set of APs/nodes.
if [ -n "$ESSID" ] ; then
    iwconfig $DEVICE essid "$ESSID"
else
    # use any essid
    iwconfig $DEVICE essid any
fi
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to