Re: [OpenWrt-Devel] Mac address randomization on rsPro ath79
On Sun, 28 Oct 2018 at 03:09, matt merhar wrote: > > ‐‐‐ Original Message ‐‐‐ > On Sunday, October 28, 2018 12:40 AM, Weedy wrote: > > > On Sat, 27 Oct 2018 at 22:46, matt merhar mattmer...@protonmail.com wrote: > > > > > Hi, > > > > Hello, I replied to you on IRC but like 2 days later :V > > Yeah, I figured it would be better to get the reply on the ML anyhow, as it > might help others. > > > > 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.) > > > > I use $topdir/flies/ > > This is probably causing the issue. If you're building a pre-made > $topdir/files/etc/config/network into the image, I don't believe it will > overwrite that existing /etc/config/network file on first boot. If you > want to continue doing things this way then you'll need to add the > 'macaddr' options to your $topdir config, or alternatively try using the > patch I provided. I suppose you could also add something like an init > script to update the config file (e.g. with "uci set") on boot instead. When I upgraded my tplink4300 the wifi code added another block to my $topdir customized config for the 2.4ghz radio, the pci path had changed. Shouldn't the boot code check for unset macaddr and uci commit like the wifi code does? > If you check /etc/board.json it should still contain the autogenerated > config similar to: > > ... > "network": { > "wan": { > "ifname": "eth0", > "protocol": "dhcp", > "macaddr": "00:15:6d:aa:bb:cc" > }, > "lan": { > "ifname": "eth1.1", > "protocol": "static", > "macaddr": "00:15:6d:aa:bb:cd" > } > }, > ... > > ...as long as you're not pre-populating that file in $topdir/files as > well. If the MACs there are correct then things are working as intended. This is all fine and my macs are also 00:15:6d:aa:bb:cc, so I just copied them over to my $topdir/. From my end the problem is solved, thanks for your time. > > > 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 > > > > Now this is interesting because I use defconfig. I don't mind adding > > fconfig to my scripts, but then why isn't defconfig picking that up? > > > > buildImage () { > > make V=99 defconfig && \ > > nice -n 7 make V=1 -j4 || exit 1 > > } > > cat configs/rsPRO-home-repeater.config > .config > > > > buildImage > > scp > > bin/targets/ath79/generic/openwrt-ath79-generic-ubnt_routerstation-pro-squashfs-sysupgrade.bin > > > > > > r...@repeater.lan:/tmp/ > > > > $ cat configs/rsPRO-home-repeater.config > > CONFIG_TARGET_ath79=y > > CONFIG_TARGET_ath79_generic=y > > CONFIG_TARGET_ath79_generic_DEVICE_ubnt_routerstation-pro=y > > CONFIG_PACKAGE_wpad=y > > CONFIG_PACKAGE_wpad-mini=n > > CONFIG_ATH_USER_REGD=y > > CONFIG_PACKAGE_ATH_DFS=y > > CONFIG_PACKAGE_ATH_DYNACK=y > > CONFIG_PACKAGE_kmod-ath9k=y > > CONFIG_ATH9K_SUPPORT_PCOEM=y > > CONFIG_ATH9K_UBNTHSR=n > > I tested this (to the point of running "make defconfig" anyways) and the > following *are* properly selected in .config using the contents of your > configs/rsPRO-home-repeater.config: > > CONFIG_DEFAULT_fconfig=y > CONFIG_PACKAGE_fconfig=y > > It lives at /usr/sbin/fconfig on the router. I didn't bother to check this, I was assuming that lacking this util caused my random macs. You are right it's there. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Mac address randomization on rsPro ath79
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 --- ‐‐‐ Original Message ‐‐‐ On Sunday, October 28, 2018 12:40 AM, Weedy wrote: > On Sat, 27 Oct 2018 at 22:46, matt merhar mattmer...@protonmail.com wrote: > > > Hi, > > Hello, I replied to you on IRC but like 2 days later :V > Yeah, I figured it would be better to get the reply on the ML anyhow, as it might help others. > > 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.) > > I use $topdir/flies/ This is probably causing the issue. If you're building a pre-made $topdir/files/etc/config/network into the image, I don't believe it will overwrite that existing /etc/config/network file on first boot. If you want to continue doing things this way then you'll need to add the 'macaddr' options to your $topdir config, or alternatively try using the patch I provided. I suppose you could also add something like an init script to update the config file (e.g. with "uci set") on boot instead. If you check /etc/board.json it should still contain the autogenerated config similar to: ... "network": { "wan": { "ifname": "eth0", "protocol": "dhcp", "macaddr": "00:15:6d:aa:bb:cc" }, "lan": { "ifname": "eth1.1", "protocol": "static", "macaddr": "00:15:6d:aa:bb:cd" } }, ... ...as long as you're not pre-populating that file in $topdir/files as well. If the MACs there are correct then things are working as intended. > > > 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 > > Now this is interesting because I use defconfig. I don't mind adding > fconfig to my scripts, but then why isn't defconfig picking that up? > > buildImage () { > make V=99 defconfig && \ > nice -n 7 make V=1 -j4 || exit 1 > } > cat configs/rsPRO-home-repeater.config > .config > > buildImage > scp > bin/targets/ath79/generic/openwrt-ath79-generic-ubnt_routerstation-pro-squashfs-sysupgrade.bin > > > r...@repeater.lan:/tmp/ > > $ cat configs/rsPRO-home-repeater.config > CONFIG_TARGET_ath79=y > CONFIG_TARGET_ath79_generic=y > CONFIG_TARGET_ath79_generic_DEVICE_ubnt_routerstation-pro=y > CONFIG_PACKAGE_wpad=y > CONFIG_PACKAGE_wpad-mini=n > CONFIG_ATH_USER_REGD=y > CONFIG_PACKAGE_ATH_DFS=y > CONFIG_PACKAGE_ATH_DYNACK=y > CONFIG_PACKAGE_kmod-ath9k=y > CONFIG_ATH9K_SUPPORT_PCOEM=y > CONFIG_ATH9K_UBNTHSR=n I tested this (to the point of running "make defconfig" anyways) and the following *are* properly selected in .config using the contents of your configs/rsPRO-home-repeater.config: CONFIG_DEFAULT_fconfig=y CONFIG_PACKAGE_fconfig=y It lives at /usr/sbin/fconfig on the router. --- End Message --- ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Mac address randomization on rsPro ath79
On Sat, 27 Oct 2018 at 22:46, matt merhar wrote: > > Hi, Hello, I replied to you on IRC but like 2 days later :V > 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.) I use $topdir/flies/ > 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 Now this is interesting because I use defconfig. I don't mind adding fconfig to my scripts, but then why isn't defconfig picking that up? buildImage () { make V=99 defconfig && \ nice -n 7 make V=1 -j4 || exit 1 } cat configs/rsPRO-home-repeater.config > .config buildImage scp bin/targets/ath79/generic/openwrt-ath79-generic-ubnt_routerstation-pro-squashfs-sysupgrade.bin r...@repeater.lan:/tmp/ $ cat configs/rsPRO-home-repeater.config CONFIG_TARGET_ath79=y CONFIG_TARGET_ath79_generic=y CONFIG_TARGET_ath79_generic_DEVICE_ubnt_routerstation-pro=y CONFIG_PACKAGE_wpad=y CONFIG_PACKAGE_wpad-mini=n CONFIG_ATH_USER_REGD=y CONFIG_PACKAGE_ATH_DFS=y CONFIG_PACKAGE_ATH_DYNACK=y CONFIG_PACKAGE_kmod-ath9k=y CONFIG_ATH9K_SUPPORT_PCOEM=y CONFIG_ATH9K_UBNTHSR=n ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Mac address randomization on rsPro ath79
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 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
[OpenWrt-Devel] Mac address randomization on rsPro ath79
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 protodhcp option hostname 'repeater' option ipv6 0 config interface lanAlias option ifname br-lan option protostatic option ipaddr 192.168.69.1 option netmask 255.255.255.0 config interface lanEmerg option ifname eth0 option protostatic option ipaddr 192.168.42.1 option netmask 255.255.255.0 root@repeater:~# ifconfig br-lanLink 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-lanLink 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 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel