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 -----
  • November
  • 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

February 2024

  • 1 participants
  • 1748 discussions
[L] Change in osmo-trx[master]: ms: add demod test tool and data
by laforge 27 Feb '24

27 Feb '24
Attention is currently required from: Hoernchen, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/36047?usp=email ) Change subject: ms: add demod test tool and data ...................................................................... Patch Set 3: Code-Review+1 (1 comment) File utils/va-test/burst-gen.cpp: https://gerrit.osmocom.org/c/osmo-trx/+/36047/comment/df457c3c_2e42d239 PS3, Line 80: // mrv(): bits(), demod_bits() {} > All of this is debug code which is why it contains copied code from the sigproclib and constants so […] Done -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/36047?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I852e34d9667d1f12f235f8b3da1fcc0d738b2db9 Gerrit-Change-Number: 36047 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 27 Feb 2024 08:25:24 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: Hoernchen <ewild(a)sysmocom.de> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[L] Change in osmo-trx[master]: ms: add sigproclib demod
by laforge 27 Feb '24

27 Feb '24
Attention is currently required from: Hoernchen, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/36046?usp=email ) Change subject: ms: add sigproclib demod ...................................................................... Patch Set 2: Code-Review+1 (1 comment) File Transceiver52M/ms/ms_rx_lower.cpp: https://gerrit.osmocom.org/c/osmo-trx/+/36046/comment/c1ff8973_60abb91d PS2, Line 161: #if 1 > " Required config option part of a future […] Done -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/36046?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I6558992bd69f18526be5ebe7d424ca00ceb67772 Gerrit-Change-Number: 36046 Gerrit-PatchSet: 2 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 27 Feb 2024 08:24:42 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: Hoernchen <ewild(a)sysmocom.de> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: epdg: Make sure PCO is forwarded from strongswan to PGW and back
by laforge 27 Feb '24

