summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Support cipher mode reject with extended causeMax2018-11-193-0/+42
| | | | | | | | | | | | | * add function to generate cipher mode reject with extended (2-byte) Cause IE * add function to get (extended) Cause value * add corresponding (extended cause) test * update existing (non-extended cause) test * use enum as a parameter for existing non-extended version to make interface more unified Change-Id: Id5509b94a18180a44f45300caaa02b843c166fa3 Related: OS#3187
* Move msgb_push helpers to public headerMax2018-11-191-39/+10
| | | | | | | | | | The msgb_wrap_with_TL() is generally useful so it make sense to make it public to facilitate code re-use. Other helpers can be implemented as trivial wrappers over existing tlv.h functions. Update headers and code accordingly. Change-Id: I37e91d031fba28cf1c6735b8069b0265746f55e6
* gsm48: gsm48_decode_freq_list: Improve documentation of paramter fPau Espin Pedrol2018-11-181-1/+1
| | | | Change-Id: Id8e3afff737211ded3c5689f2c83b1a544b42f9d
* Update GSM0808_LCLS enumsMax2018-11-181-0/+3
| | | | | | | | Add values indicating that LCLS control/config/status value has not been received yet. Change-Id: I52dc6a52f5ee043ed2c1625ffecfd495e3c746b1 Related: OS#2487
* Update 3GPP TS 08.08 Cause handlingMax2018-11-182-6/+25
| | | | | | | | | | | | * add Class definitions * add helper to check for extended bit * add helper to get Cause's Class * use enum in gsm0808_cause_name() and gsm0808_create_cipher_reject() to avoid confusion between class and cause * update gsm0808_create_cipher_reject() comments Change-Id: I31b31dfc22eb4b6b07089e1255246ac458125340 Related: OS#3187
* fsm: fix apidoc of osmo_fsm_state_name()Philipp Maier2018-11-161-1/+1
| | | | | | | The api documentation of osmo_fsm_state_name() refers to an FSM instance, but it really means the state of an FSM. Change-Id: I88ddd6048426d380c49170e66f57b3843398c046
* gsm29118: add value strings for SGSAP IEIPhilipp Maier2018-11-162-0/+36
| | | | | | | | The value strings for the SGSAP IEI are missing, lets add a set of value strings and a function to retrieve them. Change-Id: I2787303174f74ffba86675bce2c12f680d8ea708 Related: OS#3615
* socket.c: fix IP and port buffer sizesOliver Smith2018-11-061-4/+4
| | | | | | | | Use INET6_ADDRSTRLEN (46) instead of 64 for IP address buffers, and 6 instead of 16 for port buffers (the highest possible port number is 65535). Change-Id: Ia25e2f3277ad2f60df31c08d12f42c1e6d2a14a6
* gsm48: correct apidoc for gsm48_generate_mid()Philipp Maier2018-11-021-0/+1
| | | | | | | The API documentation lacks the the description for the last parameter, lets add a description for it. Change-Id: Ibcd25d3a7ddd7075eb15daff6dba42236d14d945
* Update cipher reject functionMax2018-11-021-0/+1
| | | | | | | | * add note about (yet) unsupported standard feature * use enum constant instead of hex value Change-Id: I5cc5fc1ae8d5474dbc8d3385a493adf6420a3c98 Related: OS#3187
* gsm0808: cosmetic: rename parameter "reason" to "cause"Philipp Maier2018-10-301-3/+3
| | | | | | | | | The function that generates the clear command takes a parameter "reason", which is the cause code. Lets give it the name "cause" to have a coherent naming scheme that matches the other functions and the 3gpp specs. Change-Id: I7b6c15e8fa8db13deef5041095944ca1c58fb99f
* gsm0808: fix doxygen apidocPhilipp Maier2018-10-301-1/+1
| | | | | | | | The api documentation names a parametery by a different name than it is listed in the parameter list of the function. Lets make the apidoc coherent. Change-Id: Id21ed1e920fb64522a734f206efbe2871ec05b06
* make 'show rate-counters' show group indexStefan Sperling2018-10-291-1/+1
| | | | | | | | | | | | | | Show each rate counter group's index in the output of the 'show rate-counters' command, to provide some way of telling apart distinct instances of the same rate counter group. This is not a very user-friendly UI because these indices are generated internally by libosmocore and/or applications, so users cannot easily assign meaning to these indices. However, the current rate counter implementation doesn't allow for more. Change-Id: Ieb151239407e4b2f8859fefec8d0670f5ddf908a Related: OS#3674
* stop printing group description in vty_out_rate_ctr_group_fmt()Stefan Sperling2018-10-292-3/+1
| | | | | | | | | | | | | | When vty_out_rate_ctr_group_fmt() prints the description of a counter group, it assumes this description should appear at the beginning of a line. However, the caller might be printing counters in an indented context. So just let the caller worry about printing the group title if necessary (there is currently only one known caller, which is updated in this commit). Note that printing of the group title was an undocumented feature. Change-Id: I2c55cb54e8b7a7c8c6cf72f22287083767ed0201 Related: OS#2660
* gsm23003: Add MME domain name related helper functionsHarald Welte2018-10-282-0/+92
| | | | | | | osmo_gen_mme_group_domain(), osmo_gen_mme_group_domain() and osmo_gen_home_network_domain() Change-Id: Ia882d9db05ec0037e593aeebea21bc31adb680bb
* add osmo_sock_get_{local,remote}_ip{,_port}()Oliver Smith2018-10-261-25/+86
| | | | | | | | | | Return only the IP or port of either the local or remote connection, not the whole set of IP and port of both the local and remote connection like osmo_sock_get_name() does it. This is needed for OS#2841, where we only want to print the remote IP. Related: OS#2841 Change-Id: I6803c204771c59a2002bc6a0e6b79c83c35f87e1
* cosmetic: fix typo (soocket -> socket)Oliver Smith2018-10-251-1/+1
| | | | Change-Id: I2184bf12398902d933f3744bc094418cc6961e86
* stats_statsd: Send all stat_items as gaugesDaniel Willmann2018-10-241-11/+8
| | | | | | | | | | | | | When sending a statsd metric we need to specify a type which can be a "g"auge, "c"ounter, "t"imer, "h"istogram, and "m"eter. We used to just pass the stat_item unit into this field, but that is the unit of the metric (Seconds for a timer, % for utilization, ...). Change the type field so stat_items are sent as "g"auges. Note that negative values don't seem to be supported by statsd. Change-Id: Ia16270d36c9a14521594de4b99a48c83e4ac07d4
* vty: adjust telnet logMax2018-10-241-1/+1
| | | | | | | Adjust wording so telnet command can be directly copy-pasted from the log to access the interface without the need for further editing. Change-Id: I1876447f9285adcd1b09937a6121afabd0b32e52
* libosmogsm/gsup.c: fix error code in osmo_gsup_encode()Vadim Yanitskiy2018-10-211-1/+1
| | | | | | | Missing (unset) type of to be encoded message is not a memory allocation failure (-ENOMEM), this is definitely a mistake. Change-Id: Ibbac18e2b68b765c17c2bc959c4c085037953a7f
* SGsAP protocol definitions (header + C file)Harald Welte2018-10-213-1/+134
| | | | Change-Id: Idddfc9b851eb4c2fa7dd661a9ce1b03a04883109
* vty.c: Set vty->fd to -1 after closing the FDHarald Welte2018-10-211-1/+3
| | | | Change-Id: I07d105f4a810dd809fbf6feb5c04e7410020c887
* telnet_interface: avoid double-close of fd()Harald Welte2018-10-211-1/+1
| | | | | Change-Id: Ibd81f29fa22d53553bd73c055d6a1f5255a69bad Fixes: Coverity CID#135238
* timerfd_create(): Fix error handling of osmo_fd_register()Harald Welte2018-10-211-1/+8
| | | | | Change-Id: Ia2528cc3e3155bbc9cb32dee0e3af99cc6e1c654 Closes: Coverity CID#188853
* gsm0808: allow decoding of zero length speech codec lists.Philipp Maier2018-10-161-10/+0
| | | | | | | | | | | | | | | | | | | | | 3GPP_TS_48.008, 3.2.2.103 Speech Codec List states the following: "The length indicator (octet 2) is a binary number indicating the absolute length of the contents after the length indicator. The length depends on the number and type of Speech Codec Elements to be included. The minimum length of one Speech Codec Element is 1 octet and the maximum length is 3 octets. The maximum number of Speech Codec Elements within the Speech Codec List is not defined." This clearly refers only to the length of a single speech codec element but not on the overall list. So speech codec lists with length 0 are indeed permitted by the spec. - Remove the assertion that checks on zero length speech codec lists. Change-Id: I1eb1f4466b98bdd26d765b0e4cc690b5e89e9dd6 Related: OS#3657
* add support for ipaccess messages on the ctrl interfaceStefan Sperling2018-10-151-5/+29
| | | | | | | | | In ctrl_handle_msg(), check for IPACCESS protocol messages and respond to such messages in the same way as ipa_ccm_rcvmsg_base() does. This will allow the TTCN3 IPA "chopped ping" test to pass on control interfaces. Change-Id: I9d7137c830981ccad03806b30b776e2b1f1b4699 Related: OS#2010
* fix error handling gprs_ns_nsip_listen()Stefan Sperling2018-10-101-1/+4
| | | | | | | | | If we cannot bind the listening socket, reset related fields in the osmo fd structure to NULL again. Otherwise our caller might eventually try to use an uninitialized osmo fd. Change-Id: Ia953b2eff54cac0bd980944291f75db14df09a34 Related: OS#3643
* vty logging: fix crash when missing 'logging enable'Neels Hofmeyr2018-10-011-0/+8
| | | | | | | | | | | | | | | We must explicitly check the return value of osmo_log_vty2tgt(), or may run into a segfault. I wasn't aware of this and introduced numerous such cases in I36f17c131cc70ce5a1aef62fd9693097de230cd4. Reproduce: on the VTY, do not issue 'logging enable', invoke 'logging level force-all LEVEL' first. Show in logging_vty_test.vty that this situation is now again amended by telling the user that logging was not enabled. Related: OS#3611 Change-Id: Id11702d1801d6654ca5e5a51b597a0d802e2e8dd
* ensure unix socket paths are NUL-terminated for bind/connectStefan Sperling2018-09-261-7/+5
| | | | | | | | | | | | | | | The unix(7) man page recommends that sun_path is NUL-terminated when struct sockaddr_un is passed to a bind() or connect() call. Non-NUL-terminated paths only need to be dealt with at the receiving end of a UNIX domain socket. Commit 896ff6d erroneously assumed otherwise. This commit almost reverts 896ff6d: It only leaves the added osmo_strlcpy() overflow check in place. Change-Id: I6c4ac6b0a0eef4842beae4107f6f09f6cd29172a Fixes: 896ff6db161465d506bb9bb5bee2cdeef220dd2e Related: OS#2673
* logging_vty: Ensure writing well-formed config filesHarald Welte2018-09-251-9/+9
| | | | | | | We want to have well-formed config files that print exactly one space per VTY/config node level, and not two. Change-Id: Ia75c7067284ea225cffe13ca71bad05a7747ae66
* gsm0808: add function to convert AMR S15-S0 to gsm0408 settingsPhilipp Maier2018-09-252-0/+42
| | | | | | | | Add a function to convert S0-S15 bits to struct gsm48_multi_rate_conf, which hold the codec settings for AMR. Change-Id: I973736273c236eee84decf15868190e339c3fed4 Related: OS#3548
* vty: omit HIDDEN from vty referenceNeels Hofmeyr2018-09-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | During 'show online help', the XML vty node dump, omit all commands marked HIDDEN. These commands were already hidden from the VTY reference prior to commit I1f18e0e41da4772d092d71261b9e489dc1598923, because of broken/confusing bit and boolean logic mixup. After that commit, HIDDEN commands end up in the doc. So practically, this patch here brings back the status quo of before above commit, even though the previous code clearly "intended" to list HIDDEN commands in the reference but failed to have that effect. AFAICT the complete list of commands currently hidden is: * osmo-bsc: bts/"training_sequence_code <0-7>", * osmo-bsc: ts/"phys_chan_config PCHAN" for uppercase pchans; * osmo-bts: bts/"rtp bind-ip A.B.C.D" which actually says vty_out(vty, "%% rtp bind-ip is now deprecated%s", VTY_NEWLINE); * osmo-sgsn: 'reset sgsn state' used for SGSN testing. Note that the osmo-sgsn build was broken by including hidden commands in the vty reference, since one of its hidden commands had missing doc strings and made osmotestconfig.py signal failure. This would fix that from the hide-hidden-commands angle, and so would osmo-sgsn commit I8b6e8615e409266910f2f76a10ced9ab33e4de91 from the fix-the-doc-strings angle. Change-Id: I92c3c66ff69c186234276c64478d6342e061d25e
* vty list: fix deprecation/hidden bit logicNeels Hofmeyr2018-09-241-2/+1
| | | | | | | | | | If a command is both hidden and deprecated, still don't show it for the 'list' command. We currently have no such nodes, as it seems, though. Related: OS#3584 Change-Id: I07ec15cab057a3e09064e0420a69121ee8eb4253
* vty reference: fix deprecation bit evaluationNeels Hofmeyr2018-09-241-2/+2
| | | | | | | | | | | In vty_dump_nodes(), make sure the bitwise & is evaluated first. For the deprecation flag (0x1), the practical effect is most likely identical, assuming that the boolean ! operator flips the first bit, so I expect no visible functional difference. It still was confusing and wrong to look at. Related: OS#3584 Change-Id: I1f18e0e41da4772d092d71261b9e489dc1598923
* gsm0808_utils: constify parameterPhilipp Maier2018-09-211-1/+1
| | | | | | | parameter cfg in gsm0808_sc_cfg_from_gsm48_mr_cfg() is used read only. Lets add a const to make this clear to the compiler. Change-Id: I31e8d273b070b0afc446a298299d4f502d6c396b
* gsm0808: add function to convert amr gsm0408 setings to gsm0808Philipp Maier2018-09-192-0/+44
| | | | | | | | | | | | | | | | Add a function to convert struct gsm48_multi_rate_conf, which holds the codec settings for AMR, to S0-S15 bit representation as defined in 3GPP TS 48.008 3.2.2.49 This resurrects change-id I4e656731b16621736c7a2f4e64d9ce63b1064e98 which was reverted in I9e0d405e303ed86d23703ca6362e958dddb2f861 due to gsm0808_test failing. The test failure is fixed by properly clearing the struct gsm48_multirate_cfg prior to running tests (add memset(0)). Change-Id: Ia782e21c206c15e840226d79b4209d13658ee916 Related: OS#3548
* logging vty: add 'logging level set-all <level>'Neels Hofmeyr2018-09-161-0/+24
| | | | | | | | | Add new command to once-off set each and every category to the given log level, as discussed at length on the openbsc@ mailing list. Show that it works in logging_vty_test.vty. Change-Id: I4c3e4f786476cb813fdc0a7c64f30ee04758309d
* Revert "gsm0808: add function to convert amr gsm0408 setings to gsm0808"Neels Hofmeyr2018-09-162-44/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2fd4fe6aa109c8df50baac465f0393a303a64dd2. As shown in https://jenkins.osmocom.org/jenkins/view/master/job/master-libosmocore/475/a2=default,a3=default,arch=amd64,label=osmocom-master-debian9/console This commit breaks gsm0808_test with: stderr: --- expout 2018-09-16 22:37:31.382280438 +0200 +++ /n/s/dev/make/libosmocore/tests/testsuite.dir/at-groups/21/stdout 2018-09-16 22:37:31.426281372 +0200 @@ -78,9 +78,9 @@ Input: m4_75= 0 smod= 0 m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 + m5_90= 0 icmi= 1 m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 + m7_40= 0 ver= 6 m7_95= 0 m10_2= 0 m12_2= 0 @@ -92,9 +92,9 @@ Input: m4_75= 1 smod= 0 m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 + m5_90= 0 icmi= 1 m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 + m7_40= 0 ver= 6 m7_95= 0 m10_2= 0 m12_2= 0 @@ -106,9 +106,9 @@ Input: m4_75= 0 smod= 0 m5_15= 1 spare= 0 - m5_90= 0 icmi= 0 + m5_90= 0 icmi= 1 [...] Change-Id: I9e0d405e303ed86d23703ca6362e958dddb2f861
* gsm0808: add function to convert amr gsm0408 setings to gsm0808Philipp Maier2018-09-142-0/+44
| | | | | | | | | Add a function to convert struct gsm48_multi_rate_conf, which holds the codec settings for AMR, to S0-S15 bit representation as defined in 3GPP TS 48.008 3.2.2.49 Change-Id: I4e656731b16621736c7a2f4e64d9ce63b1064e98 Related: OS#3548
* logging vty: deprecate 'all', introduce 'force-all'Neels Hofmeyr2018-09-131-20/+57
| | | | | | | | | | | | | | | Add 'logging level force-all <level>' and 'no logging level force-all' as new names for 'logging level all <level>' and 'logging level all everything'. Resurrect the functionality of 'logging level all everything' -- even if it is still deprecated because the name is confusing, it is now just an alias for 'no logging level force-all'. Show in logging_vty_test.vty that we can now again lift the global logging clamp, both with the new commands as well as with the deprecated ones. Also show that 'force-all' is written back properly, if set. Change-Id: I36f17c131cc70ce5a1aef62fd9693097de230cd4
* logging vty: write: check logging levels validityNeels Hofmeyr2018-09-132-8/+24
| | | | Change-Id: If683b1272ad2d5b402b91c52c496aa7975bc6315
* logging vty: deprecate the 'everything' keywordNeels Hofmeyr2018-09-132-13/+22
| | | | | | | | | | | | | | | | The 'logging level all everything' has not had an effect for some time now. The plan is to bring back its old functionality, but to keep it deprecated and rather define a less confusing name. * Deprecate 'everything'. * Do not write 'everything' during 'write file' or 'show running-config', which we curiously still do until now. BTW, the reason why we need to compose a complete list of categories for the deprecated 'everything' command is explained in detail in the commit log for I3b083f27e3d751ccec258880ae7676e9af959a63 Change-Id: Ib75fedb0572570a61bb34ee729a2af86cf5f16da
* logging vty: rewrite 'logging level' vty cmd generationNeels Hofmeyr2018-09-132-167/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Completely drop the implementations of log_vty_command_{str,description}(). These functions have been public API once, marked as deprecated since c65c5b4ea075ef6cef11fff9442ae0b15c1d6af7 (March 2017). I considered to keep them, or reduce them to useless stubs, but it is quite silly, really. These functions are completely and utterly useless outside of libosmocore. Any program linking these deserves to fail. Re-implement vty logging level command gen, in logging_vty.c. logging.c is simply the wrong place for that. Introduce logging_internal.h to share logging definitions to logging_vty.c without publishing as API. Introduce static gen_logging_level_cmd_strs() to compose a list of category arguments with their descriptions for VTY commands. Use osmo_talloc_asprintf() instead of the previous error prone and chaotic strlen() counting method. Do not dynamically generate log level arguments, just keep static strings. We are super unlikely to ever change the log levels we have. No changes in logging_vty_test.vty: proves that there is no functional change. All of this, besides introducing basic sanity, is cosmetic preparation to be able to re-use the generic command generation code for arbitrary commands with category or level args (for deprecated and new keywords). Rationale: I want to hide 'all' and 'everything' from the VTY command documentation, by means of deprecating. I first tried to simply define a deprecated 'logging level CAT everything' command: logging level (all|rsl|rr|...) (debug|info|notice|error|fatal) logging level CAT everything # <- deprecated and hidden But unfortunately, command matching doesn't work as intended when the CAT argument reflects a valid category; I want it to invoke the deprecated function as soon as the 'everything' keyword follows, but it stays stuck to the "valid" command when the category argument matches an explicit keyword in that list, and will throw an error on the following 'everything' keyword. I.e.: logging level rsl everything % Unknown command # <-- leads to config file parse error logging level unknown_string everything % Ignoring deprecated 'everything' # <-- works only for invalid categories So I need to define 'everything' separately, again with a list of each valid category instead of a generic CAT arg. Change-Id: I3b083f27e3d751ccec258880ae7676e9af959a63
* gsm0808: implement BSSMAP Classmark RequestNeels Hofmeyr2018-09-132-0/+14
| | | | | Related: OS#3043 Change-Id: I4a2e1d3923e33912579c4180aa1ff8e8f5abb7e7
* add osmo_str_tolower() and _toupper() with testNeels Hofmeyr2018-09-072-7/+90
| | | | | | | | | | | | | | | | | | | | | | | | | We already have osmo_str2lower() and osmo_str2upper(), but these lack: * proper destination buffer bounds checking, * ability to call directly as printf() argument. Deprecate osmo_str2upper() and osmo_str2lower() because of missing bounds checking. Introduce osmo_str_tolower_buf(), osmo_str_toupper_buf() to provide bounds-safe conversion, also able to safely convert a buffer in-place. Introduce osmo_str_tolower(), osmo_str_toupper() that call the above _buf() equivalents using a static buffer[128] and returning the resulting string directly, convenient for direct printing. Possibly truncated but always safe. Add unit tests to utils_test.c. Replace all libosmocore uses of now deprecated osmo_str2lower(). Naming: the ctype.h API is called tolower() and toupper(), so just prepend 'osmo_str_' and don't separate 'to_lower'. Change-Id: Ib0ee1206b9f31d7ba25c31f8008119ac55440797
* api doc: fix osmo_quote_str_*Neels Hofmeyr2018-09-071-2/+8
| | | | Change-Id: Ibfd8ff213630e34009936b0fcb3ee50dda65fb70
* coding: Always initialize bit counters in gsm0503_pdtch_egprs_decode().Alexander Chemeris2018-09-051-0/+5
| | | | | | | | Previsouly there were a lot of valid code paths which returned from the function before setting bit counters which led to bogus BER output in osmo-bts-trx logs when those code paths were hit. Change-Id: I4722cae3794ccbb12001113c991d9cf345a52a96
* coding: Correctly count bits when decoding EDGE bursts with MCS >= 7.Alexander Chemeris2018-09-051-1/+8
| | | | | | They consist of two blocks, so we should count both blocks. Change-Id: I560de192212dae4705054a1665726369b83d213a
* Add CC_CAUSE value_string arrayKeith2018-09-022-0/+55
| | | | | | | Adds a value_string array for GSM 04.08 Call Control cause values Change-Id: I296f208581ce2550805f9d96e20f7319e1199023
* Properly deal with sockaddr_un socket path length limitations.Stefan Sperling2018-08-291-4/+11
| | | | | | | | | In osmo_sock_unix_init(), add support for non-NUL-terminated unix socket paths and return an error if the supplied socket path exceeds the maximum socket path length supported by the operating system. Change-Id: I19d935e5e3dd7928e6e153c6f5ad7044de726016 Related: OS#2673