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

January 2024

  • 1 participants
  • 1559 discussions
[S] Change in osmo-bsc[master]: Add vty commands "no gprs nsvc ..."
by jolly 15 Jan '24

15 Jan '24
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/35571?usp=email ) Change subject: Add vty commands "no gprs nsvc ..." ...................................................................... Add vty commands "no gprs nsvc ..." A switch (bool) is used to enable or disable NSVC 0 or 1. It is enabled via any "gprs nsvc 0|1" command and disabled via "no gprs nsvc 0|1" command. If it is disabled, it is treated as unconfigured, similar when no remote IP or port has been defined. Related: OS#6006 Change-Id: Ia112e86aa35f6a245d98ef1b3720c18835faeda6 --- M include/osmocom/bsc/bts_sm.h M src/osmo-bsc/bts_vty.c M src/osmo-bsc/nm_gprs_nsvc_fsm.c 3 files changed, 47 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/71/35571/1 diff --git a/include/osmocom/bsc/bts_sm.h b/include/osmocom/bsc/bts_sm.h index e25b8da..13be3d9 100644 --- a/include/osmocom/bsc/bts_sm.h +++ b/include/osmocom/bsc/bts_sm.h @@ -40,6 +40,7 @@ /* data read via VTY config file, to configure the BTS * via OML from BSC */ int id; + bool enabled; uint16_t nsvci; uint16_t local_port; /* on the BTS */ struct osmo_sockaddr remote; diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c index e38ec94..24224f6 100644 --- a/src/osmo-bsc/bts_vty.c +++ b/src/osmo-bsc/bts_vty.c @@ -1564,6 +1564,22 @@ #define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \ "NSVC Logical Number\n" +DEFUN_USRATTR(cfg_no_bts_gprs_nsvc, + cfg_no_bts_gprs_nsvc_cmd, + X(BSC_VTY_ATTR_RESTART_ABIS_OML_LINK), + "no gprs nsvc <0-1>", + NO_STR GPRS_TEXT NSVC_TEXT) +{ + struct gsm_bts *bts = vty->index; + int idx = atoi(argv[0]); + + GPRS_CHECK_ENABLED(bts); + + bts->site_mgr->gprs.nsvc[idx].enabled = false; + + return CMD_SUCCESS; +} + DEFUN_USRATTR(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd, X(BSC_VTY_ATTR_RESTART_ABIS_OML_LINK), @@ -1578,6 +1594,7 @@ GPRS_CHECK_ENABLED(bts); bts->site_mgr->gprs.nsvc[idx].nsvci = atoi(argv[1]); + bts->site_mgr->gprs.nsvc[idx].enabled = true; return CMD_SUCCESS; } @@ -1598,6 +1615,7 @@ GPRS_CHECK_ENABLED(bts); bts->site_mgr->gprs.nsvc[idx].local_port = atoi(argv[1]); + bts->site_mgr->gprs.nsvc[idx].enabled = true; return CMD_SUCCESS; } @@ -1619,6 +1637,7 @@ /* sockaddr_in and sockaddr_in6 have the port at the same position */ bts->site_mgr->gprs.nsvc[idx].remote.u.sin.sin_port = htons(atoi(argv[1])); + bts->site_mgr->gprs.nsvc[idx].enabled = true; return CMD_SUCCESS; } @@ -1651,9 +1670,11 @@ switch (remote.af) { case AF_INET: osmo_sockaddr_str_to_in_addr(&remote, &bts->site_mgr->gprs.nsvc[idx].remote.u.sin.sin_addr); + bts->site_mgr->gprs.nsvc[idx].enabled = true; break; case AF_INET6: osmo_sockaddr_str_to_in6_addr(&remote, &bts->site_mgr->gprs.nsvc[idx].remote.u.sin6.sin6_addr); + bts->site_mgr->gprs.nsvc[idx].enabled = true; break; } @@ -4251,6 +4272,11 @@ const struct gsm_gprs_nsvc *nsvc = &bts_sm->gprs.nsvc[i]; struct osmo_sockaddr_str remote; + if (!nsvc->enabled) { + vty_out(vty, " no gprs nsvc %u%s", i, VTY_NEWLINE); + continue; + } + vty_out(vty, " gprs nsvc %u nsvci %u%s", i, nsvc->nsvci, VTY_NEWLINE); @@ -4951,6 +4977,7 @@ install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd); install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd); install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd); + install_element(BTS_NODE, &cfg_no_bts_gprs_nsvc_cmd); install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd); install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd); install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd); diff --git a/src/osmo-bsc/nm_gprs_nsvc_fsm.c b/src/osmo-bsc/nm_gprs_nsvc_fsm.c index a3555aa..beedcdd 100644 --- a/src/osmo-bsc/nm_gprs_nsvc_fsm.c +++ b/src/osmo-bsc/nm_gprs_nsvc_fsm.c @@ -96,6 +96,10 @@ static bool has_valid_nsvc(const struct gsm_gprs_nsvc *nsvc) { + /* If not configured (enabled) at all. */ + if (!nsvc->enabled) + return false; + /* remote address must be valid */ if (osmo_sockaddr_is_any(&nsvc->remote)) return false; -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/35571?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Ia112e86aa35f6a245d98ef1b3720c18835faeda6 Gerrit-Change-Number: 35571 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: NAS_Templates: Allow passing old_guti and ptmsi_sig to TAU Req template
by pespin 15 Jan '24

