aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc
AgeCommit message (Collapse)AuthorFilesLines
2014-12-28log: Set the context for paging requests as well.shared/31c3Holger Hans Peter Freyther1-0/+1
2014-12-28db: Begin with some indexes to speed up look-upsHolger Hans Peter Freyther1-0/+6
For MT-SMS we need to look-up a subscriber based on the extension and to find a undelivered SMS we need to search for the sent column to be NULL. Add two indexes to speed-up this operation.
2014-12-25sms: Remove the text of delivered SMS when they are sentHolger Hans Peter Freyther1-1/+3
When a SMS is marked as sent, clear the paypload. We might want to know about connections and delivered sms but certainly not about the content.
2014-12-09msc: Add net parameter to trans_allocJacob Erlbeck3-6/+9
The trans_alloc function still uses the subscr object to access the network object. This patch adds an explicit net parameter to this function and removes the access to subscr to obtain it. Sponsored-by: On-Waves ehf
2014-12-05msc: Add and use gsm_subscriber_groupJacob Erlbeck11-56/+65
Currently every subcriber object directly refers to the gsm_network which contains a flag shared by every related subscriber (keep_subscr). This adds a dependency on gsm_network even if only the function defined in gsm_subscriber_base.c are used. This patch adds a new struct gsm_subscriber_group which contains the keep_subscr flag and a back reference to the network object. The latter is not dereferenced in gsm_subscriber_base.c, so it can safely be set to NULL when only that part of the gsm_subscriber API is being used. It also changes that API to use gsm_subscriber_group instead of gsm_network parameters. Since there are some places where a pointer to the gsm_network is needed but where only a gsm_subscriber is available, a 'net' back pointer is added to the group struct, too. Nevertheless subscr group and network could be separated completely, but this is not the topic of this commit. Sponsored-by: On-Waves ehf
2014-12-05msc: Don't use the subscriber to access the net objectJacob Erlbeck3-11/+11
Sponsored-by: On-Waves ehf
2014-12-05msc: Add net back pointer to gsm_transJacob Erlbeck2-33/+35
Currently the net pointer is obtained from trans->subscr->net. On the other hand, the list gsm_trans object is managed by the net object. This patch adds the back pointer to the structure and replaces all trans->subscr->net by trans->net expressions. In trans_alloc() the trans->net pointer is obtained from the subscr object. Sponsored-by: On-Waves ehf
2014-10-28nitb/ctrl: Fix access to freed memory in verify_subscriber_modifyJacob Erlbeck1-7/+9
Currently the temporary string 'tmp' is freed before parts of it are referenced. This lets address sanitizer complain when evaluating strlen(imsi), where imsi points into the 'tmp' data block. This patch moves the talloc_free to the end of the function and uses a rc variable instead of using early returns. Addresses: testSubscriberAddRemove (__main__.TestCtrlNITB) ... Launch: ./src/osmo-nitb/osmo-nitb -c ./doc/examples/osmo-nitb/nanobts/openbsc.cfg -l test_hlr.sqlite3 Connecting to host 127.0.0.1:4249 Sending "SET 1000 subscriber-modify-v1 2620345,445566" Decoded replies: {} ERROR Sponsored-by: On-Waves ehf
2014-10-03nitb: Add subscriber delete commandRuben Pollan1-1/+33
2014-08-21move libctrl from openbsc to libosmoctrl (libosmocore.git)Harald Welte1-1/+1
2014-08-04MNCC: Add IMSI to CALL CONFIRM messageAndreas Eversberg1-0/+4
LCR requires IMSI to correlate calls for MPTY (multi party conference) and ECT (call transfer).
2014-08-02vty: Fix interactive VTY help for silent-sms transmissionHarald Welte1-3/+3
2014-08-02DB: produce a backtrace in case of a DB errorHarald Welte1-0/+1
This helps us to identify where exactly in our code the DB error originates from.
2014-07-19smpp: Fix small typo in the commentHolger Hans Peter Freyther1-1/+1
2014-07-03db: Use ulonglong to access the database for sqlite3Holger Hans Peter Freyther1-14/+14
The type in the schema is integer but we need to use ulonglong to read it as otherwise the read will fail. DBI: -7: The requested variable type does not match what libdbi thinks it should be
2014-06-18nitb: Only print channel activations once in show statisticsHolger Hans Peter Freyther1-3/+0
openbsc_vty_print_statistics will already print these counters for us. No need to print them again.
2014-05-18Add support for AMR frames to MNCC/RTP interfaceAndreas Eversberg1-0/+1
AMR rate is currently fixed to 5.9k.
2014-05-18bsc_api/NITB: If TCH/H channel is used, indicate it to bsc_apiAndreas Eversberg1-1/+2
If we don't do this, OsmoNITB will send an assignment command from a TCH/H to another TCH/H without any need.
2014-05-18Add check to tch_map(), if RTP sockets existAndreas Eversberg1-0/+11
2014-04-30db: Fix fall-out with the subscriber removal in the subscriber deletion codeHolger Hans Peter Freyther1-2/+2
The sender_id is gone so the code that attempted to delete SMS didn't work anymore. Delete the SMS based on src_addr or the dest_addr. Fixes: ====================================================================== ERROR: testSubscriberAddRemove (__main__.TestCtrlNITB) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/ctrl_test_runner.py", line 379, in testSubscriberAddRemove r = self.do_set('subscriber-delete-v1', '2620345') File "tests/ctrl_test_runner.py", line 114, in do_set return self.recv_msgs()[id] KeyError: 1002
2014-04-30db: Add testcase for the db migration.Holger Hans Peter Freyther1-0/+2
2014-04-30sms: Add code to migrate the database to the new schemaHolger Hans Peter Freyther1-16/+193
This is mostly based on Alexander's migration code. The code adds transaction handling and some sanity checks and cleanups to the code. We made the decision to fork the sms_from_result method and freeze it to that version. This way sms_from_result can move forward without having to deal with legacy.
2014-04-30sms: Do not store received id in the SMS database.Alexander Chemeris1-21/+10
That was a bad idea from the very beginning. A visible result of this is a wrong SMS routing when you change subscriber extensions, while having queued SMS. It's also a very wrong thing from the code layering perspective. I think the next logical step should be to remove "receiver" pointer from the gsm_sms structure into a structure, special for the internal SMS queue.
2014-04-30sms: Kill the sms->sender and use addr/ton/npi throughout the codeHolger Hans Peter Freyther3-34/+42
This is an incompatible database schema change. Store the type of the address in the database for both the sender and the receiver. Currently it is possible to use SMPP to store a SMS and the NPI and TON will be lost on the delivery of the SMS. The schema is changed to make the delivery always use the right NPI/TON. This patch is not ready for the master branch as there is no upgrade path for the HLR yet.
2014-04-04bsc/msc: Extension can never be NULL use strlen insteadHolger Hans Peter Freyther1-1/+1
Fixes: Coverity CID 1040717
2014-04-04msc: Name is never NULL use strlen to check if it is emptyHolger Hans Peter Freyther1-1/+1
Fixes: Coverity CID 1040716
2014-03-23nitb/ctrl: Implement a command to list all active subscribersHolger Hans Peter Freyther2-0/+62
This is only useful for small networks. List the IMSI and MSISDN of all active subscribers. Fixes: SYS#266
2014-03-23nitb/ctrl: Implement creating and deleting subscribersHolger Hans Peter Freyther2-0/+131
Sadly there is no proper foreign key relationship on the tables that related to the Subscriber. This means we can't use a DELETE with Cascade and need to delete everything by hand. To make things worse maybe the SMS/Paging code is still using the subscriber making the operation more dangerous. I had added NULL checks for sender_id/receiver_id at 30C3 so we should not crash in this situation. Fixes: SYS#274
2014-03-23nitb/ctrl: Add command to add/modify a subscriber to the databaseHolger Hans Peter Freyther2-1/+107
The test has been manually verified. Executing the select for the subscribers showed: sqlite> select * from Subscriber; 1|2014-03-23 12:12:46|2014-03-23 12:19:09|2620345||445567|1||0| This created a subscriber with the right IMSI, MSISDN and has it authorized. Fixes: SYS#275
2014-03-20mncc: Add support for half rate V1 frames to MNCC/RTP interfaceAndreas Eversberg1-2/+4
2014-03-20mncc: Use helper function to check if an MNCC frame is data (speech/traffic)Andreas Eversberg2-16/+9
Rename method mncc_rcv_tchf() to mncc_rcv_data(), because the check applies to all types of data frames, not only TCH/F data.
2014-03-20mncc: Complete definitions for all speech traffic frames at MNCC interfaceAndreas Eversberg1-1/+5
The new definitions are: half rate and AMR Change of definition name for bad frame, because it applies to all types of traffic, not only TCH/F. Increase MNCC interface version to 4. Version 3 is skipped, because it was used by older version of Linux-Call-Router which is incompatible with the current version of the MNCC interface.
2014-03-09sms: Rename gsm340_gen_tpdu() to gsm340_gen_sms_deliver_tpdu()Alexander Chemeris1-5/+5
Rename gsm340_gen_tpdu() to gsm340_gen_sms_deliver_tpdu() to show that it generates SMS-DELIVER TPDU and is not a generic function.
2014-03-09db,sms: Rename db_sms_mark_sent() to db_sms_mark_delivered()Alexander Chemeris2-3/+3
In MT-SMS the message is being delivered. Make the naming follow that. The schema still refers to "sent" while it should be "delivered" too.
2014-03-07db: Remove the german from the log messageAlexander Chemeris1-1/+1
2014-03-06smpp_smsc: Fix integer overflow in read return value and msgb_alloc()Daniel Willmann1-6/+6
The size parameter of msgb_alloc is uint16_t so any length value above 65535 will allocate a msgb with incorrect size. This patch changes the type of rdlen and rc to ssize_t (the return value of read) and guards against the read length being larger than UINT16_MAX. To reproduce the issue run: echo -en "\x00\x01\x00\x01\x01" |socat stdin tcp:localhost:2775
2014-03-06smpp_smsc: Check that the size is large enough to hold actual dataDaniel Willmann1-0/+6
The first 4 bytes are the length including the length field. For length < 4 the subsequent msgb_put(msg, sizeof(uint32_t)) will fail, resulting in an abort. The code also expects (in smpp_msgb_cmdid()) the existence of 4 more bytes for the SMPP command ID. This patch checks that the length received is large enough to hold all 8 bytes in the msgb and drops the connection if that's not the case. The issue is reproducible with: echo -e "\x00\x00\x00\x02\x00" |socat stdin tcp:localhost:2775
2014-03-06smpp_smsc: Fix socket read() error handlingDaniel Willmann1-16/+31
Read returning -1 is an error here so make sure to print the actual reason and close the socket. Before this patch we just looped over the fd with read returning -1 every time. EINTR is handled to not cause an error and we don't need to check EAGAIN/EWOULDBLOCK since the callback is only called in case there is something to read. To avoid copy&paste issues the check is implemented as a macro and the log message moved into a separate if.
2014-02-24sms: Address the TODO and schedule the next SMS for an active subscriberHolger Hans Peter Freyther1-6/+45
When one SMS has been delivered check if a second SMS can be scheduled to that subscriber. If nothing can be scheduled kick the normal SMS queue as one slot has become free now. Otherwise send the SMS and create a pending entry.
2014-02-24sms: Do not interfere with the SMS queue from within gsm_04_11Holger Hans Peter Freyther2-17/+6
It was possible that two SMS would be delivered at the same time which violates GSM 04.11. We should solely rely on the sms queue to schedule more SMS to the subscriber.
2014-02-21SMPP: UCS2 data_coding is 0x08, not 0x80!Harald Welte1-1/+1
As can clearly be seen from SMPP Spec v3.4 Chapter 5.2.19, a SUBMIT-SM with data_coding == 0x08 is UCS2, not with 0x80. Thanks to ciaby@rhizomatica.org for reporting the bug.
2014-02-20sms: Increment the RP Message Reference for each transactionHolger Hans Peter Freyther3-3/+41
Each RP-DATA should have a unique msg reference. Currently 42 is used for all of these. Remember the last reference we used and increment it on the next SMS. Do not track if the reference is still in use a clash is a lot less likely now. First unless SMPP is used only one SMS is delivered at a time, second the transaction space is a lot smaller than the one for the reference.
2014-01-31sms/dtap: Add log messages to analyse SMS message lossJacob Erlbeck3-0/+10
Incoming DTAP messages from MS are discarded during silent calls, which leads to the repeated delivery of SMS since the ACKs are not being processed. This patch adds some log messages that have been helpful to track this down. Sponsored-by: On-Waves ehf
2014-01-27Add function to update TRAU muxer after assignment or handoverAndreas Eversberg1-3/+16
E1 based BTS use TRAU muxer to decode TRAU frames. After changing channel from one timeslot to another (due to handover or assignment), the TRAU muxer must be updated. The call reference of the call is disconnected from the old channel and connected to the new channel.
2014-01-16Remove obsolete check of conn and lchan pointers not beeing NULLAndreas Eversberg1-4/+2
The check is removed from gsm48_cc_rx_setup() and gsm48_cc_rx_call_conf(). Receiving a layer 3 message implies that the transaction has a subscriber connection and a logical channel. This patch fixes the Coverity issues with CID 115311 and CID 1155312.
2014-01-14Each BTS can be configured for speech support (other than GSM full rate)Andreas Eversberg2-1/+29
Speech codings which are not supported by BTS will be removed from the bearer capability information element after parsing. This way it is not required for the MNCC application to consider support of each BTS. Only GSM full rate is supported by default.
2014-01-08nitb: Set the DST field in generated MM info messagesJacob Erlbeck1-0/+15
Currently the NET_DST information element (see GSM 24.008) is not included in generated MM info messages even when the DST field in the timezone info has been set via the VTY or the control interface. This patch modifies gsm48_tx_mm_info() to append this information element if (and only if) a non-zero DST has been configured. The DST IE is not part of GSM 4.8. Therefore it will only be sent, if the DST offset is configured to a value != 0. The DST functionality has been verified with wireshark by Jacob. Sponsored-by: On-Waves ehf
2013-12-29smpp: In case we know the receiver set the context for loggingHolger Hans Peter Freyther1-0/+2
2013-12-29mncc: Add the context we get from the MNCC interfaceHolger Hans Peter Freyther1-0/+13
Currently we only set the SUBSCR on RSL messages. Extend it to messages that go through MNCC. For call control/bridging it is difficult to pick the right subscriber. We should support a list or at least two legs in the imsi filter context.
2013-12-28ussd: Reject and release unhandled SS requests/interrogationTobias Engel1-1/+9
In case the unpack of a USSD request is failing the channel would remain open and the phone would not receive a response. Simply reject the interrogation. Example interrogation: 0000 1b 7b 1c 0d a1 0b 02 01 01 02 01 0e 30 03 04 01 0010 11 7f 01 00