mirror of https://github.com/hak5/openwrt.git
ramips/mt7621: mikrotik: don't use mtd-mac-address in DTS
As evidenced here[1] the device MAC address can be stored at a random offset in the hard_config partition. Rely on sysfs to update the MAC address correctly. Adjust config so that WAN is base MAC and LAN is base MAC +1 to better match label and vendor OS. [1] https://github.com/openwrt/openwrt/pull/2850#issuecomment-610809021 Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>master
parent
9242d691ec
commit
5e50515fa6
|
@ -126,10 +126,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
&gmac0 {
|
|
||||||
mtd-mac-address = <&hard_config 0x0010>;
|
|
||||||
};
|
|
||||||
|
|
||||||
&switch0 {
|
&switch0 {
|
||||||
ports {
|
ports {
|
||||||
port@0 {
|
port@0 {
|
||||||
|
@ -140,29 +136,21 @@
|
||||||
port@1 {
|
port@1 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
label = "lan2";
|
label = "lan2";
|
||||||
mtd-mac-address = <&hard_config 0x0010>;
|
|
||||||
mtd-mac-address-increment = <1>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
port@2 {
|
port@2 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
label = "lan3";
|
label = "lan3";
|
||||||
mtd-mac-address = <&hard_config 0x0010>;
|
|
||||||
mtd-mac-address-increment = <2>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
port@3 {
|
port@3 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
label = "lan4";
|
label = "lan4";
|
||||||
mtd-mac-address = <&hard_config 0x0010>;
|
|
||||||
mtd-mac-address-increment = <3>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
port@4 {
|
port@4 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
label = "lan5";
|
label = "lan5";
|
||||||
mtd-mac-address = <&hard_config 0x0010>;
|
|
||||||
mtd-mac-address-increment = <4>;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -134,11 +134,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
&gmac0 {
|
|
||||||
mtd-mac-address = <&hard_config 0x0010>;
|
|
||||||
mtd-mac-address-increment = <1>;
|
|
||||||
};
|
|
||||||
|
|
||||||
&switch0 {
|
&switch0 {
|
||||||
ports {
|
ports {
|
||||||
port@0 {
|
port@0 {
|
||||||
|
|
|
@ -158,18 +158,11 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
&gmac0 {
|
|
||||||
mtd-mac-address = <&hard_config 0x0010>;
|
|
||||||
mtd-mac-address-increment = <1>;
|
|
||||||
};
|
|
||||||
|
|
||||||
&switch0 {
|
&switch0 {
|
||||||
ports {
|
ports {
|
||||||
port@0 {
|
port@0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
label = "wan";
|
label = "wan";
|
||||||
mtd-mac-address = <&hard_config 0x0010>;
|
|
||||||
mtd-mac-address-increment = <2>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
port@1 {
|
port@1 {
|
||||||
|
|
|
@ -91,9 +91,12 @@ ramips_setup_macs()
|
||||||
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
|
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
|
||||||
label_mac=$wan_mac
|
label_mac=$wan_mac
|
||||||
;;
|
;;
|
||||||
|
mikrotik,routerboard-750gr3|\
|
||||||
mikrotik,routerboard-m11g|\
|
mikrotik,routerboard-m11g|\
|
||||||
mikrotik,routerboard-m33g)
|
mikrotik,routerboard-m33g)
|
||||||
label_mac=$(mtd_get_mac_binary hard_config 0x10)
|
label_mac=$(cat "/sys/firmware/mikrotik/hard_config/mac_base")
|
||||||
|
wan_mac=$label_mac
|
||||||
|
lan_mac=$(macaddr_add $label_mac 1)
|
||||||
;;
|
;;
|
||||||
zbtlink,zbt-we1326|\
|
zbtlink,zbt-we1326|\
|
||||||
zbtlink,zbt-wg3526-16m|\
|
zbtlink,zbt-wg3526-16m|\
|
||||||
|
|
Loading…
Reference in New Issue