aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmsc
AgeCommit message (Collapse)AuthorFilesLines
2017-12-14Cosmetic: move translation of vlr_ciph into msc_vlr_set_ciph_mode()Neels Hofmeyr2-27/+19
a_iface_tx_cipher_mode() is a bit too far away from the VLR to be handling its ciphering enums. Instead, construct the gsm0808_encrypt_info in the msc_vlr_set_ciph_mode() callback. Greatly simplify the sanity checking code. Change-Id: Id46f9a513b555d0a481f7124c9984c2b5b196b3e
2017-12-14fix BSSMAP Cipher Mode Cmd: properly set permitted algorithmsNeels Hofmeyr1-1/+1
The bit shifting is performed in gsm0808_enc_encrypt_info(), and must not be done when populating the gsm0808_encrypt_info struct. Change-Id: If75f95e8a5cc8b9979610ce6d746c1f0073ee39a
2017-12-14debug log: enrich Cipher Mode Cmd log in a_iface_tx_cipher_mode()Neels Hofmeyr1-1/+4
Change-Id: Ib406d6e6784342341e716206997e382c702ac9d2
2017-12-14compiler warning: drop double 'const' in a_iface_tx_cipher_mode()Neels Hofmeyr1-1/+1
Change-Id: I3b8baa9a259704e719ce7f12776f2d2125ebdef0
2017-12-14fix vty write: add missing 'authentication optional/required' outputNeels Hofmeyr1-0/+2
Change-Id: I4918b8a8a6f4cbe783f588ebe68a2cf1e7e50ae2
2017-12-10sms.db: silence libdbi warnings on out-of-range indexNeels Hofmeyr1-7/+14
Apparently, since libdbi 0.9.0 aka 0.9.0-5 on debian-testing, osmo-msc barfs numerous libdbi warnings whenever a query rightfully returns no rows. Trivially query whether there are any rows first by adding an inline wrap function next_row(). Silenced: DDB <000d> ../../../../src/osmo-msc/src/libmsc/db.c:188 DBI: -6: An invalid or out-of-range index was passed to libdbi DDB <000d> ../../../src/libosmocore/src/backtrace.c:47 backtrace() returned 11 addresses DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0xfb81) [0x555555563b81] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/lib/x86_64-linux-gnu/libdbi.so.1(_error_handler+0x99) [0x7ffff63f5c39] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/lib/x86_64-linux-gnu/libdbi.so.1(dbi_result_next_row+0x3d) [0x7ffff63f785d] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0x11172) [0x555555565172] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0x1e6bc) [0x5555555726bc] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0x1e7f6) [0x5555555727f6] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0x1f1d2) [0x5555555731d2] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0xbb86) [0x55555555fb86] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0x7ffff5cfe561] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0xbfba) [0x55555555ffba] Related: OS#2667 Change-Id: Ib8993c8db171d1e845a6297deef137d18506cda3
2017-12-06sms db: properly quote MSISDN in various SQL queriesNeels Hofmeyr1-5/+18
Related: OS#2706 Change-Id: I793a3863e6f4ccbabafc7dabaff97a8c79bbd8e0
2017-12-06sms db: don't attempt to query pending SMS for unset MSISDNNeels Hofmeyr1-0/+4
When the subscriber has no MSISDN, we might construct an invalid SQL statement such as ... AND dest_addr= AND ... Instead, don't even query for empty MSISDNs. Related: OS#2706 Change-Id: I7d6169d774b2da04b3051957e364fe620feed51e
2017-12-05Add missing CFLAGSAlexander Huemer1-0/+1
Change-Id: I67b5d797a80b55e01dcdbb8c782748b049cf9199
2017-11-27fix use after free: missing conn_get on CC paging responseNeels Hofmeyr1-1/+1
Adjust test expectations accordingly. The error was: ==16084==ERROR: AddressSanitizer: heap-use-after-free on address 0x61500000f5f4 at pc 0x561be639ac2b bp 0x7ffc0aabbe40 sp 0x7ffc0aabbe38 READ of size 4 at 0x61500000f5f4 thread T0 #0 0x561be639ac2a in _msc_subscr_conn_put ../../../../src/osmo-msc/src/libmsc/osmo_msc.c:384 #1 0x561be636070b in rx_from_ms ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_tests.c:204 #2 0x561be6360b21 in ms_sends_msg ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_tests.c:217 #3 0x561be635b40a in test_call_mt ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_test_call.c:328 #4 0x561be6363bb7 in run_tests ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_tests.c:802 #5 0x561be63524ea in main ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_tests.c:849 #6 0x7f6eebb3e2b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0) #7 0x561be6352fb9 in _start (/n/s/osmo/make-3G/osmo-msc/tests/msc_vlr/msc_vlr_test_call+0xdafb9) Related: OS#2672 Change-Id: If0659a878deb383ed0300217e2c41c8c79b2b6a5
2017-11-27cosmetic: log error when using a conn that's in releaseNeels Hofmeyr1-1/+4
If a conn is attempted to be used when in release, log an error, but don't skip tracking. No current code path apparently hits this, according to msc_vlr_tests. Just making sure that we will prominently see such errors when we introduce any. Change-Id: I8dd20ee56ce5ad7a90fcd03a06604c383e5eed54
2017-11-27subscr_conn: introduce usage tokens for ref error trackingNeels Hofmeyr6-19/+62
When hunting a conn use count bug, it was very hard to figure out who's (not) using the conn. To ease tracking down this bug and future bugs, explicitly name what a conn is being reserved for, and track in a bit mask. Show in the DREF logs what uses and un-uses a conn. See the test expectation updates, which nicely show how that clarifies the state of the conn in the logs. On errors, log them, but don't fail hard: if one conn use/un-use fails, we don't want to crash the entire MSC before we have to. Change-Id: I259aa0eec41efebb4c8221275219433eafaa549b
2017-11-27cosmetic: add missing spacesPhilipp Maier1-1/+1
call to msc_call_connect() lacks spaces in parameter list Change-Id: I4c11abaeff62749cbc365dfef671c4e15a85fc95
2017-11-22cosmetic: debug log: mncc: detached subscr: show subscriberNeels Hofmeyr1-1/+1
Change-Id: I477984d5e3bee8aea32419482d6bc48b1e74e6c2
2017-11-22cosmetic: log: CC trans_alloc: log trans_id and subscr, not memory addrsNeels Hofmeyr1-2/+3
Change-Id: I5f8b45d6580d42b00de847c8100023b414771939
2017-11-22cosmetic: log: CC state transition: log trans id and subscrNeels Hofmeyr1-3/+5
Change-Id: I11c5213b90de27dc2606f73c686f263008b6522f
2017-11-21libmsc/vty: don't access old bsc rate countersAlexander Couzens1-8/+0
The BSC rate counters are a leftover from the nitb split. Accessing them would result into a null-pointer exception, because the struct isn't initialized. Change-Id: I8c72ab8bf781d3f9a436eb1a27ac4d13df5e656b
2017-11-20subscr_conn: don't close after conn timeoutNeels Hofmeyr1-1/+2
If dispatching a conn timeout, the conn fsm will already have been discarded, and we cannot fire any more events to it. The expected test output changes illustrate that we are now omitting event dispatches that happen *after* the same FSM was already deallocated. Change-Id: I25af3e5a1b04e3a5c9f41956cbcbbdd8439c6457
2017-11-20cosmetic: move log message to else branchPhilipp Maier1-7/+7
The log message after the nullpointer check for conn tricks Coverity Scan into detecting a nullpointer deref. Include the log message into else branch to state the program flow more clearly Fixes: Coverity CID#178656 Change-Id: If6e962f4033c955ecd3539a719031a83c9b6205a
2017-11-20reset: remove name variable from reset contextPhilipp Maier1-1/+3
The reset context contains a string buffer to allow for setting a human readable name, that is then displayed in the logs. Since OSMO-FSMs already have such a feature there is no need for an extra name variable. Use LOGPFSML and the name parameter of osmo_fsm_inst_alloc() to display the name of the FSM Fixes: Coverity CID#178664 Change-Id: I5b051606791c5e085ca6bb1be20592127d48ceb5
2017-11-14sms_route_mt_sms: Don't return uninitialized variableHarald Welte1-1/+2
Wen there's no SMPP support compiled in, and routing was successful, we shouldn't return an uninitialized value. Change-Id: I4abbbb5ab336a7e8da08d682f396baec3b56fa3a Fixes: Coverity CID#174176
2017-11-01vty: skip installing cmds now always installed by defaultNeels Hofmeyr3-5/+0
vty_install_default() and install_default() will soon be deprecated. Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b Change-Id: I34708c73d8084db4e6c83a39be8fdaeaa492d743
2017-10-31vty: drop deprecated 'logging level sms...'Neels Hofmeyr1-15/+0
No need to drag legacy VTY from osmo-nitb to osmo-msc. Change-Id: I38ba8b9414de383bf497526d97bf7a039e41fd35
2017-10-31vty: make auth tuple reuse configurableNeels Hofmeyr1-0/+31
Change-Id: Iba6253d9bf8d4a9d9f6f26ba045e6c7f0dc7f8f2
2017-10-28Depend on both libosmo-sigtran-dev and libosmo-sccp-devHarald Welte1-0/+1
libmsc/a_iface.c and libmsc/a_iface_bssap.c still include osmocom/sccp/sccp_types.h to get access to enums defining SCCP cause values. Until that is resolved, we have to keep the build dependency to libosmo-sccp-dev Change-Id: I957dcb2bcce216d0fd81a58bfe869aca0e4624a8 Related: OS#2601
2017-10-05add ';' after OSMO_ASSERT()Neels Hofmeyr1-1/+1
Currently, OSMO_ASSERT() is defined such that it ends in a semicolon, hence an added ';' is redundant. However, the usual way this kind of macro should be defined is #define OSMO_ASSERT(x) do { ... } while(0) so that the compiler requires a trailing semicolon. To prepare for such a change possibly coming up in libosmocore, add ';' to all OSMO_ASSERT() users. Change-Id: Ic79c8b8f98a7f3bef761751d55a7e6125cf2c46d
2017-09-24fix build: remove obsolete header legacy_mgcp/mgcp.hNeels Hofmeyr1-1/+0
Since Ifb8f3fc2b399662a9dbba174e942352a1a21df3f libosmo-mgcp-client has its own definitions in mgcp_common.h, which conflict with legacy_mgcp/mgcp.h. This cross-inclusion to support libosmo-mgcp-client is no longer necessary. In the future, including libosmo-mgcp-client together with libosmo-mgcp will be made possible, but not with libosmo-legacy-mgcp (because we don't care enough). That is why including libosmo-legacy-mgcp headers would cause build failure. Depends: Ifb8f3fc2b399662a9dbba174e942352a1a21df3f Change-Id: I8e3359bedf973077c0a038aa04f5371a00c48fa0
2017-09-19ctrl: remove unimplemented cmds subscriber-{modify,delete}Neels Hofmeyr1-22/+0
Change-Id: I754de5d08c053fea5f1ca2673b0ac4d26a85778a
2017-09-19vty: fix: missing default cmds at hlr nodeNeels Hofmeyr1-0/+1
Without this, it is impossible to exit the 'hlr' node. Change-Id: I53e572194af39a431c54f83cd07e4c41c6fdf7f8
2017-09-15Remove rest_octets.hMax6-1/+10
The MSC should not fiddle with low-level SI details like rest octets anyway. Unfortunately simply removing the header is impossible as it causes massive fallout due to missing includes. Fixed it as well. The only other parameter which required removal is cell_ro_sel_par which is not referenced anywhere in the code anyway. Change-Id: Ibff77330de056fad4288cd4c48d016aad8105354
2017-09-11a_iface: fix typoPhilipp Maier1-1/+1
Change-Id: Ia849a4043d0fb209fe6e6840908f4f7fe90dc9e5
2017-09-11a_iface: fix memory leaksPhilipp Maier3-9/+20
Fix multiple memory leaske in A/BSSMAP code Change-Id: I90703c96e6a266a1cfa60b184139375aeb9ae32d
2017-09-09ctrl: subscriber-list-active: list only attached subscribersNeels Hofmeyr1-0/+3
I would have liked to add a regression test to verify this, but currently there is no easy way to run CTRL tests and at the same time have access to the osmo-msc in a way that simulates an attached subscriber. Related: OS#2285 Change-Id: I003542b208ecf3713e9e67712d84ccb4c61af14e
2017-09-08use separated libosmo-mgcp-client, apply rename to mgcp_client_*Neels Hofmeyr5-25/+25
After osmo-mgw changes I8e0b2d2a399b77086a36606f5e427271c6242df1 and I99f7faab637cfcc22ece64a1dbcbe590f2042187, apply linking of new libosmo-mgcp-client and renames to drop the "gw" from mgcp_client_*. Also rename the gsm_network.mgcpgw to mgw, to indicate that the MGCP client is used to contact the MGW (Media Gateway). Depends: I8e0b2d2a399b77086a36606f5e427271c6242df1 (osmo-mgw) I99f7faab637cfcc22ece64a1dbcbe590f2042187 (osmo-mgw) Change-Id: I093ad02ca0e532f659447c785e09678b3e6f220d
2017-09-06rename include/openbsc to include/osmocom/mscNeels Hofmeyr31-221/+221
Change-Id: I1f96a1285bbd1b4607614856bca935d5c26e2da9
2017-08-29libmsc: make pitfall in gsm0408_dispatch() more obviousPhilipp Maier1-2/+6
The function gsm0408_dispatch() accepts a message buffer pointer and accesses the l3h pointer. Even in a properly allocated message buffer, this may lead into a segfault if the user forgets to set the l3h pointer. This commit adds assertions to popup a more expressive error message. Change-Id: I43bd9bd1c170559aaa8dacaef25dba090744bcd5
2017-08-29split off osmo-msc: remove files, apply build, renameNeels Hofmeyr1-1/+0
Change-Id: Icf025e5ea8d180613b3114282951c9afa67af9a7
2017-08-29add msg type to SMS rx loggingNeels Hofmeyr1-1/+3
Change-Id: I73ea4eebe57b2d1008045a27f174072178b9f077
2017-08-29move to osmo-mgw.git: osmo-bsc_mgcp and libmgcp as libosmo-legacy-mgcpNeels Hofmeyr3-5/+5
Rewire build and includes to libosmo-legacy-mgcp. Drop osmo-bsc_mgcp and related python tests, now found in osmo-mgw.git. libosmo-legacy-mgcp is installed from osmo-mgw, hence add the dependency to jenkins.sh (so far using the pre_release branch). Change-Id: Ic99d681759edce11564da62500c2aac5cf5fffe2
2017-08-29move libiu to osmo-iuh/libosmo-ranapNeels Hofmeyr11-54/+70
Remove libiu here, use the functions from libosmo-ranap instead, by applying the ranap_ / RANAP_ prefix. Corresponding change-id in osmo-iuh.git is I6a3f7ad15be03fb94689b4af6ccfa828c25f45c0 To be able to run the msc_vlr tests for RAN_UTRAN_IU without Iu client headers available, add iu_dummy.h, containing mere function signatures that match iu_dummy.c and a mostly empty struct ranap_ue_conn_ctx. Make sure we can build with and without --enable-iu: include osmo-iuh headers only with --enable-iu. Change-Id: Ib8c4fcdb4766c5e575618b95ce16dce51063206b
2017-08-29Implement AoIP, port to M3UA SIGTRAN (large addition and refactoring)Philipp Maier10-108/+1695
This was originally a long series of commits converging to the final result seen in this patch. It does not make much sense to review the smaller steps' trial and error, we need to review this entire change as a whole. Implement AoIP in osmo-msc and osmo-bsc. Change over to the new libosmo-sigtran API with support for proper SCCP/M3UA/SCTP stacking, as mandated by 3GPP specifications for the IuCS and IuPS interfaces. From here on, a separate osmo-stp process is required for SCCP routing between OsmoBSC / OsmoHNBGW <-> OsmoMSC / OsmoSGSN jenkins.sh: build from libosmo-sccp and osmo-iuh master branches now for new M3UA SIGTRAN. Patch-by: pmaier, nhofmeyr, laforge Change-Id: I5ae4e05ee7c57cad341ea5e86af37c1f6b0ffa77
2017-08-27libmsc: Use actual delivery time in delivery reports.Keith2-2/+3
Set the time on the status report to the time the message was delivered, as this may not be the same as the time when we are delivering the report to the originating MS. Change-Id: I9056429d40bf02731f004b7833f1de45a0d1add8
2017-08-27libmsc: Fix wrong handling of user_message_reference parameterPau Espin Pedrol1-2/+2
libsmpp34 already converts received TLV integer values to native endianess in libsmpp34_(un)pack. Converting them again at receive time swaps the 2 bytes of user_message_reference, then using a wrong value. As GSM03.40 spec uses only 1 byte for the id, then only the high byte of the initial value is used and eventually sent back to the ESME. Again, at that time, htons() is not needed because libsmpp34 already handles that part. See OS-#2429 for more details. Change-Id: If748548a4a223e529a1110c89e483b599b406e8b
2017-08-27smpp: Fix compilation warningPau Espin Pedrol1-1/+1
I already stumbled into 2 compilation environments which had Werror enabled for -Wmaybe-uninitialized and the build failed, so let's workaround this warning. | smpp_openbsc.c: In function 'handle_smpp_submit': | smpp_openbsc.c:216:9: error: 'sms_msg_len' may be used uninitialized in this function [-Werror=maybe-uninitialized] | memcpy(sms->user_data, sms_msg, sms_msg_len); | ^ | smpp_openbsc.c:100:15: note: 'sms_msg_len' was declared here | unsigned int sms_msg_len; | ^ | cc1: some warnings being treated as errors Change-Id: I0901ddadb5f72e1585cb1797ac22c8ab95e83146
2017-08-27LIBMSC: Use sms->text, not sms->user_data to construct report bodyKeith1-1/+1
gsm_04_11.c sms_report_alloc() Use the sms->text, not the sms->user_data to construct the report body. This also prevents the potential output of non printable characters to the log and or vty. Change-Id: Id51bc9483ad6f52d6da74135605cfd12434c7c96
2017-08-27LIBMSC: Place correct dst address in status reportKeith1-1/+1
gsm_04_11.c: gsm340_gen_sms_status_report_tpdu() When we construct the status report PDU, use sms->src instead of sms->dst as the destination address This way we tell the MS that the message was delivered to the destination and not to itself. This is relevant for phones that display a textual representation of the delivery report. Change-Id: I2d4f87ac777465de9bfb5a775a789a2691755ee9
2017-08-27libmsc: use SMPP34_DELIVERY_RECEIPT_* in libsmpp34Pablo Neira Ayuso1-7/+1
Use new definitions in libsmpp34 to set the registered_delivery field accordingly, as provided by I5b3afff1b3b77cccd949e0606914c7ac3ba6114c. Moreover, do not set this header field to zero if status reports are off, the deliver_t structure has been already zeroed so this not required. Change-Id: Ie78e17323796120f576b9c0e1bc5ccc32da8ee12
2017-08-27libmsc: use new smpp34 esm_class definitionsPablo Neira Ayuso1-10/+8
Replace magic numbers by esm_class definitions, which have been added to latest libsmpp34 in Change-Id I91afd8b462b8fd3b2c4c5b54f4eeb7ec5b730b65 Change-Id: I6c458690da60c8f3637680efbd718f6e8c6feb4c
2017-08-27libmsc: use smpp34_tlv_for_each() to avoid suboptimal TLV handlingPablo Neira Ayuso1-30/+40
submit_to_sms() now handles two TLVs, so find_tlv() is suboptiomal and it can be removed, since it would result in two passes on the TLV list. Use new smpp34_tlv_for_each() helper to iterate over the list of TLVs that is available since I446929feed049d0411e1629ca263e2bc41f714cc. Change-Id: I53a65164a6cc4abc6bf57d9a8dc275cf21c90222
2017-08-27libmsc: Remove comment not applying anymorePau Espin Pedrol1-1/+0
The change-id I7276d356d805a83ebeec72b02c8563b7135ea0b6 added msg_ref to the databse but forgot to remove the comment stating it's not being stored. Change-Id: I204f098c8f2a480405446113e2181b2c53700cf3