summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add osmo_timerfd_* functions for osmo_fd-wrapped timerfdHarald Welte2018-05-103-1/+74
| | | | | | | | | | | | | | | 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-083-0/+117
| | | | | | | | | | | | | | | | | 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
* define a constant for the max length of called party BCD IEStefan Sperling2018-05-071-0/+1
| | | | | | | | | | | | According to TS 24.008 10.5.4.7 the called party BSC number IE has a maximum length of 43 octets. This length is assumed inside osmo-hlr with a magic number: uint8_t msisdn_enc[43]; /* TODO use constant; TS 24.008 10.5.4.7 */ This change makes libosmocore provide a constant which osmo-hlr can use. Change-Id: Ia0bf6ceadcac38a8c75d166402b54058e5c6c6d4
* 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-043-6/+8
| | | | | | | | | | 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-042-22/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0310-16/+333
| | | | | | | Remark: For libosmogb and libosmogsm, LIBVERSION was already bumped in c4fce1425e19d604c199c895e227dc2519110456. Change-Id: Ib4fa53a9bb9954ae48d0a610ba9a81dd8e8b4ef6
* debian/changelog: Fix typo in maintainer e-mailPau Espin Pedrol2018-05-031-4/+4
| | | | Change-Id: I74bef283090fd7601491c9fef9637f845853d032
* debian: libosmoctrl: Use correct library version in pkg namePau Espin Pedrol2018-05-032-3/+3
| | | | | | | | | | | | The number used in debian packaging is actually current-age, which is still 0 in this case after it was bumped a while ago. As a result, we had a libosmoctrl1_*.deb package installing a libosmoctrl.so.0 file. Fixes: OS#3175 Change-Id: I771f6c68570bc3b2bab68e1165c7284fd43e904d
* osmo-release.sh: Allow user to add extra information to the release commitPau Espin Pedrol2018-05-031-0/+1
| | | | Change-Id: Ie25d921dd27fb7653bd616cb2912330964108663
* osmo-release.sh: Always generate entire commit changelogPau Espin Pedrol2018-05-032-19/+13
| | | | | | | | | | | | | | | | | | | | | | | | Before this commit, for library projects (containing LIBVERSION in some Makefile), the entire commit list was not stored into the changelog, but only a few lines from TODO-RELEASE files. This is a bad approach for several reasons. First, because that file was only aimed at containing API/ABI breaks, and not the full relevant changeset (like bugfixes, new features, etc.). Second, because it relies on every developer making API/ABI changes to remember to store the change in there during commit break time. Let's instead always store the entire commit list in changelog, and let's use TODO-RELEASE only as a list of hints for the maintainer to help him evaluate how LIBVERSION needs to be bumped for each library. Other tools such as osmo-abi-check.git can be used to help with the process of decission too. Let's take the opportunity too to only commit stuff already added to the staging area, as it proved easier to manage from my personal experinece making latest releases. Change-Id: Ibf662173ce2b4ff3966e9ad5f56c65dfb13607ff
* osmo-release.sh: Fix error condition no LIBVERSION modifiedPau Espin Pedrol2018-05-021-5/+2
| | | | | | | | | It turns out git status doesn't return an error code in any of the modified/unmodified cases. It's not clear anyway why we check TODO-RELEASE when we actually care about the file containing the LIBVERSION (non-)change. Change-Id: I2320d6ee29cd528e55c0609be1af350655123b85
* osmo-release.sh: Exit with error if no description for new changelog entry ↵Pau Espin Pedrol2018-05-021-0/+5
| | | | | | | | | | provided If no line is provided, then the xargs line doesn't call dch (due to -r param) and as a result no new version entry is created in the log, and the old one is updated. Change-Id: I17894f669e6d3d6d31203a4522dce7fa01da323f
* osmo-release.sh: Remove temporary file TODO-RELEASE.entries after usePau Espin Pedrol2018-05-021-0/+1
| | | | Change-Id: I1cac39093d43910c2f5b969f5287cf3678110f4e
* 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
* gsm0808_test: silence deprecation: use gsm0808_create_layer3_2()Neels Hofmeyr2018-04-231-1/+11
| | | | Change-Id: Ia0afecafa8862ffbe2af3c86e5552673f0935eb0
* gsm0808_test: fix more missing inits (address sanitizer issues)Neels Hofmeyr2018-04-231-59/+52
| | | | | | | | | | | | | In recent Iaa20c59f624fbdc69a018cabd0f7e9c5a1389519 I fixed one missing init issue and didn't notice the N other similar ones right next to it. Also fix the remaining missing inits. Fixes: ../../../../src/libosmocore/src/gsm/gsm0808_utils.c:187:8: runtime error: load of value 13, which is not a valid value for type '_Bool' ../../../../src/libosmocore/src/gsm/gsm0808_utils.c:191:8: runtime error: load of value 119, which is not a valid value for type '_Bool' Related: OS#3148 Change-Id: Ie8a1a9b3132024135ca70390eae4d21c907b2edc
* gsm_08_58.h: introduce RSL_IE_ERIC_PAGING_GROUPAlexander Couzens2018-04-231-0/+1
| | | | | | | | Ericsson supports a RSL command to page and immediate assign as single command. For paging a MS the BTS must know the paging group. Change-Id: I9194500e307ad69f8da07510bc965a7a5cd82a2a
* gsm_08_58.h: Add Ericsson vendor-specific RSL message typesPau Espin Pedrol2018-04-211-0/+5
| | | | | | | We are alredy doing the same way for ip.access and siemens ones, and this way we avoid using the hardcoded value in osmo-bsc. Change-Id: I7cb65f3ff1cfdbe4eee97b7545bcd13a38c72e25
* RSL/LAPDm: Not all RLL message are "transparent"Harald Welte2018-04-192-4/+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-186-98/+216
| | | | | | | | | | | | | | | | | | | | 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
* tlv: add TLV_GET() and TLV_GET_MINLEN()Neels Hofmeyr2018-04-181-0/+21
| | | | | | | | | | | | | | | | | | | | Rationale: so far we use code like if (TLVP_PRESENT(&tp, VERY_LONG_ENUM_VALUE_NAME_THAT_NEVER_ENDS)) { val = TLVP_VAL(&tp, VERY_LONG_ENUM_VALUE_NAME_THAT_NEVER_ENDS); len = TLVP_LEN(&tp, VERY_L0NG_ENUM_VALUE_NAME_TH4T_NEVER_EMDS); } This is a) very long and b) prone to picking the wrong name one of the three times, which would use the wrong length or val without necessarily being noticed. A safer and shorter, more readable pattern is: struct tlv_p_entry *e = TVLP_GET(&tp, VERY_LONG_ENUM_VALUE_NAME_THAT_NEVER_ENDS); if (!e) return -ENOENT; hexdump(e->val, e->len); Change-Id: I445de17fc2daa3ab051f5708dd0cc185b23dc048
* 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-172-2/+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
* test_gsm0808_enc_dec_speech_codec_with_cfg: initialize properlyNeels Hofmeyr2018-04-151-7/+7
| | | | | | | | | | | | | | The uninitialized members of enc_sc sporadically hit address sanitizer failure during gsm0808_test, like: ../../../../src/libosmocore/src/gsm/gsm0808_utils.c:187:8: runtime error: load of value 13, which is not a valid value for type '_Bool' ../../../../src/libosmocore/src/gsm/gsm0808_utils.c:191:8: runtime error: load of value 119, which is not a valid value for type '_Bool' How the test survived so long is a mystery to me; as soon as some uninitialized members would by coincidence not be zero, the test should always have failed at OSMO_ASSERT(memcmp(&enc_sc, &dec_sc, sizeof(enc_sc)) == 0). Related: OS#3148 Change-Id: Iaa20c59f624fbdc69a018cabd0f7e9c5a1389519
* test_gsm0808_enc_dec_cell_id_list_lac(): populate all LACsNeels Hofmeyr2018-04-132-4/+4
| | | | Change-Id: I7535166a2827c03a954fe72d5d99217e4f25868f
* test_gsm0808_enc_dec_cell_id_list_lac(): validate encoded bytesNeels Hofmeyr2018-04-132-8/+9
| | | | Change-Id: I81b1ffbe6a5ec566c112492c2cbaf99c018c45bb
* add gsm0808_{enc,dec}_cell_idNeels Hofmeyr2018-04-135-12/+280
| | | | | | | | | | | | | | | | | | | 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-134-24/+83
| | | | | | | | | | | | | | | 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-135-0/+361
| | | | | | | | | | | | | 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-133-0/+31
| | | | | | | This will be used by cell idenitifier list code, like upcoming neighbor_ident VTY in osmo-bsc and regression tests. Change-Id: Iebc5cdf61b697b1603900993fc265af3eca0cedf
* msgb: msgb_pull: Abort when pulling more than avail sizePau Espin Pedrol2018-04-111-0/+3
| | | | Change-Id: I512ff2035ae7a929e6c96df82938cc1ddbcc4e2a
* msgb: msgb_get: Drop unneeded tmp varPau Espin Pedrol2018-04-111-2/+1
| | | | Change-Id: I27bb2ab59408c9cd1363b3b5acb2263128c55732
* avoid warning in gsm0808_create_layer3Neels Hofmeyr2018-04-101-1/+11
| | | | Change-Id: Ie098af4fc9640240196eda10fd61edcb3a872455
* deprecate PLMN de-/coding functions incapable of 3-digit MNC with leading zerosNeels Hofmeyr2018-04-102-7/+12
| | | | | | | | | All our projects have seen patches to move to 3-digit MNC handling. Furthermore, since our builds no longer break from deprecation warnings, I shall no longer refrain from deprecating old API. Change-Id: I55dfaf7ce74870de44120b26c42d45bb7b184341
* fix issue on big endian architectureThorsten Alteholz2018-04-091-1/+1
| | | | | | | | | | OSMO_IS_LITTLE_ENDIAN is always defined and has a value of either 0 or 1 as a result in byteswap.h the corresponding swap functions will be always called, independent of the endianess Signed-off-by: Thorsten Alteholz <osmocom@alteholz.de> Change-Id: I4a09d2d8ccf155e70a3977ae1747758b6bc5125e
* add gsm48_reject_value_namesNeels Hofmeyr2018-04-093-0/+38
| | | | | | | | | | | | | | 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-094-22/+97
| | | | | | | | | | | | | | | | 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-092-4/+5
| | | | | | | | | 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-093-19/+4
| | | | | | | | | | 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
* fsm_test: more thoroughly test FSM inst ids and namesNeels Hofmeyr2018-04-092-7/+138
| | | | | | | | | | | | | | | | | | Place id and name testing in its separate section, test_id_api(). Add a test that actually allocates an FSM instance with a NULL id, which is allowed, but uncovers a bug of an unset FSM instance name. osmo_fsm_inst_name() falls back to the fsm struct's name on NULL, but osmo_fsm_inst_find_by_name() fails to match if the instance's name is NULL (and until recently even crashed). Show this in fsm_test.c with loud comments. Add test to clear the id by passing NULL. Add test for setting an empty id. Add test for setting an invalid identifier (osmo_identifier_valid() == false). Change-Id: I646ed918576ce196c395dc5f42a1507c52ace2c5
* osmo_fsm_inst_find_by_name(): guard against strcmp(NULL)Neels Hofmeyr2018-04-091-0/+5
|