From 364d662cf2ce0b654e4097c62910a8d91c33cec1 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Thu, 21 Nov 2013 09:16:09 +0000
Subject: [PATCH] - Fix DL/UL information transfer messages encoders - Reset
 the initial ue id when first asnwer sent to RRC

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4474 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair-cn/S1AP/s1ap_eNB_handlers.c       | 2 ++
 openair-cn/S1AP/s1ap_eNB_nas_procedures.c | 4 +++-
 openair2/RRC/LITE/MESSAGES/asn1_msg.c     | 4 ++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/openair-cn/S1AP/s1ap_eNB_handlers.c b/openair-cn/S1AP/s1ap_eNB_handlers.c
index 9bc7e860cc..52bbbf807b 100644
--- a/openair-cn/S1AP/s1ap_eNB_handlers.c
+++ b/openair-cn/S1AP/s1ap_eNB_handlers.c
@@ -379,6 +379,8 @@ int s1ap_eNB_handle_initial_context_request(uint32_t               assoc_id,
     message_p = itti_alloc_new_message(TASK_S1AP, S1AP_INITIAL_CONTEXT_SETUP_REQ);
 
     S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_initial_id  = ue_desc_p->ue_initial_id;
+    ue_desc_p->ue_initial_id = 0;
+
     S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).eNB_ue_s1ap_id = ue_desc_p->eNB_ue_s1ap_id;
     S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_of_e_rabs =
     initialContextSetupRequest_p->e_RABToBeSetupListCtxtSUReq.s1ap_E_RABToBeSetupItemCtxtSUReq.count;
diff --git a/openair-cn/S1AP/s1ap_eNB_nas_procedures.c b/openair-cn/S1AP/s1ap_eNB_nas_procedures.c
index 29214cde8d..b8438638e3 100644
--- a/openair-cn/S1AP/s1ap_eNB_nas_procedures.c
+++ b/openair-cn/S1AP/s1ap_eNB_nas_procedures.c
@@ -236,7 +236,7 @@ int s1ap_eNB_handle_nas_downlink(uint32_t               assoc_id,
          downlink_NAS_transport_p->eNB_UE_S1AP_ID)) == NULL)
     {
         S1AP_ERROR("[SCTP %d] Received NAS downlink message for non "
-        "existing UE context: %06x\n", assoc_id,
+        "existing UE context: 0x%06x\n", assoc_id,
         downlink_NAS_transport_p->eNB_UE_S1AP_ID);
         return -1;
     }
@@ -263,6 +263,8 @@ int s1ap_eNB_handle_nas_downlink(uint32_t               assoc_id,
                                         downlink_NAS_transport_p->nas_pdu.buf,
                                         downlink_NAS_transport_p->nas_pdu.size);
 
+    ue_desc_p->ue_initial_id = 0;
+
     return 0;
 }
 
diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
index 8254e1be4e..da26cb9f3b 100644
--- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
@@ -1843,7 +1843,7 @@ uint8_t do_DLInformationTransfer(uint32_t length, uint8_t *buffer, uint8_t trans
   dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.size = pdu_length;
   dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.buf = pdu_buffer;
 
-  enc_rval = uper_encode_to_buffer (&asn_DEF_UL_CCCH_Message, (void*) &dl_dcch_msg, buffer, length);
+  enc_rval = uper_encode_to_buffer (&asn_DEF_DL_DCCH_Message, (void*) &dl_dcch_msg, buffer, length);
 
   return((enc_rval.encoded+7)/8);
 }
@@ -1864,7 +1864,7 @@ uint8_t do_ULInformationTransfer(uint32_t length, uint8_t *buffer, uint32_t pdu_
   ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.size = pdu_length;
   ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.buf = pdu_buffer;
 
-  enc_rval = uper_encode_to_buffer (&asn_DEF_UL_CCCH_Message, (void*) &ul_dcch_msg, buffer, length);
+  enc_rval = uper_encode_to_buffer (&asn_DEF_UL_DCCH_Message, (void*) &ul_dcch_msg, buffer, length);
 
   return((enc_rval.encoded+7)/8);
 }
-- 
GitLab