27 Feb '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36059?usp=email ) Change subject: epdg: Make sure PCO is forwarded from strongswan to PGW and back ...................................................................... epdg: Make sure PCO is forwarded from strongswan to PGW and back Related: OS#6369 Change-Id: Ie01d6e88b3ccc55fecc97c2ba75bb31bba5b9ef7 --- M epdg/EPDG_Tests.ttcn M library/GSUP_Templates.ttcn M library/PCO_Types.ttcn 3 files changed, 91 insertions(+), 4 deletions(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/epdg/EPDG_Tests.ttcn b/epdg/EPDG_Tests.ttcn index ff026cf..44dc80f 100644 --- a/epdg/EPDG_Tests.ttcn +++ b/epdg/EPDG_Tests.ttcn @@ -46,6 +46,10 @@ integer mp_s2b_local_port := GTP2C_PORT; charstring mp_s2b_remote_ip := "127.0.0.1"; integer mp_s2b_remote_port := GTP2C_PORT; + charstring mp_s2b_dns_ipv4 := "1.2.3.4"; + charstring mp_s2b_dns_ipv6 := "::1"; + charstring mp_s2b_pcscf_ipv4 := "5.6.7.8"; + charstring mp_s2b_pcscf_ipv6 := "::2"; charstring mp_diam_realm := "localdomain"; integer mp_diam_watchdog_initial_wait_sec := 6*3; @@ -433,6 +437,45 @@ } } +private function f_exp_tr_GTP2C_APCO_in_CreateSessionReq() + runs on EPDG_ConnHdlr return template (present) APCO { + var template ProtocolIDs_and_ContainerIDs protos, protosV4, protosV6, protosV46; + protosV4 := {tr_GTP2C_PCO_P_DNS_IPv4(''O), tr_GTP2C_PCO_P_PCSCF_IPv4(''O)}; + protosV6 := {tr_GTP2C_PCO_P_DNS_IPv6(''O), tr_GTP2C_PCO_P_PCSCF_IPv6(''O)}; + protosV46 := {tr_GTP2C_PCO_P_DNS_IPv4(''O), tr_GTP2C_PCO_P_PCSCF_IPv4(''O), + tr_GTP2C_PCO_P_DNS_IPv6(''O), tr_GTP2C_PCO_P_PCSCF_IPv6(''O)} + /* TODO: pick proto based on req_type v4, v6 or v4v6 */ + protos := protosV4; + return tr_GTP2C_APCO('0000'B, protos); +} + +private function f_GTPv2C_gen_APCO_response(APCO apco_req) runs on EPDG_ConnHdlr return template (value) APCO { + var ProtocolIDs_and_ContainerIDs proto_list_resp := {}; + + for (var integer i := 0; i < lengthof(apco_req.protocolIDs_and_ContainerIDs); i := i + 1) { + var ProtocolID_or_ContainerID proto_req := apco_req.protocolIDs_and_ContainerIDs[i]; + select (proto_req.protocolID_or_ContainerID) { + case (PCO_P_to_OCT2(PCO_P_DNS_IPv4_ADDR)) { + proto_list_resp := proto_list_resp & { valueof(ts_GTP2C_PCO_P_DNS_IPv4(f_inet_addr(mp_s2b_dns_ipv4))) }; + } + case (PCO_P_to_OCT2(PCO_P_DNS_IPv6_ADDR)) { + proto_list_resp := proto_list_resp & { valueof(ts_GTP2C_PCO_P_DNS_IPv6(f_inet_addr(mp_s2b_dns_ipv6))) }; + } + case (PCO_P_to_OCT2(PCO_P_PCSCF_IPv4_ADDR)) { + proto_list_resp := proto_list_resp & { valueof(ts_GTP2C_PCO_P_PCSCF_IPv4(f_inet_addr(mp_s2b_pcscf_ipv4))) }; + } + case (PCO_P_to_OCT2(PCO_P_PCSCF_ADDR)) { + proto_list_resp := proto_list_resp & { valueof(ts_GTP2C_PCO_P_PCSCF_IPv6(f_inet_addr(mp_s2b_pcscf_ipv6))) }; + } + case else { + log("Ignoring unknown PCO Protocol ID: ", proto_req); + } + } + } + + return ts_GTP2C_APCO(apco_req.instance, proto_list_resp); +} + /* ePDG Creates session at the PGW. PGW sends Diameter s6b AAR + AAA. */ private altstep as_GTP2C_CreateSession_success() runs on EPDG_ConnHdlr { var PDU_GTPCv2 rx_msg; @@ -441,7 +484,7 @@ var template (value) PDN_AddressAllocation paa; var template (value) BearerContextIEs bctx_ies; - [] GTP2.receive(tr_GTP2C_CreateSessionReq(g_pars.imsi)) -> value rx_msg { + [] GTP2.receive(tr_GTP2C_CreateSessionReq(g_pars.imsi, apco := f_exp_tr_GTP2C_APCO_in_CreateSessionReq())) -> value rx_msg { /* Parse TEIC and Bearer EBI and TEID and store it in g_pars */ g_pars.teic_remote := rx_msg.gtpcv2_pdu.createSessionRequest.fullyQualifiedTEID[0].tEID_GRE_Key; rx_bctx_ies := rx_msg.gtpcv2_pdu.createSessionRequest.bearerContextGrouped[0].bearerContextIEs; @@ -466,7 +509,8 @@ charging_id := ts_GTP2C_ChargingID(g_pars.teic_local)); GTP2.send(ts_GTP2C_CreateSessionResp(g_pars.teic_remote, rx_msg.sequenceNumber, { fteid_c_ie }, paa, - { ts_GTP2C_BcGrouped(bctx_ies) } )); + { ts_GTP2C_BcGrouped(bctx_ies) }, + f_GTPv2C_gen_APCO_response(rx_msg.gtpcv2_pdu.createSessionRequest.aPCO) )); setverdict(pass); } [] GTP2.receive(PDU_GTPCv2:?) -> value rx_msg { @@ -605,15 +649,20 @@ GSUP.send(ts_GSUP_EPDGTunnel_REQ(g_pars.imsi, pco)); as_GTP2C_CreateSession_success(); /* Expect a positive response back to the translator; */ - var template (present) GSUP_IEs pdp_info := { + var template (present) GSUP_IEs exp_pdp_info := { tr_GSUP_IE_PDP_CONTEXT_ID(?), tr_GSUP_IE_PDP_ADDRESS(tr_GSUP_PDP_Address_IPv4(f_inet_addr(g_pars.ue_ip))), tr_GSUP_IE_APN(f_enc_dns_hostname(g_pars.apn)), tr_GSUP_IE_PDP_QOS(?), tr_GSUP_IE_Charging_Characteristics(?) }; + var template (present) PCO_DATA exp_pco := tr_PCO({ + tr_PCO_P_DNS_IPv4(f_inet_addr(mp_s2b_dns_ipv4)), + tr_PCO_P_PCSCF_IPv4(f_inet_addr(mp_s2b_pcscf_ipv4)) + }); + /* TODO: check for v6 and v4v6 types ^ */ alt { - [] GSUP.receive(tr_GSUP_EPDGTunnel_RES(g_pars.imsi, pdp_info)); + [] GSUP.receive(tr_GSUP_EPDGTunnel_RES(g_pars.imsi, exp_pdp_info)); [] GSUP.receive(GSUP_PDU:?) -> value rx_gsup { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unexpected GSUP msg rx: ", rx_gsup)); } diff --git a/library/GSUP_Templates.ttcn b/library/GSUP_Templates.ttcn index d886088..9daf9c0 100644 --- a/library/GSUP_Templates.ttcn +++ b/library/GSUP_Templates.ttcn @@ -301,6 +301,14 @@ } } +template (present) GSUP_IE tr_GSUP_IE_PCO(template (present) PCO_DATA pco := ?) := { + tag := OSMO_GSUP_PCO_IE, + len := ?, + val := { + pco := pco + } +} + template GSUP_PDU tr_GSUP(template GSUP_MessageType msgt := ?, template GSUP_IEs ies := *) := { msg_type := msgt, ies := ies @@ -536,6 +544,7 @@ template (present) GSUP_PDU tr_GSUP_EPDGTunnel_RES(template (present) hexstring imsi, template (present) GSUP_IEs pdp_info, + template (present) PCO_DATA pco := ?, template (present) GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG, template octetstring destination_name := omit) := tr_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_RESULT, @@ -543,6 +552,7 @@ pdp_info_compl := true, pdp_info := pdp_info, message_class := message_class, + pco := pco, destination_name := destination_name)); template (value) GSUP_PDU ts_GSUP_EPDGTunnel_ERR(hexstring imsi, @@ -1229,6 +1239,7 @@ template GSUP_CancelType cancel_type := omit, template hexstring msisdn := omit, template GSUP_IMEIResult imei_result := omit, + template PCO_DATA pco := omit, template GSUP_CnDomain cn_domain := omit, template octetstring source_name := omit, template octetstring destination_name := omit @@ -1278,6 +1289,11 @@ idx := idx + 1; } + if (not istemplatekind(pco, "omit")) { + ies[idx] := tr_GSUP_IE_PCO(pco); + idx := idx + 1; + } + if (not istemplatekind(source_name, "omit")) { ies[idx] := tr_GSUP_IE_Source_Name(source_name); idx := idx + 1; diff --git a/library/PCO_Types.ttcn b/library/PCO_Types.ttcn index 22b475a..0eaa45e 100644 --- a/library/PCO_Types.ttcn +++ b/library/PCO_Types.ttcn @@ -48,6 +48,10 @@ } with { variant "FIELDLENGTH(16)"; variant "BYTEORDER(last)" }; +function PCO_P_to_OCT2(PCO_P p) return OCT2 { + return int2oct(enum2int(p), 2); +} + /* RFC 1332 IP Control Protocol options, extensions in RFC 1877 */ type enumerated IPCP_OPT { IPCP_OPT_IPADDR (3), /* RFC 1332 3.3 */ @@ -108,15 +112,23 @@ template (value) ProtocolElement ts_PCO_P_DNS_IPv4(template (value) octetstring dns4 := ''O) := ts_PCO_P_OCTSTR(PCO_P_DNS_IPv4_ADDR, protoIDContents := dns4); +template (present) ProtocolElement tr_PCO_P_DNS_IPv4(template (present) octetstring dns4 := ?) := + tr_PCO_P_OCTSTR(PCO_P_DNS_IPv4_ADDR, protoIDContents := dns4); template (value) ProtocolElement ts_PCO_P_DNS_IPv6(template (value) octetstring dns6 := ''O) := ts_PCO_P_OCTSTR(PCO_P_DNS_IPv6_ADDR, protoIDContents := dns6); +template (present) ProtocolElement tr_PCO_P_DNS_IPv6(template (present) octetstring dns6 := ?) := + tr_PCO_P_OCTSTR(PCO_P_DNS_IPv6_ADDR, protoIDContents := dns6); template (value) ProtocolElement ts_PCO_P_PCSCF_IPv4(template (value) octetstring pcscf4 := ''O) := ts_PCO_P_OCTSTR(PCO_P_PCSCF_IPv4_ADDR, protoIDContents := pcscf4); +template (present) ProtocolElement tr_PCO_P_PCSCF_IPv4(template (present) octetstring pcscf4 := ?) := + tr_PCO_P_OCTSTR(PCO_P_PCSCF_IPv4_ADDR, protoIDContents := pcscf4); template (value) ProtocolElement ts_PCO_P_PCSCF_IPv6(template (value) octetstring pcscf6 := ''O) := ts_PCO_P_OCTSTR(PCO_P_PCSCF_ADDR, protoIDContents := pcscf6); +template (present) ProtocolElement tr_PCO_P_PCSCF_IPv6(template (present) octetstring pcscf6 := ?) := + tr_PCO_P_OCTSTR(PCO_P_PCSCF_ADDR, protoIDContents := pcscf6); /* PCO send base template */ template (value) PCO_DATA ts_PCO(template (value) ProtocolIDList protocols := {}) := { -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36059?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: Ie01d6e88b3ccc55fecc97c2ba75bb31bba5b9ef7 Gerrit-Change-Number: 36059 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: PGW_Tests: refactor/improve several parameters to accomodate for diff...
by laforge 27 Feb '24

