aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/vty_interface_layer3.c
AgeCommit message (Collapse)AuthorFilesLines
2017-08-27move openbsc/* to repos rootNeels Hofmeyr1-1210/+0
This is the first step in creating this repository from the legacy openbsc.git. Like all other Osmocom repositories, keep the autoconf and automake files in the repository root. openbsc.git has been the sole exception, which ends now. Change-Id: I9c6f2a448d9cb1cc088cf1cf6918b69d7e69b4e7
2017-05-12fix VTY parsing: subscriber-create-on-demand randomNeels Hofmeyr1-1/+1
Fix parsing of the 'subscriber-create-on-demand random' VTY: atoi() is not enough to include the specified range of 1-9999999999. Use atoll() instead to ensure a large enough number space also on 32bit systems. (Note: for me, atoll() truncates at 32 bit when <stdlib.h> is not included.) Add a VTY regression test for this. Related: OS#2253 Change-Id: I353e04481ec567adca383d6b51ba8fb865eed73e
2017-03-31LU counters: count completion and failure, not messages sentNeels Hofmeyr1-3/+3
From a human admin viewpoint it doesn't make sense to count the messages sent: When we use TMSIs, we first send a LU Accept with a new TMSI, and then expect the MS to respond with a TMSI Realloc Complete message. When that fails to come through, the LU actually ends in failure, even though a LU Accept was sent. If a conn breaks/vanishes during LU, we cancel the LU without sending any reply at all, so the failed LU would not be counted. Instead, count Location Updating results, i.e. completion and failures. (With the new VLR developments, LU counters need to be triggered in completely different places, and this patch prepares for that by providing sensible counters.) Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6
2017-03-08add struct bsc_subscr, separating libbsc from gsm_subscriberNeels Hofmeyr1-4/+10
In a future commit, gsm_subscriber will be replaced by vlr_subscr, and it will not make sense to use vlr_subscr in libbsc. Thus we need a dedicated BSC subscriber: struct bsc_subscr. Add rf_policy arg to bsc_grace_paging_request() because the bsc_subscr will no longer have a backpointer to gsm_network (used to be via subscr->group). Create a separate logging filter for the new BSC subscriber. The implementation of adjusting the filter context is added in libbsc to not introduce bsc_subscr_get/_put() dependencies to libcommon. During Paging Response, fetch a bsc_subscr from the mobile identity, like we do for the gsm_subscriber. It looks like a duplication now, but will make sense for the VLR as well as for future MSC split patches. Naming: it was requested to not name the new struct bsc_sub, because 'sub' is too ambiguous. At the same time it would be fine to have 'bsc_sub_' as function prefix. Instead of struct bsc_subscriber and bsc_sub_ prefix, I decided to match both up as struct bsc_subscr and bsc_subscr_ function prefix. It's fast to type, relatively short, unambiguous, and the naming is consistent. Add bsc_subscr unit test. Related: OS#1592, OS#1594 Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e
2017-02-24vty: fix subscr ref count leak in 'subscriber name' cmdNeels Hofmeyr1-0/+1
Change-Id: I3d19518c94a7f302bf108f2ad945983cdc8db0b1
2017-02-18remove compiler warning: unused rc in vty_interface_layer3Neels Hofmeyr1-1/+0
Change-Id: I3dc94dc4bddc5a887ce196071327a6dddfe5b280
2017-01-23Add VTY command to immediately expire user (set expire_lu to now)Keith1-0/+24
Change-Id: I676c84350a7afc963bc6bb4c46c60e5ac3eee67e
2017-01-23cosmetic: use osmo_strlcpy() everywhereNeels Hofmeyr1-2/+1
Shorten some code and make obvious to the reader that the string copy is done in a safe way. Change-Id: I900726cf06d34128db22a3d3d911ee0d1423b1bd
2017-01-23fix strncpy() invocation in vty_interface_layer3.c and 3 testsNeels Hofmeyr1-1/+1
Use osmo_strlcpy() to fix unsafe invocation of strncpy(), which potentially left the result unterminated. Change-Id: I1a119b1760a3e3262538b4b012d476fdce505482
2016-12-02factor out gen of USSD notify and release complete to libosmocoreNeels Hofmeyr1-2/+2
Both libmsc and libbsc will need distinct gsm0480_send_ussdNotify() and gsm0480_send_releaseComplete() functions, since there will be distinct subscriber connection structs. Rename to msc_send_ussd_notify() and msc_send_ussd_release_complete(), and add the same in libbsc with bsc_ prefix in new file gsm_04_80_utils.c. In preparation of this patch, the message generation part of these functions has been added to libosmocore as gsm0480_create_ussd_notify() and gsm0480_create_ussd_release_complete(). Use these. Adjust all libmsc and libbsc callers according to use the msc_* or bsc_* implementation, respectively. Change-Id: I33a84e3c28576ced91d2ea24103123431f551173
2016-11-26Fix possible non-null-terminated bufferHarald Welte1-0/+1
Change-Id: I22100c260856991b9a836135b3650e5b8c5449ca Fixes: Coverity CID 57623
2016-09-18debug log for sms: fix/addNeels Hofmeyr1-0/+1
One logged the wrong function name. Add others. Change-Id: Ied5d8e84d5d192c826bc131be8907eaa55190479
2016-09-18vty l3 help: fix typo 'comamnds'; fix english s/his//Neels Hofmeyr1-5/+5
Change-Id: I6be52bbb69de8aa0a6d57a3a320661ad85fc2cc4
2016-08-29libmsc/bsc: split rate counters into bsc and msc groupAlexander Couzens1-20/+20
Tweaked-By: Neels Hofmeyr <nhofmeyr@sysmocom.de> Change-Id: I7361033cd1eb919ec3c2ea2652f40ab8c75b2f99
2016-08-27libbsc/libmsc: convert old osmo counter into rate_ctrgsAlexander Couzens1-20/+28
rate counters support the export to statsd and can have a delta value. Change-Id: Ie749cebd53a0bb618d0e23d375885712078bf8dd
2016-07-09Make random MSISDN assignment optionalMax1-15/+16
Previously if subscriber was automatically created it got assigned random MSISDN number. Make it optional (defaulting to previous behavior) by adding following: * new optional no-extension argument for subscriber-create-on-demand vty command * db unit tests * vty test Note: using the db made with new code might result in subscribers with empty extension. Such subscribers cannot be deleted using old code. Make sure not to mix db versions or manually fix it by editing sqlite with external program. Fixes: OS#1658 Change-Id: Ibbc2e88e4722b08854ebc631485f19ed56443cbb
2016-06-14Make random extension range configurableMax1-1/+29
Previously if subscriber was automatically created it got assigned random MSISDN number between 20000 and 49999. Make it configurable with new vty command "subscriber-create-on-demand random" and expand vty tests to check it. Change-Id: I040a1d227b0c7a1601dc7c33eccb0007941408a6 Related: OS#1658
2016-06-05Add regexp authorization policy for IMSIMax1-4/+11
* extend "auth policy" vty command with new option "regexp" * add vty command "authorized-regexp" for setting arbitrary POSIX regular expression * add basic vty test * add optional "regexp" argument to subscriber-create-on-demand vty command With those in place we can now set the regexp against which MS's IMSI will be matched. If IMSI match the regexp than MS is allowed to access the network. If subscriber is already marked as authorized in HLR than it'll be allowed regardless of IMSI matching. The same way we can decide whether to create subscribers on-demand basesd on IMSI regexp match. Similar to authorization this restriction can be overridden by manually creating subscriber via vty, ctrl interface or directly in HLR. Change-Id: I525f4b80676de47d1d422686da2ca012301b0129 Fixes: OS#1647
2016-05-20Make extending subscriber creation easierMax1-3/+3
* rename variable controlling subscriber creation * use enum for subscriber creation policy * move check for subscriber creation policy into separate static function Related: OS#1658, OS#1647 Change-Id: I3b10a9a764fd3a7bb96717a990e52caae16266da Reviewed-on: https://gerrit.osmocom.org/42 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
2016-04-29Start to use struct osmo_auth_vector from gsm_auth_tupleHarald Welte1-3/+3
Rather than having a 'private' structure for kc, sres and rand, we now finally (with 4 years delay) use osmo_auth_vector from libosmogsm, which encapsulates authentication vectors that can be either GSM triplets or UMTS quintuples or a combination of both. gsm_auth_tuple becomes a wrapper around osmo_auth_vector, adding use_count and key_seq to it. key_seq is no longer initialized inside gprs_gsup_messages.c, as there is no CKSN / key_seq inside the message anyway. If a usre of the code needs key_seq, they need to manage it themselves.
2016-04-06subscr: Make db_create_subscriber fail on duplicatesHolger Hans Peter Freyther1-5/+11
The issue of db_create_subscriber updating an already existing subscr is that the same subscriber will then have two entries in the active subscribers list. In general this will break assumptions that a subscr can be compared by comparing the pointer. In the case of the VTY this was not an issue as the created subscr was immediately destroyed again but it is better to avoid this problem. Change the VTY command to find the subscriber and then call sync to have the updated time set. The side-effect is we will now have two queries for the subscriber. Once through subscr_get_by_imsi and once through db_create_subscriber. Change the db_create_subscriber to fail if a subscriber already exists, and add a testcase for this behavior and do not updated the 'updated' timestamp of an already existing subscriber. Add a testcase for this behavior. Related: OS Issue #1657
2015-08-08paging: Provide information about pending requestsHolger Hans Peter Freyther1-2/+8
For debugging it is nice to know how many requests are pending. Simply count it and print it besides the paging part.
2015-08-0364bit: Fix compiler warnings in regard to 64bitHolger Hans Peter Freyther1-2/+2
vty_interface_layer3.c:584:4: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Wformat=] sizeof(subscr->extension)-1, VTY_NEWLINE);
2015-08-01nitb: Add a mode to not use TMSI for normal operationHolger Hans Peter Freyther1-0/+22
In case foreign simcards are used we can not do authentication and ciphering. In case a TMSI is re-used too early and we do page using TMSI we can't know which of the two MS is responding to us. We could change the "secure channel" routine to ask for the IMSI and only then stop the paging. As we don't have ciphering there is not much use in using the TMSI. Add a mode "no assign-tmsi" that will not assign the TMSI during LU. Now CM Service Request and Paging Response will work using the IMSI. There can't be a clash with that. [ciaby fixed the vty write to use the right name]
2015-04-29sub: Remove the queue from the subscriber codeHolger Hans Peter Freyther1-0/+2
The idea of "subscriber_get_channel" was that different requests would be coordinated. At the same time we have seen that the "queue" can get stuck at both 31C3 and the rhizomatica installations. Voice calls and SMS do not need coordination. We should be able to send SMS on a voice channel and switch the MS from a SDCCH to a TCH in case we establish a voice call. The SMS code itself needs to coordinate to obey the limit of one SMS per direction but this should be enforced in the sms layer and not on the subscriber. Modify the code to have a simple paging coordination. The subscriber code will schedule the paging and register who would like to know about success/failure. This allowed to greatly simplify the paging response handling for the transaction code (and in fact we could move the transaction list into the subscriber structure now). The code gained to support to cancel the notification of a request (but not the paging itself yet). TODO: Cancel paging request in case no one cares about it anymore.
2015-04-29sub: Remove introspection of the "channel queue"Holger Hans Peter Freyther1-77/+4
Over the next commits the queuing of commits will be completely modified to remove the queue and move the scheduling/limits to the outer callers.
2015-04-07nitb: Check source string length before calling strncpy (Coverity)Jacob Erlbeck1-0/+14
Currently some VTY command do neither check the length of the source string before calling strncpy nor ensure NUL-termination afterwards. This can to destination string buffers whose contents are not NUL-teminated. This commit adds checks and corresponding warnings to the VTY commands 'subscriber TYPE ID name .NAME" and "subscriber TYPE ID extension EXTENSION". Fixes: Coverity CID 1206570, 1206569 Sponsored-by: On-Waves ehf
2015-01-31meas: Install the scenario command and test itHolger Hans Peter Freyther1-0/+6
2015-01-31meas: Add VTY documentation for the measurement commandsHolger Hans Peter Freyther1-2/+3
Document the parameters that can be passed on.
2015-01-27nitb: Make the last change configurableHolger Hans Peter Freyther1-0/+47
Introduce a NITB node and add the subscriber creation as config name in there.
2015-01-02logging: Only compare the subscr addressHolger Hans Peter Freyther1-0/+28
Move the "logging filter imsi IMSI" into the BTS/NITB code to allow to set the gsm_subscriber and only compare it. This way we simply compare the subscriber address and don't have to care if the subscriber data is still valid.
2015-01-01Initial support for export + curses-visualization of measurementsHarald Welte1-0/+35
This extends osmo_nitb to offer a UDP feed of real-time measurement reports, which can be used by (a variety of) external tools for visualization or other processing. We also add a small ncurses based tool (meas_vis) which shows a baragraph display of the last few mobile stations that were active, indicating their uplink/downlink receive level and quality. <WARNING> This sends non-portable structures like gsm_meas_rep over UDP and assumes the receiver has identical alignment and endianness! Before this feature is merged, it either needs to be converted to a unix domain socket (but they don't do multicast, which would be nice) or the wire format needs to change into something portable with defined alignment and encoding </WARNING>
2014-12-05msc: Add and use gsm_subscriber_groupJacob Erlbeck1-7/+7
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-10-03nitb: Add subscriber delete commandRuben Pollan1-1/+33
2014-08-02vty: Fix interactive VTY help for silent-sms transmissionHarald Welte1-3/+3
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-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
2013-10-30vty: Use vty_install_default() instead of bsc_install_default()Jacob Erlbeck1-1/+1
Remove ournode_exit_cmd, ournode_end_cmd, and bsc_install_default() since this functionality is provided by the current libosmocore. Replace calls to bsc_install_default() by call to vty_install_default() with the following semantic patch: @rule1@ expression N; @@ - bsc_install_default(N); + vty_install_default(N); Ticket: OW#952 Sponsored-by: On-Waves ehf
2013-10-13db: Remove the struct gsm_network from the database layerHolger Hans Peter Freyther1-1/+1
The database code should not know about the network. Move the setting of the network pointer into the subscriber layer.
2013-10-05nitb: Add "subscriber create" VTY command.Alexander Chemeris1-0/+27
It may be useful in production, but it's really required for VTY testing of subscriber related commands.
2013-09-02vty: Use generic 'end' and 'exit' commandsJacob Erlbeck1-3/+1
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-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-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-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-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-01libmsc: Allow to set sender id when sending SMS from the VTYSylvain Munaut1-12/+42
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-25nitb: Add a VTY command to initiate a handover to another BTSHolger Hans Peter Freyther1-0/+53
2012-11-21sms: Use the DLSMS instead of the DSMS category throughout our codeHolger Hans Peter Freyther1-1/+1