15 Jan '24
Attention is currently required from: daniel, laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35510?usp=email ) Change subject: NAS_Templates: Allow passing old_guti and ptmsi_sig to TAU Req template ...................................................................... Patch Set 2: (1 comment) File library/NAS_Templates.ttcn: https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35510/comment/dad25d9d_a9f7… PS1, Line 153: ts_NAS_MobileId_GUTI_(template (value) GUTI guti) := { > yeah, the above can be named ...GUTI_From_components() or whatever. Done -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35510?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I5e0204e772edefc49a63b73fc4aad2fed5c14cac Gerrit-Change-Number: 35510 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-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Comment-Date: Mon, 15 Jan 2024 15:18:22 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: daniel <dwillmann(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: mme: Add code to derive NAS token from NAS ul_count
by pespin 15 Jan '24

15 Jan '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35570?usp=email ) Change subject: mme: Add code to derive NAS token from NAS ul_count ...................................................................... mme: Add code to derive NAS token from NAS ul_count NAS Token is derived from kasme and NAS ul_count as specified in 3GPP TS 33.401 A.9, and its LSB 16 bits passed to the network when mapping the GUTI to RAI+PTMSI+PTIMSI_SIG. Take the chance to move guti2rai_ptmsi() up to before the place it is used. Change-Id: I5e6003a2fe3e74cc93cfe4a288e6c114aa288d0b --- M library/S1AP_Emulation.ttcn M mme/LTE_CryptoFunctionDefs.cc M mme/LTE_CryptoFunctions.ttcn M mme/MME_Tests.ttcn M mme/key_derivation.c M mme/key_derivation.h 6 files changed, 100 insertions(+), 37 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/70/35570/1 diff --git a/library/S1AP_Emulation.ttcn b/library/S1AP_Emulation.ttcn index 1ef4a76..e3e3216 100644 --- a/library/S1AP_Emulation.ttcn +++ b/library/S1AP_Emulation.ttcn @@ -438,6 +438,7 @@ var S1APEM_Config s1cfg; var charstring vlr_name, mme_name; var integer ai; + var octetstring kasme; alt { /* Configuration primitive from client */ @@ -544,8 +545,13 @@ f_create_expect_proc(procedureCode, vc_conn); S1AP_PROC.reply(S1APEM_register_proc:{procedureCode, vc_conn}) to vc_conn; } + [] S1AP_PROC.getcall(S1APEM_derive_nas_token:{?, ?, -}) -> param(kasme, vc_conn) { + var integer assoc_id := f_assoc_id_by_comp(vc_conn); + var OCT32 nas_token := f_kdf_nas_token(kasme, S1apAssociationTable[assoc_id].nus.tx_count) + S1apAssociationTable[assoc_id].nus.tx_count := S1apAssociationTable[assoc_id].nus.tx_count + 1; + S1AP_PROC.reply(S1APEM_derive_nas_token:{kasme, vc_conn, nas_token}) to vc_conn; + } } - } } @@ -566,10 +572,12 @@ signature S1APEM_register(in MME_UE_S1AP_ID mme_id, in ENB_UE_S1AP_ID enb_id, in S1AP_ConnHdlr hdlr); signature S1APEM_register_proc(in integer procedureCode, in S1AP_ConnHdlr hdlr); +signature S1APEM_derive_nas_token(in octetstring kasme, in S1AP_ConnHdlr hdlr, out OCT32 nas_token); type port S1APEM_PROC_PT procedure { inout S1APEM_register; inout S1APEM_register_proc; + inout S1APEM_derive_nas_token; } with { extension "internal" }; /* Function that can be used as create_cb and will use the expect table */ @@ -669,6 +677,17 @@ log(procedureCode); } +/* Derive NAS Token (and post-increment ul_count): */ +function f_s1apem_derive_nas_token(in octetstring kasme) runs on S1AP_ConnHdlr return OCT32 +{ + var OCT32 nas_token; + S1AP_PROC.call(S1APEM_derive_nas_token:{kasme, self, -}) { + [] S1AP_PROC.getreply(S1APEM_derive_nas_token:{kasme, self, ?}) -> param(nas_token) { + return nas_token; + }; + } +} + private function f_expect_table_init() runs on S1AP_Emulation_CT { var integer i; diff --git a/mme/LTE_CryptoFunctionDefs.cc b/mme/LTE_CryptoFunctionDefs.cc index da2d521..7f82224 100644 --- a/mme/LTE_CryptoFunctionDefs.cc +++ b/mme/LTE_CryptoFunctionDefs.cc @@ -184,6 +184,14 @@ return OCTETSTRING(sizeof(kenb), kenb); } +OCTETSTRING f__kdf__nas__token(const OCTETSTRING &kasme, const INTEGER &ul_count) +{ + TTCN_Buffer ttcn_buf_kasme(kasme); + uint8_t nas_token[32]; + + mme_kdf_nas_token(ttcn_buf_kasme.get_data(), (int)ul_count, nas_token); + return OCTETSTRING(sizeof(nas_token), nas_token); +} } // namespace diff --git a/mme/LTE_CryptoFunctions.ttcn b/mme/LTE_CryptoFunctions.ttcn index 18a3755..f0ea990 100644 --- a/mme/LTE_CryptoFunctions.ttcn +++ b/mme/LTE_CryptoFunctions.ttcn @@ -40,6 +40,8 @@ external function f_kdf_nh(in OCT16 kasme, in OCT32 sync_inp) return OCT32; +external function f_kdf_nas_token(in OCT16 kasme, in integer ul_count) return OCT32; + /********************************************************************************* * mid-level API *********************************************************************************/ diff --git a/mme/MME_Tests.ttcn b/mme/MME_Tests.ttcn index f4f41e2..50b89b3 100644 --- a/mme/MME_Tests.ttcn +++ b/mme/MME_Tests.ttcn @@ -83,6 +83,7 @@ hexstring imsi, charstring ue_ip, NAS_EPS_Types.GUTI guti optional, + octetstring kasme optional, /* TEI (Control) local side, S11 (SGW) */ OCT4 s11_teic_local, @@ -289,6 +290,7 @@ imsi := f_gen_imsi(imsi_suffix), ue_ip := "192.168.123.50", guti := omit, + kasme := omit, s11_teic_local := '00000000'O, s11_teic_remote := omit, s5c_teic_local := '00000000'O, @@ -585,11 +587,11 @@ const OCT3 plmn_id := '00F110'O; const OCT6 sqn := '000000000020'O; const OCT6 ak := substr(autn, 0, 6) xor4b sqn; - var octetstring kasme := f_kdf_kasme(ck, ik, plmn_id, sqn, ak); + g_pars.ue_pars.kasme := f_kdf_kasme(ck, ik, plmn_id, sqn, ak); var S1APEM_Config cfg := { set_nas_keys := { - k_nas_int := f_kdf_nas_int(1, kasme), - k_nas_enc := f_kdf_nas_enc(1, kasme) + k_nas_int := f_kdf_nas_int(1, g_pars.ue_pars.kasme), + k_nas_enc := f_kdf_nas_enc(1, g_pars.ue_pars.kasme) } }; S1AP.send(cfg); @@ -856,6 +858,31 @@ } } + +/* 3GPP TS 23.401 D.3.5, TS 23.003 2.8.2.1 */ +private function guti2rai_ptmsi(in NAS_EPS_Types.GUTI guti, in OCT2 truncated_nas_token, out RoutingAreaIdentity rai, out OCT4 ptmsi, out OCT3 ptmsi_sig) runs on ConnHdlr { + var bitstring mtmsi_bits := oct2bit(guti.mTMSI); + var bitstring ptmsi_bits; + var bitstring ptmsi_sig_bits; + + rai := valueof(ts_RoutingAreaIdentity(guti.mccDigit1 & guti.mccDigit2 & guti.mccDigit3, + guti.mncDigit3 & guti.mncDigit1 & guti.mncDigit2, + guti.mMEGI, guti.mMEC)); + /* 3GPP TS 23.003 2.8.2.0: "P-TMSI shall be of 32 bits length where the two topmost bits are + * reserved and always set to '11'. Hence, for a UE which may handover to GERAN/UTRAN (based on + * subscription and UE capabilities), the corresponding bits in the M-TMSI are set to '11'" + */ + ptmsi_bits := '11'B & substr(mtmsi_bits, 2, 6) & oct2bit(guti.mMEC) & substr(mtmsi_bits, 16, 16); + ptmsi_sig_bits := substr(mtmsi_bits, 8, 8) & oct2bit(truncated_nas_token); + ptmsi := bit2oct(ptmsi_bits); + ptmsi_sig := bit2oct(ptmsi_sig_bits); + /* TODO: The UE shall fill the remaining 2 octets of the <P-TMSI signature> according to clauses 9.1.1, 9.4.1, 10.2.1, or + * 10.5.1 of 3GPP TS.33.401 [89] , as appropriate, for RAU/Attach procedures.*/ +} + +/* Test UE attached to EUTRAN reselecting a GERAN cell. In this scenario, the + * new SGSN will attempt to obtain information of the UE from the old SGSN (MME) + * through Gn interface using SGSN Context Request/Response procedure (OS#6294). */ private function f_gtp_sgsn_context_4g_to_2g(OCT4 new_sgsn_local_teid := '12345678'O) runs on ConnHdlr { var template (value) GTPC_PDUs SGSNContextReqPDU; var RoutingAreaIdentity rai; @@ -864,7 +891,11 @@ var Gtp1cUnitdata gtpc_pdu; var OCT4 old_mme_local_teid; - guti2rai_ptmsi(g_pars.ue_pars.guti, rai, ptmsi, ptmsi_sig); + /* Derive NAS Token (and post-increment ul_count): */ + var OCT32 nas_token := f_s1apem_derive_nas_token(g_pars.ue_pars.kasme); + var OCT2 truncated_nas_token := substr(nas_token, 30, 2); + + guti2rai_ptmsi(g_pars.ue_pars.guti, truncated_nas_token, rai, ptmsi, ptmsi_sig); SGSNContextReqPDU := ts_SGSNContextReqPDU(rai, new_sgsn_local_teid, f_inet_addr(mp_gn_local_ip), ptmsi := ts_PTMSI(ptmsi), ptmsi_sig := ts_PTMSI_sig(ptmsi_sig)); @@ -880,10 +911,10 @@ setverdict(pass); } [] GTP.receive { - setverdict(fail, "unexpected GTPC message from MME"); + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("unexpected GTPC message from MME")); } [] T.timeout { - setverdict(fail, "no SGSN Context Response from MME"); + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("no SGSN Context Response from MME")); } } @@ -1312,36 +1343,6 @@ vc_conn.done; } -/* Test UE attached to EUTRAN reselecting a GERAN cell. In this scenario, the - * new SGSN will attempt to obtain information of the UE from the old SGSN (MME) - * through Gn interface using SGSN Context Request/Response procedure (OS#6294). */ -/* TS 23.003 2.8.2.1 */ -private function guti2rai_ptmsi(in NAS_EPS_Types.GUTI guti, out RoutingAreaIdentity rai, out OCT4 ptmsi, out OCT3 ptmsi_sig) runs on ConnHdlr { - var bitstring mtmsi_bits := oct2bit(guti.mTMSI); - var bitstring ptmsi_bits; - var bitstring ptmsi_sig_bits; - - rai := valueof(ts_RoutingAreaIdentity(guti.mccDigit1 & guti.mccDigit2 & guti.mccDigit3, - guti.mncDigit3 & guti.mncDigit1 & guti.mncDigit2, - guti.mMEGI, guti.mMEC)); - /* 3GPP TS 23.003 2.8.2.0: "P-TMSI shall be of 32 bits length where the two topmost bits are - * reserved and always set to '11'. Hence, for a UE which may handover to GERAN/UTRAN (based on - * subscription and UE capabilities), the corresponding bits in the M-TMSI are set to '11'" - */ - ptmsi_bits := '11'B & substr(mtmsi_bits, 2, 6) & oct2bit(guti.mMEC) & substr(mtmsi_bits, 16, 16); - ptmsi_sig_bits := substr(mtmsi_bits, 8, 8) & oct2bit('0000'O); - ptmsi := bit2oct(ptmsi_bits); - ptmsi_sig := bit2oct(ptmsi_sig_bits); - /* TODO: The UE shall fill the remaining 2 octets of the <P-TMSI signature> according to clauses 9.1.1, 9.4.1, 10.2.1, or - * 10.5.1 of 3GPP TS.33.401 [89] , as appropriate, for RAU/Attach procedures.*/ - /* TODO: 3GPP TS 33.401 9.1.1 The 16 least significant bits available in - * the P-TMSI signature field shall be filled with the truncated NAS-token - * according to 3GPP TS 23.003 [3].The truncated NAS-token is defined as the 16 - * least significant bits of the NAS-token. - * The NAS-token is derived as specified in Annex A.9. The UE shall use the uplink NAS COUNT value that it would use - * in the next NAS message to calculate the NAS-token and increase the stored uplink NAS COUNT value by 1.*/ - /* TODO: mMEC "also copied into the 8 Most Significant Bits of the NRI field within the P-TMSI" */ -} private function f_TC_ue_cell_reselect_eutran_to_geran(ConnHdlrPars pars) runs on ConnHdlr { f_init_handler(pars); f_gtp_register_imsi(g_pars.ue_pars.imsi); diff --git a/mme/key_derivation.c b/mme/key_derivation.c index 36e4c91..8d5d8a4 100644 --- a/mme/key_derivation.c +++ b/mme/key_derivation.c @@ -80,3 +80,19 @@ gnutls_hmac_fast(GNUTLS_MAC_SHA256, k, 32, s, 14, kasme); } + +/* TS33.401 Annex A.9: NAS token derivation for inter-RAT mobility */ +void mme_kdf_nas_token(const uint8_t *kasme, uint32_t ul_count, uint8_t *nas_token) +{ + uint8_t s[7]; + + s[0] = 0x17; /* FC Value */ + + ul_count = htonl(ul_count); + memcpy(s+1, &ul_count, 4); + + s[5] = 0x00; + s[6] = 0x04; + + gnutls_hmac_fast(GNUTLS_MAC_SHA256, kasme, 32, s, 7, nas_token); +} diff --git a/mme/key_derivation.h b/mme/key_derivation.h index 496f52b..ae15b65 100644 --- a/mme/key_derivation.h +++ b/mme/key_derivation.h @@ -19,3 +19,5 @@ void mme_kdf_enb(const uint8_t *kasme, uint32_t ul_count, uint8_t *kenb); void mme_kdf_nh(const uint8_t *kasme, const uint8_t *sync_input, uint8_t *kenb); + +void mme_kdf_nas_token(const uint8_t *kasme, uint32_t ul_count, uint8_t *nas_token); -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35570?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I5e6003a2fe3e74cc93cfe4a288e6c114aa288d0b Gerrit-Change-Number: 35570 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in pysim[master]: euicc: Implement EID checksum verification + computation
by laforge 15 Jan '24

15 Jan '24
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/35569?usp=email ) Change subject: euicc: Implement EID checksum verification + computation ...................................................................... euicc: Implement EID checksum verification + computation Change-Id: I2cb342783137ee7e4b1be3b14e9c3747316f1995 --- M pySim/euicc.py A tests/test_euicc.py 2 files changed, 70 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/69/35569/1 diff --git a/pySim/euicc.py b/pySim/euicc.py index 96d95d6..e249f4f 100644 --- a/pySim/euicc.py +++ b/pySim/euicc.py @@ -32,6 +32,36 @@ from pySim.utils import Hexstr, SwHexstr import pySim.global_platform +def compute_eid_checksum(eid) -> str: + """Compute and add/replace check digits of an EID value according to GSMA SGP.29 Section 10.""" + if type(eid) == str: + if len(eid) == 30: + # first pad by 2 digits + eid += "00" + elif len(eid) == 32: + # zero the last two digits + eid = eid[:-2] + "00" + else: + raise ValueError("and EID must be 30 or 32 digits") + eid_int = int(eid) + elif type(eid) == int: + eid_int = eid + if eid_int % 100: + # zero the last two digits + eid_int -= eid_int % 100 + # Using the resulting 32 digits as a decimal integer, compute the remainder of that number on division by + # 97, Subtract the remainder from 98, and use the decimal result for the two check digits, if the result + # is one digit long, its value SHALL be prefixed by one digit of 0. + csum = 98 - (eid_int % 97) + eid_int += csum + return str(eid_int) + +def verify_eid_checksum(eid) -> bool: + """Verify the check digits of an EID value according to GSMA SGP.29 Section 10.""" + # Using the 32 digits as a decimal integer, compute the remainder of that number on division by 97. If the + # remainder of the division is 1, the verification is successful; otherwise the EID is invalid. + return int(eid) % 97 == 1 + class VersionAdapter(Adapter): """convert an EUICC Version (3-int array) to a textual representation.""" diff --git a/tests/test_euicc.py b/tests/test_euicc.py new file mode 100755 index 0000000..05d71ed --- /dev/null +++ b/tests/test_euicc.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +import unittest + +from pySim.euicc import * + +class TestEid(unittest.TestCase): + + def test_eid_verify(self): + for eid in ['89049032123451234512345678901235', '89086030202200000022000023022943', + '89044045116727494800000004479366', 89044045116727494800000004479366]: + self.assertTrue(verify_eid_checksum(eid)) + + def test_eid_verify_wrong(self): + self.assertFalse(verify_eid_checksum('89049032123451234512345678901234')) + self.assertFalse(verify_eid_checksum(89049032123451234512345678901234)) + + def test_eid_encode_with_32_digits(self): + self.assertEquals(compute_eid_checksum('89049032123451234512345678901200'), '89049032123451234512345678901235') + self.assertEquals(compute_eid_checksum('89086030202200000022000023022900'), '89086030202200000022000023022943') + + def test_eid_encode_with_30digits(self): + self.assertEquals(compute_eid_checksum('890490321234512345123456789012'), '89049032123451234512345678901235') + + def test_eid_encode_with_wrong_csum(self): + # input: EID with wrong checksum + self.assertEquals(compute_eid_checksum('89049032123451234512345678901299'), '89049032123451234512345678901235') + self.assertEquals(compute_eid_checksum(89049032123451234512345678901299), '89049032123451234512345678901235') + +if __name__ == "__main__": + unittest.main() -- To view, visit https://gerrit.osmocom.org/c/pysim/+/35569?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I2cb342783137ee7e4b1be3b14e9c3747316f1995 Gerrit-Change-Number: 35569 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-hnbgw[master]: Display RANAP state during 'show cnlink'
by pespin 15 Jan '24

15 Jan '24
Attention is currently required from: laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/35568?usp=email ) Change subject: Display RANAP state during 'show cnlink' ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/35568?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I6ab7d08fcd0631d31a12418f950c5901a93db43a Gerrit-Change-Number: 35568 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Mon, 15 Jan 2024 13:06:38 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-hnbgw[master]: Display RANAP state during 'show cnlink'
by laforge 15 Jan '24

