Move global mmctx list into struct sgsn_instance
Change-Id: Idf8458902321da03b9b0831dad3ad383a9c7afa1changes/05/30905/3
parent
58101ea587
commit
93bc518b53
|
@ -281,8 +281,6 @@ struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_nsapi(const struct sgsn_mm_ctx *mm,
|
|||
struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_tid(const struct sgsn_mm_ctx *mm,
|
||||
uint8_t tid);
|
||||
|
||||
extern struct llist_head sgsn_mm_ctxts;
|
||||
|
||||
uint32_t sgsn_alloc_ptmsi(void);
|
||||
|
||||
/* Called on subscriber data updates */
|
||||
|
|
|
@ -156,6 +156,7 @@ struct sgsn_instance {
|
|||
struct llist_head apn_list; /* list of struct sgsn_apn_ctx */
|
||||
struct llist_head ggsn_list; /* list of struct sgsn_ggsn_ctx */
|
||||
struct llist_head mme_list; /* list of struct sgsn_mme_ctx */
|
||||
struct llist_head mm_list; /* list of struct sgsn_mm_ctx */
|
||||
struct llist_head pdp_list; /* list of struct sgsn_pdp_ctx */
|
||||
|
||||
struct ctrl_handle *ctrlh;
|
||||
|
|
|
@ -60,8 +60,6 @@
|
|||
|
||||
#include "../../config.h"
|
||||
|
||||
LLIST_HEAD(sgsn_mm_ctxts);
|
||||
|
||||
const struct value_string sgsn_ran_type_names[] = {
|
||||
{ MM_CTX_T_GERAN_Gb, "GPRS/EDGE via Gb" },
|
||||
{ MM_CTX_T_UTRAN_Iu, "UMTS via Iu" },
|
||||
|
@ -98,7 +96,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_ue_ctx(const void *uectx)
|
|||
{
|
||||
struct sgsn_mm_ctx *ctx;
|
||||
|
||||
llist_for_each_entry(ctx, &sgsn_mm_ctxts, list) {
|
||||
llist_for_each_entry(ctx, &sgsn->mm_list, list) {
|
||||
if (ctx->ran_type == MM_CTX_T_UTRAN_Iu
|
||||
&& uectx == ctx->iu.ue_ctx)
|
||||
return ctx;
|
||||
|
@ -113,7 +111,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli,
|
|||
{
|
||||
struct sgsn_mm_ctx *ctx;
|
||||
|
||||
llist_for_each_entry(ctx, &sgsn_mm_ctxts, list) {
|
||||
llist_for_each_entry(ctx, &sgsn->mm_list, list) {
|
||||
if ((tlli == ctx->gb.tlli || tlli == ctx->gb.tlli_new) &&
|
||||
gprs_ra_id_equals(raid, &ctx->ra))
|
||||
return ctx;
|
||||
|
@ -137,7 +135,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli_and_ptmsi(uint32_t tlli,
|
|||
if (tlli_type != TLLI_FOREIGN && tlli_type != TLLI_LOCAL)
|
||||
return NULL;
|
||||
|
||||
llist_for_each_entry(ctx, &sgsn_mm_ctxts, list) {
|
||||
llist_for_each_entry(ctx, &sgsn->mm_list, list) {
|
||||
if ((gprs_tmsi2tlli(ctx->p_tmsi, tlli_type) == tlli ||
|
||||
gprs_tmsi2tlli(ctx->p_tmsi_old, tlli_type) == tlli) &&
|
||||
gprs_ra_id_equals(raid, &ctx->ra))
|
||||
|
@ -151,7 +149,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(uint32_t p_tmsi)
|
|||
{
|
||||
struct sgsn_mm_ctx *ctx;
|
||||
|
||||
llist_for_each_entry(ctx, &sgsn_mm_ctxts, list) {
|
||||
llist_for_each_entry(ctx, &sgsn->mm_list, list) {
|
||||
if (p_tmsi == ctx->p_tmsi ||
|
||||
(ctx->p_tmsi_old && ctx->p_tmsi_old == p_tmsi))
|
||||
return ctx;
|
||||
|
@ -163,7 +161,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi)
|
|||
{
|
||||
struct sgsn_mm_ctx *ctx;
|
||||
|
||||
llist_for_each_entry(ctx, &sgsn_mm_ctxts, list) {
|
||||
llist_for_each_entry(ctx, &sgsn->mm_list, list) {
|
||||
if (!strcmp(imsi, ctx->imsi))
|
||||
return ctx;
|
||||
}
|
||||
|
@ -205,7 +203,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(uint32_t rate_ctr_id)
|
|||
|
||||
INIT_LLIST_HEAD(&ctx->pdp_list);
|
||||
|
||||
llist_add(&ctx->list, &sgsn_mm_ctxts);
|
||||
llist_add(&ctx->list, &sgsn->mm_list);
|
||||
|
||||
return ctx;
|
||||
|
||||
|
@ -411,7 +409,7 @@ restart:
|
|||
goto restart;
|
||||
}
|
||||
|
||||
llist_for_each_entry(mm, &sgsn_mm_ctxts, list) {
|
||||
llist_for_each_entry(mm, &sgsn->mm_list, list) {
|
||||
if (mm->p_tmsi == ptmsi) {
|
||||
if (!max_retries--)
|
||||
goto failed;
|
||||
|
|
|
@ -99,7 +99,7 @@ static void sgsn_llme_cleanup_free(struct gprs_llc_llme *llme)
|
|||
{
|
||||
struct sgsn_mm_ctx *mmctx = NULL;
|
||||
|
||||
llist_for_each_entry(mmctx, &sgsn_mm_ctxts, list) {
|
||||
llist_for_each_entry(mmctx, &sgsn->mm_list, list) {
|
||||
if (llme == mmctx->gb.llme) {
|
||||
gsm0408_gprs_access_cancelled(mmctx, SGSN_ERROR_CAUSE_NONE);
|
||||
return;
|
||||
|
@ -176,6 +176,7 @@ struct sgsn_instance *sgsn_instance_alloc(void *talloc_ctx)
|
|||
INIT_LLIST_HEAD(&inst->apn_list);
|
||||
INIT_LLIST_HEAD(&inst->ggsn_list);
|
||||
INIT_LLIST_HEAD(&inst->mme_list);
|
||||
INIT_LLIST_HEAD(&inst->mm_list);
|
||||
INIT_LLIST_HEAD(&inst->pdp_list);
|
||||
|
||||
osmo_timer_setup(&inst->llme_timer, sgsn_llme_check_cb, NULL);
|
||||
|
|
|
@ -33,7 +33,7 @@ static int get_subscriber_list(struct ctrl_cmd *cmd, void *d)
|
|||
struct sgsn_mm_ctx *mm;
|
||||
|
||||
cmd->reply = talloc_strdup(cmd, "");
|
||||
llist_for_each_entry(mm, &sgsn_mm_ctxts, list) {
|
||||
llist_for_each_entry(mm, &sgsn->mm_list, list) {
|
||||
char *addr = NULL;
|
||||
struct sgsn_pdp_ctx *pdp;
|
||||
|
||||
|
|
|
@ -711,7 +711,7 @@ DEFUN(swow_mmctx_all, show_mmctx_all_cmd,
|
|||
SHOW_STR MMCTX_STR "All MM Contexts\n" INCLUDE_PDP_STR)
|
||||
{
|
||||
struct sgsn_mm_ctx *mm;
|
||||
llist_for_each_entry(mm, &sgsn_mm_ctxts, list)
|
||||
llist_for_each_entry(mm, &sgsn->mm_list, list)
|
||||
vty_dump_mmctx(vty, "", mm, (argc > 0) ? 1 : 0);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
|
@ -1006,7 +1006,7 @@ DEFUN_HIDDEN(reset_sgsn_state,
|
|||
struct gprs_subscr *subscr, *tmp_subscr;
|
||||
struct sgsn_mm_ctx *mm, *tmp_mm;
|
||||
|
||||
llist_for_each_entry_safe(mm, tmp_mm, &sgsn_mm_ctxts, list)
|
||||
llist_for_each_entry_safe(mm, tmp_mm, &sgsn->mm_list, list)
|
||||
{
|
||||
gsm0408_gprs_access_cancelled(mm, SGSN_ERROR_CAUSE_NONE);
|
||||
}
|
||||
|
|
|
@ -379,6 +379,7 @@ static void test_auth_triplets(void)
|
|||
uint32_t local_tlli = 0xffeeddcc;
|
||||
|
||||
printf("Testing authentication triplet handling\n");
|
||||
sgsn = sgsn_instance_alloc(tall_sgsn_ctx);
|
||||
|
||||
/* Check for emptiness */
|
||||
OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL);
|
||||
|
@ -864,6 +865,7 @@ static void test_gmm_detach_accept_unexpected(void)
|
|||
uint32_t local_tlli;
|
||||
|
||||
printf("Testing GMM detach accept (unexpected)\n");
|
||||
sgsn = sgsn_instance_alloc(tall_sgsn_ctx);
|
||||
|
||||
/* DTAP - Detach Accept (MT) */
|
||||
/* normal detach */
|
||||
|
@ -900,6 +902,7 @@ static void test_gmm_status_no_mmctx(void)
|
|||
uint32_t local_tlli;
|
||||
|
||||
printf("Testing GMM Status (no MMCTX)\n");
|
||||
sgsn = sgsn_instance_alloc(tall_sgsn_ctx);
|
||||
|
||||
/* DTAP - GMM Status, protocol error */
|
||||
static const unsigned char gmm_status[] = {
|
||||
|
|
Loading…
Reference in New Issue