aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2017-03-29Fix LAPD UA message buffer memory leak.Jean-Francois Dionne1-5/+5
The state check in lapd_dl_reset causes some buffers never to be released. Using talloc report LAPD UA message buffers are never released after each call and cause a memory leak. Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e
2017-03-23Add support for PCU version reportMax1-0/+1
Expand 3GPP TS 52.021 §9.4.43 Probable Cause with Osmocom-specific value for PCU version reporting to enable sending it via OML alarms. Change-Id: If57459c0610f2c7b36d599b13087c8deef8bdd9e Related: OS#1614
2017-03-22abis: add message type namesMax2-0/+104
Add human-readable names for Message Types from 3GPP TS 52.021 §9.1 Related: OS#1614 Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663
2017-03-21abis: add attribute namesMax2-0/+72
Add human-readable names for Attributes from 3GPP TS 52.021 §9.4 Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55 Related: OS#1614
2017-03-20build: fix build dependencies for generated sourcesNeels Hofmeyr1-1/+3
Ensure that a changed conv_gen.py and/or conv_codes_gsm.py result in regeneration of the gsm0503* generated sources. Before this patch, manual cleaning of the generated files was necessary to benefit from a code update. Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704
2017-03-20build: coding/gsm0503: fix build in sep. dir: -I builddirNeels Hofmeyr1-0/+1
To allow building coding/gsm0503_interleaving.c which includes the generated bit*gen.h (via bits.h), add -I to the builddir include path in order to find the generated bit*gen.h headers there. Change-Id: I0d465bc109765b1315d615243bea6af027afa368
2017-03-16logging: fail gracefully if log_info() was not calledHarald Welte1-0/+21
The logging code crashes if osmo_log_info is not set, which is typically achieved by calling log_init(). Let's fail with a reasonable assert and error message if the user forgets that. Change-Id: If3007860d2efe6ea9aec27e7d7439d44a7cd19c2
2017-03-16add gsm48_pdisc_msgtype_name()Neels Hofmeyr2-0/+202
Composing the message type string requires knowing the protocol discriminator. To ease printing the message type, add this function to switch between the defined value_string[]s depending on pdisc. Also publish the message type value_string[]s -- without inline functions to access them because it is anyway more convenient to use gsm48_pdisc_msgtype_name() instead. Since gsm48_pdisc_msgtype_name() is nontrivial, do not add as inline function -- in case the message type is not known, it needs a static string buffer. Change-Id: I0fca8e95ed5c2148b1a7440eff3fc9c7583898df
2017-03-16add gsm48_pdisc_names and gsm48_pdisc_name()Neels Hofmeyr2-0/+20
I often want to log the protocol discriminator in the openbsc debug log. It's more useful to get the name directly instead of looking it up every time. Change-Id: I0f053e2a4360b27ffccda7cf82469fb1b1cbb3ae
2017-03-16auth_milenage: fix check against too large indNeels Hofmeyr1-1/+1
To ensure that the IND index appended to SEQ does not affect the SEQ, the check should read '>= seq_1', not '>'. Change-Id: Ib1251159eee02aa07fae1b429ffec2e4604bf6a8
2017-03-15ctrl_type_vals: explicitly terminateNeels Hofmeyr1-1/+2
Don't use CTRL_TYPE_UNKNOWN as value_string[] terminator, use an explicit, more obvious { 0, NULL } termination. Set an explicit string for CTRL_TYPE_UNKNOWN. No other value_string[]s to date have such a "hidden" terminator. BTW, a { 0, "string" } item is not a terminator, only { 0, NULL } is, so we can set a string for CTRL_TYPE_UNKNOWN == 0. Also, having a string value for CTRL_TYPE_UNKNOWN is not harmful because all code paths explicitly check for the CTRL_TYPE_*s that are valid. Adjust the test expectation. From the ctrl_type_vals enum, remove the = 0, because it is implicitly 0 anyway. One motivation to press this fixup: I am trying to add a script that checks whether all value_string[]s are terminated to our jenkins jobs, and to find that this one is terminated, it would need to interpret the CTRL_TYPE_UNKNOWN constant, which would make things far more complex. At this point, all of the value_string[]s have an explicit termination, and I would like to enforce this from now on -- for readable code and to not spend more time on the validator. The patch adding ctrl_type_vals (Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28) was accepted by another reviewer before I could reconfirm my -1, so this is a fixup to enable the termination checking script patches. Related: I2bc93ab4781487e7685cfb63091a489cd126b1a8 (adds script to libosmocore) I7fe3678b524d602fc6aa14bc0ed06308df809a3e (uses in jenkins.sh) Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 (adds ctrl_type_vals) Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc
2017-03-15fix wrong return codeThorsten Alteholz1-1/+1
In case we are a daemon, we do not need to daemonize again. On the other hand everything is fine and we also do not need to bail out with an error. The daemonize template at [1] does the same. [1] http://www.itp.uzh.ch/~dpotter/howto/daemonize Change-Id: Ia4dcf7344bd65934faa3d7d46563f6e0532c232e
2017-03-15osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || INDNeels Hofmeyr1-1/+66
So far we incremented SQN by 1, which doesn't match the procedures described in 3GPP TS 33.102. An IND (index) denotes a non-significant part of SQN, and the significant SEQ part needs to be incremented. In OsmoHLR we furthermore want to use the "exception" suggested in annex C.3.4, so that each HLR's client has a fixed IND index. In other words, we will not assign IND cyclically, but keep IND unchanged per auth vector consumer. Add 'ind_bitlen' and 'ind' to the osmo_sub_auth_data.u.umts structure and increment SQN accordingly. Add a comment explaining the details. Because 'ind_bitlen' is still passed as zero, the milenage_test does not change its behavior, which is a feature I want to clearly show in this patch. The test will be expanded for the newly implemented SQN scheme in a subsequent patch. Adjust osmo-auc-gen.c to still show the right SQN and SQN.MS -- because it is passing ind_bitlen == 0, osmo-auc-gen can rely on single increments and know SQN.MS is sqn - 1. Note that osmo-auc-gen_test output remains unchanged. Related: OS#1968 Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf
2017-03-15osmo_auth_gen_vec: UMTS auth: store last used SQN, not nextNeels Hofmeyr1-3/+9
Prepare for the implementation of splitting SQN increments in SEQ and an IND part; particularly to clearly show where the changes in auth/milenage_test's expectations originate. Rationale: the source of UMTS auth vectors, for us usually OsmoHLR, typically stores the last used SQN, not the next one to be used. Particularly with the upcoming fix of the SQN scheme, this change is important: the next SQN will depend on which entity asks for it, because each auth consumer may have a particular slot in the IND part of SQN. It does not make sense to store the next SQN, because we will not know which consumer that will be for. The milenage_test has always calculated a tuple for SQN == 34. To account for the increment now happening before calculating a tuple, lower the test_aud->sqn by one to 0x21 == 33, so that it is still calculating for SQN == 34. Because we are no longer incrementing SQN after the tuple is generated, milenage_test's expected output after doing an AUTS resync to 31 changes to the next SQN = 32, the SQN used for the generated tuple. (BTW, a subsequent patch will illustrate AUTS in detail.) osmo-auc-gen now needs to pass the user requested SQN less one, because the SQN will be incremented befor generating the auth vector. Also the SQN remains the same after generating, so SQN output needs less decrementing. Note that the expected output for osmo-auc-gen_test remains unchanged, hence the same input arguments (particularly -s <sqn> and -A <auts>) still produce the same results. Note: osmo-hlr regression tests will require adjustments when this patch is merged, because it must now pass desired_sqn - 1 instead of just desired_sqn. See osmo-hlr change-id I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 . Related: OS#1968 Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3
2017-03-15lapd_core: Use 'struct value_string' for LAPD state namesHarald Welte1-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
2017-03-13build: cosmetic: coding: break a CPPFLAGS lineNeels Hofmeyr1-1/+3
Matches our general scheme and helps readability of an upcoming patch. Change-Id: I174086a988b51b6e80f3661609069b69a3d41cc7
2017-03-07libosmocoding: migrate transcoding routines from OsmoBTSVadim Yanitskiy8-0/+5555
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
2017-03-06ctrl_type_vals: fix range checkNeels Hofmeyr1-1/+1
In ctrl_cmd_parse(), fix missing check for not parseable ctrl type. Fixup for Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28. Change-Id: I7f8055225e3ee04b2a723bae07b12c42618963a0
2017-03-02Check for proper lapdm_datalink entityMax1-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
2017-03-02fix: gsm0808.c: unterminated value_string array gsm0808_bssap_namesNeels Hofmeyr1-0/+1
Change-Id: Ie38bae32372dc41e1902a8f6f0bc550ae515cfb8
2017-03-01Handle replies in ctrl_cmd_handle()Max1-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
2017-03-01Use value_string for ctrl_typeMax1-32/+13
Use value_string for enum ctrl_type instead of custom code. Add corresponding unit tests. Related: OS#1615 Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28
2017-03-01Fix client-side ctrl interface helpersMax1-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
2017-02-27Export comp128 v2 and v3 routines as wellHolger Hans Peter Freyther1-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
2017-02-23libosmoctrl: Fix typo in ctrl_interface_connect()Harald Welte1-1/+1
it's osmo_sock_init_ofd(), not osmo_sock_init_ifd() Change-Id: Ia6a82031a691403f641815862613d99b31a3a159
2017-02-23Expand and expose ctrl connection allocationMax1-5/+51
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
2017-02-23logging.h: fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*Neels Hofmeyr7-43/+43
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
2017-02-22logging: centrally define ctx and filter indexesNeels Hofmeyr8-48/+49
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
2017-02-22fix osmo_auth_gen_vec_auts: copy rand to auth vectorNeels Hofmeyr1-1/+8
Related: OS#1593 Change-Id: If943731a78089f0aac3d55245de80596d01314a4
2017-02-21gsup decode: fix expectation of AUTS length, should be 14Neels Hofmeyr1-2/+2
The wrong expectation caused OsmoHLR to fail on Auth Sync. Change-Id: I277fb3d407396dffa5c07a9c5454d87a415d393f
2017-02-19Document ctrl_interface_setup_dynip() functionMax1-0/+8
Change-Id: Ie1d5881dda7a9b797d15e9e1eead8281a994d91e
2017-02-17fix: gprs_bssgp_vty: logging filter: wrong constantNeels Hofmeyr1-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
2017-02-15gsup: add osmo_gsup_message_type_name()Neels Hofmeyr2-0/+30
Change-Id: Ic29b588b72893821d73fe90ecc16c6bf78d5a360
2017-02-14osmo_hexparse: allow whitespace in parsed string, add ws testNeels Hofmeyr1-9/+22
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
2017-02-09cosmetic: replace fprintf with LOGPPhilipp Maier1-8/+12
socket.c still uses fprintf to output error messages. This commit replaces the fprintf with proper LOGP messages. Change-Id: Ia2993415d5f5c33ccd719af239ff59252d11b764
2017-02-09utils/conv_gen.py: improve application flexibilityVadim Yanitskiy1-1/+1
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
2017-02-08fix various compiler warnings (on FreeBSD-11.0)Harald Welte3-2/+3
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
2017-02-07lapd_core: Fix MDL-ERROR ind after RELEASE indPhilipp Maier1-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
2017-02-07lapd_core: fix program flowPhilipp Maier1-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
2017-02-07select: add functionality to check socket statePhilipp Maier1-6/+24
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
2017-02-06osmo_auth*: fix ordering of function argsNeels Hofmeyr1-3/+3
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
2017-02-03lapd_core: Improve debug outputPhilipp Maier1-144/+190
The debug output of lapd core has no references to the dl objects, since we have multiple links, seeing which action is for which object is impossible. This commit adds pointer references (dl=%p) to each log line. Change-Id: I3024d1cbd58631e2abac4ce5822528e2e6e15fda
2017-02-02GSUP, OAP, osmo-gen-vec: fix AUTS length to 14, not 16Neels Hofmeyr1-1/+1
GSUP transmits AUTS for UMTS authentication procedures, and OAP uses the same procedures to authenticate. osmo-gen-vec is a utility program that passes AUTS to our osmo_auth_gen_vec_auts() API. According to 3GPP 33.102 6.3.3, AUTS = SQN^AK || MAC-S, which are 6 || 8 == 14 bytes. This is confirmed by 24.008 9.2.3a where the TLV has 16 bytes, TL = 2 and AUTS being the V = 14. It is not harmful for milenage_gen_vec_auts() to pass two more AUTS bytes. But writing 16 bytes to a GSUP struct is a potential problem when passing in a 14 byte long AUTS buffer to the GSUP API, which then reads past the AUTS buffer. The API implies the length, so far to be 16, so passing in a 14 byte buffer to GSUP would require copying to a larger buffer first. Fix this by using a length of 14 for AUTS everywhere instead. This constitues an ABI breakage, we may handle it as a "fix before an official release", otherwise we need a version bump. The OAP protocol document has also been updated, needs an update in the osmo-gsm-manuals as well. Change-Id: If25b173d9ec57ea4c504d860954912b7d82af455
2017-01-27socket: Introduce function to obtain socket nameHarald Welte1-1/+43
Using this function, one can obtain a human-readable string identifying the host and port names of the socket. Change-Id: Ib5de5c7b9effe1b0a363e4473a7be7fa38ca6ef3
2017-01-25OML: add external alertsMax1-0/+1
Add special cause for alerts produced by external processes. Change-Id: Idd7ee085321f8172c72ecfdba320186049f4d988 Related: OS#1615
2017-01-24sim: Link to libtalloc as symbols of it are used hereHolger Hans Peter Freyther1-0/+1
A DSO should link to the libraries that it is using. Linking to libtalloc will resolve these warnings: Change-Id: I4c8d5e80e194b9d9b4fa2424c4a22377ecee9c7a dpkg-shlibdeps: warning: symbol _talloc_zero used by debian/libosmosim0/usr/lib/i386-linux-gnu/libosmosim.so.0.0.0 found in none of the libraries dpkg-shlibdeps: warning: symbol _talloc_free used by debian/libosmosim0/usr/lib/i386-linux-gnu/libosmosim.so.0.0.0 found in none of the libraries dpkg-shlibdeps: warning: symbol talloc_strndup used by debian/libosmosim0/usr/lib/i386-linux-gnu/libosmosim.so.0.0.0 found in none of the libraries dpkg-shlibdeps: warning: symbol talloc_strdup used by debian/libosmosim0/usr/lib/i386-linux-gnu/libosmosim.so.0.0.0 found in none of the libraries dpkg-shlibdeps: warning: symbol _talloc_memdup used by debian/libosmosim0/usr/lib/i386-linux-gnu/libosmosim.so.0.0.0 found in none of the libraries
2017-01-23ipa: Remove unneeded #include statementHarald Welte1-1/+0
Change-Id: I69f2891a2bea6f87f079b6778aa01ee27a25001b
2017-01-23disable various code if building for bare-iron embeddedHarald Welte2-0/+12
We don't have file-based I/O nor ethernet devices with mac addresses when building for OsmocomBB. Change-Id: I01a9e6d8dbe885dbeac2769b84931a4d44f7a3a5
2017-01-19Add abis_nm_fail_evt_vrep to libosmogsm.mapMax1-0/+1
Change-Id: If56b521429af497ddd5a47170eb2c085b1fb78ba
2017-01-18doc: fix doxygen 'utils' group closing braceNeels Hofmeyr1-1/+2
osmo_strlcpy() was excluded from the group because the closing brace was above it. Change-Id: I6701261f5854342ac4cd4f2da62e49eb40362938