Attention is currently required from: fixeria.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/35333?usp=email )
Change subject: silent_call: check return value of trans_alloc() against NULL
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/35333?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ie989cd8146d66d9531cf3f3d84f46a2c6fcc2e5c
Gerrit-Change-Number: 35333
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 12 Dec 2023 15:39:50 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: fixeria.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/35332?usp=email )
Change subject: osmo_stream_srv_link_ofd_cb(): fix wrong socket size passed to accept()
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> It's correct. […]
man 2 accept:
"""
The addrlen argument is a value-result argument: the caller must initialize it to contain the size (in bytes) of the structure pointed to by addr; on return it will contain the actual size of the peer address.
The returned address is truncated if the buffer provided is too small; in this case, addrlen will return a value greater than was supplied to the call.
"""
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35332?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie280c255fb2ba790b448e283439c42b766427352
Gerrit-Change-Number: 35332
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 12 Dec 2023 15:33:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: fixeria.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/35332?usp=email )
Change subject: osmo_stream_srv_link_ofd_cb(): fix wrong socket size passed to accept()
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> Could you elaborate more please? […]
It's correct. the len passed to it needs to be the maximum size of the struct which can be copied in.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35332?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie280c255fb2ba790b448e283439c42b766427352
Gerrit-Change-Number: 35332
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 12 Dec 2023 15:32:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/35332?usp=email )
Change subject: osmo_stream_srv_link_ofd_cb(): fix wrong socket size passed to accept()
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> This is wrong.
Could you elaborate more please?
We're passing a pointer to `osa.u.sa` (`struct sockaddr`) but sizeof `osa.u.sas` (`struct sockaddr_storage`) to `accept()`. Isn't this wrong?
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35332?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie280c255fb2ba790b448e283439c42b766427352
Gerrit-Change-Number: 35332
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 12 Dec 2023 15:29:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/35242?usp=email )
Change subject: vty: Retrieve IP addr set from sk when dumping xUA server
......................................................................
vty: Retrieve IP addr set from sk when dumping xUA server
Until now we simply printed back the configured set of IP addresses, not
the one retrieved from the socket at the time, because we didn't have
any easy means to retrieve multiple addresses from a socket.
This is possible since recently using libosmocore APIs. Use them.
Depends: libosmo-netif.git Change-Id I1bd3f790d93af74c150938a59108b882ad2820f3
Depends: libosmocore.git Change-Id I18a0e1a652a3e8ef3e97154355eb1d07a14ef0bd
Related: SYS#6636
Change-Id: I331b6e2fe11cd97e286b7ba684d4a17b8055f9d4
---
M TODO-RELEASE
M src/osmo_ss7_vty.c
2 files changed, 44 insertions(+), 4 deletions(-)
Approvals:
osmith: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 1e4c41a..2b15a91 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -9,3 +9,4 @@
#library what description / commit summary line
libosmocore >1.9.0 osmo_sock_multiaddr_{add,del}_local_addr()
libosmo-netif >1.4.0 osmo_stream_{srv,cli}_get_fd()
+libosmocore >1.9,0 osmo_sock_multiaddr_get_ip_and_port(), osmo_multiaddr_ip_and_port_snprintf()
\ No newline at end of file
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 5a637b4..6c36768 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -610,11 +610,33 @@
static void vty_dump_xua_server(struct vty *vty, struct osmo_xua_server *xs)
{
- char buf[512];
+ char buf[OSMO_SOCK_MULTIADDR_PEER_STR_MAXLEN];
const char *proto = get_value_string(osmo_ss7_asp_protocol_vals, xs->cfg.proto);
- if (osmo_ss7_asp_peer_snprintf(buf, sizeof(buf), &xs->cfg.local) < 0)
- snprintf(buf, sizeof(buf), "<error>");
- vty_out(vty, "xUA server for %s on %s%s", proto, buf, VTY_NEWLINE);
+ int fd = xs->server ? osmo_stream_srv_link_get_fd(xs->server) : -1;
+
+ if (fd < 0) {
+ if (osmo_ss7_asp_peer_snprintf(buf, sizeof(buf), &xs->cfg.local) < 0)
+ snprintf(buf, sizeof(buf), "<error>");
+ } else {
+ char hostbuf[OSMO_SOCK_MAX_ADDRS][INET6_ADDRSTRLEN];
+ size_t num_hostbuf = ARRAY_SIZE(hostbuf);
+ char portbuf[6];
+ int rc;
+ rc = osmo_sock_multiaddr_get_ip_and_port(fd, ss7_asp_proto_to_ip_proto(xs->cfg.proto),
+ &hostbuf[0][0], &num_hostbuf, sizeof(hostbuf[0]),
+ portbuf, sizeof(portbuf), true);
+ if (rc < 0) {
+ snprintf(buf, sizeof(buf), "<error>");
+ } else {
+ if (num_hostbuf > ARRAY_SIZE(hostbuf))
+ num_hostbuf = ARRAY_SIZE(hostbuf);
+ osmo_multiaddr_ip_and_port_snprintf(buf, sizeof(buf),
+ &hostbuf[0][0], num_hostbuf, sizeof(hostbuf[0]),
+ portbuf);
+ }
+ }
+ vty_out(vty, "xUA server for %s on %s is %s%s",
+ proto, buf, fd >= 0 ? "listening" : "inactive", VTY_NEWLINE);
}
DEFUN(show_cs7_xua, show_cs7_xua_cmd,
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/35242?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I331b6e2fe11cd97e286b7ba684d4a17b8055f9d4
Gerrit-Change-Number: 35242
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/35253?usp=email )
Change subject: vty: show cs7 instance asp: Swap columns SCTP Role and Remote Address list
......................................................................
vty: show cs7 instance asp: Swap columns SCTP Role and Remote Address list
The Remote Address is by far the potentially largest column, as well as
the one with more variable length, so move it to the end for better formatting.
Change-Id: I4854219f8898266ae47b9117ef79dbad30a5b0fd
---
M TODO-RELEASE
M src/osmo_ss7_vty.c
M tests/vty/ss7_asp_test.vty
3 files changed, 49 insertions(+), 37 deletions(-)
Approvals:
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 2b15a91..c7771bd 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -9,4 +9,4 @@
#library what description / commit summary line
libosmocore >1.9.0 osmo_sock_multiaddr_{add,del}_local_addr()
libosmo-netif >1.4.0 osmo_stream_{srv,cli}_get_fd()
-libosmocore >1.9,0 osmo_sock_multiaddr_get_ip_and_port(), osmo_multiaddr_ip_and_port_snprintf()
\ No newline at end of file
+libosmocore >1.9.0 osmo_sock_multiaddr_get_ip_and_port(), osmo_multiaddr_ip_and_port_snprintf()
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 6c36768..39d5b3b 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -1149,9 +1149,9 @@
return CMD_WARNING;
}
- vty_out(vty, " Current Primary Link%s", VTY_NEWLINE);
- vty_out(vty, "ASP Name AS Name State Type Role Remote IPaddr & Port SCTP Role%s", VTY_NEWLINE);
- vty_out(vty, "------------ ------------ ------------- ---- ---- ----------------------- ---------%s", VTY_NEWLINE);
+ vty_out(vty, " Current Primary Link%s", VTY_NEWLINE);
+ vty_out(vty, "ASP Name AS Name State Type Role SCTP Role Remote Addresses%s", VTY_NEWLINE);
+ vty_out(vty, "------------ ------------ ------------- ---- ---- --------- -----------------------%s", VTY_NEWLINE);
llist_for_each_entry(asp, &inst->asp_list, list) {
if (asp->cfg.proto == OSMO_SS7_ASP_PROT_IPA && asp->cfg.remote.port == 0 && asp->server) {
@@ -1163,14 +1163,14 @@
snprintf(buf, sizeof(buf), "%s:%s", hostbuf, portbuf);
} else
osmo_ss7_asp_peer_snprintf(buf, sizeof(buf), &asp->cfg.remote);
- vty_out(vty, "%-12s %-12s %-13s %-4s %-4s %-23s %-9s%s",
+ vty_out(vty, "%-12s %-12s %-13s %-4s %-4s %-9s %-23s%s",
asp->cfg.name,
as_list_for_asp(asp, as_buf, sizeof(as_buf)),
asp->fi? osmo_fsm_inst_state_name(asp->fi) : "uninitialized",
get_value_string(osmo_ss7_asp_protocol_vals, asp->cfg.proto),
osmo_str_tolower(get_value_string(osmo_ss7_asp_role_names, asp->cfg.role)),
- buf,
asp->cfg.is_server ? "server" : "client",
+ buf,
VTY_NEWLINE);
}
return CMD_SUCCESS;
diff --git a/tests/vty/ss7_asp_test.vty b/tests/vty/ss7_asp_test.vty
index dcea4ca..73a13b5 100644
--- a/tests/vty/ss7_asp_test.vty
+++ b/tests/vty/ss7_asp_test.vty
@@ -256,27 +256,27 @@
ss7_asp_vty_test(config-cs7-asp)# remote-ip 127.0.0.200
ss7_asp_vty_test(config-cs7-asp)# local-ip 127.0.0.100
ss7_asp_vty_test(config-cs7-asp)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role Remote IPaddr & Port SCTP Role
------------- ------------ ------------- ---- ---- ----------------------- ---------
-my-asp ? uninitialized m3ua sg 127.0.0.200:12345 server
+ Current Primary Link
+ASP Name AS Name State Type Role SCTP Role Remote Addresses
+------------ ------------ ------------- ---- ---- --------- -----------------------
+my-asp ? uninitialized m3ua sg server 127.0.0.200:12345
ss7_asp_vty_test(config-cs7-asp)# remote-ip 127.0.0.201
ss7_asp_vty_test(config-cs7-asp)# local-ip 127.0.0.101
ss7_asp_vty_test(config-cs7-asp)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role Remote IPaddr & Port SCTP Role
------------- ------------ ------------- ---- ---- ----------------------- ---------
-my-asp ? uninitialized m3ua sg (127.0.0.200|127.0.0.201):12345 server
+ Current Primary Link
+ASP Name AS Name State Type Role SCTP Role Remote Addresses
+------------ ------------ ------------- ---- ---- --------- -----------------------
+my-asp ? uninitialized m3ua sg server (127.0.0.200|127.0.0.201):12345
ss7_asp_vty_test(config-cs7-asp)# ! Mark as primary:
ss7_asp_vty_test(config-cs7-asp)# remote-ip 127.0.0.201 primary
ss7_asp_vty_test(config-cs7-asp)# ! 'local-ip 127.0.0.101 primary' cannot be tested here since output may be different based on sysctl available
ss7_asp_vty_test(config-cs7-asp)# local-ip 127.0.0.101
...
ss7_asp_vty_test(config-cs7-asp)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role Remote IPaddr & Port SCTP Role
------------- ------------ ------------- ---- ---- ----------------------- ---------
-my-asp ? uninitialized m3ua sg (127.0.0.200|127.0.0.201*):12345 server
+ Current Primary Link
+ASP Name AS Name State Type Role SCTP Role Remote Addresses
+------------ ------------ ------------- ---- ---- --------- -----------------------
+my-asp ? uninitialized m3ua sg server (127.0.0.200|127.0.0.201*):12345
ss7_asp_vty_test(config-cs7-asp)# show running-config
...
local-ip 127.0.0.100
@@ -289,10 +289,10 @@
ss7_asp_vty_test(config-cs7-asp)# remote-ip 127.0.0.201
ss7_asp_vty_test(config-cs7-asp)# local-ip 127.0.0.101
ss7_asp_vty_test(config-cs7-asp)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role Remote IPaddr & Port SCTP Role
------------- ------------ ------------- ---- ---- ----------------------- ---------
-my-asp ? uninitialized m3ua sg (127.0.0.200|127.0.0.201):12345 server
+ Current Primary Link
+ASP Name AS Name State Type Role SCTP Role Remote Addresses
+------------ ------------ ------------- ---- ---- --------- -----------------------
+my-asp ? uninitialized m3ua sg server (127.0.0.200|127.0.0.201):12345
ss7_asp_vty_test(config-cs7-asp)# show running-config
...
local-ip 127.0.0.100
@@ -361,26 +361,26 @@
ss7_asp_vty_test(config-cs7-as)# routing-key 0 3.2.1
ss7_asp_vty_test(config-cs7-as)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role Remote IPaddr & Port SCTP Role
------------- ------------ ------------- ---- ---- ----------------------- ---------
-my-asp my-ass ASP_DOWN m3ua sg (127.0.0.200|127.0.0.201):12345 server
+ Current Primary Link
+ASP Name AS Name State Type Role SCTP Role Remote Addresses
+------------ ------------ ------------- ---- ---- --------- -----------------------
+my-asp my-ass ASP_DOWN m3ua sg server (127.0.0.200|127.0.0.201):12345
ss7_asp_vty_test(config-cs7-as)# exit
ss7_asp_vty_test(config-cs7)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role Remote IPaddr & Port SCTP Role
------------- ------------ ------------- ---- ---- ----------------------- ---------
-my-asp my-ass ASP_DOWN m3ua sg (127.0.0.200|127.0.0.201):12345 server
+ Current Primary Link
+ASP Name AS Name State Type Role SCTP Role Remote Addresses
+------------ ------------ ------------- ---- ---- --------- -----------------------
+my-asp my-ass ASP_DOWN m3ua sg server (127.0.0.200|127.0.0.201):12345
ss7_asp_vty_test(config-cs7)# exit
ss7_asp_vty_test(config)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role Remote IPaddr & Port SCTP Role
------------- ------------ ------------- ---- ---- ----------------------- ---------
-my-asp my-ass ASP_DOWN m3ua sg (127.0.0.200|127.0.0.201):12345 server
+ Current Primary Link
+ASP Name AS Name State Type Role SCTP Role Remote Addresses
+------------ ------------ ------------- ---- ---- --------- -----------------------
+my-asp my-ass ASP_DOWN m3ua sg server (127.0.0.200|127.0.0.201):12345
ss7_asp_vty_test(config)# do show cs7 instance 0 as all
Routing Routing Key Cic Cic Traffic
@@ -423,9 +423,9 @@
ss7_asp_vty_test(config-cs7)# no asp my-asp
ss7_asp_vty_test(config-cs7)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role Remote IPaddr & Port SCTP Role
------------- ------------ ------------- ---- ---- ----------------------- ---------
+ Current Primary Link
+ASP Name AS Name State Type Role SCTP Role Remote Addresses
+------------ ------------ ------------- ---- ---- --------- -----------------------
ss7_asp_vty_test(config-cs7)# do show cs7 instance 0 as all
Routing Routing Key Cic Cic Traffic
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/35253?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I4854219f8898266ae47b9117ef79dbad30a5b0fd
Gerrit-Change-Number: 35253
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/35274?usp=email )
Change subject: vty: show cs7 instance asp: Print loc and rem addr retrieved from socket
......................................................................
vty: show cs7 instance asp: Print loc and rem addr retrieved from socket
Until now, we were in general printing the list of remote addresses that
were stored in config, because we didn't have an easy way to retrieve
the addresses from the socket. Since recently some libosmocore APIs make
that easy, so use them now.
If the socket is not yet created, then log the addrress list from the config.
Furthermore, take the chance to print now both local and remote
addresses.
Related: SYS#6636
Change-Id: I607e4c2dd37f07bf1c07c88681918184e92202ea
---
M src/osmo_ss7_asp.c
M src/osmo_ss7_vty.c
M src/ss7_internal.h
M tests/vty/ss7_asp_test.vty
4 files changed, 104 insertions(+), 46 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
osmith: Looks good to me, but someone else must approve
diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c
index 55e5a29..f867ce5 100644
--- a/src/osmo_ss7_asp.c
+++ b/src/osmo_ss7_asp.c
@@ -1134,3 +1134,19 @@
{
return asp->cfg.proto;
}
+
+/*! \brief Get the fd of a given ASP
+ * \param[in] asp The ASP for which the fd is requested
+ * \returns The fd of the ASP if acailable, negative otherwise
+ */
+int ss7_asp_get_fd(const struct osmo_ss7_asp *asp)
+{
+ if (asp->cfg.is_server) {
+ if (asp->server)
+ return osmo_stream_srv_get_fd(asp->server);
+ } else {
+ if (asp->client)
+ return osmo_stream_cli_get_fd(asp->client);
+ }
+ return -1;
+}
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 39d5b3b..7350c13 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -1133,13 +1133,39 @@
return buf;
}
+/* Similar to osmo_sock_multiaddr_get_name_buf(), but aimed at listening sockets (only local part): */
+static char *get_sockname_buf(char *buf, size_t buf_len, int fd, int proto, bool local)
+{
+ char hostbuf[OSMO_SOCK_MAX_ADDRS][INET6_ADDRSTRLEN];
+ size_t num_hostbuf = ARRAY_SIZE(hostbuf);
+ char portbuf[6];
+ struct osmo_strbuf sb = { .buf = buf, .len = buf_len };
+ bool need_more_bufs;
+ int rc;
+
+ rc = osmo_sock_multiaddr_get_ip_and_port(fd, proto, &hostbuf[0][0],
+ &num_hostbuf, sizeof(hostbuf[0]),
+ portbuf, sizeof(portbuf), local);
+ if (rc < 0)
+ return NULL;
+
+ need_more_bufs = num_hostbuf > ARRAY_SIZE(hostbuf);
+ if (need_more_bufs)
+ num_hostbuf = ARRAY_SIZE(hostbuf);
+ OSMO_STRBUF_APPEND(sb, osmo_multiaddr_ip_and_port_snprintf,
+ &hostbuf[0][0], num_hostbuf, sizeof(hostbuf[0]), portbuf);
+ if (need_more_bufs)
+ OSMO_STRBUF_PRINTF(sb, "<need-more-bufs!>");
+
+ return buf;
+}
+
DEFUN(show_cs7_asp, show_cs7_asp_cmd,
"show cs7 instance <0-15> asp",
SHOW_STR CS7_STR INST_STR INST_STR "Application Server Process (ASP)\n")
{
struct osmo_ss7_instance *inst;
struct osmo_ss7_asp *asp;
- char buf[512];
char as_buf[64];
int id = atoi(argv[0]);
@@ -1149,28 +1175,32 @@
return CMD_WARNING;
}
- vty_out(vty, " Current Primary Link%s", VTY_NEWLINE);
- vty_out(vty, "ASP Name AS Name State Type Role SCTP Role Remote Addresses%s", VTY_NEWLINE);
- vty_out(vty, "------------ ------------ ------------- ---- ---- --------- -----------------------%s", VTY_NEWLINE);
+ vty_out(vty, "ASP Name AS Name State Type Role SCTP Role Local Addresses Remote Addresses%s", VTY_NEWLINE);
+ vty_out(vty, "------------ ------------ ------------- ---- ---- --------- ----------------------- -----------------------%s", VTY_NEWLINE);
llist_for_each_entry(asp, &inst->asp_list, list) {
- if (asp->cfg.proto == OSMO_SS7_ASP_PROT_IPA && asp->cfg.remote.port == 0 && asp->server) {
- int fd = osmo_stream_srv_get_fd(asp->server);
- char hostbuf[64];
- char portbuf[16];
- osmo_sock_get_ip_and_port(fd, hostbuf, sizeof(hostbuf),
- portbuf, sizeof(portbuf), false);
- snprintf(buf, sizeof(buf), "%s:%s", hostbuf, portbuf);
- } else
- osmo_ss7_asp_peer_snprintf(buf, sizeof(buf), &asp->cfg.remote);
- vty_out(vty, "%-12s %-12s %-13s %-4s %-4s %-9s %-23s%s",
+ char buf_loc[OSMO_SOCK_MULTIADDR_PEER_STR_MAXLEN];
+ char buf_rem[sizeof(buf_loc)];
+ int fd = ss7_asp_get_fd(asp);
+ if (fd > 0) {
+ int proto = ss7_asp_proto_to_ip_proto(asp->cfg.proto);
+ if (!get_sockname_buf(buf_loc, sizeof(buf_loc), fd, proto, true))
+ OSMO_STRLCPY_ARRAY(buf_loc, "<sockname-error>");
+ if (!get_sockname_buf(buf_rem, sizeof(buf_rem), fd, proto, false))
+ OSMO_STRLCPY_ARRAY(buf_rem, "<sockname-error>");
+ } else {
+ osmo_ss7_asp_peer_snprintf(buf_loc, sizeof(buf_loc), &asp->cfg.local);
+ osmo_ss7_asp_peer_snprintf(buf_rem, sizeof(buf_rem), &asp->cfg.remote);
+ }
+
+ vty_out(vty, "%-12s %-12s %-13s %-4s %-4s %-9s %-23s %-23s%s",
asp->cfg.name,
as_list_for_asp(asp, as_buf, sizeof(as_buf)),
asp->fi? osmo_fsm_inst_state_name(asp->fi) : "uninitialized",
get_value_string(osmo_ss7_asp_protocol_vals, asp->cfg.proto),
osmo_str_tolower(get_value_string(osmo_ss7_asp_role_names, asp->cfg.role)),
asp->cfg.is_server ? "server" : "client",
- buf,
+ buf_loc, buf_rem,
VTY_NEWLINE);
}
return CMD_SUCCESS;
diff --git a/src/ss7_internal.h b/src/ss7_internal.h
index e2d78d8..fd01ca4 100644
--- a/src/ss7_internal.h
+++ b/src/ss7_internal.h
@@ -19,6 +19,7 @@
enum osmo_ss7_asp_protocol proto);
bool ss7_asp_set_default_peer_hosts(struct osmo_ss7_asp *asp);
bool ss7_asp_is_started(const struct osmo_ss7_asp *asp);
+int ss7_asp_get_fd(const struct osmo_ss7_asp *asp);
struct osmo_ss7_asp *ss7_asp_find_by_socket_addr(int fd);
int ss7_asp_proto_to_ip_proto(enum osmo_ss7_asp_protocol proto);
diff --git a/tests/vty/ss7_asp_test.vty b/tests/vty/ss7_asp_test.vty
index 73a13b5..a767552 100644
--- a/tests/vty/ss7_asp_test.vty
+++ b/tests/vty/ss7_asp_test.vty
@@ -256,27 +256,24 @@
ss7_asp_vty_test(config-cs7-asp)# remote-ip 127.0.0.200
ss7_asp_vty_test(config-cs7-asp)# local-ip 127.0.0.100
ss7_asp_vty_test(config-cs7-asp)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role SCTP Role Remote Addresses
------------- ------------ ------------- ---- ---- --------- -----------------------
-my-asp ? uninitialized m3ua sg server 127.0.0.200:12345
+ASP Name AS Name State Type Role SCTP Role Local Addresses Remote Addresses
+------------ ------------ ------------- ---- ---- --------- ----------------------- -----------------------
+my-asp ? uninitialized m3ua sg server 127.0.0.100:54321 127.0.0.200:12345
ss7_asp_vty_test(config-cs7-asp)# remote-ip 127.0.0.201
ss7_asp_vty_test(config-cs7-asp)# local-ip 127.0.0.101
ss7_asp_vty_test(config-cs7-asp)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role SCTP Role Remote Addresses
------------- ------------ ------------- ---- ---- --------- -----------------------
-my-asp ? uninitialized m3ua sg server (127.0.0.200|127.0.0.201):12345
+ASP Name AS Name State Type Role SCTP Role Local Addresses Remote Addresses
+------------ ------------ ------------- ---- ---- --------- ----------------------- -----------------------
+my-asp ? uninitialized m3ua sg server (127.0.0.100|127.0.0.101):54321 (127.0.0.200|127.0.0.201):12345
ss7_asp_vty_test(config-cs7-asp)# ! Mark as primary:
ss7_asp_vty_test(config-cs7-asp)# remote-ip 127.0.0.201 primary
ss7_asp_vty_test(config-cs7-asp)# ! 'local-ip 127.0.0.101 primary' cannot be tested here since output may be different based on sysctl available
ss7_asp_vty_test(config-cs7-asp)# local-ip 127.0.0.101
...
ss7_asp_vty_test(config-cs7-asp)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role SCTP Role Remote Addresses
------------- ------------ ------------- ---- ---- --------- -----------------------
-my-asp ? uninitialized m3ua sg server (127.0.0.200|127.0.0.201*):12345
+ASP Name AS Name State Type Role SCTP Role Local Addresses Remote Addresses
+------------ ------------ ------------- ---- ---- --------- ----------------------- -----------------------
+my-asp ? uninitialized m3ua sg server (127.0.0.100|127.0.0.101):54321 (127.0.0.200|127.0.0.201*):12345
ss7_asp_vty_test(config-cs7-asp)# show running-config
...
local-ip 127.0.0.100
@@ -289,10 +286,9 @@
ss7_asp_vty_test(config-cs7-asp)# remote-ip 127.0.0.201
ss7_asp_vty_test(config-cs7-asp)# local-ip 127.0.0.101
ss7_asp_vty_test(config-cs7-asp)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role SCTP Role Remote Addresses
------------- ------------ ------------- ---- ---- --------- -----------------------
-my-asp ? uninitialized m3ua sg server (127.0.0.200|127.0.0.201):12345
+ASP Name AS Name State Type Role SCTP Role Local Addresses Remote Addresses
+------------ ------------ ------------- ---- ---- --------- ----------------------- -----------------------
+my-asp ? uninitialized m3ua sg server (127.0.0.100|127.0.0.101):54321 (127.0.0.200|127.0.0.201):12345
ss7_asp_vty_test(config-cs7-asp)# show running-config
...
local-ip 127.0.0.100
@@ -361,26 +357,23 @@
ss7_asp_vty_test(config-cs7-as)# routing-key 0 3.2.1
ss7_asp_vty_test(config-cs7-as)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role SCTP Role Remote Addresses
------------- ------------ ------------- ---- ---- --------- -----------------------
-my-asp my-ass ASP_DOWN m3ua sg server (127.0.0.200|127.0.0.201):12345
+ASP Name AS Name State Type Role SCTP Role Local Addresses Remote Addresses
+------------ ------------ ------------- ---- ---- --------- ----------------------- -----------------------
+my-asp my-ass ASP_DOWN m3ua sg server (127.0.0.100|127.0.0.101):54321 (127.0.0.200|127.0.0.201):12345
ss7_asp_vty_test(config-cs7-as)# exit
ss7_asp_vty_test(config-cs7)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role SCTP Role Remote Addresses
------------- ------------ ------------- ---- ---- --------- -----------------------
-my-asp my-ass ASP_DOWN m3ua sg server (127.0.0.200|127.0.0.201):12345
+ASP Name AS Name State Type Role SCTP Role Local Addresses Remote Addresses
+------------ ------------ ------------- ---- ---- --------- ----------------------- -----------------------
+my-asp my-ass ASP_DOWN m3ua sg server (127.0.0.100|127.0.0.101):54321 (127.0.0.200|127.0.0.201):12345
ss7_asp_vty_test(config-cs7)# exit
ss7_asp_vty_test(config)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role SCTP Role Remote Addresses
------------- ------------ ------------- ---- ---- --------- -----------------------
-my-asp my-ass ASP_DOWN m3ua sg server (127.0.0.200|127.0.0.201):12345
+ASP Name AS Name State Type Role SCTP Role Local Addresses Remote Addresses
+------------ ------------ ------------- ---- ---- --------- ----------------------- -----------------------
+my-asp my-ass ASP_DOWN m3ua sg server (127.0.0.100|127.0.0.101):54321 (127.0.0.200|127.0.0.201):12345
ss7_asp_vty_test(config)# do show cs7 instance 0 as all
Routing Routing Key Cic Cic Traffic
@@ -423,9 +416,8 @@
ss7_asp_vty_test(config-cs7)# no asp my-asp
ss7_asp_vty_test(config-cs7)# do show cs7 instance 0 asp
- Current Primary Link
-ASP Name AS Name State Type Role SCTP Role Remote Addresses
------------- ------------ ------------- ---- ---- --------- -----------------------
+ASP Name AS Name State Type Role SCTP Role Local Addresses Remote Addresses
+------------ ------------ ------------- ---- ---- --------- ----------------------- -----------------------
ss7_asp_vty_test(config-cs7)# do show cs7 instance 0 as all
Routing Routing Key Cic Cic Traffic
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/35274?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I607e4c2dd37f07bf1c07c88681918184e92202ea
Gerrit-Change-Number: 35274
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: merged