lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

July 2025

  • 1 participants
  • 1492 discussions
[M] Change in osmo-ttcn3-hacks[master]: msc: Introduce test TC_stat_bsc_sctp_disconnected
by pespin 10 Jul '25

10 Jul '25
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40636?usp=email ) Change subject: msc: Introduce test TC_stat_bsc_sctp_disconnected ...................................................................... msc: Introduce test TC_stat_bsc_sctp_disconnected Related: OS#5917 Depends: osmo-msc.git Change-Id Ice1b2c163b1b0d134fcaa1c8bf543038a35fabdf Change-Id: I4cf30ea09cb1d1286bd5ab6975f3f27e39b9c183 --- M msc/MSC_Tests.default M msc/MSC_Tests.ttcn M msc/MSC_Tests_Iu.ttcn M msc/expected-results.xml 4 files changed, 196 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/36/40636/1 diff --git a/msc/MSC_Tests.default b/msc/MSC_Tests.default index 34954bd..149d8e7 100644 --- a/msc/MSC_Tests.default +++ b/msc/MSC_Tests.default @@ -31,6 +31,15 @@ *.STATSVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes" *.STATSVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes" *.STATSVTY.PROMPT1 := "OsmoMSC> " +*.STPVTY.CTRL_MODE := "client" +*.STPVTY.CTRL_HOSTNAME := "127.0.0.1" +*.STPVTY.CTRL_PORTNUM := "4239" +*.STPVTY.CTRL_LOGIN_SKIPPED := "yes" +*.STPVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes" +*.STPVTY.CTRL_READMODE := "buffered" +*.STPVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes" +*.STPVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes" +*.STPVTY.PROMPT1 := "OsmoSTP> " [MODULE_PARAMETERS] diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn index 1ba52d9..4a7acdc 100644 --- a/msc/MSC_Tests.ttcn +++ b/msc/MSC_Tests.ttcn @@ -110,8 +110,10 @@ /* only to get events from IPA underneath GSUP */ port IPA_CTRL_PT GSUP_IPA_EVENT; - /* VTY to MSC */ + /* VTY to MSC: */ port TELNETasp_PT MSCVTY; + /* VTY to STP: */ + port TELNETasp_PT STPVTY; /* StatsD */ var StatsD_Checker_CT vc_STATSD; @@ -315,6 +317,34 @@ } } +friend function f_init_vty_stp() runs on MTC_CT { + if (STPVTY.checkstate("Mapped")) { + /* skip initialization if already executed once */ + return; + } + map(self:STPVTY, system:STPVTY); + f_vty_set_prompts(STPVTY, prompt_prefix := "OsmoSTP"); + f_vty_transceive(STPVTY, "enable"); +} + +friend function f_vty_stp_msc_asp_cmd(charstring cmd) runs on MTC_CT +{ + var charstring asp_name; + var charstring loc_port; + var charstring rem_port; + var charstring asp_proto; + if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { + asp_name := "msc0-0"; + loc_port := int2str(1905); + rem_port := int2str(2905); + asp_proto := "m3ua"; + } else { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "osmo-stp not used in SCCPLite!"); + } + var charstring asp_node := "asp " & asp_name & " " & loc_port & " " & rem_port & " " & asp_proto; + f_vty_config2(STPVTY, {"cs7 instance 0", asp_node}, cmd); +} + function f_init(integer num_bsc := 1, boolean sgsap := false, boolean gsup := true, boolean osmux := false) runs on MTC_CT { if (g_initialized == true) { @@ -499,6 +529,12 @@ return f_start_handler_with_pars(fn, f_init_pars(imsi_suffix, ran_idx := ran_idx, ran_is_geran := ran_is_geran, use_osmux := use_osmux, verify_cell_id := verify_cell_id)); } +friend function f_msc_stats_prefix() return charstring +{ + return mp_statsd_prefix & "net.0.msc."; +} + + private function f_tc_lu_imsi_noauth_tmsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { f_init_handler(pars); f_perform_lu(); @@ -2464,6 +2500,7 @@ f_mt_sms(spars); f_expect_clear(); + f_ran_unregister_imsi(g_pars.imsi); } testcase TC_lu_and_mt_sms() runs on MTC_CT { var BSC_ConnHdlrPars pars; @@ -3525,6 +3562,8 @@ /* then test the transaction mode */ f_smpp_mt_sms(spars, true); + + f_ran_unregister_imsi(g_pars.imsi); } testcase TC_smpp_mt_sms() runs on MTC_CT { var BSC_ConnHdlr vc_conn; @@ -7594,6 +7633,83 @@ vc_conn.done; } +/* When the last local IPA/SCTP link/ASP is terminated, last AS goes inactive + * and a SCCP N-PCSTATE.ind (unavailable) should arrive to upper layers. + * As a result, osmo-msc should immediately mark the ran_peer as unusable. + * In AoIP, the SCCP N-PCSTATE is triggered by instructing the STP to + * shutdown the ASP serving the MSC, which will close the SCTP assoc between + * itself and IUT (MSC), which should then generate an N-PCSTATE.ind. + */ +friend function f_tc_mt_sms(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { + var SmsParameters spars := valueof(t_SmsPars); + + f_init_handler(pars); + + /* register an 'expect' for given IMSI (+TMSI) */ + f_ran_register_imsi(g_pars.imsi, g_pars.tmsi); + + f_vty_sms_send(hex2str(pars.imsi), "2342", "Hello SMS"); + + /* MSC->BSC: expect PAGING from MSC. We can't match on specific TMSI + because it was provided in a previous first vc_conn in test during 1st LU. */ + f_expect_paging_tmsi(?); + + /* Establish DTAP / BSSAP / SCCP connection */ + f_establish_fully(EST_TYPE_PAG_RESP); + + spars.tp.ud := 'C8329BFD064D9B53'O; + f_mt_sms(spars); + + f_expect_clear(); + f_ran_unregister_imsi(g_pars.imsi); +} +testcase TC_stat_bsc_sctp_disconnected() runs on MTC_CT { + var BSC_ConnHdlr vc_conn; + var BSC_ConnHdlrPars pars; + var charstring msc_stats_prefix := f_msc_stats_prefix(); + + var StatsDExpects expect_connected := { + {name := msc_stats_prefix & "ran_peers.total", mtype := "g", min := 1, max := 1}, + {name := msc_stats_prefix & "ran_peers.active", mtype := "g", min := 1, max := 1} + }; + var StatsDExpects expect_disconnected := { + {name := msc_stats_prefix & "ran_peers.total", mtype := "g", min := 1, max := 1}, + {name := msc_stats_prefix & "ran_peers.active", mtype := "g", min := 0, max := 0} + }; + + g_statd_timeout := 15.0; + f_init(); + f_init_vty_stp(); + + connect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + f_statsd_reset(); + f_statsd_expect(expect_connected, wait_converge := true); + disconnect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + + pars := f_init_pars(1); + vc_conn := f_start_handler_with_pars(refers(f_tc_lu_and_mt_sms), pars); + vc_conn.done; + + f_logp(MSCVTY, "Shutting down MSC ASP in STP"); + f_vty_stp_msc_asp_cmd("shutdown"); + + /* Wait for AS PENDING->INACTIVE transition (T(r) timeout after 2000msec): */ + connect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + f_statsd_expect(expect_disconnected, wait_converge := true); + disconnect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + + f_logp(MSCVTY, "Restarting MSC ASP in STP"); + f_vty_stp_msc_asp_cmd("no shutdown"); + + connect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + f_statsd_expect(expect_connected, wait_converge := true); + disconnect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + + vc_conn := f_start_handler_with_pars(refers(f_tc_mt_sms), pars); + vc_conn.done; + setverdict(pass); +} + control { execute( TC_cr_before_reset() ); execute( TC_lu_imsi_noauth_tmsi() ); @@ -7787,6 +7903,13 @@ execute( TC_lu_and_mt_csd() ); execute( TC_lu_and_mo_call_reass_for_mt_codec() ); + + /* This "nightly" if can be removed once libosmo-sigtran (osmo-stp) > 2.1.0 is released. + * Currently released osmo-stp 2.1.0 ends up in in broken AS-ACTIVE+ASP-DOWN state when + * restarting the ASP after exiting the related asp node through VTY: */ + if (Misc_Helpers.f_osmo_repo_is("nightly")) { + execute( TC_stat_bsc_sctp_disconnected() ); + } } diff --git a/msc/MSC_Tests_Iu.ttcn b/msc/MSC_Tests_Iu.ttcn index c78b86b..c3c7231 100644 --- a/msc/MSC_Tests_Iu.ttcn +++ b/msc/MSC_Tests_Iu.ttcn @@ -12,6 +12,7 @@ import from General_Types all; import from Osmocom_Types all; +import from Misc_Helpers all; import from BSC_ConnectionHandler all; import from MSC_Tests all; @@ -29,7 +30,10 @@ import from L3_Templates all; import from L3_Common all; - +import from StatsD_Types all; +import from StatsD_CodecPort all; +import from StatsD_CodecPort_CtrlFunct all; +import from StatsD_Checker all; testcase TC_iu_lu_imsi_reject() runs on MTC_CT { var BSC_ConnHdlr vc_conn; @@ -593,6 +597,54 @@ vc_conn.done; } +testcase TC_stat_rnc_sctp_disconnected() runs on MTC_CT { + var BSC_ConnHdlr vc_conn; + var BSC_ConnHdlrPars pars; + var charstring msc_stats_prefix := f_msc_stats_prefix(); + + var StatsDExpects expect_connected := { + {name := msc_stats_prefix & "ran_peers.total", mtype := "g", min := 3, max := 3}, + {name := msc_stats_prefix & "ran_peers.active", mtype := "g", min := 3, max := 3} + }; + var StatsDExpects expect_disconnected := { + {name := msc_stats_prefix & "ran_peers.total", mtype := "g", min := 3, max := 3}, + {name := msc_stats_prefix & "ran_peers.active", mtype := "g", min := 0, max := 0} + }; + + g_statd_timeout := 15.0; + f_init(3); + f_init_vty_stp(); + + connect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + f_statsd_reset(); + f_statsd_expect(expect_connected, wait_converge := true); + disconnect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + + pars := f_init_pars(1, ran_idx := 2, ran_is_geran := false); + vc_conn := f_start_handler_with_pars(refers(f_tc_lu_and_mt_sms), pars); + vc_conn.done; + + f_logp(MSCVTY, "Shutting down MSC ASP in STP"); + f_vty_stp_msc_asp_cmd("shutdown"); + + /* Wait for AS PENDING->INACTIVE transition (T(r) timeout after 2000msec): */ + connect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + f_statsd_expect(expect_disconnected, wait_converge := true); + disconnect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + + f_logp(MSCVTY, "Restarting MSC ASP in STP"); + f_vty_stp_msc_asp_cmd("no shutdown"); + + connect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + f_statsd_expect(expect_connected, wait_converge := true); + disconnect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + + pars := f_init_pars(2, ran_idx := 2, ran_is_geran := false); + vc_conn := f_start_handler_with_pars(refers(f_tc_lu_and_mt_sms), pars); + vc_conn.done; + setverdict(pass); +} + control { execute( TC_iu_lu_imsi_reject() ); execute( TC_iu_lu_imsi_timeout_gsup() ); @@ -664,6 +716,13 @@ /* Run this last: at the time of writing this test crashes the MSC */ execute( TC_mo_cc_iu_release() ); + + /* This "nightly" if can be removed once libosmo-sigtran (osmo-stp) > 2.1.0 is released. + * Currently released osmo-stp 2.1.0 ends up in in broken AS-ACTIVE+ASP-DOWN state when + * restarting the ASP after exiting the related asp node through VTY: */ + if (Misc_Helpers.f_osmo_repo_is("nightly")) { + execute( TC_stat_rnc_sctp_disconnected() ); + } } diff --git a/msc/expected-results.xml b/msc/expected-results.xml index 9d7e315..04cd191 100644 --- a/msc/expected-results.xml +++ b/msc/expected-results.xml @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<testsuite name='Titan' tests='227' failures='10' errors='0' skipped='0' inconc='0' time='MASKED'> +<testsuite name='Titan' tests='228' failures='10' errors='0' skipped='0' inconc='0' time='MASKED'> <testcase classname='MSC_Tests' name='TC_cr_before_reset' time='MASKED'/> <testcase classname='MSC_Tests' name='TC_lu_imsi_noauth_tmsi' time='MASKED'/> <testcase classname='MSC_Tests' name='TC_lu_imsi_noauth_notmsi' time='MASKED'/> @@ -176,6 +176,7 @@ <testcase classname='MSC_Tests' name='TC_lu_and_mo_csd' time='MASKED'/> <testcase classname='MSC_Tests' name='TC_lu_and_mt_csd' time='MASKED'/> <testcase classname='MSC_Tests' name='TC_lu_and_mo_call_reass_for_mt_codec' time='MASKED'/> + <testcase classname='MSC_Tests' name='TC_stat_bsc_sctp_disconnected' time='MASKED'/> <!-- MSC_Tests_Iu testcases start here --> <testcase classname='MSC_Tests_Iu' name='TC_iu_lu_imsi_reject' time='MASKED'/> <testcase classname='MSC_Tests_Iu' name='TC_iu_lu_imsi_timeout_gsup' time='MASKED'/> @@ -256,6 +257,7 @@ </testcase> <testcase classname='MSC_Tests_Iu' name='TC_iu_lu_and_expire_while_paging' time='MASKED'/> <testcase classname='MSC_Tests_Iu' name='TC_mo_cc_iu_release' time='MASKED'/> + <testcase classname='MSC_Tests_Iu' name='TC_stat_rnc_sctp_disconnected' time='MASKED'/> <!-- MSC_Tests_ASCI testcases start here --> <testcase classname='MSC_Tests_ASCI' name='TC_no_callref' time='MASKED'/> <testcase classname='MSC_Tests_ASCI' name='TC_setup_refuse' time='MASKED'/> -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40636?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I4cf30ea09cb1d1286bd5ab6975f3f27e39b9c183 Gerrit-Change-Number: 40636 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: RAN_Emulation: Fix handling of IMSI in RANAP Paging
by pespin 10 Jul '25

