# rt61 failes because of net script problem

## Urd

Hi!

I'm currently setting up gentoo on my Notebook which is equipped with a rt61 WLAN card

```

lspci | grep RaLink

00:0b.0 Network controller: RaLink RT2561/RT61 rev B 802.11g

```

I'm using net-wireless/ralink-rt61 driver for it, because the other two drivers (rt61 and rt2x00) don't compile with my kernel.

I had the problem, that the card didn't work (not even if I configured it manually), dhcpcd just put out a time out error.

After some research I found out, that it seams to be very important in what order yo provide the driver with it's information.

The following (manual method) works for me:

```

# modprobe rt61

# ifconfig ra0 up

# iwconfig ra0 essid "network essid"

# iwpriv ra0 set AuthMethod=WPAPSK

# iwpriv ra0 set WPAPSK=secret_phrase

# iwpriv ra0 set EncrypType=TKIP

# dhcpcd ra0

# ifconfig ra0

ra0       Link encap:Ethernet  HWaddr 00:13:D3:75:1C:26  

          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::213:d3ff:fe75:1c26/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:287 errors:0 dropped:0 overruns:0 frame:0

          TX packets:330 errors:0 dropped:0 overruns:0 carrier:0

          collisions:1 txqueuelen:1000 

          RX bytes:30515 (29.7 Kb)  TX bytes:1197 (1.1 Kb)

          Interrupt:18 

```

With that method I almost immediately get the IP for the WLAN card. I haven't checked any other ordersyet, but it seams like that "EncrypType" has to be after "AuthMode" and "WPAPSK".

But now back to the net script.  When I run 

```

/etc/init.d/net.ra0 --verbose start

```

I get the following output:

```

 * Starting ra0

 *   Loading networking modules for ra0

 *     modules: apipa arping ccwgroup macchanger macnet rename iwconfig essidnet iptunnel ifconfig system dhcpcd ip6to4

 *       iwconfig provides wireless

 *       ifconfig provides interface

 *       dhcpcd provides dhcp

 *   Configuring ra0 for MAC address 00:13:D3:75:1C:26 ...                                                             [ ok ]

 *   Wireless extensions not found for ra0

 *   Bringing up ra0

 *     dhcp

 *       Running dhcpcd ...

Error, ra0: timed out                                                                                                  [ ok ]

 *       ra0 received address 169.254.123.222/16

```

Notice the "Wireless extensions not found for ra0"? Very strange I thought to myself. I went on and checked the /lib/rcscripts/net/iwconfig.sh script. I found out that it checks /proc/net/wireless for the presence of the card. But fr some reason my card isn't showing up there, even though it works when I configure it manually. Seems to be a bug in the rt61 module.

Maybe the /lib/rcscripts/net/iwconfig.sh script could be changed to check those "buggy" rt61 module in another way. I found out that iwconfig without any parameters would work good.

Here is an example:

```

# modprobe rt61

# iwconfig

eth0      no wireless extensions.

lo        no wireless extensions.

sit0      no wireless extensions.

ra0       no wireless extensions.

# ifconfig ra0 up

# iwconfig

eth0      no wireless extensions.

lo        no wireless extensions.

sit0      no wireless extensions.

ra0       RT61 Wireless  ESSID:""  Nickname:""

          Mode:Auto  Frequency:2.412 GHz  Bit Rate=54 Mb/s   

          RTS thr:off   Fragment thr:off

          Encryption key:off

```

See? After bringing the interface up the "No wireless extensions" message disappears for ra0. Maybe the net script could use that in addition to the current check (@Roy?  :Wink: ).

Unil that is fixed however I'll have to go without WLAN.

-Martin

----------

## NeddySeagoon

Urd,

Dirty Hack ...

Add the following to your /etc/conf.d/local.start

```
ifconfig ra0 up

/etc/init.d/net.ra0 restart
```

You may want start, rather than restart.

All this does is to allow the network to fail during its normal startup then do it again right at the very end of the boot process.

Like I said, its a dirty hack.

You may want to try allowing some settling time with the commands

```
sleep_scan_ra0="10"

associate_timeout_ra0="5"
```

in your net file tool.

Its not an issue when you bring the interface up by hand. The times are in seconds and are probably excessive.

You may want to file a bug at bugs.gentoo.org too.

What kernel do you have and what version of rt2x00 were you trying?

----------

## Urd

I fear that wouldn't help much. The problem i, that the script refuses to configure ra0 because it cannot find it in /proc/net/wirelss. So it doesn't matter much where or when you start it.

I currently use sys-kernel/gentoo-sources-2.6.22-r8.

The rt2x00 is the one currently available in portage.  net-wireless/rt2x00-9999

----------

## NeddySeagoon

Urd,

If you are feeling a little adventurous, you could try baselayout-2...

Its marked as testing on x86 and amd64 and is also hardmasked until all archs have keyworded it.

It will give you a new set of scripts.

You can also try some gentle ebuild hacking. the rt2x00-9999 ebuild fails as the kernel config symbol, CONFIG_NET_RADIO has been removed in the 2.6.22 kernel, so the check fails. you can back off kernel versions unitil the ebuild works or remove the check.

There is a ready patched ebuild in my net-wireless overlay here Its not tested against your device (I have a rt73) nor your exact kernel. Play with it if you want to.

----------

