Project

General

Profile

Actions

Bug #3441

closed

two processes can open the same UDP port without error

Added by dexter over 5 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
08/01/2018
Due date:
% Done:

100%

Spec Reference:

Description

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.

Actions #1

Updated by dexter over 5 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

Actions #2

Updated by dexter over 5 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.

See also:
https://gerrit.osmocom.org/#/c/osmo-mgw/+/10306/

and

https://gerrit.osmocom.org/#/c/libosmocore/+/10289/

Actions #3

Updated by dexter over 5 years ago

  • Status changed from In Progress to Resolved
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)