3

Some time ago i was here asking for help regarding how to set up a RPi with a realtek rtl8188CUS based dongle (TRENDNET TEW-648UBM) as access point

As reported in the link above, everything was working fine, until the sd card started to throw out some errors, and i had to reflash. I reflashed with the latest wheezy (2013-07) (but i tried also 2013-05 and 2013-02 without success, the latter was also what i was using before.)

I had everything backed up, so i could restore the previous access point configuration. The problem i am having is that hostapd now stopped working :(

So, short recap:

  • the stock 8192cu driver that comes with wheezy was working fine in managed and master mode, and it is still working fine, after the reflashing, but in managed mode only (e.g., to connect to another access point).

  • setting the interface in master mode using the wireless-tools provided by realtek still works.

  • i was using the isc-dhcp-server, and the configuration has not changed (i am using the backed up configuration)

Now what happening now: if, after reboot, i run hostapd (realtek version, latest, 3.4.4-4749), what i get is

root@raspberrypi:~# hostapd /etc/hostapd/hostapd.conf 
Configuration file: /etc/hostapd/hostapd.conf
drv->ifindex=3
l2_sock_recv==l2_sock_xmit=0x0x125e638
+rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
rtl871x_set_key_ops
rtl871x_set_key_ops
rtl871x_set_key_ops
rtl871x_set_key_ops
Using interface wlan0 with hwaddr d8:eb:97:14:06:4f and ssid 'RTL8188CUS'
rtl871x_set_wps_assoc_resp_ie
rtl871x_set_wps_beacon_ie
rtl871x_set_wps_probe_resp_ie
random: Only 17/20 bytes of strong random data available from /dev/random
random: Not enough entropy pool available for secure operations
WPA: Not enough entropy in random pool for secure operations - update keys later when the first station connects
rtl871x_set_key_ops
rtl871x_set_beacon_ops
rtl871x_set_hidden_ssid_ops
+rtl871x_get_sta_wpaie, 08:d4:2b:1a:cd:2c is sta's address
wlan0: STA 08:d4:2b:1a:cd:2c IEEE 802.11: associated
rtl871x_set_key_ops
rtl871x_set_key_ops
rtl871x_set_key_ops
+rtl871x_send_eapol
+rtl871x_send_eapol
rtl871x_set_key_ops
wlan0: AP-STA-CONNECTED 08:d4:2b:1a:cd:2c
wlan0: STA 08:d4:2b:1a:cd:2c RADIUS: starting accounting session 520782E0-00000000
wlan0: STA 08:d4:2b:1a:cd:2c WPA: pairwise key handshake completed (RSN)     
rtl871x_set_key_ops
+rtl871x_sta_remove_ops, 08:d4:2b:1a:cd:2c is sta address removed
+rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
ELOOP: remaining socket: sock=6 eloop_data=0x125e6a8 user_data=(nil)    handler=0x29df0
root@raspberrypi:~#    

In other words, when i run it the first time, it almost works, when i connect to the network from a device it succeed, but i cannot exchange data, and after a few seconds hostapd shuts down with that deauth message i don't understand.
When i try to bring hostapd up again i get:

root@raspberrypi:~# hostapd /etc/hostapd/hostapd.conf 
Configuration file: /etc/hostapd/hostapd.conf
drv->ifindex=6
l2_sock_recv==l2_sock_xmit=0x0x1bfa638
+rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
rtl871x_set_key_ops
rtl871x_set_key_ops
rtl871x_set_key_ops
rtl871x_set_key_ops
Using interface wlan0 with hwaddr d8:eb:97:14:06:4f and ssid 'RTL8188CUS'
rtl871x_set_wps_assoc_resp_ie
rtl871x_set_wps_beacon_ie
rtl871x_set_wps_probe_resp_ie
rtl871x_set_key_ops
rtl871x_set_beacon_ops
rtl871x_set_hidden_ssid_ops

And hostapd is stuck there, seemingly not accepting any connection, no matter how much i try from the clients.

Finally, my hostapd.conf and dhcpd.conf (both perfectly working before the sdcard crashed)

root@raspberrypi:/etc/hostapd$ cat hostapd.conf 
interface=wlan0
ssid=RTL8188CUS
channel=2
driver=rtl871xdrv
ieee80211n=1
hw_mode=g
device_name=RTL8188CUS
manufacturer=Realtek
wpa=2 # This sets the security settings to WPA2
wpa_passphrase=xxxxxxxxxxxxxxxxxxx
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP


# Other settings
beacon_int=100
auth_algs=3
wmm_enabled=1

and

root@raspberrypi:/etc/hostapd$ cat ../dhcp/dhcpd.conf 
ddns-update-style none;
option domain-name-servers 8.8.8.8, 4.2.2.4;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;

subnet 192.168.2.0 netmask 255.255.255.0 {
        range 192.168.2.100     192.168.2.200;
    default-lease-time 86400;
    max-lease-time 86400;
    option routers      192.168.2.1;
    #option subnet-mask     255.255.255.0;
    option broadcast-address        192.168.2.255;
    option domain-name-servers      8.8.8.8, 4.2.2.4;
#    option netbios-name-servers     192.168.2.1;
#    option netbios-node-type 2;

        host MyHost {
                hardware ethernet XX:XX:XX:XX:XX:XX;
                fixed-address 192.168.2.101;
        }
}

I should also mention that the command rfkill list all shows no device (while i think it used to show one), and that, when everything was working, i used to insert the 8192cu module like

insmod /lib/modules/3.6.11+/kernel/drivers/net/wireless/rtl8192cu/8192cu.ko  rtw_power_mgnt=2 rtw_ips_mode=1 rtw_hwpwrp_detect=1 rtw_enusbs

however, neither this way, nor a simple modprobe 8192cu without any option has any beneficial effect now.

UPDATE

It turned out that using the raspbian kernel and not the standard foundation kernel that comes by default on raspbian made things work out again, but only sometimes. I really don't know why not always, since the steps are always the same.