aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2014-08-21libctrl: Remove reference to 'DNAT' in favor of 'DCTRL'Harald Welte1-1/+1
2014-08-21libctr: rename/move control interface to libosmocore naming schemeHarald Welte3-0/+1071
2014-08-21gsm0808: Fix copy and paste pointed out by clangHolger Hans Peter Freyther1-1/+1
The element following the identifier list was the GSM0808_IE_LSA_INFORMATION. It is a TLV type as well and the issue got introduced in 92107dfd3b99ab0dbb0f4770286454ad94a36de2. Fixes: gsm0808.c:316:40: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides] [GSM0808_IE_LSA_IDENTIFIER_LIST] = { TLV_TYPE_TLV }, ^~~~~~~~~~~~ gsm0808.c:315:40: note: previous initialization is here [GSM0808_IE_LSA_IDENTIFIER_LIST] = { TLV_TYPE_TLV },
2014-08-21macaddr: Add some code for FreeBSD (it should work on the others too)Holger Hans Peter Freyther1-0/+41
There doesn't seem to be a way to share this code with Linux as it doesn't have the sockaddr_dl concept inside the getifaddrs. I manually verified this on a FreeBSD10 box and hex decoding gave me the correct mac address and rc was 0.
2014-08-21ipa: use %z as format string whne printing sizeof() resultHarald Welte1-1/+1
thanks to Holger for reminding me
2014-08-21ipa: fix compiler warning regarding printf (%d -> %lu)Harald Welte1-1/+1
2014-08-21macaddr: add #include unistd.h for close() functionHarald Welte1-0/+1
this fixes a compile warning
2014-08-20ipa: rename functions for consistencyHarald Welte3-24/+39
As we are breaking builds by moving functions from libosmo-abis to libosmocore anyway, we might as well give functions more appropriate names. ipaccess is a company, while IPA is the multiplex protocol, and CCM is the protocol used for establishing identities on the IPA multiplex.
2014-08-20import various generic IPA related functions from libosmo-abisHarald Welte2-1/+448
libosmo-abis is about forming A-bis interfaces/lines by means of E1 or the IPA multiplex (or possibly other link layers). The IPA multiplex is used in other contexts, such as the Control interface, or the A interface. In that context, it makes sense to have generic IPA related functions in libosmocore.
2014-08-18Add osmo_get_macaddr() function to obtain etherent mac addressHarald Welte1-0/+26
This used to be private in osmo-bts/common/abis.c, where it really didn't belong.
2014-08-18osmocore: Add function osmo_macaddr_parse() to parse ETH MAC addressHarald Welte2-1/+27
2014-08-17abis_nm: add abis_nm_msg_disc_names[] value_stringHarald Welte2-0/+10
2014-08-17abis_nm: introduce abis_nm_{osmo,ipa}_magic[]Harald Welte2-0/+5
... used to be oml_{osmo,ipa}_magic in osmo-bts
2014-07-07gprs-ns: Re-initialize the list head and free the unknown_nsvcHolger Hans Peter Freyther1-0/+3
Fix re-initialize issue of the GPRS NS. This was found while working on the GB Proxy tests. ==27800== Invalid write of size 4 ==27800== at 0x403C263: rate_ctr_group_alloc (linuxlist.h:65) ==27800== by 0x4050974: gprs_nsvc_create (gprs_ns.c:209) ==27800== by 0x405320D: gprs_ns_instantiate (gprs_ns.c:1330) ==27800== by 0x804B212: main (gbproxy_test.c:797) ==27800== Address 0x434173c is 52 bytes inside a block of size 784 free'd ==27800== at 0x4029DA8: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==27800== by 0x4041BBD: _talloc_free (talloc.c:609) ==27800== by 0x40432B2: talloc_free (talloc.c:578) ==27800== by 0x40532D3: gprs_ns_destroy (gprs_ns.c:1363) ==27800== by 0x804B1FE: main (gbproxy_test.c:791)
2014-07-01write_queue: Use EBADF instead of EBABDFD for portabilityHolger Hans Peter Freyther3-5/+5
EBADFD is linux specific while EBADF is POSIX. Fix the build on FreeBSD and use EBADF throughout the file.
2014-06-22vty: Avoid use-after-free in VTY telnet interfaceDaniel Willmann2-4/+4
If the read callback closes the connection conn is already freed so we can't derefernce it. Instead return -EBADFD in the read function if it closed the connection and check for that.
2014-06-22write_queue: Avoid possible use-after-free if fd is read-/writableDaniel Willmann1-5/+18
If the FD is both readable and writable and the read callback closes the connection (and frees the surrounding structure) we shouldn't call the write callback (or check anything else in the read fd). With this patch callback functions can return -EBADFD if they don't want the FD to be handled any more.
2014-06-21update TS 08.08 header + TLV definitions to TS 48.008 / 11.7.0Harald Welte1-16/+149
This adds support for A-over-IP and LCLS related message/IEI definitions. Old definitions are in decimal, which is very hard (at least for me) to compare with the binary tables in the spec. Hex is much easier to manually compare for completeness/correctness. I didn't touch the existing definitions, but think they should move to hex, too.
2014-06-16gsm: Add Kasumi cipher implementationSylvain Munaut2-1/+187
Submitted-by: Max <max.suraev@fairwaves.co> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-06-16include: Switch to #pragma once patternSylvain Munaut4-16/+4
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-05-23gsm0411_smr: Fix the size of the arrayHolger Hans Peter Freyther1-1/+1
The code is lacking a "," at the end of a string and we ended up doing string concatination instead of having an invalid state. Fixes Coverity CID 1206564
2014-05-23gsm0411_smr: Make the look-up table staticHolger Hans Peter Freyther1-1/+1
2014-05-23timer: Use the now parameter when it is not NULLHolger Hans Peter Freyther1-3/+3
The code would have used an uninitialized current_time in case "now" was not NULL. As now is const and timersub expects a non const parameter I decided to copy now into current_time. Fixes: CID #1040661
2014-05-19Fix introducing osmocom speficic OML attributesHarald Welte2-0/+8
Rename NM_ATT_O_REDUCEPOWER to NM_ATT_OSMO_REDUCEPOWER, which makes it more clear that this is an osmcoom specific attribute. Also, we cannot simply overload 0x01 as an already defined OML attribute. The problem is quite simple: When we use abis_nm_att_tlvdef during the TLV parse, 0x01 will match to NM_ATT_ABIS_CHANNEL, which is defined as { TLV_TYPE_FIXED, 3 }. So instead, we need to introduce a new abis_nm_osmo_att_tlvdef[], which has to be patched into abis_nm_att_tlvdef[] by the means of tlv_def_patch(), exactly how we do it for bs-11 and nanobts specific attributes. I'm using 0xfe for the attribute, as 0xfe doesn't overlap with the IPA specific attribues (and we might want to combine/merge the 12.21 plus IPA plus osmocom spefici attributes)
2014-05-15select: Fix english in commentHolger Hans Peter Freyther1-1/+1
2014-04-17backtrace: Speculative fix for FreeBSD10.0 and execinfo.hHolger Hans Peter Freyther1-1/+2
FreeBSD 10.0 ships an execinfo.h but one needs to link to an additional library for the backtrace functions. Check if there is a backtrace symbol in libexecinfo and if so link to that library.
2014-03-31Release: Prepare the release of 0.6.60.6.6Holger Hans Peter Freyther1-1/+1
2014-03-26src/socket: Adding unix domain socket supportÁlvaro Neira Ayuso1-0/+102
Added some function for adding the unix domain socket support. Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-03-26sms: Add missing brackets in the relative validity time calculation.Alexander Chemeris1-3/+3
2014-03-26gsm/lapdm: Prevent LAPD tx_queue from filling up in polling modeDaniel Willmann2-0/+27
If LAPDm receives an I-Frame while there already is an I-Frame in the tx_queue the code generates an additional RR (to acknowledge the received I-Frame). Instead, N(R) of the I-Frame in the tx_queue should be updated to ACK the data.
2014-03-26lapdm: Make lapdm_datalink_for_sapi publicDaniel Willmann2-3/+4
This API allows you to get the lapdm_datalink for a SAPI. It's needed in the lapdm_test, so make it public.
2014-03-16lapd: Improve log message and mention the SAPI the dl is onHolger Hans Peter Freyther1-2/+2
When debugging an issue that involves SAPI=0 and SAPI=3 the log file does not have enough context. Add the SAPI to this message so we at least understand which SAPI we are talking about.
2014-03-10ladpm: Fix msgb handling and SAPI=3 establishment delayJacob Erlbeck1-27/+14
Currently it takes 3s to establish a SAPI 3 SACCH connection with osmo-bts. This is due to the fact, that a broken SABME request is sent first and and is ignored by the MS. Then, after a T200 timeout (2s) the SABME command is sent again (this time correctly) and answered by the MS. The first SABME message is broken (it has a length field of 3 and ends with 3 bytes from the tail of the original RSL message), because of it is expected throughout lapdm.c that msg buffers containing RSL have msg->l2h == msg->data. Some abis input drivers fulfill this but IPA doesn't, thus the 3 bytes of the IPA header are still part of the msg and confuse length computation. Since internal fields of the msg are modified directly, this is difficult to see. This patch adds a new function msgb_pull_to_l3() that explicitely skips over all headers prepending L3 and therefore resets l1h and l2h. This function is then used instead of msgb_pull_l2h() which only worked correctly when msg->l2h == msg->data. In addition, code manipulating msg->tail and msg->len directly has been replaced by calls to msgb_trim(). Note that this patch does not fix all issues of this case in the LADP related code. Ticket: SYS#192 Sponsored-by: On-Waves ehf
2014-03-04msgb: Add msgb_hexdump() functionJacob Erlbeck1-0/+49
This function works like osmo_hexdump() and returns a static buffer containing hex bytes along with markers for the layers. Note that it uses osmo_hexdump() internally, thus a call to msgb_hexdump() invalidates the buffer that has been returned by an earlier call to osmo_hexdump(). In short: don't mix them in a single call printf(). Sponsored-by: On-Waves ehf
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
2014-01-02utils: Greatly improve performance of osmo_hexdump routinesNils O. Selåsdal1-5/+13
In the osmo-bts and libosmo-abis code the hexdump routine is used for every incoming/outgoing packet (including voice frames) and the usage of snprintf showed up inside profiles. There is a semantic change when more than 4096 characters are used. The code will now truncate at byte boundaries (and not nibbles). Code: static const int lengths[] = { 23, 1000, 52 }; char buf[4096]; int i; for (i = 0; i < 30000; ++i) char *res = osmo_hexdump(buf, lengths[i & 3]); Results: before: after: real 0m3.233s real 0m0.085s user 0m3.212s user 0m0.084s sys 0m0.000s sys 0m0.000s
2013-12-29logging: Copy the filter_fn and fix the IMSI filter in OpenBSCHolger Hans Peter Freyther1-0/+1
The filter_fn has not been copied into the new structure breaking the imsi and other filters in OpenBSC. Looking at the code we should also introduce a callback for the reset of the context so we could use subscr_get/subscr_put on the subscriber structure.
2013-12-07Refactor COMP128v23 implementation and add test suitMax2-38/+29
2013-11-22gb: Remove comment about ABI changes from the MakefileHolger Hans Peter Freyther1-3/+0
Okay. this comment thing has not worked (I totally forgot about it). I think either we try to find ABI breakages with tools or we use #error macros and check for a version...
2013-11-11gprs: Fix VTY NSVC initialisation bug by changing gprs_nsvc_create()Jacob Erlbeck1-3/+3
Currently the field nsvci_is_valid is set to 0 in the NSVC object returned by gprs_nsvc_create(). This was a semantic change probably introduced by commit 5e6d679d. As a result, NSVC created via the VTY have this flag set to 0 causing RESET_ACK messages to be rejected. This patch changes the default behaviour of gprs_nsvc_create() to always set this flag. So it must be set to 0 explicitely if needed which is more intuitive and thus less error prone. It fixes breaking connections from the Gbproxy to the SGSN. Ticket: OW#874 Sponsored-by: On-Waves ehf
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-30gprs: Ignore NS RESET_ACK and ALIVE_ACK without RESETJacob Erlbeck1-0/+17
Currently those messages are answered by a NS_STATUS message when received on an uninitialised (no NS_RESET hat been seen yet) NS_VC which violates GPP TS 08.16 7.3.1 and 7.4.1. This patch adds checks to gprs_ns_vc_create() and eventually returns before the error NS_STATUS message is generated. Sponsored-by: On-Waves ehf
2013-10-25gprs: Address coverity warning for gprs_ns_tx_status resultHolger Hans Peter Freyther1-8/+10
Add a #define for the check and use this in this path as well. Fixes: Coverity CID 1103092
2013-10-25gprs: Address coverity warning on unchecked return of gprs_ns_tx_reset_ackHolger Hans Peter Freyther1-1/+5
Fixes: Coverity CID 1111545
2013-10-25gprs: Address coverity warning on unchecked return of gprs_ns_tx_statusHolger Hans Peter Freyther1-1/+4
We could consider creating a CHECK MACRO that will print a message in case of a tx failure. Fixes: Coverity CID 1111544