fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/29160 )
Change subject: Fix handling of Re-Synchronization-Info AVP in AIR ......................................................................
Fix handling of Re-Synchronization-Info AVP in AIR
Below is an example of a decoded Requested-EUTRAN-Authentication-Info:
[{ 'Requested-EUTRAN-Authentication-Info', [1], %% Number-Of-Requested-Vectors [1], %% Immediate-Response-Preferred [[ %% Re-Synchronization-Info 154,153,78,226,63,248,178,208,169,186,215,18,159,150,252, 103,249,220,169,90,223,249,219,26,172,118,171,193,216,221 ]], [] %% AVP }]
As can be seen, the value of Re-Synchronization-Info is not a binary, but a list, so indeed is_binary(ReSyncInfo) would yeild false. Use is_list() instead and convert to binary using list_to_binary().
Change-Id: Ie5eded2f5fb2de01f69d2a9c0e5d70283bf5cbf5 Related: OS#5646 --- M src/server_cb.erl 1 file changed, 5 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo_dia2gsup refs/changes/60/29160/1
diff --git a/src/server_cb.erl b/src/server_cb.erl index dc7fe59..9893cb3 100644 --- a/src/server_cb.erl +++ b/src/server_cb.erl @@ -189,10 +189,11 @@ GsupTx1 = #{message_type => send_auth_info_req, imsi => list_to_binary(UserName), supported_rat_types => [rat_eutran_sgs], current_rat_type => rat_eutran_sgs}, case ReqEU of - #'Requested-EUTRAN-Authentication-Info'{'Re-Synchronization-Info' = ReSyncInfo} - when is_binary(ReSyncInfo) -> - GsupTx2 = #{rand => string:substr(ReSyncInfo, 1, 16), - auts => string:substr(ReSyncInfo, 17)}; + #'Requested-EUTRAN-Authentication-Info'{'Re-Synchronization-Info' = [ReSyncInfo]} + when is_list(ReSyncInfo) -> + ReSyncInfoBin = list_to_binary(ReSyncInfo), + GsupTx2 = #{rand => string:substr(ReSyncInfoBin, 1, 16), + auts => string:substr(ReSyncInfoBin, 17)}; _ -> GsupTx2 = #{} end,