15 Jan '24
Attention is currently required from: laforge. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/35568?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Verified-1 by Jenkins Builder Change subject: Display RANAP state during 'show cnlink' ...................................................................... Display RANAP state during 'show cnlink' This adds a line to the output showing DISCONNECTED or CONNNECTED state for each cnlink during the 'show cnlink' VTY command. Closes: SYS#6741 Change-Id: I6ab7d08fcd0631d31a12418f950c5901a93db43a --- M src/osmo-hnbgw/cnlink.c M src/osmo-hnbgw/hnbgw_vty.c M tests/config/defaults.vty M tests/config/legacy.vty M tests/config/one_cs7.vty M tests/config/one_cs7_with_addrs.vty M tests/config/one_cs7_with_iucs_addr.vty M tests/config/one_cs7_with_iups_addr.vty M tests/config/two_cs7.vty M tests/config/two_cs7_with_addrs.vty 10 files changed, 32 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/68/35568/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/35568?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I6ab7d08fcd0631d31a12418f950c5901a93db43a Gerrit-Change-Number: 35568 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in osmo-hnbgw[master]: Display RANAP state during 'show cnlink'
by laforge 15 Jan '24

15 Jan '24
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/35568?usp=email ) Change subject: Display RANAP state during 'show cnlink' ...................................................................... Display RANAP state during 'show cnlink' This adds a line to the output showing DISCONNECTED or CONNNECTED state for each cnlink during the 'show cnlink' VTY command. Closes: SYS#6741 Change-Id: I6ab7d08fcd0631d31a12418f950c5901a93db43a --- M src/osmo-hnbgw/cnlink.c M src/osmo-hnbgw/hnbgw_vty.c 2 files changed, 16 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/68/35568/1 diff --git a/src/osmo-hnbgw/cnlink.c b/src/osmo-hnbgw/cnlink.c index 0ff8163..78cd72f 100644 --- a/src/osmo-hnbgw/cnlink.c +++ b/src/osmo-hnbgw/cnlink.c @@ -304,7 +304,7 @@ static struct osmo_fsm_state cnlink_fsm_states[] = { [CNLINK_ST_DISC] = { - .name = "DISC", + .name = "DISCONNECTED", .in_event_mask = 0 | S(CNLINK_EV_RX_RESET) | S(CNLINK_EV_RX_RESET_ACK) @@ -317,7 +317,7 @@ .action = cnlink_disc_action, }, [CNLINK_ST_CONN] = { - .name = "CONN", + .name = "CONNECTED", .in_event_mask = 0 | S(CNLINK_EV_RX_RESET) | S(CNLINK_EV_RX_RESET_ACK) diff --git a/src/osmo-hnbgw/hnbgw_vty.c b/src/osmo-hnbgw/hnbgw_vty.c index 8cbe249..62fe4aa 100644 --- a/src/osmo-hnbgw/hnbgw_vty.c +++ b/src/osmo-hnbgw/hnbgw_vty.c @@ -149,6 +149,7 @@ rt = osmo_ss7_route_lookup(ss7, cnlink->remote_addr.pc); vty_out(vty, " SS7 route: %s%s", osmo_ss7_route_name(rt, true), VTY_NEWLINE); + vty_out(vty, " RANAP state: %s%s", osmo_fsm_inst_state_name(cnlink->fi), VTY_NEWLINE); } DEFUN(show_cnlink, show_cnlink_cmd, "show cnlink", -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/35568?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I6ab7d08fcd0631d31a12418f950c5901a93db43a Gerrit-Change-Number: 35568 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-bsc[master]: Also track downtime when OML link is lost
by pespin 15 Jan '24

