[openwrt/openwrt] base-files: fix wrong ucidef_set_network_device_mac network-device entry

LEDE Commits lede-commits at lists.infradead.org
Fri Oct 20 04:10:27 PDT 2023


ansuel pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/0da199f60c47a4b861562ffec3842535eb56a67b

commit 0da199f60c47a4b861562ffec3842535eb56a67b
Author: Michael 'ASAP' Weinrich <michael at a5ap.net>
AuthorDate: Thu Oct 5 19:39:58 2023 -0700

    base-files: fix wrong ucidef_set_network_device_mac network-device entry
    
    The ucidef_set_network_device_* functions in uci-defaults.sh disagree
    on whether to use "network-device" or "network_device" in board.json.
    With the additional caveat that jshn will translate hyphens (-) into
    underscores (_). This casues problems in netifd which expected
    "network_device" causing boards which depend on assigning MACs in
    board.json via uci-defaults.sh (or jshn in general) to fail.
    
    This commit addresses the issue by using network_device in
    uci-defaults.sh.
    
    The bug was uncovered in the forums here:
    https://forum.openwrt.org/t/support-for-rtl838x-based-managed-switches/57875/2596
    
    This was exposed by commit 4ebba8a05d09 ("realtek: add support for HPE
    1920-8g-poe+") where the board_config_load call from 03_gpio introduced
    the key normalization by jshn.
    
    Fixes: 9290539ca9c7 ("base-files: allow setting device and bridge macs")
    Tested-by: Stijn Segers <foss at volatilesystems.org>
    Signed-off-by: Michael 'ASAP' Weinrich <michael at a5ap.net>
    [ improve commit title, description and fix wrong Tested-by tag ]
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
    (cherry picked from commit 12bc79d6d521581e37a8b067ce8a562429aeefbd)
---
 package/base-files/files/lib/functions/uci-defaults.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index a37e8cf824..6f395ec24b 100644
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -107,7 +107,7 @@ ucidef_set_bridge_mac() {
 }
 
 ucidef_set_network_device_mac() {
-	json_select_object "network-device"
+	json_select_object "network_device"
 	json_select_object "${1}"
 	json_add_string macaddr "${2}"
 	json_select ..




More information about the lede-commits mailing list