|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. /lib/functions.sh
|
|
|
|
. /lib/functions/uci-defaults.sh
|
|
|
|
. /lib/functions/system.sh
|
|
|
|
|
|
|
|
ramips_setup_interfaces()
|
|
|
|
{
|
|
|
|
local board="$1"
|
|
|
|
|
|
|
|
case $board in
|
|
|
|
alfa-network,awusfree1|\
|
|
|
|
d-team,pbr-d1|\
|
|
|
|
tama,w06|\
|
|
|
|
tplink,tl-mr3020-v3|\
|
|
|
|
tplink,tl-wr802n-v4)
|
|
|
|
ucidef_set_interface_lan "eth0"
|
|
|
|
;;
|
|
|
|
buffalo,wcr-1166ds)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"3:lan" "4:wan" "6@eth0"
|
|
|
|
;;
|
|
|
|
cudy,wr1000)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"2:lan:2" "3:lan:1" "4:wan" "6@eth0"
|
|
|
|
;;
|
|
|
|
duzun,dm06)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"1:lan" "0:wan" "6@eth0"
|
|
|
|
;;
|
|
|
|
glinet,gl-mt300n-v2)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"1:lan" "0:wan" "6@eth0"
|
|
|
|
;;
|
|
|
|
glinet,vixmini)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"0:lan" "6@eth0"
|
|
|
|
;;
|
|
|
|
hilink,hlk-7628n|\
|
|
|
|
hiwifi,hc5861b|\
|
|
|
|
skylab,skw92a|\
|
|
|
|
tplink,archer-c20-v4|\
|
|
|
|
tplink,archer-c50-v3|\
|
|
|
|
tplink,archer-c50-v4|\
|
|
|
|
tplink,tl-mr3420-v5|\
|
|
|
|
tplink,tl-wr840n-v4|\
|
|
|
|
tplink,tl-wr840n-v5|\
|
|
|
|
tplink,tl-wr841n-v13|\
|
|
|
|
tplink,tl-wr841n-v14|\
|
|
|
|
tplink,tl-wr842n-v5|\
|
|
|
|
unielec,u7628-01-16m|\
|
|
|
|
wrtnode,wrtnode2p|\
|
|
|
|
wrtnode,wrtnode2r|\
|
|
|
|
zyxel,keenetic-extra-ii)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
|
|
|
|
;;
|
|
|
|
hiwifi,hc5661a|\
|
|
|
|
hiwifi,hc5761a|\
|
|
|
|
mediatek,mt7628an-eval-board|\
|
|
|
|
mercury,mac1200r-v2|\
|
|
|
|
totolink,lr1200|\
|
|
|
|
wavlink,wl-wn570ha1|\
|
|
|
|
wavlink,wl-wn575a3)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
|
|
|
|
;;
|
|
|
|
iptime,a3)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"2:lan:2" "3:lan:1" "0:wan" "6@eth0"
|
|
|
|
;;
|
|
|
|
iptime,a604m)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
|
|
|
|
;;
|
|
|
|
mediatek,linkit-smart-7688|\
|
|
|
|
onion,omega2p|\
|
|
|
|
onion,omega2|\
|
|
|
|
tplink,tl-wa801nd-v5|\
|
|
|
|
widora,neo-16m|\
|
|
|
|
widora,neo-32m)
|
|
|
|
ucidef_add_switch "switch0"
|
|
|
|
ucidef_add_switch_attr "switch0" "enable" "false"
|
|
|
|
ucidef_set_interface_lan "eth0"
|
|
|
|
;;
|
|
|
|
netgear,r6120)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6@eth0"
|
|
|
|
;;
|
|
|
|
rakwireless,rak633)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
|
|
|
|
;;
|
|
|
|
tplink,tl-wr902ac-v3)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"4:lan" "6@eth0"
|
|
|
|
;;
|
|
|
|
vocore,vocore2|\
|
|
|
|
vocore,vocore2-lite)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"0:lan" "2:lan" "6t@eth0"
|
|
|
|
;;
|
|
|
|
wiznet,wizfi630s)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"0:wan" "3:lan" "4:lan" "6@eth0"
|
|
|
|
;;
|
|
|
|
xiaomi,mir4a-100m)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"4:lan:1" "2:lan:2" "0:wan" "6@eth0"
|
|
|
|
;;
|
|
|
|
xiaomi,miwifi-nano)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"0:lan:2" "2:lan:1" "4:wan" "6@eth0"
|
|
|
|
;;
|
|
|
|
zbtlink,zbt-we1226)
|
|
|
|
ucidef_add_switch "switch0" \
|
|
|
|
"0:lan:2" "1:lan:1" "4:wan" "6@eth0"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
ramips_setup_macs()
|
|
|
|
{
|
|
|
|
local board="$1"
|
|
|
|
local lan_mac=""
|
|
|
|
local wan_mac=""
|
|
|
|
local label_mac=""
|
|
|
|
|
|
|
|
case $board in
|
|
|
|
buffalo,wcr-1166ds)
|
|
|
|
local index="$(find_mtd_index "board_data")"
|
|
|
|
wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
|
|
|
|
lan_mac=$wan_mac
|
|
|
|
;;
|
|
|
|
cudy,wr1000)
|
|
|
|
wan_mac=$(mtd_get_mac_binary factory 0x2e)
|
ramips: remove bogus ralink,mtd-eeprom with offset 0x4
Several devices in mt76x8 subtarget use the following line to set
up wmac in their DTS(I) files:
ralink,mtd-eeprom = <&factory 0x4>
This is strange for several reasons:
- They should use mediatek,mtd-eeprom on this SOC
- The caldata is supposed to start at 0x0
- The parent DTSI mt7628an.dtsi specifies mediatek,mtd-eeprom anyway,
starting from 0x0
- The offset coincides with the default location of the MAC address
in caldata
Based on the comment in b28e94d4bfa1 ("ramips: MiWiFi Nano fixes"),
it looks like the author for this device wanted to actually use
mtd-mac-address instead of ralink,mtd-eeprom. A check on the same
device revealed that actually the MAC address start at offset 4 there,
so the correct caldata offset is 0x0.
Based on these findings, and the fact that the expected location on
this SOC is 0x0, we remove the "ralink,mtd-eeprom = <&factory 0x4>"
statement from all devices in ramips (being only mt7628an anyway).
Thanks to Sungbo Eo for finding and researching this.
Reported-by: Sungbo Eo <mans0n@gorani.run>
Fixes: b28e94d4bfa1 ("ramips: MiWiFi Nano fixes")
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
|
|
|
label_mac=$(mtd_get_mac_binary factory 0x4)
|
|
|
|
;;
|
ramips: remove default case for MAC address assignment
So far, MAC address assignment in ramips has contained a default
case, which defined wan_mac = eth0 + 1 for _every_ device not
having an explicit case there.
This is not desirable, as many device supporters will just not
care or know about this definition, so another MAC address will be
introduced by accident. In some cases the wan_mac is assigned
although it is not needed, in other cases even addresses not
dedicated to the device will be used (e.g. wan_mac actually is
eth0 - 1, but during support nobody cared, so eth0 + 1 is used now,
which might actually belong to another device ...).
Thus, in this PR the former default case is converted to an
explicit case. This one comprises all devices not being accounted
for by other cases, reduced by those not having wan at all.
The big number of entries for this node might be another indication
that many of them wouldn't actually be there if there hadn't been
default wan_mac setup.
In exchange, the current "do nothing" case can be removed, as it
will be the new default case.
The devices being put in the newly created explicit case were
determined as follows:
1. Create a list of all devices based on the DTS files.
2. Remove all devices already having an explicit entry setting
their address.
3. Remove all devices that only have lan set up in the first part
of 02_network:
mt7620:
- alfa-network,tube-e4g
- asus,rp-n53
- buffalo,wmr-300
- comfast,cf-wr800n
- edimax,ew-7476rpc
- edimax,ew-7478ac
- elecom,wrh-300cr
- hnet,c108
- kimax,u25awf-h1
- kimax,u35wf
- kingston,mlw221
- kingston,mlwg2
- microduino,microwrt
- netgear,ex2700
- netgear,ex3700
- netgear,wn3000rp-v3
- planex,cs-qr10
- planex,mzk-ex300np
- planex,mzk-ex750np
- ravpower,wd03
- sercomm,na930
- yukai,bocco
- zbtlink,zbt-cpe102
- zte,q7
mt7621:
- gnubee,gb-pc1
- gnubee,gb-pc2
- linksys,re6500
- mikrotik,rbm11g
- netgear,ex6150
- thunder,timecloud
- tplink,re350-v1
- tplink,re650-v1
mt76x8:
- alfa-network,awusfree1
- d-team,pbr-d1
- glinet,vixmini
- vocore,vocore2-lite
- tama,w06
- tplink,tl-mr3020-v3
- tplink,tl-wa801nd-v5
- tplink,tl-wr802n-v4
- tplink,tl-wr902ac-v3
- vocore,vocore2
- widora,neo-16m
- widora,neo-32m
rt288x:
- buffalo,wli-tx4-ag300n
- dlink,dap-1522-a1
rt305x:
- allnet,all0256n-4m
- allnet,all0256n-8m
- allnet,all5002
- allnet,all5003
- alphanetworks,asl26555-16m
- alphanetworks,asl26555-8m
- asus,wl-330n
- aximcom,mr-102n
- dlink,dcs-930
- easyacc,wizard-8800
- hame,mpr-a2
- hootoo,ht-tm02
- huawei,d105
- intenso,memory2move
- planex,mzk-dp150n
- rt305x dlink,dcs-930l-b1
- sparklan,wcr-150gn
- tenda,3g150b
- tenda,3g300m
- tenda,w150m
- trendnet,tew-638apb-v2
- unbranded,a5-v11
- vocore,vocore-16m
- vocore,vocore-8m
- wansview,ncs601w
- zorlik,zl5900v2
rt3883:
- loewe,wmdr-143n
- omnima,hpm
4. Put the remaining devices in the new case.
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
|
|
|
duzun,dm06|\
|
|
|
|
netgear,r6120|\
|
|
|
|
wrtnode,wrtnode2p|\
|
|
|
|
wrtnode,wrtnode2r|\
|
|
|
|
zyxel,keenetic-extra-ii)
|
|
|
|
wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1)
|
|
|
|
;;
|
|
|
|
hilink,hlk-7628n)
|
|
|
|
lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
|
|
|
|
wan_mac=$(macaddr_add "$lan_mac" 1)
|
|
|
|
;;
|
|
|
|
hiwifi,hc5661a|\
|
|
|
|
hiwifi,hc5761a|\
|
|
|
|
hiwifi,hc5861b)
|
|
|
|
lan_mac=$(mtd_get_mac_ascii bdinfo "Vfac_mac ")
|
|
|
|
label_mac=$lan_mac
|
|
|
|
[ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
|
|
|
|
wan_mac=$(macaddr_add "$lan_mac" 1)
|
|
|
|
;;
|
|
|
|
iptime,a3|\
|
|
|
|
iptime,a604m)
|
|
|
|
wan_mac=$(mtd_get_mac_binary u-boot 0x1fc40)
|
|
|
|
;;
|
|
|
|
mediatek,linkit-smart-7688|\
|
|
|
|
onion,omega2|\
|
|
|
|
onion,omega2p)
|
|
|
|
wan_mac=$(mtd_get_mac_binary factory 0x4)
|
|
|
|
lan_mac=$(mtd_get_mac_binary factory 0x2e)
|
|
|
|
;;
|
|
|
|
mercury,mac1200r-v2)
|
|
|
|
wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory_info 0xd)" 1)
|
|
|
|
;;
|
|
|
|
rakwireless,rak633|\
|
|
|
|
unielec,u7628-01-16m|\
|
|
|
|
wavlink,wl-wn575a3|\
|
|
|
|
wiznet,wizfi630s)
|
|
|
|
wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x28)" 1)
|
|
|
|
;;
|
|
|
|
skylab,skw92a|\
|
|
|
|
totolink,lr1200)
|
|
|
|
wan_mac=$(mtd_get_mac_binary factory 0x2e)
|
|
|
|
;;
|
|
|
|
tplink,archer-c20-v4|\
|
|
|
|
tplink,archer-c50-v3|\
|
|
|
|
tplink,tl-mr3420-v5|\
|
|
|
|
tplink,tl-wr840n-v4|\
|
|
|
|
tplink,tl-wr840n-v5|\
|
|
|
|
tplink,tl-wr841n-v13|\
|
|
|
|
tplink,tl-wr841n-v14|\
|
|
|
|
tplink,tl-wr842n-v5)
|
|
|
|
wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0xf100)" 1)
|
|
|
|
;;
|
|
|
|
tplink,archer-c50-v4)
|
|
|
|
wan_mac=$(macaddr_add "$(mtd_get_mac_binary rom 0xf100)" 1)
|
|
|
|
;;
|
|
|
|
vocore,vocore2|\
|
|
|
|
vocore,vocore2-lite)
|
ramips: remove bogus ralink,mtd-eeprom with offset 0x4
Several devices in mt76x8 subtarget use the following line to set
up wmac in their DTS(I) files:
ralink,mtd-eeprom = <&factory 0x4>
This is strange for several reasons:
- They should use mediatek,mtd-eeprom on this SOC
- The caldata is supposed to start at 0x0
- The parent DTSI mt7628an.dtsi specifies mediatek,mtd-eeprom anyway,
starting from 0x0
- The offset coincides with the default location of the MAC address
in caldata
Based on the comment in b28e94d4bfa1 ("ramips: MiWiFi Nano fixes"),
it looks like the author for this device wanted to actually use
mtd-mac-address instead of ralink,mtd-eeprom. A check on the same
device revealed that actually the MAC address start at offset 4 there,
so the correct caldata offset is 0x0.
Based on these findings, and the fact that the expected location on
this SOC is 0x0, we remove the "ralink,mtd-eeprom = <&factory 0x4>"
statement from all devices in ramips (being only mt7628an anyway).
Thanks to Sungbo Eo for finding and researching this.
Reported-by: Sungbo Eo <mans0n@gorani.run>
Fixes: b28e94d4bfa1 ("ramips: MiWiFi Nano fixes")
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
|
|
|
label_mac=$(mtd_get_mac_binary factory 0x4)
|
|
|
|
;;
|
|
|
|
wavlink,wl-wn570ha1|\
|
|
|
|
zbtlink,zbt-we1226)
|
|
|
|
wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x2e)" 1)
|
|
|
|
;;
|
|
|
|
xiaomi,mir4a-100m)
|
|
|
|
wan_mac=$(mtd_get_mac_binary factory 0x4)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
|
|
|
|
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
|
|
|
|
[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
|
|
|
|
}
|
|
|
|
|
|
|
|
board_config_update
|
|
|
|
board=$(board_name)
|
|
|
|
ramips_setup_interfaces $board
|
|
|
|
ramips_setup_macs $board
|
|
|
|
board_config_flush
|
|
|
|
|
|
|
|
exit 0
|