Category Archives: VoCore

mt76 or mt7628?

Currently openwrt has an opensource driver mt76, I have a study about it, every line of its code is very clear and beautiful, so it should be easy to replace official mt7628 with this one, unfortunately, I find it is very hard to understand its registers(mtk did not document any of that registers) so I can not setting up its interfaces unless do some hack 🙂

There is another way, enable cfg80211 in mt7628, I find it has some code about cfg80211, but I enable it in makefile, it can not work at all 🙂 guess it is not well tested…

VoCore2: LuCI

Setting STA mode by LuCI is always my target.

Spend some time learn about LuCI.

First fix is about the encryption:
Currently the encrypt do not have WPA/WPA2, it is because in /usr/lib/lua/luci/model/cbi/admin_network/wifi.lua:663, we should add hwtype=ralink to enable the encrypt ways.

Note: it only have hwtype == mac80211 or hwtype == broadcom, but no ralink, so we can not find WPA/WPA2 encryption and can not setup its password. I have submitted this patch to github/openwrt/luci, hope this can be fixed.

Second fix is about the scan:

This needs to rewrite iwinfo_wext_scan.c in libiwinfo.
Anyway, we can not use that “Join Network” button, because LuCI action/design is very weird, it will remove exists AP setting…and no way set it to “apcli0”.
There is an easy way to connect to STA, directly setting up client and it will be done.

My home router name is KOKO, so ESSID is KOKO, BSSID empty. Network already in setting, then select “Wireless Security” input your password.

VoCore2: WiFi modes(ADHOC) 2

AdHoc can not directly work that ways…
Find in source code, it must have CONFIG_STA_SUPPORT then you can enable that “NetworkType” setting.
But this driver do not support that mode I guess.
Have to check the source code again. There should be a way to enable it. :p

VoCore2: WiFi modes(ADHOC)

Just find some instruction to use the mt7628 driver by iwpriv, this still need work to make it work with uci system, but at least if you are using latest vocore2 wifi driver, you can start adhoc mode by iwpriv. 🙂

