Bug #3383

libosmo-sigtran performs blocking connect() for M3UA

Added by laforge 10 months ago. Updated 10 months ago.

Target version:
Start date:
Due date:
% Done:


Spec Reference:


When trying to establish a connection from OsmoBSC to a MSC, and the MSC/STP doesn't either
a) actively refuse the connection (port unreachable or the like), or
b) accept the connection

We are blocking the entire BSC process, so no vty or Abis processing is happening.

it basically looks like this in strace:

bind(8, {sa_family=AF_INET, sin_port=htons(30003), sin_addr=inet_addr("")}, 16) = 0
connect(8, {sa_family=AF_INET, sin_port=htons(30003), sin_addr=inet_addr("")}, 16^Cstrace: Process 56640 detached
 <detached ...>


#1 Updated by laforge 10 months ago

  • Status changed from New to In Progress
  • Assignee set to laforge
  • % Done changed from 0 to 10

libosmo-sigtran is using osmo_stream_cli* API of libosmo-netif in order to perform the client side connection to an STP.

In the end, osmo_stream_cli_open2 is called, which will
  • first call osmo_sock_init2(AF_INET, SOCK_STREAM, ... OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_BIND)
  • later (if cli->flags & OSMO_STREAM_CLI_F_NODELAY) setsockopt_nodelay()

At no point we seem to be setting FIONBIO / non-blocking on that socket. libosmocore can do this if OSMO_SOCK_F_NONBLOCK is set - which libosmo-netif doesn't do.

#2 Updated by laforge 10 months ago

  • % Done changed from 10 to 50

#3 Updated by laforge 10 months ago

  • % Done changed from 50 to 90

I just did a quick test using LD_PRELOAD of the modified libosmo-netif, and indeed the OsmoBSC is now using non-blcoking connect. After about 5 minutes, the non-blocking connect fails and the re-connect logic of libosmo-netif kicks in. looks good so far.

#4 Updated by laforge 10 months ago

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

patch merged

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)