[RFC 2/6] base-files: preinit: add altname config function
Evan Jobling
evan.jobling at mslsc.com.au
Wed Oct 9 01:07:25 PDT 2024
Add helper function for setting altname in preinit.
Note that using this function would require an image
to have ip-full (under network, routing and redirection)
in the make config.
Signed-off-by: Evan Jobling <evan.jobling at mslsc.com.au>
---
.../files/lib/preinit/10_indicate_preinit | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/package/base-files/files/lib/preinit/10_indicate_preinit b/package/base-files/files/lib/preinit/10_indicate_preinit
index a8f7758c84..f1b970e400 100644
--- a/package/base-files/files/lib/preinit/10_indicate_preinit
+++ b/package/base-files/files/lib/preinit/10_indicate_preinit
@@ -63,6 +63,19 @@ preinit_config_switch() {
json_select ..
}
+preinit_config_altname() {
+ local original
+
+ local netdev="$1"
+ local altname="$2"
+
+ [ -d "/sys/class/net/$altname" ] && return
+
+ [ "$netdev" = "$altname" ] && return
+
+ ip link set "$original" altname "$netdev"
+}
+
preinit_config_port() {
local original
--
2.39.5
More information about the openwrt-devel
mailing list