warzone2100
warzone2100 copied to clipboard
netplay: switch from miniupnpc to LibPlum
LibPlum provides the following advantages comparing to the old miniupnpc option:
- It supports not only UPnP, but also more modern and widely adopted NAT-PMP and PCP protocols for automatic port mapping.
- Even more lightweight than miniupnpc, has no dependencies, much cleaner API.
- Can be made to work with IPv6 (mostly thanks to the PCP support).
The patch also renames UPnP
configuration option to portMapping
. The old config option value will be used as a fallback if there's already one existing in user config.
Updated the branch to get LibPlum via submodule instead of doing FetchContent_Declare/FetchContent_MakeAvailable
.
The PR still needs some work, e.g.: before connecting to a lobby server, WZ would need to wait for libplum to finish discovery (with either success or failure, with timeout of 10 seconds on the WZ size), since the external port discovered by the libplum can be different from the internal port assigned initially by the WZ config. We need to communicate it to the lobby somehow.
Still, we can at least observe the CI status, especially given that the LibPlum submodule points to the https://github.com/paullouisageneau/libplum/commit/2c7631367bf1b201a389f8a2423fef9d7c66f45c, which contains all recent fixes for the CI/packaging.