Hello Jenkins Builder, fixeria, daniel,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmo-sccp/+/33335
to look at the new patch set (#9).
Change subject: Set stream_cli/srv name to contain ASP + sockname
......................................................................
Set stream_cli/srv name to contain ASP + sockname
Upon connect/accept, update the name to contain both the ASP and the
sockname of the established socked. This allows easily identifying the
stream based on IP layer as well as upper xUA layer.
Example logs:
"""
stream.c:1193 SRV(m3ua,::1:2905) accept()ed new link from ::1 to port 2905
stream.c:1672 SRVCONN(asp-dyn-0,(r=::1:43568<->l=::1:2905)) connected read/write (what=0x1)
stream.c:1589 SRVCONN(asp-dyn-0,(r=::1:43568<->l=::1:2905)) message received
"""
"""
stream.c:521 CLICONN(asp0){CONNECTING} connection established
stream.c:552 CLICONN(asp0,(r=::1:2905<->l=::ffff:127.0.0.2:35911)){CONNECTED} connected read
stream.c:401 CLICONN(asp0,(r=::1:2905<->l=::ffff:127.0.0.2:35911)){CONNECTED} message received
"""
Depends: libosmo-netif.git I539a0d29d11348efe702f971965a55cf56db5c59
Change-Id: I05bc5f6c7795f62c1814c1c774287b41ee85a475
---
M TODO-RELEASE
M src/osmo_ss7.c
2 files changed, 31 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/35/33335/9
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/33335
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I05bc5f6c7795f62c1814c1c774287b41ee85a475
Gerrit-Change-Number: 33335
Gerrit-PatchSet: 9
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newpatchset
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/33343 )
Change subject: stream: Drop name param from recently added API osmo_stream_srv_create2()
......................................................................
stream: Drop name param from recently added API osmo_stream_srv_create2()
It was later decided that since setting a name is not really required,
it is best to leave it out of the create() function and let the user use
the osmo_stream_srv_set_name() API if needed (otherwise a dynamic name
based on socket is selected)
Change-Id: I5d677ef57b7db0aedd8c43282568c845097cb12b
---
M examples/ipa-stream-server.c
M examples/stream-server.c
M include/osmocom/netif/stream.h
M src/stream.c
4 files changed, 21 insertions(+), 9 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/examples/ipa-stream-server.c b/examples/ipa-stream-server.c
index e490ff6..c72ed9a 100644
--- a/examples/ipa-stream-server.c
+++ b/examples/ipa-stream-server.c
@@ -75,12 +75,13 @@
return -1;
}
- conn = osmo_stream_srv_create2(tall_test, "ipa_srv", srv, fd, NULL);
+ conn = osmo_stream_srv_create2(tall_test, srv, fd, NULL);
if (conn == NULL) {
LOGP(DSTREAMTEST, LOGL_ERROR,
"error while creating connection\n");
return -1;
}
+ osmo_stream_srv_set_name(conn, "ipa_srv");
osmo_stream_srv_set_read_cb(conn, read_cb);
osmo_stream_srv_set_closed_cb(conn, close_cb);
diff --git a/examples/stream-server.c b/examples/stream-server.c
index d7c2aff..8aa8b9b 100644
--- a/examples/stream-server.c
+++ b/examples/stream-server.c
@@ -69,12 +69,13 @@
return -1;
}
- conn = osmo_stream_srv_create2(tall_test, "stream_server", srv, fd, NULL);
+ conn = osmo_stream_srv_create2(tall_test, srv, fd, NULL);
if (conn == NULL) {
LOGP(DSTREAMTEST, LOGL_ERROR,
"error while creating connection\n");
return -1;
}
+ osmo_stream_srv_set_name(conn, "stream_server");
osmo_stream_srv_set_read_cb(conn, read_cb);
osmo_stream_srv_set_closed_cb(conn, close_cb);
diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h
index c56b9a6..057815b 100644
--- a/include/osmocom/netif/stream.h
+++ b/include/osmocom/netif/stream.h
@@ -46,7 +46,7 @@
struct osmo_stream_srv;
struct osmo_stream_srv *osmo_stream_srv_create(void *ctx, struct osmo_stream_srv_link *link, int fd, int (*read_cb)(struct osmo_stream_srv *conn), int (*closed_cb)(struct osmo_stream_srv *conn), void *data);
-struct osmo_stream_srv *osmo_stream_srv_create2(void *ctx, const char *name, struct osmo_stream_srv_link *link, int fd, void *data);
+struct osmo_stream_srv *osmo_stream_srv_create2(void *ctx, struct osmo_stream_srv_link *link, int fd, void *data);
void osmo_stream_srv_set_name(struct osmo_stream_srv *conn, const char *name);
void osmo_stream_srv_set_read_cb(struct osmo_stream_srv *conn, int (*read_cb)(struct osmo_stream_srv *conn, struct msgb *msg));
void osmo_stream_srv_set_closed_cb(struct osmo_stream_srv *conn, int (*closed_cb)(struct osmo_stream_srv *conn));
diff --git a/src/stream.c b/src/stream.c
index 8771614..b646c3d 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1703,14 +1703,12 @@
/*! \brief Create a Stream Server inside the specified link
* \param[in] ctx talloc allocation context from which to allocate
- * \param[in] name name of the connection
* \param[in] link Stream Server Link to which we belong
* \param[in] fd system file descriptor of the new connection
* \param[in] data User data to save in the new Stream Server struct
* \returns Stream Server in case of success; NULL on error */
struct osmo_stream_srv *
-osmo_stream_srv_create2(void *ctx, const char *name,
- struct osmo_stream_srv_link *link, int fd, void *data)
+osmo_stream_srv_create2(void *ctx, struct osmo_stream_srv_link *link, int fd, void *data)
{
struct osmo_stream_srv *conn;
@@ -1723,11 +1721,9 @@
conn->mode = OSMO_STREAM_MODE_OSMO_IO;
conn->srv = link;
- if (name)
- conn->name = talloc_strdup(conn, name);
osmo_sock_get_name_buf(conn->sockname, sizeof(conn->sockname), fd);
- conn->iofd = osmo_iofd_setup(conn, fd, conn->name ? : conn->sockname,
+ conn->iofd = osmo_iofd_setup(conn, fd, conn->sockname,
OSMO_IO_FD_MODE_READ_WRITE, &srv_ioops, conn);
if (!conn->iofd) {
talloc_free(conn);
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33343
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I5d677ef57b7db0aedd8c43282568c845097cb12b
Gerrit-Change-Number: 33343
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/33342 )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: stream: Drop recently added API osmo_stream_cli_create2
......................................................................
stream: Drop recently added API osmo_stream_cli_create2
It was later decided that since setting a name is not really required,
it is best to leave it out of the create() function and let the user use
the osmo_stream_cli_set_name() API if needed (otherwise a dynamic name
based on socket is selected).
Change-Id: I2a2fad318ef22c2ac117f95588a078ca3beccea5
---
M examples/ipa-stream-client.c
M examples/stream-client.c
M include/osmocom/netif/stream.h
M src/stream.c
4 files changed, 37 insertions(+), 35 deletions(-)
Approvals:
daniel: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c
index 91abfac..b66d93a 100644
--- a/examples/ipa-stream-client.c
+++ b/examples/ipa-stream-client.c
@@ -164,11 +164,12 @@
* initialize stream client.
*/
- conn = osmo_stream_cli_create2(tall_test, "ipa_test_client");
+ conn = osmo_stream_cli_create(tall_test);
if (conn == NULL) {
fprintf(stderr, "cannot create client\n");
exit(EXIT_FAILURE);
}
+ osmo_stream_cli_set_name(conn, "ipa_test_client");
osmo_stream_cli_set_addr(conn, "127.0.0.1");
osmo_stream_cli_set_port(conn, 10000);
osmo_stream_cli_set_connect_cb(conn, connect_cb);
diff --git a/examples/stream-client.c b/examples/stream-client.c
index 350535d..6781c72 100644
--- a/examples/stream-client.c
+++ b/examples/stream-client.c
@@ -103,11 +103,12 @@
* initialize stream cli.
*/
- conn = osmo_stream_cli_create2(tall_test, "stream_client");
+ conn = osmo_stream_cli_create(tall_test);
if (conn == NULL) {
fprintf(stderr, "cannot create cli\n");
exit(EXIT_FAILURE);
}
+ osmo_stream_cli_set_name(conn, "stream_client");
osmo_stream_cli_set_addr(conn, "127.0.0.1");
osmo_stream_cli_set_port(conn, 10000);
osmo_stream_cli_set_connect_cb(conn, connect_cb);
diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h
index 11e9070..c56b9a6 100644
--- a/include/osmocom/netif/stream.h
+++ b/include/osmocom/netif/stream.h
@@ -90,7 +90,6 @@
bool osmo_stream_cli_is_connected(struct osmo_stream_cli *cli);
struct osmo_stream_cli *osmo_stream_cli_create(void *ctx);
-struct osmo_stream_cli *osmo_stream_cli_create2(void *ctx, const char *name);
void osmo_stream_cli_destroy(struct osmo_stream_cli *cli);
int osmo_stream_cli_open(struct osmo_stream_cli *cli);
diff --git a/src/stream.c b/src/stream.c
index a5a5bf1..8771614 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -576,7 +576,23 @@
*/
struct osmo_stream_cli *osmo_stream_cli_create(void *ctx)
{
- return osmo_stream_cli_create2(ctx, "");
+ struct osmo_stream_cli *cli;
+
+ cli = talloc_zero(ctx, struct osmo_stream_cli);
+ if (!cli)
+ return NULL;
+
+ cli->mode = OSMO_STREAM_MODE_UNKNOWN;
+ cli->sk_domain = AF_UNSPEC;
+ cli->sk_type = SOCK_STREAM;
+ cli->proto = IPPROTO_TCP;
+
+ cli->state = STREAM_CLI_STATE_CLOSED;
+ osmo_timer_setup(&cli->timer, cli_timer_cb, cli);
+ cli->reconnect_timeout = 5; /* default is 5 seconds. */
+ INIT_LLIST_HEAD(&cli->tx_queue);
+
+ return cli;
}
static void stream_cli_iofd_read_cb(struct osmo_io_fd *iofd, int res, struct msgb *msg)
@@ -624,35 +640,6 @@
.segmentation_cb = NULL,
};
-/*! \brief Create an Osmocom stream client
- * \param[in] ctx talloc context from which to allocate memory
- * This function allocates a new \ref osmo_stream_cli and initializes
- * it with default values (5s reconnect timer, TCP protocol)
- * \param[in] name a description of the stream client. Will be used in logging
- * \return allocated stream client, or NULL in case of error
- */
-struct osmo_stream_cli *osmo_stream_cli_create2(void *ctx, const char *name)
-{
- struct osmo_stream_cli *cli;
-
- cli = talloc_zero(ctx, struct osmo_stream_cli);
- if (!cli)
- return NULL;
-
- cli->name = talloc_strdup(cli, name);
- cli->mode = OSMO_STREAM_MODE_UNKNOWN;
- cli->sk_domain = AF_UNSPEC;
- cli->sk_type = SOCK_STREAM;
- cli->proto = IPPROTO_TCP;
-
- cli->state = STREAM_CLI_STATE_CLOSED;
- osmo_timer_setup(&cli->timer, cli_timer_cb, cli);
- cli->reconnect_timeout = 5; /* default is 5 seconds. */
- INIT_LLIST_HEAD(&cli->tx_queue);
-
- return cli;
-}
-
/*! \brief Set a name on the cli object (used during logging)
* \param[in] cli stream_cli whose name is to be set
* \param[in] name the name to be set on cli
@@ -875,7 +862,7 @@
}
/*! \brief Set the call-back function called to read from the stream client socket
- * Only for osmo_stream_cli created with osmo_stream_cli_create()
+ * This function will configure osmo_stream_cli to use osmo_ofd internally.
* \param[in] cli Stream Client to modify
* \param[in] read_cb Call-back function to be called when we want to read */
void
@@ -888,7 +875,7 @@
}
/*! \brief Set the call-back function called to read from the stream client socket
- * Only use this function for osmo_stream_cli created with osmo_stream_cli_create2()
+ * This function will configure osmo_stream_cli to use osmo_iofd internally.
* \param[in] cli Stream Client to modify
* \param[in] read_cb Call-back function to be called when data was read from the socket */
void
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33342
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I2a2fad318ef22c2ac117f95588a078ca3beccea5
Gerrit-Change-Number: 33342
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/33338 )
(
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: stream: srv cb: Use osmo_sockaddr and improve logging when cli connects
......................................................................
stream: srv cb: Use osmo_sockaddr and improve logging when cli connects
Specially important is the change where we now print the remote port
which connected to us, not our local port (which is already printed as
part of LOGSLNK).
Change-Id: I6e556f8263496ded41bb221ccc8e193c5361697f
---
M src/stream.c
1 file changed, 22 insertions(+), 18 deletions(-)
Approvals:
daniel: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/stream.c b/src/stream.c
index b646c3d..fdc1cc1 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1155,36 +1155,27 @@
{
int ret;
int sock_fd;
- char addrstr[128];
- bool is_ipv6 = false;
- struct sockaddr_storage sa;
- socklen_t sa_len = sizeof(sa);
+ struct osmo_sockaddr osa;
+ socklen_t sa_len = sizeof(osa.u.sas);
struct osmo_stream_srv_link *link = ofd->data;
- ret = accept(ofd->fd, (struct sockaddr *)&sa, &sa_len);
+ ret = accept(ofd->fd, &osa.u.sa, &sa_len);
if (ret < 0) {
- LOGP(DLINP, LOGL_ERROR, "failed to accept from origin "
- "peer, reason=`%s'\n", strerror(errno));
+ LOGP(DLINP, LOGL_ERROR, "failed to accept from origin peer, reason=`%s'\n",
+ strerror(errno));
return ret;
}
sock_fd = ret;
- is_ipv6 = false;
- switch (((struct sockaddr *)&sa)->sa_family) {
+ switch (osa.u.sa.sa_family) {
case AF_UNIX:
LOGSLNK(link, LOGL_DEBUG, "accept()ed new link on fd %d\n",
sock_fd);
break;
case AF_INET6:
- is_ipv6 = true;
- /* fall through */
case AF_INET:
- LOGSLNK(link, LOGL_DEBUG, "accept()ed new link from %s to port %u\n",
- inet_ntop(is_ipv6 ? AF_INET6 : AF_INET,
- is_ipv6 ? (void *)&(((struct sockaddr_in6 *)&sa)->sin6_addr) :
- (void *)&(((struct sockaddr_in *)&sa)->sin_addr),
- addrstr, sizeof(addrstr)),
- link->port);
+ LOGSLNK(link, LOGL_DEBUG, "accept()ed new link from %s\n",
+ osmo_sockaddr_to_str(&osa));
if (link->proto == IPPROTO_SCTP) {
ret = sctp_sock_activate_events(sock_fd);
@@ -1194,7 +1185,7 @@
break;
default:
LOGSLNK(link, LOGL_DEBUG, "accept()ed unexpected address family %d\n",
- ((struct sockaddr *)&sa)->sa_family);
+ osa.u.sa.sa_family);
goto error_close_socket;
}
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33338
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I6e556f8263496ded41bb221ccc8e193c5361697f
Gerrit-Change-Number: 33338
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/33337 )
Change subject: stream: Print socket info as part of the logging context
......................................................................
Patch Set 5: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33337
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I17ef699dab72c1b613708070d22e9f040b0fe069
Gerrit-Change-Number: 33337
Gerrit-PatchSet: 5
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(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-Comment-Date: Tue, 20 Jun 2023 17:51:09 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: dexter.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/33308 )
Change subject: mgcp-client: Add keepalive feature
......................................................................
Patch Set 6:
(1 comment)
Patchset:
PS6:
waiting to get another vote here to merge the whole feature.
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/33308
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I3dc74c78548d017f272da863d5282dc5e0020ca3
Gerrit-Change-Number: 33308
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 20 Jun 2023 17:50:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment