aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm_rlcmac.cpp
AgeCommit message (Collapse)AuthorFilesLines
2020-03-30Move gsm_rlcmac.cpp -> .cPau Espin Pedrol1-5920/+0
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-26gsm_rlcmac.cpp: Avoid declaring variable in for loopPau Espin Pedrol1-4/+6
That's only allowed under C++. Change-Id: I0da8849a0fb7f9a7ee5e726edea87e91dc411ea8
2020-03-26gsm_rlcmac: Use 'struct bitvec' instead of 'bitvec'Pau Espin Pedrol1-12/+12
The later is only accepted when compiling as c++. Change-Id: Ib5004643d4eff3bc9d11b66ddaf262f1c0d2aef6
2020-03-25rlcmac: Rename field to MS RA Cap2 in Additional_MS_Rad_Access_Cap_tPau Espin Pedrol1-1/+1
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-23rlcmac: Introduce MS Radio Access Capabilities 2 to fix related spare bitsPau Espin Pedrol1-7/+10
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 Pedrol1-121/+84
Change-Id: I6a6e79d7e12cd5e8e969bf0eaa30ddac6b0aa7d3
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-11rlcmac: fix encode_gsm_*(): do not suppress encoding errorsVadim Yanitskiy1-9/+12
Change-Id: Ieec8e6e0823c6f6985f9d343af6d503b8fe9e6ab
2020-03-07gsm_rlcmac: improve dissection of MS RA Capability IEVincent Helfre1-0/+34
Port from wireshark.git de028e81c53f9c45ccc5adb3bffd2f16ae2017bf This commit breaks transcoding of the test vectors containing the MS RA Capability IE due to the reasons explained in [1]. The more fields we add, the longer gets the output of the CSN.1 encoder. This is not critical, since we never need to encode messages containing the MS RA Capability IE on practice. [1] Ibb4cbd3f5865415fd547e95fc24ff31df1aed4c0 Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: Ibb4cbd3f5865415fd547e95fc24ff31df1aed4c0
2020-03-02gsm_rlcmac: fix Packet_Resource_Request_t: s/Slot/I_LEVEL_TN/Pau Espin Pedrol1-1/+1
This is how this field is named in Wireshark. Change-Id: I140443c48af8e4bb1b6279e6de986879b7d9c276
2020-03-02tests/rlcmac: also verify encoding of MS RA CapabilityVadim Yanitskiy1-0/+24
The main idea of this change is to demonstrate a weakness of the CSN.1 codec that most likely causes a unit test breakage in [1]. The problem seems to be that the transitional structures, where the CSN.1 decoder stores the results, do not contain any details about presence of the optional fields (such as M_UINT_OR_NULL). In other words, it's impossible to know whether some optional field is omitted in the encoded message (NULL), or is it just set to 0. This means that the encoder will always include all optional fields, even if they're not present in the original message. [1] Ibb4cbd3f5865415fd547e95fc24ff31df1aed4c0 Change-Id: Ic46d6e56768f516203d27d8e7a5adb77afdf32b7
2020-02-18gsm_rlcmac: fix misleading LOGP statement in decode_gsm_ra_cap()Vadim Yanitskiy1-1/+1
Change-Id: I48fd701566e1364ce7fccaa3e3a1a0296b932988
2020-02-17csn1: get rid of C++ specific code, compile with GCCVadim Yanitskiy1-83/+83
The implementation of CSN.1 codec was taken from Wireshark, where it's implemented in pure C. For some reason it was mixed with C++ specific features, mostly using references in parameter declaration. Not sure what are the benefits. Change-Id: I56d8b7fbd2f9f4e0bdd6b09d0366fe7eb7aa327a
2020-02-15gsm_rlcmac.cpp: fix global-buffer-overflow error reported by ASANPascal Quantin1-1/+4
Port from wireshark.git f751918476bdde65f2289b86245a3c30dace6730. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: I70d4ff3e137b5fd13d367bd4ea6ab501e81e7a87
2020-02-14gsm_rlcmac.cpp: fix another global-buffer-overflow error reported by ASANPascal Quantin1-1/+4
Port from wireshark.git aa3bbe5aebdc180172e7956719b26199e4784fcc. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: I808ec66011cdfe8e1193298f7fb7e92d25b45be4
2020-02-14gsm_rlcmac: Update : PACKET RESOURCE REQUEST to Release 14.0.0AndersBroman1-0/+150
Port from wireshark.git 07fc801684ebff7aff02505cdb2c120caea846e0. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: Iceb59c58406180bc57fe6eb27127b4d11a0a3df7
2020-02-08Fix trailing newline mess with LOGP(C) in rlcmac/csn1Pau Espin Pedrol1-0/+36
Output was incorrect before this patch. LOPC was being called without having any initial LOGP, and trailing newline was usually missing at the end. Since csnDecoder/encoder functions are recursive, it's difficult to handle logging state in a coherent way inside them. Let's better simply control start/end of logging related topics in the callers of those functions, and simply use LOGPC everywhere in csn1.cpp. Change-Id: I50da7560939fac360b7545e2a6bfaf45ed0c4832
2020-02-05rlcmac: Transform a few LOGPC messages to LOGPPau Espin Pedrol1-7/+7
Those messages are self contained and don't need LOGPC. Change-Id: Iea79e030563cd29bfc9750ff5c3e398c590a7307
2020-02-05rlcmac: Return error code from csn1 encoder/decoderPau Espin Pedrol1-94/+139
Change-Id: I0c5e1b870608b0622b239791effd5c5878e230bc
2020-01-28gsm_rlcmac: add dissection of NAS containerVincent Helfre1-5/+11
Port from wireshark.git 575e4df4aa3392ffd09ca372859573f09f0a5c57 Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: I2a05a057b6f441364502a96f9f34872c7e251a36
2020-01-28gsm_rlcmac.cpp: fix an out of bounds accessPascal Quantin1-1/+1
Port from wireshark.git a4a5adb68b898f770e2addf9168d796979ebe237. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: I23fb2199fc8f9cc3e5bd475e2558ee8d482df1e1
2020-01-28gsm_rlcmac.cpp: Do not skip too many lines of the CSN_DESCR when the field ↵Pascal Quantin1-2/+2
is missing Port from wireshark.git c4ead251da7199cfd746d378c51eb8c30d09a6ba. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: Ib9b8eafd69d3b45b0d631ba9635689807b472b73
2020-01-28gsm_rlcmac.cpp: hanged all M_BIT macros to M_UINT, as M_BIT does not use the ↵Anders Broman1-61/+61
referenced hf. Port from wireshark.git e97273a35d101516decbc7d98fcc6c6b3f193962. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: Id20d31e9ebd851b45d5f3280f3e229d8d7ae2cea
2020-01-28gsm_rlcmac.cpp: Fix trailing whitespacePau Espin Pedrol1-12/+12
Change-Id: I3b50cf386d417ba73b97f48b3000f69d9a54c8c9
2020-01-28gsm_rlcmac: Enhance dissection of PSI1Pascal Quantin1-27/+33
Port of wireshark.git 7e9411fee3a101b53693210f7a38789fd4c70ba2. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: I89d488c1f349c556e40a9d13895b1309d5140212
2020-01-28csn1: Allow CHOICE elements to re-process the bits used for the choicePau Espin Pedrol1-42/+42
This is a port of wireshark.git commit 2f024256bf337400ef3a82fa75e6d48d5707e059. From 78516187d821b8d19d16987b1d6bc855ee7cbe10 Mon Sep 17 00:00:00 2001 From: Sylvain Munaut <tnt@246tNt.com> Date: Sat, 4 Feb 2012 10:00:22 +0100 Subject: [PATCH 4/6] packet-csn1: Allow CHOICE elements to re-process the bits used for the choice We may want to display more detail, or the sub-element should be displayed with its headers or whatever ... Change-Id: I3a5a95d5f918b8f17a2400a6d0c4d855ecacea7e
2020-01-28csn1: Update M_NULL CSN_DESCR to match wiresharkAnders Broman1-2/+2
Port from iwireshark.git commit cc6d4341e65ef2e8d8488fe0ac0f236ece0dd844. It looks like it makes no difference to us now, but other EGPRS messages may use it in the future. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: I34039370c292e62790a38abb59f55c69fffa88e8
2020-01-28tests/rlcmac: Add test to showcase that decode_gsm_ra_cap() failsPau Espin Pedrol1-2/+2
Currently code using that function in osmo-pcu is disabled, allegadly because SGSN was sending incorrect values, but it looks more like a CSN1 issue. Related: OS#1525, OS#3499 Change-Id: I92c86397f988afaa791871d823a45fa85054f3bb
2019-07-17fix spelling errors detected by lintianThorsten Alteholz1-2/+2
Change-Id: I381618eb55cc513cfa9c2e384c27cead0935c8bf
2017-05-15remove pcu own bitvector implementationAlexander Couzens1-62/+62
The osmocore bitvec is exact the same, but use a pointer instead of a reference. Change-Id: Id8f797631d89aa12b6e48efb2dc153a3e2f059f7
2016-02-08rlc: Add decode_gsm_ra_cap to decode Radio Access CapsJacob Erlbeck1-0/+8
This uses the CSN.1 decoder to fully parse the radio access capabilities as defined by TS 24.008, 10.5.5.12a. Sponsored-by: On-Waves ehf
2013-12-30Fix warnings in gsm_rlcmac.cppIvan Kluchnikov1-0/+3
1. ar.direction variable was not initialized 2. overrunning array "data->RLC_DATA" of 20 bytes at byte offset 22 using index "i" (which evaluates to 22)
2012-10-10Ported fixes and improvements from Wireshark for RLC/MAC control block ↵Ivan Kluchnikov1-57/+135
decoding. Part 1. Generic improvements to the csn.1 dissector include: • Added a flag to the type descriptor structure so that any type can (potentially) flagged as xxx_OR_NULL. This was specifically needed for UINT_OR_NULL for the ms capabilities struct. • Changed the CSN_SERIALIZE so that the length of the length field can be specified. • For CSN_NEXT_EXIST removed the requirement that the next type be CSN_END, to allow truncation of multiple IEs. • For CSN_LEFT_ALIGNED_VAR_BITMAP corrected the handling of bit_offset. • Added a new type CSN_PADDING_BITS to make inspection of padding bits more convenient. • Improved the CSN_RECURSIVE_TARRAY_1 to show the array index. Improvements to the gsm_rlcmac dissector include: • Rework the definition of EGPRS Ack/Nack Description so that the length IE (and absence thereof) is handled correctly. • Added Padding Bits definitions to all PDUs • Change the Multislot_capability_t and Content_t definitions to allow truncation at any IE
2012-06-15Removed all size_t variables. Fixed type of readIndex and writeIndex variables.Ivan Kluchnikov1-9/+9
We use unsigned int type for readIndex and writeIndex parameters in bitvec_read_field() and bitvec_write_field() functions.
2012-06-14move everything to src/ subdirectoryHarald Welte1-0/+5430
The code corresponds to commit a9aa4777cc1144897a77dfb6c5c3d7325705251e in openbts-p2.8.git (Tue Jun 12 18:14:49 2012 +0400)