27 Feb '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36074?usp=email ) Change subject: PGW_Tests: refactor/improve several parameters to accomodate for different GTPv2C interfaces ...................................................................... PGW_Tests: refactor/improve several parameters to accomodate for different GTPv2C interfaces So far we were only testing s5/s8 interface, but we'll want to test s2b soon. This commit is a mixture of refactorings and code improvements as a step towards testing S2b interface. Change-Id: I22b3e18d02ca828e2ea43bde2e0a602db236cf50 --- M library/GTPv2_Templates.ttcn M pgw/PGW_Tests.ttcn 2 files changed, 94 insertions(+), 52 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved osmith: Looks good to me, but someone else must approve diff --git a/library/GTPv2_Templates.ttcn b/library/GTPv2_Templates.ttcn index 8df234a..431415a 100644 --- a/library/GTPv2_Templates.ttcn +++ b/library/GTPv2_Templates.ttcn @@ -887,13 +887,14 @@ template (value) octetstring apn, template (value) BIT3 pdn_type, template (omit) FullyQualifiedTEID_List teid_list, template (value) OCT2 chg_car, template (value) uint4_t bearer_id, + template (omit) UserLocationInfo uli := omit, template (value) Bearer_QoS qos := ts_GTP2C_BearerQos('09'O, 0,0,0,0)) := ts_PDU_GTP2C('00000000'O, '000000'O, '20'O, { createSessionRequest := { iMSI := ts_GTP2C_Imsi(imsi), mSISDN := fs_GTP2C_msisdn(msisdn), mEI := omit, - userLocationInfo := omit, + userLocationInfo := uli, servingNetwork := omit, rAT_Type := ts_GTP2C_RatType(rat_type), indication := omit, diff --git a/pgw/PGW_Tests.ttcn b/pgw/PGW_Tests.ttcn index 81fea12..bd32760 100644 --- a/pgw/PGW_Tests.ttcn +++ b/pgw/PGW_Tests.ttcn @@ -98,14 +98,6 @@ port DIAMETER_Conn_PT Gx; port DIAMETER_Conn_PT Gy; - /* TEI (Data) local side */ - var OCT4 g_teid; - /* TEI (Control) local side */ - var OCT4 g_teic; - /* TEI (Data) remote side */ - var OCT4 g_teid_remote; - /* TEI (Control) remote side */ - var OCT4 g_teic_remote; /* GTP-U IPv4 address remote sie */ var OCT4 g_gtpu4_remote; var OCT16 g_gtpu6_remote; @@ -122,6 +114,15 @@ var integer g_start_prog_count := 0; } +type record BearerConfig { + /* EPS Bearer ID */ + uint4_t ebi optional, + /* TEI (Data) local side */ + OCT4 teid_local optional, + /* TEI (Data) remote side */ + OCT4 teid_remote optional +}; + /* configuration data for a given Session */ type record SessionPars { hexstring imsi, @@ -138,7 +139,13 @@ /* APN-AMBR */ octetstring pco optional, octetstring epco optional, + + /* TEI (Control) local side */ + OCT4 teic_local, + /* TEI (Control) remote side */ + OCT4 teic_remote optional, /* Bearer Contexts to be created */ + BearerConfig bearer optional, charstring tun_dev_name, charstring tun_netns_name optional, @@ -148,24 +155,28 @@ } template (value) SessionPars -t_SessionPars(hexstring imsi, charstring tundev, integer rat_type := 6, charstring apn := "internet", +t_SessionPars(hexstring imsi, charstring tundev, template (omit) hexstring msisdn := '1234'H, integer rat_type := 6, charstring apn := "internet", boolean selection_mode := false, BIT3 pdn_type := '001'B) := { imsi := imsi, - msisdn := '1234'H, + msisdn := msisdn, rat_type := rat_type, apn := apn, selection_mode := selection_mode, pdn_type := pdn_type, pco := omit, epco := omit, + teic_local := '00000000'O, + teic_remote := omit, + bearer := { + ebi := 5, + teid_local := omit, + teid_remote := omit + }, tun_dev_name := tundev, tun_netns_name := tundev, gy_validity_time := 0 } -type record BearerConfig { - integer eps_bearer_id -} type function void_fn() runs on PGW_Session_CT; @@ -292,6 +303,9 @@ private function f_handler_init(void_fn fn, SessionPars pars) runs on PGW_Session_CT { g_pars := valueof(pars); + /* allocate + register TEID-C on local side */ + g_pars.teic_local := f_gtp2_allocate_teid(); + g_pars.bearer.teid_local := g_pars.teic_local; fn.apply(); } @@ -346,8 +360,8 @@ imsi := char2oct(f_dec_TBCD(imsi_hex2oct(g_pars.imsi))); //msisdn := char2oct(f_dec_TBCD(substr(ctx_val.msisdn, 1, lengthof(ctx_val.msisdn) -1))); rat_type := int2oct(g_pars.rat_type, 1); - charging_char := char2oct(oct2str('0000'O)); // f_create_session() uses hardcoded chg_car := '0000'O - nsapi := '01'O; // f_create_session() uses hardcoded bearer_id := 1 + charging_char := char2oct(oct2str('0000'O)); // f_s5s8_create_session() uses hardcoded chg_car := '0000'O + nsapi := int2oct(g_pars.bearer.ebi, 1); select (req_type) { case (INITIAL_REQUEST) { tpl := tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control, @@ -550,7 +564,7 @@ /* find F-TEID of the P-GW U side */ var FullyQualifiedTEID rx_fteid; rx_fteid := valueof(f_find_teid(bctx.bearerContextIEs.fullyQualifiedTEID, 5, '0010'B)); - g_teid_remote := rx_fteid.tEID_GRE_Key; + g_pars.bearer.teid_remote := rx_fteid.tEID_GRE_Key; if (rx_fteid.v4_Flag == '1'B) { g_gtpu4_remote := rx_fteid.iPv4_Address; } @@ -559,8 +573,8 @@ } var UECUPS_CreateTun uecups_create := { - tx_teid := oct2int(g_teid_remote), - rx_teid := oct2int(g_teid), + tx_teid := oct2int(g_pars.bearer.teid_remote), + rx_teid := oct2int(g_pars.bearer.teid_local), user_addr_type := IPV4, user_addr := '00000000'O, local_gtp_ep := valueof(ts_UECUPS_SockAddr(f_inet_addr(mp_local_hostname_u))), @@ -582,28 +596,22 @@ } /* create a session on the PGW */ -private function f_create_session() runs on PGW_Session_CT { +private function f_create_session(template (value) FullyQualifiedTEID fteid_c_ie, + template (value) FullyQualifiedTEID fteid_u_ie, + template (omit) UserLocationInfo uli_ie := omit) runs on PGW_Session_CT { var PDU_GTPCv2 rx; - /* allocate + register TEID-C on local side */ - g_teic := f_gtp2_allocate_teid(); - g_teid := g_teic; - - var template (value) FullyQualifiedTEID fteid_c_ie, fteid_u_ie; - fteid_c_ie := ts_GTP2C_FTEID(FTEID_IF_S5S8_SGW_GTPC, g_teic, 0, - f_inet_addr(mp_local_hostname_c), omit); - fteid_u_ie := ts_GTP2C_FTEID(FTEID_IF_S5S8_SGW_GTPU, g_teid, 2, - f_inet_addr(mp_local_hostname_u), omit); var template (value) PDU_GTPCv2 g2c := - ts_GTP2C_CreateSessionReq(imsi := g_pars.imsi, msisdn := g_pars.msisdn, rat_type := 6, + ts_GTP2C_CreateSessionReq(imsi := g_pars.imsi, + msisdn := g_pars.msisdn, + rat_type := g_pars.rat_type, sender_fteid := fteid_c_ie, apn := f_enc_dns_hostname(g_pars.apn), - pdn_type := g_pars.pdn_type, teid_list := { fteid_u_ie }, - chg_car := '0000'O, bearer_id := 1); - /* open5gs up to 1.2.3 won't accept it without ULI, despite not mandatory */ - var template (value) TAI tai := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0001'O }; - var template (value) ECGI ecgi := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0'H, 23 }; - g2c.gtpcv2_pdu.createSessionRequest.userLocationInfo := ts_GTP2C_UserLocInfo(tai := tai, ecgi := ecgi); + pdn_type := g_pars.pdn_type, + teid_list := { fteid_u_ie }, + chg_car := '0000'O, + bearer_id := g_pars.bearer.ebi, + uli := uli_ie); g2c.gtpcv2_pdu.createSessionRequest.servingNetwork := ts_GTP2C_ServingNetwork('001'H, '01F'H); GTP2.send(g2c); @@ -614,10 +622,10 @@ as_DIA_Gy_CCR(INITIAL_REQUEST); } alt { - [] GTP2.receive(tr_GTP2C_CreateSessionResp(d_teid:=g_teic, cause:=Request_accepted)) -> value rx { + [] GTP2.receive(tr_GTP2C_CreateSessionResp(d_teid:=g_pars.teic_local, cause:=Request_accepted)) -> value rx { /* extract TEIDs */ var CreateSessionResponse resp := rx.gtpcv2_pdu.createSessionResponse; - g_teic_remote := resp.fullyQualifiedTEID[0].tEID_GRE_Key; + g_pars.teic_remote := resp.fullyQualifiedTEID[0].tEID_GRE_Key; /* extract allocated address[es] */ var PDN_Address_and_Prefix paa := resp.pDN_AddressAllocation.pDN_Address_and_Prefix; @@ -645,7 +653,7 @@ } } } - [] GTP2.receive(tr_GTP2C_CreateSessionResp(d_teid:=g_teic, cause:=?)) -> value rx { + [] GTP2.receive(tr_GTP2C_CreateSessionResp(d_teid:=g_pars.teic_local, cause:=?)) -> value rx { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unexpected CreateSessionResp(cause=", rx.gtpcv2_pdu.createSessionResponse.cause.causeValue, ")")); @@ -658,18 +666,38 @@ } +/* create a session on the PGW on a S5/S8 interface (from SGW )*/ +private function f_s5s8_create_session() runs on PGW_Session_CT { + var template (value) FullyQualifiedTEID fteid_c_ie, fteid_u_ie; + var template (value) UserLocationInfo uli_ie; + + fteid_c_ie := ts_GTP2C_FTEID(FTEID_IF_S5S8_SGW_GTPC, g_pars.teic_local, 0, + f_inet_addr(mp_local_hostname_c), omit); + fteid_u_ie := ts_GTP2C_FTEID(FTEID_IF_S5S8_SGW_GTPU, g_pars.bearer.teid_local, 2, + f_inet_addr(mp_local_hostname_u), omit); + + + /* open5gs up to 1.2.3 won't accept it without ULI, despite not mandatory */ + var template (value) TAI tai := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0001'O }; + var template (value) ECGI ecgi := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0'H, 23 }; + uli_ie := ts_GTP2C_UserLocInfo(tai := tai, ecgi := ecgi); + + f_create_session(fteid_c_ie, fteid_u_ie, uli_ie); + +} + /* delete the session from the PGW */ private function f_delete_session(template (omit) GTP2C_Cause tx_cause := omit, template (present) OCT4 exp_teid, template (present) GTP2C_Cause exp_cause, boolean expect_diameter := true) runs on PGW_Session_CT { var template (value) FullyQualifiedTEID fteid_c_ie - fteid_c_ie := ts_GTP2C_FTEID(FTEID_IF_S5S8_SGW_GTPC, g_teic, 0, + fteid_c_ie := ts_GTP2C_FTEID(FTEID_IF_S5S8_SGW_GTPC, g_pars.teic_local, 0, f_inet_addr(mp_local_hostname_c), omit); var template PDU_GTPCv2 g2c := - ts_GTP2C_DeleteSessionReq(d_teid := g_teic_remote, cause := tx_cause, + ts_GTP2C_DeleteSessionReq(d_teid := g_pars.teic_remote, cause := tx_cause, sender_fteid := fteid_c_ie, - teid_list := {}, bearer_id := 1); + teid_list := {}, bearer_id := g_pars.bearer.ebi); GTP2.send(g2c); if (Gx.checkstate("Connected") and expect_diameter) { @@ -693,10 +721,10 @@ } /* destroy tunnel in daemon */ - if (isbound(g_teid)) { + if (isbound(g_pars.bearer.teid_local)) { var UECUPS_DestroyTun uecups_destroy := { local_gtp_ep := valueof(ts_UECUPS_SockAddr(f_inet_addr(mp_local_hostname_u))), - rx_teid := oct2int(g_teid) + rx_teid := oct2int(g_pars.bearer.teid_local) }; /* FIXME: what about IPv4/IPv6 differentiation? */ f_gtp2_destroy_tunnel(uecups_destroy); @@ -803,7 +831,7 @@ /* create a session, expect it to succeed */ private function f_TC_createSession() runs on PGW_Session_CT { - f_create_session(); + f_s5s8_create_session(); setverdict(pass); } testcase TC_createSession() runs on PGW_Test_CT { @@ -816,7 +844,7 @@ /* create a session, then execute a ping command on the user plane */ private function f_TC_createSession_ping4() runs on PGW_Session_CT { - f_create_session(); + f_s5s8_create_session(); f_ping4(mp_ping_hostname); setverdict(pass); } @@ -847,8 +875,8 @@ /* create a session, then delete it again */ private function f_TC_createSession_deleteSession() runs on PGW_Session_CT { - f_create_session(); - f_delete_session(omit, g_teic, Request_accepted); + f_s5s8_create_session(); + f_delete_session(omit, g_pars.teic_local, Request_accepted); setverdict(pass); } testcase TC_createSession_deleteSession() runs on PGW_Test_CT { @@ -861,8 +889,7 @@ /* send a DeleteSessionReq for an unknown/invalid TEID */ private function f_TC_deleteSession_unknown() runs on PGW_Session_CT { - g_teic := f_gtp2_allocate_teid(); - g_teic_remote := f_rnd_octstring(4); + g_pars.teic_remote := f_rnd_octstring(4); f_delete_session(omit, '00000000'O, Context_Not_Found, false); setverdict(pass); } @@ -878,7 +905,7 @@ private function f_TC_gy_charging_cc_time() runs on PGW_Session_CT { var default d; - f_create_session(); + f_s5s8_create_session(); /* We should receive an update even if no traffic is sent: */ as_DIA_Gy_CCR(UPDATE_REQUEST); @@ -894,7 +921,7 @@ as_DIA_Gy_CCR(UPDATE_REQUEST); f_validate_gy_cc_report(g_rx_gy, VALIDITY_TIME, (3..4), ?, ?); - f_delete_session(omit, g_teic, Request_accepted); + f_delete_session(omit, g_pars.teic_local, Request_accepted); f_validate_gy_cc_report(g_rx_gy, FINAL, (0..1), 0, 0); setverdict(pass); } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36074?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: I22b3e18d02ca828e2ea43bde2e0a602db236cf50 Gerrit-Change-Number: 36074 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: GTPv2_Templates: Allow specifying APCO IE in CreateSessionReq/Resp
by laforge 27 Feb '24

27 Feb '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36058?usp=email ) Change subject: GTPv2_Templates: Allow specifying APCO IE in CreateSessionReq/Resp ...................................................................... GTPv2_Templates: Allow specifying APCO IE in CreateSessionReq/Resp Change-Id: I860a9424d6109434a953b1aa39d1fa6035fc7e94 --- M library/GTPv2_Templates.ttcn 1 file changed, 78 insertions(+), 4 deletions(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/library/GTPv2_Templates.ttcn b/library/GTPv2_Templates.ttcn index 9f242ee..8df234a 100644 --- a/library/GTPv2_Templates.ttcn +++ b/library/GTPv2_Templates.ttcn @@ -762,6 +762,68 @@ pDN_CSID_List := {csid}, instance := instance); +/* 8.94 Additional Protocol Configuration Options (APCO) */ +template (present) ProtocolID_or_ContainerID +tr_GTP2C_PCO_P(template (present) OCT2 protocolID_or_ContainerID := ?, + template (present) octetstring protID_orContID_Contents := ?) := { + protocolID_or_ContainerID := protocolID_or_ContainerID, + lengthIndicator := ?, + protID_orContID_Contents := protID_orContID_Contents +} +template (value) ProtocolID_or_ContainerID +ts_GTP2C_PCO_P(template (value) OCT2 protocolID_or_ContainerID, + template (value) octetstring protID_orContID_Contents := ''O) := { + protocolID_or_ContainerID := protocolID_or_ContainerID, + lengthIndicator := 0, + protID_orContID_Contents := protID_orContID_Contents +} + +template (present) ProtocolID_or_ContainerID tr_GTP2C_PCO_P_DNS_IPv4(template (present) octetstring dns4 := ?) := + tr_GTP2C_PCO_P('000d'O, dns4); +template (value) ProtocolID_or_ContainerID ts_GTP2C_PCO_P_DNS_IPv4(template (value) octetstring dns4 := ''O) := + ts_GTP2C_PCO_P('000d'O, dns4); + +template (present) ProtocolID_or_ContainerID tr_GTP2C_PCO_P_DNS_IPv6(template (present) octetstring dns6 := ?) := + tr_GTP2C_PCO_P('0003'O, dns6); +template (value) ProtocolID_or_ContainerID ts_GTP2C_PCO_P_DNS_IPv6(template (value) octetstring dns6 := ''O) := + ts_GTP2C_PCO_P('0003'O, dns6); + +template (present) ProtocolID_or_ContainerID tr_GTP2C_PCO_P_PCSCF_IPv4(template (present) octetstring pcscf4 := ?) := + tr_GTP2C_PCO_P('000C'O, pcscf4); +template (value) ProtocolID_or_ContainerID ts_GTP2C_PCO_P_PCSCF_IPv4(template (value) octetstring pcscf4 := ''O) := + ts_GTP2C_PCO_P('000C'O, pcscf4); + +template (present) ProtocolID_or_ContainerID tr_GTP2C_PCO_P_PCSCF_IPv6(template (present) octetstring pcscf6 := ?) := + tr_GTP2C_PCO_P('0001'O, pcscf6); +template (value) ProtocolID_or_ContainerID ts_GTP2C_PCO_P_PCSCF_IPv6(template (value) octetstring pcscf6 := ''O) := + ts_GTP2C_PCO_P('0001'O, pcscf6); + +template (value) APCO +ts_GTP2C_APCO(template (value) BIT4 instance := '0000'B, + template (value) ProtocolIDs_and_ContainerIDs protocolIDs_and_ContainerIDs := {}) := { + elementIdentifier := 'A3'O, + lengthIndicator := 0, + instance := instance, + spare := '0000'B, + configProtocol := '000'B, + spare2 := '0000'B, + extensionField := '1'B, + protocolIDs_and_ContainerIDs := protocolIDs_and_ContainerIDs, + additionalOctets := omit +} +template (present) APCO +tr_GTP2C_APCO(template (present) BIT4 instance := ?, + template ProtocolIDs_and_ContainerIDs protocolIDs_and_ContainerIDs := *) := { + elementIdentifier := 'A3'O, + lengthIndicator := ?, + instance := instance, + spare := ?, + configProtocol := '000'B, + spare2 := '0000'B, + extensionField := '1'B, + protocolIDs_and_ContainerIDs := protocolIDs_and_ContainerIDs, + additionalOctets := * +} template (value) PDU_GTPCv2 ts_PDU_GTP2C(template (omit) OCT4 teid, template (value) OCT3 seq, template (value) OCT1 msg_type, @@ -890,7 +952,9 @@ template (present) PDU_GTPCv2 -tr_GTP2C_CreateSessionReq(template (present) hexstring imsi := ?, template (present) octetstring apn := ?) := +tr_GTP2C_CreateSessionReq(template (present) hexstring imsi := ?, + template (present) octetstring apn := ?, + template APCO apco := *) := tr_PDU_GTP2C('00000000'O, ?, { createSessionRequest := { iMSI := tr_GTP2C_Imsi(imsi), @@ -921,7 +985,7 @@ signallingPriorityIndication := *, iP_Addr := omit, portNumber := omit, - aPCO := *, + aPCO := apco, trustedWLANAccessNetworkIdentifier := omit, cNOperatorSelectionEntity := omit, presenceReportingAreaInformation := omit, @@ -943,7 +1007,8 @@ template (value) OCT3 seq, template (value) FullyQualifiedTEID_List fteids, template (value) PDN_AddressAllocation addr, - template (omit) BearerContextGrouped_List bearerContextGrouped := omit) := + template (omit) BearerContextGrouped_List bearerContextGrouped := omit, + template (omit) APCO apco := omit) := ts_PDU_GTP2C(d_teid, seq, '21'O, { createSessionResponse := { cause := ts_GTP2C_Cause(Request_accepted, '0'B), @@ -963,7 +1028,7 @@ csid := omit, lDN := omit, pGW_Back_OffTime := omit, - aPCO := omit, + aPCO := apco, trustedWLANIPv4Parameters := omit, indicationFlags := omit, presenceReportingAreaAction := omit, -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36058?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: I860a9424d6109434a953b1aa39d1fa6035fc7e94 Gerrit-Change-Number: 36058 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: PGW_Tests: refactor/improve several parameters to accomodate for diff...
by laforge 27 Feb '24

27 Feb '24
Attention is currently required from: lynxis lazus, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36074?usp=email ) Change subject: PGW_Tests: refactor/improve several parameters to accomodate for different GTPv2C interfaces ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36074?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: I22b3e18d02ca828e2ea43bde2e0a602db236cf50 Gerrit-Change-Number: 36074 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Tue, 27 Feb 2024 08:23:25 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: epdg: Make sure PCO is forwarded from strongswan to PGW and back
by laforge 27 Feb '24

27 Feb '24
Attention is currently required from: lynxis lazus, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36059?usp=email ) Change subject: epdg: Make sure PCO is forwarded from strongswan to PGW and back ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36059?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: Ie01d6e88b3ccc55fecc97c2ba75bb31bba5b9ef7 Gerrit-Change-Number: 36059 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Tue, 27 Feb 2024 08:23:02 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: GTPv2_Templates: Allow specifying APCO IE in CreateSessionReq/Resp
by laforge 27 Feb '24

27 Feb '24
Attention is currently required from: lynxis lazus, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36058?usp=email ) Change subject: GTPv2_Templates: Allow specifying APCO IE in CreateSessionReq/Resp ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36058?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: I860a9424d6109434a953b1aa39d1fa6035fc7e94 Gerrit-Change-Number: 36058 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Tue, 27 Feb 2024 08:14:04 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[L] Change in osmo-bsc[master]: ctrl: Add lchan show to all ctrl levels
by laforge 27 Feb '24