10 Jul '25
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40634?usp=email ) Change subject: RAN_Emulation: Fix handling of IMSI in RANAP Paging ...................................................................... RAN_Emulation: Fix handling of IMSI in RANAP Paging The IMSI in RANAP Paging messages is encoded in octetstring BCD format. We need to decode it before using it, since we use plain hexstrings everywhere in the module to manage IMSIs. Take the chance to clean up and improve logging on related lines, both for BSSAP and RANAP. Change-Id: Ia892a52bad41a4e331703bbab438d8c811b2025e --- M library/Osmocom_Types.ttcn M library/RAN_Emulation.ttcnpp 2 files changed, 24 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/34/40634/1 diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn index a7e37e6..690535c 100644 --- a/library/Osmocom_Types.ttcn +++ b/library/Osmocom_Types.ttcn @@ -265,6 +265,22 @@ return ret; } +function imsi_oct2hex(octetstring imsi) return hexstring { + var hexstring ret := ''H + var integer i; + + /* swap nibbles and skip F */ + for (i := 0; i < lengthof(imsi); i := i+1) { + var hexstring h := oct2hex(imsi[i]); + if (h[0] == 'F'H) { + ret := ret & h[1]; + } else { + ret := ret & h[1] & h[0]; + } + } + return ret; +} + function f_pad_oct(octetstring str, integer len, OCT1 pad) return octetstring { var integer strlen := lengthof(str); for (var integer i := 0; i < len-strlen; i := i+1) { diff --git a/library/RAN_Emulation.ttcnpp b/library/RAN_Emulation.ttcnpp index 9401ed6..4e28ab2 100644 --- a/library/RAN_Emulation.ttcnpp +++ b/library/RAN_Emulation.ttcnpp @@ -565,18 +565,19 @@ runs on RAN_Emulation_CT return template PDU_BSSAP { if (match(bssap, tr_BSSMAP_Paging)) { var RAN_ConnHdlr client := null; - var template OCT4 tmsi := omit; + var hexstring imsi := bssap.pdu.bssmap.paging.iMSI.digits; + var template (omit) OCT4 tmsi := omit; if (ispresent(bssap.pdu.bssmap.paging.tMSI)) { tmsi := bssap.pdu.bssmap.paging.tMSI.tmsiOctets; } - client := f_imsi_table_find(bssap.pdu.bssmap.paging.iMSI.digits, tmsi); + client := f_imsi_table_find(imsi, tmsi); if (client != null) { log("CommonBssmapUnitdataCallback: IMSI/TMSI found in table, dispatching to ", client); CLIENT.send(bssap) to client; return omit; } - log("CommonBssmapUnitdataCallback: IMSI/TMSI not found in table"); + log("CommonBssmapUnitdataCallback: IMSI=", imsi, ", TMSI=", tmsi, " not found in table"); } else { log("CommonBssmapUnitdataCallback: Not a paging message"); } @@ -719,8 +720,8 @@ if (match(ranap, tr_RANAP_Paging(?, ?))) { var RAN_ConnHdlr client := null; /* extract IMSI and (if present) TMSI */ - var IMSI imsi := ranap.initiatingMessage.value_.paging.protocolIEs[1].value_.permanentNAS_UE_ID.iMSI; - var template OCT4 tmsi := omit; + var hexstring imsi := imsi_oct2hex(ranap.initiatingMessage.value_.paging.protocolIEs[1].value_.permanentNAS_UE_ID.iMSI); + var template (omit) OCT4 tmsi := omit; if (lengthof(ranap.initiatingMessage.value_.paging.protocolIEs) > 2 and ranap.initiatingMessage.value_.paging.protocolIEs[2].id == id_TemporaryUE_ID) { var TemporaryUE_ID ue_id; @@ -731,14 +732,14 @@ tmsi := ue_id.p_TMSI; } } - client := f_imsi_table_find(oct2hex(imsi), tmsi); + client := f_imsi_table_find(imsi, tmsi); if (client != null) { log("CommonRanapUnitdataCallback: IMSI/TMSI found in table, dispatching to ", client); CLIENT.send(ranap) to client; return omit; } - log("CommonRanapUnitdataCallback: IMSI/TMSI not found in table"); + log("CommonRanapUnitdataCallback: IMSI=", imsi, ", TMSI=", tmsi, " not found in table"); } else if (match(ranap, tr_RANAP_ResetResource(?, ?, ?))) { /* extract IuSigConId */ if (lengthof(ranap.initiatingMessage.value_.resetResource.protocolIEs) > 2 and -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40634?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ia892a52bad41a4e331703bbab438d8c811b2025e Gerrit-Change-Number: 40634 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-msc[master]: ran_peer: Add specific API to free object
by pespin 10 Jul '25

10 Jul '25
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/40632?usp=email ) Change subject: ran_peer: Add specific API to free object ...................................................................... ran_peer: Add specific API to free object Add a specific ran_peer_free() API so it becomes clear where the object is freed and hence the entire lifecycle of the object. Swap the talloc tree parentship to have the fi be a child of the object, which simplifies tear down triggered by FSM cleanup. Apparently the object is not being freed anywhere, so they are so far only being added to the list through .ran_peer_up_l2() -> ran_peer_find_or_create(). Change-Id: I721de21a68a4e336ae508a995e3cfcca05d57efe --- M include/osmocom/msc/ran_peer.h M src/libmsc/ran_peer.c 2 files changed, 27 insertions(+), 24 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/32/40632/1 diff --git a/include/osmocom/msc/ran_peer.h b/include/osmocom/msc/ran_peer.h index 211dd44..0ef490d 100644 --- a/include/osmocom/msc/ran_peer.h +++ b/include/osmocom/msc/ran_peer.h @@ -106,6 +106,7 @@ void ran_peer_reset(struct ran_peer *rp); void ran_peer_becomes_unreachable(struct ran_peer *rp); +void ran_peer_discard_all_conns(struct ran_peer *rp); struct ran_peer *ran_peer_find_by_cell_id(struct sccp_ran_inst *sri, const struct gsm0808_cell_id *cid, bool expecting_single_match); diff --git a/src/libmsc/ran_peer.c b/src/libmsc/ran_peer.c index 07e4328..d87a279 100644 --- a/src/libmsc/ran_peer.c +++ b/src/libmsc/ran_peer.c @@ -1,5 +1,5 @@ /* - * (C) 2019 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * (C) 2019-2025 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> * All Rights Reserved * * SPDX-License-Identifier: AGPL-3.0+ @@ -42,16 +42,23 @@ OSMO_ASSERT( osmo_fsm_register(&ran_peer_fsm) == 0); } -/* Allocate a RAN peer with FSM instance. To deallocate, call osmo_fsm_inst_term(ran_peer->fi). */ +/* Allocate a RAN peer with FSM instance. To deallocate, call ran_peer_free(). */ static struct ran_peer *ran_peer_alloc(struct sccp_ran_inst *sri, const struct osmo_sccp_addr *peer_addr) { struct ran_peer *rp; - struct osmo_fsm_inst *fi; char *sccp_addr; char *pos; - fi = osmo_fsm_inst_alloc(&ran_peer_fsm, sri, NULL, LOGL_DEBUG, NULL); - OSMO_ASSERT(fi); + rp = talloc(sri, struct ran_peer); + OSMO_ASSERT(rp); + *rp = (struct ran_peer){ + .sri = sri, + .peer_addr = *peer_addr, + }; + INIT_LLIST_HEAD(&rp->cells_seen); + + rp->fi = osmo_fsm_inst_alloc(&ran_peer_fsm, rp, rp, LOGL_DEBUG, NULL); + OSMO_ASSERT(rp->fi); /* Unfortunately, osmo_sccp_inst_addr_name() returns "RI=SSN_PC,PC=0.24.1,SSN=BSSAP" but neither commas nor * full-stops are allowed as FSM inst id. Make it "RI=SSN_PC:PC-0-24-1:SSN-BSSAP". */ @@ -62,23 +69,26 @@ else if (*pos == '.' || *pos == '=') *pos = '-'; } - osmo_fsm_inst_update_id_f(fi, "%s:%s", osmo_rat_type_name(sri->ran->type), sccp_addr); - - rp = talloc_zero(fi, struct ran_peer); - OSMO_ASSERT(rp); - *rp = (struct ran_peer){ - .sri = sri, - .peer_addr = *peer_addr, - .fi = fi, - }; - INIT_LLIST_HEAD(&rp->cells_seen); - fi->priv = rp; + osmo_fsm_inst_update_id_f(rp->fi, "%s:%s", osmo_rat_type_name(sri->ran->type), sccp_addr); llist_add(&rp->entry, &sri->ran_peers); return rp; } +void ran_peer_free(struct ran_peer *rp) +{ + if (!rp) + return; + + ran_peer_discard_all_conns(rp); + + osmo_fsm_inst_free(rp->fi); + rp->fi = NULL; + llist_del(&rp->entry); + talloc_free(rp); +} + struct ran_peer *ran_peer_find_or_create(struct sccp_ran_inst *sri, const struct osmo_sccp_addr *peer_addr) { struct ran_peer *rp = ran_peer_find_by_addr(sri, peer_addr); @@ -461,13 +471,6 @@ return 0; } -void ran_peer_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause) -{ - struct ran_peer *rp = fi->priv; - ran_peer_discard_all_conns(rp); - llist_del(&rp->entry); -} - static const struct value_string ran_peer_fsm_event_names[] = { OSMO_VALUE_STRING(RAN_PEER_EV_MSG_UP_CL), OSMO_VALUE_STRING(RAN_PEER_EV_MSG_UP_CO_INITIAL), @@ -548,7 +551,6 @@ .log_subsys = DRR, .event_names = ran_peer_fsm_event_names, .timer_cb = ran_peer_fsm_timer_cb, - .cleanup = ran_peer_fsm_cleanup, .allstate_action = ran_peer_allstate_action, .allstate_event_mask = 0 | S(RAN_PEER_EV_MSG_UP_CL) -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/40632?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I721de21a68a4e336ae508a995e3cfcca05d57efe Gerrit-Change-Number: 40632 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-msc[master]: msc: Initial implementation of N-PCSTATE.ind
by pespin 10 Jul '25

10 Jul '25
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/40630?usp=email ) Change subject: msc: Initial implementation of N-PCSTATE.ind ...................................................................... msc: Initial implementation of N-PCSTATE.ind Change-Id: Ice1b2c163b1b0d134fcaa1c8bf543038a35fabdf --- M include/osmocom/msc/ran_peer.h M src/libmsc/ran_peer.c M src/libmsc/sccp_ran.c 3 files changed, 127 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/30/40630/1 diff --git a/include/osmocom/msc/ran_peer.h b/include/osmocom/msc/ran_peer.h index c936d5c..211dd44 100644 --- a/include/osmocom/msc/ran_peer.h +++ b/include/osmocom/msc/ran_peer.h @@ -91,7 +91,7 @@ }; struct ran_peer *ran_peer_find_or_create(struct sccp_ran_inst *sri, const struct osmo_sccp_addr *peer_addr); -struct ran_peer *ran_peer_find_by_addr(struct sccp_ran_inst *sri, const struct osmo_sccp_addr *peer_addr); +struct ran_peer *ran_peer_find_by_addr(const struct sccp_ran_inst *sri, const struct osmo_sccp_addr *peer_addr); void ran_peer_cells_seen_add(struct ran_peer *ran_peer, const struct gsm0808_cell_id *id); @@ -104,5 +104,8 @@ int ran_peer_down_paging(struct ran_peer *rp, const struct gsm0808_cell_id *page_id, struct vlr_subscr *vsub, enum paging_cause cause); +void ran_peer_reset(struct ran_peer *rp); +void ran_peer_becomes_unreachable(struct ran_peer *rp); + struct ran_peer *ran_peer_find_by_cell_id(struct sccp_ran_inst *sri, const struct gsm0808_cell_id *cid, bool expecting_single_match); diff --git a/src/libmsc/ran_peer.c b/src/libmsc/ran_peer.c index 09e57eb..bef753a 100644 --- a/src/libmsc/ran_peer.c +++ b/src/libmsc/ran_peer.c @@ -87,7 +87,7 @@ return ran_peer_alloc(sri, peer_addr); } -struct ran_peer *ran_peer_find_by_addr(struct sccp_ran_inst *sri, const struct osmo_sccp_addr *peer_addr) +struct ran_peer *ran_peer_find_by_addr(const struct sccp_ran_inst *sri, const struct osmo_sccp_addr *peer_addr) { struct ran_peer *rp; llist_for_each_entry(rp, &sri->ran_peers, entry) { @@ -128,6 +128,13 @@ } } +/* N-PCSTATE.ind informs us the peer went down and is no longer reachable: */ +void ran_peer_becomes_unreachable(struct ran_peer *rp) +{ + ran_peer_discard_all_conns(rp); + ran_peer_state_chg(rp, RAN_PEER_ST_WAIT_RX_RESET); +} + static void ran_peer_update_osmux_support(struct ran_peer *rp, int supports_osmux) { bool old_value = rp->remote_supports_osmux; diff --git a/src/libmsc/sccp_ran.c b/src/libmsc/sccp_ran.c index 9907f20..3a1bfd5 100644 --- a/src/libmsc/sccp_ran.c +++ b/src/libmsc/sccp_ran.c @@ -29,6 +29,7 @@ #include <osmocom/msc/debug.h> #include <osmocom/msc/sccp_ran.h> #include <osmocom/msc/ran_infra.h> +#include <osmocom/msc/ran_peer.h> struct osmo_tdef g_sccp_tdefs[] = { {} @@ -59,6 +60,107 @@ return sri; } +/* Find an ran_peer (BSC/RNC) by its remote SCCP address */ +static struct ran_peer *get_ran_peer_by_pc(const struct sccp_ran_inst *sri, uint32_t pc) +{ + struct ran_peer *rp; + struct osmo_ss7_instance *cs7 = osmo_sccp_get_ss7(sri->sccp); + struct osmo_sccp_addr rem_addr; + + osmo_sccp_make_addr_pc_ssn(&rem_addr, pc, sri->ran->ssn); + rp = ran_peer_find_by_addr(sri, &rem_addr); + if (rp) + return rp; + LOGP(DMSC, LOGL_DEBUG, "Nofind ran_peer found under remote address: %s\n", osmo_sccp_addr_name(cs7, &rem_addr)); + return NULL; +} + +static void handle_pcstate_ind(struct sccp_ran_inst *sri, const struct osmo_scu_pcstate_param *pcst) +{ + struct ran_peer *rp; + bool connected; + bool disconnected; + + LOGP(DMSC, LOGL_DEBUG, "N-PCSTATE ind: affected_pc=%u sp_status=%s remote_sccp_status=%s\n", + pcst->affected_pc, osmo_sccp_sp_status_name(pcst->sp_status), + osmo_sccp_rem_sccp_status_name(pcst->remote_sccp_status)); + + /* If we don't care about that point-code, ignore PCSTATE. */ + rp = get_ran_peer_by_pc(sri, pcst->affected_pc); + if (!rp) + return; + + /* See if this marks the point code to have become available, or to have been lost. + * + * I want to detect two events: + * - connection event (both indicators say PC is reachable). + * - disconnection event (at least one indicator says the PC is not reachable). + * + * There are two separate incoming indicators with various possible values -- the incoming events can be: + * + * - neither connection nor disconnection indicated -- just indicating congestion + * connected == false, disconnected == false --> do nothing. + * - both incoming values indicate that we are connected + * --> trigger connected + * - both indicate we are disconnected + * --> trigger disconnected + * - one value indicates 'connected', the other indicates 'disconnected' + * --> trigger disconnected + * + * Congestion could imply that we're connected, but it does not indicate that a PC's reachability changed, so no need to + * trigger on that. + */ + connected = false; + disconnected = false; + + switch (pcst->sp_status) { + case OSMO_SCCP_SP_S_ACCESSIBLE: + connected = true; + break; + case OSMO_SCCP_SP_S_INACCESSIBLE: + disconnected = true; + break; + default: + case OSMO_SCCP_SP_S_CONGESTED: + /* Neither connecting nor disconnecting */ + break; + } + + switch (pcst->remote_sccp_status) { + case OSMO_SCCP_REM_SCCP_S_AVAILABLE: + if (!disconnected) + connected = true; + break; + case OSMO_SCCP_REM_SCCP_S_UNAVAILABLE_UNKNOWN: + case OSMO_SCCP_REM_SCCP_S_UNEQUIPPED: + case OSMO_SCCP_REM_SCCP_S_INACCESSIBLE: + disconnected = true; + connected = false; + break; + default: + case OSMO_SCCP_REM_SCCP_S_CONGESTED: + /* Neither connecting nor disconnecting */ + break; + } + + if (disconnected && rp->fi && rp->fi->state == RAN_PEER_ST_READY) { + LOG_RAN_PEER(rp, LOGL_NOTICE, + "now unreachable: N-PCSTATE ind: pc=%u sp_status=%s remote_sccp_status=%s\n", + pcst->affected_pc, + osmo_sccp_sp_status_name(pcst->sp_status), + osmo_sccp_rem_sccp_status_name(pcst->remote_sccp_status)); + ran_peer_becomes_unreachable(rp); + /* TODO: need to change state?! */ + } else if (connected && rp->fi && rp->fi->state != RAN_PEER_ST_READY) { + LOG_RAN_PEER(rp, LOGL_NOTICE, + "now available: N-PCSTATE ind: pc=%u sp_status=%s remote_sccp_status=%s\n", + pcst->affected_pc, + osmo_sccp_sp_status_name(pcst->sp_status), + osmo_sccp_rem_sccp_status_name(pcst->remote_sccp_status)); + ran_peer_reset(rp); + } +} + static int sccp_ran_sap_up(struct osmo_prim_hdr *oph, void *_scu) { struct osmo_sccp_user *scu = _scu; @@ -141,6 +243,19 @@ rc = sri->ran->sccp_ran_ops.up_l2(sri, peer_addr, false, 0, oph->msg); break; + case OSMO_PRIM(OSMO_SCU_PRIM_N_PCSTATE, PRIM_OP_INDICATION): + handle_pcstate_ind(sri, &prim->u.pcstate); + rc = 0; + break; + + case OSMO_PRIM(OSMO_SCU_PRIM_N_STATE, PRIM_OP_INDICATION): + LOG_SCCP_RAN_CL(sri, NULL, LOGL_INFO, + "SCCP-User-SAP: Ignoring %s.%s\n", + osmo_scu_prim_type_name(oph->primitive), + get_value_string(osmo_prim_op_names, oph->operation)); + rc = 0; + break; + default: LOG_SCCP_RAN_CL(sri, NULL, LOGL_DEBUG, "%s(%s)\n", __func__, osmo_scu_prim_name(oph)); rc = -1; -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/40630?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: Ice1b2c163b1b0d134fcaa1c8bf543038a35fabdf Gerrit-Change-Number: 40630 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-msc[master]: ran_peer: Avoid paging attempt if not ready
by pespin 10 Jul '25

10 Jul '25
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/40631?usp=email ) Change subject: ran_peer: Avoid paging attempt if not ready ...................................................................... ran_peer: Avoid paging attempt if not ready If the link is not ready it will fail to transmit the msg anyway, so there's no use in trying to submit a page over it. Change-Id: Ia858291f4454e4caf293e1aaf60ea04d2d4a64e9 --- M src/libmsc/ran_peer.c 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/31/40631/1 diff --git a/src/libmsc/ran_peer.c b/src/libmsc/ran_peer.c index bef753a..07e4328 100644 --- a/src/libmsc/ran_peer.c +++ b/src/libmsc/ran_peer.c @@ -682,6 +682,10 @@ { struct msgb *l2; + /* ran_peer is not ready for paging (link not ready). */ + if (!rp->fi || rp->fi->state != RAN_PEER_ST_READY) + return 0; + /* There are also the RAN peers that are configured in the neighbor ident for Handover, but if those aren't * connected, then we can't Page there. */ if (!cell_id_list_find(&rp->cells_seen, page_id, 0, false)) -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/40631?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: Ia858291f4454e4caf293e1aaf60ea04d2d4a64e9 Gerrit-Change-Number: 40631 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-msc[master]: ran_peer: Introuce stats msc.ran_peers.{total,active}
by pespin 10 Jul '25

