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 osmocom-bb[master]: doc/examples/mobile: add tch-{data,voice} sections
by fixeria 24 Jan '24

24 Jan '24
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35636?usp=email ) ( 4 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: doc/examples/mobile: add tch-{data,voice} sections ...................................................................... doc/examples/mobile: add tch-{data,voice} sections Change-Id: I9e53d4c429445ded07d77b27b6a31aa404b00e27 Related: OS#4396 --- M doc/examples/mobile/default.cfg M doc/examples/mobile/multi_ms.cfg 2 files changed, 31 insertions(+), 6 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/doc/examples/mobile/default.cfg b/doc/examples/mobile/default.cfg index 841a356..ac756bb 100644 --- a/doc/examples/mobile/default.cfg +++ b/doc/examples/mobile/default.cfg @@ -61,8 +61,13 @@ ki comp128 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 no barred-access rplmn 001 01 - audio - io-handler none + tch-data + io-handler unix-sock + io-tch-format ti + unix-socket /tmp/ms_data_1 + tch-voice + io-handler l1phy +! io-format ti alsa-output-dev default alsa-input-dev default no shutdown diff --git a/doc/examples/mobile/multi_ms.cfg b/doc/examples/mobile/multi_ms.cfg index c7d4097..48cdfb1 100644 --- a/doc/examples/mobile/multi_ms.cfg +++ b/doc/examples/mobile/multi_ms.cfg @@ -61,8 +61,13 @@ ki comp128 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 no barred-access rplmn 001 01 - audio - io-handler none + tch-data + io-handler unix-sock + io-tch-format ti + unix-socket /tmp/ms_data.one + tch-voice + io-handler l1phy +! io-format ti alsa-output-dev default alsa-input-dev default no shutdown @@ -117,8 +122,13 @@ ki comp128 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff no barred-access rplmn 001 01 - audio - io-handler none + tch-data + io-handler unix-sock + io-tch-format ti + unix-socket /tmp/ms_data.two + tch-voice + io-handler l1phy +! io-format ti alsa-output-dev default alsa-input-dev default no shutdown -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35636?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I9e53d4c429445ded07d77b27b6a31aa404b00e27 Gerrit-Change-Number: 35636 Gerrit-PatchSet: 7 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmocom-bb[master]: firmware (libosmocore): fix gsm48_chan_mode for TCH/[FH]2.4
by fixeria 24 Jan '24

24 Jan '24
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35637?usp=email ) ( 4 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: firmware (libosmocore): fix gsm48_chan_mode for TCH/[FH]2.4 ...................................................................... firmware (libosmocore): fix gsm48_chan_mode for TCH/[FH]2.4 This is basically a back-port of the fix that was merged to libosmocore.git back in 2013. Our ancient copy of libosmocore, which is used for building the firmware, predates this commit. Ideally, we should rip off this ancient copy and build the firmware against recent master (see OS#2378). But for now, let's just fix our local copy. Otherwise TCH/[FH]2.4 support is broken. Change-Id: I99f528f3e1cd4c04ebb9d8becf1572688dd531ae Related: libosmocore.git 31e844bfe2756e36dd50f8bed9fa8b087ee6a1d9 Related: OS#4396 --- M src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h 1 file changed, 20 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h index 172ef67..e5d129e 100644 --- a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h @@ -345,7 +345,7 @@ GSM48_CMODE_DATA_14k5 = 0x0f, GSM48_CMODE_DATA_12k0 = 0x03, GSM48_CMODE_DATA_6k0 = 0x0b, - GSM48_CMODE_DATA_3k6 = 0x23, + GSM48_CMODE_DATA_3k6 = 0x13, }; /* Chapter 9.1.2 */ -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35637?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I99f528f3e1cd4c04ebb9d8becf1572688dd531ae Gerrit-Change-Number: 35637 Gerrit-PatchSet: 6 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in ...osmo-epdg[master]: Make CreateSession Req+Resp procedure async
by pespin 23 Jan '24

23 Jan '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35660?usp=email ) Change subject: Make CreateSession Req+Resp procedure async ...................................................................... Make CreateSession Req+Resp procedure async Change-Id: Ib42ed08afa4a06149d2d72ac64487eec808e260f --- M src/epdg_gtpc_s2b.erl M src/ue_fsm.erl 2 files changed, 44 insertions(+), 32 deletions(-) git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/60/35660/1 diff --git a/src/epdg_gtpc_s2b.erl b/src/epdg_gtpc_s2b.erl index fe07a42..fc41351 100644 --- a/src/epdg_gtpc_s2b.erl +++ b/src/epdg_gtpc_s2b.erl @@ -86,6 +86,7 @@ -record(gtp_session, { imsi :: binary(), + pid :: pid(), apn :: binary(), ue_ip :: inet:ip_address(), local_control_tei = 0 :: non_neg_integer(), @@ -136,32 +137,15 @@ end. create_session_req(Imsi) -> - gen_server:call(?SERVER, - {gtpc_create_session_req, {Imsi}}). + gen_server:call(?SERVER, {gtpc_create_session_req, {Imsi}}). -handle_call({gtpc_create_session_req, {Imsi}}, _From, State0) -> - {Sess0, State1} = find_or_new_gtp_session(Imsi, State0), +handle_call({gtpc_create_session_req, {Imsi}}, {Pid, _Tag} = _From, State0) -> + {Sess0, State1} = find_or_new_gtp_session(Imsi, Pid, State0), Req = gen_create_session_request(Sess0, State1), %TODO: increment State.seq_no. tx_gtp(Req, State1), lager:debug("Waiting for CreateSessionResponse~n", []), - receive - {udp, _Socket, IP, InPortNo, RxMsg} -> - try - Resp = gtp_packet:decode(RxMsg), - lager:info("s2b: Rx from IP ~p port ~p ~p~n", [IP, InPortNo, Resp]), - Sess1 = update_gtp_session_from_create_session_response(Resp, Sess0), - lager:info("s2b: Updated Session after create_session_response: ~p~n", [Sess1]), - State2 = update_gtp_session(Sess0, Sess1, State1), - {reply, {ok, Resp}, State2} - catch Any -> - lager:error("Error sending message to receiver, ERROR: ~p~n", [Any]), - {reply, {error, decode_failure}, State1} - end - after 5000 -> - lager:error("Timeout waiting for CreateSessionResponse for ~p~n", [Req]), - {reply, timeout, State1} - end. + {reply, ok, State1}. %% @callback gen_server handle_cast(stop, State) -> @@ -199,13 +183,14 @@ %% Internal Function Definitions %% ------------------------------------------------------------------ -new_gtp_session(Imsi, State) -> +new_gtp_session(Imsi, Pid, State) -> % TODO: find non-used local TEI inside State Bearer = #gtp_bearer{ ebi = 5, local_data_tei = State#gtp_state.next_local_data_tei }, Sess = #gtp_session{imsi = Imsi, + pid = Pid, apn = ?APN, local_control_tei = State#gtp_state.next_local_control_tei, bearer = Bearer @@ -224,13 +209,13 @@ undefined, State#gtp_state.sessions). -find_or_new_gtp_session(Imsi, State) -> +find_or_new_gtp_session(Imsi, Pid, State) -> Sess = find_gtp_session_by_imsi(Imsi, State), case Sess of #gtp_session{imsi = Imsi} -> {Sess, State}; undefined -> - new_gtp_session(Imsi, State) + new_gtp_session(Imsi, Pid, State) end. update_gtp_session(OldSess, NewSess, State) -> @@ -277,6 +262,20 @@ connect(Address) -> connect(?SVC_NAME, Address). +rx_gtp(Resp = #gtp{version = v2, type = create_session_response}, State0) -> + Sess0 = find_gtp_session_by_local_teic(Resp#gtp.tei, State0), + case Sess0 of + undefined -> + lager:error("Rx unknown TEI ~p: ~p~n", [Resp#gtp.tei, Resp]), + {noreply, State0}; + Sess0 -> + Sess1 = update_gtp_session_from_create_session_response(Resp, Sess0), + lager:info("s2b: Updated Session after create_session_response: ~p~n", [Sess1]), + State1 = update_gtp_session(Sess0, Sess1, State0), + ue_fsm:received_gtpc_create_session_response(Sess0#gtp_session.pid, {ok, Resp}), + {noreply, State1} + end; + rx_gtp(Req = #gtp{version = v2, type = delete_bearer_request}, State) -> Sess = find_gtp_session_by_local_teic(Req#gtp.tei, State), case Sess of @@ -289,6 +288,7 @@ State1 = delete_gtp_session(Sess, State), {noreply, State1} end; + rx_gtp(Req, State) -> lager:error("S2b: UNIMPLEMENTED Rx: ~p~n", [Req]), {noreply, State}. diff --git a/src/ue_fsm.erl b/src/ue_fsm.erl index 0fe6992..f6b2b7e 100644 --- a/src/ue_fsm.erl +++ b/src/ue_fsm.erl @@ -36,7 +36,7 @@ -export([start_link/1]). -export([init/1,callback_mode/0,terminate/3]). --export([auth_request/1, lu_request/1, tunnel_request/1]). +-export([auth_request/1, lu_request/1, tunnel_request/1, received_gtpc_create_session_response/2]). -export([state_new/3,state_authenticated/3]). -record(ue_fsm_data, { @@ -60,6 +60,10 @@ lager:info("ue_fsm tunnel_request~n", []), gen_statem:cast(Pid, tunnel_request). +received_gtpc_create_session_response(Pid, Msg) -> + lager:info("ue_fsm received_gtpc_create_session_response ~p~n", [Msg]), + gen_statem:cast(Pid, {received_gtpc_create_session_response, Msg}). + init(Imsi) -> lager:info("ue_fsm init(~p)~n", [Imsi]), Data = #ue_fsm_data{imsi = Imsi}, @@ -96,14 +100,13 @@ state_authenticated(cast, tunnel_request, Data) -> lager:info("ue_fsm state_authenticated event=tunnel_request, ~p~n", [Data]), - Result = epdg_gtpc_s2b:create_session_req(Data#ue_fsm_data.imsi), + epdg_gtpc_s2b:create_session_req(Data#ue_fsm_data.imsi), + {keep_state, Data}; + +state_authenticated(cast, {received_gtpc_create_session_response, Result}, Data) -> + lager:info("ue_fsm state_authenticated event=received_gtpc_create_session_response, ~p~n", [Data]), gsup_server:tunnel_response(Data#ue_fsm_data.imsi, Result), - case Result of - {ok, _} -> - {keep_state, Data}; - {error, Err} -> - {stop, Err, Data} - end; + {keep_state, Data}; state_authenticated(cast, _Whatever, Data) -> lager:info("ue_fsm state_authenticated event=auth_request, ~p~n", [Data]), -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35660?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-epdg Gerrit-Branch: master Gerrit-Change-Id: Ib42ed08afa4a06149d2d72ac64487eec808e260f Gerrit-Change-Number: 35660 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in ...osmo-epdg[master]: Introduce ue_fsm
by pespin 23 Jan '24

23 Jan '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35659?usp=email ) Change subject: Introduce ue_fsm ...................................................................... Introduce ue_fsm Decouple gsup_server from other protocols. Change-Id: I0c960c4c250458384ed706a99582ec52083019f6 --- M src/gsup_server.erl A src/ue_fsm.erl 2 files changed, 269 insertions(+), 70 deletions(-) git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/59/35659/1 diff --git a/src/gsup_server.erl b/src/gsup_server.erl index b8ed637..5fe227c 100644 --- a/src/gsup_server.erl +++ b/src/gsup_server.erl @@ -41,19 +41,28 @@ -include_lib("osmo_gsup/include/gsup_protocol.hrl"). -include_lib("gtplib/include/gtp_packet.hrl"). +-define(SERVER, ?MODULE). + -define(IPAC_PROTO_EXT_GSUP, {osmo, 5}). -record(gsups_state, { lsocket, % listening socket lport, % local port. only interesting if we bind with port 0 socket, % current active socket. we only support a single tcp connection - ccm_options % ipa ccm options + ccm_options, % ipa ccm options + ues = sets:new() + }). + +-record(gsups_ue, { + imsi :: binary(), + pid :: pid() }). -export([start_link/3]). -export([init/1, handle_call/3, handle_cast/2, handle_info/2]). -export([code_change/3, terminate/2]). +-export([auth_response/2, lu_response/2, tunnel_response/2]). % TODO: -spec dia_sip2gsup('SIP-Auth-Data-Item'()) -> #'GSUPAuthTuple'{}. dia_sip2gsup(#'SIP-Auth-Data-Item'{'SIP-Authenticate' = [Authenticate], 'SIP-Authorization' = [Authorization], @@ -71,7 +80,7 @@ %% ------------------------------------------------------------------ start_link(ServerAddr, ServerPort, Options) -> - gen_server:start_link(?MODULE, [ServerAddr, ServerPort, Options], [{debug, [trace]}]). + gen_server:start_link({local, ?SERVER}, ?MODULE, [ServerAddr, ServerPort, Options], [{debug, [trace]}]). %% ------------------------------------------------------------------ %% gen_server Function Definitions @@ -105,20 +114,76 @@ end. % send a given GSUP message and synchronously wait for message type ExpRes or ExpErr -handle_call({transceive_gsup, GsupMsgTx, ExpRes, ExpErr}, _From, State) -> - Socket = State#gsups_state.socket, - {ok, Imsi} = maps:find(imsi, GsupMsgTx), - ipa_proto:send(Socket, ?IPAC_PROTO_EXT_GSUP, GsupMsgTx), - % selective receive for only those GSUP responses we expect - receive - {ipa, Socket, ?IPAC_PROTO_EXT_GSUP, GsupMsgRx = #{message_type := ExpRes, imsi := Imsi}} -> - {reply, GsupMsgRx, State}; +handle_call(Info, _From, State) -> + error_logger:error_report(["unknown handle_call", {module, ?MODULE}, {info, Info}, {state, State}]), + {reply, error, not_implemented}. - {ipa, Socket, ?IPAC_PROTO_EXT_GSUP, GsupMsgRx = #{message_type := ExpErr, imsi := Imsi}} -> - {reply, GsupMsgRx, State} - after 5000 -> - {reply, timeout, State} - end. +handle_cast({auth_response, {Imsi, Auth}}, State) -> + lager:info("auth_response for ~p: ~p~n", [Imsi, Auth]), + Socket = State#gsups_state.socket, + case Auth of + {ok, Mar} -> SipAuthTuples = Mar#'MAA'.'SIP-Auth-Data-Item', + % AuthTuples = dia_sip2gsup(SipAuthTuples), + Resp = #{message_type => send_auth_info_res, + message_class => 5, + imsi => list_to_binary(Mar#'MAA'.'User-Name'), + auth_tuples => lists:map(fun dia_sip2gsup/1, SipAuthTuples) + }; + {error, _} -> Resp = #{message_type => send_auth_info_err, imsi => Imsi, message_class => 5, cause => 16#11} + end, + lager:info("GSUP: Tx ~p~n", [Resp]), + ipa_proto:send(Socket, ?IPAC_PROTO_EXT_GSUP, Resp), + {noreply, State}; + +handle_cast({lu_response, {Imsi, Result}}, State) -> + lager:info("lu_response for ~p: ~p~n", [Imsi, Result]), + Socket = State#gsups_state.socket, + case Result of + {ok, _Sar} -> Resp = #{message_type => location_upd_res, + imsi => Imsi, + message_class => 5 + }; + {error, _} -> Resp = #{message_type => location_upd_err, + imsi => Imsi, + message_class => 5, + cause => 16#11 % FIXME: Use proper defines as cause code and use Network failure + } + end, + lager:info("GSUP: Tx ~p~n", [Resp]), + ipa_proto:send(Socket, ?IPAC_PROTO_EXT_GSUP, Resp), + {noreply, State}; + +handle_cast({tunnel_response, {Imsi, Result}}, State) -> + lager:info("tunnel_response for ~p: ~p~n", [Imsi, Result]), + Socket = State#gsups_state.socket, + case Result of + {ok, #gtp{version = v2, type = create_session_response}} -> + {ok, CreateSessResp} = Result, + IEs = CreateSessResp#gtp.ie, + %%#{{v2_bearer_context,0} := BearerMap} = IEs, + #{{v2_pdn_address_allocation,0} := Paa} = IEs, + PdpAddress = #{pdp_type_org => 1, pdp_type_nr => 16#21, address => #{ ipv4 => Paa#v2_pdn_address_allocation.address}}, + PdpInfo = #{pdp_context_id => 0, + pdp_address => PdpAddress, + access_point_name => "foobar.apn", + quality_of_service => <<0, 0, 0>>, + pdp_charging => 0}, + Resp = #{message_type => epdg_tunnel_result, + imsi => Imsi, + message_class => 5, + pdp_info_complete => true, + pdp_info_list => [PdpInfo] + }; + {error, _} -> + Resp = #{message_type => epdg_tunnel_error, + imsi => Imsi, + message_class => 5, + cause => 16#11 % FIXME: Use proper defines as cause code and use Network failure + } + end, + lager:info("GSUP: Tx ~p~n", [Resp]), + ipa_proto:send(Socket, ?IPAC_PROTO_EXT_GSUP, Resp), + {noreply, State}; handle_cast(Info, S) -> error_logger:error_report(["unknown handle_cast", {module, ?MODULE}, {info, Info}, {state, S}]), @@ -140,74 +205,47 @@ {noreply, S#gsups_state{socket=Socket}}; % send auth info / requesting authentication tuples -handle_info({ipa, Socket, ?IPAC_PROTO_EXT_GSUP, GsupMsgRx = #{message_type := send_auth_info_req, imsi := Imsi}}, S) -> - Auth = auth_handler:auth_request(Imsi), - case Auth of - {ok, Mar} -> SipAuthTuples = Mar#'MAA'.'SIP-Auth-Data-Item', - % AuthTuples = dia_sip2gsup(SipAuthTuples), - Resp = #{message_type => send_auth_info_res, - message_class => 5, - imsi => list_to_binary(Mar#'MAA'.'User-Name'), - auth_tuples => lists:map(fun dia_sip2gsup/1, SipAuthTuples) - }; - {error, _} -> Resp = #{message_type => send_auth_info_err, imsi => Imsi, message_class => 5, cause => 16#11} - end, - lager:info("auth tuples: ~p ~n", [Resp]), - ipa_proto:send(Socket, ?IPAC_PROTO_EXT_GSUP, Resp), - {noreply, S}; +handle_info({ipa, _Socket, ?IPAC_PROTO_EXT_GSUP, _GsupMsgRx = #{message_type := send_auth_info_req, imsi := Imsi}}, State0) -> + {UE, State1} = find_or_new_gsups_ue(Imsi, State0), + ue_fsm:auth_request(UE#gsups_ue.pid), + {noreply, State1}; % location update request / when a UE wants to connect to a specific APN. This will trigger a AAA->HLR Request Server Assignment Request % FIXME: add APN instead of hardcoded internet -handle_info({ipa, Socket, ?IPAC_PROTO_EXT_GSUP, GsupMsgRx = #{message_type := location_upd_req, imsi := Imsi}}, S) -> - % FIXME: use enum for Server-Assignment-Type => REGISTERING - Result = epdg_diameter_swx:server_assignment_request(Imsi, 1, "internet"), - case Result of - {ok, Sar} -> Resp = #{message_type => location_upd_res, - imsi => Imsi, - message_class => 5 - }; - {error, _} -> Resp = #{message_type => location_upd_err, - imsi => Imsi, - message_class => 5, - cause => 16#11 % FIXME: Use proper defines as cause code and use Network failure - } +handle_info({ipa, Socket, ?IPAC_PROTO_EXT_GSUP, _GsupMsgRx = #{message_type := location_upd_req, imsi := Imsi}}, State) -> + UE = find_gsups_ue_by_imsi(Imsi, State), + case UE of + #gsups_ue{imsi = Imsi} -> + ue_fsm:lu_request(UE#gsups_ue.pid); + undefined -> + Resp = #{message_type => location_upd_err, + imsi => Imsi, + message_class => 5, + cause => 16#11 % FIXME: Use proper defines as cause code and use Network failure + }, + lager:info("GSUP: Tx ~p~n", [Resp]), + ipa_proto:send(Socket, ?IPAC_PROTO_EXT_GSUP, Resp) end, - ipa_proto:send(Socket, ?IPAC_PROTO_EXT_GSUP, Resp), - {noreply, S}; + {noreply, State}; % epdg tunnel request / trigger the establishment to the PGW and prepares everything for the user traffic to flow % When sending a epdg_tunnel_response everything must be ready for the UE traffic -handle_info({ipa, Socket, ?IPAC_PROTO_EXT_GSUP, GsupMsgRx = #{message_type := epdg_tunnel_request, imsi := Imsi}}, S) -> +handle_info({ipa, Socket, ?IPAC_PROTO_EXT_GSUP, GsupMsgRx = #{message_type := epdg_tunnel_request, imsi := Imsi}}, State) -> lager:info("GSUP: Rx ~p~n", [GsupMsgRx]), - Result = epdg_gtpc_s2b:create_session_req(Imsi), - case Result of - {ok, #gtp{version = v2, type = create_session_response}} -> - {ok, CreateSessResp} = Result, - IEs = CreateSessResp#gtp.ie, - %%#{{v2_bearer_context,0} := BearerMap} = IEs, - #{{v2_pdn_address_allocation,0} := Paa} = IEs, - PdpAddress = #{pdp_type_org => 1, pdp_type_nr => 16#21, address => #{ ipv4 => Paa#v2_pdn_address_allocation.address}}, - PdpInfo = #{pdp_context_id => 0, - pdp_address => PdpAddress, - access_point_name => "foobar.apn", - quality_of_service => <<0, 0, 0>>, - pdp_charging => 0}, - Resp = #{message_type => epdg_tunnel_result, - imsi => Imsi, - message_class => 5, - pdp_info_complete => true, - pdp_info_list => [PdpInfo] - }; - {error, _} -> + UE = find_gsups_ue_by_imsi(Imsi, State), + case UE of + #gsups_ue{imsi = Imsi} -> + ue_fsm:tunnel_request(UE#gsups_ue.pid); + undefined -> Resp = #{message_type => epdg_tunnel_error, imsi => Imsi, message_class => 5, cause => 16#11 % FIXME: Use proper defines as cause code and use Network failure - } + }, + lager:info("GSUP: Tx ~p~n", [Resp]), + ipa_proto:send(Socket, ?IPAC_PROTO_EXT_GSUP, Resp) end, - lager:info("GSUP: Tx ~p~n", [Resp]), - ipa_proto:send(Socket, ?IPAC_PROTO_EXT_GSUP, Resp), - {noreply, S}; + {noreply, State}; handle_info(Info, S) -> error_logger:error_report(["unknown handle_info", {module, ?MODULE}, {info, Info}, {state, S}]), @@ -218,3 +256,43 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}. + +auth_response(Imsi, Auth) -> + lager:info("auth_response(~p): ~p~n", [Imsi, Auth]), + gen_server:cast(?SERVER, {auth_response, {Imsi, Auth}}). + +lu_response(Imsi, Result) -> + lager:info("lu_response(~p): ~p~n", [Imsi, Result]), + gen_server:cast(?SERVER, {lu_response, {Imsi, Result}}). + +tunnel_response(Imsi, Result) -> + lager:info("tunnel_response(~p): ~p~n", [Imsi, Result]), + gen_server:cast(?SERVER, {tunnel_response, {Imsi, Result}}). + +%% ------------------------------------------------------------------ +%% Internal Function Definitions +%% ------------------------------------------------------------------ + +new_gsups_ue(Imsi, State) -> + {ok, Pid} = ue_fsm:start_link(Imsi), + UE = #gsups_ue{imsi = Imsi, pid = Pid}, + NewSt = State#gsups_state{ues = sets:add_element(UE, State#gsups_state.ues)}, + {UE, NewSt}. + +% returns gsups_ue if found, undefined it not +find_gsups_ue_by_imsi(Imsi, State) -> + sets:fold( + fun(UEsIt = #gsups_ue{imsi = Imsi}, _AccIn) -> UEsIt; + (_, AccIn) -> AccIn + end, + undefined, + State#gsups_state.ues). + +find_or_new_gsups_ue(Imsi, State) -> + UE = find_gsups_ue_by_imsi(Imsi, State), + case UE of + #gsups_ue{imsi = Imsi} -> + {UE, State}; + undefined -> + new_gsups_ue(Imsi, State) + end. \ No newline at end of file diff --git a/src/ue_fsm.erl b/src/ue_fsm.erl new file mode 100644 index 0000000..0fe6992 --- /dev/null +++ b/src/ue_fsm.erl @@ -0,0 +1,110 @@ +% UE FSM +% (C) 2023 by sysmocom +% +% All Rights Reserved +% +% This program is free software; you can redistribute it and/or modify +% it under the terms of the GNU Affero General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU Affero General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +% Additional Permission under GNU AGPL version 3 section 7: +% +% If you modify this Program, or any covered work, by linking or +% combining it with runtime libraries of Erlang/OTP as released by +% Ericsson on http://www.erlang.org (or a modified version of these +% libraries), containing parts covered by the terms of the Erlang Public +% License (http://www.erlang.org/EPLICENSE) the licensors of this +% Program grant you additional permission to convey the resulting work +% without the need to license the runtime libraries of Erlang/OTP under +% the GNU Affero General Public License. Corresponding Source for a +% non-source form of such a combination shall include the source code +% for the parts of the runtime libraries of Erlang/OTP used as well as +% that of the covered work. + +-module(ue_fsm). +-behaviour(gen_statem). +-define(NAME, ue_fsm). + +-export([start_link/1]). +-export([init/1,callback_mode/0,terminate/3]). +-export([auth_request/1, lu_request/1, tunnel_request/1]). +-export([state_new/3,state_authenticated/3]). + +-record(ue_fsm_data, { + imsi + }). + +start_link(Imsi) -> + ServerName = lists:concat([?NAME, "_", binary_to_list(Imsi)]), + lager:info("ue_fsm start_link(~p)~n", [ServerName]), + gen_statem:start_link({local, list_to_atom(ServerName)}, ?MODULE, Imsi, [{debug, [trace]}]). + +auth_request(Pid) -> + lager:info("ue_fsm auth_request~n", []), + gen_statem:cast(Pid, auth_request). + +lu_request(Pid) -> + lager:info("ue_fsm lu_request~n", []), + gen_statem:cast(Pid, lu_request). + +tunnel_request(Pid) -> + lager:info("ue_fsm tunnel_request~n", []), + gen_statem:cast(Pid, tunnel_request). + +init(Imsi) -> + lager:info("ue_fsm init(~p)~n", [Imsi]), + Data = #ue_fsm_data{imsi = Imsi}, + {ok, state_new, Data}. + +callback_mode() -> + state_functions. + +terminate(Reason, State, Data) -> + lager:info("terminating ~p with reason ~p state=~p, ~p~n", [?MODULE, Reason, State, Data]), + ok. + +state_new(cast, auth_request, Data) -> + lager:info("ue_fsm state_new event=auth_request, ~p~n", [Data]), + Auth = auth_handler:auth_request(Data#ue_fsm_data.imsi), + gsup_server:auth_response(Data#ue_fsm_data.imsi, Auth), + case Auth of + {ok, _} -> + {next_state, state_authenticated, Data}; + {error, Err} -> + {stop, Err, Data} + end. + +state_authenticated(cast, lu_request, Data) -> + lager:info("ue_fsm state_authenticated event=lu_request, ~p~n", [Data]), + Result = epdg_diameter_swx:server_assignment_request(Data#ue_fsm_data.imsi, 1, "internet"), + gsup_server:lu_response(Data#ue_fsm_data.imsi, Result), + case Result of + {ok, _} -> + {keep_state, Data}; + {error, Err} -> + {stop, Err, Data} + end; + +state_authenticated(cast, tunnel_request, Data) -> + lager:info("ue_fsm state_authenticated event=tunnel_request, ~p~n", [Data]), + Result = epdg_gtpc_s2b:create_session_req(Data#ue_fsm_data.imsi), + gsup_server:tunnel_response(Data#ue_fsm_data.imsi, Result), + case Result of + {ok, _} -> + {keep_state, Data}; + {error, Err} -> + {stop, Err, Data} + end; + +state_authenticated(cast, _Whatever, Data) -> + lager:info("ue_fsm state_authenticated event=auth_request, ~p~n", [Data]), + {keep_state, Data}. \ No newline at end of file -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35659?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-epdg Gerrit-Branch: master Gerrit-Change-Id: I0c960c4c250458384ed706a99582ec52083019f6 Gerrit-Change-Number: 35659 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: mobile: add a separate logging category for CSD
by jolly 23 Jan '24

23 Jan '24
Attention is currently required from: fixeria, laforge. jolly has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35656?usp=email ) Change subject: mobile: add a separate logging category for CSD ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35656?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: If9db0759aeb4324ace9ae258c852787f37897d83 Gerrit-Change-Number: 35656 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 23 Jan 2024 15:24:16 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: GSUP: Fix missing and wrongly sorted IEs in ts_GSUP_IE_PdpInfo
by fixeria 23 Jan '24

23 Jan '24
Attention is currently required from: pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35652?usp=email ) Change subject: GSUP: Fix missing and wrongly sorted IEs in ts_GSUP_IE_PdpInfo ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35652?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: I65e586187d7230f122644c101f8467becae6e204 Gerrit-Change-Number: 35652 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 23 Jan 2024 14:02:11 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: GSUP: Fix PDPInfoCompl IE
by fixeria 23 Jan '24

23 Jan '24
Attention is currently required from: pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35651?usp=email ) Change subject: GSUP: Fix PDPInfoCompl IE ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35651?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: I7b6e584f12828019fc9c0f961a0c8692c0b44b1c Gerrit-Change-Number: 35651 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 23 Jan 2024 14:00:55 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in ...osmo-epdg[master]: Forward IP Address from CreateSessionresponse in GSUP EPDG Tunnel Result
by pespin 23 Jan '24

23 Jan '24
Attention is currently required from: lynxis lazus. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35658?usp=email ) Change subject: Forward IP Address from CreateSessionresponse in GSUP EPDG Tunnel Result ...................................................................... Patch Set 2: (1 comment) Patchset: PS2: I plan to refactor this in a followup patch, probably as a gen_statem, but that's definetly another patch, and meanwhile can cal already pass through the UE IP address. -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35658?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-epdg Gerrit-Branch: master Gerrit-Change-Id: I2a9130d242830daa826414a287f54862752017d2 Gerrit-Change-Number: 35658 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-CC: Jenkins Builder Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Tue, 23 Jan 2024 11:05:59 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[S] Change in ...osmo-epdg[master]: Forward IP Address from CreateSessionresponse in GSUP EPDG Tunnel Result
by pespin 23 Jan '24

