aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/osmo_bsc_sigtran.c
AgeCommit message (Collapse)AuthorFilesLines
2021-10-07Get rid of lots of stubs [4/4]Pau Espin Pedrol1-1/+2
These are not needed anymore since we re-introduced libbsc, specially to avoid all this churn. Some specific methods are explicitly required to be overwritten by tests, so we specificially mark those with __attribute__((weak)) in order to be able to overwrite them. This is the last step towards fixing interdependency mess of symbols and stubs, and requires previous patches in order to have tests apssing fine. Change-Id: Ic7401b8a6eb903882e30fda1cf091ac99a254ef0
2021-06-04Use new stat item/ctr getter APIsPau Espin Pedrol1-9/+9
Generated with following and similar spatch snippets: """ @@ expression E1, E2; @@ - &E2->ctr[E1] + rate_ctr_group_get_ctr(E2, E1) """ Change-Id: I0b43f922a595d694ac0aeda80107ef9bf4e755e7
2020-10-15BSSMAP RESET: tweak loggingNeels Hofmeyr1-2/+2
It is not particularly interesting to see a periodic "Sending RESET" to an unconnected MSC in the logs. De-escalate to LOGL_INFO to make it easier to configure away these logs. Sending a RESET ACK is much more interesting, because it indicates that a connection has been established. Note that additionally, there will be a log on DMSC LOGL_NOTICE whenever a link goes up or down, so the RESET logging does not add much crucial information for operation maintenance, see a_reset_link_up() / a_reset_link_lost(). Change-Id: I86d67d19e20135c4944613c8e99580ef0e22ea8d
2020-10-15BSSMAP RESET: move cancel-paging call to osmo_bsc_sigtran_reset()Neels Hofmeyr1-1/+5
So far we would cancel ongoing Paging for a given MSC only after receiving a RESET message from that BSC. However, the typical operation would be that OsmoBSC *sends* a RESET and receives a RESET-ACK. Instead, move the call to within osmo_bsc_sigtran_reset(). This is also called when OsmoBSC considers the A-interface link to be lost, from the a_reset.c code, after multiple SCCP connection failures. Change-Id: Ia14b916be56563d18632c69a833084e71799a468
2020-10-15BSSMAP RESET: generalize a_reset FSMNeels Hofmeyr1-14/+2
Separate the a_reset FSM implementation from BSSMAP and MSC specifics, so that it can be re-used on the Lb interface. Move the FSM implementation to bssmap_reset.c and tweak, to match common practices we have generally established in our osmo_fsm implementations. Keep a_reset.h and a_reset.c and redirect to bssmap_reset.c. A difficulty is setting a proper logging category: the FSM definition allows only one fixed logging category for FSM state transitions and events. Ideally, the BSSMAP reset fsm would log on DMSC, and the BSSMAP-LE reset fsm would log on DLCS. Since that is not possible, introduce a separate DRESET logging category. This in fact matches an item on my wishlist, because if a given MSC is configured but currently not connected, the previous RESET FSM would continuously "spam" log LOGL_NOTICE messages indicating that it is resending RESET, and I often want to silence those messages without silencing the entire DMSC category. This is now easily possible by setting DRESET logging to LOGL_ERROR. There is additional "link up" / "link lost" logging on DMSC, so all interesting info is still visible on DMSC. Change-Id: Ib3c3a163186c40a93be0dea666230431172136df
2020-10-08LCS: SCCP next conn id: prepare Lb-interfaceNeels Hofmeyr1-24/+1
When adding the Lb interface, it is necessary to determine an unused conn id across *all* SCCP users. Prepare adding Lb by moving conn id creation out of the gscon code and generalizing. Change-Id: I12fcb18f6e4380f72929cfe7681bac05330a8c9a
2020-10-07LCS: implement re-use of existing A-interface connNeels Hofmeyr1-0/+13
Location Services brings a new scenario to OsmoBSC: the MSC may create an A-interface conn for a subscriber without an lchan being established (N-CONNECT from MSC to BSC, so far only for an incoming inter-BSC handover). If an MS becomes active while an A-interface conn is already established, associate with an existing conn. Change-Id: I42290f519a419ed7e8dd02a5ed0a5261b30a51e6
2020-10-03log MSC nr for opening new A connNeels Hofmeyr1-2/+2
Change-Id: Ie2df767197947b2d5ffeb882dc0827914975df88
2020-08-25Change default SCTP conn NULL->127.0.0.1 to localhost->localhostPau Espin Pedrol1-2/+5
"127.0.0.1" is changed to "localhost" to let local NSS decide whether to use IPv4 or IPv6. In newish systems, IPv6 ::1 will be selected since IPv6 takes precedence over IPv4. Similarly, the default source addr needs to be changed from NULL to "localhost" since for some yet unknwon reason, getaddrinfo(AF_UNSPEC, NULL) returns first IPv4 "0.0.0.0" and later "::", which is inconsistent with getaddrinfo("localhost") result, resulting in src=IPv4(0.0.0.0) and dst=IPv6(::1), which is incompatible and will fail. In any case, since the default remote address is a local one and it's the client side, there's no real logical change since the kernel would anyway should have taken a local address anyway. Change-Id: Ic93be6c47403e65b7c338604728570f23bc3de12
2020-08-24osmo_bsc_sigtran.c: Remove unused #definesHarald Welte1-3/+0
Change-Id: Ic21f27f67815190020f3860a9fbb5f4f1fd78a57
2020-08-13info, error log: show MSC nr for new connNeels Hofmeyr1-3/+3
Change-Id: I0a7e0a638515f48d49e2d2e1d905d9e574994fd5
2020-07-18Move struct gsm_bts: gsm_data.* => bts.*Pau Espin Pedrol1-0/+1
Place all code related to the object into the related file. Having all the data model in one file made sense in early stage of development to make progress quickly, but nowadays it hurts more than helps, due to constantly growing size and more and more bits being added to the model, gaining in complexity. Currently, having lots of different objects mixed up in gsm_data.h is a hole of despair, where nobody can make any sense were to properly put new stuff in, ending up with functions related to same object in different files or with wrong prefixes, declarations of non-existing functions, etc. because people cannot make up their mind on strict relation to objects in the data model. Splitting them in files really helps finding code operating on a specific object and helping with logically splitting in the future. Change-Id: I00c15f5285b5c1a0109279b7ab192d5467a04ece
2020-07-01create ASP+AS only once per cs7 instanceNeels Hofmeyr1-86/+140
Refactor osmo_bsc_sigtran_init(): invoke osmo_sccp_simple_client_on_ss7_id() exactly once per cs7 instance. When introducing MSC pooling to the ttcn3-bsc-tests, it became apparent that osmo-bsc rapidly huts down and re-creates the SCTP link for each configured MSC. This manifested in an osmo-stp crash (fixed in libosmo-sccp I9b3ae6dfcf6efeabb7fb6c33503d1d7924fec2fa). I first tried to fix it by only restarting an ASP when it wasn't found in the AS yet, but that created obscure problems described in OS#4635 which in turn completely broke ttcn3-msc-tests. This solution keeps osmo_sccp_simple_client_on_ss7_id() unchanged and instead invokes it exactly once per cs7 instance. Keep the same auto-config logic, but change and improve the mechanisms to achieve it: Replace the fail_on_next_invalid_cfg flag with a more accurate check against remote PC collisions between configured MSCs. Before this patch, the code made sure that at most one MSC lacks an explicit remote address (and cs7 instance), so that no two MSCs get the same default remote PC. This patch more accurately checks that no two MSCs use the same remote PC on the same cs7 instance, period, whether implicitly or explicitly configured. Before this patch, the logic amounted to creating cs7 instance 0 implicitly, but it was not very obvious: If an 'msc' has an msc-addr configured, it is associated with the cs7 instance that has this addr in its address book. If it has no msc-addr configured, then msc->a.cs7_instance_valid == false. In that case, msc->a.cs7_instance is still 0 (from talloc_zero) and hence osmo_sccp_simple_client_on_ss7_id(ss7_id = 0) created cs7 instance 0. In this patch, that logic remains unchanged, but is written out more explicitly: if any msc has no cs7 instance associated, make sure to create cs7 instance 0 beforehand. Then iterate all osmo_ss7_instances. If at least one MSC uses it, set up the SCCP client on it and connect all MSCs as appropriate. Related: OS#4625 OS#4635 Change-Id: I16f4f7f447f69525a2f57c4649ab295112904d6a
2020-06-23fix crashes due to OSMO_ASSERT(conn->lchan)Vadim Yanitskiy1-1/+1
Starting from ttcn3-bsc-test-sccplite build #777, it was noticed that osmo-bsc crashes with the following message: Assert failed conn->lchan include/osmocom/bsc/gsm_data.h:1376 The cause of this is a recently merged patch that calls conn_get_bts() during assignment_fsm rate counter dispatch: "Count assignment rates per BTS as well" commit b5ccf09fc4042c7fb1fdaaa6263961c40b32564e Change-Id I0009e51d4caf68e762138d98e2e23d49acc3cc1a The root cause being that the assignment_fsm attempts to count an Assignment event for a BTS after the lchan has already been released and disassociated from the conn. The assertion is found in conn_get_bts(), which is used in various places. In fact, each caller is a potential DoS risk -- though most are in code paths that are guaranteed to have an lchan and bts present, having an OSMO_ASSERT() on the relatively volatile presence of an lchan is not a good idea for osmo-bsc's stability and error resilience. - Change conn_get_bts() to return NULL in the lack of an lchan. - Adjust all callers of conn_get_bts() to gracefully handle a NULL return val. - Same for cgi_for_msc() and callers, closely related. Here is a backtrace: Program received signal SIGABRT pwndbg> bt 0x0000555555be6e52 in conn_get_bts (conn=0x622000057160) at include/osmocom/bsc/gsm_data.h:1376 0x0000555555c1edc8 in assignment_fsm_timer_cb (fi=0x612000060220) at assignment_fsm.c:758 0x00007ffff72b1104 in fsm_tmr_cb (data=0x612000060220) at libosmocore/src/fsm.c:325 0x00007ffff72ab062 in osmo_timers_update () at libosmocore/src/timer.c:257 0x00007ffff72ab5d2 in _osmo_select_main (polling=0) at libosmocore/src/select.c:260 0x00007ffff72abd2f in osmo_select_main_ctx (polling=<optimized out>) at libosmocore/src/select.c:291 0x0000555555e1b81b in main (argc=3, argv=0x7fffffffe1b8) at osmo_bsc_main.c:953 0x00007ffff6752002 in __libc_start_main () from /usr/lib/libc.so.6 0x0000555555b61bbe in _start () In the case of the assignment_fsm counter, we now miss a chance to increase a BTS counter for a failed Assignment, but this is a separate problem. The main point of this patch is that osmo-bsc must not crash. Related: OS#4620, OS#4619 Patch-by: fixeria Tweaked-by: neels Fixes: I0009e51d4caf68e762138d98e2e23d49acc3cc1a Change-Id: Id681dfb0ad654bdb4b71805d1ad4f39a8bf6bbd1
2020-06-03create only one SCCP user per SCCP instanceNeels Hofmeyr1-2/+6
Depends: I9ecbab16b45268f626950303d6ff8296dd6acda0 (libosmo-sccp) Change-Id: I6a2710edeb9ba047ae70e6b49d4c2e5f06d41a4e
2020-05-29drop all BSC originated USSD notification featuresNeels Hofmeyr1-22/+0
The BSC is the wrong network component to originate USSD messaging, as can be seen in the hacks in the USSD code: for example, the BSC would send a CM Service Accept message as if an MSC had accepted the connection, dispatch a USSD and directly send some RR release message (without proper tear down messaging like the lchan_fsm does these days). This made sense in the osmo-nitb world, but by now we are aiming for solid 3GPP compliance. The BSC shall not originate USSD messages. Deprecate all VTY and CTRL commands related to USSD: VTY [no] bsc-welcome-text [no] bsc-msc-lost-text [no] bsc-grace-text [no] missing-msc-text (the commands with 'no' are ignored, without 'no' lead to an error) CTRL ussd-notify-v1 Drop (already unused) ussd.h. Drop gsm_04_80.h, gsm_04_80_utils.c, and all calling code. Drop "RF grace" notification, where osmo-bsc was able to notify active subscribers that the RF was being turned off. Change-Id: Iaef6f2e01b4dbf2bff0a0bb50d6851f50ae79f6a
2020-05-16log: Adjust "new SIGTRAN connection" logging levelAlexander Chemeris1-2/+2
The "new SIGTRAN connection" message is sent on every new transaction between an MS and MSC, i.e. A LOT during normal operation. Let's demote it to INFO and clarify that this is about SCCP connection instead of a generic SIGTRAN term. Change-Id: I711b70ae84aa98f43ea3f807ea5c8464b71ca6bb
2020-05-11stats: Add counters for Tx BSSMAP messages.Alexander Chemeris1-1/+13
We already have counters for Rx side, now we also count Tx side. See comments in the msc_ctr_description array implementation for the details. Change-Id: I89a173f6bdd9a3c21233fe01d07ab2ff0442bb10
2020-05-09osmo_bsc_sigtran: Fix a SSCP-> SCCP typo in a commentAlexander Chemeris1-1/+1
Change-Id: Iee7e87922f2aa034840993b4bfad3de8defbf5f1
2020-05-09Fix a comment for the handle_unitdata_from_msc() function.Alexander Chemeris1-2/+2
Change-Id: If20632cfe63b78c2cb17c1bb9d12207a4956be64
2019-11-13Fix some typosMartin Hauke1-2/+2
Fix typos and common misspellings in code comments and in the manual. Change-Id: I46fc9d424620c77ae9ccf78b58081bd303386d7c
2019-10-11sigtran: Set default remote ip to localhost instead of nullPau Espin Pedrol1-1/+2
NULL or 0.0.0.0 should actually not be used upon connect() calls. Whoever, it worked so far because osmo_sock_init2() calls getaddrinfo() on it which does the 0.0.0.0->127.0.0.1 translation. osmo-msc already passed 127.0.0.1 as default address, so let's do the same here. Change-Id: Ib0d33c66faab78e609742638425cb8a0c382406f
2019-07-16Fix some spelling errors found by lintianRuben Undheim1-1/+1
Change-Id: I63a733f8bea69f355a6686d99c3aa194c8ac9012
2019-06-18Re-introduce support for IPA-encapsulated MGCPHarald Welte1-0/+4
Old osmo-bsc-sccplite already supported this, but in the migration over to libosmo-sigtran and to real 3GPP AoIP, this functionality got lost. We now create a UDP proxy socket. Any MGCP commands received via IPA from MSC (or rather: bsc_nat) are retransmitted to the MGW via UDP on this socket. Any responses back from the MGW received on the UDP socket are retransmitted back to MSC/bsc_nat as MGCP inside the IPA multiplex. Closes: OS#2536 Change-Id: I38ad8fa645c08900e0e1f1b4b96136bc6d96b3ab
2019-06-06bsc: Append Osmux Support IE only on AoIPPau Espin Pedrol1-2/+2
Since in SCCPlite the BSC-attached MGW is controlled by the MSC, we don't need this kind of signalling. It's only needed for AoIP. Related: OS#2551 Change-Id: I802fc65c593e42aaa7a15cecab7a2f2b77ade3ea
2019-06-06Introduce msc_is_{sccplite,aoip}() helpersPau Espin Pedrol1-2/+1
Having the helper makes it easier to read/find for transport type checks. It will be ifurther re-used in forthcoming commits. Change-Id: Ic0ee4c472e29ec3092049e5e23b744395613616d
2019-05-19bssap: Announce Osmux support on RESET (ACK) sendPau Espin Pedrol1-0/+16
Related: OS#2551 Depends on: libosmocore I28f83e2e32b9533c99e65ccc1562900ac2aec74e Change-Id: I6b5b475b6109a2882051445762e27046d015b770
2019-03-14log N-CONNECT from MSCNeels Hofmeyr1-0/+4
Change-Id: I83f15c7231b2b766aba4d25339d08acbbca3a47e
2019-03-14incoming connect: don't crash if calling addr is missingNeels Hofmeyr1-1/+0
The idea was to guard the logging, though actually that can handle a NULL ss7 quite well. Change-Id: Ib028432b37a5c48b677bb21b869cc722575dce92
2018-08-29fix dependency bug: include mgcp_client/, not mgcp/Neels Hofmeyr1-1/+1
In osmo_bsc_sigtran.c, instead of osmocom/mgcp/mgcp_common.h, include the same file from mgcp_client/. (mgcp_common.h is identically installed both by libosmo-mgcp and libosmo-mgcp-client, in their respective include dir.) Trying to include from mgcp/ breaks the debian package builds, since only libosmo-mgcp-client is installed as per osmo-bsc dependencies. The error was introduced by: commit d8f46c0074e6c2b3b693f48ca496d11a301d4923 "MGCP: add 'X-Osmo-IGN: C' for SCCPlite by default" change id I257ad574d8060fef19afce9798bd8a5a7f8c99fe Change-Id: I917b0c08ed91172ecb68c946aecb02c5109fcced
2018-08-29log: tweaks and more context in osmo_bsc_sigtran_send()Neels Hofmeyr1-4/+6
Change-Id: I3d51f17b0f6ceb0e5237b4d6d5252c701fc2fe6b
2018-08-25MGCP: add 'X-Osmo-IGN: C' for SCCPlite by defaultNeels Hofmeyr1-0/+10
Use libosmo-mgcp-client's new X-Osmo-IGN header to indicate that CallIDs are allowed to mismatch. Add VTY commands 'msc' / 'mgw x-osmo-ign call-id' and 'no mgw x-osmo-ign' to switch this behavior explicitly. For SCCPlite MSCs, unless a specific config was issued, always send 'X-Osmo-IGN: C' by default, to ignore CallID mismatches. Depends: Id7ae275ffde8ea9389270cfe3db087ee8db00b51 (osmo-mgw) Change-Id: I257ad574d8060fef19afce9798bd8a5a7f8c99fe
2018-08-07GSCON: call api of a_reset.c with msc object directlyPhilipp Maier1-7/+5
The API of a_reset.c is currently called with a pointer to struct reset_ctx. This puts the responsibility of checking the presence of msc->a.reset_fsm to the caller. It would be much more effective if the caller would check if msc->a.reset_fsm before dereferencing it. This also fixes at least one segfault that ocurrs when gscon_timer_cb() is called but no sccp connection is present yet. Therefore the pointer to bsc_msc_data would not be populated. This is now detected by a_reset.c itsself. - minor code cleanups - call a_reset.c functions with msc (struct bsc_msc_data) Change-Id: I0802aaadf0af4e58e41c98999e8c6823838adb61 Related: OS#3447
2018-08-07GSCON: avoid sending connection oriented data when not connectedPhilipp Maier1-1/+6
When no connection is present and had never existed, then conn->sccp.msc is unpopulated. However, there may be situations where osmo_bsc_sigtran_send() is executed while no connection is present. At the moment we assert on conn->sccp.msc, which would cause osmo-bsc to exit. In order to avoid this, better check conn->sccp.msc and drop the sccp message when the check is negative. - Remove assertion, add check. Change-Id: I4eaa983702224e5995a388ea9890ee04212eb569 Related: OS#3446
2018-08-07sigtran: fix memleak in osmo_bsc_sigtran_send()Philipp Maier1-1/+2
The function osmo_bsc_sigtran_send() checks if the MSC is ready by calling a_reset_conn_ready(). If it is not ready it returns with -EINVAL. The msg message buffer is not freed, so we leak memory in those edge cases. - Make sure msg is freed when MSC is not ready. - Add a comment that osmo_bsc_sigtran_send() takes ownership of msg Change-Id: Ib1ff1d20e960a356bcee276b7c1bf9c93283e7af
2018-07-28large refactoring: use FSMs for lchans; add inter-BSC HONeels Hofmeyr1-8/+43
Add FSMs: - timeslot_fsm: handle dynamic timeslots and OML+RSL availability. - lchan_fsm: handle an individual lchan activation, RTP stream and release, signal the appropriate calling FSMs on success, failure, release. - mgw_endpoint_fsm: handle one entire endpoint with several CI. - assignment_fsm: BSSMAP Assignment Request. - handover_fsm: all of intra, inter-MO and inter-MT handover. Above FSMs absorb large parts of the gscon FSM. The gscon FSM was surpassing the maximum amount events (32), and it is more logical to treat assignment, handover and MGW procedures in separate FSMs. - Add logging macros for each FSM type: - LOG_TS() - LOG_LCHAN() - LOG_MGWEP(), LOG_CI() - LOG_ASSIGNMENT() - LOG_HO() These log with the osmo_fsm_inst where present. New style decision: logging without a final newline char is awkward, especially for gsmtap logging and when other logs interleave LOGPC() calls; we have various cases where the final \n goes missing, and also this invokes the log category checking N times instead of once. So I decided to make these macros *always* append a newline, but only if there is no final newline yet. I hope that the compiler optimizes the strlen() of the constant format strings away. Thus I can log with or without typing "\n" and always get an \n termination anyway. General: - replace osmo_timers, state enums and program-wide osmo_signal_dispatch() with dedicated FSM timeouts, states and events. - introduce a common way to handle Tnnn timers: gsm_timers.h/.c: struct T_def. These can be used (with some macro magic) to define a state's timeout once, and not make mistakes for each osmo_fsm_inst_state_chg(). Details: bsc_subscr_conn_fsm.c: - move most states of this FSM to lchan_fsm, assignment_fsm, handover_fsm and mgw_endpoint_fsm. - There is exactly one state for an ongoing Assignment, with all details handled in conn->assignment.fi. The state relies on the assignment_fsm's timeout. - There is one state for an ongoing Handover; except for an incoming Handover from a remote BSS, the gscon remains in ST_INIT until the new lchan and conn are both established. - move bssmap_add_lcls_status() to osmo_bsc_lcls.c abis_rsl.c: - move all dynamic timeslot logic away into timeslot_fsm. Only keep plain send/receive functions in abis_rsl.c - reduce some rsl functions to merely send a message, rename to "_tx_". - rsl_ipacc_mdcx(): add '_tx_' in the name; move parts that change the lchan state out into the lchan_fsm, the lchan->abis_ip.* are now set there prior to invoking this function. - move all timers and error/release handling away into various FSMs. - tweak ipa_smod_s_for_lchan() and ipa_rtp_pt_for_lchan() to not require an lchan passed, but just mode,type that they require. Rename to ipacc_speech_mode*() and ipacc_payload_type(). - add rsl_forward_layer3_info, used for inter-BSC HO MO, to just send the RR message received during BSSMAP Handover Command. - move various logging to LOG_LCHAN() in order to log with the lchan FSM instance. One drawback is that the lchan FSM is limited to one logging category, i.e. this moves some logging from DRR to DRSL. It might actually make sense to combine those categories. - lose LOGP...LOGPC logging cascades: they are bad for gsmtap logging and for performance. - handle_classmark_chg(): change logging, move cm2 len check out of the cm3 condition (I hope that's correct). - gsm48_send_ho_cmd(): split off gsm48_make_ho_cmd() which doesn't send right away, so that during inter-bsc HO we can make an RR Handover Command to send via the MSC to the remote BSS. assignment_fsm.c: - the Chan Mode Modify in case of re-using the same lchan is not implemented yet, because this was also missing in the previous implementation (OS#3357). osmo_bsc_api.c: - simplify bsc_mr_config() and move to lchan_fsm.c, the only caller; rename to lchan_mr_config(). (bsc_mr_config() used to copy the values to mr_bts_lv twice, once by member assignment and then again with a memcpy.) - During handover, we used to copy the MR config from the old lchan. Since we may handover between FR and HR, rather set the MR Config anew every time, so that FR rates are always available on FR lchans, and never on HR lchans. Depends: I03ee7ce840ecfa0b6a33358e7385528aabd4873f (libosmocore), I1f2918418c38918c5ac70acaa51a47adfca12b5e (libosmocore) Change-Id: I82e3f918295daa83274a4cf803f046979f284366
2018-06-08Explicitly register CTRL-over-IPA callback with libosmo-sigtranHarald Welte1-1/+5
In Change-Id OSI6b7354f3b23a26bb4eab12213ca3d3b614c8154f we introduced a function called osmo_ss7_asp_rx_unknown() which was supposed ot override a weak symbol in libosmo-sigtran. However, the related change in libosmo-sigtran (I8616f914192000df0ec6547ff4ada80e0f9042a2) was modified later on to use explicit registration of a call-back function instead of weak symbol override. Let's adopt the osmo-bsc code to make use of this explict call-back registration. Change-Id: Id5880ec90dfa00b29cbb0ffea8c8dd50e24742bd Related: OS#2012
2018-05-27move 'extern struct gsm_network *bsc_gsmnet" to header fileHarald Welte1-3/+2
It's not a good idea to keep extern declarations copied over half a dozen C files. Let's move it to a header. Change-Id: I6f643f1393ba0955d9c0cf1cf78d5c604e7b9451
2018-05-27Remove 'struct bsc_msc_connection' + fix IPA-encapsulated CTRLHarald Welte1-0/+35
The bsc_msc_connection dates back to the old pre-libosmo-sigtran days, and 90% of the field members weren't used at all (even the new sigtran specific ones!). Let's merge what remains into struct bsc_msc_data. As a side effect, the already dysfunctional "dest A.B.C.D" VTY command has been removed from the MSC node. There's quite a bit of fall-out in the CTRL interface, which was the code with strongest ties to bsc_msc_connection. This was resolved by properly porting CTRL handling over to libosmo-sigtran, meaning that an IPA/SCCPlite connected MSC can now again send CTRL GET/SET commands, and can also receive those selective few TRAPs that old osmo-bsc-sccplite also sent to its MSC[s]. Change-Id: I6b7354f3b23a26bb4eab12213ca3d3b614c8154f Related: OS#2012
2018-05-25vty: Permit selection of other ASP protocol than M3UAHarald Welte1-1/+1
We used to have hard-coded M3UA. Let's allow the user to configure this per MSC using a new "asp-protocol (m3ua|sua|ipa)" VTY command. For SUA this should just work 1:1 without any trouble. For IPA, this of course only changes the underlying transport without reflecting the various differences in terms of BSSMAP ASSIGNMENT, MGCP handling, etc. Change-Id: I0800c709e574cedd7f5dd98be81c78782245cd13 Related: OS#2544
2018-05-17a_reset: cleanup + remove dead codePhilipp Maier1-6/+6
The function a_reset_free() is not used anywhere at the code. The reason for this is that a BSC instance is never cleared once it is started up. Also the timer number is not according to the spec. - Remove a_reset_free() - Fix timer identification number (T4) - use fi->priv to hold context info - Fix sourcecode formatting Change-Id: I72095d52304c520e383755eee6c889bce492cbd4 Related: OS#3102
2018-03-16introduce an osmo_fsm for gsm_subscriber_connectionHarald Welte1-69/+38
In the current implementation of osmo-bsc, the subscriber connection is not handled (very) statefully. However, there is some state keeping in the code that handles the mgcp connection, but there are still to much loose ends which allow odd situations to happen, which then lead severe error situations (see also closes tags at the end) This commit adds a number of improvements to fix those problems. - Use an osmo-fsm to control the gsm_subscriber_connection state and make sure that certain operations can only take place at certain states (e.g let connection oriented SCCP traffic only pass when an SCCP connection actually exists. Remove the old osmo_bsc_mgcp.c code. Use the recently developed MGCP client FSM to handle the MGCP connections. Also make sure that stuff that already works does not break. This in particular refers to the internal handover capability and the respective unit-tests. See also OS#2823, OS#2768 and OS#2898 - Fix logic to permit assignment to a signalling channel. (OS#2762) - Introduce T993210 to release lchan + subscr_conn if MSC fails to respond The GSM specs don't have an explicit timer for this, so let's introdcue a custom timer (hence starting with 99). This timeout catches the following situation: * we send a SCCP CR with COMPL_L3_INFO from the MS to the MSC, * the MSC doesn't respond (e.g. SCCP routing failure, program down, ...) The MS is supposed to timeout with T3210, 3220 or 3230. But the BSC shouldn't trust the MS but have some timer on its own. SCCP would have a timer T(conn est), but that one is specified to be 1-2min and hence rather long. See also: OS#2775 - Terminate bsc_subscr_conn_fsm on SCCP N-DISC.ind from MSC If the MSC is disconnecting the SCCP channel, we must terminate the FSM which in turn will release all lchan's and other state. This makes TC_chan_rel_hard_rlsd pass, see also OS#2731 As a side-effect, this fixes TC_chan_act_ack_est_ind_refused(), where the MSC is answering with CREF to our CR/COMPL_L3. - Release subscriber connection on RLL RELEASE IND of SAPI0 on main DCCH The subscriber connection isn't really useful for anything after the SAPI0 main signalling link has been released. We could try to re-establish, but our best option is probably simply releasing the subscriber_conn and anything related to it. This will make TC_chan_rel_rll_rel_ind pass, see also OS#2730 This commit has been tested using the BSC_Tests TTCN3 testsuit and the following tests were passed: TC_chan_act_noreply TC_chan_act_ack_noest TC_chan_act_ack_est_ind_noreply TC_chan_act_ack_est_ind_refused TC_chan_act_nack TC_chan_exhaustion TC_ctrl TC_chan_rel_conn_fail TC_chan_rel_hard_clear TC_chan_rel_hard_rlsd TC_chan_rel_a_reset TC_rll_est_ind_inact_lchan TC_rll_est_ind_inval_sapi1 TC_rll_est_ind_inval_sapi3 TC_rll_est_ind_inval_sacch TC_assignment_cic_only TC_assignment_csd TC_assignment_ctm TC_assignment_fr_a5_0 TC_assignment_fr_a5_1_codec_missing TC_assignment_fr_a5_1 TC_assignment_fr_a5_3 TC_assignment_fr_a5_4 TC_paging_imsi_nochan TC_paging_tmsi_nochan TC_paging_tmsi_any TC_paging_tmsi_sdcch TC_paging_tmsi_tch_f TC_paging_tmsi_tch_hf TC_paging_imsi_nochan_cgi TC_paging_imsi_nochan_lac_ci TC_paging_imsi_nochan_ci TC_paging_imsi_nochan_lai TC_paging_imsi_nochan_lac TC_paging_imsi_nochan_all TC_paging_imsi_nochan_plmn_lac_rnc TC_paging_imsi_nochan_rnc TC_paging_imsi_nochan_lac_rnc TC_paging_imsi_nochan_lacs TC_paging_imsi_nochan_lacs_empty TC_paging_imsi_a_reset TC_paging_counter TC_rsl_drop_counter TC_classmark TC_unsol_ass_fail TC_unsol_ass_compl TC_unsol_ho_fail TC_err_82_short_msg TC_ho_int Authors: Harald Welte <laforge@gnumonks.org> Philipp Maier <pmaier@sysmocom.de> Neels Hofmeyr <neels@hofmeyr.de> Closes: OS#2730 Closes: OS#2731 Closes: OS#2762 Closes: OS#2768 Closes: OS#2775 Closes: OS#2823 Closes: OS#2898 Closes: OS#2936 Change-Id: I68286d26e2014048b054f39ef29c35fef420cc97
2018-02-19SIGTRAN: correct wrong log categoryPhilipp Maier1-2/+2
osmo_bsc_sigtran.c uses DRANAP instead of DMSC in two places, this is not correct. - change wrong DRANAP to DMSC Change-Id: I1594d1906cf7d053d00fff52e9dc0ddfd097ed6e
2018-02-19Structural reform: Get rid of osmo_bsc_sccp_conHarald Welte1-86/+58
There was always a 1:1 correspondence between gsm_subscriber_connection and osmo_bsc_sccp_con, so there's really no point in having two separate dynamically allocated data structures with pointers back and forth and another linked list around. Let's merge osmo_bsc_sccp_con into gsm_subscriber_connection for simplicity. The resulting code might not be elegant in places, but I've tried to do only the most simple changes in this patch, while further simplifications can be done in later subsequent patches. As a side-effect, this patch also fixes lchan clearing if the MSC (or the local SCCP provider) hard-disconnects the SCCP connection. Change-Id: Idd2b733477ee90d24dec369755a00f1c39c93f39
2018-01-24cosmetic: log prim operation as textMax1-1/+2
When logging SCCP error, log failed primitive operation as text. Change-Id: I91f739cea9f518a24fff6870f7dceab8175c9646 Related: OS#2851
2017-12-23cosmetic: Hide all accesses to conn->bts behind conn_get_bts()Harald Welte1-2/+3
This is a new inline function that hides all accesses to conn->bts. A follow-up patch will then point this to conn->lchan->ts->trx->bts to get rid of the bts field. Change-Id: Ib6cf7097ced34eebe80441c29ab1534f21956a33
2017-12-19osmo-bsc: Move user plane/voice related bits into sub-structureHarald Welte1-2/+2
This clarifies which members of the struct are for what. Change-Id: I618822e6f2d48adce25f9df5c25acbce7c858412
2017-12-19remove libosmo-sccp dependency for osmo-bscHarald Welte1-3/+3
libosmo-sccp is the old sccp-lite-focused SCCP implementation that we used before libosmo-sigtran was created. The new osmo-bsc in this repository is using libosmo-sigtran and shouldn't be using parts of libosmo-sccp anymore. We only keep it around in configure.ac and Makefile.am for osmo-bsc_nat, which is not even built in this repository anymore (or 'again yet'?) Change-Id: I8f274be7d196cd7a5b1ec9ada949130fb06e984d
2017-11-10use osmo_sccp_inst_addr_name() instead of looking up ss7Neels Hofmeyr1-8/+4
Depends: libosmo-sccp I70ec5c8b42682a23f11a5820431c7e34e225709b Change-Id: Idb451597c724ac87a391121cebd0b0a927dd49d1
2017-11-09osmo-bsc: SCCP addrs: default only if unset, reject invalidNeels Hofmeyr1-32/+25
So far, if the user entered an invalid SCCP address in the config, the osmo_bsc_sigtran_init() code simply replaced that with the default, i.e. running with a completely different address than the user may intend. Use the default SCCP addresses only when they are unset by the user. Default MSC addr: set directly, do not detour via cs7 instance PC. The default MSC SCCP addr is just a point code + SSN, deriving it from the cs7 instance first is a confusing step. Just set the PC and SSN, and done. Using default addresses does not constitute an "auto configuration": if we set up a cs7 instance automatically, we do not want to have to create a second one automatically, to prevent "auto-confusion", and want to bail instead. But for each MSC on its own, using default SCCP addresses makes sense and is orthogonal to automatic cs7 instance creation. Hence drop the auto config semantics from the default SCCP address parts. Always validate the SCCP addresses we will end up using, and bail immediately if they are erratic. i.e. don't overwrite a non-empty invalid SCCP address with defaults, but straight bail. Beneficial side effects: - Fix some grammar ultra confusion in log messages. - Add context: log the MSC number the logging refers to. - Drop code dup: since we're always logging the used SCCP addresses, might as well log those once, unconditionally, in the end. Change-Id: Iadbc2e9740457e1b389b7e7ad9c94274e7d8cb11