OpenWrt Forum Archive

Topic: Atheros only! - Next Generation Piranha firmware (v4) + AAP (v3)

The content of this topic has been archived between 20 Aug 2015 and 21 Apr 2018. Unfortunately there are posts – most likely complete pages – missing.

Will try and get this setup ASAP.

I have not been following this at all.... Early on I wrote a much simpler autoconnect script loosely based on aap.  Lacking originality, I called mine aap as well.....

#!/usr/bin/awk -f

BEGIN { 
    chan=0;
    essid="";
    encr=0;
    psk2=0;
    psk=0;    
        i=0;
        # find interface - start by finding if in sta mode
        while( "uci show wireless" | getline) {
            if(/mode=sta/) {
                split($0,wl,".");
                iface=wl[2];
                }
        }
    close("uci show wireless")
    "uci get wireless." iface ".device" | getline radio
    close("uci get wireless." iface ".device")
    "uci -P /var/state get wireless." iface ".ifname" | getline ifname
    close("uci -P /var/state get wireless." iface ".ifname")
    "uci get ssid.core.keepalive1" | getline keepalive1
    close("uci get ssid.core.keepalive1")
    "uci get ssid.core.keepalive2" | getline keepalive2
    close("uci get ssid.core.keepalive2")
    system("ifconfig " ifname " up")
    for(;;){
        while( "iwlist " ifname " scan" | getline ) {
            scan[i++]=$0;
            }
        close("iwlist wlan0 scan")
        for (j=0;j<i;j++) {
            $0=scan[j];
            if ($1 == "Cell" || $1 == EOF ) {
                if(chan == 0) continue;
                print "essid: " essid
                # we're at the end of a record
                # process data we have and try to connect
                if(psk2 == 1) crypt = "psk2";
                else if (psk == 1) crypt ="psk";
                else if (encr == 1) crypt = "wep";
                else crypt = "none";
                psk=0;
                psk2=0;
                encr=0;
                rkey="";
                print essid;
                # first we see if we're in blacklist
                bl="0"
                "uci -q get ssid.black.\"" essid "\"" | getline bl
                close("uci -q get ssid.black.\"" essid "\"")
                if ( bl == "1" ) {
                    print essid " blacklisted";
                    continue;
                    }
                # now we get key if we're encrypted
                if ( crypt != "none" ) {
                    "uci -q get ssid.white.\"" essid "\""| getline rkey
                    close("uci -q get ssid.white.\"" essid "\"")
                    if ( rkey == "" ) {
                        print essid " is encrypted and key not in whitelist";
                        continue;
                        }
                    }
    
                system("uci set wireless." radio ".channel=" channel);
                system("uci set wireless." iface ".ssid=\"" essid "\"");
                if (crypt == "none") {
                    system("uci set wireless." iface ".encryption=none");
                    system("uci -q delete wireless." iface ".key");
                    }
                else {
                    system("uci set wireless." iface ".key=" rkey);
                    system("uci set wireless." iface ".encryption=" crypt);
                    }
                system("uci show wireless > /tmp/keepalive");
                system("wifi up");
                r=0;
                s=0;
                while( r + s < 2  ) {
                    system("sleep 20;");
                    r=system(keepalive1);
                    s=system(keepalive2);
                    }
                system("wifi down");
                }
            else {
                # now test for the things we want
                # channel    
                if (/Channel:[0-9]/) {
                    m=match($0,"Channel");
                    if (RSTART > 0) {
                    s=substr($0,m);
                    n=match(s,/[0-9]+/);
                    chan=substr(s,n,RLENGTH)}
                    continue;
                    }
                # we don't need else as we break on successful find
                if (/^ *ESSID/) {
                    m=match($0,"\".*\"");
                    if (RSTART > 0) essid=substr($0,m+1,RLENGTH-2);
                    continue;
                    }
                if (/^ *Encryption key:on/) {
                    encr = 1;
                    continue;
                    }
                if (/^ *IE: IEEE 802.11i\/WPA2/) {
                    psk2=1;
                    continue;
                    }
                if (/^ *IE: WPA /) {
                    psk=1;
                    continue;
                    }
                }
            }
        }
    }

and /etc/config/ssid:

config ssid black
    option "badssid1" "1"
    option "badssid2" "1"

