Hello everyone,
a student college and me are using the osmo-sim-auth tool for a student
project. We have valid data for our SIM card since it's a special
ordered test SIM card. In 2G mode we get the correct RES value, but in
3G mode we always get only an AUTS value. We calculated the SQN value
from the AUTS to verify that we have the correct SQN value, but still we
only get AUTS as return.
I would be grateful to hear if any of you have an idea why this is
happening.
Best regards
Marco
Hi,
we are now running our own copy of patchwork at https://patchwork.osmocom.org. In addition to single patches this version can track series and has a REST API and git-pw client support. The system is currently subscribed to the GPRS, OpenBSC and OsmocomBB mailinglist.
The installation is running offlineimap every couple of minutes to fetch new mail, this means it can take some minutes for your comment or patch to be visible.
kind regards
holger
Hi list,
osmo_prim_init() and msgb use firstly confuses me, and secondly is
apparently "inefficient" in sccp_helpers.c.
First, let's look at osmo_sccp_tx_unitdata() (libosmo-sccp branch
sysmocom/iu):
int osmo_sccp_tx_unitdata(struct osmo_sua_link *link,
const struct osmo_sccp_addr *calling_addr,
const struct osmo_sccp_addr *called_addr,
uint8_t *data, unsigned int len)
{
struct msgb *msg = msgb_alloc(1024, "sccp_tx_unitdata");
struct osmo_scu_prim *prim;
struct osmo_scu_unitdata_param *param;
prim = (struct osmo_scu_prim *) msgb_put(msg, sizeof(*prim));
param = &prim->u.unitdata;
memcpy(¶m->calling_addr, calling_addr, sizeof(*calling_addr));
memcpy(¶m->called_addr, called_addr, sizeof(*called_addr));
osmo_prim_init(&prim->oph, SCCP_SAP_USER, OSMO_SCU_PRIM_N_UNITDATA, PRIM_OP_REQUEST, msg);
msg->l2h = msgb_put(msg, len);
memcpy(msg->l2h, data, len);
return osmo_sua_user_link_down(link, &prim->oph);
}
First off, we allocate 1024 bytes of msgb. Into it goes an osmo_scu_prim
struct (here 'prim'). We set some parameters in prim, fair enough. But
now what, prim->oph, the prim header, has a msg pointer, which points back
at the msgb that contains the prim. really?? The msgb containing a struct
pointing back at the same msgb has my head spinning.
Finally we add the data, l2h pointing at the start of it. I'm confused ...
how large is the msgb supposed to be? Is it len + sizeof(*prim)?
Secondly, let's look at:
int osmo_sccp_tx_unitdata_msg(struct osmo_sua_link *link,
const struct osmo_sccp_addr *calling_addr,
const struct osmo_sccp_addr *called_addr,
struct msgb *msg)
{
int rc;
rc = osmo_sccp_tx_unitdata(link, calling_addr, called_addr,
msg->data, msgb_length(msg));
msgb_free(msg);
return rc;
}
So, something out there has a msgb containing data. For example, from
ranap_new_msg_paging_cmd(). That msgb has probably been allocated
specifically to compose a message to go over the sccp link.
We go on, though, to allocate *another* msgb (size 1024, remember), and
memcpy the first msgb into the second msgb, behind the osmo_scu_prim
struct.
I'll first use this as-is, talking about premature optimization. But I'd
prefer to have neither the wicked cunning nor the blunt dumbness in there;
the combination strikes me as jolly mad ;)
Are there good reasons for this?
I would have envisioned something like: tell ranap_new_msg_paging_cmd() to
allocate sizeof(*prim) of headroom; or first create a msgb of fixed
known-max size, and add first the prim header and then compose the data.
And, given the union prim->u has "unknown" size, why not point at the data
from prim->oph directly, instead of pointing back at the msgb? Or have
that union first? That would be easier to understand.
If some code needs to know the msgb that contains the prim->oph, I find it
weird to pass it the prim->oph with a backpointer, instead of just passing
the msgb right away.
~Neels
Hi,
this only happens when building a debian package, valgrind doesn't show anything crazy. It is a bit difficult to see which test it is. Any ideas?
holger
Output:
+++ /media/sf_source/gsm/libosmocore/tests/testsuite.dir/at-groups/7/stdout 2016-03-31 20:03:51.000000000 +0200
@@ -24,7 +24,7 @@
Src: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
Dst: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
msgb(%p): Sub area is not fully contained in the msg data
-msgb(%p): Sub area is not fully contained in the msg data
+msgb(%p): Negative sizes are not allowed
msgb(%p): Sub area is not fully contained in the msg data
msgb(%p): Negative sizes are not allowed
msgb(%p): Negative sizes are not allowed
7. testsuite.at:42: 7. msgb (testsuite.at:42): FAILED (testsuite.at:45)
Hi,
it is my pleasure to announce the osmo-sip-connector. It is a pure connector/translator/bridge from our NITB MNCC protocol to SIP (and vice versa). The sourcecode can be found here[1] and Debian 8.0 packages are available as part of the nightly packages[2] we are building. To run it a config file needs to be placed in /etc/osmocom/osmo-sip-connector.cfg. An example configuration can be found in doc/examples/ of the git repository.
The system is meant to contact (and be contacted) from a single SIP PBX, the system will not do RTP proxying and transcoding is left as exercise to the PBX. The system is using libosmocore/libosmovty and sofia-sip(-glib) for SIP. There is a custom evpoll.c that integrates Osmocore's event loop with glib.
As with every (new) software there is a long list of TODOs and we will address them:
* Review logging and make sure enough context about call handling is present
* Add VTY show commands (e.g. list calls and legs)
* Add Stats/Counters to measure events and timing
* Find a testing strategy
* Implement a codec selection scheme that is good
* IMSI based addressing
* Release cause mapping
* DTMF handling
* Create a manual for it.
In the long run we might want to consider mapping LUs to SIP REGISTER and SMPP to SIP as well. But that is quite far away and just a vague idea right now.
kind regards
holger
[1] http://git.osmocom.org/osmo-sip-connector/
[2] https://build.opensuse.org/package/show/network:osmocom:nightly/osmo-sip-co…
In the past normal migration was possible only if the actual
schema version differed from the version used in DB by 1. For
example, if DB uses an old version 3 and you need to use it
with the code written for version 5, the check_db_revision()
will convert it to 4 and DB will still use incompatible schema
version during Osmo-NITB running time. After next run it will
be converted to version 5.
This patch replaces a set of 'else-if' checks by a 'switch'
without 'break' statements between 'case' labels (waterfall).
It makes you able to migrate from current version to the
latest despite any difference between them.
Also fixed the sms_from_result_v3() to avoid large depth of
function calls, because they can be changed in the future
and lose compatibility with old table schemas.
Also fixed db_test and now it is successful.
Signed-off-by: Vadim Yanitskiy <axilirator(a)gmail.com>
---
openbsc/src/libmsc/db.c | 65 ++++++++++++++++++++++++++++----------------
openbsc/tests/db/db_test.c | 1 +
openbsc/tests/db/db_test.err | 3 ++
3 files changed, 45 insertions(+), 24 deletions(-)
diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c
index 04aee79..ad5afca 100644
--- a/openbsc/src/libmsc/db.c
+++ b/openbsc/src/libmsc/db.c
@@ -225,23 +225,27 @@ static struct gsm_sms *sms_from_result_v3(dbi_result result)
{
struct gsm_sms *sms = sms_alloc();
long long unsigned int sender_id;
- struct gsm_subscriber *sender;
- const char *text, *daddr;
+ const char *text, *daddr, *extension;
const unsigned char *user_data;
- char buf[32];
+ dbi_result sender_result;
if (!sms)
return NULL;
- sms->id = dbi_result_get_ulonglong(result, "id");
-
sender_id = dbi_result_get_ulonglong(result, "sender_id");
- snprintf(buf, sizeof(buf), "%llu", sender_id);
- sender = db_get_subscriber(GSM_SUBSCRIBER_ID, buf);
- OSMO_ASSERT(sender);
- strncpy(sms->src.addr, sender->extension, sizeof(sms->src.addr)-1);
- subscr_direct_free(sender);
- sender = NULL;
+ sms->id = dbi_result_get_ulonglong(result, "id");
+
+ sender_result = dbi_conn_queryf(conn,
+ "SELECT * FROM Subscriber "
+ "WHERE id = %llu", sender_id);
+
+ if (sender_result) {
+ if (dbi_result_next_row(sender_result)) {
+ extension = dbi_result_get_string(sender_result, "extension");
+ strncpy(sms->src.addr, extension, sizeof(sms->src.addr) - 1);
+ }
+ dbi_result_free(sender_result);
+ }
sms->reply_path_req = dbi_result_get_ulonglong(result, "reply_path_req");
sms->status_rep_req = dbi_result_get_ulonglong(result, "status_rep_req");
@@ -477,16 +481,20 @@ static int check_db_revision(void)
{
dbi_result result;
const char *rev_s;
+ int db_rev = 0;
+ /* Make a query */
result = dbi_conn_query(conn,
- "SELECT value FROM Meta WHERE key='revision'");
+ "SELECT value FROM Meta "
+ "WHERE key = 'revision'");
if (!result)
return -EINVAL;
-
if (!dbi_result_next_row(result)) {
dbi_result_free(result);
return -EINVAL;
}
+
+ /* Fetch the DB schema revision */
rev_s = dbi_result_get_string(result, "value");
if (!rev_s) {
dbi_result_free(result);
@@ -494,28 +502,37 @@ static int check_db_revision(void)
}
if (!strcmp(rev_s, SCHEMA_REVISION)) {
- /* everything is fine */
- } else if (!strcmp(rev_s, "2")) {
+ /* Everything is fine */
+ dbi_result_free(result);
+ return 0;
+ }
+
+ db_rev = atoi(rev_s);
+ dbi_result_free(result);
+
+ /* Incremental migration waterfall */
+ switch (db_rev) {
+ case 2:
if (update_db_revision_2())
goto error;
- } else if (!strcmp(rev_s, "3")) {
+ case 3:
if (update_db_revision_3())
goto error;
- } else if (!strcmp(rev_s, "4")) {
+ case 4:
if (update_db_revision_4())
- goto error;
- } else {
- LOGP(DDB, LOGL_FATAL, "Invalid database schema revision '%s'.\n", rev_s);
- dbi_result_free(result);
+ goto error;
+
+ /* The end of waterfall */
+ break;
+ default:
+ LOGP(DDB, LOGL_FATAL, "Invalid database schema revision '%d'.\n", db_rev);
return -EINVAL;
}
- dbi_result_free(result);
return 0;
error:
- LOGP(DDB, LOGL_FATAL, "Failed to update database from schema revision '%s'.\n", rev_s);
- dbi_result_free(result);
+ LOGP(DDB, LOGL_FATAL, "Failed to update database from schema revision '%d'.\n", db_rev);
return -EINVAL;
}
diff --git a/openbsc/tests/db/db_test.c b/openbsc/tests/db/db_test.c
index a02d1f8..2fdd830 100644
--- a/openbsc/tests/db/db_test.c
+++ b/openbsc/tests/db/db_test.c
@@ -187,6 +187,7 @@ int main()
char *alice_imsi = "3243245432345";
alice = db_create_subscriber(alice_imsi);
+ db_subscriber_alloc_tmsi(alice);
db_sync_subscriber(alice);
alice_db = db_get_subscriber(GSM_SUBSCRIBER_IMSI, alice->imsi);
COMPARE(alice, alice_db);
diff --git a/openbsc/tests/db/db_test.err b/openbsc/tests/db/db_test.err
index fa9a54c..d8a3e7f 100644
--- a/openbsc/tests/db/db_test.err
+++ b/openbsc/tests/db/db_test.err
@@ -1,2 +1,5 @@
Going to migrate from revision 3
+[0;mMigration complete.
+[0;mGoing to migrate from revision 4
+[0;mMigration complete.
[0;m
\ No newline at end of file
--
2.8.0