summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* 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
* 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-011-32/+13
| | | | | | | | 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
* 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-231-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
* logging.h: fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*Neels Hofmeyr2017-02-237-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
* logging: centrally define ctx and filter indexesNeels Hofmeyr2017-02-228-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
* 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-152-0/+30
| | | | Change-Id: Ic29b588b72893821d73fe90ecc16c6bf78d5a360
* osmo_hexparse: allow whitespace in parsed string, add ws testNeels Hofmeyr2017-02-141-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
* cosmetic: replace fprintf with LOGPPhilipp Maier2017-02-091-8/+12
| | | | | | | 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-091-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
* fix various compiler warnings (on FreeBSD-11.0)Harald Welte2017-02-083-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
* 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-071-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
* osmo_auth*: fix ordering of function argsNeels Hofmeyr2017-02-061-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
* lapd_core: Improve debug outputPhilipp Maier2017-02-031-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
* GSUP, OAP, osmo-gen-vec: fix AUTS length to 14, not 16Neels Hofmeyr2017-02-021-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
* socket: Introduce function to obtain socket nameHarald Welte2017-01-271-1/+43
| | | | | | | Using this function, one can obtain a human-readable string identifying the host and port names of the socket. Change-Id: Ib5de5c7b9effe1b0a363e4473a7be7fa38ca6ef3
* OML: add external alertsMax2017-01-251-0/+1
| | | | | | | Add special cause for alerts produced by external processes. Change-Id: Idd7ee085321f8172c72ecfdba320186049f4d988 Related: OS#1615
* sim: Link to libtalloc as symbols of it are used hereHolger Hans Peter Freyther2017-01-241-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
* ipa: Remove unneeded #include statementHarald Welte2017-01-231-1/+0
| | | | Change-Id: I69f2891a2bea6f87f079b6778aa01ee27a25001b
* disable various code if building for bare-iron embeddedHarald Welte2017-01-232-0/+12
| | | | | | | We don't have file-based I/O nor ethernet devices with mac addresses when building for OsmocomBB. Change-Id: I01a9e6d8dbe885dbeac2769b84931a4d44f7a3a5
* Add abis_nm_fail_evt_vrep to libosmogsm.mapMax2017-01-191-0/+1
| | | | Change-Id: If56b521429af497ddd5a47170eb2c085b1fb78ba
* doc: fix doxygen 'utils' group closing braceNeels Hofmeyr2017-01-181-1/+2
| | | | | | | osmo_strlcpy() was excluded from the group because the closing brace was above it. Change-Id: I6701261f5854342ac4cd4f2da62e49eb40362938
* libosmogsm.map: fix typoMax2017-01-171-1/+1
| | | | | Change-Id: I71413fbe703e459782a235e5b1d8487265de3780 Related: OS#1615
* Mark deprecated function as suchMax2017-01-161-0/+1
| | | | | | | Mark abis_nm_debugp_foh() function superseded by macro with the same name as deprecated. Change-Id: I2d3ea2b56aff6b687f72f832360b8cb8a24164e9
* doc: clarify osmo_strlcpy() docNeels Hofmeyr2017-01-151-5/+5
| | | | | | | Stating that it 'truncates src' is misleading. Also clarify whether siz includes the space needed for the terminating NUL. Change-Id: I01c1a94408b471f7f54576178a60938bf9ee3261
* Always include <osmocom/core/talloc.h> and not <talloc.h>Harald Welte2017-01-151-1/+1
| | | | | | In EMBEDDED builds we don't have a system-wide talloc Change-Id: Icc526016bda45b36e584afee8669996752d6d89c
* configure.ac: Introduce --disable-ctrlHarald Welte2017-01-151-0/+3
| | | | | | | | Using --disable-ctrl, one can disable the building of libosmoctrl. The 'embedded' target will also automaticall disable ctrl. Change-Id: I6912396338c5b23ae860fef2a55854d6df9a579d
* Fix compilation warnings: missing includes: gsm0411_utils.c, lapd_core.c, ↵Max2017-01-132-0/+2
| | | | | | oap_test.c Change-Id: Id524327b3f44e22e3aa44c5e8e4965b084cb326a
* gprs_ns_vty: guard against duplicate VTY elementsNeels Hofmeyr2017-01-121-0/+8
| | | | | | | | The TbfTest in osmo-pcu calls gprs_ns_vty_init() repeatedly, which aborts because of duplicate VTY elements. Fix this by skipping the VTY init if it already happened. Change-Id: I05c7f25a4e873ae76b206819180b8b043b60103e
* Add abis_nm_fail_evt_vrep() functionMax2017-01-111-4/+17
| | | | | | | | | It accept fixed number of arguments including va_list instead of variable number of arguments in abis_nm_fail_evt_rep() - similar to vprintff() vs printf(). Related: OS#1615 Change-Id: Ib293dec1c2de9b664584a8456c782ea7b6dd8555
* LAPD: improve loggingMax2017-01-101-4/+6
| | | | | | Log error cause and state names in case of SABM errors. Change-Id: I2c7fa276e03f8b14ba41cc1fb6e19d0aae77d127
* DTX: fix AMR SID-FIRST detectionJean-Francois Dionne2017-01-101-2/+2
| | | | | | | Max's note: adjusted test output. Change-Id: I46477c631bf86345cb757f31d7f2e2935b12adcc Related: OS#1801
* Add value strings for Probable Cause TypeMax2017-01-102-0/+8
| | | | | | | | Add string representation of Probable Cause Type from 3GPP TS 12.21 § 9.4.43. Change-Id: I9fe14ed3b5398f59dd06a509e4d419e074cc20a7 Related: OS#1615
* fsm: Add VTY introspection of osmo_fsm and their instancesHarald Welte2017-01-073-4/+181
| | | | Change-Id: I89212e4f149f019099115a85bab353c04170df90
* Add osmo_fsm_find_by_name() and avoid registering FSM with same nameHarald Welte2017-01-071-1/+13
| | | | | | | This addresses a FIXME in the fsm.c code: osmo_fsm_register() should fail in case a FSM with the given name already exists. Change-Id: I5fd882939859c79581eba70c14cbafd64560b583
* vty: OSMO_ASSERT() if two identical commands are installedHarald Welte2017-01-071-0/+19
| | | | | | | | | When the caller installs two identical commands at a given VTY node, the result is that neither of the two commands can ever be executed: The VTY would always complain about "Ambiguous command.". Let's fail fast at program start when two identical commands are intalled. Change-Id: I85ff4640ebb3d8b75a6a9ab5d2f668edb5b7189e
* Add OML Failure Event Report supportMax2017-01-062-0/+39
| | | | | | | | Add 3GPP TS 12.21 § 8.8.2 Failure Event Report function which pack given vararg string and parameters into msgb. Change-Id: I58c198d8ea588432c62520928b08f0b2a7035e93 Related: OS#1615
* Add event cause string descriptionsMax2017-01-062-0/+16
| | | | | | | | Add human-readable descriptions to event causes from 3GPP TS 12.21 § 9.4.43. Change-Id: Id173c978616c98b7831fbafb5401064257f1cf73 Related: OS#1615
* Add function to get uninterrupted bit runPravin Kumarvel2017-01-061-0/+45
| | | | | | | | | Function bitvec_rl_curbit added to get number of uninterrupted bits run in vector starting from the current bit till max number of bits. Test case is added to check bitvec_rl_curbit. Change-Id: Iae153d3639ea6b891c1fc10d7801a435c9492e26