Bug 379071

Summary: Wishlist: ifup-wireless pick essid from list
Product: [Fedora] Fedora Reporter: Penelope Fudd <bugzilla.redhat.com>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 7CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-13 14:38:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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):

How reproducible:

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}}'`
 if [ -n "$ESSID" ] ; then
     iwconfig $DEVICE essid "$ESSID"

Then I can put 
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: