This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 49021 - WIRELESS test in net.agent calls everything wireless...
WIRELESS test in net.agent calls everything wireless...
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: hotplug (Show other bugs)
7.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Trond Eivind Glomsrxd
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-07-12 21:33 EDT by Michael K. Johnson
Modified: 2007-04-18 12:34 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-04-12 13:04:28 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Michael K. Johnson 2001-07-12 21:33:46 EDT
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-12 22:15:34 EDT
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 11:18:27 EDT
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 19:02:26 EDT
I'll do what notting suggests.
Comment 4 Bill Nottingham 2001-07-17 00:43:16 EDT
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 18:12:56 EST
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 18:20:11 EST
(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 15:03:11 EDT
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 13:04:24 EDT
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 18:41:32 EDT
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.