 openbsc/include/openbsc/gprs_sgsn.h | 4 ++++
 openbsc/src/gprs/gprs_gmm.c         | 5 +++++
 openbsc/src/gprs/gprs_sgsn.c        | 7 +++++++
 3 files changed, 16 insertions(+)

diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h
index 61120b1..91551af 100644
--- a/openbsc/include/openbsc/gprs_sgsn.h
+++ b/openbsc/include/openbsc/gprs_sgsn.h
@@ -187,6 +187,10 @@ struct sgsn_ggsn_ctx *sgsn_mm_ctx_find_ggsn_ctx(struct sgsn_mm_ctx *mmctx,
 						struct tlv_parsed *tp,
 						enum gsm48_gsm_cause *gsm_cause,
 						char *apn_str);
+            
+/* Determines whether the EPC capability flag is present and set in */
+/* MS Network Capability IE (TS 24.008 v10.15.0 section 10.5.5.12)*/
+int sgsn_mm_ctx_is_epc_capable(struct sgsn_mm_ctx *mmctx);
 
 enum pdp_ctx_state {
 	PDP_STATE_NONE,
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 115e898..0add395 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -836,6 +836,7 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
 	uint16_t cid;
 	enum gsm48_gmm_cause reject_cause;
 	int rc;
+	int epc_cap;
 
 	LOGMMCTXP(LOGL_INFO, ctx, "-> GMM ATTACH REQUEST ");
 
@@ -852,6 +853,9 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
 		goto err_inval;
 	cur += msnc_len;
 
+	/* EPC Capability flag */
+	epc_cap = (msnc_len >= 3 && (msnc[2] & 0b100));
+
 	/* aTTACH Type 10.5.5.2 */
 	att_type = *cur++ & 0x0f;
 
@@ -871,6 +875,7 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
 
 	DEBUGPC(DMM, "MI(%s) type=\"%s\" ", mi_string,
 		get_value_string(gprs_att_t_strs, att_type));
+	LOGPC(DMM, LOGL_INFO, " ecp_capability=%s", (epc_cap ? "true" : "false"));
 
 	/* Old routing area identification 10.5.5.15. Skip it */
 	cur += 6;
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index f40de0b..48309ca 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -246,6 +246,13 @@ void sgsn_mm_ctx_cleanup_free(struct sgsn_mm_ctx *mm)
 	gprs_llgmm_assign(llme, tlli, 0xffffffff, GPRS_ALGO_GEA0, NULL);
 }
 
+/* Determines whether the EPC capability flag is present and set in */
+/* MS Network Capability IE  (TS 24.008 v10.15.0 section 10.5.5.12)*/
+int sgsn_mm_ctx_is_epc_capable(struct sgsn_mm_ctx *mmctx)
+{
+	return (mmctx->ms_network_capa.len >= 3 && (mmctx->ms_network_capa.buf[2] & 0b100));
+}
+
 
 /* look up PDP context by MM context and NSAPI */
 struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_nsapi(const struct sgsn_mm_ctx *mm,