a> Config STA to link with AP which is OPEN/NONE(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=OPEN
3. iwpriv ra0 set EncrypType=NONE
4. iwpriv ra0 set SSID=”AP’s SSID”

b> Config STA to link with AP which is SHARED/WEP(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=SHARED
3. iwpriv ra0 set EncrypType=WEP
4. iwpriv ra0 set DefaultKeyID=1
5. iwpriv ra0 set Key1=”AP’s wep key”
6. iwpriv ra0 set SSID=”AP’s SSID”

c> Config STA to link with AP which is WPAPSK/TKIP(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=WPAPSK
3. iwpriv ra0 set EncrypType=TKIP
4. iwpriv ra0 set SSID=”AP’s SSID”
5. iwpriv ra0 set WPAPSK=”AP’s wpa-preshared key”
6. iwpriv ra0 set SSID=”AP’s SSID”

d> Config STA to link with AP which is WPAPSK/AES(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=WPAPSK
3. iwpriv ra0 set EncrypType=AES
4. iwpriv ra0 set SSID=”AP’s SSID”
5. iwpriv ra0 set WPAPSK=”AP’s wpa-preshared key”
6. iwpriv ra0 set SSID=”AP’s SSID”

e> Config STA to link with AP which is WPA2PSK/TKIP(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=WPA2PSK
3. iwpriv ra0 set EncrypType=TKIP
4. iwpriv ra0 set SSID=”AP’s SSID”
5. iwpriv ra0 set WPAPSK=12345678
6. iwpriv ra0 set SSID=”AP’s SSID”

f> Config STA to create/link as adhoc mode, which is OPEN/NONE(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Adhoc
2. iwpriv ra0 set AuthMode=OPEN
3. iwpriv ra0 set EncrypType=NONE
4. iwpriv ra0 set SSID=”Adhoc’s SSID”

g> Config STA to create/link as adhoc mode, which is WPANONE/TKIP(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Adhoc
2. iwpriv ra0 set AuthMode=WPANONE
3. iwpriv ra0 set EncrypType=TKIP
4. iwpriv ra0 set SSID=”AP’s SSID”
5. iwpriv ra0 set WPAPSK=12345678
6. iwpriv ra0 set SSID=”AP’s SSID”

VoCore2: Monitor/Sniffer on WiFi

It is pretty simple by using mt7628.ko(or directly use firmware http://vonger.cn/misc/vocore2/20180419V.bin)

First install libpcap.ipk and tcpdump.ipk

Then MonitorMode=2 is MONITOR_MODE_FULL, =1 is MONITOR_MODE_REGULAR_RX, =0 is OFF.

ifconfig mon0 up
iwpriv ra0 set MonitorMode=2
tcpdump -i mon0 -w /tmp/store.cap -vv

or tcpdump -i ra0 -w /tmp/store.cap -vv

The raw data is saved to /tmp/store.cap.
Now we can use wireshark to read store.cap, check the data we get from net. 🙂

PS: CMCC-XXX is everywhere, noise…

VoCore2: Show Multiple SSIDs(up to 16 SSID)

Today when I hack the mt7628 driver, I find this hidden feature( maybe not hidden, but at least no documentation at all )

Example come first, if we want 4 different SSIDs in same VoCore2, need to setting up /etc/wireless/mt7628/mt7628.dat

This is only works for mediatek wifi driver mt7628.ko, not sure if mt76 works.

Modify BssidNum, set it to 4.

BssidNum=4
SSID1=VoCore2
SSID2=VoCore2-GUEST
SSID3=VoCore2-HOST
SSID4=VoCore2-NAS

Then reboot, you will find four raX device in your device list.

ra1       Available private ioctls :
          set              (8BE2) : set 1536 char  & get   0      
          show             (8BF1) : set 1024 char  & get   0      
          get_site_survey  (8BED) : set   0       & get 1024 char 
          set_wsc_oob      (8BF9) : set 1024 char  & get 1024 char 
          get_mac_table    (8BEF) : set 1024 char  & get 1024 char 
          e2p              (8BE7) : set 1024 char  & get 1024 char 
          bbp              (8BE3) : set 1024 char  & get 1024 char 
          mac              (8BE5) : set 1024 char  & get 1024 char 
          rf               (8BF3) : set 1024 char  & get 1024 char 
          get_wsc_profile  (8BF2) : set 1024 char  & get 1024 char 
          get_ba_table     (8BF6) : set 1024 char  & get 1024 char 
          stat             (8BE9) : set 1024 char  & get 1024 char 

br-lan    no private ioctls.

mon0      Available private ioctls :
          set              (8BE2) : set 1536 char  & get   0      
          show             (8BF1) : set 1024 char  & get   0      
          get_site_survey  (8BED) : set   0       & get 1024 char 
          set_wsc_oob      (8BF9) : set 1024 char  & get 1024 char 
          get_mac_table    (8BEF) : set 1024 char  & get 1024 char 
          e2p              (8BE7) : set 1024 char  & get 1024 char 
          bbp              (8BE3) : set 1024 char  & get 1024 char 
          mac              (8BE5) : set 1024 char  & get 1024 char 
          rf               (8BF3) : set 1024 char  & get 1024 char 
          get_wsc_profile  (8BF2) : set 1024 char  & get 1024 char 
          get_ba_table     (8BF6) : set 1024 char  & get 1024 char 
          stat             (8BE9) : set 1024 char  & get 1024 char 

ra2       Available private ioctls :
          set              (8BE2) : set 1536 char  & get   0      
          show             (8BF1) : set 1024 char  & get   0      
          get_site_survey  (8BED) : set   0       & get 1024 char 
          set_wsc_oob      (8BF9) : set 1024 char  & get 1024 char 
          get_mac_table    (8BEF) : set 1024 char  & get 1024 char 
          e2p              (8BE7) : set 1024 char  & get 1024 char 
          bbp              (8BE3) : set 1024 char  & get 1024 char 
          mac              (8BE5) : set 1024 char  & get 1024 char 
          rf               (8BF3) : set 1024 char  & get 1024 char 
          get_wsc_profile  (8BF2) : set 1024 char  & get 1024 char 
          get_ba_table     (8BF6) : set 1024 char  & get 1024 char 
          stat             (8BE9) : set 1024 char  & get 1024 char 

lo        no private ioctls.

eth0.1    no private ioctls.

apcli0    Available private ioctls :
          set              (8BE2) : set 1536 char  & get   0      
          show             (8BF1) : set 1024 char  & get   0      
          get_site_survey  (8BED) : set   0       & get 1024 char 
          set_wsc_oob      (8BF9) : set 1024 char  & get 1024 char 
          get_mac_table    (8BEF) : set 1024 char  & get 1024 char 
          e2p              (8BE7) : set 1024 char  & get 1024 char 
          bbp              (8BE3) : set 1024 char  & get 1024 char 
          mac              (8BE5) : set 1024 char  & get 1024 char 
          rf               (8BF3) : set 1024 char  & get 1024 char 
          get_wsc_profile  (8BF2) : set 1024 char  & get 1024 char 
          get_ba_table     (8BF6) : set 1024 char  & get 1024 char 
          stat             (8BE9) : set 1024 char  & get 1024 char 

ra3       Available private ioctls :
          set              (8BE2) : set 1536 char  & get   0      
          show             (8BF1) : set 1024 char  & get   0      
          get_site_survey  (8BED) : set   0       & get 1024 char 
          set_wsc_oob      (8BF9) : set 1024 char  & get 1024 char 
          get_mac_table    (8BEF) : set 1024 char  & get 1024 char 
          e2p              (8BE7) : set 1024 char  & get 1024 char 
          bbp              (8BE3) : set 1024 char  & get 1024 char 
          mac              (8BE5) : set 1024 char  & get 1024 char 
          rf               (8BF3) : set 1024 char  & get 1024 char 
          get_wsc_profile  (8BF2) : set 1024 char  & get 1024 char 
          get_ba_table     (8BF6) : set 1024 char  & get 1024 char 
          stat             (8BE9) : set 1024 char  & get 1024 char 

ra0       Available private ioctls :
          set              (8BE2) : set 1536 char  & get   0      
          show             (8BF1) : set 1024 char  & get   0      
          get_site_survey  (8BED) : set   0       & get 1024 char 
          set_wsc_oob      (8BF9) : set 1024 char  & get 1024 char 
          get_mac_table    (8BEF) : set 1024 char  & get 1024 char 
          e2p              (8BE7) : set 1024 char  & get 1024 char 
          bbp              (8BE3) : set 1024 char  & get 1024 char 
          mac              (8BE5) : set 1024 char  & get 1024 char 
          rf               (8BF3) : set 1024 char  & get 1024 char 
          get_wsc_profile  (8BF2) : set 1024 char  & get 1024 char 
          get_ba_table     (8BF6) : set 1024 char  & get 1024 char 
          stat             (8BE9) : set 1024 char  & get 1024 char 

eth0      no private ioctls.

eth0.2    no private ioctls.

apcli1    Available private ioctls :
          set              (8BE2) : set 1536 char  & get   0      
          show             (8BF1) : set 1024 char  & get   0      
          get_site_survey  (8BED) : set   0       & get 1024 char 
          set_wsc_oob      (8BF9) : set 1024 char  & get 1024 char 
          get_mac_table    (8BEF) : set 1024 char  & get 1024 char 
          e2p              (8BE7) : set 1024 char  & get 1024 char 
          bbp              (8BE3) : set 1024 char  & get 1024 char 
          mac              (8BE5) : set 1024 char  & get 1024 char 
          rf               (8BF3) : set 1024 char  & get 1024 char 
          get_wsc_profile  (8BF2) : set 1024 char  & get 1024 char 
          get_ba_table     (8BF6) : set 1024 char  & get 1024 char 
          stat             (8BE9) : set 1024 char  & get 1024 char 

Now we can use every ra0, ra1, ra2, ra3 same time by one VoCore2. 🙂
And we can setting network, firewall to use them for guest, nas etc…

PS: it support up to 16 ssids, you need to modify its setting in the same file.

Have fun!

mine is working so well.

VoCore2: Port mt7628.ko to LuCI 8

Install LuCI to the firmware, get some errors:

Tue May 15 00:07:30 2018 daemon.notice netifd: Interface 'wan' has link connectivity
Tue May 15 00:07:30 2018 daemon.notice netifd: radio0 (844): uci: Parse error (too many arguments) at line 24, byte 24
Tue May 15 00:07:30 2018 user.notice firewall: Reloading firewall due to ifup of lan (br-lan)
Tue May 15 00:11:10 2018 daemon.err uhttpd[794]: luci: accepted login on / for root from 192.168.61.231
Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:509: Failed to execute arcombine dispatcher target for entry '/admin/network/network/wwan'.
Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: The called action terminated with an exception:
Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/map'.
Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/nsection'.
Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/ucisection'.
Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/tabcontainer'.
Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/network_ifacelist'.
Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/model/network.lua:1277: bad argument #4 to '?' (no value)
Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: stack traceback:
Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: 	[C]: in function 'assert'
Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: 	/usr/lib/lua/luci/dispatcher.lua:509: in function 'dispatch'
Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: 	/usr/lib/lua/luci/dispatcher.lua:127: in function 
Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:509: Failed to execute arcombine dispatcher target for entry '/admin/network/network/wwan'.
Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: The called action terminated with an exception:
Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/map'.
Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/nsection'.
Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/ucisection'.
Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/tabcontainer'.
Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/network_ifacelist'.
Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/model/network.lua:1277: bad argument #4 to '?' (no value)
Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: stack traceback:
Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: 	[C]: in function 'assert'
Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: 	/usr/lib/lua/luci/dispatcher.lua:509: in function 'dispatch'
Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: 	/usr/lib/lua/luci/dispatcher.lua:127: in function 
Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:509: Failed to execute arcombine dispatcher target for entry '/admin/network/network/lan'.
Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: The called action terminated with an exception:
Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/map'.
Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/nsection'.
Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/ucisection'.
Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/tabcontainer'.
Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/network_ifacelist'.
Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/model/network.lua:1277: bad argument #4 to '?' (no value)
Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: stack traceback:
Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: 	[C]: in function 'assert'
Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: 	/usr/lib/lua/luci/dispatcher.lua:509: in function 'dispatch'
Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: 	/usr/lib/lua/luci/dispatcher.lua:127: in function 
Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:509: Failed to execute arcombine dispatcher target for entry '/admin/network/network/lan'.
Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: The called action terminated with an exception:
Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/map'.
Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/nsection'.
Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/ucisection'.
Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/tabcontainer'.
Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/network_ifacelist'.
Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/model/network.lua:1277: bad argument #4 to '?' (no value)
Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: stack traceback:
Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: 	[C]: in function 'assert'
Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: 	/usr/lib/lua/luci/dispatcher.lua:509: in function 'dispatch'
Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: 	/usr/lib/lua/luci/dispatcher.lua:127: in function 
Tue May 15 00:38:37 2018 daemon.info dnsmasq-dhcp[1152]: DHCPREQUEST(br-lan) 192.168.61.231 78:4f:43:5b:75:57
Tue May 15 00:38:37 2018 daemon.info dnsmasq-dhcp[1152]: DHCPACK(br-lan) 192.168.61.231 78:4f:43:5b:75:57 Vongers-MBP-2
Tue May 15 00:38:37 2018 daemon.warn odhcpd[705]: DHCPV6 SOLICIT IA_NA from 00010001217b622f784f435b7557 on br-lan: ok fd2d:f637:12aa::4e9/128
Tue May 15 00:38:38 2018 daemon.warn odhcpd[705]: DHCPV6 REQUEST IA_NA from 00010001217b622f784f435b7557 on br-lan: ok fd2d:f637:12aa::4e9/128

I did not install iwinfo, so that should be one of the problem.
LuCI netdev interface can not be edit, that should be something missed.

VoCore2: Setup OpenWrt in MacOS 10.13

Just copy from openwrt official site.

I used to use port but brew looks better now.

First, install brew.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

It is broken when I install it, need to set privilege for some folders, you can call “brew doctor” to get instruction then fix it or search google 🙂

brew install coreutils diffutils findutils gawk gnu-getopt gnu-tar grep wget quilt xz gnu-time

note: in my macbook, I find getopt do not support –long. Looks like default it will find the getopt from MacOS (/usr/bin) but not the one from brew.

add this line to your ~/.profile, so system will search and use gnu-getopt first.(this path will be different if version of getopt changed)

export PATH="/usr/local/Cellar/gnu-getopt/1.1.6/bin:$PATH"

Then make a virtual disk by disk-utils, must be case sensitive disk, size around 20GB.

Clone openwrt latest version from github to the new disk.

git clone https://github.com/openwrt/openwrt.git

Then make menuconfig, everything will work.

If you want install mt7628.ko into the firmware, follow the tutorial at https://github.com/vonger/vocore2

VoCore2: Port mt7628.ko to LuCI 7

I find VoCore2 led is not working with new driver mt7628,ko, it is because in /etc/config/system, led is set to “wlan0” which is used by mt76 drivers.

So make a simple patch to fix it.

diff -Naur a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -443,10 +443,10 @@
 	set_wifi_led "vocore:green:status"
 	;;
 vocore2)
-	set_wifi_led "$boardname:fuchsia:status"
+	set_wifi_led "$boardname:fuchsia:status" "ra0"
 	;;
 vocore2lite)
-	set_wifi_led "$boardname:green:status"
+	set_wifi_led "$boardname:green:status" "ra0"
 	;;
 w502u)
 	set_usb_led "$boardname:blue:usb"

Note: new version VoCore2 I plan to use red led, one reason is red more like heart than fuchsia, so when we transfer data, it is like its heartbeat, this is my VoCore2 Ultimate first design.
Another reason…fuchsia led is very shortage, every time it is hard to get (looks like not many people use it) 🙂

VoCore2: Port mt7628.ko to LuCI 6

I think it is working now 🙂

1. copy /etc/config/wireless from current vocore2 firmware to same folder.
2. copy /lib/netifd/wireless/ralink.sh from current vocore2 firmware to same folder.
3. chmod +x /lib/netifd/wireless/ralink.sh

Then reboot, at least ap mode is working.
Still some parameters and sta mode are not working, but these bugs should be easy to fix 🙂

OK, next time I can make a patch and put to github.