[S] Change in libosmo-sccp[master]: vty: Retrieve IP addr set from sk when dumping xUA server

2023-12-12 Thread pespin
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   whatdescription / 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), >cfg.local) < 0)
-   snprintf(buf, sizeof(buf), "");
-   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), 
>cfg.local) < 0)
+   snprintf(buf, sizeof(buf), "");
+   } 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),
+[0][0], 
_hostbuf, sizeof(hostbuf[0]),
+portbuf, 
sizeof(portbuf), true);
+   if (rc < 0) {
+   snprintf(buf, sizeof(buf), "");
+   } else {
+   if (num_hostbuf > ARRAY_SIZE(hostbuf))
+   num_hostbuf = ARRAY_SIZE(hostbuf);
+   osmo_multiaddr_ip_and_port_snprintf(buf, sizeof(buf),
+   [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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


[S] Change in libosmo-sccp[master]: vty: Retrieve IP addr set from sk when dumping xUA server

2023-12-12 Thread pespin
Attention is currently required from: fixeria, laforge.

pespin has posted comments on 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
..


Patch Set 3: Code-Review+2


--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Attention: laforge 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Tue, 12 Dec 2023 15:25:04 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[S] Change in libosmo-sccp[master]: vty: Retrieve IP addr set from sk when dumping xUA server

2023-12-12 Thread osmith
Attention is currently required from: fixeria, laforge, pespin.

osmith has posted comments on 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
..


Patch Set 3: Code-Review+1

(1 comment)

File src/osmo_ss7_vty.c:

https://gerrit.osmocom.org/c/libosmo-sccp/+/35242/comment/3bd4cb52_78a7e750
PS2, Line 632:  num_hostbuf = ARRAY_SIZE(hostbuf);
> Because in libosmocore I'm already using a strbuf and it was easy. […]
Ack



--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Attention: laforge 
Gerrit-Attention: pespin 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Tue, 12 Dec 2023 15:23:15 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: osmith 
Comment-In-Reply-To: pespin 
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


[S] Change in libosmo-sccp[master]: vty: Retrieve IP addr set from sk when dumping xUA server

2023-12-12 Thread pespin
Attention is currently required from: fixeria, laforge, osmith.

Hello Jenkins Builder, fixeria, laforge, osmith,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/libosmo-sccp/+/35242?usp=email

to look at the new patch set (#3).

The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder


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(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/42/35242/3
--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Attention: osmith 
Gerrit-Attention: laforge 
Gerrit-Attention: fixeria 
Gerrit-MessageType: newpatchset


[S] Change in libosmo-sccp[master]: vty: Retrieve IP addr set from sk when dumping xUA server

2023-12-12 Thread pespin
Attention is currently required from: fixeria, laforge, osmith.

pespin has posted comments on 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
..


Patch Set 2:

(3 comments)

File src/osmo_ss7_vty.c:

https://gerrit.osmocom.org/c/libosmo-sccp/+/35242/comment/fe80e270_327033cf
PS2, Line 613:  char buf[OSMO_SOCK_MAX_ADDRS * INET6_ADDRSTRLEN + 
OSMO_SOCK_MAX_ADDRS + 2 + 6 + 1];
> maybe put it into a define? see also https://gerrit.osmocom. […]
Done


https://gerrit.osmocom.org/c/libosmo-sccp/+/35242/comment/2ac1d177_4ddbc071
PS2, Line 629: 
> May we let the VTY user know a bit more than:

I really expect this to never happen, because it's only going over here if the 
fd is set. If unset, the ips are printed from config. So this is only some hint 
to look at something really weird happening internally. It shouldn't happen.

> May we let the VTY user know a bit more than:

I can print some UTF flower emojis too if you want. But probably not worth the 
effort given that we have APIs already printing stuff in a "standard" or usual 
way.


https://gerrit.osmocom.org/c/libosmo-sccp/+/35242/comment/f538093a_877e8769
PS2, Line 632:  num_hostbuf = ARRAY_SIZE(hostbuf);
> From the user perspective, it would be more practical to see those which fit 
> into the buffer, and so […]
Because in libosmocore I'm already using a strbuf and it was easy. In here I'd 
need to do complex snprintf sutff or change to a strbuf.

This is all really hypotetical cases which I don't expect to happen in general, 
I think our time is better spent here on other things. The socket won't have 
more than 32 addresses because to start with internally we limit to it during 
osmo_sockaddr_multiaddr_init2(), and iirc the kernel sctp stack also limits it 
to 32.

If someone ever really gets into that, I bet we can then and only then spend 
time fixing this kind of stuff.



--
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: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Attention: osmith 
Gerrit-Attention: laforge 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Tue, 12 Dec 2023 15:04:07 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith 
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


[S] Change in libosmo-sccp[master]: vty: Retrieve IP addr set from sk when dumping xUA server

2023-12-12 Thread fixeria
Attention is currently required from: laforge, osmith, pespin.

fixeria has posted comments on 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
..


Patch Set 2:

(3 comments)

Commit Message:

https://gerrit.osmocom.org/c/libosmo-sccp/+/35242/comment/54aa6804_87285fe5
PS2, Line 14: osmo_stream_srv_link_get_sockname
`` ;)


File src/osmo_ss7_vty.c:

https://gerrit.osmocom.org/c/libosmo-sccp/+/35242/comment/ae48497c_8fa25d68
PS2, Line 629: 
May we let the VTY user know a bit more than:

```
xUA server for %s on  is listening
```

Maybe be more verbose and print an error message here?

Alternatively, we can rephrase a bit and print each address on new line maybe?

```
xUA server for %s is listening on:
  ADDR:PORT
  ADDR:PORT
  ADDR:PORT
  (+N addresses more)

xUA server for %s is listening on:
  (could not retrieve listening address(es) due to an error)
```


https://gerrit.osmocom.org/c/libosmo-sccp/+/35242/comment/94f53d63_9413d8da
PS2, Line 632:  num_hostbuf = ARRAY_SIZE(hostbuf);
> in https://gerrit.osmocom. […]
>From the user perspective, it would be more practical to see those which fit 
>into the buffer, and some error message like `(+N addresses more)...`.



--
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: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Attention: osmith 
Gerrit-Attention: laforge 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Tue, 12 Dec 2023 14:01:31 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith 
Gerrit-MessageType: comment


[S] Change in libosmo-sccp[master]: vty: Retrieve IP addr set from sk when dumping xUA server

2023-12-12 Thread osmith
Attention is currently required from: fixeria, laforge, pespin.

osmith has posted comments on 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
..


Patch Set 2:

(2 comments)

File src/osmo_ss7_vty.c:

https://gerrit.osmocom.org/c/libosmo-sccp/+/35242/comment/086979e2_84eb283b
PS2, Line 613:  char buf[OSMO_SOCK_MAX_ADDRS * INET6_ADDRSTRLEN + 
OSMO_SOCK_MAX_ADDRS + 2 + 6 + 1];
maybe put it into a define? see also 
https://gerrit.osmocom.org/c/libosmo-netif/+/35287/comment/82dc01d3_b7055e6e/


https://gerrit.osmocom.org/c/libosmo-sccp/+/35242/comment/0f9dbc2a_d3925ddf
PS2, Line 632:  num_hostbuf = ARRAY_SIZE(hostbuf);
in https://gerrit.osmocom.org/c/libosmocore/+/35180 you print  
in that case, why not here too?



--
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: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Attention: laforge 
Gerrit-Attention: pespin 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Tue, 12 Dec 2023 12:30:30 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


[S] Change in libosmo-sccp[master]: vty: Retrieve IP addr set from sk when dumping xUA server

2023-12-06 Thread pespin
pespin has uploaded this change for review. ( 
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 osmo_stream_srv_link_get_sockname()
Depends: libosmocore.git Change-Id I48950754ed6f61ee5ffa04a447fab8903f10acc0
Related: SYS#6636
Change-Id: I331b6e2fe11cd97e286b7ba684d4a17b8055f9d4
---
M TODO-RELEASE
M src/osmo_ss7_vty.c
2 files changed, 44 insertions(+), 4 deletions(-)



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

diff --git a/TODO-RELEASE b/TODO-RELEASE
index 1e4c41a..2b15a91 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -9,3 +9,4 @@
 #library   whatdescription / 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..6ab2401 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_MAX_ADDRS * INET6_ADDRSTRLEN + OSMO_SOCK_MAX_ADDRS + 
2 + 6 + 1];
const char *proto = get_value_string(osmo_ss7_asp_protocol_vals, 
xs->cfg.proto);
-   if (osmo_ss7_asp_peer_snprintf(buf, sizeof(buf), >cfg.local) < 0)
-   snprintf(buf, sizeof(buf), "");
-   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), 
>cfg.local) < 0)
+   snprintf(buf, sizeof(buf), "");
+   } 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),
+[0][0], 
_hostbuf, sizeof(hostbuf[0]),
+portbuf, 
sizeof(portbuf), true);
+   if (rc < 0) {
+   snprintf(buf, sizeof(buf), "");
+   } else {
+   if (num_hostbuf > ARRAY_SIZE(hostbuf))
+   num_hostbuf = ARRAY_SIZE(hostbuf);
+   osmo_multiaddr_ip_and_port_snprintf(buf, sizeof(buf),
+   [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: 1
Gerrit-Owner: pespin 
Gerrit-MessageType: newchange