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.

Wow, lots of traffic in here! Sorry for not coming back that fast. Actually, I'm moving apartments right now and this turns out to be a 24/7 job.

@lux
Your assumption is perfectly correct. Unfortunately, due to the busybox built-in grep, the blacklist indeed need to be a non-empty file. AAP "calculates" the temp files (/tmp/aap_blst etc) on-the-fly out of /e/c/aap. Same applies to white-, mac- and hiddenlists btw. That said, please use the supplied /e/c/aap and leave it as is (with the dummy entries as there need to be at least one ssid, fakemac, blst and key defined) and just append your custom bssid sections (only ONE section per bssid) for proper AAP functionality.

EDIT: I added this important information to the tutorial (post #2). I've almost forgotten this one as my very own custom /e/c/aap is VERY long and includes various fakemac, ssid, blst and key options. Thanks for pointing this out again.

There's no need to define the ssid option unless the network is hidden. AAP utilizes OPN networks by default IF prefonly toggle is set to "0"

@Seth7
There is no default passwd/login. Just telnet in (telnet 10.0.0.1), run "passwd", supply the desired password twice, then SSH in (ssh root@10.0.0.1). Also, v4 100708 has been taken down in favor of v4 100813 (obvious reason for the opkg 404 error)

@all
If you're having problems to get AAP running, I'd like to ask you to post your /e/c/aap, the output of "aap log" and "aap list" respectively. Otherwise, I'm more or less unable to support you. Descriptions like "It doesn't work for me" actually are NOT enough information for a support request. Thanks in advance!

HTH orange

(Last edited by orange on 3 Sep 2010, 12:26)

I'v placed a 5V switching reg next to my router ... less than an inch (1cm about) ....

I think its creating too much interference ..... ill need to remove it and use its original 5V supply and see if it still can't connect to anything ..

I think this what you had asked for as far as information ....

I have eliminated hte 5V switcher ....... and ...

root@OpenWrt:~# aap list
26  gmt_12a                          00:18:84:13:69:09 8  wep  2C0EE80617
root@OpenWrt:~# aap log
[808] 00:00:55 (re-)scan done, 1 suitable APs found in range, initiating connection attempt(s)
[808] 00:03:51 connection to AP 00:18:84:13:69:09 failed/skipped, tried all suitable APs, initiating (re-)scan
[808] 00:03:53 (re-)scan done, 1 suitable APs found in range, initiating connection attempt(s)
[808] 00:06:47 connection to AP 00:18:84:13:69:09 failed/skipped, tried all suitable APs, initiating (re-)scan
[808] 00:06:49 (re-)scan done, 1 suitable APs found in range, initiating connection attempt(s)
root@OpenWrt:~# aap list
26  gmt_12a                          00:18:84:13:69:09 8  wep  2C0EE80617
root@OpenWrt:~# cd ..
root@OpenWrt:/# cd etc/config/
root@OpenWrt:/etc/config# vi aap

config 'aap'
        option 'checkfreq' '60'
        option 'dhcptimeout' '160'
        option 'ineturl' 'www.google.com'
        option 'logenable' '1'
        option 'prefonly' '1'
        option 'rescandelay' '43200'
        option 'warndelay' '220'
        option 'watchinet' '1'
        option 'autostart' '1'

config '00:18:84:13:69:09'
        option 'key' '2C0EE80617'

config '00:22:33:44:55:66'
        option 'fakemac' '00:33:44:55:66:77'

config '00:44:55:66:77:88'
        option 'ssid' 'default'

config '00:55:66:77:88:99'
        option 'blst' '1'

config '00:02:6f:33:c7:b4'
        option 'blst' '1'

~
~
~
~
~
~
~
~
~
~
~
~
- aap 1/27 3%
any thing look wrong ??? perhaps the KEY ??

@Seth7
Maybe I can help you, but post your /etc/config/wireless and /etc/config/network files

Is the key 2C0EE80617 correct or not? Cause of course if it is not correct it wont work...

(Last edited by lux on 4 Sep 2010, 17:59)

lux wrote:

@Seth7
Maybe I can help you, but post your /etc/config/wireless and /etc/config/network files

Is the key 2C0EE80617 correct or not? Cause of course if it is not correct it wont work...

Yea .. the Key is correct ...... it was a copy/paste - so no mistakes


etc/config/wireless

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 'ssid' 'lazana'
        option 'encryption' 'none'

config 'wifi-iface'
        option 'device' 'wifi0'
        option 'network' 'lan'
        option 'mode' 'ap'
        option 'ssid' 'Link'
        option 'encryption' 'none'

etc/config/network

config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'wan'
        option 'proto' 'dhcp'

config 'interface' 'lan'
        option 'ifname' 'eth0'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '10.0.0.1'
        option 'netmask' '255.255.255.0'

@Seth7
I have a fonera FON2201 with Piranha v4/100813.
I suppose you have the same or a similar router.

In first: in an old thread (https://forum.openwrt.org/viewtopic.php?id=21636) Orange wrote "Requirements: ... It assumes a single madwifi-VAP ath0 in sta mode".
But your configuration has 2 SSIDs: one in sta and one in ap mode.
Probably cause you want it to work like a WiFi repeater.
But aap doesn't work with this configuration.
I modified a bit the code solving this problem and I will post my code in the next days (cause I'm also working on another "weakness": macchanger on every boot changes randomly the mac, but the choice is not random at all cause the /dev/random has not enough entropy in such a small device)

So, if your router is similar to mine, I would try the next configuration:

>> etc/config/wireless

config 'wifi-device' 'wifi0'
        option 'type' 'atheros'
        option 'channel' 'auto'
#       option 'country' '392' #this is an optional change

config 'wifi-iface'
        option 'device' 'wifi0'
        option 'network' 'wan'
        option 'mode' 'sta'
        option 'ssid' 'lazana'
        option 'encryption' 'none'


>> etc/config/network

config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'wan'
        option 'proto' 'dhcp'

config 'interface' 'lan'
        option 'ifname' 'eth0.1 eth0.2' #but try also just 'eth0.1' or 'eth0'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '10.0.0.1'
        option 'netmask' '255.255.255.0'


>> the /etc/config/aap you posted before is OK

Then connect to the router by ethernet cable into the port labeled as "computer" (if you are confused just try both) and verify if the router is connected to the bssid 00:18:84:13:69:09 (as you wrote in your aap config file) with the command: iwconfig
And also try the commands: aap log, aap list, ping www.google.com
If something is wrong try to check the log with the command: logread

Let me know your results
Later I will explain you how to add a virtual ssid as you want

(Last edited by lux on 5 Sep 2010, 01:07)

crud .. changing 'eth0' to 'eth0.1' has made in inaccessible .. gona haft to solder some wires and get into it via serial

reset button dosent seem to be working

ok ... changing 'etho' to 'etho eth0.1 etho.2' seemed to be ok ...

removed the AP

and

root@OpenWrt:~# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

br-lan    no wireless extensions.

eth0.1    no wireless extensions.

eth0.2    no wireless extensions.

wifi0     no wireless extensions.

ath0      IEEE 802.11g  ESSID:"OPEN_WRT"
          Mode:Managed  Frequency:2.462 GHz  Access Point: 00:18:84:13:69:09
          Bit Rate:1 Mb/s   Tx-Power:18 dBm
          RTS thr:off   Fragment thr:off
          Encryption key:2C0E-E806-17   Security mode:restricted
          Power Management:off
          Link Quality=20/70  Signal level=-76 dBm  Noise level=-96 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

root@OpenWrt:~# aap log
[833] 00:00:56 (re-)scan done, 1 suitable APs found in range, initiating connection attempt(s)
root@OpenWrt:~# aap log
[833] 00:00:56 (re-)scan done, 1 suitable APs found in range, initiating connection attempt(s)
[833] 00:03:47 connected to AP 00:18:84:13:69:09 on channel 11 with WAN IP 192.168.208.143

So how about the VAP ??

(Last edited by Seth7 on 5 Sep 2010, 09:13)

@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)

Sounds great !!!!

The changes you posted didn't seem to have any ill effects ..... connected to MY encrypted AP with no issues and VAP running well .....

Ill change it later to remove my AP and see what happens ....

I would like this to show all detected AP's and connect to secured AP's if i want to ....

Isnt the option prefonly '0'   --- make it connect to anything ??

I have several AP's in my area that are secured - i just want to see if they were scanned so that i know the Wrouter didn't go deaf !!!

Also would changing scan delay longer - to let the VAP be detected or is the VAP only active when  the router is connected to something ??

I'm happy that it's working also for you!!

About your questions: the VAP (in "ap" mode) is just working when the AP (in "sta" mode) is connected.
So when AAP can't connect to any network, the VAP is not working.
I tested this situation.

About the prefonly option, I'm not so sure cause I didn't test it so much.
Anyway Orange wrote: "# Defines the search mode. Try to find all accesspoints that provide internet access. "0"=NO, "1"=YES
aap_prefonly=0
...AAP utilizes OPN networks by default IF prefonly toggle is set to 0"
So I suppose that:
- if it's 0, then it connects to the strongest signal between all the open networks available and the networks defined into the config file
- if it's 1, then it connects just to the strongest signal between the networks defined into the config file

To scan the available networks and find the strongest signal it uses the command:
wlanconfig ath0 list scan

Which image file would work as a ramdisk on a meraki mini?

napierzaza wrote:

Which image file would work as a ramdisk on a meraki mini?

RamDisk ??? i didn't know there was a mod to add a ramdisk/flash to the Fon. Are you working on a hard ware mod??

Ill bet this will work on a Meraki mini ....... its very similar to a Fon ...

Maybe I'm mixing my terms. But I wanted to load the firmware into the device without saving it on the flash chip. For testing.

napierzaza wrote:

Maybe I'm mixing my terms. But I wanted to load the firmware into the device without saving it on the flash chip. For testing.

I don't think that's possible .... there are changes to MadWifi and other repositories ..... but i believe you can copy your routers flash contents via ftp and put it back later ...... ill assume that your router has original firmware or open-wrt??

If its openwrt then just flash it back with latest openwrt if you don't like AAP ..... keep in mind im just a NOOB.

lux ...

Do you know off hand if channel 0 or -1 can be set .... perhaps using another country code??

Seth7 wrote:

lux ...

Do you know off hand if channel 0 or -1 can be set .... perhaps using another country code??

duh ... option 'channel' '6'

under the e/c/wireless config....

@lux
First of all, I'm sorry for still being that silent but unfortunately, I'm still on my way moving apartments, renovating, re-establishing my working environment, setting up a new wireless Piranha drone (this time with a homebrew cantenna), etc. I somewhat under-estimated the efforts involved with it. Thus, I currently have very few spare time on the plate. This may take another few weeks until finished. I'll then be back with full engagement.

That said, I'd quickly like to answer your questions/comment your contributions (btw, much appreciated!)

1. The random Mac feature:
In the past, AAP has been released with the feature to utilize a specific Mac upon connection attempt (for networks with enabled Mac filtering). The Mac was reset to default when connecting to a network without Mac filtering. At some point in time, I decided to re-write this AAP module to connect with a random Mac by default while preserving the specific Mac definition for Mac-filtering networks. This fits best into my very personal usage scenario (obfuscating the drone) but I see that it may NOT fit for everyone. Thus my proposal is to introduce another toggle with subsequent releases to switch between the two described behaviours. Sounds good?

2. Your code contributions
From my perspective (by having a quick look), your AAP modifications make perfect sense and thus will be introduced to subsequent AAP releases. Thanks for sharing your thoughts, I actually love it to see someone REALLY think about AAP enhancements.

3. The prefonly toggle

So I suppose that:
- if it's 0, then it connects to the strongest signal between all the open networks available and the networks defined into the config file
- if it's 1, then it connects just to the strongest signal between the networks defined into the config file

Perfectly correct assumption! The default is prefonly=0 just due to the fact that, OPN surrounding networks assumed, AAP works out of the box for quick internet access (while on the road or something) without any user configuration required. Certainly, you may whitelist/utilize OPN networks as well while using prefonly=1, i.e. you just need to configure the OPN networks of desire with an empty key argument (this may be broken with most recent UCI releases deleting empty UCI configuration arguments, need to check this once time allows), that's it!

@napierzaza

Which image file would work as a ramdisk on a meraki mini?

I'm unsure about that one (never tried that myself). That said, the Meraki Mini mini is in general (as an Atheros device supported by OpenWrt Backfire) supported by Piranha v4 .. and if there is a stock OpenWrt image capable of what you're trying to achieve at http://downloads.openwrt.org/backfire/10.03/atheros/ there is a corresponding image at http://piranha.pwnz.org/pub/v4/100813/ as well. If not, this is something not covered by the default build process.

(Last edited by orange on 13 Sep 2010, 17:16)

hi lux !
the configuration you'v posted is exactly what dosn't work for me with the last Backfire 10.03.1-rc3.

Lux wrote:

.....
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'
.....

i just wanted to test aap under backfire but opkg return an " has no valid architecture "
I want to try piranha but since this message i don't realy think i shoold

here is my architecture

root@OpenWrt:~# cat /proc/cpuinfo wrote:

system type        : Atheros AR9132 rev 2
machine            : TP-LINK TL-WR1043ND
processor        : 0
cpu model        : MIPS 24Kc V7.4
BogoMIPS        : 266.24
wait instruction    : yes
microsecond timers    : yes
tlb_entries        : 16
extra interrupt vector    : yes
hardware watchpoint    : yes, count: 4, address/irw mask: [0x0ff8, 0x0ffc, 0x0ffb, 0x0ffb]
ASEs implemented    : mips16
shadow register sets    : 1
core            : 0
VCED exceptions        : not available
VCEI exceptions        : not available

what do you tink ?
thank you

(Last edited by ethernos on 19 Sep 2010, 16:27)

@Orange
I'm writing some improvements for AAP
They are not so big changes, just few stuff I found useful
One change is about a small bug with the ping when watchinet is 0
Another change is a "more random" mac changes
Then a web interface
And then I'm trying to minimize the IO to files (in particular the writes)

I have not so much time, but when I finish it I'll send it to you (just to let you know)
I'm doing it cause of my needs, but maybe some changes are not conciliabile with your plan about the software (for example you dont want a web interface)


@ethernos
You can't run AAP on a pre-compiled OpenWrt distribution as Orange wrote here: https://forum.openwrt.org/viewtopic.php?id=26116
"...That said, due to its design, AAP is Atheros only and won't run on a pre-compiled OpenWrt distribution as it needs a patch to madwifi sources, in order to un-truncate "wlanconfig ath0 list scan" SSID output, that isn't part of OpenWrt by default. I don't feel it appropriate to provide comprehensive patching/installation and OpenWrt configuration instructions as this would significantly higher both the potential for failure and my very own maintenance overhead in supporting AAP. Thus I provide Piranha (currently v4) as a ready-to-use solution. Support for other OpenWrt platforms (Broadcom etc) isn't planned (at least not from a short term perspective)..."

Orange is the creator of Piranha and AAP so you should ask him if it is possible to install it on your devise.
Anyway Piranha is just OpenWrt with something preinstalled and patched, so if your device can run OpenWrt maybe it can also run Piranha.
But keep in mind that I'm not expert at all in this, so wait for Orange answer cause I dont want you to make a big mess.

So, I assume that now AAP is not working on your device
If AAP is not working, with that configuration you posted, I would expect this behaviour:
- the AP in STA (client) mode cant connect to anything, cause there is not a wifi network with ssid 'SSID' and with no encryption close to your device
- the AP in AP (access point) mode is not working cause the STA one failed
I posted this configuration cause it works with AAP

If you want it to work like a wifi client with a virtual access point (without AAP), so: change the AP in STA (client) mode with the right ssid name and encryption key (I mean the one from the original network close to you router)
When this AP in client mode is working, so also the virtual AP will work

@lux

I'm writing some improvements for AAP
They are not so big changes, just few stuff I found useful
One change is about a small bug with the ping when watchinet is 0
Another change is a "more random" mac changes
Then a web interface
And then I'm trying to minimize the IO to files (in particular the writes)

I have not so much time, but when I finish it I'll send it to you (just to let you know)
I'm doing it cause of my needs, but maybe some changes are not conciliabile with your plan about the software (for example you dont want a web interface)

Sounds very nice! I'm actually really looking forward to your AAP improvements. It's much appreciated to see someone actively contributing to the Piranha Project. And btw, I'd LOVE to have a web interface for AAP. That said, it would be cool if we could talk about its design a bit in advance. Please contact me via email (contact details on the Piranha Project Website). Thanks!

@ethernos

Orange is the creator of Piranha and AAP so you should ask him if it is possible to install it on your devise.
Anyway Piranha is just OpenWrt with something preinstalled and patched, so if your device can run OpenWrt maybe it can also run Piranha.
But keep in mind that I'm not expert at all in this, so wait for Orange answer cause I dont want you to make a big mess.

lux provided perfectly correct informations. Piranha v4 will work on all Atheros hardware supported by Backfire 10.03 (that's what it actually is, besides a few minor modifications). Next Piranha v4 snapshot (no ETA yet) will be based upon Backfire 10.03.1.

HuRAH !!!!!

More writers ... i will love to test !!!!!

yep ... looking forward to it ...

not sure if this is a bug for Piranha, or openwrt:

config 'interface' 'wan'
        option 'ifname' 'eth0'
        option 'macaddr' 00:11:22:33:44:55

is not effective, original mac is always showing. neither is the following:

ifconfig eth0 hw ether 00:11:22:33:44:55
ifconfig: SIOCSIFHWADDR: Operation not supported

any idea?