Commit 53f1ebde authored by Laurent THOMAS's avatar Laurent THOMAS

add processing of pduSessionEstablishmentAccept

parent afcbf7b6
......@@ -43,6 +43,7 @@
#include <openair3/UICC/usim_interface.h>
#include <openair3/NAS/COMMON/NR_NAS_defs.h>
#include <openair1/PHY/phy_extern_nr_ue.h>
#include <openair1/SIMULATION/ETH_TRANSPORT/proto.h>
uint8_t *registration_request_buf;
uint32_t registration_request_len;
......@@ -854,9 +855,12 @@ void *nas_nrue_task(void *args_p)
offset = 0;
while(offset < payload_container_length) {
// Fixme: this is not good 'type' 0x29 searching in TLV like structure
// AND fix dirsty code copy hereafter of the same!!!
if (*(payload_container + offset) == 0x29) { // PDU address IEI
if ((*(payload_container+offset+1) == 0x05) && (*(payload_container +offset+2) == 0x01)) { // IPV4
nas_getparams();
// FixME: seems wrong: pdcp_module_init has already created the interface
netlink_init_tun("ue", 1);
sprintf(baseNetAddress, "%d.%d", *(payload_container+offset+3), *(payload_container+offset+4));
int third_octet = *(payload_container+offset+5);
......@@ -912,6 +916,36 @@ void *nas_nrue_task(void *args_p)
case FGS_DOWNLINK_NAS_TRANSPORT:
decodeDownlinkNASTransport(&initialNasMsg, pdu_buffer);
break;
case FGS_PDU_SESSION_ESTABLISHMENT_ACC:
{
uint8_t offset = 0;
uint8_t *payload_container = pdu_buffer;
offset += SECURITY_PROTECTED_5GS_NAS_MESSAGE_HEADER_LENGTH;
uint16_t payload_container_length = htons(((dl_nas_transport_t *)(pdu_buffer + offset))->payload_container_length);
if ((payload_container_length >= PAYLOAD_CONTAINER_LENGTH_MIN) &&
(payload_container_length <= PAYLOAD_CONTAINER_LENGTH_MAX))
offset += (PLAIN_5GS_NAS_MESSAGE_HEADER_LENGTH + 3);
if (offset < NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length)
payload_container = pdu_buffer + offset;
while(offset < payload_container_length) {
if (*(payload_container + offset) == 0x29) { // PDU address IEI
if ((*(payload_container+offset+1) == 0x05) && (*(payload_container +offset+2) == 0x01)) { // IPV4
nas_getparams();
sprintf(baseNetAddress, "%d.%d", *(payload_container+offset+3), *(payload_container+offset+4));
int third_octet = *(payload_container+offset+5);
int fourth_octet = *(payload_container+offset+6);
LOG_I(NAS, "Received PDU Session Establishment Accept, UE IP: %d.%d.%d.%d\n",
*(payload_container+offset+3), *(payload_container+offset+4),
*(payload_container+offset+5), *(payload_container+offset+6));
nas_config(1,third_octet,fourth_octet,"oaitun_ue");
break;
}
}
offset++;
}
}
break;
default:
LOG_W(NR_RRC,"unknow message type %d\n",msg_type);
......@@ -927,9 +961,8 @@ void *nas_nrue_task(void *args_p)
itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p);
LOG_I(NAS, "Send NAS_UPLINK_DATA_REQ message\n");
}
break;
}
break;
default:
LOG_E(NAS, "[UE %d] Received unexpected message %s\n", Mod_id, ITTI_MSG_NAME (msg_p));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment