pespin has uploaded this change for review.
gsup_server: Delete session if initial auth failed
It may be that due to a bug the previous session was kept alive and the
related epdg_ue_fsm has actually already terminated.
In any case, there's no use in keeping the session at this initial
transaction after having created it, so simply delete it if it fails.
Change-Id: Iebbab786e9647a026b2937115004747cd1883da0
---
M src/epdg_ue_fsm.erl
M src/gsup_server.erl
2 files changed, 23 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/92/35892/1
diff --git a/src/epdg_ue_fsm.erl b/src/epdg_ue_fsm.erl
index 21f59da..94cf9c4 100644
--- a/src/epdg_ue_fsm.erl
+++ b/src/epdg_ue_fsm.erl
@@ -37,7 +37,7 @@
-include_lib("osmo_gsup/include/gsup_protocol.hrl").
-include_lib("gtplib/include/gtp_packet.hrl").
--export([start_link/1]).
+-export([start_link/1, stop/1]).
-export([init/1,callback_mode/0,terminate/3]).
-export([auth_request/1, lu_request/1, tunnel_request/1, purge_ms_request/1]).
-export([received_swm_auth_response/2, received_swm_auth_compl_response/2, received_swm_session_termination_answer/2]).
@@ -57,6 +57,9 @@
lager:info("ue_fsm start_link(~p)~n", [ServerName]),
gen_statem:start_link({local, list_to_atom(ServerName)}, ?MODULE, Imsi, [{debug, [trace]}]).
+stop(SrvRef) ->
+ gen_statem:stop(SrvRef).
+
auth_request(Pid) ->
lager:info("ue_fsm auth_request~n", []),
try
diff --git a/src/gsup_server.erl b/src/gsup_server.erl
index 0c7a723..fd2a8b5 100644
--- a/src/gsup_server.erl
+++ b/src/gsup_server.erl
@@ -234,7 +234,7 @@
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),
case epdg_ue_fsm:auth_request(UE#gsups_ue.pid) of
- ok -> ok;
+ ok -> State2 = State1;
{error, Err} ->
lager:error("Auth Req for Imsi ~p failed: ~p~n", [Imsi, Err]),
Resp = #{message_type => send_auth_info_err,
@@ -242,9 +242,11 @@
message_class => 5,
cause => ?GSUP_CAUSE_NET_FAIL
},
- tx_gsup(Socket, Resp)
+ tx_gsup(Socket, Resp),
+ epdg_ue_fsm:stop(UE#gsups_ue.pid),
+ State2 = delete_gsups_ue(Imsi, State1)
end,
- {noreply, State1};
+ {noreply, State2};
% 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
To view, visit change 35892. To unsubscribe, or for help writing mail filters, visit settings.