aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc
AgeCommit message (Collapse)AuthorFilesLines
2013-09-11Added new auth policy black-list.Ivan Kluchnikov2-3/+11
In this mode by default we set authorized = 1 for all new subscribers. BSC accepts all MS, except subscribers not authorized in DB. All subscribers with authorized = 0 are part of the black list and not accepted.
2013-09-02vty: Use generic 'end' and 'exit' commandsJacob Erlbeck2-5/+3
Add bsc_install_default() and replace all install_default() This patch adds bsc_install_default() which calls install_default() and add 'exit' and 'end'. All other calls to install_default() are replaced by calls to bsc_install_default(). Since 'exit' and 'end' are now added automatically to each node, the explicit registrations of these commands are removed by this patch, too. The related tests succeed now without work-arounds (except for the 'config' node itself which is part of libosmocore).
2013-09-02SMPP: add missing VTY parameter 'deliver-src-imsi' for ESMEHarald Welte1-0/+24
the parameter was already used in the code and saved from VTY code, but somehow the functions for parsing it didn't make it into master.
2013-08-18Fix: Handle CM service request on already secured channel correctlyAndreas Eversberg1-0/+5
Second part of the previous patch. Log an error message in case we receive a location updating request on an already authenticated channel.
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-27expiration: Allow to disable the periodic location updating procedureHolger Hans Peter Freyther2-26/+46
Disable the periodic LU using "no periodic location update" VTY command. In that case set the expire_lu to 0 which will then be translated to a NULL in the database layer. This leads to a bit of copy and paste in the db_sync_subscriber method but I don't see how we could easily use 'datetime(%i, 'unixepoch')' and 'NULL' at the same time. Change the query to find expired queries to check for NOT NULL and the time being in the past. This means if there are still old subscribers in the database they might not be expired. One would need to execute a query like "UPATE Subscriber SET expire_lu = 0 WHERE expire_lu is null". The same applies when disabling the periodic LU. One would need to update the database by hand. Manual tests executed/passed: 1.) periodic LU enabled: * use gst LUTest.st to do a LU * UPDATE Subscriber SET expire_lu=datetime('now'); * observe the subscriber being expired (it was) 2.) periodic LU disabled: * use gst LUTest.st to do a LU * verify that the expire_lu is NULL in the database
2013-07-27expiration: Speculative fixes for the periodic expiring handlingHolger Hans Peter Freyther3-17/+61
We were expiring subscribers during active calls. This is because the T3212 is stopped under certain conditions but we didn't stop that timer at all. Remember if T3212 timer was stopped due something done by NITB and update the expiration time at the end of the radio connection, as the phone should restart it when returning to MM Idle. It is a bit difficult to decide when we should set the flag. E.g. in a CM Service Request we don't know if we accept the service and during a LU we already send MM messages before we accept or reject the subscriber. The easiest is to set the flag when receiving a paging response on known subscribers and at the end of the authentication process. Do not expire a subscriber that has an active connection that is marked with the flag, e.g. we would still expire a subscriber that is being paged. Manual tests executed/passed: * gst LUTest.st verified that a expiration date was set * gst SMSTest.st (doing another LU but forcing a timeout on the SMS sending). Verified that the expire_lu was updated.
2013-07-27expiration: Print the "expire_lu" time in show subscriberHolger Hans Peter Freyther1-0/+9
This can help with debugging subscriber expiration issues.
2013-07-27smpp: Move the coding/mode detection into a utils fileHolger Hans Peter Freyther4-36/+69
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-27misc: Fix compilation warningsHolger Hans Peter Freyther4-17/+7
bsc_api.c:417:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘unsigned int’ [-Wformat] bsc_api.c: In function ‘handle_ass_fail’: bsc_api.c:458:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘unsigned int’ [-Wformat] db.c: In function ‘db_sync_subscriber’: db.c:785:3: warning: format ‘%i’ expects argument of type ‘int’, but argument 8 has type ‘time_t’ [-Wformat] osmo_msc.c: In function ‘msc_release_connection’: osmo_msc.c:145:20: warning: unused variable ‘trans’ [-Wunused-variable] smpp_smsc.c: In function ‘link_accept_cb’: smpp_smsc.c:891:24: warning: assignment from incompatible pointer type [enabled by default] smpp_smsc.c:271:1: warning: ‘esme_by_system_id’ defined but not used [-Wunused-function] smpp_openbsc.c: In function ‘smpp_openbsc_init’: smpp_openbsc.c:545:2: warning: implicit declaration of function ‘smpp_vty_init’ [-Wimplicit-function-declaration] osmo_bsc_ctrl.c: In function ‘verify_bts_loc’: osmo_bsc_ctrl.c:340:19: warning: variable ‘height’ set but not used [-Wunused-but-set-variable smpp_mirror.c: In function ‘main’: smpp_mirror.c:297:2: warning: implicit declaration of function ‘osmo_init_logging’ [-Wimplicit-function-declaration]
2013-07-21SMPP: complete the VTY help/documentationHarald Welte1-9/+33
As discovered by osmotestconfig.py, a number of SMPP related VTY commands were missing their help/documentation text.
2013-07-14smpp: Close the file descriptor when we can't accept the SMSC connHolger Hans Peter Freyther1-1/+4
When we failed to allocate the memory or failed to register the fd we would have leaked the file descriptor. Close the fd and avoid the leak.
2013-07-14smpp: Add the classic check for osmo_fd_registerHolger Hans Peter Freyther1-1/+5
In case the osmo_fd_register will fail we will need to free the memory we have allocated. Fixes: Coverity CID 1042375
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 Freyther2-2/+2
The if (submit->short_message) and if (smsc->system_id) will always be true. Fixes: Coverity CID 1042371, CID 1042372
2013-07-14nitb: The subscr->imsi is an array will never be NULLHolger Hans Peter Freyther1-2/+1
Array compared against 0 (NO_EFFECT) array_null: Comparing an array to null is not useful: "subscr->imsi" Fixes: Coverity CID 1040716
2013-07-13Fix license header at smpp_openbsc.c and smpp_smsc.cHarald Welte2-22/+24
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-07-11Fix: Handle CM service request on already secured channel correctlyAndreas Eversberg1-1/+2
A CM service request must be acknowledged also, when encryption is already enabled. Without encryption enabled, the security status is GSM_SECURITY_NOTAVAIL, which causes a CM service acknowledge. On initial CM service request, the security status is GSM_SECURITY_SUCCEED, if encryption is enabled. This will not lead to an acknowledge, because the cyphering command implies an acknowlege. An additional CM service request requires an acknowledge, so I added a new security status: GSM_SECURITY_ALREADY
2013-07-06mncc: Remove what we believe to be a tautology from the MNCC codeHolger Hans Peter Freyther1-14/+16
Coverity pointed out that we use trans->subscr after a NULL check, it is our believe that every transaction will have a subscriber. Remove the check and add an assert before we are dispatching things. Fixes: Coverity CID 1040740, CID 1040739
2013-07-04nitb: Add a missing NULL check for searching the subscriberHolger Hans Peter Freyther1-1/+8
"subscriber " SUBSCR_TYPES " ID sms pending-send could fail with an invalid ID/IMSI for the subscriber. Fixes: Coverity CID 1040715
2013-07-04db: Fix an issue with the memsetHolger Hans Peter Freyther1-1/+1
We want to memset the entire area of the atuple and not just the first four/eight bytes of the data. Fixes: Coverity CID 1040708
2013-07-04gsm_subscriber: Fix compiler warning of the printf stringHolger Hans Peter Freyther1-1/+1
This fixes both a GCC and a Coverity warning: GCC: gsm_subscriber.c: In function ‘subscr_expire_callback’: gsm_subscriber.c:389:2: warning: format ‘%i’ expects argument of type ‘int’, but argument 8 has type ‘long long unsigned int’ [-Wformat] Coverity: CID 1040712
2013-06-12smpp: Only write the systemd-id if it is not emptyHolger Hans Peter Freyther1-1/+1
system_id is a char array, which makes the NULL check a tautology, so we should check with strlen if the string is empty or not. This is fixing the "write" command of VTY that would otherwise create a config file that can not be parsed.
2013-06-12Makefile.am: Use AM_CPPFLAGSAlexander Huemer1-1/+1
Since automake 1.13 INCLUDES is depricates and causes a warning
2013-05-28SMPP: Add new 'dcs_transparent' ESME settingHarald Welte3-9/+58
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-05-26SMPP: Respond with BIND_TRX_RESP to BIND_TRX, not BIND_TX_RESPHarald Welte1-1/+1
2013-04-29smpp: Attempt to fix a memory leak of the msgbHolger Hans Peter Freyther1-1/+3
The smpp_pdu_rx method does not free the msgb. Introduce an annotation (currently defined to nothing) to indicate what will happen to a msgb.
2013-03-13SMPP: Implement SMPP Osmocom Estensions on MO-SMS0.13.0Harald Welte4-6/+111
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-03-03vty: Document some previously undocumented parametersHolger Hans Peter Freyther1-2/+4
Katerina pointed out that some nodes are not fully documented and proposed some messages. The token/timeout messages were correct, I have modified the other messages. I removed the full-stop from the PING/PONG documentation as we are normally not using a full sentence.
2013-02-12VTY: backwards compatibility for 'logging level sms'Harald Welte1-0/+14
when the SMS code was moved into libosmocore, its logging prefix was changed from 'sms' to 'lsms', which breaks existing config files. This introduces a deprecated/hidden vty command to make sure those config files are still parsed OK, and will simply print a warning message about the config needing some update.
2013-01-25CC: gsm48_cc_tx_release() must not remove callrefAndreas Eversberg1-2/+0
If after release has been sent, the call control layer waits for: - reception of release complete - or timeout - or release of transaction (due to radio link failure) In this case, an MNCC_REL_CNF is sent to upper layer. The callref must still exist, so the upper layer can handle this confirm.
2013-01-25CC: mncc_release_ind() must send MNCC_REL_CNF in state N19Andreas Eversberg1-0/+2
If transaction is destroyed, but callref still exists, the mncc_release_ind function is called. If the upper layer already sent an MNCC_REL_REQ, the state N19 was entered. In this case it expects an MNCC_REL_CNF.
2013-01-25CC: Be sure to allocate call instance with talloc_zero()Andreas Eversberg1-1/+1
2013-01-24smpp_vty: Ensure to not print 'system-id' in openbsc.cfg if its emptyHarald Welte1-1/+2
... as an empty system-id would render the openbsc.cfg unparseable on next openbsc start.
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
2013-01-13sms: Avoid infinite CP-ERROR/CP-ACK loop with sms.Holger Hans Peter Freyther1-0/+12
The issue can be reproduced by typing the following 9 or more times. OpenBSC> subscriber id 2 sms sender id 2 send bla For some unknown reason the phone sends us a CP-ERROR for a transaction identifier we have allocated and used but don't remember. Due the way we use the SMC/SMR we 'establish' the machine and this results in a CP-ACK being sent out. But the CP-ERROR is not having the content we want for an establish so we send out a RP-ERROR. This will result in a CP-ERROR because the phone does not know the transaction... Avoid the issue by checking the direction of the transaction. If we do not know the transaction and it is supposed to be allocated by us then just ignore it and do not create a new transaction.
2013-01-01libmsc: Track and update the location update expiryJan Luebbe2-6/+132
Set the subscriber expiry timeout to twice the duration of the location update period and provide functions subscr_expire() and db_subscriber_expire() to mark subscribers offline that have missed two location update periods. This patch increases the DB revision to 3, so the hlr will be incompatible with prior versions. We should allow 0 for T3212 as well to disable the location update period. In that case we will need a way to indicate that in the database.
2013-01-01misc: Do not use else when using return in the previous branchHolger Hans Peter Freyther1-1/+1
2013-01-01libmsc: Allow to set sender id when sending SMS from the VTYSylvain Munaut3-16/+54
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-01-01libmsc: Refuse service to anyone not attachedSylvain Munaut1-0/+4
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-29gsm_04_08: Display debug message correctly on DETACH INDICATIONdaniel/channel-ho-wipDaniel Willmann1-3/+5
Log messages would get mangled before if we receive detach by TMSI or IMSI.
2012-12-26libmsc: One of assign_compl and assign_fail will always be calledHolger Hans Peter Freyther1-12/+0
Remove the log messages and comments as they are wrong for now. Even for the mode modify we will get the assign complete call.
2012-12-26handover: Fix the handover signalling for IP based BTSesHolger Hans Peter Freyther1-13/+20
This was reported by Kevin when he was testing handover. The problem is the order of the signal handlers for S_ABISIP_CRCX_ACK. Right now the handover signal handler is called before the one inside the libmsc gsm_04_08.c. This means S_HANDOVER_ACK is signalled _before_ there is a rtp socket created for the channel. The result is that the MDCX will never be sent and the called will not be properly switched _after_ the handover detection. I do not want to play with the order of signal handlers, remove the CRCX ack handling from the handover_logic.c and force the NITB (and later the BSC) to check if the lchan is involved with a handover and do the switching in there. This means right now we do what two signal handlers did in one. Reproduced and tested with the FakeBTS Handover test. Log message: <0004> abis_rsl.c:1954 (bts=1,trx=0,ts=3,ss=0) IPAC_CRCX_ACK ... <000c> gsm_04_08.c:1400 no RTP socket for new_lchan <001a> rtp_proxy.c:533 rtp_socket_create(): success <001a> rtp_proxy.c:615 rtp_socket_bind(rs=0x48703c8, IP=0.0.0.0): ...
2012-12-25gsm_subscriber: change subscr_bsc_active_subscriber to pluralJan Luebbe1-5/+5
This was requested by Holger Freyther <zecke@selfish.org>.