Commit a85be06c authored by Guido Casati's avatar Guido Casati

Add defines for IPv4 and IPv6 PDU address header fields

parent 2c07f008
...@@ -128,14 +128,14 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_ ...@@ -128,14 +128,14 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_
uint8_t *addr = psea_msg.pdu_addr_ie.pdu_addr_oct; uint8_t *addr = psea_msg.pdu_addr_ie.pdu_addr_oct;
if (psea_msg.pdu_addr_ie.pdu_type == PDU_SESSION_TYPE_IPV4) { if (psea_msg.pdu_addr_ie.pdu_type == PDU_SESSION_TYPE_IPV4) {
for (int i = 0; i < 4; ++i) for (int i = 0; i < IPv4_ADDRESS_LENGTH; ++i)
addr[i] = *curPtr++; addr[i] = *curPtr++;
char ip[20]; char ip[20];
capture_ipv4_addr(&addr[0], ip, sizeof(ip)); capture_ipv4_addr(&addr[0], ip, sizeof(ip));
tun_config(1, ip, NULL, "oaitun_ue"); tun_config(1, ip, NULL, "oaitun_ue");
setup_ue_ipv4_route(1, ip, "oaitun_ue"); setup_ue_ipv4_route(1, ip, "oaitun_ue");
} else if (psea_msg.pdu_addr_ie.pdu_type == PDU_SESSION_TYPE_IPV6) { } else if (psea_msg.pdu_addr_ie.pdu_type == PDU_SESSION_TYPE_IPV6) {
for (int i = 0; i < 8; ++i) for (int i = 0; i < IPv6_INTERFACE_ID_LENGTH; ++i)
addr[i] = *curPtr++; addr[i] = *curPtr++;
char ipv6[40]; char ipv6[40];
capture_ipv6_addr(addr, ipv6, sizeof(ipv6)); capture_ipv6_addr(addr, ipv6, sizeof(ipv6));
...@@ -145,12 +145,12 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_ ...@@ -145,12 +145,12 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_
// IPv4v6, the PDU address information in octet 4 to octet 11 // IPv4v6, the PDU address information in octet 4 to octet 11
// contains an interface identifier for the IPv6 link local address // contains an interface identifier for the IPv6 link local address
// and in octet 12 to octet 15 contains an IPv4 address." // and in octet 12 to octet 15 contains an IPv4 address."
for (int i = 0; i < 12; ++i) for (int i = 0; i < IPv4_ADDRESS_LENGTH + IPv6_INTERFACE_ID_LENGTH; ++i)
addr[i] = *curPtr++; addr[i] = *curPtr++;
char ipv6[40]; char ipv6[40];
capture_ipv6_addr(addr, ipv6, sizeof(ipv6)); capture_ipv6_addr(addr, ipv6, sizeof(ipv6));
char ipv4[20]; char ipv4[20];
capture_ipv4_addr(&addr[8], ipv4, sizeof(ipv4)); capture_ipv4_addr(&addr[IPv6_INTERFACE_ID_LENGTH], ipv4, sizeof(ipv4));
tun_config(1, ipv4, ipv6, "oaitun_ue"); tun_config(1, ipv4, ipv6, "oaitun_ue");
setup_ue_ipv4_route(1, ipv4, "oaitun_ue"); setup_ue_ipv4_route(1, ipv4, "oaitun_ue");
} else { } else {
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
#define PDU_SESSION_TYPE_IPV4 0b001 #define PDU_SESSION_TYPE_IPV4 0b001
#define PDU_SESSION_TYPE_IPV6 0b010 #define PDU_SESSION_TYPE_IPV6 0b010
#define PDU_SESSION_TYPE_IPV4V6 0b011 #define PDU_SESSION_TYPE_IPV4V6 0b011
#define IPv4_ADDRESS_LENGTH 4 // length of the IPv4 address associated with a PDU session
#define IPv6_INTERFACE_ID_LENGTH 8 // interface identifier for the IPv6 link local address
/* Rule operation codes - TS 24.501 Table 9.11.4.13.1 */ /* Rule operation codes - TS 24.501 Table 9.11.4.13.1 */
...@@ -114,7 +116,8 @@ typedef struct pdu_address_s { ...@@ -114,7 +116,8 @@ typedef struct pdu_address_s {
uint8_t pdu_iei; /* PDU Address IEI (0x29) */ uint8_t pdu_iei; /* PDU Address IEI (0x29) */
uint8_t pdu_length; /* Length of PDU address contents */ uint8_t pdu_length; /* Length of PDU address contents */
uint8_t pdu_type; /* PDU session type value */ uint8_t pdu_type; /* PDU session type value */
uint8_t pdu_addr_oct[12]; /* PDU address information (depending on type, up to 12 bytes)*/ /// PDU address information (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 */ } pdu_address_t; /* TS 24.501 9.11.4.10 */
typedef struct dnn_s { typedef struct dnn_s {
......
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