Attention is currently required from: laforge.
Hello Jenkins Builder, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/32318
to look at the new patch set (#2).
Change subject: {RAN,BSSAP_LE}_Adapter: Support M3UA without routing context
......................................................................
{RAN,BSSAP_LE}_Adapter: Support M3UA without routing context
The 3rd-party M3UA_Emulation supports operation both with and without
a routing context. Let's make sure the layers we build on top don't
loose that capability by forcing routing context usage.
Change-Id: Iff849953d923770c93029a6a5c5b86daa8c38f1e
---
M library/BSSAP_LE_Adapter.ttcn
M library/RAN_Adapter.ttcnpp
2 files changed, 29 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/18/32318/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/32318
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Iff849953d923770c93029a6a5c5b86daa8c38f1e
Gerrit-Change-Number: 32318
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newpatchset
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/32320 )
Change subject: sccp_scoc.c: fix infinite loop on conn ID exhaustion
......................................................................
Patch Set 1:
(1 comment)
File src/sccp_scoc.c:
https://gerrit.osmocom.org/c/libosmo-sccp/+/32320/comment/fa9c4504_b97b3fda
PS1, Line 589: 0
re above comment: 0 here means always iterate the entire connection ID number space.
For outbound SCCP connections, the caller can adjust the number of sane iterations, for inbound SCCP connections there is no way to do so yet.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/32320
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ib64e0cb1ae0cc8b7bebcb2a352d4068b496b304a
Gerrit-Change-Number: 32320
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Fri, 14 Apr 2023 23:43:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/32320 )
Change subject: sccp_scoc.c: fix infinite loop on conn ID exhaustion
......................................................................
Patch Set 1:
(1 comment)
Commit Message:
https://gerrit.osmocom.org/c/libosmo-sccp/+/32320/comment/2a4e333f_3cb54e64
PS1, Line 17: entire SCCP conn id number space before exiting in failure.
...which raises the question: should the max_iterations for inbound SCCP be configurable by the caller? The answer 'yes' would mean another patch following this one.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/32320
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ib64e0cb1ae0cc8b7bebcb2a352d4068b496b304a
Gerrit-Change-Number: 32320
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Fri, 14 Apr 2023 23:41:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/32321 )
Change subject: add public API: osmo_sccp_instance_next_conn_id()
......................................................................
add public API: osmo_sccp_instance_next_conn_id()
In struct osmo_sccp_instance, we have a next_id, to find an unused SCCP
connection ID. This is used for inbound SCCP connections.
At the same time, in each of our SCCP client programs, we have a
separate mechanism to find a connection ID for outbound connections.
See for example bsc_sccp.c: bsc_sccp_inst_next_conn_id()
It makes much more sense for callers to use the same
osmo_sccp_instance->next_id counter:
- Currently the inbound and outbound counters go out of sync: For
example, in osmo-bsc, if we have three MS doing a usual Complete Layer
3, osmo-bsc's counter increments by three. If we then have one
Handover Required coming back from the MSC, i.e. inbound SCCP
connection, the sccp_inst->next_id is behind by three, and will
iterate SCCP connections three times before finding an unused id.
- Each implementation has to take care to properly wrap the ID in its
valid range, e.g. in osmo-bsc:
test_id = (test_id + 1) & 0x00FFFFFF;
if (OSMO_UNLIKELY(test_id == 0x00FFFFFF))
test_id = 0;
Add public API so that callers can benefit from the internal
osmo_sccp_instance->next_id and do not need to duplicate the code for
staying within the proper range.
Change-Id: If59d524fbe1088a59ae1b69908e2d4bf67113439
---
M include/osmocom/sigtran/sccp_sap.h
M src/sccp_scoc.c
2 files changed, 41 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/21/32321/1
diff --git a/include/osmocom/sigtran/sccp_sap.h b/include/osmocom/sigtran/sccp_sap.h
index 24d8832..403928f 100644
--- a/include/osmocom/sigtran/sccp_sap.h
+++ b/include/osmocom/sigtran/sccp_sap.h
@@ -339,3 +339,5 @@
int osmo_sccp_gt_cmp(const struct osmo_sccp_gt *a, const struct osmo_sccp_gt *b);
const char *osmo_sccp_user_name(struct osmo_sccp_user *scu);
+
+int osmo_sccp_instance_next_conn_id(struct osmo_sccp_instance *sccp, uint32_t max_attempts);
diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c
index 6d2499c..f42a88d 100644
--- a/src/sccp_scoc.c
+++ b/src/sccp_scoc.c
@@ -546,7 +546,7 @@
* \param[in] max_attempts Number of iterations to find an unused ID, or zero to iterate the entire ID number space.
* \return unused ID on success (>=0) or negative on elapsed max_attempts without an unused id (<0).
*/
-static int osmo_sccp_instance_next_conn_id(struct osmo_sccp_instance *sccp, uint32_t max_attempts)
+int osmo_sccp_instance_next_conn_id(struct osmo_sccp_instance *sccp, uint32_t max_attempts)
{
if (!max_attempts || max_attempts > 0x00FFFFFE) {
/* Maximally iterate the entire conn id number space once. */
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/32321
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: If59d524fbe1088a59ae1b69908e2d4bf67113439
Gerrit-Change-Number: 32321
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/32320 )
Change subject: sccp_scoc.c: fix infinite loop on conn ID exhaustion
......................................................................
sccp_scoc.c: fix infinite loop on conn ID exhaustion
Looking for an unused SCCP connection ID has no exit condition if all
connection IDs are in use. However unlikely it is that there are
16777215 active connections on one SCCP instance, add an exit condition.
Do so by implementing the ID lookup in a new separate function, which
qualifies for public API (upcoming patch).
So far, use an exit condition closest to previous behavior: iterate the
entire SCCP conn id number space before exiting in failure.
Change-Id: Ib64e0cb1ae0cc8b7bebcb2a352d4068b496b304a
---
M src/sccp_scoc.c
1 file changed, 52 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/20/32320/1
diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c
index c929ed6..6d2499c 100644
--- a/src/sccp_scoc.c
+++ b/src/sccp_scoc.c
@@ -539,10 +539,19 @@
return conn;
}
-/* Search for next free connection ID and allocate conn */
-static struct sccp_connection *conn_create(struct osmo_sccp_user *user)
+/* Return an unused SCCP connection ID.
+ * Callers *must* check the returned value, even if max_attempts == 0: on negative return value, there are no unused IDs
+ * available.
+ * \param[in] sccp The SCCP instance to determine a new connection ID for.
+ * \param[in] max_attempts Number of iterations to find an unused ID, or zero to iterate the entire ID number space.
+ * \return unused ID on success (>=0) or negative on elapsed max_attempts without an unused id (<0).
+ */
+static int osmo_sccp_instance_next_conn_id(struct osmo_sccp_instance *sccp, uint32_t max_attempts)
{
- struct osmo_sccp_instance *sccp = user->inst;
+ if (!max_attempts || max_attempts > 0x00FFFFFE) {
+ /* Maximally iterate the entire conn id number space once. */
+ max_attempts = 0x00FFFFFE;
+ }
/* SUA: RFC3868 sec 3.10.4:
* The source reference number is a 4 octet long integer.
@@ -555,14 +564,32 @@
* Hence, as we currently use the connection ID also as local reference,
* let's simply use 24 bit ids to fit all link types (excluding 0x00ffffff).
*/
- do {
+ while (1) {
/* Optimized modulo operation (% 0x00FFFFFE) using bitwise AND plus CMP: */
sccp->next_id = (sccp->next_id + 1) & 0x00FFFFFF;
if (OSMO_UNLIKELY(sccp->next_id == 0x00FFFFFF))
sccp->next_id = 0;
- } while (conn_find_by_id(sccp, sccp->next_id));
- return conn_create_id(user, sccp->next_id);
+ if (!conn_find_by_id(sccp, sccp->next_id))
+ return sccp->next_id;
+
+ if (max_attempts) {
+ max_attempts--;
+ if (!max_attempts)
+ break;
+ }
+ }
+
+ return -1;
+}
+
+/* Search for next free connection ID and allocate conn */
+static struct sccp_connection *conn_create(struct osmo_sccp_user *user)
+{
+ int conn_id = osmo_sccp_instance_next_conn_id(user->inst, 0);
+ if (conn_id < 0)
+ return NULL;
+ return conn_create_id(user, conn_id);
}
static void conn_opt_data_clear_cache(struct sccp_connection *conn)
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/32320
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ib64e0cb1ae0cc8b7bebcb2a352d4068b496b304a
Gerrit-Change-Number: 32320
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange