Bug 379071 - Wishlist: ifup-wireless pick essid from list
Summary: Wishlist: ifup-wireless pick essid from list
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 7
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-11-12 23:46 UTC by Penelope Fudd
Modified: 2014-03-17 03:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-11-13 14:38:42 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Penelope Fudd 2007-11-12 23:46:04 UTC
Description of problem:
If I set my work ESSID in /etc/sysconfig/network-scripts/ifcfg-eth1 (my wifi
card), then I won't be able to get connected at home, and vice-versa.

Version-Release number of selected component (if applicable):
initscripts-8.54.1-1

How reproducible:
Always

Steps to Reproduce:
1. edit /etc/sysconfig/network-scripts/ifcfg-eth1
2. change ESSID= to 'ESSID=mywork'
3. go home and type 'ifup eth1'
  
Actual results:
Determining IP information for eth1... failed; no link present.  Check cable?


Expected results:
Determining IP information for eth1... done.


Additional info:

My patch is this:
------------------------
--- ifup-wireless.orig  2007-11-12 15:33:27.000000000 -0800
+++ ifup-wireless       2007-11-12 15:27:21.000000000 -0800
@@ -94,6 +94,13 @@
 # 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 the ESSID is a list separated by '|' , then scan for those.
+# Set ESSID to blank if none found, else pick first one.
+  if [[ "$ESSID" =~ "|" ]]; then
+  ESSID=`iwlist $DEVICE scan | gawk '{if (match($0,"ESSID:\"('$ESSID')\""))
{print substr($0,RSTART+7,RLENGTH-8);exit}}'`
+fi
+
 if [ -n "$ESSID" ] ; then
     iwconfig $DEVICE essid "$ESSID"
 else
--------------

Then I can put 
 ESSID='mywork|myhome'
into /etc/sysconfig/network-scripts/ifcfg-eth1 and everything just works.

I would have used the blank ESSID, except there's a commercial wifi ap near
work, and I'd randomly connect to that one instead of my work one.

A further enhancement would be to change the '|' to something that won't be
interpreted by the shell, as system-config-network discards the quotes.

Comment 1 Bill Nottingham 2007-11-13 14:38:42 UTC
This sort of thing is *much* better solved by using NetworkManager.  You can
also do multiple ifcfg files, such as:

ifcfg-work:
DEVICE=wlan0
ESSID=foo

ifcfg-home:
DEVICE=wlan0
ESSID=bar



Note You need to log in before you can comment on or make changes to this bug.