Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/13234


Change subject: Store + show remote ip/port in dynamically created ASPs
......................................................................

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
---
M src/osmo_ss7.c
1 file changed, 6 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/34/13234/1

diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 4bb8fc8..acd8e6b 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1732,9 +1732,15 @@
                        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);

--
To view, visit https://gerrit.osmocom.org/13234
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I39a1c57bc72e8aff607f3a551811a2f6372adab4
Gerrit-Change-Number: 13234
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to