Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp UDP ports setting #1130

Merged

Conversation

davidebeatrici
Copy link
Member

@davidebeatrici davidebeatrici commented May 19, 2020

Now that Proto supports UDP, the server can handle multiple protocols on each UDP port.

The UDP ports are specified by the OpenVPN_UdpPortList configuration setting, because:

  • OpenVPN is currently the only UDP protocol supported by SoftEther VPN to allow a custom port number.
  • Before Proto was introduced, a unified interface for the protocols didn't exist; each protocol implementation had to create its own listener.

In preparation for the upcoming WireGuard implementation, this pull request renames OpenVPN_UdpPortList to PortsUDP, which should clarify that the setting is global.

The change is reflected in the code. Also, the ports are now stored in a LIST rather than a string. The conversion between string and LIST only happens when loading/saving the configuration.

The default UDP ports are now the same as the TCP ones (443, 992, 1194, 5555).


VPN Command Line Management Utility:

  • PortsUDPSet: This command can be used to specify a single or multiple UDP ports the server should listen on. 0 can be specified to disable the UDP listener.
    Administrator privileges are required to execute the command.
  • PortsUDPGet: This command can be used to retrieve the UDP ports the server is listening on.

The two commands replace the functionality that was previously provided by OpenVpnEnable and OpenVpnGet, respectively.


VPN Server Manager:

Before After
Main dialog - Before Main dialog - After
OpenVPN dialog - Before OpenVPN dialog - After

@davidebeatrici
Copy link
Member Author

I have to update vpnsmgr accordingly.

@davidebeatrici davidebeatrici marked this pull request as draft May 19, 2020 04:32
Now that Proto supports UDP, the server can handle multiple protocols on each UDP port.

The UDP ports are specified by the "OpenVPN_UdpPortList" configuration setting, because:

- OpenVPN is currently the only UDP protocol supported by SoftEther VPN to allow a custom port number.
- Before Proto was introduced, a unified interface for the protocols didn't exist; each protocol implementation had to create its own listener.

In preparation for the upcoming WireGuard implementation, this commit renames "OpenVPN_UdpPortList" to "PortsUDP", which should clarify that the setting is global.

The change is reflected in the code. Also, the ports are now stored in a LIST rather than a string. The conversion between string and LIST only happens when loading/saving the configuration.

The default UDP ports are now the same as the TCP ones (443, 992, 1194, 5555).
@davidebeatrici davidebeatrici changed the title Rename "OpenVPN_UdpPortList" to "PortsUDP", store ports in a LIST, add PortsUDPGet and PortsUDPSet commands Revamp UDP ports setting May 20, 2020
@davidebeatrici davidebeatrici marked this pull request as ready for review May 20, 2020 02:55
Originally, StrToPortList() returned NULL when it encountered a number equal to 0 or higher than 65535.

This commit adds a new parameter to the function called "limit_range":

- When its value is true, the function retains the original behavior.
- When its value is false, the function doesn't check whether the number is in the network port number range (1-65535).

The change is required because the command to set the UDP ports will allow to remove all ports by specifying "0" as the port number.
PortsUDPSet: This command can be used to specify a single or multiple UDP ports the server should listen on. "0" can be specified to disable the UDP listener.
Administrator privileges are required to execute the command.

PortsUDPGet: This command can be used to retrieve the UDP ports the server is listening on.

The two commands replace the functionality that was previously provided by OpenVpnEnable and OpenVpnGet, respectively.
The function only called StrToPortList(), thus it can safely be replaced with the upstream function.
This commit moves the UDP ports setting right below the TCP listeners and uses the new RPC methods to get and set them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant