From 2fe54fc7f01c7feff6677b057bab05d4ca7309dc Mon Sep 17 00:00:00 2001 From: alexz Date: Fri, 19 Dec 2025 09:10:38 +0000 Subject: [PATCH] rego-tunnel: use VM_NET_IP env var directly instead of detecting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- apps/rego-tunnel/vpn_scripts/start.sh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/apps/rego-tunnel/vpn_scripts/start.sh b/apps/rego-tunnel/vpn_scripts/start.sh index 4ed50b3..6a265a2 100755 --- a/apps/rego-tunnel/vpn_scripts/start.sh +++ b/apps/rego-tunnel/vpn_scripts/start.sh @@ -15,16 +15,12 @@ cp /vpn_scripts/id_ed25519-lenovo /root/.ssh/ 2>/dev/null || true chmod 600 /root/.ssh/id_ed25519-lenovo 2>/dev/null || true get_windows_ip() { - # Method 1: DHCP leases (hostname is "Windows") - local ip=$(awk '/Windows/ {print $3}' /var/lib/misc/dnsmasq.leases 2>/dev/null | head -1) - if [[ -n "$ip" ]]; then echo "$ip"; return; fi - - # Method 2: ip neigh (ARP table) - look for 172.32.x.x on docker interface (VM_NET_IP subnet) - ip=$(ip neigh show dev docker 2>/dev/null | grep -oE '172\.32\.[0-9]+\.[0-9]+' | head -1) - if [[ -n "$ip" ]]; then echo "$ip"; return; fi - - # Method 3: qemu.ip file (if available) - cat /run/shm/qemu.ip 2>/dev/null || true + # Use VM_NET_IP env var if set, otherwise detect from DHCP leases + if [[ -n "${VM_NET_IP:-}" ]]; then + echo "$VM_NET_IP" + return + fi + awk '/Windows/ {print $3}' /var/lib/misc/dnsmasq.leases 2>/dev/null | head -1 } get_container_ip() {