Commit 0fd0a4fc authored by Guido Casati's avatar Guido Casati

NAS: Minor comments and logs

parent 8215aa60
......@@ -56,12 +56,17 @@ static int capture_ipv6_addr(const uint8_t *addr, char *ip, size_t len)
addr[7]);
}
/**
* @brief PDU session establishment accept (8.3.2 of 3GPP TS 24.501)
* network to UE
*/
void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_length)
{
security_protected_nas_5gs_msg_t sec_nas_hdr;
security_protected_plain_nas_5gs_msg_t sec_nas_msg;
pdu_session_establishment_accept_msg_t psea_msg;
uint8_t *curPtr = buffer;
// Security protected NAS header (7 bytes)
sec_nas_hdr.epd = *curPtr++;
sec_nas_hdr.sht = *curPtr++;
uint32_t tmp;
......@@ -69,6 +74,7 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_
sec_nas_hdr.mac = htonl(tmp);
curPtr += sizeof(sec_nas_hdr.mac);
sec_nas_hdr.sqn = *curPtr++;
// Security protected plain NAS message
sec_nas_msg.epd = *curPtr++;
sec_nas_msg.sht = *curPtr++;
sec_nas_msg.msg_type = *curPtr++;
......@@ -144,6 +150,8 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_
capture_ipv4_addr(&addr[0], ip, sizeof(ip));
tun_config(1, ip, NULL, "oaitun_ue");
setup_ue_ipv4_route(1, ip, "oaitun_ue");
LOG_I(NAS, "Received PDU Session Establishment Accept, UE IP: %u.%u.%u.%u\n",
addr[0], addr[1], addr[2], addr[3]);
} else if (psea_msg.pdu_addr_ie.pdu_type == PDU_SESSION_TYPE_IPV6) {
for (int i = 0; i < IPv6_INTERFACE_ID_LENGTH; ++i)
addr[i] = *curPtr++;
......
......@@ -120,10 +120,13 @@ typedef struct session_ambr_s {
/* Optional Presence IE - TS 24.501 Table 8.3.2.1.1 */
typedef struct pdu_address_s {
uint8_t pdu_iei; /* PDU Address IEI (0x29) */
uint8_t pdu_length; /* Length of PDU address contents */
uint8_t pdu_type; /* PDU session type value */
/// PDU address information (depending on type, up to 12 bytes)
// PDU address IEI (0x29) (octet 1)
uint8_t pdu_iei;
// Length of PDU address contents (octet 2)
uint8_t pdu_length;
// PDU session type value (9.11.4.11 of TS 24.501)
uint8_t pdu_type;
// PDU address IE (depending on type, up to 12 bytes)
uint8_t pdu_addr_oct[IPv4_ADDRESS_LENGTH + IPv6_INTERFACE_ID_LENGTH];
} pdu_address_t; /* TS 24.501 9.11.4.10 */
......
......@@ -23,6 +23,7 @@
* \brief simulator for nr nas message
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \protocol 5GS (5GMM and 5GSM)
* \date 2020
* \version 0.1
*/
......
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