pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/33335 )
Change subject: Set stream_cli/srv name to contain ASP + sockname ......................................................................
Set stream_cli/srv name to contain ASP + sockname
Upon connect/accept, update the name to contain both the ASP and the sockname of the established socked. This allows easily identifying the stream based on IP layer as well as upper xUA layer.
Example logs: """ stream.c:1193 SRV(::1:2905) accept()ed new link from ::1 to port 2905 stream.c:1672 SRVCONN(asp-dyn-0,(r=::1:43568<->l=::1:2905)) connected read/write (what=0x1) stream.c:1589 SRVCONN(asp-dyn-0,(r=::1:43568<->l=::1:2905)) message received """ """ stream.c:521 CLICONN(asp0){CONNECTING} connection established stream.c:552 CLICONN(asp0,(r=::1:2905<->l=::ffff:127.0.0.2:35911)){CONNECTED} connected read stream.c:401 CLICONN(asp0,(r=::1:2905<->l=::ffff:127.0.0.2:35911)){CONNECTED} message received """
Change-Id: I05bc5f6c7795f62c1814c1c774287b41ee85a475 --- M src/osmo_ss7.c 1 file changed, 35 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/35/33335/1
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index f5db687..128545d 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -1838,6 +1838,10 @@ talloc_free(asp->sock_name); asp->sock_name = osmo_sock_get_name(asp, ofd->fd);
+ char *cli_name = talloc_asprintf(asp, "%s,%s", asp->cfg.name, asp->sock_name); + osmo_stream_cli_set_name(asp->client, cli_name); + talloc_free(cli_name); + LOGPASP(asp, DLSS7, LOGL_INFO, "Client connected %s\n", asp->sock_name);
if (asp->lm && asp->lm->prim_cb) { @@ -2089,9 +2093,15 @@ * connection came in */ asp->server = srv; asp->xua_server = oxs; + /* update the ASP socket name */ talloc_free(asp->sock_name); asp->sock_name = talloc_reparent(link, asp, sock_name); + + char *srv_name = talloc_asprintf(asp, "%s,%s", asp->cfg.name, asp->sock_name); + osmo_stream_srv_set_name(asp->server, srv_name); + talloc_free(srv_name); + /* make sure the conn_cb() is called with the asp as private * data */ osmo_stream_srv_set_data(srv, asp);