10 Jul '25
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/40633?usp=email ) Change subject: ran_peer: Introuce stats msc.ran_peers.{total,active} ...................................................................... ran_peer: Introuce stats msc.ran_peers.{total,active} Change-Id: I36e40510c9a95f0c9cf5f32d2a7baab840aa8660 --- M include/osmocom/msc/gsm_data.h M src/libmsc/ran_peer.c 2 files changed, 33 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/33/40633/1 diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h index 119f093..03fba55 100644 --- a/include/osmocom/msc/gsm_data.h +++ b/include/osmocom/msc/gsm_data.h @@ -109,6 +109,8 @@ enum { MSC_STAT_ACTIVE_CALLS, MSC_STAT_ACTIVE_NC_SS, + MSC_STAT_RAN_PEERS_TOTAL, + MSC_STAT_RAN_PEERS_ACTIVE, }; static const struct rate_ctr_group_desc msc_ctrg_desc = { @@ -120,8 +122,10 @@ }; static const struct osmo_stat_item_desc msc_stat_item_description[] = { - [MSC_STAT_ACTIVE_CALLS] = { "msc.active_calls", "Currently active calls " , OSMO_STAT_ITEM_NO_UNIT, 4, 0}, - [MSC_STAT_ACTIVE_NC_SS] = { "msc.active_nc_ss", "Currently active SS/USSD sessions", OSMO_STAT_ITEM_NO_UNIT, 4, 0}, + [MSC_STAT_ACTIVE_CALLS] = { "msc.active_calls", "Currently active calls ", OSMO_STAT_ITEM_NO_UNIT, 4, 0}, + [MSC_STAT_ACTIVE_NC_SS] = { "msc.active_nc_ss", "Currently active SS/USSD sessions", OSMO_STAT_ITEM_NO_UNIT, 4, 0}, + [MSC_STAT_RAN_PEERS_TOTAL] = { "msc.ran_peers.total", "Total RAN peers (BSC, RNC)", OSMO_STAT_ITEM_NO_UNIT, 4, 0}, + [MSC_STAT_RAN_PEERS_ACTIVE] = { "msc.ran_peers.active", "Currently active RAN peers (BSSAP/RANAP ready)", OSMO_STAT_ITEM_NO_UNIT, 4, 0}, }; static const struct osmo_stat_item_group_desc msc_statg_desc = { diff --git a/src/libmsc/ran_peer.c b/src/libmsc/ran_peer.c index d87a279..222a014 100644 --- a/src/libmsc/ran_peer.c +++ b/src/libmsc/ran_peer.c @@ -23,6 +23,7 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/logging.h> #include <osmocom/core/fsm.h> +#include <osmocom/core/stat_item.h> #include <osmocom/sigtran/sccp_helpers.h> #include <osmocom/msc/ran_peer.h> @@ -45,6 +46,7 @@ /* Allocate a RAN peer with FSM instance. To deallocate, call ran_peer_free(). */ static struct ran_peer *ran_peer_alloc(struct sccp_ran_inst *sri, const struct osmo_sccp_addr *peer_addr) { + struct gsm_network *net = sri->user_data; struct ran_peer *rp; char *sccp_addr; char *pos; @@ -72,17 +74,24 @@ osmo_fsm_inst_update_id_f(rp->fi, "%s:%s", osmo_rat_type_name(sri->ran->type), sccp_addr); llist_add(&rp->entry, &sri->ran_peers); + osmo_stat_item_inc(osmo_stat_item_group_get_item(net->statg, MSC_STAT_RAN_PEERS_TOTAL), 1); return rp; } void ran_peer_free(struct ran_peer *rp) { + struct gsm_network *net; if (!rp) return; ran_peer_discard_all_conns(rp); + net = rp->sri->user_data; + if (rp->fi->state == RAN_PEER_ST_READY) + osmo_stat_item_dec(osmo_stat_item_group_get_item(net->statg, MSC_STAT_RAN_PEERS_ACTIVE), 1); + osmo_stat_item_dec(osmo_stat_item_group_get_item(net->statg, MSC_STAT_RAN_PEERS_TOTAL), 1); + osmo_fsm_inst_free(rp->fi); rp->fi = NULL; llist_del(&rp->entry); @@ -376,6 +385,14 @@ return msc_i->ran_conn; } +void ran_peer_st_ready_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct ran_peer *rp = fi->priv; + struct gsm_network *net = rp->sri->user_data; + if (prev_state != RAN_PEER_ST_READY) + osmo_stat_item_inc(osmo_stat_item_group_get_item(net->statg, MSC_STAT_RAN_PEERS_ACTIVE), 1); +} + void ran_peer_st_ready(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct ran_peer *rp = fi->priv; @@ -464,6 +481,14 @@ } } +void ran_peer_st_ready_onleave(struct osmo_fsm_inst *fi, uint32_t next_state) +{ + struct ran_peer *rp = fi->priv; + struct gsm_network *net = rp->sri->user_data; + if (next_state != RAN_PEER_ST_READY) + osmo_stat_item_dec(osmo_stat_item_group_get_item(net->statg, MSC_STAT_RAN_PEERS_ACTIVE), 1); +} + static int ran_peer_fsm_timer_cb(struct osmo_fsm_inst *fi) { struct ran_peer *rp = fi->priv; @@ -524,6 +549,8 @@ [RAN_PEER_ST_READY] = { .name = "READY", .action = ran_peer_st_ready, + .onenter = ran_peer_st_ready_onenter, + .onleave = ran_peer_st_ready_onleave, .in_event_mask = 0 | S(RAN_PEER_EV_RX_RESET) | S(RAN_PEER_EV_MSG_UP_CO_INITIAL) -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/40633?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I36e40510c9a95f0c9cf5f32d2a7baab840aa8660 Gerrit-Change-Number: 40633 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-hnbgw[master]: Make sure MSC/SGSN PC are added to sccp-addressbook
by laforge 10 Jul '25

10 Jul '25
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/40627?usp=email ) Change subject: Make sure MSC/SGSN PC are added to sccp-addressbook ...................................................................... Make sure MSC/SGSN PC are added to sccp-addressbook This way they can used by libosmo-sigtran to figure out interesting remote PCs it should track availability for. Related: OS#5917 Related: SYS#7501 Depends: libosmo-sigtran.git Change-Id I9d2452d9cc8e443050927a047b7ebacd2b2f37e1 Change-Id: I6a537adca27dd2bbad33d0f2be71eb41d6ad3a27 --- M TODO-RELEASE M include/osmocom/hnbgw/hnbgw.h M include/osmocom/hnbgw/hnbgw_cn.h M src/osmo-hnbgw/cnlink.c M src/osmo-hnbgw/hnbgw_cn.c M tests/cnpool.vty 6 files changed, 131 insertions(+), 77 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved osmith: Looks good to me, but someone else must approve diff --git a/TODO-RELEASE b/TODO-RELEASE index 0ed7189..895cb3c 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,4 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libosmo-sigtran >2.1.0 osmo_sccp_addr_{create,update}() diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h index 685bc12..f4ec21c 100644 --- a/include/osmocom/hnbgw/hnbgw.h +++ b/include/osmocom/hnbgw/hnbgw.h @@ -56,6 +56,8 @@ #define DEFAULT_PC_HNBGW ((23 << 3) + 5) #define DEFAULT_PC_MSC ((23 << 3) + 1) #define DEFAULT_PC_SGSN ((23 << 3) + 4) +#define DEFAULT_ADDR_NAME_MSC "addr-dyn-msc-default" +#define DEFAULT_ADDR_NAME_SGSN "addr-dyn-sgsn-default" /* 25.467 Section 7.1 */ #define IUH_DEFAULT_SCTP_PORT 29169 diff --git a/include/osmocom/hnbgw/hnbgw_cn.h b/include/osmocom/hnbgw/hnbgw_cn.h index 8e765c8..68a0ac5 100644 --- a/include/osmocom/hnbgw/hnbgw_cn.h +++ b/include/osmocom/hnbgw/hnbgw_cn.h @@ -37,6 +37,7 @@ const char *peer_name; /* What we use as the remote MSC/SGSN point-code if the user does not configure any address. */ uint32_t default_remote_pc; + const char *default_addr_name; struct hnbgw_cnpool_cfg vty; struct hnbgw_cnpool_cfg use; diff --git a/src/osmo-hnbgw/cnlink.c b/src/osmo-hnbgw/cnlink.c index ea53ee0..83ca51f 100644 --- a/src/osmo-hnbgw/cnlink.c +++ b/src/osmo-hnbgw/cnlink.c @@ -385,45 +385,22 @@ return hnbgw_cnlink_tx_sccp_unitdata_req(cnlink, msg); } -static bool addr_has_pc_and_ssn(const struct osmo_sccp_addr *addr) +/* Return address found in sccp address-book, and fill in missing fields in the + * entry with default values. */ +static struct osmo_ss7_instance *sccp_addr_by_name_filled(struct osmo_sccp_addr *dest, const char *addr_name, uint32_t default_pc) { - if (!(addr->presence & OSMO_SCCP_ADDR_T_SSN)) - return false; - if (!(addr->presence & OSMO_SCCP_ADDR_T_PC)) - return false; - return true; -} + struct osmo_ss7_instance *s7i; + s7i = osmo_sccp_addr_by_name(dest, addr_name); + if (!s7i) + return NULL; -static int resolve_addr_name(struct osmo_sccp_addr *dest, struct osmo_ss7_instance **ss7, - const char *addr_name, const char *label, - uint32_t default_pc) -{ - if (!addr_name) { + /* Address exists in address-book but may not be filled entirely: */ + if (!dest->presence) osmo_sccp_make_addr_pc_ssn(dest, default_pc, OSMO_SCCP_SSN_RANAP); - if (label) - LOGP(DCN, LOGL_INFO, "%s remote addr not configured, using default: %s\n", label, - osmo_sccp_addr_name(*ss7, dest)); - return 0; - } + else if (!(dest->presence & OSMO_SCCP_ADDR_T_SSN)) + osmo_sccp_addr_set_ssn(dest, OSMO_SCCP_SSN_RANAP); - *ss7 = osmo_sccp_addr_by_name(dest, addr_name); - if (!*ss7) { - if (label) - LOGP(DCN, LOGL_ERROR, "%s remote addr: no such SCCP address book entry: '%s'\n", - label, addr_name); - return -1; - } - - osmo_sccp_addr_set_ssn(dest, OSMO_SCCP_SSN_RANAP); - - if (!addr_has_pc_and_ssn(dest)) { - if (label) - LOGP(DCN, LOGL_ERROR, "Invalid/incomplete %s remote-addr: %s\n", - label, osmo_sccp_addr_name(*ss7, dest)); - return -1; - } - - return 0; + return s7i; } char *hnbgw_cnlink_sccp_addr_to_str(struct hnbgw_cnlink *cnlink, const struct osmo_sccp_addr *addr) @@ -451,13 +428,17 @@ bool changed = false; if (cnlink->vty.remote_addr_name && cnlink->use.remote_addr_name) { - struct osmo_ss7_instance *ss7; + struct osmo_ss7_instance *s7i; struct osmo_sccp_addr remote_addr = {}; /* Instead of comparing whether the address book entry names are different, actually resolve the * resulting SCCP address, and only restart the cnlink if the resulting address changed. */ - resolve_addr_name(&remote_addr, &ss7, cnlink->vty.remote_addr_name, NULL, cnlink->pool->default_remote_pc); - if (osmo_sccp_addr_cmp(&remote_addr, &cnlink->remote_addr, OSMO_SCCP_ADDR_T_PC | OSMO_SCCP_ADDR_T_SSN)) + s7i = sccp_addr_by_name_filled(&remote_addr, cnlink->vty.remote_addr_name, + cnlink->pool->default_remote_pc); + if (!s7i) + return true; + if (osmo_sccp_addr_cmp(&remote_addr, &cnlink->remote_addr, + OSMO_SCCP_ADDR_T_PC | OSMO_SCCP_ADDR_T_SSN)) changed = true; } else if (cnlink->vty.remote_addr_name != cnlink->use.remote_addr_name) { /* One of them is NULL, the other is not. */ @@ -465,7 +446,6 @@ } /* if more cnlink configuration is added in the future, it needs to be compared here. */ - return changed; } @@ -485,19 +465,20 @@ * Set cnlink->hnbgw_sccp_user to the new SCCP instance. Return 0 on success, negative on error. */ int hnbgw_cnlink_start_or_restart(struct hnbgw_cnlink *cnlink) { - struct osmo_ss7_instance *ss7 = NULL; + struct osmo_ss7_instance *s7i = NULL; struct hnbgw_sccp_user *hsu; + uint32_t ss7_id; + int rc; /* If a hnbgw_sccp_user has already been set up, use that. */ if (cnlink->hnbgw_sccp_user) { - if (hnbgw_cnlink_sccp_cfg_changed(cnlink)) { - LOG_CNLINK(cnlink, DCN, LOGL_NOTICE, "config changed, restarting SCCP\n"); - hnbgw_cnlink_drop_sccp(cnlink); - } else { + if (!hnbgw_cnlink_sccp_cfg_changed(cnlink)) { LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "SCCP instance already set up, using %s\n", cnlink->hnbgw_sccp_user->name); return 0; } + LOG_CNLINK(cnlink, DCN, LOGL_NOTICE, "config changed, restarting SCCP\n"); + hnbgw_cnlink_drop_sccp(cnlink); } else { LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "no SCCP instance selected yet\n"); } @@ -505,49 +486,64 @@ /* Copy the current configuration: cnlink->use = cnlink->vty */ hnbgw_cnlink_cfg_copy(cnlink); - /* Figure out which cs7 instance to use. If cnlink->remote_addr_name is set, it points to an address book entry - * in a specific cs7 instance. If it is not set, leave ss7 == NULL to use cs7 instance 0. */ - if (cnlink->use.remote_addr_name) { - if (resolve_addr_name(&cnlink->remote_addr, &ss7, cnlink->use.remote_addr_name, cnlink->name, - cnlink->pool->default_remote_pc)) { + if (!cnlink->use.remote_addr_name) { + /* No remote address configured in VTY, set a default one and + * make sure it becomes registered in the sccp address-book: */ + cnlink->use.remote_addr_name = talloc_strdup(cnlink, cnlink->pool->default_addr_name); + s7i = osmo_sccp_addr_by_name(&cnlink->remote_addr, cnlink->use.remote_addr_name); + if (!s7i) { + LOG_CNLINK(cnlink, DCN, LOGL_NOTICE, "To auto-configure cnlink, creating cs7 instance 0 implicitly\n"); + s7i = osmo_ss7_instance_find_or_create(g_hnbgw, 0); + OSMO_ASSERT(s7i); + osmo_sccp_make_addr_pc_ssn(&cnlink->remote_addr, + cnlink->pool->default_remote_pc, + OSMO_SCCP_SSN_RANAP); + rc = osmo_sccp_addr_create(s7i, cnlink->use.remote_addr_name, &cnlink->remote_addr); + if (rc < 0) { + LOG_CNLINK(cnlink, DCN, LOGL_ERROR, "Failed adding address '%s' to sccp address-book!\n", + cnlink->use.remote_addr_name); + return -EINVAL; + } + } + /* Update VTY config to show & point to the address dynamically added to address-book: */ + cnlink->vty.remote_addr_name = talloc_strdup(cnlink, cnlink->use.remote_addr_name); + } else { + s7i = sccp_addr_by_name_filled(&cnlink->remote_addr, cnlink->use.remote_addr_name, cnlink->pool->default_remote_pc); + if (!s7i) { LOG_CNLINK(cnlink, DCN, LOGL_ERROR, "cannot initialize SCCP: there is no SCCP address named '%s'\n", cnlink->use.remote_addr_name); return -ENOENT; } - LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "remote-addr is '%s', using cs7 instance %u\n", - cnlink->use.remote_addr_name, osmo_ss7_instance_get_id(ss7)); - } else { - /* If no address is configured, use the default remote CN address, according to legacy behavior. */ - osmo_sccp_make_addr_pc_ssn(&cnlink->remote_addr, cnlink->pool->default_remote_pc, OSMO_SCCP_SSN_RANAP); - } - - /* If no 'cs7 instance' has been selected by the address, see if there already is a cs7 0 we can use by default. - * If it doesn't exist, it will get created by osmo_sccp_simple_client_on_ss7_id(). */ - if (!ss7) { - ss7 = osmo_ss7_instance_find(0); - LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "Using default 'cs7 instance 0' (%s)\n", ss7 ? "already exists" : "will create"); - } - - if (ss7) { - /* Has another cnlink already set up an SCCP instance for this ss7? */ - llist_for_each_entry(hsu, &g_hnbgw->sccp.users, entry) { - if (hsu->ss7 != ss7) - continue; - LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "using existing SCCP instance %s on cs7 instance %u\n", - hsu->name, osmo_ss7_instance_get_id(ss7)); - cnlink->hnbgw_sccp_user = hsu; - hnbgw_sccp_user_get(cnlink->hnbgw_sccp_user, HSU_USE_CNLINK); - hnbgw_cnlink_log_self(cnlink); - return 0; + cnlink->use.remote_addr_name, osmo_ss7_instance_get_id(s7i)); + /* Address exists in address-book but may not be filled entirely: */ + rc = osmo_sccp_addr_update(s7i, cnlink->use.remote_addr_name, &cnlink->remote_addr); + if (rc < 0) { + LOG_CNLINK(cnlink, DCN, LOGL_ERROR, "Failed updating address '%s' in sccp address-book!\n", + cnlink->use.remote_addr_name); + return -EINVAL; } - /* else cnlink->hnbgw_sccp_user stays NULL and is set up below. */ - LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "cs7 instance %u has no configured SCCP instance yet\n", osmo_ss7_instance_get_id(ss7)); } + ss7_id = osmo_ss7_instance_get_id(s7i); + + /* Has another cnlink already set up an SCCP instance for this s7i? */ + llist_for_each_entry(hsu, &g_hnbgw->sccp.users, entry) { + if (hsu->ss7 != s7i) + continue; + LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "using existing SCCP instance %s on cs7 instance %u\n", + hsu->name, ss7_id); + cnlink->hnbgw_sccp_user = hsu; + hnbgw_sccp_user_get(cnlink->hnbgw_sccp_user, HSU_USE_CNLINK); + hnbgw_cnlink_log_self(cnlink); + return 0; + } + /* else cnlink->hnbgw_sccp_user stays NULL and is set up below. */ + LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "cs7 instance %u has no configured SCCP instance yet\n", ss7_id); + /* No SCCP instance yet for this ss7. Create it. If no address name is given that resolves to a * particular cs7 instance above, use 'cs7 instance 0'. */ - cnlink->hnbgw_sccp_user = hnbgw_sccp_user_alloc(ss7 ? osmo_ss7_instance_get_id(ss7) : 0); + cnlink->hnbgw_sccp_user = hnbgw_sccp_user_alloc(ss7_id); hnbgw_sccp_user_get(cnlink->hnbgw_sccp_user, HSU_USE_CNLINK); hnbgw_cnlink_log_self(cnlink); return 0; diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c index f881dc1..ab800f7 100644 --- a/src/osmo-hnbgw/hnbgw_cn.c +++ b/src/osmo-hnbgw/hnbgw_cn.c @@ -312,12 +312,14 @@ cnpool->pool_name = "iucs"; cnpool->peer_name = "msc"; cnpool->default_remote_pc = DEFAULT_PC_MSC; + cnpool->default_addr_name = DEFAULT_ADDR_NAME_MSC; cnpool->ctrs = rate_ctr_group_alloc(cnpool, &iucs_ctrg_desc, 0); break; case DOMAIN_PS: cnpool->pool_name = "iups"; cnpool->peer_name = "sgsn"; cnpool->default_remote_pc = DEFAULT_PC_SGSN; + cnpool->default_addr_name = DEFAULT_ADDR_NAME_SGSN; cnpool->ctrs = rate_ctr_group_alloc(cnpool, &iups_ctrg_desc, 0); break; default: diff --git a/tests/cnpool.vty b/tests/cnpool.vty index 78f660f..83d7352 100644 --- a/tests/cnpool.vty +++ b/tests/cnpool.vty @@ -134,10 +134,23 @@ OsmoHNBGW(config)# ### The config file has no 'msc' or 'sgsn', so defaults have been set up OsmoHNBGW(config)# show running-config ... +cs7 instance 0 + point-code 0.23.5 +... + sccp-address addr-dyn-msc-default + routing-indicator PC + point-code 0.23.1 + subsystem-number 142 + sccp-address addr-dyn-sgsn-default + routing-indicator PC + point-code 0.23.4 +... msc 0 name msc-0 + remote-addr addr-dyn-msc-default sgsn 0 name sgsn-0 + remote-addr addr-dyn-sgsn-default ... OsmoHNBGW(config)# msc 1 @@ -227,10 +240,12 @@ ... msc 0 name msc-0 + remote-addr addr-dyn-msc-default msc 1 name msc-1 sgsn 0 name sgsn-0 + remote-addr addr-dyn-sgsn-default sgsn 1 name sgsn-1 ... @@ -259,6 +274,7 @@ ... msc 0 name msc-0 + remote-addr addr-dyn-msc-default msc 1 name msc-1 msc 2 @@ -271,6 +287,7 @@ allow-emergency sgsn 0 name sgsn-0 + remote-addr addr-dyn-sgsn-default sgsn 1 name sgsn-1 sgsn 2 @@ -297,6 +314,7 @@ ... msc 0 name msc-0 + remote-addr addr-dyn-msc-default msc 1 name msc-1 msc 2 @@ -307,6 +325,7 @@ remote-addr addr-msc4 sgsn 0 name sgsn-0 + remote-addr addr-dyn-sgsn-default sgsn 1 name sgsn-1 sgsn 2 @@ -378,3 +397,36 @@ ... msc 0 ... + +OsmoHNBGW(config-hnbgw)# exit +OsmoHNBGW(config)# ### Apply all SCCP changes: +OsmoHNBGW(config)# apply sccp +OsmoHNBGW(config)# show running-config +... +hnbgw +... +msc 0 + name msc-0 + remote-addr addr-msc0 +msc 1 + name msc-1 + remote-addr addr-dyn-msc-default +msc 2 + name msc-2 + remote-addr addr-msc2 +msc 3 + name msc-3 + remote-addr addr-msc4 +sgsn 0 + name sgsn-0 + remote-addr addr-sgsn0 +sgsn 1 + name sgsn-1 + remote-addr addr-dyn-sgsn-default +sgsn 2 + name sgsn-2 + remote-addr addr-sgsn4 +sgsn 3 + name sgsn-3 + remote-addr addr-sgsn3 +... -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/40627?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I6a537adca27dd2bbad33d0f2be71eb41d6ad3a27 Gerrit-Change-Number: 40627 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-hnbgw[master]: Make sure MSC/SGSN PC are added to sccp-addressbook
by laforge 10 Jul '25

