aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/smpp_openbsc.c
AgeCommit message (Collapse)AuthorFilesLines
2016-03-04disable code trying to reach across BSC/MSC bounds, make build passNeels Hofmeyr1-0/+2
Disable ipacc_rtp_direct, Osmo SMPP TLVs, Ctrl interface and channel_test. These need to be reimplemented with proper separation of libs. Add some tall_* pointers the linker requires for osmo-cscn.
2016-03-03libmsc/smpp: disable lchan access for nowNeels Hofmeyr1-0/+2
To make the IuCS build work, disable the BSC-land access from MSC's SMPP code. Some way shall be found to make the Osmocom vendor-specific SMPP TLVs work over the A-interface (after the MSCSPLIT), but we're concentrating on IuCS for now.
2016-02-25smpp: refactor initialization, add bind addressNeels Hofmeyr1-16/+27
Make the SMPP bind address configurable (used to be harcoded as "0.0.0.0"). Add VTY command smpp local-tcp A.B.C.D <1-65535> while keeping the old command 'local-tcp-port <1-65535>'. Both the old and the new command immediately change the SMPP listening address and port. Add a LOGL_NOTICE log when the SMPP listening address and/or port change. However, to be useful, this patch has to go somewhat further: refactor the initialization procedure, because it was impossible to run the VTY commands without an already established connection. The SMPP initialization procedure was weird. It would first open a connection on the default port, and a subsequent VTY port reconfiguration while reading the config file would try to re-establish a connection on a different port. If that failed, smpp would switch back to the default port instead of failing the program launch as the user would expect. If anything else ran on port 2775, SMPP would thus refuse to launch despite the config file having a different port: the first bind would always happen on 0.0.0.0:2775. Change that. In the VTY commands, merely store address and port if no fd is established yet. Introduce several SMPP initialization stages: * allocate struct and initialize pointers, * then read config file without immediately starting to listen, * and once the main program is ready, start listening. After that, the VTY command behaves as before: try to re-establish the old connection if the newly supplied address and port don't work out. I'm not actually sure why this switch-back behavior is needed, but fair enough. In detail, replace the function smpp_smsc_init() with the various steps smpp_smsc_alloc_init() -- prepare struct for VTY commands smpp_smsc_conf() -- set addr an port only, for reading the config file smpp_smsc_start() -- establish a first connection, for main() smpp_smsc_restart() -- switch running connection, for telnet VTY smpp_smsc_stop() -- tear down connection, used by _start() twice And replace smpp_openbsc_init() smpp_openbsc_set_net() with smpp_openbsc_alloc_init() smpp_openbsc_start() I'd have picked function names like "_bind"/"_unbind", but in the SMPP protocol there is also a bind/unbind process, so instead I chose the names "_start", "_restart" and "_stop". The smsc struct used to be talloc'd outside of smpp_smsc_init(). Since the smsc code internally uses talloc anyway and employs the smsc struct as talloc context, I decided to enforce talloc allocation within smpp_smsc_alloc_init(). Be stricter about osmo_signal_register_handler() return codes.
2015-08-08subscr: Fix subscr refcount issue in case of message errorHolger Hans Peter Freyther1-0/+2
In case the SMPP payload didn't include the right fields we would leak the subscr reference count.
2015-07-06sms: Add a way to always route SMS through SMPP systemsHolger Hans Peter Freyther1-0/+5
default-route would only be looked at after there has been no subscriber in the local database. Depending on the setup this is not what one wants. This has been discussed at the OsmoDevCon and there have been hacks in some branches. Let's introduce a VTY command to select if SMPP should be consulted first and then fallback to the current behavior.
2015-02-08smpp: Fix potential crash in handling submitSMHolger Hans Peter Freyther1-3/+4
In case: * No message_payload and a 0 sm_length was used * esm_class indicates UDH being present * 7bit encoding was requested The code would execute: ud_len = *sms_msg + 1; Which is a NULL pointer dereference and would lead to a crash of the NITB. Enforce the limits of the sm_length parameter and reject the messae otherwise. Fixes: Coverity CID 1042373
2015-02-08smpp: Do not check conn for being nullHolger Hans Peter Freyther1-1/+1
We are deferencing conn earlier in this function without doing a null check. At the time deliver_to_esme is called the conn will always exist and even the lchan is likely to be present. Remove the null check for conn right now. Fixes: Coverity CID 1210594
2014-12-05msc: Add and use gsm_subscriber_groupJacob Erlbeck1-2/+2
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-07-19smpp: Fix small typo in the commentHolger Hans Peter Freyther1-1/+1
2014-04-30sms: Kill the sms->sender and use addr/ton/npi throughout the codeHolger Hans Peter Freyther1-3/+2
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-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.
2013-12-29smpp: In case we know the receiver set the context for loggingHolger Hans Peter Freyther1-0/+2
2013-08-03SMPP: use VTY setting for E212/E164 in ALERT NOTIFICATIONHarald Welte1-24/+25
There's a VTY option by which for every ESME the user can specify if the E.212 or E.164 number should be used in DELIVER-SM. The ALERT notifications generate by subscriber LU have so far always contained the E.212 (IMSI) rather than E.164 (MSISDN) which is a bit inconsistent. Rather than copying code, we create a new function that implements ALERTing all ESMEs.
2013-08-03SMPP: convert a SMMA to a SMPP ALERT NOTIFICATIONHarald Welte1-0/+28
2013-08-03SMPP: don't get stuck in case of SMS memory exceededHarald Welte1-0/+4
If the MS memory for SMS is exceeded and we get an RP-layer error, we need to report that back to the (transaction-mode) ESME. Otherwise the ESME will wait forever after sending a SUBMIT-SM without ever receiving a response to it. Thanks to Holger for catching this.
2013-07-27smpp: Move the coding/mode detection into a utils fileHolger Hans Peter Freyther1-35/+1
Make sure to not ever have issues with this code again, move the utility code to a new file and create a basic testcase. The method currently has 100% line and branch coverage. My initial patched missed the smpp_utils.c file and I re-did the copying (and verifying the branch coverage)
2013-07-14smpp: Fix possible NULL dereference of the emse->aclHolger Hans Peter Freyther1-2/+2
The esme->acl is treated like it can be NULL in other places of the code. Assume it can be NULL during this check as well. Dereference after null check (FORWARD_NULL) 9. var_deref_op: Dereferencing null pointer "esme->acl". Fixes: Coverity CID 1042374
2013-07-14smpp: Checking an array for NULL will always be falseHolger Hans Peter Freyther1-1/+1
The if (submit->short_message) and if (smsc->system_id) will always be true. Fixes: Coverity CID 1042371, CID 1042372
2013-07-13Fix license header at smpp_openbsc.c and smpp_smsc.cHarald Welte1-11/+12
As Holger pointed out, they contained a GPLv2+ disclaimer rather than the AGPLv3+ which we use for OpenBSC. This is not an incompaibility, but was done unintentionally. The code was always mean to be under AGPLv3+. Nevertheless, anyone using those two files in a version up to this commit have the right to use it under GPLv2+ as well. This is not applicable for any versions after this commit.
2013-07-11smpp_openbsc: Fix parsing of 03.38 data coding scheme in MO caseHarald Welte1-15/+28
2013-05-28SMPP: Add new 'dcs_transparent' ESME settingHarald Welte1-9/+30
If an ESME has the dcs_transparent config flag, then the TP-DCS of MO-SMS is transparently passed to SMPP and not converted to SMPP specific data_coding values. This is needed in cases where ESMEs actually care about the exact TP-DCS, as the conversion from TP-DCS to SMPP data_coding is not bijective.
2013-05-28SMPP: Pass on 0xFx style DCS from SMPP to GSMHarald Welte1-17/+33
There are multiple ways how the TS 03.38 TP-DCS can indicate 8bit or 7bit messages. SMPP has it's own data coding specification, which is different from TS 03.38. However, some SMPP ESMEs want to be able to have fine-grained control over the TP-DCS indicated in the TPDU header. If such values like 0xF6 are used in SMPP, we now transparently pass them on to the GSM side.
2013-03-13SMPP: Implement SMPP Osmocom Estensions on MO-SMS0.13.0Harald Welte1-4/+81
An ESME can now be configured in the VTY to enable osmocom-extensions, which will add vendor-specific SMPP TLVs for RxLev/RxQual/ARFCN/IMEI and transmit power to the SMPP DELIVER-SM message type.
2013-03-13SMPP: Fix crash on delivery of incoming SUBMIT-SMHarald Welte1-5/+8
As bsc_gsmnet is NULL at the time we call smpp_openbsc_init(), we later run into segfaults with subscribers that don't have a subscr->net set. However, we cannot delay smpp_openbsc_init() until after bsc_bootstrap_network(), as we then fail to parse the SMPP specific VTY/config file options...
2013-01-20smpp: Fix a memleak of the SMS on the submit pathHolger Hans Peter Freyther1-1/+2
2013-01-20SMPP: Inform the SMS Queue that a SMS was submitted to kick the queueHolger Hans Peter Freyther1-1/+6
Work on the 'forward' part.. tell the sms queue that something has been submitted for it.. Conflicts: openbsc/src/libmsc/smpp_openbsc.c
2012-11-24use DLSMS and not DSMS in SMPP related code (merge with master)Harald Welte1-8/+8
2012-11-24SMPP: fix handling of UDH / multi-part for 7-bit messagesHarald Welte1-14/+47
... I would have never believed it is such a broken mindfuck.
2012-11-24SMPP: add small utility program 'smpp_mirror'Harald Welte1-7/+16
This program binds as ESME transceiver to a SMSC and simply mirrors back all SMS that it receives.
2012-11-24SMPP: Implement support for MO SMSHarald Welte1-2/+91
Each ESME can have a number of prefix-matching routes, or it can be a 'default route' to whcih all otherwise unknown SMS destinations are routed.
2012-11-24SMPP: VTY configuration of SMPP code, authentication supportHarald Welte1-0/+12
2012-11-16SMPP: fix subscriber reference leak.Harald Welte1-1/+1
subscr_get_by_* is already increasing the refcount, we shouldn't do that a second time (thanks, Holger).
2012-11-16SMPP: More logging in error cases, fix UDH in 7bit ASCIIHarald Welte1-1/+17
2012-11-16SMPP: Implement ALERT NOTIFICATION on attach/detach of subscribersHarald Welte1-1/+35
2012-11-16SMPP: Deal with DCS according to 03.38 and respect TP-PIDHarald Welte1-12/+11
2012-11-16SMPP: Introduce ESME reference coountingHarald Welte1-3/+7
In case a ESME disappears after SUBMIT-SM but before the MT-SMS is delivered (transaction mode), we have to make sure the esme structure still exists.
2012-11-16SMPP: Implement transaction mode for SUBMIT-SMHarald Welte1-1/+49
WARNING: if the ESME disconnects, osmo_esme gets freed, and sms->smpp.esme might point to invalid/unallocated memory!
2012-11-16Initial support of SMPP interface for MT-SMSHarald Welte1-0/+206