Change in libosmo-sccp[master]: Store + show remote ip/port in dynamically created ASPs

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Mar 14 15:40:30 UTC 2019


Harald Welte has submitted this change and it was merged. ( 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(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



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 @@
 			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: merged
Gerrit-Change-Id: I39a1c57bc72e8aff607f3a551811a2f6372adab4
Gerrit-Change-Number: 13234
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190314/63fb8f9d/attachment.html>


More information about the gerrit-log mailing list