aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/gsm_04_08.c
AgeCommit message (Collapse)AuthorFilesLines
2017-03-16log protocol discriminators and message types by namesysmocom/iu_before_collapseNeels Hofmeyr1-6/+8
Depends: libosmocore change-id I0fca8e95ed5c2148b1a7440eff3fc9c7583898df Change-Id: If1c49faf6e1757cb16b383dd2db87b48bc94eee6
2017-03-16log: ciphering/security are implicit CM Service AcceptNeels Hofmeyr1-0/+21
Log just as prominently to mark CM Service Accept. Change-Id: I7afe9d4f69e5525ede7a7c380a2c48fb2c5054b6
2017-03-16debug log: upon bumping a conn, say why it is keptNeels Hofmeyr1-1/+2
Change-Id: I378af1fa06d8a45c01a80a381be143572e1dc41f
2017-03-16allow CM Service Request on already open connectionNeels Hofmeyr1-4/+59
Change-Id: I3c4687aafe495e60b1568e6505dbf847adab37f1
2017-03-16more specifically conclude cm service requestsNeels Hofmeyr1-12/+4
Don't end a CM Service Request "lock" too indiscriminately. Trigger only on new transactions that start. Change-Id: I4f64b8d91cfb1e61be4563594b2d6b23144af5bc
2017-03-16remove cruft: old anchor and auth codeNeels Hofmeyr1-62/+0
Change-Id: I16ceeeede46f244fd454758cc223673dd51cfc72
2017-03-16mostly cosmetic: have one msc_conn_close() with cause argumentNeels Hofmeyr1-10/+9
Change-Id: Ied7663f856cfce6e7ed1c0314fd558af85091dcc
2017-03-16Reinstate msc subscriber conn ref countingNeels Hofmeyr1-3/+2
Indeed the easiest way of ensuring all code paths can cause conn discarding while still all code paths can check on whether a conn needs to be discarded. Change-Id: I641fe36d9fa2077e3caf63cc583aaa380603bff0
2017-03-16implement utran security mode with vlrNeels Hofmeyr1-8/+29
Change-Id: Ib1e285b54cd7aaa0895e9c51a47720f446a07183
2017-03-16vlr: allow setting assign_tmsi per-subscriberNeels Hofmeyr1-1/+2
Change-Id: I7469da0ed19e1e8b292422aadfd3ae2ebc2afd57
2017-03-16ensure authentication is required on UTRANNeels Hofmeyr1-5/+8
Change-Id: I9b9ad1379324f1405bd02a05fcd7ef8c53bacbde
2017-03-16vlr on utran: transmit CommonIDNeels Hofmeyr1-0/+7
Change-Id: Ice3c71f048b097f2c2de8bd4f4508a7ca2cb1cf5
2017-03-16msc: decouple from bsc_api and btsNeels Hofmeyr1-2/+2
Change-Id: I3564291a6d20da13a8d75c71b0c425da4948d412
2017-03-16Make the code work so that the msc_vlr tests passNeels Hofmeyr1-55/+37
Change-Id: Ie8814d856bbe4c111007a696a4d26576854c134f
2017-03-16IuCS: don't remove Iu conn until release FIXMENeels Hofmeyr1-0/+6
Don't remove the gsm_subscriber_connection without an Iu Release. The 2G paradigm is to close a subscriber connection as soon as nothing else is pending. In 3G however, the conn is often discarded even though the IuCS stays open and valid, which confuses the situation: before the UE releases a bit later, we would try to page the subscriber unsuccessfully, because the UE expects to already be connected. To first fix the discrepancy of Iu vs. subscr release, never discard gsm_subscriber_connections when msc_release_connection() is called. This creates a "lazy" CN that keeps connections open as long as the UE will tolerate. It is really fast in sending many SMS in close succession, but is certainly a bad CN design choice: we should rather stay lean on connections. A subsequent commit will change this, but I decided to keep this commit as a reference, for when we'd like to test situations that should re-use an established connection. Change-Id: I012378cfa432d791146db387554ec1909de05297
2017-03-16bridge calls via mgcpgwNeels Hofmeyr1-2/+1
Change-Id: Ie259e30bc532fe9817c96562022ac33443d5747a
2017-03-16also do call assignment for MT calls, upon Call ConfirmedNeels Hofmeyr1-0/+2
Change-Id: I863fa73948f61aaffd7f4472f3abc3e44228e31f
2017-03-16IuCS: cosmetic prep for msc_call_assignment()Neels Hofmeyr1-3/+8
Rename gsm48_cc_tx_call_proc() to gsm48_cc_tx_call_proc_and_assign() to mark the place where the A-interface will send a BSSAP Assignment Request / where the IuCS-interface will send a RAB Assignment Request. Add function msc_call_assignment() to decide between A-iface and IuCS assignment, to be implemented in subsequent commit. Change-Id: I0695e233d57d13658793b0e63bb7c3ff224909a0
2017-03-16cosmetic: make gsm0408_loc_upd_rej() staticNeels Hofmeyr1-1/+1
2017-03-16LU counters: count completion and failure, not messages sentNeels Hofmeyr1-5/+1
From a human admin viewpoint it doesn't make sense to count the messages sent: When we use TMSIs, we first send a LU Accept with a new TMSI, and then expect the MS to respond with a TMSI Realloc Complete message. When that fails to come through, the LU actually ends in failure, even though a LU Accept was sent. In 3G, if a UE sends an Iu Release during LU (e.g. user enables flight mode), we cancel the LU without sending any reply at all, so nothing would be counted. Instead, count Location Updating results, i.e. completion and failures.
2017-03-16remove handle_abisip_signal()Neels Hofmeyr1-71/+0
Change-Id: I9cf80f9c2c8a53a29e42f000029e680a9922cb41
2017-03-16gsm0408_clear_request(): actually free the released connNeels Hofmeyr1-0/+2
By having conn->in_release == 1, calling msc_release_connection() has no effect and thus never frees the conn. So, after all pending requests have been discarded, also discard and free the unused connection.
2017-03-16gsm_04_08.c: iu.hNeels Hofmeyr1-0/+1
Change-Id: I624612b5d5cd70770326347634aee2a42ba88945
2017-03-16gsm_04_08: remove apply_codec_restrictions() -- TODO really?Neels Hofmeyr1-28/+0
This function is wrongly placed on the MSC level. Unfortunately I cannot remember the very plausible details that hwelte had back in the days to argue for this change. (Refactoring an old commit that fails to explain in more detail.) Change-Id: I82623847e652a59a921d2fb142b77cf22420a746
2017-03-16include msc_ifaces.h in gsm_04_08.cNeels Hofmeyr1-0/+2
Change-Id: I11be1bdfe6993f89b34319e7d1526c729d6e0cde
2017-03-16complete IuCS paging implementationNeels Hofmeyr1-5/+3
Add paging timeout to struct gsm_subscriber. Previously, paging timeout was implemented only on BSC level, where each request has its own timeout value. The MSC will still send individual requests to BSC or RNC level, where they timeout individually. However, the MSC must also have an own timeout to be sure to discard stale pagings that the BSC or RNC never replied for. Add handle_paging_resp(), copying the few libmsc relevant parts of gsm48_handle_paging_resp().
2017-03-16Iu auth wipNeels Hofmeyr1-0/+25
Change-Id: I44effcca80dc6850178174dc957bcd5608b0ae14
2017-03-16libmsc: duplicate gsm0808 / gsm48 functions (towards BSC)Neels Hofmeyr1-6/+7
In osmo-nitb, libmsc would directly call the functions on the BSC level, not always via the bsc_api. When separating libmsc from libbsc, some functions are missing from the linkage. Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also add a _tx to gsm0808_cipher_mode(): * add msc_gsm0808_tx_cipher_mode() (dummy/stub) * add msc_gsm48_tx_mm_serv_ack() * add msc_gsm48_tx_mm_serv_rej() Call these from libmsc instead of * gsm0808_cipher_mode() * gsm48_tx_mm_serv_ack() * gsm48_tx_mm_serv_rej() Also add a comment relatd to msc_gsm0808_tx_cipher_mode() in two places. Change-Id: I5b276853d3af71f5e3f0a031fd17b4fff0580020
2017-03-16Use new msc_tx_dtap() instead of gsm0808_submit_dtap()Neels Hofmeyr1-1/+1
Aim: msc_tx_dtap() shall redirect to IuCS or A interfaces depending on subscr conn. Change-Id: I30d961f16eb7b9c0ab9cc3f43198098d3f1a909f
2017-03-16gsm0408_loc_upd_rej(): remove bts use (used only for debug log)Neels Hofmeyr1-4/+2
Change-Id: I3ac38f4b701ad8308470573260fa91a4b04c2f18
2017-03-16gsm_04_08, gsm_subscriber: decouple lac from btsNeels Hofmeyr1-2/+1
The idea is to not have a direct pointer to a bts struct (into BSC land), but a LAC to resolve the BSC or RNC depending on the appropriate A or IuCS interface. subscr_update(): remove bts arg, add lac arg. Pass conn->lac to gsm48_generate_lai() instead of bts->location_area_code. Change-Id: I9f2b298a785bf4b2a1b3fcdd91b8256106b2d9de
2017-03-16libmsc: iucs dev: disable large parts of the codeNeels Hofmeyr1-0/+66
Change-Id: I3ef6ca26150b6102a0fa22a88a60d9a442d640b4
2017-03-16don't use lchan in libmscNeels Hofmeyr1-10/+10
Change-Id: Ic7ed7faa2bcc7aae799f41ed4abc2c001bfb61b7
2017-03-16gsm_04_08.c: Don't set msg->lchan nor msg->dstHarald Welte1-34/+0
the BSC-side of the API behind gsm0808_submit_dtap() is doing this resolving again anyway. So let's avoid doing it twice, and avoid having more dependency of the MSC down into the lchan details. Conflicts: openbsc/src/libmsc/gsm_04_08.c Change-Id: I14254be68ee1a48e9f1ce968233414d86c6ba9d5
2017-03-16gsup_client: allow passing a unit id to identify with HLRNeels Hofmeyr1-1/+1
Before, each GSUP client would contact the HLR with an identical unit id, i.e. "SGSN-00-00-00-00-00-00", with the result that some messages were sucked off by the wrong client. Pass explicit unit name from each gsup client user, so that OsmoMSC is "MSC" and OsmoSGSN is "SGSN". Hence the HLR can properly route the messages. Todo: also set some values instead of the zeros. Change-Id: I3f8d6dd47c7013920e2a4bde006ed77afd974e80
2017-03-16Use libvlr in libmsc (large refactoring)Neels Hofmeyr1-654/+513
Original libvlr code is by Harald Welte <laforge@gnumonks.org>, polished and tweaked by Neels Hofmeyr <nhofmeyr@sysmocom.de>. This is a long series of development collapsed in one patch. The original history may still be available as branch neels/vlr_orig. TODO: This commit may be split in several smaller changes before merging to master. Related: OS#1592 Change-Id: I702ba504ce2de93507312c28eca8d11f09f4ee8b
2017-03-16Introduce subscriber_connection ref-countingHarald Welte1-6/+10
This introduces a reference count for gsm_subscriber_connection. Every user of the connection needs to hold a reference until done. Once the reference count dorps to zero, the connection is cleared towards the BSC (which subsequently will clear any logical channels associated with it). Related: OS#1592 Change-Id: I8c05e6c81f246ff8b5bf91312f80410b1a85f15e
2017-03-16logging: auth request: use hexdump without spaces for RAND, AUTNNeels Hofmeyr1-2/+2
Change-Id: I656d8619a1adc93e2f627f4e1ba21512a7374279
2017-03-08add struct bsc_subscr, separating libbsc from gsm_subscriberNeels Hofmeyr1-3/+26
In a future commit, gsm_subscriber will be replaced by vlr_subscr, and it will not make sense to use vlr_subscr in libbsc. Thus we need a dedicated BSC subscriber: struct bsc_subscr. Add rf_policy arg to bsc_grace_paging_request() because the bsc_subscr will no longer have a backpointer to gsm_network (used to be via subscr->group). Create a separate logging filter for the new BSC subscriber. The implementation of adjusting the filter context is added in libbsc to not introduce bsc_subscr_get/_put() dependencies to libcommon. During Paging Response, fetch a bsc_subscr from the mobile identity, like we do for the gsm_subscriber. It looks like a duplication now, but will make sense for the VLR as well as for future MSC split patches. Naming: it was requested to not name the new struct bsc_sub, because 'sub' is too ambiguous. At the same time it would be fine to have 'bsc_sub_' as function prefix. Instead of struct bsc_subscriber and bsc_sub_ prefix, I decided to match both up as struct bsc_subscr and bsc_subscr_ function prefix. It's fast to type, relatively short, unambiguous, and the naming is consistent. Add bsc_subscr unit test. Related: OS#1592, OS#1594 Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e
2017-03-02subscriber conn: add indicator for originating RANNeels Hofmeyr1-1/+1
Add via_ran to gsm_subscriber_connection to indicate whether a conn is coming in via 2G/GERAN/A-Interface or 3G/UTRAN/Iu-Interface. Prepares for Iu, but also for libvlr to decide between GSM or UMTS Auth. Until actual Iu support is merged to master, this indicator will aid VLR unit testing. At some point we may also add RAN_GERAN_IU; it's not on the agenda yet, but to clearly distinguish the names if we want to add it, explicitly name the ones we have RAN_GERAN_A and RAN_UTRAN_IU. Change-Id: I93b870522f725170e4265a5543f6b680383d7465
2017-02-28silent_call: remove unfinished fuzzer interfacePhilipp Maier1-0/+2
Remove the fuzzer interface that was partially implemented in gsm_04_08.c and silent_call.c is causing problems when an SMS is sent during an active silent call. The reason for this is that gsm0408_dispatch() in gsm_04_08.c would decide to rout all uplink traffic to silent_call_rx() in silent_call.c. silent_call_rx() is a stub function that discards the data. This patch removes the fuzzer interface code by placing ifdefs around it, so that it can be re-activated by experimentators. Change-Id: Id500197d58663b3f4b1756136343670388b0a4bc
2017-02-23logging fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*Neels Hofmeyr1-8/+8
In libosmocore, my patch was merged to master a bit too soon. To accomodate the request for naming that matches the general "LOG" prefix instead of "LOGGING", a fixup was committed to libosmocore. Adjust for that. Original patch: change-id I5c343630020f4b108099696fd96c2111614c8067 The fixup: change-id I424fe3f12ea620338902b2bb8230544bde3f1a93 Change-Id: Ib2ec5e4884aa90f48051ee2f832af557aa525991
2017-02-22logging: use central filter and ctx consts from libosmocoreNeels Hofmeyr1-8/+8
The LCHAN and BTS filter contexts are actually never used, so drop them until someone adds them properly. For now use only LOGGING_{FILTER,CTX}_VLR_SUBSCR. Some of these will change to _BSC_SUBSCR once struct bsc_subscriber is introduced, and later on, struct gsm_subscriber will be replaced by vlr_subscriber so that the names will match. Depends: libosmocore change-id I5c343630020f4b108099696fd96c2111614c8067 Change-Id: Ifa82f6a461ad4c0eeddb8a38fb3833460432d16b
2017-02-09Expand chan allocation loggingMax1-1/+1
Log more data related to channel allocation: - channel type - number of paging attempts - timers fired Change-Id: Ib417a9c942c17b902dd80ff555cd9da5f91bff48
2017-02-06gsm_04_08: implement parsing of UMTS Auth responsesNeels Hofmeyr1-5/+221
Parse the longer UMTS res from the extended Auth Response Parameter IE. Parse the R99 Authentication Failure and AUTS in case of cause GSM_REJECT_SYNCH_FAILURE which indicates a SQN re-sync request. Both still end in 'not implemented' error logs, which are the places where the upcoming VLR that supports UMTS AKA will integrate. Depends on recently added constants in libosmocore in commit 55a43b801385e07a484217925ecf2379b9f54fcf aka change-id I745061ce8eb88aa23080dadcdbfe2d703c362a30 Change-Id: I4868bbeedc32fa7b8d03b9e3c66db618543d38ec
2017-02-03gsm48_tx_mm_auth_req(): support UMTS AUTNNeels Hofmeyr1-3/+20
To be able to do R99 UMTS authentication, we need to send along AUTN bytes in the Authentication Request. Add autn parameter to gsm48_tx_mm_auth_req() and conditionally append the R99 AUTN TLV to the Authentication Request message. Change-Id: I0d644559088706aa06b42b9bfe1f8c21ca6fa4da
2017-02-03gsm0408_rcv_cc: guard against NULL subscriberNeels Hofmeyr1-0/+5
Check conn->subscr against NULL. gsm0408_rcv_cc() dereferences many conn members without checking presence: the bts and lchan members may be expected to be NULL in the ongoing MSC split and 3G developments. But the conn->subscr is initially NULL, so an MS sending a CC message before something like a LU or CM Service Request will result in a segfault. Prevent that. Note: the upcoming VLR will be more restrictive on what messages are processed, this is a "backport" to the situation on current master. Change-Id: If067db7cc0dd3210d9eb1da15be6b637795a3ecf
2017-01-26various comment / whitespace tweaks (libmsc, gprs, libcommon-cs)Neels Hofmeyr1-1/+1
cosmetic ws in common_cs_vty.c, osmo_msc.c comment: tiny typo fix in gsm_04_08.c In comments, drop some unbalanced braces, because simplistic C file harvesters will break at a single opening brace even if it is in a comment. This is aimed at the fsm-to-dot.py script in libosmocore/contrib. Change-Id: I3c1fa53195a1e57d6fe0a6791c346d30ceff1251
2017-01-23cosmetic: use osmo_strlcpy() everywhereNeels Hofmeyr1-10/+9
Shorten some code and make obvious to the reader that the string copy is done in a safe way. Change-Id: I900726cf06d34128db22a3d3d911ee0d1423b1bd
2016-12-02split subscr_con_allocate()/_free() in bsc_ and msc_Neels Hofmeyr1-0/+27
Rename current subscr_con_allocate() and subscr_con_free to bsc_*, and add two separate msc_subscr_con_allocate() and _free(). The msc_subscr_con_free() ignores all lchan members. In libbsc use bsc_*, in libmsc use msc_*. Change-Id: I3cf7c7cafdf4672ec7b26058bba8a77159855257 Future: there will be distinct subscr conns for libbsc and libmsc.