27 Feb '24
Attention is currently required from: matanp, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/36084?usp=email ) Change subject: ctrl: Add lchan show to all ctrl levels ...................................................................... Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/36084?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: I23c1a7e6f6679e3964e359fb202ffe6781a07e8a Gerrit-Change-Number: 36084 Gerrit-PatchSet: 3 Gerrit-Owner: matanp <matan1008(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: matanp <matan1008(a)gmail.com> Gerrit-Comment-Date: Tue, 27 Feb 2024 08:13:43 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in libosmocore[master]: osmo_io: Change struct osmo_io_ops to contain struct, not union
by laforge 27 Feb '24

27 Feb '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/36062?usp=email ) Change subject: osmo_io: Change struct osmo_io_ops to contain struct, not union ...................................................................... osmo_io: Change struct osmo_io_ops to contain struct, not union As we introduce more modes, and each mode aliases call-back function pointers to those of another mode, we have more and more error cases where we (for exampele) access read_cb, but in reality the user has populated recvfrom_cb. Let's use a struct, meaning that call-backs of one mode no longer alias to the same memory locations of call-backs fro another mode. This allows us to properly check if the user actually provided the right callbacks for the given mode of the iofd. This breaks ABI, but luckily not API. So a simple recompile of higher-layer library + application code will work. Change-Id: I9d302df8d00369e7b30437a52deb205f75882be3 --- M TODO-RELEASE M include/osmocom/core/osmo_io.h M src/core/osmo_io.c M src/core/osmo_io_poll.c 4 files changed, 96 insertions(+), 36 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve diff --git a/TODO-RELEASE b/TODO-RELEASE index a8e812b..3e75184 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -12,6 +12,8 @@ core ADD osmo_sock_sctp_get_peer_addr_info() core ADD gsmtap_inst_fd2() core, DEPRECATE gsmtap_inst_fd() core behavior change osmo_tdef_fsm_inst_state_chg(): allow millisecond precision +core ABI change osmo_io_ops now contains a struct of structs, not union of structs +core ABI change osmo_iofd_set_ioops() now returns a value (error code) isdn ABI change add states and flags for external T200 handling isdn ADD initial implementation of the V.110 Terminal Adapter gsm ABI change add T200 timer states to lapdm_datalink diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h index 46e1a53..3c704be 100644 --- a/include/osmocom/core/osmo_io.h +++ b/include/osmocom/core/osmo_io.h @@ -35,37 +35,35 @@ { return get_value_string(osmo_io_backend_names, val); } struct osmo_io_ops { - union { - /* mode OSMO_IO_FD_MODE_READ_WRITE: */ - struct { - /*! call-back function when something was read from fd */ - void (*read_cb)(struct osmo_io_fd *iofd, int res, struct msgb *msg); - /*! call-back function when write has completed on fd */ - void (*write_cb)(struct osmo_io_fd *iofd, int res, - struct msgb *msg); - /*! call-back function to segment the data at message boundaries. - * Needs to return the size of the next message. If it returns - * -EAGAIN or a value larger than msgb_length() (message is incomplete) - * osmo_io will wait for more data to be read. Other negative values - * cause the msg to be discarded. - * If a full message was received (segmentation_cb() returns a value <= msgb_length()) - * the msgb will be trimmed to size by osmo_io and forwarded to the read call-back. Any - * parsing done to the msgb by segmentation_cb() will be preserved for the read_cb() - * (e.g. setting lxh or msgb->cb). */ - int (*segmentation_cb)(struct msgb *msg); - }; + /* mode OSMO_IO_FD_MODE_READ_WRITE: */ + struct { + /*! call-back function when something was read from fd */ + void (*read_cb)(struct osmo_io_fd *iofd, int res, struct msgb *msg); + /*! call-back function when write has completed on fd */ + void (*write_cb)(struct osmo_io_fd *iofd, int res, + struct msgb *msg); + /*! call-back function to segment the data at message boundaries. + * Needs to return the size of the next message. If it returns + * -EAGAIN or a value larger than msgb_length() (message is incomplete) + * osmo_io will wait for more data to be read. Other negative values + * cause the msg to be discarded. + * If a full message was received (segmentation_cb() returns a value <= msgb_length()) + * the msgb will be trimmed to size by osmo_io and forwarded to the read call-back. Any + * parsing done to the msgb by segmentation_cb() will be preserved for the read_cb() + * (e.g. setting lxh or msgb->cb). */ + int (*segmentation_cb)(struct msgb *msg); + }; - /* mode OSMO_IO_FD_MODE_RECVFROM_SENDTO: */ - struct { - /*! call-back function emulating recvfrom */ - void (*recvfrom_cb)(struct osmo_io_fd *iofd, int res, - struct msgb *msg, - const struct osmo_sockaddr *saddr); - /*! call-back function emulating sendto */ - void (*sendto_cb)(struct osmo_io_fd *iofd, int res, - struct msgb *msg, - const struct osmo_sockaddr *daddr); - }; + /* mode OSMO_IO_FD_MODE_RECVFROM_SENDTO: */ + struct { + /*! call-back function emulating recvfrom */ + void (*recvfrom_cb)(struct osmo_io_fd *iofd, int res, + struct msgb *msg, + const struct osmo_sockaddr *saddr); + /*! call-back function emulating sendto */ + void (*sendto_cb)(struct osmo_io_fd *iofd, int res, + struct msgb *msg, + const struct osmo_sockaddr *daddr); }; }; @@ -98,4 +96,4 @@ const char *osmo_iofd_get_name(const struct osmo_io_fd *iofd); void osmo_iofd_set_name(struct osmo_io_fd *iofd, const char *name); -void osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops); +int osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops); diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index e059f87..9de9e2e 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -306,6 +306,8 @@ int res; struct msgb *pending = NULL; + OSMO_ASSERT(iofd->mode == OSMO_IO_FD_MODE_READ_WRITE); + if (rc <= 0) { iofd->io_ops.read_cb(iofd, rc, msg); return; @@ -473,6 +475,24 @@ return 0; } +static int check_mode_callback_compat(enum osmo_io_fd_mode mode, const struct osmo_io_ops *ops) +{ + switch (mode) { + case OSMO_IO_FD_MODE_READ_WRITE: + if (ops->recvfrom_cb || ops->sendto_cb) + return false; + break; + case OSMO_IO_FD_MODE_RECVFROM_SENDTO: + if (ops->read_cb || ops->write_cb) + return false; + break; + default: + break; + } + + return true; +} + /*! Allocate and setup a new iofd. * \param[in] ctx the parent context from which to allocate * \param[in] fd the underlying system file descriptor @@ -496,6 +516,9 @@ return NULL; } + if (!check_mode_callback_compat(mode, ioops)) + return NULL; + iofd = talloc_zero(ctx, struct osmo_io_fd); if (!iofd) return NULL; @@ -543,8 +566,10 @@ return rc; IOFD_FLAG_UNSET(iofd, IOFD_FLAG_CLOSED); - if (iofd->io_ops.read_cb) + if ((iofd->mode == OSMO_IO_FD_MODE_READ_WRITE && iofd->io_ops.read_cb) || + (iofd->mode == OSMO_IO_FD_MODE_RECVFROM_SENDTO && iofd->io_ops.recvfrom_cb)) { osmo_iofd_ops.read_enable(iofd); + } if (iofd->tx_queue.current_length > 0) osmo_iofd_ops.write_enable(iofd); @@ -722,8 +747,11 @@ /*! Set the osmo_io_ops for an iofd. * \param[in] iofd Target iofd file descriptor * \param[in] ioops osmo_io_ops structure to be set */ -void osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops) +int osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops) { + if (!check_mode_callback_compat(iofd->mode, ioops)) + return -EINVAL; + iofd->io_ops = *ioops; switch (iofd->mode) { @@ -743,6 +771,8 @@ default: OSMO_ASSERT(0); } + + return 0; } /*! Notify the user if/when the socket is connected. diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c index 5000dca..d7f80c0 100644 --- a/src/core/osmo_io_poll.c +++ b/src/core/osmo_io_poll.c @@ -81,10 +81,18 @@ rc = sendmsg(ofd->fd, &msghdr->hdr, msghdr->flags); iofd_handle_send_completion(iofd, rc, msghdr); } else { - if (iofd->mode == OSMO_IO_FD_MODE_READ_WRITE) - /* Socket is writable, but we have no data to send. A non-blocking/async - connect() is signalled this way. */ + /* Socket is writable, but we have no data to send. A non-blocking/async + connect() is signalled this way. */ + switch (iofd->mode) { + case OSMO_IO_FD_MODE_READ_WRITE: iofd->io_ops.write_cb(iofd, 0, NULL); + break; + case OSMO_IO_FD_MODE_RECVFROM_SENDTO: + iofd->io_ops.sendto_cb(iofd, 0, NULL, NULL); + break; + default: + break; + } if (osmo_iofd_txqueue_len(iofd) == 0) iofd_poll_ops.write_disable(iofd); } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/36062?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9d302df8d00369e7b30437a52deb205f75882be3 Gerrit-Change-Number: 36062 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • ...
  • 175
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.