Skip to content

Commit

Permalink
functions.sh: Pass -w argument to iptables
Browse files Browse the repository at this point in the history
When starting concurrently with other users of iptables, the iptables
invocations can fail because it can't grab the shared xtables lock. Pass
the -w argument to iptables to wait instead of failing, which should
hopefully make things work better. Use a 1-second max wait time to avoid
hanging forever if something goes wrong.

Fixes tohojo#132.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
  • Loading branch information
tohojo committed Feb 25, 2021
1 parent 37ead1f commit 195d3b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
[ -z "$IPTABLES_BINARY" ] && IPTABLES_BINARY=$(which iptables)
[ -z "$IP6TABLES" ] && IP6TABLES=ip6tables_wrapper
[ -z "$IP6TABLES_BINARY" ] && IP6TABLES_BINARY=$(which ip6tables)
[ -z "$IPTABLES_ARGS" ] && IPTABLES_ARGS="-w 1"


# Try modprobe first, fall back to insmod
Expand Down
4 changes: 2 additions & 2 deletions src/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ ipt() {
esac
done

SILENT=1 ${IPTABLES} "$@"
SILENT=1 ${IP6TABLES} "$@"
SILENT=1 ${IPTABLES} $IPTABLES_ARGS "$@"
SILENT=1 ${IP6TABLES} $IPTABLES_ARGS "$@"
}


Expand Down

0 comments on commit 195d3b5

Please sign in to comment.