summaryrefslogtreecommitdiffstats
path: root/src/gsm
Commit message (Collapse)AuthorAgeFilesLines
* Make osmo_apn_to_str() more robustMax2017-10-201-0/+3
| | | | | | | Previously it would crash on NULL input. Let's handle it gracefully instead. Corresponding test case is also added. Change-Id: I587153e49d1c92128fac3ae5c124adba9592378e
* [doc] Properly define gsm0800 group and move all related files into itHarald Welte2017-10-172-3/+4
| | | | Change-Id: I91920c69c86d6a1932172becacb76faff2d3eb1e
* [doc] Properly define 'oap' group and add introductory textHarald Welte2017-10-171-2/+1
| | | | Change-Id: I1e875991ae1dd93862f850f85d40b3dac61ece72
* [doc] Define 'gsup' group with proper name, add intro textHarald Welte2017-10-171-2/+1
| | | | Change-Id: Ieee6213dc5aad082a2d439c7418b51f281b80b1a
* [doc] make sure all SMS related code is part of the 'sms' groupHarald Welte2017-10-174-7/+7
| | | | Change-Id: I24c56ccb56d5b39cfb887808f91b715da54c0f8b
* [doc] gea has separate group; A5 is not part of crypto but a5 groupHarald Welte2017-10-172-14/+11
| | | | Change-Id: I2fd24c86f9b52244073ec800a3287e3d38e660d9
* gsm: make osmo_imsi_str_valid() NULL-safeNeels Hofmeyr2017-10-101-0/+2
| | | | | | | | | No callers that would pass NULL exist, but let's check against NULL from the start. Fixup for recent change I1e94f5b0717b947d2a7a7d36bacdf04a75cb3522. Change-Id: I111fbf29228929f2cd6ffa06bcb1f69da223224e
* Fix build on older systemsMax2017-10-101-0/+3
| | | | | | | | Make sure GRND_NONBLOCK is always defined, even when using syscall directly. Change-Id: I1bcac37ee1847596b49122f9307bd2689ba71b1b Related: OS#1694
* auth: add OSMO_MILENAGE_IND_BITLEN_MAXNeels Hofmeyr2017-10-091-1/+1
| | | | | | Will be used by OsmoHLR to validate VTY and CTRL input. Change-Id: Ic39f3404d1a49ffd06070aa9897b36f219eacf4d
* auth: add value_strings for osmo_sub_auth_type, comment on osmo_auth_alg_name()Neels Hofmeyr2017-10-092-0/+8
| | | | | | | | | Add osmo_sub_auth_type_names[] and osmo_sub_auth_type_name(). Also add a hint to enum osmo_auth_algo's API doc that osmo_auth_alg_name() already exists (it is defined further below). Change-Id: I652a929bcd11c694d86812fb03d0a1cbd985efda
* Add function to generate random identifierMax2017-10-092-0/+49
| | | | | | | | | | | | | | | | | The function is a wrapper on top of getrandom() (if available via glibc) or corresponding syscall. If neither is available than failure is always returned. It's intended to generate small random data good enough for session identifiers and keys. To generate long-term cryptographic keys it's better to use special crypto libraries (like GnuTLS for example) instead. As an example it's used to replace old insecure random number generator in osmo-auc-gen utility. Change-Id: I0241b814ea4c4ce1458f7ad76e31d390383c2048 Related: OS#1694
* add osmo_imsi_str_valid() and osmo_msisdn_str_valid()Neels Hofmeyr2017-10-053-1/+70
| | | | | | | | | Add GSM23003_IMSI_MIN_DIGITS definition. Add regression test gsm23003_test.c to test the two new functions. Will be used by OsmoHLR to validate VTY and CTRL input. Change-Id: I1e94f5b0717b947d2a7a7d36bacdf04a75cb3522
* ipa: place comment "IPA Multiplex" on ipa allocated msgbsNeels Hofmeyr2017-09-071-1/+1
| | | | | | | | | | libosmocore offers the ipa API as general IPA Multiplex, which is e.g. used for GSUP in osmo-msc. Looking at talloc reports, it is confusing to see "Abis/IP" as msgb comment, because osmo-msc does not have an Abis interface. Rename to "IPA Multiplex" as a more general description. Change-Id: I3714dd21707bec0c4bcd0871e6ee8ff32d56b125
* lapd_core: Fix crash in lapd_est_req() functionIvan Kluchnikov2017-09-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lapd_est_req() function could be called on uninitialized lapd link (before lapd_dl_init() and after lapd_dl_exit() functions) due to invalid usage on higher levels. In order to prevent using uninitialized lapd link, we should set LAPD_STATE_NULL state for lapd_datalink in lapd_dl_exit() function. So all messages for lapd_datalink in null state will be unhandled by lapd_recv_dlsap() function and lapd_est_req() function will not be called before lapd_dl_init() function where lapd link state is changed to idle. #0 0x00007f46ecd99aa5 in lapd_est_req (dp=<optimized out>, lctx=0x7f46ed80b8b8) at lapd_core.c:1769 #1 0x00007f46ecd9dda8 in rslms_rx_rll_est_req (msg=msg@entry=0x7f46eeab4940, dl=dl@entry=0x7f46ed80b888) at lapdm.c:845 #2 0x00007f46ecd9fc03 in rslms_rx_rll (lc=0x7f46ed80b398, msg=0x7f46eeab4940) at lapdm.c:1157 #3 lapdm_rslms_recvmsg (msg=0x7f46eeab4940, lc=0x7f46ed80b398) at lapdm.c:1223 #4 0x00007f46ed63773d in rsl_rx_rll (msg=<optimized out>, trx=<optimized out>) at rsl.c:2178 #5 down_rsl (trx=<optimized out>, msg=<optimized out>) at rsl.c:2541 #6 0x00007f46ed641529 in sign_link_cb (msg=<optimized out>) at abis.c:169 #7 0x00007f46ec54b111 in ipaccess_bts_read_cb (link=0x7f46eeab4940, msg=0x0) at input/ipaccess.c:807 #8 0x00007f46ec548a8e in ipa_client_read (link=0x7f46ee26ae30) at input/ipa.c:74 #9 ipa_client_fd_cb (ofd=<optimized out>, what=1) at input/ipa.c:137 #10 0x00007f46ecfc726f in osmo_fd_disp_fds (_eset=0x7ffe7a9fcd20, _wset=0x7ffe7a9fcca0, _rset=0x7ffe7a9fcc20) at select.c:167 #11 osmo_select_main (polling=polling@entry=0) at select.c:207 #12 0x00007f46ed63fc25 in bts_main (argc=5, argv=<optimized out>) at main.c:359 #13 0x00007f46ebd76f45 in __libc_start_main (main=0x7f46ed61b120 <main>, argc=5, argv=0x7ffe7a9fcf18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, #14 0x00007f46ed61b14e in _start () Related: OS#1982 Change-Id: I306dad9b78e3becaef14c5305ec25c312feefe3c
* umts aka: add sqn_ms out-param, print SQN.MS in osmo-auc-genNeels Hofmeyr2017-08-291-1/+2
| | | | | | | | | | | | | | | | When doing UMTS AKA with AUTS, it can be interesting to know the SQN.MS that was encoded in the AUTS. The only way to know this is to provide it as a separate out-parameter from milenage_gen_vec_auts(), because the SQN.MS from AUTS stored in umts.sqn is immediately modified non-trivially by milenage_gen_vec(). Add sqn_ms to struct osmo_sub_auth_data to retain SQN.MS even after a vector was generated. Use this to print out SQN.MS for 'osmo-auc-gen -3 -A'. Adjust test suite expectations. Related: OS#2464 Change-Id: I9fc05bbf169d06716f40b995154fd42a3f91bef3
* gsm0411_utils: GSM03.40 9.2.3.11 SCTS should be localKeith2017-08-171-1/+1
| | | | | | | | From GSM 03.40: "The Service-Centre-Time-Stamp, and any other times coded in this format that are defined in this specification, represent the time local to the sending entity." Change-Id: I4efdb1eaae43aced33961b64d4f14b0040321c10
* auth_milenage: Fix non-AUTS case with OPHarald Welte2017-08-161-12/+24
| | | | | | | | | We only implemented OPC generation from OP in the AUTS case, but not in the case of normal authentication vector generation. This never really was visible so far due to the fact that we use OPC at sysmocom, and never the shared OP value. Change-Id: Id3fa038dfc2ff1ba63616fa5e8eab0520481ff26
* Add osmo_gprs_{ul,dl}_block_size_{bits,bytes} functionsHarald Welte2017-08-092-0/+96
| | | | | | Those functions can be used to look up the size of (E)GPRS blocks. Change-Id: I05ff75ef7dfae639886bbd09fe35f03a8af9d988
* RSL: Add support for RSL_CHAN_OSMO_PDCH to rsl_dec_chan_nr()Harald Welte2017-07-301-0/+3
| | | | Change-Id: Icc772285636c06e1075a89809f0ac379d7a0002c
* LC15: add NM measurement type to standard attribute listMinh-Quang Nguyen2017-07-141-0/+1
| | | | Change-Id: I320b379429aaf0f7351aed5e4f72a481cc268c05
* LC15: Enable string for IPAC RSL direct retryMinh-Quang Nguyen2017-07-141-0/+1
| | | | Change-Id: I3e69fba0e21e181d28baee90e95f57216f2617af
* IPAC manufacture-defined measurement pre-processing definitionsMinh-Quang Nguyen2017-07-141-0/+5
| | | | Change-Id: Ie1853697f4cff5ff98654fa1cae6c68e28a0076b
* utils: add function gsm_fn_as_gsmtime_str()Philipp Maier2017-07-112-0/+12
| | | | | | | Convert a given frame number into a printable string that displays the sub components of the frame number. Change-Id: I8015d2ded3940b01b35df7b72fc35c70c25e9926
* gsm_utils: Add osmo_dump_gsmtimePau Espin Pedrol2017-07-102-0/+12
| | | | | | Used by osmo-bts, moved from osmo-bts l1sap.c:dump_gsmtime. Change-Id: Ib5452e2c20f53006c0f6d197fb055728947125d8
* gsup: Add encoding/decoding for the pdp charging characteristicsHolger Hans Peter Freyther2017-07-071-0/+20
| | | | | | | | These fields can be in the ISD and the PDP Context inofmration. Store pointers to this IE in both cases. It needs to be used by the SGSN when opening a PDP context. Change-Id: Iedc7c02adcf77ca5c9545119e19c968dfbbb3e6b
* abis_nm.c: Fix implicit enumeration type conversionPau Espin Pedrol2017-06-231-4/+4
| | | | | | | Fixes following warning message: abis_nm.c:101:2: warning: implicit conversion from enumeration type 'enum abis_nm_msgtype_bs11' to different enumeration type 'enum abis_nm_msgtype' [-Wenum-conversion] Change-Id: Icb0ed423febf1ceb6626e256d32011b4118fc527
* gsm0411_utils.c: Fix compilation warningsPau Espin Pedrol2017-06-231-2/+2
| | | | | | | | | | | gsm0411_utils.c:102:2: warning: #warning find a portable way to obtain timezone offset [-Wcpp] #warning find a portable way to obtain timezone offset gsm0411_utils.c: In function 'gsm338_get_sms_alphabet': gsm0411_utils.c:260:4: warning: large integer implicitly truncated to unsigned type [-Woverflow] return 0xffffffff; Change-Id: I1d6cb31f38721f79e2cf93f9b8e4776f3720aa07
* Fix warnings: tolower() and similar require ucharPau Espin Pedrol2017-06-231-1/+1
| | | | | | | | | | | | utils.c: In function 'osmo_str2lower': utils.c:277:3: warning: array subscript has type 'char' [-Wchar-subscripts] out[i] = tolower(in[i]); And according to man: If c is neither an unsigned char value nor EOF, the behavior of these func‐ tions is undefined. Change-Id: I3fed2ab6a4efba9f8a21fcf84a5b3a91e8df084f
* Fix compilation warnings: use correct log type for uint32_tPau Espin Pedrol2017-06-231-1/+2
| | | | Change-Id: Ic1e3255800999669ca9619bfceb4124c773eff2d
* fix map entry for gsm0808_speech_codec_from_chan_typeNeels Hofmeyr2017-06-231-1/+1
| | | | | | | | | | | Recent commit 884ba0f2bcaf385cabee0b4228a2598d61fa406b adds function gsm0808_chan_type_to_speech_codec() but adds a mismatching name in libosmogsm.map. openbsc.git's aoip branch can't build with this. This must have been an on-the-fly rename that wasn't properly tested. Always test your patches! Change-Id: I68feb14f7bcb2f62b89f9b2d8c085d6824b493bc
* fix map entry and .h declaration for gsm0808_chan_type_to_speech_codec()Neels Hofmeyr2017-06-231-1/+1
| | | | | | | | | | | | Recent commit 3149b0d076477303a38df735fe579b1b06ee17b2 adds function gsm0808_chan_type_to_speech_codec() but adds a completely mismatching name in libosmogsm.map, as well as a definition with a typo in the name. Fix the entry in libosmogsm.map. Add the missing 'c' in gsm0808_utils.h Change-Id: I5a621fa5ef6b632eabbe224f3dd383eacaffb695
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-2346-194/+193
| | | | | | | | | | | | | | | | | Considering the various styles and implications found in the sources, edit scores of files to follow the same API doc guidelines around the doxygen grouping and the \file tag. Many files now show a short description in the generated API doc that was so far only available as C comment. The guidelines and reasoning behind it is documented at https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation In some instances, remove file comments and add to the corresponding group instead, to be shared among several files (e.g. bitvec). Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
* doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr2017-06-2326-263/+263
| | | | | | | | | | Especially for short descriptions, it is annoying to have to type \brief for every single API doc. Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes the first sentence of an API doc as the brief description. Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
* comments: gsm0808_utils: mention various 3GPP specsPhilipp Maier2017-06-231-0/+5
| | | | | Tweaked-by: nhofmeyr Change-Id: I990dfe9eeaf96f377484b828143935240a937226
* gsm0808: fix length check of the element decoder functionsPhilipp Maier2017-06-231-6/+6
| | | | | | | | | | | | | | | The length check of the decoder functions is not entirely correct. The check also checks for values below zero, which does not make sense, since the length is encoded as uint8_t. For some elements a minimum length is known (in most cases this is 1), so checking for zero is sufficient but in some cases (e.g. channel type) the spec mentions a minimum and maximum length. This is now also reflected in the code. Tweaked-by: nhofmeyr Change-Id: I78bc887f68d1963d28c6fcd631ac20ccd893d6d6
* gsm0808: add function gsm0808_speech_codec_from_chan_type()Philipp Maier2017-06-222-0/+55
| | | | | | | | | | | | | | | | The contents of the speech codec element (struct gsm0808_speech_codec), that is also used in the speech codec list element (struct gsm0808_speech_codec_list) can be generated directly from the permitted speech parameter in the channel type field (struct gsm0808_channel_type) when full AoIP with compressed speech via RTP/UDP/IP is assumed and when the codec configuration on the air interface exactly matches the codec configuration on the IP backhaul. This patch adds a function that can be used as a helper to fill out spech codec fields by only giving a permitted speech parameter as input. Change-Id: I257c972e9fdf0dfe940a8d483447085bd62e50a2
* gsm0808: add function gsm0808_chan_type_to_speech_code()Philipp Maier2017-06-222-0/+38
| | | | | | | | | | | | The permitted speech field used in channel type element (struct gsm0808_channel_type) uses a different representation as the type field in the speech codec element (struct gsm0808_speech_codec) This patch adds a function to convert from permitted speech to speech codec type. Change-Id: Ib26a9c20864459b2baaa04f49b6e7902ba44b7cb
* gsm0808: fix AoIP speech codec element parser/generatorPhilipp Maier2017-06-221-18/+82
| | | | | | | | | | The implementation of the parser/generator for the speech codec information element slightly wrong, making it impossible to use it properly. (See also: 3GPP TS 48.008, 3.2.2.103) Change-Id: Idabb0f9620659557672e1c6b90c75481192e5c89
* gsm/gsm48.c: drop useless assignmentVadim Yanitskiy2017-06-131-1/+0
| | | | Change-Id: I96c1ba70e332199a4ca95e827a7562f953975af4
* update/extend doxygen documentationHarald Welte2017-06-1230-98/+663
| | | | | | | | | It's a pity that even with this patch we still are fare away from having the whole API documented. However, at least we have a more solid foundation. Updates not only extend the documentation, but also make sure it is rendered properly in the doxygen HTML. Change-Id: I1344bd1a6869fb00de7c1899a8db93bba9bafce3
* Update doxygen main page for libosmo{core,gsm,vty}Harald Welte2017-06-121-0/+13
| | | | | | | We should link to project homepage as well as put the library into the wider Osmocom context. Change-Id: I07ca57ecef0f36c87c9ebacc1e1507c217bdb25b
* Add header file with definitions for GSM TS 04.14 / 3GPP TS 44.014Harald Welte2017-06-123-1/+23
| | | | Change-Id: I1f4fc2761b55a4f83544c1c3793ab67fec9fc120
* Distinguish between unsupported and invalid MCSMax2017-05-241-53/+54
| | | | | | | | | | | | | | | | | | Previously MCS0 was incorrectly set for some of type1 header values while according to 3GPP TS 44.060 it can only be set for type3. Fix this: * use EGPRS_MCS* constants instead of magic values * do not set MCS0 for reserved bits values in EGPRS header type1 * return different error codes for invalid and unsupported MCS as well as for other decoding errors Note: there's no need to adjust tests because MCS0 decoding is not supported but it's better to explicitly distinguish between unsupported and invalid values nevertheless. Change-Id: Id665d5c0cf50efa18b1bcbf4f17359418a380f9e Related: OS#1524
* add libpseudotalloc as super-simplistic talloc replacementHarald Welte2017-05-171-0/+4
| | | | | | | | | | | In tightly embedded builds (--enable-embedded), we want the ability to replace talloc with a very simple heap allocator to avoid the complexity of talloc without modifying all our code that assumes talloc. This will break the hierarchical notion of the allocator, but libosmo{core,gsm,coding,codec} don't rely on that anyway. Change-Id: Ie341034076f242a813f081919dd09d845775ad35
* gsm/gsm0411_smr.c: strip unused variableVadim Yanitskiy2017-05-171-2/+1
| | | | Change-Id: I53f69913907588c45a9661c4e86e1bfb57a2418f
* gsm0808 + ipa: fix compilation on systems without sys/socket.hHarald Welte2017-05-152-3/+15
| | | | Change-Id: I60f5d4982cd96ab29f9924ec11b46bf56fbfc346
* use osmo_{htonl,htons,ntohl,ntohs}() functions all over libosmocoreHarald Welte2017-05-157-25/+22
| | | | | | This gets us one step closer to fixing the embedded build Change-Id: I3fc2639b6ade9ab138766987eceab7ec9498fdc7
* Make EARFCN size calculation more robustMax2017-05-142-6/+22
| | | | | | | | | | | | | * add osmo_earfcn_bit_size_ext() function which allows to specify how many EARFCNs we should skip when estimating required bit size for SI2quater * make old osmo_earfcn_bit_size() into wrapper over newly added function and mark it as deprecated This is necessary to properly estimate necessary space for EARFCNs when they are spread over several SI2q messages with different index. Change-Id: I92e12e91605bdab9916a3f665705287572434f74 Related: RT#8792
* gsm_04_08: Add missing GSM cause valueDaniel Willmann2017-05-121-0/+3
| | | | | | | | | | | | Table 10.5.157 in 10.5.6.6 of 3GPP TS 04.08 is badly formatted. The first value 0x19 "LLC or SNDCP failure" is in the same line as the heading and has not been included in the struct_value so far. Table 10.5.157 in 10.5.6.6 of 3GPP TS 24.008 fixes this formatting issue and also defines two more values 0x08 and 0x18 which are now added to the struct value_string. Change-Id: I5bcc52f739ff0677011d024448afcc2a54869638
* doc: fix incorrect return value descriptionMax2017-05-101-1/+1
| | | | | Change-Id: Ieba009273f911bc4217122a6346220aeb29e8bc4 Related: OS#1614