From: Adrian Schmutzler Date: Tue, 22 Oct 2019 17:04:27 +0000 (+0200) Subject: ramips: remove default case for MAC address assignment X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d2b9333ea90ed89069879b4a676211c72c859f9b;p=oweals%2Fopenwrt.git 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 --- diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index 4e50117a4c..94600bb437 100755 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -219,11 +219,44 @@ ramips_setup_macs() local label_mac="" case $board in - buffalo,whr-1166d|\ - buffalo,whr-300hp2|\ - buffalo,whr-600d|\ - xiaomi,miwifi-mini) - # This empty case has to be kept for devices without any MAC address adjustments + aigale,ai-br100|\ + alfa-network,ac1200rm|\ + asus,rt-ac51u|\ + asus,rt-n12p|\ + asus,rt-n14u|\ + bdcom,wap2100-sk|\ + dlink,dir-810l|\ + edimax,ew-7478apc|\ + fon,fon2601|\ + head-weblink,hdrm200|\ + nexx,wt3020-4m|\ + nexx,wt3020-8m|\ + phicomm,psg1208|\ + phicomm,psg1218a|\ + phicomm,psg1218b|\ + planex,db-wrt01|\ + planex,mzk-750dhp|\ + ralink,mt7620a-evb|\ + ralink,mt7620a-mt7530-evb|\ + ralink,mt7620a-mt7610e-evb|\ + ralink,mt7620a-v22sg-evb|\ + sanlinking,d240|\ + tplink,archer-c2-v1|\ + tplink,archer-c20-v1|\ + tplink,archer-c20i|\ + tplink,archer-c50-v1|\ + tplink,archer-mr200|\ + vonets,var11n-300|\ + wrtnode,wrtnode|\ + youku,yk1|\ + zbtlink,zbt-ape522ii|\ + zbtlink,zbt-wa05|\ + zbtlink,zbt-we2026|\ + zbtlink,zbt-we826-16m|\ + zbtlink,zbt-we826-32m|\ + zbtlink,zbt-we826-e|\ + zbtlink,zbt-wr8305rt) + wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) ;; dlink,dch-m225) lan_mac=$(mtd_get_mac_ascii factory lanmac) @@ -289,9 +322,6 @@ ramips_setup_macs() zyxel,keenetic-viva) wan_mac=$(mtd_get_mac_binary factory 0x28) ;; - *) - wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) - ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 6a0d06577b..f415cd29b8 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -143,6 +143,34 @@ ramips_setup_macs() local label_mac="" case $board in + adslr,g7|\ + afoundry,ew1200|\ + asiarf,ap7621-001|\ + asiarf,ap7621-nv1|\ + firefly,firewrt|\ + gehua,ghl-r-001|\ + mediatek,ap-mt7621a-v60|\ + mediatek,mt7621-eval-board|\ + mikrotik,rb750gr3|\ + mikrotik,rbm33g|\ + mqmaker,witi|\ + mtc,wr1201|\ + netgear,r6220|\ + netgear,wndr3700-v5|\ + storylink,sap-g3200u3|\ + telco-electronics,x1|\ + totolink,a7000r|\ + ubiquiti,edgerouterx|\ + ubiquiti,edgerouterx-sfp|\ + unielec,u7621-06-16m|\ + unielec,u7621-06-64m|\ + wevo,11acnas|\ + wevo,w2914ns-v2|\ + xiaoyu,xy-c5|\ + xzwifi,creativebox-v1|\ + zbtlink,zbt-wg2626) + wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) + ;; asus,rt-ac57u|\ d-team,newifi-d2|\ d-team,pbr-m1|\ @@ -169,9 +197,6 @@ ramips_setup_macs() wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)" lan_mac=$wan_mac ;; - buffalo,wsr-600dhp) - # This empty case has to be kept for devices without any MAC address adjustments - ;; dlink,dir-860l-b1) lan_mac=$(mtd_get_mac_ascii factory lanmac) wan_mac=$(mtd_get_mac_ascii factory wanmac) @@ -220,9 +245,6 @@ ramips_setup_macs() wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) label_mac=$(cat /sys/class/ieee80211/phy0/macaddress) ;; - *) - wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) - ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 3bb5d31423..63861c2089 100755 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -136,8 +136,30 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_binary factory 0x2e) label_mac=$(cat /sys/class/ieee80211/phy0/macaddress) ;; - glinet,gl-mt300n-v2) - # This empty case has to be kept for devices without any MAC address adjustments + duzun,dm06|\ + mediatek,mt7628an-eval-board|\ + netgear,r6120|\ + rakwireless,rak633|\ + 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|\ + wavlink,wl-wn570ha1|\ + wavlink,wl-wn575a3|\ + wiznet,wizfi630s|\ + wrtnode,wrtnode2p|\ + wrtnode,wrtnode2r|\ + xiaomi,mir4a-100m|\ + xiaomi,miwifi-nano|\ + zbtlink,zbt-we1226|\ + zyxel,keenetic-extra-ii) + wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) ;; hilink,hlk-7628n) lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)") @@ -172,9 +194,6 @@ ramips_setup_macs() vocore,vocore2-lite) label_mac=$(cat /sys/class/ieee80211/phy0/macaddress) ;; - *) - wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) - ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/ramips/rt288x/base-files/etc/board.d/02_network b/target/linux/ramips/rt288x/base-files/etc/board.d/02_network index 20b6f5317f..b9588f4aad 100755 --- a/target/linux/ramips/rt288x/base-files/etc/board.d/02_network +++ b/target/linux/ramips/rt288x/base-files/etc/board.d/02_network @@ -42,7 +42,12 @@ ramips_setup_macs() local label_mac="" case $board in - *) + airlink101,ar670w|\ + airlink101,ar725w|\ + asus,rt-n15|\ + belkin,f5d8235-v1|\ + buffalo,wzr-agl300nh|\ + ralink,v11st-fe) wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) ;; esac diff --git a/target/linux/ramips/rt305x/base-files/etc/board.d/02_network b/target/linux/ramips/rt305x/base-files/etc/board.d/02_network index 326bc8a3df..5c110b375e 100755 --- a/target/linux/ramips/rt305x/base-files/etc/board.d/02_network +++ b/target/linux/ramips/rt305x/base-files/etc/board.d/02_network @@ -166,16 +166,68 @@ ramips_setup_macs() local label_mac="" case $board in + 7links,px-4885-4m|\ + 7links,px-4885-8m|\ + accton,wr6202|\ + airlive,air3gii|\ + argus,atp-52b|\ + asiarf,awapn2403|\ + asiarf,awm002-evb-4m|\ + asiarf,awm002-evb-8m|\ + asus,rt-g32-b1|\ + asus,rt-n10-plus|\ + asus,rt-n13u|\ + asus,wl-330n3g|\ + aztech,hw550-3g|\ + belkin,f5d8235-v2|\ + belkin,f7c027|\ + dlink,dap-1350|\ + dlink,dir-300-b1|\ + dlink,dir-600-b1|\ + dlink,dir-610-a1|\ + dlink,dir-620-d1|\ + dlink,dwr-512-b|\ + edimax,3g-6200n|\ + edimax,3g-6200nl|\ + fon,fonera-20n|\ + huawei,hg255d|\ + jcg,jhr-n805r|\ + jcg,jhr-n825r|\ + jcg,jhr-n926r|\ + mofinetwork,mofi3500-3gn|\ + netcore,nw718|\ + nexx,wt1520-4m|\ + nexx,wt1520-8m|\ + nixcore,x1-16m|\ + nixcore,x1-8m|\ + olimex,rt5350f-olinuxino|\ + olimex,rt5350f-olinuxino-evb|\ + omnima,miniembplug|\ + omnima,miniembwifi|\ + planex,mzk-w300nh2|\ + planex,mzk-wdpr|\ + poray,ip2202|\ + prolink,pwh2004|\ + ralink,v22rw-2x2|\ + sitecom,wl-351|\ + teltonika,rut5xx|\ + trendnet,tew-714tru|\ + unbranded,wr512-3gn-4m|\ + unbranded,wr512-3gn-8m|\ + unbranded,xdx-rn502j|\ + upvel,ur-326n4g|\ + upvel,ur-336un|\ + zyxel,keenetic|\ + zyxel,nbg-419n|\ + zyxel,nbg-419n-v2) + wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) + ;; 8devices,carambola|\ alfa-network,w502u|\ arcwireless,freestation5|\ netgear,wnce2001) wan_mac=$(mtd_get_mac_binary factory 0x2e) ;; - buffalo,whr-g300n|\ - zyxel,keenetic-start) - # This empty case has to be kept for devices without any MAC address adjustments - ;; dlink,dir-300-b7|\ dlink,dir-320-b1|\ dlink,dir-620-a1|\ @@ -209,9 +261,6 @@ ramips_setup_macs() tenda,w306r-v2) wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 5) ;; - *) - wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) - ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/ramips/rt3883/base-files/etc/board.d/02_network b/target/linux/ramips/rt3883/base-files/etc/board.d/02_network index 519d46aae6..27c15eecac 100755 --- a/target/linux/ramips/rt3883/base-files/etc/board.d/02_network +++ b/target/linux/ramips/rt3883/base-files/etc/board.d/02_network @@ -81,9 +81,6 @@ ramips_setup_macs() trendnet,tew-692gr) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1) ;; - *) - wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) - ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac