aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/channel
AgeCommit message (Collapse)AuthorFilesLines
2017-03-08add struct bsc_subscr, separating libbsc from gsm_subscriberNeels Hofmeyr2-2/+3
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
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-11-24move to libcommon-cs: net init 3: actual moveNeels Hofmeyr1-0/+1
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 Hofmeyr1-0/+1
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 Hofmeyr1-1/+1
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-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-26mscsplit: gsm_network_init(): add explicit root talloc ctxNeels Hofmeyr1-1/+1
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-15Consistenly format variables in */Makefile.am filesAlexander Huemer1-6/+26
Change-Id: Ifa21513c007072314097b7bec188579972dc1694
2016-03-03channel_test: don't segfault if paging failsNeels Hofmeyr1-2/+5
Add due assertions of return value validity, otherwise leading to segfaults.
2015-10-12libmsc: Use RAND_bytes when choosing a tmsiDaniel Willmann1-1/+1
Require openssl version to be >= 0.9.5 because we rely on the RAND_bytes return value. [hfreyther: Add cast to uint8_t*]
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.
2014-12-05msc: Add and use gsm_subscriber_groupJacob Erlbeck1-1/+4
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-11-11bsc: Move gsm_network_init function to libbscJacob Erlbeck1-3/+5
Currently libcommon depends on libbsc, because gsm_network_init (libcommon/gsm_data.c) directly calls gsm_net_update_ctype (libbsc/gsm_04_08_utils.c). This patch moves gsm_network_init to a new file libbsc/net_init.c. Sponsored-by: On-Waves ehf
2014-05-28channel_test: Return a positive number to claim it was pagedHolger Hans Peter Freyther1-1/+4
This addresses an ASAN issue where the request was already deleted by our callback function. (gdb) where #0 0xb69e7810 in __asan_report_error () from /usr/lib/i386-linux-gnu/libasan.so.0 #1 0xb69e0aff in __asan_report_store4 () from /usr/lib/i386-linux-gnu/libasan.so.0 #2 0x0804ea64 in subscr_send_paging_request (subscr=subscr@entry=0xb5103cb0) at gsm_subscriber.c:212 #3 0x0804edac in subscr_get_channel (subscr=subscr@entry=0xb5103cb0, type=type@entry=2, cbfn=cbfn@entry=0x804969d <subscr_cb>, param=param@entry=0x2342) at gsm_subscriber.c:246 #4 0x080498f7 in main (argc=1, argv=0xbffff804) at channel_test.c:77 Breakpoint 3, subscr_paging_dispatch (hooknum=hooknum@entry=101, event=event@entry=200, msg=msg@entry=0x1323, data=<optimized out>, data@entry=0x8063900 <s_conn>, param=<optimized out>, param@entry=0xb5103cb0) at gsm_subscriber.c:126 126 llist_del(&request->entry); (gdb) b llist_del (gdb) bt #0 subscr_paging_dispatch (hooknum=hooknum@entry=101, event=event@entry=200, msg=msg@entry=0x1323, data=<optimized out>, data@entry=0x8063900 <s_conn>, param=<optimized out>, param@entry=0xb5103cb0) at gsm_subscriber.c:126 #1 0x0804e8a9 in subscr_paging_cb (hooknum=101, event=200, msg=0x1323, data=0x8063900 <s_conn>, param=0xb5103cb0) at gsm_subscriber.c:187 #2 0x080497e9 in paging_request (bts=0xb5b03e70, subscriber=subscriber@entry=0xb5103cb0, type=2, cbfn=cbfn@entry=0x804e881 <subscr_paging_cb>, data=data@entry=0xb5103cb0) at channel_test.c:51 #3 0x0804ea39 in subscr_send_paging_request (subscr=subscr@entry=0xb5103cb0) at gsm_subscriber.c:207 #4 0x0804edac in subscr_get_channel (subscr=subscr@entry=0xb5103cb0, type=type@entry=2, cbfn=cbfn@entry=0x804969d <subscr_cb>, param=param@entry=0x2342) at gsm_subscriber.c:246 #5 0x080498f7 in main (argc=1, argv=0xbffff804) at channel_test.c:77 (gdb) q
2013-12-27db: Avoid crash we have seen with the dbi code when reading a SMSHolger Hans Peter Freyther1-0/+1
Avoid a crash when reading a SMS and a Subscriber could not be resolved. It is not clear why the read was failing. The sender_id and the receiver_id was valid for the given sms. I assume that the database has been locked due external access to it. The side-effect is that in case of such a failure the sms_queue will start to deliver starting from subscriber id = 0 again. #1 0x0000000000428bec in sms_from_result (net=0x156a270, result=0x15eda30) at db.c:1146 #2 0x000000000042a8e0 in db_sms_get_unsent_by_subscr (net=0x156a270, min_subscr_id=<optimized out>, failed=<optimized out>) at db.c:1255 #3 0x000000000042e900 in take_next_sms (smsq=<optimized out>) at sms_queue.c:193 #4 sms_submit_pending (_data=0x158e300) at sms_queue.c:227 #5 0x00007f3fd30de3bc in osmo_timers_update () at timer.c:243 #6 0x00007f3fd30de69b in osmo_select_main (polling=0) at select.c:133 #7 0x0000000000406fbc in main (argc=9, argv=<optimized out>) at bsc_hack.c:346 (gdb) frame 1 #1 0x0000000000428bec in sms_from_result (net=0x156a270, result=0x15eda30) at db.c:1146 1146 strncpy(sms->src.addr, sms->sender->extension, sizeof(sms->src.addr)-1); (gdb) p *sms (gdb) p sms->sender $1 = (struct gsm_subscriber *) 0x0 (gdb) p sender_id $2 = <optimized out>
2013-12-13build: channel_test does not use dlopen/dlsym remove LIBRARY_DL depHolger Hans Peter Freyther1-1/+1
2013-12-13freebsd: dlopen/dlsym/dlerror is part of libc, use LIBRARY_DL for linkingNikola1-1/+1
In FreeBSD there is no spearate library for dlopen, dlsym and dlerror. Use LIBRARY_DL to check for this condition.
2013-07-27expiration: Speculative fixes for the periodic expiring handlingHolger Hans Peter Freyther1-0/+1
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-06-12Makefile.am: Use AM_CPPFLAGSAlexander Huemer1-1/+1
Since automake 1.13 INCLUDES is depricates and causes a warning
2012-01-15abis: gsm_data_shared.h includes libosmo-abis header, add abis to cflagsHolger Hans Peter Freyther1-1/+1
gsm_data_shared.h includes e1_input.h of libosmo-abis, add the LIBOSMOABIS_CFLAGS to Makefile.am, remove AM_LDFLAGS at the same time as we only build .a archives.
2012-01-06tests: Introduce running tests with GNU autotest in OpenBSCHolger Hans Peter Freyther2-0/+4
The quality of the tests is of different value but it is good to get started and improve from here.
2012-01-06channel: Make the test not crash again.Holger Hans Peter Freyther1-4/+15
* Initialize logging * The callback expects NULL or a subscriber connection
2011-06-30misc: Link to libosmogsm after adding our static librariesHolger Hans Peter Freyther1-2/+2
GCC 4.6.0 and LD.BFD 2.21 on ARM somehow fail to resolve the dbi symbols when we have the library in front of the static libraries, move them to the back. Without this patch the tlv_def_patch symbol and the gsm48_construct_ra.
2011-06-30misc: Link to -ldbi after adding our static librariesHolger Hans Peter Freyther1-2/+2
GCC 4.6.0 and LD.BFD 2.21 on ARM somehow fail to resolve the dbi symbols when we have the library in front of the static libraries, move them to the back.
2011-06-26make channel_test build againHarald Welte1-1/+1
2011-05-06src: use namespace prefix osmo_fd* and osmo_select*Pablo Neira Ayuso1-1/+1
Summary of changes: s/struct bsc_fd/struct osmo_fd/g s/bsc_register_fd/osmo_fd_register/g s/bsc_unregister_fd/osmo_fd_unregister/g s/bsc_select_main/osmo_select_main/g
2011-03-23src: use new library libosmogsm and new path to headers in libosmocorePablo Neira Ayuso2-3/+3
libosmogsm is a new library that is distributed in the libosmocore. Now, openbsc depends on it. This patch gets openbsc with this change. This patch also rewrites all include path to the new osmocom/[gsm|core] Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-04prefix sub-directories containing libraries with 'lib'Harald Welte1-11/+5
... and make sure tests work again after restructuring
2011-02-11[BSC] Move the BTS-type specific code from bcs_init.c to bts_*.cHarald Welte2-2/+2
bsc_init.c was a big mess even only for two supported BTS models, so before adding more BTS types, this needs a cleanup. All the BTS specific code from bsc_init.c has now moved into bts_{siemens_bs11,ipaccess_nanobts}.c This has required that input_event() and nm_state_event() get both converted to proper libosmocore signals instead of referencing external symbols.
2011-01-06subscr: Dump the pending requests to help with debugging state.Holger Hans Peter Freyther1-0/+1
2011-01-06subscr: Stop all paging requests if one is failing.Holger Hans Peter Freyther1-0/+1
If one paging request is timing out the others will timeout soon as well. With the current code the next timeout would expire the next request in the queue. We will now stop all paging requests and then issue a next paging request. So for both paging success and failure we will now stop all the other requests. This is mostly a workaround, one should count on how many BTSes we are paging and wait for all failures before we remove the item from the queue.
2011-01-01License change: We are now AGPLv3+ instead of GPLv2+Harald Welte1-5/+4
The reason for this is quite simple: We want to make sure anyone running a customized version of OpenBSC to operate a network will have to release all custom modifiations to the source code.
2010-12-21test: Make it compile but it is segfaulting on start nowHolger Hans Peter Freyther1-0/+2
2010-09-18janitor: Move the * to the variable nameHolger Hans Peter Freyther1-1/+1
2010-09-06chan: Store the to be assigned channel type in the GSM Network.Holger Hans Peter Freyther1-0/+1
Store the mapping from request to channel type in the GSM Network struct as there is some policy involved with handling the request. E.g. in a half rate network we don't want emergy calls to be getting a TCH/F, or we want to have a different policy for early/late assignment of phone calls. Update the table when creating the network and when the neci is changed.
2010-02-26[misc] Add LIBOSMOCORE_CFLAGS to the includesHolger Hans Peter Freyther1-1/+1
2010-02-20finish openbsc / libosmocore separationHarald Welte2-9/+3
* use pkg-config from openbsc to find header and library * move sms and timer tests to libosmocore itself * ensure "make distcheck" works on both packages
2010-01-11misc: Fix compilation of the test cases.Holger Hans Peter Freyther2-1/+6
2009-12-23[channel] Compile statistics.c into the test.Holger Hans Peter Freyther1-1/+2
2009-08-20[subscr] Change the signature... the gsm_network is in the subscrHolger Hans Peter Freyther1-1/+2
Remove the extra parameter from the method, the network can be taken from the subscriber.
2009-08-17[subscr] Split gsm_subscriber.c in BSC and MSC partHolger Hans Peter Freyther1-0/+1
For the BSC part we still assign a gsm_subscriber to lchan but it might only contain the TMSI of this subscriber. For the MSC part we will need the HLR/VLR feature of the gsm_subscriber, specially the lookup's by number... So if libbsc.a/libmsc.a are compiled in one app and used the subscribers will be shared, and if only libbsc.a gets used we will have more empty gsm_subscriber.c..
2009-08-10misc: Firs round of fixing compilation of test casesHolger Hans Peter Freyther2-1/+3
Next round should be using them again
2009-06-26make tests compile again after talloc branch changesHarald Welte2-4/+10
2009-06-10[channel] Add a test case for the request foo in gsm_subscriber.cHolger Hans Peter Freyther2-0/+86
This is simulating a successfull request and is causing a segfault. The test is done with a "mock object" in this case a minimalistic paging implementation which is enough to show the crash. Compare that the callback data is supposed to be the same....