From cd6ed9058725d0d23d9459f3b6f572a08e584db2 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Wed, 20 Nov 2013 12:09:17 +0000
Subject: [PATCH] - Completed Initial context setup request message - Fixed RB
 ID - Removed unused variable in NNSF

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4458 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair-cn/MME_APP/mme_app_bearer.c   | 2 +-
 openair-cn/S1AP/s1ap_eNB_handlers.c   | 9 +++++++++
 openair-cn/S1AP/s1ap_eNB_nnsf.c       | 5 ++---
 openair2/COMMON/s1ap_messages_types.h | 2 +-
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/openair-cn/MME_APP/mme_app_bearer.c b/openair-cn/MME_APP/mme_app_bearer.c
index d431f34fb1..90251ce20f 100644
--- a/openair-cn/MME_APP/mme_app_bearer.c
+++ b/openair-cn/MME_APP/mme_app_bearer.c
@@ -330,7 +330,7 @@ int mme_app_handle_create_sess_resp(SgwCreateSessionResponse *create_sess_resp_p
         attach_accept_p->transparent.eNB_ue_s1ap_id = ue_context_p->eNB_ue_s1ap_id;
         attach_accept_p->transparent.mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id;
 
-        attach_accept_p->transparent.ebi = bearer_id - 5;
+        attach_accept_p->transparent.ebi = bearer_id;
 
         attach_accept_p->transparent.qci = current_bearer_p->qci;
         attach_accept_p->transparent.prio_level = current_bearer_p->prio_level;
diff --git a/openair-cn/S1AP/s1ap_eNB_handlers.c b/openair-cn/S1AP/s1ap_eNB_handlers.c
index 64facc3345..86aca8ab74 100644
--- a/openair-cn/S1AP/s1ap_eNB_handlers.c
+++ b/openair-cn/S1AP/s1ap_eNB_handlers.c
@@ -415,6 +415,15 @@ int s1ap_eNB_handle_initial_context_request(uint32_t               assoc_id,
             S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer = NULL;
         }
 
+        /* Set the transport layer address */
+        memcpy(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.buffer,
+               item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size);
+        S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.length =
+        item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused;
+
+        /* GTP tunnel endpoint ID */
+        OCTET_STRING_TO_INT32(&item_p->gTP_TEID, S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].gtp_teid);
+
         /* Set the QOS informations */
         S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI;
 
diff --git a/openair-cn/S1AP/s1ap_eNB_nnsf.c b/openair-cn/S1AP/s1ap_eNB_nnsf.c
index 1ad7e95a3a..2d3a964ffd 100644
--- a/openair-cn/S1AP/s1ap_eNB_nnsf.c
+++ b/openair-cn/S1AP/s1ap_eNB_nnsf.c
@@ -53,9 +53,8 @@ s1ap_eNB_nnsf_select_mme(s1ap_eNB_instance_t       *instance_p,
     struct s1ap_eNB_mme_data_s *mme_highest_capacity_p = NULL;
     uint8_t current_capacity = 0;
 
-    RB_FOREACH(mme_data_p, s1ap_mme_map, &instance_p->s1ap_mme_head) {
-        struct served_gummei_s *gummei_p = NULL;
-
+    RB_FOREACH(mme_data_p, s1ap_mme_map, &instance_p->s1ap_mme_head)
+    {
         if (mme_data_p->state != S1AP_ENB_STATE_CONNECTED) {
             /* The association between MME and eNB is not ready for the moment,
              * go to the next known MME.
diff --git a/openair2/COMMON/s1ap_messages_types.h b/openair2/COMMON/s1ap_messages_types.h
index 69d5c055ab..d6028d3360 100644
--- a/openair2/COMMON/s1ap_messages_types.h
+++ b/openair2/COMMON/s1ap_messages_types.h
@@ -134,7 +134,7 @@ typedef struct nas_pdu_s {
 } nas_pdu_t, ue_radio_cap_t;
 
 typedef struct transport_layer_addr_s {
-    /* Length of the transport layer address buffer. S1AP layer received a
+    /* Length of the transport layer address buffer in bits. S1AP layer received a
      * bit string<1..160> containing one of the following addresses: ipv4,
      * ipv6, or ipv4 and ipv6. The layer doesn't interpret the buffer but
      * silently forward it to S1-U.
-- 
GitLab