aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmsc/a_iface_bssap.c
AgeCommit message (Collapse)AuthorFilesLines
2019-01-24Handle LCLS-NOTIFICATION message from BSSMax1-0/+25
Change-Id: Ibf5f9cad1f70aee56d5bca8fe09a24ca417e7a63 Related: OS#2487
2019-01-12add LOG_RAN_CONN() to use the conn->fi->id for contextNeels Hofmeyr1-0/+3
For each conn, set a default logging category, to distinguish categories for BSSMAP and RANAP based conns. LOG_RAN_CONN(): log with the conn's default category, LOG_RAN_CONN_CAT(): log with a manually set category (mostly for keeping previous DMM logging on the same category). In some places, replace LOGP() using manual context with LOG_RAN_CONN(), and remove the manual context info, now provided by the conn->fi->id. This is loosely related to inter-BSC and inter-MSC handover: to speed up refactoring, I want to avoid the need for manual logging context and just use this LOG_RAN_CONN(). Change-Id: I0a7809840428b1e028df6eb683bc5ffcc8df474a
2019-01-04use osmo_rat_type from libosmocoreNeels Hofmeyr1-2/+2
Replace locally defined enum ran_type with libosmocore's new enum osmo_rat_type, and value_string ran_type_names with osmo_rat_type_names. The string representations change, which has cosmetic effects on the test suite expectations. Depends: I659687aef7a4d67ca372a39fef31dee07aed7631 (libosmocore) Change-Id: I2c78c265dc99df581e1b00e563d6912c7ffdb36b
2018-12-11Revert "move ASS-COMPL MGCP handling out of a_iface_bssap.c"Neels Hofmeyr1-1/+51
Two reasons: - the caller of msc_mgcp_ass_complete() from Iu, iucs_rx_rab_assign(), failed to be adjusted, breaking IuCS, as an --enable-iu --enable-werror build shows. Unfortunately our gerrit verification doesn't --enable-werror for osmo-msc. - the condition of requiring ST_MDCX_RAN is faulty, breaking GSM CS. This reverts commit 212c0c9bdaf1166e3bcbab85f3ab31dc17162f5b. Change-Id: I8348675c2f7c8856ea1682d05ee54160d4cfeb96
2018-12-10move ASS-COMPL MGCP handling out of a_iface_bssap.cNeels Hofmeyr1-51/+1
BSSMAP Assignment Complete: sort MGCP handling upon Assignment Complete to the proper locations. a_iface_bssap.c is not the right place to invoke the MGCP related procedures. - in a_iface_bssap.c only decode the IEs. - call ran_conn_assign_compl() and pass decoded values. - drop msc_assign_compl(), it was dead code; instead: - add ran_conn_assign_compl() - pass on all MGCP related info to msc_mgcp_ass_complete() - move all MGCP ctx related handling from a_iface_bssap.c to msc_mgcp.c. I'm dropping some comments to save some time, because if I adjust them IMHO they would still anyway restate the obvious. ran_conn_assign_compl() is now quite a thin shim, but it makes sense to have it: - This is the place that should tear down the ran_conn in case assignment failed, left for a future patch. - In the light of upcoming inter-MSC handover, ran_conn_assign_compl() will be the place where the Assignment Complete message might be relayed to a remote MSC. Change-Id: I8137215c443239bddf3e69b5715839a365b73b6c
2018-12-07ASS-COMPL: do not fire Sec Mode Compl eventNeels Hofmeyr1-4/+0
BSSMAP Assignment Complete: Do not invoke ran_conn_rx_sec_mode_compl(), that's just weird. Instead this should call msc_assign_compl(), which is currently dead code and does nothing ... and there are some more strings attached, being resolved in a subsequent patch. Change-Id: I448fdb783364628005437b3d866d1a076a9767d7
2018-11-30combine several small .h in msc_common.hNeels Hofmeyr1-1/+0
For hysterical raisins, there are some header files that contain few declarations, and where the name doesn't reflect the content. Combine them to new msc_common.h: - common.h - common_cs.h - osmo_msc.h Change-Id: I9e3a587342f8d398fb27354a2f2475f8797cdb28
2018-11-30rename some RAN conn related stuff to ran_conn_*Neels Hofmeyr1-12/+12
Following previous rename of gsm_subscriber_connection: Some functions and #defines are still called like "msc_conn" or just "msc_", while they are clearly about a RAN conn. To avoid confusion with the future separate concepts of MSC roles and a RAN connection, rename all those to match the common "ran_conn" prefix. Change-Id: Ia17a0a35f11911e00e19cafb5d7828d729a69640
2018-11-30rename gsm_subscriber_connection to ran_connNeels Hofmeyr1-30/+30
In preparation for inter-BSC and inter-MSC handover, we need to separate the subscriber management logic from the actual RAN connections. What better time to finally rename gsm_subscriber_connection. * Name choice: In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it "bss_conn": in 3G a BSS is called RNS, IIUC. The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network. * Rationale: A subscriber in the MSC so far has only one RAN connection, but e.g. for inter-BSC handover, a second one needs to be created to handover to. Most of the items in the former gsm_subscriber_connection are actually related to the RAN, with only a few MM and RTP related items. So, as a first step, just rename it to ran_conn, to cosmetically prepare for moving the not strictly RAN related items away later. Also: - Rename some functions from msc_subscr_conn_* to ran_conn_* - Rename "Subscr_Conn" FSM instance name to "RAN_conn" - Rename SUBSCR_CONN_* to RAN_CONN_* Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-30drop msc_compl_l3() return valueNeels Hofmeyr1-13/+2
msc_compl_l3() always returns MSC_CONN_ACCEPT, because the conn FSM handles (or should handle) all reject cases. The accept/reject return value is a legacy from libbsc internally passing a conn over to libmsc, in osmo-nitb. Drop enum msc_compl_l3_rc. Change msc_compl_l3_rc() to return void. Change all callers to always act like for acceptance, as they always did anyway. Drop some local variables now no longer needed. Adjust the comment to msc_compl_l3(). Drop a bunch of #if-0'd code from msc_compl_l3(). Change-Id: I759d15f4e820d5fc16397ed7210ce92308e52a09
2018-11-23osmo_msc: remove unused parameter from msc_dtap()Philipp Maier1-1/+1
The parameter link_id in the function msc_dtap() is unused. Lets remove it. Change-Id: I7ba67b0cb514c91bc87a7b396ed3962b7a68e7da
2018-11-20Use libosmocore to function to parse cipher mode reject causeMax1-6/+7
This allow us to handle both regular and extended cause transparently. Change-Id: I7742ac41dd0642a5a40ce79d23250f8d9e6ae556 Related: OS#3187
2018-11-20Use BSSAP-specific TLV parser from libosmocoreMax1-1/+1
Change-Id: Iae1a3ffcebf1b0b95e61cd5dffe7ef734796fcfc
2018-11-02Add counters for BSSMAP cipher mode messagesMax1-0/+6
Count COMPLETE and REJECT messages. Besides general troubleshooting that's also useful for TTCN-3 tests to check that OsmoMSC processed those messages as expected. Change-Id: I5822b2b38b64f1a691b26c926a8e2bece21dc624 Related: OS#3187
2018-11-02Properly parse cause in cipher mode rejectMax1-5/+6
Use appropriate TLV routines to get and log the value of rejection cause. Change-Id: I26b3eb0deff6dbd217b23d284bbc6e6a9eebc8e6 Fixes: OS#3187
2018-08-07mgcp: use codec information returned with ASSIGNMENT COMPL.Philipp Maier1-0/+48
When the assignment completes a choosen codec is returned. At the moment we do not use this information. - add struct members for codec info (both, RAN and CN) - parse codec info in BSSMAP ASSIGNMENT COMPLETE - use codec info on mgcp Since the MNCC API is not complete yet, we currently only use the codec info only on the internal MNCC yet. Change-Id: I9d5b1cd016d9a058b22a367d0e5e9f2ef447931a Related: OS#2728
2018-05-17a_reset: cleanup + remove dead codePhilipp Maier1-4/+4
a_reset.c/h was originally developed to be used in both, bsc and msc without changes. Unfortunately no suitable library has been found for a_reset.c/h so the file ended up as duplicated code in both split brances. Eventually we decided to specialize the generalized code again, which means some of the functions needed only by osmo-bsc are removed. - Remove dead code - Fix timer identification number (T16) - use fi->priv to hold context info - Minor cosmetic fixes Change-Id: I8e489eb494d358d130e51cb2167929edeaa12e92 Depends: libosmocore I36d221c973d3890721ef1d376fb9be82c4311378 Related: OS#3103
2018-04-11fix BSC Clear RequestNeels Hofmeyr1-8/+2
On receiving a Clear Request, don't send a Clear Command "out of band", let the FSM do the release handling by invoking msc_subscr_conn_mo_close(). Fixes: ttcn3 MSC_Tests.TC_lu_clear_request Change-Id: I168b889ac7989641cc679b781dcffb87ff13a710
2018-04-11properly receive BSSMAP Clear Complete and Iu Release CompleteNeels Hofmeyr1-4/+16
When sending a BSSMAP Clear or Iu Release, do not immediately discard the conn, but wait until a BSSMAP Clear Complete / Iu Release Complete has been received. Hence we will no longer show in the log that an incoming Release/Clear Complete belongs to an unknown subscriber, but will still be around to properly log the release. Related: OS#3122 Change-Id: Ie4c6aaba3866d6e5b98004e8870a215e8cf8ffc1
2018-04-09DTAP: Ensure proper DLCI is used in MSC-originated DTAPHarald Welte1-0/+2
The DLCI field of the DTAP header indicates the SAPI as well as the data link (main DCCH or SACCH). We must make sure to use the correct DLCI when sending DTAP to the BSC. We achieve this by * storing the DLCI in the msgb->cb while parsing the DTAP header * storing the received DLCI (from msgb->cb) in the transaction for mobile-originated transactions * using the trans->dlci to sent msgb->cb when transmitting L3 * filling the DTAP DLCI value from msgb->cb when transmitting DTAP For MSC-originated transactions, we choose a DLCI value corresponding to the service (SAPI=0 for CC, SAPI=3 for SMS) and store that in trans->dlci. Closes: OS#3150 Change-Id: If511b20f52575054cab1346d99a8cb68d827fdbf
2018-04-05unify allocation of gsm_subscriber_connectionNeels Hofmeyr1-6/+1
The current msc_subscr_con_allocate() was in fact only used by msc_vlr_tests, while both a_iface_bssap.c and iucs.c did their own duplicate code of allocating the gsm_subscriber_connection struct. Unify. Drop the old msc_subscr_con_allocate(), instead add msc_subscr_conn_alloc(). The new function also takes via_ran and lac arguments directly. The conn allocation will soon be closely tied to the subscr_conn_fsm instance allocation, so place the new function definition alongside the other subscr_conn_fsm API, and match its naming ("conn"). Related: OS#3122 Change-Id: Ia57b42a149a43f9c370b1310e2e1f512183993ea
2018-04-03cosmetic: rx_bssmap: read message type once into local varNeels Hofmeyr1-4/+6
Instead of referencing msg->l3h[0] all the time, use local variable msg_type. Related: OS#3122 Change-Id: If70c9fa00edd462d3470bded6eb2c6521e4d9234
2018-03-21cosmetic: remove unused variablePhilipp Maier1-4/+0
Change-Id: Ic19d0401557d506d104b82f88b4dcf72055d62e1
2018-03-18a_iface_bssap: Treat inbound RESET as implicit RESET ACKHarald Welte1-0/+4
If both sides are sending RESET at the same time, they are not aware of each other. This leads to synchronization problems in wich the remote side is transmitting e.g. a COMPL L3 INFO after receiving a RESET ACK, but before even receiving or processing the RESET in the inverse direction. So let's treat receiving a RESET as an implicit RESET ACK to any RESET we may have sent. Change-Id: I0ae34fbb3735592bb7cffa5aaf421b14a8acc90e
2018-03-18BSSAP: Return error code if COMPL L3 with no or too short L3 payloadHarald Welte1-0/+6
Change-Id: Ie3bf1351ed11a9eb261737c2da0361e632e7b6e5
2018-03-15use libosmocom to parse cell identifier in bssmap_rx_l3_compl()Stefan Sperling1-18/+49
Use the new gsm0808_dec_cell_id_list2() API to decode the cell identifier in the bssap COMPLETE LAYER 3 information message. Also, actually compare the MCC-MNC in WHOLE_GLOBAL and LAI_AND_LAC cell identifiers to the network configuration, and drop messages with mismatching MCC-MNC (addresses OS#2980). Related: OS#2847 Related: OS#2980 Change-Id: I855477507e4d65fb9890da0ceea26dd2c4dfaf82
2018-02-28implement support for 3-digit MNC with leading zerosNeels Hofmeyr1-9/+4
Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout the code base to be able to handle an MNC < 100 that has three digits (leading zeros). Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore), Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore) Change-Id: I82f0016d9512ee8722a3489a3cb4b6c704a271fc
2018-02-16libmsc: bssap: Remove fixme and properly update msgb tailPau Espin Pedrol1-3/+2
Change-Id: I28073efd5cff58cd212341bceee784caf08d5ad8
2018-02-14libmsc: bssap: Catch TLV parse failuresPau Espin Pedrol1-1/+7
Change-Id: I1d1951f4a5daf200e85c76fea14a35e952491d27
2018-02-14libmsc: bssap: Refactor rx paths to to avoid parse_tlv code duplicationPau Espin Pedrol1-67/+58
Change-Id: I6aef9a94fa5b2e0b62a9c1744b8e18e5985f788f
2018-02-14libmsc: bssap: Fix typo in log messagePau Espin Pedrol1-1/+1
Change-Id: I941cd7f4e9eec3e4f2786100a0e64770d5aee4a7
2018-02-09a_iface: Fix heap-use-after-free by cleaning up msgb ownershipHarald Welte1-69/+17
When we receive a msgb-wrapped primitive from the SCCP provider (stack), it transfers msgb ownership to us (the SCCP user). The existing code passed the msgb ownership down into all the various downstream functions, which each then had to take care of msgb free'ing. Not all of the paths did eventually free the msgb. And at least one path used data from the primitive *after* the free Let's restructure this in a way that no msgb ownership is transferred down the call chain. Instead, there's one common msgb_free() in sccp_sap_up(). We can do this as nobody is queueing or otherwise keeping the msgb. Change-Id: Ie65616ccb55ec58a0224bbe3c8e004e6029ef3e6 SUMMARY: AddressSanitizer: heap-use-after-free /home/laforge/projects/git/osmo-msc/src/libmsc/a_iface.c:538 in sccp_sap_up
2018-02-09Introduce new BSSAP logging category/subsystemHarald Welte1-21/+21
Having all BSSAP related logs in the "DMSC" category is overly generic, and dosn't provide useful granularity. Change-Id: Id1e52dad03840dfd026fb23f3845a8771c8cc308
2018-02-09a_iface: Add copyright statement (after recent contributions)Harald Welte1-0/+1
Change-Id: I3f5dedb045a9ae9b93b00a8388a73ed77e67f19f
2018-02-09cosmetic: a_iface: More logging harmonizationHarald Welte1-4/+4
Change-Id: I66139862c4d821fcce0334207ce84fffbd08b4e3
2018-02-09a_iface: centralize lookup of subscriber_connHarald Welte1-73/+42
There's little point in resolving the gsm_subscriber_connection in each and every function handling connection-oriented messages. We can resolve it once and dispatch the already-resolved conn into the function, instead of passing the raw sccp_user and a_conn_info. Change-Id: Iea85527ea4d4cde7b36cc28a8027362c1570518f
2018-02-09cosmetic: No need for 'break' after 'return'Harald Welte1-11/+0
This just makes the code longer with no added benefit. Change-Id: If689b8284a669021219eff0397c6e90570e2aaa4
2018-02-09cosmetic: a_iface: Harmonize log statementsHarald Welte1-8/+8
Clean up the log statements in a_iface*.c, which was very inconsistent. For example "BSC sending" is very confusing. We are receiving from the BSC, and it did already send the message, it is no longer in the process of sending it if we have already received it in the MSC. Change-Id: Id50e964d86713ae506d4e7657159797e09501d99
2018-02-09a_sccp_rx_dt(): Don't print hexdump of message multiple timesHarald Welte1-2/+0
We don't need to hexdump it in a_sccp_rx_dt() and then again in rx_bssmap() or rx_dtap(). Change-Id: I2caa8e0af236983430155f9c808de913377d5780
2018-02-09a_iface_bssap.c: Use LOGPCONN() whenever possibleHarald Welte1-18/+18
Change-Id: Ic1c9d14b892154d51165598338d23a924a772265
2018-02-09a_iface: Reduce log levelsHarald Welte1-16/+16
During normal operation, regular messages occurring during processing of a call / transaction should not be higher than LOGL_INFO. Change-Id: Ibd04ade47b249406696c7d0b660474afc4f4adee
2018-02-09cosmetic: Use msgb_hexdump*() rather than manual osmo_hexdump() on msgHarald Welte1-2/+2
This requires libosmocore Change-Id I98e85397fb541ee0fd711f2e1852f63f3bb87359 Change-Id: Ieeb97a9f1eba2fdef84294b8c8c7ac0984ae5c70
2018-02-09Don't answer to BSC-originated RESET with another RESETHarald Welte1-9/+14
If the BSC is contacting us for the first time and sending a BSSMAP RESET, then we should simply ACK that and transition into the "connected" state, where connection-oriented and connectionless procedures are permitted. This patch is a bit large for such a seemingly simple behavioural change, but the existing data model didn't permit a more straight-forward implementation. Change-Id: Ie67e7ed20a6c42afe99bafef96d85a4e083dd057 Closes: OS#2914
2018-02-05mgcp: use osmo-mgw to switch rtp streamsPhilipp Maier1-5/+2
in the current implementation we still use osmo-bsc_mgcp, which has many problems and is also obsoleted by osmo-mgw. integrate osmo-mgw and re-implement the current switching using an osmo fsm. Depends: osmo-mgw Iab6a6038e7610c62f34e642cd49c93d11151252c Depends: osmo-iuh I3c1a0455c5f25cae41ee19229d6daf299e023062 Closes: OS#2605 Change-Id: Ieea9630358b3963261fa1993cf1f3b563ff23538
2017-12-20cosmetic: rename sccp_rx_udt and sccp_rx_dt to a_*Neels Hofmeyr1-2/+2
These rx functions are only used for the A interface, hence the names should not suggest general SCCP rx (which Iu also has). Change-Id: I6815c3d4dea4c2abfdff1cf0239ada6a9254f351
2017-12-18a_iface_bssap: compiler warning: cast const away from TLV val for l2hNeels Hofmeyr1-2/+2
Change-Id: Id91a4299391ff0d0e4e28ed05c2f755b9702146a
2017-09-15Remove rest_octets.hMax1-0/+4
The MSC should not fiddle with low-level SI details like rest octets anyway. Unfortunately simply removing the header is impossible as it causes massive fallout due to missing includes. Fixed it as well. The only other parameter which required removal is cell_ro_sel_par which is not referenced anywhere in the code anyway. Change-Id: Ibff77330de056fad4288cd4c48d016aad8105354
2017-09-11a_iface: fix memory leaksPhilipp Maier1-6/+8
Fix multiple memory leaske in A/BSSMAP code Change-Id: I90703c96e6a266a1cfa60b184139375aeb9ae32d
2017-09-08use separated libosmo-mgcp-client, apply rename to mgcp_client_*Neels Hofmeyr1-2/+2
After osmo-mgw changes I8e0b2d2a399b77086a36606f5e427271c6242df1 and I99f7faab637cfcc22ece64a1dbcbe590f2042187, apply linking of new libosmo-mgcp-client and renames to drop the "gw" from mgcp_client_*. Also rename the gsm_network.mgcpgw to mgw, to indicate that the MGCP client is used to contact the MGW (Media Gateway). Depends: I8e0b2d2a399b77086a36606f5e427271c6242df1 (osmo-mgw) I99f7faab637cfcc22ece64a1dbcbe590f2042187 (osmo-mgw) Change-Id: I093ad02ca0e532f659447c785e09678b3e6f220d
2017-09-06rename include/openbsc to include/osmocom/mscNeels Hofmeyr1-6/+6
Change-Id: I1f96a1285bbd1b4607614856bca935d5c26e2da9