aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-03-13 12:45:58 +0100
committerHarald Welte <laforge@gnumonks.org>2019-03-14 15:40:29 +0000
commit005c3a69823cbca2a3b82933a3750d80a639c670 (patch)
treeaa7ebdc94a51a8f4f604df9752f4e87710d5613a
parentbf7eded0fcd60df96fa2fbe6ed80654f891d4f21 (diff)
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
-rw-r--r--src/osmo_ss7.c6
1 files changed, 6 insertions, 0 deletions
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);