two processes can open the same UDP port without error
When two processes open a socket with the same UDP port there will be no error since we set SO_REUSEADDR also for UDP ports. This is dangerous and might lead into situations that are very difficult to debug. There is no point in setting SO_REUSEADDR for UDP ports since UDP is connection less and there can not be any lingering connections like with TCP.
#1 Updated by dexter about 2 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 100
The problem should be fixed now. I also noticed a missing return code check. See also:
https://gerrit.osmocom.org/#/c/libosmocore/+/10288 socket: check return code of setsockopt
https://gerrit.osmocom.org/#/c/libosmocore/+/10289 socket: do not set SO_REUSEADDR for IPPROTO_UDP
#2 Updated by dexter about 2 years ago
I have now tested everything and I do not see any problems with fallout. Except osmo-mgw had problems with its unit-tests because one of the test function did not close the connections it created for the test, resulting in different ports on the following test. This also means that the applications internally did not notice that they re-use ports. This is now fixed.