Bug 49021 - WIRELESS test in net.agent calls everything wireless...
Summary: WIRELESS test in net.agent calls everything wireless...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: hotplug
Version: 7.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Trond Eivind Glomsrxd
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-07-13 01:33 UTC by Michael K. Johnson
Modified: 2007-04-18 16:34 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-04-12 17:04:28 UTC
Embargoed:


Attachments (Terms of Use)

Description Michael K. Johnson 2001-07-13 01:33:46 UTC
Description of Problem:

WIRELESS test in /etc/hotplug/net.agent is broken

How Reproducible:

add to /etc/hotplug/net.agent

exec 2>/tmp/asdf
set -x

Then plug in a wireless and wired pcmcia/cardbus cards
alternately and look at /tmp/asdf each time

There are at least two bugs in the line
    iwconfig $INTERFACE | grep -q "no wireless extensions" || WIRELESS=1
The first is that if grep wants to write, it will error out
instead of writing with "bad file descriptor" because stdout does
not exist.

The second, and most critical, is that "no wireless extensions" is
printed on iwconfig's *standard error* not standard out, so grep
can never see it.  Please change to
    iwconfig $INTERFACE 2>&1 | \
      grep "no wireless extensions" >/dev/null 2>&1 || WIRELESS=1
That will fix both bugs at once.

Comment 1 Michael K. Johnson 2001-07-13 02:15:34 UTC
Well, I did say at least two bugs.

The | actually causes the WIRELESS=1 to be evaluated in a subshell.
Because iwconfig is broken and doesn't know how to just look to see
if there are any wireless extensions, we have to use eval.  Yes, this
is ugly, but it is also now tested more...

    eval $(iwconfig $INTERFACE 2>&1 | grep -q "no wireless extensions"
>/dev/null 2>&1 || echo WIRELESS=1)

That I've tested enough times to have reasonable confidence that it
is right.

Comment 2 Bill Nottingham 2001-07-13 15:18:27 UTC
It could also load the network-functions file and use the is_wireless test
there. Of course, that would tie it to having at least a particular version
of initscripts.

Comment 3 Trond Eivind Glomsrxd 2001-07-13 23:02:26 UTC
I'll do what notting suggests.

Comment 4 Bill Nottingham 2001-07-17 04:43:16 UTC
Make that four bugs in the script. You forgot:

- uses completely bogus variable ${REALDEVICE}
- doesn't normalize output of 'ip' commmand case wise

Wheeeeeeeee. Also fixed the original, just using a simple if !iwconfig ... ;
then <do stuff>; seems simpler to read, at least.

Fixed in 2001-04-24-7.




Comment 5 Michael K. Johnson 2002-02-02 23:12:56 UTC
I just installed 7.2, and this is NOT all fixed.  grep NEEDS A FILE DESCRIPTOR
and it kills the script if you don't have one.  EVERY SINGLE ethernet card you
insert has the wireless bits run because grep complains with
grep: writing output: Bad file descriptor
All you have to do to test this is add
exec 2>> /tmp/netagent.log
set -x
to the top of /etc/hotplug/net.agent and then insert a card with no
wireless extensions.

Comment 6 Michael K. Johnson 2002-02-02 23:20:11 UTC
(just installed 7.2 on the machine I noticed this on originally, that is;
the only machine where I have a setup that shows up this bug.)

To make this clear, you ABSOLUTELY MUST give grep file descriptors to
write on, or it aborts.  The hotplug daemon does not do so.  Either add
exec >/dev/null
exec 2>/dev/null
in hotplug.functions, or go through and fix every instance in the hotplug
scripts AND all the networking scripts that get called through hotplug to
explicitly redirect output, or modify the hotplug daemon to open /dev/null
for stdout and stderr.  Using the "-q" argument to grep is not enough here.
I know it looks prettier than ">/dev/null 2>&1" but the two are not
synonyms.

Comment 7 Trond Eivind Glomsrxd 2002-04-11 19:03:11 UTC
Is this still a problem in skipjack2 or later? Some grep issues have been
adresses, and a new hotplug is in...

Comment 8 Michael K. Johnson 2002-04-12 17:04:24 UTC
As I wrote before:
>EVERY SINGLE ethernet card you
>insert has the wireless bits run because grep complains with
>grep: writing output: Bad file descriptor
>All you have to do to test this is add
>exec 2>> /tmp/netagent.log
>set -x
>to the top of /etc/hotplug/net.agent and then insert a card with no
>wireless extensions.

Have you done that?  I'm out of range of a skipjack machine right now.

Comment 9 Trond Eivind Glomsrxd 2002-08-15 22:41:32 UTC
Hotplug no longer handles wireless cards at all, in the latest limbo beta.


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