Posted: Thu Dec 11, 2008 21:43 Post subject: AutoAP for Fonera/Atheros? BETA!
Almost done with porting AutoAP to fonera. my goal was/is to do is as little modification as possible to autoap's logic and code. If it ain't broke, why fix it? Instead concentrated on re-writing the utilities AutoAP needs on to function in Fonera/Atheros
Site_Survey(AutoAP relies on it) is/was flawed in the Fonera build. It has a tendency to screwup wifi and sometimes lockup my machine. enc[] field is missing(necessary).
Rewrote Site_Survey in AWK since i didn't have access to the code or know how to compile. Relies on "iwlist" for input. It only occupies 1.5K and is fast once fed data from "iwlist ath0 scan". dtim[] and rate[] is faked since it is not necessary and unavailable/[hard to extract] from iwlist.
Issues:
1. A hardware scan on atheros takes up to 3 seconds to complete. In the mean time it leave the active channel and then comes back. you don't lose data/connection but it may be annoying to some.
2. Haven't figured out how to toggle passive/active scan. If you don't care, it still works! Seems to default to to passive.
Rewrote sort since it is missing from the fonera recompiles of busybox. It's done in awk and is FAST. when we get a Fonera busybox build with sort included it can get chucked.
wl's action(ONLY as necessary for Autoap.sh) was duplicated by simple shell script replacement. Relies on iwconfig/ifconfig. Did not duplicate "wl wsec 0' since i don't know what it does.
Autoap.sh logic now works for perfectly with very few changes. nvram variable collection, scan parsing, html logging,picking out targets, proceed to connection to target with/without key.
Only one problem left. actually connecting. I am doing something wrong with associating and running dhcp. something VERY specific to the fonera/dd-wrt It works on the wifi/atheros/madwifi on my laptop so it has GOT to be something stupidly small i haven't figured out or so obvious I'm too blind to see. If somebody can point me out to the EXACT COMMAND LINE minimum procedure for JUST disconnecting/connecting/associating/dhcping to an AP from the Fonera, I'd be most grateful. If i have to duplicate actions already taken, just to be sure, thats ok. I can stick it in the wl clone.
One more thing. For a gui, I think autoap.cgi should work for this port as long as it gets recompiled for Atheros/Fonera. Afterall, it only needs to deal with AAP specific variables/start/stop/autostart. Nothing hardware critical. Need to contact someone for that(Kuthulu? Eko?)
Comments?
Suggestions?
Last edited by treebuey on Mon Dec 22, 2008 5:14; edited 1 time in total
Man, this is awesome! What a great start for you to the dd-wrt forums - first post and then this, lol, are you crazy? That's a tremendous contribution many of us are waiting for for years!!!
One thing I'd be interested in...
Would you be able to port this to openwrt kamikaze as well? I mean one would need to adjust the config to uci instead of nvram. If you'd come up with something in that regard, I'd be very happy to introduce your port into the next release of Piranha (with prominent credit for sure).
Please send me a PM if you'd be interested!
Thanks a lot in advance,
orange _________________ 7x La Fonera 2100, 1x NanoStation2 Loco
running bleeding edge openwrt backfire/attitude adjustment
or4n9e on irc.freenode.net
Actually, once it works, it should be NOT bethat hard to just drop it in Legend/Kamikaze. ALL you need more is a pseudo nvram command and static database, which is all nvram REALLY is. A few lines of shell and awk will be all it takes. This I plan to write anyway(for my laptop) the moment I get this working in dd-wrt. Remember, this is not actually re-writing AutoAp. Just providing the hooks/tweaks so it WILL work in an environment that isn't broadcom. Legend might actually work better since I think the drivers are prettier.
Btw, I've been around a few months. Mostly in irc. And have 4 foneras to play with. One with Legend which I flashed 5 days ago. Just haven't had time to play with. Aircrack-ng is working damn near perfect on it I observed.
Tree
orange wrote:
Man, this is awesome! What a great start for you to the dd-wrt forums - first post and then this, lol, are you crazy? That's a tremendous contribution many of us are waiting for for years!!!
One thing I'd be interested in...
Would you be able to port this to openwrt kamikaze as well? I mean one would need to adjust the config to uci instead of nvram. If you'd come up with something in that regard, I'd be very happy to introduce your port into the next release of Piranha (with prominent credit for sure).
Please send me a PM if you'd be interested!
Maybe I am not being clear what kind of help i need. Here is something I posted on fonerahacks...
the connection. I can FAKE the actual connection to make sure everything ELSE works and it does.
Condition: a fonera Already prepped and working as a wireless repeater/client with the GUI. No changes necessary as AutoAP will only modify temporarily what needs to be done to connect as a client to the AP
My problem:
Autoap scans and selects target AP.. GOOD
udhcpc is killed in preparation for a new connection, GOOD
*ifconfig ath0 down and then up to be sure. GOOD
*ifconfig ath0 192.168.66.1 netmask 255.255.255.0 (just to be sure something is there)
*iwconfig ath0 essid "SSID" key "1122334455" (or without key for open)
at this point i should get associated and connected(appears to be). sometimes i do, sometimes i dont. PROBLEM
*udhcpc -i ath0 to get assigned IPs and DNC by the target AP. nothing happens. PROBLEM
doesn't matter if i entered a legit ip before or not all. i can't communicate with the AP.
So what am i doing WRONG or forgetting to do? I know it has to be something small and stupid.
I feel like I've put together a Ferrari but i can't afford the gas to drive it!
_________________
____________________
4 La Foneras
2 with DD-WRT
1 with Legend
1 unflashed
4 WRT54g with DD-WRT
Explanation: there is NOTHING wrong with AutoAP. only took at most 10 bytes of change to make it work with Fonera plus utility replacements. minor porting issues..
AutoAP code is PERFECT logic. Problem is dd-wrt port to Fonera/Atheros...
Explanation: I assumed that i was doing something wrong porting wl to operate in an atheros environment.
NO. Everything works. But even AutoAP times out trying to associate with target AP. could take as long as 10 MINUTES! Nothing wrong with udhcpc.
Why? Because dd-wrt takes over. it thinks the Atheros is an idiot so it forces Atheros to continue to scan EVEN after it is ready to associate in a fixed channel and bssid/ssid.
Solved(awkwardly) the association problem by toggling ATH0 up and down and added some delay. still inconsistent but faster association and connect. connects and locks in about a minute. In some ways quite comparable to it's operation on the WRT.
Kuthulu was kind enough to provide the source for his autoap.exe WEB gui.took me several hours to figure how to do it, but finally got it running on the Atheros/Fonera. works perfectly as far as i can tell with NO changes.
Im going to try it all out soon together on the newest build and see if the other nagging little problems are fixed.
Plan to start handing it out this week so you guys can play with it.
hey Tree and everyone else involved congrats on the progress I'm looking forward to trying it out. Spread the good news on the fonerahacks board as well. Its a quiet site but people frequent it.
There is some probably useless junk/delays in both the wl clone AND autoap.sh. Testing PS's and
SLEEPS. if it works without them, delete. wl *might* like an extra sleep at the end of it. The
original autoap.sh is provided as a reference so you can diff and find where they are. wl, of
course, is just shell script.
The AWK programs work fine. don't touch them unless you KNOW what you are doing.
It appears that the fonera port COMMITS all the variables it deals without requiring an "nvram
commit" It will leave the ath0_ssid nvram changed to whatever it was at the last boot/reset.
wep keys in nvram were untouched since it they were not used for actual AutoAP operation.
This version of AutoAp was tested on DD-WRT v24-sp2 (12/13/0 std (SVN revision 11181). Other
builds may work particularly if client/repeater mode is satisfactory. OPENWRT will NOT
work, yet.
The PATH variable is modified in autoap.sh AND executable path in autoap.exe to enable
operation from /jffs/bin. autoap.exe GUI is a compiled program and I am not sure i am
authorized to provide the source. It seems to me though that the path can be modified with a
simple binary file editor.
Some features are untested/unusable. but the most important ones are. If you can fix, FIX and
POST about it. Some features/capability may arrive by themselves as the Fonera/Atheros port to
DD-WRT matures.
WPA is NOT enabled in for AUTOAP to connect to APs. However, I see no reason why it cannot be
enabled for you to connect TO the Fonera.
Yes, I know its a kludge to have 4 extra external scripts/programs to get AutoAP to work on the
Fonera. If you can do it in one, I'd be most impressed!
This is may be my(treebuey's) last major contribution to this effort. I may add WPA
capability and port to Openwrt at a future date.
Please respect past, present, future contributions by others and aknowledge them. As such, I
have offer my acknowledgement to dd-wrt and the coders of site_survey. Even though I did not
copy the code, I did copy the format.
Treebuey thanks for the contribution, but AutoAP for the Fonera does not works.
AutoAP scans and connects for a few seconds at each of the networks, including IP obtained by DHCP, but then tries to connect to another network and loses connectivity.
It has come to connect as a client for several minutes, but eventually returns to scan and disconnect.
Now it takes 30 minutes authenticating, associating, getting IP ... but nothing ...
Do you think this can be solved by changing some parameters for the configuration of DD-WRT or by changing a few lines of program?
By the way, I'm testing in a fonera with DD WRT v24 sp1 std. Exists a version 24 sp2 that you comment?
Thanks for replying. It should help clarify some issues.
I didn't keep track of the versions I tested with very well. I DO know that i was not happy with the SP1. For instance, I had problems with scanning,associating and the use of JFFS crashing the router. Shouldn't happen since did not code anything really complex. Eventually finally settled on a version techie1(IRC) recommended and it tested well. There are newer versions but this is good enough for me..
After reading your note I went back and found the version I used. Found it by comparing revision dates and not svn number.. Downloaded it and did a md5sum on it and the last version so this IS the linux.bin used for my final test.
A couple things to keep in mind. If for whatever reason you CANNOT maintain an adequate connection with an AP by hand/gui and NOT using autoap, autoap will never work in a satisfactory manner either. It cannot fix problems with your client/repeater setup or build. I may post my test nvram.bin if people have problems with settings, but am reluctant to do so because their build may not be compatible with it.
The possible useless code I mentioned in the README was implemented to make AutoAP work with an intermediate test build. not final. But should not prevent AutoAp from working, merely make certain operations slower than necessary.
When AutoAp associates, connects and dhcps adequately. it goes into a dumb mode. It merely checks internet connectivity by pinging a test site every two minutes or so. When it can't ping the test site anymore, THEN it comes back to life, connects to a new site and/or rescans. Not before. I did not change ANY of this code.
A little about my test environment. Very electrically noisy. One Fonera wireless repeater, One wrt54gv6, One wrtgv4 running AutoAp and all within 100 feet. Plus about 10 APs that are not mine within a block. Various channels, often the same. Was able to maintain connections between 5 to 100 minutes at a time, always establishing a NEW connection within 1-5 minutes. Was able to maintain a decent connection to a nearby open AP with an SNR of 7.
After posting the AutoAP here, took it to work to various job sites where I cut trim/trees. It worked with connect times varying from 30 minutes to 2 hours with the latter being more likely. Might actually had been better had I set the default rescan rate to higher than 120 minutes. One of the 2 hour connects was to an AP with an SNR of 10.
mere wrote:
Treebuey thanks for the contribution, but AutoAP for the Fonera does not works.
AutoAP scans and connects for a few seconds at each of the networks, including IP obtained by DHCP, but then tries to connect to another network and loses connectivity.
It has come to connect as a client for several minutes, but eventually returns to scan and disconnect.
Now it takes 30 minutes authenticating, associating, getting IP ... but nothing ...
Do you think this can be solved by changing some parameters for the configuration of DD-WRT or by changing a few lines of program?
By the way, I'm testing in a fonera with DD WRT v24 sp1 std. Exists a version 24 sp2 that you comment?
I have AutoAP installed on a router with a Broadcom chip and it works perfectly, so the problem is not how I use it, but it is incompatible with the version 24 sp1.
I installed on my fonera firmware DD-WRT v24 pre sp2 and now AutoAP works OK . Is associated with preferred APs in a few seconds. I keep trying ...
I now tested autoap for the f*nera and... it works great!!!
Awesome work you've done. I'd like to thank you a lot. I was never able to test autoap due to the lack of broadcom hardware, but now this little f*nera gained a tremedous amount of usability!!!
So far my appreciations...
One issue I had and I'd like to file a "bug report" herewith, is, that autoap doesn't work correctly with ssids that contains spaces. This can also be verified by investigating the scan results... while the nvram setting is correct (verified at autoap's wiki page) the script isn't able to identify a network "with spaces" as "with spaces" but it identifies it as "with" and it therefore fails to connect. I don't know if that's a general autoap issue or a problem resulting from porting autoap to the fonera/atheros.
Could you please have a deeper look into it?
Thanks in advance!
best,
orange
PS: I'm not sure if the script is able to handle special characters within the ssid, because the only ssid that would meet this also contains spaces "FRITZ!Box Fon WLAN 7170" and is therefore not identified correctly anyway --> identified as "FRITZ!Box" <-- see above _________________ 7x La Fonera 2100, 1x NanoStation2 Loco
running bleeding edge openwrt backfire/attitude adjustment
or4n9e on irc.freenode.net
Interesting problem. I checked all the scripts and they all use enclosed double quotes. Except scan.awk. In the one place where it matters, I guess, on the third line, change "$1" to "$0". this was unnecessary parsing of white space. Proper parsing take place later in the script anyway.
There still might be a problem with shell interpretation in autoap.sh but i don't see it yet. I *think* there is a 20 character limit also. Try to break it some more... ;)
(modified scan.awk enclosed,original post updated also)
Thanks for your help/feedback in testing.
Tree
orange wrote:
treebuey,
......I'm not sure if the script is able to handle special characters within the ssid, because the only ssid that would meet this also contains spaces "FRITZ!Box Fon WLAN 7170" and is therefore not identified correctly anyway --> identified as "FRITZ!Box <-- see above