# wpa_supplicant and wireless-tools. Odd behavior

## vortex_3

Hello everyone,

I had installed on my system only the wpa_supplicant tool to connect to my wireless network. Recently, I should install something (maybe an update to firefox?) that also install the wireless-tools. After that, on the next reboot my PC didn't automatically connect to the wireless as usual. I got an error like this

```
 * Starting wlan0

SIOCSIFFLAGS: Unknown error 132

SIOCSIFFLAGS: Unknown error 132

SIOCSIFFLAGS: Unknown error 132

 *   Configuring wireless network for wlan0

 *   wlan0 does not support scanning

 *   You either need to set a preferred_aps list in /etc/conf.d/wireless

 *      preferred_aps=( "ESSID1" "ESSID2" )

 *      and set associate_order_wlan0="forcepreferred"

 *      or set associate_order_wlan0="forcepreferredonly"

 *   or hardcode the ESSID to "any" and let the driver find an Access Point

 *      essid_wlan0="any"

 *   or configure defaulting to Ad-Hoc when Managed fails

 *      adhoc_essid_wlan0="WLAN"

 *   or hardcode the ESSID against the interface (not recommended)

 *      essid_wlan0="ESSID"

 *   Failed to configure wireless for wlan0
```

It was a little strange for me because I had selected wpa_supplicant over wireless-tools on the /etc/conf.d/net file. 

I uninstalled wireless-tools and everything worked just fine as before.

I start to search what could be the problem and I found some results that I didn't fully understand.

When both programs are installed, I found that the problem is the position of the line: "modules=( "dhcpcd" )" on the /etc/conf.d/net file. If that line is placed after "modules=( "wpa_supplicant" )" it didn't work.

I mean, when this is my /etc/conf.d/net file:

```
modules=( "ifconfig" )

config_eth0=("dhcp")

fallback_eth0=( "null" )

modules=( "wpa_supplicant" )

modules=( "dhcpcd" )

wpa_supplicant_wlan0="-Dwext" # For generic wireless

config_wlan0=( "dhcp" )

dhcpcd_eth0="-t 3"
```

I get this:

```
# /etc/init.d/net.wlan0 restart

 * Starting wlan0

SIOCSIFFLAGS: Unknown error 132

SIOCSIFFLAGS: Unknown error 132

SIOCSIFFLAGS: Unknown error 132

 *   Configuring wireless network for wlan0

 *   wlan0 does not support scanning

 *   You either need to set a preferred_aps list in /etc/conf.d/wireless

 *      preferred_aps=( "ESSID1" "ESSID2" )

 *      and set associate_order_wlan0="forcepreferred"

 *      or set associate_order_wlan0="forcepreferredonly"

 *   or hardcode the ESSID to "any" and let the driver find an Access Point

 *      essid_wlan0="any"

 *   or configure defaulting to Ad-Hoc when Managed fails

 *      adhoc_essid_wlan0="WLAN"

 *   or hardcode the ESSID against the interface (not recommended)

 *      essid_wlan0="ESSID"

 *   Failed to configure wireless for wlan0
```

However, if I changed that line an put it before "modules=( "wpa_supplicant" )":

```
modules=( "ifconfig" )

config_eth0=("dhcp")

fallback_eth0=( "null" )

modules=( "dhcpcd" )

modules=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext" # For generic wireless

config_wlan0=( "dhcp" )

dhcpcd_eth0="-t 3"
```

It works:

```
# /etc/init.d/net.wlan0 restart

 * Caching service dependencies ...

 *  Cannot add provide 'net', as a service with the same name exists!  [ ok ]

 * Starting wlan0

SIOCSIFFLAGS: Unknown error 132

SIOCSIFFLAGS: Unknown error 132

 *   Starting wpa_supplicant on wlan0 ...                                             [ ok ]

 *   Starting wpa_cli on wlan0 ...                                                        [ ok ]

 *     Backgrounding ...
```

[Note: Even though I get those 2 error messages, my network was still working as normal. I'm still working on why are those errors there.]

However, I uninsintalled wirelss-tools and reload the wireless modules 

```
# emerge --unmerge net-wireless/wireless-tools

# rmmod iwlagn

# modprobe iwlagn
```

and put the /etc/conf.d/net configuration file back to the previous state (dhcpcd after wpa_supplicant)

```
modules=( "ifconfig" )

config_eth0=("dhcp")

fallback_eth0=( "null" )

modules=( "wpa_supplicant" )

modules=( "dhcpcd" )

wpa_supplicant_wlan0="-Dwext" # For generic wireless

config_wlan0=( "dhcp" )

dhcpcd_eth0="-t 3"
```

and it worked without any error:

```
# /etc/init.d/net.wlan0 restart

 * Stopping wlan0

 *   Bringing down wlan0

 *     Stopping dhcpcd on wlan0 ...                              [ ok ]

 *     Shutting down wlan0 ...                                      [ ok ]

 *     Stopping wpa_cli on wlan0 ...                             [ ok ]

 *     Stopping wpa_supplicant on wlan0 ...                  [ ok ]

 * Starting wlan0

 *   Starting wpa_supplicant on wlan0 ...                     [ ok ]

 *   Starting wpa_cli on wlan0 ...                                [ ok ]

 *     Backgrounding ...
```

Is there anything that I am missing there? have I overlooked something?

I would appreciated any tips or suggest about where the problem could be.

Thanks!

----------

