network: use iptables-restore --wait if available

Avoid bailing out early if multiple instances of iptables-restore are
called simultaneously.

Fixes QubesOS/qubes-issues#3665

(cherry picked from commit 8f6bd245bd)
This commit is contained in:
Marek Marczykowski-Górecki 2018-05-24 04:23:51 +02:00
parent d482add57d
commit c9cf96eeef
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -33,10 +33,16 @@ start() {
# Do not start if there is no config file.
[ ! -f "$IPTABLES_DATA" ] && return 6
CMD_ARGS=
if "$CMD-restore" --help 2>&1 | grep -q wait=; then
CMD_ARGS=--wait
fi
echo -n $"${CMD}: Applying firewall rules: "
$CMD-restore $IPTABLES_DATA
if [ $? -eq 0 ]; then
"$CMD-restore" $CMD_ARGS "$IPTABLES_DATA"
ret="$?"
if [ "$ret" -eq 0 ]; then
echo OK
else
echo FAIL; return 1