pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/32485 )
Change subject: sm: Destroy PDP Context if activation fails ......................................................................
sm: Destroy PDP Context if activation fails
There's no use in keeping them in inactive state. This allows upper layers recreating them upon next SMREG-PDP_ACT.req.
Change-Id: Ic9f9ae3becb0c26a55a3b08959a00a7df0bdb5b2 --- M src/sm/sm_ms_fsm.c 1 file changed, 20 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/src/sm/sm_ms_fsm.c b/src/sm/sm_ms_fsm.c index 297e81c..14f5ee7 100644 --- a/src/sm/sm_ms_fsm.c +++ b/src/sm/sm_ms_fsm.c @@ -41,6 +41,13 @@ #define sm_ms_fsm_state_chg(fi, NEXT_STATE) \ osmo_tdef_fsm_inst_state_chg(fi, NEXT_STATE, sm_ms_fsm_timeouts, g_sm_ctx->T_defs, -1)
+static void st_sm_ms_pdp_inactive_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + /* PDP became inactive, there's no use in keeping it */ + struct gprs_sm_ms_fsm_ctx *ctx = (struct gprs_sm_ms_fsm_ctx *)fi->priv; + gprs_sm_entity_free(ctx->sme); +} + static void st_sm_ms_pdp_inactive(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { @@ -176,6 +183,7 @@ .out_state_mask = X(GPRS_SM_MS_ST_PDP_ACTIVE_PENDING), .name = "INACTIVE", + .onenter = st_sm_ms_pdp_inactive_on_enter, .action = st_sm_ms_pdp_inactive, }, [GPRS_SM_MS_ST_PDP_ACTIVE_PENDING] = {