File: //proc/23796/root/sbin/ip6tables
#!/bin/sh
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
#
# A version 6 iptables wrapper that aims to replace with original iptables
# This wrapper will excute the orginal iptables and retry when EAGAIN is received
RETRY_TIMES=5
RETRY_INTERVAL_MIN_SECS=1
RETRY_INTERVAL_MAX_SECS=3
i=0
while [ ${i} -lt ${RETRY_TIMES} ]; do
/usr/bin/xtables-legacy-multi ip6tables $@
originalExitCode=$?
# Resource problem (resource temporarily unavailable)
if [ ${originalExitCode} -ne 4 ]; then
exit ${originalExitCode}
fi
sleep $((RETRY_INTERVAL_MIN_SECS + RANDOM % RETRY_INTERVAL_MAX_SECS))
i=$((i+1))
done
exit ${originalExitCode}