aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gprs_gmm.c
AgeCommit message (Collapse)AuthorFilesLines
2016-09-05gprs/gsm0408_gprs_force_reattach_oldmsg: check llme before useAlexander Couzens1-1/+2
Change-Id: I9385655872c4dcf46aa1d18bcc47b84aba2f34f7
2016-09-02IuPS: Change GTP-U endpoint to SGSN in PMM_IDLE and page UE when data arrivesDaniel Willmann1-1/+12
Change-Id: I47b73a40cbdda6b7c31fb2767f74f9f93d84056b
2016-09-02IuPS: Introduce function to change PMM stateDaniel Willmann1-6/+29
This is where IuPS will redirect GTP-U endpoints in a subsequent commit. Also add comprehensive logging of pmm_state transitions. Change-Id: I7c2cd1abc1805659b01dffffff31c49fe5161086
2016-09-02IuPS: GMM Attach: reset MM ctx pending_reqDaniel Willmann1-0/+1
Change-Id: I0df0f3d88085939eb617405e2013ad164eed477b
2016-09-02IuPS: sgsn_mm_ctx: add enum gprs_pmm_state field, track PMM stateDaniel Willmann1-0/+6
Iu needs to page to transfer data in PMM-IDLE state. Change-Id: Id37778cb9a0328a21c8e8246998ecdb43dd687d8
2016-09-02IuPS: RA UPD: make sure to authorize, for Iu Integrity ProtectionDaniel Willmann1-4/+7
Change-Id: I2ea2089895f8a8e125ef39d9bef70dafb2b1ce69
2016-09-02IuPS: add GMM Service Request rx and txDaniel Willmann1-0/+199
Change-Id: Ib935de22d23a15f449927840d4d59497ce22abbd
2016-09-02IuPS: send Security Mode Command, track the new_key flag.Daniel Willmann1-0/+13
Change-Id: I0b2593c2df13b79eb36975b0d302e31cfdf8bb09
2016-09-02IuPS: dev hack: init hardcoded Ki on ATT REQDaniel Willmann1-0/+29
DEVELOPMENT HACK: Our current HLR does not support 3G authentication tokens. A new HLR/VLR implementation is being developed. Until it is ready and actual milenage authentication is properly supported, we are hardcoding a fixed Ki and use 2G auth. Change-Id: Ieca45960fa941a3a706c6e479b04b9f2ef89d860
2016-09-01IuPS: add Iu response to create_pdp_conf()Daniel Willmann1-0/+25
Change-Id: Iad65ca9b77c3166d4df9a58af527e6aef7e589ee
2016-09-01IuPS: redirect Iu in various places, link Iu in sgsn-testDaniel Willmann1-6/+55
In gsm48_gmm_sendmsg(), redirect to iu_tx() for both cases of MM context present or not. In gsm48_rx_gmm_att_req(), compose an MM context marked as Iu for messages coming in from a ue_conn_ctx (passed in msg->dst). Also make sure cid is initialized to avoid introducing a compiler warning. In gsm48_rx_gmm_ra_upd_req(), look up an Iu MM context based on the presence of the ue_conn_ctx in msg->dst. In sgsn-test, add libiu and libasn1c, libosmo-sigtran, libosmo-ranap, which are now needed for an --enable-iu build. Change-Id: Ia47ffbfa6fa0f5a0cd76a379c57ef42faa0d80e3
2016-09-01IuPS: osmo-sgsn: add core IuPS impl, call iu_init()Daniel Willmann1-0/+88
Add main Iu entry points for IuPS: * gsm0408_gprs_rcvmsg_iu() * sgsn_ranap_iu_event() * sgsn_ranap_rab_ass_resp() Add main MM context management for IuPS: * sgsn_mm_ctx_by_ue_ctx() * sgsn_mm_ctx_alloc_iu() Call iu_init() from sgsn_main.c. Add asn_debug impl ("extern" from libasn1c). Initialize asn_debug VTY command (iu_vty_init()). osmo-sgsn build: add libiu and libasn1c, libosmo-sigtran, libosmo-ranap Change-Id: I469ae6ca9ef254d04ee0d2d79bdd65aebcd027b5
2016-08-27IuPS: track msg->dst aka ue_conn_ctx, commentDaniel Willmann1-0/+4
For Iu connections, msg->dst will point to the ue_conn_ctx, and we need to make sure to keep msg->dst intact when copying from/to msgb and from/to MM context. Change-Id: I90c7ca6c3655d447aaca958e0086ae6ce6f6045a
2016-08-27gprs_gmm: Fix bit mask when determining update/attach typeDaniel Willmann1-2/+6
Bit 4 is reserved in 3GPP TS 04.08 so exclude it from the type. In 3GPP TS 24.008 it indicates if a follow-on request is pending by the MS, but only in Iu mode. According to the spec it is not required to react to that request with a follow-on proceed so this field can be ignored for now. See 3GPP TS 24.008 Ch. 4.4: "Unless it has specific permission from the network (follow-on proceed) the mobile station side should await the release of the RR connection used for a MM specific procedure before a new MM specific procedure or MM connection establishment is started." as well as Ch. 4.4.4.6: "If the network wishes to prolong the RR connection to allow the mobile station to initiate MM connection establishment (for example if the mobile station has indicated in the LOCATION UPDATING REQUEST that it has a follow-on request pending) the network shall send "follow on proceed" in the LOCATION UPDATING ACCEPT and start timer T3255." Change-Id: If1dff960c406060e257dafc54132687ffc42ad8f
2016-08-22comment: gsm48_gmm_sendmsg(): add spec reference on encryptableNeels Hofmeyr1-1/+3
Change-Id: I54a3bc518bc38e38b78f6e9ea3705e4fbd5ffb98
2016-07-25sgsn: add statistics counter for GPRS and PDP packetsAlexander Couzens1-2/+17
Changing the test to allow still allocated block from the rate counters. Change-Id: Ie30e4c3084ee3a138d6b39bb5000234ac814e65f
2016-07-23gprs_gmm: remove duplicated start of T3395Alexander Couzens1-2/+1
The timer is already scheduled by gsm48_tx_gsm_deact_pdp_req(). Change-Id: I8203b939d2196f87b11c0f3b2b0ff481e572835c
2016-07-16SGSN: encrypt/decrypt only necessary framesMax1-20/+28
According to 3GPP TS 24.008 § 4.7.1.2 some GMM frames are not supposed to be ciphered. Propagate information about the necessity for encryption between MM <-> LLC to ensure only proper frames are encrypted/decrypted/dropped. Change-Id: I0358905e60d1b182f75caec81bfcc72bbbbb2aa1 Related: OS#1582
2016-07-16SGSN: add preliminary support for GPRS encryptionMax1-15/+24
It is already functional enough to allow testing with real phones. However, note - there are several limitations in the current implementation: * only default value for IOV-UI is supported at the moment * AUTN-based key material is not supported Related: OS#1582 Change-Id: I8900b906693496e4e6b35be5a86937c58039ed9e
2016-07-16SGSN: split GEA key management from TLLIMax1-8/+9
Move GEA key from TLLI assignment into separate function. Change-Id: I8a0bc907072dc19cd9535a28b5252dc0f05357cc Related: OS#1582
2016-07-16SGSN: use unique AUTH REQ referenceMax1-8/+22
The A&C reference number specified in 3GPP TS 24.008 § 10.5.5.19 identifies particular request sent by network with the related response sent by MS. The value transparently copied from request to response by MS: the spec do not specify what exactly should be in there so we use rand() to decrease chance for collisions. Note: variable named 'rand' clashes with standard function rand() so it was renamed. Change-Id: I3638821a9b4a0532b28dbbb50faa30c4082579f6 Related: OS#1582
2016-07-04SGSN: move TLLI unassignment into separate functionMax1-18/+8
Change-Id: Ia4df145ab03ebcaad70a13601cff60c488a5de54 Related: OS#1582
2016-06-05gprs_gmm.c: don't transmit NOTEXIST when mmctx is NULLNeels Hofmeyr1-1/+4
Add missing mmctx NULL check in gsm0408_rcv_gmm(). gsm48_tx_gmm_status() would dereference mmctx without checking, so we can't call it if mmctx == NULL. Follows up on recent e98ba82d2b07c835: "gprs_gmm.c: Don't try to de-reference NULL mmctx". Change-Id: If59efbde86c76ffe91a0b33be87273783a2a4a02
2016-06-02gprs: more conditionals for Gb specific actionsDaniel Willmann1-1/+1
Change-Id: I213d21b9ddbf19e56269defcc6aa65aca4947140
2016-06-02gprs_gmm.c: Perform LLME operations only if we have oneHarald Welte1-5/+7
In case the GMM message did not arrive over a Gb interface, there is no LLME (and thus the associated pointer is NULL). Don't try to perform operations on a NULL LLME. Change-Id: If7f24161cd2826f8ee238d4bc1090adf555cea4e
2016-06-02gprs_gmm.c: Make TLLI handling specific to Gb interfaceHarald Welte1-36/+60
Soem of the operations we perform in the GMM layer are specific to the GPRS/EDGE radio access network and its Gb interface. Let's make them conditional to that in preparation of supporting an Iu interface. Change-Id: I3efb7c5087afe8e2331ec17bd9fac5029f4bee6c
2016-06-02gprs_gmm.c: Don't try to de-reference NULL mmctxNeels Hofmeyr1-0/+32
There was a comment in the code that certain GMM messages require a valid mmctx pointer. However, nothing actually checked if that pointer was in fact non-NULL. We plainly crashed if a MS would send us the wrong message in the wrong state. Original patch by Harald Welte, but it broke message validity checking, resulting in sgsn_test failure. This re-implements the NULL check in a different way, as explained by in-code comment. Change-Id: I7908de65bec91599f7042549b832cbbd7ae5a9a8
2016-06-02rename gsm0408_gprs_rcvmsg() to gsm0408_gprs_rcvmsg_gb()Harald Welte1-2/+2
This is the entry point for GMM from Gb. We will create a new one for Iu, so let's be explicit rather than implicit. Change-Id: I93c074bf99db041117c0dc03dc8255879845a875
2016-06-01prepare sgsn_mm_ctx for Gb and Iu mode (UMTS)Harald Welte1-24/+24
Explicitly mark those sgsn_mm_ctx members that apply for Gb mode and (upcoming) Iu mode, respectively. Add some comments in sgsn_mm_ctx. Change-Id: Ife9b02549f284e2547f16117cf43d7a36948fc4b Tweaked-By: Neels Hofmeyr <nhofmeyr@sysmocom.de>
2016-04-29move gsm_04_08_gprs.h to libosmocoreHarald Welte1-1/+1
This requres the corresponding commit in libosmocore.
2016-04-29Start to use struct osmo_auth_vector from gsm_auth_tupleHarald Welte1-5/+7
Rather than having a 'private' structure for kc, sres and rand, we now finally (with 4 years delay) use osmo_auth_vector from libosmogsm, which encapsulates authentication vectors that can be either GSM triplets or UMTS quintuples or a combination of both. gsm_auth_tuple becomes a wrapper around osmo_auth_vector, adding use_count and key_seq to it. key_seq is no longer initialized inside gprs_gsup_messages.c, as there is no CKSN / key_seq inside the message anyway. If a usre of the code needs key_seq, they need to manage it themselves.
2016-03-1504.08: apply new transaction id inline functionsNeels Hofmeyr1-4/+4
libosmocore recently added inline functions to relieve callers from applying bitmasks and bit shifts to access the transaction id of a GSM 04.08 header. Apply these functions.
2016-03-1504.08: apply new bitmask functions, fix bitmask useNeels Hofmeyr1-1/+1
Replace hardcoded protocol discriminator and message type bitmasks with function calls recently introduced in libosmocore. Note that the release 98 bitmasks slightly differ from the release 99 bitmasks. This patch uses the "default" gsm48_hdr_msg_type invocation, thus it depends on libosmocore whether 98 or 99 bitmasks are used. In some places, use of the bitmask was erratic. Fix these implicitly by employing the bitmask functions: * silent_call.c: silent_call_reroute(): add missing bitmask for MM. * bsc_msg_filter.c: bsc_msg_filter_initial(): RR vs. MM messages. * osmo_bsc_filter.c: bsc_find_msc() and bsc_scan_bts_msg(): RR vs. MM messages. * bsc_nat_rewrite.c: bsc_nat_rewrite_msg(): SMS vs. CC messages. * bsc_ussd.c: no bitmask is applicable for the message types used here. * gb_proxy.c: gbproxy_imsi_acquisition(): missing bit mask for pdisc. In gprs_gb_parse.c: gprs_gb_parse_dtap(), add a log notice for unexpected message types.
2016-02-22sgsn: Re-add searching for MM ctx based on TLLI / P-TMSI matchesJacob Erlbeck1-3/+23
If an MM context cannot be found based on BBSGP info and a RA UPDATE REQUEST is received, try to find an MM context with an P-TMSI from which the TLLI could have been derived. This also checks, whether the routing area matches. This is similar to the old behaviour removed by the commits "sgsn: Only look at TLLIs in sgsn_mm_ctx_by_tlli" and "sgsn: Remove tlli_foreign2local", except that this will only be done for RA UPDATE REQUESTs now. Sponsored-by: On-Waves ehf
2016-02-22sgsn: Change handling of missing mmctx in gsm48_rx_gmm_ra_upd_reqJacob Erlbeck1-3/+15
Currently the MM context is just overwritten by a call to sgsn_mm_ctx_by_tlli(msgb_tlli(msg), &old_ra_id) even if it has already been found by using the BSSGP info. With the changes made to sgsn_mm_ctx_by_tlli this will never find a MM context if the routing area has changed. If the routing area has not changed, the mmctx has already been found if it exists. This commit splits searching for an MM context (if it hasn't been found already) from checking, whether a found one can really be used. The actual search is removed, so that the MS will be forced to restart the attach procedure, which is less efficient but safe. Sponsored-by: On-Waves ehf
2016-01-30gsm0408: Provide unique strings for the gsm 04.08 messageHolger Hans Peter Freyther1-18/+18
At Rhizomatica we see that some GSM 04.08 messages are leaked and have no other indication if that is Call Control, SMS or something else.
2015-08-18Use 'ROUTING AREA' consistently, not 'ROUTEING AREA'Harald Welte1-1/+1
The spec unfortuantely uses both terms and has no consistent spelling, but in our logging output we can at least try to be consistent.
2015-08-18GSM/GPRS 04.08: Don't print numeric mobile identity typesHarald Welte1-6/+7
I guess none of our users knows what a mi_type=0x02 is, but most would know what an IMSI or a TMSI is. So let's use the newly introduced gsm48_mi_type_name() function to fix this.
2015-08-18GMM: fix format string compiler warningHarald Welte1-1/+1
2015-08-18GMM: Don't use DGPRS logging category from GMMHarald Welte1-2/+2
2015-08-18GMM: use MMCTXP whenever possible to include MS identity in log outputHarald Welte1-14/+17
2015-08-18GMM: add hexdump in case of unknown pdisc/msgtypeHarald Welte1-6/+6
2015-08-18sgsn: make all SGSN timers configurable via the VTYHarald Welte1-36/+15
2015-06-02sgsn: Simplify finding/using the first address of the resultHolger Hans Peter Freyther1-7/+2
The loop was used to print all returned addresses but we can simply pick the first one. This is fixing a coverity issue that the loop will be executed eaxactly once (and that was on purpose). Simplify the code and just take the first element (which might be NULL). Fixes: Coverity CID#1302852
2015-05-29ggsn: The id is a uint32_t don't print it as signedHolger Hans Peter Freyther1-1/+1
This was noticed as I started to use UINT32_MAX for dynamically created GGSNs.
2015-05-25sgsn: Allow to resolve the IPv4 address of a GGSN through DNSHolger Hans Peter Freyther1-10/+141
For real networks we need to check if the requested APN string is allowed and then resolve the GGSN address through DNS. There are countries with two or three digit MNCs and one could either try to keep a list of countries that have two/three digits or just try both of them. I have opted for the later for the ease of the implementation. C-Ares doesn't allow to cancel a request so we will need to have the MMCTX and the Lookup have different lifetimes. We simply set ->mmctx to NULL in case the MMCTX dies more early. The selected and verified apn_str will be copied into the out parameter. In case no static APN/GGSN config is present and the dynamic mode is enabled a request will be made.
2015-05-25sgsn: Create a copy of the msgb for later usageHolger Hans Peter Freyther1-3/+35
When needing to do an asynchronous DNS query we need to keep the TLV data around. So create a wrapper that takes a copy of it and frees it after the call. I can change the code to add an out parameter to decide if the msgb should be freed or not. Pick network failure in case the msgb could not be cloned in the hope the MS will retry then.
2015-05-25sgsn: Re-factor the activate PDP code for future changesHolger Hans Peter Freyther1-24/+39
A real SGSN will dynamically resolve the APN name into the GGSN IP Address. This means that after we have collected all information we need to start to resolve the GGSN and then can continue.
2015-05-24sgsn: Extract the hlr Number into the mm contextHolger Hans Peter Freyther1-0/+38
Include the hlr-Number of the subscriber in the CDR. This is useful for debugging and understanding which equipment was used during the test. In contrast to the MSISDN the '+' is emitted as the number must be in international format already.
2015-05-06sgsn: Add various signals consumed by CDR or other client codeHolger Hans Peter Freyther1-1/+30