fix MWP hole punch for production use. bind to 0.0.0.0 instead of

published IP, resend packets every 500ms instead of single-shot, fix
Docker iptables-legacy chains so miniupnpd port mapping fully works
without warnings
This commit is contained in:
2026-02-10 11:26:57 -03:00
parent 33730fed8a
commit 2fe03cb855
12 changed files with 356 additions and 56 deletions

View File

@@ -47,7 +47,7 @@ echo "miniupnpd is running (UPnP mode)"
# Show router state
echo ""
echo "Router NAT table:"
docker compose exec router iptables -t nat -L -n | head -20
docker compose exec router iptables-legacy -t nat -L -n | head -20
echo ""
echo "[4/4] Running peer tests..."
@@ -104,7 +104,7 @@ ALICE_UPNP=$(docker logs test-peer-a 2>&1 | grep -c "UPnP" || true)
BOB_UPNP=$(docker logs test-peer-b 2>&1 | grep -c "UPnP" || true)
ALICE_NATPMP=$(docker logs test-peer-a 2>&1 | grep -c "Using NAT-PMP:" || true)
BOB_NATPMP=$(docker logs test-peer-b 2>&1 | grep -c "Using NAT-PMP:" || true)
CONNECTION=$(docker logs test-peer-b 2>&1 | grep -c "Connected\|SUCCESS" || true)
CONNECTION=$(docker logs test-peer-b 2>&1 | grep -c "CONNECTION ESTABLISHED" || true)
echo ""
echo "=========================================="
@@ -140,4 +140,13 @@ if [ $ALICE_NATPMP -gt 0 ] || [ $BOB_NATPMP -gt 0 ]; then
fi
echo ""
echo "Test complete."
# Final pass/fail
ALICE_CONNECTED=$(docker logs test-peer-a 2>&1 | grep -c "CONNECTION ESTABLISHED" || true)
if [ $ALICE_CONNECTED -gt 0 ] && [ $CONNECTION -gt 0 ]; then
echo "PASS: Both peers established connection through NAT"
elif [ $ALICE_CONNECTED -gt 0 ] || [ $CONNECTION -gt 0 ]; then
echo "PASS: At least one peer established connection through NAT"
else
echo "FAIL: No connection established"
exit 1
fi