forked from acouzens/open5gs
update it
This commit is contained in:
parent
0f7bdc1ded
commit
19fc153f00
|
@ -45,9 +45,9 @@ c_int16_t gtp_parse_bearer_qos(
|
|||
|
||||
memset(bearer_qos, 0, sizeof(gtp_bearer_qos_t));
|
||||
|
||||
bearer_qos->pci = source->pci;
|
||||
bearer_qos->pl = source->pl;
|
||||
bearer_qos->pvi = source->pvi;
|
||||
bearer_qos->pre_emption_capability = source->pre_emption_capability;
|
||||
bearer_qos->priority_level = source->priority_level;
|
||||
bearer_qos->pre_emption_vulnerability = source->pre_emption_vulnerability;
|
||||
size++;
|
||||
|
||||
bearer_qos->qci = source->qci;
|
||||
|
|
|
@ -111,14 +111,14 @@ typedef struct _gtp_ambr_t {
|
|||
typedef struct _gtp_bearer_qos_t {
|
||||
ED5(c_uint8_t spare1:1;,
|
||||
/* See 3GPP TS 29.212[29], clause 5.3.46 Pre-emption-Capability AVP. */
|
||||
c_uint8_t pci:1;,
|
||||
c_uint8_t pre_emption_capability:1;,
|
||||
/* See 3GPP TS 29.212[29], clause 5.3.45 Priority-Level AVP.
|
||||
* PL encodes each priority level defined for the Priority-Level AVP
|
||||
* as the binary value of the priority level. */
|
||||
c_uint8_t pl:4;,
|
||||
c_uint8_t priority_level:4;,
|
||||
c_uint8_t spare2:1;,
|
||||
/* See 3GPP TS 29.212[29], clause 5.3.47 Pre-emption-Vulnerability AVP. */
|
||||
c_uint8_t pvi:1;)
|
||||
c_uint8_t pre_emption_vulnerability:1;)
|
||||
c_uint8_t qci; /* specified in 3GPP TS 23.203 [48]. */
|
||||
|
||||
/* specified in 3GPP TS 36.413 [10]. */
|
||||
|
|
|
@ -52,6 +52,7 @@ status_t hss_context_init(void)
|
|||
memcpy(profile->k, CORE_HEX(K, strlen(K), buf), HSS_KEY_LEN);
|
||||
profile->sqn = 64;
|
||||
|
||||
profile->access_restriction_data = 5;
|
||||
profile->subscriber_status = HSS_SUBSCRIBER_STATUS_SERVICE_GRANTED;
|
||||
profile->network_access_mode = HSS_NETWORK_ACCESS_MODE_ONLY_PACKET;
|
||||
profile->max_bandwidth_ul = 102400; /* Kbps */
|
||||
|
@ -69,8 +70,8 @@ status_t hss_context_init(void)
|
|||
|
||||
pdn->type = PDN_TYPE_IPV4;
|
||||
|
||||
pdn->qci = PDN_QCI_1;
|
||||
pdn->priority_level = 1;
|
||||
pdn->qci = PDN_QCI_9;
|
||||
pdn->priority_level = 8;
|
||||
|
||||
pdn->pre_emption_capability = PDN_PRE_EMPTION_CAPABILITY_DISABLED;
|
||||
pdn->pre_emption_vulnerability = PDN_PRE_EMPTION_VULNERABILITY_DISABLED;
|
||||
|
@ -297,6 +298,7 @@ hss_ue_t* hss_ue_add(hss_profile_id_t id, c_int8_t *imsi_bcd)
|
|||
core_generate_random_bytes(ue->rand, RAND_LEN);
|
||||
ue->sqn = profile->sqn;
|
||||
|
||||
ue->access_restriction_data = profile->access_restriction_data;
|
||||
ue->subscriber_status = profile->subscriber_status;
|
||||
ue->network_access_mode = profile->network_access_mode;
|
||||
ue->max_bandwidth_ul = profile->max_bandwidth_ul;
|
||||
|
|
|
@ -27,6 +27,7 @@ typedef struct _hss_profile_t {
|
|||
c_uint8_t amf[HSS_AMF_LEN];
|
||||
c_uint64_t sqn;
|
||||
|
||||
c_uint32_t access_restriction_data;
|
||||
c_uint32_t subscriber_status;
|
||||
c_uint32_t network_access_mode;
|
||||
|
||||
|
@ -46,13 +47,24 @@ typedef struct _hss_ue_t {
|
|||
|
||||
plmn_id_t visited_plmn_id;
|
||||
|
||||
#define HSS_ACCESS_RESTRICTION_UTRAN_NOT_ALLOWED (1)
|
||||
#define HSS_ACCESS_RESTRICTION_GERAN_NOT_ALLOWED (1<<1)
|
||||
#define HSS_ACCESS_RESTRICTION_GAN_NOT_ALLOWED (1<<2)
|
||||
#define HSS_ACCESS_RESTRICTION_I_HSPA_EVOLUTION_NOT_ALLOWED (1<<3)
|
||||
#define HSS_ACCESS_RESTRICTION_WB_E_UTRAN_NOT_ALLOWED (1<<4)
|
||||
#define HSS_ACCESS_RESTRICTION_HO_TO_NON_3GPP_ACCESS_NOT_ALLOWED (1<<5)
|
||||
#define HSS_ACCESS_RESTRICTION_NB_IOT_NOT_ALLOWED (1<<6)
|
||||
c_uint32_t access_restriction_data;
|
||||
|
||||
#define HSS_SUBSCRIBER_STATUS_SERVICE_GRANTED 0
|
||||
#define HSS_SUBSCRIBER_STATUS_OPERATOR_DETERMINED_BARRING 1
|
||||
c_uint32_t subscriber_status;
|
||||
|
||||
#define HSS_NETWORK_ACCESS_MODE_PACKET_AND_CIRCUIT 0
|
||||
#define HSS_NETWORK_ACCESS_MODE_RESERVED 1
|
||||
#define HSS_NETWORK_ACCESS_MODE_ONLY_PACKET 2
|
||||
c_uint32_t network_access_mode;
|
||||
|
||||
c_uint32_t max_bandwidth_ul; /* Kbps */
|
||||
c_uint32_t max_bandwidth_dl; /* Kbps */
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ static int hss_ulr_cb( struct msg **msg, struct avp *avp,
|
|||
if (hdr && hdr->avp_value &&
|
||||
!(hdr->avp_value->u32 & S6A_ULR_SKIP_SUBSCRIBER_DATA))
|
||||
{
|
||||
struct avp *avp_msisdn;
|
||||
struct avp *avp_msisdn, *avp_access_restriction_data;
|
||||
struct avp *avp_subscriber_status, *avp_network_access_mode;
|
||||
struct avp *avp_ambr, *avp_max_bandwidth_ul, *avp_max_bandwidth_dl;
|
||||
int i;
|
||||
|
@ -229,6 +229,17 @@ static int hss_ulr_cb( struct msg **msg, struct avp *avp,
|
|||
d_assert(fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avp_msisdn) == 0,
|
||||
goto out,);
|
||||
|
||||
if (ue->access_restriction_data)
|
||||
{
|
||||
d_assert(fd_msg_avp_new(s6a_access_restriction_data, 0,
|
||||
&avp_access_restriction_data) == 0, goto out,);
|
||||
val.i32 = ue->access_restriction_data;
|
||||
d_assert(fd_msg_avp_setvalue(
|
||||
avp_access_restriction_data, &val) == 0, goto out,);
|
||||
d_assert(fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD,
|
||||
avp_access_restriction_data) == 0, goto out,);
|
||||
}
|
||||
|
||||
d_assert(fd_msg_avp_new(s6a_subscriber_status, 0,
|
||||
&avp_subscriber_status) == 0, goto out,);
|
||||
val.i32 = ue->subscriber_status;
|
||||
|
|
|
@ -37,6 +37,17 @@ void esm_handle_information_response(mme_esm_t *esm,
|
|||
esm_information_response->access_point_name.apn);
|
||||
}
|
||||
|
||||
if (esm_information_response->presencemask &
|
||||
NAS_ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT)
|
||||
{
|
||||
nas_protocol_configuration_options_t *protocol_configuration_options =
|
||||
&esm_information_response->protocol_configuration_options;
|
||||
esm->pco_len = protocol_configuration_options->length;
|
||||
d_assert(esm->pco_len <= MAX_PCO_LEN, return,
|
||||
"length(%d) exceeds MAX:%d", esm->pco_len, MAX_PCO_LEN);
|
||||
memcpy(esm->pco, protocol_configuration_options->buffer, esm->pco_len);
|
||||
}
|
||||
|
||||
rv = mme_s11_build_create_session_req(&pkbuf, esm);
|
||||
d_assert(rv == CORE_OK, return, "S11 build error");
|
||||
|
||||
|
|
|
@ -164,7 +164,10 @@ typedef struct _mme_esm_t {
|
|||
c_uint32_t sgw_addr; /* SGW-S11-F-TEID IPv4 Address */
|
||||
c_uint32_t sgw_teid; /* SGW-S11-F-TEID */
|
||||
|
||||
c_uint8_t pti; /** Procedure Trasaction Identity */
|
||||
c_uint8_t pti; /** Procedure Trasaction Identity */
|
||||
|
||||
c_uint8_t pco[MAX_PCO_LEN];
|
||||
int pco_len;
|
||||
|
||||
mme_sgw_t *sgw;
|
||||
pdn_t *pdn;
|
||||
|
|
|
@ -22,8 +22,6 @@ status_t mme_s11_build_create_session_req(pkbuf_t **pkbuf, mme_esm_t *esm)
|
|||
gtp_f_teid_t s11, s5;
|
||||
gtp_paa_t paa;
|
||||
gtp_ambr_t ambr;
|
||||
pco_t pco;
|
||||
char pcobuf[MAX_PCO_LEN];
|
||||
gtp_bearer_qos_t bearer_qos;
|
||||
char bearer_qos_buf[GTP_BEARER_QOS_LEN];
|
||||
gtp_ue_timezone_t ue_timezone;
|
||||
|
@ -36,6 +34,8 @@ status_t mme_s11_build_create_session_req(pkbuf_t **pkbuf, mme_esm_t *esm)
|
|||
ue = esm->ue;
|
||||
d_assert(ue, return CORE_ERROR, "Null param");
|
||||
|
||||
d_assert(esm->pco_len, return CORE_ERROR, "Null param");
|
||||
|
||||
memset(>p_message, 0, sizeof(gtp_message_t));
|
||||
|
||||
d_assert(ue->imsi_len, return CORE_ERROR, "Null param");
|
||||
|
@ -108,39 +108,25 @@ status_t mme_s11_build_create_session_req(pkbuf_t **pkbuf, mme_esm_t *esm)
|
|||
req->maximum_apn_restriction.u8 = GTP_APN_NO_RESTRICTION;
|
||||
|
||||
memset(&ambr, 0, sizeof(gtp_ambr_t));
|
||||
ambr.uplink = htonl(1000);
|
||||
ambr.downlink = htonl(2000);
|
||||
ambr.uplink = htonl(pdn->max_bandwidth_ul);
|
||||
ambr.downlink = htonl(pdn->max_bandwidth_dl);
|
||||
req->aggregate_maximum_bit_rate.presence = 1;
|
||||
req->aggregate_maximum_bit_rate.data = &ambr;
|
||||
req->aggregate_maximum_bit_rate.len = sizeof(ambr);
|
||||
|
||||
memset(&pco, 0, sizeof(pco_t));
|
||||
pco.ext = 1;
|
||||
pco.configuration_protocol =
|
||||
PCO_PPP_FOR_USE_WITH_IP_PDP_TYPE_OR_IP_PDN_TYPE;
|
||||
pco.num_of_id = 3;
|
||||
pco.ids[0].id = PROTOCOL_OR_CONTAINER_ID_INTERNET_PROTOCOL_CONTROL_PROTOCOL;
|
||||
pco.ids[0].contents = (c_uint8_t *)"\x01\x00\x00\x10\x81\x06\x00\x00\x00\x00\x83\x06\x00\x00\x00\x00";
|
||||
pco.ids[0].length = 16;
|
||||
pco.ids[1].id = PROTOCOL_OR_CONTAINER_ID_DNS_SERVER_IPV4_ADDRESS_REQUEST;
|
||||
pco.ids[1].length = 0;
|
||||
pco.ids[2].id = PROTOCOL_OR_CONTAINER_ID_IP_ADDRESS_ALLOCATION_VIA_NAS_SIGNALLING;
|
||||
pco.ids[2].length = 0;
|
||||
|
||||
req->protocol_configuration_options.presence = 1;
|
||||
req->protocol_configuration_options.data = &pcobuf;
|
||||
req->protocol_configuration_options.len =
|
||||
pco_build(pcobuf, MAX_PCO_LEN, &pco);
|
||||
req->protocol_configuration_options.data = esm->pco;
|
||||
req->protocol_configuration_options.len = esm->pco_len;
|
||||
|
||||
req->bearer_contexts_to_be_created.presence = 1;
|
||||
req->bearer_contexts_to_be_created.eps_bearer_id.presence = 1;
|
||||
req->bearer_contexts_to_be_created.eps_bearer_id.u8 = 5;
|
||||
|
||||
memset(&bearer_qos, 0, sizeof(bearer_qos));
|
||||
bearer_qos.pvi = 1;
|
||||
bearer_qos.pl = 1;
|
||||
bearer_qos.pci = 1;
|
||||
bearer_qos.qci = 5;
|
||||
bearer_qos.pre_emption_vulnerability = pdn->pre_emption_vulnerability;
|
||||
bearer_qos.pre_emption_capability = pdn->pre_emption_capability;
|
||||
bearer_qos.qci = pdn->qci;
|
||||
bearer_qos.priority_level = pdn->priority_level;
|
||||
req->bearer_contexts_to_be_created.bearer_level_qos.presence = 1;
|
||||
gtp_build_bearer_qos(&req->bearer_contexts_to_be_created.bearer_level_qos,
|
||||
&bearer_qos, bearer_qos_buf, GTP_BEARER_QOS_LEN);
|
||||
|
|
|
@ -142,9 +142,9 @@ static void gtp_message_test1(abts_case *tc, void *data)
|
|||
req.bearer_contexts_to_be_created.eps_bearer_id.u8 = 5;
|
||||
|
||||
memset(&bearer_qos, 0, sizeof(bearer_qos));
|
||||
bearer_qos.pvi = 1;
|
||||
bearer_qos.pl = 1;
|
||||
bearer_qos.pci = 1;
|
||||
bearer_qos.pre_emption_vulnerability = 1;
|
||||
bearer_qos.priority_level = 1;
|
||||
bearer_qos.pre_emption_capability = 1;
|
||||
bearer_qos.qci = 5;
|
||||
req.bearer_contexts_to_be_created.bearer_level_qos.presence = 1;
|
||||
size = gtp_build_bearer_qos(
|
||||
|
@ -263,9 +263,9 @@ static void gtp_message_test1(abts_case *tc, void *data)
|
|||
size = gtp_parse_bearer_qos(&bearer_qos,
|
||||
&req.bearer_contexts_to_be_created.bearer_level_qos);
|
||||
ABTS_INT_EQUAL(tc, 22, size);
|
||||
ABTS_INT_EQUAL(tc, 1, bearer_qos.pvi);
|
||||
ABTS_INT_EQUAL(tc, 1, bearer_qos.pl);
|
||||
ABTS_INT_EQUAL(tc, 1, bearer_qos.pci);
|
||||
ABTS_INT_EQUAL(tc, 1, bearer_qos.pre_emption_vulnerability);
|
||||
ABTS_INT_EQUAL(tc, 1, bearer_qos.priority_level);
|
||||
ABTS_INT_EQUAL(tc, 1, bearer_qos.pre_emption_capability);
|
||||
ABTS_INT_EQUAL(tc, 5, bearer_qos.qci);
|
||||
ABTS_INT_EQUAL(tc, 0, req.
|
||||
bearer_contexts_to_be_created.s11_u_mme_f_teid.presence);
|
||||
|
|
Loading…
Reference in New Issue