fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40664?usp=email )
Change subject: s1ap_proxy: forward E-RAB RELEASE COMMAND/RESPONSE as-is ......................................................................
s1ap_proxy: forward E-RAB RELEASE COMMAND/RESPONSE as-is
There's nothing to patch in these PDUs, so avoid re-encoding them. This also makes the metrics correctly report them as unmodified.
Change-Id: I0dc968d1a9a6ad03d6252c08380e33f5d3aac8d8 Related: SYS#7065 --- M src/s1ap_proxy.erl M test/s1ap_proxy_test.erl 2 files changed, 12 insertions(+), 14 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/64/40664/1
diff --git a/src/s1ap_proxy.erl b/src/s1ap_proxy.erl index 0cd92f7..3073370 100644 --- a/src/s1ap_proxy.erl +++ b/src/s1ap_proxy.erl @@ -386,17 +386,16 @@ {forward, S2};
%% 9.1.3.5 E-RAB RELEASE COMMAND -handle_pdu({Outcome = initiatingMessage, +handle_pdu({initiatingMessage, #'InitiatingMessage'{procedureCode = ?'id-E-RABRelease', - value = C0} = Msg}, S0) -> + value = C0}}, S0) -> ?LOG_DEBUG("Processing E-RAB RELEASE COMMAND"), s1gw_metrics:ctr_inc(?S1GW_CTR_S1AP_PROXY_IN_PKT_ERAB_RELEASE_CMD), case handle_ies(?'id-E-RABToBeReleasedList', C0#'E-RABReleaseCommand'.protocolIEs, S0) of - {{ok, IEs}, S1} -> - C1 = C0#'E-RABReleaseCommand'{protocolIEs = IEs}, - PDU = {Outcome, Msg#'InitiatingMessage'{value = C1}}, - {{forward, PDU}, S1}; %% forward patched PDU + {{ok, _}, S1} -> + %% there's nothing to patch in this PDU, so we forward it as-is + {forward, S1}; %% forward patched PDU {{error, Reason}, S1} -> ?LOG_NOTICE("Failed to process E-RAB RELEASE COMMAND: ~p", [Reason]), s1gw_metrics:ctr_inc(?S1GW_CTR_S1AP_PROXY_IN_PKT_PROC_ERROR), @@ -404,17 +403,16 @@ end;
%% 9.1.3.6 E-RAB RELEASE RESPONSE -handle_pdu({Outcome = successfulOutcome, +handle_pdu({successfulOutcome, #'SuccessfulOutcome'{procedureCode = ?'id-E-RABRelease', - value = C0} = Msg}, S0) -> + value = C0}}, S0) -> ?LOG_DEBUG("Processing E-RAB RELEASE RESPONSE"), s1gw_metrics:ctr_inc(?S1GW_CTR_S1AP_PROXY_IN_PKT_ERAB_RELEASE_RSP), case handle_ies(?'id-E-RABReleaseListBearerRelComp', C0#'E-RABReleaseResponse'.protocolIEs, S0) of - {{ok, IEs}, S1} -> - C1 = C0#'E-RABReleaseResponse'{protocolIEs = IEs}, - PDU = {Outcome, Msg#'SuccessfulOutcome'{value = C1}}, - {{forward, PDU}, S1}; %% forward patched PDU + {{ok, _}, S1} -> + %% there's nothing to patch in this PDU, so we forward it as-is + {forward, S1}; %% forward patched PDU {{error, Reason}, S1} -> ?LOG_NOTICE("Failed to process E-RAB RELEASE RESPONSE: ~p", [Reason]), s1gw_metrics:ctr_inc(?S1GW_CTR_S1AP_PROXY_IN_PKT_PROC_ERROR), diff --git a/test/s1ap_proxy_test.erl b/test/s1ap_proxy_test.erl index ea5180e..3a73910 100644 --- a/test/s1ap_proxy_test.erl +++ b/test/s1ap_proxy_test.erl @@ -136,8 +136,8 @@ ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_ERAB_RELEASE_CMD, 1), ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_ERAB_RELEASE_RSP, 1), ?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_ALL, 2 + 2), -%% ?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_PROC, 2), -%% ?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_UNMODIFIED, 2), + ?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_PROC, 2), + ?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_UNMODIFIED, 2), ?_assertEqual([], s1ap_proxy:fetch_erab_list(Pid))].