Add NRF debug/trace for finding crash [#512]

This commit is contained in:
Sukchan Lee 2020-07-26 14:54:30 -04:00
parent ff56388b3e
commit 06a5566128
8 changed files with 47 additions and 11 deletions

View File

@ -470,10 +470,13 @@ void ogs_sbi_nf_instance_clear(ogs_sbi_nf_instance_t *nf_instance)
if (nf_instance->ipv4[i])
ogs_freeaddrinfo(nf_instance->ipv4[i]);
}
nf_instance->num_of_ipv4 = 0;
for (i = 0; i < nf_instance->num_of_ipv6; i++) {
if (nf_instance->ipv6[i])
ogs_freeaddrinfo(nf_instance->ipv6[i]);
}
nf_instance->num_of_ipv6 = 0;
ogs_sbi_nf_service_remove_all(nf_instance);
}
@ -595,6 +598,7 @@ void ogs_sbi_nf_service_clear(ogs_sbi_nf_service_t *nf_service)
if (nf_service->versions[i].expiry)
ogs_free(nf_service->versions[i].expiry);
}
nf_service->num_of_version = 0;
for (i = 0; i < nf_service->num_of_addr; i++) {
if (nf_service->addr[i].ipv4)
@ -602,6 +606,7 @@ void ogs_sbi_nf_service_clear(ogs_sbi_nf_service_t *nf_service)
if (nf_service->addr[i].ipv6)
ogs_freeaddrinfo(nf_service->addr[i].ipv6);
}
nf_service->num_of_addr = 0;
}
void ogs_sbi_nf_service_remove(ogs_sbi_nf_service_t *nf_service)

View File

@ -42,11 +42,20 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
NFProfile->nf_type = nf_instance->nf_type;
NFProfile->nf_status = nf_instance->nf_status;
ogs_trace("[%s] ogs_nnrf_nfm_build_nf_profile()", nf_instance->id);
ogs_trace("NF-Type[%s] NF-Status[%s] IPv4[%d] IPv6[%d]",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
OpenAPI_nf_status_ToString(nf_instance->nf_status),
nf_instance->num_of_ipv4, nf_instance->num_of_ipv6);
if (strlen(nf_instance->fqdn)) {
memset(fqdn, 0, sizeof(fqdn));
fqdn_len = ogs_fqdn_build(fqdn,
nf_instance->fqdn, strlen(nf_instance->fqdn));
NFProfile->fqdn = ogs_memdup(fqdn, fqdn_len);
ogs_fatal("FQDN[%s]", nf_instance->fqdn);
}
Ipv4AddrList = OpenAPI_list_create();
@ -55,12 +64,23 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
ogs_assert(Ipv6AddrList);
for (i = 0; i < nf_instance->num_of_ipv4; i++) {
if (nf_instance->ipv4[i])
if (nf_instance->ipv4[i]) {
ogs_trace("IPv4 [family:%d, addr:%x, port:%d]",
nf_instance->ipv4[i]->ogs_sa_family,
htobe32(nf_instance->ipv4[i]->sin.sin_addr.s_addr),
nf_instance->ipv4[i]->ogs_sin_port);
ogs_assert(nf_instance->ipv4[i]->ogs_sa_family == AF_INET);
OpenAPI_list_add(Ipv4AddrList, ogs_ipstrdup(nf_instance->ipv4[i]));
}
}
for (i = 0; i < nf_instance->num_of_ipv6; i++) {
if (nf_instance->ipv6[i])
if (nf_instance->ipv6[i]) {
ogs_trace("IPv6 [family:%d, port:%d]",
nf_instance->ipv6[i]->ogs_sa_family,
nf_instance->ipv6[i]->ogs_sin_port);
ogs_assert(nf_instance->ipv4[i]->ogs_sa_family == AF_INET6);
OpenAPI_list_add(Ipv6AddrList, ogs_ipstrdup(nf_instance->ipv6[i]));
}
}
if (Ipv4AddrList->count)

