@Seth7
--
EDIT
After writing this message I tried to go back to the original code af AAP (I don't have it anymore, but I commented all my lines) and it was working with one VAP... so now I dont know if this can really solve your situation (but had the same problem as you)!!!
Anyway my modifications make sense and they are mandatory for another improvement: the random change of the MAC address which I'll describe later
--
AAP requires "a single madwifi-VAP ath0 in sta mode" as Orange wrote here: https://forum.openwrt.org/viewtopic.php?id=21636
I modified the code of AAP to get it working also with a single madwifi-VAP ath0 in "sta" mode plus some VAPs in "ap" mode, so it is possible to use the router like a WiFi repeater
The maximum number of VAPs in AP mode for OpenWRT is 4, as written here: http://downloads.openwrt.org/kamikaze/d … 120001.2.2
These VAPs in "sta" and "ap" mode have to be defined in the file /etc/config/wireless
>>>> Here is an example of /etc/config/wireless with one "sta"and one "ap":
config 'wifi-device' 'wifi0'
option 'type' 'atheros'
option 'channel' 'auto'
# option 'country' '392'
config 'wifi-iface'
option 'device' 'wifi0'
option 'network' 'wan'
option 'mode' 'sta'
option 'hidden' '0'
option 'ssid' 'SSID'
config 'wifi-iface'
option 'device' 'wifi0'
option 'network' 'lan'
option 'mode' 'ap'
option 'ssid' 'OpenWRT'
option 'encryption' 'psk2'
option 'key' 'password'
>>>> Here is how to modify the code of AAP
NOTE: BEFORE EDITING THE CODE IT'S BETTER TO WAIT TO KNOW WHAT ORANGE THINKS ABOUT IT, CAUSE HE KNOWS THIS STUFF MUCH BETTER THAN ME
- Stop aap with the command: aap stop
- Edit aap with the command: vi /bin/aap
- Here is what to edit:
Lines around 122 (inside the function aap_connect()):
[only lines in red are edited or added]
...
if [ `grep -ic $aap_bssid /tmp/aap_mlst` = "1" ]; then
aap_fakemac=`grep -i $aap_bssid /tmp/aap_mlst | awk -F"$(printf '\t')" '{print $2}'`
#wlanconfig ath0 destroy #commented
ifconfig | grep ath | awk '{split($1, z); print "wlanconfig", z[1], "destroy" | "sh"}' #added
macchanger -m $aap_fakemac wifi0
wlanconfig ath0 create wlandev wifi0 wlanmode sta
else
#wlanconfig ath0 destroy #commented
ifconfig | grep ath | awk '{split($1, z); print "wlanconfig", z[1], "destroy" | "sh"}' #added
macchanger -A wifi0
wlanconfig ath0 create wlandev wifi0 wlanmode sta
fi
...
And few lines after:
...
uci set wireless.@wifi-iface[0].encryption=$aap_encryption
uci set wireless.@wifi-iface[0].key=$aap_key
rm /var/run/hostapd-ath*/ath* #added
ifup wan
/sbin/wifi
...
- Close vi and save
- Edit the file /etc/config/wireless introducing a VAP as I wrote before
- Reboot the router
Technically the problem was that, before connecting to a new network, AAP was destroying just the ath0 connection
Now it will destroy all the ath* connections
@Orange: if you have time, take a look to my code cause I'm not so expert and if you find it useful you can add it to the official release
@Seth7: it works for me, let me know if it also works for you
(I'm also working on another "weakness": on every boot AAP changes randomly the MAC address before connecting to an AP; but if there is no ethernet connection, but just wifi connections, so this choice is not random at all, cause the random MAC is often - almost always - the same. The problem is that the source of entropy for the /dev/random device - used by macchanger - is just the ethernet connection. I solved it with a pseudo-random choice and I'll post the solution later after some tests)
(Last edited by lux on 5 Sep 2010, 16:15)