config ssid white
    option "goodssid1" "key1"
    option "goodssid2" "key2"
    
config ssid core
    option "keepalive1" "test command 1"
    option "keepalive2" "test command 2"

The keepalives are commands that must succeed (return 0) when you have internet connectivity and fail (return > 0) when you don't have internet connectivity.  I use rdate back to my home server but you can use anything you want.

(Last edited by cptdondo on 16 Oct 2011, 01:51)

Thanks for the information. Will surely try this out as soon as the final OpenWRT version is released.

hello, i registered with this forum a few seconds ago to post this, so its my first post. AAP as outlined in post #216 works nearly perfectly all the way up to the latest trunk. tested on ubiquity bullet2hp (atheros 2315) and generic chinese wap2102 (atheros 2317). im actually only using it for the whitelist/blacklist and signal strength sorting, but i have tested all of the functionality. i also modified a couple lines to use tcpping instead of ping. i did have to use full wapd instead of mini to get it functioning as a repeater on a usable level, but this seems to be the case without aap as well.

thanks orange!

mattsqz wrote:

hello, i registered with this forum a few seconds ago to post this, so its my first post. AAP as outlined in post #216 works nearly perfectly all the way up to the latest trunk. tested on ubiquity bullet2hp (atheros 2315) and generic chinese wap2102 (atheros 2317). im actually only using it for the whitelist/blacklist and signal strength sorting, but i have tested all of the functionality. i also modified a couple lines to use tcpping instead of ping. i did have to use full wapd instead of mini to get it functioning as a repeater on a usable level, but this seems to be the case without aap as well.

thanks orange!

You're very welcome! Thanks for the positive feedback. That said, AAP v3 still has room for improvement, especially as trunk is moving to mac80211 - I'm already working on this.

@cptdondo
Thanks to you also for posting the most recent magicconnect, i.e. your AAP fork. I actually have a lot of comments to your script in the pipeline, but I'm a bit short in time the last (and next) days and I'll come back with feedback to you soon.

(Last edited by orange on 22 Oct 2011, 23:39)

Anyone know when the final OpenWRT will be out as I am waiting for that before I build my custom FW.

Never.

Because everybody waits for the stable release, instead of using and debugging the current pre-release.

bulanula wrote:

Anyone know when the final OpenWRT will be out as I am waiting for that before I build my custom FW.

why wait?  i see no point in waiting for the dev team to decide to call a certain build by a certain version number before i do anything with it...there is no magic seasoning that makes a point revision increase better than, say, a recent development release. the more people there are using trunk, the faster things will move along!

@bulanula
I second what mattsqz and Orca said. I mean, there's not even the need to build the firmware yourself as you can already use AAP v3 (as provided in post #216) with Backfire 10.03.1-rc5 available at http://downloads.openwrt.org/backfire/1 … 5/atheros/ - 10.03.1 "Final" will anyway just be another svn revision/checkout as 10.03.1-rc5 also is. That said, AAP v3 works very well with 10.03.1-rc5; just follow the instructions provided (post #216) and get started.

Thanks,
orange

OK I will try and do this when I have time. Thanks !

I'm attempting to modify AAP to include a per-network SNR offset as an optional configuration value.  I would find this useful because certain networks maintain higher speeds/reliability despite not appearing to be as favorable as others based on their SNR.

So far, I've come up with the following additions to aap_uci():

uci show aap | awk 'substr($0,27) ~ /^snroffset=/ {print substr($0,6,17)}' > /tmp/aap_snroffsetlst2
aap_snroffsetlst2=`awk '{printf("%s\t", $0)}' /tmp/aap_snroffsetlst2`
aap_snroffsetcount=`wc -l < /tmp/aap_snroffsetlst2`
d=1
while [ $d -le $aap_snroffsetcount ]; do
    aap_snroffsetlst=`echo "$aap_snroffsetlst2" | awk -F"$(printf '\t')" -v d="$d" '{print $d}'`
    uci get aap.@$aap_snroffsetlst[0].key >> /tmp/aap_snroffsetlst3
    d=$(($d+1))
done

It appears that the logical next step is to modify aap_scan() to add the SNR offset value to the measured SNR.  I think I'd eventually determine how to do this, but I'd appreciate any help or suggestions on that or any fixes to the above code.

