forked from acouzens/open5gs
parent
dee14f84af
commit
3554419d97
|
@ -165,7 +165,7 @@ typedef struct ogs_pfcp_far_s {
|
|||
|
||||
ogs_pfcp_smreq_flags_t smreq_flags;
|
||||
|
||||
#define MAX_NUM_OF_PACKET_BUFFER 48
|
||||
#define MAX_NUM_OF_PACKET_BUFFER 256
|
||||
uint32_t num_of_buffered_packet;
|
||||
ogs_pkbuf_t* buffered_packet[MAX_NUM_OF_PACKET_BUFFER];
|
||||
|
||||
|
|
|
@ -129,10 +129,12 @@ void ogs_pfcp_up_handle_pdr(
|
|||
|
||||
sendbuf = ogs_pkbuf_copy(recvbuf);
|
||||
if (!sendbuf) {
|
||||
ogs_error("CHECK CONFIGURATION : Not enough packet buffer");
|
||||
ogs_error("Edit sgwu.yaml in EPC or upf.yaml in 5GC");
|
||||
ogs_error("pool");
|
||||
ogs_error(" packet: 32768");
|
||||
ogs_fatal("CHECK CONFIGURATION : Not enough packet buffer");
|
||||
ogs_fatal("For example, edit sgwu.yaml in EPC or "
|
||||
"upf.yaml in 5GC like the following");
|
||||
ogs_fatal("pool");
|
||||
ogs_fatal(" packet: 327680");
|
||||
ogs_assert_if_reached();
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -272,17 +272,18 @@ void ogs_pfcp_send_g_pdu(ogs_pfcp_pdr_t *pdr, ogs_pkbuf_t *sendbuf)
|
|||
ogs_pfcp_qer_t *qer = NULL;
|
||||
|
||||
ogs_assert(pdr);
|
||||
ogs_assert(sendbuf);
|
||||
|
||||
far = pdr->far;
|
||||
if (!far) {
|
||||
ogs_error("No FAR");
|
||||
ogs_pkbuf_free(sendbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
gnode = far->gnode;
|
||||
ogs_assert(gnode);
|
||||
ogs_assert(gnode->sock);
|
||||
ogs_assert(sendbuf);
|
||||
|
||||
qer = pdr->qer;
|
||||
|
||||
|
|
|
@ -190,7 +190,6 @@ int ogs_sctp_connect(ogs_sock_t *sock, ogs_sockaddr_t *sa_list)
|
|||
int ogs_sctp_sendmsg(ogs_sock_t *sock, const void *msg, size_t len,
|
||||
ogs_sockaddr_t *to, uint32_t ppid, uint16_t stream_no)
|
||||
{
|
||||
int size;
|
||||
socklen_t addrlen = 0;
|
||||
|
||||
ogs_assert(sock);
|
||||
|
@ -198,19 +197,13 @@ int ogs_sctp_sendmsg(ogs_sock_t *sock, const void *msg, size_t len,
|
|||
if (to)
|
||||
addrlen = ogs_sockaddr_len(to);
|
||||
|
||||
size = sctp_sendmsg(sock->fd, msg, len,
|
||||
return sctp_sendmsg(sock->fd, msg, len,
|
||||
to ? &to->sa : NULL, addrlen,
|
||||
htobe32(ppid),
|
||||
0, /* flags */
|
||||
stream_no,
|
||||
0, /* timetolive */
|
||||
0); /* context */
|
||||
if (size < 0) {
|
||||
ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno,
|
||||
"sctp_sendmsg(len:%d) failed", (int)len);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
int ogs_sctp_recvmsg(ogs_sock_t *sock, void *msg, size_t len,
|
||||
|
|
|
@ -329,24 +329,16 @@ int ogs_sctp_sendmsg(ogs_sock_t *sock, const void *msg, size_t len,
|
|||
{
|
||||
struct socket *socket = (struct socket *)sock;
|
||||
struct sctp_sndinfo sndinfo;
|
||||
ssize_t sent;
|
||||
|
||||
ogs_assert(socket);
|
||||
|
||||
memset((void *)&sndinfo, 0, sizeof(struct sctp_sndinfo));
|
||||
sndinfo.snd_ppid = htobe32(ppid);
|
||||
sndinfo.snd_sid = stream_no;
|
||||
sent = usrsctp_sendv(socket, msg, len,
|
||||
return usrsctp_sendv(socket, msg, len,
|
||||
to ? &to->sa : NULL, to ? 1 : 0,
|
||||
(void *)&sndinfo, (socklen_t)sizeof(struct sctp_sndinfo),
|
||||
SCTP_SENDV_SNDINFO, 0);
|
||||
|
||||
if (sent < 0 || sent != len) {
|
||||
ogs_error("sent : %d, len : %d", (int)sent, (int)len);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
return sent;
|
||||
}
|
||||
|
||||
int ogs_sctp_recvmsg(ogs_sock_t *sock, void *msg, size_t len,
|
||||
|
|
|
@ -55,7 +55,6 @@ int nas_5gs_send_to_downlink_nas_transport(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf)
|
|||
|
||||
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("nas_5gs_send_to_gnb() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +92,7 @@ void nas_5gs_send_registration_reject(
|
|||
ogs_expect_or_return(gmmbuf);
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
|
||||
void nas_5gs_send_service_accept(amf_ue_t *amf_ue)
|
||||
|
@ -185,6 +184,7 @@ void nas_5gs_send_de_registration_accept(amf_ue_t *amf_ue)
|
|||
|
||||
void nas_5gs_send_identity_request(amf_ue_t *amf_ue)
|
||||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
|
@ -204,7 +204,8 @@ void nas_5gs_send_identity_request(amf_ue_t *amf_ue)
|
|||
ogs_timer_start(amf_ue->t3570.timer,
|
||||
amf_timer_cfg(AMF_TIMER_T3570)->duration);
|
||||
|
||||
nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
|
||||
void nas_5gs_send_authentication_request(amf_ue_t *amf_ue)
|
||||
|
@ -460,85 +461,3 @@ void nas_5gs_send_back_5gsm_message_from_sbi(amf_sess_t *sess, int status)
|
|||
ogs_assert(sess);
|
||||
nas_5gs_send_back_5gsm_message(sess, gmm_cause_from_sbi(status));
|
||||
}
|
||||
|
||||
#if 0
|
||||
void nas_5gs_send_tau_accept(
|
||||
amf_ue_t *amf_ue, NGAP_ProcedureCode_t procedureCode)
|
||||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
ogs_debug("Tracking area update accept");
|
||||
ogs_debug(" IMSI[%s]", amf_ue->imsi_bcd);
|
||||
|
||||
gmmbuf = gmm_build_tau_accept(amf_ue);
|
||||
ogs_expect_or_return(gmmbuf);
|
||||
|
||||
if (procedureCode == NGAP_ProcedureCode_id_InitialContextSetup) {
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
ngapbuf = ngap_build_initial_context_setup_request(amf_ue, gmmbuf);
|
||||
ogs_expect_or_return(ngapbuf);
|
||||
|
||||
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
} else if (procedureCode == NGAP_ProcedureCode_id_downlinkNASTransport) {
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
} else
|
||||
ogs_assert_if_reached();
|
||||
}
|
||||
|
||||
void nas_5gs_send_tau_reject(amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t gmm_cause)
|
||||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
/* Build TAU reject */
|
||||
gmmbuf = gmm_build_tau_reject(gmm_cause, amf_ue);
|
||||
ogs_expect_or_return(gmmbuf);
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
|
||||
void nas_5gs_send_cs_service_notification(amf_ue_t *amf_ue)
|
||||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
ogs_debug("CS Service Notification");
|
||||
ogs_debug(" IMSI[%s]", amf_ue->imsi_bcd);
|
||||
|
||||
gmmbuf = gmm_build_cs_service_notification(amf_ue);
|
||||
ogs_expect_or_return(gmmbuf);
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
|
||||
void nas_5gs_send_downlink_nas_transport(
|
||||
amf_ue_t *amf_ue, uint8_t *buffer, uint8_t length)
|
||||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
ogs_assert(buffer);
|
||||
ogs_assert(length);
|
||||
|
||||
ogs_debug("Downlink NAS transport");
|
||||
ogs_debug(" IMSI[%s]", amf_ue->imsi_bcd);
|
||||
|
||||
gmmbuf = gmm_build_downlink_nas_transport(amf_ue, buffer, length);
|
||||
ogs_expect_or_return(gmmbuf);
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -57,38 +57,29 @@ int ngap_send(ogs_sock_t *sock, ogs_pkbuf_t *pkbuf,
|
|||
sent = ogs_sctp_sendmsg(sock, pkbuf->data, pkbuf->len,
|
||||
addr, OGS_SCTP_NGAP_PPID, stream_no);
|
||||
if (sent < 0 || sent != pkbuf->len) {
|
||||
ogs_error("ogs_sctp_sendmsg error (%d:%s)", errno, strerror(errno));
|
||||
ogs_error("ogs_sctp_sendmsg(len:%d,ssn:%d) error (%d:%s)",
|
||||
pkbuf->len, stream_no, errno, strerror(errno));
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
int ngap_send_to_gnb(amf_gnb_t *gnb, ogs_pkbuf_t *pkbuf, uint16_t stream_no)
|
||||
{
|
||||
char buf[OGS_ADDRSTRLEN];
|
||||
int rv;
|
||||
|
||||
ogs_assert(gnb);
|
||||
ogs_assert(pkbuf);
|
||||
ogs_assert(gnb->sock);
|
||||
|
||||
ogs_debug(" IP[%s] RAN_ID[%d]",
|
||||
OGS_ADDR(gnb->addr, buf), gnb->gnb_id);
|
||||
ogs_debug(" IP[%s] RAN_ID[%d]", OGS_ADDR(gnb->addr, buf), gnb->gnb_id);
|
||||
|
||||
rv = ngap_send(gnb->sock, pkbuf,
|
||||
return ngap_send(gnb->sock, pkbuf,
|
||||
gnb->sock_type == SOCK_STREAM ? NULL : gnb->addr,
|
||||
stream_no);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ngap_send() failed");
|
||||
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
ngap_event_push(AMF_EVT_NGAP_LO_CONNREFUSED,
|
||||
gnb->sock, gnb->addr, NULL, 0, 0);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int ngap_send_to_ran_ue(ran_ue_t *ran_ue, ogs_pkbuf_t *pkbuf)
|
||||
|
|
|
@ -288,8 +288,10 @@ int emm_handle_attach_complete(
|
|||
}
|
||||
|
||||
emmbuf = nas_eps_security_encode(mme_ue, &message);
|
||||
if (emmbuf)
|
||||
nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
if (emmbuf) {
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
|
||||
ogs_debug("[EMM] EMM information");
|
||||
ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd);
|
||||
|
|
|
@ -127,17 +127,6 @@ ogs_pkbuf_t *esm_build_activate_default_bearer_context_request(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* CHECK PDN_TYPE */
|
||||
if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
|
||||
/* Nothing */
|
||||
} else if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
|
||||
/* Nothing */
|
||||
} else if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
|
||||
/* Nothing */
|
||||
} else {
|
||||
ogs_error("Unknown PDN Type %u", pdn->paa.pdn_type);
|
||||
}
|
||||
|
||||
ogs_debug("[ESM] Activate default bearer context request");
|
||||
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
||||
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
||||
|
@ -179,17 +168,6 @@ ogs_pkbuf_t *esm_build_activate_default_bearer_context_request(
|
|||
* included in the ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST message.
|
||||
*/
|
||||
|
||||
/* CHECK PDN_TYPE */
|
||||
if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
|
||||
/* Nothing */
|
||||
} else if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
|
||||
/* Nothing */
|
||||
} else if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
|
||||
/* Nothing */
|
||||
} else {
|
||||
ogs_error("Unknown PDN Type %u", pdn->paa.pdn_type);
|
||||
}
|
||||
|
||||
pdn_address->pdn_type = pdn->paa.pdn_type;
|
||||
if (sess->request_type.type == OGS_NAS_EPS_PDN_TYPE_IPV4V6) {
|
||||
if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
|
||||
|
|
|
@ -129,6 +129,7 @@ int esm_handle_information_response(mme_sess_t *sess,
|
|||
|
||||
if (sess->pdn) {
|
||||
ogs_debug(" APN[%s]", sess->pdn->apn);
|
||||
|
||||
if (SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) {
|
||||
mme_csmap_t *csmap = mme_csmap_find_by_tai(&mme_ue->tai);
|
||||
mme_ue->csmap = csmap;
|
||||
|
@ -136,6 +137,20 @@ int esm_handle_information_response(mme_sess_t *sess,
|
|||
if (csmap) {
|
||||
sgsap_send_location_update_request(mme_ue);
|
||||
} else {
|
||||
|
||||
if (sess->pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
|
||||
/* Nothing */
|
||||
} else if (sess->pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
|
||||
/* Nothing */
|
||||
} else if (sess->pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
|
||||
/* Nothing */
|
||||
} else {
|
||||
ogs_error("Unknown PDN Type %u", sess->pdn->paa.pdn_type);
|
||||
nas_eps_send_pdn_connectivity_reject(
|
||||
sess, ESM_CAUSE_UNKNOWN_PDN_TYPE);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
nas_eps_send_attach_accept(mme_ue);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -160,17 +160,6 @@ void mme_s11_handle_create_session_response(
|
|||
pdn = sess->pdn;
|
||||
ogs_assert(pdn);
|
||||
|
||||
/* CHECK PDN_TYPE */
|
||||
if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
|
||||
/* Nothing */
|
||||
} else if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
|
||||
/* Nothing */
|
||||
} else if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
|
||||
/* Nothing */
|
||||
} else {
|
||||
ogs_error("Unknown PDN Type %u", pdn->paa.pdn_type);
|
||||
}
|
||||
|
||||
/* Control Plane(UL) : SGW-S11 */
|
||||
sgw_s11_teid = rsp->sender_f_teid_for_control_plane.data;
|
||||
mme_ue->sgw_s11_teid = ntohl(sgw_s11_teid->teid);
|
||||
|
@ -178,19 +167,6 @@ void mme_s11_handle_create_session_response(
|
|||
memcpy(&pdn->paa, rsp->pdn_address_allocation.data,
|
||||
rsp->pdn_address_allocation.len);
|
||||
|
||||
/* CHECK PDN_TYPE */
|
||||
if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
|
||||
/* Nothing */
|
||||
} else if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
|
||||
/* Nothing */
|
||||
} else if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
|
||||
/* Nothing */
|
||||
} else {
|
||||
ogs_error("Unknown PDN Type %u", pdn->paa.pdn_type);
|
||||
ogs_log_hexdump(OGS_LOG_ERROR,
|
||||
rsp->pdn_address_allocation.data, rsp->pdn_address_allocation.len);
|
||||
}
|
||||
|
||||
/* PCO */
|
||||
if (rsp->protocol_configuration_options.presence) {
|
||||
OGS_TLV_STORE_DATA(&sess->pgw_pco,
|
||||
|
@ -230,19 +206,6 @@ void mme_s11_handle_create_session_response(
|
|||
rv = ogs_gtp_f_teid_to_ip(sgw_s1u_teid, &bearer->sgw_s1u_ip);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
|
||||
/* CHECK PDN_TYPE */
|
||||
if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
|
||||
/* Nothing */
|
||||
} else if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
|
||||
/* Nothing */
|
||||
} else if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
|
||||
/* Nothing */
|
||||
} else {
|
||||
ogs_error("Unknown PDN Type %u", pdn->paa.pdn_type);
|
||||
ogs_log_hexdump(OGS_LOG_ERROR,
|
||||
rsp->pdn_address_allocation.data, rsp->pdn_address_allocation.len);
|
||||
}
|
||||
|
||||
if (SESSION_CONTEXT_IN_ATTACH(sess)) {
|
||||
mme_csmap_t *csmap = mme_csmap_find_by_tai(&mme_ue->tai);
|
||||
mme_ue->csmap = csmap;
|
||||
|
|
|
@ -86,7 +86,6 @@ int nas_eps_send_to_downlink_nas_transport(mme_ue_t *mme_ue, ogs_pkbuf_t *pkbuf)
|
|||
|
||||
rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("nas_eps_send_to_enb() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -144,11 +143,12 @@ void nas_eps_send_attach_reject(mme_ue_t *mme_ue,
|
|||
emmbuf = emm_build_attach_reject(emm_cause, esmbuf);
|
||||
ogs_expect_or_return(emmbuf);
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
|
||||
void nas_eps_send_identity_request(mme_ue_t *mme_ue)
|
||||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *emmbuf = NULL;
|
||||
|
||||
ogs_assert(mme_ue);
|
||||
|
@ -168,7 +168,8 @@ void nas_eps_send_identity_request(mme_ue_t *mme_ue)
|
|||
ogs_timer_start(mme_ue->t3470.timer,
|
||||
mme_timer_cfg(MME_TIMER_T3470)->duration);
|
||||
|
||||
nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
|
||||
void nas_eps_send_authentication_request(
|
||||
|
|
|
@ -58,18 +58,19 @@ int s1ap_send(ogs_sock_t *sock, ogs_pkbuf_t *pkbuf,
|
|||
sent = ogs_sctp_sendmsg(sock, pkbuf->data, pkbuf->len,
|
||||
addr, OGS_SCTP_S1AP_PPID, stream_no);
|
||||
if (sent < 0 || sent != pkbuf->len) {
|
||||
ogs_error("ogs_sctp_sendmsg error (%d:%s)", errno, strerror(errno));
|
||||
ogs_error("ogs_sctp_sendmsg(len:%d,ssn:%d) error (%d:%s)",
|
||||
pkbuf->len, stream_no, errno, strerror(errno));
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
int s1ap_send_to_enb(mme_enb_t *enb, ogs_pkbuf_t *pkbuf, uint16_t stream_no)
|
||||
{
|
||||
char buf[OGS_ADDRSTRLEN];
|
||||
int rv;
|
||||
|
||||
ogs_assert(enb);
|
||||
ogs_assert(pkbuf);
|
||||
|
@ -77,18 +78,9 @@ int s1ap_send_to_enb(mme_enb_t *enb, ogs_pkbuf_t *pkbuf, uint16_t stream_no)
|
|||
|
||||
ogs_debug(" IP[%s] ENB_ID[%d]", OGS_ADDR(enb->addr, buf), enb->enb_id);
|
||||
|
||||
rv = s1ap_send(enb->sock, pkbuf,
|
||||
return s1ap_send(enb->sock, pkbuf,
|
||||
enb->sock_type == SOCK_STREAM ? NULL : enb->addr,
|
||||
stream_no);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_send() failed");
|
||||
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
s1ap_event_push(MME_EVT_S1AP_LO_CONNREFUSED,
|
||||
enb->sock, enb->addr, NULL, 0, 0);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int s1ap_send_to_enb_ue(enb_ue_t *enb_ue, ogs_pkbuf_t *pkbuf)
|
||||
|
|
|
@ -68,11 +68,13 @@ int sgsap_send(ogs_sock_t *sock, ogs_pkbuf_t *pkbuf,
|
|||
sent = ogs_sctp_sendmsg(sock, pkbuf->data, pkbuf->len,
|
||||
addr, OGS_SCTP_SGSAP_PPID, stream_no);
|
||||
if (sent < 0 || sent != pkbuf->len) {
|
||||
ogs_error("ogs_sctp_sendmsg error (%d:%s)", errno, strerror(errno));
|
||||
ogs_error("ogs_sctp_sendmsg(len:%d,ssn:%d) error (%d:%s)",
|
||||
pkbuf->len, stream_no, errno, strerror(errno));
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
|
@ -80,9 +82,7 @@ int sgsap_send_to_vlr_with_sid(
|
|||
mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf, uint16_t stream_no)
|
||||
{
|
||||
char buf[OGS_ADDRSTRLEN];
|
||||
ogs_socknode_t *node = NULL;;
|
||||
ogs_sock_t *sock = NULL;;
|
||||
int rv;
|
||||
|
||||
ogs_assert(vlr);
|
||||
ogs_assert(pkbuf);
|
||||
|
@ -90,16 +90,7 @@ int sgsap_send_to_vlr_with_sid(
|
|||
ogs_assert(sock);
|
||||
|
||||
ogs_debug(" VLR-IP[%s]", OGS_ADDR(vlr->addr, buf));
|
||||
rv = sgsap_send(sock, pkbuf, vlr->addr, stream_no);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("sgsap_send() failed");
|
||||
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
sgsap_event_push(MME_EVT_SGSAP_LO_CONNREFUSED,
|
||||
node->sock, node->addr, NULL, 0, 0);
|
||||
}
|
||||
|
||||
return rv;
|
||||
return sgsap_send(sock, pkbuf, vlr->addr, stream_no);
|
||||
}
|
||||
|
||||
int sgsap_send_to_vlr(mme_ue_t *mme_ue, ogs_pkbuf_t *pkbuf)
|
||||
|
|
|
@ -162,29 +162,6 @@ void smf_gx_handle_cca_initial_request(
|
|||
}
|
||||
|
||||
smf_epc_pfcp_send_session_establishment_request(sess, gtp_xact);
|
||||
|
||||
#if ENABLE_PDN_TYPE_DEBUG
|
||||
if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
|
||||
/* Nothing */
|
||||
} else if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
|
||||
/* Nothing */
|
||||
} else if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
|
||||
/* Nothing */
|
||||
} else {
|
||||
smf_ue_t *smf_ue = NULL;
|
||||
char buf1[OGS_ADDRSTRLEN];
|
||||
char buf2[OGS_ADDRSTRLEN];
|
||||
|
||||
ogs_error("Unknown PDN Type %u", sess->pdn.paa.pdn_type);
|
||||
|
||||
smf_ue = sess->smf_ue;
|
||||
ogs_assert(smf_ue);
|
||||
ogs_error(" UE IMSI:[%s] IPv4:[%s] IPv6:[%s]",
|
||||
smf_ue->imsi_bcd,
|
||||
sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "",
|
||||
sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : "");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void smf_gx_handle_cca_termination_request(
|
||||
|
|
|
@ -91,29 +91,6 @@ ogs_pkbuf_t *smf_n4_build_session_establishment_request(
|
|||
i++;
|
||||
}
|
||||
|
||||
#if ENABLE_PDN_TYPE_DEBUG
|
||||
if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
|
||||
/* Nothing */
|
||||
} else if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
|
||||
/* Nothing */
|
||||
} else if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
|
||||
/* Nothing */
|
||||
} else {
|
||||
smf_ue_t *smf_ue = NULL;
|
||||
char buf1[OGS_ADDRSTRLEN];
|
||||
char buf2[OGS_ADDRSTRLEN];
|
||||
|
||||
ogs_error("Unknown PDN Type %u", sess->pdn.paa.pdn_type);
|
||||
|
||||
smf_ue = sess->smf_ue;
|
||||
ogs_assert(smf_ue);
|
||||
ogs_error(" UE IMSI:[%s] IPv4:[%s] IPv6:[%s]",
|
||||
smf_ue->imsi_bcd,
|
||||
sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "",
|
||||
sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : "");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* PDN Type */
|
||||
req->pdn_type.presence = 1;
|
||||
req->pdn_type.u8 = sess->pdn.paa.pdn_type;
|
||||
|
@ -123,29 +100,6 @@ ogs_pkbuf_t *smf_n4_build_session_establishment_request(
|
|||
|
||||
ogs_pfcp_pdrbuf_clear();
|
||||
|
||||
#if ENABLE_PDN_TYPE_DEBUG
|
||||
if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
|
||||
/* Nothing */
|
||||
} else if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
|
||||
/* Nothing */
|
||||
} else if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
|
||||
/* Nothing */
|
||||
} else {
|
||||
smf_ue_t *smf_ue = NULL;
|
||||
char buf1[OGS_ADDRSTRLEN];
|
||||
char buf2[OGS_ADDRSTRLEN];
|
||||
|
||||
ogs_error("Unknown PDN Type %u", sess->pdn.paa.pdn_type);
|
||||
|
||||
smf_ue = sess->smf_ue;
|
||||
ogs_assert(smf_ue);
|
||||
ogs_error(" UE IMSI:[%s] IPv4:[%s] IPv6:[%s]",
|
||||
smf_ue->imsi_bcd,
|
||||
sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "",
|
||||
sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : "");
|
||||
}
|
||||
#endif
|
||||
|
||||
return pkbuf;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,29 +75,6 @@ ogs_pkbuf_t *smf_s5c_build_create_session_response(
|
|||
rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface.
|
||||
len = len;
|
||||
|
||||
#if ENABLE_PDN_TYPE_DEBUG
|
||||
if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
|
||||
/* Nothing */
|
||||
} else if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
|
||||
/* Nothing */
|
||||
} else if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
|
||||
/* Nothing */
|
||||
} else {
|
||||
smf_ue_t *smf_ue = NULL;
|
||||
char buf1[OGS_ADDRSTRLEN];
|
||||
char buf2[OGS_ADDRSTRLEN];
|
||||
|
||||
ogs_error("Unknown PDN Type %u", sess->pdn.paa.pdn_type);
|
||||
|
||||
smf_ue = sess->smf_ue;
|
||||
ogs_assert(smf_ue);
|
||||
ogs_error(" UE IMSI:[%s] IPv4:[%s] IPv6:[%s]",
|
||||
smf_ue->imsi_bcd,
|
||||
sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "",
|
||||
sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : "");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* PDN Address Allocation */
|
||||
rsp->pdn_address_allocation.data = &sess->pdn.paa;
|
||||
if (sess->ipv4 && sess->ipv6)
|
||||
|
|
Loading…
Reference in New Issue