diff --git a/net/bsbf-openwrt-resources/Makefile b/net/bsbf-openwrt-resources/Makefile index b1b1820358..86b87d0a90 100644 --- a/net/bsbf-openwrt-resources/Makefile +++ b/net/bsbf-openwrt-resources/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bsbf-openwrt-resources -PKG_VERSION:=2 +PKG_VERSION:=3 PKG_LICENSE:=AGPL-3.0-or-later PKG_MAINTAINER:=Chester A. Unal diff --git a/net/bsbf-openwrt-resources/files/etc/hotplug.d/net/99-bsbf-autoconf-dhcp b/net/bsbf-openwrt-resources/files/etc/hotplug.d/net/99-bsbf-autoconf-dhcp index 2362fc2c09..4b4c27d0a2 100644 --- a/net/bsbf-openwrt-resources/files/etc/hotplug.d/net/99-bsbf-autoconf-dhcp +++ b/net/bsbf-openwrt-resources/files/etc/hotplug.d/net/99-bsbf-autoconf-dhcp @@ -8,11 +8,11 @@ # Exclude MBIM and QMI network interfaces which a DHCP client wouldn't work on. grep -E "(mbim|qmi)" /sys"${DEVPATH%/*/*}/uevent" && exit -# Exit if a network with the network interface already exists. -uci_network=$(uci show network) -echo "$uci_network" | grep -q ".device='$DEVICENAME'" && exit +# If a network with the same name already exists, exit. +uci get network.wan_"$DEVICENAME" && exit # Decide on the metric value. Start from 1 and work up to 8. +uci_network=$(uci show network) metric=1 while [ $metric -le 8 ]; do # Break if this metric isn't in use. @@ -24,16 +24,10 @@ done # If there are no available metrics, exit with code 1. [ "$metric" -gt 8 ] && exit 1 -# Decide on the network name. Start from wan1. -index=1 -while echo "$uci_network" | grep -q "wan$index"; do - index=$((index + 1)) -done - -uci set network.wan$index=interface -uci set network.wan$index.device="$DEVICENAME" -uci set network.wan$index.proto='dhcp' -uci set network.wan$index.peerdns='0' -uci set network.wan$index.metric="$metric" +uci set network.wan_"$DEVICENAME"=interface +uci set network.wan_"$DEVICENAME".device="$DEVICENAME" +uci set network.wan_"$DEVICENAME".proto='dhcp' +uci set network.wan_"$DEVICENAME".peerdns='0' +uci set network.wan_"$DEVICENAME".metric="$metric" uci commit network -ifup wan$index +ifup wan_"$DEVICENAME"