isc-dhcp: use network_get_device in client scripts
authorPhilip Prindeville <philipp@redfish-solutions.com>
Tue, 25 Jul 2023 21:48:14 +0000 (15:48 -0600)
committerPhilip Prindeville <philipp@redfish-solutions.com>
Tue, 25 Jul 2023 21:55:14 +0000 (15:55 -0600)
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
net/isc-dhcp/Makefile
net/isc-dhcp/files/dhclient.init
net/isc-dhcp/files/dhclient6.init

index d35609e388fbde90ef01696d860b23de4557b691..906cae673790bff7de85a21425e924eef15aba12 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=isc-dhcp
 UPSTREAM_NAME:=dhcp
 PKG_VERSION:=4.4.3-P1
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=LICENSE
index b5ffb411d02f2bbc7c3cc8eee0ba9f60057cdbce..543cdf8cdbf02a274eb95ca758d9323111eca051 100644 (file)
@@ -8,23 +8,23 @@ pid_file=/var/run/dhclient.pid
 script_file=/usr/sbin/dhclient-script
 
 start() {
-       /usr/sbin/dhclient -q -nw -cf $config_file -lf $lease_file -pf $pid_file -sf $script_file `/sbin/uci get network.wan.ifname`
-       
-       if [ $? -ne 0 ]; then
-               return 1
-       fi
+       local ifname
+
+       . /lib/functions/network.sh
+
+       network_get_device ifname "wan" || return 1
+
+       /usr/sbin/dhclient -q -nw -cf $config_file -lf $lease_file -pf $pid_file -sf $script_file $ifname
+
+       [ $? -eq 0 ] || return 1
 }
 
 stop() {
-       if [ ! -e $pid_file ]; then
-               return 1
-       fi
+       [ -e $pid_file ] || return 1
 
-       kill -9 `cat $pid_file`
+       kill -9 $(cat $pid_file)
 
-       if [ $? -ne 0 ]; then
-               return 1
-       fi
+       [ $? -eq 0 ] || return 1
 
        rm $pid_file
 }
index 630c3f25f1ae1913b3ff6dece514aef805d9e61e..dd1a095b1e214052d39ea4354022f1785a5c0174 100644 (file)
@@ -8,23 +8,23 @@ pid_file=/var/run/dhclient6.pid
 script_file=/usr/sbin/dhclient-script
 
 start() {
-       /usr/sbin/dhclient -q -nw -6 -cf $config_file -lf $lease_file -pf $pid_file -sf $script_file `/sbin/uci get network.wan.ifname`
-       
-       if [ $? -ne 0 ]; then
-               return 1
-       fi
+       local ifname
+
+       . /lib/functions/network.sh
+
+       network_get_device ifname "wan" || return 1
+
+       /usr/sbin/dhclient -q -nw -6 -cf $config_file -lf $lease_file -pf $pid_file -sf $script_file $ifname
+
+       [ $? -eq 0 ] || return 1
 }
 
 stop() {
-       if [ ! -e $pid_file ]; then
-               return 1
-       fi
+       [ -e $pid_file ] || return 1
+
+       kill -9 $(cat $pid_file)
 
-       kill -9 `cat $pid_file`
+       [ $? -eq 0 ] || return 1
 
-       if [ $? -ne 0 ]; then
-               return 1
-       fi
-       
        rm $pid_file
 }