15 Jan '24
Attention is currently required from: jolly, lynxis lazus. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/35566?usp=email ) Change subject: Also track downtime when OML link is lost ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/35566?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I1776099cbfef51af1d5a3a056fb0654abd7366a9 Gerrit-Change-Number: 35566 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Mon, 15 Jan 2024 11:26:59 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-bsc[master]: Also track downtime when OML link is lost
by jolly 15 Jan '24

15 Jan '24
Attention is currently required from: lynxis lazus, pespin. jolly has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/35566?usp=email ) Change subject: Also track downtime when OML link is lost ...................................................................... Patch Set 1: (1 comment) File src/osmo-bsc/bts_ipaccess_nanobts.c: https://gerrit.osmocom.org/c/osmo-bsc/+/35566/comment/2bb98965_0121496b PS1, Line 763: static void ipaccess_sign_link_down(struct e1inp_line *line) > Looks like you probably want to add the downtime count here instead of ipaccess_drop_oml()? What if […] ipaccess_sign_link_down() calls ipaccess_drop_oml() in any case. ipaccess_sign_link_down() acquires the BTS pointer from the link that went down. -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/35566?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I1776099cbfef51af1d5a3a056fb0654abd7366a9 Gerrit-Change-Number: 35566 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Mon, 15 Jan 2024 11:09:05 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in pysim[master]: ts_102_221: Better explain 'selected file invalidated'
by jolly 15 Jan '24

15 Jan '24
Attention is currently required from: laforge. jolly has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/35565?usp=email ) Change subject: ts_102_221: Better explain 'selected file invalidated' ...................................................................... Patch Set 1: (2 comments) Commit Message: https://gerrit.osmocom.org/c/pysim/+/35565/comment/41346fd9_8dbaa57f PS1, Line 9: Some specs call it 'invalidated', others call it 'deactivaed'. If the deactivated File docs/shell.rst: https://gerrit.osmocom.org/c/pysim/+/35565/comment/7383d053_0bb53b77 PS1, Line 415: sed used? -- To view, visit https://gerrit.osmocom.org/c/pysim/+/35565?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I91488b0e7dc25a8970022b09e575485a4165eefa Gerrit-Change-Number: 35565 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: jolly <andreas(a)eversberg.eu> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Mon, 15 Jan 2024 10:10:21 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • ...
  • 156
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.