aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2022-06-11Try to send any queued SMS for the senderkeith/smsKeith Whyte1-0/+5
2022-06-11Try to send all SMS in sub_ready_for_sms()Keith Whyte1-0/+2
2022-06-11Remove the queue re-runners.Keith Whyte1-3/+4
2022-06-11Queue the specific SMS, Don't just run the queue on SMS_SUBMITEDKeith Whyte3-3/+48
Running the queue is not good enough, as only some few SMS for unattached subs will stop the db routine from reaching the new message.
2022-06-10Move VLR check to db.cKeith2-6/+33
Change-Id: Ibd07b9d200b48108d705ed4c461cc4ddfa421fd2
2022-06-07Use unix timestamps in the SMS dbKeith1-6/+6
There's really no need to convert to/from YYYY-MM-DD HH:MM:SS everytime we access the database Change-Id: I26abe838900798e54c8e98ff80021ddba7426b82
2022-05-22Disable SECURE_DELETEKeith Whyte1-1/+7
There is really no need to overwrite deleted SMS with zeros Change-Id: I8856705b62e18ef286ae8dc5f3b81054a9c2fd98
2022-05-22Just delete, don't bother marking sent first.Keith Whyte3-21/+27
Change-Id: I8a0dedf512d861ec02ecb3b5fe5bb1d09b92efe0
2022-05-22Adds db statemente to delete SMS by IDKeith Whyte2-2/+27
We don't worry about status sent/not sent with this version. Change-Id: I753e8043215743b79bb48fab45b30253c25b015f
2022-05-19sms: Introduce VTY-configurable minimum SMS validity periodHarald Welte6-3/+24
This is meant as a safeguard against users or user equipment which doesn't set a reasonable validity period. Using this setting, the SMSC administrator can set a minimum SMS validity period. Any SMS submitted with lower validity period will be extended to that minimum. Change-Id: I192528a6f9059d158fa12876a247d61bd7edaec8 Related: OS#5567
2022-05-19sms: Make default SMS validity period configurable via VTYHarald Welte5-1/+18
Change-Id: Ie2c81c1d5795dd9aaf07b9766013f20b01abc762
2022-05-19smpp: Parse and use SMPP-provided validity periodHarald Welte6-2/+165
Before this patch, we always ignored any SMPP-provided validity period and used '0' which is now, and means it expires immediately. As SMPP allows for validity_period of NULL, use 7 days as SMSC default in such situations. Change-Id: Iad9f2697f045ed3bc0eb74c3a9730861f82e6c48 Closes: OS#5567
2022-05-19sms_queue: Make deletion of messages from DB VTY-configurableHarald Welte4-2/+39
This introduces some VTY settings that determine if delivered or expired messages should be removed from he SQL database or not. Change-Id: Id6174875d5c01c40d987077651b27ae1acbcaa93
2022-05-19sms_queue: Use local variable rather than 9x pointer de-ref in functionHarald Welte1-9/+10
Change-Id: Idf6eb9ec6603a0643033396ed9227e4319724145
2022-05-19sms: Give smsc its own VTY config nodeHarald Welte8-73/+178
The pre-historic sms_queue code used to have very strange aspects, such as having some parameters (max-failure, max-pending) which could only be sent from the 'enable' node, but not from a config file. Before adding more configuration parameters, let's clean this up by introducing a proper VTY config node for the 'smsc'; move the existing config commands there and add new ones for max-failure and max-pending. As the sms_queue data structure is only allocated after the config file parsing happens, we are introducing a new 'sms_queue_config' data structure. This encapsulates the public readable/writable config parameters. Change-Id: Ie8e0ab1a9f979337ff06544b9ab3820954d9804a
2022-05-18tests/msc_vlr/Makefile.am: drop -ldbiOliver Smith1-1/+0
Fix for: /usr/bin/ld: cannot find -ldbi Fixes: d43c22 ("switch from libdbi to lbsqlite3") Change-Id: I8dcce119a8121881d56cb18328b5f702763b43ea
2022-05-17sms: Encapsulate SMS queue related config parametersHarald Welte6-38/+53
Introduce a 'struct sms_queue_config' that holds all config parameters related to the SMS queue. Change-Id: I559ab7a6e0502a1a12a662ebd5591875d47ec7b2
2022-05-17db: Switch from 'synchronous = FULL' to 'synchronous = NORMAL'Harald Welte1-10/+1
As we're using WAL mode, it is not neccessary to use synchronous=FULL but rely on synchronous=NORMAL mode while still guaranteeing database consistency. To do this, we can fix the typo in one of our two PRAGMA statements, and remove the other. See https://www.sqlite.org/pragma.html#pragma_synchronous for the sqlite3 documentation on that topic. Change-Id: Ie782f0fe90e7204c4d55cdb3948b728c348367d1 Closes: OS#5566 RelateD: OS#5564, OS#5563
2022-05-17switch from libdbi to lbsqlite3Harald Welte11-660/+603
The choice of libdbi was one of the biggest early mistakes in (back then) OpenBSC development. A database abstraction library that prevents you from using proper prepared statements. Let's finally abandon it and use sqlite3 directly, just like we do in osmo-hlr. I decided to remove the database migration code as it would be relatively cumbersome to port all of it to direct sqlite3 with prepared statements, and it is prone to introduction of all kinds of errors. Since we don't have a body of older database files and comprehensive migration tests, it is safer to not offer migration code of uncertain quality. The last schema revision (5) was introduced 5 years ago in 2017 (osmo-msc v1.1.0), so it is considered an exceptionally rare case. People can install osmo-msc 1.1.0 through 1.8.0 to upgrade to v5 before using this new 'direct sqlite3' version of osmo-msc. Change-Id: Ia334904289f92d014e7bd16b02b3b5817c12c790 Related: OS#5559, OS#5563, OS#5564
2022-05-16tests: Remove sms.db{-wal,-shm} files, not just sms.dbHarald Welte1-4/+4
ERROR: files left in build directory after distclean: ./sms.db-shm ./tests/sms.db-shm ./tests/sms.db-wal ./sms.db-wal Change-Id: Iecd380f598edbd1635361e4c340d54d092739919
2022-05-16sms_queue: merge sms_pending_add into sms_pending_fromHarald Welte1-8/+3
Both callers would immediately execute sms_pending_add() after a successful sms_pending_from(); we can merge those two functions. Change-Id: Iaf37234b3caafd568dd4fe17739be9ec842c2a8d
2022-05-16sms_queue: refactor sms_pending add/remove codeHarald Welte1-22/+18
This avoids every caller from manually having to remember to increment the count, the stat_item and llist_{add,del}. Change-Id: Ice4c73727ef2d7e4118f0ef5fe24cae943c7528f
2022-05-16smpp: don't enqueue write messages if ESME is disconnectedHarald Welte1-1/+8
If the ESME has been disconnected (dead socket) but still is in memory (other users hold a use count), we shouldn't enqueue messages to the write queue. This prevents messages like DSMPP write_queue.c:112 wqueue(0x7f8bc392f6e0) is full. Rejecting msgb Change-Id: I10a270f1d555782be272f4d78da43190618a9950 Closes: OS#3278
2022-05-16smpp: Fix use-after-free bug when ESME disconnects but has write pendingHarald Welte1-1/+1
When the SMPP code free's an ESME it also free's the related write_queue and the osmo_fd contained therein. So if this happens while we are in esme_link_read_cb(), we must return -EBADF to make osmo_wqueue_bfd_cb() of libosmocore avoid further accessing related memory. Change-Id: I441d3b05c2f2556c530783a7f66c73adf6d845a1 Closes: OS#5565
2022-05-16sms_queue: Introduce rate_ctr / stat_itemHarald Welte1-7/+106
This allows us to monitor the load of the SMS queue. Change-Id: I8c00b5b0d33695fbb5f89fd2a4c8e35c9f7df6ac
2022-05-15vlr: Add rate counters and stat itemsHarald Welte2-5/+193
This should give us some more insight into what is happening inside the MSC's VLR in terms of number of subcribers, rate of successful / unsuccessful GSUP procedures, etc. Related: OS#1974 Change-Id: I681bcfc1875363478190151f2931cad197323ee8
2022-05-15vlr: Split vlr_subscr_rx_imsi_detach()Harald Welte1-4/+11
The function vlr_subscr_rx_imsi_detach() implies that an explicit IMSI DETACH was received. However, that same function was called in other situations such as timer expiration or GSUP CANCEL. Let's clean this up by splitting the function into two parts. No logical change is introduced to the VLR in this patch. Change-Id: Iffc02f3062ad591ca372a3c6d866066cf63a8830
2022-05-15sms_queue: Annotate each function with some commentHarald Welte1-29/+47
It makes the code much more readable if there's at least a one-liner documenting each function (and struct member). Change-Id: I6d239369cabdf1703eba7f3606b46b95cbbb1ea7
2022-05-15switch sqlite3 to single-threaded modeHarald Welte8-0/+14
Looking at 'perf top' of osmo-msc under load shows that there's a significant amount of time spent in terms of locking (mutex,...) which is useless as osmo-msc is a single-threaded application. Unfortunately libdbi doesn't provide a mechanism to perform sqlite3_config(), so we have to do it directly here, introducing an explicit build-time dependency (and linkage) to libsqlite3. Related: OS#5559 Change-Id: I5bbea90d28b6d73b64b9e5124ff59304b90a8a75
2022-05-13call rate_ctr_init() to make rate counters work properlyHarald Welte1-0/+1
The existing rate counters per-minute/hour/day values were never computed as the related timer was never started... Change-Id: I27282051a6da5d1e1a25981712fbe4c4a6378dea
2022-05-04fix crash on CM Serv Rej: fix use count mismatchNeels Hofmeyr3-7/+24
With comments, clarify the code paths where a CM Service use count has not yet been placed on the conn (just send CM Service Reject) and where the use count is placed (decrement count on CM Service Reject). Place the CM Service use count slightly earlier: - it is then correctly present when checking the mobile identity in cm_serv_reuse_conn(), avoiding the crash reported in OS#5532. - there is only one place incrementing the use count instead of two. Related: OS#5532 Change-Id: I6c735b79b67108bcaadada3f01c7046e262f939b
2022-04-13tests: use 'check_PROGRAMS' instead of 'noinst_PROGRAMS'Vadim Yanitskiy6-6/+6
When using 'check_PROGRAMS', autoconf/automake generates smarter Makefiles, so that the test programs are not being compiled during the normal 'make all', but only during 'make check'. Change-Id: I13b519e61ca0d9ce038e8c989ddac012de4a6c61
2022-01-13call_leg: local_bridge: Avoid null pointer access if CN-side not readyPau Espin Pedrol1-0/+3
This happens if for instance an HNBGW drops the RAB-AssignmentRequest and does nothing with it. call_leg.c:348:15: runtime error: member access within null pointer of type 'struct rtp_stream' Related: OS#5401 Change-Id: I67d2d5b2dd3b367c34f929d63c056306ec001431
2022-01-11Drop unneeded ax_check_compile_flag.m4Pau Espin Pedrol1-74/+0
The macro is no longer used since efa6c5b7d688ceea902d3b02ba78b813185d3c40. Change-Id: I58130ad70b5109a5720fc1b5702863cc503e6345
2022-01-07ran_msg_iu.c: Set proper codec in Assignment CompletePau Espin Pedrol1-1/+2
We need to set the codec as present in order for msc_a_up_call_assignment_complete() to configure properly the CN-side of he leg with the IUFP codec, which should be the desired default in order to avoid transcoding. Change-Id: Ib8086462239e2df748cf47ea7b37a07f1f3b85a8
2022-01-07Avoid setting audio codec if not available during assignment_complete (MDCX)Pau Espin Pedrol2-2/+6
RAB Assignment Complete contains no codec info, hence assignment_complete.codec is not set and assignment_complete.codec_present is false. As a result a wrong value is passed to rtp_stream_set_codec. This fixes osmo-msc sending "a=rtpmap:112 AMR/8000/1" during MDCX in the RAT-side connection of the call leg after having properly sent VND.3GPP.IUFP/16000 in CRCX. Change-Id: Ic028d35893d29f7d72f22f82ef89695229c9b01b
2022-01-05Announce IuFP audio codec for UTRAN conns in CRCX towards MGWPau Espin Pedrol3-2/+15
This way the MGW knows it has to handle IuUP in that connection (answer IuUP Initialization, etc.). Depends: osmo-mgw.git 1de5ed6f979bd4c1380789c9a82f8e396f05c5f8 Change-Id: I7aca671e00ed27ac03f0d106b5a6b665a9bed4c1
2021-12-14treewide: remove FSF addressOliver Smith10-40/+0
Remove the paragraph about writing to the Free Software Foundation's mailing address. The FSF has changed addresses in the past, and may do so again. In 2021 this is not useful, let's rather have a bit less boilerplate at the start of source files. Change-Id: I1b68e0aa26d81fbfe26abaa287d2bd5eec2cfd0f
2021-12-09ran_msg_iu: do not pass UEA0 to ranap_new_msg_sec_mod_cmd2()Alexander Couzens1-2/+3
On the protocol level, it's impossible to indicate UEA0 together with the other algorithms. The encryption is either a) disabled, so the Encryption Information IE is not present, or b) enabled, so the Encryption Information IE indicates UEA1 and/or UEA2. Because of that, the ranap_new_msg_sec_mod_cmd2() would fail to generate the RANAP PDU if the given bitmask has the UEA0 bit set. Fixes: 505a94a610fc ("Make UTRAN encryption algorithms configurable") Change-Id: I3271d27c09fc8d70a912bce998ceffbce64dd95e
2021-12-07libmsc: fix memory leak (struct msgb) in msc_i_ran_enc()Vadim Yanitskiy4-14/+7
Function msc_i_ran_enc() calls msc_role_ran_encode(), but unlike the other callers of this function it does not free() the encoded message. A simple solution would be to call msgb_free(), like it's done in the other places. But a more elegant solution is to modify function msc_role_ran_encode(), so that it attaches the msgb to OTC_SELECT. This way there is no need to call msgb_free() here and there. This change fixes a memleak observed while running ttcn3-msc-test. Change-Id: I741e082badc32ba9a97c1495c894e1d22e122e3a Related: OS#5340
2021-12-02libmsc: ran_iu_make_security_mode_command(): clarify UIA maskVadim Yanitskiy1-1/+5
Change-Id: I7535d5ede5b22c61575a16d15927598e6137392a
2021-11-30libmsc: ran_iu_make_security_mode_command(): improve readabilityVadim Yanitskiy1-2/+4
Change-Id: I14f4f9617f91ed17fb7614f218cb023a0231866d
2021-11-30libvlr: fix is_ciph_required(): always send SecModeCmd for UTRANVadim Yanitskiy4-111/+178
Ciphering is optional in both GERAN and UTRAN, however for the later it's *required* to enable integrity protection for the signalling. Thus we must always send Security Mode Command in UTRAN, even in case if ciphering is disabled (UEA0) in the configuration. The actual decision whether to send CMC/SMC or not is taken in: * vlr_access_req_fsm.c / _proc_arq_vlr_node2(), and * vlr_lu_fsm.c / vlr_loc_upd_post_auth(). depending on the value returned by is_ciph_required(). Let's rename this function to is_cmc_smc_required() and ensure that it always returns true in UTRAN. This change fixes the Iu test cases in ttcn3-msc-test. Change-Id: I6205f13453eff7afbf25e013d72ae98a78fcd31b Fixes: OS#5333
2021-11-30libvlr: vlr_set_ciph_mode(): avoid redundant checkVadim Yanitskiy4-7/+0
This function is never called when ciph_required is false, so there is no need for an additional check in this function. Change-Id: I900ddd5f1882f8cee234ab1074adcf25830a092c
2021-11-29libmsc: fix another memleak (struct gsm_sms) in gsm340_rx_tpdu()Vadim Yanitskiy1-1/+1
Change-Id: I42e819fb83096c1432df16f501b9d1f6a6160ae7 Fixes: I2c50904349dd4ed229b60b8468d776b817c0bd44
2021-11-29libmsc: fix memory leak (struct gsm_sms) in gsm340_rx_tpdu()Vadim Yanitskiy1-1/+2
If a MO SMS gets successfully routed through SMPP, we return early in gsm340_rx_tpdu() and leak a chunk of type 'struct gsm_sms'. Change-Id: I8a745d747f06baa7109418ffe600b27b3c0a5228 Fixes: [1] Ic34d398e0a850856e20380ae35e5c2ae5e3c539b Fixes: OS#5334
2021-11-28VTY: clarify deprecation message for cfg_net_per_loc_upd_cmdVadim Yanitskiy1-2/+2
Change-Id: I95636a7713cd90956e46a5b6f8f7ded3bf4f5f0a
2021-11-27libmsc/gsm_04_08: refactor require ciphering into an own functionAlexander Couzens4-4/+16
Make it more readable. Change-Id: I9e407f65b282e645feabe714f7f4c3e44fae21e9
2021-11-17utran: use new UTRAN encryption enumAlexander Couzens5-13/+17
Depends: libosmocore.git I4b9baff2c2fbd0e339fc769cc69cce58d3a72cdf Change-Id: If6978d7ed1a78facc2591cfc30fda2721629bffa
2021-11-16Bump version: 1.7.0.43-aefbf-dirty → 1.8.01.8.0Pau Espin Pedrol5-29/+93
Change-Id: I37aa63e1c4ed021c5cc8b186f073cf01ab9a9cb6