aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests
AgeCommit message (Collapse)AuthorFilesLines
2016-12-12Support Deactivate PDP Context Request from networkPravin Kumarvel2-0/+140
Enable Deactivate PDP context based on the IMSI of the subscriber. When there are PDP contexts present for a MM context, PDP context will be deactivated along with GMM Detach(MM context deletion). If there are no PDP present, MM context will be deleted to avoid further PDP context request from the MS. Test cases is added to check this functionality. Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13
2016-12-09gsm0408_test.c: Don't pass negative value to strerror()Harald Welte1-1/+1
Change-Id: I4fcf24ec1bc974a3189486d2372b9713d7fdab70 Fixes: Coverity CID 135192
2016-12-09sgsn_test: Fix missing = in == type checkHarald Welte1-1/+1
Change-Id: I696a7d25d2f4d19922e05a7e83c4aeec5c44fb07 Fixes: Coverity CID 135156
2016-12-02Move timezone settings up to network levelNeels Hofmeyr3-20/+19
Time zone used to be configurable per-BTS. In the upcoming MSC-split, no BTS structures will be available on the MSC level. To simplify, drop the ability to manage several time zones in a core network and place the time zone config on the network VTY level, i.e. in gsm_network. If we are going to re-add fine grained time zone settings, it should probably be tied to the LAC. Adjust time zone VTY config code (to be moved to libcommon-cs in subsequent commit). Adjust time zone Ctrl Interface code. Change-Id: I69848887d92990f3d6f969be80f6ef91f6bdbbe8
2016-12-02reinvent connection_for_subscr() and move to libmscNeels Hofmeyr1-2/+0
Implement connection_for_subscr() from a completely different angle: instead of looking up lchans in bts structs, look up the subscriber in the global list of gsm_subscriber_connection. static lchan_find() is thus obsoleted. All callers of connection_for_subscr() live in libmsc, so move to libmsc. The move and edit are done in a single commit since the old and new implementation have nothing in common. Future: osmo-cscn will use this, without bts being present. Remove implementation of connection_for_subscr() from channel_test.c -- it is possible that the abort() in there was intended for a regression test, but actually it seems the implementation was merely added for linking reasons, and the abort() added to guard against the NULL return value: no comment nor the commit log indicate that the abort() is test critical; the addition was the only change in channel_test.c for that commit; at the same time a connection_for_subscr() call was added in libmsc. Change-Id: I5e0ba0ecf1726ebd540800f4e98fdfc937c904ff
2016-12-02tests: drop unused libmsc, unneeded duplicate libbsc linkingNeels Hofmeyr3-5/+0
Because of libcommon-cs, tests/gsm0408,subscr,trau no longer need libmsc. Change-Id: I9073eba41a1cd3136ed7a9def6fe8aaf282eaa18
2016-12-02sms_next_rp_msg_ref(): use direct pointer to next_rp_ref counterNeels Hofmeyr1-3/+3
libbsc and libmsc will have separate subscriber connection structs. Hence don't rely on gsm_subscriber_connection, but work on a direct pointer to the counter for the next RP reference. The only very thin function in gsm_04_11_helper.c thus becomes obsolete: drop the entire file. Change-Id: I2a2e9ba6a981a385d1f8f07acbe03536ffed0072
2016-11-24move to libcommon-cs: net init 3: actual moveNeels Hofmeyr7-1/+7
Reincarnate gsm_network_init() as the parts not specific to libbsc. Move from bsc_network_init() those bits that are not BSC specific (and useful for upcoming osmo-cscn). Add libcommon-cs to all linkages that use gsm_network_init(). Note: the only requirement to allow linking gsm_network_init() without libbsc is to keep the call to gsm_net_update_ctype() out of libcommon-cs. The other items are kept out of libcommon-cs because it makes sense semantically. But the separation is not strong in that the BSC specific data members are of course still omnipresent in struct gsm_network. If bsc_network_init() is not called, these are not initialized properly -- for now no users of uninitialized members exist. So this is just a first step towards a sensible split of the BSC and MSC gsm_network structs. The long term aim should be to have entirely separate structs with some common general items. Change-Id: If06316b97002390dc9a434686750cb96193ea63b
2016-11-24move to libcommon-cs: net init 2: move bsc_network_init decl to new .hNeels Hofmeyr2-0/+2
bsc_network_init() is more fit to live in a BSC specific header, move it to new common_bsc.h. It will probably also absorb the BSC-specific part of gsm_network in the future. Adjust header includes across the board. Particularly, fix abis_nm.h by explicitly including gsm_data.h: it so far relied on other headers to do that, which now is no longer always given. Change-Id: I9edfb1e748bb1cb484fadd48b0406f5b3098e89b
2016-11-24move to libcommon-cs: net init 1: rename to bsc_network_initNeels Hofmeyr2-3/+3
The gsm_network_init() function initializes a whole lot of BSC specific stuff. Aiming to move some of it to libcommon-cs, first rename it to bsc_network_init(). This will retain the BSC specific stuff when the move is done. Adjust all callers. Future: osmo-cscn will call the more generic part and not the BSC specific part. Change-Id: I4816ae19374390fc5c64972f7cad2e9ec3d8bcc3
2016-11-15test/gbproxy: Test for possible memory corruption when link_info is freedDaniel Willmann2-0/+276
This test is to trigger the use-after free issue in commit bff7b0d80972. If compiled with address-sanitizer the test will abort without the fix. Change-Id: I5e8c6626ba43342740f08d699383bdded739079f Ticket: OW#3049 Sponsored-by: On-Waves ehf
2016-11-01OML: Improve OML attribute handlingPhilipp5-0/+351
the OML attribute tables are hardcoded. To set variable parameters, the hardcoded data structure (tlv) is patched on byte level during runtime. This patch replaces this mechanism. - Replace hardcoded OML attribute tables with dynamically generated TLV structures. - Add unit tests to check if the OML attribute tables are generated correctly - Put OML attribute table generator code in a separate file: bts_ipaccess_nanobts_omlattr.c Change-Id: Ibeb34a84912d6cf695f553a34c69320fca7d08fa
2016-10-28sndcp: Fixups for sndcp layer based on coverity-scan suggestionsPhilipp2-0/+3
- missing break in gprs_sndcp_pcomp.c, line 143 - string overflow in slhc_test.c, line 211 - sizeof mismatch in gprs_sndcp_xid.c, line 1369 and 1378 - mismatching signedness in gprs_sndcp_xid.c, line 1377 - needless < 0 comparison in gprs_sndcp_xid.c, line 477 - needless < 0 comparison in gprs_sndcp_xid.c, line 209 - missing returncode check in v42bis_test.c, line 320 - wrong pointer dereferentialization in gprs_sndcp_comp.c, line 73 Change-Id: I4f9adf251f5119e67ffe76baad6f1f996ac8dbad
2016-10-13msgb ctx: use new msgb_talloc_ctx_init(), don't access talloc_msgb_ctxNeels Hofmeyr1-4/+3
Drop extern definitions of talloc_msgb_ctx and use msgb_talloc_ctx_init() instead. In sgsn_test.c, use a local variable msgb_ctx to do the talloc report from the return value of msgb_talloc_ctx_init(). Change-Id: I2f9ace855f0ecbdc9adf5d75bcb1a3d666570de4
2016-10-13msgb talloc ctx: initialize in all main() scopesNeels Hofmeyr6-0/+8
Add msgb_talloc_ctx_init() call to many main() functions still lacking a msgb talloc context. Change-Id: Ib0d6751260659cabf18a7ce80680ba2fb4228ea1
2016-10-13gtphub_test.c: remove unused include of msgb.hNeels Hofmeyr1-1/+0
Change-Id: I7a8003a0e0bff803941d7981ffc07cf78c3ae9a9
2016-09-30SGSN: Fixing build configPhilipp2-4/+8
Tests for V.42bis, slhc, llc-xid and sndcp-xid are built and executed on all build configurations, but are only needed when the sgsn (gprs) is built. This patch adds conditions check if the tests mentioned abvove are needed or not. Change-Id: I6921e6198ea7f99fe5276f91cbc522091853bc4e
2016-09-30vty_test_runner.py: fix indents to use spaces, fix vim commentNeels Hofmeyr1-27/+27
Most of this file uses four spaces of indenting. Replace all tabs with spaces. Remove the erratic 'set' from the recently added vim comment at the bottom. Change-Id: I4273b3314defb1e5b31b509c2ac7d7c6cd6834cf
2016-09-30vty_test_runner.py: make unittest print all output by defaultNeels Hofmeyr1-1/+1
Add option to TextTestRunner that shows print output on stdout. It's better to see everything in our jenkins runs and not hide test output. Change-Id: If4be1ad1c81c9ed4ab9b208b4c6d1e4b2cc8fdd5
2016-09-28vty_test_runner.py: fix nat_msc_test(): socket attach: reduce timeout, retryNeels Hofmeyr1-5/+22
In nat_msc_test(), upon socket timeout, retry up to six times. Reduce the timeout between retries. This should get rid of sporadic test failures that we've been seeing a lot on jenkins lately. Raise an exception upon unexpected vty response. Print more detail to stdout. Since we would actually want as much output as we can get in a test suite, remove the 'if (verbose)' and just always print the connection source. unittest is keeping all stdout silent by default anyway. Change-Id: I2f83eef55592778e54164a90e1eabeb80fb918da
2016-09-28dyn TS: fix: ts_subslots() for TCH/F_PDCH in PDCH modeNeels Hofmeyr1-1/+1
In gsm_data_shared.c, add ts_pchan() to determine actual pchan type for dynamic and non-dynamic TS. Use in ts_subslots() to fix the value returned for TCH/F_PDCH in PDCH mode. Adjust the assertion in channel_test.c accordingly. Drop GSM_PCHAN_TCH_F_PDCH, which is now handled in ts_pchan(). Explicitly add GSM_PCHAN_PDCH as zero in subslots_per_pchan[] (cosmetic). Adjust the comment in subslots_per_pchan[]. The fix for the number of subslots affects only one caller: bts_chan_load() in chan_alloc.c. Before this, it would always include a TCH/F_PDCH in the load_counter->total, now it is skipped when in PDCH mode. Whether this is the way bts_chan_load() should handle dynamic TS is a separate discussion, so far I'm only making sure that the two dyn TS kinds act in the same way: TCH/F_TCH/H_PDCH is only counted when in TCH mode, and TCH/F_PDCH should match. Change-Id: Icd6668667ad2be7ad20866ffd185bf3b8711ccd6
2016-09-28channel_test: test nr of subslots for dyn pchan, with errorNeels Hofmeyr2-0/+32
Add test_dyn_ts_subslots() and call from main(). Update channel_test.ok. This includes erratic assert to show a bug for TCH/F_PDCH in PDCH mode: the nr of subslots should be the same as for a normal PDCH, i.e. zero. This will be adjusted along with the fix in an upcoming commit. Change-Id: I09685be3fb3ed1ead4577b772a9fbc31967980d1
2016-09-28channel test: prepare to add another test functionNeels Hofmeyr1-3/+8
Move the main() guts to test_request_chan(), so that I can add another test in an upcoming commit. Change-Id: I1349d0f416806416080d4667ad697f7db1ea252d
2016-09-27SLHC: Improving slhc (RFC1144) testcasePhilipp2-56/+130
- Adding Testcases for UNCOMPRESSED_TCP and TYPE_IP - Minor cosmetic changes Change-Id: I555fa3c9b9f78424102f359ef1c27b290fa9c9e9
2016-09-26vty_test_runner.py: raise exception when MSC socket connection failsNeels Hofmeyr1-0/+4
Instead of below error, raise an exception to describe what's happening. Seen in a jenkins run on https://gerrit.osmocom.org/#/c/945/2: ERROR: testBSCreload (__main__.TestVTYNAT) ---------------------------------------------------------------------- Traceback (most recent call last): File "./vty_test_runner.py", line 787, in testBSCreload msc = nat_msc_test(self, ip, port) File "./vty_test_runner.py", line 1251, in nat_msc_test return conn UnboundLocalError: local variable 'conn' referenced before assignment Change-Id: Iae26e7345267a21aed0b108b089453832889c9fa
2016-09-26cosmetic: vty_test_runner.py: add comment for vim auto settingsNeels Hofmeyr1-0/+2
Change-Id: I61a0476a0317b011432bb4f6f593cfdcaf1c072b
2016-09-26mscsplit: gsm_network_init(): add explicit root talloc ctxNeels Hofmeyr2-3/+3
Decouple the root talloc context from libbsc's global talloc_bsc_ctx. This allows to define the root talloc ctx from a main() scope, which in turn helps decouple libmsc from libbsc. Change-Id: I92f6b47b1eeea2e8f3fba66f25d7e708e5659f8a
2016-09-24SNDCP: add V.42bis data compression functionalityPhilipp1-0/+1
- Add compression control for V.42bis Add code to handle compression (gprs_sndcp_dcomp.c/h) - Add Adjustments in SNDCP - Add VTY commands Change-Id: I6d36cbdf2f5c5f83ca9ba57c70452f02b8582e7e
2016-09-24V.42bis: integration and unit testPhilipp6-0/+1105
- Edit previously committed V.42bis implementation to function outside IAXmodem. - Add unit test to verify the correct function of V.42bis Change-Id: I689413f2541b6def0625ce6bd96f1f488f05f99d
2016-09-24SNDCP: add RFC1144 header compression functionalityPhilipp1-0/+2
- Add module to handle compression entities - Add module to control header compression - Introduce VTY commands for heade compression configuration - Add changes in sndcp and llc to integrate header compression Change-Id: Ia00260dc09978844c2865957b4d43000b78b5e43
2016-09-24RFC1144: integration and unit-testPhilipp6-0/+372
The previously pushed slhc implementation has been modified to compile and function outside of the kernel. Also debug log messages were added and datatypes ware matched. The implementation is now ready to be used Change-Id: I7a638e88a43b3eb9d006751a03ef2570e36613f0
2016-09-24SNDCP: add SNDCP-XID encoder/decoder and unit testPhilipp6-1/+326
The SNDCP-XID (or layer-3 xid) is used to exchange layer-3 parameters such as compression. The encoder encodes a bytestream that is then sent as regular XID field from LLC. We will need the SNDCP-XID to negotiate the parameters for our upcomming GPRS data and header compression features Change-Id: If2d63fe2550864cafef3156b1dc0629037c49c1e
2016-09-18cosmetic: various comment, whitespace tweaksNeels Hofmeyr1-1/+1
Change-Id: I131939cfba4d67d7e2c935341deeb14d09523fee
2016-09-15Build fixesAlexander Huemer4-3/+7
Some fixes for build environments where dependencies are installed in distinct directories. Change-Id: I38808fd2911747b266ee6fde91187a88dd7ae355
2016-09-15Consistenly format variables in */Makefile.am filesAlexander Huemer17-214/+633
Change-Id: Ifa21513c007072314097b7bec188579972dc1694
2016-09-01IuPS: redirect Iu in various places, link Iu in sgsn-testDaniel Willmann1-0/+10
In gsm48_gmm_sendmsg(), redirect to iu_tx() for both cases of MM context present or not. In gsm48_rx_gmm_att_req(), compose an MM context marked as Iu for messages coming in from a ue_conn_ctx (passed in msg->dst). Also make sure cid is initialized to avoid introducing a compiler warning. In gsm48_rx_gmm_ra_upd_req(), look up an Iu MM context based on the presence of the ue_conn_ctx in msg->dst. In sgsn-test, add libiu and libasn1c, libosmo-sigtran, libosmo-ranap, which are now needed for an --enable-iu build. Change-Id: Ia47ffbfa6fa0f5a0cd76a379c57ef42faa0d80e3
2016-08-27Adding LLC-XID related modifications in LLCPhilipp1-0/+1
With this commit the already existing XID mechanism has been modified to suit the needs for the upcomming SNDCP-XID patches. This commit should not break anything since it does not alter the current behaviour (incoming XID is still just echoed, on GMM-Reset a basic XID message is still echoed) Change-Id: I65b9d625e72d3d61c99abdc7041773701d694d52
2016-08-27Adding LLC-XID encoder / decoder and unit testPhilipp5-1/+203
The lle-xid encoder/decoder is needed to encode and decode llc xid parameter messages. We need this to exchange sndcp-parameters (SNDCP-XID) and also simple parameters such as encryption IOVs Change-Id: Ia06e4cb08bf9b48c2a4682606d1b1a91d19a9d37
2016-07-25sgsn: add statistics counter for GPRS and PDP packetsAlexander Couzens1-1/+2
Changing the test to allow still allocated block from the rate counters. Change-Id: Ie30e4c3084ee3a138d6b39bb5000234ac814e65f
2016-07-24fix ctrl test: dyn TS: use new GSM_PCHAN_TCH_F_TCH_H_PDCHNeels Hofmeyr1-1/+4
Add GSM_PCHAN_TCH_F_TCH_H_PDCH in gsm_pchant_names and gsm_pchant_descs: the VTY and CTRL can now handle the new pchan type. Adjust the CTRL iface test to expect the new PCHAN type in the output. Fixes make check with --enable-external-tests after libosmocore commit fd80f5a04239c2ab7b561401476dd89f2861748b that adds GSM_PCHAN_TCH_F_TCH_H_PDCH. Change-Id: I4ad9c972d7f76f7e20cf74d6fc3d1928b644a4f8
2016-07-16SGSN: encrypt/decrypt only necessary framesMax1-1/+1
According to 3GPP TS 24.008 § 4.7.1.2 some GMM frames are not supposed to be ciphered. Propagate information about the necessity for encryption between MM <-> LLC to ensure only proper frames are encrypted/decrypted/dropped. Change-Id: I0358905e60d1b182f75caec81bfcc72bbbbb2aa1 Related: OS#1582
2016-07-16SGSN: use unique AUTH REQ referenceMax2-0/+20
The A&C reference number specified in 3GPP TS 24.008 § 10.5.5.19 identifies particular request sent by network with the related response sent by MS. The value transparently copied from request to response by MS: the spec do not specify what exactly should be in there so we use rand() to decrease chance for collisions. Note: variable named 'rand' clashes with standard function rand() so it was renamed. Change-Id: I3638821a9b4a0532b28dbbb50faa30c4082579f6 Related: OS#1582
2016-07-11SGSN: prevent starting with inconsistent configMax1-0/+2
Previously it was possible to start osmo-sgsn with "auth-policy remote" but without "gsup remote-*" which resulted in broken setup: no MS could perform GPRS ATTACH. Add consistency check to vty code to fix this. Related: OS#1582 Change-Id: Ie4296e7d99d7833f7d828b0196435ea81097cf6e
2016-07-09Make random MSISDN assignment optionalMax2-10/+71
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-07-04SGSN: move TLLI unassignment into separate functionMax1-1/+1
Change-Id: Ia4df145ab03ebcaad70a13601cff60c488a5de54 Related: OS#1582
2016-06-29Fix vty tests with subscriber deletionMax1-9/+11
Use correct vty command for subscriber deletion, adjust assertions accordingly. The error was cause by inconsistent syntax of vty commands for subscriber creation and deletion. Change-Id: I9b9376b4ac0ec066000545167de312ca4460493b
2016-06-20typo in sgsn_testNeels Hofmeyr2-2/+2
(committing just to test gerrit, if it goes through it's still a valid change) Change-Id: I3291ea2da99cd7f0e2f340b0e6fd6022d088beb8
2016-06-18rm dup: use channel type names from libosmocoreNeels Hofmeyr2-4/+6
In gsm_lchant_name(enum gsm_chan_t), use the gsm_chan_t_names value strings from libosmocore instead of redefining the same strings. The list from libosmocore is also more complete, including CCCH and PDTCH. Add a todo comment to move to libosmocore. In consequence, libosmogsm linkage needs to be added to osmo-bsc_mgcp, mgcp_test, mgcp_transcoding_test and smpp_mirror, smpp_test. Change-Id: If65ee7c0619cbc0acb0a15045bd5a969442c93cc
2016-06-14Make random extension range configurableMax2-3/+24
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-0/+16
* 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