fix some PFCP peer,session error handling paths

Fix various failures to return and/or discard a session on PFCP message
errors.

Change-Id: I12650037c7c74d98e1f33e0379cf91edcbd02d1a
This commit is contained in:
Neels Hofmeyr 2023-02-08 23:54:02 +01:00
parent 374fd1eab4
commit 4e2b367d89
2 changed files with 17 additions and 2 deletions

View File

@ -327,6 +327,8 @@ nack_response:
.cause = cause,
};
osmo_pfcp_endpoint_tx(peer->up_endpoint->pfcp_ep, resp);
if (session)
up_session_discard(session);
}
static void up_peer_not_associated_action(struct osmo_fsm_inst *fi, uint32_t event, void *data)

View File

@ -631,14 +631,20 @@ static void up_session_est(struct up_session *session, struct osmo_pfcp_msg *m)
resp->up_f_seid_present = true;
rc = osmo_pfcp_endpoint_tx(peer->up_endpoint->pfcp_ep, tx);
if (rc)
if (rc) {
/* sending ACK failed, discard session. It might seem like a good idea to keep the session around,
* because the creation succeeded, only the ACK failed. But in the greater scheme of things, if we
* cannot ACK to the PFCP peer, all is lost. Rather not keep stale sessions around. */
up_session_fsm_state_chg(UP_SESSION_ST_WAIT_USE_COUNT);
return;
}
up_session_fsm_state_chg(UP_SESSION_ST_ESTABLISHED);
return;
nack_response:
resp->created_pdr_count = 0;
osmo_pfcp_endpoint_tx(peer->up_endpoint->pfcp_ep, tx);
/* No matter if sending the NACK succeeded or not, discard the session. */
up_session_fsm_state_chg(UP_SESSION_ST_WAIT_USE_COUNT);
}
@ -719,8 +725,13 @@ static void up_session_mod(struct up_session *session, struct osmo_pfcp_msg *m)
goto nack_response;
/* Success, send ACK */
if (osmo_pfcp_endpoint_tx(peer->up_endpoint->pfcp_ep, tx))
if (osmo_pfcp_endpoint_tx(peer->up_endpoint->pfcp_ep, tx)) {
/* sending ACK failed, discard session. It might seem like a good idea to keep the session around,
* because the modification succeeded, only the ACK failed. But in the greater scheme of things, if we
* cannot ACK to the PFCP peer, all is lost. Rather not keep stale sessions around. */
up_session_fsm_state_chg(UP_SESSION_ST_WAIT_USE_COUNT);
return;
}
LOGPFSML(fi, LOGL_NOTICE, "Session modified: %s\n", up_session_gtp_status(session));
return;
@ -728,6 +739,7 @@ static void up_session_mod(struct up_session *session, struct osmo_pfcp_msg *m)
nack_response:
resp->created_pdr_count = 0;
osmo_pfcp_endpoint_tx(peer->up_endpoint->pfcp_ep, tx);
/* No matter if sending the NACK succeeded or not, discard the session. */
up_session_fsm_state_chg(UP_SESSION_ST_WAIT_USE_COUNT);
}
@ -742,6 +754,7 @@ static void up_session_del(struct up_session *session, struct osmo_pfcp_msg *m)
.cause = OSMO_PFCP_CAUSE_REQUEST_ACCEPTED
};
osmo_pfcp_endpoint_tx(peer->up_endpoint->pfcp_ep, tx);
/* No matter if sending the deletion ACK succeeded or not, discard the session. */
up_session_fsm_state_chg(UP_SESSION_ST_WAIT_USE_COUNT);
}