23 Jan '24
pespin has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35658?usp=email ) Change subject: Forward IP Address from CreateSessionresponse in GSUP EPDG Tunnel Result ...................................................................... Forward IP Address from CreateSessionresponse in GSUP EPDG Tunnel Result Related: OS#6091 Change-Id: I2a9130d242830daa826414a287f54862752017d2 --- M rebar.config M rebar.lock M src/gsup_server.erl 3 files changed, 29 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/58/35658/2 -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35658?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-epdg Gerrit-Branch: master Gerrit-Change-Id: I2a9130d242830daa826414a287f54862752017d2 Gerrit-Change-Number: 35658 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in ...osmo-epdg[master]: WIP: IP Address in GSUP EPDG Tunnel Result
by pespin 23 Jan '24

23 Jan '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35658?usp=email ) Change subject: WIP: IP Address in GSUP EPDG Tunnel Result ...................................................................... WIP: IP Address in GSUP EPDG Tunnel Result Change-Id: I2a9130d242830daa826414a287f54862752017d2 --- M rebar.config M rebar.lock M src/gsup_server.erl 3 files changed, 28 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/58/35658/1 diff --git a/rebar.config b/rebar.config index a2db3ea..19688f5 100644 --- a/rebar.config +++ b/rebar.config @@ -6,7 +6,7 @@ {lager, {git, "https://github.com/erlang-lager/lager", {tag, "3.9.2"}}}, {gtplib, "3.2.0"}, {osmo_ss7, {git, "https://gitea.osmocom.org/erlang/osmo_ss7", {ref, "9f294d3612f998860004820d1d85b4264721577b"}}}, - {osmo_gsup, {git, "https://gitea.osmocom.org/erlang/osmo_gsup", {branch, "lynxis/epdg"}}} + {osmo_gsup, {git, "https://gerrit.osmocom.org/erlang/osmo_gsup", {branch, "osmocom/epdg"}}} ]}. {minimum_otp_vsn, "20.3"}. diff --git a/rebar.lock b/rebar.lock index 322e84d..d74d179 100644 --- a/rebar.lock +++ b/rebar.lock @@ -11,8 +11,8 @@ {ref,"459a3b2cdd9eadd29e5a7ce5c43932f5ccd6eb88"}}, 0}, {<<"osmo_gsup">>, - {git,"https://gitea.osmocom.org/erlang/osmo_gsup", - {ref,"07672d8ab1608aa9c9e50ca035521876558fcd42"}}, + {git,"https://gerrit.osmocom.org/erlang/osmo_gsup", + {ref,"1a064fa6aece492352271ae164b29262d66f6b6d"}}, 0}, {<<"osmo_ss7">>, {git,"https://gitea.osmocom.org/erlang/osmo_ss7", diff --git a/src/gsup_server.erl b/src/gsup_server.erl index 030a328..b8ed637 100644 --- a/src/gsup_server.erl +++ b/src/gsup_server.erl @@ -38,6 +38,8 @@ -include_lib("diameter_3gpp_ts29_273_swx.hrl"). -include_lib("osmo_ss7/include/ipa.hrl"). +-include_lib("osmo_gsup/include/gsup_protocol.hrl"). +-include_lib("gtplib/include/gtp_packet.hrl"). -define(IPAC_PROTO_EXT_GSUP, {osmo, 5}). @@ -179,10 +181,22 @@ lager:info("GSUP: Rx ~p~n", [GsupMsgRx]), Result = epdg_gtpc_s2b:create_session_req(Imsi), case Result of - {ok, _} -> + {ok, #gtp{version = v2, type = create_session_response}} -> + {ok, CreateSessResp} = Result, + IEs = CreateSessResp#gtp.ie, + %%#{{v2_bearer_context,0} := BearerMap} = IEs, + #{{v2_pdn_address_allocation,0} := Paa} = IEs, + PdpAddress = #{pdp_type_org => 1, pdp_type_nr => 16#21, address => #{ ipv4 => Paa#v2_pdn_address_allocation.address}}, + PdpInfo = #{pdp_context_id => 0, + pdp_address => PdpAddress, + access_point_name => "foobar.apn", + quality_of_service => <<0, 0, 0>>, + pdp_charging => 0}, Resp = #{message_type => epdg_tunnel_result, imsi => Imsi, - message_class => 5 + message_class => 5, + pdp_info_complete => true, + pdp_info_list => [PdpInfo] }; {error, _} -> Resp = #{message_type => epdg_tunnel_error, -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35658?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-epdg Gerrit-Branch: master Gerrit-Change-Id: I2a9130d242830daa826414a287f54862752017d2 Gerrit-Change-Number: 35658 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • ...
  • 156
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.