Great forum post, It was a good guideline for me to get the raspberry working as an access point, unfortunately it wasn't enough, but at least for now I tracked down the problem and developed kind of a ritual to get it to work
My wireless dongle is an rt5370, and have it configured with a static IP in /etc/network/interfaces.
The main problem was that every freakin time I started hostapd and dnsmasq or isc-dhcp-server, I couldn't get any device to finish the connection process. The authentication works great but then when it comes to dhcp, all devices could receive an IP but enter in kind of an infinite loop of new requests, because they keep asking and asking for an IP. First I thought it was an Android problem of some sort, because in Windows it showed as connected, and in Android I could apparently see the state of the connection jump from connected -> authenticating -> requesting ip -> ... in a matter of a second. In a close look to syslog I could see that windows was acting in the same way, but was not apparent. One quick note, if I turned off wireless authentication in hostapd, this "bug" seemed to go away, but WPA2 was a must.
After tons of experiments I came with this ritual to get everything come up correctly and work at boot time.
In a nutshell this is my startup script saved properly as an init.d
/etc/init.d/hostapd start
/etc/init.d/hostapd stop
/etc/init.d/dnsmasq stop
ifdown wlan0
sleep 1
/etc/init.d/hostapd start
sleep 2
ifdown wlan0
sleep 1
ifup wlan0
sleep 2
/etc/init.d/dnsmasq start
My conclusions are:
1) hostapd is bringing very badly wlan0 up (ifconfig shows not IP at all assigned to wlan0).
2) hostapd needs a mon.wlan0 interface for monitoring purposes and creates one if non existent. If I try to start hostapd only once without this interface existing, I enter in that dhcp request infinite loop described before, so I start hostapd, stop it, bring wlan0 down with ifdown, and then start hostapd.
I would love to ear others thoughts on this matter. I've seen similar situations in this or other forums if I'm not mistaken, but didn't found any solution.
If anyone wants some of my configurations, please ask. I didn't post any because I think I done almost everything as other have done. I could be wrong.