Bug #4444
closedports not unique when running multiple osmo-bts on the same machine
100%
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
Updated by laforge about 4 years 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.
Updated by laforge about 4 years ago
- % Done changed from 0 to 80
Updated by laforge about 4 years ago
- Related to Bug #4446: osmo-bts doesn't actually ever connect() its RTP/UDP sockets added
Updated by laforge almost 4 years ago
- Status changed from In Progress to Resolved
- % Done changed from 80 to 100
patches merged back in march