diff options
-rw-r--r-- | src/gsup_server.c | 11 | ||||
-rw-r--r-- | src/gsup_server.h | 4 | ||||
-rw-r--r-- | src/hlr.c | 6 | ||||
-rw-r--r-- | src/luop.c | 7 |
4 files changed, 20 insertions, 8 deletions
diff --git a/src/gsup_server.c b/src/gsup_server.c index 03a6f56..07d4feb 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -337,15 +337,16 @@ void osmo_gsup_server_destroy(struct osmo_gsup_server *gsups) /* Set GSUP message's pdp_infos[0] to a wildcard APN. * Use the provided apn_buf to store the produced APN data. This must remain valid until - * osmo_gsup_encode() is done. */ -void osmo_gsup_configure_wildcard_apn(struct osmo_gsup_message *gsup, - uint8_t *apn_buf, size_t apn_buf_size) + * osmo_gsup_encode() is done. Return 0 if an entry was added, -ENOMEM if the provided buffer is too + * small. */ +int osmo_gsup_configure_wildcard_apn(struct osmo_gsup_message *gsup, + uint8_t *apn_buf, size_t apn_buf_size) { int l; l = osmo_apn_from_str(apn_buf, apn_buf_size, "*"); if (l <= 0) - return; + return -ENOMEM; gsup->pdp_infos[0].apn_enc = apn_buf; gsup->pdp_infos[0].apn_enc_len = l; @@ -353,4 +354,6 @@ void osmo_gsup_configure_wildcard_apn(struct osmo_gsup_message *gsup, gsup->num_pdp_infos = 1; /* FIXME: use real value: */ gsup->pdp_infos[0].context_id = 1; + + return 0; } diff --git a/src/gsup_server.h b/src/gsup_server.h index b52b783..66c1a9c 100644 --- a/src/gsup_server.h +++ b/src/gsup_server.h @@ -53,5 +53,5 @@ struct osmo_gsup_server *osmo_gsup_server_create(void *ctx, void osmo_gsup_server_destroy(struct osmo_gsup_server *gsups); -void osmo_gsup_configure_wildcard_apn(struct osmo_gsup_message *gsup, - uint8_t *apn_buf, size_t apn_buf_size); +int osmo_gsup_configure_wildcard_apn(struct osmo_gsup_message *gsup, + uint8_t *apn_buf, size_t apn_buf_size); @@ -98,7 +98,11 @@ osmo_hlr_subscriber_update_notify(struct hlr_subscriber *subscr) /* FIXME: PDP infos - use more fine-grained access control instead of wildcard APN */ - osmo_gsup_configure_wildcard_apn(&gsup, apn, sizeof(apn)); + if (osmo_gsup_configure_wildcard_apn(&gsup, apn, sizeof(apn))) { + LOGP(DMAIN, LOGL_ERROR, "%s: Error: cannot encode wildcard APN\n", + subscr->imsi); + continue; + } } else if (co->supports_cs) { gsup.cn_domain = OSMO_GSUP_CN_DOMAIN_CS; } else { @@ -242,7 +242,12 @@ void lu_op_tx_insert_subscr_data(struct lu_operation *luop) if (luop->is_ps) { /* FIXME: PDP infos - use more fine-grained access control instead of wildcard APN */ - osmo_gsup_configure_wildcard_apn(&gsup, apn, sizeof(apn)); + if (osmo_gsup_configure_wildcard_apn(&gsup, apn, sizeof(apn))) { + LOGP(DMAIN, LOGL_ERROR, "%s: Error: cannot encode wildcard APN\n", + luop->subscr.imsi); + lu_op_tx_error(luop, GMM_CAUSE_PROTO_ERR_UNSPEC); + return; + } } /* Send ISD to new VLR/SGSN */ |