summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* fix spellingThorsten Alteholz2018-05-151-2/+2
| | | | Change-Id: I3ac92217f83279d5f987ab34eb18b2e6cb1c7812
* fsm: guard action callbackPhilipp Maier2018-05-151-1/+3
| | | | | | | | | | | The FSM allows to set individual action callback functions for each state but it does not allow to leave the action callback pointer unpopulated. However, there are cornercases where having no callback function is desirable. - Check if action callback is popolated before executing it. Change-Id: I36d221c973d3890721ef1d376fb9be82c4311378
* isdnhdlc: Port from kernel to userspaceHarald Welte2018-05-112-61/+49
| | | | | | | | | | | * prefix all symbols/constants with osmo_ * use stdint.h types instead of kernel types * use Doxygen API documentation * use Osmocom CRC16-CCITT functions * use Osmocom bit-reversal functions * integrate with Automake Change-Id: I109085ab3e412c20b19cd42fb7137aa0e4167542
* import isdn4linux HDLC code from linux kernelHarald Welte2018-05-111-0/+630
| | | | | | | I've been importing from 94d7dbf108813ea45a91e27e9a8bd231d5a23fa7 but the isdnhdlc code hasn't seen any changes since 2012 anyway. Change-Id: I3c58f9cb6921c2fdd0f2fcb11f622a0be88c7c63
* Add osmo_timerfd_* functions for osmo_fd-wrapped timerfdHarald Welte2018-05-101-0/+66
| | | | | | | | | | | | | | | Linux offers file descriptor based periodic (interval) timers, which can achieve a higher precision than our userspace based timers and which can be slave'd to CLOCK_MONOTINIC or other clock sources. Let's add some code for osmo_fd wrapped versions that integrate well with our select() abstraction. The code has been used in osmo-bts-trx since June 2017 (change-id I51b19adde14ebb7ef3bb863d45e06243c323e22e), and I'm just renaming and moving it to libosmocore here. After a merge, the osmo-bts implementations can be removed in favor if this one. Change-Id: Ibeffba7c997252c003723bcd5d14122c4ded2fe7
* 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
* configure: Check separately for lib implementing dlopen and dlsymPau Espin Pedrol2018-05-041-1/+1
| | | | | | | | | | Sometimes the library probiding dlopen is not the same one providing dlsym. This is the case when compiling with AddressSanitizer enabled. In this case, AC_SEARCH_LIBS([dlopen]...) reports no lib is required, but tests using dlsym still require to link against -ldl. Change-Id: Ic619b0885688066b60c97caf1e2c7e5402c1d9f7
* control_if: Avoid heap-use-after-free in osmo_wqueue_bfd_cbPau Espin Pedrol2018-05-041-19/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Imagine following scenario: 1- client connects to CTRL iface, a new conn is created with POLL_READ enabled. 2- A non-related event happens which triggers a TRAP to be sent. As a result, the wqueue for the conn has now enabled POLL_WRITE, and message will be sent next time we go through osmo_main_select(). 3- At the same time, we receive the GET cmd from the CTRL client, which means POLL_READ event will be also triggered next time we call osmo_main_select(). 4- osmo_main_select triggers osmo_wqueue_bfd_cb with both READ/WRITE flags set. 5- The read_cb of wqueue is executed first. The handler closes the CTRL conn for some reason, freeing the osmo_fd struct and returns. 6- osmo_qeueue_bfd_cb keeps using the already freed osmo_fd and calls write_cb. So in step 6 we get a heap-use-after-free catched by AddressSanitizer: 20180424135406115 DLCTRL <0018> control_if.c:506 accept()ed new CTRL connection from (r=10.42.42.1:53910<->l=10.42.42.7:4249) 20180424135406116 DLCTRL <0018> control_cmd.c:378 Command: GET bts.0.oml-connection-state 20180424135406117 DLINP <0013> bts_ipaccess_nanobts.c:417 Identified BTS 1/0/0 20180424135406118 DNM <0005> abis_nm.c:1628 Get Attr (bts=0) 20180424135406118 DNM <0005> abis_nm.c:1628 Get Attr (bts=0) 20180424135406118 DCTRL <000e> osmo_bsc_ctrl.c:158 BTS connection (re)established, sending TRAP. 20180424135406119 DLCTRL <0018> control_if.c:173 close()d CTRL connection (r=10.42.42.1:53910<->l=10.42.42.7:4249) ================================================================= ==12301==ERROR: AddressSanitizer: heap-use-after-free on address 0x611000003e04 at pc 0x7f23091c3a2f bp 0x7ffc0cb73ff0 sp 0x7ffc0cb73fe8 READ of size 4 at 0x611000003e04 thread T0 #0 0x7f23091c3a2e in osmo_wqueue_bfd_cb /home/osmocom-build/jenkins/workspace/osmo-gsm-tester_build-osmo-bsc/libosmocore/src/write_queue.c:65 #1 0x7f23091ad5d8 in osmo_fd_disp_fds /home/osmocom-build/jenkins/workspace/osmo-gsm-tester_build-osmo-bsc/libosmocore/src/select.c:216 #2 0x7f23091ad5d8 in osmo_select_main /home/osmocom-build/jenkins/workspace/osmo-gsm-tester_build-osmo-bsc/libosmocore/src/select.c:256 #3 0x56538bdb7a26 in main /home/osmocom-build/jenkins/workspace/osmo-gsm-tester_build-osmo-bsc/osmo-bsc/src/osmo-bsc/osmo_bsc_main.c:532 #4 0x7f23077532e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #5 0x56538bdb8999 in _start (/home/jenkins/workspace/osmo-gsm-tester_run-prod/trial-896/inst/osmo-bsc/bin/osmo-bsc+0x259999) Fixes: OS#3206 Change-Id: I84d10caaadcfa6bd46ba8756ca89aa0badcfd2e3
* Bump version: 0.10.2.284-bc47-dirty → 0.11.0Pau Espin Pedrol2018-05-036-6/+6
| | | | | | | Remark: For libosmogb and libosmogsm, LIBVERSION was already bumped in c4fce1425e19d604c199c895e227dc2519110456. Change-Id: Ib4fa53a9bb9954ae48d0a610ba9a81dd8e8b4ef6
* 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
* osmo_sockaddr_is_local: Fix memleakPau Espin Pedrol2018-04-181-1/+4
| | | | | | | | | | | | | | | Catched by AddressSanitizer in osmo-bts-trx while running tests in osmo-gsm-tester: ==31738==ERROR: LeakSanitizer: detected memory leaks Direct leak of 5744 byte(s) in 1 object(s) allocated from: #0 0x7ff7ec789ed0 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1ed0) #1 0x7ff7e952697c (/lib/x86_64-linux-gnu/libc.so.6+0x10297c) #2 0x7ff7e95274df in getifaddrs (/lib/x86_64-linux-gnu/libc.so.6+0x1034df) #3 0x7ff7eadcdc8f in osmo_sockaddr_is_local libosmocore/src/socket.c:537 Change-Id: I778d3c1f162abce0595e62670c29c5134bccd28d
* osmo_get_macaddr: Fix buffer read out of boundsPau Espin Pedrol2018-04-181-2/+7
| | | | | | | | | | | | | | | Catched by address sanitizer in osmo-bts-trx during osmo-gsm-tester test run. ==25503==ERROR: AddressSanitizer: global-buffer-overflow on address 0x55b4e8468780 at pc 0x7fd824f543ba bp 0x7fffc21009f0 sp 0x7fffc21009e8 READ of size 16 at 0x55b4e8468780 thread T0 #0 0x7fd824f543b9 in osmo_get_macaddr libosmocore/src/macaddr.c:132 #1 0x55b4e842df33 in abis_open osmo-bts/src/common/abis.c:256 #2 0x55b4e84286c9 in bts_main osmo-bts/src/common/main.c:342 #3 0x7fd8235ab2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #4 0x55b4e838e759 in _start (/home/jenkins/workspace/osmo-gsm-tester_run-prod/trial-807/inst/osmo-bts/bin/osmo-bts-trx+0xfc759) Change-Id: I3727ef339279c8eeb85908735467bfd0e02ca259
* 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
* cosmetic: log: fix typo, clarify msg for rate_ctr name manglingNeels Hofmeyr2018-04-161-2/+3
| | | | Change-Id: I9a04d501698f8a3360ef9dcbf04b57c5ac10e63b
* 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
* add osmo_fsm_inst_update_id_f()Neels Hofmeyr2018-04-091-22/+45
| | | | | | | | | | | | | | | | In the osmo-msc, I would like to set the subscr conn FSM identifier by a string format, to include the type of Complete Layer 3 that is taking place. I could each time talloc a string and free it again. This API is more convenient. From osmo_fsm_inst_update_id(), call osmo_fsm_inst_update_id_f() with "%s" (or pass NULL). Put the name updating into separate static update_name() function to clarify. Adjust the error message for erratic ID: don't say "allocate", it might be from an update. Adjust test expectation. Change-Id: I76743a7642f2449fd33350691ac8ebbf4400371d
* cosmetic: osmo_fsm_inst_update_id(): don't log "allocate"Neels Hofmeyr2018-04-091-2/+3
| | | | | | | | | On erratic id in osmo_fsm_inst_update_id(), don't say "Attempting to allocate FSM instance". Escape the invalid id using osmo_quote_str(). Change-Id: I770fc460de21faa42b403f694e853e8da01c4bef
* fsm: id: properly set name in case of NULL idNeels Hofmeyr2018-04-091-5/+3
| | | | | | | | | | Since alloc relies on osmo_fsm_inst_update_id() to set the name, never skip that. In osmo_fsm_inst_alloc(), we allow passing a NULL id, and in osmo_fsm_inst_update_id(), we set the name without id if id is NULL. Change-Id: I6d6b09a811b82770818f19b189a57d9fc4a8133b
* osmo_fsm_inst_find_by_name(): guard against strcmp(NULL)Neels Hofmeyr2018-04-091-0/+5
| | | | | | | | | | | | | | | | | | strcmp() *must not* be passed NULL pointers, or we hit: ../../../src/libosmocore/src/fsm.c:123:8: runtime error: null pointer passed as argument 2, which is declared to never be null ASAN:DEADLYSIGNAL (Or, alternatively, a segfault.) If any of the search string or an FSM instance's name string should be NULL, simply never match. Technically, an FSM should never have a NULL name, but a current bug actually allows this (pass NULL id to alloc), which will be addressed by an upcoming patch. To test for it, we need to first make sure this here doesn't segfault. Change-Id: I2e5f82c06d1a4727bd93e955366e3b62b2df1b32
* add osmo_quote_str(),osmo_quote_str_buf() and testNeels Hofmeyr2018-04-091-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | Rationale: with osmo_escape_str(), you get the escaped contents of the string, but not so graceful handling of NULL strings. The caller needs to quote it, and for NULL strings not quote it. osmo_quote_str() is like osmo_escape_str() but always quotes a non-NULL string, and for a NULL string returns a literal NULL, i.e. it should (tm) give the exact C representation of a string. That's useful in testing, to show exactly what char* situation we have, without jumping through hoops like if (str) printf("\"%s\"", osmo_escape_str(str, -1)); else printf("NULL"); Copy the unit test for osmo_escape_str() and adjust. To indicate that the double quotes are returned by osmo_quote_str(), use single quotes in the test printf()s. I considered allowing to pick the quoting characters by further arguments, but that complicates things: we'd need to escape the quoting characters. Just hardcode double quotes like C. Change-Id: I6f1b3709b32c23fc52f70ad9ecc9439c62b02a12
* fix spellingThorsten Alteholz2018-04-083-3/+3
| | | | | | | fix for some spelling issues found by lintian Signed-off-by: Thorsten Alteholz <osmocom@alteholz.de> Change-Id: I69976ecae6939d9ff51bfe4ce7374890c6563b82
* socket.c: osmo_sock_init: Several logic fixes and log improvementsPau Espin Pedrol2018-04-051-8/+16
| | | | | | See explanations in previous commit. Change-Id: I4889e777d8627fdfb52c97ab3ab353b6ed34aab2
* socket.c: osmo_sock_init2: connect: Several logic fixes and log improvementsPau Espin Pedrol2018-04-051-8/+17
| | | | | | See explanations in previous commits. Change-Id: Ib2f7577b9f498ae9d388ed1f79f6ca0ec6f09664
* socket.c: osmo_sock_init2: bind: Several logic fixes and log improvementsPau Espin Pedrol2018-04-051-7/+19
| | | | | | | | | | | | | | | | | | | | | | | After investigating osmo-msc showing this log message and looking at the code, it's a bit difficult to find out what's going on in the code: socket.c:224 unable to bind socket: (null):0: Protocol not supported The root cause was not yet found, but probably SCTP is not enabled in the kernel of the host running it. The cod eis most probably failing during socket() and not due to bind error as the log says, so let's print an error if socket() fails. Then, if setsockopt fails, we want to still keep trying in case an extra addr was offered by addrinfo_helper. It is definetly wrong to continue if setsockopt fails, because then we are skipping the bind(), which is a fundamental part of what osmo_sock_init2 does. Then, let's print the bind error when it really happens, and re-write the extra log at the end if we reach the point at which no suitable addr is found. Change-Id: I1854422ad92dadf33ed4d849e15c0380c3bf1626
* cosmetic: flatten ctrl_handle_msg()Neels Hofmeyr2018-04-051-17/+19
| | | | Change-Id: I3a711f5c974b7f56e27b333d390d1a706fb57007
* ctrl: fix deferred commands (and hence fix osmo-bts-sysmo 'clock-info' cmd)Neels Hofmeyr2018-04-052-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CTRL interface has a ctrl_cmd_def_* API that allows deferring a CTRL command reply until later. However, the command handling currently fails to acknowledge this and deallocates the struct ctrl_cmd anyway. Fix: in struct ctrl_cmd, add a defer pointer to be populated by ctrl_cmd_def_make(). A cmd thus marked as deferred is not deallocated at the end of command handling. This fix needs no change in calling code. (Another idea was to return a different code than CTRL_CMD_HANDLED when the command is to be deferred, but that would require adjusting each user of ctrl_cmd_def_make(). The implicit marking is safer and easier.) Show that handling deferred commands is fixed by adjusting the expectations of ctrl_test.c's test_deferred_cmd() and removing the now obsolete exit_early label. One symptom of the breakage is that osmo-bts-sysmo crashes when asked to report a trx's clock-info, which is aggravated by the fact that the sysmobts-mgr does ask osmo-bts-sysmo for a clock-info. The crash appears since Id583b413f8b8bd16e5cf92a8a9e8663903646381 -- it looked like just fixing an obvious memory leak, which it did as shown by the unit test, but deferred ctrl commands actually relied on that leak. Both fixed now. Related: OS#3120 Change-Id: I24232be7dcf7be79f4def91ddc8b8f8005b56318
* 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 logging talloc ctx: add osmo_init_logging2()Neels Hofmeyr2018-03-281-1/+6
| | | | | | | | | | | | | | | Deprecate osmo_init_logging() for the benefit of adding an explicit talloc context argument to new function osmo_init_logging2(). Pass a ctx to log_init() instead of hardcoded NULL. Before now, *all* of our code uses a NULL ctx for logging, which amounts to talloc "leaks" hit by address sanitizer builds on newer gcc (e.g. gcc 7.3.0 on debian 9). This commit helps fixing "leaks" detected in e.g. osmo-bsc unit tests by a sanitize build with gcc (Debian 7.3.0-12) 7.3.0. Change-Id: I216837780e9405fdaec8059c63d10699c695b360
* vty/command.c: write_config_file(): sanely compose temp pathNeels Hofmeyr2018-03-281-1/+11
| | | | | | | | | | | | | | | Fix GCC version 7.3.0 (Debian 7.3.0-12) compiler warning: ../../../../src/libosmocore/src/vty/command.c: In function ‘write_config_file’: ../../../../src/libosmocore/src/vty/command.c:2741:2: error: null destination pointer [-Werror=format-overflow=] sprintf(config_file_tmp, "%s.XXXXXX", config_file); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Check agains NULL after each _talloc_zero() in write_config_file(). While at it, add a comment explaining why we don't use talloc_asprintf() instead. Change-Id: I7bdc52afe724c1d21f419fe49a6e2ebca9420969
* VTY: Don't welcome the user to the "control" interface, if it's VTYHarald Welte2018-03-271