AutoAP for Fonera/Atheros? BETA!

Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware
Goto page 1, 2, 3, 4, 5, 6  Next
Author Message
treebuey
DD-WRT Novice


Joined: 09 Dec 2008
Posts: 22

PostPosted: Thu Dec 11, 2008 21:43    Post subject: AutoAP for Fonera/Atheros? BETA! Reply with quote
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
Sponsor
orange
DD-WRT Guru


Joined: 05 Sep 2007
Posts: 532
Location: 49.50N, 08.44E

PostPosted: Thu Dec 11, 2008 22:13    Post subject: Reply with quote
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
treebuey
DD-WRT Novice


Joined: 09 Dec 2008
Posts: 22

PostPosted: Thu Dec 11, 2008 23:10    Post subject: Reply with quote
Thanks Orange, but wait till it actually works! Wink

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!

Thanks a lot in advance,
orange
treebuey
DD-WRT Novice


Joined: 09 Dec 2008
Posts: 22

PostPosted: Fri Dec 12, 2008 17:55    Post subject: Reply with quote
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
treebuey
DD-WRT Novice


Joined: 09 Dec 2008
Posts: 22

PostPosted: Sat Dec 13, 2008 8:39    Post subject: Reply with quote
UPDATE: (almost ALMOST there....)

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.

Iwpriv fixed channel command? Hell no! Pay me!
Iwconfig fixed channel/MAC or rate? Hell no! Pay me!

When do the stars , planets, Sun align?

Every 10-15 friggin minutes. Unacceptable.

"Gee, I wasnt there! Guess it didn't happen!"

If someone doesn't tell me how to stop dd-wrt from forcing an excrutiatingly needlessly slow scan on Atheros, I am going to Disneyland/OpenWRT.

EOS

btw, this is coming from an EXCRUTIATINGLY long-to-associate-but-it-works Fonera. WITH AutoAP....
treebuey
DD-WRT Novice


Joined: 09 Dec 2008
Posts: 22

PostPosted: Sat Dec 20, 2008 12:01    Post subject: Reply with quote
Update:

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.

Tree
mrdally204
DD-WRT User


Joined: 18 Jan 2008
Posts: 54

PostPosted: Sun Dec 21, 2008 1:36    Post subject: Reply with quote
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.
treebuey
DD-WRT Novice


Joined: 09 Dec 2008
Posts: 22

PostPosted: Mon Dec 22, 2008 5:22    Post subject: Reply with quote
I'm tired. so here's the README...

have fun!

####12/21/08####AUTOAP for the Fonera/DD-WRT by treebuey####

Installation is simple.

Enable JFFS and make sure a usable file system is in /jffs

if not there, mkdir /jffs/bin

Copy all these files to /jffs/bin

Make sure all files are executable ( i.e. chmod 755 /jffs/bin/* )

Make SURE you are in a suitable client/repeater mode.(READ the references)

run autoap.sh& (this also enables web interface if not there already)

Web Interface: http://your_fonera_ip/user/cgi-bin/autoap.cgi

Web Log: http://your_fonera_ip/user/autoap.htm


NOTES:

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/0Cool 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.


REFERENCES that may be useful

http://www.dd-wrt.com/wiki/index.php/Autoap (The original. A MUST READ)

http://www.dd-wrt.com/wiki/index.php/Universal_Wireless_Repeater

http://www.dd-wrt.com/phpBB2/viewtopic.php?t=6575 (The original thread.)

http://www.dd-wrt.com/phpBB2/viewtopic.php?t=43882 (please post comments/fixes/suggestions
here) (also good for understanding the porting approach taken)

(The package is at the end of this post. You have to login to download it)


Last edited by treebuey on Sun Jan 11, 2009 16:50; edited 5 times in total
mere
DD-WRT Novice


Joined: 23 Dec 2007
Posts: 6

PostPosted: Fri Dec 26, 2008 10:58    Post subject: Reply with quote
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?
treebuey
DD-WRT Novice


Joined: 09 Dec 2008
Posts: 22

PostPosted: Sat Dec 27, 2008 4:52    Post subject: Reply with quote
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.

http://www.dd-wrt.com/dd-wrtv2/down.php?path=downloads%2Fothers%2Feko%2FBrainSlayer-V24-preSP2%2F131208%2Ffonera/

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?
mere
DD-WRT Novice


Joined: 23 Dec 2007
Posts: 6

PostPosted: Sat Dec 27, 2008 10:15    Post subject: Reply with quote
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 Razz . Is associated with preferred APs in a few seconds. I keep trying ...

Thanks again Treebuey. Idea
illtww
DD-WRT Novice


Joined: 30 Dec 2008
Posts: 2

PostPosted: Tue Dec 30, 2008 3:35    Post subject: ummm..... Reply with quote
Nevermind...

missed the link..

Will et you know how it works..

This will allow me to use the Fonera as a universal repeater correct?

IE... Repeat free wireless signals?
illtww
DD-WRT Novice


Joined: 30 Dec 2008
Posts: 2

PostPosted: Tue Dec 30, 2008 4:46    Post subject: Reply with quote
Umm I am a newbie..

Is there a step by step for Creating the JFFS dirs and copying the files over..

also

What should the startup script look like in dd-wrt?

_________________
x1 FON 2200 x1 Wrt54g V4
orange
DD-WRT Guru


Joined: 05 Sep 2007
Posts: 532
Location: 49.50N, 08.44E

PostPosted: Sat Jan 03, 2009 2:57    Post subject: Reply with quote
treebuey,

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
treebuey
DD-WRT Novice


Joined: 09 Dec 2008
Posts: 22

PostPosted: Sat Jan 03, 2009 5:05    Post subject: Reply with quote
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
Goto page 1, 2, 3, 4, 5, 6  Next Display posts from previous:    Page 1 of 6
Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum