Skip to content

Commit 77efcdc

Browse files
authored
Fix logic error in IP list size check (hestiacp#4941)
The script was using `-le` (less than or equal) to check if the IP list size was below the minimum threshold. This caused valid lists with exactly `IPSET_MIN_SIZE` entries to be incorrectly rejected.
1 parent 874e406 commit 77efcdc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bin/v-add-firewall-ipset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ if [ ! -f "${IPSET_PATH}/${IPSET_FILE}.iplist" ] || [ "$refresh" = "yes" ]; then
130130

131131
# Validate iplist file size
132132
iplist_size=$(sed -r -e '/^#|^$/d' "$iplist_tempfile" | wc -l)
133-
[[ "$iplist_size" -le "$IPSET_MIN_SIZE" ]] && check_result "$E_INVALID" "IP list file too small (<${IPSET_MIN_SIZE}), ignoring"
133+
[[ "$iplist_size" -lt "$IPSET_MIN_SIZE" ]] && check_result "$E_INVALID" "IP list file too small (<${IPSET_MIN_SIZE}), ignoring"
134134
mv -f "$iplist_tempfile" "${IPSET_PATH}/${IPSET_FILE}.iplist"
135135

136136
fi

0 commit comments

Comments
 (0)