diff options
Diffstat (limited to 'guix-container.sh')
-rwxr-xr-x | guix-container.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/guix-container.sh b/guix-container.sh index acfb2cf..8a358b8 100755 --- a/guix-container.sh +++ b/guix-container.sh @@ -53,9 +53,17 @@ is_running() { network_rip() { ip link delete veth-guix-out 2>/dev/null || true + + if [ -n "$HOST_SYSTEM_ROOT" ]; then + # There's no connection to the real net when running in a test + # environment. + return + fi + echo 0 > /proc/sys/net/ipv4/ip_forward + for LINKNAME in $(ip route | grep default | awk '{print $5}'); do - iptables -t nat -D POSTROUTING \ + iptables -t nat -D POSTROUTING \ -s 10.207.87.1/24 -o "$LINKNAME" -j MASQUERADE 2>/dev/null \ || true done @@ -149,6 +157,11 @@ start() { nsenter --target "$SHEPHERD_PID" --net ip route add \ default via 10.207.87.1 dev veth-guix-in + if [ -n "$HOST_SYSTEM_ROOT" ]; then + # Don't connect to the real net when running in a test environment. + return + fi + for LINKNAME in $(ip route | grep default | awk '{print $5}'); do iptables -t nat -A POSTROUTING \ -s 10.207.87.1/24 -o "$LINKNAME" -j MASQUERADE |