fails to set the WEP encryption key (rt2500)

Bug #42282 reported by PC
6
Affects Status Importance Assigned to Milestone
wireless-tools (Ubuntu)
Incomplete
Medium
Scott James Remnant (Canonical)

Bug Description

My wep key is never set properly on startup
the issue seems to be in the ifup binary since it fails to run the /etc/networking/if-pre-up.d/wireless-tools script correctly (maybe a variable name typo in the compiled binary?).

The workaround is currently to set the key manually with

iwconfig ethx key XXXXXXXXXX

Revision history for this message
sam tygier (samtygier) wrote :

can you post your /etc/network/interfaces.

X out the wep keys if you need.

Changed in ifupdown:
status: Unconfirmed → Needs Info
Revision history for this message
PC (pieter-claassen) wrote :

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.

iface eth2 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.1
wireless-essid AAA
wireless-key AABBCCDDEE

#auto eth2

iface wlan0 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.1
wireless-essid AAA
wireless-key AABBCCDDEE

#auto wlan0

iface eth1 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.1
wireless-essid AAA
wireless-key AABBCCDDEE

auto eth1

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Add the following to the top of /etc/network/if-pre-up.d/wireless-tools (just before the IWCONFIG= line)

    eval 2>/tmp/wireless.log
    set -x

Run ifdown/ifup for an interfact that the key isn't set for, and then attach /tmp/wireless.log

Thanks

Changed in ifupdown:
assignee: nobody → keybuk
Revision history for this message
PC (pieter-claassen) wrote : Re: [Bug 42282] Re: ifup fails to set the WEP encryption key properly

Hi Scott, the eval didn't work but I just dumped the stdout verbatim
here.

root@desktop:/tmp# ifdown eth1
root@desktop:/tmp# ifup eth1
+ IWCONFIG=/sbin/iwconfig
+ '[' '!' -x /sbin/iwconfig ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n AABBCCDDEE ']'
+ /sbin/iwconfig eth1 key AABBCCDDEE
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n WLAN ']'
+ /sbin/iwconfig eth1 essid WLAN
+ '[' -n '' ']'
Error : Temporary failure in name resolution

On Tue, 2006-05-02 at 14:07 +0000, Scott James Remnant wrote:
> Add the following to the top of /etc/network/if-pre-up.d/wireless-tools (just before the IWCONFIG= line)
>
> eval 2>/tmp/wireless.log
> set -x
>
> Run ifdown/ifup for an interfact that the key isn't set for, and then attach /tmp/wireless.log
>
> Thanks
>
> ** Changed in: ifupdown (Ubuntu)
> Assignee: (unassigned) => Scott James Remnant
>

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote : Re: ifup fails to set the WEP encryption key properly

Ok, so the key has been set correctly ...

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote : Re: fails to set the WEP encryption key

Your card may be one of those that requires the mode to be set first...

could you try adding

wireless-mode managed

to your /etc/network/interfaces rules and see whether that improves matters?

Revision history for this message
PC (pieter-claassen) wrote : Re: [Bug 42282] Re: fails to set the WEP encryption key

Info included below.

If I do the following by hand, it still works.
iwconfig eth1 key AABBCCDDEE
iwconfig eth1 essid WLAN

The card uses the RT2500 driver that comes with the ubuntu distro.

root@desktop:/etc/network# ifup eth1
+ IWCONFIG=/sbin/iwconfig
+ '[' '!' -x /sbin/iwconfig ']'
+ '[' -n '' ']'
+ '[' -n managed ']'
+ /sbin/iwconfig eth1 mode managed
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n AABBCCDDEE ']'
+ eval /sbin/iwconfig eth1 key AABBCCDDEE
++ /sbin/iwconfig eth1 key AABBCCDDEE
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n WLAN ']'
+ /sbin/iwconfig eth1 essid WLAN
+ '[' -n '' ']'
Error : Temporary failure in name resolution

On Tue, 2006-05-02 at 15:21 +0000, Scott James Remnant wrote:
> Your card may be one of those that requires the mode to be set first...
>
> could you try adding
>
> wireless-mode managed
>
> to your /etc/network/interfaces rules and see whether that improves matters?
>

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote : Re: fails to set the WEP encryption key

And you can confirm that the commands run by the wireless-tools script are identical in both order, quoting, etc. in EVERY WAY to the commands you run that "make it work" ?

