| Server IP : 193.86.120.172 / Your IP : 216.73.216.215 Web Server : Apache/2.4.63 (Unix) System : Linux JServices 3.10.108 #86003 SMP Wed Oct 22 13:20:46 CST 2025 x86_64 User : kubec ( 1026) PHP Version : 8.2.28 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /sbin/ |
Upload File : |
#!/bin/sh
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
#
# A iptables-restore wrapper that aims to replace with original iptables-restore
# This wrapper will excute the orginal iptables-restores and retry when EAGAIN is received
RETRY_TIMES=5
RETRY_INTERVAL_MIN_MSECS=1000000
RETRY_INTERVAL_MAX_MSECS=3000000
PIPE_INFO=""
if [ -e "/proc/$$/fd/0" ] && grep -sq '^flags.*[02]$' "/proc/$$/fdinfo/0" && [ ! -t 0 ]; then
while read -r line; do
PIPE_INFO=$(printf "%s\n%s" "${PIPE_INFO}" "${line}")
done
fi
i=0
while [ ${i} -lt ${RETRY_TIMES} ]; do
if [ -z "${PIPE_INFO}" ];then
/usr/bin/xtables-legacy-multi iptables-restore "$@"
else
echo "${PIPE_INFO}" | /usr/bin/xtables-legacy-multi iptables-restore "$@"
fi
originalExitCode=$?
# Resource problem (resource temporarily unavailable)
if [ ${originalExitCode} -ne 1 ]; then
if [ ${originalExitCode} -ne 0 ]; then
logger -p err -t "iptable_debug" "iptables-restore failed, error=${originalExitCode}"
fi
exit ${originalExitCode}
fi
usleep $((RETRY_INTERVAL_MIN_MSECS + ((RANDOM * 100) % (RETRY_INTERVAL_MAX_MSECS - RETRY_INTERVAL_MIN_MSECS))))
i=$((i+1))
logger -p err -t "iptable_debug" "iptables-restore retry, error=${originalExitCode}, times=$i"
done
exit ${originalExitCode}