Skip to content
This repository was archived by the owner on Jul 20, 2024. It is now read-only.

Fix loop that can run infinitely in some cases #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion snat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
set -x

# wait for eth1
while ! ip link show dev eth1; do
end_time=$((SECONDS + 180))
while [ $SECONDS -lt $end_time ] && ! ip link show dev eth1; do
sleep 1
done

if ! ip link show dev eth1; then
exit 1
fi

# enable IP forwarding and NAT
sysctl -q -w net.ipv4.ip_forward=1
sysctl -q -w net.ipv4.conf.eth1.send_redirects=0
Expand Down