10 Jul '25
Attention is currently required from: daniel, pespin. laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/40627?usp=email ) Change subject: Make sure MSC/SGSN PC are added to sccp-addressbook ...................................................................... Patch Set 1: Code-Review+2 (1 comment) Patchset: PS1: > The previous behavior still holds true in the sense that the default is only applied upon start of t […] Done -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/40627?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I6a537adca27dd2bbad33d0f2be71eb41d6ad3a27 Gerrit-Change-Number: 40627 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Comment-Date: Thu, 10 Jul 2025 17:48:33 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XS] Change in libosmo-sigtran[master]: xua_snm: Tx DUNA/DAVA to ASPs with single AS and no coordinated rctx
by laforge 10 Jul '25

10 Jul '25
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40621?usp=email ) Change subject: xua_snm: Tx DUNA/DAVA to ASPs with single AS and no coordinated rctx ...................................................................... xua_snm: Tx DUNA/DAVA to ASPs with single AS and no coordinated rctx ss7_asp_get_all_rctx_be() properly skips rctx=0 as per special osmocom meaning "no rctx IE". However, in this case the count of rctx was used to skip sending notifications to ASPs not associated to the AS/PC becoming available/unavailable. This fixes problems when both osmo-bsc and osmo-stp configure the routing-key with rctx=0, meaning both agree to use no rctx. Change-Id: Ibda223090e7d503d8501c50f4cdf0b8b8c65a724 --- M src/xua_snm.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: osmith: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/xua_snm.c b/src/xua_snm.c index 04568d2..e613573 100644 --- a/src/xua_snm.c +++ b/src/xua_snm.c @@ -232,7 +232,7 @@ num_rctx = ss7_asp_get_all_rctx_be(asp, rctx, ARRAY_SIZE(rctx), as); /* this can happen if the given ASP is only in the AS that reports the change, * which shall be excluded */ - if (num_rctx == 0) + if (num_rctx == 0 && osmo_ss7_as_has_asp(as, asp)) continue; xua_tx_snm_available(asp, rctx, num_rctx, aff_pc, num_aff_pc, info_str, available); } -- To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40621?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmo-sigtran Gerrit-Branch: master Gerrit-Change-Id: Ibda223090e7d503d8501c50f4cdf0b8b8c65a724 Gerrit-Change-Number: 40621 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
1 0
0 0
[XS] Change in libosmo-sigtran[master]: xua_snm: Tx DUNA/DAVA to ASPs with single AS and no coordinated rctx
by laforge 10 Jul '25

10 Jul '25
Attention is currently required from: daniel, pespin. laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40621?usp=email ) Change subject: xua_snm: Tx DUNA/DAVA to ASPs with single AS and no coordinated rctx ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40621?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmo-sigtran Gerrit-Branch: master Gerrit-Change-Id: Ibda223090e7d503d8501c50f4cdf0b8b8c65a724 Gerrit-Change-Number: 40621 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Comment-Date: Thu, 10 Jul 2025 17:47:59 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • ...
  • 150
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.