path: root/openbsc/tests
AgeCommit message (Collapse)AuthorFilesLines
2015-08-0364bit: Fix compiler warnings in regard to 64bitHolger Hans Peter Freyther3-3/+3
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-07-13sms: Fix the non-SMPP mode of the testHolger Hans Peter Freyther1-3/+4
List needs to be executed from within the right configuration node to see if it is available or not. list on the toplevel will uncoditionally show "smpp" as part of the logging config.
2015-07-06sms: Add a way to always route SMS through SMPP systemsHolger Hans Peter Freyther1-0/+22
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-07-02configure: Do not link all applications against libgsmHolger Hans Peter Freyther1-1/+1
Use the same trick as done by the dlopen check to not have everyone link against the library.
2015-06-19Fix build wrt. missing CFLAGS constituentsAndreas Rottmann3-3/+3
When libosmo-netif and/or libosmo-abis are installed in distinct prefixes, the build failed with non-found headers.
2015-05-25sgsn: Allow to resolve the IPv4 address of a GGSN through DNSHolger Hans Peter Freyther2-9/+19
For real networks we need to check if the requested APN string is allowed and then resolve the GGSN address through DNS. There are countries with two or three digit MNCs and one could either try to keep a list of countries that have two/three digits or just try both of them. I have opted for the later for the ease of the implementation. C-Ares doesn't allow to cancel a request so we will need to have the MMCTX and the Lookup have different lifetimes. We simply set ->mmctx to NULL in case the MMCTX dies more early. The selected and verified apn_str will be copied into the out parameter. In case no static APN/GGSN config is present and the dynamic mode is enabled a request will be made.
2015-05-25sgsn: If there is a subscr don't allow an empty listHolger Hans Peter Freyther1-4/+5
This is a left-over from the initial system where no PDP was provided by the system. For now if there is a subscr attached and no PDP context provisioned. He is not allowed to have a data connection. Update the testcase to create the pdp list entry more early with a wildcard and then change it to a specific match.
2015-05-24gsup: Copy the hlr-Number and use it during purgeHolger Hans Peter Freyther1-0/+2
Copy the hlr-Number into the sgsn_data and use it during the purgeMS. There is no unit test that looks at the data we send so I manually verified this by looking at the output. Below is the output of the test that purges the subscriber. <000f> gprs_subscriber.c:170 SUBSCR(123456789012345) Sending GSUP, will send: 0c 01 08 21 43 65 87 09 21 43 f5 09 07 91 83 61 26 31 23 f3
2015-05-24gsup: Decode/Encode the hlr-Number in the GSUP messageHolger Hans Peter Freyther1-0/+2
Implement it similar to the msisdn_enc/msisdn_enc_len and extend the testcase to include it as well.
2015-05-06sgsn: Add VTY configuration for the CDR moduleHolger Hans Peter Freyther1-0/+28
Make it possible to set a filename to use for the CDR. By default no CDR will be generated. Forbid to set the interval of 0 seconds as this will cause a lot of work. Add a very basic VTY test.
2015-05-06sgsn: Extract the MSISDN from the subscr data structureHolger Hans Peter Freyther1-0/+4
In case there is a subscr attached to the MM context and there is an encoded MSISDN we will attempt to decode it and in case of an international number prepend a '+'. Assume that the array size of gsm_mmcc_called->number is as big as ctx->msisdn for the strncpy.
2015-05-05sgsn: Copy the msisdn to the sgsn_data and use it in PDP activationHolger Hans Peter Freyther1-0/+9
The MSISDN should be present for "security" reasons in the first activation of a PDP context. Take the encoded MSISDN, store it for future use and then put it into the PDP activation request. The MM Context contains a field for a decoded MSISDN already. As we need to forward the data to the GGSN I want to avoid having to store TON and NPI in another place. Simply store the data in the encoded form.
2015-05-05gsup: Extract the QoS fieldHolger Hans Peter Freyther1-1/+2
Add roundtrip test for the new QoS IE. It will be consumed in later commits.
2015-05-05gsup: Extract the new MSISDN stringHolger Hans Peter Freyther1-0/+2
Extract the new MSISDN IE from the GSUP message and verify that it is read/written to the message.
2015-05-03filter: Move the con_type into the filter_stateHolger Hans Peter Freyther1-11/+11
2015-05-03filter: Remove nat_sccp_connection from public APIHolger Hans Peter Freyther1-1/+1
2015-05-03filter: Separate SCCP/BSSAP extraction and gsm48 codeHolger Hans Peter Freyther1-1/+2
For the BSC we will have the gsm48_hdr and don't need to find data within SCCP. For legacy reasons we need to initialize con_type, imsi, reject causes early on and need to do the same in the filter method.
2015-05-03filter: More renaming and remove of "NAT" from itHolger Hans Peter Freyther1-11/+11
2015-05-03filter: Remove nat from bsc_nat_acc_lst and replace with msgHolger Hans Peter Freyther1-6/+6
2015-05-03filter: Cease out "struct bsc_nat" from the APIHolger Hans Peter Freyther1-2/+2
This means we need to require a talloc context and simply operate on the list. I had considered creating a structure to hold the list head but I didn't find any other members so omitted it for now.
2015-05-03filter: Move the method definition to the filter moduleHolger Hans Peter Freyther1-0/+1
Move the filter methods to the filter module. This is still only usable for the NAT and the _dt/_cr filter routines need to move back to the bsc_nat in the long run.
2015-05-03filter: Move the gsm 04.08 filter to a common placeHolger Hans Peter Freyther1-2/+3
For customer requirements we want to be able to do filtering on the BSC as well. The same messages need to be scanned and the same access-lists will be looked at. In the future we might even split traffic based on the IMSI. Begin with moving the code to a new top level directory and then renaming and removing the nat dependency.
2015-04-29sub: Remove the queue from the subscriber codeHolger Hans Peter Freyther1-5/+7
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-29mgcp/test: Fix mgcp-transcoding assertion (Coverity)Jacob Erlbeck1-1/+1
In test_rtp_seq_state an assignment is accidently done within an assertion. This commit changes that into a comparison as it was intended. Fixes: Coverity CID 1295457, 1295458 Sponsored-by: On-Waves ehf
2015-04-23nat: Make mode-set patching optionalHolger Hans Peter Freyther3-1/+34
2015-04-23misc: Fix warnings about size of size_t in printfHolger Hans Peter Freyther2-10/+10
Fixes warnings like: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat]
2015-04-07nitb: Check source string length before calling strncpy (Coverity)Jacob Erlbeck1-0/+26
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-04-07gprs: Fix GSUP cancel_type handling (Coverity)Jacob Erlbeck1-0/+12
When handling an incoming GSUP cancellation request, the cancel_type if effectively ignored, such that is always handled as GPRS_GSUP_CANCEL_TYPE_UPDATE and never as WITHDRAW. This commit fixes the expression used to set the variable is_update_procedure. Fixes: Coverity CID 1267739 Sponsored-by: On-Waves ehf
2015-04-05nat: Add a ctrl command to add to an existing ACC listHolger Hans Peter Freyther1-0/+12
We want to have a program add entries to the allow list this can be done using: $ -d localhost -p 4250 -s net.0.add.allow.access-list.NAME "^IMSI$"
2015-04-01bsc: Allow to use different LAC/CI for the core-networkHolger Hans Peter Freyther1-0/+15
We need to use different LAC/CI towards the core network. It is a bit problematic as LAC/CI is a per BTS attribute so this feature only works if a BSC manages everything in the same LAC. Related: SYS#1398
2015-03-22rtp: And really catch up and remove all occurences of openbsc/rtp.hHolger Hans Peter Freyther1-1/+3
2015-02-10ctrl: Implement a global result for rf_locked0.14.0Holger Hans Peter Freyther1-0/+10
Create a one stop command to give a statement for the entire network. This can be used to check the policy and the state of the entire network.
2015-02-10ctrl: Add a command to check how many bts are configuredHolger Hans Peter Freyther1-0/+6
This can be used to query how many bts are configured to check if all of them are locked or not.
2015-02-06sgsn: Add easy APN commands with just the nameHolger Hans Peter Freyther1-0/+18
For most configurations we don't address multiple GGSNs but only want to enforce a list of APNs. In the future we might add a special global GGSN context but not right now. Fixes: SYS#593
2015-02-06Revert "gprs: Block other GSUP procedures during PURGE_MS"Jacob Erlbeck2-84/+0
This reverts commit f81cacc6814dde73f203d125b0065d1451a98317. Since the PURGE MS retry mechanism had been removed, this feature is not used anymore. It just makes the code more complex. Conflicts: openbsc/include/openbsc/gprs_sgsn.h openbsc/src/gprs/gprs_subscriber.c openbsc/tests/sgsn/sgsn_test.c
2015-02-06sgsn: Select GGSN based on APNJacob Erlbeck2-0/+136
Currently the APN IE in the Activate PDP Contex Request and the PDP data that is stored with the subscriber is ignored completely. This commit adds the sgsn_mm_ctx_find_ggsn_ctx that checks the APN IE against the subscriber's PDP data entries if both are present. If there is no match, the request is rejected. If an APN IE has not been included but PDP data entries are present, the function checks all of these entries against the static 'apn' configuration to find a suitable entry. If an APN has not been determined so far and any APN is allowed, the configuration is checked with an empty APN string, to allow for default configurations based on the IMSI prefix only. If nothing of this succeeded but the request wasn't rejected either, and there is no 'apn' configuration at all or if any APN is allowed but a default configuration ist not present, the GGSN with id 0 is used (if present). Otherwise the request is rejected ('missing APN'). Ticket: OW#1334 Sponsored-by: On-Waves ehf
2015-02-06sgsn: Add functions to handle APN contextsJacob Erlbeck3-0/+115
This commit adds the exported functions apn_ctx_find_alloc, apn_ctx_free, apn_ctx_by_name, and apn_ctx_match to manage and retrieve APN to GGSN mappings. The following VTY commands are added to 'config-sgsn': - apn APN ggsn <0-255> - apn APN imsi-prefix PREFIX ggsn <0-255> which maps an APN gateway string to an SGSN id. The SGSN must be configured in advance. When matching an APN string, entries with a leading '*' are used for suffix matching, otherwise an exact match is done. When a prefix is given, it is matched against the IMSI. If several entries match, a longer matching IMSI prefix has precedence. If there are several matching entries with the same PREFIX, the entry with longest matching APN is returned. Ticket: OW#1334 Sponsored-by: On-Waves ehf
2015-02-06sgsn: Add PDP info to subscriber dataJacob Erlbeck1-1/+9
Currently the PDP info that is transmitted via GSUP is just parsed and then discarded. This commit adds a new data structure sgsn_subscriber_pdp_data and maintains a list of those in sgsn_subscriber_data. The PDP data is copied from an incoming GSUP UpdateLocationResult message. If that message contains the PDPInfoComplete flag, the list is cleared before new entries are added. The 'show subscriber cache' output now also shows the PDP data entries. Note that the InsertSubscriberData message is still not supported. [hfreyther: Added talloc_free in gprs_subscr_pdp_data_clear] Sponsored-by: On-Waves ehf
2015-01-31bsc/nitb: Allow to set the GPRS mode through the ctrl commandHolger Hans Peter Freyther1-0/+19
Create a control command to read and modify the gprs mode. Use the get_string_value to indicate if the value was found or not. This is useful for the ctrl interface where I didn't want to replicate "none", "gprs" and "egprs". Share code to verify that a BTS supports the mode. Related: SYS#591
2015-01-31ctrl/bsc: Fix copy and paste error and update textHolger Hans Peter Freyther1-1/+1
30f1f376383df3ae8d85e96542bf14d174c25d89 introduced new channel combinations but had a copy and paste error in the description. The jenkins system didn't run the external tests so this issue and others were not noticed until now. Fix the copy and paste and update the test result.
2015-01-31meas: Install the scenario command and test itHolger Hans Peter Freyther1-0/+19
2015-01-30sgsn/test: Fix memory leak in test_subscriber_gsupJacob Erlbeck1-6/+9
Currently the MM context is not deleted when a GSUP location cancellation message is processed, because the real sgsn_update_subscriber_data function has been wrapped to a dummy implementation. This commit adds an explicit call to sgsn_mm_ctx_cleanup_free which also unassigns the LLME, so the call to gprs_llgmm_assign is removed. It also adds an assertion to check that there are no talloc'ed blocks left in tall_bsc_ctx. Addresses: == 372 bytes in 1 blocks are possibly lost in loss record 7 of 9 == at 0x402A17C: malloc (in /usr/lib/valgrind/ == by 0x4059FB8: _talloc_zero (talloc.c:354) == by 0x8055B82: sgsn_mm_ctx_alloc (gprs_sgsn.c:167) == by 0x804A336: alloc_mm_ctx (sgsn_test.c:140) == by 0x804B24D: test_subscriber_gsup (sgsn_test.c:503) == by 0x804EC99: main (sgsn_test.c:1853) Sponsored-by: On-Waves ehf
2015-01-30sgsn/test: Add checks for subscr->error_causeJacob Erlbeck1-0/+4
This commits adds a few asserts that check the value of subscr->error_cause after a GSUP message has been received. Sponsored-by: On-Waves ehf
2015-01-30gprs: Use 'Network failure' as default causeJacob Erlbeck1-0/+10
This commit adds a check after a GSUP message has been decoded whether it is an error message and does not contain a cause value. If his is the case, the cause value is set to 'Network failure', so that this cause if effectively the default value for error messages. Sponsored-by: On-Waves ehf
2015-01-30gprs/test: Fix GSUP Purge MS response messagesJacob Erlbeck1-2/+2
Currently the message types for these message types are wrong. This patch inserts the correct message types. Sponsored-by: On-Waves ehf
2015-01-30sgsn/test: Add tests for PurgeMs responsesJacob Erlbeck1-0/+30
Currently there are not any test cases for PurgeMS GSUP messages in test_subscriber_gsup. This commit adds tests for incoming PurgeMSResult and -Error messages. Sponsored-by: On-Waves ehf
2015-01-30gprs: Support cancellation typeJacob Erlbeck1-1/+1
The cancellation type that is part of the UpdateCancellation message is currently ignored. This patch adds the missing glue between the existing GSUP and GMM support. If the type is not present or has the value updateProcedure the subcriber and MM context are siliently removed. Otherwise, a message with cause 'implicitly detached' is sent to the MS. Since the real cause is not known (the specification neither added a cause IE nor defined a static cause value), the MS may get the real cause in the following AttachRej. Added VTY commands: - update-subscriber imsi IMSI cancel update-procedure - update-subscriber imsi IMSI cancel subscription-withdraw the old form without the cause is no longer supported. Sponsored-by: On-Waves ehf
2015-01-28gprs: Don't use subscr->keep_in_ram in normal operationJacob Erlbeck1-0/+3
Currently the keep_in_ram flag is explicitely reset in gprs_subscr_cleanup to cover the case, that the VTY 'create' sub-command has been used to create the subscriber entry. This commit completely removes keep_in_ram handling from gprs_subscriber.c and adds a VTY 'destroy' sub-command to reset the flag and remove the entry. So 'create' and 'destroy' can be used to manager sticky entries that are kept even when a location cancellation is done. Added VTY command: - update-subscriber imsi IMSI destroy Sponsored-by: On-Waves ehf
2015-01-28sgsn: Add sgsn_mm_ctx_cleanup_free for safe shutdownJacob Erlbeck1-8/+2
Currently the MM context cleanup code is distributed over several functions. sgsn_mm_ctx_free not only frees data structure but also eventually stops the timer and does the subscriber clean-up. mm_ctx_cleanup_free (gprs_gmm.c) cleans up the PDP contexts and unassign the TLLI. This commit moves the cleanup code from both functions into a new unifying function sgsn_mm_ctx_cleanup_free that cares about the clean-up of all related sub-systems. Sponsored-by: On-Waves ehf
2015-01-28sgsn: Don't allow mmctx == NULL in sgsn_update_subscriber_dataJacob Erlbeck1-10/+11
Currently, sgsn_update_subscriber_data can be called with mmctx == NULL and will find and associate the right context (if present) based on the subscriber's IMSI. This will not happen in regular use any more, since sgsn_update_subscriber_data will only be called when subscribers are used (auth mode 'remote') and in this case gprs_subscr_get_or_create_by_mmctx will already be called by sgsn_auth_request. Therefore, MM context and subscriber are always associated except for some test cases and experimental VTY usage. The current implementation of sgsn_update_subscriber_data also causes additional complexity for the deletion on MM contexts to avoid a ipossible double-free MM contexts. This commit removes the MM context <-> subscriber association code from sgsn_update_subscriber_data. That function must always be called with mmctx != NULL, now. To avoid problems with VTY and test usage, the calling subscriber function now only call sgsn_update_subscriber_data when mmctx != NULL, since the purpose of that function is to update that state of an existing MM context after subscriber data has been changed. Sponsored-by: On-Waves ehf