aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs/gprs_sgsn.c
AgeCommit message (Collapse)AuthorFilesLines
2018-10-30Allocate sgsn_instance with tallocPau Espin Pedrol1-1/+12
Change-Id: I4a83c5799f0dbd5eb762039c6cfba671f6e465be
2018-10-30Update wrong references to bsc in sgsn codePau Espin Pedrol1-7/+7
Change-Id: I93f0dc721c2eff8a87fb9248882f24768f708713
2018-09-19GTP: refactor the echo timerAlexander Couzens1-4/+14
Move the check of the echo timer into an own function. The gtp echo timer must be re-check everytime the echo-timer has been modified or deactivated via vty. Fixes the TTCN3 SGSN_Tests.TC_attach_restart_ctr_echo Change-Id: Ia33471a9a9cfc3887facb665c82094b99932052a
2018-09-19sgsn_ggsn_ctx_drop_pdp: protect against nullpointer when MM is goneAlexander Couzens1-1/+3
When the GGSN crashs, the SGSN will be notified after it comes back. Because of the async operation, the mm ctx could be already gone. Change-Id: I507a8c2193c84f8dff7f5d669adcd3583331f289
2018-09-13gprs_gmm: introduce a GMM Attach Request FSMAlexander Couzens1-0/+6
The old GMM Attach Request handling used a recursive function which can not handle certain states and is quite complex and hard to extend. The new FSM handles such request in a FSM and can be called multiple times. Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912
2018-08-17Use osmo_clock_gettime from libosmocorePau Espin Pedrol1-1/+1
Change-Id: Ic638849c6687c376c4c0c36cc286d499a073d6ca
2018-07-24sgsn: Fix crash using new libgtp cb_recovery2 APIPau Espin Pedrol1-2/+6
When PDP CTX CREATE ACK is received with an increased RestartCtr, cb_recovery2 is called first, which will dettach ggsn from al pdp ctx (free the pdp_t). But when giving control back from the ctrl, libgtp still uses that freed ctx and sends it back to osmo-sgsn through cb_conf(). As specs state in any case that we need to handle the message containing the increased RestartCtr as valid, we then need to avoid freeing the pdp ctx and leave handling for later in cb_conf. Depends: osmo-ggsn (libgtp) Change-Id I53e92298f2f6b84d662a3300d922e8c2ccb178bc. Change-Id: I0989c00e18ca95a099e1a312940eaac71957b444
2018-07-16Forward GGSN originated DEACT PDP CTX REQPau Espin Pedrol1-7/+7
This commit fixes TTCN3 sgsn test TC_attach_pdp_act_user_deact_mt. Change-Id: I204209c017aac8a8402cbb8d0a0200540abcc954
2018-07-16sgsn: Don't attempt to delete GTP pdp ctx if GGSN was restartedPau Espin Pedrol1-5/+12
Scenario and behaviour before this commit: - Received Echo Reply from GGSN has incremented RestartCounter - func sgsn_ggsn_ctx_drop_all_pdp() is called to dettach all pdp ctx from GGSN and request the MS to deact all related ctx. - DEACT ACCEPT is received from MS, and then it tries to send DEL PDP CTX to GGSN, expecting to receive a Confirmation and only then freeing the pdp ctx. The problem is that since the initial cause of triggering was a GGSN restart, the GGSN doesn't know anything about that pdp ctx anymore, so it's not useful sending it. We can instead dettach the GGSN and libgtp ref at drop_all_pdp() time and then when we receive DEACT ACCEPT from MS we can free the pdp ctx directly. Change-Id: I1c74098e181552c218e152bf4ac5035cea770428
2018-07-16Add optional TearDownInd IE in PDP DEACT REQ towards PCUPau Espin Pedrol1-2/+1
According to 3GPP TS 24.008 Section 6.1.3.4, the tear down indicator IE maybe included in the DEACTIVATE PDP CONTEXT REQUEST message in order to indicate whether only the PDP context associated with this specific TI or all active PDP contexts sharing the same PDP address and APN as the PDP context associated with this specific TI shall be deactivated. As we don't permit/support establishing multiple PDP contexts using the same APN and PDP address, it shouldn't really make any difference. Nevertheless, we want to clear everything, so let's include it. Change-Id: Ia9bc2d0e93362a8473eac5cf4c7e8ffa41c79e5b
2018-07-13Disarm T3395 when dettaching mmctx from pdpctxPau Espin Pedrol1-3/+1
In sgsn_pdp_ctx_terminate, a pdp ctx is terminated and the mm ctx is detached. However, T3395 may still be armed and then pdpctx_timer_cb will trigger, and attempt to use the pdp->mm ctx which was already detached (set to NULL) when calling gsm48_tx_gsm_deact_pdp_req()->mmctx2msgid(). Following list of log lines shows the scenario+crash, in which osmo-sgsn is trying to deactivate the ctx all the time but the PCU doesn't ACK it, and then at some point the PDP context is forced released. osmo-sgsn/src/gprs/gprs_gmm.c:2294 MM(901700000015254/d7e9ab95) <- DEACTIVATE PDP CONTEXT REQ osmo-sgsn/src/gprs/gprs_gmm.c:1464 MM(901700000015254/d7e9ab95) -> GMM DETACH REQUEST TLLI=0xd7e9ab95 type=GPRS detach Power-off osmo-sgsn/src/gprs/gprs_gmm.c:313 MM(901700000015254/d7e9ab95) Cleaning MM context due to GPRS DETACH REQUEST osmo-sgsn/src/gprs/gprs_sgsn.c:332 MM(901700000015254/d7e9ab95) Dropping PDP context for NSAPI=5 osmo-sgsn/src/gprs/gprs_sgsn.c:434 PDP(901700000015254/0) Forcing release of PDP context osmo-sgsn/src/gprs/gprs_sndcp.c:508 SNSM-DEACTIVATE.ind (lle=0x62100001bca0, TLLI=d7e9ab95, SAPI=3, NSAPI=5) osmo-sgsn/src/gprs/sgsn_libgtp.c:310 PDP(---/0) Delete PDP Context osmo-sgsn/src/gprs/gprs_gmm.c:2294 MM(---/ffffffff) <- DEACTIVATE PDP CONTEXT REQ osmo-sgsn/src/gprs/gprs_gmm.c:305:25: runtime error: member access within null pointer of type 'const struct sgsn_mm_ctx' Program received signal SIGSEGV, Segmentation fault. 0x0000555555698c1b in mmctx2msgid (msg=0x61d0000172e0, mm=0x0) at /home/pespin/dev/sysmocom/git/osmo-sgsn/src/gprs/gprs_gmm.c:305 305 msgb_tlli(msg) = mm->gb.tlli; (gdb) bt #0 0x0000555555698c1b in mmctx2msgid (msg=0x61d0000172e0, mm=0x0) at osmo-sgsn/src/gprs/gprs_gmm.c:305 #1 0x00005555556b170a in _gsm48_tx_gsm_deact_pdp_req (mm=0x0, tid=0 '\000', sm_cause=38 '&') at osmo-sgsn/src/gprs/gprs_gmm.c:2297 #2 0x00005555556b1a2e in gsm48_tx_gsm_deact_pdp_req (pdp=0x6140000008a0, sm_cause=38 '&') at osmo-sgsn/src/gprs/gprs_gmm.c:2311 #3 0x00005555556b876c in pdpctx_timer_cb (_pdp=0x6140000008a0) at osmo-sgsn/src/gprs/gprs_gmm.c:2717 #4 0x00007ffff355eb3e in osmo_timers_update () at libosmocore/src/timer.c:257 #5 0x00007ffff356255c in osmo_select_main (polling=0) at libosmocore/src/select.c:254 #6 0x00005555556f17cb in main (argc=3, argv=0x7fffffffe298) at osmo-sgsn/src/gprs/sgsn_main.c:531 Change-Id: I2120e53ade6cabad37f9bd99e6680a453411821b
2018-07-13osmo-sgsn: ping GGSN periodically and check for restart counterPau Espin Pedrol1-2/+23
Before this commit, echo req/rsp logic was implemented in libgtp but never used in osmo-sgsn. This commit adds a timer which periodically sends a GTP ECHO Request to every GGSN if there's at least one pdpd context associated with it. This way by checking the restart counter in the ECHO Reply it can be known if the GGSN was restarted. In this case, logic already present in osmo-sgsn will terminate all pdp contexts associated with that GGSN. Change-Id: I9d714726785407859f26bbef052cd0efc28e8dae
2018-07-13Maintain per ggsn pdp ctx listPau Espin Pedrol1-10/+12
This way we can easily track all pdp context associated to a specific ggsn, which is useful to handle some scenarios, such as the one implemented in next commit, in which specs references that GSNs should ping only other GSNs with at least one pdp ctx in common. So the list of pdp ctx per GGSN is really useful too (and cheap computationally) to check if we should arm or disarm the echo procedure timer. So this commit can be seen as a preparation for next commit. Change-Id: I3bbcc0883df2bf1290ba8d4bd70db8baa494087a
2017-12-27Migrate from OpenSSL to osmo_get_rand_id()Max1-5/+4
This avoids potential licensing incompatibility and makes integration of Debian packaging patches easier. The libosmocore version requirements are fine already but for jenkins tests to pass we have to have Ic77866ce65acf524b768882c751a4f9c0635740b merged into libosmocore master. Related: OS#1694 Change-Id: I2b687b7f07ef05bbd861b8479cad5a958a3dde92
2017-12-26Use connection id when allocating rate countersMax1-3/+5
Due to recent libosmocore's change we can't allocate rate counters with the same name and index which are already allocated. This causes sgsn_mm_ctx_alloc_iu() failure for multiple subscribers. Fix this by using conn_id parameter from ranap_ue_conn_ctx. Change-Id: I1062ffdcac96c82269cab6f4e7ae50e28dc3aa44 Related: OS#2757
2017-11-28Replace '.' in counter names with ':'Pau Espin Pedrol1-14/+14
'.' is an illegal character in counter names, as they are exported via CTRL interface, where '.' has a special meaning that cannot be used by strings comprising the variable name. Change-Id: Ie7734cc42151581897d220b445984448ceb57aed
2017-11-21Replace '.' in counter names with ':'Harald Welte1-23/+23
'.' is an illegal character in counter names, as they are exported via CTRL interface, where '.' has a special meaning that cannot be used by strings comprising the variable name. Change-Id: Iec382ec4ee54beb2937431f5a9d8d1171224eebb
2017-09-06move include/openbsc to include/osmocom/sgsnNeels Hofmeyr1-8/+8
Change-Id: I281ef585fffc2644682c8282224fb1c2da5ca795
2017-08-30split off osmo-sgsn: remove files, apply build1.1.0Neels Hofmeyr1-0/+2
Change-Id: I5d27ff93e56cd13e0e70edd15e2080201e35e91f
2017-08-30move libiu to osmo-iuh/libosmo-ranapNeels Hofmeyr1-1/+10
Remove libiu here, use the functions from libosmo-ranap instead, by applying the ranap_ / RANAP_ prefix. Corresponding change-id in osmo-iuh.git is I6a3f7ad15be03fb94689b4af6ccfa828c25f45c0 To be able to run the msc_vlr tests for RAN_UTRAN_IU without Iu client headers available, add iu_dummy.h, containing mere function signatures that match iu_dummy.c and a mostly empty struct ranap_ue_conn_ctx. Make sure we can build with and without --enable-iu: include osmo-iuh headers only with --enable-iu. Change-Id: Ib8c4fcdb4766c5e575618b95ce16dce51063206b
2017-08-27Migrate from gprs_apn_to_str() to libosmocore osmo_apn_to_str()Harald Welte1-1/+2
In 2015, Jacob moved/copied related functions to libosmocore, but for some reason didn't remove the copies here. Let's follow-up on that and remove duplicated code. The libosmocore commit introducing osmo_apn_to_str() was 8114294bf29ac6e44822c0ae43d4b0819f11b022 Change-Id: I7315ffcbed8a54cca2056f313bb7783ad82d0ee9
2017-08-27check for missing result of rate_ctr_group_alloc()Harald Welte1-0/+16
In case the counter group allocation fails, we must handle this gracefully and fail the allocation of the parent object, too. RelateD: OS#2361 Change-Id: I7dad4a4d52fe05f6b990359841b4408df5990e21
2017-08-27sgsn: Fill the cch_pdp with a value coming from the tlv structureHolger Hans Peter Freyther1-5/+16
For some GGSNs we need to insert the PDP Charging Characteristics that were returned. We receive these values from GSUP and will fill them into the tlv structure when finding the ggsn context. Change-Id: I1725bfd2403d29ce3550bfcd6fcc1498426ef906
2017-08-27Implement IuCS (large refactoring and addition)Neels Hofmeyr1-0/+1
osmo-nitb becomes osmo-msc add DIUCS debug log constant add iucs.[hc] add msc vty, remove nitb vty add libiudummy, to avoid linking Iu deps in tests Use new msc_tx_dtap() instead of gsm0808_submit_dtap() libmgcp: add mgcpgw client API bridge calls via mgcpgw Enable MSC specific CTRL commands, bsc_base_ctrl_cmds_install() still needs to be split up. Change-Id: I5b5b6a9678b458affa86800afb1ec726e66eed88
2017-08-27move openbsc/* to repos rootNeels Hofmeyr1-0/+895
This is the first step in creating this repository from the legacy openbsc.git. Like all other Osmocom repositories, keep the autoconf and automake files in the repository root. openbsc.git has been the sole exception, which ends now. Change-Id: I9c6f2a448d9cb1cc088cf1cf6918b69d7e69b4e7