Skip to content

Commit

Permalink
[mme] handle second s1ap setup as reset (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
spencersevilla committed Mar 7, 2024
1 parent 1f418f2 commit d876379
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/gtp/xact.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ typedef struct ogs_gtp_xact_s {
#define OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_LO_CONNREFUSED 2
#define OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_RESET_ALL 3
#define OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_RESET_PARTIAL 4
#define OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_S1_SETUPREQ 5
int release_action;

#define OGS_GTP_DELETE_INDIRECT_HANDOVER_COMPLETE 1
Expand Down
6 changes: 4 additions & 2 deletions src/mme/mme-gtp-path.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ void mme_gtp_send_release_all_ue_in_enb(mme_enb_t *enb, int action)
mme_ue = enb_ue->mme_ue;

if (mme_ue) {
if (action == OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_LO_CONNREFUSED) {
if (action == OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_LO_CONNREFUSED ||
action == OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_S1_SETUPREQ) {
/*
* https://github.com/open5gs/open5gs/pull/1497
*
Expand Down Expand Up @@ -585,7 +586,8 @@ void mme_gtp_send_release_all_ue_in_enb(mme_enb_t *enb, int action)
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id, action);

if (action == OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_LO_CONNREFUSED ||
action == OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_RESET_ALL) {
action == OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_RESET_ALL ||
action == OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_S1_SETUPREQ) {
enb_ue_remove(enb_ue);
} else {
/* At this point, it does not support other action */
Expand Down
3 changes: 2 additions & 1 deletion src/mme/mme-s11-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,8 @@ void mme_s11_handle_release_access_bearers_response(
} else {
ogs_error("ENB-S1 Context has already been removed");
}
} else if (action == OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_LO_CONNREFUSED) {
} else if (action == OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_LO_CONNREFUSED ||
action == OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_S1_SETUPREQ) {
/* enb_ue_unlink() and enb_ue_remove() has already been executed.
* So, there is no `enb_ue` context */

Expand Down
10 changes: 10 additions & 0 deletions src/mme/s1ap-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,17 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, ogs_s1ap_message_t *message)

stats_update_mme_enbs();

if (enb->state.s1_setup_success == true) {
// we have already associated with this eNB in the past, so
// something happened. Per 36.413.8.7.3.1 we need to clear
// all associated UE contexts similar to a Reset procedure.
ogs_warn("eNB was previously associated. Clearing all associated UE contexts.");

mme_gtp_send_release_all_ue_in_enb(
enb, OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_S1_SETUPREQ);
}
enb->state.s1_setup_success = true;

r = s1ap_send_s1_setup_response(enb);
ogs_expect(r == OGS_OK);
ogs_assert(r != OGS_ERROR);
Expand Down

0 comments on commit d876379

Please sign in to comment.