aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2021-08-06gprs_ns2_sns: ensure the SNS fsm behave correct when no signalling NSVCs are ↵lynxis/ns2_nextAlexander Couzens1-5/+20
present When no remaining signalling NSVCs are available the SNS must be restarted (BSS) or go into unconfigured state (SGSN). Change-Id: I95e6bbb7a418d647a8426804879571597ae06ff8
2021-08-06gprs_ns2: improve reselection protectionAlexander Couzens1-0/+4
Change-Id: I375a7639fb8e0f92fd67bb4176bd6219978aa428
2021-08-06gprs_ns2: add correct filename/linenr to sns failed log messageAlexander Couzens1-1/+1
Change-Id: I117eaf8340fca50cb14392a3f05ea8feac1af3ed
2021-08-06gprs_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-08-06gprs_ns2_sns: implement outbound SNS DEL proceduresAlexander Couzens1-7/+76
When removing a bind the remote side needs to be informed via the SNS DELETE procedure. Related: OS#5036 Change-Id: I53cd54dfd262c70c425c3f13dad3b29526daa523
2021-08-06gprs_ns2_sns: implement outbound SNS ADD proceduresAlexander Couzens1-34/+188
When adding a bind, the remote side needs to be informed via the SNS ADD procedure. Related: OS#5036 Change-Id: I71c33200bd1f0307ceb943ee958db5ebe3623d36
2021-08-06gprs_ns2_sns: implement local change weight procedureAlexander Couzens4-8/+461
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-08-06gprs_ns2: dont use llist_for_each when freeing an elementAlexander Couzens2-15/+21
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-08-06gprs_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-08-06gprs_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-08-06gprs_ns2: move sns_event into internal.h to direct emit eventsAlexander Couzens3-18/+18
Creating just a proxy function seems more overhead instead of calling it direct. Change-Id: I8e3fae4367c112b5a71bffb33c302d903855cddc
2021-08-06gprs_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. Change-Id: If9823aadaa936e136aa43e88cee925ddd5974841
2021-08-06gprs_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-06gprs_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-06gprs_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. Change-Id: I86275c99432262b3c19c1ded9a77090b74303bc8
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 Couzens1-0/+3
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
2021-07-06gprs_ns2_vty: dump_nsvc: change output depending on NSVCIAlexander Couzens1-10/+9
If the NSVCI is valid, there is no signalling or data weight defined (internally this is 1). For NSVC with NSVCI don't print the signalling or data weight. For NSVC without NSVCI, don't print NSVCI at all. Related: OS#5180 Change-Id: Iaadc806a9136436468e2b02eb0bc1f4570a10ecc
2021-07-06gprs_ns2: fix wrong format string in Tx Size loglineAlexander Couzens1-1/+1
Don't use %u for integer. Change-Id: I324836ec4943c97f0dbc16ade697c468eba02b35
2021-07-06gprs_ns2: use gprs_ns2_free_bind() to clean up a bindAlexander Couzens1-3/+3
gprs_ns2_free_bind() takes care of all required steps to clean up a bind. The driver->free_bind() operation only cleans up the driver internal state but not NSVCs and other generic things. Fixes a crash when free'ing a bind from the vty which has active NSVCs. Related: OS#5195 Change-Id: I0a2ad22905bcacb929b9b5f5b034af0da3081826
2021-07-02gprs_ns2: correct mtu value in the log lineAlexander Couzens1-2/+2
The log line should describe what's reported towards the NS user and not the NSE MTU itself Related: OS#5192 Change-Id: I3f5445a1ba8c89c4023ff48be15a80569a128528
2021-07-02gprs_ns2: fix check of MTU changes for frame relayAlexander Couzens1-3/+7
The frame relay needs 2 byte for data packets. Related: OS#5192 Change-Id: I02d4e81896a473aeb79ea2f2983e12324244048f
2021-07-02gprs_ns2: fix crash when changing the MTUAlexander Couzens1-1/+1
When the MTU changes for any fr device, all NSE will recalculate their MTU. If any NSE is alive, libosmocore will crash. Related: OS#5192 Change-Id: I31ba5cefea7bbb0b74060d6664b42c58815ee2a1
2021-06-30bts_feature: Introduce feature to confiure dyn ts as sdcch8Pau Espin Pedrol1-0/+2
This feature signals support to configure Osmocom Dynamic Timeslot type as SDCCH8, on top of historically supported TCH/H and TCH/F. The idea is that when unneeded, the TS is configured as PDCH, and as soon as there's need for an SDCCH and there's none available, the TS is dynamically reconfigured to SDCCH8. Once all logical channels in the dynamic TS are released and hence becomes free, the BSC will reconfigure it to PDCH. Related: SYS#5309 Change-Id: Ifc0ca8916bd3e93e5a60a7dd7391d2588fdb5532
2021-06-30Rename osmo dyn ts enumsPau Espin Pedrol1-1/+1
They will gain support to be activated as SDCCH/8 soon too. Since new name would start to be too large, use a more generic naming for it. Related: OS#5309 Change-Id: I56dcfe4d17899630b17f80145c3ced72f1e91e68
2021-06-29add fixme: enforce 8 byte length of KcNeels Hofmeyr1-0/+4
Change-Id: I57efb0a24cb71b365189eccb5088b130fad15093
2021-06-29ns2: Ignore NSVC with data_weight 0 for datadaniel/miscDaniel Willmann1-0/+2
Change-Id: If0c2bee285f85110771326e07b513fc3e3f9d3f0 Fixes: OS#5189
2021-06-25bts_features: add feature for BCCH carrier power reduction modeVadim Yanitskiy1-0/+2
Change-Id: I69283b3f35988fc7a1a1dcf1a1ad3b67f08ec716 Related: SYS#4919
2021-06-25gsm0808: add Kc128 to Handover RequestNeels Hofmeyr1-0/+3
Change-Id: Ieb6e43eef9e57281d54d4b7c63664668df5aef3e
2021-06-25gprs_ns2_vc_fsm: reset the ALIVE response time when stopping testAlexander Couzens1-0/+1
Prevent showing a response time when the NSVC has failed. Related: OS#5089 Change-Id: I5435077d35ff1ae3d743ea1b1b8ace7f0fb913cf
2021-06-25gprs_ns2: fix missing notify towards the NSE when NSVC become blockedAlexander Couzens1-0/+1
The NSE wasn't notified when a NSVC went into the BLOCKED state from an UNBLOCKED state. Related: OS#5182 Change-Id: I09634e414e9bb966e6b5809b7de1b59fbabd413d
2021-06-25gprs_ns2: use llist_add_tail to keep orderAlexander Couzens2-6/+6
When configuring multiple NSE/BINDs the order of the configuration should be keeped. Related: OS#5181 Change-Id: Ibbc03f0780b49543b5bd97ee059f11cfd6c2a126
2021-06-21add Kc128 to gsm0808 Create Ciphering CommandNeels Hofmeyr3-10/+51
Prepare for A5/4 support in osmo-msc. Add new function gsm0808_create_cipher2() which takes a struct as argument instead of individual fields. This is akin to e.g. gsm0808_create_handover_request() below in the file, and allows backwards compatibly extending the argument list without needing a new function signature every time. Add struct gsm0808_cipher_mode_command, as argument list for gsm0808_create_cipher2(), with kc128 included. Encode the Kc128 IE in gsm0808_create_cipher2(). Implement gsm0808_create_cipher() by calling gsm0808_create_cipher2(). Change-Id: Ib3906085e0c6e5a496a9f755f0f786238a86ca34
2021-06-18vty: make function cmd_range_match() publicPhilipp Maier1-4/+4
Certain control interface commands also may require to verfy a range in their verify function. cmd_range_match() from the VTY does exactly that and the range can be specified as string, the same way as we would specify it in the VTY. Change-Id: I53fc207677f52b1dc748b01d58424839cdba807c related: SYS#5369
2021-06-18osmo_select_shutdown_request(): allow finishing pending writes on SIGTERMNeels Hofmeyr1-1/+69
Allow telling osmo_select_main* to only service pending writes (shutdown mode). Introduce API fuctions to indicate a shutdown request, and find out whether shutdown is complete. Some osmo programs have a curious sleep of few seconds upon receiving SIGTERM. The idea presumably was to finish off pending writes before halting the program. But a sleep() on program exit is annoying, especially when there usually are no pending writes, and when osmo-bsc is launched numerous times for tests. Change-Id: Ib94d4316924103459577087c2214188679db2227
2021-06-16stats_vty: Improve generation of osmo countersDaniel Willmann1-11/+10
Use section for all counter headings, the idea is that the generated doc is included below a chapter describing the implemented counters which can optionally describe individual items. If not osmo_counters are present simply omit the whole section to tidy up the manual. Those are deprecated anyway and not used in the osmo-* projects that I checked. Change-Id: I126b39cb9458e0f62efa338967e07151a0eece0f Related: SYS#5005, OS#4523
2021-06-16control_cmd: fix typoPhilipp Maier1-1/+1
Change-Id: I9deaee42aeb0ab0549cc7c4f180ad9c216b9df39
2021-06-15ctrl: Support recovering from short writePau Espin Pedrol1-1/+7
osmo_wqueue has support for it, so simply handle it correctly in the callback (updating buffer and returning -EAGAIN). Related: OS#5169 Change-Id: I6cbc7ec6ae6832e61cddf4402332ba09b142a7d4
2021-06-15ctrl: Pre-calculate required size before allocating msgbPau Espin Pedrol1-59/+28
This commit fixes crash when response is more than ~4096 chars. Furthermore, we now allocate only the required memory, not 4096 for all messages, which usually don't require it. Test needs to be adapted since it assumed there was more available space at the end of the msgb. Related: OS#5169 Change-Id: I0b8f370f7b08736207f9efed13a0663b5e482824
2021-06-13gprs_ns2_sns: bss: set gss->familyAlexander Couzens1-0/+1
gss->family (and gss->ip) was never set. So IPv6 should have never worked. Fixes: e769f5226be6 ("gprs_ns2_sns: rework IP-SNS initial remote") Related: OS#5036 Change-Id: I4e39dc5c7f766a7040645ceb62afdf6a9cfad00f
2021-06-13gprs_ns2_sns: replace ns2_sns_type with address familyAlexander Couzens1-28/+24
Reduces the code as the conversion between address family (bind) and ns2_sns_type is not needed anymore. Related: OS#5036 Change-Id: I1bcdd43af34c926d4b88491d00669422c299bef7
2021-06-13gprs_ns2_sns: refactor nss_weight_sum_data -> ip46_weight_sum_dataAlexander Couzens1-7/+7
Allow to use ip46_weight_sum_data for local endpoints as well. Related: OS#5036 Change-Id: I75d88f3da89ad13e34a3fd5ae72bd967d81f4abc
2021-06-13gprs_ns2_sns: refactor ip4_weight_sum/ip6_weight_sumAlexander Couzens1-16/+14
Use the new introduced struct ns2_sns_elems instead of the elems seperate. Related: OS#5036 Change-Id: I0956ab6085554210569188f52cae121e32fca19b
2021-06-13gprs_ns2_sns: add check for duplicates to add_ip6_elem()Alexander Couzens1-3/+8
The ip4 version already checks for duplicates. Related: OS#5036 Change-Id: I4a1528ea3427946ce465085919b2b522d3cedd07
2021-06-11bts_feature: Introduce feature to speak to PCUPau Espin Pedrol1-0/+2
This feature provides the BSC with information on whether the BTS talks the IPAC_PROTO_EXT_PCU osmocom extension over the underlying IPA multiplex of the OML link. Related: SYS#5303 Change-Id: Id62421f7f5540875ac877a187757f2cf0556bd02