summaryrefslogtreecommitdiffstats
path: root/src/gb
Commit message (Collapse)AuthorAgeFilesLines
* BSSGP: add function to reset all PTP BVCMax2017-07-282-0/+27
| | | | | Change-Id: I9bf8f4dd784ccddbb9926492a85fff3293a0e913 Related: OS#1638
* Add missing BSSGP cause valuesMax2017-07-011-20/+57
| | | | | | Add values from 3GPP TS 48.018 Change-Id: Ie39a6c91a46d179392d861805a106743a07c6fb0
* BSSGP: handle BVC-RESET-ACKMax2017-06-281-0/+3
| | | | | | | | | | | | | That's necessary for SGSN to properly handle BSS response to reset procedure initiated by SGSN (foe example via 'bssgp bvc nsei 101 bvci 0 reset' command). According to 3GPP TS 48.018 §8.4 "after performing the BVC Reset procedure all affected BVCs are assumed to be unblocked at the SGSN" so there's no need in any special handling. Change-Id: I90dfbd0195a8403406429ccc746299d072445f7b Related: OS#1638
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-239-51/+58
| | | | | | | | | | | | | | | | | Considering the various styles and implications found in the sources, edit scores of files to follow the same API doc guidelines around the doxygen grouping and the \file tag. Many files now show a short description in the generated API doc that was so far only available as C comment. The guidelines and reasoning behind it is documented at https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation In some instances, remove file comments and add to the corresponding group instead, to be shared among several files (e.g. bitvec). Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
* doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr2017-06-232-33/+33
| | | | | | | | | | Especially for short descriptions, it is annoying to have to type \brief for every single API doc. Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes the first sentence of an API doc as the brief description. Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
* gb/gprs_bssgp.c: avoid valueless goto usageVadim Yanitskiy2017-06-131-10/+3
| | | | Change-Id: I0c2aaf1ab462c923d62232f1a63fae1e4eb18b4d
* update/extend doxygen documentationHarald Welte2017-06-121-1/+1
| | | | | | | | | It's a pity that even with this patch we still are fare away from having the whole API documented. However, at least we have a more solid foundation. Updates not only extend the documentation, but also make sure it is rendered properly in the doxygen HTML. Change-Id: I1344bd1a6869fb00de7c1899a8db93bba9bafce3
* Add human-readable names for signal_nsMax2017-05-242-0/+11
| | | | | Change-Id: Id664355eb8305fb287e4dae0800fb20dc2f9b8cd Related: SYS#3610
* libosmogb: Convert to use new endian conversion helpersHarald Welte2017-05-156-96/+91
| | | | Change-Id: I5ed17702cd9487e1cab6bae39802aa11fb6a37b0
* timer: add osmo_timer_setup()Pablo Neira Ayuso2017-05-092-4/+2
| | | | | | | | | | | | | | | Add a new function timer function to set up the timer, similar to what we have in the Linux kernel. This patch also converts existing opencoded timer setup in the libosmocore tree as initial client of this new function. This patch implicitly removes function callback passed by reference that defeat compile time type validation. Compile-tested only, but I ran make check that reports success when testing timer infrastructure. Change-Id: I2fa49972ecaab3748b25168b26d92034e9145666
* gprs: add value strings for NS PDU typeMax2017-05-092-2/+27
| | | | | | | | Add value strings for Service Control PDUs according to 3GPP TS 48.016 §9 and use them for logging. Change-Id: I0ea3a45f35d68619d4cfa9735ef77abd9f9f0d58 Related: SYS#3610
* fix spelling in API docu, command reply, logging, descriptionsThorsten Alteholz2017-04-231-1/+1
| | | | | | sections: ctrl, gb, gsm, vty Change-Id: Iac211b5cd8504da36b699777b95a2448dd7c3e70
* logging.h: fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*Neels Hofmeyr2017-02-235-33/+33
| | | | | | | | | | | | | | | My recent logging patch was merged to master a bit too soon. Accomodate the request for naming that matches the general "LOG" prefix instead of "LOGGING". libosmocore will not be backwards-compatible with the few commits from change-id I5c343630020f4b108099696fd96c2111614c8067 up to this one. This and following commits are backwards compatible with those before that short window. See also: * openbsc change-id Ib2ec5e4884aa90f48051ee2f832af557aa525991 * osmo-pcu change-id I4db4a668f2be07f3d55f848d38d1b490d8a7a685 Change-Id: I424fe3f12ea620338902b2bb8230544bde3f1a93
* logging: centrally define ctx and filter indexesNeels Hofmeyr2017-02-226-39/+33
| | | | | | | | | | | | | | | | | | | | | | | It is too easy for calling code to use the same filter and context indexes for different filters and structs. For example, openbsc's IMSI filter and libgb's GPRS_BVC filter both fall on index 1 even though there are plenty more indexes to choose from. To alleviate this, have one central definition here, sort of like ports.h does for VTY and CTRL port numbers. Add static asserts to make sure the indexes fit in the available array and bit mask space. Calling code like openbsc.git and osmo-pcu need adjustments and/or should move to using these enum values instead of their local definitions. Taking this opportunity to also prepare for a split of struct gsm_subscriber in openbsc into bsc_subsciber and vlr_subscriber with appropriate separate filter index constants for both subscriber types. Include previous LOG_FILTER_ALL in the LOGGING_FILTER_* enum, and replace its use by (1 << LOGGING_FILTER_ALL). Change-Id: I5c343630020f4b108099696fd96c2111614c8067
* fix: gprs_bssgp_vty: logging filter: wrong constantNeels Hofmeyr2017-02-171-1/+1
| | | | | | | Setting the BVC log filter to NULL worked only if the NSVC filter was set, use the proper constant instead. Change-Id: Ic1cc268ed20700698c93d3ff8bf85cc0f01d3b1b
* gprs_ns_vty: guard against duplicate VTY elementsNeels Hofmeyr2017-01-121-0/+8
| | | | | | | | The TbfTest in osmo-pcu calls gprs_ns_vty_init() repeatedly, which aborts because of duplicate VTY elements. Fix this by skipping the VTY init if it already happened. Change-Id: I05c7f25a4e873ae76b206819180b8b043b60103e
* bssgp_rx_paging(): Fix parsing of P-TMSI IE in Paging messageHarald Welte2016-11-111-1/+2
| | | | | | | | | | | | | | | | | | | | | This was actually discovered by the following compiler warning in gcc-6.2.0: CC gprs_bssgp_bss.lo gprs_bssgp_bss.c: In function ‘bssgp_rx_paging’: gprs_bssgp_bss.c:544:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (TLVP_PRESENT(&tp, BSSGP_IE_TMSI) && ^~ gprs_bssgp_bss.c:548:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ *(pinfo->ptmsi) = ntohl(*(uint32_t *) ^ This is an actual bug. If we recevied a BSSGP Paging Request without P-TMSI, we might crash or report some random memory as P-TMSI to the caller in the output data structure. Change-Id: Ib4f307827cd7cccc91c1415a6fb5428d7cf8416d
* bssgp_vty: Remove dead code and compiler warningHarald Welte2016-11-111-7/+0
| | | | | | | | gprs_bssgp_vty.c:48:34: warning: ‘gprs_bssgp_timer_strs’ defined but not used [-Wunused-const-variable=] static const struct value_string gprs_bssgp_timer_strs[] = { ^~~~~~~~~~~~~~~~~~~~~ Change-Id: Ia41ccb7b227c41996cdef51dc6779bfc5b5a8d48
* add osmo_gettimeofday as a shim around gettimeofdayNeels Hofmeyr2016-09-222-6/+6
| | | | | | | This allows feeding a custom time for unit tests by overriding osmo_gettimeofday. Change-Id: Ic7a81a6eb51f27fe452962b91f2eae2070d87089
* Fix unaligned access found by addr. sanitizerMax2016-04-242-4/+4
| | | | | | | | gprs_bssgp.c:461:9: runtime error: load of misaligned address 0x62100001a66b for type 'uint32_t', which requires 4 byte alignment gprs_ns.c:937:16: runtime error: load of misaligned address 0x61d00002a97f for type 'uint16_t', which requires 2 byte alignment
* gb: Add bssgp_pdu_str to libosmogb namespaceMax2016-04-121-0/+1
| | | | [hfreyther: To be used by osmo-pcu]
* Add missing docs for bssgp bvc reset vty commandMax2016-04-071-2/+8
| | | | Fixes the build failure with extended tests enabled.
* Add vty command to explicitly reset given BVCIMax2016-04-051-0/+20
| | | | | It's useful for debugging and is similar to existing reset command for nsvc.
* Improve BSSGP debug outputMax2016-03-172-17/+17
| | | | | Print string representation of Cause IE and PDU type instead of numerical value.
* Add helper function to convert numerical BSSGP PDU type to stringMax2016-03-111-0/+46
|
* gb: Add bssgp_msgb_copy functionJacob Erlbeck2016-02-222-0/+31
| | | | | | | | | | | | | | This function originates from openbsc/src/gprs but is just specific to BSSGP/Gb on the same level like bssgp_msgb_alloc. This commit puts the former gprs_msgb_copy function beside bssgp_msgb_alloc. Renamed function: gprs_msgb_copy -> bssgp_msgb_copy Sponsored-by: On-Waves ehf
* ns: Force a defined state when sending NS RESETJacob Erlbeck2015-12-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Currently the state is assumed to remain the same while the reset procedure is active. While this works correctly in general, a single unexpected BLOCK_ACK or UNBLOCK_ACK can change the state but will not stop the reset procedure. The leads to repeated RESET messages, where the corresponding RESET_ACK is ignored. This is a stable state which can only be left by manual intervention or by reception of a RESET message from the peer. This commit changes the RESET timeout handler to set the state to BLOCKED/RESET when sending the new NS RESET message. Note that this should ensure a clean restart even if the state has been screwed up. It does not fix the handling of BLOCK_ACK or UNBLOCK_ACK in abnormal cases. Addresses: gprs_ns.c:349 NSEI=8895 Tx NS RESET (NSVCI=8895, cause=O&M intervention) gprs_ns.c:878 NSVCI=8895 Rx NS RESET ACK (NSEI=8895, NSVCI=8895) gprs_ns.c:887 NS RESET ACK Discarding unexpected message for NS-VCI 8895 from SGSN NSEI=8895 Ticket: OW#1551 Sponsored-by: On-Waves ehf
* ns/stats: Add missing osmo_stat_item_group_free to gprs_nsvc_deleteJacob Erlbeck2015-12-171-0/+1
| | | | | | | | | | | | | | | | | | | | | The stat item group is not removed by gprs_nsvc_delete which will corrupt the group list. Addresses: valgrind tests/gbproxy/gbproxy_test [...] ==4541== Invalid write of size 4 ==4541== at 0x4071ACA: __llist_add (linuxlist.h:65) ==4541== by 0x4071ACA: llist_add (linuxlist.h:81) ==4541== by 0x4071ACA: osmo_stat_item_group_alloc (stat_item.c:112) ==4541== by 0x407EDFD: gprs_nsvc_create (gprs_ns.c:244) ==4541== by 0x408109D: gprs_ns_instantiate (gprs_ns.c:1388) ==4541== by 0x804CFD3: test_gbproxy_ident_changes (gbproxy_test.c:1501) ==4541== by 0x805FBD3: main (gbproxy_test.c:5803) Sponsored-by: On-Waves ehf
* remove our internal copy of talloc, use system libtallocHarald Welte2015-12-051-2/+2
| | | | | | | Shipping our own private copy of talloc was a good idea in 2008, when it was not readily available on most target platforms. Today, the situation is quite different, as it is a standard library on major Linux distributions.
* gprs-ns/stats: When the NSVCI is updated, update the stats counterHolger Hans Peter Freyther2015-11-041-0/+2
| | | | | | | | | | | The NS object is created with an unknown identity and only after the reset procedure has progressed (completed?) we know the real ID for this peer. Before nobody has looked at the idx values (this could have been seen with the CTRL interface) but with statsd the wrong NSVCI becomes obvious. Add routines to update the idx and I don't know if the change of idx is causing any issues but we will find that out soon.
* ns/stats: Fix class_id of "NSVC Peer Statistics" rate_ctr groupJacob Erlbeck2015-08-221-0/+1
| | | | | | | | | Currently the class_id is not set which effectively puts these groups into the 'subscriber' class. This commit adds the missing initialisation value. Sponsored-by: On-Waves ehf
* stats: Limit reporting by class idJacob Erlbeck2015-11-022-0/+4
| | | | | | | | | | | | | | | This commit adds class_id fields to the rate_ctr and stat_item group descriptions. The stats reporter code is extended to only process groups whose class_id does not exceed a per reporter max_class level. If the class_id is not set, the code assumes 'global' for groups with idx == 0 and 'subscriber' otherwise. The following vty command is added to config-stats: level (global|peer|subscriber) Set the maximum group level Sponsored-by: On-Waves ehf
* stats: Add osmo_ name prefix to identifiersJacob Erlbeck2015-11-021-4/+4
| | | | | | | | | | Since the the stat_item and stats functions and data types are meant to be exported, they get an osmo_ prefix. Sponsored-by: On-Waves ehf [hfreyther: Prepended the enum values too. This was requested by Jacob]
* ns: Add statistics for some eventsJacob Erlbeck2015-10-282-1/+39
| | | | | | | | | | | | The following counters are added to the ns.nsvc counter group: lost.alive The number of missing ALIVE ACK messages lost.reset The number of missing RESET ACK messages The following items are added to the ns.nsvc stat item group: alive.delay The time in ms between sending ALIVE and receiving the next ALIVE ACK Sponsored-by: On-Waves ehf
* release: Prepare the 0.8.2 releaseHolger Hans Peter Freyther2015-08-011-1/+1
| | | | | I have kind of used 0.8.1 by accident already so let us move to 0.8.2 now.
* bssgp: Fix IMSI buffer size (Coverity)Jacob Erlbeck2015-06-191-2/+4
| | | | | | | | | | | | | Currently the size of the IMSI pointer is used instead of the size of the talloc'ed buffer. This commit changes the call to gsm48_mi_to_string to use the same value that has been used with talloc_zero_size(). The length is changed to 17 since that value is used for GSM_IMSI_LENGTH in openbsc. Fixes: Coverity CID 1040663 Sponsored-by: On-Waves ehf
* bssgp: Fix bssgp_tx_fc_bvc parameter typeJacob Erlbeck2015-05-061-1/+1
| | | | | | | | | | | | Currently large values for Bmax default MS get sliced since a uint16_t is used as the type of the corresponding parameter of bssgp_tx_fc_bvc. GSM 48.018, 11.3.2 which in turn refers to 11.3.5 specifies a maximum of 6MB (0xffff * 100). This commit changes the type to uint32_t to cover the full value range. Sponsored-by: On-Waves ehf
* bssgp: Fix call to llist_entry in fc_queue_timer_cfgJacob Erlbeck2015-04-301-1/+1
| | | | | | | | | | | | | Currently the DL sometimes hangs and sometimes a lot of messages (still not able to send PDU) are logged. This is caused by an invalid timer delay computation, setting msecs either to 0 or to some big value. This is due to an '&' operator at the wrong place, accessing some parts in fc instead of the first element of the list. This commit fixes that issue. Sponsored-by: On-Waves ehf
* bssgp: Fix encoding of BVC_FLOW_CONTROLJacob Erlbeck2015-04-291-5/+5
| | | | | | | | | Currently all 2 byte IE of the message are transmitted in the little endian byte ordering. This commit adds htons to the encoding expressions. Sponsored-by: On-Waves ehf
* bssgp: Fix output of the VTY 'show bssgp stats' commandJacob Erlbeck2015-04-291-2/+3
| | | | | | | | The output is terminated by a '\n' instead of VTY_NEWLINE. This is fixed by the commit. Sponsored-by: On-Waves ehf
* gprs: Add assertion for msg != NULL to bssgp_msgb_alloc (Coverity)Jacob Erlbeck2015-04-101-0/+4
| | | | | | | | | | | | | Currently out-of-memory is not handled by bssgp_msgb_alloc, leading to SEGV failures if msgb_alloc_headroom returns NULL. This commit adds an OSMO_ASSERT to catch this case, which improves the situation only slightly. But bssgp_msgb_alloc is used in many places without checking the return value, so just adding a conditional early NULL return would not fix the issue either. Fixes: Coverity CID 1293377 Sponsored-by: On-Waves ehf
* ns: Log when sending fails (Coverity)Jacob Erlbeck2015-04-072-0/+20
| | | | | | | | | | | | | | | | Currently the return value of the gprs_ns_tx family of functions is often ignored. This is not a serious issue, since the successful delivery of the messages is neither guaranteed nor acknowledged by the network layer anyway. Nevertheless this commit adds logging (level INFO) to gprs_ns_tx and gprs_ns_msgb_alloc. The definition of the latter has been moved from the header file to gprs_ns.c. Fixes: Coverity CID 1040678, 1040679, 1040680, 1040681, 1040682, 1040683, 1040684, 1040686, 1040687, 1040688, 1111545, 1240203, 1240204 Sponsored-by: On-Waves ehf
* bssgp: Ensure non-NULL bctx before calling bssgp_rx_ptp (Coverity)Jacob Erlbeck2015-04-071-1/+6
| | | | | | | | | | | | | | Currently bssgp_rx_ptp might be called with bctx being NULL, when the NS BVCI is neither BVCI_SIGNALLING nor BVCI_PTM, but the message is a BVC_RESET or it contains an BVCI IE != BVCI_SIGNALLING where the BVCI is not known. This patch ensures that bssgp_rx_ptp will only be called with a non-NULL bctx. A log message will be issued, if the bctx is NULL when this was not expected. Fixes: Coverity CID 1040674 Sponsored-by: On-Waves ehf
* bssgp: Always expect dup != NULL in bssgp_tx_dl_ud (Coverity)Jacob Erlbeck2015-04-071-25/+24
| | | | | | | | | | | | | | Currently the implementation of bssgp_tx_dl_ud conditionally adds some optional IE if dup != NULL. Later on is dereferences dup to access qos_profile and fc, but this without checking dup in advance. This may lead to an segmentation violation fault. This commit changes the value range of the function to only accept dup != NULL. An assertion will fail otherwise. All other explicit checks for non-NULL are removed. Fixes: Coverity CID 1040673 Sponsored-by: On-Waves ehf
* bssgp: Handle BSSGP STATUS messagesJacob Erlbeck2015-03-181-16/+62
| | | | | | | | | | | | | | | | | | | Currently incoming BSSGP STATUS messages are just logged and no other action is taken. This makes it impossible for higher layers to react to failures which are indicated by corresponding STATUS messages unless a timeout is triggered as a result of that failure later on. This commit adds a bssgp_rx_status() function and calls it on incoming STATUS messages. That function logs a message, increments the new BSSGP_CTR_STATUS counter if the bctx context exists and invokes an NM_STATUS status indication. The latter will allow the application to handle failures immediately. Since all STATUS messages should be handled, the function is already called in bssgp_rcvmsg and the message is no longer handled in (and will not reach) bssgp_rx_sign and bssgp_rx_ptp. Ticket: OW#1414 Sponsored-by: On-Waves ehf
* bssgp: Don't reply with STATUS when receiving a PtP STATUS messageJacob Erlbeck2015-03-181-0/+2
| | | | | | | | | | | | | Currently each incoming PtP BSSGP STATUS message is handled as 'not yet implemented' and a BSSGP STATUS message (cause BSSGP_CAUSE_PROTO_ERR_UNSPEC) is sent back to the peer. This will cause endless messages loops if both peers use this BSSGP stack implementation. This does not apply to signalling messages. This commit changes the implementation of bssgp_rx_ptp() to just do logging in this case. Sponsored-by: On-Waves ehf
* bssgp: Fix VTY command 'show bssgp nsei N'Jacob Erlbeck2014-11-101-1/+1
| | | | | | | | | | Currently this command segfaults (at least when ASAN is enabled), because when getting the NSEI the index to argv is wrong and out of bounds. This patch fixes the offset. Sponsored-by: On-Waves ehf
* Change license of libosmogb from AGPLv3+ to GPLv2+Harald Welte2014-10-268-32/+32
| | | | | | | | | | | The copyright holders Harald Welte, Holger Freyther, Andreas Eversberg and sysmocom - s.f.m.c. GmbH (represented by Holger and Harald) agree that the license of libosmogb should be GPLv2+ and not AGPLv3+. The reason the source files stated AGPLv3+ is due to the history, as they were moved from OpenBSC to libosmocore at the time we needed to use them from osmo-pcu. It was an oversight back then to not re-license them accordingly.
* gprs: Don't discard SUSPEND/RESUME in bssgp_rcvmsgJacob Erlbeck2014-10-231-18/+26
| | | | | | | | | | | | | | | Currently sending SUSPEND/RESUME messages to this function (like it is done in the osmo-sgsn) results in STATUS messages complaining about an unknown BVCI. The reason is, that these messages rely on a TLLI/RAI pair to identify the context and do not contain an explicit BVCI. This patch modifies bssgp_rcvmsg() to only complain about and unknown BVCI if one is given but a matching context is not found (except for RESET messages). The ctx argument is removed from the functions handling SUSPEND and RESUME since it will always be NULL then. Sponsored-by: On-Waves ehf
* bssgp: Free msgb in case of error when calling into gprs_ns_sendmsgHolger Hans Peter Freyther2014-10-101-0/+3
| | | | | | | | | | | | | | | | | | | | | In the OsmoSGSN we have a crash with a DEAD/BLOCKED GPRS-NS and segmented SN-UNITDATA. For the caller it is not easy to know if the passed msg buffer has been freed or not. The most easy solution is to always take the ownership and either pass it on or free it in case of an error. Adjust indirect and direct callers of gprs_ns_sendmsg. I found the following call-chains with an external msgb parameter. gprs_ns_sendmsg <- _bssgp_tx_dl_ud <- bssgp_fc_in <- bssgp_tx_dl_ud Update the test to allocate a real msgb because for the test with '1000' we will msgb_free it right away. Sponsored-by: On-Waves ehf