aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/sgsn
AgeCommit message (Collapse)AuthorFilesLines
2024-08-20Replace gprs_ra_id with modern osmo_routing_area_idAlexander Couzens4-8/+9
The new modern osmo_routing_area_id is more flexible and allow to access PLMN, LAC more convient. Depends: Iaef54cac541913534af00f40483723e9952a6807 (libosmocore) Change-Id: Ia41eb8f51d3836b1bc65325ff1ec6bdb16e20c7e
2024-08-19Fix double free during RAU with unexpected Old RAIPau Espin Pedrol1-0/+1
If an MS which had an MMCTX at the SGSN sent RAU update with an unexpected Old RA field, the RAU was rejected and LLME (LLC layer) unassigned (freed), because no MMCTX was found matching the wrong old RA. However, an MMCTX may actually exist pointing to that LLME, and hence when the LLME is freed, it stayed unnoticed with a dangling pointer to the freed LLME in ctx->gb.llme. Let's try to harder to avoid this kind of bugs which make osmo-sgsn crash. Once we properly split the code into separate independent layers (LLC, MMCTX, etc.) each holding their own structs, this kind of bugs shouldn't happen anymore. Related: OS#6441 Change-Id: I5a4328c6e945b85dd815215724feecadba59c435
2024-08-04includes: add forward declartion of external typesAlexander Couzens1-0/+3
Change-Id: Ifbf0a045a6391694155f6627967f2d92b930d765
2024-08-04includes: sgsn.h: use full path include for gtp.hAlexander Couzens1-1/+1
The gtp header of ggsn have been moved to osmocom/gtp/gtp.h for a while. Use the full path to prevent clashs with older versions Change-Id: I764644110c0f332b18117e1e8311ddc55eafd5fa
2024-08-01Handle rx UpdatePDPCtxReq with Tunnel Direct Flags EI=1Pau Espin Pedrol2-1/+1
GGSN informed us that it received an Error Indication when sending DL data to the RNC. This probably means the RNC lost its state, aka crashed or was rebooted. Mark the subscriber as PMM-IDLE, release Iu and point GTPU back to SGSN. Then page the UE so it hopefully re-creates the state at the RNC. Related: OS#6512 Related: OS#6519 Related: SYS#5435 Depends: osmo-ggsn.git Change-Id Ic80a9a928c55b6ff85be96014920bb42793cb943 Change-Id: I76d4c387730fdbfb9e7e0dd23a5afb9e762228b1
2024-07-30Announce SGSN own TEID during UpdatePDPCtxReq after UE goes PMM-IDLEPau Espin Pedrol1-0/+3
When the UE/RNC closes the Iu conn (while keeping the PDP Context activated), the SGSN updates the GGSN to point the GTPU tunnel to itself. Unfortunately, only the IP address was being updated while the TEID was kept the same (the one from the RNC). As a result, when new MT data arrived at the GGSN, it would forward it over GTPU to the SGSN using the incorrect RNC TEID, which the libgtp stack at osmo-sgsn would silently drop due to not being known (because it was >PDP_MAX=1024). The issue can be triggered in test SGSN_Tests_Iu.TC_pmm_idle_rx_mt_data. Related: OS#5773 Related: SYS#5435 Change-Id: I782aa43c71569922a945bd44544bb1388bf8c878
2024-07-30Fix DeactPDPCtxAcc when UE goes PMM ENABLED but lost its PDP contextPau Espin Pedrol1-0/+1
Scenario: UE activates a PDP context, then after a while goes PMM IDLE (Iu conn is destroyed but PDP is kept). When UE connects through Iu again, it sends eg. RAU or ServiceRequest with pdp_status bitmask statis the active NSAPIs. If some NSAPI (PDP context) is enabled at SGSN but doesn't show up in the bitmask, SGSN will destroy the PDP context with GGSN (DeletePDPContextReq) towards GGSN prior to re-creating it. When SGSN receives the DeletePDPContextResp, it would forward a DeactivatePDPContextReq to the UE for a PDP context which was not known by the UE anymore, this is wrong. With this patch, the state of the NSAPI/PDP at the UE side is tracked, and used to know whether when the PDP gets deleted on the GGSN side then it needs to also be deleted on the Iu side. Change-Id: I0ccd9228d71c29248b5f510356dbfdb09565dc30
2024-01-29gsup: Use new libosmogsm struct osmo_gsup_pdp_info fieldsPau Espin Pedrol1-1/+5
This also makes sure it doesn't compile against older libosmogsm gsup versions which would break ABI. Change-Id: I0d03d368e73ab62ec631420769f6af91f2ff9987 Related: OS#6091 Depends: libosmocore.git Change-Id 70be3560659c58f24b8db529c4fc85da4bb0ec04
2023-09-18sgsn_rim: forward message based on RIM ROUTING ADDRESSPhilipp Maier1-1/+1
At the moment we parse the RAN TRANSPARENT CONTAINER to look at the destination RIM ROUTING INFORMATION. This is not correct. The SGSN should not decode the RAN TRANSPARENT CONTAINER and use the RIM ROUTING ADDRESS / RIM ROUTING ADDRESS DISCRIMINATOR IE to make the routing decision. Related: OS#6095 Depends: libosmocore.git Ibca1f08906c4ffeecdae80d4e91c6c7b05fe4f8a Change-Id: Ifd2b915ed2f05130cff8ee77714b82005c17de3d
2023-08-10sgsn_rim: get rid of MME check in sgsn_rim_rx_from_gtp:Philipp Maier1-1/+1
There is no point in checking the MME any further. When the message has reached this code path it is about to be forwarded to BSSGP, so the MME does not play a role in the following code pathes. The check also relys on the source RIM ROUTING INFORMATION IE inside the RAN TRANSPARENT CONTAINER, which we are not supposed to decode. Change-Id: I97c89aeb11537ae54d1fbea48c75619d8a92af61 Related: OS#6095
2023-01-11vty: Introduce encryption cipher-plugin-path commandPau Espin Pedrol1-0/+1
The load of plugins will eventually be moved to libosmo-gprs implementation, and path will be passed as a parameter. Once it's moved inside libosmo-gprs, it will be more strict on load failures, which can cause internally if the path doesn't exist (unless NULL is passed). Hence, add a VTY config to allow configuring the right path, and have it disabled by default. Change-Id: I4f965c7afafa193f4d7486750dd3e43cca22bb65
2023-01-11Move global mmctx list into struct sgsn_instancePau Espin Pedrol2-2/+1
Change-Id: Idf8458902321da03b9b0831dad3ad383a9c7afa1
2023-01-11Split gprs_sgsn.{c,h} -> {auth,mmctx,sgsn}.{c,h}Pau Espin Pedrol10-48/+72
Some level of split already existed, like sgsn_auth.c, but headers were entangled together. Let's clearly separate application centric code (sgsn.c/h), auth related code (auth.c/h) and mmctx related code (mmctx.c/h). Change-Id: I048a082851c1275c959649942904205b02acce2a
2023-01-11Rename bscconfig.h -> config.hPau Espin Pedrol1-1/+1
Change-Id: I007103be34c1aaab7a9375c44b226d4590fe5b24
2023-01-11Move LOGGSUBSCRP to gprs_subscriber.hPau Espin Pedrol2-5/+5
The define belongs to gprs_subscriber.h header. Change-Id: Icdb7e55ca8e90dd2ba79ccdb1a8ba650a3942ab3
2023-01-11Move sgsn_ctrl_cmds_install() declaration to sgsn.hPau Espin Pedrol2-5/+5
sgsn.h is the main header containing all misc app related contents. This is another step towards shrinking gprs_sgsn.h mess. Change-Id: I80e3a68e2e368d8c73135c850e4728bdf6cf5f09
2023-01-11Move gtphub header to include/osmocom/gtphub/Pau Espin Pedrol2-524/+0
Change-Id: I82e1f2a3bc8e22b28747a540879bd661f1704cde
2023-01-11Move global pdp_list inside struct sgsn_instancePau Espin Pedrol2-2/+1
This way pdp contexts are managed by the lifcycle of the main global struct sgsn_instance automatically. Change-Id: I725218fd54adcc68dceded5eb43675f25771bb96
2023-01-11Move sgsn_pdp_ctx to its own file pdpctx.{c,h}Pau Espin Pedrol3-74/+98
This further shrinks the mess in gprs_sgsn.h, and allows to easily see layer violations (like pdpctx.c requiring llc.h) Change-Id: Iad4da06efee7d8514ff48423bdaebc0f26413cc1
2023-01-11Move extern declarations of tall_sgsn_ctx to sgsn.hPau Espin Pedrol1-0/+1
Change-Id: Ifbd54b2e92db8d4a0e0cd1c569cfd83dd85165b8
2023-01-11gtp_{ggsn,mme}: Allocate contexts under struct sgsn_instancePau Espin Pedrol1-4/+5
This way apns are managed by the lifcycle of the main global struct sgsn_instance automatically. Change-Id: Ie65d59632a368c6957c33dca64e856ace792b2c6
2023-01-05Move global apn_list inside struct sgsn_instancePau Espin Pedrol2-2/+1
This way apns are managed by the lifcycle of the main global struct sgsn_instance automatically. Change-Id: I8cc8e540cfb64d0f130e9c0aaedf7b0835f8fe16
2023-01-05Move gtp related functions to gtp.hPau Espin Pedrol2-12/+22
The functions are implemented in sgsn_libgtp.c and hence belong to header file gtp.h Change-Id: I7f5cf2895b05e03435769548b61051e6284ccb3c
2023-01-05sndcp: Standarize unitdata function namingPau Espin Pedrol1-4/+5
Use sndcp_<sap>_type>_<op> so that it's easier to distinguish and identify them. Change-Id: Ib8825570a8f61d0a28d631f86f5244e70d3194aa
2023-01-05Move func defintions of funcs implemented in gprs_sndcp.c to gprs_sndcp.hPau Espin Pedrol2-12/+9
Move them to the correct header where they belong, so that the all the related protocol stuff is placed together. Change-Id: I9052f48a0af125bb445194f4ae94ebbe49508fda
2023-01-05Properly split llc->sndcp->gtp unitdata pathi through extra func callPau Espin Pedrol3-3/+7
Beforehand the function handling the LL-UNITDATA primitive from LLC was already submitting the packet to GTP code which had an SNDCP related name, so everything was really confusing and layer separation was not clean. Change-Id: Ia544a9dd4c0c7647b0c1b64ca110351f40820618
2023-01-05sgsn.h: Drop declaration of non existing functionPau Espin Pedrol1-3/+0
Change-Id: Idabea56d1ff89e51b517b15771a5a1ed3b050ec9
2023-01-05Move struct sgsn_subscriber_pdp_data to gprs_subscriber.hPau Espin Pedrol2-14/+16
The functions driving its lifcyecles are already in gprs_subscriber.c, and are used mainly by functions in the same file, hence move it to the related header to further shrink gprs_sgsn.h. Change-Id: Iff7be91af130a3317d57d3649c17e3d5d2540e7a
2023-01-05Move struct apn_ctx and APN related definitions to its own filePau Espin Pedrol4-15/+26
This allows further shrinking of gprs_sgsn.{c,h} and also being able to use GSM_APN_LENGTH on different headers easily (needed by follow-up patch). Change-Id: Id225ed8b84e1376f4a30f17dd4b153b6b1a6efa8
2023-01-05Move global ggsn_list into struct sgsn_instancePau Espin Pedrol2-1/+1
Change-Id: I9d4c74476b777a866af2796dd376ed50da7b5d01
2023-01-05Keep sgsn subsystems under struct sgsn_instance lifecyclePau Espin Pedrol2-4/+5
Rework initialization and destruction of several sgsn subsystems to be allocated & released together with the struct sgsn_instance. This makes it easier to destroy and recreate the entire context and allows us to start moving global variables scattered around to be under struct sgsn_instance. Change-Id: Idf60519b8e475b94d38bbb69e737132a5afaefab
2023-01-05Move related structs to gprs_subscriber.hPau Espin Pedrol2-24/+26
This allows shrinking a bit more gprs_sgsn.h and and in turn have everything much more tidy. Change-Id: Ie39b48a0d612aa632327cc5a21c833b05f5bf297
2023-01-05Fix -Werror=old-style-definitionPau Espin Pedrol1-1/+1
Change-Id: I119d4ba58d9c68df12b433b0cee924468a1473d8
2023-01-05Introduce new header file sgsn/gtp.hPau Espin Pedrol3-3/+6
It will be used to store all stuff relatd to libgtp use and GTP protocol, similar to what we already do for other protocols. Change-Id: I4aae35cd0ea401856cd822cb507d668350d07a89
2023-01-05Move gprs_sndcp_vty_init() declaration to gprs_sndcp.hPau Espin Pedrol2-1/+2
Change-Id: Iea9692e7ef9bd017d89ef654d2f2ae5b30cc4550
2023-01-05gprs_subscriber: Move API declarations to correct headerPau Espin Pedrol2-30/+28
Change-Id: Iaa1032c38fa54ad57c472d9120cfbb34b2ae90e9
2023-01-05Move struct sgsn_ggsn_ctx to its own file gtp_ggsn.{c,h}Pau Espin Pedrol3-29/+42
Similar to what we already have for struct sgsn_mme_ctx in gtp_mme.{c,h}. This is just the nth step of properly splitting different protocol layers, data model, etc. Change-Id: Iad1895f09e43e299df7bb126bf52fdb98268392e
2023-01-04Replace gprs_str_to_apn() with libosmocore API osmo_apn_from_str()Pau Espin Pedrol1-2/+0
The exact same function exists in libosmocore with a different naming. Change-Id: Ibef55a648f2d58f4fdd24fa553efde530982af2d
2023-01-04Remove unused function gprs_parse_mi_tmsi()Pau Espin Pedrol1-1/+0
Change-Id: I6fb7688bf54c7ae3ca3e06bf3a1b729fa62d82f9
2023-01-04Standarize lle and llme state enum & value_stringPau Espin Pedrol1-0/+1
Change-Id: Iaf102ce5ca60854fe7eb1af17c73a80e7c76181b
2023-01-02Move gprs_tmr_to_secs() to tests/gprs/gprs_test.cPau Espin Pedrol1-1/+0
That function is only used in the test. Let's hence move the function to the same test file in order to simplify osmo-sgsn code. Change-Id: I69d80810362d75eb93974af34f61639514f99f8a
2022-12-28Rename gprs_gb.[c,h] -> gprs_ns.[c,h]Pau Espin Pedrol2-1/+1
All remaining code in that file is NS protocol related, hence let's rename it so that we end up with one file per protocol in the Gb stack. Change-Id: I8312c8a70d60cab48764950c5b57ca02964e9db2
2022-12-28Move some functions gprs_gb.[c,h] -> gprs_gmm.[c,h]Pau Espin Pedrol2-5/+5
This leaves only NS protocol related code in gprs_gb.[c,h], which will be renamed to gprs_ns.[c,h] in a follow up patch. Change-Id: I3dcbe1d0f75cb91ec8b700e239e2ba16fff030a2
2022-12-28Create new specific file for BSSGP codePau Espin Pedrol3-6/+13
Right now there's no much code there since the related code is totally entangled with the LLC one. This will eventually change in the future when we switch to use libosmo-gprs. Hence, this commit is a preparation to have already some place to put new BSSGP specific code in the future. Change-Id: I816396ab5ccb86032bbc21b41a959934a7768780
2022-12-22Move gprs_gb_parse.[c,h] to tests/sgsn/Pau Espin Pedrol2-62/+0
That big file is really only used by tests/sgsn/sgsn_test nowadays, so let's keep it out of osmo-sgsn app code base. Change-Id: Ia5a639832f52b2f015a2800bd0d94a28d7bc689b
2022-11-04vty: Make new libgtp tdefs configurable through VTYPau Espin Pedrol1-0/+1
Related: OS#5485 Depends: osmo-ggsn.git Change-Id I10bc8e2e197c0e8753b23b684b5ae41025672bf7 Change-Id: I46e9cd158a9f2f721c69f807beb7bb67a459f4a4
2022-10-11Constify LLC/SNDCP parametersMax3-4/+4
That makes it easier to track side-effects while reading the code. Related: OS#5349 Change-Id: I903f8a747a8d3b7f734dac7b0c12373ecbb90b11
2022-09-08llc: gprs_llc_fcs(): make the input data pointer constVadim Yanitskiy2-2/+2
Change-Id: If95210fe69f915ab1010fe5916cb6bee3faeb7b9
2022-09-08gprs_llc.h: use '#pragma once'Vadim Yanitskiy1-5/+1
Change-Id: Iff748fe68dbef83589bfb5e3bea5183deb365fa6
2022-03-10Iu: add UEA encryptionNeels Hofmeyr1-0/+1
Add vty 'encryption uea 0 1 2', defaults to 'encryption uea 0' to yield previous behavior. If any UEA above 0 is enabled, include the UEA key in the Iu Security Mode Command. I noticed that only the code bit in st_iu_security_cmd_on_enter() affects the test. The same code in gsm48_gmm_authorize() seems to be dead code? But applying the patch there as well just to be safe. We cannot yet verify the chosen UEA to match a configured UEA level, because the iu_client.c does not send us message details with the RANAP_IU_EVENT_SECURITY_MODE_COMPLETE. Also we cannot yet send the set of configured UEA to the hNodeB, since, again, iu_client.c does not provide the proper API for it. The proper solution here is to completely dissolve iu_client.c and do all Iu handling in osmo-sgsn itself -- see OS#5487. Related: SYS#5516 Related: I1a7c3b156830058c43f15f55883ea301d2d01d5f (osmo-ttcn3-hacks) Change-Id: I27e8e0078c45426bf227bb44aac82a4875d18d0f