summaryrefslogtreecommitdiffstats
path: root/src/gsm
Commit message (Collapse)AuthorAgeFilesLines
* gsm0808: Add value_string for encryption algorithmsPau Espin Pedrol2018-07-122-0/+13
| | | | Change-Id: Iadf6460c438d02c53c2eaa9e42d51844ad28859a
* gsm_08_08: gsm0808_permitted_speech does not have value stringsPhilipp Maier2018-07-122-0/+15
| | | | | | | enum gsm0808_permitted_speech does not have any value strings. Lets add value strings to make debugging easier. Change-Id: I5b5612a5df2758b0137a34c17f7c8c2b3f07c806
* Don't enforce Python 2 for utilitiesVadim Yanitskiy2018-07-021-1/+1
| | | | | | | | | | | The conv_gen.py utility was tested against both Python 2 and 3, so there is no need to enforce Python 2. Also, having: #!/usr/local/bin/python{2|3} is a bad idea, because Python may be installed in a different location. Change-Id: I6007d481047b584db13d6eda70fb99f11f9ddaa1
* Don't call abort() directly, always use osmo_panic()Harald Welte2018-06-281-1/+1
| | | | | | | | | A loooong time ago, we introduced osmo_panic() as a wrapper around abort(). The advantage is, that this wrapper can be overridden, and that it will also work in embedded (bare iron) targets, where the abort simply translates to an infinite loop. Change-Id: I5a70eb65952cbc329bf96eacb428b07a9da32433
* add and tweak inter-BSC HO APINeels Hofmeyr2018-06-182-2/+87
| | | | | | | | | | | | | | | | | | Add: gsm0808_create_handover_detect() gsm0808_create_handover_complete() gsm0808_create_handover_failure() To existing structs gsm0808_old_bss_to_new_bss_info and gsm0808_handover_required, add a final 'more_items' flag that makes future extensions API and ABI compatible. Fix the msgb string for Handover Request Ack. Extend some API doc comments. Related: OS#2283 (inter-BSC Handover, BSC side, MT) Change-Id: I03ee7ce840ecfa0b6a33358e7385528aabd4873f
* gsm: lapdm.c: Add missing new line char in notice log stringPau Espin Pedrol2018-06-181-1/+1
| | | | Change-Id: I92c78ea01570dc1f4be11b113c07f0aa3b342c8f
* gsm 04.80: Add value_string for component type and op codeHarald Welte2018-06-162-0/+34
| | | | Change-Id: I2615a88db5224d65f37c7cc505e183ec8b196e8a
* gsup: Add value_string for Session State IEHarald Welte2018-06-162-0/+9
| | | | | | | | In Change-Id I1cee271fed0284a134ffed103c0d4bebbcfde2a8 we added support for a new session state IE, but we didn't add any value_string array for string conversion of it. Let's fix this. Change-Id: I3d9f087786dc37c42498fa9a2be07483ec93ba7b
* gsup: Add osmo_gsup_get_err_msg_type() functionHarald Welte2018-06-112-0/+24
| | | | | | | | This function can be used to resolve the error message type for a given message type. Can be used by generic error handlers that work for any incoming message type. Change-Id: Ic637bec53dd7fe3ec83da99b49b4eae34d5602b2
* gsm/gsm0480: refactor and expose gsm0480_parse_facility_ie()Vadim Yanitskiy2018-06-112-16/+31
| | | | | | | | | | | | | | This function can be used when there is only a part of GSM 04.80 message available - Facility IE, e.g. when a message is carried over GSUP/MAP. Let's expose it. Refactoring includes the following: - adding the 'gsm0480_' prefix; - correcting inverted return value; - cosmetic code style changes. Change-Id: I623c39ffbe6cdee65eade8435a2faa04d0da193e
* gsm/gsm0480.c: introduce gsm0480_extract_ie_by_tag()Vadim Yanitskiy2018-06-112-0/+89
| | | | | | | | In some cases, there is no need to parse the whole message, e.g. during the conversion from DTAP to GSUP/MAP. This function can be used to extract given IE from a message. Change-Id: I3989d061903352473305f80712f1a1560d05df3d
* gsm0808: Add value_string for LCLS related IEsHarald Welte2018-06-022-0/+36
| | | | Change-Id: I18d7a29496929c761aeaba9c0aee847befc13108
* GSUP: introduce new messages for SS/USSD payloadsVadim Yanitskiy2018-05-311-0/+15
| | | | | | | | | | | | | | | | | In order to be able to transfer SS/USSD messages via GSUP, this change introduces the following new message types: - OSMO_GSUP_MSGT_PROC_SS_*, and the following new IE: - OSMO_GSUP_SS_INFO_IE which represents an ASN.1 encoded MAP payload coming to/from the mobile station 'as is', without any transcoding. Change-Id: Ie17a78043a35fffbdd59e80fd2b2da39cce5e532 Related: OS#1597
* GSUP: implement TCAP-like session managementVadim Yanitskiy2018-05-311-0/+16
| | | | | | | | | | | | | | | | | | | | Unlike TCAP/MAP, GSUP is just a transport layer without the dialogue/context. This prevents us from having session based communication, required e.g. for USSD. But we can emulate TCAP dialogue by adding additional IEs, which would allow to relate each message to a particular session. This change introduces the following IEs: - OSMO_GSUP_SESSION_ID_IE, - OSMO_GSUP_SESSION_STATE_IE, which optionally can be used to indicate that the message is related to a session with given ID, and to manage session state, i.e. initiate, continue, and finish. Change-Id: I1cee271fed0284a134ffed103c0d4bebbcfde2a8 Related: OS#1597
* gsm0808: Add encoding functions for LCLS BSSMAP messagesHarald Welte2018-05-302-0/+63
| | | | Change-Id: Ib83143e467df068b7d462a8e51d94b9d961ce18f
* gsm0480: fix: don't overwrite the data of RELEASE_COMPLETEVadim Yanitskiy2018-05-291-2/+6
| | | | | | | | | | | According to the 3GPP TS 04.80, table 2.5 'Release complete', a RELEASE_COMPLETE message may containg optional FACILITY element. Meanwhile, the 0xff byte is used to indicate that there is no decoded message (legacy field). Let's avoid overwriting of a decoded message. Change-Id: I0c85292222749a48ca0c4b2e93f4fa2d61468c18
* add gsm0808_create_handover_request_ack()Neels Hofmeyr2018-05-272-0/+26
| | | | | Related: OS#2283 (inter-BSC Handover, BSC side, MT) Change-Id: I692292a06c7d66004404560dc4ed933ca9107f9b
* add support for gsm0808 HANDOVER REQUIRED messageNeels Hofmeyr2018-05-272-0/+71
| | | | | Related: OS#2283 (inter-BSC Handover, BSC side, MO) Change-Id: Idb6dc3eab0282158a17091d97ed77c1e2e3eb3c2
* add gsm0808_cell_id_to_list()Neels Hofmeyr2018-05-272-0/+32
| | | | | | | | The idea is to be able to add a gsm0808_cell_id to a gsm0808_cell_id_list2: first convert it to a list, then re-use gsm0808_cell_id_list_add(). It will be used by osmo-bsc to manage neighbor-BSS cell identifiers from VTY. Change-Id: Ibf746ac60b1b1e920baf494b396658a5ceabd788
* mncc: properly export osmo_mncc_name()Harald Welte2018-05-242-4/+1
| | | | | | | For some strange reason, the osmo_mncc_name() inline function was not in the mncc.h header, but in the mncc.c file. Let's fix that. Change-Id: I2c3666510c981dffa4ba25bed517fd7ebd1250f5
* gsm: kasumi: Fix dynamic-stack-buffer-overflow on out buffers not multiple ↵Pau Espin Pedrol2018-05-171-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | of 64 bits Fixes following AddressSanitizer report during gea_test run with gcc 8.1.0: ==8899==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0x7ffc5f1719bb at pc 0x7fe574adc5fe bp 0x7ffc5f171460 sp 0x7ffc5f171450 WRITE of size 1 at 0x7ffc5f1719bb thread T0 #0 0x7fe574adc5fd in osmo_store64be_ext ../../include/osmocom/core/bit64gen.h:75 #1 0x7fe574adc649 in osmo_store64be ../../include/osmocom/core/bit64gen.h:104 #2 0x7fe574ade936 in _kasumi_kgcore libosmocore/src/gsm/kasumi.c:186 #3 0x7fe574ae2532 in gea4 libosmocore/src/gsm/gea.c:44 #4 0x7fe574ae266c in gea3 libosmocore/src/gsm/gea.c:60 #5 0x7fe574a9b616 in gprs_cipher_run libosmocore/src/gsm/gprs_cipher_core.c:95 #6 0x56422d3fb2ee in test_gea libosmocore/tests/gea/gea_test.c:29 #7 0x56422d3fb506 in main libosmocore/tests/gea/gea_test.c:49 #8 0x7fe5730f406a in __libc_start_main (/usr/lib/libc.so.6+0x2306a) #9 0x56422d3fadf9 in _start (libosmocore/tests/gea/.libs/lt-gea_test+0x1df9) The kasumi_test is updated to calculate the entire array of bits according to expected result. Before this commit it worked by writing the entire last 64bit block, and addressSanitizer cannot catch it because the allocated buffer is 64bit aligned too. Change-Id: I7b2a0224a3b5527d5a3ad7e17efc73081b63eac1
* fix spellingThorsten Alteholz2018-05-151-2/+2
| | | | Change-Id: I3ac92217f83279d5f987ab34eb18b2e6cb1c7812
* lapdm: don't enforce contention resolution on SAPI0/DCCHHarald Welte2018-05-091-5/+2
| | | | | | | | | | | | | | | | | | | In Change-Id: I8c2c103cdc7f9a45d7b2080c572f559fc3db58e4 we introduced a check to enforce contention resolution always being used in MS-originated LAPDm establishment on the main DCCH / SAPI0. This is only required after RACH request (IMM.ASS.) and not after a normal assignment command which was sent already via a dedicated channel. Hence, we cannot enforce a strict requirement for contention resolution in those cases. We *could* use the RSL Channel Activation type as a constraint on whether or not to enforce contention-resoluiton-only LAPDm establishment, but this is out of the scope of the LAPDm code but would have to be done inside OsmoBTS. Related: OS#3252 Change-Id: Id903492ee90809fe98defcf4abc0419b8150069f
* lapdm: send_rslms_rll_l3_ui(): Don't include B4/SACCH IE unless neededHarald Welte2018-05-081-3/+5
| | | | | | | | | | | | | | The RSL_IE_MS_POWER / RSL_IE_TIMING_ADVANCE is how we communicate the SACCH L1 header values on the MS side between LAPDm and L3 (which is a non-standard use of RSL). However, those IEs only maek sense on the SACCH, where we have B4 frame format and where we actually have a L1 header containing related information. Let's make sure to skip those IEs on regular RLL UNIT DATA INDICATION happening on other channel types. Change-Id: I6f13e02192531479287f71de674d17ca2ceabdc6 Closes: OS#3249
* lapdm: cleanup: send_rslms_rll_l3_ui(): Use msgb_tv_push()Harald Welte2018-05-081-9/+5
| | | | | | | | This is a purely cosmetic clean-up to use the msgb_tv_push() API to pre-pend a Tag-Value IE to a msgb, rather than the existing open-coding approach. Change-Id: I19bbfa1e327a617685ed11d4182e533df33215cb
* add gsm0808 channel enum to IE val conversion functionsNeels Hofmeyr2018-05-082-0/+10
| | | | | | | | | | | | | | | | | Add: - gsm0808_current_channel_type_1() - gsm0808_permitted_speech() - gsm0808_chosen_channel() - gsm0808_channel_type_name() gsm0808_permitted_speech() is moved from osmo-bsc's bssap_speech_from_lchan(); gsm0808_chosen_channel() is moved from osmo-bsc's lchan_to_chosen_channel(); Rationale: will be re-used by inter-BSC handover, makes sense to keep with the other gsm0808 utils. Related: OS#2283 (inter-BSC handover, BSC side) Change-Id: I8a3cc5d4548e9a78d945d54c69ccced251edcec9
* lapdm: Implement SABM related constraintsHarald Welte2018-05-081-0/+45
| | | | | | | | | | * MO SAPI0 establishment *must always* have L3 payload for contention resolution * SAPI3 establishment *must never* use contention resolution * MT establish must never use contention resolution Change-Id: I8c2c103cdc7f9a45d7b2080c572f559fc3db58e4 Closes: OS#2370
* lapdm: Fix back-pointer from lapdm_entity to lapdm_channelHarald Welte2018-05-041-0/+2
| | | | | | | | It seems that during all those years it has never been noted that the back-pointer from the lapdm_entity to the lapdm_channel was never initialized. Let's fix that. Change-Id: Iaca66cd6a2c9f315561e365b51163927868fc346
* gsm_utils: call gnutls_global_init() as constructorAlexander Couzens2018-05-021-0/+19
| | | | | | | | | | gnutls_global_init must be called at least once for gnutls < 3.3.0. It doesn't hurt calling it twice, except a reference counter is increased. gnutls >= 3.3.0 will call it automatic. Fixes: OS#2986 Change-Id: I241b6ae5aa8df13dd78f04658cf0953e9561c9e2
* RSL/LAPDm: Not all RLL message are "transparent"Harald Welte2018-04-191-3/+21
| | | | | | | | | | 3GPP TS 48.058 has a very clear definition of which messages are "transparent" and hence have the T-bit == 1. This is *not* just all RLL messages, but basically only RLL_DATA.{ind,req} and RLL_UNITDATA.{ind,req}. All other messages are non-transparent. Change-Id: I9f83654af189d818563d799bf623325b7fee8e70 Closes: OS#3188
* add gsm0808_cell_{id,id_list}_name() and friendsNeels Hofmeyr2018-04-182-0/+149
| | | | | | | | | | | | | | | | | | | | Provide comprehensive API to obtain string representations of Cell Identifiers and -Lists. Change gsm0808_test.c to use the new functions (which simplifies the output a bit), so that we don't duplicate printing code in gsm0808_test.c, and so that the not-so-trivial printing code is also tested. In gsm0808_test, also test gsm0808_cell_id_list_name_buf()'s return value and truncation behavior. The rationale for gsm0808_cell_id_list_name(), i.e. printing an entire list of cell identifiers, is that even though the maximum is 127 elements, a list of more than a few elements is hardly ever expected in practice (even more than one element isn't actually expected: either "entire BSS" or a single LAC). It is thus useful to log the entire list when it shows up in Paging and Handover. Change-Id: I9b2106805422f96c5cc96ebb9178451355582df3
* gsm/gsm48.c: add call independent SS message namesVadim Yanitskiy2018-04-171-0/+12
| | | | Change-Id: I697639d8469e5dda617b27995c4a92e1f0c0bead
* protocol/gsm_04_08.h: drop incorrect GSM48_PDISC_USSDVadim Yanitskiy2018-04-171-1/+0
| | | | | | | | | | | | According to the GSM TS 04.07, section 11.2.3.1.1 "Protocol discriminator", bits 1 to 4 of the first octet of a standard L3 message contain the protocol discriminator IE. Meanwhile, the GSM48_PDISC_USSD represents value 0x11, i.e. 0b10001, that requires 5 bits, and moreover it is not documented anywhere. Let's drop it. Change-Id: Ic4eb8a6db4ff1dfd535bd0c84e7acf1908422f64
* prevent integer underflow in ipa_ccm_make_id_resp_from_req()Harald Welte2018-04-171-1/+6
| | | | | | | don't blindly trust the tag-length value in an IPA CCM ID GET message. This could result in a remotely-triggered integer underflow. Change-Id: I4723361e1094b358310541a7dc4c5c921c778a15
* add gsm0808_{enc,dec}_cell_idNeels Hofmeyr2018-04-132-0/+53
| | | | | | | | | | | | | | | | | | | Clarify semantics and micro-optimise for the case of single Cell Identifer IEs. Test in gsm0808_test.c So far we have gsm0808_enc_cell_id_list2(), but there also exist instances of single Cell Identifiers (3GPP TS 48.008 3.2.2.17). It is possible to decode the same using the cell identifier list API, but this forces the caller to also keep a full struct gsm0808_cell_id_list2 with all its 127 entries around. E.g. for handover, there are two Cell Identifiers (Serving and Target); I'd need two full cell id lists for each, and these would be dynamically allocated for each handover operation, whether it uses them or not. Related: OS#2283 (inter-BSC HO, BSC side) Change-Id: I9f9c528965775698ab62ac386af0516192c4b0cc
* add tlv_parse2(), capable of multiple instances of the same IENeels Hofmeyr2018-04-132-24/+69
| | | | | | | | | | | | | | | Allow passing multiple struct tlv_parsed in an array, to allow parsing as many repeated IEs as are expected by the caller. From tlv_parse(), call tlv_parse2() with dec_multiple = 1 to yield the previous behavior. tlv_parse() remains valid API. An example of multiple IEs is the BSSMAP Handover Request, containing Cell Identifier (Serving) and Cell Identifier (Target), both defined by 3GPP TS 48.008 3.2.2.17 with identical IE tags; both are mandatory. Related: OS#2283 (inter-BSC HO, BSC side) Change-Id: Id04008eaf0a1cafdbdc11b7efc556e3035b1c84d
* add gsm0808_cell_id_list_add() to combine two cell identifier listsNeels Hofmeyr2018-04-132-0/+80
| | | | | | | | | | | | | This will be used by the upcoming neighbor_ident API in osmo-bsc, where the vty interface allows composing neihbor BSS cell identifier lists, and we want to allow adding individual items from individual user commands. It will also be useful to accumulate cell identifiers in case a subscriber sees multiple alternative cells from a neighboring BSS, and we want to pass these on to the MSC in a Handover Required. Related: OS#2283 (inter-BSC HO, BSC side) Change-Id: I5781f5fa5339c92ab2e2620489b002829d206925
* add osmo_cgi_name()Neels Hofmeyr2018-04-132-0/+29
| | | | | | | This will be used by cell idenitifier list code, like upcoming neighbor_ident VTY in osmo-bsc and regression tests. Change-Id: Iebc5cdf61b697b1603900993fc265af3eca0cedf
* avoid warning in gsm0808_create_layer3Neels Hofmeyr2018-04-101-1/+11
| | | | Change-Id: Ie098af4fc9640240196eda10fd61edcb3a872455
* add gsm48_reject_value_namesNeels Hofmeyr2018-04-092-0/+34
| | | | | | | | | | | | | | There seems to be quite some confusion / overlap between enum gsm48_reject_value, gsm48_gsm_cause and gsm48_gmm_cause. I tried to go with gsm48_gsm_cause_names[], but e.g. GSM48_REJECT_CONGESTION is not represented. Instead of attempting to mix/merge those enums, provide a separate value string array for enum gsm48_reject_value. This will be used by osmo-msc's libvlr (refactoring of FSM result handling), I27bf8d68737ff1f8dc6d11fb1eac3d391aab0cb1. Change-Id: I6661f139e68a498fb1bef10c266c2f064b72774a
* fix spellingThorsten Alteholz2018-04-081-1/+1
| | | | | | | fix for some spelling issues found by lintian Signed-off-by: Thorsten Alteholz <osmocom@alteholz.de> Change-Id: I69976ecae6939d9ff51bfe4ce7374890c6563b82
* gsm0480: drop messages with incorrect data lengthVadim Yanitskiy2018-04-041-9/+12
| | | | | | | | | | If either an INVOKE, either a RETURN_RESULT component has the data with incorrect length (see Annex A, 3GPP TS 04.80), the whole message is probably incorrect. Let's drop such messages instead of silent truncation. Change-Id: I2a169b0b84aa26ea2521edd55ff005c27ae6d808
* gsm0480: copy the raw USSD data, its DCS and lengthVadim Yanitskiy2018-04-041-9/+17
| | | | | | | | | | | | | | | | | | As it was already documented before, the 'ss_request' struct has a rudiment of deprecated 'ussd_request' struct - the 'ussd_text' field. It represents the data either of an INVOKE component, either of a RETURN_RESULT component, encoded as ASCII in case if DCS is 0x0f (i.e. decoded by the code itself), otherwise raw bytes 'as is'. Previously, there was no possibility to distinguish between ASCII and raw bytes with different DCS. Moreover, the payload decoding is not desired in some cases. Let's introduce the new fields, which will carry the raw unmodified payload, its length and DCS (Data Coding Scheme). Change-Id: Ia193d175021e145bb3b131290231f307dbefc64a
* gsm0808: Add value strings for BSSMAP cause codesPhilipp Maier2018-03-292-0/+74
| | | | | | | | | | libosmocore has no value strings for BSSMAP cause codes yet. - Add value strings for BSSMAP cause codes and a function to retrieve them Change-Id: I313dd8d7b06374e1e35ddc18b7a42562d9e25d45 Related: OS#1609
* fix gsm0808_enc_cell_id_list2 for leading-zero MNCNeels Hofmeyr2018-03-231-2/+2
| | | | | | | | | Use non-deprecated API to decode encode in gsm0808_enc_cell_id_list2(). Adjust gsm0808_test.c to now expect the correct results instead of previous failure. Change-Id: I1ce78883995e0d484368046b69db5afb2b4adc97
* gsm_08_08: correct speech codec defaultsPhilipp Maier2018-03-231-2/+2
| | | | | | | | | | | | The speech codec defaults are not correct. The defaults recommended in 3GPP TS 28.062, Table 7.11.3.1.3-2 are limited by 3GPP TS 48.008, Section 3.2.2.103. Some defaults are actually reserved for future use. Also the endianess of the 16 bit values is reversed. - correct values so that they match the specification - transmit bytes in the correct endianess Change-Id: I6c3a34d39a375d71c4128fd38f06629e8b98b100
* abis_nm: Introduce abis_nm_dump_foh()Harald Welte2018-03-172-4/+12
| | | | | | | | This is a more modern way of printing the Abis OML Formatted Object Header, without assuming that it would be used in a log statement or prescribing the log level to be used. Change-Id: I9b2c2afec28882b817d104d5b062651ade7aadd8
* add a regression test for TLV parsing with repeated IEsStefan Sperling2018-03-161-2/+2
| | | | | | | | | | | | | Since commit bf383a1d83661af26ccd6521c49b655fb22531d4 tlv_parse() will return the first occurrence of a repeated IE. Add a test to verify this behaviour. This test passes with the current code and fails if bf383a1d83661af26ccd6521c49b655fb22531d4 is reverted. While here, fix lies in documentation about the return value of tlv_parse() and fix a typo in another comment. Change-Id: I041f38548c5e4236920991d6c681c1c1e04de9ca Related: OS#2904
* fix parse_cell_id_lac_and_ci_list()Stefan Sperling2018-03-161-6/+7
| | | | | | | | | | | The implementation was entirely broken, reading data from wrong offsets and always writing to the first element of the decoded list. Also, add a new test for this function which found the problems. Change-Id: If0fafbc7171da2a3044bfa9a167208a1afa1c07b Related: OS#2847 Depends: Ife4e485e2b86c6f3321c9700611700115ad247b2
* fix bug in parse_cell_id_ci_list()Stefan Sperling2018-03-161-1/+1
| | | | | | | | | | | Cell ID lists with CI were misparsed because parse_cell_id_ci_list() failed to report the amount of consumed bytes to its caller. Also add a regression test which uncovered the bug. Change-Id: Ife4e485e2b86c6f3321c9700611700115ad247b2 Depends: If6b941720de33dca66b6b1aa2cb95a3275708b7f Related: OS#2847