Bug Fixed for 5GC
This commit is contained in:
parent
85555daa15
commit
01b69e046f
|
@ -0,0 +1,101 @@
|
|||
db_uri: mongodb://localhost/open5gs
|
||||
|
||||
logger:
|
||||
|
||||
parameter:
|
||||
|
||||
amf:
|
||||
sbi:
|
||||
- addr: 127.0.0.2
|
||||
port: 7777
|
||||
ngap:
|
||||
- addr: 127.0.0.2
|
||||
guami:
|
||||
- plmn_id:
|
||||
mcc: 001
|
||||
mnc: 01
|
||||
amf_id:
|
||||
region: 1
|
||||
set: 1
|
||||
pointer: 1
|
||||
tai:
|
||||
- plmn_id:
|
||||
mcc: 001
|
||||
mnc: 01
|
||||
tac: 81
|
||||
plmn:
|
||||
- plmn_id:
|
||||
mcc: 001
|
||||
mnc: 01
|
||||
s_nssai:
|
||||
- sst: 1
|
||||
security:
|
||||
integrity_order : [ NIA2, NIA1, NIA0 ]
|
||||
ciphering_order : [ NEA0, NEA1, NEA2 ]
|
||||
network_name:
|
||||
full: Open5GS
|
||||
amf_name: open5gs-amf0
|
||||
|
||||
smf:
|
||||
sbi:
|
||||
- addr: 127.0.0.3
|
||||
port: 7777
|
||||
gtpc:
|
||||
- addr: 127.0.0.3
|
||||
- addr: ::1
|
||||
pfcp:
|
||||
- addr: 127.0.0.3
|
||||
pdn:
|
||||
- addr: 10.45.0.1/16
|
||||
- addr: cafe::1/64
|
||||
dns:
|
||||
- 8.8.8.8
|
||||
- 8.8.4.4
|
||||
- 2001:4860:4860::8888
|
||||
- 2001:4860:4860::8844
|
||||
mtu: 1400
|
||||
freeDiameter:
|
||||
identity: pgw.open-ims.test
|
||||
realm: open-ims.test
|
||||
listen_on: 127.0.0.3
|
||||
load_extension:
|
||||
- module: @freediameter_extensions_builddir@/dbg_msg_dumps.fdx
|
||||
conf: 0x8888
|
||||
- module: @freediameter_extensions_builddir@/dict_rfc5777.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_mip6i.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_nasreq.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_nas_mipv6.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_dcca.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_dcca_3gpp.fdx
|
||||
connect:
|
||||
- identity: pcrf.open-ims.test
|
||||
addr: 127.0.0.5
|
||||
upf:
|
||||
pfcp:
|
||||
- addr: 127.0.0.4
|
||||
gtpu:
|
||||
- addr:
|
||||
- 127.0.0.4
|
||||
- ::1
|
||||
pdn:
|
||||
|
||||
ausf:
|
||||
sbi:
|
||||
- addr: 127.0.0.5
|
||||
port: 7777
|
||||
|
||||
udm:
|
||||
sbi:
|
||||
- addr: 127.0.0.6
|
||||
port: 7777
|
||||
|
||||
udr:
|
||||
sbi:
|
||||
- addr: 127.0.0.7
|
||||
port: 7777
|
||||
nrf:
|
||||
sbi:
|
||||
- addr:
|
||||
- 127.0.0.1
|
||||
- ::1
|
||||
port: 7777
|
|
@ -36,6 +36,7 @@ endif
|
|||
example_conf = '''
|
||||
5gc.yaml
|
||||
5gc-sample.yaml
|
||||
00101.yaml
|
||||
minimal.yaml
|
||||
epc.yaml
|
||||
epc-fdconf.yaml
|
||||
|
|
|
@ -290,13 +290,13 @@ pool:
|
|||
#
|
||||
# time:
|
||||
#
|
||||
# o NF Instance Heartbeat (Default : 3 seconds)
|
||||
# o NF Instance Heartbeat (Default : 5 seconds)
|
||||
#
|
||||
# o NF Instance Heartbeat (Disabled)
|
||||
# nf_instance:
|
||||
# heartbeat: 0
|
||||
#
|
||||
# o NF Instance Heartbeat (5 seconds)
|
||||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 5
|
||||
# heartbeat: 10
|
||||
time:
|
||||
|
|
|
@ -167,13 +167,13 @@ pool:
|
|||
#
|
||||
# time:
|
||||
#
|
||||
# o NF Instance Heartbeat (Default : 3 seconds)
|
||||
# o NF Instance Heartbeat (Default : 5 seconds)
|
||||
#
|
||||
# o NF Instance Heartbeat (Disabled)
|
||||
# nf_instance:
|
||||
# heartbeat: 0
|
||||
#
|
||||
# o NF Instance Heartbeat (5 seconds)
|
||||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 5
|
||||
# heartbeat: 10
|
||||
time:
|
||||
|
|
|
@ -370,13 +370,13 @@ pool:
|
|||
#
|
||||
# time:
|
||||
#
|
||||
# o NF Instance Heartbeat (Default : 3 seconds)
|
||||
# o NF Instance Heartbeat (Default : 5 seconds)
|
||||
#
|
||||
# o NF Instance Heartbeat (Disabled)
|
||||
# nf_instance:
|
||||
# heartbeat: 0
|
||||
#
|
||||
# o NF Instance Heartbeat (5 seconds)
|
||||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 5
|
||||
# heartbeat: 10
|
||||
time:
|
||||
|
|
|
@ -167,13 +167,13 @@ pool:
|
|||
#
|
||||
# time:
|
||||
#
|
||||
# o NF Instance Heartbeat (Default : 3 seconds)
|
||||
# o NF Instance Heartbeat (Default : 5 seconds)
|
||||
#
|
||||
# o NF Instance Heartbeat (Disabled)
|
||||
# nf_instance:
|
||||
# heartbeat: 0
|
||||
#
|
||||
# o NF Instance Heartbeat (5 seconds)
|
||||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 5
|
||||
# heartbeat: 10
|
||||
time:
|
||||
|
|
|
@ -169,13 +169,13 @@ pool:
|
|||
#
|
||||
# time:
|
||||
#
|
||||
# o NF Instance Heartbeat (Default : 3 seconds)
|
||||
# o NF Instance Heartbeat (Default : 5 seconds)
|
||||
#
|
||||
# o NF Instance Heartbeat (Disabled)
|
||||
# nf_instance:
|
||||
# heartbeat: 0
|
||||
#
|
||||
# o NF Instance Heartbeat (5 seconds)
|
||||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 5
|
||||
# heartbeat: 10
|
||||
time:
|
||||
|
|
|
@ -187,7 +187,7 @@ static int config_prepare(void)
|
|||
|
||||
recalculate_pool_size();
|
||||
|
||||
self.time.nf_instance.heartbeat = 3; /* 3 second */
|
||||
self.time.nf_instance.heartbeat = 5; /* 5 second */
|
||||
self.time.nf_instance.validity = 3600; /* 3600 seconds = 1 hour */
|
||||
self.time.subscription.validity = 86400; /* 86400 seconds = 1 day */
|
||||
|
||||
|
|
|
@ -123,6 +123,29 @@ void ogs_asn_buffer_to_BIT_STRING(
|
|||
memcpy(bit_string->buf, buf, size);
|
||||
}
|
||||
|
||||
void ogs_asn_uint32_to_BIT_STRING(
|
||||
uint32_t uint32, uint8_t bitsize, BIT_STRING_t *bit_string)
|
||||
{
|
||||
char tmp[32];
|
||||
uint64_t uint64;
|
||||
ogs_assert(bit_string);
|
||||
|
||||
uint64 = uint32;
|
||||
ogs_uint64_to_buffer(
|
||||
uint64 << ((32 - bitsize) % 8), (bitsize + 7) / 8, tmp);
|
||||
ogs_asn_buffer_to_BIT_STRING(
|
||||
tmp, (bitsize + 7) / 8, (32 - bitsize) % 8, bit_string);
|
||||
}
|
||||
|
||||
void ogs_asn_BIT_STRING_to_uint32(BIT_STRING_t *bit_string, uint32_t *uint32)
|
||||
{
|
||||
ogs_assert(bit_string);
|
||||
ogs_assert(uint32);
|
||||
|
||||
*uint32 = ogs_buffer_to_uint64(bit_string->buf, bit_string->size)
|
||||
>> bit_string->bits_unused;
|
||||
}
|
||||
|
||||
int ogs_asn_BIT_STRING_to_ip(BIT_STRING_t *bit_string, ogs_ip_t *ip)
|
||||
{
|
||||
char buf[OGS_ADDRSTRLEN], buf2[OGS_ADDRSTRLEN];
|
||||
|
|
|
@ -70,8 +70,12 @@ void ogs_asn_OCTET_STRING_to_uint32(
|
|||
|
||||
void ogs_asn_buffer_to_OCTET_STRING(
|
||||
void *buf, int size, OCTET_STRING_t *octet_string);
|
||||
|
||||
void ogs_asn_buffer_to_BIT_STRING(
|
||||
void *buf, int size, int unused, BIT_STRING_t *bit_string);
|
||||
void ogs_asn_uint32_to_BIT_STRING(
|
||||
uint32_t uint32, uint8_t bitsize, BIT_STRING_t *bit_string);
|
||||
void ogs_asn_BIT_STRING_to_uint32(BIT_STRING_t *bit_string, uint32_t *uint32);
|
||||
|
||||
int ogs_asn_BIT_STRING_to_ip(
|
||||
BIT_STRING_t *bit_string, ogs_ip_t *ip);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/*******************************************************************************
|
||||
* This file had been created by gtp-tlv.py script v0.1.0
|
||||
* Please do not modify this file but regenerate it via script.
|
||||
* Created on: 2020-06-25 00:24:05.837938 by acetcom
|
||||
* Created on: 2020-06-25 16:31:59.432871 by acetcom
|
||||
* from 29274-d80.docx
|
||||
******************************************************************************/
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/*******************************************************************************
|
||||
* This file had been created by gtp-tlv.py script v0.1.0
|
||||
* Please do not modify this file but regenerate it via script.
|
||||
* Created on: 2020-06-25 00:24:05.831453 by acetcom
|
||||
* Created on: 2020-06-25 16:31:59.426452 by acetcom
|
||||
* from 29274-d80.docx
|
||||
******************************************************************************/
|
||||
|
||||
|
@ -42,6 +42,8 @@ extern "C" {
|
|||
typedef struct ogs_gtp_header_s {
|
||||
union {
|
||||
struct {
|
||||
#define OGS_GTP_VERSION_0 0
|
||||
#define OGS_GTP_VERSION_1 1
|
||||
ED4(uint8_t version:3;,
|
||||
uint8_t piggybacked:1;,
|
||||
uint8_t teid_presence:1;,
|
||||
|
@ -50,8 +52,16 @@ typedef struct ogs_gtp_header_s {
|
|||
/* GTU-U flags */
|
||||
#define OGS_GTPU_FLAGS_PN 0x1
|
||||
#define OGS_GTPU_FLAGS_S 0x2
|
||||
#define OGS_GTPU_FLAGS_E 0x4
|
||||
uint8_t flags;
|
||||
};
|
||||
/* GTP-U message type, defined in 3GPP TS 29.281 Release 11 */
|
||||
#define OGS_GTPU_MSGTYPE_ECHO_REQ 1
|
||||
#define OGS_GTPU_MSGTYPE_ECHO_RSP 2
|
||||
#define OGS_GTPU_MSGTYPE_ERR_IND 26
|
||||
#define OGS_GTPU_MSGTYPE_SUPP_EXTHDR_NOTI 31
|
||||
#define OGS_GTPU_MSGTYPE_END_MARKER 254
|
||||
#define OGS_GTPU_MSGTYPE_GPDU 255
|
||||
uint8_t type;
|
||||
uint16_t length;
|
||||
union {
|
||||
|
@ -67,14 +77,6 @@ typedef struct ogs_gtp_header_s {
|
|||
};
|
||||
} __attribute__ ((packed)) ogs_gtp_header_t;
|
||||
|
||||
/* GTP-U message type, defined in 3GPP TS 29.281 Release 11 */
|
||||
#define OGS_GTPU_MSGTYPE_ECHO_REQ 1
|
||||
#define OGS_GTPU_MSGTYPE_ECHO_RSP 2
|
||||
#define OGS_GTPU_MSGTYPE_ERR_IND 26
|
||||
#define OGS_GTPU_MSGTYPE_SUPP_EXTHDR_NOTI 31
|
||||
#define OGS_GTPU_MSGTYPE_END_MARKER 254
|
||||
#define OGS_GTPU_MSGTYPE_GPDU 255
|
||||
|
||||
/* GTPv2-C message type */
|
||||
#define OGS_GTP_ECHO_REQUEST_TYPE 1
|
||||
#define OGS_GTP_ECHO_RESPONSE_TYPE 2
|
||||
|
|
|
@ -394,6 +394,8 @@ extern "C" {
|
|||
typedef struct ogs_gtp_header_s {
|
||||
union {
|
||||
struct {
|
||||
#define OGS_GTP_VERSION_0 0
|
||||
#define OGS_GTP_VERSION_1 1
|
||||
ED4(uint8_t version:3;,
|
||||
uint8_t piggybacked:1;,
|
||||
uint8_t teid_presence:1;,
|
||||
|
@ -402,8 +404,16 @@ typedef struct ogs_gtp_header_s {
|
|||
/* GTU-U flags */
|
||||
#define OGS_GTPU_FLAGS_PN 0x1
|
||||
#define OGS_GTPU_FLAGS_S 0x2
|
||||
#define OGS_GTPU_FLAGS_E 0x4
|
||||
uint8_t flags;
|
||||
};
|
||||
/* GTP-U message type, defined in 3GPP TS 29.281 Release 11 */
|
||||
#define OGS_GTPU_MSGTYPE_ECHO_REQ 1
|
||||
#define OGS_GTPU_MSGTYPE_ECHO_RSP 2
|
||||
#define OGS_GTPU_MSGTYPE_ERR_IND 26
|
||||
#define OGS_GTPU_MSGTYPE_SUPP_EXTHDR_NOTI 31
|
||||
#define OGS_GTPU_MSGTYPE_END_MARKER 254
|
||||
#define OGS_GTPU_MSGTYPE_GPDU 255
|
||||
uint8_t type;
|
||||
uint16_t length;
|
||||
union {
|
||||
|
@ -419,14 +429,6 @@ typedef struct ogs_gtp_header_s {
|
|||
};
|
||||
} __attribute__ ((packed)) ogs_gtp_header_t;
|
||||
|
||||
/* GTP-U message type, defined in 3GPP TS 29.281 Release 11 */
|
||||
#define OGS_GTPU_MSGTYPE_ECHO_REQ 1
|
||||
#define OGS_GTPU_MSGTYPE_ECHO_RSP 2
|
||||
#define OGS_GTPU_MSGTYPE_ERR_IND 26
|
||||
#define OGS_GTPU_MSGTYPE_SUPP_EXTHDR_NOTI 31
|
||||
#define OGS_GTPU_MSGTYPE_END_MARKER 254
|
||||
#define OGS_GTPU_MSGTYPE_GPDU 255
|
||||
|
||||
/* GTPv2-C message type */
|
||||
""")
|
||||
|
||||
|
|
|
@ -28,26 +28,14 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OGS_5GS_GTP_HEADER_LEN 16
|
||||
typedef struct ogs_5gs_gtp_header_s {
|
||||
union {
|
||||
struct {
|
||||
ED6(uint8_t version:3;,
|
||||
uint8_t protocol_type:1;,
|
||||
uint8_t reserved:1;,
|
||||
uint8_t next_extension:1;,
|
||||
uint8_t seqence_number:1;,
|
||||
uint8_t n_pdu_number:1;)
|
||||
};
|
||||
uint8_t flags;
|
||||
};
|
||||
uint8_t type;
|
||||
uint16_t length;
|
||||
uint32_t teid;
|
||||
struct {
|
||||
#define OGS_GTPV1U_EXTENSION_HEADER_LEN 4
|
||||
|
||||
typedef struct ogs_gtp_extension_header_s {
|
||||
#define OGS_GTP_EXTENSION_HEADER_TYPE_PDU_SESSION_CONTAINER 0x85
|
||||
#define OGS_GTP_EXTENSION_HEADER_TYPE_NO_MORE_EXTENSION_HEADERS 0x0
|
||||
uint32_t type;
|
||||
uint16_t sequence_number;
|
||||
uint8_t n_pdu_number;
|
||||
uint8_t type;
|
||||
uint8_t len;
|
||||
#define OGS_GTP_EXTENSION_HEADER_PDU_TYPE_UL_PDU_SESSION_INFORMATION 1
|
||||
ED2(uint8_t pdu_type:4;,
|
||||
|
@ -55,8 +43,7 @@ typedef struct ogs_5gs_gtp_header_s {
|
|||
ED2(uint8_t spare2:2;,
|
||||
uint8_t qos_flow_identifier:6;);
|
||||
uint8_t next_type;
|
||||
} extension_header;
|
||||
} __attribute__ ((packed)) ogs_5gs_gtp_header_t;
|
||||
} __attribute__ ((packed)) ogs_gtp_extension_header_t;
|
||||
|
||||
/* 8.4 Cause */
|
||||
#define OGS_GTP_CAUSE_LOCAL_DETACH 2
|
||||
|
|
|
@ -19,6 +19,61 @@
|
|||
|
||||
#include "ogs-gtp.h"
|
||||
|
||||
int ogs_gtpu_header_len(ogs_pkbuf_t *pkbuf)
|
||||
{
|
||||
ogs_gtp_header_t *gtp_h = NULL;
|
||||
uint8_t *ext_h = NULL;
|
||||
uint16_t len = 0;
|
||||
|
||||
ogs_assert(pkbuf);
|
||||
ogs_assert(pkbuf->data);
|
||||
|
||||
gtp_h = (ogs_gtp_header_t *)pkbuf->data;
|
||||
|
||||
len = OGS_GTPV1U_HEADER_LEN;
|
||||
if (pkbuf->len < len) return -1;
|
||||
|
||||
if (gtp_h->flags & OGS_GTPU_FLAGS_E) {
|
||||
|
||||
len += OGS_GTPV1U_EXTENSION_HEADER_LEN;
|
||||
if (pkbuf->len < len) return -1;
|
||||
|
||||
/*
|
||||
* TS29.281
|
||||
* 5.2.1 General format of the GTP-U Extension Header
|
||||
*
|
||||
* If no such Header follows,
|
||||
* then the value of the Next Extension Header Type shall be 0. */
|
||||
while (*(ext_h = (((uint8_t *)gtp_h) + len - 1))) {
|
||||
/*
|
||||
* The length of the Extension header shall be defined
|
||||
* in a variable length of 4 octets, i.e. m+1 = n*4 octets,
|
||||
* where n is a positive integer.
|
||||
*/
|
||||
len += (*(++ext_h)) * 4;
|
||||
if (pkbuf->len < len) return -1;
|
||||
}
|
||||
|
||||
} else if (gtp_h->flags & (OGS_GTPU_FLAGS_S|OGS_GTPU_FLAGS_PN)) {
|
||||
/*
|
||||
* If and only if one or more of these three flags are set,
|
||||
* the fields Sequence Number, N-PDU and Extension Header
|
||||
* shall be present. The sender shall set all the bits of
|
||||
* the unused fields to zero. The receiver shall not evaluate
|
||||
* the unused fields.
|
||||
* For example, if only the E flag is set to 1, then
|
||||
* the N-PDU Number and Sequence Number fields shall also be present,
|
||||
* but will not have meaningful values and shall not be evaluated.
|
||||
*/
|
||||
len += 4;
|
||||
}
|
||||
|
||||
if (pkbuf->len < len) return -1;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
uint16_t ogs_in_cksum(uint16_t *addr, int len)
|
||||
{
|
||||
int nleft = len;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
int ogs_gtpu_header_len(ogs_pkbuf_t *pkbuf);
|
||||
uint16_t ogs_in_cksum(uint16_t *addr, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -135,6 +135,21 @@ void ogs_nas_5gs_nas_guti_to_mobilty_identity_guti(
|
|||
|
||||
memset(mobile_identity_guti, 0, sizeof(*mobile_identity_guti));
|
||||
|
||||
/*
|
||||
* TS24.501
|
||||
* 9.11.3.4 5GS mobile identity
|
||||
* Figure 9.11.3.4.1 5GS mobile identity IE for type of identity "5G-GUTI"
|
||||
*
|
||||
* Octet 1 : 5GS mobile identity IEI
|
||||
* Octet 2-3 : Length of 5GS mobile identity contents
|
||||
* Octet 4 : 1 1 1 1 0 0 1 0
|
||||
*
|
||||
* <Octet 4>
|
||||
* h.supi_format = 0xf (1 1 1 1)
|
||||
* h.odd_even = 0 (Spare 0)
|
||||
* h.type = x x x (Type of identity : 5G-GUTI)
|
||||
*/
|
||||
mobile_identity_guti->h.supi_format = 0xf;
|
||||
mobile_identity_guti->h.type = OGS_NAS_5GS_MOBILE_IDENTITY_GUTI;
|
||||
|
||||
memcpy(&mobile_identity_guti->nas_plmn_id,
|
||||
|
|
|
@ -142,10 +142,9 @@ ED3(uint8_t type:4;,
|
|||
* M LV-E 6-n */
|
||||
#define OGS_NAS_MAX_SCHEME_OUTPUT_LEN 64
|
||||
typedef struct ogs_nas_5gs_mobile_identity_header_s {
|
||||
ED4(uint8_t spare1:1;,
|
||||
#define OGS_NAS_5GS_SUPI_FORMAT_IMSI 0
|
||||
#define OGS_NAS_5GS_SUPI_FORMAT_NETWORK_SPECIFIC_IDENTIFIER 1
|
||||
uint8_t supi_format:3;,
|
||||
ED3(uint8_t supi_format:4;,
|
||||
uint8_t odd_even:1;,
|
||||
uint8_t type:3;)
|
||||
} __attribute__ ((packed)) ogs_nas_5gs_mobile_identity_header_t;
|
||||
|
|
|
@ -19,35 +19,23 @@
|
|||
|
||||
#include "ogs-ngap.h"
|
||||
|
||||
void ogs_ngap_uint32_to_GNB_ID(uint32_t gnb_id, NGAP_GNB_ID_t *gNB_ID)
|
||||
void ogs_ngap_uint32_to_GNB_ID(
|
||||
uint32_t gnb_id, uint8_t bitsize, NGAP_GNB_ID_t *gNB_ID)
|
||||
{
|
||||
BIT_STRING_t *bit_string = NULL;
|
||||
|
||||
ogs_assert(gNB_ID);
|
||||
|
||||
/* gNB ID : 22bit ~ 32bit */
|
||||
ogs_asn_uint32_to_BIT_STRING(gnb_id, bitsize, &gNB_ID->choice.gNB_ID);
|
||||
gNB_ID->present = NGAP_GNB_ID_PR_gNB_ID;
|
||||
bit_string = &gNB_ID->choice.gNB_ID;
|
||||
ogs_assert(bit_string);
|
||||
|
||||
bit_string->size = 3;
|
||||
bit_string->buf = CALLOC(bit_string->size, sizeof(uint8_t));
|
||||
|
||||
bit_string->buf[0] = gnb_id >> 16;
|
||||
bit_string->buf[1] = gnb_id >> 8;
|
||||
bit_string->buf[2] = (gnb_id & 0xff);
|
||||
}
|
||||
|
||||
void ogs_ngap_GNB_ID_to_uint32(NGAP_GNB_ID_t *gNB_ID, uint32_t *gnb_id)
|
||||
{
|
||||
uint8_t *buf = NULL;
|
||||
|
||||
ogs_assert(gnb_id);
|
||||
ogs_assert(gNB_ID);
|
||||
|
||||
buf = gNB_ID->choice.gNB_ID.buf;
|
||||
ogs_assert(buf);
|
||||
|
||||
*gnb_id = (buf[0] << 16) + (buf[1] << 8) + buf[2];
|
||||
/* gNB ID : 22bit ~ 32bit */
|
||||
ogs_asn_BIT_STRING_to_uint32(&gNB_ID->choice.gNB_ID, gnb_id);
|
||||
}
|
||||
|
||||
void ogs_ngap_uint8_to_AMFRegionID(
|
||||
|
@ -124,30 +112,31 @@ void ogs_ngap_AMFPointer_to_uint8(
|
|||
*pointer = (buf[0] >> 2);
|
||||
}
|
||||
|
||||
void ogs_ngap_nr_cgi_to_ASN(ogs_nr_cgi_t *cgi, NGAP_NR_CGI_t *nR_CGI)
|
||||
void ogs_ngap_nr_cgi_to_ASN(ogs_nr_cgi_t *nr_cgi, NGAP_NR_CGI_t *nR_CGI)
|
||||
{
|
||||
char buf[5];
|
||||
|
||||
ogs_assert(cgi);
|
||||
ogs_assert(nr_cgi);
|
||||
ogs_assert(nR_CGI);
|
||||
|
||||
ogs_asn_buffer_to_OCTET_STRING(
|
||||
&cgi->plmn_id, OGS_PLMN_ID_LEN, &nR_CGI->pLMNIdentity);
|
||||
&nr_cgi->plmn_id, OGS_PLMN_ID_LEN, &nR_CGI->pLMNIdentity);
|
||||
|
||||
/* CellIdentity : 36bit */
|
||||
ogs_uint64_to_buffer((cgi->cell_id << 4), 5, buf);
|
||||
ogs_uint64_to_buffer((nr_cgi->cell_id << 4), 5, buf);
|
||||
ogs_asn_buffer_to_BIT_STRING(buf, 5, 4, &nR_CGI->nRCellIdentity);
|
||||
}
|
||||
|
||||
void ogs_ngap_ASN_to_nr_cgi(NGAP_NR_CGI_t *nR_CGI, ogs_nr_cgi_t *cgi)
|
||||
void ogs_ngap_ASN_to_nr_cgi(NGAP_NR_CGI_t *nR_CGI, ogs_nr_cgi_t *nr_cgi)
|
||||
{
|
||||
ogs_assert(cgi);
|
||||
ogs_assert(nr_cgi);
|
||||
ogs_assert(nR_CGI);
|
||||
|
||||
memcpy(&cgi->plmn_id, nR_CGI->pLMNIdentity.buf, OGS_PLMN_ID_LEN);
|
||||
memcpy(&nr_cgi->plmn_id, nR_CGI->pLMNIdentity.buf, OGS_PLMN_ID_LEN);
|
||||
|
||||
/* CellIdentity : 36bit */
|
||||
cgi->cell_id = (ogs_buffer_to_uint64(nR_CGI->nRCellIdentity.buf, 5) >> 4);
|
||||
nr_cgi->cell_id =
|
||||
(ogs_buffer_to_uint64(nR_CGI->nRCellIdentity.buf, 5) >> 4);
|
||||
}
|
||||
|
||||
void ogs_ngap_5gs_tai_to_ASN(ogs_5gs_tai_t *tai, NGAP_TAI_t *tAI)
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ogs_ngap_uint32_to_GNB_ID(uint32_t gnb_id, NGAP_GNB_ID_t *gNB_ID);
|
||||
void ogs_ngap_uint32_to_GNB_ID(
|
||||
uint32_t gnb_id, uint8_t bitsize, NGAP_GNB_ID_t *gNB_ID);
|
||||
void ogs_ngap_GNB_ID_to_uint32(NGAP_GNB_ID_t *gNB_ID, uint32_t *gnb_id);
|
||||
|
||||
void ogs_ngap_uint8_to_AMFRegionID(
|
||||
|
|
|
@ -173,13 +173,13 @@ struct ran_ue_s {
|
|||
ran_ue_t *source_ue;
|
||||
ran_ue_t *target_ue;
|
||||
|
||||
/* Use amf_ue->tai, amf_ue->e_cgi.
|
||||
* Do not access ran_ue->saved.tai ran_ue->saved.e_cgi.
|
||||
/* Use amf_ue->tai, amf_ue->nr_cgi.
|
||||
* Do not access ran_ue->saved.tai ran_ue->saved.nr_cgi.
|
||||
*
|
||||
* Save TAI and ECGI. And then, this will copy 'amf_ue_t' context later */
|
||||
struct {
|
||||
ogs_5gs_tai_t tai;
|
||||
ogs_nr_cgi_t cgi;
|
||||
ogs_nr_cgi_t nr_cgi;
|
||||
} saved;
|
||||
|
||||
/* Store by UE Context Release Command
|
||||
|
@ -264,7 +264,7 @@ struct amf_ue_s {
|
|||
/* UE Info */
|
||||
amf_guami_t *guami;
|
||||
ogs_5gs_tai_t tai;
|
||||
ogs_nr_cgi_t cgi;
|
||||
ogs_nr_cgi_t nr_cgi;
|
||||
ogs_plmn_id_t last_visited_plmn_id;
|
||||
ogs_nas_ue_usage_setting_t ue_usage_setting;
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ ogs_pkbuf_t *gmm_build_registration_accept(amf_ue_t *amf_ue)
|
|||
ogs_debug("[%s] TAI[PLMN_ID:%06x,TAC:%d]", amf_ue->supi,
|
||||
ogs_plmn_id_hexdump(&amf_ue->tai.plmn_id), amf_ue->tai.tac.v);
|
||||
ogs_debug("[%s] NR_CGI[PLMN_ID:%06x,CELL_ID:0x%llx]", amf_ue->supi,
|
||||
ogs_plmn_id_hexdump(&amf_ue->cgi.plmn_id),
|
||||
(long long)amf_ue->cgi.cell_id);
|
||||
ogs_plmn_id_hexdump(&amf_ue->nr_cgi.plmn_id),
|
||||
(long long)amf_ue->nr_cgi.cell_id);
|
||||
|
||||
served_tai_index = amf_find_served_tai(&amf_ue->tai);
|
||||
ogs_debug("[%s] SERVED_TAI_INDEX[%d]", amf_ue->supi, served_tai_index);
|
||||
|
|
|
@ -128,18 +128,18 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue,
|
|||
ogs_debug(" OLD TAI[PLMN_ID:%06x,TAC:%d]",
|
||||
ogs_plmn_id_hexdump(&amf_ue->tai.plmn_id), amf_ue->tai.tac.v);
|
||||
ogs_debug(" OLD NR_CGI[PLMN_ID:%06x,CELL_ID:0x%llx]",
|
||||
ogs_plmn_id_hexdump(&amf_ue->cgi.plmn_id),
|
||||
(long long)amf_ue->cgi.cell_id);
|
||||
ogs_plmn_id_hexdump(&amf_ue->nr_cgi.plmn_id),
|
||||
(long long)amf_ue->nr_cgi.cell_id);
|
||||
ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]",
|
||||
ogs_plmn_id_hexdump(&ran_ue->saved.tai.plmn_id),
|
||||
ran_ue->saved.tai.tac.v);
|
||||
ogs_debug(" NR_CGI[PLMN_ID:%06x,CELL_ID:0x%llx]",
|
||||
ogs_plmn_id_hexdump(&ran_ue->saved.cgi.plmn_id),
|
||||
(long long)ran_ue->saved.cgi.cell_id);
|
||||
ogs_plmn_id_hexdump(&ran_ue->saved.nr_cgi.plmn_id),
|
||||
(long long)ran_ue->saved.nr_cgi.cell_id);
|
||||
|
||||
/* Copy TAI and ECGI from ran_ue */
|
||||
memcpy(&amf_ue->tai, &ran_ue->saved.tai, sizeof(ogs_5gs_tai_t));
|
||||
memcpy(&amf_ue->cgi, &ran_ue->saved.cgi, sizeof(ogs_nr_cgi_t));
|
||||
memcpy(&amf_ue->nr_cgi, &ran_ue->saved.nr_cgi, sizeof(ogs_nr_cgi_t));
|
||||
|
||||
/* Check TAI */
|
||||
served_tai_index = amf_find_served_tai(&amf_ue->tai);
|
||||
|
|
|
@ -91,9 +91,6 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
|
|||
amf_sess_t *sess = NULL;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
ogs_nas_5gs_message_t *nas_message = NULL;
|
||||
#if 0
|
||||
NGAP_ProcedureCode_t procedureCode;
|
||||
#endif
|
||||
ogs_nas_security_header_type_t h;
|
||||
|
||||
ogs_assert(e);
|
||||
|
|
|
@ -169,7 +169,7 @@ void ngap_handle_ng_setup_request(amf_gnb_t *gnb, ogs_ngap_message_t *message)
|
|||
}
|
||||
|
||||
ogs_ngap_GNB_ID_to_uint32(&globalGNB_ID->gNB_ID, &gnb_id);
|
||||
ogs_debug(" IP[%s] GNB_ID[%x]", OGS_ADDR(gnb->addr, buf), gnb_id);
|
||||
ogs_debug(" IP[%s] GNB_ID[0x%x]", OGS_ADDR(gnb->addr, buf), gnb_id);
|
||||
|
||||
if (PagingDRX)
|
||||
ogs_debug(" PagingDRX[%ld]", *PagingDRX);
|
||||
|
@ -450,7 +450,7 @@ void ngap_handle_initial_ue_message(amf_gnb_t *gnb, ogs_ngap_message_t *message)
|
|||
UserLocationInformation->choice.userLocationInformationNR;
|
||||
|
||||
ogs_ngap_ASN_to_nr_cgi(
|
||||
&userLocationInformationNR->nR_CGI, &ran_ue->saved.cgi);
|
||||
&userLocationInformationNR->nR_CGI, &ran_ue->saved.nr_cgi);
|
||||
ogs_ngap_ASN_to_5gs_tai(
|
||||
&userLocationInformationNR->tAI, &ran_ue->saved.tai);
|
||||
|
||||
|
@ -461,7 +461,7 @@ void ngap_handle_initial_ue_message(amf_gnb_t *gnb, ogs_ngap_message_t *message)
|
|||
ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld] "
|
||||
"TAC[%d] CellID[0x%llx]",
|
||||
ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id,
|
||||
ran_ue->saved.tai.tac.v, (long long)ran_ue->saved.cgi.cell_id);
|
||||
ran_ue->saved.tai.tac.v, (long long)ran_ue->saved.nr_cgi.cell_id);
|
||||
|
||||
ngap_send_to_nas(ran_ue,
|
||||
NGAP_ProcedureCode_id_InitialUEMessage, NAS_PDU);
|
||||
|
@ -1058,7 +1058,7 @@ void ngap_handle_ue_context_release_request(
|
|||
|
||||
ran_ue = ran_ue_find_by_amf_ue_ngap_id(amf_ue_ngap_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("No RAN UE Context : AMF_UE_NGAP_ID[%lld]",
|
||||
ogs_warn("No RAN UE Context : AMF_UE_NGAP_ID[%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
ngap_send_error_indication(gnb, NULL, &amf_ue_ngap_id,
|
||||
NGAP_Cause_PR_radioNetwork,
|
||||
|
@ -1678,7 +1678,8 @@ void ngap_handle_gnb_configuration_transfer(
|
|||
|
||||
target_gnb = amf_gnb_find_by_gnb_id(target_gnb_id);
|
||||
if (target_gnb == NULL) {
|
||||
ogs_warn("RAN configuration transfer : cannot find target RAN-id[%d]",
|
||||
ogs_warn("RAN configuration transfer : "
|
||||
"cannot find target RAN-id[%d]",
|
||||
target_gnb_id);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,8 @@ void amf_nnrf_handle_nf_status_subscribe(
|
|||
struct timeval tv;
|
||||
struct tm local, next;
|
||||
ogs_time_t diff, duration;
|
||||
|
||||
memset(&next, 0, sizeof(next));
|
||||
if (ogs_strptime(SubscriptionData->validity_time,
|
||||
OGS_TIME_ISO8601_FORMAT, &next)) {
|
||||
ogs_gettimeofday(&tv);
|
||||
|
|
|
@ -69,6 +69,8 @@ void ausf_nnrf_handle_nf_status_subscribe(
|
|||
struct timeval tv;
|
||||
struct tm local, next;
|
||||
ogs_time_t diff, duration;
|
||||
|
||||
memset(&next, 0, sizeof(next));
|
||||
if (ogs_strptime(SubscriptionData->validity_time,
|
||||
OGS_TIME_ISO8601_FORMAT, &next)) {
|
||||
ogs_gettimeofday(&tv);
|
||||
|
|
|
@ -131,7 +131,7 @@ static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data)
|
|||
int rv;
|
||||
ssize_t size;
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
uint32_t len = OGS_GTPV1U_HEADER_LEN;
|
||||
int len;
|
||||
ogs_gtp_header_t *gtp_h = NULL;
|
||||
struct ip *ip_h = NULL;
|
||||
|
||||
|
@ -159,12 +159,17 @@ static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data)
|
|||
ogs_assert(pkbuf->len);
|
||||
|
||||
gtp_h = (ogs_gtp_header_t *)pkbuf->data;
|
||||
if (gtp_h->flags & OGS_GTPU_FLAGS_S) len += 4;
|
||||
teid = be32toh(gtp_h->teid);
|
||||
|
||||
ogs_debug("[PGW] RECV GPU-U from SGW : TEID[0x%x]", teid);
|
||||
|
||||
/* Remove GTP header and send packets to TUN interface */
|
||||
len = ogs_gtpu_header_len(pkbuf);
|
||||
if (len < 0) {
|
||||
ogs_error("[DROP] Cannot decode GTPU packet");
|
||||
ogs_log_hexdump(OGS_LOG_ERROR, pkbuf->data, pkbuf->len);
|
||||
goto cleanup;
|
||||
}
|
||||
ogs_assert(ogs_pkbuf_pull(pkbuf, len));
|
||||
|
||||
ip_h = (struct ip *)pkbuf->data;
|
||||
|
|
|
@ -69,6 +69,8 @@ void smf_nnrf_handle_nf_status_subscribe(
|
|||
struct timeval tv;
|
||||
struct tm local, next;
|
||||
ogs_time_t diff, duration;
|
||||
|
||||
memset(&next, 0, sizeof(next));
|
||||
if (ogs_strptime(SubscriptionData->validity_time,
|
||||
OGS_TIME_ISO8601_FORMAT, &next)) {
|
||||
ogs_gettimeofday(&tv);
|
||||
|
|
|
@ -69,6 +69,8 @@ void udm_nnrf_handle_nf_status_subscribe(
|
|||
struct timeval tv;
|
||||
struct tm local, next;
|
||||
ogs_time_t diff, duration;
|
||||
|
||||
memset(&next, 0, sizeof(next));
|
||||
if (ogs_strptime(SubscriptionData->validity_time,
|
||||
OGS_TIME_ISO8601_FORMAT, &next)) {
|
||||
ogs_gettimeofday(&tv);
|
||||
|
|
|
@ -134,7 +134,24 @@ bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg)
|
|||
|
||||
sqn = ogs_buffer_to_uint64(sqn_ms, OGS_SQN_LEN);
|
||||
|
||||
/* 33.102 C.3.4 Guide : IND + 1 */
|
||||
/* 33.102 C.3.4 Guide : IND + 1
|
||||
*
|
||||
* General rule: index values IND used in the array scheme,
|
||||
* according to Annex C.1.2, shall be allocated cyclically
|
||||
* within its range 0, ... , a-1. This means that the index value IND
|
||||
* used with the previously generated authentication vector is stored
|
||||
* in SQN HE , and the next authentication vector shall use index
|
||||
* value IND +1 mod a.
|
||||
*
|
||||
* In future releases there may be additional information
|
||||
* about the requesting node identity. If this information is
|
||||
* available it is recommended to use it in the following way:
|
||||
*
|
||||
* - If the new request comes from the same serving node
|
||||
* as the previous request, then the index value used for
|
||||
* the new request shall be the same as was used for
|
||||
* the previous request.
|
||||
*/
|
||||
sqn = (sqn + 32 + 1) & OGS_MAX_SQN;
|
||||
|
||||
ogs_uint64_to_buffer(sqn, OGS_SQN_LEN, udm_ue->sqn);
|
||||
|
|
|
@ -30,9 +30,17 @@ bool udm_nudr_dr_handle_subscription_authentication(
|
|||
ogs_sbi_response_t *response = NULL;
|
||||
|
||||
#if 0
|
||||
const char *tmp = "de8ca9df474091fe4e9263c5daa907e9";
|
||||
const char *tmp = "cc3766b98a8031a7286a68c7f577ed2e"; /* For test */
|
||||
const char *tmp[1] = "de8ca9df474091fe4e9263c5daa907e9";
|
||||
const char *tmp[1] = "cc3766b98a8031a7286a68c7f577ed2e"; /* For test */
|
||||
|
||||
/* ISSUE-482 */
|
||||
const char *tmp[2] = {
|
||||
"3a1fa0f51fe50f324f8522b220fc62a2",
|
||||
"cc5539bf72824c879e47e73efc885021"
|
||||
};
|
||||
static int step = 0;
|
||||
#endif
|
||||
|
||||
uint8_t autn[OGS_AUTN_LEN];
|
||||
uint8_t ik[OGS_KEY_LEN];
|
||||
uint8_t ck[OGS_KEY_LEN];
|
||||
|
@ -151,8 +159,9 @@ bool udm_nudr_dr_handle_subscription_authentication(
|
|||
|
||||
ogs_random(udm_ue->rand, OGS_RAND_LEN);
|
||||
#if 0
|
||||
/* FIX IT! TODO! NEW! */
|
||||
OGS_HEX(tmp, strlen(tmp), udm_ue->rand);
|
||||
OGS_HEX(tmp[step], strlen(tmp[step]), udm_ue->rand);
|
||||
if (step == 0) step = 1; /* For supporting authentication failure */
|
||||
else step = 0;
|
||||
#endif
|
||||
|
||||
milenage_generate(udm_ue->opc, udm_ue->amf, udm_ue->k, udm_ue->sqn,
|
||||
|
|
|
@ -69,6 +69,8 @@ void udr_nnrf_handle_nf_status_subscribe(
|
|||
struct timeval tv;
|
||||
struct tm local, next;
|
||||
ogs_time_t diff, duration;
|
||||
|
||||
memset(&next, 0, sizeof(next));
|
||||
if (ogs_strptime(SubscriptionData->validity_time,
|
||||
OGS_TIME_ISO8601_FORMAT, &next)) {
|
||||
ogs_gettimeofday(&tv);
|
||||
|
|
|
@ -83,12 +83,14 @@ static void _gtpv1_tun_recv_cb(short when, ogs_socket_t fd, void *data)
|
|||
|
||||
static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data)
|
||||
{
|
||||
int rv;
|
||||
int rv, len;
|
||||
ssize_t size;
|
||||
char buf[OGS_ADDRSTRLEN];
|
||||
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
uint32_t len = OGS_GTPV1U_HEADER_LEN;
|
||||
uint32_t extension_header_type = 0;
|
||||
ogs_5gs_gtp_header_t *gtp_h = NULL;
|
||||
ogs_sockaddr_t from;
|
||||
|
||||
ogs_gtp_header_t *gtp_h = NULL;
|
||||
struct ip *ip_h = NULL;
|
||||
|
||||
uint32_t teid;
|
||||
|
@ -102,7 +104,7 @@ static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data)
|
|||
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
|
||||
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN);
|
||||
|
||||
size = ogs_recv(fd, pkbuf->data, pkbuf->len, 0);
|
||||
size = ogs_recvfrom(fd, pkbuf->data, pkbuf->len, 0, &from);
|
||||
if (size <= 0) {
|
||||
ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno,
|
||||
"ogs_recv() failed");
|
||||
|
@ -114,24 +116,79 @@ static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data)
|
|||
ogs_assert(pkbuf);
|
||||
ogs_assert(pkbuf->len);
|
||||
|
||||
gtp_h = (ogs_5gs_gtp_header_t *)pkbuf->data;
|
||||
teid = be32toh(gtp_h->teid);
|
||||
|
||||
ogs_debug("[UPF] RECV GPU-U from gNB : TEID[0x%x]", teid);
|
||||
|
||||
/* Remove GTP header and send packets to TUN interface */
|
||||
if (gtp_h->seqence_number) len += 4;
|
||||
if (gtp_h->next_extension) {
|
||||
extension_header_type = be32toh(gtp_h->extension_header.type);
|
||||
switch (extension_header_type) {
|
||||
case OGS_GTP_EXTENSION_HEADER_TYPE_PDU_SESSION_CONTAINER:
|
||||
len += 8; /* TODO : QoS QFI */
|
||||
break;
|
||||
default:
|
||||
gtp_h = (ogs_gtp_header_t *)pkbuf->data;
|
||||
if (gtp_h->version != OGS_GTP_VERSION_1) {
|
||||
ogs_error("[DROP] Invalid GTPU version [%d]", gtp_h->version);
|
||||
ogs_log_hexdump(OGS_LOG_ERROR, pkbuf->data, pkbuf->len);
|
||||
ogs_error("[DROP] Cannot decode extension header");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (gtp_h->type == OGS_GTPU_MSGTYPE_ECHO_REQ) {
|
||||
ogs_pkbuf_t *echo_rsp;
|
||||
|
||||
ogs_debug("[RECV] Echo Request from [%s]", OGS_ADDR(&from, buf));
|
||||
echo_rsp = ogs_gtp_handle_echo_req(pkbuf);
|
||||
if (echo_rsp) {
|
||||
ssize_t sent;
|
||||
|
||||
/* Echo reply */
|
||||
ogs_debug("[SEND] Echo Response to [%s]", OGS_ADDR(&from, buf));
|
||||
|
||||
sent = ogs_sendto(fd, echo_rsp->data, echo_rsp->len, 0, &from);
|
||||
if (sent < 0 || sent != echo_rsp->len) {
|
||||
ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno,
|
||||
"ogs_sendto() failed");
|
||||
}
|
||||
ogs_pkbuf_free(echo_rsp);
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
teid = be32toh(gtp_h->teid);
|
||||
|
||||
if (gtp_h->type == OGS_GTPU_MSGTYPE_END_MARKER) {
|
||||
ogs_debug("[RECV] End Marker from [%s] : TEID[0x%x]",
|
||||
OGS_ADDR(&from, buf), teid);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (gtp_h->type != OGS_GTPU_MSGTYPE_GPDU) {
|
||||
ogs_error("[DROP] Invalid GTPU Type [%d]", gtp_h->type);
|
||||
ogs_log_hexdump(OGS_LOG_ERROR, pkbuf->data, pkbuf->len);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ogs_debug("[RECV] GPU-U from [%s] : TEID[0x%x]",
|
||||
OGS_ADDR(&from, buf), teid);
|
||||
|
||||
if (gtp_h->flags & OGS_GTPU_FLAGS_E) {
|
||||
/*
|
||||
* TS29.281
|
||||
* 5.2.1 General format of the GTP-U Extension Header
|
||||
* Figure 5.2.1-3: Definition of Extension Header Type
|
||||
*
|
||||
* Note 4 : For a GTP-PDU with several Extension Headers, the PDU
|
||||
* Session Container should be the first Extension Header
|
||||
*/
|
||||
ogs_gtp_extension_header_t *extension_header =
|
||||
(ogs_gtp_extension_header_t *)(pkbuf->data + OGS_GTPV1U_HEADER_LEN);
|
||||
ogs_assert(extension_header);
|
||||
if (extension_header->type ==
|
||||
OGS_GTP_EXTENSION_HEADER_TYPE_PDU_SESSION_CONTAINER) {
|
||||
if (extension_header->pdu_type ==
|
||||
OGS_GTP_EXTENSION_HEADER_PDU_TYPE_UL_PDU_SESSION_INFORMATION) {
|
||||
ogs_debug(" QFI [0x%x]",
|
||||
extension_header->qos_flow_identifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove GTP header and send packets to TUN interface */
|
||||
len = ogs_gtpu_header_len(pkbuf);
|
||||
if (len < 0) {
|
||||
ogs_error("[DROP] Cannot decode GTPU packet");
|
||||
ogs_log_hexdump(OGS_LOG_ERROR, pkbuf->data, pkbuf->len);
|
||||
goto cleanup;
|
||||
}
|
||||
ogs_assert(ogs_pkbuf_pull(pkbuf, len));
|
||||
|
||||
|
@ -153,9 +210,9 @@ static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data)
|
|||
subnet = sess->ipv6->subnet;
|
||||
|
||||
if (!subnet) {
|
||||
ogs_log_hexdump(OGS_LOG_ERROR, pkbuf->data, pkbuf->len);
|
||||
ogs_error("[DROP] Cannot find subnet V:%d, IPv4:%p, IPv6:%p",
|
||||
ip_h->ip_v, sess->ipv4, sess->ipv6);
|
||||
ogs_log_hexdump(OGS_LOG_ERROR, pkbuf->data, pkbuf->len);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||
*
|
||||
* This file is part of Open5GS.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "test-5gc.h"
|
||||
|
||||
abts_suite *test_issues_482(abts_suite *suite);
|
||||
|
||||
const struct testlist {
|
||||
abts_suite *(*func)(abts_suite *suite);
|
||||
} alltests[] = {
|
||||
{test_issues_482},
|
||||
{NULL},
|
||||
};
|
||||
|
||||
static void terminate(void)
|
||||
{
|
||||
ogs_msleep(50);
|
||||
|
||||
test_child_terminate();
|
||||
app_terminate();
|
||||
|
||||
test_5gc_final();
|
||||
ogs_app_terminate();
|
||||
}
|
||||
|
||||
static void initialize(const char *const argv[])
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = ogs_app_initialize(NULL, argv);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
test_5gc_init();
|
||||
|
||||
rv = app_initialize(argv);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
}
|
||||
|
||||
int main(int argc, const char *const argv[])
|
||||
{
|
||||
int i;
|
||||
abts_suite *suite = NULL;
|
||||
|
||||
atexit(terminate);
|
||||
test_5gc_run(argc, argv, "00101.yaml", initialize);
|
||||
|
||||
for (i = 0; alltests[i].func; i++)
|
||||
suite = alltests[i].func(suite);
|
||||
|
||||
return abts_report(suite);
|
||||
}
|
|
@ -0,0 +1,389 @@
|
|||
/*
|
||||
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||
*
|
||||
* This file is part of Open5GS.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "test-5gc.h"
|
||||
|
||||
static void test1_func(abts_case *tc, void *data)
|
||||
{
|
||||
int rv;
|
||||
ogs_socknode_t *ngap;
|
||||
ogs_socknode_t *gtpu;
|
||||
ogs_pkbuf_t *gmmbuf;
|
||||
ogs_pkbuf_t *gsmbuf;
|
||||
ogs_pkbuf_t *nasbuf;
|
||||
ogs_pkbuf_t *sendbuf;
|
||||
ogs_pkbuf_t *recvbuf;
|
||||
ogs_ngap_message_t message;
|
||||
int i;
|
||||
int msgindex = 0;
|
||||
|
||||
ogs_nas_5gs_mobile_identity_suci_t mobile_identity_suci;
|
||||
test_ue_t test_ue;
|
||||
test_sess_t test_sess;
|
||||
|
||||
uint8_t tmp[OGS_MAX_SDU_LEN];
|
||||
|
||||
const char *_k_string = "00112233445566778899aabbccddeeff";
|
||||
uint8_t k[OGS_KEY_LEN];
|
||||
const char *_opc_string = "279eb54971771559879284fddde3ee0c";
|
||||
uint8_t opc[OGS_KEY_LEN];
|
||||
|
||||
mongoc_collection_t *collection = NULL;
|
||||
bson_t *doc = NULL;
|
||||
int64_t count = 0;
|
||||
bson_error_t error;
|
||||
const char *json =
|
||||
"{"
|
||||
"\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, "
|
||||
"\"imsi\" : \"001010000000001\","
|
||||
"\"ambr\" : { "
|
||||
"\"uplink\" : { \"$numberLong\" : \"1024000\" }, "
|
||||
"\"downlink\" : { \"$numberLong\" : \"1024000\" } "
|
||||
"},"
|
||||
"\"pdn\" : ["
|
||||
"{"
|
||||
"\"apn\" : \"internet\", "
|
||||
"\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, "
|
||||
"\"ambr\" : {"
|
||||
"\"uplink\" : { \"$numberLong\" : \"1024000\" }, "
|
||||
"\"downlink\" : { \"$numberLong\" : \"1024000\" } "
|
||||
"},"
|
||||
"\"qos\" : { "
|
||||
"\"qci\" : 9, "
|
||||
"\"arp\" : { "
|
||||
"\"priority_level\" : 8,"
|
||||
"\"pre_emption_vulnerability\" : 1, "
|
||||
"\"pre_emption_capability\" : 1"
|
||||
"} "
|
||||
"}, "
|
||||
"\"type\" : 2"
|
||||
"}"
|
||||
"],"
|
||||
"\"security\" : { "
|
||||
"\"k\" : \"00112233445566778899aabbccddeeff\", "
|
||||
"\"opc\" : \"279eb54971771559879284fddde3ee0c\", "
|
||||
"\"amf\" : \"8000\", "
|
||||
"\"sqn\" : { \"$numberLong\" : \"32\" } "
|
||||
"}, "
|
||||
"\"subscribed_rau_tau_timer\" : 12,"
|
||||
"\"network_access_mode\" : 2, "
|
||||
"\"subscriber_status\" : 0, "
|
||||
"\"access_restriction_data\" : 32, "
|
||||
"\"__v\" : 0 "
|
||||
"}";
|
||||
|
||||
/* Setup Test UE & Session Context */
|
||||
memset(&test_ue, 0, sizeof(test_ue));
|
||||
memset(&test_sess, 0, sizeof(test_sess));
|
||||
test_sess.test_ue = &test_ue;
|
||||
test_ue.sess = &test_sess;
|
||||
|
||||
test_ue.nas.registration.type = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE;
|
||||
test_ue.nas.registration.follow_on_request = 1;
|
||||
test_ue.nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL;
|
||||
|
||||
memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci));
|
||||
|
||||
mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI;
|
||||
mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI;
|
||||
ogs_nas_from_plmn_id(&mobile_identity_suci.nas_plmn_id,
|
||||
&test_self()->tai.plmn_id);
|
||||
mobile_identity_suci.routing_indicator1 = 0;
|
||||
mobile_identity_suci.routing_indicator2 = 0xf;
|
||||
mobile_identity_suci.routing_indicator3 = 0xf;
|
||||
mobile_identity_suci.routing_indicator4 = 0xf;
|
||||
mobile_identity_suci.protection_scheme_id = OGS_NAS_5GS_NULL_SCHEME;
|
||||
mobile_identity_suci.home_network_pki_value = 0;
|
||||
mobile_identity_suci.scheme_output[0] = 0;
|
||||
mobile_identity_suci.scheme_output[1] = 0;
|
||||
mobile_identity_suci.scheme_output[2] = 0;
|
||||
mobile_identity_suci.scheme_output[3] = 0;
|
||||
mobile_identity_suci.scheme_output[4] = 0x10;
|
||||
|
||||
test_ue_set_mobile_identity_suci(&test_ue, &mobile_identity_suci, 13);
|
||||
|
||||
test_ue.nas.access_type = OGS_ACCESS_TYPE_3GPP;
|
||||
test_ue.abba_len = 2;
|
||||
|
||||
OGS_HEX(_k_string, strlen(_k_string), test_ue.k);
|
||||
OGS_HEX(_opc_string, strlen(_opc_string), test_ue.opc);
|
||||
|
||||
test_sess.psi = 5;
|
||||
test_sess.pti = 1;
|
||||
test_sess.pdu_session_type = OGS_PDU_SESSION_TYPE_IPV4V6;
|
||||
test_sess.dnn = (char *)"internet";
|
||||
|
||||
memset(&test_sess.gnb_n3_ip, 0, sizeof(test_sess.gnb_n3_ip));
|
||||
test_sess.gnb_n3_ip.ipv4 = true;
|
||||
test_sess.gnb_n3_ip.addr = inet_addr("127.0.0.5");
|
||||
test_sess.gnb_n3_teid = 0;
|
||||
|
||||
/* gNB connects to AMF */
|
||||
ngap = testgnb_ngap_client("127.0.0.2");
|
||||
ABTS_PTR_NOTNULL(tc, ngap);
|
||||
|
||||
/* gNB connects to UPF */
|
||||
gtpu = testgnb_gtpu_server("127.0.0.5");
|
||||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
|
||||
/* Send NG-Setup Reqeust */
|
||||
sendbuf = testngap_build_ng_setup_request(0xce, 31);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive NG-Setup Response */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/********** Insert Subscriber in Database */
|
||||
collection = mongoc_client_get_collection(
|
||||
ogs_mongoc()->client, ogs_mongoc()->name, "subscribers");
|
||||
ABTS_PTR_NOTNULL(tc, collection);
|
||||
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
|
||||
ABTS_PTR_NOTNULL(tc, doc);
|
||||
|
||||
count = mongoc_collection_count (
|
||||
collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error);
|
||||
if (count) {
|
||||
ABTS_TRUE(tc, mongoc_collection_remove(collection,
|
||||
MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error))
|
||||
}
|
||||
bson_destroy(doc);
|
||||
|
||||
doc = bson_new_from_json((const uint8_t *)json, -1, &error);;
|
||||
ABTS_PTR_NOTNULL(tc, doc);
|
||||
ABTS_TRUE(tc, mongoc_collection_insert(collection,
|
||||
MONGOC_INSERT_NONE, doc, NULL, &error));
|
||||
bson_destroy(doc);
|
||||
|
||||
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
|
||||
ABTS_PTR_NOTNULL(tc, doc);
|
||||
do {
|
||||
count = mongoc_collection_count (
|
||||
collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error);
|
||||
} while (count == 0);
|
||||
bson_destroy(doc);
|
||||
|
||||
/* To start RAN-UE-NGAP-ID : 0 */
|
||||
test_ue.ran_ue_ngap_id = -1;
|
||||
test_self()->nr_cgi.cell_id = 0x000000ce7;
|
||||
|
||||
/* Send Registration request */
|
||||
test_ue.registration_request_type.guti = 1;
|
||||
gmmbuf = testgmm_build_registration_request(&test_ue, NULL);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
|
||||
test_ue.registration_request_type.requested_nssai = 1;
|
||||
test_ue.registration_request_type.last_visited_registered_tai = 1;
|
||||
test_ue.registration_request_type.ue_usage_setting = 1;
|
||||
nasbuf = testgmm_build_registration_request(&test_ue, NULL);
|
||||
ABTS_PTR_NOTNULL(tc, nasbuf);
|
||||
|
||||
sendbuf = testngap_build_initial_ue_message(&test_ue, gmmbuf, false);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Indentity request */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send Identity response */
|
||||
gmmbuf = testgmm_build_identity_response(&test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Authentication request */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send Authentication failure - SYNCH failure */
|
||||
gmmbuf = testgmm_build_authentication_failure(
|
||||
&test_ue, OGS_5GMM_CAUSE_SYNCH_FAILURE, 0x1f60);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Authentication request */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send Authentication response */
|
||||
gmmbuf = testgmm_build_authentication_response(&test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Security mode command */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send Security mode complete */
|
||||
gmmbuf = testgmm_build_security_mode_complete(&test_ue, nasbuf);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Initial context setup request */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send UE radio capability info indication */
|
||||
sendbuf = testngap_build_ue_radio_capability_info_indication(&test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Send Initial context setup response */
|
||||
sendbuf = testngap_build_initial_context_setup_response(&test_ue, NULL);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
ogs_msleep(50);
|
||||
|
||||
/* Send Registration complete */
|
||||
gmmbuf = testgmm_build_registration_complete(&test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Configuration update command */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
#if 0
|
||||
/* Send PDU session establishment request */
|
||||
gsmbuf = testgsm_build_pdu_session_establishment_request(&test_sess);
|
||||
ABTS_PTR_NOTNULL(tc, gsmbuf);
|
||||
gmmbuf = testgmm_build_ul_nas_transport(&test_sess,
|
||||
OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive PDU session establishment accept */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send GTP-U ICMP Packet */
|
||||
rv = test_gtpu_build_ping(&sendbuf, &test_sess, "10.45.0.1");
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
rv = testgnb_gtpu_send(gtpu, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
ogs_msleep(50);
|
||||
|
||||
/* Send PDU session resource setup response */
|
||||
sendbuf = testngap_build_pdu_session_resource_setup_response(&test_sess);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
ogs_msleep(50);
|
||||
|
||||
/* Receive GTP-U ICMP Packet */
|
||||
recvbuf = testgnb_gtpu_read(gtpu);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
/* Send GTP-U ICMP Packet */
|
||||
rv = test_gtpu_build_ping(&sendbuf, &test_sess, "10.45.0.1");
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
rv = testgnb_gtpu_send(gtpu, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive GTP-U ICMP Packet */
|
||||
recvbuf = testgnb_gtpu_read(gtpu);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
ogs_msleep(50);
|
||||
|
||||
/* Send De-registration request */
|
||||
gmmbuf = testgmm_build_de_registration_request(&test_ue, 1);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive UE context release command */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send UE context release complete */
|
||||
sendbuf = testngap_build_ue_context_release_complete(&test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
#endif
|
||||
|
||||
ogs_msleep(50);
|
||||
|
||||
/********** Remove Subscriber in Database */
|
||||
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
|
||||
ABTS_PTR_NOTNULL(tc, doc);
|
||||
ABTS_TRUE(tc, mongoc_collection_remove(collection,
|
||||
MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error))
|
||||
bson_destroy(doc);
|
||||
|
||||
mongoc_collection_destroy(collection);
|
||||
|
||||
/* gNB disonncect from UPF */
|
||||
testgnb_gtpu_close(gtpu);
|
||||
|
||||
/* gNB disonncect from AMF */
|
||||
testgnb_ngap_close(ngap);
|
||||
|
||||
/* Clear Test UE Context */
|
||||
test_ue_remove(&test_ue);
|
||||
}
|
||||
|
||||
abts_suite *test_issues_482(abts_suite *suite)
|
||||
{
|
||||
suite = ADD_SUITE(suite)
|
||||
|
||||
abts_run_test(suite, test1_func, NULL);
|
||||
|
||||
return suite;
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
# Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||
|
||||
# This file is part of Open5GS.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
test00101_sources = files('''
|
||||
abts-main.c
|
||||
issues-482-test.c
|
||||
'''.split())
|
||||
|
||||
test00101_exe = executable('00101',
|
||||
sources : test00101_sources,
|
||||
c_args : testcore_cc_flags,
|
||||
dependencies : libtest5gc_dep)
|
|
@ -63,9 +63,9 @@ static int test_context_validation(void)
|
|||
OGS_PLMN_ID_LEN);
|
||||
}
|
||||
|
||||
memcpy(&test_self()->cgi.plmn_id, &test_self()->tai.plmn_id,
|
||||
memcpy(&test_self()->nr_cgi.plmn_id, &test_self()->tai.plmn_id,
|
||||
OGS_PLMN_ID_LEN);
|
||||
test_self()->cgi.cell_id = 1;
|
||||
test_self()->nr_cgi.cell_id = 0x40001;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ typedef struct test_context_s {
|
|||
} plmn_support[OGS_MAX_NUM_OF_PLMN];
|
||||
|
||||
ogs_5gs_tai_t tai;
|
||||
ogs_nr_cgi_t cgi;
|
||||
ogs_nr_cgi_t nr_cgi;
|
||||
} test_context_t;
|
||||
|
||||
typedef struct test_sess_s test_sess_t;
|
||||
|
|
|
@ -252,6 +252,21 @@ ogs_pkbuf_t *testgmm_build_service_request(
|
|||
ogs_assert(test_ue->nas_guti.m_tmsi);
|
||||
memset(&mobile_identity_s_tmsi, 0, sizeof(mobile_identity_s_tmsi));
|
||||
|
||||
/*
|
||||
* TS24.501
|
||||
* 9.11.3.4 5GS mobile identity
|
||||
* Figure 9.11.3.4.5 5GS mobile identity IE for type of identity "5G-S-TMSI"
|
||||
*
|
||||
* Octet 1 : 5GS mobile identity IEI
|
||||
* Octet 2-3 : Length of 5GS mobile identity contents
|
||||
* Octet 4 : 1 1 1 1 0 1 0 0
|
||||
*
|
||||
* <Octet 4>
|
||||
* h.supi_format = 0xf (1 1 1 1)
|
||||
* h.odd_even = 0 (Spare 0)
|
||||
* h.type = 1 0 0 (Type of identity : 5G-S-TMSI)
|
||||
*/
|
||||
mobile_identity_s_tmsi.h.supi_format = 0xf;
|
||||
mobile_identity_s_tmsi.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_S_TMSI;
|
||||
mobile_identity_s_tmsi.m_tmsi = htobe32(test_ue->nas_guti.m_tmsi);
|
||||
mobile_identity_s_tmsi.set1 = test_ue->nas_guti.amf_id.set1;
|
||||
|
@ -424,7 +439,7 @@ ogs_pkbuf_t *testgmm_build_authentication_response(test_ue_t *test_ue)
|
|||
}
|
||||
|
||||
ogs_pkbuf_t *testgmm_build_authentication_failure(
|
||||
test_ue_t *test_ue, ogs_nas_5gmm_cause_t gmm_cause)
|
||||
test_ue_t *test_ue, ogs_nas_5gmm_cause_t gmm_cause, uint64_t sqn_ms)
|
||||
|
||||
{
|
||||
ogs_nas_5gs_message_t message;
|
||||
|
@ -436,7 +451,11 @@ ogs_pkbuf_t *testgmm_build_authentication_failure(
|
|||
&authentication_failure->authentication_failure_parameter;
|
||||
|
||||
uint8_t ak[OGS_AK_LEN];
|
||||
#if 0
|
||||
uint8_t sqn_ms[OGS_SQN_LEN] = "\x00\x00\x11\x22\x33\x44";
|
||||
uint8_t sqn_ms[OGS_SQN_LEN] = "\x00\x00\x00\x00\x1f\x60"; /* Issues 482 */
|
||||
#endif
|
||||
uint8_t sqn[OGS_SQN_LEN];
|
||||
uint8_t mac_s[OGS_MAC_S_LEN];
|
||||
uint8_t amf[2] = { 0, 0 };
|
||||
uint8_t auts[OGS_AUTS_LEN];
|
||||
|
@ -458,10 +477,11 @@ ogs_pkbuf_t *testgmm_build_authentication_failure(
|
|||
milenage_f2345(test_ue->opc, test_ue->k, test_ue->rand,
|
||||
NULL, NULL, NULL, NULL, ak);
|
||||
|
||||
ogs_uint64_to_buffer(sqn_ms, 6, sqn);
|
||||
milenage_f1(test_ue->opc, test_ue->k, test_ue->rand,
|
||||
sqn_ms, amf, NULL, auts + OGS_SQN_LEN);
|
||||
sqn, amf, NULL, auts + OGS_SQN_LEN);
|
||||
for (i = 0; i < OGS_SQN_LEN; i++)
|
||||
auts[i] = sqn_ms[i] ^ ak[i];
|
||||
auts[i] = sqn[i] ^ ak[i];
|
||||
|
||||
authentication_failure_parameter->length = OGS_AUTS_LEN;
|
||||
memcpy(authentication_failure_parameter->auts, auts,
|
||||
|
|
|
@ -37,7 +37,7 @@ ogs_pkbuf_t *testgmm_build_de_registration_request(
|
|||
ogs_pkbuf_t *testgmm_build_identity_response(test_ue_t *test_ue);
|
||||
ogs_pkbuf_t *testgmm_build_authentication_response(test_ue_t *test_ue);
|
||||
ogs_pkbuf_t *testgmm_build_authentication_failure(
|
||||
test_ue_t *test_ue, ogs_nas_5gmm_cause_t gmm_cause);
|
||||
test_ue_t *test_ue, ogs_nas_5gmm_cause_t gmm_cause, uint64_t sqn_ms);
|
||||
ogs_pkbuf_t *testgmm_build_security_mode_complete(
|
||||
test_ue_t *test_ue, ogs_pkbuf_t *nasbuf);
|
||||
ogs_pkbuf_t *testgmm_build_configuration_update_complete(test_ue_t *test_ue);
|
||||
|
|
|
@ -114,7 +114,8 @@ int test_gtpu_build_ping(ogs_pkbuf_t **sendbuf,
|
|||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
ogs_5gs_gtp_header_t *gtp_h = NULL;
|
||||
ogs_gtp_header_t *gtp_h = NULL;
|
||||
ogs_gtp_extension_header_t *ext_h = NULL;
|
||||
ogs_ipsubnet_t dst_ipsub;
|
||||
|
||||
ogs_assert(sess);
|
||||
|
@ -127,28 +128,30 @@ int test_gtpu_build_ping(ogs_pkbuf_t **sendbuf,
|
|||
ogs_pkbuf_put(pkbuf, 200);
|
||||
memset(pkbuf->data, 0, pkbuf->len);
|
||||
|
||||
gtp_h = (ogs_5gs_gtp_header_t *)pkbuf->data;
|
||||
gtp_h = (ogs_gtp_header_t *)pkbuf->data;
|
||||
gtp_h->flags = 0x34;
|
||||
gtp_h->type = OGS_GTPU_MSGTYPE_GPDU;
|
||||
gtp_h->teid = htobe32(sess->upf_n3_teid);
|
||||
gtp_h->extension_header.type =
|
||||
htobe32(OGS_GTP_EXTENSION_HEADER_TYPE_PDU_SESSION_CONTAINER);
|
||||
gtp_h->extension_header.len = 1;
|
||||
gtp_h->extension_header.pdu_type =
|
||||
|
||||
ext_h = (ogs_gtp_extension_header_t *)(pkbuf->data + OGS_GTPV1U_HEADER_LEN);
|
||||
ext_h->type = OGS_GTP_EXTENSION_HEADER_TYPE_PDU_SESSION_CONTAINER;
|
||||
ext_h->len = 1;
|
||||
ext_h->pdu_type =
|
||||
OGS_GTP_EXTENSION_HEADER_PDU_TYPE_UL_PDU_SESSION_INFORMATION;
|
||||
gtp_h->extension_header.qos_flow_identifier = 1;
|
||||
gtp_h->extension_header.next_type =
|
||||
OGS_GTP_EXTENSION_HEADER_TYPE_NO_MORE_EXTENSION_HEADERS;
|
||||
ext_h->qos_flow_identifier = 1;
|
||||
ext_h->next_type = OGS_GTP_EXTENSION_HEADER_TYPE_NO_MORE_EXTENSION_HEADERS;
|
||||
|
||||
if (dst_ipsub.family == AF_INET) {
|
||||
struct ip *ip_h = NULL;
|
||||
struct icmp *icmp_h = NULL;
|
||||
|
||||
#define GTP_EXTENSION_HEADER_SIZE 8
|
||||
gtp_h->length = htobe16(
|
||||
sizeof *ip_h + ICMP_MINLEN + GTP_EXTENSION_HEADER_SIZE);
|
||||
sizeof *ip_h + ICMP_MINLEN +
|
||||
OGS_GTPV1U_EXTENSION_HEADER_LEN + ext_h->len * 4);
|
||||
|
||||
ip_h = (struct ip *)(pkbuf->data + OGS_5GS_GTP_HEADER_LEN);
|
||||
ip_h = (struct ip *)(pkbuf->data +
|
||||
OGS_GTPV1U_HEADER_LEN +
|
||||
OGS_GTPV1U_EXTENSION_HEADER_LEN + ext_h->len * 4);
|
||||
icmp_h = (struct icmp *)((uint8_t *)ip_h + sizeof *ip_h);
|
||||
|
||||
ip_h->ip_v = 4;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
static ogs_pkbuf_t *testngap_build_pdu_session_resource_response_trasfer(
|
||||
test_sess_t *sess);
|
||||
|
||||
ogs_pkbuf_t *testngap_build_ng_setup_request(uint32_t gnb_id)
|
||||
ogs_pkbuf_t *testngap_build_ng_setup_request(uint32_t gnb_id, uint8_t bitsize)
|
||||
{
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
int i, j;
|
||||
|
@ -63,7 +63,7 @@ ogs_pkbuf_t *testngap_build_ng_setup_request(uint32_t gnb_id)
|
|||
ogs_asn_buffer_to_OCTET_STRING(
|
||||
plmn_id, OGS_PLMN_ID_LEN, &globalGNB_ID->pLMNIdentity);
|
||||
|
||||
ogs_ngap_uint32_to_GNB_ID(gnb_id, &globalGNB_ID->gNB_ID);
|
||||
ogs_ngap_uint32_to_GNB_ID(gnb_id, bitsize, &globalGNB_ID->gNB_ID);
|
||||
|
||||
ie = CALLOC(1, sizeof(NGAP_NGSetupRequestIEs_t));
|
||||
ASN_SEQUENCE_ADD(&NGSetupRequest->protocolIEs, ie);
|
||||
|
@ -242,7 +242,7 @@ ogs_pkbuf_t *testngap_build_initial_ue_message(
|
|||
CALLOC(1, sizeof(NGAP_UserLocationInformationNR_t));
|
||||
|
||||
nR_CGI = &userLocationInformationNR->nR_CGI;
|
||||
ogs_ngap_nr_cgi_to_ASN(&test_self()->cgi, nR_CGI);
|
||||
ogs_ngap_nr_cgi_to_ASN(&test_self()->nr_cgi, nR_CGI);
|
||||
|
||||
tAI = &userLocationInformationNR->tAI;
|
||||
ogs_ngap_5gs_tai_to_ASN(&test_self()->tai, tAI);
|
||||
|
@ -378,7 +378,7 @@ ogs_pkbuf_t *testngap_build_uplink_nas_transport(
|
|||
CALLOC(1, sizeof(NGAP_UserLocationInformationNR_t));
|
||||
|
||||
nR_CGI = &userLocationInformationNR->nR_CGI;
|
||||
ogs_ngap_nr_cgi_to_ASN(&test_self()->cgi, nR_CGI);
|
||||
ogs_ngap_nr_cgi_to_ASN(&test_self()->nr_cgi, nR_CGI);
|
||||
|
||||
tAI = &userLocationInformationNR->tAI;
|
||||
ogs_ngap_5gs_tai_to_ASN(&test_self()->tai, tAI);
|
||||
|
@ -556,7 +556,21 @@ ogs_pkbuf_t *testngap_build_ue_radio_capability_info_indication(
|
|||
NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL;
|
||||
NGAP_UERadioCapability_t *UERadioCapability = NULL;
|
||||
|
||||
char capability[] = "abcd";
|
||||
uint8_t tmp[OGS_MAX_SDU_LEN];
|
||||
char *_capability_captured = "040ca1080f"
|
||||
"de1a00000074e5a0 31e000380a03c126 0c80038d80818804 804c0203018022a3"
|
||||
"6146b040d0d00012 0098087ad8202020 e1de38720c380020 64f1f570000f001c"
|
||||
"0003c002a36266b0 40d0d00012009808 7ad8202020e1de38 720c38002064f1f5"
|
||||
"70000f001c0003c0 02a3626eb040d0d0 00120098087ad820 2020e1de38720c38"
|
||||
"002064f1f570000f 001c0003c0003403 898000000e480713 4000001c900e1400"
|
||||
"0000390088407022 6c70e04089b1c381 0226c70e007b0380 c000a07010140c00"
|
||||
"a0341f0000800000 00032a6802080000 4b2ca82000032cb2 800a955d52a9a020"
|
||||
"7000b00000004008 0118b10000204060 71112131b1f21252 62728292a4a50123"
|
||||
"bb40002000208183 91244cd9f4295327 50a551021ffff21f fff21ffff21ffff2"
|
||||
"1ffff21ffff21fff f21ffff21ffff21f fff21ffff21ffff2 1ffff21ffff21fff"
|
||||
"f21ffff21fffffe0 dd88600280706900 00000054888af410 0001a47a08000023"
|
||||
"fe40000331401c36 980610fffffffff3 5500020045240000 80000412c3804260"
|
||||
"9a143c0c00000410 0004104394000000 0000";
|
||||
|
||||
ogs_assert(test_ue);
|
||||
|
||||
|
@ -599,7 +613,7 @@ ogs_pkbuf_t *testngap_build_ue_radio_capability_info_indication(
|
|||
ASN_SEQUENCE_ADD(&UERadioCapabilityInfoIndication->protocolIEs, ie);
|
||||
|
||||
ie->id = NGAP_ProtocolIE_ID_id_UERadioCapability;
|
||||
ie->criticality = NGAP_Criticality_reject;
|
||||
ie->criticality = NGAP_Criticality_ignore;
|
||||
ie->value.present =
|
||||
NGAP_UERadioCapabilityInfoIndicationIEs__value_PR_UERadioCapability;
|
||||
|
||||
|
@ -608,9 +622,11 @@ ogs_pkbuf_t *testngap_build_ue_radio_capability_info_indication(
|
|||
asn_uint642INTEGER(AMF_UE_NGAP_ID, test_ue->amf_ue_ngap_id);
|
||||
*RAN_UE_NGAP_ID = test_ue->ran_ue_ngap_id;
|
||||
|
||||
UERadioCapability->size = strlen(capability);
|
||||
OGS_HEX(_capability_captured, strlen(_capability_captured), tmp),
|
||||
|
||||
UERadioCapability->size = 407;
|
||||
UERadioCapability->buf = CALLOC(UERadioCapability->size, sizeof(uint8_t));
|
||||
memcpy(UERadioCapability->buf, capability, UERadioCapability->size);
|
||||
memcpy(UERadioCapability->buf, tmp, UERadioCapability->size);
|
||||
|
||||
return nga_ngap_encode(&pdu);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
ogs_pkbuf_t *testngap_build_ng_setup_request(uint32_t gnb_id);
|
||||
ogs_pkbuf_t *testngap_build_ng_setup_request(uint32_t gnb_id, uint8_t bitsize);
|
||||
ogs_pkbuf_t *testngap_build_initial_ue_message(
|
||||
test_ue_t *test_ue, ogs_pkbuf_t *gmmbuf, bool s_tmsi);
|
||||
ogs_pkbuf_t *testngap_build_uplink_nas_transport(
|
||||
|
|
|
@ -56,6 +56,9 @@ void testngap_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf)
|
|||
case NGAP_ProcedureCode_id_UEContextRelease:
|
||||
/* Nothing */
|
||||
break;
|
||||
case NGAP_ProcedureCode_id_ErrorIndication:
|
||||
/* Nothing */
|
||||
break;
|
||||
default:
|
||||
ogs_error("Not implemented(choice:%d, proc:%d)",
|
||||
pdu->present, (int)initiatingMessage->procedureCode);
|
||||
|
|
|
@ -30,3 +30,4 @@ subdir('csfb')
|
|||
subdir('cups')
|
||||
subdir('minimal')
|
||||
subdir('registration')
|
||||
subdir('00101')
|
||||
|
|
|
@ -143,7 +143,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
|
||||
/* Send NG-Setup Reqeust */
|
||||
sendbuf = testngap_build_ng_setup_request(0x000102);
|
||||
sendbuf = testngap_build_ng_setup_request(0x102, 32);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
|
|
@ -96,7 +96,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
|
||||
test_ue.nas.registration.type = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE;
|
||||
test_ue.nas.registration.follow_on_request = 1;
|
||||
test_ue.nas.registration.value = 1; /* Initial Registration */
|
||||
test_ue.nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL;
|
||||
|
||||
memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci));
|
||||
|
||||
|
@ -143,7 +143,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
|
||||
/* Send NG-Setup Reqeust */
|
||||
sendbuf = testngap_build_ng_setup_request(0x000102);
|
||||
sendbuf = testngap_build_ng_setup_request(0x4000, 27);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
@ -197,7 +197,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
|
||||
/* Send Authentication failure - SYNCH failure */
|
||||
gmmbuf = testgmm_build_authentication_failure(
|
||||
&test_ue, OGS_5GMM_CAUSE_SYNCH_FAILURE);
|
||||
&test_ue, OGS_5GMM_CAUSE_SYNCH_FAILURE, 0x11223344);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
|
@ -211,7 +211,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
|
||||
/* Send Authentication failure - MAC failure */
|
||||
gmmbuf = testgmm_build_authentication_failure(
|
||||
&test_ue, OGS_5GMM_CAUSE_MAC_FAILURE);
|
||||
&test_ue, OGS_5GMM_CAUSE_MAC_FAILURE, 0);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
|
|
|
@ -94,9 +94,9 @@ static void test1_func(abts_case *tc, void *data)
|
|||
test_sess.test_ue = &test_ue;
|
||||
test_ue.sess = &test_sess;
|
||||
|
||||
test_ue.nas.registration.type = 1; /* TSC[0], KSI[1] */
|
||||
test_ue.nas.registration.type = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE;
|
||||
test_ue.nas.registration.follow_on_request = 1;
|
||||
test_ue.nas.registration.value = 1; /* Initial Registration */
|
||||
test_ue.nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL;
|
||||
|
||||
memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci));
|
||||
|
||||
|
@ -143,7 +143,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
|
||||
/* Send NG-Setup Reqeust */
|
||||
sendbuf = testngap_build_ng_setup_request(0x000102);
|
||||
sendbuf = testngap_build_ng_setup_request(0x4000, 26);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
|
|
@ -94,7 +94,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
test_sess.test_ue = &test_ue;
|
||||
test_ue.sess = &test_sess;
|
||||
|
||||
test_ue.nas.registration.type = 1; /* TSC[0], KSI[1] */
|
||||
test_ue.nas.registration.type = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE;
|
||||
test_ue.nas.registration.follow_on_request = 1;
|
||||
test_ue.nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL;
|
||||
|
||||
|
@ -143,7 +143,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
|
||||
/* Send NG-Setup Reqeust */
|
||||
sendbuf = testngap_build_ng_setup_request(0x000102);
|
||||
sendbuf = testngap_build_ng_setup_request(0x4000, 28);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
|
|
@ -143,7 +143,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
|
||||
/* Send NG-Setup Reqeust */
|
||||
sendbuf = testngap_build_ng_setup_request(0x000102);
|
||||
sendbuf = testngap_build_ng_setup_request(0x4000, 22);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
|
|
@ -94,7 +94,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
test_sess.test_ue = &test_ue;
|
||||
test_ue.sess = &test_sess;
|
||||
|
||||
test_ue.nas.registration.type = 1; /* TSC[0], KSI[1] */
|
||||
test_ue.nas.registration.type = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE;
|
||||
test_ue.nas.registration.follow_on_request = 1;
|
||||
test_ue.nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL;
|
||||
|
||||
|
@ -143,7 +143,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
|
||||
/* Send NG-Setup Reqeust */
|
||||
sendbuf = testngap_build_ng_setup_request(0x000102);
|
||||
sendbuf = testngap_build_ng_setup_request(0x4000, 29);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
|
|
@ -143,7 +143,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
|
||||
/* Send NG-Setup Reqeust */
|
||||
sendbuf = testngap_build_ng_setup_request(0x000102);
|
||||
sendbuf = testngap_build_ng_setup_request(0x4000, 23);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
@ -606,7 +606,7 @@ static void test2_func(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
|
||||
/* Send NG-Setup Reqeust */
|
||||
sendbuf = testngap_build_ng_setup_request(0x000102);
|
||||
sendbuf = testngap_build_ng_setup_request(0x4000, 24);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
@ -915,7 +915,7 @@ static void test3_func(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
|
||||
/* Send NG-Setup Reqeust */
|
||||
sendbuf = testngap_build_ng_setup_request(0x000102);
|
||||
sendbuf = testngap_build_ng_setup_request(0x4000, 25);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
@ -1181,6 +1181,515 @@ static void test3_func(abts_case *tc, void *data)
|
|||
test_ue_remove(&test_ue);
|
||||
}
|
||||
|
||||
static void test4_func(abts_case *tc, void *data)
|
||||
{
|
||||
int rv;
|
||||
ogs_socknode_t *ngap;
|
||||
ogs_socknode_t *gtpu;
|
||||
ogs_pkbuf_t *gmmbuf;
|
||||
ogs_pkbuf_t *gsmbuf;
|
||||
ogs_pkbuf_t *nasbuf;
|
||||
ogs_pkbuf_t *sendbuf;
|
||||
ogs_pkbuf_t *recvbuf;
|
||||
ogs_ngap_message_t message;
|
||||
int i;
|
||||
int msgindex = 0;
|
||||
|
||||
/* for backup */
|
||||
uint32_t ran_ue_ngap_id;
|
||||
uint64_t amf_ue_ngap_id;
|
||||
|
||||
ogs_nas_5gs_mobile_identity_suci_t mobile_identity_suci;
|
||||
test_ue_t test_ue;
|
||||
test_sess_t test_sess;
|
||||
|
||||
uint8_t tmp[OGS_MAX_SDU_LEN];
|
||||
|
||||
const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e";
|
||||
uint8_t k[OGS_KEY_LEN];
|
||||
const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7";
|
||||
uint8_t opc[OGS_KEY_LEN];
|
||||
|
||||
mongoc_collection_t *collection = NULL;
|
||||
bson_t *doc = NULL;
|
||||
int64_t count = 0;
|
||||
bson_error_t error;
|
||||
const char *json =
|
||||
"{"
|
||||
"\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, "
|
||||
"\"imsi\" : \"901700000021309\","
|
||||
"\"ambr\" : { "
|
||||
"\"uplink\" : { \"$numberLong\" : \"1024000\" }, "
|
||||
"\"downlink\" : { \"$numberLong\" : \"1024000\" } "
|
||||
"},"
|
||||
"\"pdn\" : ["
|
||||
"{"
|
||||
"\"apn\" : \"internet\", "
|
||||
"\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, "
|
||||
"\"ambr\" : {"
|
||||
"\"uplink\" : { \"$numberLong\" : \"1024000\" }, "
|
||||
"\"downlink\" : { \"$numberLong\" : \"1024000\" } "
|
||||
"},"
|
||||
"\"qos\" : { "
|
||||
"\"qci\" : 9, "
|
||||
"\"arp\" : { "
|
||||
"\"priority_level\" : 8,"
|
||||
"\"pre_emption_vulnerability\" : 1, "
|
||||
"\"pre_emption_capability\" : 1"
|
||||
"} "
|
||||
"}, "
|
||||
"\"type\" : 2"
|
||||
"}"
|
||||
"],"
|
||||
"\"security\" : { "
|
||||
"\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", "
|
||||
"\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", "
|
||||
"\"amf\" : \"8000\", "
|
||||
"\"sqn\" : { \"$numberLong\" : \"25235952177090\" } "
|
||||
"}, "
|
||||
"\"subscribed_rau_tau_timer\" : 12,"
|
||||
"\"network_access_mode\" : 2, "
|
||||
"\"subscriber_status\" : 0, "
|
||||
"\"access_restriction_data\" : 32, "
|
||||
"\"__v\" : 0 "
|
||||
"}";
|
||||
|
||||
/* Setup Test UE & Session Context */
|
||||
memset(&test_ue, 0, sizeof(test_ue));
|
||||
memset(&test_sess, 0, sizeof(test_sess));
|
||||
test_sess.test_ue = &test_ue;
|
||||
test_ue.sess = &test_sess;
|
||||
|
||||
test_ue.nas.registration.type = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE;
|
||||
test_ue.nas.registration.follow_on_request = 1;
|
||||
test_ue.nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL;
|
||||
|
||||
memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci));
|
||||
|
||||
mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI;
|
||||
mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI;
|
||||
ogs_nas_from_plmn_id(&mobile_identity_suci.nas_plmn_id,
|
||||
&test_self()->tai.plmn_id);
|
||||
mobile_identity_suci.routing_indicator1 = 0;
|
||||
mobile_identity_suci.routing_indicator2 = 0xf;
|
||||
mobile_identity_suci.routing_indicator3 = 0xf;
|
||||
mobile_identity_suci.routing_indicator4 = 0xf;
|
||||
mobile_identity_suci.protection_scheme_id = OGS_NAS_5GS_NULL_SCHEME;
|
||||
mobile_identity_suci.home_network_pki_value = 0;
|
||||
mobile_identity_suci.scheme_output[0] = 0;
|
||||
mobile_identity_suci.scheme_output[1] = 0;
|
||||
mobile_identity_suci.scheme_output[2] = 0x20;
|
||||
mobile_identity_suci.scheme_output[3] = 0x31;
|
||||
mobile_identity_suci.scheme_output[4] = 0x90;
|
||||
|
||||
test_ue_set_mobile_identity_suci(&test_ue, &mobile_identity_suci, 13);
|
||||
|
||||
test_ue.nas.access_type = OGS_ACCESS_TYPE_3GPP;
|
||||
test_ue.abba_len = 2;
|
||||
|
||||
OGS_HEX(_k_string, strlen(_k_string), test_ue.k);
|
||||
OGS_HEX(_opc_string, strlen(_opc_string), test_ue.opc);
|
||||
|
||||
test_sess.psi = 5;
|
||||
test_sess.pti = 1;
|
||||
test_sess.pdu_session_type = OGS_PDU_SESSION_TYPE_IPV4V6;
|
||||
test_sess.dnn = (char *)"internet";
|
||||
|
||||
memset(&test_sess.gnb_n3_ip, 0, sizeof(test_sess.gnb_n3_ip));
|
||||
test_sess.gnb_n3_ip.ipv4 = true;
|
||||
test_sess.gnb_n3_ip.addr = inet_addr("127.0.0.5");
|
||||
test_sess.gnb_n3_teid = 3;
|
||||
|
||||
/* gNB connects to AMF */
|
||||
ngap = testgnb_ngap_client("127.0.0.2");
|
||||
ABTS_PTR_NOTNULL(tc, ngap);
|
||||
|
||||
/* gNB connects to UPF */
|
||||
gtpu = testgnb_gtpu_server("127.0.0.5");
|
||||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
|
||||
/* Send NG-Setup Reqeust */
|
||||
sendbuf = testngap_build_ng_setup_request(0x4000, 28);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive NG-Setup Response */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/********** Insert Subscriber in Database */
|
||||
collection = mongoc_client_get_collection(
|
||||
ogs_mongoc()->client, ogs_mongoc()->name, "subscribers");
|
||||
ABTS_PTR_NOTNULL(tc, collection);
|
||||
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
|
||||
ABTS_PTR_NOTNULL(tc, doc);
|
||||
|
||||
count = mongoc_collection_count (
|
||||
collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error);
|
||||
if (count) {
|
||||
ABTS_TRUE(tc, mongoc_collection_remove(collection,
|
||||
MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error))
|
||||
}
|
||||
bson_destroy(doc);
|
||||
|
||||
doc = bson_new_from_json((const uint8_t *)json, -1, &error);;
|
||||
ABTS_PTR_NOTNULL(tc, doc);
|
||||
ABTS_TRUE(tc, mongoc_collection_insert(collection,
|
||||
MONGOC_INSERT_NONE, doc, NULL, &error));
|
||||
bson_destroy(doc);
|
||||
|
||||
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
|
||||
ABTS_PTR_NOTNULL(tc, doc);
|
||||
do {
|
||||
count = mongoc_collection_count (
|
||||
collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error);
|
||||
} while (count == 0);
|
||||
bson_destroy(doc);
|
||||
|
||||
/* Send Registration request */
|
||||
test_ue.registration_request_type.guti = 1;
|
||||
gmmbuf = testgmm_build_registration_request(&test_ue, NULL);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
|
||||
test_ue.registration_request_type.requested_nssai = 1;
|
||||
test_ue.registration_request_type.last_visited_registered_tai = 1;
|
||||
test_ue.registration_request_type.ue_usage_setting = 1;
|
||||
nasbuf = testgmm_build_registration_request(&test_ue, NULL);
|
||||
ABTS_PTR_NOTNULL(tc, nasbuf);
|
||||
|
||||
sendbuf = testngap_build_initial_ue_message(&test_ue, gmmbuf, false);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Identity request */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send Identity response */
|
||||
gmmbuf = testgmm_build_identity_response(&test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Authentication request */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send Authentication response */
|
||||
gmmbuf = testgmm_build_authentication_response(&test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Security mode command */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send Security mode complete */
|
||||
gmmbuf = testgmm_build_security_mode_complete(&test_ue, nasbuf);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Initial context setup request */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send UE radio capability info indication */
|
||||
sendbuf = testngap_build_ue_radio_capability_info_indication(&test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Send Initial context setup response */
|
||||
sendbuf = testngap_build_initial_context_setup_response(&test_ue, NULL);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
ogs_msleep(50);
|
||||
|
||||
/* Send Registration complete */
|
||||
gmmbuf = testgmm_build_registration_complete(&test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Configuration update command */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send UE context release request */
|
||||
sendbuf = testngap_build_ue_context_release_request(&test_ue,
|
||||
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
|
||||
false);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive UE context release command */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send UE context release complete */
|
||||
sendbuf = testngap_build_ue_context_release_complete(&test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
ogs_msleep(50);
|
||||
|
||||
/*
|
||||
* Send Service request Using InitialUEMessage
|
||||
* - PDU Session Status
|
||||
*/
|
||||
test_ue.service_request_type.integrity_protected = 0;
|
||||
test_ue.service_request_type.pdu_session_status = 1;
|
||||
nasbuf = testgmm_build_service_request(&test_ue, NULL);
|
||||
ABTS_PTR_NOTNULL(tc, nasbuf);
|
||||
|
||||
test_ue.service_request_type.integrity_protected = 1;
|
||||
test_ue.service_request_type.pdu_session_status = 0;
|
||||
gmmbuf = testgmm_build_service_request(&test_ue, nasbuf);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
|
||||
sendbuf = testngap_build_initial_ue_message(&test_ue, gmmbuf, true);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Service accept */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
ABTS_INT_EQUAL(tc, 0x0000, test_ue.pdu_session_status);
|
||||
|
||||
/* Send Initial context setup response */
|
||||
sendbuf = testngap_build_initial_context_setup_response(&test_ue, NULL);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Send PDU session establishment request */
|
||||
gsmbuf = testgsm_build_pdu_session_establishment_request(&test_sess);
|
||||
ABTS_PTR_NOTNULL(tc, gsmbuf);
|
||||
gmmbuf = testgmm_build_ul_nas_transport(&test_sess,
|
||||
OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive PDU session establishment accept */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send PDU session resource setup response */
|
||||
sendbuf = testngap_build_pdu_session_resource_setup_response(&test_sess);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
ogs_msleep(50);
|
||||
|
||||
/* Send GTP-U ICMP Packet */
|
||||
rv = test_gtpu_build_ping(&sendbuf, &test_sess, "10.45.0.1");
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
rv = testgnb_gtpu_send(gtpu, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive GTP-U ICMP Packet */
|
||||
recvbuf = testgnb_gtpu_read(gtpu);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
ogs_msleep(50);
|
||||
|
||||
/*
|
||||
* Send Service request Using InitialUEMessage
|
||||
* - Uplink Data Status
|
||||
* - PDU Session Status
|
||||
*/
|
||||
test_ue.service_request_type.integrity_protected = 0;
|
||||
test_ue.service_request_type.uplink_data_status = 1;
|
||||
test_ue.service_request_type.psimask.uplink_data_status =
|
||||
1 << test_sess.psi;
|
||||
test_ue.service_request_type.pdu_session_status = 1;
|
||||
test_ue.service_request_type.psimask.pdu_session_status =
|
||||
1 << test_sess.psi;
|
||||
nasbuf = testgmm_build_service_request(&test_ue, NULL);
|
||||
ABTS_PTR_NOTNULL(tc, nasbuf);
|
||||
|
||||
test_ue.service_request_type.integrity_protected = 1;
|
||||
test_ue.service_request_type.uplink_data_status = 0;
|
||||
test_ue.service_request_type.pdu_session_status = 0;
|
||||
gmmbuf = testgmm_build_service_request(&test_ue, nasbuf);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
|
||||
sendbuf = testngap_build_initial_ue_message(&test_ue, gmmbuf, true);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Service accept */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
ABTS_INT_EQUAL(tc, 0x2000, test_ue.pdu_session_status);
|
||||
ABTS_INT_EQUAL(tc, 0x0000, test_ue.pdu_session_reactivation_result);
|
||||
|
||||
/* Send Initial context setup response */
|
||||
sendbuf = testngap_build_initial_context_setup_response(
|
||||
&test_ue, NULL);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
ogs_msleep(50);
|
||||
|
||||
/* Send GTP-U ICMP Packet */
|
||||
rv = test_gtpu_build_ping(&sendbuf, &test_sess, "10.45.0.1");
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
rv = testgnb_gtpu_send(gtpu, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive GTP-U ICMP Packet */
|
||||
recvbuf = testgnb_gtpu_read(gtpu);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
/*
|
||||
* Send Service request Using UplinkNASTransport
|
||||
* - Uplink Data Status
|
||||
*/
|
||||
test_ue.service_request_type.integrity_protected = 1;
|
||||
test_ue.service_request_type.ciphered = 1;
|
||||
test_ue.service_request_type.uplink_data_status = 1;
|
||||
test_ue.service_request_type.psimask.uplink_data_status =
|
||||
1 << test_sess.psi;
|
||||
gmmbuf = testgmm_build_service_request(&test_ue, NULL);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Service accept */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
ABTS_INT_EQUAL(tc, 0x0000, test_ue.pdu_session_reactivation_result);
|
||||
}
|
||||
|
||||
/* Send UE context release request */
|
||||
ran_ue_ngap_id = test_ue.ran_ue_ngap_id;
|
||||
amf_ue_ngap_id = test_ue.amf_ue_ngap_id;
|
||||
|
||||
test_ue.ran_ue_ngap_id = 2;
|
||||
test_ue.amf_ue_ngap_id = 2;
|
||||
sendbuf = testngap_build_ue_context_release_request(&test_ue,
|
||||
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
|
||||
false);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Error Indication */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
ogs_msleep(50);
|
||||
|
||||
test_ue.ran_ue_ngap_id = ran_ue_ngap_id;
|
||||
test_ue.amf_ue_ngap_id = amf_ue_ngap_id;
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
/*
|
||||
* Send Service request Using UplinkNASTransport
|
||||
* - Uplink Data Status
|
||||
*/
|
||||
test_ue.service_request_type.integrity_protected = 1;
|
||||
test_ue.service_request_type.ciphered = 1;
|
||||
test_ue.service_request_type.uplink_data_status = 1;
|
||||
test_ue.service_request_type.psimask.uplink_data_status =
|
||||
1 << test_sess.psi;
|
||||
gmmbuf = testgmm_build_service_request(&test_ue, NULL);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive Service accept */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
ABTS_INT_EQUAL(tc, 0x0000, test_ue.pdu_session_reactivation_result);
|
||||
}
|
||||
|
||||
/* Send De-registration request */
|
||||
gmmbuf = testgmm_build_de_registration_request(&test_ue, 1);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive UE context release command */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(&test_ue, recvbuf);
|
||||
|
||||
/* Send UE context release complete */
|
||||
sendbuf = testngap_build_ue_context_release_complete(&test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
ogs_msleep(50);
|
||||
|
||||
/********** Remove Subscriber in Database */
|
||||
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
|
||||
ABTS_PTR_NOTNULL(tc, doc);
|
||||
ABTS_TRUE(tc, mongoc_collection_remove(collection,
|
||||
MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error))
|
||||
bson_destroy(doc);
|
||||
|
||||
mongoc_collection_destroy(collection);
|
||||
|
||||
/* gNB disonncect from UPF */
|
||||
testgnb_gtpu_close(gtpu);
|
||||
|
||||
/* gNB disonncect from AMF */
|
||||
testgnb_ngap_close(ngap);
|
||||
|
||||
/* Clear Test UE Context */
|
||||
test_ue_remove(&test_ue);
|
||||
}
|
||||
|
||||
abts_suite *test_idle(abts_suite *suite)
|
||||
{
|
||||
suite = ADD_SUITE(suite)
|
||||
|
@ -1188,6 +1697,7 @@ abts_suite *test_idle(abts_suite *suite)
|
|||
abts_run_test(suite, test1_func, NULL);
|
||||
abts_run_test(suite, test2_func, NULL);
|
||||
abts_run_test(suite, test3_func, NULL);
|
||||
abts_run_test(suite, test4_func, NULL);
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
test_sess.test_ue = &test_ue;
|
||||
test_ue.sess = &test_sess;
|
||||
|
||||
test_ue.nas.registration.type = 1; /* TSC[0], KSI[1] */
|
||||
test_ue.nas.registration.type = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE;
|
||||
test_ue.nas.registration.follow_on_request = 1;
|
||||
test_ue.nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL;
|
||||
|
||||
|
@ -143,7 +143,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
|
||||
/* Send NG-Setup Reqeust */
|
||||
sendbuf = testngap_build_ng_setup_request(0x000102);
|
||||
sendbuf = testngap_build_ng_setup_request(0x4000, 30);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
|
Loading…
Reference in New Issue