Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 76601

Summary: Wireless setup fails when key contains spaces
Product: Gentoo Linux Reporter: Marc Gallagher <marcgallagher>
Component: [OLD] baselayoutAssignee: Roy Marples (RETIRED) <uberlord>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 66472    
Attachments: allows whitespace in essid keys and fixes iwconfig_get_essid_var error

Description Marc Gallagher 2005-01-04 00:07:50 UTC
My wireless setup uses a key containing spaces, which causes the following output when running the init script: 

/lib/rcscripts/net.modules.d/iwconfig
 * Starting wlan0
 *    Configuring wireless network for wlan0
 *    Trying to force preferred in case they are hidden
/lib/rcscripts/net.modules.d/iwconfig: line 340: iwconfig_get_essid_var: command not found
 *    wlan0 does not support setting keys
 *    or the parameter "mac_key_" or "key_" is incorrect
 *    Failed to associate with any preferred access points on wlan0
 *    Couldn't associate with any access points on wlan0
 *    Failed to configure wireless for wlan0

problem #1: iwconfig_get_essid_var is undefined! :)

Problem #2: my /etc/conf.d/net file contains a line like:
key_MyEssid="s:my wacky key"

lines 338-344 of /lib/rcscripts/net.modules.d/iwconfig contain:
e=$( iwconfig ${iface} key ${key} 2>&1 )
if [[ -n ${e} && ${key} != off ]]; then
    ##snip Error handling
    return 1
fi

and if I stick in an echo to see the contents of $e it prints:

Error : unrecognised wireless request "wacky"

I hacked around the problem by adding quotes around ${key}, so that line 338 becomes:
e=$( iwconfig ${iface} key "${key}" 2>&1 )

This will probably break for people who use stuff like:   key_ESSID1="s:yourkeyhere enc open"

----

/etc/conf.d/wireless - In my setup, MyEssid is hidden

config_MyEssid=( "dhcp" )
key_MyEssid="s:my wacky key"
dhcpcd_MyEssid="-N -t 10"

associate_order_wlan0="forcepreferred"
preferred_aps=( "MyEssid" )


Reproducible: Always
Steps to Reproduce:
1. Create an essid with spaces, e.g. key_MyEssid="s:my wacky key"
2. Force MyEssid to be chosen
3. start the wireless script

Actual Results:  
 * Starting wlan0
 *    Configuring wireless network for wlan0
 *    Trying to force preferred in case they are hidden
/lib/rcscripts/net.modules.d/iwconfig: line 340: iwconfig_get_essid_var: command
not found
 *    wlan0 does not support setting keys
 *    or the parameter "mac_key_" or "key_" is incorrect
 *    Failed to associate with any preferred access points on wlan0
 *    Couldn't associate with any access points on wlan0
 *    Failed to configure wireless for wlan0

Expected Results:  
results with my hack:

 * Starting wlan0
 *    Configuring wireless network for wlan0
 *    Trying to force preferred in case they are hidden
 *       wlan0 connected to "MyEssid" at 00:90:4B:31:7D:C8
 *       in managed mode (WEP enabled - restricted)
 *    Bringing up wlan0
 *       dhcp
 *          Running dhcpcd ...                                                 
                                        [ ok ]
 *          wlan0 received address 192.168.1.100


Gentoo Base System version 2.6.8
Portage 2.0.51-r3 (default-linux/x86/2004.3, gcc-3.4.3, glibc-2.3.4.20041102-r0,
2.6.9-gentoo-r13 i686)
=================================================================
System uname: 2.6.9-gentoo-r13 i686 Mobile Intel(R) Pentium(R) 4 - M CPU 1.80GHz
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.15.90.0.1.1-r3
Headers:  sys-kernel/linux26-headers-2.6.8.1-r1
Libtools: sys-devel/libtool-1.5.2-r7
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=pentium4 -pipe -mfpmath=sse -mmmx -msse -msse2
-fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentium4 -pipe -mfpmath=sse -mmmx -msse -msse2
-fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo
http://mirror.datapipe.net/gentoo http://mirrors.acm.cs.rpi.edu/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X aac aalib acl acpi alsa apm audiofile avi berkdb bitmap-fonts bzlib
canna cjk crypt cups dio directfb dvd encode esd fam fbcon flac foomaticdb
freewnn gdbm gif glx gpm gtk gtk2 imlib ipv6 java javascript jpeg libwww mad
maildir mikmod mmap mmx motif mpeg ncurses nls nptl nptlonly oggvorbis openal
opengl oss pam pcmcia pcre pdflib perl png python qt quicktime readline samba
sdl sharedmem spell sse ssl svga tcpd tiff truetype unicode usb xml2 xmms xpm xv
zlib"
Comment 1 Marc Gallagher 2005-01-04 00:11:02 UTC
I should mention that I am using baselayout-1.11.8
Comment 2 Roy Marples (RETIRED) gentoo-dev 2005-01-04 03:43:28 UTC
Created attachment 47567 [details, diff]
allows whitespace in essid keys and fixes iwconfig_get_essid_var error

This patch should fix the reported problems

To allow whitespace in keys, you need to configure as below
key_ESSID="s:'space test' enc open"

The quotes are NOT part the key, but define the key "space test"
Comment 3 Marc Gallagher 2005-01-04 20:52:11 UTC
Thanks a lot, that patch did the trick for me!
Comment 4 Roy Marples (RETIRED) gentoo-dev 2005-01-05 02:00:04 UTC
Applied to CVS - will be in baselayout-1.11.9
Comment 5 Roy Marples (RETIRED) gentoo-dev 2005-01-31 00:01:48 UTC
Fixed by baselayout-1.11.9