From d738640e6f4df63196ef5019e6295c75e915835f Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Tue, 4 Nov 2025 02:01:38 -0800 Subject: [PATCH] Improved Log Messages - Suppressed some syslog messages under specific conditions. - Improved checking of Guest Networks. --- README.md | 4 ++-- YazDHCP.sh | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 29a5035..aceb422 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # YazDHCP -## v1.2.2 +## v1.2.3 -### Updated on 2025-Nov-02 +### Updated on 2025-Nov-04 ## About diff --git a/YazDHCP.sh b/YazDHCP.sh index 3ff6e2b..0a2f46d 100644 --- a/YazDHCP.sh +++ b/YazDHCP.sh @@ -13,7 +13,7 @@ ## Forked from https://github.com/jackyaz/YazDHCP ## ## ## ########################################################## -# Last Modified: 2025-Nov-02 +# Last Modified: 2025-Nov-04 #--------------------------------------------------------- ############################################# @@ -29,8 +29,8 @@ ### Start of script variables ### readonly SCRIPT_NAME="YazDHCP" -readonly SCRIPT_VERSION="v1.2.2" -readonly SCRIPT_VERSTAG="25110223" +readonly SCRIPT_VERSION="v1.2.3" +readonly SCRIPT_VERSTAG="25110400" SCRIPT_BRANCH="develop" SCRIPT_REPO="https://raw.githubusercontent.com/AMTM-OSR/$SCRIPT_NAME/$SCRIPT_BRANCH" readonly SCRIPT_DIR="/jffs/addons/$SCRIPT_NAME.d" @@ -193,7 +193,10 @@ readonly ListIconsOpt="ls" iconsFound=false backupsFound=false waitToConfirm=false +wifiRestarted=false inStartupMode=false +gnCheckAttemptNum=0 +isInteractiveMenuMode=false maxUserIconsBackupFiles="$defMaxUserIconsBackupFiles" theUserIconsBackupDir="$defUserIconsBackupDir" prefUserIconsBackupDir="$theUserIconsBackupDir" @@ -1054,6 +1057,7 @@ _CheckForWirelessRadioEnabled_() done "$wifiRadioEnabled" && return 0 + ! "$isInteractiveMenuMode" && \ Print_Output true "Wireless Radios are *NOT* enabled." "$WARN" return 1 } @@ -1072,7 +1076,8 @@ _Get_ActiveGuestNetwork_VirtualInterfaces_() if ! _CheckForWirelessRadioEnabled_ && \ [ "${#gnInfoStr1}" -eq 0 ] && [ "${#gnInfoStr2}" -eq 0 ] then - Print_Output true "Guest Network Interfaces *NOT* found." "$ERR" + ! "$isInteractiveMenuMode" && \ + Print_Output true "Guest Network Interfaces *NOT* found." "$WARN" return 1 fi @@ -4221,13 +4226,18 @@ _Check_ActiveGuestNetwork_SubnetInfo_() if [ -z "$gnListOfIFaces" ] then _Init_ActiveGuestNetwork_SubnetInfo_ - if "$inStartupMode" - then ## Try again after initial startup ## + if "$inStartupMode" || "$wifiRestarted" + then ## Try again after some timeout ## if [ -s /jffs/scripts/YazFi ] - then sleepSecs=45 + then sleepSecs=60 elif [ "$fwInstalledBaseVers" -lt 3006 ] then sleepSecs=30 fi + gnCheckAttemptNum="$((gnCheckAttemptNum + 1))" + if [ "$gnCheckAttemptNum" -ge 2 ] + then inStartupMode=false ; wifiRestarted=false + fi + Print_Output true "Trying again. Check for available Guest Networks in $sleepSecs sec." "$PASS" ( sleep "$sleepSecs" ; _Check_ActiveGuestNetwork_SubnetInfo_ ) & else _AllowGuestNetwork_IP_Reservations_ reset false @@ -4307,6 +4317,7 @@ MainMenu() { local showexport menuOption srMenuOptStr gnMenuOptStr dhcpStaticIPsOK local allowGuestNetIPaddrReservations gnAllowReservationsMenuSetting + isInteractiveMenuMode=true _HandleInvalidOption_() { @@ -4800,6 +4811,7 @@ fi ##----------------------------------------## if [ $# -eq 0 ] || [ -z "$1" ] then + isInteractiveMenuMode=true Create_Dirs Set_Version_Custom_Settings local Create_Symlinks 2>/dev/null @@ -4842,9 +4854,16 @@ case "$1" in if [ "$2" = "restart" ] && [ "$3" = "wireless" ] then NTP_Ready - Print_Output true "Wireless restarted. Checking for available Guest Networks in 20 secs...." "$PASS" + sleepSecs=20 + if [ -s /jffs/scripts/YazFi ] + then sleepSecs=60 + elif [ "$fwInstalledBaseVers" -lt 3006 ] + then sleepSecs=30 + fi + wifiRestarted=true + Print_Output true "Wireless restarted. Check for available Guest Networks in $sleepSecs sec." "$PASS" Check_Lock - sleep 20 + sleep "$sleepSecs" _Update_GuestNetCheck_Status_ INIT _Check_ActiveGuestNetwork_SubnetInfo_ Process_DHCP_Clients