2017-10-09 15:28:53 +00:00
|
|
|
|
|
|
|
===== test_subscr_create_update_sel_delete
|
|
|
|
|
|
|
|
--- Create with valid / invalid IMSI
|
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, imsi0, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> 0
|
2017-10-09 15:28:53 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
}
|
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, imsi1, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> 0
|
2017-10-09 15:28:53 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi1, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 2,
|
|
|
|
.imsi = '123456789000001',
|
|
|
|
}
|
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, imsi2, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> 0
|
2017-10-09 15:28:53 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi2, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 3,
|
|
|
|
.imsi = '123456789000002',
|
|
|
|
}
|
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, imsi0, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> -EIO
|
2017-10-09 15:28:53 +00:00
|
|
|
DAUC IMSI='123456789000000': Cannot create subscriber: SQL error: (2067) UNIQUE constraint failed: subscriber.imsi
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
}
|
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, imsi1, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> -EIO
|
2017-10-09 15:28:53 +00:00
|
|
|
DAUC IMSI='123456789000001': Cannot create subscriber: SQL error: (2067) UNIQUE constraint failed: subscriber.imsi
|
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, imsi1, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> -EIO
|
2017-10-09 15:28:53 +00:00
|
|
|
DAUC IMSI='123456789000001': Cannot create subscriber: SQL error: (2067) UNIQUE constraint failed: subscriber.imsi
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi1, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 2,
|
|
|
|
.imsi = '123456789000001',
|
|
|
|
}
|
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, imsi2, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> -EIO
|
2017-10-09 15:28:53 +00:00
|
|
|
DAUC IMSI='123456789000002': Cannot create subscriber: SQL error: (2067) UNIQUE constraint failed: subscriber.imsi
|
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, imsi2, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> -EIO
|
2017-10-09 15:28:53 +00:00
|
|
|
DAUC IMSI='123456789000002': Cannot create subscriber: SQL error: (2067) UNIQUE constraint failed: subscriber.imsi
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi2, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 3,
|
|
|
|
.imsi = '123456789000002',
|
|
|
|
}
|
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, "123456789 000003", DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> -EINVAL
|
2017-10-09 15:28:53 +00:00
|
|
|
DAUC Cannot create subscriber: invalid IMSI: '123456789 000003'
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_imsi(dbc, "123456789000003", &g_subscr) --> -ENOENT
|
2017-10-09 15:28:53 +00:00
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, "123456789000002123456", DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> -EINVAL
|
2017-10-09 15:28:53 +00:00
|
|
|
DAUC Cannot create subscriber: invalid IMSI: '123456789000002123456'
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_imsi(dbc, "123456789000002123456", &g_subscr) --> -ENOENT
|
2017-10-09 15:28:53 +00:00
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, "foobar123", DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> -EINVAL
|
2017-10-09 15:28:53 +00:00
|
|
|
DAUC Cannot create subscriber: invalid IMSI: 'foobar123'
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_imsi(dbc, "foobar123", &g_subscr) --> -ENOENT
|
2017-10-09 15:28:53 +00:00
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, "123", DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> -EINVAL
|
2017-10-09 15:28:53 +00:00
|
|
|
DAUC Cannot create subscriber: invalid IMSI: '123'
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_imsi(dbc, "123", &g_subscr) --> -ENOENT
|
2017-10-09 15:28:53 +00:00
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, short_imsi, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> 0
|
2017-10-09 15:28:53 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, short_imsi, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 4,
|
|
|
|
.imsi = '123456',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-06 12:49:05 +00:00
|
|
|
--- Check if subscriber exists (by IMSI)
|
|
|
|
|
|
|
|
db_subscr_exists_by_imsi(dbc, imsi0) --> 0
|
|
|
|
|
|
|
|
db_subscr_exists_by_imsi(dbc, unknown_imsi) --> -ENOENT
|
|
|
|
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
--- Set valid / invalid MSISDN
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_msisdn_by_imsi(dbc, imsi0, "54321") --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '54321',
|
|
|
|
}
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_msisdn(dbc, "54321", &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '54321',
|
|
|
|
}
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
db_subscr_update_msisdn_by_imsi(dbc, imsi0, "54321012345678912345678") --> -EINVAL
|
|
|
|
DAUC IMSI='123456789000000': Cannot update subscriber: invalid MSISDN: '54321012345678912345678'
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '54321',
|
|
|
|
}
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_msisdn(dbc, "54321", &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '54321',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_get_by_msisdn(dbc, "54321012345678912345678", &g_subscr) --> -ENOENT
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
db_subscr_update_msisdn_by_imsi(dbc, imsi0, "543 21") --> -EINVAL
|
|
|
|
DAUC IMSI='123456789000000': Cannot update subscriber: invalid MSISDN: '543 21'
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '54321',
|
|
|
|
}
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_msisdn(dbc, "543 21", &g_subscr) --> -ENOENT
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
db_subscr_update_msisdn_by_imsi(dbc, imsi0, "foobar123") --> -EINVAL
|
|
|
|
DAUC IMSI='123456789000000': Cannot update subscriber: invalid MSISDN: 'foobar123'
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '54321',
|
|
|
|
}
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_msisdn(dbc, "foobar123", &g_subscr) --> -ENOENT
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
db_subscr_update_msisdn_by_imsi(dbc, imsi0, "5") --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '5',
|
|
|
|
}
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_msisdn(dbc, "5", &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '5',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_get_by_msisdn(dbc, "54321", &g_subscr) --> -ENOENT
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
db_subscr_update_msisdn_by_imsi(dbc, imsi0, "543210123456789") --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_msisdn(dbc, "543210123456789", &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
db_subscr_update_msisdn_by_imsi(dbc, imsi0, "5432101234567891") --> -EINVAL
|
|
|
|
DAUC IMSI='123456789000000': Cannot update subscriber: invalid MSISDN: '5432101234567891'
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_msisdn(dbc, "5432101234567891", &g_subscr) --> -ENOENT
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
|
2019-03-30 10:03:42 +00:00
|
|
|
--- Check if subscriber exists (by MSISDN)
|
|
|
|
|
|
|
|
db_subscr_exists_by_msisdn(dbc, "543210123456789") --> 0
|
|
|
|
|
|
|
|
db_subscr_exists_by_msisdn(dbc, "5432101234567891") --> -ENOENT
|
|
|
|
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
--- Set MSISDN on non-existent / invalid IMSI
|
|
|
|
|
|
|
|
db_subscr_update_msisdn_by_imsi(dbc, unknown_imsi, "99") --> -ENOENT
|
|
|
|
DAUC Cannot update MSISDN: no such subscriber: IMSI='999999999'
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_msisdn(dbc, "99", &g_subscr) --> -ENOENT
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
db_subscr_update_msisdn_by_imsi(dbc, "foobar", "99") --> -ENOENT
|
|
|
|
DAUC Cannot update MSISDN: no such subscriber: IMSI='foobar'
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_msisdn(dbc, "99", &g_subscr) --> -ENOENT
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
|
2019-01-09 11:03:51 +00:00
|
|
|
--- Set valid / invalid IMEI
|
|
|
|
|
|
|
|
db_subscr_update_imei_by_imsi(dbc, imsi0, "12345678901234") --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imei(dbc, "12345678901234", &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.imei = '12345678901234',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_imei_by_imsi(dbc, imsi0, "123456789012345") --> -EINVAL
|
|
|
|
DAUC Cannot update subscriber IMSI='123456789000000': invalid IMEI: '123456789012345'
|
|
|
|
|
|
|
|
db_subscr_get_by_imei(dbc, "12345678901234", &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.imei = '12345678901234',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_get_by_imei(dbc, "123456789012345", &g_subscr) --> -ENOENT
|
|
|
|
|
|
|
|
|
|
|
|
--- Set the same IMEI again
|
|
|
|
|
|
|
|
db_subscr_update_imei_by_imsi(dbc, imsi0, "12345678901234") --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imei(dbc, "12345678901234", &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.imei = '12345678901234',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Remove IMEI
|
|
|
|
|
|
|
|
db_subscr_update_imei_by_imsi(dbc, imsi0, NULL) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imei(dbc, "12345678901234", &g_subscr) --> -ENOENT
|
|
|
|
|
|
|
|
|
2017-10-06 02:10:06 +00:00
|
|
|
--- Set / unset nam_cs and nam_ps
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, imsi0, false, true) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.nam_ps = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, imsi0, false, false) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.nam_cs = false,
|
|
|
|
.nam_ps = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, imsi0, true, false) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.nam_ps = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, imsi0, true, true) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Set / unset nam_cs and nam_ps *again*
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, imsi0, false, true) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.nam_ps = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, imsi0, false, true) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.nam_ps = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, imsi0, false, false) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.nam_cs = false,
|
|
|
|
.nam_ps = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, imsi0, false, false) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.nam_cs = false,
|
|
|
|
.nam_ps = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, imsi0, true, true) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.nam_cs = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, imsi0, true, true) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.nam_cs = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, imsi0, true, false) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, imsi0, true, false) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Set nam_cs and nam_ps on non-existent / invalid IMSI
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, unknown_imsi, false, true) --> -ENOENT
|
|
|
|
DAUC Cannot disable PS: no such subscriber: IMSI='999999999'
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, unknown_imsi, false, false) --> -ENOENT
|
|
|
|
DAUC Cannot disable CS: no such subscriber: IMSI='999999999'
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, unknown_imsi, &g_subscr) --> -ENOENT
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, "foobar", false, true) --> -ENOENT
|
|
|
|
DAUC Cannot disable PS: no such subscriber: IMSI='foobar'
|
|
|
|
|
|
|
|
db_subscr_nam(dbc, "foobar", false, false) --> -ENOENT
|
|
|
|
DAUC Cannot disable CS: no such subscriber: IMSI='foobar'
|
|
|
|
|
|
|
|
|
2017-10-09 15:36:08 +00:00
|
|
|
--- Record LU for PS and CS (SGSN and VLR names)
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, id0, "5952", true) --> 0
|
2017-10-09 15:36:08 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, id0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.sgsn_number = '5952',
|
|
|
|
}
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, id0, "712", false) --> 0
|
2017-10-09 15:36:08 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, id0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.vlr_number = '712',
|
|
|
|
.sgsn_number = '5952',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Record LU for PS and CS (SGSN and VLR names) *again*
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, id0, "111", true) --> 0
|
2017-10-09 15:36:08 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, id0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.vlr_number = '712',
|
|
|
|
.sgsn_number = '111',
|
|
|
|
}
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, id0, "111", true) --> 0
|
2017-10-09 15:36:08 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, id0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.vlr_number = '712',
|
|
|
|
.sgsn_number = '111',
|
|
|
|
}
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, id0, "222", false) --> 0
|
2017-10-09 15:36:08 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, id0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.vlr_number = '222',
|
|
|
|
.sgsn_number = '111',
|
|
|
|
}
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, id0, "222", false) --> 0
|
2017-10-09 15:36:08 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, id0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.vlr_number = '222',
|
|
|
|
.sgsn_number = '111',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Unset LU info for PS and CS (SGSN and VLR names)
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, id0, "", true) --> 0
|
2017-10-09 15:36:08 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, id0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.vlr_number = '222',
|
|
|
|
}
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, id0, "", false) --> 0
|
2017-10-09 15:36:08 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, id0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, id0, "111", true) --> 0
|
2017-10-09 15:36:08 +00:00
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, id0, "222", false) --> 0
|
2017-10-09 15:36:08 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, id0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.vlr_number = '222',
|
|
|
|
.sgsn_number = '111',
|
|
|
|
}
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, id0, NULL, true) --> 0
|
2017-10-09 15:36:08 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, id0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.vlr_number = '222',
|
|
|
|
}
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, id0, NULL, false) --> 0
|
2017-10-09 15:36:08 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, id0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Record LU for non-existent ID
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, 99999, "5952", true) --> -ENOENT
|
2017-10-09 15:36:08 +00:00
|
|
|
DAUC Cannot update SGSN number for subscriber ID=99999: no such subscriber
|
|
|
|
|
1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
These are seemingly orthogonal changes in one patch, because they are in fact
sufficiently intertwined that we are not willing to spend the time to separate
them. They are also refactoring changes, unlikely to make sense on their own.
** lu_fsm:
Attempting to make luop.c keep state about incoming GSUP requests made me find
shortcomings in several places:
- since it predates osmo_fsm, it is a state machine that does not strictly
enforce the order of state transitions or the right sequence of incoming
events.
- several places OSMO_ASSERT() on data received from the network.
- modifies the subscriber state before a LU is accepted.
- dead code about canceling a subscriber in a previous VLR. That would be a
good thing to actually do, which should also be trivial now that we record
vlr_name and sgsn_name, but I decided to remove the dead code for now.
To both step up the LU game *and* make it easier for me to integrate
osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,
ample experience of writing osmo_fsms.
** osmo_gsup_req:
Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /
communicate with remote MSCs via a proxy:
a) It is important that a response that osmo-hlr generates and that is sent
back to a requesting MSC contains all IEs that are needed to route it back to
the requester. Particularly source_name must become destination_name in the
response to be able to even reach the requesting MSC. Other fields are also
necessary to match, which were so far taken care of in individual numerous code
paths.
b) For some operations, the response to a GSUP request is generated
asynchronously (like Update Location Request -> Response, or taking the
response from an EUSE, or the upcoming proxying to a remote HLR). To be able to
feed a request message's information back into the response, we must thus keep
the request data around. Since struct osmo_gsup_message references a lot of
external data, usually with pointers directly into the received msgb, it is not
so trivial to pass GSUP message data around asynchronously, on its own.
osmo_gsup_req is the combined solution for both a and b: it keeps all data for
a GSUP message by taking ownership of the incoming msgb, and it provides an
explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that
all code paths trivially are definitely responding with the correct IEs set to
match the request's routing (by using osmo_gsup_make_response() recently added
to libosmocore).
Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to
incoming requests received on the GSUP server (above LU code being one of
them).
In fact, the same should be done on the client side. Hence osmo_gsup_req is
implemented in a server/client agnostic way, and is placed in
libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,
using osmo_gsup_req in the related GSUP client is likely to resolve those
problems without much thinking required beyond making all code paths use it.
libosmo-gsupclient is hence added to osmo-hlr binary's own library
dependencies. It would have been added by the D-GSM proxy routing anyway, we
are just doing it a little sooner.
** cni_peer_id.c / osmo_ipa_name:
We so far handle an IPA unit name as pointer + size, or as just pointer with
implicit talloc size. To ease working with GSUP peer identification data, I
require:
- a non-allocated storage of an IPA Name. It brings the drawback of being
size limited, but our current implementation is anyway only able to handle
MSC and SGSN names of 31 characters (see struct hlr_subscriber).
- a single-argument handle for IPA Name,
- easy to use utility functions like osmo_ipa_name_to_str(), osmo_ipa_name_cmp(), and copying
by simple assignment, a = b.
Hence this patch adds a osmo_ipa_name in cni_peer_id.h and cni_peer_id.c. Heavily
used in LU and osmo_gsup_req.
Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566
Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9
2019-11-20 01:36:45 +00:00
|
|
|
db_subscr_lu_str(dbc, 99999, "712", false) --> -ENOENT
|
2017-10-09 15:36:08 +00:00
|
|
|
DAUC Cannot update VLR number for subscriber ID=99999: no such subscriber
|
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, 99999, &g_subscr) --> -ENOENT
|
|
|
|
|
|
|
|
|
2017-10-09 15:48:51 +00:00
|
|
|
--- Purge and un-purge PS and CS
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, imsi0, true, true) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.ms_purged_ps = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, imsi0, true, false) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.ms_purged_cs = true,
|
|
|
|
.ms_purged_ps = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, imsi0, false, false) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.ms_purged_ps = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, imsi0, false, true) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Purge PS and CS *again*
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, imsi0, true, true) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.ms_purged_ps = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, imsi0, true, true) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.ms_purged_ps = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, imsi0, false, true) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, imsi0, false, true) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, imsi0, true, false) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.ms_purged_cs = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, imsi0, true, false) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
.ms_purged_cs = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, imsi0, false, false) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, imsi0, false, false) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Purge on non-existent / invalid IMSI
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, unknown_imsi, true, true) --> -ENOENT
|
|
|
|
DAUC Cannot purge PS: no such subscriber: IMSI='999999999'
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, unknown_imsi, &g_subscr) --> -ENOENT
|
|
|
|
|
|
|
|
db_subscr_purge(dbc, unknown_imsi, true, false) --> -ENOENT
|
|
|
|
DAUC Cannot purge CS: no such subscriber: IMSI='999999999'
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, unknown_imsi, &g_subscr) --> -ENOENT
|
|
|
|
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
--- Delete non-existent / invalid IDs
|
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, 999) --> -ENOENT
|
|
|
|
DAUC Cannot delete: no such subscriber: ID=999
|
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, -10) --> -ENOENT
|
|
|
|
DAUC Cannot delete: no such subscriber: ID=-10
|
|
|
|
|
|
|
|
|
|
|
|
--- Delete subscribers
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.msisdn = '543210123456789',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, id0) --> 0
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> -ENOENT
|
2017-10-09 15:28:53 +00:00
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, id0) --> -ENOENT
|
|
|
|
DAUC Cannot delete: no such subscriber: ID=1
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi1, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 2,
|
|
|
|
.imsi = '123456789000001',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, id1) --> 0
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_imsi(dbc, imsi1, &g_subscr) --> -ENOENT
|
2017-10-09 15:28:53 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi2, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 3,
|
|
|
|
.imsi = '123456789000002',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, id2) --> 0
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_imsi(dbc, imsi2, &g_subscr) --> -ENOENT
|
2017-10-09 15:28:53 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, short_imsi, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 4,
|
|
|
|
.imsi = '123456',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, id_short) --> 0
|
|
|
|
|
2017-10-09 15:30:32 +00:00
|
|
|
db_subscr_get_by_imsi(dbc, short_imsi, &g_subscr) --> -ENOENT
|
2017-10-09 15:28:53 +00:00
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
|
|
|
|
--- Create and delete subscribers with non-default nam_cs and nam_ps
|
|
|
|
|
|
|
|
db_subscr_create(dbc, imsi0, 0x00) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
.nam_cs = false,
|
|
|
|
.nam_ps = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_create(dbc, imsi1, DB_SUBSCR_FLAG_NAM_CS) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi1, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 2,
|
|
|
|
.imsi = '123456789000001',
|
|
|
|
.nam_ps = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_create(dbc, imsi2, DB_SUBSCR_FLAG_NAM_PS) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi2, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 3,
|
|
|
|
.imsi = '123456789000002',
|
|
|
|
.nam_cs = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, id0) --> 0
|
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, id1) --> 0
|
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, id2) --> 0
|
|
|
|
|
2017-10-09 15:28:53 +00:00
|
|
|
===== test_subscr_create_update_sel_delete: SUCCESS
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
===== test_subscr_aud
|
|
|
|
|
|
|
|
--- Get auth data for non-existent subscriber
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, unknown_imsi, &g_aud2g, &g_aud3g, &g_id) --> -2
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='999999999': No such subscriber
|
|
|
|
|
|
|
|
|
2019-08-21 18:01:31 +00:00
|
|
|
db_get_auc(dbc, imsi0, 3, vec, N_VECTORS, NULL, NULL, false) --> -2
|
2017-11-23 14:27:50 +00:00
|
|
|
DAUC IMSI='123456789000000': No such subscriber
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
--- Create subscriber
|
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, imsi0, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
}
|
|
|
|
|
2018-11-16 07:47:26 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -ENOKEY
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
|
2019-08-21 18:01:31 +00:00
|
|
|
db_get_auc(dbc, imsi0, 3, vec, N_VECTORS, NULL, NULL, false) --> -ENOKEY
|
2017-11-23 14:27:50 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
--- Set auth data, 2G only
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_COMP128v1, "0123456789abcdef0123456789abcdef")) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v1,
|
|
|
|
.u.gsm.ki = '0123456789abcdef0123456789abcdef',
|
|
|
|
}
|
|
|
|
3G: none
|
|
|
|
|
2019-08-21 18:01:31 +00:00
|
|
|
db_get_auc(dbc, imsi0, 3, vec, N_VECTORS, NULL, NULL, false) --> 3
|
2017-11-23 14:27:50 +00:00
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': Calling to generate 3 vectors
|
|
|
|
DAUC IMSI='123456789000000': Generated 3 vectors
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_COMP128v1, "0123456789abcdef0123456789abcdef")) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v1,
|
|
|
|
.u.gsm.ki = '0123456789abcdef0123456789abcdef',
|
|
|
|
}
|
|
|
|
3G: none
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_COMP128v2, "BeadedBeeAced1EbbedDefacedFacade")) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v2,
|
|
|
|
.u.gsm.ki = 'beadedbeeaced1ebbeddefacedfacade',
|
|
|
|
}
|
|
|
|
3G: none
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_COMP128v3, "DeafBeddedBabeAcceededFadedDecaf")) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v3,
|
|
|
|
.u.gsm.ki = 'deafbeddedbabeacceededfadeddecaf',
|
|
|
|
}
|
|
|
|
3G: none
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR, "CededEffacedAceFacedBadFadedBeef")) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = XOR,
|
|
|
|
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
}
|
|
|
|
3G: none
|
|
|
|
|
|
|
|
|
|
|
|
--- Remove 2G auth data
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_NONE, NULL)) --> 0
|
|
|
|
|
2018-11-16 07:47:26 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -ENOKEY
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
|
2019-08-21 18:01:31 +00:00
|
|
|
db_get_auc(dbc, imsi0, 3, vec, N_VECTORS, NULL, NULL, false) --> -ENOKEY
|
2017-11-23 14:27:50 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_NONE, NULL)) --> -ENOENT
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR, "CededEffacedAceFacedBadFadedBeef")) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = XOR,
|
|
|
|
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
}
|
|
|
|
3G: none
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_NONE, "f000000000000f00000000000f000000")) --> 0
|
|
|
|
|
2018-11-16 07:47:26 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -ENOKEY
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
|
2019-08-21 18:01:31 +00:00
|
|
|
db_get_auc(dbc, imsi0, 3, vec, N_VECTORS, NULL, NULL, false) --> -ENOKEY
|
2017-11-23 14:27:50 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
--- Set auth data, 3G only
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "BeefedCafeFaceAcedAddedDecadeFee", true, "C01ffedC1cadaeAc1d1f1edAcac1aB0a", 5)) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 1,
|
|
|
|
.u.umts.k = 'c01ffedc1cadaeac1d1f1edacac1ab0a',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
2019-08-21 18:01:31 +00:00
|
|
|
db_get_auc(dbc, imsi0, 3, vec, N_VECTORS, NULL, NULL, false) --> 3
|
2017-11-23 14:27:50 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': Calling to generate 3 vectors
|
|
|
|
DAUC IMSI='123456789000000': Generated 3 vectors
|
|
|
|
DAUC IMSI='123456789000000': Updating SQN=0 in DB
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "BeefedCafeFaceAcedAddedDecadeFee", true, "C01ffedC1cadaeAc1d1f1edAcac1aB0a", 5)) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 1,
|
|
|
|
.u.umts.k = 'c01ffedc1cadaeac1d1f1edacac1ab0a',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "Deaf0ff1ceD0d0DabbedD1ced1ceF00d", true, "F1bbed0afD0eF0bD0ffed0ddF1fe0b0e", 0)) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'deaf0ff1ced0d0dabbedd1ced1cef00d',
|
|
|
|
.u.umts.opc_is_op = 1,
|
|
|
|
.u.umts.k = 'f1bbed0afd0ef0bd0ffed0ddf1fe0b0e',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "BeefedCafeFaceAcedAddedDecadeFee", false, "DeafBeddedBabeAcceededFadedDecaf", OSMO_MILENAGE_IND_BITLEN_MAX)) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'deafbeddedbabeacceededfadeddecaf',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 28,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "CededEffacedAceFacedBadFadedBeef", false, "BeefedCafeFaceAcedAddedDecadeFee", 5)) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Remove 3G auth data
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_NONE, NULL, false, NULL, 0)) --> 0
|
|
|
|
|
2018-11-16 07:47:26 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -ENOKEY
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
|
2019-08-21 18:01:31 +00:00
|
|
|
db_get_auc(dbc, imsi0, 3, vec, N_VECTORS, NULL, NULL, false) --> -ENOKEY
|
2017-11-23 14:27:50 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_NONE, NULL, false, NULL, 0)) --> -ENOENT
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "CededEffacedAceFacedBadFadedBeef", false, "BeefedCafeFaceAcedAddedDecadeFee", 5)) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
2019-08-21 18:01:31 +00:00
|
|
|
db_get_auc(dbc, imsi0, 3, vec, N_VECTORS, NULL, NULL, false) --> 3
|
2017-11-23 14:27:50 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': Calling to generate 3 vectors
|
|
|
|
DAUC IMSI='123456789000000': Generated 3 vectors
|
|
|
|
DAUC IMSI='123456789000000': Updating SQN=0 in DB
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_NONE, "asdfasdfasd", false, "asdfasdfasdf", 99999)) --> 0
|
|
|
|
|
2018-11-16 07:47:26 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -ENOKEY
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
|
2019-08-21 18:01:31 +00:00
|
|
|
db_get_auc(dbc, imsi0, 3, vec, N_VECTORS, NULL, NULL, false) --> -ENOKEY
|
2017-11-23 14:27:50 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
--- Set auth data, 2G and 3G
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_COMP128v3, "CededEffacedAceFacedBadFadedBeef")) --> 0
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "BeefedCafeFaceAcedAddedDecadeFee", false, "DeafBeddedBabeAcceededFadedDecaf", 5)) --> 0
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v3,
|
|
|
|
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
}
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'deafbeddedbabeacceededfadeddecaf',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
2019-08-21 18:01:31 +00:00
|
|
|
db_get_auc(dbc, imsi0, 3, vec, N_VECTORS, NULL, NULL, false) --> 3
|
2017-11-23 14:27:50 +00:00
|
|
|
DAUC IMSI='123456789000000': Calling to generate 3 vectors
|
|
|
|
DAUC IMSI='123456789000000': Generated 3 vectors
|
|
|
|
DAUC IMSI='123456789000000': Updating SQN=0 in DB
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
--- Set invalid auth data
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(99999, "f000000000000f00000000000f000000")) --> -EINVAL
|
|
|
|
DAUC Cannot update auth tokens: Unknown auth algo: 99999
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v3,
|
|
|
|
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
}
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'deafbeddedbabeacceededfadeddecaf',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR, "f000000000000f00000000000f000000f00000000")) --> -EINVAL
|
|
|
|
DAUC Cannot update auth tokens: Invalid KI: 'f000000000000f00000000000f000000f00000000'
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v3,
|
|
|
|
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
}
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'deafbeddedbabeacceededfadeddecaf',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR, "f00")) --> -EINVAL
|
|
|
|
DAUC Cannot update auth tokens: Invalid KI: 'f00'
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v3,
|
|
|
|
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
}
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'deafbeddedbabeacceededfadeddecaf',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_MILENAGE, "0123456789abcdef0123456789abcdef")) --> -EINVAL
|
|
|
|
DAUC Cannot update auth tokens: auth algo not suited for 2G: MILENAGE
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v3,
|
|
|
|
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
}
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'deafbeddedbabeacceededfadeddecaf',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "0f000000000000f00000000000f000000", false, "f000000000000f00000000000f000000", 5)) --> -EINVAL
|
|
|
|
DAUC Cannot update auth tokens: Invalid OP/OPC: '0f000000000000f00000000000f000000'
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v3,
|
|
|
|
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
}
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'deafbeddedbabeacceededfadeddecaf',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "f000000000000f00000000000f000000", false, "000000000000f00000000000f000000", 5)) --> -EINVAL
|
|
|
|
DAUC Cannot update auth tokens: Invalid K: '000000000000f00000000000f000000'
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v3,
|
|
|
|
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
}
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'deafbeddedbabeacceededfadeddecaf',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "f000000000000f00000000000f000000", false, "f000000000000f00000000000f000000", OSMO_MILENAGE_IND_BITLEN_MAX + 1)) --> -EINVAL
|
|
|
|
DAUC Cannot update auth tokens: Invalid ind_bitlen: 29
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v3,
|
|
|
|
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
}
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'deafbeddedbabeacceededfadeddecaf',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "X000000000000f00000000000f000000", false, "f000000000000f00000000000f000000", 5)) --> -EINVAL
|
|
|
|
DAUC Cannot update auth tokens: Invalid OP/OPC: 'X000000000000f00000000000f000000'
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v3,
|
|
|
|
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
}
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'deafbeddedbabeacceededfadeddecaf',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "f000000000000f00000000000f000000", false, "f000000000000 f00000000000 f000000", 5)) --> -EINVAL
|
|
|
|
DAUC Cannot update auth tokens: Invalid K: 'f000000000000 f00000000000 f000000'
|
|
|
|
|
2017-10-09 15:51:13 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
2G: struct osmo_sub_auth_data {
|
|
|
|
.type = GSM,
|
|
|
|
.algo = COMP128v3,
|
|
|
|
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
|
|
|
|
}
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 0,
|
|
|
|
.u.umts.k = 'deafbeddedbabeacceededfadeddecaf',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Delete subscriber
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, id) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> -ENOENT
|
|
|
|
|
|
|
|
|
|
|
|
--- Re-add subscriber and verify auth data didn't come back
|
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, imsi0, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> 0
|
2017-10-10 00:25:00 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
}
|
|
|
|
|
2018-11-16 07:47:26 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -ENOKEY
|
2017-10-10 00:25:00 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
|
2019-08-21 18:01:31 +00:00
|
|
|
db_get_auc(dbc, imsi0, 3, vec, N_VECTORS, NULL, NULL, false) --> -ENOKEY
|
2017-11-23 14:27:50 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
db_subscr_delete_by_id(dbc, id) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> -ENOENT
|
|
|
|
|
2019-08-21 18:01:31 +00:00
|
|
|
db_get_auc(dbc, imsi0, 3, vec, N_VECTORS, NULL, NULL, false) --> -2
|
2017-11-23 14:27:50 +00:00
|
|
|
DAUC IMSI='123456789000000': No such subscriber
|
|
|
|
|
2017-10-10 00:25:00 +00:00
|
|
|
===== test_subscr_aud: SUCCESS
|
|
|
|
|
2017-10-09 21:03:57 +00:00
|
|
|
|
2019-07-24 09:32:45 +00:00
|
|
|
===== test_subscr_aud_invalid_len
|
|
|
|
|
|
|
|
--- Create subscriber
|
|
|
|
|
|
|
|
db_subscr_create(dbc, imsi0, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Set auth data, 2G only, with invalid Ki length
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_COMP128v1, "0123456789abcdef0123456789abcdef")) --> 0
|
|
|
|
|
|
|
|
raw SQL: UPDATE auc_2g SET ki = '0123456789abcdef0123456789abcde'
|
|
|
|
sqlite3_prepare_v2(dbc->db, sql, -1, &stmt, NULL) --> SQLITE_OK
|
|
|
|
|
|
|
|
sqlite3_step(stmt) --> SQLITE_DONE
|
|
|
|
|
2019-08-13 09:59:01 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -ENOKEY
|
2019-07-24 09:32:45 +00:00
|
|
|
DAUC IMSI='123456789000000': Error reading Ki, expected length 16 but has length 15
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--- Remove 2G auth data
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_NONE, NULL)) --> 0
|
|
|
|
|
|
|
|
|
|
|
|
--- Set auth data, 3G only, with invalid K length
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "BeefedCafeFaceAcedAddedDecadeFee", true, "C01ffedC1cadaeAc1d1f1edAcac1aB0a", 5)) --> 0
|
|
|
|
|
|
|
|
raw SQL: UPDATE auc_3g SET k = 'C01ffedC1cadaeAc1d1f1edAcac1aB0'
|
|
|
|
sqlite3_prepare_v2(dbc->db, sql, -1, &stmt, NULL) --> SQLITE_OK
|
|
|
|
|
|
|
|
sqlite3_step(stmt) --> SQLITE_DONE
|
|
|
|
|
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -5
|
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': Error reading K, expected length 16 but has length 15
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--- Set auth data, 3G only, with invalid OP length
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "BeefedCafeFaceAcedAddedDecadeFee", true, "C01ffedC1cadaeAc1d1f1edAcac1aB0a", 5)) --> 0
|
|
|
|
|
|
|
|
raw SQL: UPDATE auc_3g SET op = 'BeefedCafeFaceAcedAddedDecadeFe'
|
|
|
|
sqlite3_prepare_v2(dbc->db, sql, -1, &stmt, NULL) --> SQLITE_OK
|
|
|
|
|
|
|
|
sqlite3_step(stmt) --> SQLITE_DONE
|
|
|
|
|
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -5
|
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': Error reading OP, expected length 16 but has length 15
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--- Set auth data, 3G only, with invalid OPC length
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "BeefedCafeFaceAcedAddedDecadeFee", false, "C01ffedC1cadaeAc1d1f1edAcac1aB0a", 5)) --> 0
|
|
|
|
|
|
|
|
raw SQL: UPDATE auc_3g SET opc = 'BeefedCafeFaceAcedAddedDecadeFe'
|
|
|
|
sqlite3_prepare_v2(dbc->db, sql, -1, &stmt, NULL) --> SQLITE_OK
|
|
|
|
|
|
|
|
sqlite3_step(stmt) --> SQLITE_DONE
|
|
|
|
|
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -5
|
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': Error reading OPC, expected length 16 but has length 15
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--- Delete subscriber
|
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, id) --> 0
|
|
|
|
|
|
|
|
===== test_subscr_aud_invalid_len: SUCCESS
|
|
|
|
|
|
|
|
|
2017-10-09 21:03:57 +00:00
|
|
|
===== test_subscr_sqn
|
|
|
|
|
|
|
|
--- Set SQN for unknown subscriber
|
|
|
|
|
|
|
|
db_update_sqn(dbc, 99, 999) --> -ENOENT
|
|
|
|
DAUC Cannot update SQN for subscriber ID=99: no auc_3g entry for such subscriber
|
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, 99, &g_subscr) --> -ENOENT
|
|
|
|
|
|
|
|
db_update_sqn(dbc, 9999, 99) --> -ENOENT
|
|
|
|
DAUC Cannot update SQN for subscriber ID=9999: no auc_3g entry for such subscriber
|
|
|
|
|
|
|
|
db_subscr_get_by_id(dbc, 9999, &g_subscr) --> -ENOENT
|
|
|
|
|
|
|
|
|
|
|
|
--- Create subscriber
|
|
|
|
|
2019-03-06 12:17:39 +00:00
|
|
|
db_subscr_create(dbc, imsi0, DB_SUBSCR_FLAG_NAM_CS | DB_SUBSCR_FLAG_NAM_PS) --> 0
|
2017-10-09 21:03:57 +00:00
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
}
|
|
|
|
|
2018-11-16 07:47:26 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -ENOKEY
|
2017-10-09 21:03:57 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--- Set SQN, but no 3G auth data present
|
|
|
|
|
|
|
|
db_update_sqn(dbc, id, 123) --> -ENOENT
|
|
|
|
DAUC Cannot update SQN for subscriber ID=1: no auc_3g entry for such subscriber
|
|
|
|
|
2018-11-16 07:47:26 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -ENOKEY
|
2017-10-09 21:03:57 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
|
|
|
|
db_update_sqn(dbc, id, 543) --> -ENOENT
|
|
|
|
DAUC Cannot update SQN for subscriber ID=1: no auc_3g entry for such subscriber
|
|
|
|
|
2018-11-16 07:47:26 +00:00
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -ENOKEY
|
2017-10-09 21:03:57 +00:00
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
DAUC IMSI='123456789000000': No 3G Auth Data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--- Set auth 3G data
|
|
|
|
|
|
|
|
db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "BeefedCafeFaceAcedAddedDecadeFee", true, "C01ffedC1cadaeAc1d1f1edAcac1aB0a", 5)) --> 0
|
|
|
|
|
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 1,
|
|
|
|
.u.umts.k = 'c01ffedc1cadaeac1d1f1edacac1ab0a',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Set SQN
|
|
|
|
|
|
|
|
db_update_sqn(dbc, id, 23315) --> 0
|
|
|
|
|
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 1,
|
|
|
|
.u.umts.k = 'c01ffedc1cadaeac1d1f1edacac1ab0a',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.sqn = 23315,
|
|
|
|
.u.umts.sqn = 0x5b13,
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_update_sqn(dbc, id, 23315) --> 0
|
|
|
|
|
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 1,
|
|
|
|
.u.umts.k = 'c01ffedc1cadaeac1d1f1edacac1ab0a',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.sqn = 23315,
|
|
|
|
.u.umts.sqn = 0x5b13,
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_update_sqn(dbc, id, 423) --> 0
|
|
|
|
|
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 1,
|
|
|
|
.u.umts.k = 'c01ffedc1cadaeac1d1f1edacac1ab0a',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.sqn = 423,
|
|
|
|
.u.umts.sqn = 0x1a7,
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Set SQN: thru uint64_t range, using the int64_t SQLite bind
|
|
|
|
|
|
|
|
db_update_sqn(dbc, id, 0) --> 0
|
|
|
|
|
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 1,
|
|
|
|
.u.umts.k = 'c01ffedc1cadaeac1d1f1edacac1ab0a',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_update_sqn(dbc, id, INT64_MAX) --> 0
|
|
|
|
|
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 1,
|
|
|
|
.u.umts.k = 'c01ffedc1cadaeac1d1f1edacac1ab0a',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.sqn = 9223372036854775807,
|
|
|
|
.u.umts.sqn = 0x7fffffffffffffff,
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_update_sqn(dbc, id, INT64_MIN) --> 0
|
|
|
|
|
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 1,
|
|
|
|
.u.umts.k = 'c01ffedc1cadaeac1d1f1edacac1ab0a',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.sqn = 9223372036854775808,
|
|
|
|
.u.umts.sqn = 0x8000000000000000,
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
db_update_sqn(dbc, id, UINT64_MAX) --> 0
|
|
|
|
|
|
|
|
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
|
|
|
|
DAUC IMSI='123456789000000': No 2G Auth Data
|
|
|
|
|
|
|
|
2G: none
|
|
|
|
3G: struct osmo_sub_auth_data {
|
|
|
|
.type = UMTS,
|
|
|
|
.algo = MILENAGE,
|
|
|
|
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
|
|
|
|
.u.umts.opc_is_op = 1,
|
|
|
|
.u.umts.k = 'c01ffedc1cadaeac1d1f1edacac1ab0a',
|
|
|
|
.u.umts.amf = '0000',
|
|
|
|
.u.umts.sqn = 18446744073709551615,
|
|
|
|
.u.umts.sqn = 0xffffffffffffffff,
|
|
|
|
.u.umts.ind_bitlen = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- Delete subscriber
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
|
|
|
|
struct hlr_subscriber {
|
|
|
|
.id = 1,
|
|
|
|
.imsi = '123456789000000',
|
|
|
|
}
|
|
|
|
|
|
|
|
db_subscr_delete_by_id(dbc, id) --> 0
|
|
|
|
|
|
|
|
db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> -ENOENT
|
|
|
|
|
|
|
|
===== test_subscr_sqn: SUCCESS
|
|
|
|
|
db v6: determine 3G AUC IND from VLR name
Each VLR requesting auth tuples should use a distinct IND pool for 3G
auth. So far we tied the IND to the GSUP peer connection; MSC and SGSN
were always distinct GSUP peers, they ended up using distinct INDs.
However, we have implemented a GSUP proxy, so that, in a distributed
setup, a remotely roaming subscriber has only one direct GSUP peer
proxying for both remote MSC and SGSN. That means as soon as a
subscriber roams to a different site, we would use the GSUP proxy name
to determine the IND instead of the separate MSC and SGSN. The site's
MSC and SGSN appear as the same client, get the same IND bucket, waste
SQNs rapidly and cause auth tuple generation load.
So instead of using the local client as IND, persistently keep a list of
VLR names and assign a different IND to each. Use the
gsup_req->source_name as indicator, which reflects the actual remote
VLR's name (remote MSC or SGSN).
Persist the site <-> IND assignments in the database.
Add an IND test to db_test.c
There was an earlier patch version that separated the IND pools by
cn_domain, but it turned out to add complex semantics, while only
solving one aspect of the "adjacent VLR" problem. We need a solution not
only for CS vs PS, but also for 2,3G vs 4G, and for sites that are
physically adjacent to each other. This patch version does not offer any
automatic solution for that -- as soon as more than 2^IND_bitlen
(usually 32) VLRs show up, it is the responsibility of the admin to
ensure the 'ind' table in the hlr.db does not have unfortunate IND
assignments. So far no VTY commands exist for that, they may be added in
the future.
Related: OS#4319
Change-Id: I6f0a6bbef3a27507605c3b4a0e1a89bdfd468374
2019-12-12 03:04:53 +00:00
|
|
|
|
|
|
|
===== test_ind
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"msc-23\0" ind = 1
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"sgsn-11\0" ind = 2
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"msc-42\0" ind = 3
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"sgsn-22\0" ind = 4
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"msc-0x17\0" ind = 5
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"sgsn-0xaa\0" ind = 6
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"msc-42\0" ind = 3
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"sgsn-22\0" ind = 4
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"msc-0x17\0" ind = 5
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"sgsn-0xaa\0" ind = 6
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"sgsn-0xbb\0" ind = 7
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"msc-0x2a\0" ind = 8
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"msc-42\0" ind = 3
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"sgsn-22\0" ind = 4
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"msc-23\0" ind = 1
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"sgsn-11\0" ind = 2
|
|
|
|
|
|
|
|
db_ind_del(dbc, &vlr) --> 0
|
|
|
|
|
|
|
|
"msc-0x17\0" ind deleted
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"msc-0x2a\0" ind = 8
|
|
|
|
|
|
|
|
db_ind(dbc, &vlr, &ind) --> 0
|
|
|
|
|
|
|
|
"any-unknown\0" ind = 9
|
|
|
|
|
|
|
|
===== test_ind: SUCCESS
|
|
|
|
|