summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Marangi2023-10-20 10:40:27 +0000
committerChristian Marangi2023-10-20 10:49:53 +0000
commit5590a80e2566d378be955f61c287a63fb3bdf329 (patch)
tree7128e2236343c23e9f0c0d1b9efd3f87f7b3abb5
parenteb69d3f1c45d5b955cd10c6dcb28fee3d7a60d8e (diff)
downloadnetifd-5590a80e2566d378be955f61c287a63fb3bdf329.tar.gz
config: fix incompatible with jshn network-device entry
On parsing jshn "normalize" the entry of any non alphanumeric char to '_'. This resulted in the secanrio where the data passed by board.json with entry 'network-device' being converted to 'network_device', and the system still expecting data with the original 'network-device'. To fix this, changes needs to be done in multiple place. Any function in core uci-defaults.sh that expect 'network-device' needs to be changed to 'network_device' and here in netifd core, we need to switch to use 'network_device' directly to prevent any conflict with jshn conversion. The issue was exposed by commit 4ebba8a05d09 ("realtek: add support for HPE 1920-8g-poe+") in openwrt core where board_config_load call from 03_gpio introduced the key normalization by jshn. board.json is not considered stable and is not migrated on sysupgrade but actually recreated with up to date data, hence no migration or special handling are needed and the entry can be directly changed. Ref: https://forum.openwrt.org/t/57875/2589 Ref: https://github.com/openwrt/openwrt/pull/13622 Reported-by: Michael 'ASAP' Weinrich <michael@a5ap.net> Fixes: 42c48866f1c1 ("config: parse default mac address from board.json") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-rw-r--r--config.c2
-rw-r--r--config/board.json2
2 files changed, 2 insertions, 2 deletions
diff --git a/config.c b/config.c
index dbf4425..b4724b5 100644
--- a/config.c
+++ b/config.c
@@ -732,7 +732,7 @@ config_init_board(void)
free(board_netdevs);
board_netdevs = NULL;
- cur = config_find_blobmsg_attr(b.head, "network-device",
+ cur = config_find_blobmsg_attr(b.head, "network_device",
BLOBMSG_TYPE_TABLE);
if (!cur)
return;
diff --git a/config/board.json b/config/board.json
index 112a511..96f2380 100644
--- a/config/board.json
+++ b/config/board.json
@@ -20,7 +20,7 @@
"macaddr": "be:a5:11:16:76:d7"
}
},
- "network-device": {
+ "network_device": {
"eth0": {
"macaddr": "bc:a5:11:16:76:d7"
},