forked from acouzens/open5gs
Fixed security vulnerability for malformed packet
This commit is contained in:
parent
b116f077a5
commit
5764f7267d
|
@ -259,12 +259,22 @@ void s1ap_handle_initial_ue_message(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
|||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
||||
if (!enb_ue) {
|
||||
enb_ue = enb_ue_add(enb, *ENB_UE_S1AP_ID);
|
||||
|
@ -453,6 +463,24 @@ void s1ap_handle_uplink_nas_transport(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -474,15 +502,6 @@ void s1ap_handle_uplink_nas_transport(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
||||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
||||
|
||||
|
@ -602,6 +621,24 @@ void s1ap_handle_ue_capability_info_indication(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -623,15 +660,6 @@ void s1ap_handle_ue_capability_info_indication(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
||||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
||||
|
||||
|
@ -692,6 +720,24 @@ void s1ap_handle_initial_context_setup_response(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -713,15 +759,6 @@ void s1ap_handle_initial_context_setup_response(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
||||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
||||
|
||||
|
@ -863,6 +900,24 @@ void s1ap_handle_initial_context_setup_failure(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -884,15 +939,6 @@ void s1ap_handle_initial_context_setup_failure(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
||||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
||||
|
||||
|
@ -978,6 +1024,24 @@ void s1ap_handle_ue_context_modification_response(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -999,15 +1063,6 @@ void s1ap_handle_ue_context_modification_response(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
||||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
||||
|
||||
|
@ -1069,6 +1124,24 @@ void s1ap_handle_ue_context_modification_failure(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -1090,15 +1163,6 @@ void s1ap_handle_ue_context_modification_failure(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
||||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
||||
|
||||
|
@ -1182,6 +1246,24 @@ void s1ap_handle_e_rab_setup_response(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -1203,15 +1285,6 @@ void s1ap_handle_e_rab_setup_response(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
||||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
||||
|
||||
|
@ -1388,6 +1461,24 @@ void s1ap_handle_ue_context_release_request(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -1485,6 +1576,24 @@ void s1ap_handle_ue_context_release_complete(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -1710,6 +1819,24 @@ void s1ap_handle_e_rab_modification_indication(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -1731,15 +1858,6 @@ void s1ap_handle_e_rab_modification_indication(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
||||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
||||
|
||||
|
@ -1996,12 +2114,22 @@ void s1ap_handle_path_switch_request(
|
|||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -2458,6 +2586,24 @@ void s1ap_handle_handover_required(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -2479,15 +2625,6 @@ void s1ap_handle_handover_required(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
||||
source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id);
|
||||
|
||||
|
@ -2602,6 +2739,24 @@ void s1ap_handle_handover_request_ack(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -2623,15 +2778,6 @@ void s1ap_handle_handover_request_ack(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!E_RABAdmittedList) {
|
||||
ogs_error("No E_RABAdmittedList");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
|
@ -2927,6 +3073,24 @@ void s1ap_handle_handover_cancel(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -2948,15 +3112,6 @@ void s1ap_handle_handover_cancel(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Cause) {
|
||||
ogs_error("No Cause");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
|
@ -3040,6 +3195,30 @@ void s1ap_handle_enb_status_transfer(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
|
||||
/*
|
||||
* The test code is using this problem,
|
||||
* so we use WARN here instead of ERROR.
|
||||
*/
|
||||
ogs_warn("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -3061,15 +3240,6 @@ void s1ap_handle_enb_status_transfer(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ENB_StatusTransfer_TransparentContainer) {
|
||||
ogs_error("No ENB_StatusTransfer_TransparentContainer");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
|
@ -3158,6 +3328,24 @@ void s1ap_handle_handover_notification(
|
|||
ogs_debug(" IP[%s] ENB_ID[%d]",
|
||||
OGS_ADDR(enb->sctp.addr, buf), enb->enb_id);
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ENB_UE_S1AP_ID > 0x00ffffff) {
|
||||
ogs_error("Invalid ENB_UE_S1AP_ID [%lx]", *ENB_UE_S1AP_ID);
|
||||
r = s1ap_send_error_indication(enb, NULL, NULL,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_S1AP_ID) {
|
||||
ogs_error("No MME_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
|
||||
|
@ -3179,15 +3367,6 @@ void s1ap_handle_handover_notification(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ENB_UE_S1AP_ID) {
|
||||
ogs_error("No ENB_UE_S1AP_ID");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EUTRAN_CGI) {
|
||||
ogs_error("No EUTRAN_CGI");
|
||||
r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
||||
|
|
|
@ -28,6 +28,7 @@ abts_suite *test_emm_status(abts_suite *suite);
|
|||
abts_suite *test_ue_context(abts_suite *suite);
|
||||
abts_suite *test_reset(abts_suite *suite);
|
||||
abts_suite *test_issues(abts_suite *suite);
|
||||
abts_suite *test_crash(abts_suite *suite);
|
||||
|
||||
const struct testlist {
|
||||
abts_suite *(*func)(abts_suite *suite);
|
||||
|
@ -41,6 +42,7 @@ const struct testlist {
|
|||
{test_ue_context},
|
||||
{test_reset},
|
||||
{test_issues},
|
||||
{test_crash},
|
||||
{NULL},
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* Copyright (C) 2023 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-common.h"
|
||||
|
||||
static void test1_func(abts_case *tc, void *data)
|
||||
{
|
||||
int rv;
|
||||
ogs_socknode_t *s1ap;
|
||||
ogs_pkbuf_t *sendbuf;
|
||||
ogs_pkbuf_t *recvbuf;
|
||||
|
||||
s1ap = tests1ap_client(AF_INET);
|
||||
ABTS_PTR_NOTNULL(tc, s1ap);
|
||||
|
||||
sendbuf = test_s1ap_build_malformed_s1_setup_request(0);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
|
||||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
recvbuf = testenb_s1ap_read(s1ap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
testenb_s1ap_close(s1ap);
|
||||
}
|
||||
|
||||
static void test2_func(abts_case *tc, void *data)
|
||||
{
|
||||
int rv;
|
||||
ogs_socknode_t *s1ap;
|
||||
ogs_pkbuf_t *sendbuf;
|
||||
ogs_pkbuf_t *recvbuf = NULL;
|
||||
ogs_s1ap_message_t message;
|
||||
int i;
|
||||
|
||||
s1ap = tests1ap_client(AF_INET);
|
||||
ABTS_PTR_NOTNULL(tc, s1ap);
|
||||
|
||||
sendbuf = test_s1ap_build_s1_setup_request(
|
||||
S1AP_ENB_ID_PR_macroENB_ID, 0x54f64);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
|
||||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
recvbuf = testenb_s1ap_read(s1ap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
sendbuf = test_s1ap_build_malformed_enb_status_transfer(0);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
|
||||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
recvbuf = testenb_s1ap_read(s1ap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
testenb_s1ap_close(s1ap);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void test3_func(abts_case *tc, void *data)
|
||||
{
|
||||
int rv;
|
||||
ogs_socknode_t *s1ap;
|
||||
ogs_pkbuf_t *sendbuf;
|
||||
ogs_pkbuf_t *recvbuf;
|
||||
|
||||
s1ap = tests1ap_client(AF_INET);
|
||||
ABTS_PTR_NOTNULL(tc, s1ap);
|
||||
|
||||
sendbuf = test_s1ap_build_oversized_message(0);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
|
||||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
recvbuf = testenb_s1ap_read(s1ap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
testenb_s1ap_close(s1ap);
|
||||
}
|
||||
#endif
|
||||
|
||||
abts_suite *test_crash(abts_suite *suite)
|
||||
{
|
||||
suite = ADD_SUITE(suite)
|
||||
|
||||
abts_run_test(suite, test1_func, NULL);
|
||||
abts_run_test(suite, test2_func, NULL);
|
||||
#if 0
|
||||
abts_run_test(suite, test3_func, NULL);
|
||||
#endif
|
||||
|
||||
return suite;
|
||||
}
|
|
@ -26,6 +26,7 @@ testapp_attach_sources = files('''
|
|||
reset-test.c
|
||||
ue-context-test.c
|
||||
issues-test.c
|
||||
crash-test.c
|
||||
'''.split())
|
||||
|
||||
testapp_attach_exe = executable('attach',
|
||||
|
|
|
@ -97,36 +97,12 @@ static void s1setup_test2(abts_case *tc, void *data)
|
|||
}
|
||||
}
|
||||
|
||||
static void s1setup_test3(abts_case *tc, void *data)
|
||||
{
|
||||
int rv;
|
||||
ogs_socknode_t *s1ap;
|
||||
ogs_pkbuf_t *sendbuf;
|
||||
ogs_pkbuf_t *recvbuf;
|
||||
|
||||
s1ap = tests1ap_client(AF_INET);
|
||||
ABTS_PTR_NOTNULL(tc, s1ap);
|
||||
|
||||
sendbuf = test_s1ap_build_invalid_packet(0);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
|
||||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
recvbuf = testenb_s1ap_read(s1ap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
testenb_s1ap_close(s1ap);
|
||||
}
|
||||
|
||||
abts_suite *test_s1setup(abts_suite *suite)
|
||||
{
|
||||
suite = ADD_SUITE(suite)
|
||||
|
||||
abts_run_test(suite, s1setup_test1, NULL);
|
||||
abts_run_test(suite, s1setup_test2, NULL);
|
||||
abts_run_test(suite, s1setup_test3, NULL);
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -66,9 +66,13 @@ ogs_pkbuf_t *test_s1ap_build_handover_cancel(test_ue_t *test_ue,
|
|||
ogs_pkbuf_t *test_s1ap_build_handover_failure(test_ue_t *test_ue,
|
||||
S1AP_Cause_PR group, long cause);
|
||||
|
||||
ogs_pkbuf_t *test_s1ap_build_invalid_packet(int i);
|
||||
ogs_pkbuf_t *test_s1ap_build_enb_configuration_transfer(int i);
|
||||
|
||||
ogs_pkbuf_t *test_s1ap_build_malformed_s1_setup_request(int i);
|
||||
ogs_pkbuf_t *test_s1ap_build_malformed_enb_status_transfer(int i);
|
||||
ogs_pkbuf_t *test_s1ap_build_malformed_e_rab_modification_indication(int i);
|
||||
ogs_pkbuf_t *test_s1ap_build_oversized_message(int i);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue