diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c
index 52a4e345dabf5576db18b17e89c082789bffa3ce..d5d77f4ea82af921810df989ee1541936235acf8 100644
--- a/openair2/LAYER2/MAC/config.c
+++ b/openair2/LAYER2/MAC/config.c
@@ -1373,15 +1373,14 @@ rrc_mac_config_req_ue(
 
 //for D2D
 #if defined(Rel10) || defined(Rel14)
-  if ( sourceL2Id && groupL2Id) {
+  if (sourceL2Id){
      UE_mac_inst[Mod_idP].sourceL2Id = *sourceL2Id;
+  }
+  if (groupL2Id) {
      UE_mac_inst[Mod_idP].groupL2Id = *groupL2Id;
-  } else if (sourceL2Id) { //reset groupL2Id
-     UE_mac_inst[Mod_idP].groupL2Id = 0x00000000;
   }
-  if ( sourceL2Id && destinationL2Id) {
-       UE_mac_inst[Mod_idP].sourceL2Id = *sourceL2Id;
-       UE_mac_inst[Mod_idP].destinationL2Id = *destinationL2Id;
+  if (destinationL2Id) {
+     UE_mac_inst[Mod_idP].destinationL2Id = *destinationL2Id;
   }
 
 #endif
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index 5889b8da0db444affe10a73923ca9a69defeba2d..9cab4281d55e0474503f7a9df441f6029d3dfb40 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -765,7 +765,7 @@ void ue_send_sl_sdu(module_id_t module_idP,
   AssertFatal(((longh->LCID==3)|(longh->LCID==10)),"LCID is %d (not 3 or 10)\n",longh->LCID);
   //filter incoming packet based on destination address
   destinationL2Id = (longh->DST07<<16) | (longh->DST815 <<8) | (longh->DST1623);
-  LOG_I( MAC, "[DestinationL2Id:  %"PRIu32"]  \n", destinationL2Id );
+  LOG_I( MAC, "[DestinationL2Id:  0x%08x]  \n", destinationL2Id );
   //match the destinationL2Id with UE L2Id or groupL2ID
   if (!((destinationL2Id == UE_mac_inst[module_idP].sourceL2Id) | (destinationL2Id == UE_mac_inst[module_idP].groupL2Id))){
      LOG_I( MAC, "[Destination Id is neither matched with Source Id nor with Group Id, drop the packet!!! \n");
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
index 8a955e55cd5369e9e9d82443a232e8a9162f9c36..07aafee26b4e00e7931db94d895924f3a5f392a7 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
@@ -407,7 +407,8 @@ struct pdcp_netlink_element_s {
 #ifdef Rel14
 #define PDCP_SOCKET_PORT_NO 9999 //temporary value
 int pdcp_pc5_sockfd;
-struct sockaddr_in prose_app_addr;
+struct sockaddr_in prose_ctrl_addr;
+struct sockaddr_in prose_pdcp_addr;
 struct sockaddr_in pdcp_sin;
 int pdcp_pc5_socket_init();
 
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index fb94bb6ffa341d24f3e4bc006c8a2612e3a034f6..528a1d8f9de3a85895cc2a3a5d095f0a5bccf0f3 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -218,25 +218,25 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const  ctxt_pP)
          sl_pc5s_msg_recv = calloc(1, sizeof(sidelink_pc5s_element));
          memcpy((void*)sl_pc5s_msg_recv, (void*)(sdu_p->data+sizeof(pdcp_data_ind_header_t)), sizeof(sidelink_pc5s_element));
 
-         LOG_D(PDCP,"[pdcp_fifo_flush_sdus]: Received DirectCommunicationRequest (PC5-S), header msg_type: %d)\n", sl_pc5s_msg_recv->pdcp_data_header.msg_type);
-         LOG_D(PDCP,"[pdcp_fifo_flush_sdus]: Received DirectCommunicationRequest (PC5-S), header rb_id: %d)\n", sl_pc5s_msg_recv->pdcp_data_header.rb_id);
-         LOG_D(PDCP,"[pdcp_fifo_flush_sdus]: Received DirectCommunicationRequest (PC5-S), header data_size: %d)\n", sl_pc5s_msg_recv->pdcp_data_header.data_size);
-         LOG_D(PDCP,"[pdcp_fifo_flush_sdus]: Received DirectCommunicationRequest (PC5-S), header inst: %d)\n", sl_pc5s_msg_recv->pdcp_data_header.inst);
+         LOG_D(PDCP,"Received PC5S message, header msg_type: %d)\n", sl_pc5s_msg_recv->pdcp_data_header.msg_type);
+         LOG_D(PDCP,"Received PC5S message, header rb_id: %d)\n", sl_pc5s_msg_recv->pdcp_data_header.rb_id);
+         LOG_D(PDCP,"Received PC5S message, header data_size: %d)\n", sl_pc5s_msg_recv->pdcp_data_header.data_size);
+         LOG_D(PDCP,"Received PC5S message, header inst: %d)\n", sl_pc5s_msg_recv->pdcp_data_header.inst);
 
          if (sl_pc5s_msg_recv->pdcp_data_header.msg_type == SL_DIRECT_COMMUNICATION_REQUEST){
-            LOG_D(PDCP,"[pdcp_pc5_socket_thread_fct]: Received DirectCommunicationRequest (PC5-S), seqno: %d)\n", sl_pc5s_msg_recv->pc5sPrimitive.pc5s_direct_communication_req.sequenceNumber);
-            LOG_D(PDCP,"[pdcp_pc5_socket_thread_fct]: Received DirectCommunicationRequest (PC5-S), ipAddressConfig: %d)\n", sl_pc5s_msg_recv->pc5sPrimitive.pc5s_direct_communication_req.ipAddressConfig);
+            LOG_D(PDCP,"PC5S message (SL_DIRECT_COMMUNICATION_REQUEST), seqno: %d)\n", sl_pc5s_msg_recv->pc5sPrimitive.pc5s_direct_communication_req.sequenceNumber);
+            LOG_D(PDCP,"PC5S message (SL_DIRECT_COMMUNICATION_REQUEST), ipAddressConfig: %d)\n", sl_pc5s_msg_recv->pc5sPrimitive.pc5s_direct_communication_req.ipAddressConfig);
          }
          //send to ProSe app
-         LOG_D(RRC,"[pdcp_fifo_flush_sdus]: Send DirectCommunicationRequest to ProSe App \n");
+         LOG_D(PDCP,"Send DirectCommunicationRequest to ProSe App \n");
 #endif
          memset(send_buf, 0, BUFSIZE);
          //memcpy((void *)send_buf, (void *)sl_pc5s_msg_recv, sizeof(sidelink_pc5s_element));
          memcpy((void *)send_buf, (void*)(sdu_p->data+sizeof(pdcp_data_ind_header_t)), sizeof(sidelink_pc5s_element));
          //free(sl_ctrl_msg_send);
 
-         int prose_addr_len = sizeof(prose_app_addr);
-         int n = sendto(pdcp_pc5_sockfd, (char *)send_buf, sizeof(sidelink_pc5s_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
+         int prose_addr_len = sizeof(prose_pdcp_addr);
+         int n = sendto(pdcp_pc5_sockfd, (char *)send_buf, sizeof(sidelink_pc5s_element), 0, (struct sockaddr *)&prose_pdcp_addr, prose_addr_len);
          if (n < 0) {
             LOG_E(PDCP, "ERROR: Failed to send to ProSe App\n");
             exit(EXIT_FAILURE);
@@ -570,11 +570,11 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
 //TTN for D2D (PC5S)
 #ifdef Rel14
   // module_id = 0 ; //hardcoded for testing only
-   prose_addr_len = sizeof(prose_app_addr);
+   prose_addr_len = sizeof(prose_pdcp_addr);
    // receive a message from ProSe App
    memset(receive_buf, 0, BUFSIZE);
    bytes_received = recvfrom(pdcp_pc5_sockfd, receive_buf, BUFSIZE, 0,
-         (struct sockaddr *) &prose_app_addr, &prose_addr_len);
+         (struct sockaddr *) &prose_pdcp_addr, &prose_addr_len);
    //  if (bytes_received < 0){
    //    LOG_E(RRC, "ERROR: Failed to receive from ProSe App\n");
    //    exit(EXIT_FAILURE);
@@ -592,8 +592,8 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
          sl_pc5s_msg_send->pc5sPrimitive.status = 1;
 
          memcpy((void *)send_buf, (void *)sl_pc5s_msg_send, sizeof(sidelink_pc5s_element));
-         int prose_addr_len = sizeof(prose_app_addr);
-         int bytes_sent = sendto(pdcp_pc5_sockfd, (char *)send_buf, sizeof(sidelink_pc5s_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
+         int prose_addr_len = sizeof(prose_pdcp_addr);
+         int bytes_sent = sendto(pdcp_pc5_sockfd, (char *)send_buf, sizeof(sidelink_pc5s_element), 0, (struct sockaddr *)&prose_pdcp_addr, prose_addr_len);
          if (bytes_sent < 0) {
             LOG_E(PDCP, "ERROR: Failed to send to ProSe App\n");
             exit(EXIT_FAILURE);
@@ -1306,14 +1306,14 @@ void *pdcp_pc5_socket_thread_fct(void *arg)
 
    LOG_I(PDCP,"*****************[pdcp_pc5_socket_thread_fct]**************\n");
    //from the main program, listen for the incoming messages from control socket (ProSe App)
-   prose_addr_len = sizeof(prose_app_addr);
+   prose_addr_len = sizeof(prose_pdcp_addr);
 
    while (1) {
       LOG_I(RRC,"[pdcp_pc5_socket_thread_fct]: Listening to incoming connection from ProSe App \n");
       // receive a message from ProSe App
       memset(receive_buf, 0, BUFSIZE);
       n = recvfrom(pdcp_pc5_sockfd, receive_buf, BUFSIZE, 0,
-            (struct sockaddr *) &prose_app_addr, &prose_addr_len);
+            (struct sockaddr *) &prose_pdcp_addr, &prose_addr_len);
       if (n < 0){
          LOG_E(RRC, "ERROR: Failed to receive from ProSe App\n");
          exit(EXIT_FAILURE);
diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h
index 3477e73c51645e561ac99e0bb973775c845393c8..e39520e520702257690ec218b3a3521e03d0c443 100644
--- a/openair2/RRC/LITE/defs.h
+++ b/openair2/RRC/LITE/defs.h
@@ -120,6 +120,7 @@ struct DirectCommunicationEstablishReq {
 };
 
 struct PC5SEstablishReq{
+   uint8_t type;
    uint32_t sourceL2Id;
    uint32_t destinationL2Id;
 };
diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c
index f36b6019c143a684b6785161f2cc678b5ed795f1..587599e3a1870124cff708c258b29067f5518ed2 100644
--- a/openair2/RRC/LITE/rrc_UE.c
+++ b/openair2/RRC/LITE/rrc_UE.c
@@ -5440,6 +5440,7 @@ void *rrc_control_socket_thread_fct(void *arg)
    struct sidelink_ctrl_element *sl_ctrl_msg_send = NULL;
    uint32_t sourceL2Id, groupL2Id, destinationL2Id;
    module_id_t         module_id = 0; //hardcoded for testing only
+   uint8_t type;
 
    //from the main program, listen for the incoming messages from control socket (ProSe App)
    prose_addr_len = sizeof(prose_app_addr);
@@ -5509,8 +5510,8 @@ void *rrc_control_socket_thread_fct(void *arg)
 #ifdef DEBUG_CTRL_SOCKET
          LOG_I(RRC,"[GroupCommunicationEstablishReq] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
          LOG_I(RRC,"[GroupCommunicationEstablishReq] type: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.type);
-         LOG_I(RRC,"[GroupCommunicationEstablishReq] source Id: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.sourceL2Id);
-         LOG_I(RRC,"[GroupCommunicationEstablishReq] group Id: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupL2Id);
+         LOG_I(RRC,"[GroupCommunicationEstablishReq] source Id: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.sourceL2Id);
+         LOG_I(RRC,"[GroupCommunicationEstablishReq] group Id: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupL2Id);
          LOG_I(RRC,"[GroupCommunicationEstablishReq] group IP Address: " IPV4_ADDR "\n",IPV4_ADDR_FORMAT(sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupIpAddress));
 #endif
 
@@ -5566,9 +5567,7 @@ void *rrc_control_socket_thread_fct(void *arg)
          sl_ctrl_msg_send->type = GROUP_COMMUNICATION_ESTABLISH_RSP;
          //in case of TX, assign a new SLRB and prepare for the filter
          if (sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.type == 1) {
-#ifdef DEBUG_CTRL_SOCKET
-            LOG_I(RRC,"[GroupCommunicationEstablishReq]  PPPP: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.pppp);
-#endif
+
             sl_ctrl_msg_send->sidelinkPrimitive.slrb_id = SLRB_ID; //slrb_id
             //pthread_mutex_lock(&slrb_mutex);
             slrb_id = SLRB_ID;
@@ -5672,55 +5671,108 @@ void *rrc_control_socket_thread_fct(void *arg)
 
 
       case PC5S_ESTABLISH_REQ:
+         type =  sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.type;
          sourceL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.sourceL2Id;
-         destinationL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.destinationL2Id;
+ #ifdef DEBUG_CTRL_SOCKET
+                  LOG_I(RRC,"[PC5EstablishReq] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
+                  LOG_I(RRC,"[PC5EstablishReq] type: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.type); //RX/TX
+                  LOG_I(RRC,"[PC5EstablishReq] source Id: 0x%08x \n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.sourceL2Id);
+#endif
+         if (type > 0) {
+            destinationL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.destinationL2Id;
 #ifdef DEBUG_CTRL_SOCKET
-         LOG_I(RRC,"[PC5EstablishReq] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
-         LOG_I(RRC,"[PC5EstablishReq] source Id: 0x%08x \n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.sourceL2Id);
-         LOG_I(RRC,"[PC5EstablishReq] destination Id: 0x%08x \n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.destinationL2Id);
+            LOG_I(RRC,"[PC5EstablishReq] destination Id: 0x%08x \n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.destinationL2Id);
 #endif
+         }
+
          //store sourceL2Id, destinationL2Id
-         UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
-         UE_rrc_inst[module_id].destinationL2Id = destinationL2Id;
-         // configure lower layers PDCP/MAC/PHY
-         rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
-                (RadioResourceConfigCommonSIB_t *)NULL,
-                (struct PhysicalConfigDedicated *)NULL,
-     #if defined(Rel10) || defined(Rel14)
-                (SCellToAddMod_r10_t *)NULL,
-                //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
-     #endif
-                (MeasObjectToAddMod_t **)NULL,
-                (MAC_MainConfig_t *)NULL,
-                0,
-                (struct LogicalChannelConfig *)NULL,
-                (MeasGapConfig_t *)NULL,
-                (TDD_Config_t *)NULL,
-                (MobilityControlInfo_t *)NULL,
-                NULL,
-                NULL,
-                NULL,
-                NULL,
-                NULL,
-                NULL
-     #if defined(Rel10) || defined(Rel14)
-                ,0,
-                (MBSFN_AreaInfoList_r9_t *)NULL,
-                (PMCH_InfoList_r9_t *)NULL
+         if (type > 0) { //TX
+            UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
+            UE_rrc_inst[module_id].destinationL2Id = destinationL2Id;
+
+            // configure lower layers PDCP/MAC/PHY
+            rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
+                   (RadioResourceConfigCommonSIB_t *)NULL,
+                   (struct PhysicalConfigDedicated *)NULL,
+        #if defined(Rel10) || defined(Rel14)
+                   (SCellToAddMod_r10_t *)NULL,
+                   //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+        #endif
+                   (MeasObjectToAddMod_t **)NULL,
+                   (MAC_MainConfig_t *)NULL,
+                   0,
+                   (struct LogicalChannelConfig *)NULL,
+                   (MeasGapConfig_t *)NULL,
+                   (TDD_Config_t *)NULL,
+                   (MobilityControlInfo_t *)NULL,
+                   NULL,
+                   NULL,
+                   NULL,
+                   NULL,
+                   NULL,
+                   NULL
+        #if defined(Rel10) || defined(Rel14)
+                   ,0,
+                   (MBSFN_AreaInfoList_r9_t *)NULL,
+                   (PMCH_InfoList_r9_t *)NULL
+
+        #endif
+        #ifdef CBA
+                   ,
+                   0,
+                   0
+        #endif
+        #if defined(Rel10) || defined(Rel14)
+                   ,
+                   &sourceL2Id,
+                   NULL,
+                   &destinationL2Id
+        #endif
+                   );
+
+         } else {//RX
+            UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
+            // configure lower layers PDCP/MAC/PHY
+              rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
+                     (RadioResourceConfigCommonSIB_t *)NULL,
+                     (struct PhysicalConfigDedicated *)NULL,
+          #if defined(Rel10) || defined(Rel14)
+                     (SCellToAddMod_r10_t *)NULL,
+                     //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+          #endif
+                     (MeasObjectToAddMod_t **)NULL,
+                     (MAC_MainConfig_t *)NULL,
+                     0,
+                     (struct LogicalChannelConfig *)NULL,
+                     (MeasGapConfig_t *)NULL,
+                     (TDD_Config_t *)NULL,
+                     (MobilityControlInfo_t *)NULL,
+                     NULL,
+                     NULL,
+                     NULL,
+                     NULL,
+                     NULL,
+                     NULL
+          #if defined(Rel10) || defined(Rel14)
+                     ,0,
+                     (MBSFN_AreaInfoList_r9_t *)NULL,
+                     (PMCH_InfoList_r9_t *)NULL
+
+          #endif
+          #ifdef CBA
+                     ,
+                     0,
+                     0
+          #endif
+          #if defined(Rel10) || defined(Rel14)
+                     ,
+                     &sourceL2Id,
+                     NULL,
+                     NULL
+          #endif
+                     );
+         }
 
-     #endif
-     #ifdef CBA
-                ,
-                0,
-                0
-     #endif
-     #if defined(Rel10) || defined(Rel14)
-                ,
-                &sourceL2Id,
-                &destinationL2Id,
-                &destinationL2Id
-     #endif
-                );
 
          LOG_I(RRC,"Send PC5EstablishRsp to ProSe App\n");
          memset(send_buf, 0, BUFSIZE);
@@ -5733,7 +5785,7 @@ void *rrc_control_socket_thread_fct(void *arg)
 
          prose_addr_len = sizeof(prose_app_addr);
          n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
-         free(sl_ctrl_msg_send);
+//         free(sl_ctrl_msg_send);
          if (n < 0){
             LOG_E(RRC, "ERROR: Failed to send to ProSe App\n");
             exit(EXIT_FAILURE);