Project

General

Profile

Bug #4444

ports not unique when running multiple osmo-bts on the same machine

Added by laforge 8 months ago. Updated 4 months ago.

Status:
Resolved
Priority:
Urgent
Assignee:
Category:
-
Target version:
-
Start date:
03/08/2020
Due date:
% Done:

100%

Spec Reference:

Description

This is with running two osmo-bts[-virtual] on the same machine and a number of active voice calls:

root@36bd59f48d7c:/docker# ./netstat  -uan
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
udp      768      0 172.18.23.4:16384       0.0.0.0:*                          
udp        0      0 172.18.23.4:16384       0.0.0.0:*                          
udp        0      0 172.18.23.4:16385       0.0.0.0:*                          
udp        0      0 172.18.23.4:16385       0.0.0.0:*                          
udp      768      0 172.18.23.4:16386       0.0.0.0:*                          
udp        0      0 172.18.23.4:16386       0.0.0.0:*                          
udp        0      0 172.18.23.4:16387       0.0.0.0:*                          
udp        0      0 172.18.23.4:16387       0.0.0.0:*                          
udp        0      0 172.18.23.4:16388       0.0.0.0:*                          
udp        0      0 172.18.23.4:16388       0.0.0.0:*                          
udp        0      0 172.18.23.4:16389       0.0.0.0:*                          
udp        0      0 172.18.23.4:16389       0.0.0.0:*                          
udp        0      0 172.18.23.4:16390       0.0.0.0:*                          
udp        0      0 172.18.23.4:16391       0.0.0.0:*                          
udp        0      0 172.18.23.4:16392       0.0.0.0:*                          
udp        0      0 172.18.23.4:16393       0.0.0.0:*                          
udp        0      0 172.18.23.4:16394       0.0.0.0:*                          
udp        0      0 172.18.23.4:16395       0.0.0.0:*                          
udp        0      0 172.18.23.4:16396       0.0.0.0:*                          
udp        0      0 172.18.23.4:16397       0.0.0.0:*                          

16384 is bts->rtp_port_range_start. So both of them happily start to bind ports from 16384 upwards without creating any error whatsoever. This means that the bind_rtp() loop in source:src/common/rsl.c is not working at all.


Related issues

Related to OsmoBTS - Bug #4446: osmo-bts doesn't actually ever connect() its RTP/UDP socketsNew03/08/2020

History

#1 Updated by laforge 8 months ago

It turns out that libortp uses not only SO_REUSEADDR, but actually also SO_REUSEPORT since 0.24.0 in 2015. This means that any attempt to bind multiple sockets to the same local port will succeed, and the logic to bind to a unique port in osmo-bts is completely rendered useless.

This should have caused visible problems not only when operating multiple osmo-bts on one machine (rare), but also with a single osmo-bts. Once the range (default 16384-17407 ) wraps, there is a risk of new sockets (for new cals) colliding with old ones. As two ports (RTP+RTCP) are used per call, this means every 512 voice calls we expect the BTS to wrap. And from that point onwards there's a risk of overlapping with previously allocated sockets.

#3 Updated by laforge 8 months ago

  • Related to Bug #4446: osmo-bts doesn't actually ever connect() its RTP/UDP sockets added

#4 Updated by laforge 4 months ago

  • Status changed from In Progress to Resolved
  • % Done changed from 80 to 100

patches merged back in march

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)