usb_direct: fix netmon script when bonding is enabled

This commit is contained in:
Alfonso Gamboa
2023-07-19 13:05:33 -07:00
parent 86b4f38429
commit ac34e561cc
3 changed files with 89 additions and 35 deletions

View File

@@ -57,28 +57,3 @@ wait_for_icamera() {
sleep 5
done
}
gateway_supervisor() {
last=0
last2=0
while [[ 1 ]]; do
ping -c1 -W 2 `/opt/wz_mini/bin/busybox ip route | awk '/default/ { print $3 }'` >& /dev/null
status=$?
if [[ $status == 1 ]]; then
echo "$1: $(date) Unable to reach default route via USB Direct Link..."
if [[ $last == 1 && $last2 == 1 ]]; then
echo "$1: $(date) USB Direct is Down, bring down usb0"
ifconfig usb0 down
status=0
fi
fi
last2=$last
last=$status
sleep 10
done
}

View File

@@ -61,7 +61,7 @@ bonding_setup() {
#Run the DHCP client, and bind mount our fake wpa_cli.sh to fool iCamera
ifconfig wlan0 up
pkill udhcpc
udhcpc -i wlan0 -x hostname:$CUSTOM_HOSTNAME -p /var/run/udhcpc.pid -b
udhcpc -i wlan0 -x hostname:$CUSTOM_HOSTNAME -p /var/run/udhcpc.pid -b -S
# If running with Interface Bonding enabled, kill any existing
# wpa_supplicant that might be running and spawn our own instead
@@ -78,8 +78,10 @@ bonding_setup() {
mount -o bind /opt/wz_mini/bin/wpa_cli.sh /bin/wpa_cli
fi
echo "Run network monitor for USB Direct"
/opt/wz_mini/usr/bin/netmon.sh &
if [[ "$ENABLE_USB_DIRECT" == "true" ]]; then
echo "Run network monitor for USB Direct"
/opt/wz_mini/usr/bin/netmon.sh &
fi
}