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

Commit 2ed70d9

Browse files
committed
Fix loop that can run infinitely in some cases
1 parent 75636c9 commit 2ed70d9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

snat.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
set -x
33

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

10+
if ! ip link show dev eth1; then
11+
exit 1
12+
fi
13+
914
# enable IP forwarding and NAT
1015
sysctl -q -w net.ipv4.ip_forward=1
1116
sysctl -q -w net.ipv4.conf.eth1.send_redirects=0

0 commit comments

Comments
 (0)