summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* osmo-auc-gen: clarify SQN output, prepare for SQN changesNeels Hofmeyr2017-03-152-16/+18
| | | | | | | | | | | | | | | | Upcoming patches will change the way SQN are incremented. Change the SQN related output by osmo-auc-gen so that it also makes sense after these changes, and so that its output is proven to remain unchanged for the same arguments: Always show the SQN used for vector generation when a UMTS vector was generated. Don't show the next SQN, it will not make sense anymore (see later patches). The adjustments of expected output of osmo-auc-gen_test illustrates how the output changes. Related: OS#1968 Change-Id: I35d9c669002ff3e8570e07b444cca34ce57c3b0c
* add osmo-auc-gen_testNeels Hofmeyr2017-03-156-2/+134
| | | | | | | | | | | | | | | | | | Add test for osmo-auc-gen invocations to ensure stability across upcoming SQN increment scheme changes. The test comprises of a shell script that invokes the osmo-auc-gen binary with various milenage parameters, of which the stdout/stderr are verified. More osmo-auc-gen invocations could be added, but my main focus is on the SEQ changes. Instead of manually testing that it still works for each SQN patch, I want this test to do it for me. To make sure that osmo-auc-gen is build before the tests are launched, place 'utils' before 'tests' in the root Makefile.am. Related: OS#1968 Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec
* milenage_test: cosmetic fix: shown value is not SEQ.MSNeels Hofmeyr2017-03-152-2/+4
| | | | | | | | | | | | | | | In the milenage_test, the console output printed "SEQ.MS = 33", but 33 is a) the SQN, not SEQ; b) the SQN *after* the next auth generation, i.e. SQN.MS would have been 31. While at it also use the proper PRIu64 from inttypes.h to output the sqn value. This prepares for upcoming sparation of SQN incrementing by SEQ and IND, particularly to clearly show where the changes in auth/milenage_test's expectations originate. Related: OS#1968 Change-Id: Ie83201f1362f3d793ada774f3fc5f89cc0b3fbb7
* lapd_core: Use 'struct value_string' for LAPD state namesHarald Welte2017-03-151-28/+33
| | | | | | | | | We don't really use state numbers without bounds check into string tables since March 2010, when value_string became part of libosmocore. It's time to catch up, 7 years later... Change-Id: I1dac7b4cb441a1119cc167112521e8b8aae62e63
* Doxygen: exclude osmocom/core/gsm/protocol/*Harald Welte2017-03-151-1/+1
| | | | | | | | | We don't document the header files that define structs/enums/types that are taken 1:1 from the relevant GSM specifications. So let's avoid having doxygen generate tons of warnings for related undocumented members. Change-Id: I231f78972a015902e4085aa80fcbc04009ae9f13
* gsm_04_08: add _NUM_CHREQ_T to enumAlexander Couzens2017-03-141-0/+1
| | | | | | _NUM_CHREQ_T defines the last element of the enum Change-Id: Id67ba8de89dd6288e449197438e9e1c5d7f5a134
* gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ_T_PDCH_TWO_PHASEAlexander Couzens2017-03-141-0/+2
| | | | | | | | | | The previous version of this commit got reverted to avoid a breakage in openbsc. The problem is openbsc use an array of chreq_type with a manual defined size. This array is using enums as index which breaks if any elements got added into the middle, because the size of the array can't hold elements greater or equal than the size. Change-Id: I6676105507fe4e5627f740dfe4c2770f766ad068
* build: cosmetic: coding: break a CPPFLAGS lineNeels Hofmeyr2017-03-131-1/+3
| | | | | | Matches our general scheme and helps readability of an upcoming patch. Change-Id: I174086a988b51b6e80f3661609069b69a3d41cc7
* libosmocoding: fix .deb buildingMax2017-03-073-0/+9
| | | | | | | dpkg-buildpackage fails due to missing file descriptions - add necessary .install and .doc-base files to fix it. Change-Id: I5fb7e813c0860a3b5037e805deb84f9bf649ffa3
* libosmocoding: migrate transcoding routines from OsmoBTSVadim Yanitskiy2017-03-0725-7/+8111
| | | | | | | | | | | | | | | | | | | | | | | | | There are some projects, such as GR-GSM and OsmocomBB, which would benefit from using one shared implementation of GSM 05.03 code. So, this commit introduces a new sub-library called libosmocoding, which (for now) provides GSM, GPRS and EDGE transcoding routines, migrated from OsmoBTS. The original GSM 05.03 code from OsmoBTS was relicensed under GPLv2-or-later with permission of copyright holders (Andreas Eversberg, Alexander Chemeris and Tom Tsou). The following data types are currently supported: - xCCH - PDTCH (CS 1-4 and MCS 1-9) - TCH/FR - TCH/HR - TCH/AFS - RCH/AHS - RACH - SCH Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1
* tests/conv: separate test logicVadim Yanitskiy2017-03-064-153/+169
| | | | | | | | To be able to add some more tests, related to convolutional coding, without duplication of code, the test logic was separated from the conv_test.c into conv.c and conv.h. Change-Id: Idbdc7e19cb9b9a36cd1fccd621cd858e87530d98
* gsm0503.h: generate header automaticallyVadim Yanitskiy2017-03-063-174/+7
| | | | | | | Since we have automatic header generation, implemented in the utils/conv_gen.py, it's time to use this feature! Change-Id: I21caa4e433b2cc1861611e35350a9671da444c2a
* utils/conv_gen.py: add header generation featureVadim Yanitskiy2017-03-061-5/+44
| | | | Change-Id: Iae830d716f01810972edbef14fc5383ac647d0ea
* utils/conv_gen.py: add test vectors generation featureVadim Yanitskiy2017-03-061-2/+76
| | | | Change-Id: Ie10c47ee952f253b1ba77ecf6e79f2c033545bc1
* ctrl_type_vals: fix range checkNeels Hofmeyr2017-03-061-1/+1
| | | | | | | | In ctrl_cmd_parse(), fix missing check for not parseable ctrl type. Fixup for Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28. Change-Id: I7f8055225e3ee04b2a723bae07b12c42618963a0
* Check for proper lapdm_datalink entityMax2017-03-021-2/+8
| | | | | | | | | | Previously lapdm_datalink->entity->mode was dereferenced without checking if correct entity is present. This might lead to segfault. Check it explicitly before dereferencing, log error and gracefully return if necessary. Change-Id: I0361e3731e86712b415a370cab1128d611988f56 Related: OS#1898
* fix: gsm0808.c: unterminated value_string array gsm0808_bssap_namesNeels Hofmeyr2017-03-021-0/+1
| | | | Change-Id: Ie38bae32372dc41e1902a8f6f0bc550ae515cfb8
* fsm: convenience: add inline osmo_fsm_inst_state_name()Neels Hofmeyr2017-03-011-0/+4
| | | | Change-Id: If9a6ecc4d6e2beaf716569e9a6053d73488e860b
* Handle replies in ctrl_cmd_handle()Max2017-03-011-0/+17
| | | | | | | | | | | | Previously *_REPLY and ERROR messages were not explicitly handled which would lead to sending error in response to them which in turn would prompt other party to send error as well which would result in infinite cycle. Handle it explicitly by logging message id and other relevant data. Change-Id: Id96f3a2fc81fa4549f49556d83f062c6b2f59e28 Related: OS#1615
* Use value_string for ctrl_typeMax2017-03-017-37/+74
| | | | | | | | Use value_string for enum ctrl_type instead of custom code. Add corresponding unit tests. Related: OS#1615 Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28
* Fix client-side ctrl interface helpersMax2017-03-011-40/+1
| | | | | | | | * remove unused ctrl_interface_connect() which is not part of public API * add default read callback to osmo_ctrl_conn_alloc() Change-Id: Iaa209e34a849ce0dfe2e29b482c3208ade1a32a4 Related: OS#1615
* Export comp128 v2 and v3 routines as wellHolger Hans Peter Freyther2017-02-271-0/+2
| | | | | | | It is in the public header file and allows to easily bind it from other languages (without having to go through the abstraction). Change-Id: I0128d529c52ec030cfb87b0aff3c69cadf2c59d2
* ports.h: rename CSCN to MSCNeels Hofmeyr2017-02-242-2/+2
| | | | | | See OS#1958 Change-Id: I85aee0f8fdfc9c69d0ba9240988c633d3e707f2d
* libosmoctrl: Fix typo in ctrl_interface_connect()Harald Welte2017-02-231-1/+1
| | | | | | it's osmo_sock_init_ofd(), not osmo_sock_init_ifd() Change-Id: Ia6a82031a691403f641815862613d99b31a3a159
* Expand and expose ctrl connection allocationMax2017-02-232-6/+52
| | | | | | | | | | | | Add function for allocating CTRL connection to public headers and replace call to previous static function with it. Add doxygen docs for this function. It's useful if we need to allocate ctrl connection but don't need to bind to any interfaces: when we act as ctrl client. Related: OS#1615 Change-Id: I522ed809cbebfd3d7dd08b4ed9137b39ff192e32
* logging.h: fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*Neels Hofmeyr2017-02-238-59/+61
| | | | | | | | | | | | | | | My recent logging patch was merged to master a bit too soon. Accomodate the request for naming that matches the general "LOG" prefix instead of "LOGGING". libosmocore will not be backwards-compatible with the few commits from change-id I5c343630020f4b108099696fd96c2111614c8067 up to this one. This and following commits are backwards compatible with those before that short window. See also: * openbsc change-id Ib2ec5e4884aa90f48051ee2f832af557aa525991 * osmo-pcu change-id I4db4a668f2be07f3d55f848d38d1b490d8a7a685 Change-Id: I424fe3f12ea620338902b2bb8230544bde3f1a93
* logging.h: fixup: add API doc for logging enums recently addedNeels Hofmeyr2017-02-231-0/+5
| | | | Change-Id: Ic459b04219abe70171c8f80ed09df53d412dcfb2
* logging.h: fix backwards compat broken by recent commitNeels Hofmeyr2017-02-231-0/+7
| | | | | | | | | | | | | | Commit 812ba6dc63a75c39678dd3fe652768e76bf63183 "logging: centrally define ctx and filter indexes" Removed definitions, which causes older e.g. openbsc and osmo-pcu code trees to fail to build against a newer libosmocore. Re-introduce the legacy definitions to redirect to the new ones and re-establish backwards compatibility. The GPRS_* constants used to be defined in gprs_msgb.h, but since that header also includes logging.h, rather place the legacy shims in logging.h next to the other ones. Change-Id: I455bb1bb474d758af0fd5b6397f7e57260ad739d
* gsm_04_08.h: add R99 MSCR and CBQ3 to SI3 Ctrl Chan DescrNeels Hofmeyr2017-02-231-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | MSCR and CBQ3 are Release 1999 additions to the Control Channel Description IE of SI3. Assuming that no-one is using the spare bits, this will not cause any code conflicts. In the R99 struct, spare1 and spare2 are in different places, so rather rename them to spare_1 and spare_2 to make sure we get a compiler barf *if* anyone tries to use them with the wrong structure. Adjust the spec reference to TS 44.018; TS 04.08 Figure 10.5.33 is replaced by TS 44.018 Figure 10.5.2.11.1 which is right there in the named Section 10.5.2.11, so drop the explicit reference. Motivation: the R99 Control Channel Description defines MSCR to indicate whether the MSC is R99+ or not. To use UMTS AKA on GSM networks, we want to indicate that our libmsc is capable of R99, like OsmoSGSN already does. CBQ3 is merely added for completeness, no particular use case in mind. Related: OS#1593 Change-Id: If87e07b5d04e1617155383e14c98d2125fdd0608
* logging: centrally define ctx and filter indexesNeels Hofmeyr2017-02-2210-54/+66
| | | | | | | | | | | | | | | | | | | | | | | It is too easy for calling code to use the same filter and context indexes for different filters and structs. For example, openbsc's IMSI filter and libgb's GPRS_BVC filter both fall on index 1 even though there are plenty more indexes to choose from. To alleviate this, have one central definition here, sort of like ports.h does for VTY and CTRL port numbers. Add static asserts to make sure the indexes fit in the available array and bit mask space. Calling code like openbsc.git and osmo-pcu need adjustments and/or should move to using these enum values instead of their local definitions. Taking this opportunity to also prepare for a split of struct gsm_subscriber in openbsc into bsc_subsciber and vlr_subscriber with appropriate separate filter index constants for both subscriber types. Include previous LOG_FILTER_ALL in the LOGGING_FILTER_* enum, and replace its use by (1 << LOGGING_FILTER_ALL). Change-Id: I5c343630020f4b108099696fd96c2111614c8067
* gsup_test: also check stderrNeels Hofmeyr2017-02-224-8/+89
| | | | | | | | | Configure logging to be deterministic and add stderr checking to testuite.at. However, exclude the thousands of message modification log lines from the log to not have a huge test expectation file. Change-Id: I0dd7112967a64a168556b62e5ec15107b7608ffb
* gsup test: add decoding test for UMTS IEsNeels Hofmeyr2017-02-222-1/+61
| | | | | | | | | | This would have caught the wrong expectation of AUTS' length fixed recently (3a5ca647c531b7761dc6c555e5e0cabc972bd3ac). Besides AUTS, add AUTN, RES, CK, IK which were also not tested yet. Change-Id: I6fddf8d7ce97137b0a585d365807bcaf90a319d0 Related: OS#1593
* fix osmo_auth_gen_vec_auts: copy rand to auth vectorNeels Hofmeyr2017-02-221-1/+8
| | | | | Related: OS#1593 Change-Id: If943731a78089f0aac3d55245de80596d01314a4
* gsup decode: fix expectation of AUTS length, should be 14Neels Hofmeyr2017-02-211-2/+2
| | | | | | The wrong expectation caused OsmoHLR to fail on Auth Sync. Change-Id: I277fb3d407396dffa5c07a9c5454d87a415d393f
* Document ctrl_interface_setup_dynip() functionMax2017-02-191-0/+8
| | | | Change-Id: Ie1d5881dda7a9b797d15e9e1eead8281a994d91e
* fix: gprs_bssgp_vty: logging filter: wrong constantNeels Hofmeyr2017-02-171-1/+1
| | | | | | | Setting the BVC log filter to NULL worked only if the NSVC filter was set, use the proper constant instead. Change-Id: Ic1cc268ed20700698c93d3ff8bf85cc0f01d3b1b
* gsup: add osmo_gsup_message_type_name()Neels Hofmeyr2017-02-153-0/+35
| | | | Change-Id: Ic29b588b72893821d73fe90ecc16c6bf78d5a360
* OAP:remove design doc. osmocom-authn-protocol.txtikostov2017-02-152-251/+1
| | | | | | | | | | | Osmocom Authentication Protocol design document is removed from libosmocore project as this information has been included in the User Manual. It is present in SGSN User Manual. relates to OS#1874 Change-Id: I2d4dc608622a7484e67b15f930efc76e28285045
* osmo_hexparse: allow whitespace in parsed string, add ws testNeels Hofmeyr2017-02-143-9/+51
| | | | | | | | This is particularly useful for hex dumps containing spaces found in a log (e.g. osmo-nitb authentication rand token), which can now be passed in quotes to osmo-auc-gen without having to edit the spaces away. Change-Id: Ib7af07f674a2d26c8569acdee98835fb3e626c45
* utils: add hexparse testNeels Hofmeyr2017-02-142-0/+117
| | | | Change-Id: Ic95ab00b57d54905a235109561c00419161cf4bc
* Add CTRL port for OsmoHLRMax2017-02-141-0/+1
| | | | | Change-Id: I1328c89ec8e908bf4b4d2c0a398690278369e0f5 Related: OS#1645
* cosmetic: replace fprintf with LOGPPhilipp Maier2017-02-092-9/+28
| | | | | | | socket.c still uses fprintf to output error messages. This commit replaces the fprintf with proper LOGP messages. Change-Id: Ia2993415d5f5c33ccd719af239ff59252d11b764
* utils/conv_gen.py: improve application flexibilityVadim Yanitskiy2017-02-092-9/+39
| | | | | | | | | | This change makes the conv_gen application more interactive and flexible, allowing to generate not only code definitions but also the test vectors and header files in the future. Moreover, it becomes possible to select exact code family, such as GSM, GMR etc. Change-Id: I0b476b00234c17f78b41d695cf3bfd13edb64c28
* Add minimal testing of socket.c helper functionsHarald Welte2017-02-086-2/+97
| | | | Change-Id: I2773b3859a206f96fb8fa095d50a653d9eeb8d79
* fix various compiler warnings (on FreeBSD-11.0)Harald Welte2017-02-084-5/+6
| | | | | | | FreeBSD 11.0 uses clang version 3.8.0 which spits various warnings during libosmocore compilation. Let's clean this up a bit. Change-Id: Ic14572e6970bd0b8916604fabf807f1608fa07e5
* lapd_core: Fix MDL-ERROR ind after RELEASE indPhilipp Maier2017-02-071-4/+4
| | | | | | | | | in lapd_t200_cb() The RELEASE INDICATION is transmitted before the MDL ERROR INIDCATION, this prevents the MDL ERROR INDICATION from being sent because the RELASE INDICATION close to connection eraly. This commit puts the messages into the correct order. Change-Id: Iae74777138fc27828f511e3aa321d1981861f4a5
* lapd_core: fix program flowPhilipp Maier2017-02-071-5/+5
| | | | | | | | | | | | | | | | when the lapd core is in state LAPD_STATE_SABM_SENT, and the retransmission counter exceeds (link down) lapd_t200_cb() will send an RELASE_INDICATION and an MDL_ERROR_INDICATION to L3. This action is done before the state is processed. This seems to be no problem with standard retransmission counts (n200), but may cause timing problems that lead to deadlock states when custom timer configurations are in use. (Ericsson RBS). This commit moves the functions calls for sending the indications mentioned above to the very end of the if branch to relax the timing again. (See lapd_t200_cb()) Change-Id: I1c1beb3701b19744a3ce9946abca7767d20a0b6a
* select: add functionality to check socket statePhilipp Maier2017-02-072-6/+26
| | | | | | | | | | | | osmo_fd_register() is used to register socket file descriptors, after registering a socket, there is no way to test if the socket is still registered or actually registered at all. This commit adds a new function osmo_fd_register_check() that can be used to check in advance, if the socket fd is registered, before performing further operations. Change-Id: I48ec7098d6bba586c81bf0d5c9088108e2c081c6
* bssgp_fc_test: do not use real timeNeels Hofmeyr2017-02-071-1/+8
| | | | | | | | | Employ osmo_gettimeofday_override_* to take bssgp_fc_test off real time. The jenkins build slave often failed the test based on sporadic time delays due to server load and randomly rejected good patches. This patch ends that. Change-Id: Ie5029b85c2a154554d75d7f9af49a3b93425fdd9 Related: OS#1809
* osmo_auth*: fix ordering of function argsNeels Hofmeyr2017-02-062-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | milenage_gen_vec() has parameter ordering of (..., auts, rand_auts, rand). osmo_auth_gen_vec_auts() has (..., rand_auts, auts, rand), but actually feeds args in the same order, so that its rand_auts becomes auts, and its auts becomes rand_auts. Interestingly enough, API user osmo-gen-vec.c also adheres to this misordering and in turn passes auts for osmo_auth_gen_vec_auts()'s rand_auts and vice versa, so that it matches milenage_gen_vec(). So both the implementation (milenage_*) and the API user use the same ordering, just osmo_auth_gen_vec_auts() and osmo_auth_impl{ .gen_vec_auts() } in-between have the argument names swapped. Any current user of this API would need to adhere to this swapping or will not get successful AUTS resolution to a SQN. So the least impact fix is to rename the args without any actual functional change. So swap the names rand_auts and auts for osmo_auth_gen_vec_auts() and osmo_auth_impl{ .gen_vec_auts() }. (Also adjust API doc ordering) Change-Id: I0dcbd49759fc32d3b8974102dbd1d6703364ebf4