[PATCH 2/5] base-files: ucidef netdev altname, label and alias

Evan Jobling evan.jobling at mslsc.com.au
Tue Oct 15 03:13:10 PDT 2024


In addition to path, conduit and gro options.

Allow for setting options for more network device
configuration in preinit.

Adding in preparation for more configuration in
preinit.

A second label pass is required, in case of
conflicts with the path variable and the
network interface doesn't have a .ethernet handle.
For example DSA devices where their label conflicts
with the desired port name.

An altname pass (requiring ip-full) could mitigate
issues when migrating configurations if one wishes
to rename devices in preinit.

A device specific example:

For example in the Firebox M300
default interface names are eth0-eth7
with eth3-eth7 being ports on a dsa switch.
eth3 and eth4 start out as being the conduit
interfaces.

The old names for the devices would be
sweth3 through sweth7. One could set
the altname property to keep existing
configurations working. Or the alias
to keep the names coming up in ip-link
whilst not being able to up/down
the interface with that handle.

Signed-off-by: Evan Jobling <evan.jobling at mslsc.com.au>
---
 .../base-files/files/lib/functions/uci-defaults.sh   | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index 8355099c35..7997e49d83 100644
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -122,6 +122,18 @@ ucidef_set_network_device_path() {
 	_ucidef_set_network_device_common $1 path $2
 }
 
+ucidef_set_network_device_label() {
+	_ucidef_set_network_device_common $1 label $2
+}
+
+ucidef_set_network_device_altname() {
+	_ucidef_set_network_device_common $1 altname $2
+}
+
+ucidef_set_network_device_alias() {
+	_ucidef_set_network_device_common $1 alias $2
+}
+
 ucidef_set_network_device_gro() {
 	_ucidef_set_network_device_common $1 gro $2
 }
-- 
2.39.5




More information about the openwrt-devel mailing list