gprs_gmm: introduce a GMM Attach Request FSM
The old GMM Attach Request handling used a recursive function
which can not handle certain states and is quite complex and hard to
extend.
The new FSM handles such request in a FSM and can be called multiple
times.
Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912
diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c
index d8bca85..977ae48 100644
--- a/src/gprs/gprs_sgsn.c
+++ b/src/gprs/gprs_sgsn.c
@@ -40,6 +40,7 @@
#include <osmocom/sgsn/gprs_gmm.h>
#include <osmocom/sgsn/gprs_utils.h>
#include <osmocom/sgsn/signal.h>
+#include <osmocom/sgsn/gprs_gmm_attach.h>
#include <osmocom/sgsn/gprs_llc.h>
#include <pdp.h>
@@ -241,6 +242,7 @@
talloc_free(ctx);
return NULL;
}
+ ctx->gmm_att_req.fsm = osmo_fsm_inst_alloc(&gmm_attach_req_fsm, ctx, ctx, LOGL_DEBUG, "gb_gmm_req");
INIT_LLIST_HEAD(&ctx->pdp_list);
llist_add(&ctx->list, &sgsn_mm_ctxts);
@@ -273,6 +275,7 @@
talloc_free(ctx);
return NULL;
}
+ ctx->gmm_att_req.fsm = osmo_fsm_inst_alloc(&gmm_attach_req_fsm, ctx, ctx, LOGL_DEBUG, "gb_gmm_req");
/* Need to get RAID from IU conn */
ctx->ra = ctx->iu.ue_ctx->ra_id;
@@ -350,6 +353,9 @@
gprs_subscr_put(subscr);
}
+ if (mm->gmm_att_req.fsm)
+ gmm_att_req_free(mm);
+
sgsn_mm_ctx_free(mm);
mm = NULL;