From 005c3a69823cbca2a3b82933a3750d80a639c670 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 13 Mar 2019 12:45:58 +0100 Subject: Store + show remote ip/port in dynamically created ASPs "show cs7 instance 0 asp" before this patch would not display the remote IP/port information about dynamically-added ASPs but instead: Effect Primary ASP Name AS Name State Type Rmt Port Remote IP Addr SCTP ------------ ------------ ------------- ---- -------- --------------- ---------- asp-dyn-0 ? ASP_ACTIVE m3ua 0 (null) With this patch it is now correctly displayed: Effect Primary ASP Name AS Name State Type Rmt Port Remote IP Addr SCTP ------------ ------------ ------------- ---- -------- --------------- ---------- asp-dyn-0 ? ASP_ACTIVE m3ua 24905 127.0.0.1 Change-Id: I39a1c57bc72e8aff607f3a551811a2f6372adab4 Closes: OS#3836 --- src/osmo_ss7.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index 381a53a..f8633b6 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -1691,9 +1691,15 @@ static int xua_accept_cb(struct osmo_stream_srv_link *link, int fd) asp = osmo_ss7_asp_find_or_create(oxs->inst, namebuf, 0, 0, oxs->cfg.proto); if (asp) { + char hostbuf[INET6_ADDRSTRLEN]; + char portbuf[16]; + + osmo_sock_get_ip_and_port(fd, hostbuf, sizeof(hostbuf), portbuf, sizeof(portbuf), false); LOGP(DLSS7, LOGL_INFO, "%s: created dynamicASP %s\n", sock_name, asp->cfg.name); asp->cfg.is_server = true; + asp->cfg.remote.port = atoi(portbuf); + asp->cfg.remote.host = talloc_strdup(asp, hostbuf); asp->dyn_allocated = true; asp->server = srv; osmo_ss7_asp_restart(asp); -- cgit v1.2.3