Bug 379071 - Wishlist: ifup-wireless pick essid from list
Wishlist: ifup-wireless pick essid from list
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
7
All Linux
low Severity low
: ---
: ---
Assigned To: Bill Nottingham
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-11-12 18:46 EST by Penelope Fudd
Modified: 2014-03-16 23:11 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-11-13 09:38:42 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Penelope Fudd 2007-11-12 18:46:04 EST
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 09:38:42 EST
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.