HDTN
HDTN copied to clipboard
No way to bind UDPCL to a specific source port
The current outduct_element_config_t
has a way to ensure a specific LTP local port with ltpSenderBoundPort
but there is no way to do the equivalent thing with the outgoing UDP source port.
The current behavior uses a fixed bind port of "0" (meaning choose an ephemeral port) here
https://github.com/nasa/HDTN/blob/73e30dbfc6962d647aeb4d5c1b5334d90b64d29f/common/udp/src/UdpBundleSource.cpp#L242
but this could be made a configuration from e.g. an option udpSenderBoundPort
.
Additionally, the current open()
and bind()
within UdpBundleSource::OnResolve()
doesn't actually need to wait for the peer address resolution. Both open and bind can happen (and catch errros) in that class constructor.
If source port selection is allowed, the following should be enabled just before the bind()
call to enable multiple sockets to use the same sort port
m_udpSocket.set_option(boost::asio::socket_base::reuse_address(true));