I'm afraid if that's the case, there's no information here that reveals the bug -- you're saying that there's a difference between you running a command on the shell, and the exact same command being run by a shell script.

There must be some other difference at work here.

After running "ifup eth1", please prove this is failing by providing /var/log/syslog which will show the dhclient attempts and the output of "ifconfig eth1" once an address has been found.

Revision history for this message
PC (pieter-claassen) wrote : Re: [Bug 42282] Re: fails to set the WEP encryption key
Download full text (4.4 KiB)

I don't use dhcp on this interface, but notice that once the interface
comes up with a static ip it still leases a dhcp ip (bottom of mail).
The sequence by hand is exactly the same as that in wireless-tools

What state does ifdown leave the iwconfig settings? Notice that ifdown
removes the key but not the essid from the wireless interface. If I
don't use ifdown but just take the inteface down with ifconfig, then
ifup brings the interface up no problem.

root@desktop:~# ifdown eth1
Error for wireless request "Set Mode" (8B06) :
    SET failed on device eth1 ; Invalid argument.

root@desktop:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
iface eth1 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.1
wireless-mode managed
wireless-essid WLAN
wireless-key AABBCCDDEE

auto eth1

root@desktop:~# tail -2 /var/log/syslog

May 3 19:08:41 localhost dhclient: DHCPDISCOVER on eth1 to
255.255.255.255 port 67 interval 19
May 3 19:08:41 localhost dhclient: send_packet: Network is down

root@desktop:~# iwconfig eth1
eth1 RT2500 Wireless ESSID:"WLAN"
          Mode:Managed Frequency=2.412 GHz Bit Rate:18 Mb/s
          RTS thr:off Fragment thr:off
          Encryption key:off
          Link Quality=44/100 Signal level=-63 dBm Noise level:-205
dBm
          Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
          Tx excessive retries:0 Invalid misc:0 Missed beacon:0

root@desktop:~# ifup eth1
+ IWCONFIG=/sbin/iwconfig
+ '[' '!' -x /sbin/iwconfig ']'
+ '[' -n '' ']'
+ '[' -n managed ']'
+ /sbin/iwconfig eth1 mode managed
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n AABBCCDDEE ']'
+ eval /sbin/iwconfig eth1 key AABBCCDDEE
++ /sbin/iwconfig eth1 key AABBCCDDEE
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n WLAN ']'
+ /sbin/iwconfig eth1 essid WLAN
+ '[' -n '' ']'
root@desktop:~# iwconfig
lo no wireless extensions.

eth1 RT2500 Wireless ESSID:"WLAN"
          Mode:Managed Frequency=2.412 GHz Bit Rate:54 Mb/s
          RTS thr:off Fragment thr:off
          Encryption key:off
          Link Quality=44/100 Signal level=-63 dBm Noise level:-204
dBm
          Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
          Tx excessive retries:0 Invalid misc:0 Missed beacon:0

eth0 no wireless extensions.

sit0 no wireless extensions.

tun0 no wireless extensions.

root@desktop:~# iwconfig eth1 key AABBCCDDEE
root@desktop:~# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=4.99 ms

--- 192.168.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss,...

Read more...

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote : Re: fails to set the WEP encryption key

That's interesting, this implies that your card needs the ESSID set before the Wireless Key, which is actually exactly the opposite to most cards.

If you move the following bit of code to the top of the wireless-tools script, does that make things work?

if [ -n "$IF_WIRELESS_ESSID" ]; then
  $IWCONFIG "$IFACE" essid "$IF_WIRELESS_ESSID"
fi

Revision history for this message
PC (pieter-claassen) wrote : Re: [Bug 42282] Re: fails to set the WEP encryption key
Download full text (13.1 KiB)

Scott, it is really weird.

I changed the code as requested but it didn't solve the problem (even
though manually, the card doesn't care which way I do it anyhow).

I noticed in syslog that the wireless interface eth1, even though it is
set to static IP still leases and IP successfully but then overrides it
with the static IP.

I included an strace of the ifdown eth1 and ifup eth1 FYI.

dmesg indicates that my machines thinks that my rtl8139 card is also on
eth1. Maybe that is the issue. How do I force my interfaces to be
different? (Just rmmod 8139too didn't work).

Cheers,
Pieter

On Wed, 2006-05-03 at 17:38 +0000, Scott James Remnant wrote:
> That's interesting, this implies that your card needs the ESSID set before the Wireless Key, which is actually exactly the opposite to most cards.
>
> If you move the following bit of code to the top of the wireless-tools script, does that make things work?
>
> if [ -n "$IF_WIRELESS_ESSID" ]; then
> $IWCONFIG "$IFACE" essid "$IF_WIRELESS_ESSID"
> fi
>
> ** Summary changed:
>
> - fails to set the WEP encryption key
> + fails to set the WEP encryption key (rt2500)
>

execve("/sbin/ifdown", ["ifdown", "eth1"], [/* 37 vars */]) = 0
uname({sys="Linux", node="desktop", ...}) = 0
brk(0) = 0x804f000
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f57000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
old_mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f55000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=82358, ...}) = 0
old_mmap(NULL, 82358, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f40000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220O\1"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1232784, ...}) = 0
old_mmap(NULL, 1238972, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7e11000
old_mmap(0xb7f36000, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x125000) = 0xb7f36000
old_mmap(0xb7f3d000, 10172, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7f3d000
close(3) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7e10000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7e108e0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
munmap(0xb7f40000, 82358) = 0
fcntl64(0, F_GETFD) = 0
fcntl64(1, F_GETFD) = 0
fcntl64(2, F_GETFD) = 0
brk(0) = 0x804f000
brk(0x8070000) = 0x8070000
open("/etc/network/interfaces", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=486, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f5...

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Attach complete output of "ifconfig -a" and /etc/iftab

Revision history for this message
PC (pieter-claassen) wrote : Re: [Bug 42282] Re: fails to set the WEP encryption key (rt2500)

root@desktop:/tmp# ifconfig -a
eth1 Link encap:Ethernet HWaddr 00:50:18:3B:B8:80
          inet addr:192.168.1.36 Bcast:192.168.1.255
Mask:255.255.255.0
          inet6 addr: fe80::250:18ff:fe3b:b880/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:1855006 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1203089 errors:13919 dropped:13919 overruns:0
carrier:0
          collisions:206292 txqueuelen:1000
          RX bytes:2478813485 (2.3 GiB) TX bytes:173190374 (165.1 MiB)
          Interrupt:11 Base address:0x4000

lo Link encap:Local Loopback
          inet addr:127.0.0.1 Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING MTU:16436 Metric:1
          RX packets:1415811 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1415811 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:640374359 (610.7 MiB) TX bytes:640374359 (610.7 MiB)

sit0 Link encap:IPv6-in-IPv4
          NOARP MTU:1480 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

root@desktop:~# cat /etc/iftab
# This file assigns persistent names to network interfaces. See
iftab(5).
eth0 mac 00:0a:e6:18:25:e5

On Wed, 2006-05-03 at 20:57 +0000, Scott James Remnant wrote:
> Attach complete output of "ifconfig -a" and /etc/iftab
>

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

I don't see any eth0 being detected in the "ifconfig -a" output there, this was after a fresh boot and not after you'd rmmod'd the card, yes?

Revision history for this message
PC (pieter-claassen) wrote :

Yes, you are right. After a fresh boot, things look normal with wired
card seen as eth0 and wireless as eth1

However, this did happen after the interface was renamed from ra0 to
eth1 which I think happened some time before the dapper upgrade.

I am at a loss. Summarised are the facts:

During ifdown, there is an error
+ /sbin/iwconfig eth1 mode auto
Error for wireless request "Set Mode" (8B06) :
    SET failed on device eth1 ; Invalid argument.

The card is left after ifdown without a key but the essid and mode is
still set.

on ifup eth1 the card is left without a key (even though if I cut and
paste the code from the set -x into the command line, it all works).

The additional errors we see is from the other code run
in /etc/netork/if-up.d/[openvpn|ntpdate]

I tried to have a look at the ifup/ifdown source but it didn't look like
normal c.

if I run iwconfig eth 1 key AABBCCDDEE after running ifup eth1, then all
works fine.

I really am at a loss as to where to look next.

Cheers,
P

On Wed, 2006-05-03 at 22:36 +0000, Scott James Remnant wrote:
> I don't see any eth0 being detected in the "ifconfig -a" output there,
> this was after a fresh boot and not after you'd rmmod'd the card, yes?
>

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

We have many other resports of problems with this driver not working correctly, merged with the kernel report

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.