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

Bug 88175

Summary: Multiple hidden ESSIDs not supported in baselayout-1.11.10-r4
Product: Gentoo Linux Reporter: georg.lippold
Component: [OLD] baselayoutAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: uberlord
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
URL: http://gentoo-wiki.com/Talk:HOWTO_Wireless_Configuration_and_Startup#How_can_I_have_multiple_hidden_ESSIDs_in_.2Fetc.2Fconf.d.2Fwireless
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 66472    
Attachments: /etc/conf.d/net

Description georg.lippold 2005-04-06 08:53:38 UTC
In /etc/conf.d/wireless I tried to set

essid_ethX=( "ESSID1" "ESSID2" )

and

key_ESSID1="0123-4567-890A-..."
key_ESSID2="ABCD-..."

because I have two WLAN's with hidden ESSID's and different keys I try to access. With baselayout-1.11.10-r4 my computer is only associated with the first listed ESSID but not with the second. For the "old" baselayout I worked out a patch for /etc/init.d/net.ethX. in iface_start(), put this before trying to assign an IP adress:

# split essid's
local essids=( \"\$\{essid_$iface\[@\]\}\" )
# do this only for wireless interfaces
if [[ -n ${iwconfig_IFACE} ]]; then
  # sequentially go through essids
  for essid in ${essids} ; do
     # replace all invalid chars by underscore (so it works with /etc/conf.d/wireless)
     local ESSID_IF=`echo "${essid}" | sed s,'[^A-Za-z_]','_',g`
     # get the key for the interface
     eval key=( \"\$\{key_$ESSID_IF\}\" )
     # and configure it
     iwconfig ${IFACE} essid "${essid}" key "${key}"
     # get Access Point MAC
     local APMAC=`iwconfig ${IFACE} | grep Access | awk '{ print $NF; }'`
     if [[ ${APMAC} != "00:00:00:00:00:00" ]] ; then
       # we are connected
       break
     fi
  done
fi

then, after the first working access point is found the interface will be set up with an IP. But I cannot figure out how to add this to /lib/rcscripts/net.modules.d/iwconfig in function iwconfig_associate().

Maybe you can help?

Reproducible: Always
Steps to Reproduce:
1. configure your access point with a hidden essid
2. in /etc/conf.d/wireless set essid_ethX=( "essid_invalid" "your_essid" )
3. run /etc/conf.d/net.ethX restart
Actual Results:  
The interface is not associated with the right access point.

Expected Results:  
The interface should have been associated to the access point with the second essid.
Comment 1 Roy Marples (RETIRED) gentoo-dev 2005-04-06 09:04:54 UTC
Marking as INVALID

essid_ethX is used to assign an ESSID to the network card - you cannot assign more than one

what you need is as follows

preferred_aps=( "ESSID1" "ESSID2" )
associate_order="forcepreferredonly"

see /etc/conf.d/wireless.example for a description of how these work
Comment 2 georg.lippold 2005-04-07 02:52:38 UTC
I tried this, but it doesn't work with WEP-keys for the access points. I get a connection to my access point only if both key and essid are correct. I monitored the settings for ethX with a watch iwconfig ethX. With your recommendation, the script really cycles through the essids but the keys are not applied correctly prior or while connecting. It may be that this is a card specific issue (I have an iwp2200) but for me it only works with essid and key set correctly. Otherwise my card won't associate.
Comment 3 Roy Marples (RETIRED) gentoo-dev 2005-04-07 03:03:37 UTC
Please set RC_VERBOSE="yes" in /etc/conf.d/rc
Then post/attach the output of the script starting.
Lastly, post/attach your conf.d/net and conf.d/wireless files

Or, if you're paranoid about keys, essids, mail them to me
Comment 4 georg.lippold 2005-04-07 11:35:18 UTC
Output of /etc/init.d/net.eth1 restart:
 # /etc/init.d/net.eth1 restart
 * Caching service dependencies ...                                            [ ok ]
 * Starting eth1
 *    Loading networking modules for eth1
 *       modules: iwconfig essidnet iptunnel ifconfig adsl dhcpcd apipa
 *          iwconfig provides wireless
 *          ifconfig provides interface
 *          dhcpcd provides dhcp
 *    Configuring wireless network for eth1
 *    Trying to force preferred in case they are hidden
 *    Connecting to "WLAN-Georg" (WEP Disabled) ...                            [ !! ]
 *    Connecting to "Uni-Bremen" (WEP Disabled) ...                            [ !! ]
 *    Failed to associate with any preferred access points on eth1
 *    Couldn't find any access points on eth1
 *    Failed to configure wireless for eth1                                    [ !! ]

/etc/conf.d/wireless is:
associate_order_eth1="forcepreferredonly"
key_WLAN_Georg="ABCD-EF12-3456-7890-0987-6543-21"
nameservers_Uni_Bremen=( "134.102.200.14" "134.102.20.20" )
nameservers_WLAN_Georg=( "192.168.0.2" "134.102.200.14" "134.102.20.20" )
preferred_aps=( "WLAN-Georg" "Uni-Bremen" )
searchdomains_Uni_Bremen="informatik.uni-bremen.de uni-bremen.de"
searchdomains_WLAN_Georg="wlan.netz informatik.uni-bremen.de uni-bremen.de"

/etc/conf.d/net is attached
Comment 5 georg.lippold 2005-04-07 11:36:06 UTC
Created attachment 55574 [details]
/etc/conf.d/net
Comment 6 Roy Marples (RETIRED) gentoo-dev 2005-04-08 03:57:48 UTC
I cannot replicate your issue :(

You could also try setting associate_test_eth1="quality"

If that fails, we need to debug some stuff.

Add some lines to /lib/rcscripts/net.modules.d/iwconfig ?
After line 334 key=$( iwconfig_get_wep_key ${mac} )

echo "ESSIDVAR = ${ESSIDVAR}"
echo "key = ${key}"

If the key is "off" then try changing line 333 to read
LC_ALL=C ESSIDVAR=${ESSID//[![:word:]]/_}

and post the output again please - also, take note of ESSIDVAR and tell me if they are different after making the LC_ALL=C change.
Comment 7 georg.lippold 2005-04-08 08:49:57 UTC
Yes, replacing Line 333 with 

LC_ALL=C ESSIDVAR=${ESSID//[![:word:]]/_}

helped me very much. Now it works for me :) Thanks! Before the change, the output of the script was

 *    Configuring wireless network for eth1
 *    Trying to force preferred in case they are hidden
ESSIDVAR = 
key = off
 *    Connecting to "WLAN-Georg" (WEP Disabled) ...                            [ !! ]
ESSIDVAR = 
key = off
 *    Connecting to "Uni-Bremen" (WEP Disabled) ...                            [ !! ]
 *    Failed to associate with any preferred access points on eth1
 *    Couldn't find any access points on eth1
 *    Failed to configure wireless for eth1                                    [ !! ]

and now it is

 * Starting eth1
 *    Loading networking modules for eth1
 *       modules: iwconfig essidnet iptunnel ifconfig adsl dhcpcd apipa
 *          iwconfig provides wireless
 *          ifconfig provides interface
 *          dhcpcd provides dhcp
 *    Configuring wireless network for eth1
 *    Trying to force preferred in case they are hidden
ESSIDVAR = WLAN_Georg
key = ABCD-EF12-3456-7890-0987-6543-21
 *    Connecting to "WLAN-Georg" (WEP enabled - open) ...                      [ ok ]
 *       eth1 connected to "WLAN-Georg" at 00:01:36:07:16:E1
 *       in managed mode (WEP enabled - open)
 *    Configuring eth1 for "WLAN-Georg" ...                                    [ ok ]
 *    Bringing up eth1
 *       dhcp
 *          Running dhcpcd ...                                                 [ ok ]
 *          eth1 received address 192.168.0.100
 *    Running postup function

Very nice :)

Please include this in upcoming versions of baselayout!