pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/41303?usp=email )
Change subject: aaa_diameter_swx: Avoid answering RTR with Success if already deregistering ......................................................................
aaa_diameter_swx: Avoid answering RTR with Success if already deregistering
When receiving an SWx RTR on our osmo-epdg (epdg+AAA), we initiate the deregistration against peer nodes on other interfaces and answer with SWx RTA.
If a subsequent RTR for the subscriber arrives on the interface while the deregistration is in progress, we'd answer with RTA Result-Code 2001 SUCCESS. Let's instead answer already as if we didn't know about the subscriber, since it will end up being freed in a short span of time and nothing can be done about it.
Related: OS#6796 Change-Id: I0ed13e9503ec380ce4331c662ca3eb966ccbda92 --- M src/aaa_diameter_swx_cb.erl M src/aaa_ue_fsm.erl 2 files changed, 21 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/03/41303/1
diff --git a/src/aaa_diameter_swx_cb.erl b/src/aaa_diameter_swx_cb.erl index 3ae11f0..f8ebd08 100644 --- a/src/aaa_diameter_swx_cb.erl +++ b/src/aaa_diameter_swx_cb.erl @@ -149,14 +149,26 @@ case DeregReason of #'Deregistration-Reason'{'Reason-Code' = ?'REASON-CODE_PERMANENT_TERMINATION'} -> case aaa_ue_fsm:ev_rx_swx_rtr(Pid) of - {error, _} -> aaa_ue_fsm:stop(Pid); - _ -> ok + {error, dereg_in_progress} -> + Res = [], + %% TS 29.229 6.2.2.1 DIAMETER_ERROR_USER_UNKNOWN + ERes = #'Experimental-Result'{'Vendor-Id' = ?VENDOR_ID_3GPP, + 'Experimental-Result-Code' = 5001}; + {error, _} -> + aaa_ue_fsm:stop(Pid), % unknown error, make sure we tear down. + Res = [], + %% TS 29.229 6.2.2.1 DIAMETER_ERROR_USER_UNKNOWN + ERes = #'Experimental-Result'{'Vendor-Id' = ?VENDOR_ID_3GPP, + 'Experimental-Result-Code' = 5001}; + _ -> + Res = 2001, %% Success + ERes = [] end; _ -> - aaa_ue_fsm:stop(Pid) - end, - Res = 2001, %% Success - ERes = []; + aaa_ue_fsm:stop(Pid), + Res = 2001, %% Success + ERes = [] + end; undefined -> Res = [], %% TS 29.229 6.2.2.1 DIAMETER_ERROR_USER_UNKNOWN diff --git a/src/aaa_ue_fsm.erl b/src/aaa_ue_fsm.erl index fa1c807..91830d9 100644 --- a/src/aaa_ue_fsm.erl +++ b/src/aaa_ue_fsm.erl @@ -451,7 +451,7 @@ state_authenticated_wait_swx_saa({call, From}, rx_swx_rtr, Data) -> lager:info("ue_fsm state_authenticated_wait_swx_saa event=rx_swx_rtr ~p~n", [Data]), %% We are already tearing down in an ordered manner, accept and do nothing. - {keep_state, Data, [{reply,From,ok}]}; + {keep_state, Data, [{reply,From,{error,dereg_in_progress}}]}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% state_dereg_net_initiated_wait_s6b_asa: @@ -469,7 +469,7 @@ state_dereg_net_initiated_wait_s6b_asa({call, From}, rx_swx_rtr, Data) -> lager:info("ue_fsm state_dereg_net_initiated_wait_s6b_asa event=rx_swx_rtr ~p~n", [Data]), %% We are already tearing down in an ordered manner, accept and do nothing. - {keep_state, Data, [{reply,From,ok}]}; + {keep_state, Data, [{reply,From,{error,dereg_in_progress}}]};
state_dereg_net_initiated_wait_s6b_asa({call, From}, Ev, Data) -> lager:notice("ue_fsm state_dereg_net_initiated_wait_s6b_asa: Unexpected call event ~p, ~p~n", [Ev, Data]), @@ -494,7 +494,7 @@ state_dereg_net_initiated_wait_swm_asa({call, From}, rx_swx_rtr, Data) -> lager:info("ue_fsm state_dereg_net_initiated_wait_swm_asa event=rx_swx_rtr ~p~n", [Data]), %% We are already tearing down in an ordered manner, accept and do nothing. - {keep_state, Data, [{reply,From,ok}]}; + {keep_state, Data, [{reply,From,{error,dereg_in_progress}}]};
state_dereg_net_initiated_wait_swm_asa({call, From}, Ev, Data) -> lager:notice("ue_fsm state_dereg_net_initiated_wait_swm_asa: Unexpected call event ~p, ~p~n", [Ev, Data]),