(Last edited by goatroper on 28 Oct 2011, 00:07)

Nice idea goatroper !

I was wondering if it might be possible to run this along with a vap, to be used as a sort of on the go repeater. possibly on a fonera.

Will try to keep you updated when I get this going but I still have not had time right now.

Progress?

R3dsk11n, AAP works well with VAPs.  I've used multiple VAPs and 1 wired configuration routing through the AAP wireless (station mode) link.

AAP destroys and rebuilds the wifi interfaces as it cycles through potential internet connections.  the wired link remains up/working during this process.  once AAP settles on a network, all wifi interfaces are functional and stable. 
Note: this was only tested on an om1p device

enjoy wifi relaying via AAP wink

cheers,

gs1

Any news about borgbox ?

hi bulanula,

borgbox was updated to backfire rc6 in october 2011. I cleaned it up a little to reduce the firmware footprint.  I've also created a borgbox version with a TOR transparent proxy on one of the wifi VAPs (recently updated to version 0.2.3.9-alpha). it runs well on my om1p devices and includes AAP (makes a good wifi relay) - you can read a little more on it here:

https://forum.openwrt.org/viewtopic.php?id=32453

cheers,

gs1

buddyblah wrote:

hi bulanula,

borgbox was updated to backfire rc6 in october 2011. I cleaned it up a little to reduce the firmware footprint.  I've also created a borgbox version with a TOR transparent proxy on one of the wifi VAPs (recently updated to version 0.2.3.9-alpha). it runs well on my om1p devices and includes AAP (makes a good wifi relay) - you can read a little more on it here:

https://forum.openwrt.org/viewtopic.php?id=32453

cheers,

gs1

Very nice ! Thank you !

bulanula, thank you and --> happy new year

I just built with the latest Backfire (10.03.1, r29608) - no more RC versions it seems.
still with AAP, the TOR version is the latest 0.2.3.10-alpha, and I update my custom script (.drone) to switch TOR transparent proxy between running on  wifi or on the wired port.  I figured a new year build was in order wink

I will be testing it over the next couple of days.  keep an eye on github or respective threads on this forum for updates...

https://github.com/guinness1/borgbox/downloads

have a great 2012

cheers,

gs1

Great !

Happy new year and thank you for building with latest OpenWRT !

Happy new years ...

Any news from orange ?

I'm happy to report that I have flashed a EOC-5610 with Piranha v4 firmware.  Upon first look, it is working as expected.  I have stopped aap  (aap stop), set ath0 to monitor mode (monitor), and scanned for the wifi in the area (airodump-ng ath0). 

Thanks to orange for this work, I'm still finding that piranha is a useful tool.

Here are the flashing commands I entered in the Redboot session:

ip_addr -h 192.168.1.100 -l 192.168.1.1/24
fis init -f
load -r -b %{FREEMEMLO} openwrt-atheros-vmlinux.lzma
fis create -r 0x80041000 -e 0x80041000 vmlinux.bin.l7
fis free
load -r -b %{FREEMEMLO} openwrt-atheros-root.squashfs
fis create -l 0x6E0000 rootfs
fconfig        
fis load -l vmlinux.bin.l7
exec
reset

(Last edited by technocrat on 3 Feb 2012, 01:21)

technocrat wrote:

I'm happy to report that I have flashed a EOC-5610 with Piranha v4 firmware.  Upon first look, it is working as expected.  I have stopped aap  (aap stop), set ath0 to monitor mode (monitor), and scanned for the wifi in the area (airodump-ng ath0). 

Thanks to orange for this work, I'm still finding that piranha is a useful tool.

Here are the flashing commands I entered in the Redboot session:

ip_addr -h 192.168.1.100 -l 192.168.1.1/24
fis init -f
load -r -b %{FREEMEMLO} openwrt-atheros-vmlinux.lzma
fis create -r 0x80041000 -e 0x80041000 vmlinux.bin.l7
fis free
load -r -b %{FREEMEMLO} openwrt-atheros-root.squashfs
fis create -l 0x6E0000 rootfs
fconfig        
fis load -l vmlinux.bin.l7
exec
reset

Yeah. Thanks for that !

I see that now there is no need to use RedBoot after you do the first ( initial ) install so I just use web interface from now on for my EOC2611P.