Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9257 ) Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/Makefile.am M include/osmocom/sgsn/gprs_gmm.h A include/osmocom/sgsn/gprs_gmm_attach.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 9 files changed, 494 insertions(+), 9 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/sgsn/Makefile.am b/include/osmocom/sgsn/Makefile.am index 269cebc..3b563c4 100644 --- a/include/osmocom/sgsn/Makefile.am +++ b/include/osmocom/sgsn/Makefile.am @@ -5,6 +5,7 @@ gb_proxy.h \ gprs_gb_parse.h \ gprs_gmm.h \ + gprs_gmm_attach.h \ gprs_llc.h \ gprs_llc_xid.h \ gprs_sgsn.h \ diff --git a/include/osmocom/sgsn/gprs_gmm.h b/include/osmocom/sgsn/gprs_gmm.h index d12eaf9..ffcebd3 100644 --- a/include/osmocom/sgsn/gprs_gmm.h +++ b/include/osmocom/sgsn/gprs_gmm.h @@ -40,6 +40,8 @@ uint8_t gmm_cause); int gsm48_tx_gmm_att_ack(struct sgsn_mm_ctx *mm); +int gprs_gmm_attach_req_ies(struct msgb *a, struct msgb *b); + /* TODO: move extract_subscr_* when gsm48_gmm_authorize() got removed */ void extract_subscr_msisdn(struct sgsn_mm_ctx *ctx); void extract_subscr_hlr(struct sgsn_mm_ctx *ctx); diff --git a/include/osmocom/sgsn/gprs_gmm_attach.h b/include/osmocom/sgsn/gprs_gmm_attach.h new file mode 100644 index 000..22fbd6f --- /dev/null +++ b/include/osmocom/sgsn/gprs_gmm_attach.h @@ -0,0 +1,37 @@ +#ifndef GPRS_GMM_ATTACH_H +#define GPRS_GMM_ATTACH_H + +#include + +struct sgsn_mm_ctx; + +enum gmm_attach_req_fsm_states { + ST_INIT, + ST_IDENTIY, + ST_RETRIEVE_AUTH, + ST_AUTH, + ST_ASK_VLR, + ST_ACCEPT, + ST_REJECT +}; + +enum gmm_attach_req_fsm_events { + E_ATTACH_REQ_RECV, + E_IDEN_RESP_RECV, + E_AUTH_RESP_RECV_SUCCESS, + E_AUTH_RESP_RECV_RESYNC, + E_ATTACH_ACCEPTED, + E_ATTACH_ACCEPT_SENT, + E_ATTACH_COMPLETE_RECV, + E_REJECT, + E_VLR_ANSWERED, +}; + +#define GMM_DISCARD_MS_WITHOUT_REJECT -1 + +extern const struct value_string gmm_attach_req_fsm_event_names[]; +extern struct osmo_fsm gmm_attach_req_fsm; + +void gmm_att_req_free(struct sgsn_mm_ctx *mm); + +#endif // GPRS_GMM_ATTACH_H diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h index 6f16dc7..a5ca959 100644 --- a/include/osmocom/sgsn/gprs_sgsn.h +++ b/include/osmocom/sgsn/gprs_sgsn.h @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -168,6 +169,15 @@ struct ranap_ue_conn_ctx*ue_ctx; struct service_info service; } iu; + struct { + struct osmo_fsm_inst *fsm; + + /* when a second attach req arrives while in this procedure, +* the fsm needs to compare it against old to decide what to do */ + struct msgb *attach_req; + uint32_t id_type; + bool auth_reattempt; + } gmm_att_req; /* VLR number */ uint32_tnew_sgsn_addr; /* Authentication Triplet */ diff --git a/src/gprs/Makefile.am b/src/gprs/Makefile.am index 46d94d4..0f7c5fa 100644 --- a/src/gprs/Makefile.am +++ b/src/gprs/Makefile.am @@ -59,6 +59,7 @@ $(NULL) osmo_sgsn_SOURCES = \ + gprs_gmm_attach.c \ gprs_gmm.c \ gprs_sgsn.c \ gprs_sndcp.c \ diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c index bea63dc..a363c70 100644 --- a/src/gprs/gprs_gmm.c +++ b/src/gprs/gprs_gmm.c @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -791,7 +792,7 @@ /* FIXME: enable LLC cipheirng */ /* Check if we can let the mobile station enter */ - return gsm48_gmm_authorize(ctx); + return osmo_fsm_inst_dispatch(ctx->gmm_att_req.fsm, E_AUTH_RESP_RECV_SUCCESS, NULL); } /* Section 9.4.10: Authentication and Ciphering Failure */ @@ -836,7 +837,7 @@ rc = gprs_subscr_request_auth_info(ctx, auts, ctx->auth_triplet.vec.rand); if (!rc) - return 0; + return osmo_fsm_inst_dispatch(ctx->gmm_att_req.fsm, E_AUTH_RESP_RECV_RESYNC, NULL); /* on error, fall through to send a reject */
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/9257 ) Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. Patch Set 16: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 16 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: lynxis lazus Gerrit-Comment-Date: Thu, 13 Sep 2018 13:50:40 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#16). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/Makefile.am M include/osmocom/sgsn/gprs_gmm.h A include/osmocom/sgsn/gprs_gmm_attach.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 9 files changed, 494 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/16 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 16 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
lynxis lazus has posted comments on this change. ( https://gerrit.osmocom.org/9257 ) Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. Patch Set 15: (1 comment) https://gerrit.osmocom.org/#/c/9257/15/include/osmocom/sgsn/gprs_gmm_attach.h File include/osmocom/sgsn/gprs_gmm_attach.h: https://gerrit.osmocom.org/#/c/9257/15/include/osmocom/sgsn/gprs_gmm_attach.h@8 PS15, Line 8: enum gmm_attach_req_fsm_states { > if those states are modelled after any spec reference, it might be useful to > document it here in a c […] I'ven't found FSM in the spec for the attach request. -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 15 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: lynxis lazus Gerrit-Comment-Date: Tue, 11 Sep 2018 16:31:49 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/9257 ) Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. Patch Set 15: Code-Review+1 (3 comments) https://gerrit.osmocom.org/#/c/9257/15/include/osmocom/sgsn/gprs_gmm_attach.h File include/osmocom/sgsn/gprs_gmm_attach.h: https://gerrit.osmocom.org/#/c/9257/15/include/osmocom/sgsn/gprs_gmm_attach.h@8 PS15, Line 8: enum gmm_attach_req_fsm_states { if those states are modelled after any spec reference, it might be useful to document it here in a comment. https://gerrit.osmocom.org/#/c/9257/15/src/gprs/gprs_gmm_attach.c File src/gprs/gprs_gmm_attach.c: https://gerrit.osmocom.org/#/c/9257/15/src/gprs/gprs_gmm_attach.c@2 PS15, Line 2: please put the usual license header on top o the file, simply copying it from a neighboring file https://gerrit.osmocom.org/#/c/9257/15/src/gprs/gprs_gmm_attach.c@387 PS15, Line 387: static __attribute__((constructor)) void l2tp_fsm_init(void) l2tp ? -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 15 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: lynxis lazus Gerrit-Comment-Date: Tue, 04 Sep 2018 17:30:49 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#15). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/Makefile.am M include/osmocom/sgsn/gprs_gmm.h A include/osmocom/sgsn/gprs_gmm_attach.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 9 files changed, 494 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/15 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 15 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#14). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/Makefile.am M include/osmocom/sgsn/gprs_gmm.h A include/osmocom/sgsn/gprs_gmm_attach.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 9 files changed, 494 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/14 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 14 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#13). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/Makefile.am M include/osmocom/sgsn/gprs_gmm.h A include/osmocom/sgsn/gprs_gmm_attach.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 9 files changed, 489 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/13 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 13 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
lynxis lazus has posted comments on this change. ( https://gerrit.osmocom.org/9257 ) Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. Patch Set 12: Code-Review-1 (3 comments) missing UMTS_RESYNC https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.c File src/gprs/gprs_gmm_attach.c: https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.c@143 PS1, Line 143: /* network failure */ > this appears that UMTS AKA is not working with this new FSM? Was it also > broken before this FSM? I […] I talked to neels about this. I'll implemented this. https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.c@155 PS1, Line 155: struct sgsn_mm_ctx *ctx = fi->priv; > do we want to silently ignore any other events? In other FSMs we explicitly > OSMO_ASSERT() on any un […] It's possible to get other events in case of packet lost. If we get a doublicated event, we can ignore it, because the timeout will resent the packet anyway. https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.c@175 PS1, Line 175: { > does this mean you're not supporting disabling or enabling of P-TMSI > allocation? I believe it shoul […] It's working in the same way, if PTMSI_ALLOC is defined. I haven't implement the other leg, because the code looked weired and I expected it wasn't used anymore. -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 12 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: lynxis lazus Gerrit-Comment-Date: Tue, 28 Aug 2018 13:54:18 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#12). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/Makefile.am M include/osmocom/sgsn/gprs_gmm.h A include/osmocom/sgsn/gprs_gmm_attach.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 9 files changed, 475 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/12 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 12 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#10). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/Makefile.am M include/osmocom/sgsn/gprs_gmm.h A include/osmocom/sgsn/gprs_gmm_attach.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 9 files changed, 475 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/10 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 10 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#9). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/Makefile.am M include/osmocom/sgsn/gprs_gmm.h A include/osmocom/sgsn/gprs_gmm_attach.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 9 files changed, 475 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/9 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 9 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#8). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/gprs_gmm.h A include/osmocom/sgsn/gprs_gmm_attach.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 8 files changed, 474 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/8 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 8 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#7). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/gprs_gmm.h A include/osmocom/sgsn/gprs_gmm_attach.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 8 files changed, 475 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/7 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 7 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#6). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/gprs_gmm.h A include/osmocom/sgsn/gprs_gmm_attach.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 8 files changed, 475 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/6 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 6 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#5). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/gprs_gmm.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c A src/gprs/gprs_gmm_attach.h M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 8 files changed, 475 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/5 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 5 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#4). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/gprs_gmm.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c A src/gprs/gprs_gmm_attach.h M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 8 files changed, 475 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/4 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 4 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9257 to look at the new patch set (#2). Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/gprs_gmm.h M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c A src/gprs/gprs_gmm_attach.h M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 8 files changed, 476 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/2 -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 2 Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/9257 ) Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. Patch Set 1: Code-Review-1 (9 comments) https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.h File src/gprs/gprs_gmm_attach.h: https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.h@7 PS1, Line 7:ST_INIT, the states might warrant some more documentation/explanation in comments here https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.h@17 PS1, Line 17: E_ATTACH_REQ_RECV, same goes for the events here. The *_RECV and *_SENT are pretty lcear, but the others might not be? https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.c File src/gprs/gprs_gmm_attach.c: https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.c@10 PS1, Line 10: extern const struct value_string gmm_attach_req_fsm_event_names[]; why declare the fsm and the event_names here? Are they used anywhere in the filbe before they are defined further down? https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.c@71 PS1, Line 71: /* check if we received a identity response */ you don't have a switch statement or an OSMO_ASSERT on the "event" which mgiht be dangerous as the FSM definition might be edited in the future and this code implicitly assumes only a single event may arrive here? https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.c@89 PS1, Line 89: if (type == GSM_MI_TYPE_IMEI && !strlen(ctx->imsi)) { no tab here https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.c@143 PS1, Line 143: /* FIXME!! */ this appears that UMTS AKA is not working with this new FSM? Was it also broken before this FSM? In that case: We cannot afford to introduce known regression. https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.c@155 PS1, Line 155: } do we want to silently ignore any other events? In other FSMs we explicitly OSMO_ASSERT() on any unexpecte events here. Same applies to all other state handling functiosn. https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.c@175 PS1, Line 175: /* TODO: #ifdef ! PTMSI_ALLOC is not supported */ does this mean you're not supporting disabling or enabling of P-TMSI allocation? I believe it should be enabled at all times these days, the #define was just a hack to disable it for debugging? https://gerrit.osmocom.org/#/c/9257/1/src/gprs/gprs_gmm_attach.c@222 PS1, Line 222: .name = "Ask the hlr about the MS", please use shorter more symbolic names, possibly even "ST_ASK_VLR" here. This is used heavily in logging and also in the CTRL interface, not sure spaces are even permitted... -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazusGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus Gerrit-Comment-Date: Wed, 23 May 2018 16:19:48 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
lynxis lazus has posted comments on this change. ( https://gerrit.osmocom.org/9257 ) Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. Patch Set 1: the failing tests are related to the changes. I would recommend removing the unit tests, because ttcn3 is testing the same and is much more maintainable and debug'able. -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazusGerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus Gerrit-Comment-Date: Wed, 23 May 2018 00:44:46 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
lynxis lazus has posted comments on this change. ( https://gerrit.osmocom.org/9257 ) Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. Set Ready For Review -- To view, visit https://gerrit.osmocom.org/9257 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I58b9c17be9776a03bb2a5b21e99135cfefc8c912 Gerrit-Change-Number: 9257 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazusGerrit-Reviewer: Jenkins Builder Gerrit-Comment-Date: Wed, 23 May 2018 00:44:13 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-sgsn[master]: gprs_gmm: introduce a GMM Attach Request FSM
lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/9257 Change subject: gprs_gmm: introduce a GMM Attach Request FSM .. 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 --- M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/Makefile.am M src/gprs/gprs_gmm.c A src/gprs/gprs_gmm_attach.c A src/gprs/gprs_gmm_attach.h M src/gprs/gprs_sgsn.c M tests/sgsn/Makefile.am 7 files changed, 404 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/57/9257/1 diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h index 64e5619..2a01a99 100644 --- a/include/osmocom/sgsn/gprs_sgsn.h +++ b/include/osmocom/sgsn/gprs_sgsn.h @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -168,6 +169,8 @@ struct ranap_ue_conn_ctx*ue_ctx; struct service_info service; } iu; + struct osmo_fsm_inst *gmm_att_req_fsm; + uint32_t gmm_att_identy_type; /* VLR number */ uint32_tnew_sgsn_addr; /* Authentication Triplet */ diff --git a/src/gprs/Makefile.am b/src/gprs/Makefile.am index 4c7f730..aa6b08c 100644 --- a/src/gprs/Makefile.am +++ b/src/gprs/Makefile.am @@ -58,6 +58,7 @@ $(NULL) osmo_sgsn_SOURCES = \ + gprs_gmm_attach.c \ gprs_gmm.c \ gprs_sgsn.c \ gprs_sndcp.c \ diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c index 57d3883..4236870 100644 --- a/src/gprs/gprs_gmm.c +++ b/src/gprs/gprs_gmm.c @@ -64,6 +64,8 @@ #include +#include "gprs_gmm_attach.h" + #define PTMSI_ALLOC extern struct sgsn_instance *sgsn; @@ -791,7 +793,7 @@ /* FIXME: enable LLC cipheirng */ /* Check if we can let the mobile station enter */ - return gsm48_gmm_authorize(ctx); + return osmo_fsm_inst_dispatch(ctx->gmm_att_req_fsm, E_AUTH_RESP_RECV, NULL); } /* Section 9.4.10: Authentication and Ciphering Failure */ @@ -1107,7 +1109,10 @@ { ctx->sec_ctx = OSMO_AUTH_TYPE_NONE; - gsm48_gmm_authorize(ctx); + if (ctx->gmm_att_req_fsm->state != ST_INIT) + osmo_fsm_inst_dispatch(ctx->gmm_att_req_fsm, E_VLR_ANSWERED, (void *) 0); + else + gsm48_gmm_authorize(ctx); } void gsm0408_gprs_access_granted(struct sgsn_mm_ctx *ctx) @@ -1118,7 +1123,8 @@ "Authorized, continuing procedure, IMSI=%s\n", ctx->imsi); /* Continue with the authorization */ - gsm48_gmm_authorize(ctx); + if (ctx->gmm_att_req_fsm->state != ST_INIT) + osmo_fsm_inst_dispatch(ctx->gmm_att_req_fsm, E_VLR_ANSWERED, (void *) 0); break; default: LOGMMCTXP(LOGL_INFO, ctx, @@ -1139,8 +1145,8 @@ "with cause '%s' (%d)\n", get_value_string(gsm48_gmm_cause_names, gmm_cause), gmm_cause); - gsm48_tx_gmm_att_rej(ctx, gmm_cause); - mm_ctx_cleanup_free(ctx, "GPRS ATTACH REJECT"); + if (ctx->gmm_att_req_fsm->state != ST_INIT) + osmo_fsm_inst_dispatch(ctx->gmm_att_req_fsm, E_REJECT, (void *) (long) gmm_cause); break; case GMM_REGISTERED_NORMAL: case GMM_REGISTERED_SUSPENDED: @@ -1183,6 +1189,7 @@ { struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg); uint8_t mi_type = gh->data[1] & GSM_MI_TYPE_MASK; + long mi_typel = mi_type; char mi_string[GSM48_MI_SIZE]; gsm48_mi_to_string(mi_string, sizeof(mi_string), >data[1], gh->data[0]); @@ -1235,7 +1242,7 @@ } /* Check if we can let the mobile station enter */ - return gsm48_gmm_authorize(ctx); + return osmo_fsm_inst_dispatch(ctx->gmm_att_req_fsm, E_IDEN_RESP_RECV, (void *)mi_typel); } /* Allocate a new P-TMSI and change context state */ @@ -1425,8 +1432,8 @@ gprs_llgmm_assign(ctx->gb.llme, ctx->gb.tlli, ctx->gb.tlli_new); } - ctx->pending_req = GSM48_MT_GMM_ATTACH_REQ; - return gsm48_gmm_authorize(ctx); + osmo_fsm_inst_dispatch(ctx->gmm_att_req_fsm, E_ATTACH_REQ_RECV, msg); + return 0; err_inval: LOGPC(DMM, LOGL_INFO, "\n"); @@ -2023,6 +2030,7 @@ mmctx_set_mm_state(mmctx, MM_READY); rc = 0; + osmo_fsm_inst_dispatch(mmctx->gmm_att_req_fsm, E_ATTACH_COMPLETE_RECV, 0); memset(_data, 0, sizeof(sig_data)); sig_data.mm = mmctx; osmo_signal_dispatch(SS_SGSN,