AgeCommit message (Collapse)AuthorFilesLines
2020-05-15contrib: integrate RPM specosmith/rpmOliver Smith1-5/+7
Remove OpenSUSE bug report link, set version to 0.0.0, make it build with CentOS 8 etc. Related: OS#4550 Change-Id: Idfe04c2e2609763387d1309f059c390b8e7ae938
2020-05-14contrib: import RPM specOliver Smith1-0/+82
Copy the RPM spec file from: https://build.opensuse.org/project/show/home:mnhauke:osmocom:nightly Related: OS#4550 Change-Id: I4da70814357a326842de52b33934819d3ea133d8
2020-05-12Expect ms object to exist before calling tbf_alloc_dl_tbf()Pau Espin Pedrol8-221/+223
Same as previous commit, this time for the DL counterpart. Change-Id: I87f6cdf8288a688466020bda0874e68b57aa71c4
2020-05-12Expect ms object to exist before calling tbf_alloc_ul_tbf()Pau Espin Pedrol8-103/+105
It's really non-sense from architectural point of view to pass an optional pointer to the MS holding the TBF and creating it otherwise. TBFs shouldn't be creating MS they belong too. This simple change requiring so many code line changes really exhibits how badly entangled the object relationship is. Another commit will follow doing the same for dl tbf. Change-Id: I010aa5877902816ae246e09ad5ad87946f96855c
2020-05-11fix egprs_mslot_class_from_ra(): multislot class may not be presentVadim Yanitskiy1-1/+2
For more details, see 3GPP TS 44.060, table 11.2.5a.2. Change-Id: Iba0466b29afd26cff317ed4fb6749f8a3079f16a Signed-off-by: Vadim Yanitskiy <axilirator@gmail.com> Related: OS#1548
2020-05-09Use OSMO_FD_* instead of deprecated BSC_FD_*Pau Espin Pedrol5-12/+12
New define is available since libosmocore 1.1.0, and we already require 1.3.0, so no need to update dependenices. Let's change it to avoid people re-using old BSC_FD_* symbols when copy-pasting somewhere else. Change-Id: Ida8fd3bd7347163567acde34ad67aefee913b0ea
2020-05-08bts: Return uint8_t in egprs_mslot_class_from_ra()Pau Espin Pedrol1-2/+2
MultislotClass is 5 bit long, so an uint8_t is enough. In most places we are already storing multislot class as uint8_t. Change-Id: I1dcaff9d69379453a0b794e5f36b820f5f78531f
2020-05-08bts: Fix Decoding EGPRS MultislotClass from 11-bit EGPRS PACKET CHANNEL REQUESTPau Espin Pedrol1-1/+1
In osmo-pcu datatructures, the variables holding multislot classes simply contain an integer referring to the multislot class number, instead of coding from 3GPP TS 44.060 Table and Table 11.2.5a.3. So coding Multislot class 3 is stored as 0x03 in osmo-pcu variables, while in 3GPP TS 44.060 coding it's coded as 0x02 (N-1). This allows us using value 0x00 to designate a "yet unknown (EGPRS) Multislot class". Hence, we need to add 1 to the decoded value to match our data structures. Change-Id: Id3b121272bb7e84c0542ae9b4ce09598c6054edd
2020-05-08bts: Rename mslot_class_from_raPau Espin Pedrol1-5/+13
This function is actually returning an EGPRS multislot class, so let's update naming. The variable using the return value was already being passed as egprs_ms_class to tbf_alloc_ul_tbf(). Change-Id: Idb51836c8c9dd4e865bf2cb0b0c24155662f2ae8
2020-05-08tbf: Avoid crash: don't set TBF window size if setup failedPau Espin Pedrol1-3/+3
Should fix assertion triggered due to the tbf not set up properly beforehand. Fixes: OS#4524 Change-Id: I267b147520ef5a50f40ad4bc19e7b5fb3e708127
2020-04-29pdch: Avoid sending GSMTAP_CHANNEL_UNKOWN for rejected UL EGPRS data blockPau Espin Pedrol1-3/+3
Even if we don't accept it, let's submit GSMTAP with correct channel. We don't return error like in code below, because otherwise the generic UNKNOWN gsmtap message will be sent. Change-Id: I853679ce8907d46fcb84ae4127335c10623f09c9
2020-04-29pcu_l1_if: Don't use GSMTAP_CHANNEL_PACCH when sending unknown gsmtap blocksPau Espin Pedrol1-1/+1
It's actually counter-productive when analyzing wireshark traces, since one may not spot a decoding issue and assume PACCH is sent on the wrong TS. Change-Id: I7a96148f1ca1ebfa88a3ff714ea3bb8798866046
2020-04-20TBF/UL: fix rcv_data_block_acknowledged(): print the actual TLLIVadim Yanitskiy2-3/+3
Change-Id: I71b5c656d4b318d11bd5fe2b5d163c3a06e09a6a
2020-04-20sba: fix possible memleak in SBAController::alloc()Vadim Yanitskiy1-3/+3
Change-Id: I417eda155cd5b1e46dd0b05db3f507abd79121d1
2020-04-17TODO: remove those that have obviously been implemented 5+ years agoHarald Welte1-8/+0
The TODO file hasn't seen any updates sicne 2014, while the code has evolved. I'm not sure about some of the topics, but at least several can for sure be removed by now Change-Id: I56581c9b2a08edb1b6d4dc53ad9eb6fdd1800a0d
2020-04-11configure.ac: fix libtool issue with clang and sanitizerEric1-0/+5
As pointed out at https://github.com/libexpat/libexpat/issues/312 libtool does not play nice with clang sanitizer builds at all. For those builds LD shoud be set to clang too (and LDFLAGS needs the sanitizer flags as well), because the clang compiler driver knows how linking to the sanitizer libs works, but then at a later stage libtool fails to actually produce the shared libraries and the build fails. This is fixed by this patch. Addtionally LD_LIBRARY_PATH has no effect on conftest runs during configure time, so the rpath needs to be set to the asan library path to ensure the configure run does not fail due to a missing asan library, i.e.: SANS='-fsanitize=memory -fsanitize-recover=all -shared-libsan' export CC=clang-10 ASANPATH=$(dirname `$CC -print-file-name=libclang_rt.asan-x86_64.so`) export LDFLAGS="-Wl,-rpath,$ASANPATH $SANS $LDFLAGS" Change-Id: I999adf84a34c03765ce6c32ece0e61d0ac6e1c13
2020-04-02l1if: fix pcu_rx_rach_ind(): use proper format string specifiersVadim Yanitskiy1-1/+1
Change-Id: If95362ef4cc203a60856d6b47d95d441813a5c19
2020-03-30csn1: Remove code block from CSN_NEXT_EXIST_LHPau Espin Pedrol1-6/+0
It was removed in wireshark.git e8407dd6c1378427daee77e8de540d0b5f7a0b73 and it's not there anymore in current master. Change-Id: I73f4eeca3fd4f00a5bc4f06ef7a9bb9b8a70e37b
2020-03-30csn1: Properly verify CSN_BITMAP lengthPau Espin Pedrol1-4/+16
Change-Id: I9f7672b534f9345caff99095504749eebad25adb
2020-03-30csn1: verify enough bits present to decode whole CSN_UINT_ARRAYPau Espin Pedrol1-4/+4
Change-Id: I4a762a8fec4153b53e10df1ec8ba3708c1f47649
2020-03-30csn1: Fix Several typos & whitespacePau Espin Pedrol1-4/+3
Change-Id: Ibe31d52d4a5a4015196d73681082f68b99a80c77
2020-03-30rlcmac: add dissection of 2G->3G/4G PS handoverPau Espin Pedrol2-1/+13
Port from wireshark.git 428ee66ae1c524b49f9043729b1f1e9b4f52f409, from Pascal Quantin. The original commit is also changing the RRC_Container field to M_CALLBACK, but we leave them as M_VAR_ARRAY since the callback is basically used to add more dissection information in wireshark. Change-Id: I0f374e78300efddff00c4df26a401adcdee18a12
2020-03-30rlcmac: support decode FDD_CELL_INFORMATION of "UTRAN FDD DescriptionPau Espin Pedrol3-7/+247
Port of patch (+ later fixes squashed) of wireshark.git commit dea5452b95dfaf18e38670a8e2b3b38f9175fdfd, from Lei Chen: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6856 Squashed wireshark.git fix commits: 774be29de0b4d93d01aecb1518c41d7d551071a9 51c31cd7bd3d8fc196a9f90a8af466ad84e9e6a8 6aca10831f86c562970b13efa811f46e25ee3091 c1ceac58cdb77051e9bd14c1f6f7669cf5779a86 Change-Id: I08523bc1bbdffde479ef974b4c7b56cfa5639591
2020-03-30Move gsm_rlcmac.cpp -> .cPau Espin Pedrol13-36/+62
Original file from wireshark.git (packet-gsm_csn1.c) is being built and maintained as a C file. There's no real need for us to maintain it as a C++, and doing so will make both files derive over time (as already happened). Let's keep it as a C compiler (which btw seems to be more strict) to make it easier to port patches back and forth wireshark.git. Take the chance to move some declarations we added to csn1.h to be able to build it out of wireshark. Let's keep those in a separate header file to ease looking for differences. Change-Id: I818a8ae947f002d35142f9f5473454cfd80e1830
2020-03-30gsm_rlcmac: Disable unused CSN1 descriptorsPau Espin Pedrol1-6/+130
When switching to C compiler, it will warn/error. Use #if 0 as in the original wireshark.git epan/dissectors/packet-gsm_rlcmac.c code. Change-Id: If1be50947c02208f15892d99edeb394fb4f52b75
2020-03-29fix: properly include pure C headers from C++ codeVadim Yanitskiy2-0/+5
Header files included from libosmocore may potentially contain some language constructions allowed in C but not in C++, such as type casting. Let's add 'extern "C" { ... }' and be safe. Change-Id: I7197f7b34f30b49d5397506ce9d67cbf0e2cc196
2020-03-27tbf.cpp: Include c++ <new> header required for new operator's replacement typePau Espin Pedrol2-0/+4
Including the <new> header is required as explained by the c++ specs [1] osmo-pcu/src/tbf.cpp: In function ‘gprs_rlcmac_ul_tbf* tbf_alloc_ul_tbf(gprs_rlcmac_bts*, GprsMs*, int8_t, uint8_t, uint8_t, bool)’: osmo-pcu/src/tbf.cpp:1002:39: error: no matching function for call to ‘operator new(sizetype, gprs_rlcmac_ul_tbf*&)’ 1002 | new (tbf) gprs_rlcmac_ul_tbf(bts->bts); | ^ Most of the times this issue is not detected because other STL headers are already including <new>. [1] http://www.cplusplus.com/reference/new/operator%20new/ Change-Id: Ie5fb536ae29dcf40e2a0dbe67432bebd61b8c7aa
2020-03-27pdch: cosmetic: use GSM_MI_TYPE_* constants from libosmocoreVadim Yanitskiy1-1/+1
Change-Id: I1d85c8eded68bc8aa8e90c33b36d335fa775ded2
2020-03-27pdch: fix packet_paging_request(): properly print paging MIVadim Yanitskiy1-5/+4
This problem problem was discovered by the Undefined Behavior Sanitizer: pdch.cpp:210:4: runtime error: load of misaligned address 0x60c00002abf2 for type 'uint32_t', which requires 4 byte alignment Do not convert TMSI to number, use osmo_mi_name() from libosmocore. Also use this function to print other MI types (IMSI or IMEISV). Change-Id: Icf8836f216793e342b239c8e6645aac1e82bf324
2020-03-27BSSGP: fix: properly encode P-TMSI in RR Paging RequestVadim Yanitskiy1-17/+36
The TMSI/P-TMSI IE in BSSGP PAGING-PS/CS comes without the MI type header, that must be present in RR Paging Request. Prepend it. TTCN-3 test case: I7fbec5b2c5c3943a7413417b623f55c135c152d7 Change-Id: I97fd5ffc15a4a58112d7c37c69b7ac42b0741a0e
2020-03-27BSSGP: cosmetic use OSMO_IMSI_BUF_SIZE from libosmocoreVadim Yanitskiy1-1/+1
Change-Id: I2079118100a3422e9c2ee63a5ac74e3ee81080b3
2020-03-26Don't check ul_control_block before decoding into it.Keith1-1/+1
This patch corrects an error introduced in 6fd8ffb6fe62586a6880780678cbee3d9f97e763 That commit allowed us to send the data over GSMTAP even if the Uplink Control Block had invalid content, that is to say, if decode_gsm_rlcmac_uplink() returned error. However the check for ul_control_block->u.MESSAGE_TYPE was place before decode_gsm_rlcmac_uplink() Change-Id: Ic47602e5c6a13571b92c0a939fc3514110b82444
2020-03-26csn1.h: Fix trailing whitespacePau Espin Pedrol1-34/+34
Change-Id: If17d36378fabeb7d22a513b93b0ecfde899df520
2020-03-26gsm_rlcmac.cpp: Avoid declaring variable in for loopPau Espin Pedrol1-4/+6
That's only allowed under C++. Change-Id: I0da8849a0fb7f9a7ee5e726edea87e91dc411ea8
2020-03-26cosmetic: Do not indent header includes inside extern C blockPau Espin Pedrol2-11/+11
Change-Id: I3091d917a13e45b3aef8e52a53dcafa308581652
2020-03-26gsm_rlcmac: Use 'struct bitvec' instead of 'bitvec'Pau Espin Pedrol3-20/+20
The later is only accepted when compiling as c++. Change-Id: Ib5004643d4eff3bc9d11b66ddaf262f1c0d2aef6
2020-03-26pcu_l1_if.cpp: Add missing header ctype.hPau Espin Pedrol1-0/+1
The file uses the isdigit() function. Change-Id: Id06ea25969ad9b964b3207479604132d25160f24
2020-03-25rlcmac: Rename field to MS RA Cap2 in Additional_MS_Rad_Access_Cap_tPau Espin Pedrol2-2/+2
This fix was spotted by wireshark.git developers while reviewing port of osmo-pcu commit e50ce6e45c4509805807d599cadf1a1b23d37f63. Related: https://code.wireshark.org/review/c/36574/ Fixes: e50ce6e45c4509805807d599cadf1a1b23d37f63 Change-Id: Ic5fc3252f61b6a042d9c3def7a6a32b311dd9d9e
2020-03-25cosmetic: rlcmac: Fix comment typo and whitespace introduced recentlyPau Espin Pedrol1-1/+2
Change-Id: Ie56898e11e2c9426393af0f6558d340c454fe6c4
2020-03-23rlcmac: Introduce MS Radio Access Capabilities 2 to fix related spare bitsPau Espin Pedrol6-58/+57
There's two variants for the Ms Radio Access Capabilities. * The usual encoding with spare bits (usually to fill up to octet boundary) as defined in TS 24.008 Table 10.5.146 And there's too: * MS Radio Access Capabilities 2 IE from TS44.060 section 12.30, which is the same but removing all spare bits, and which is used in messages like Packet Resource Request and Additional MS RAC messages. The later is used basically for messages having extra IEs after the MS Radio Access capabilities IE, since they are encoded immediatelly afterwards. So this patch does: * Adds the expected spare bits (M_PADDING) to MS_Radio_Access_capability_t * Creates a new MS_Radio_Access_capability2_t without padding * Updates code to use the new "2" version where needed. Note RLCMACTest long de/encoding line logs change only because the name of the struct changes (the "2" is added). Change-Id: Ibd756f80a03452a651e2771dbc628d701e55ac4b
2020-03-23rlcmac: Log names of de/encoded rlcmac packet typesPau Espin Pedrol2-157/+120
Change-Id: I6a6e79d7e12cd5e8e969bf0eaa30ddac6b0aa7d3
2020-03-23rlcmac: Fix bug receiving RA capPau Espin Pedrol4-20/+16
It seems the assumptions regarding maximum number of RA capabilitites in one message were wrong. Doing some rough calculations, each RA capabilitiy value (without extensions) can take around 20ish bits, which means for a message containing up to 52 bytes that quite a lot of different values could be theoretically fed in. Let's be safe and increase the array size to be able to handle all different access technologies listed in See TS 24.008 table 10.5.146 following restrictions: * "The MS Radio Access capability is a type 4 information element, with a maximum length of 52 octets." * "Among the three Access Type Technologies GSM 900-P, GSM 900-E and GSM 900-R only one shall be present." * "the mobile station should provide the relevant radio access capability for either GSM 1800 band OR GSM 1900 band, not both". Wireshark requires similar fix (it's not important though because it currently uses another ad-hoc decoder for RAcap). Related: OS#4463 Change-Id: I5334eaacfbc238fae8bea50c9e9667c2117f81ff
2020-03-23csn1: Validate recursive array max size during decodingPau Espin Pedrol5-5/+163
This way if CSN1 encoded bitstream contains more elements than what the defintion expects it will fail instead of overflowing the decoded buffer. RA cap struct placed in unit test is taken from a real android phone sending the value when attaching to the network. Then SGSN sends it back and osmo-pcu would crash similar to unit test: *** stack smashing detected ***: terminated Process terminating with default action of signal 6 (SIGABRT): dumping core at 0x4C62CE5: raise (in /usr/lib/libc-2.31.so) by 0x4C4C856: abort (in /usr/lib/libc-2.31.so) by 0x4CA62AF: __libc_message (in /usr/lib/libc-2.31.so) by 0x4D36069: __fortify_fail (in /usr/lib/libc-2.31.so) by 0x4D36033: __stack_chk_fail (in /usr/lib/libc-2.31.so) by 0x124706: testRAcap2(void*) (RLCMACTest.cpp:468) Related: OS#4463 Change-Id: I9fe0e55e0a6a41ae2cc885fba490c1d4a186231e
2020-03-23rlcmac: Don't pass array element to CSN1 descriptorsPau Espin Pedrol1-12/+11
This way the macros can be used to access the arrays themselves and calculate its static size to enable validation later. In the case of Packet_Access_Reject_t, modify the description to use a M_REC_TARRAY_1 object to get rid of access to 2nd element. The new description is the correct one, since the first element is mandatory according to TS 44.060 Table 11.2.1. Change-Id: I6f10350d4734360c7a15a702c72b59efd84987ee
2020-03-21tests/RLCMACTest: Several fixes and improvements to RAcap testsPau Espin Pedrol3-40/+91
It was recently discovered that the Racap value used for testRAcap was actually malformed (it was taken from a TTCN3 test). It had the presence bit for "EGPRS multislot class" set but no struct was put after it. So let's move that malformed value to a new test named testMalformedRAcap(). Since it doesn't make sense trying to re-encode or do similar things with an initially malformed value, let's drop all those parts in this new test. For the old testRAcap() test, use a new bitstream this time with the "EGPRS multoslot class" struct set inside (class 3). Change-Id: I1e7f8d8866695732ee24a79d8b54d660fd4f22d5
2020-03-20tests/RLCMACTest: free allocated bitvectorsPau Espin Pedrol1-0/+3
Change-Id: I6d1e93cb1a07a7bf05483dbc877105a86a17829b
2020-03-19csn1.c: Almost all of the logging is DEBUG, not NOTICEHarald Welte2-107/+107
low-level text decodes of CSN.1 messages certainly are not NOTICEable events, but rather something used for debugging. Right now we get various text CSN.1 log output of osmo-pcu in it's default configuration. Despite all log levels being relatively high (NOTICE), we still see those messages as they simply are logged at the wrong level. Related: OS#2577 Change-Id: I7b42c9e21ad8d8a5b54e7a3b68490934ce3d3198
2020-03-18Use downlink BSSGP RA Cap IEPau Espin Pedrol1-6/+1
This commit is basically a revert of f4bb42459ca4f3e18f9ee3d3a27389b85c7692e8, which disabled the code. That commit claimed the SGSN may have providen inacurate or wrong data at the time, but then it should be fixed in the SGSN. Related: OS#1525, OS#3499 Change-Id: Ie36ae23203110018d4b5ae47591e0a64989e23a0
2020-03-16Use clock_gettime(CLOCK_MONOTONIC) and timespec everywherePau Espin Pedrol12-122/+130
We should really be using monotonic clock in all places that gettimeofday is used right now. Since clock_gettime() uses timespec, let's move all code to use timespecs instead to avoid having to convert in several places between timespec and timeval. Actually use osmo_clock_gettime() shim everywhere to be able to control the time everywhere from unit tests. Change-Id: Ie265d70f8ffa7dbf7efbef6030505d9fcb5dc338
2020-03-11csn1: fix: do not return 0 if no bits left in the bufferVadim Yanitskiy3-6/+7
Both csnStreamDecoder() and csnStreamEncoder() shall not return 0 prematurely if no more bits left in the input / output bit-vector. Returning CSN_ERROR_NEED_MORE_BITS_TO_UNPACK might make more sense, however we don't know in advance (i.e. without entering the loop) whether it's an error or not. Some CSN.1 definitions have names like 'M_*_OR_NULL', what basically means that they're optional and can be ignored or omitted. Most of the case statements do check whether the number of remaining bits is enough to unpack / pack a value, so let's leave it up to the current CSN_* handler (pointed by pDescr) if no bits left. Return CSN_ERROR_NEED_MORE_BITS_TO_UNPACK only if the number of remaining bits is negative as this is an error in any case. Change-Id: Ie3a15e210624599e39b1e70c8d34efc10c552f6c