Open dtgreene opened 4 months ago
I think it's not up to Godot to behave the same way, it's up to your gdscript code? Can you not just call the add port mapping function on the individual device?
I did try adding the port mapping but the result was the same, failed due to no gateway. From what I can tell, this check happens in the thin wrapper Godot has around the underlying miniupnpc library:
https://github.com/godotengine/godot/blob/master/modules/upnp/upnp.cpp#L315-L323
Is it your primary router or secondary, I have this problem when using my secondary router connected to another router that connects directly to the provider. When I use the primary router, it works fine. My secondary router is a tp-link, and my primary router is ZTE.
It is unfortunate that the only free alternative for networking is UPnP, that is disabled on most routers. There should be a better option, without having to expend money in a tunneling service.
@dtgreene Do you have two routers in your network setup (i.e. behind double NAT)? If so, you won't be reachable from the Internet unless one of the routers is on the DMZ (i.e. has all its ports forwarded) to avoid a double NAT situation.
@Calinou @brunoCreator I only have the one router setup in my house. I was thinking maybe Godot's implementation with miniupnpc
just needed tweaking since you can add the mapping through their CLI but not with Godot.
Either way I learned that UPnP really isn't a great solution and I'd be better off with a NAT punchthrough or a relay server. I left this issue open because I thought this was still a genuine bug. I can close it though if it doesn't seem like a problem.
Tested versions
Godot v4.2.stable
System information
Godot v4.2.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Ti (NVIDIA; 31.0.15.3742) - AMD Ryzen 5 5600X 6-Core Processor (12 Threads)
Issue description
Calling
discover()
on a new UPNP instance works as expected and my router shows up as one of the devices found. However,get_gateway()
always returns null without any further messages. UPNP is enabled on the router.Router:
Script:
Godot reports the IGD status as 5 or "Not Connected". I downloaded the miniupnpc client and added the mapping directly through the CLI. It also reported the status as not connected but continued anyway and worked successfully.
I'm not sure if this would still be considered a bug but I wonder if it's possible for Godot to behave this way as well since the mapping can still be added even with the not connected status.
Steps to reproduce
upnp.discover()
upnp.get_gateway()
Minimal reproduction project (MRP)
demo.zip