View File

@ -145,7 +145,6 @@ bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
ogs_fqdn_parse(nf_service->fqdn,
NFService->fqdn, strlen(NFService->fqdn));
nf_service->num_of_addr = 0;
OpenAPI_list_for_each(IpEndPointList, node2) {
OpenAPI_ip_end_point_t *IpEndPoint = node2->data;
ogs_sockaddr_t *addr = NULL, *addr6 = NULL;

View File

@ -44,7 +44,7 @@ static ogs_sbi_nf_instance_t *find_or_discover_nf_instance(
}
if (*nf == false) {
ogs_warn("[%s] Try to discover",
ogs_warn("Try to discover [%s]",
OpenAPI_nf_type_ToString(sbi_object->nf_type));
ogs_timer_start(sbi_object->client_wait.timer,
sbi_object->client_wait.duration);

View File

@ -557,11 +557,12 @@ int gmm_handle_authentication_response(amf_ue_t *amf_ue,
amf_ue->rand, authentication_response_parameter->res, hxres_star);
if (memcmp(hxres_star, amf_ue->hxres_star, OGS_MAX_RES_LEN) != 0) {
ogs_log_hexdump(OGS_LOG_WARN,
ogs_error("[%s] MAC failure", amf_ue->suci);
ogs_log_hexdump(OGS_LOG_ERROR,
authentication_response_parameter->res,
authentication_response_parameter->length);
ogs_log_hexdump(OGS_LOG_WARN, hxres_star, OGS_MAX_RES_LEN);
ogs_log_hexdump(OGS_LOG_WARN,
ogs_log_hexdump(OGS_LOG_ERROR, hxres_star, OGS_MAX_RES_LEN);
ogs_log_hexdump(OGS_LOG_ERROR,
amf_ue->hxres_star, OGS_MAX_RES_LEN);
return OGS_ERROR;
}

View File

@ -979,7 +979,7 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
case OGS_FSM_EXIT_SIG:
break;
default:
ogs_error("Unknown event[%s]", amf_event_get_name(e));
ogs_error("GMM exception occurred [%s]", amf_event_get_name(e));
break;
}
}

View File

@ -238,7 +238,7 @@ void nas_5gs_send_authentication_reject(amf_ue_t *amf_ue)
ogs_assert(amf_ue);
ogs_debug("[%s] Authentication reject", amf_ue->suci);
ogs_warn("[%s] Authentication reject", amf_ue->suci);
gmmbuf = gmm_build_authentication_reject();
ogs_expect_or_return(gmmbuf);

View File

@ -350,6 +350,10 @@ bool nrf_nnrf_handle_nf_discover(
return false;
}
ogs_debug("NF-Discover : Requester[%s] Target[%s]",
OpenAPI_nf_type_ToString(recvmsg->param.requester_nf_type),
OpenAPI_nf_type_ToString(recvmsg->param.target_nf_type));
SearchResult = ogs_calloc(1, sizeof(*SearchResult));
ogs_assert(SearchResult);
@ -370,13 +374,20 @@ bool nrf_nnrf_handle_nf_discover(
if (!recvmsg->param.limit ||
(recvmsg->param.limit && i < recvmsg->param.limit)) {
ogs_debug("[%s:%d] NF-Discovered [NF-Type:%s,NF-Status:%s,"
"IPv4:%d,IPv6:%d]", nf_instance->id, i,
OpenAPI_nf_type_ToString(nf_instance->nf_type),
OpenAPI_nf_status_ToString(nf_instance->nf_status),
nf_instance->num_of_ipv4, nf_instance->num_of_ipv6);
NFProfile = ogs_nnrf_nfm_build_nf_profile(nf_instance);
ogs_assert(NFProfile);
OpenAPI_list_add(SearchResult->nf_instances, NFProfile);
}
i++;
i++;
}
}
if (recvmsg->param.limit) SearchResult->num_nf_inst_complete = i;