aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gprs_gmm.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-02-02 18:03:05 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-02-06 13:00:29 +0100
commit277b71e0d8b7a8c53599546b0d06ae3810a290eb (patch)
tree1946d33d8f56ae68939d9009a54c7c9adce656b6 /openbsc/src/gprs/gprs_gmm.c
parentf345612654720c63e29c75c0689e6955da478059 (diff)
sgsn: Select GGSN based on APN
Currently the APN IE in the Activate PDP Contex Request and the PDP data that is stored with the subscriber is ignored completely. This commit adds the sgsn_mm_ctx_find_ggsn_ctx that checks the APN IE against the subscriber's PDP data entries if both are present. If there is no match, the request is rejected. If an APN IE has not been included but PDP data entries are present, the function checks all of these entries against the static 'apn' configuration to find a suitable entry. If an APN has not been determined so far and any APN is allowed, the configuration is checked with an empty APN string, to allow for default configurations based on the IMSI prefix only. If nothing of this succeeded but the request wasn't rejected either, and there is no 'apn' configuration at all or if any APN is allowed but a default configuration ist not present, the GGSN with id 0 is used (if present). Otherwise the request is rejected ('missing APN'). Ticket: OW#1334 Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/gprs/gprs_gmm.c')
-rw-r--r--openbsc/src/gprs/gprs_gmm.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index abda327f0..ace0c2ec0 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -1541,6 +1541,7 @@ static int gsm48_rx_gsm_act_pdp_req(struct sgsn_mm_ctx *mmctx,
uint8_t transaction_id = (gh->proto_discr >> 4);
struct sgsn_ggsn_ctx *ggsn;
struct sgsn_pdp_ctx *pdp;
+ enum gsm48_gsm_cause gsm_cause;
LOGMMCTXP(LOGL_INFO, mmctx, "-> ACTIVATE PDP CONTEXT REQ: SAPI=%u NSAPI=%u ",
act_req->req_llc_sapi, act_req->req_nsapi);
@@ -1599,9 +1600,6 @@ static int gsm48_rx_gsm_act_pdp_req(struct sgsn_mm_ctx *mmctx,
tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].len = req_pdpa_len;
tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].val = req_pdpa;
- /* FIXME: determine GGSN based on APN and subscription options */
- if (TLVP_PRESENT(&tp, GSM48_IE_GSM_APN)) {}
-
/* Check if NSAPI is out of range (TS 04.65 / 7.2) */
if (act_req->req_nsapi < 5 || act_req->req_nsapi > 15) {
/* Send reject with GSM_CAUSE_INV_MAND_INFO */
@@ -1631,11 +1629,14 @@ static int gsm48_rx_gsm_act_pdp_req(struct sgsn_mm_ctx *mmctx,
* for re-transmissions */
rate_ctr_inc(&mmctx->ctrg->ctr[GMM_CTR_PDP_CTX_ACT]);
- ggsn = sgsn_ggsn_ctx_by_id(0);
+ /* Determine GGSN based on APN and subscription options */
+ ggsn = sgsn_mm_ctx_find_ggsn_ctx(mmctx, &tp, &gsm_cause);
if (!ggsn) {
- LOGP(DGPRS, LOGL_ERROR, "No GGSN context 0 found!\n");
- return -EIO;
+ LOGP(DGPRS, LOGL_ERROR, "No GGSN context found!\n");
+ return gsm48_tx_gsm_act_pdp_rej(mmctx, transaction_id,
+ gsm_cause, 0, NULL);
}
+ LOGMMCTXP(LOGL_DEBUG, mmctx, "Using GGSN %d\n", ggsn->id);
ggsn->gsn = sgsn->gsn;
pdp = sgsn_create_pdp_ctx(ggsn, mmctx, act_req->req_nsapi, &tp);
if (!pdp)