diff options
-rw-r--r-- | include/osmocom/sgsn/gprs_gb.h | 4 | ||||
-rw-r--r-- | src/sgsn/gprs_gb.c | 8 | ||||
-rw-r--r-- | src/sgsn/gprs_sndcp.c | 11 |
3 files changed, 21 insertions, 2 deletions
diff --git a/include/osmocom/sgsn/gprs_gb.h b/include/osmocom/sgsn/gprs_gb.h index 3bc367613..47f2a3184 100644 --- a/include/osmocom/sgsn/gprs_gb.h +++ b/include/osmocom/sgsn/gprs_gb.h @@ -3,7 +3,9 @@ #include <stdbool.h> #include <osmocom/core/msgb.h> -#include <osmocom/sgsn/gprs_rllc.h> +#include <osmocom/sgsn/gprs_llc.h> int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme, bool drop_cipherable); +/* Has to be called whenever any PDU (signaling, data, ...) has been received */ +void gprs_gb_recv_pdu(struct sgsn_mm_ctx *mmctx); diff --git a/src/sgsn/gprs_gb.c b/src/sgsn/gprs_gb.c index 2d9c25a14..9fa8e00b4 100644 --- a/src/sgsn/gprs_gb.c +++ b/src/sgsn/gprs_gb.c @@ -34,6 +34,12 @@ #include <osmocom/sgsn/gprs_sm.h> #include <osmocom/sgsn/debug.h> +/* Has to be called whenever any PDU (signaling, data, ...) has been received */ +void gprs_gb_recv_pdu(struct sgsn_mm_ctx *mmctx) { + if (mmctx->gb.llme) + osmo_fsm_inst_dispatch(mmctx->gb.mm_state_fsm, E_MM_PDU_RECEPTION, NULL); +} + /* Main entry point for incoming 04.08 GPRS messages from Gb */ int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme, bool drop_cipherable) @@ -50,7 +56,7 @@ int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme, msgid2mmctx(mmctx, msg); rate_ctr_inc(&mmctx->ctrg->ctr[GMM_CTR_PKTS_SIG_IN]); mmctx->gb.llme = llme; - osmo_fsm_inst_dispatch(mmctx->gb.mm_state_fsm, E_MM_PDU_RECEPTION, NULL); + gprs_gb_recv_pdu(mmctx); } /* MMCTX can be NULL */ diff --git a/src/sgsn/gprs_sndcp.c b/src/sgsn/gprs_sndcp.c index d9aa1e576..01be57ef2 100644 --- a/src/sgsn/gprs_sndcp.c +++ b/src/sgsn/gprs_sndcp.c @@ -31,6 +31,7 @@ #include <osmocom/gprs/gprs_bssgp.h> #include <osmocom/sgsn/debug.h> +#include <osmocom/sgsn/gprs_gb.h> #include <osmocom/sgsn/gprs_llc.h> #include <osmocom/sgsn/sgsn.h> #include <osmocom/sgsn/gprs_sndcp.h> @@ -745,6 +746,7 @@ int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, struct sndcp_common_hdr *sch = (struct sndcp_common_hdr *)hdr; struct sndcp_comp_hdr *scomph = NULL; struct sndcp_udata_hdr *suh; + struct sgsn_mm_ctx *mmctx; uint8_t *npdu; uint16_t npdu_num __attribute__((unused)); int npdu_len; @@ -778,6 +780,15 @@ int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, /* FIXME: move this RA_ID up to the LLME or even higher */ bssgp_parse_cell_id(&sne->ra_id, msgb_bcid(msg)); + mmctx = sgsn_mm_ctx_by_tlli(msgb_tlli(msg), &sne->ra_id); + if (!mmctx) { + LOGP(DSNDCP, LOGL_ERROR, "Message for non-existing MM ctx " + "(lle=%p, TLLI=%08x, SAPI=%u, NSAPI=%u)\n", + lle, lle->llme->tlli, lle->sapi, sch->nsapi); + return -EIO; + } + gprs_gb_recv_pdu(mmctx); + if (scomph) { sne->defrag.pcomp = scomph->pcomp; sne->defrag.dcomp = scomph->dcomp; |