The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.
--- Begin Message ---
Hi,

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, October 24, 2018 1:07 AM, Weedy <weedy2...@gmail.com> wrote:

> I'm currently having some fun on master and noticed every reboot gives
> me random mac addresses. Never happened on ar71xx.
>
> #### LAN configuration
>
> config interface lan
> option ifname eth1
> option type bridge
> option proto dhcp
> option hostname 'repeater'
> option ipv6 0
>
> config interface lanAlias
> option ifname br-lan
> option proto static
> option ipaddr 192.168.69.1
> option netmask 255.255.255.0
>
> config interface lanEmerg
> option ifname eth0
> option proto static
> option ipaddr 192.168.42.1
> option netmask 255.255.255.0
>
> root@repeater:~# ifconfig
> br-lan Link encap:Ethernet HWaddr 1E:3C:CB:9D:D7:D7
> inet addr:192.168.69.1 Bcast:192.168.69.255 Mask:255.255.255.0
> ...
>
> eth0 Link encap:Ethernet HWaddr F6:1A:54:6F:68:23
> inet addr:192.168.42.1 Bcast:192.168.42.255 Mask:255.255.255.0
> ...
> Interrupt:4
>
> eth1 Link encap:Ethernet HWaddr 1E:3C:CB:9D:D7:D7
> ...
> Interrupt:5
>
> root@repeater:~# ifconfig
> br-lan Link encap:Ethernet HWaddr 2A:F7:8A:0F:2A:65
> inet addr:192.168.69.1 Bcast:192.168.69.255 Mask:255.255.255.0
> ...
> eth0 Link encap:Ethernet HWaddr 2A:CE:6B:79:1E:B8
> inet addr:192.168.42.1 Bcast:192.168.42.255 Mask:255.255.255.0
> ...
> Interrupt:4
>
> eth1 Link encap:Ethernet HWaddr 2A:F7:8A:0F:2A:65
> ...
> Interrupt:5

Due to the switch to using devicetree in ath79, it became necessary to
populate the MAC addresses via userland during first boot. This is done
using target/linux/ath79/base-files/etc/board.d/02_network,
specifically:

        ubnt,routerstation|\
        ubnt,routerstation-pro)
                wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n 
ar7100_esa)
                lan_mac=$(macaddr_add "$wan_mac" 1)

This said, I can think of a few potential reasons for your
/etc/config/network to lack the 'macaddr' option for lan/wan interfaces:

1.) Rather than modify the UCI network config generated at first boot,
the config was instead overwritten with those from an ar71xx install
(uploading via scp, .tar.gz via LuCI, cat >, etc.)
2.) Using sysupgrade -F and preserving the old config while migrating
from ar71xx -> ath79
2.) Building your own image and deselecting the 'fconfig' utility which
is necessary to read the base MAC address from the RedBoot config
partition

So, to fix this: use an image with fconfig built-in as intended, let the
router boot up and fetch/populate the MAC addresses, and then merge your
old configs with the newly generated ones, without overwriting the
'macaddr' fields in /etc/config/network. Or just add the macaddr to your
current config.

Note that even after doing this, there can be a cosmetic issue where
br-lan will have the correct MAC address, but eth1 will still show a
random MAC. Frames making their way onto the wire will use the MAC
assigned to br-lan.

I've personally worked around this by disabling failsafe using
CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE=y and changing the switch0 config
to "option ports '0 1 2 3 4'". With failsafe enabled, the default
interfaces are brought up early regardless of what you have defined in
/etc/config/network, and I've found it doesn't clean up after itself
properly. That is unrelated to any of the RouterStation-specific
changes. With those two config changes, all of the MAC addresses are
correct - eth0, eth1, and br-lan.

The details:
In ar71xx, the MAC address is populated early in the board-specific .c
files such as arch/mips/ath79/prom.c and arch/mips/ath79/mach-ubnt.c.
Switching to DT means that most of the board-specific .c stuff is
replaced by .dts/.dtsi files, that are limited to the existing
functionality provided by drivers like 'mtd-mac-address' (from
drivers/of/of_net.c), which needs a *predefined flash offset at compile
time* in order to read the MAC address from the config partition.
However, the RedBoot partition parser is also needed to dynamically read
the partition table at boot (which changes every time a different
firmware is flashed) from the FIS section of flash. This leads to a
situation where you can either: use drivers/mtd/redboot.c to parse the
FIS table and probe the partitions at boot, or use the
'fixed-partitions' mechanism to define the offset of the RedBoot config
partition - but not both (at least not correctly).

Anyways, an earlier version of the patchset did behave similarly to
ar71xx with regards to MAC assignment during boot - but because it used
both the RedBoot parser AND a duplicate fixed partition in the same DT
flash node, multiple devs said it was incorrect, hence the move to doing
it in userland at first boot using fconfig.

You can apply this patch (untested) to current master if you want it to
behave more similarly to ar71xx (similarly because this only works if
the RedBoot config hasn't been touched - technically, the flash offset
of the base MAC address could change if rewritten/modified):

diff --git a/target/linux/ath79/base-files/etc/board.d/02_network 
b/target/linux/ath79/base-files/etc/board.d/02_network
index 56eb42f65c..f69e74500b 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -232,11 +232,6 @@ ath79_setup_macs()
                base_mac=$(mtd_get_mac_binary u-boot 130048)
                wan_mac=$(macaddr_add "$base_mac" 1)
                ;;
-       ubnt,routerstation|\
-       ubnt,routerstation-pro)
-               wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n 
ar7100_esa)
-               lan_mac=$(macaddr_add "$wan_mac" 1)
-               ;;
        wd,mynet-wifi-rangeextender)
                lan_mac=$(nvram get et0macaddr)
                ;;
diff --git a/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi 
b/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi
index 143a4b7e80..e5ac861ceb 100644
--- a/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi
+++ b/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi
@@ -50,10 +50,15 @@

 &eth0 {
        status = "okay";
+
+       mtd-mac-address = <&rbc 0x17>;
 };

 &eth1 {
        status = "okay";
+
+       mtd-mac-address = <&rbc 0x17>;
+       mtd-mac-address-increment = <1>;
 };

 &pcie0 {
@@ -72,6 +77,12 @@
                partitions {
                        compatible = "ecoscentric,redboot-fis-partitions";
                };
+
+               rbc: partition@fff000 {
+                       label = "RedBoot config";
+                       reg = <0x0fff000 0x0001000>;
+                       read-only;
+               };
        };
 };






--- End Message ---
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to