server_cb: Improve handling resynchronization info
This commit improves handling of the resynchronization information in a DIAMETER request from a UE that has a sync failure. It factors parsing of the resync info into a helper function with a defined spec, and handles the resynchronization info as a binary rather than a string. Change-Id: I2aad313d4d37d07040bc5344de3a023d34fd8ded
This commit is contained in:
parent
6e28afb504
commit
9e0bd808bf
|
@ -100,6 +100,22 @@ req_num_of_vec([#'Requested-UTRAN-GERAN-Authentication-Info'{'Number-Of-Requeste
|
||||||
req_num_of_vec([#'Requested-UTRAN-GERAN-Authentication-Info'{'Number-Of-Requested-Vectors'=[Num]}]) -> Num;
|
req_num_of_vec([#'Requested-UTRAN-GERAN-Authentication-Info'{'Number-Of-Requested-Vectors'=[Num]}]) -> Num;
|
||||||
req_num_of_vec(_) -> false.
|
req_num_of_vec(_) -> false.
|
||||||
|
|
||||||
|
|
||||||
|
-type binary_or_false() :: false | binary().
|
||||||
|
-spec req_resynchronization_info([tuple()]) -> binary_or_false().
|
||||||
|
req_resynchronization_info([#'Requested-EUTRAN-Authentication-Info'{'Re-Synchronization-Info'=[]}]) ->
|
||||||
|
false;
|
||||||
|
req_resynchronization_info([#'Requested-EUTRAN-Authentication-Info'{'Re-Synchronization-Info'=[Info]}]) ->
|
||||||
|
list_to_binary(Info);
|
||||||
|
|
||||||
|
req_resynchronization_info([#'Requested-UTRAN-GERAN-Authentication-Info'{'Re-Synchronization-Info'=[]}]) ->
|
||||||
|
false;
|
||||||
|
req_resynchronization_info([#'Requested-UTRAN-GERAN-Authentication-Info'{'Re-Synchronization-Info'=[Info]}]) ->
|
||||||
|
list_to_binary(Info);
|
||||||
|
|
||||||
|
req_resynchronization_info(_) ->
|
||||||
|
false.
|
||||||
|
|
||||||
-define(PDP_TYPE_DEFAULT, <<0,0,0,16#21>>). % IPv4
|
-define(PDP_TYPE_DEFAULT, <<0,0,0,16#21>>). % IPv4
|
||||||
-define(PDP_QOS_DEFAULT, <<0,0,0,0,0,0,0,0,0,0,0,0,0,0>>). % fixme
|
-define(PDP_QOS_DEFAULT, <<0,0,0,0,0,0,0,0,0,0,0,0,0,0>>). % fixme
|
||||||
|
|
||||||
|
@ -188,13 +204,14 @@ handle_request(#diameter_packet{msg = Req, errors = []}, _SvcName, {_, Caps}) wh
|
||||||
% construct GSUP request to HLR and transceive it
|
% construct GSUP request to HLR and transceive it
|
||||||
GsupTx1 = #{message_type => send_auth_info_req, imsi => list_to_binary(UserName),
|
GsupTx1 = #{message_type => send_auth_info_req, imsi => list_to_binary(UserName),
|
||||||
supported_rat_types => [rat_eutran_sgs], current_rat_type => rat_eutran_sgs},
|
supported_rat_types => [rat_eutran_sgs], current_rat_type => rat_eutran_sgs},
|
||||||
case ReqEU of
|
ResyncInfo = req_resynchronization_info(ReqEU),
|
||||||
#'Requested-EUTRAN-Authentication-Info'{'Re-Synchronization-Info' = ReSyncInfo}
|
case ResyncInfo of
|
||||||
when is_binary(ReSyncInfo) ->
|
false ->
|
||||||
GsupTx2 = #{rand => string:substr(ReSyncInfo, 1, 16),
|
GsupTx2 = #{};
|
||||||
auts => string:substr(ReSyncInfo, 17)};
|
ValidResyncInfo ->
|
||||||
_ ->
|
lager:info("ResyncInfo is valid ~p", [ResyncInfo]),
|
||||||
GsupTx2 = #{}
|
GsupTx2 = #{rand => binary:part(ValidResyncInfo, 0, 16),
|
||||||
|
auts => binary:part(ValidResyncInfo, 16, 14)}
|
||||||
end,
|
end,
|
||||||
GsupTx = maps:merge(GsupTx1, GsupTx2),
|
GsupTx = maps:merge(GsupTx1, GsupTx2),
|
||||||
GsupRx = gen_server:call(gsup_client, {transceive_gsup, GsupTx, send_auth_info_res, send_auth_info_err}),
|
GsupRx = gen_server:call(gsup_client, {transceive_gsup, GsupTx, send_auth_info_res, send_auth_info_err}),
|
||||||
|
|
Loading…
Reference in New Issue