laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-cbc/+/40736?usp=email )
Change subject: sbcap: Listen on (127.0.0.1|::1) by default
......................................................................
sbcap: Listen on (127.0.0.1|::1) by default
Follow what's described in the User Manual:
"The default is to bind to the 3GPP standard port number 29168 for
SBc-AP at the loopback IP address 127.0.0.1 and ::1."
Change-Id: I6cb1c7031c09469e7b7c29a0733e99faea9f6615
---
M src/cbc_data.c
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
diff --git a/src/cbc_data.c b/src/cbc_data.c
index a9c2c9e..16efc88 100644
--- a/src/cbc_data.c
+++ b/src/cbc_data.c
@@ -112,7 +112,8 @@
return;
g_cbc->config.sbcap.local_host[0] = talloc_strdup(g_cbc, "127.0.0.1");
- g_cbc->config.sbcap.num_local_host = 1;
+ g_cbc->config.sbcap.local_host[1] = talloc_strdup(g_cbc, "::1");
+ g_cbc->config.sbcap.num_local_host = 2;
}
int cbc_start(struct cbc *cbc)
--
To view, visit https://gerrit.osmocom.org/c/osmo-cbc/+/40736?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: I6cb1c7031c09469e7b7c29a0733e99faea9f6615
Gerrit-Change-Number: 40736
Gerrit-PatchSet: 1
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>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-cbc/+/40735?usp=email )
Change subject: Set default SBcAP local host when no VTY cfg sbcap node provided
......................................................................
Set default SBcAP local host when no VTY cfg sbcap node provided
During 7fbd6aa472b011876894949b8a9a6c2784473451 a "configured" flag was
introduced which could be used to make sure the SBcAP node was
configured before "peer" node, which made sure the local IP address was
set before triggering connect() in client mode.
However, the patch didn't account for the possibility that a user may
use a config file with no "sbcap" node at all, which hence ends up with
no local address being configured and opening the listen server SBcAP
socket will fail.
Related: OS#6814
Change-Id: I48eb465fecbeebd7cd8eafb17908ba0439bb9e50
---
M include/osmocom/cbc/cbc_data.h
M src/cbc_data.c
M src/cbc_main.c
3 files changed, 21 insertions(+), 5 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/osmocom/cbc/cbc_data.h b/include/osmocom/cbc/cbc_data.h
index d5e5cde..9040b99 100644
--- a/include/osmocom/cbc/cbc_data.h
+++ b/include/osmocom/cbc/cbc_data.h
@@ -89,6 +89,7 @@
extern struct cbc *g_cbc;
struct cbc *cbc_alloc(void *ctx);
int cbc_start(struct cbc *cbc);
+void cbc_add_sbcap_default_local_host_if_needed(struct cbc *cbc);
/* rest_api.c */
int rest_api_init(void *ctx, const char *bind_addr, uint16_t port);
diff --git a/src/cbc_data.c b/src/cbc_data.c
index 3029ffc..a9c2c9e 100644
--- a/src/cbc_data.c
+++ b/src/cbc_data.c
@@ -85,7 +85,9 @@
INIT_LLIST_HEAD(&cbc->expired_messages);
cbc->config.cbsp.local_host = talloc_strdup(cbc, "127.0.0.1");
cbc->config.cbsp.local_port = CBSP_TCP_PORT;
- /* cbc->config.sbcap local_host set up during VTY (and vty_go_parent) */
+ /* Due to SCTP multi-home support, cbc->config.sbcap.local_host is not set here,
+ * but through VTY (user or vty_go_parent()), or if not set default is set after
+ * VTY cfg read, during cbc_start(). */
cbc->config.sbcap.local_port = SBcAP_SCTP_PORT;
cbc->config.ecbe.local_host = talloc_strdup(cbc, "127.0.0.1");
cbc->config.ecbe.local_port = 12345;
@@ -103,6 +105,16 @@
return cbc;
}
+/* If no local addr set, add a default one: */
+void cbc_add_sbcap_default_local_host_if_needed(struct cbc *cbc)
+{
+ if (g_cbc->config.sbcap.num_local_host > 0)
+ return;
+
+ g_cbc->config.sbcap.local_host[0] = talloc_strdup(g_cbc, "127.0.0.1");
+ g_cbc->config.sbcap.num_local_host = 1;
+}
+
int cbc_start(struct cbc *cbc)
{
void *tall_rest_ctx;
@@ -115,6 +127,12 @@
return rc;
}
+ /* User didn't configure an SBcAP node with a local address, use default: */
+ if (!cbc->config.sbcap.configured) {
+ cbc_add_sbcap_default_local_host_if_needed(cbc);
+ cbc->config.sbcap.configured = true;
+ }
+
if ((rc = cbc_sbcap_mgr_open_srv(cbc->sbcap.mgr)) < 0) {
LOGP(DMAIN, LOGL_ERROR, "Error binding SBc-AP port\n");
return rc;
diff --git a/src/cbc_main.c b/src/cbc_main.c
index 2de8c72..d34546d 100644
--- a/src/cbc_main.c
+++ b/src/cbc_main.c
@@ -113,10 +113,7 @@
break;
case SBcAP_NODE:
/* If no local addr set, add a default one: */
- if (g_cbc->config.sbcap.num_local_host == 0) {
- g_cbc->config.sbcap.local_host[0] = talloc_strdup(g_cbc, "127.0.0.1");
- g_cbc->config.sbcap.num_local_host = 1;
- }
+ cbc_add_sbcap_default_local_host_if_needed(g_cbc);
g_cbc->config.sbcap.configured = true;
vty->node = CONFIG_NODE;
vty->index = NULL;
--
To view, visit https://gerrit.osmocom.org/c/osmo-cbc/+/40735?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: I48eb465fecbeebd7cd8eafb17908ba0439bb9e50
Gerrit-Change-Number: 40735
Gerrit-PatchSet: 1
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>
Attention is currently required from: pespin.
laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-cbc/+/40735?usp=email )
Change subject: Set default SBcAP local host when no VTY cfg sbcap node provided
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-cbc/+/40735?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: I48eb465fecbeebd7cd8eafb17908ba0439bb9e50
Gerrit-Change-Number: 40735
Gerrit-PatchSet: 1
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-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 23 Jul 2025 11:17:10 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: pespin.
laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-cbc/+/40735?usp=email )
Change subject: Set default SBcAP local host when no VTY cfg sbcap node provided
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-cbc/+/40735?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: I48eb465fecbeebd7cd8eafb17908ba0439bb9e50
Gerrit-Change-Number: 40735
Gerrit-PatchSet: 1
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-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 23 Jul 2025 11:17:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: jolly, pespin.
laforge has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40725?usp=email )
Change subject: Automatically increase io_uring, if too small.
......................................................................
Patch Set 2:
(6 comments)
File src/core/osmo_io_internal.h:
https://gerrit.osmocom.org/c/libosmocore/+/40725/comment/a53bcc51_10cebfac?… :
PS2, Line 110: void *read_ring[IOFD_MSGHDR_READ_SQES];
some comments here would be useful to explan what those fields are and how hey are used (not just the read_ring now, but also the previously-introduced read_msghdr, read_len, ...
Also: why are those pointers void? if it points to a ring, shouldn't it be 'struct io_uring *' for read_ring and write_ring?
File src/core/osmo_io_uring.c:
https://gerrit.osmocom.org/c/libosmocore/+/40725/comment/a0eb6d91_79685d7d?… :
PS2, Line 67: g_io_uring_queue
pleaes use a more descriptive name. The variable is not a qeuue, but it is the size of the ring. Something like g_io_uring_size or g_io_uring_num_entries would be more descriptive.
https://gerrit.osmocom.org/c/libosmocore/+/40725/comment/06962c19_78cb567d?… :
PS2, Line 113: OSMO_IO_URING_QUEUE
like the variable name in the code, the environment variable name shold be self-descriptive. Also, since it's the *initial* size, something like OSMO_IO_URING_INITIAL_{SIZE,NUM_ENTRIES} would make most sense.
Naming does matter...
https://gerrit.osmocom.org/c/libosmocore/+/40725/comment/76d8c11b_e4366e52?… :
PS2, Line 163: osmo_iofd_uring_get_sqe
the 'osmo_' prefix is reserverd for exported functions. You are adding a static function, it should not have an osmo_ prefix.
https://gerrit.osmocom.org/c/libosmocore/+/40725/comment/4b3570e8_75a14c96?… :
PS2, Line 172: LOGP(DLIO, LOGL_NOTICE, "io_uring too small to handle all SQEs, increasing size to %d.\n", g_io_uring_queue);
minor: while the current implementation alsways doubles the size, it might still be useful to print the old [too small] size?
https://gerrit.osmocom.org/c/libosmocore/+/40725/comment/40117db5_b6cf2823?… :
PS2, Line 175:
is there code to clean up the old ring after completion of the last cqe of the old ring?
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40725?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id9230146acc8d54bfd44834e783c31b37bd64bca
Gerrit-Change-Number: 40725
Gerrit-PatchSet: 2
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 23 Jul 2025 11:16:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: pespin.
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40493?usp=email )
Change subject: Add multiple messages buffers to io_uring write operations
......................................................................
Patch Set 7:
(5 comments)
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/40493/comment/38629ece_28e3e269?… :
PS4, Line 248: lh = iofd->tx_queue.msg_queue.prev;
> You added it to libosmocore but apparently not using it here?
I fogot to remove this function. I was already using llist_last_entry_or_null().
https://gerrit.osmocom.org/c/libosmocore/+/40493/comment/1d4d96d5_8c0d3497?… :
PS4, Line 444: /* Re-enqueue remaining buffers. */
> Here we should improve it by adding new msg from the tx_queue into the iov if we aren't yet doing it […]
Then we must change the way the tx_queue stores. Currently it stores msghdrs, but we would need to store msgbs. It makes this much more complex.
https://gerrit.osmocom.org/c/libosmocore/+/40493/comment/bfff97ec_18737813?… :
PS4, Line 465: iofd->io_ops.write_cb(iofd, (rc < 0) ? rc : chunk, msg);
> Again, by incorporation the negative value case into chunk variable, we can simplify all these lines […]
Done
https://gerrit.osmocom.org/c/libosmocore/+/40493/comment/d0e4fd57_ed6a5e70?… :
PS4, Line 479: msgb_free(msghdr->msg[idx]);
> msghdr->msg[idx] = NULL;
Done
https://gerrit.osmocom.org/c/libosmocore/+/40493/comment/6e737520_f1bf4096?… :
PS4, Line 517: msghdr = iofd_txqueue_tail(iofd);
> Not done, not answered, no comment explaining in code.
I wrote it abovethe function call llist_last_entry_or_null().
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40493?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8c4e0a785cf66becd7fb5b2caf718c9724b56686
Gerrit-Change-Number: 40493
Gerrit-PatchSet: 7
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 23 Jul 2025 10:46:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: jolly <andreas(a)eversberg.eu>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge, pespin.
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40491?usp=email )
Change subject: Add multiple messages buffers to struct iofd_msghdr
......................................................................
Patch Set 6:
(2 comments)
File src/core/osmo_io_internal.h:
https://gerrit.osmocom.org/c/libosmocore/+/40491/comment/7e36cd82_3a36aa3c?… :
PS5, Line 143: int io_len;
> I wonder whether this is needed or can be inferred when needed by looking up NULL ptrs in "msg" fiel […]
Without it, we would have extra loops. I want to avoid that. Alternatively we could use a list of msgb+iovec in an extra structure. This would make it much more complex.
File src/core/osmo_io_internal.h:
https://gerrit.osmocom.org/c/libosmocore/+/40491/comment/5b827776_3017afd8?… :
PS3, Line 140: int msg_max;
> This should definetly be configurable over API per osmo_iofd object. […]
Done
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40491?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4fb1067de4615cc22cc6caf99b481491e7f2ef92
Gerrit-Change-Number: 40491
Gerrit-PatchSet: 6
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 23 Jul 2025 10:46:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: jolly <andreas(a)eversberg.eu>
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge, pespin.
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40584?usp=email )
Change subject: Avoid reusing pending buffer; append incoming data instead
......................................................................
Patch Set 4:
(5 comments)
Commit Message:
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/ff2050e4_17cbe464?… :
PS3, Line 17: This change ensures that newly received data is appended to the existing
> First you say we don't want to reuse the pending buffer, but here you say "This change ensures that […]
Maybe I should state that I don't want to reuse the pending buffer for the read operation. Instead I copy from the buffer that was used for the read operation to the pending buffer.
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/2b7b3610_96fc97ba?… :
PS3, Line 177: /*! convenience wrapper to call msgb_alloc with parameters from osmo_io_fd (with extra size) */
> "with extra size" here doesn't apply anymore?
Done
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/d54ad17c_59b4ea84?… :
PS3, Line 178: struct msgb *iofd_msgb_alloc2(struct osmo_io_fd *iofd, size_t size)
> This is probably breaking the promise that msgb passed to the app are at least of a certain size con […]
In case the pending buffer is used, the size may be larger, but never smaller. I don't see any problem with that. It happens when reading/receiing. The application should only care about the length of data in the buffer not the size.
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/3ca7bf60_cd0f8648?… :
PS3, Line 335: * If the pending message is not large enough, create a larger message. */
> I may be wrong, but I'd expect user to configure iofd with a max_size big enough to allow whatever s […]
Imagine the pending buffer is almost full. Now we read extra data that is larger than the remaining space of the pending buffer. In order to merge them, a larger buffer is needed.
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/f6d10647_ee937061?… :
PS3, Line 344: memcpy(msgb_put(iofd->pending, msgb_length(msg)), msgb_data(msg), msgb_length(msg));
> Can we avoid 2 memcpys (here and above) in the specific code path?
How? The fist memcopy is used, if the pending buffer must be enlarged. The second memcopy will append the newly received data to the pending buffer.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40584?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I08df9736ccc5e9a7df61ca6dcf94629ee010752f
Gerrit-Change-Number: 40584
Gerrit-PatchSet: 4
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 23 Jul 2025 10:46:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge, pespin.
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40489?usp=email )
Change subject: Allow io_uring_submit batching just ahead of poll/select
......................................................................
Patch Set 4:
(4 comments)
Patchset:
PS3:
> I'm still not convinced we want to add more envvars. […]
Right now I use the envvars for running TTCN3 tests with different io_uring features. It makes it easier to compare.
File src/core/osmo_io_uring.c:
https://gerrit.osmocom.org/c/libosmocore/+/40489/comment/889cdea7_e7f90d3f?… :
PS2, Line 186: if (!g_io_uring_batch)
> maybe use the OSMO_LIKELY macro for branch prediction optimizaton, as we assume the default is the c […]
Done
https://gerrit.osmocom.org/c/libosmocore/+/40489/comment/afbdc520_829fc90e?… :
PS2, Line 329: if (!g_io_uring_batch)
> same here and further below
Done
File src/core/select.c:
https://gerrit.osmocom.org/c/libosmocore/+/40489/comment/a9058573_f6aff482?… :
PS3, Line 440: osmo_io_uring_submit();
> I'd say it makes more sense to have the OSMO_UNLIKELY if here directly, to avoid an extra call+ret o […]
Done
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40489?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id34fe2ced32c63d15b14810e145744f7509064cc
Gerrit-Change-Number: 40489
Gerrit-PatchSet: 4
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 23 Jul 2025 10:46:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>