[M] Change in ...osmo-epdg[master]: Propagate SWx PPR as S6b Re-Auth-Request
pespin has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36308?usp=email ) Change subject: Propagate SWx PPR as S6b Re-Auth-Request .. Propagate SWx PPR as S6b Re-Auth-Request This commit implements the 3GPP TS 29.273 section 9.1.2.5 "Service Authorization Information Update Procedures". Related: OS#6400 Change-Id: I0e263dae37d5b8b3cdce2014787eb82910ed686a --- M src/aaa_diameter_s6b.erl M src/aaa_diameter_s6b_cb.erl M src/aaa_ue_fsm.erl 3 files changed, 96 insertions(+), 12 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/src/aaa_diameter_s6b.erl b/src/aaa_diameter_s6b.erl index f8f9027..1639d02 100644 --- a/src/aaa_diameter_s6b.erl +++ b/src/aaa_diameter_s6b.erl @@ -49,7 +49,7 @@ %% gen_server Function Exports -export([init/1, handle_call/3, handle_cast/2, handle_info/2, peer_down/3]). -export([code_change/3]). --export([tx_as_request/1]). +-export([tx_reauth_request/1, tx_as_request/1]). -export([tx_aa_answer/2, tx_st_answer/2]). %% Diameter Application Definitions @@ -138,9 +138,30 @@ % handle_request(STR) was spawned into its own process, and it's blocked waiting for STA: Pid ! {sta, DiaRC}. +tx_reauth_request(NAI) -> +gen_server:call(?SERVER, {rar, NAI}). + tx_as_request(NAI) -> gen_server:call(?SERVER, {asr, NAI}). +handle_call({rar, NAI}, _From, State) -> +lager:debug("S6b Tx RAR NAI=~p~n", [NAI]), +SessionId = diameter:session_id(application:get_env(?ENV_APP_NAME, dia_s6b_origin_host, ?ENV_DEFAULT_ORIG_HOST)), +RAR = #'RAR'{'Session-Id' = SessionId, + 'Auth-Application-Id' = ?DIAMETER_APP_ID_S6b, + 'Re-Auth-Request-Type' = ?'RE-AUTH-REQUEST-TYPE_AUTHORIZE_ONLY', + 'User-Name' = [NAI] +}, +lager:debug("S6b Tx RAR: ~p~n", [RAR]), +Ret = diameter_call(RAR, State), +case Ret of +ok -> +{reply, ok, State}; +{error, Err} -> +lager:error("Error: ~w~n", [Err]), +{reply, {error, Err}, State} +end; + handle_call({asr, NAI}, _From, State) -> lager:debug("S6b Tx ASR NAI=~p~n", [NAI]), SessionId = diameter:session_id(application:get_env(?ENV_APP_NAME, dia_s6b_origin_host, ?ENV_DEFAULT_ORIG_HOST)), diff --git a/src/aaa_diameter_s6b_cb.erl b/src/aaa_diameter_s6b_cb.erl index b3f8d5f..8e2bcca 100644 --- a/src/aaa_diameter_s6b_cb.erl +++ b/src/aaa_diameter_s6b_cb.erl @@ -41,6 +41,15 @@ | Avps]}; % TODO: is there a simple way to capture all the following requests? prepare_request(#diameter_packet{msg = Req}, _, {_, Caps}) + when is_record(Req, 'RAR') -> +#diameter_caps{origin_host = {OH, DH}, origin_realm = {OR, DR}} = Caps, + Msg = Req#'RAR'{'Origin-Host' = OH, +'Origin-Realm' = OR, +'Destination-Realm' = DR, +'Destination-Host' = DH}, +lager:debug("S6b prepare_request: ~p~n", [Msg]), + {send, Msg}; +prepare_request(#diameter_packet{msg = Req}, _, {_, Caps}) when is_record(Req, 'ASR') -> #diameter_caps{origin_host = {OH, DH}, origin_realm = {OR, DR}} = Caps, Msg = Req#'ASR'{'Origin-Host' = OH, @@ -134,6 +143,22 @@ erlang:error({unexpected, ?MODULE, ?LINE}). %% handle_answer/4 +handle_answer(#diameter_packet{msg = Msg, errors = Errors}, Request, _SvcName, Peer) when is_record(Msg, 'RAA') -> +lager:info("S6b Rx RAA ~p: ~p/ Errors ~p ~n", [Peer, Msg, Errors]), +% Obtain Imsi from originating Request: +#'RAR'{'User-Name' = [NAI]} = Request, +Imsi = conv:nai_to_imsi(NAI), +PidRes = aaa_ue_fsm:get_pid_by_imsi(Imsi), +#'RAA'{'Result-Code' = ResultCode} = Msg, +DiaRC = #epdg_dia_rc{result_code = ResultCode}, +case conv:dia_rc_success(DiaRC) of +ok -> +aaa_ue_fsm:ev_rx_s6b_raa(PidRes, ok); +_ -> +aaa_ue_fsm:ev_rx_s6b_raa(PidRes, {error, DiaRC}) +end, +{ok, Msg}; + handle_answer(#diameter_packet{msg = Msg, errors = Errors}, Request, _SvcName, Peer) when is_record(Msg, 'ASA') -> lager:info("S6b Rx ASA ~p: ~p/ Errors ~p ~n", [Peer, Msg, Errors]), % Obtain Imsi from originating Request: diff --git a/src/aaa_ue_fsm.erl b/src/aaa_ue_fsm.erl index b32d6c0..d2e4aad 100644 --- a/src/aaa_ue_fsm.erl +++ b/src/aaa_ue_fsm.erl @@ -44,7 +44,7 @@ -export([get_server_name_by_imsi/1, get_pid_by_imsi/1]). -export([ev_rx_swm_auth_req/2, ev_rx_swm_reauth_answer/2, ev_rx_swm_auth_compl/2, ev_rx_swm_str/1, ev_rx_swm_asa/1, ev_rx_swx_maa/2, ev_rx_swx_saa/2, ev_rx_swx_ppr/2, ev_rx_swx_rtr/1, - ev_rx_s6b_aar/2, ev_rx_s6b_str/1, ev_rx_s6b_asa/2]). + ev_rx_s6b_aar/2, ev_rx_s6b_str/1, ev_rx_s6b_raa/2, ev_rx_s6b_asa/2]). -export([state_new/3, state_wait_swx_maa/3, state_wait_swx_saa/3, @@
[M] Change in ...osmo-epdg[master]: Propagate SWx PPR as S6b Re-Auth-Request
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36308?usp=email ) Change subject: Propagate SWx PPR as S6b Re-Auth-Request .. Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36308?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: I0e263dae37d5b8b3cdce2014787eb82910ed686a Gerrit-Change-Number: 36308 Gerrit-PatchSet: 2 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Mon, 18 Mar 2024 13:47:17 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in ...osmo-epdg[master]: Propagate SWx PPR as S6b Re-Auth-Request
Attention is currently required from: pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36308?usp=email ) Change subject: Propagate SWx PPR as S6b Re-Auth-Request .. Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36308?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: I0e263dae37d5b8b3cdce2014787eb82910ed686a Gerrit-Change-Number: 36308 Gerrit-PatchSet: 2 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Attention: pespin Gerrit-Comment-Date: Mon, 18 Mar 2024 12:12:08 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in ...osmo-epdg[master]: Propagate SWx PPR as S6b Re-Auth-Request
Attention is currently required from: laforge, pespin. Hello Jenkins Builder, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36308?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Code-Review+1 by laforge, Verified+1 by Jenkins Builder Change subject: Propagate SWx PPR as S6b Re-Auth-Request .. Propagate SWx PPR as S6b Re-Auth-Request This commit implements the 3GPP TS 29.273 section 9.1.2.5 "Service Authorization Information Update Procedures". Related: OS#6400 Change-Id: I0e263dae37d5b8b3cdce2014787eb82910ed686a --- M src/aaa_diameter_s6b.erl M src/aaa_diameter_s6b_cb.erl M src/aaa_ue_fsm.erl 3 files changed, 96 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/08/36308/2 -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36308?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: I0e263dae37d5b8b3cdce2014787eb82910ed686a Gerrit-Change-Number: 36308 Gerrit-PatchSet: 2 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Attention: laforge Gerrit-Attention: pespin Gerrit-MessageType: newpatchset
[M] Change in ...osmo-epdg[master]: Propagate SWx PPR as S6b Re-Auth-Request
Attention is currently required from: pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36308?usp=email ) Change subject: Propagate SWx PPR as S6b Re-Auth-Request .. Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36308?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: I0e263dae37d5b8b3cdce2014787eb82910ed686a Gerrit-Change-Number: 36308 Gerrit-PatchSet: 1 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Attention: pespin Gerrit-Comment-Date: Fri, 15 Mar 2024 20:10:14 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in ...osmo-epdg[master]: Propagate SWx PPR as S6b Re-Auth-Request
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36308?usp=email ) Change subject: Propagate SWx PPR as S6b Re-Auth-Request .. Propagate SWx PPR as S6b Re-Auth-Request This commit implements the 3GPP TS 29.273 section 9.1.2.5 "Service Authorization Information Update Procedures". Related: OS#6400 Change-Id: I0e263dae37d5b8b3cdce2014787eb82910ed686a --- M src/aaa_diameter_s6b.erl M src/aaa_diameter_s6b_cb.erl M src/aaa_ue_fsm.erl 3 files changed, 80 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/08/36308/1 diff --git a/src/aaa_diameter_s6b.erl b/src/aaa_diameter_s6b.erl index f8f9027..1639d02 100644 --- a/src/aaa_diameter_s6b.erl +++ b/src/aaa_diameter_s6b.erl @@ -49,7 +49,7 @@ %% gen_server Function Exports -export([init/1, handle_call/3, handle_cast/2, handle_info/2, peer_down/3]). -export([code_change/3]). --export([tx_as_request/1]). +-export([tx_reauth_request/1, tx_as_request/1]). -export([tx_aa_answer/2, tx_st_answer/2]). %% Diameter Application Definitions @@ -138,9 +138,30 @@ % handle_request(STR) was spawned into its own process, and it's blocked waiting for STA: Pid ! {sta, DiaRC}. +tx_reauth_request(NAI) -> +gen_server:call(?SERVER, {rar, NAI}). + tx_as_request(NAI) -> gen_server:call(?SERVER, {asr, NAI}). +handle_call({rar, NAI}, _From, State) -> +lager:debug("S6b Tx RAR NAI=~p~n", [NAI]), +SessionId = diameter:session_id(application:get_env(?ENV_APP_NAME, dia_s6b_origin_host, ?ENV_DEFAULT_ORIG_HOST)), +RAR = #'RAR'{'Session-Id' = SessionId, + 'Auth-Application-Id' = ?DIAMETER_APP_ID_S6b, + 'Re-Auth-Request-Type' = ?'RE-AUTH-REQUEST-TYPE_AUTHORIZE_ONLY', + 'User-Name' = [NAI] +}, +lager:debug("S6b Tx RAR: ~p~n", [RAR]), +Ret = diameter_call(RAR, State), +case Ret of +ok -> +{reply, ok, State}; +{error, Err} -> +lager:error("Error: ~w~n", [Err]), +{reply, {error, Err}, State} +end; + handle_call({asr, NAI}, _From, State) -> lager:debug("S6b Tx ASR NAI=~p~n", [NAI]), SessionId = diameter:session_id(application:get_env(?ENV_APP_NAME, dia_s6b_origin_host, ?ENV_DEFAULT_ORIG_HOST)), diff --git a/src/aaa_diameter_s6b_cb.erl b/src/aaa_diameter_s6b_cb.erl index b3f8d5f..8e2bcca 100644 --- a/src/aaa_diameter_s6b_cb.erl +++ b/src/aaa_diameter_s6b_cb.erl @@ -41,6 +41,15 @@ | Avps]}; % TODO: is there a simple way to capture all the following requests? prepare_request(#diameter_packet{msg = Req}, _, {_, Caps}) + when is_record(Req, 'RAR') -> +#diameter_caps{origin_host = {OH, DH}, origin_realm = {OR, DR}} = Caps, + Msg = Req#'RAR'{'Origin-Host' = OH, +'Origin-Realm' = OR, +'Destination-Realm' = DR, +'Destination-Host' = DH}, +lager:debug("S6b prepare_request: ~p~n", [Msg]), + {send, Msg}; +prepare_request(#diameter_packet{msg = Req}, _, {_, Caps}) when is_record(Req, 'ASR') -> #diameter_caps{origin_host = {OH, DH}, origin_realm = {OR, DR}} = Caps, Msg = Req#'ASR'{'Origin-Host' = OH, @@ -134,6 +143,22 @@ erlang:error({unexpected, ?MODULE, ?LINE}). %% handle_answer/4 +handle_answer(#diameter_packet{msg = Msg, errors = Errors}, Request, _SvcName, Peer) when is_record(Msg, 'RAA') -> +lager:info("S6b Rx RAA ~p: ~p/ Errors ~p ~n", [Peer, Msg, Errors]), +% Obtain Imsi from originating Request: +#'RAR'{'User-Name' = [NAI]} = Request, +Imsi = conv:nai_to_imsi(NAI), +PidRes = aaa_ue_fsm:get_pid_by_imsi(Imsi), +#'RAA'{'Result-Code' = ResultCode} = Msg, +DiaRC = #epdg_dia_rc{result_code = ResultCode}, +case conv:dia_rc_success(DiaRC) of +ok -> +aaa_ue_fsm:ev_rx_s6b_raa(PidRes, ok); +_ -> +aaa_ue_fsm:ev_rx_s6b_raa(PidRes, {error, DiaRC}) +end, +{ok, Msg}; + handle_answer(#diameter_packet{msg = Msg, errors = Errors}, Request, _SvcName, Peer) when is_record(Msg, 'ASA') -> lager:info("S6b Rx ASA ~p: ~p/ Errors ~p ~n", [Peer, Msg, Errors]), % Obtain Imsi from originating Request: diff --git a/src/aaa_ue_fsm.erl b/src/aaa_ue_fsm.erl index b32d6c0..38538b5 100644 --- a/src/aaa_ue_fsm.erl +++ b/src/aaa_ue_fsm.erl @@ -44,7 +44,7 @@ -export([get_server_name_by_imsi/1, get_pid_by_imsi/1]). -export([ev_rx_swm_auth_req/2, ev_rx_swm_reauth_answer/2, ev_rx_swm_auth_compl/2, ev_rx_swm_str/1, ev_rx_swm_asa/1, ev_rx_swx_maa/2, ev_rx_swx_saa/2, ev_rx_swx_ppr/2, ev_rx_swx_rtr/1, - ev_rx_s6b_aar/2, ev_rx_s6b_str/1, ev_rx_s6b_asa/2]). + ev_rx_s6b_aar/2, ev_rx_s6b_str/1, ev_rx_s6b_raa/2, ev_rx_s6b_asa/2]). -export([state_new/3, state_wait_swx_maa/3, state_wait_swx_saa/3, @@ -175,6 +175,15 @@ {error,