From patchwork Mon Apr 12 12:27:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Bj=C3=B8rn_Mork?= X-Patchwork-Id: 1465229 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=HiIlNG6u; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=mork.no header.i=@mork.no header.a=rsa-sha256 header.s=b header.b=kHgtfDVY; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FJp2z5Y5vz9ssP for ; Mon, 12 Apr 2021 22:29:47 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7VK67/qVEwA88hXsjKjSeOfcX+C1mUS7wfvde9Ii0tc=; b=HiIlNG6uVGV/koRqDW+gCBLTc BJyh6ISqnrhfQqZnOuHpk68pqMAWztqjzFDOnk8WNpaUaooNWjwdlAVdPQt6hiFT6NQI8CEVNiHJJ 6tx7dL1A/GmZl/olGDphj1TYDPuSKLoDuCOD8SkYLUAEtO7p2GbfU47ylWtQa/KmvS7LyNyE8VZBW G9Y7C7sQMlWfXzgcawgFpEeSZcp8LHElqCBvSts0uyF+zV5XV6Rs0BBROkN3QlcOEkroXiEIko52m GLXcgrzWoUUVwPkiT02OzkdvkBjmTIeZMs6iVbp+03asE5RS7vAr5ZRtHcTNvw2xWGnoKRhwyLdy4 /r1V+OmVw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVvfl-006gbR-RT; Mon, 12 Apr 2021 12:28:10 +0000 Received: from canardo.mork.no ([2001:4641::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvfB-006gS6-AT for openwrt-devel@lists.openwrt.org; Mon, 12 Apr 2021 12:27:37 +0000 Received: from canardo.mork.no (ip6-localhost [IPv6:0:0:0:0:0:0:0:1]) by canardo.mork.no (8.15.2/8.15.2) with ESMTPS id 13CCRSTb029489 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 14:27:29 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mork.no; s=b; t=1618230449; bh=bZh+RQMqS+IfiJJVAHE6qa/rs62Yj5gXc2c4+RByeJQ=; h=From:To:Cc:Subject:Date:Message-Id:References:From; b=kHgtfDVYJS7z+lD+1AKtTx09gLiusrKk7ih4F/DZ6DkAaPkUkAFaPNmh7PwkZU6dW PfrrpoJOVPo0Ou6vGvaVz0h7kRWXHbn1ISwz+26vQMuMCqiXBWNZyt6mofVNO6zP9X 2xP4uYJrBfmzlNYORB0jjiZSqaU8+k/Zwy9heIgU= Received: (from bjorn@localhost) by canardo.mork.no (8.15.2/8.15.2/Submit) id 13CCRSeT029483; Mon, 12 Apr 2021 14:27:28 +0200 From: =?utf-8?q?Bj=C3=B8rn_Mork?= To: openwrt-devel@lists.openwrt.org Cc: =?utf-8?q?Bj=C3=B8rn_Mork?= , John Crispin Subject: [PATCH 1/3] realtek: revert to "standard" management configuration Date: Mon, 12 Apr 2021 14:27:23 +0200 Message-Id: <20210412122725.29430-2-bjorn@mork.no> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210412122725.29430-1-bjorn@mork.no> References: <20210412122725.29430-1-bjorn@mork.no> MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on canardo.mork.no X-Virus-Scanned: clamav-milter 0.102.4 at canardo X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_132733_738844_8F3E7E4C X-CRM114-Status: GOOD ( 14.22 ) X-Spam-Score: -2.5 (--) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The default management interface should be easy to find for users doing "blind" installations without console access. There are already multiple examples in the forum of advanced early adopters having [...] Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2001:4641:0:0:0:0:0:1 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The default management interface should be easy to find for users doing "blind" installations without console access. There are already multiple examples in the forum of advanced early adopters having problems locating the management interface after installing OpenWrt. Requiring tagged VLAN configration to access the initial management interface creates unnecessary hassle at best. Errors on the other end are close to impossible to debug without console access, even for advanced users. Less advanced users might have problems with the concept of VLAN tagging. Limiting management access to a single arbitrary port among up to 52 possible LAN ports makes this even more difficult, for no reason at all. Users might have reasons to use a different port for management. And they might even have difficulties using the OpenWrt selected one. The port might be the wrong type for their management link (e.g copper instead of fibre). Or they might depend on PoE power from a device which they can't reconfigure. User expectations will be based on - OpenWrt defaults for other devices - stock firmware default for the device in question - common default behaviour of similar devices All 3 cases point to a static IP address accessible on the native VLAN of any LAN port. A switch does not have any WAN port. All ports are LAN ports. This changes the default network configuration in line with these expectations. Cc: John Crispin Signed-off-by: Bjørn Mork Acked-by: Hauke Mehrtens --- .../realtek/base-files/etc/board.d/02_network | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index 1e199db5897f..44f1f0a7a5c1 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -22,27 +22,23 @@ for lan in /sys/class/net/lan*; do lan_list="$lan_list $(basename $lan)" done ucidef_set_bridge_device switch -ucidef_set_interface_wan "$lan_list" -ucidef_set_interface "lan" ifname "lan1:t" protocol "static" vlan 100 +ucidef_set_interface_lan "$lan_list" lan_mac="" -wan_mac="" label_mac="" case $board in *) - wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) + lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) label_mac=$lan_mac ;; esac -lan_mac=$(macaddr_setbit_la $wan_mac) - ucidef_set_interface_macaddr "lan" $lan_mac -ucidef_set_interface_macaddr "wan" $wan_mac -ucidef_set_bridge_mac "$wan_mac" -ucidef_set_network_device_mac eth0 $wan_mac +ucidef_set_bridge_mac "$lan_mac" +ucidef_set_network_device_mac eth0 $lan_mac for lan in $lan_list; do ucidef_set_network_device_mac $lan $lan_mac + lan_mac=$(macaddr_setbit_la $lan_mac) lan_mac=$(macaddr_add $lan_mac 1) done [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac From patchwork Mon Apr 12 12:27:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Bj=C3=B8rn_Mork?= X-Patchwork-Id: 1465228 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=pNJ3c1iO; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=mork.no header.i=@mork.no header.a=rsa-sha256 header.s=b header.b=gNgCLWZK; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FJp2w48kqz9sjB for ; Mon, 12 Apr 2021 22:29:44 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=s1NaFT4/CXV5oProIrux1BhCsn93ZVu8llat4iIgBAI=; b=pNJ3c1iO9uqg5zZh+2tZXsAqN fH+K5m6FNK2S1knjCYe76qzoANwt5r37lyaFg8uM/eStu9ILkSnAV2hnaUj1k6TBSl2t4NpxiDtQS /1UH54UJxTX8bWejMckcTU/u2RJxfM7MonLzQO1GS3EkP41MuV9BhWpGx/ZzjXq+vQK+XnsEvlpYw lC8jXNHHtUtMFhI4pFXYneIUUYYjM02kladSEV0VtM9PiKZwaRpVSE6IfzifVHJn9wNjbQx1dWbIa T3wkRwFLUKLvhA9bsaizziqhpwy4HNgnS/wKI3D59A1HvhDUp/ltaqwhlyZv7bH8yHPiBmlVZAgCy vEnJCYlZA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVvfa-006gZ9-6e; Mon, 12 Apr 2021 12:27:58 +0000 Received: from canardo.mork.no ([2001:4641::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvfB-006gS8-CO for openwrt-devel@lists.openwrt.org; Mon, 12 Apr 2021 12:27:36 +0000 Received: from canardo.mork.no (ip6-localhost [IPv6:0:0:0:0:0:0:0:1]) by canardo.mork.no (8.15.2/8.15.2) with ESMTPS id 13CCRT9q029504 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 14:27:29 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mork.no; s=b; t=1618230449; bh=yV4WeNbRzhiho4R+dpDM2xY7u8cMrLU2BoMvoF8yVnY=; h=From:To:Cc:Subject:Date:Message-Id:References:From; b=gNgCLWZK3MaXygVQ3AQj6gpMV0rR3ID6yLbViBZkZXAEw97ZkLbdGtPK2a/gIfCvr XGGSNSRgKvkn7nnhPo0d60LvqqCi7kFXRdEieszABm7wgJR6sJ1mYqsVCtY6uXc8tC bQnoH+J5maiW0H5n4meRUIOW5RJz66tvGk1BHP8k= Received: (from bjorn@localhost) by canardo.mork.no (8.15.2/8.15.2/Submit) id 13CCRTV3029495; Mon, 12 Apr 2021 14:27:29 +0200 From: =?utf-8?q?Bj=C3=B8rn_Mork?= To: openwrt-devel@lists.openwrt.org Cc: =?utf-8?q?Bj=C3=B8rn_Mork?= Subject: [PATCH 2/3] realtek: sort the port list numerically Date: Mon, 12 Apr 2021 14:27:24 +0200 Message-Id: <20210412122725.29430-3-bjorn@mork.no> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210412122725.29430-1-bjorn@mork.no> References: <20210412122725.29430-1-bjorn@mork.no> MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on canardo.mork.no X-Virus-Scanned: clamav-milter 0.102.4 at canardo X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_132733_738219_6A29EECD X-CRM114-Status: UNSURE ( 9.09 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Mac adresses are assigned in the order given by the port list. The interfaces are also brought up in this order. This target supports devices with up to 52 ports. Sorting these alphabetically is very [...] Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2001:4641:0:0:0:0:0:1 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Mac adresses are assigned in the order given by the port list. The interfaces are also brought up in this order. This target supports devices with up to 52 ports. Sorting these alphabetically is very confusing, and assigning mac addresses in alphabetic order does not match stock firmware behaviour. There are probably better ways to do the numrical sorting, but this was what I came up with... Signed-off-by: Bjørn Mork --- target/linux/realtek/base-files/etc/board.d/02_network | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index 44f1f0a7a5c1..06293174b0df 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -17,10 +17,7 @@ ucidef_set_poe() { board=$(board_name) board_config_update -lan_list="" -for lan in /sys/class/net/lan*; do - lan_list="$lan_list $(basename $lan)" -done +lan_list=$(for lan in /sys/class/net/lan*; do echo "${lan#/sys/class/net/lan}"; done|sort -n|sed -e 's/^/lan/'|xargs) ucidef_set_bridge_device switch ucidef_set_interface_lan "$lan_list" From patchwork Mon Apr 12 12:27:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Bj=C3=B8rn_Mork?= X-Patchwork-Id: 1465226 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=IQCNIw9i; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=mork.no header.i=@mork.no header.a=rsa-sha256 header.s=b header.b=dPKe4Fnp; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FJp2v1dBRz9sXM for ; Mon, 12 Apr 2021 22:29:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VL6S1+xV8OkONXNkIJlfyIyJCVafKtwwhPQ2jkD+T4Y=; b=IQCNIw9iwQyvowoxUTAkTc8pK kHO1Ncz/LptIV4JAa3fD9i5JEb24f2YFWFxkQTzUSBeOGOJ8WAdDBUrioYOMXRYHVaD/p4WzT01Gx mfk0pKXsfTpCM+2OVHnOlg+C92T2xIuiIiqL0sx7OnZdAch0bmrbROu6t0U0DnlRFO5u8+LwiHsuG vI6CP764y2OQAWk0ZW1qCsN+lZSB77kIT0AroCoAIdktgCTKV7r903NWZs6UbtpNATsentrXtyZ0W Fu79fo34u1icdDIIUDaDeBPUl6pxQIrgbBJekas4a6JIsSuhg+Uv1d4iMlYZvmZG/s0pJEx3oZkyH lpddIij9A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVvfO-006gWT-9u; Mon, 12 Apr 2021 12:27:46 +0000 Received: from canardo.mork.no ([2001:4641::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvfB-006gSB-DV for openwrt-devel@lists.openwrt.org; Mon, 12 Apr 2021 12:27:35 +0000 Received: from canardo.mork.no (ip6-localhost [IPv6:0:0:0:0:0:0:0:1]) by canardo.mork.no (8.15.2/8.15.2) with ESMTPS id 13CCRTSs029525 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 14:27:29 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mork.no; s=b; t=1618230450; bh=WR9HvqXXM9ZFnX9Fw4CZH+pvfz0TENgGrMH7D9PGNWI=; h=From:To:Cc:Subject:Date:Message-Id:References:From; b=dPKe4Fnpsp2qXnzu7CNrdpTRZZtW5U4Wt003BHXvqcPHXtIGUNuPZhNbFWqJTbOQP nlZZgj8Oq3OWDG4yLHhPh+pMfQUo2FyQzIZdgn/AqTKfHUecis03oaOJAw+Iu3FV72 3xD3wv7ZYFyxHpo54Tvgczl0fyjxxmMzXYnsepMo= Received: (from bjorn@localhost) by canardo.mork.no (8.15.2/8.15.2/Submit) id 13CCRTCZ029507; Mon, 12 Apr 2021 14:27:29 +0200 From: =?utf-8?q?Bj=C3=B8rn_Mork?= To: openwrt-devel@lists.openwrt.org Cc: =?utf-8?q?Bj=C3=B8rn_Mork?= Subject: [PATCH 3/3] realtek: use full range of assigned MAC addresses Date: Mon, 12 Apr 2021 14:27:25 +0200 Message-Id: <20210412122725.29430-4-bjorn@mork.no> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210412122725.29430-1-bjorn@mork.no> References: <20210412122725.29430-1-bjorn@mork.no> MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on canardo.mork.no X-Virus-Scanned: clamav-milter 0.102.4 at canardo X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_132733_732389_468406B7 X-CRM114-Status: UNSURE ( 8.49 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Some devices are assigned globally unique MAC addresses for all ports. These are stored by U-Boot in the second U-Boot enviroment ("sysinfo") as a range of start and end address. Use the full range if provided. Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2001:4641:0:0:0:0:0:1 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Some devices are assigned globally unique MAC addresses for all ports. These are stored by U-Boot in the second U-Boot enviroment ("sysinfo") as a range of start and end address. Use the full range if provided. Signed-off-by: Bjørn Mork --- target/linux/realtek/base-files/etc/board.d/02_network | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index 06293174b0df..f4daeed93d86 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -22,11 +22,14 @@ ucidef_set_bridge_device switch ucidef_set_interface_lan "$lan_list" lan_mac="" +lan_mac_end="" label_mac="" case $board in *) - lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) - label_mac=$lan_mac + lan_mac=$(mtd_get_mac_ascii u-boot-env2 mac_start) + lan_mac_end=$(mtd_get_mac_ascii u-boot-env2 mac_end) + label_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) + [ -z "$lan_mac" ] && lan_mac=$label_mac ;; esac @@ -35,7 +38,7 @@ ucidef_set_bridge_mac "$lan_mac" ucidef_set_network_device_mac eth0 $lan_mac for lan in $lan_list; do ucidef_set_network_device_mac $lan $lan_mac - lan_mac=$(macaddr_setbit_la $lan_mac) + [ -z "$lan_mac_end" ] || [ "$lan_mac" == "$lan_mac_end" ] && lan_mac=$(macaddr_setbit_la $lan_mac) lan_mac=$(macaddr_add $lan_mac 1) done [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac