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

October 2023

  • 1 participants
  • 1843 discussions
[M] Change in libosmocore[master]: gsmtap: Hide implementation of gsmtap_inst
by pespin 13 Oct '23

13 Oct '23
Attention is currently required from: arehbein, daniel, laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/34720?usp=email ) Change subject: gsmtap: Hide implementation of gsmtap_inst ...................................................................... Patch Set 5: (1 comment) Patchset: PS5: Once this is merged, please submit patches for projects using the _fd() version to use the _fd2() instead (and update its TODO-RELEASE to state they need libosmocore > 1.9.0) -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34720?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: Ibe1a51205a6df764571b6d074e365825555609a5 Gerrit-Change-Number: 34720 Gerrit-PatchSet: 5 Gerrit-Owner: arehbein <arehbein(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: arehbein <arehbein(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Comment-Date: Fri, 13 Oct 2023 10:50:10 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[M] Change in libosmocore[master]: gsmtap: Hide implementation of gsmtap_inst
by pespin 13 Oct '23

13 Oct '23
Attention is currently required from: arehbein, daniel, laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/34720?usp=email ) Change subject: gsmtap: Hide implementation of gsmtap_inst ...................................................................... Patch Set 5: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34720?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: Ibe1a51205a6df764571b6d074e365825555609a5 Gerrit-Change-Number: 34720 Gerrit-PatchSet: 5 Gerrit-Owner: arehbein <arehbein(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: arehbein <arehbein(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Comment-Date: Fri, 13 Oct 2023 10:49:12 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in docker-playground[master]: common/ttcn3-docker-run.sh: add TEST_NAME env var
by osmith 13 Oct '23

13 Oct '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/docker-playground/+/34732?usp=email ) Change subject: common/ttcn3-docker-run.sh: add TEST_NAME env var ...................................................................... common/ttcn3-docker-run.sh: add TEST_NAME env var Make it possible to run only one test by setting an environment variable. Change-Id: I1f45a05e089b429918096fcd64f7c02033d5a9dd --- M README.md M common/ttcn3-docker-run.sh 2 files changed, 37 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/32/34732/1 diff --git a/README.md b/README.md index 6f05417..436fdd0 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,16 @@ Osmocom project. Defaults to `master`. * `NO_DOCKER_IMAGE_BUILD`: when set to `1`, it won't try to update the containers (see "caching" below) +* `DOCKER_ARGS`: pass extra arguments to docker, e.g. to mount local sources + for building as done in osmo-dev.git/ttcn3/ttcn3.sh + +### Run only one test + +``` +$ cd ttcn3-hlr-test +$ export DOCKER_ARGS="-e TEST_NAME=TC_gsup_sai" +$ ./jenkins.sh +``` ### Using nightly packages from a different date diff --git a/common/ttcn3-docker-run.sh b/common/ttcn3-docker-run.sh index 26e291c..c8c871e 100755 --- a/common/ttcn3-docker-run.sh +++ b/common/ttcn3-docker-run.sh @@ -33,7 +33,21 @@ cd /data -/osmo-ttcn3-hacks/start-testsuite.sh "/osmo-ttcn3-hacks/$SUBDIR/$SUITE" +# Use TEST_NAME to only run one test instead of all. Set it like this: +# $ cd ttcn3-hlr-test +# $ export DOCKER_ARGS="-e TEST_NAME=TC_gsup_sai" +# $ ./jenkins.sh + +EXTRA_ARGS="" +if [ -n "$TEST_NAME" ]; then + EXTRA_ARGS="$SUITE.$TEST_NAME" +fi + +/osmo-ttcn3-hacks/start-testsuite.sh \ + "/osmo-ttcn3-hacks/$SUBDIR/$SUITE" \ + "$SUITE.cfg" \ + $EXTRA_ARGS + exit_code=$? /osmo-ttcn3-hacks/log_merge.sh "$SUITE" --rm -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/34732?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: I1f45a05e089b429918096fcd64f7c02033d5a9dd Gerrit-Change-Number: 34732 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in libosmocore[master]: gsmtap: Hide implementation of gsmtap_inst
by arehbein 12 Oct '23

12 Oct '23
Attention is currently required from: arehbein, daniel, laforge. Hello Jenkins Builder, daniel, laforge, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/34720?usp=email to look at the new patch set (#5). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder Change subject: gsmtap: Hide implementation of gsmtap_inst ...................................................................... gsmtap: Hide implementation of gsmtap_inst - Use forward decl. of struct gsmtap_inst in header - Remove 'static inline' attributes from gsmtap_inst_fd() declaration, move function definition to gsmtap_util.c and mark it as deprecated - Add gsmtap_inst_fd2() as replacement for gsmtap_inst_fd() Related: OS#6213 Change-Id: Ibe1a51205a6df764571b6d074e365825555609a5 --- M TODO-RELEASE M include/osmocom/core/gsmtap_util.h M src/core/gsmtap_util.c M src/core/libosmocore.map 4 files changed, 48 insertions(+), 15 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/20/34720/5 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34720?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: Ibe1a51205a6df764571b6d074e365825555609a5 Gerrit-Change-Number: 34720 Gerrit-PatchSet: 5 Gerrit-Owner: arehbein <arehbein(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: arehbein <arehbein(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in ...osmo-epdg[master]: gsup_server: call the server_assignment_request() on location update ...
by pespin 12 Oct '23

12 Oct '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/34731?usp=email ) Change subject: gsup_server: call the server_assignment_request() on location update request ...................................................................... gsup_server: call the server_assignment_request() on location update request Change-Id: I3aa506a9860e503ae3e1b0542cc3a2e9cd150c6e --- M src/gsup_server.erl 1 file changed, 23 insertions(+), 4 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsup_server.erl b/src/gsup_server.erl index 26af3b4..923d020 100644 --- a/src/gsup_server.erl +++ b/src/gsup_server.erl @@ -156,11 +156,21 @@ {noreply, S}; % 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) -> - Resp = #{message_type => location_upd_res, - imsi => Imsi, - message_class => 5 - }, + % 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 + } + end, ipa_proto:send(Socket, ?IPAC_PROTO_EXT_GSUP, Resp), {noreply, S}; -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/34731?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: I3aa506a9860e503ae3e1b0542cc3a2e9cd150c6e Gerrit-Change-Number: 34731 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in ...osmo-epdg[master]: epdg_diameter_swx: parse the result code of the MAA
by pespin 12 Oct '23

12 Oct '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/34730?usp=email ) Change subject: epdg_diameter_swx: parse the result code of the MAA ...................................................................... epdg_diameter_swx: parse the result code of the MAA Parse error cases on both the Result-Code and the Experimental-Result-Code of an Media Authentication Answer. Change-Id: I8d2c99f12df3de1df5529d03ffccab07b14337df --- M src/epdg_diameter_swx.erl 1 file changed, 44 insertions(+), 2 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/src/epdg_diameter_swx.erl b/src/epdg_diameter_swx.erl index 6ae0c1f..9909446 100644 --- a/src/epdg_diameter_swx.erl +++ b/src/epdg_diameter_swx.erl @@ -104,6 +104,7 @@ gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). peer_down(API, SvcName, {PeerRef, _} = Peer) -> + % fixme: why do we still have ets here? (catch ets:delete(?MODULE, {API, PeerRef})), gen_server:cast(?SERVER, {peer_down, SvcName, Peer}), ok. @@ -131,7 +132,32 @@ gen_server:call(?SERVER, {sar, {IMSI, Type, APN}}). +result_code_success(2001) -> ok; +result_code_success(2002) -> ok; +result_code_success(_) -> invalid_result_code. + % TODO Sync failure + +-define (MAA_Errors(), #{ + invalid_result_code => #{error => "Unknown result code"}, + invalid_exp_result => #{error => "Unknown experimental result code"}, + unknown_user => #{error => "User is not known by HSS"} +}). + +-spec parse_mar(#'MAA'{}) -> map(). +parse_mar(#'MAA'{'Result-Code' = [ResultCode]} = Maa) -> + Success = result_code_success(ResultCode), + {Success, ResultCode}; + +parse_mar(#'MAA'{'Experimental-Result' = [#{'Vendor-Code' := ?VENDOR_ID_3GPP, 'ExpResultCode' := 5001}]} = Maa) -> + {unknown_user, 5001}; +parse_mar(#'MAA'{'Experimental-Result' = [#{'Vendor-Code' := ?VENDOR_ID_3GPP, 'ExpResultCode' := ResultCode}]} = Maa) -> + {invalid_exp_result, ResultCode}; +parse_mar(Maa) -> + {unknown_err, []}. + +% parse_mar(#'MAA'{'Experimental-Result-Code' = [ResultCode] = MAA) -> + handle_call({mar, {IMSI, NumAuthItems, AuthScheme, RAT, CKey, IntegrityKey}}, _From, State) -> SessionId = diameter:session_id(application:get_env(?SERVER, origin_host, "aaa.example.org")), MAR = #'MAR'{'Vendor-Specific-Application-Id' = #'Vendor-Specific-Application-Id'{ @@ -168,8 +194,12 @@ }, Ret = diameter:call(?SVC_NAME, ?APP_ALIAS, SAR, []), case Ret of - {ok, SAA} -> - {reply, {ok, SAA}, State}; + {ok, Maa} -> + SuccessCode = parse_mar(Maa), + case SuccessCode of + {ok, _} -> {reply, {ok, Maa}, State}; + {Err, Info} -> {reply, {error, {Err, Info, Maa}}, State} + end; {error, Err} -> lager:error("Error: ~w~n", [Err]), {reply, {error, Err}, State} -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/34730?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: I8d2c99f12df3de1df5529d03ffccab07b14337df Gerrit-Change-Number: 34730 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[L] Change in ...osmo-epdg[master]: Initial GSUP server support
by pespin 12 Oct '23

12 Oct '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/34726?usp=email ) Change subject: Initial GSUP server support ...................................................................... Initial GSUP server support This requires branches of osmo_ss7 and osmo_gsup which haven't yet been merged to master. Change-Id: I89986ae958b40d30ec824186b79d3aa88b2af35d --- M rebar.config M rebar.lock D src/gsup_client.erl A src/gsup_server.erl M src/osmo_epdg_sup.erl 5 files changed, 208 insertions(+), 134 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/rebar.config b/rebar.config index 51852e4..03e0e7c 100644 --- a/rebar.config +++ b/rebar.config @@ -4,8 +4,8 @@ {deps, [ {lager, {git, "https://github.com/erlang-lager/lager", {tag, "3.9.2"}}}, - {osmo_ss7, {git, "https://gitea.osmocom.org/erlang/osmo_ss7", {ref, "3c6cdc5a53c4a5ec1aff417f2cbfaa9449004ee6"}}}, - {osmo_gsup, {git, "https://gitea.osmocom.org/erlang/osmo_gsup", {ref, "ee15ee2b44f4a57c57831393d1fed2dc215d36e4"}}} + {osmo_ss7, {git, "https://gitea.osmocom.org/erlang/osmo_ss7", {ref, "9f294d3612f998860004820d1d85b4264721577b"}}}, + {osmo_gsup, {git, "https://gitea.osmocom.org/erlang/osmo_gsup", {ref, "07672d8ab1608aa9c9e50ca035521876558fcd42"}}} ]}. {minimum_otp_vsn, "20.3"}. diff --git a/rebar.lock b/rebar.lock index 4c53cab..4aeafea 100644 --- a/rebar.lock +++ b/rebar.lock @@ -10,11 +10,11 @@ 0}, {<<"osmo_gsup">>, {git,"https://gitea.osmocom.org/erlang/osmo_gsup", - {ref,"ee15ee2b44f4a57c57831393d1fed2dc215d36e4"}}, + {ref,"07672d8ab1608aa9c9e50ca035521876558fcd42"}}, 0}, {<<"osmo_ss7">>, {git,"https://gitea.osmocom.org/erlang/osmo_ss7", - {ref,"3c6cdc5a53c4a5ec1aff417f2cbfaa9449004ee6"}}, + {ref,"9f294d3612f998860004820d1d85b4264721577b"}}, 0}, {<<"parse_trans">>, {git,"https://github.com/uwiger/parse_trans", diff --git a/src/gsup_client.erl b/src/gsup_client.erl deleted file mode 100644 index 6ddfdcb..0000000 --- a/src/gsup_client.erl +++ /dev/null @@ -1,124 +0,0 @@ -% simple, blocking/synchronous GSUP client - -% (C) 2019 by Harald Welte <laforge(a)gnumonks.org> -% (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(gsup_client). - --behaviour(gen_server). - --include_lib("osmo_gsup/include/gsup_protocol.hrl"). --include_lib("osmo_ss7/include/ipa.hrl"). - --define(IPAC_PROTO_EXT_GSUP, {osmo, 5}). - --record(gsupc_state, { - socket, - ipa_pid - }). - --export([start_link/3]). - --export([init/1, handle_call/3, handle_cast/2, handle_info/2]). --export([code_change/3, terminate/2]). - -%% ------------------------------------------------------------------ -%% our exported API -%% ------------------------------------------------------------------ - -start_link(ServerAddr, ServerPort, Options) -> - gen_server:start_link(?MODULE, [ServerAddr, ServerPort, Options], [{debug, [trace]}]). - -%% ------------------------------------------------------------------ -%% gen_server Function Definitions -%% ------------------------------------------------------------------ - -init([Address, Port, Options]) -> - ipa_proto:init(), - % register the GSUP codec with the IPA core; ignore result as we mgiht be doing this multiple times - ipa_proto:register_codec(?IPAC_PROTO_EXT_GSUP, fun gsup_protocol:encode/1, fun gsup_protocol:decode/1), - lager:info("GSUP Server on IP ~s port ~p~n", [Address, Port]), - CcmOptions = #ipa_ccm_options{ - serial_number="EPDG-00-00-00-00-00-00", - unit_id="0/0/0", - mac_address="00:00:00:00:00:00", - location="00:00:00:00:00:00", - unit_type="00:00:00:00:00:00", - equipment_version="00:00:00:00:00:00", - sw_version="00:00:00:00:00:00", - unit_name="EPDG-00-00-00-00-00-00" - }, - case ipa_proto:start_listen(Port, 1, Options) of - {ok, {Socket, IpaPid}} -> - ipa_proto:set_ccm_options(Socket, CcmOptions), - lager:info("connected!~n", []), - true = ipa_proto:register_stream(Socket, ?IPAC_PROTO_EXT_GSUP, {process_id, self()}), - % ipa_proto:unblock(Socket), - {ok, #gsupc_state{socket=Socket, ipa_pid=IpaPid}}; - {error, econnrefused} -> - timer:sleep(5000), - {stop, connrefused} - 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#gsupc_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}; - - {ipa, Socket, ?IPAC_PROTO_EXT_GSUP, GsupMsgRx = #{message_type := ExpErr, imsi := Imsi}} -> - {reply, GsupMsgRx, State} - after 5000 -> - {reply, timeout, State} - end. - -handle_cast(Info, S) -> - error_logger:error_report(["unknown handle_cast", {module, ?MODULE}, {info, Info}, {state, S}]), - {noreply, S}. - -handle_info({ipa_closed, _}, S) -> - lager:error("GSUP connection has been closed, supervisor should reconnect us"), - {stop, ipa_closed, S}; -handle_info(Info, S) -> - error_logger:error_report(["unknown handle_info", {module, ?MODULE}, {info, Info}, {state, S}]), - {noreply, S}. - -terminate(Reason, _S) -> - lager:info("terminating ~p with reason ~p~n", [?MODULE, Reason]). - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. diff --git a/src/gsup_server.erl b/src/gsup_server.erl new file mode 100644 index 0000000..e25e681 --- /dev/null +++ b/src/gsup_server.erl @@ -0,0 +1,181 @@ +% simple, blocking/synchronous GSUP client + +% (C) 2019 by Harald Welte <laforge(a)gnumonks.org> +% (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(gsup_server). + +-behaviour(gen_server). + +-include_lib("diameter_3gpp_ts29_273_swx.hrl"). +-include_lib("osmo_ss7/include/ipa.hrl"). + +-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 + }). + +-export([start_link/3]). + +-export([init/1, handle_call/3, handle_cast/2, handle_info/2]). +-export([code_change/3, terminate/2]). + +% TODO: -spec dia_sip2gsup('SIP-Auth-Data-Item'()) -> #'GSUPAuthTuple'{}. +dia_sip2gsup(#'SIP-Auth-Data-Item'{'SIP-Authenticate' = [Authenticate], 'SIP-Authorization' = [Authorization], + 'Confidentiality-Key' = [CKey], 'Integrity-Key' = [IKey]}) -> + lager:info("dia_sip2gsup: auth ~p authz ~p ~n", [Authenticate, Authorization]), + lager:info(" rand ~p autn ~p ~n", [lists:sublist(Authenticate, 1, 16), lists:sublist(Authenticate, 17, 16)]), + #{rand => list_to_binary(lists:sublist(Authenticate, 1, 16)), + autn=> list_to_binary(lists:sublist(Authenticate, 17, 16)), + res=> list_to_binary(Authorization), + ik=> list_to_binary(IKey), + ck=> list_to_binary(CKey)}. + +%% ------------------------------------------------------------------ +%% our exported API +%% ------------------------------------------------------------------ + +start_link(ServerAddr, ServerPort, Options) -> + gen_server:start_link(?MODULE, [ServerAddr, ServerPort, Options], [{debug, [trace]}]). + +%% ------------------------------------------------------------------ +%% gen_server Function Definitions +%% ------------------------------------------------------------------ + +init([Address, Port, Options]) -> + ipa_proto:init(), + % register the GSUP codec with the IPA core; ignore result as we mgiht be doing this multiple times + ipa_proto:register_codec(?IPAC_PROTO_EXT_GSUP, fun gsup_protocol:encode/1, fun gsup_protocol:decode/1), + lager:info("GSUP Server on IP ~s port ~p~n", [Address, Port]), + CcmOptions = #ipa_ccm_options{ + serial_number="EPDG-00-00-00-00-00-00", + unit_id="0/0/0", + mac_address="00:00:00:00:00:00", + location="00:00:00:00:00:00", + unit_type="00:00:00:00:00:00", + equipment_version="00:00:00:00:00:00", + sw_version="00:00:00:00:00:00", + unit_name="EPDG-00-00-00-00-00-00" + }, + case ipa_proto:start_listen(Port, 1, Options) of + {ok, LSocket, Port} -> + lager:info("connected!~n", []), + {ok, #gsups_state{lsocket = LSocket, lport = Port, ccm_options = CcmOptions}}; + {error, econnrefused} -> + timer:sleep(5000), + {stop, connrefused}; + {error, Reason} -> + timer:sleep(5000), + {stop, Reason} + 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}; + + {ipa, Socket, ?IPAC_PROTO_EXT_GSUP, GsupMsgRx = #{message_type := ExpErr, imsi := Imsi}} -> + {reply, GsupMsgRx, State} + after 5000 -> + {reply, timeout, State} + end. + +handle_cast(Info, S) -> + error_logger:error_report(["unknown handle_cast", {module, ?MODULE}, {info, Info}, {state, S}]), + {noreply, S}. + +% When the IPA connection is closed. +handle_info({ipa_closed, _}, S) -> + lager:error("GSUP connection has been closed, supervisor should reconnect us"), + {noreply, S}; + +% FIXME: handle multiple concurrent connection well +% When a new IPA connection arrives +handle_info({ipa_tcp_accept, Socket}, S) -> + lager:notice("GSUP connection has been established"), + ipa_proto:register_socket(Socket), + ipa_proto:set_ccm_options(Socket, S#gsups_state.ccm_options), + true = ipa_proto:register_stream(Socket, ?IPAC_PROTO_EXT_GSUP, {process_id, self()}), + ipa_proto:unblock(Socket), + lager:info("connected!~n", []), + {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 = {error, 'not_implemented_yet!'}, + %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}; + +% location update request / when a UE wants to connect to a specific APN. This will trigger a AAA->HLR Request Server Assignment Request +handle_info({ipa, Socket, ?IPAC_PROTO_EXT_GSUP, GsupMsgRx = #{message_type := location_upd_req, imsi := Imsi}}, S) -> + Resp = #{message_type => location_upd_res, + imsi => Imsi, + message_class => 5 + }, + ipa_proto:send(Socket, ?IPAC_PROTO_EXT_GSUP, Resp), + {noreply, S}; + +% 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) -> + {noreply, S}; + +handle_info(Info, S) -> + error_logger:error_report(["unknown handle_info", {module, ?MODULE}, {info, Info}, {state, S}]), + {noreply, S}. + +terminate(Reason, _S) -> + lager:info("terminating ~p with reason ~p~n", [?MODULE, Reason]). + +code_change(_OldVsn, State, _Extra) -> + {ok, State}. diff --git a/src/osmo_epdg_sup.erl b/src/osmo_epdg_sup.erl index 231d27f..d5b0e6e 100644 --- a/src/osmo_epdg_sup.erl +++ b/src/osmo_epdg_sup.erl @@ -9,9 +9,14 @@ supervisor:start_link({local, ?SERVER}, ?MODULE, []). init([]) -> - DiaServer = {epdg_diameter_swx, {epdg_diameter_swx,start_link,[]}, - permanent, - 5000, - worker, - [epdg_diameter_swx_cb]}, - {ok, { {one_for_one, 5, 10}, [DiaServer]} }. + DiaServer = {epdg_diameter_swx, {epdg_diameter_swx,start_link,[]}, + permanent, + 5000, + worker, + [epdg_diameter_swx_cb]}, + GsupServer = {gsup_server, {gsup_server, start_link, ["0.0.0.0", 4222, []]}, + permanent, + 5000, + worker, + [gsup_server]}, + {ok, { {one_for_all, 5, 10}, [DiaServer, GsupServer]} }. -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/34726?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: I89986ae958b40d30ec824186b79d3aa88b2af35d Gerrit-Change-Number: 34726 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in ...osmo-epdg[master]: Initial GSUP Auth handler support
by pespin 12 Oct '23

12 Oct '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/34728?usp=email ) Change subject: Initial GSUP Auth handler support ...................................................................... Initial GSUP Auth handler support Change-Id: Iad42c74f1c6f35791d3e33c1082e804eb67e861c --- A src/auth_handler.erl M src/gsup_server.erl M src/osmo_epdg_sup.erl 3 files changed, 74 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/src/auth_handler.erl b/src/auth_handler.erl new file mode 100644 index 0000000..83e8aaf --- /dev/null +++ b/src/auth_handler.erl @@ -0,0 +1,58 @@ +-module(auth_handler). +-behaviour(gen_server). + +-include_lib("osmo_gsup/include/gsup_protocol.hrl"). +-include_lib("diameter_3gpp_ts29_273_swx.hrl"). + +-record(auth_state, { + table_id % ets table id +}). + +-export([start_link/0]). +-export([init/1, handle_call/3, handle_cast/2, handle_info/2]). +-export([code_change/3, terminate/2]). + +-export[(auth_request/1)]. + +-define(SERVER, ?MODULE). + +% The ets table contains only IMSIs + +start_link() -> + gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). + +init([]) -> + TableId = ets:new(auth_req, [bag, named_table]), + {ok, #auth_state{table_id = TableId}}. + + +auth_request(Imsi) -> + gen_server:call(?SERVER, {epdg_auth_req, Imsi}). + +handle_call({epdg_auth_req, Imsi}, From, State) -> + % request the diameter code for a tuple + CKey = [], + IntegrityKey = [], + Result = epdg_diameter_swx:multimedia_auth_request(Imsi, 1, "EAP-AKA", 1, CKey, IntegrityKey), + case Result of + {ok, Mar} -> {reply, {ok, Mar}, State}; + {error, Err} -> {reply, {error, Err}, State}; + {_, _} -> {reply, {error, unknown}, State} + end. + +handle_cast(Info, S) -> + error_logger:error_report(["unknown handle_cast", {module, ?MODULE}, {info, Info}, {state, S}]), + {noreply, S}. +handle_info(Info, S) -> + error_logger:error_report(["unknown handle_info", {module, ?MODULE}, {info, Info}, {state, S}]), + {noreply, S}. + + +stop() -> + gen_server:call(?MODULE, stop). + +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +terminate(Reason, _S) -> + lager:info("terminating ~p with reason ~p~n", [?MODULE, Reason]). diff --git a/src/gsup_server.erl b/src/gsup_server.erl index e25e681..26af3b4 100644 --- a/src/gsup_server.erl +++ b/src/gsup_server.erl @@ -140,8 +140,7 @@ % 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 = {error, 'not_implemented_yet!'}, - %Auth = auth_handler:auth_request(Imsi), + Auth = auth_handler:auth_request(Imsi), case Auth of {ok, Mar} -> SipAuthTuples = Mar#'MAA'.'SIP-Auth-Data-Item', % AuthTuples = dia_sip2gsup(SipAuthTuples), diff --git a/src/osmo_epdg_sup.erl b/src/osmo_epdg_sup.erl index d5b0e6e..a523a7f 100644 --- a/src/osmo_epdg_sup.erl +++ b/src/osmo_epdg_sup.erl @@ -19,4 +19,9 @@ 5000, worker, [gsup_server]}, - {ok, { {one_for_all, 5, 10}, [DiaServer, GsupServer]} }. + AuthHandler = {auth_handler, {auth_handler, start_link, []}, + permanent, + 5000, + worker, + [auth_handler]}, + {ok, { {one_for_all, 5, 10}, [DiaServer, GsupServer, AuthHandler]} }. -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/34728?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: Iad42c74f1c6f35791d3e33c1082e804eb67e861c Gerrit-Change-Number: 34728 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in ...osmo-epdg[master]: gsup_server: call the server_assignment_request() on location update ...
by pespin 12 Oct '23

12 Oct '23
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/34731?usp=email ) Change subject: gsup_server: call the server_assignment_request() on location update request ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/34731?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: I3aa506a9860e503ae3e1b0542cc3a2e9cd150c6e Gerrit-Change-Number: 34731 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Thu, 12 Oct 2023 19:06:28 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in ...osmo-epdg[master]: epdg_diameter_swx: parse the result code of the MAA
by pespin 12 Oct '23

12 Oct '23
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/34730?usp=email ) Change subject: epdg_diameter_swx: parse the result code of the MAA ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/34730?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: I8d2c99f12df3de1df5529d03ffccab07b14337df Gerrit-Change-Number: 34730 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Thu, 12 Oct 2023 19:06:26 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • ...
  • 185
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.