From 18cca7f5e47d6a1e2d4f783c82fc6e1ada8e7edd Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Mon, 6 Jun 2022 22:20:52 +0900 Subject: [PATCH] Re-enabling HTTP/1.1 (#1570) --- lib/sbi/mhd-server.c | 19 +++++++++++++++++-- src/amf/gmm-handler.c | 16 +++++++++++----- src/amf/nsmf-handler.c | 10 ++++++++++ 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/lib/sbi/mhd-server.c b/lib/sbi/mhd-server.c index 793dc2d11..1c68c130c 100644 --- a/lib/sbi/mhd-server.c +++ b/lib/sbi/mhd-server.c @@ -289,6 +289,11 @@ static void server_stop(ogs_sbi_server_t *server) } } +static void free_callback(void *cls) +{ + ogs_free(cls); +} + static bool server_send_response( ogs_sbi_stream_t *stream, ogs_sbi_response_t *response) { @@ -325,10 +330,20 @@ static bool server_send_response( ogs_assert(mhd_socket != INVALID_SOCKET); if (response->http.content) { - mhd_response = MHD_create_response_from_buffer( + mhd_response = MHD_create_response_from_buffer_with_free_callback( response->http.content_length, response->http.content, - MHD_RESPMEM_PERSISTENT); + free_callback); ogs_assert(mhd_response); + + /* response->http.content will be freed in free_callback() function. + * + * ogs_sbi_response_free(response) should not de-allocate + * response->http.content memory. + * + * So, we'll set response->http.content to NULL. + */ + response->http.content = NULL; + } else { mhd_response = MHD_create_response_from_buffer( 0, NULL, MHD_RESPMEM_PERSISTENT); diff --git a/src/amf/gmm-handler.c b/src/amf/gmm-handler.c index c1ef48e9d..3b1792a40 100644 --- a/src/amf/gmm-handler.c +++ b/src/amf/gmm-handler.c @@ -1120,12 +1120,18 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue, OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE) { param.ue_location = true; param.ue_timezone = true; - } - ogs_assert(true == - amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF, - sess, AMF_UPDATE_SM_CONTEXT_N1_RELEASED, ¶m, - amf_nsmf_pdusession_build_update_sm_context)); + ogs_assert(true == + amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF, + sess, AMF_UPDATE_SM_CONTEXT_N1_RELEASED, ¶m, + amf_nsmf_pdusession_build_update_sm_context)); + } else { + + ogs_assert(true == + amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF, + sess, AMF_UPDATE_SM_CONTEXT_MODIFIED, ¶m, + amf_nsmf_pdusession_build_update_sm_context)); + } switch (gsm_header->message_type) { case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE: diff --git a/src/amf/nsmf-handler.c b/src/amf/nsmf-handler.c index 4000cc89c..2953c4b46 100644 --- a/src/amf/nsmf-handler.c +++ b/src/amf/nsmf-handler.c @@ -487,6 +487,16 @@ int amf_nsmf_pdusession_handle_update_sm_context( * 4. PFCP Session Modifcation Response */ + /* + * 1. PDU session release request + * 2. /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify + */ + + /* + * 1. PDU session modification complete + * 2. /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify + */ + } else if (state == AMF_UPDATE_SM_CONTEXT_DEACTIVATED) { /* * 1. UEContextReleaseRequest