isc-dhcp: use network_get_device in client scripts

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
This commit is contained in:
Philip Prindeville 2023-07-25 15:48:14 -06:00
parent 971d326768
commit 8a52c2b742
3 changed files with 26 additions and 26 deletions

View file

@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=isc-dhcp PKG_NAME:=isc-dhcp
UPSTREAM_NAME:=dhcp UPSTREAM_NAME:=dhcp
PKG_VERSION:=4.4.3-P1 PKG_VERSION:=4.4.3-P1
PKG_RELEASE:=3 PKG_RELEASE:=4
PKG_LICENSE:=BSD-3-Clause PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE PKG_LICENSE_FILES:=LICENSE

View file

@ -8,23 +8,23 @@ pid_file=/var/run/dhclient.pid
script_file=/usr/sbin/dhclient-script script_file=/usr/sbin/dhclient-script
start() { start() {
/usr/sbin/dhclient -q -nw -cf $config_file -lf $lease_file -pf $pid_file -sf $script_file `/sbin/uci get network.wan.ifname` local ifname
if [ $? -ne 0 ]; then . /lib/functions/network.sh
return 1
fi 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() { stop() {
if [ ! -e $pid_file ]; then [ -e $pid_file ] || return 1
return 1
fi
kill -9 `cat $pid_file` kill -9 $(cat $pid_file)
if [ $? -ne 0 ]; then [ $? -eq 0 ] || return 1
return 1
fi
rm $pid_file rm $pid_file
} }

View file

@ -8,23 +8,23 @@ pid_file=/var/run/dhclient6.pid
script_file=/usr/sbin/dhclient-script script_file=/usr/sbin/dhclient-script
start() { 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` local ifname
if [ $? -ne 0 ]; then . /lib/functions/network.sh
return 1
fi 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() { stop() {
if [ ! -e $pid_file ]; then [ -e $pid_file ] || return 1
return 1
fi
kill -9 `cat $pid_file` kill -9 $(cat $pid_file)
[ $? -eq 0 ] || return 1
if [ $? -ne 0 ]; then
return 1
fi
rm $pid_file rm $pid_file
} }