aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2021-09-07gprs_ns2: nsvc: react on STATUS PDUs with cause code NSVC UNKNOWN/NSVC BLOCKEDAlexander Couzens1-0/+27
A STATUS PDU with cause code NSVC UNKNOWN/NSVC BLOCKED informs the other side about a state mismatch between the side. Change-Id: Ib6a2424f3027a30f14ef0a9fc2230e6aae9a2a04
2021-09-07gprs_ns2: fix a white spaceAlexander Couzens1-1/+1
Change-Id: I2207d13ae451ce49482625fac43b6ab1c0f215e8
2021-09-07gprs_ns2: fix NS STATUS validationAlexander Couzens1-4/+3
The wrong TLVs were used. Change-Id: I01339d93469285cc5340500717ab2b696284e12a
2021-09-07ns2: fix a crash when receiving a SIZE while configuredAlexander Couzens1-0/+2
The ns2_vc_force_unconfigured() needs to be protected otherwise it would free gss->nsvc which will be used later. It further would run into another SNS failure which is wrong too. Change-Id: If14b9e3fcd5d139457b10d06517302168091d8d8
2021-09-07ns2: nsvc: reject UNITDATA when the remote BLOCK'edAlexander Couzens1-0/+1
When the remote initiated the BLOCK the nsvc would still accept UNITDATA over this nsvc. Change-Id: I3ed4aa105a84e448082d3028fe844aae7720426b
2021-09-04gprs_ns2: ensure the incoming NSVC is also the outgoing NSVCAlexander Couzens1-2/+1
Previous the SNS NSVC (the NSVC used for all SNS traffic) was never changed except when the choosen NSVC went dead or got freed. When receiving a SNS SIZE PDU over a different NSVC than the current SNS NSVC the answer would be transmitted to a different port. Change-Id: I36cd9488b8bca5cb99dae5cf50a55ee282e0557b
2021-09-04gprs_ns2_sns: ensure the SNS fsm behave correct when no signalling NSVCs are ↵Alexander Couzens1-4/+19
present When no remaining signalling NSVCs are available the SNS must be restarted (BSS) or go into unconfigured state (SGSN). Change-Id: I95e6bbb7a418d647a8426804879571597ae06ff8
2021-09-04gprs_ns2: improve reselection protectionAlexander Couzens1-0/+1
Change-Id: I375a7639fb8e0f92fd67bb4176bd6219978aa428
2021-09-04gprs_ns2: add correct filename/linenr to sns failed log messageAlexander Couzens1-1/+1
Change-Id: I117eaf8340fca50cb14392a3f05ea8feac1af3ed
2021-09-04gprs_ns2: calculate the nse->*_sums before notifing the sns fsmAlexander Couzens1-1/+1
The sns fsm needs these information to determine if there is a signalling nsvc left Change-Id: I7b115921780bd1ae895d8b9d0d4aec3e1cbaaf58
2021-09-04gprs_ns2: also prevent recursive events when SGSN side cleans upAlexander Couzens1-0/+2
When cleaning up the SGSN side (e.g. receiving a SNS SIZE PDU) the clean up will result in a use-after-free bug when the SGSN side is still alive. Change-Id: I0f57dd0577d1fc7bd270f58e15f6f22eb130ef59
2021-09-04gprs_ns2_sns: implement outbound SNS DEL proceduresAlexander Couzens1-9/+95
When removing a bind the remote side needs to be informed via the SNS DELETE procedure. Related: OS#5036 Change-Id: I53cd54dfd262c70c425c3f13dad3b29526daa523
2021-09-04gprs_ns2_sns: implement outbound SNS ADD proceduresAlexander Couzens1-33/+190
When adding a bind, the remote side needs to be informed via the SNS ADD procedure. Related: OS#5036 Change-Id: I71c33200bd1f0307ceb943ee958db5ebe3623d36
2021-09-04gprs_ns2_sns: implement local change weight procedureAlexander Couzens5-9/+460
When changing the bind ip-sns weight, initiate a SNS CHANGE WEIGHT procedure to inform the other side. Related: OS#5036 Change-Id: Icec4dabb46bc198f68f91bfe09ba279fbe68d454
2021-09-04gprs_ns2: don't use llist_for_each when freeing an elementAlexander Couzens3-20/+28
The problem are recursive execution because a free generates an event which could allow the use to free a nsvcs while the llist_for_each() is still running. Change-Id: I902557fb6e56e6588728a46e43a9cbe3215d5c68
2021-09-04gprs_ns2: gprs_ns2_free_bind() should remove itself before removing nsvcsAlexander Couzens1-4/+4
When removing NSVCs before removing the bind from the SNS list, the removing NSVCs could trigger a creation of a new NSVC on the same bind ending in a while(true) loop. Change-Id: I6f497348f75fb479427d8a4c23313e33fbc62036
2021-09-04gprs_ns2: use an event to free the nsvscs when using SNSAlexander Couzens3-3/+18
Otherwise there could be recursive loop when free'ing NSVCs which in the end create an event which the SNS want to free the NSVCs a second time Change-Id: Ie99ba5fe8a84519fe8a8c0abdf875606715ab7f6
2021-09-04gprs_ns2_sns: rework sns clean upAlexander Couzens1-16/+33
Move the cleanup into it's own state. Also changing the SGSN unconfigured state which won't be triggered when a SIZE is received. Change-Id: I2639345fdf3cd300a934238d676c543065ceaa8b
2021-09-04gprs_ns2: move sns_event into internal.h to direct emit eventsAlexander Couzens2-92/+92
When other parts of ns2 requires to emit an event to the SNS fsm it would need a proxy function because the events are private to the SNS file. To circumvent creating multiple proxy function make the events available via a header file. Change-Id: I8e3fae4367c112b5a71bffb33c302d903855cddc
2021-09-03gsm_08_58.h: Extend IPA Power Control Params IEs to pass C/I paramsPau Espin Pedrol2-2/+72
This commit adds new Osmocom specific IEs required to pass C/I related Power Control Parameters osmo-bsc => osmo-bts to be used by the MS Power Control Loop being implemented. Related: SYS#4917 Change-Id: Iffef0611430ad6c90606149c398d80158633bbca
2021-08-31gsm_08_58: fix sourcecode formattingPhilipp Maier1-1/+1
Change-Id: Ia58c25441911d6f872a8ec5664c71e56ad895f97
2021-08-31gsm_08_58: fix sourcecode formattingPhilipp Maier1-12/+12
struct abis_rsl_osmo_rep_acch_cap has an indentation level that is too deep. Change-Id: Ie15feac75d1aa4fe5e5e237b14119addf09e5d77
2021-08-31bts_features: Add new feature to indicate support for temporary overpowerPhilipp Maier2-0/+2
To indicate to the BSC that a BTS supports temporary overpower of SACCH/FACCH channels a new feature BTS_FEAT_ACCH_TOP is added. Change-Id: I62fbfc30acd5d67b20727b75a8f256e6b5d31e06 Related: SYS#5319
2021-08-31rsl: add new RSL IE to signal temporary overpowerPhilipp Maier2-0/+7
To transfer the temporary overpower value from the BSC to the BTS, a new RSL IE (RSL_IE_OSMO_TOP_ACCH_CAP) is added. Change-Id: I31c5be4bceb9140d63ab8e2f197f0acc68699426 Related: SYS#5319
2021-08-31gsm0503_coding: use ahs tables when encoding ahs codec idPhilipp Maier1-1/+1
The encoder function gsm0503_tch_ahs_encode uses gsm0503_afs_ic_ubit when encoding the CMR or FT (depends on the frame number). This is not correct. It should use gsm0503_ahs_ic_ubit instead. Change-Id: Id250b2102ac79ff222bd3ad9d1abc4b60abdd12b Related: SYS#5549
2021-08-26cosmetic: Fix missing space in commentPau Espin Pedrol1-1/+1
Change-Id: If0940a2e1c66c3498f5e3d6ac641029290955175
2021-08-23vty 'stats reset': do not reset stat_itemsNeels Hofmeyr1-8/+1
Exempt all stat_item statistics from 'stats reset'. Only reset rate_ctr statistics to zero. The rate_ctr statistics have an implicit time scale, counting occurences per time unit. For them it makes sense to reset all ratings and start from zero, for example in a test suite (e.g. our TTCN3 BSC_Tests). In contrast, stat_item statistics count number of objects or nr of specific object stati at any given time, and they do not deteriorate over time. Many stat items depend on increment/decrement to be sane. For example, in osmo-bsc, if the nr of connected BTS is 3, that does not make sense to be reset to zero. There are still 3 BTS connected, only the stat_item would suddenly reflect zero. From then on, it'd be wrong. All stat_items are by definition wrong after a 'stats reset'. - Those that depend on increment/decrement will be wrong until the program exits, and - those that are set to absolute values will be wrong up until the next value is set. That could be seconds or hours later, depending. Related: SYS#5542 Change-Id: If2134768b1076e7af189276c45f2a09a4944303e
2021-08-23codec: add missing osmo_amr_type_name function.Philipp Maier1-0/+3
We have value strings for osmo_amr_type, but we do not have a function that returns us the strings. Change-Id: I694f56b032537440db6264df5e6a6aa3a2992175
2021-08-20stats: send real last value if no new values comeOliver Smith5-1/+15
Background: * Individual values can be added to osmo_stat_item.values at any time. * Stats are reported at a fixed interval (see vty 'stats interval'), e.g. every 10 seconds. * In order to report a new stat value, we use the maximum of all osmo_stat_item.values added since the last report. * By default, we do not send new stat values if they did not change (see vty 'config-stats' -> 'flush-period' default of 0). Fix the following bug: * If 'flush-period' is 0, and no new osmo_stat_item.values are coming in, the last value that gets reported is not necessarily the last entry in osmo_stat_item.values. * For attached reporters (statsd), it could then be that the given stat stays at the wrong value for a long stretch of time (think of several hours/days/forever). Explanation of how the test shows that it is fixed: * stats get reported (value is irrelevant) * osmo_stat_item gets a new value: 20 * osmo_stat_item gets a new value: 10 * stats get reported (value: 20, the maximum of both new values) * osmo_stat_item gets no new values * stats get reported (value: 10, this is new because of the bug fix, the real last value in osmo_stat_item, different from the 20 sent earlier, without the fix it would not send anything here and the last sent value would be 20) * osmo_stat_item gets no new values * stats get reported (nothing gets sent, since the real last value was already sent and 'flush-period' is 0) Fixes: OS#5215 Change-Id: Ibeefd0e3d1dbe4be454ff05a21df4848b2abfabe
2021-08-20tests/stats: show how last item sent may be wrongOliver Smith2-0/+12
Extend the test to illustrate the bug described in the related issue, which will be fixed with the next patch. Related: OS#5215 Change-Id: I1d26867ac1b837bea6a9754a3203e53c147e7a5f
2021-08-19tests: add 'make update_exp' targetOliver Smith1-0/+179
Add convenience target to update the test output. Change-Id: I7247fffde82ab9195ae03b2ccb30d7aa47543113
2021-08-13gprs_ns2: add recursive anchor to protect against double freeAlexander Couzens2-5/+20
When free'ing a NSE/NSVC/BIND ensure there can't be a double free by using a free anchor in the struct. Recursive free's can happen when the NS user reacts on an event (e.g. GPRS_NS2_AFF_CAUSE_VC_FAILURE) and calls the free(). Or when the user free's a NSVC when the NSE uses SNS as configuration, the fsm tries to free it again. Change-Id: If9823aadaa936e136aa43e88cee925ddd5974841
2021-08-13gprs_ns2_sns: free the NSE if the SIZE PDU is not validAlexander Couzens1-0/+14
The SGSN fsm should be freed when becoming invalid instead of going into the unconfigured state. The unconfigured states should be only used when creating the NSE (on the SGSN side). Change-Id: Ife889091ecba4180a90743deb786767008fe863d
2021-08-13gprs_ns2_sns: refactor SNS failures into a functionAlexander Couzens1-10/+25
The SNS fsm is similar for BSS and SGSN. Terminate the SGSN failures by freeing the NSE. Change-Id: I1896f6c3ddb4f98ca261139c1cc77aa8f1558c6f
2021-08-13gprs_ns2_udp: don't start the NSVC fsm for SNSAlexander Couzens1-1/+3
The SNS code will always create NSVC on it's own. The only case when the SNS dialect allows dynamic NSE/NSVC is on the SGSN side when accepting dynamic NSE and receiving the first SNS SIZE. In this case the NSVC FSM must not be started yet. Prevents sending NS_ALIVE before the SNS configuration has been finished. Change-Id: I86275c99432262b3c19c1ded9a77090b74303bc8
2021-08-06vty/ports: move pcap server/client portsOliver Smith1-2/+4
Resolve conflict with other Osmocom software by moving ports: osmo-pcap-client 4237 -> 4227 osmo-pcap-server 4238 -> 4228 Remove wrong previous comments that claimed 4240 and 4241 were used. Related: OS#5203 Related: osmo-pcap I3b18b1fbbca2799f868f28104e2f5d513f93d46c Change-Id: I098f211370bba61995ce424ab64029bdd4c49e2d
2021-08-06vty/ports: prepare formatting for a long defineOliver Smith1-22/+22
Add one more tab between the define and the port number, to prepare for longer defines in the next patch. Related: OS#5203 Change-Id: I46655e33651814f41a1fea93406a83334d2fc529
2021-07-28utils: Fix c++ warn in OSMO_STRBUF_APPENDPau Espin Pedrol1-1/+1
It's really a false positive since _sb_l is compared and granted to be psotivie by the time we compare, so we don't really care, but c++ is not happy about it. """ /osmocom/core/utils.h:227:40: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] 227 | if (_sb_l < 0 || _sb_l > _sb_remain) \ | ~~~~~~^~~~~~~~~~~~ """ Change-Id: I90e7374aa959468670f1c0ea65a427398d423ddb
2021-07-27vty: clear screen with ^LOliver Smith1-0/+17
Use ANSI escape characters to clear the screen with ^L, like it works in typical Linux shells. I always found it slightly inconvenient that this didn't work in the VTY. Change-Id: Ie2356cd92f39b4dc28b5c20bbe4557fb0d972747
2021-07-27command: fix sourcecode formattingPhilipp Maier1-1/+1
Change-Id: Icc75c3b45821c24360e0fdb4a29077994e73ae05
2021-07-26gb/bssgp: Abort clearly if backward-compat API is used in wrong wayPau Espin Pedrol1-0/+1
Some tests under osmo-pcu (TbfTest) were caught accessning NULL pointer bssgp_nsi in bssgp_tx_llc_discarded triggered by timeout while stepping slowly with the debugger. It seems that test is not properly using neither the old nor the new API. Let's catch such cases easily. Change-Id: I3ea42755c4bfd29e4a01ad57f186f28d58ab466a
2021-07-26cosmetic: gb/gprs_ns.c: fix trailing whitespacePau Espin Pedrol1-2/+2
Change-Id: I842efdb93c9b480d5ab35c78b0bc60697262874a
2021-07-19vty: show uptime: use timespecsubOliver Smith1-5/+7
Related: OS#4609 Change-Id: If94795b3cd74040c49bdcbed8c410bf6e950afff
2021-07-16Make gcc 11.1.0 false positivies happyPau Espin Pedrol2-12/+11
After my system's gcc was upgraded, I get false positivies in a couple places. Let's initialize those to make gcc happy. """ /git/libosmocore/src/socket.c: In function ‘osmo_sock_init’: /git/libosmocore/src/socket.c:958:25: error: ‘sfd’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 958 | close(sfd); | ^~~~~~~~~~ /git/libosmocore/src/gsm/gsm48.c: In function ‘osmo_mobile_identity_decode’: /git/libosmocore/src/gsm/gsm48.c:690:20: error: ‘str_size’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 690 | if (rc < 1 || rc >= str_size) { | ~~~~~~~^~~~~~~~~~~~~~~~~ /git/libosmocore/src/gsm/gsm48.c:679:22: error: ‘str’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 679 | rc = osmo_bcd2str(str, str_size, mi_data, 1, 1 + nibbles_len, allow_hex); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ Change-Id: I8aacfbc21e23f63a65e8baee3fd536a1fe1bdd8a
2021-07-15vty: add "shutdown"Oliver Smith1-0/+16
Kill programs with SIGTERM with the new vty command, as it would happen with "systemctl stop". I've considered running the select shutdown logic too in order to ensure that pending OSMO_FD_WRITE requests are serviced. But as noted in review, it's better to ensure that the regular SIGTERM code path works as expected and call that instead of introducing an alternative code path. Closes: OS#4609 Change-Id: I3596a35b0f4a24e49484ec3f24a98e4d4f583e1e
2021-07-15vty: add "show pid"Oliver Smith1-0/+8
Related: OS#4609 Change-Id: Ib636050afc1eed134f450f2f1cdd3b51153b0160
2021-07-15vty: add "show uptime"Oliver Smith1-0/+27
Related: OS#4609 Change-Id: Ic7d9d5d3c8a9abd06a7e626aed7679f68406040c
2021-07-13gprs_ns2: ensure the NSE becomes dead when FR link went downAlexander Couzens3-0/+61
The FR code is using force unconfigured to change the state of the NSVC when the FR link goes down. The force unconfigured state didn't notified the NSE when changing into this state. Related: SYS#5533 Change-Id: I4d7bbbbce26f7cde99eebe96995c50b1e812e5bd
2021-07-09Aggregate NSVC stats inside the NSEDaniel Willmann4-13/+45
Change-Id: Ifa3c85ec52bda14596e9d7a8705baa1fd4ee2010 Related: OS#4998
2021-07-09fix api doc of osmo_identifier_sanitize_buf()Neels Hofmeyr1-1/+1
The implementation cleary replaces sep_chars instead of keeping them. Adjust the doc to clarify that. It seems to me that the intention was to *allow* sep_chars instead of replacing them, especially when looking at sep_chars of osmo_separated_identifiers_valid(). But we're stuck with that now. Change-Id: Ia842a7eeb46b49ee364be55c1194e463ebcaf392