forked from acouzens/open5gs
fix the APN bug
This commit is contained in:
parent
3a36d458e5
commit
9b523b043f
|
@ -139,7 +139,7 @@ typedef struct _qos_t {
|
|||
* PDN Structure */
|
||||
typedef struct _pdn_t {
|
||||
c_uint32_t context_identifier;
|
||||
c_int8_t apn[MAX_APN_LEN];
|
||||
c_int8_t apn[MAX_APN_LEN+1];
|
||||
#define S6A_PDN_TYPE_IPV4 0
|
||||
#define S6A_PDN_TYPE_IPV6 1
|
||||
#define S6A_PDN_TYPE_IPV4_AND_IPV6 2
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
/*******************************************************************************
|
||||
* This file had been created by gtpv2c_tlv.py script v0.1.0
|
||||
* Please do not modify this file but regenerate it via script.
|
||||
* Created on: 2017-08-01 11:30:40.156868 by acetcom
|
||||
* Created on: 2017-08-19 16:43:29.568100 by acetcom
|
||||
* from 24301-d80.docx
|
||||
******************************************************************************/
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
/*******************************************************************************
|
||||
* This file had been created by gtpv2c_tlv.py script v0.1.0
|
||||
* Please do not modify this file but regenerate it via script.
|
||||
* Created on: 2017-08-01 11:30:40.185472 by acetcom
|
||||
* Created on: 2017-08-19 16:43:29.597664 by acetcom
|
||||
* from 24301-d80.docx
|
||||
******************************************************************************/
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
/*******************************************************************************
|
||||
* This file had been created by gtpv2c_tlv.py script v0.1.0
|
||||
* Please do not modify this file but regenerate it via script.
|
||||
* Created on: 2017-08-01 11:30:40.114797 by acetcom
|
||||
* Created on: 2017-08-19 16:43:29.530361 by acetcom
|
||||
* from 24301-d80.docx
|
||||
******************************************************************************/
|
||||
|
||||
|
@ -1466,8 +1466,8 @@ c_int16_t nas_decode_tracking_area_identity_list(nas_tracking_area_identity_list
|
|||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error");
|
||||
memcpy(tracking_area_identity_list, pkbuf->payload - size, size);
|
||||
|
||||
int i = 0;
|
||||
{
|
||||
int i = 0;
|
||||
if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS)
|
||||
for (i = 0; i < tracking_area_identity_list->num + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)
|
||||
tracking_area_identity_list->type0.tac[i] = ntohs(tracking_area_identity_list->type0.tac[i]);
|
||||
|
@ -1492,8 +1492,8 @@ c_int16_t nas_encode_tracking_area_identity_list(pkbuf_t *pkbuf, nas_tracking_ar
|
|||
nas_tracking_area_identity_list_t target;
|
||||
|
||||
memcpy(&target, tracking_area_identity_list, sizeof(nas_tracking_area_identity_list_t));
|
||||
int i = 0;
|
||||
{
|
||||
int i = 0;
|
||||
if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS)
|
||||
for (i = 0; i < tracking_area_identity_list->num + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)
|
||||
target.type0.tac[i] = htons(tracking_area_identity_list->type0.tac[i]);
|
||||
|
@ -2156,6 +2156,9 @@ c_int16_t nas_decode_access_point_name(nas_access_point_name_t *access_point_nam
|
|||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error");
|
||||
memcpy(access_point_name, pkbuf->payload - size, size);
|
||||
|
||||
memmove(&access_point_name->apn[0], &access_point_name->apn[1], access_point_name->length);
|
||||
access_point_name->length--;
|
||||
|
||||
d_trace(5, " ACCESS_POINT_NAME - ");
|
||||
d_trace_hex(5, pkbuf->payload - size, size);
|
||||
|
||||
|
@ -2168,6 +2171,10 @@ c_int16_t nas_encode_access_point_name(pkbuf_t *pkbuf, nas_access_point_name_t *
|
|||
nas_access_point_name_t target;
|
||||
|
||||
memcpy(&target, access_point_name, sizeof(nas_access_point_name_t));
|
||||
core_cpystrn(&target.apn[1], &access_point_name->apn[0], c_min(access_point_name->length, MAX_APN_LEN) + 1);
|
||||
target.apn[0] = access_point_name->length;
|
||||
target.length++; size++;
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error");
|
||||
memcpy(pkbuf->payload - size, &target, size);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
/*******************************************************************************
|
||||
* This file had been created by gtpv2c_tlv.py script v0.1.0
|
||||
* Please do not modify this file but regenerate it via script.
|
||||
* Created on: 2017-08-01 11:30:40.109131 by acetcom
|
||||
* Created on: 2017-08-19 16:43:29.525216 by acetcom
|
||||
* from 24301-d80.docx
|
||||
******************************************************************************/
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
/*******************************************************************************
|
||||
* This file had been created by gtpv2c_tlv.py script v0.1.0
|
||||
* Please do not modify this file but regenerate it via script.
|
||||
* Created on: 2017-08-01 11:30:40.130949 by acetcom
|
||||
* Created on: 2017-08-19 16:43:29.546027 by acetcom
|
||||
* from 24301-d80.docx
|
||||
******************************************************************************/
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ type_list["Tracking area identity"]["encode"] = \
|
|||
" target.tac = htons(tracking_area_identity->tac);\n\n"
|
||||
|
||||
type_list["Tracking area identity list"]["decode"] = \
|
||||
" int i = 0;\n" \
|
||||
" {\n" \
|
||||
" int i = 0;\n" \
|
||||
" if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS)\n" \
|
||||
" for (i = 0; i < tracking_area_identity_list->num + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)\n" \
|
||||
" tracking_area_identity_list->type0.tac[i] = ntohs(tracking_area_identity_list->type0.tac[i]);\n" \
|
||||
|
@ -28,8 +28,8 @@ type_list["Tracking area identity list"]["decode"] = \
|
|||
" return -1;\n" \
|
||||
" }\n\n"
|
||||
type_list["Tracking area identity list"]["encode"] = \
|
||||
" int i = 0;\n" \
|
||||
" {\n" \
|
||||
" int i = 0;\n" \
|
||||
" if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS)\n" \
|
||||
" for (i = 0; i < tracking_area_identity_list->num + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)\n" \
|
||||
" target.type0.tac[i] = htons(tracking_area_identity_list->type0.tac[i]);\n" \
|
||||
|
@ -86,3 +86,12 @@ type_list["Short MAC"]["decode"] = \
|
|||
" *short_mac = ntohs(*short_mac);\n\n"
|
||||
type_list["Short MAC"]["encode"] = \
|
||||
" target = htons(*short_mac);\n\n"
|
||||
|
||||
type_list["Access point name"]["decode"] = \
|
||||
" memmove(&access_point_name->apn[0], &access_point_name->apn[1], access_point_name->length);\n" \
|
||||
" access_point_name->length--;\n\n"
|
||||
|
||||
type_list["Access point name"]["encode"] = \
|
||||
" core_cpystrn(&target.apn[1], &access_point_name->apn[0], c_min(access_point_name->length, MAX_APN_LEN) + 1);\n" \
|
||||
" target.apn[0] = access_point_name->length;\n" \
|
||||
" target.length++; size++;\n\n"
|
||||
|
|
|
@ -521,9 +521,8 @@ status_t hss_db_subscription_data(
|
|||
BSON_ITER_HOLDS_UTF8(&child2_iter))
|
||||
{
|
||||
utf8 = bson_iter_utf8(&child2_iter, &length);
|
||||
/* FIX the bug */
|
||||
core_cpystrn(pdn->apn+1, utf8, length+1);
|
||||
pdn->apn[0] = length;
|
||||
core_cpystrn(pdn->apn, utf8,
|
||||
c_min(length, MAX_APN_LEN)+1);
|
||||
}
|
||||
else if (!strcmp(child2_key, "type") &&
|
||||
BSON_ITER_HOLDS_INT32(&child2_iter))
|
||||
|
|
|
@ -65,9 +65,8 @@ static int hss_air_cb( struct msg **msg, struct avp *avp,
|
|||
|
||||
CHECK_FCT( fd_msg_search_avp(qry, fd_user_name, &avp) );
|
||||
CHECK_FCT( fd_msg_avp_hdr(avp, &hdr) );
|
||||
|
||||
memcpy(imsi_bcd, (char*)hdr->avp_value->os.data, hdr->avp_value->os.len);
|
||||
imsi_bcd[hdr->avp_value->os.len] = 0;
|
||||
core_cpystrn(imsi_bcd, (char*)hdr->avp_value->os.data,
|
||||
c_min(hdr->avp_value->os.len, MAX_IMSI_BCD_LEN)+1);
|
||||
|
||||
rv = hss_db_auth_info(imsi_bcd, &auth_info);
|
||||
if (rv != CORE_OK)
|
||||
|
@ -101,10 +100,8 @@ static int hss_air_cb( struct msg **msg, struct avp *avp,
|
|||
|
||||
CHECK_FCT( fd_msg_search_avp(qry, s6a_visited_plmn_id, &avp) );
|
||||
CHECK_FCT( fd_msg_avp_hdr(avp, &hdr) );
|
||||
|
||||
#if 0 // TODO : check visited_plmn_id
|
||||
memcpy(visited_plmn_id,
|
||||
hdr->avp_value->os.data, hdr->avp_value->os.len);
|
||||
memcpy(visited_plmn_id, hdr->avp_value->os.data, hdr->avp_value->os.len);
|
||||
#endif
|
||||
|
||||
milenage_opc(auth_info.k, auth_info.op, opc);
|
||||
|
@ -204,9 +201,8 @@ static int hss_ulr_cb( struct msg **msg, struct avp *avp,
|
|||
|
||||
CHECK_FCT( fd_msg_search_avp(qry, fd_user_name, &avp) );
|
||||
CHECK_FCT( fd_msg_avp_hdr(avp, &hdr) );
|
||||
|
||||
memcpy(imsi_bcd, (char*)hdr->avp_value->os.data, hdr->avp_value->os.len);
|
||||
imsi_bcd[hdr->avp_value->os.len] = 0;
|
||||
core_cpystrn(imsi_bcd, (char*)hdr->avp_value->os.data,
|
||||
c_min(hdr->avp_value->os.len, MAX_IMSI_BCD_LEN)+1);
|
||||
|
||||
rv = hss_db_subscription_data(imsi_bcd, &subscription_data);
|
||||
if (rv != CORE_OK)
|
||||
|
@ -217,14 +213,9 @@ static int hss_ulr_cb( struct msg **msg, struct avp *avp,
|
|||
|
||||
CHECK_FCT( fd_msg_search_avp(qry, s6a_visited_plmn_id, &avp) );
|
||||
CHECK_FCT( fd_msg_avp_hdr(avp, &hdr) );
|
||||
|
||||
if (hdr && hdr->avp_value && hdr->avp_value->os.data)
|
||||
{
|
||||
#if 0 // TODO : check visited_plmn_id
|
||||
memcpy(visited_plmn_id,
|
||||
hdr->avp_value->os.data, hdr->avp_value->os.len);
|
||||
memcpy(visited_plmn_id, hdr->avp_value->os.data, hdr->avp_value->os.len);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */
|
||||
CHECK_FCT( fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1) );
|
||||
|
@ -308,7 +299,7 @@ static int hss_ulr_cb( struct msg **msg, struct avp *avp,
|
|||
|
||||
CHECK_FCT( fd_msg_avp_new(s6a_context_identifier, 0,
|
||||
&context_identifier) );
|
||||
val.i32 = 0; /* FIXME : default PDN Context Identifier */
|
||||
val.i32 = 0;
|
||||
CHECK_FCT( fd_msg_avp_setvalue(context_identifier, &val) );
|
||||
CHECK_FCT( fd_msg_avp_add(apn_configuration_profile,
|
||||
MSG_BRW_LAST_CHILD, context_identifier) );
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#define TRACE_MODULE _esm_build
|
||||
|
||||
#include "core_debug.h"
|
||||
#include "core_lib.h"
|
||||
|
||||
#include "nas_message.h"
|
||||
|
||||
|
@ -97,7 +98,8 @@ status_t esm_build_activate_default_bearer_context(
|
|||
eps_qos->dl_gbr = 0xff;
|
||||
|
||||
access_point_name->length = strlen(pdn->apn);
|
||||
strcpy(access_point_name->apn, pdn->apn);
|
||||
core_cpystrn(access_point_name->apn, pdn->apn,
|
||||
c_min(access_point_name->length, MAX_APN_LEN) + 1);
|
||||
|
||||
pdn_address->length = PAA_IPV4_LEN;
|
||||
memcpy(&pdn_address->paa, &pdn->paa, pdn_address->length);
|
||||
|
|
|
@ -1725,10 +1725,12 @@ pdn_t* mme_pdn_find_by_apn(mme_ue_t *mme_ue, c_int8_t *apn)
|
|||
{
|
||||
pdn = &mme_ue->pdn[i];
|
||||
if (strcmp(pdn->apn, apn) == 0)
|
||||
break;
|
||||
{
|
||||
return pdn;
|
||||
}
|
||||
}
|
||||
|
||||
return pdn;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void mme_ue_paged(mme_ue_t *mme_ue)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "core_debug.h"
|
||||
#include "core_pool.h"
|
||||
#include "core_lib.h"
|
||||
|
||||
#include "fd_lib.h"
|
||||
#include "s6a_lib.h"
|
||||
|
@ -593,9 +594,8 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg)
|
|||
{
|
||||
CHECK_FCT_DO(
|
||||
fd_msg_avp_hdr(avpch3, &hdr), return );
|
||||
memcpy(apn, hdr->avp_value->os.data,
|
||||
hdr->avp_value->os.len);
|
||||
apn[hdr->avp_value->os.len] = 0;
|
||||
core_cpystrn(apn, (char*)hdr->avp_value->os.data,
|
||||
c_min(hdr->avp_value->os.len, MAX_APN_LEN)+1);
|
||||
|
||||
pdn = mme_pdn_find_by_apn(mme_ue, apn);
|
||||
if (!pdn)
|
||||
|
|
Loading…
Reference in New Issue