bsbf-autoconf-cellular: set device option for network
authorChester A. Unal <redacted>
Thu, 5 Mar 2026 16:54:20 +0000 (18:54 +0200)
committerChester A. Unal <redacted>
Sat, 7 Mar 2026 10:07:15 +0000 (12:07 +0200)
Set the device option for the network. This is solely for the ease of
matching the network to the corresponding network interface.

Signed-off-by: Chester A. Unal <redacted>
net/bsbf-openwrt-resources/Makefile
net/bsbf-openwrt-resources/files/etc/hotplug.d/net/99-bsbf-autoconf-cellular

index a9f8e7df9f0a38af2947c14cf0be664da2ffe821..b1b182035864181f2ec4ae0b4384da52819f6720 100644 (file)
@@ -4,7 +4,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=bsbf-openwrt-resources
-PKG_VERSION:=1
+PKG_VERSION:=2
 
 PKG_LICENSE:=AGPL-3.0-or-later
 PKG_MAINTAINER:=Chester A. Unal <chester.a.unal@arinc9.com>
index 76f9b61613a28648a9c8ac139f129f6326ad564a..da3778302516908b23f62d75dc5118190e92339e 100644 (file)
@@ -14,11 +14,22 @@ else
        devpath=/sys"${DEVPATH%/*/*/*/*}"
 fi
 
-# If a network with the device path already exists, set control model to the
-# current detected one and exit.
 uci_network=$(uci show network)
+
+# Delete the interface name if it's already set somewhere.
+device_section=$(echo "$uci_network" | grep ".device='$DEVICENAME'" | cut -d. -f2)
+if [ -n "$device_section" ]; then
+       uci delete network.$device_section.device
+       uci commit network
+fi
+
+# If a network with the device path already exists, set the interface name and
+# control model to the current detected one, bring up the network, and exit.
+# Setting the interface name is solely for the ease of matching the network to
+# the corresponding interface.
 section=$(echo "$uci_network" | grep ".devpath='$devpath'" | cut -d. -f2)
 if [ -n "$section" ]; then
+       uci set network.$section.device="$DEVICENAME"
        uci set network.$section.proto="$cur_proto"
        uci commit network
        ifup $section
@@ -44,6 +55,7 @@ while echo "$uci_network" | grep -q "wwan$index"; do
 done
 
 uci set network.wwan$index=interface
+uci set network.wwan$index.device="$DEVICENAME"
 uci set network.wwan$index.devpath="$devpath"
 uci set network.wwan$index.proto="$cur_proto"
 uci set network.wwan$index.apn='internet'
git clone https://git.99rst.org/PROJECT