path: root/src/gsm
AgeCommit message (Collapse)AuthorFilesLines
2014-03-07gsm/auth: Add the XOR test algorithmsylvain/securitySylvain Munaut2-1/+52
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-03-07lapdm: Implement randomized paddingSylvain Munaut1-4/+37
Specs taken from ETSI TS 144 006 V11.0.0 (2012-10), Section 5.2 The default behavior stays the same, but randomization can be enabled via a flag. The test is also modified to check that stuff is indeed getting randomized. Note that this is only part of a full randomized padding implementation. Some other part should get randomized as well but those aren't implemented here ... (like SI5/6 padding and the empty frames). Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-02-09lapd: Use the right struct for the talloc_zero_array callHolger Hans Peter Freyther1-2/+2
I saw this while playing with talloc pools and wondered why lapd_core is creating a log_info. Use the right struct for the array.
2014-02-08sms: The msg_ref is passed from the outside so remove the wrong fixmeHolger Hans Peter Freyther1-1/+1
2014-01-23lapdm: Fix typo in the commentHolger Hans Peter Freyther1-1/+1
2014-01-13gsm/gsm48ie: Fix range 256 W[i] decoding0.6.5Jacob Erlbeck1-4/+4
Currently w[14]/w[15] and w[18]/w[19] are swapped in range 256 format decoding in gsm48_decode_freq_list(). This patch fixes this. Sponsored-by: On-Waves ehf
2014-01-09sms: Fix gsm_7bit legacy functions return valueJacob Erlbeck1-6/+11
The legacy 7bit conversion functions (those without the '_n_' in the name) gave wrong return values on 64 bit platforms due to unproper signed/unsigned conversions and the usage of SIZE_MAX. This patch fixes this by using a smaller max size (see GSM_7BIT_LEGACY_MAX_BUFFER_SIZE, currently set to 64k) for the legacy wrappers and by using unsigned int for max_septets. In addition, there are tests now that check the return values of legacy encoding and decoding. Sponsored-by: On-Waves ehf
2014-01-02abis: Use the right return value for abis_nm_pchan4chcombHolger Hans Peter Freyther1-1/+1
abis_nm_pchan4chcomb will return a pchan for a given channel combination but returned a value of the channel combination. Fix it to return the physical channel combination. Fixes: Coverity CID 1040767
2013-12-07Refactor COMP128v23 implementation and add test suitMax2-38/+29
2013-11-03implement COMP128 version 2 and 3 A3/A8 algorithmKevin Redon3-5/+240
simple copy into C from reversed code from www.hackingprojects.net
2013-10-15ussd: Fix text of RELEASE COMPLETEAlexander Huemer1-1/+1
Before the assigned value (0xFF) was truncated, reg->text[0] is of type char. A corresponding test for the same value in openbsc could only fail.
2013-09-16gsm48: Added 'Network Daylight Saving Time' info elementJacob Erlbeck1-0/+1
This information element has been added to the MM Information message in GSM24.008. This patch adds it to the tlv_definition to keep the TLV parser from breaking. Ticket: OW#978
2013-09-04sms: Implement encoding the address as alphanumeric typeHolger Hans Peter Freyther1-9/+21
The number of digits is the number of used octets times two (two digits per octet). The result has been successfully dissected by wireshark. It has not been tested with real phones.
2013-08-12sms: Added comment about the gsm_7bit_alphabet tableJacob Erlbeck1-2/+6
The table structure is not intuitive, so this comment shall aid to understand this.
2013-08-12sms: Added result buffer size parameter to 7bit conv funsJacob Erlbeck3-59/+104
The 7bit<->8bit encoding/decoding functions didn't check whether there is still enough space in the destination buffer. Therefore a buffer size parameter has been added to each of the functions which is used to truncate the output if the buffer is too small. In addition, the return value of the decoding functions has been changed to number of characters written (excluding \0), so this value is always equal to strlen(decoded). The old functions are still available as wrapper functions.
2013-08-09lapd: Remove the double NULL check idiom with msgb_freeHolger Hans Peter Freyther1-22/+13
if (ptr) msgb_free(ptr) extends to: if (ptr) talloc_free(ptr) And according to the talloc documentation a talloc_free(NULL) will not crash: "... Likewise, if "ptr" is NULL, then the function will make no modifications and returns -1."
2013-08-09gsm: The LAPDm prim/structs changed, increment current version0.6.3Holger Hans Peter Freyther1-1/+1
2013-08-08Add special 7-bit encoding and decoding functions for USSD codingAndreas Eversberg3-5/+38
Handling 7-bit coding is a little different for USSD, as TS 03.38 states: To avoid the situation where the receiving entity confuses 7 binary zero pad bits as the @ character, the carriage return or <CR> character shall be used for padding in this situation [...]. If <CR> is intended to be the last character and the message (including the wanted <CR>) ends on an octet boundary, then another <CR> must be added together with a padding bit 0. The receiving entity will perform the carriage return function twice, but this will not result in misoperation as the definition of <CR> [...] is identical to the definition of <CR><CR>. The receiving entity shall remove the final <CR> character where the message ends on an octet boundary with <CR> as the last character. Jacob has verified the fix with fakeBTS and the wireshark dissector. Fixes: OW#947 Reviewed-by: Jacob Erlbeck <jerlbeck@sysmocom.de>
2013-08-08encoding: Provide an overload for the gsm_7bit_encode and a simple testHolger Hans Peter Freyther2-2/+9
This is required for encoding the SMS header using the alpha numeric rules. Reviewed-by: Jacob Erlbeck <jerlbeck@sysmocom.de>
2013-07-11gsm0808.c: Add TLV definition for LAYER3_HEADER_INFORMATIONDmitri Soloviev1-0/+1
This is required for osmo-bsc to parse Alcatel S-12 CIPHER MODE COMMAND in osmo-bsc.
2013-07-10LAPD: Free resume/re-establishment msgb if it carries no contentAndreas Eversberg1-2/+5
lapdm.c takes the re-establishment message and forwards it to lapd_core.c, so we can assume that msgb is set at primitive. In case there is data in the re-establishment msg, it is moved into send_buffer. In case of no data (0 length), it must be freed. Fixes an issue spotted by Coverity Scan.
2013-07-07gsm: Revert the gsm_7bit_encode changes as they are wrongHolger Hans Peter Freyther2-30/+9
This reverts commit f996b05dbddccb8e8788dd69777a4fedfa2373eb and 2b0cac4ef83137ee0bdd583aee877eac467abeab. A detailed explanation can be found here: http://lists.osmocom.org/pipermail/openbsc/2013-July/004737.html The short description is that: 1.) The API should return (as out parameter) the number of octets used. 2.) The handling for the <CR> encoding only applies to USSD and it is incomplete. On top of that it broke the SMS test.
2013-07-06Fix: Handle returned length by gsm_7bit_encode correctlyAndreas Eversberg1-9/+24
2013-07-06Fix encoding of last character at 7bit encoding functionAndreas Eversberg1-0/+6
To avoid the situation where the receiving entity confuses 7 binary zero pad bits as the @ character, the carriage return or <CR> character shall be used for padding in this situation.
2013-07-06LAPDm: Allow sending unit data on DCCHAndreas Eversberg1-10/+18
It is used to transfer PHYSICAL INFORMATION message to the MS.
2013-07-06LAPDm: Fix re-establishment of datalinkAndreas Eversberg1-5/+14
If the datalink fails or if handover or assignment to a new channel fails, it is re-establised by sending SABM again. The length of establish message is 0 in this case. The length is used to differentiate between re-establishment and contention resolution, which has to be handled differently. See TS 04.06 Chapter
2013-07-03gsm0408: Avoid unaligned memory access in gsm48_generate_mid_from_tmsiHolger Hans Peter Freyther1-2/+2
The &buf[3] is unlikely to be aligned properly. Use memcpy instead of an assignment. Add a small testcase that verifies that I didn't mess up the conversion. Alignment trap: osmo-nitb (3293) PC=0x492b7094 Instr=0xe5803003 Address=0xbeb259db FSR 0x801
2013-06-29introduce gsm0808_create_reset_ack()Harald Welte1-0/+13
2013-06-18lapd_core: msgb_trim() the L2 padding from ESTABLISH.ind0.6.1Harald Welte1-2/+3
When a SABM(E) frame arrives, we have to trim the L2 padding (0x2b for gsm) before handing the data off to L3, just like we do with I frames. Also, we should use mggb_trim() or even msgb_l3trim() instead of manually fiddling with msgb->length and ->tail pointers.
2013-06-11misc: Fix the spelling of frame in the RLM cause stringsHolger Hans Peter Freyther1-1/+1
2013-05-23gsm_utils: refer to ETSI TS 05.08 instead of TS 08.05Bhaskar1-2/+2
2013-05-08lapd: Set the tx_hist to NULL after freeing itHolger Hans Peter Freyther1-0/+1
Make detecting use after free of the tx_hist easy and set the variable to NULL after talloc_free has been freed.
2013-04-06Fix of potential memory leaks at lapdm.cAndreas Eversberg1-4/+17
2013-04-06Fix: LAPDm contention resoltion must acknowledge subsequent SABMAndreas Eversberg1-2/+8
After reception of SABM, the network responds with UA and enters the establised multiframe state. If UA is not received by mobile, the SABM is transmitted again, and the network must respond with UA again, unless it is from a different mobile. Add LAPDm collision test (contention resolution on network side).
2013-03-13gsm_septets2octets(): Input parameter should be constHarald Welte1-1/+2
2013-03-03cygwin: Link many libraries with -no-undefined to create a dllHolger Hans Peter Freyther1-1/+1
Only the Gb library relies on having undefined references to a symbol that needs to be provided by the host application. For all other libraries we can link with -no-undefined.
2013-02-15misc: Doxygen tweaks: fixed some typos and minor errorsKaterina Barone-Adesi3-4/+5
Doxygen generates quite a lot of warnings on libosmocore. Some of them are obvious typos - this patch aims to fix such low-hanging fruit.
2013-02-10turn abis_nm_debugp_foh() into a macroHarald Welte1-12/+10
this will avoid printing 'abis_nm.c' as the filename in the log, which is pretty useless during debugging. We want to know where abis_nm_debugp_foh() is being used from, not where it is implemented.
2012-12-26lapd: Check in rslms_rx_rll() if lapdm context was initialized earlierDaniel Willmann1-2/+18
This was found while implementing handover on a sysmobts. When we receive a channel release request for a channel that was never really activated (set_lapdm_context() was not called) we segfault in lapd_recv_dlsap(). We now return early with -EINVAL in rslms_rx_rll() if we receive a message that assumes set_lapdm_context() was already called. These are: * RSL_MT_UNIT_DATA_REQ * RSL_MT_DATA_REQ * RSL_MT_SUSP_REQ * RSL_MT_REL_REQ A test case was added to trigger the issue.
2012-12-11build: Don't use the deprecated INCLUDES in the various Makefile.amSylvain Munaut1-2/+1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-11gsm: Add method to find ARFCN based on frequencySylvain Munaut2-45/+66
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-06sms: Print 'network' or 'mobile' when creating the SMC/SMRHolger Hans Peter Freyther2-3/+4
2012-12-06gsm/a5: Return -ENOTSUP if the selected cipher is not supportedSylvain Munaut1-2/+6
Extracted from a patch by Max Suraev Max.Suraev@fairwaves.ru> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-11-26lapd: Use LOGL_ERROR for messgaes that are wrong in the given contextHolger Hans Peter Freyther1-14/+14
Log message that are either too big or have the C/R bit set as error.
2012-11-22misc: Use static const struct for LAPD and AbisHolger Hans Peter Freyther2-2/+2
2012-11-22sms: Mark the state dispatch table as static constHolger Hans Peter Freyther2-4/+4
GCC 4.7.2 was already smart enough to see that the table is const so there is no change in the generated assembly code. For some reason the dispatch is still going through one relocation.
2012-11-22sms: Fix typos in the comments and log messages.Holger Hans Peter Freyther2-5/+5
2012-11-22smr: Introduce an id and prefix all log messages with SMR(ID)Holger Hans Peter Freyther1-31/+68
When OpenBSC is handling more than one message at a time it is difficult to see which log message belongs to which SMR instance. Introduce a uint64_t id that can be set to the row_id/message_id and prefix all log messages with SMR(ID). This change is ABI and API incompatible with previous versions of libosmogsm.
2012-11-22smc: Introduce an id and prefix all log messages with SMC(ID)Holger Hans Peter Freyther1-30/+60
When OpenBSC is handling more than one message at a time it is difficult to see which log message belongs to which SMC. Introduce a uint64_t id that can be set to the row_id/message_id and prefix all log messages with SMC(ID). This change is ABI and API incompatible with previous versions of libosmogsm. Example: SMC(100) instance created SMC(100) message MNSMS-EST-REQ received in state IDLE
2012-11-14smc: Fix a typo in the smc codeHolger Hans Peter Freyther1-1/+1