Change in ...osmo-sgsn[master]: Replace own timer infra with libosmocore osmo_tdef

2019-08-21 Thread pespin
pespin has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/15214 )

Change subject: Replace own timer infra with libosmocore osmo_tdef
..

Replace own timer infra with libosmocore osmo_tdef

VTY command "show timer" is also available now.

Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
---
M include/osmocom/sgsn/sgsn.h
M src/gprs/gprs_gmm.c
M src/gprs/gprs_gmm_attach.c
M src/gprs/sgsn_vty.c
M tests/sgsn/sgsn_test.c
5 files changed, 132 insertions(+), 126 deletions(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/include/osmocom/sgsn/sgsn.h b/include/osmocom/sgsn/sgsn.h
index 0a6ea29..6e4f5ca 100644
--- a/include/osmocom/sgsn/sgsn.h
+++ b/include/osmocom/sgsn/sgsn.h
@@ -86,20 +86,8 @@
/* CDR configuration */
struct sgsn_cdr cdr;

-   struct {
-   int T3312;
-   int T3322;
-   int T3350;
-   int T3360;
-   int T3370;
-   int T3313;
-   int T3314;
-   int T3316;
-   int T3385;
-   int T3386;
-   int T3395;
-   int T3397;
-   } timers;
+   /* Timer defintions */
+   struct osmo_tdef *T_defs;

int dynamic_lookup;

diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c
index b8b0116..db8defc 100644
--- a/src/gprs/gprs_gmm.c
+++ b/src/gprs/gprs_gmm.c
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -235,12 +236,15 @@

 static void mmctx_timer_cb(void *_mm);

-static void mmctx_timer_start(struct sgsn_mm_ctx *mm, unsigned int T,
-   unsigned int seconds)
+static void mmctx_timer_start(struct sgsn_mm_ctx *mm, unsigned int T)
 {
+   unsigned long seconds;
if (osmo_timer_pending(>timer))
LOGMMCTXP(LOGL_ERROR, mm, "Starting MM timer %u while old "
"timer %u pending\n", T, mm->T);
+
+   seconds = osmo_tdef_get(sgsn->cfg.T_defs, T, OSMO_TDEF_S, -1);
+
mm->T = T;
mm->num_T_exp = 0;

@@ -259,7 +263,11 @@

 time_t gprs_max_time_to_idle(void)
 {
-   return sgsn->cfg.timers.T3314 + (sgsn->cfg.timers.T3312 + 4 * 60);
+   unsigned long T3314, T3312;
+
+   T3314 = osmo_tdef_get(sgsn->cfg.T_defs, 3314, OSMO_TDEF_S, -1);
+   T3312 = osmo_tdef_get(sgsn->cfg.T_defs, 3312, OSMO_TDEF_S, -1);
+   return T3314 + (T3312 + 4 * 60);
 }

 /* Send a message through the underlying layer.
@@ -449,6 +457,7 @@
struct gsm48_hdr *gh;
struct gsm48_attach_ack *aa;
uint8_t *mid;
+   unsigned long t;
 #if 0
uint8_t *ptsig;
 #endif
@@ -465,7 +474,8 @@
aa = (struct gsm48_attach_ack *) msgb_put(msg, sizeof(*aa));
aa->force_stby = 0; /* not indicated */
aa->att_result = 1; /* GPRS only */
-   aa->ra_upd_timer = gprs_secs_to_tmr_floor(sgsn->cfg.timers.T3312);
+   t = osmo_tdef_get(sgsn->cfg.T_defs, 3312, OSMO_TDEF_S, -1);
+   aa->ra_upd_timer = gprs_secs_to_tmr_floor(t);
aa->radio_prio = 4; /* lowest */
gsm48_encode_ra(>ra_id, >ra);

@@ -482,8 +492,8 @@
 * (fixed 44s, default value, GSM 04.08, table 11.4a) to safely limit
 * the inactivity time READY->STANDBY.
 */
-   msgb_tv_put(msg, GSM48_IE_GMM_TIMER_READY,
-   gprs_secs_to_tmr_floor(sgsn->cfg.timers.T3314));
+   t = osmo_tdef_get(sgsn->cfg.T_defs, 3314, OSMO_TDEF_S, -1);
+   msgb_tv_put(msg, GSM48_IE_GMM_TIMER_READY, gprs_secs_to_tmr_floor(t));

 #ifdef PTMSI_ALLOC
/* Optional: Allocated P-TMSI */
@@ -1019,12 +1029,12 @@
/* Request IMSI and IMEI from the MS if they are unknown */
if (!strlen(ctx->imei)) {
ctx->t3370_id_type = GSM_MI_TYPE_IMEI;
-   mmctx_timer_start(ctx, 3370, sgsn->cfg.timers.T3370);
+   mmctx_timer_start(ctx, 3370);
return gsm48_tx_gmm_id_req(ctx, GSM_MI_TYPE_IMEI);
}
if (!strlen(ctx->imsi)) {
ctx->t3370_id_type = GSM_MI_TYPE_IMSI;
-   mmctx_timer_start(ctx, 3370, sgsn->cfg.timers.T3370);
+   mmctx_timer_start(ctx, 3370);
return gsm48_tx_gmm_id_req(ctx, GSM_MI_TYPE_IMSI);
}

@@ -1047,7 +1057,7 @@
&& !sgsn_mm_ctx_is_authenticated(ctx)) {
struct gsm_auth_tuple *at = >auth_triplet;

-   mmctx_timer_start(ctx, 3360, sgsn->cfg.timers.T3360);
+   mmctx_timer_start(ctx, 3360);
return gsm48_tx_gmm_auth_ciph_req(ctx, >vec, at->key_seq,
  false);
}
@@ -1086,7 +1096,7 @@
extract_subscr_hlr(ctx);
 #ifdef PTMSI_ALLOC
/* Start T3350 and re-transmit up to 5 times until ATTACH 

Change in ...osmo-sgsn[master]: Replace own timer infra with libosmocore osmo_tdef

2019-08-21 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/15214 )

Change subject: Replace own timer infra with libosmocore osmo_tdef
..


Patch Set 4: Code-Review+2

+2, it was already reviewed by more people before last fixup changes


--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15214
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
Gerrit-Change-Number: 15214
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 21 Aug 2019 09:06:27 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-sgsn[master]: Replace own timer infra with libosmocore osmo_tdef

2019-08-20 Thread osmith
osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/15214 )

Change subject: Replace own timer infra with libosmocore osmo_tdef
..


Patch Set 4: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15214
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
Gerrit-Change-Number: 15214
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 21 Aug 2019 05:58:32 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-sgsn[master]: Replace own timer infra with libosmocore osmo_tdef

2019-08-20 Thread pespin
Hello fixeria, neels, osmith, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-sgsn/+/15214

to look at the new patch set (#4).

Change subject: Replace own timer infra with libosmocore osmo_tdef
..

Replace own timer infra with libosmocore osmo_tdef

VTY command "show timer" is also available now.

Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
---
M include/osmocom/sgsn/sgsn.h
M src/gprs/gprs_gmm.c
M src/gprs/gprs_gmm_attach.c
M src/gprs/sgsn_vty.c
M tests/sgsn/sgsn_test.c
5 files changed, 132 insertions(+), 126 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/14/15214/4
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15214
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
Gerrit-Change-Number: 15214
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in ...osmo-sgsn[master]: Replace own timer infra with libosmocore osmo_tdef

2019-08-20 Thread pespin
Hello fixeria, neels, osmith, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-sgsn/+/15214

to look at the new patch set (#3).

Change subject: Replace own timer infra with libosmocore osmo_tdef
..

Replace own timer infra with libosmocore osmo_tdef

VTY command "show timer" is also available now.

Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
---
M include/osmocom/sgsn/sgsn.h
M src/gprs/gprs_gmm.c
M src/gprs/gprs_gmm_attach.c
M src/gprs/sgsn_vty.c
4 files changed, 125 insertions(+), 126 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/14/15214/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15214
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
Gerrit-Change-Number: 15214
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in ...osmo-sgsn[master]: Replace own timer infra with libosmocore osmo_tdef

2019-08-20 Thread osmith
osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/15214 )

Change subject: Replace own timer infra with libosmocore osmo_tdef
..


Patch Set 2: Code-Review+1

(3 comments)

https://gerrit.osmocom.org/#/c/15214/2//COMMIT_MSG
Commit Message:

https://gerrit.osmocom.org/#/c/15214/2//COMMIT_MSG@8
PS2, Line 8:
How about mentioning the new VTY commands here?


https://gerrit.osmocom.org/#/c/15214/2/src/gprs/gprs_gmm.c
File src/gprs/gprs_gmm.c:

https://gerrit.osmocom.org/#/c/15214/2/src/gprs/gprs_gmm.c@2287
PS2, Line 2287:
empty line at start of function


https://gerrit.osmocom.org/#/c/15214/2/src/gprs/gprs_gmm.c@2291
PS2, Line 2291:
unrelated change



--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15214
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
Gerrit-Change-Number: 15214
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 20 Aug 2019 10:48:58 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-sgsn[master]: Replace own timer infra with libosmocore osmo_tdef

2019-08-20 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/15214 )

Change subject: Replace own timer infra with libosmocore osmo_tdef
..


Patch Set 2:

ping


--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15214
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
Gerrit-Change-Number: 15214
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 20 Aug 2019 08:51:31 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-sgsn[master]: Replace own timer infra with libosmocore osmo_tdef

2019-08-15 Thread pespin
Hello fixeria, neels, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-sgsn/+/15214

to look at the new patch set (#2).

Change subject: Replace own timer infra with libosmocore osmo_tdef
..

Replace own timer infra with libosmocore osmo_tdef

Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
---
M include/osmocom/sgsn/sgsn.h
M src/gprs/gprs_gmm.c
M src/gprs/gprs_gmm_attach.c
M src/gprs/sgsn_vty.c
4 files changed, 127 insertions(+), 126 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/14/15214/2
-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15214
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
Gerrit-Change-Number: 15214
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in ...osmo-sgsn[master]: Replace own timer infra with libosmocore osmo_tdef

2019-08-15 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/15214 )

Change subject: Replace own timer infra with libosmocore osmo_tdef
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/15214/1/src/gprs/gprs_gmm_attach.c
File src/gprs/gprs_gmm_attach.c:

https://gerrit.osmocom.org/#/c/15214/1/src/gprs/gprs_gmm_attach.c@15
PS1, Line 15: static const struct osmo_tdef_state_timeout 
gmm_attach_fsm_timeouts[] = {
> -1: you *have* to explicitly use an array size of [32] to be safe. […]
Would be great having a define for that ;)

I actually looked in the doc while writing the patch because I saw some code 
with the 32 in there, but I didn't find it :(



--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15214
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
Gerrit-Change-Number: 15214
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 15 Aug 2019 09:35:01 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels 
Gerrit-MessageType: comment


Change in ...osmo-sgsn[master]: Replace own timer infra with libosmocore osmo_tdef

2019-08-14 Thread neels
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/15214 )

Change subject: Replace own timer infra with libosmocore osmo_tdef
..


Patch Set 1: Code-Review-1

(2 comments)

nice!

https://gerrit.osmocom.org/#/c/15214/1/src/gprs/gprs_gmm.c
File src/gprs/gprs_gmm.c:

https://gerrit.osmocom.org/#/c/15214/1/src/gprs/gprs_gmm.c@475
PS1, Line 475:  t = osmo_tdef_get(sgsn->cfg.T_defs, 3312, OSMO_TDEF_S, -1);
Hmm, I just notice a flaw in the osmo_tdef() API.

The val_if_not_present argument is an unsigned long, and I see -1 explicitly in 
the API docs, indicating that a negative value causes a program abort if no 
timer is found. That is in fact not possible with an unsigned long arg.

I created https://osmocom.org/issues/4152 for this.


https://gerrit.osmocom.org/#/c/15214/1/src/gprs/gprs_gmm_attach.c
File src/gprs/gprs_gmm_attach.c:

https://gerrit.osmocom.org/#/c/15214/1/src/gprs/gprs_gmm_attach.c@15
PS1, Line 15: static const struct osmo_tdef_state_timeout 
gmm_attach_fsm_timeouts[] = {
-1: you *have* to explicitly use an array size of [32] to be safe. See 
osmo_tdef_get_state_timeout() API doc.



--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15214
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
Gerrit-Change-Number: 15214
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: neels 
Gerrit-Comment-Date: Thu, 15 Aug 2019 00:18:34 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-sgsn[master]: Replace own timer infra with libosmocore osmo_tdef

2019-08-14 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/15214 )

Change subject: Replace own timer infra with libosmocore osmo_tdef
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15214
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
Gerrit-Change-Number: 15214
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Comment-Date: Wed, 14 Aug 2019 23:18:07 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-sgsn[master]: Replace own timer infra with libosmocore osmo_tdef

2019-08-14 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/15214


Change subject: Replace own timer infra with libosmocore osmo_tdef
..

Replace own timer infra with libosmocore osmo_tdef

Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
---
M include/osmocom/sgsn/sgsn.h
M src/gprs/gprs_gmm.c
M src/gprs/gprs_gmm_attach.c
M src/gprs/sgsn_vty.c
4 files changed, 127 insertions(+), 126 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/14/15214/1

diff --git a/include/osmocom/sgsn/sgsn.h b/include/osmocom/sgsn/sgsn.h
index 0a6ea29..6e4f5ca 100644
--- a/include/osmocom/sgsn/sgsn.h
+++ b/include/osmocom/sgsn/sgsn.h
@@ -86,20 +86,8 @@
/* CDR configuration */
struct sgsn_cdr cdr;

-   struct {
-   int T3312;
-   int T3322;
-   int T3350;
-   int T3360;
-   int T3370;
-   int T3313;
-   int T3314;
-   int T3316;
-   int T3385;
-   int T3386;
-   int T3395;
-   int T3397;
-   } timers;
+   /* Timer defintions */
+   struct osmo_tdef *T_defs;

int dynamic_lookup;

diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c
index 5d03923..c223f2a 100644
--- a/src/gprs/gprs_gmm.c
+++ b/src/gprs/gprs_gmm.c
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -231,12 +232,15 @@

 static void mmctx_timer_cb(void *_mm);

-static void mmctx_timer_start(struct sgsn_mm_ctx *mm, unsigned int T,
-   unsigned int seconds)
+static void mmctx_timer_start(struct sgsn_mm_ctx *mm, unsigned int T)
 {
+   unsigned long seconds;
if (osmo_timer_pending(>timer))
LOGMMCTXP(LOGL_ERROR, mm, "Starting MM timer %u while old "
"timer %u pending\n", T, mm->T);
+
+   seconds = osmo_tdef_get(sgsn->cfg.T_defs, T, OSMO_TDEF_S, -1);
+
mm->T = T;
mm->num_T_exp = 0;

@@ -255,7 +259,11 @@

 time_t gprs_max_time_to_idle(void)
 {
-   return sgsn->cfg.timers.T3314 + (sgsn->cfg.timers.T3312 + 4 * 60);
+   unsigned long T3314, T3312;
+
+   T3314 = osmo_tdef_get(sgsn->cfg.T_defs, 3314, OSMO_TDEF_S, -1);
+   T3312 = osmo_tdef_get(sgsn->cfg.T_defs, 3312, OSMO_TDEF_S, -1);
+   return T3314 + (T3312 + 4 * 60);
 }

 /* Send a message through the underlying layer.
@@ -447,6 +455,7 @@
struct gsm48_hdr *gh;
struct gsm48_attach_ack *aa;
uint8_t *mid;
+   unsigned long t;
 #if 0
uint8_t *ptsig;
 #endif
@@ -463,7 +472,8 @@
aa = (struct gsm48_attach_ack *) msgb_put(msg, sizeof(*aa));
aa->force_stby = 0; /* not indicated */
aa->att_result = 1; /* GPRS only */
-   aa->ra_upd_timer = gprs_secs_to_tmr_floor(sgsn->cfg.timers.T3312);
+   t = osmo_tdef_get(sgsn->cfg.T_defs, 3312, OSMO_TDEF_S, -1);
+   aa->ra_upd_timer = gprs_secs_to_tmr_floor(t);
aa->radio_prio = 4; /* lowest */
gsm48_encode_ra(>ra_id, >ra);

@@ -480,8 +490,8 @@
 * (fixed 44s, default value, GSM 04.08, table 11.4a) to safely limit
 * the inactivity time READY->STANDBY.
 */
-   msgb_tv_put(msg, GSM48_IE_GMM_TIMER_READY,
-   gprs_secs_to_tmr_floor(sgsn->cfg.timers.T3314));
+   t = osmo_tdef_get(sgsn->cfg.T_defs, 3314, OSMO_TDEF_S, -1);
+   msgb_tv_put(msg, GSM48_IE_GMM_TIMER_READY, gprs_secs_to_tmr_floor(t));

 #ifdef PTMSI_ALLOC
/* Optional: Allocated P-TMSI */
@@ -1017,12 +1027,12 @@
/* Request IMSI and IMEI from the MS if they are unknown */
if (!strlen(ctx->imei)) {
ctx->t3370_id_type = GSM_MI_TYPE_IMEI;
-   mmctx_timer_start(ctx, 3370, sgsn->cfg.timers.T3370);
+   mmctx_timer_start(ctx, 3370);
return gsm48_tx_gmm_id_req(ctx, GSM_MI_TYPE_IMEI);
}
if (!strlen(ctx->imsi)) {
ctx->t3370_id_type = GSM_MI_TYPE_IMSI;
-   mmctx_timer_start(ctx, 3370, sgsn->cfg.timers.T3370);
+   mmctx_timer_start(ctx, 3370);
return gsm48_tx_gmm_id_req(ctx, GSM_MI_TYPE_IMSI);
}

@@ -1045,7 +1055,7 @@
&& !sgsn_mm_ctx_is_authenticated(ctx)) {
struct gsm_auth_tuple *at = >auth_triplet;

-   mmctx_timer_start(ctx, 3360, sgsn->cfg.timers.T3360);
+   mmctx_timer_start(ctx, 3360);
return gsm48_tx_gmm_auth_ciph_req(ctx, >vec, at->key_seq,
  false);
}
@@ -1084,7 +1094,7 @@
extract_subscr_hlr(ctx);
 #ifdef PTMSI_ALLOC
/* Start T3350 and re-transmit up to 5 times until ATTACH 
COMPLETE */
-   mmctx_timer_start(ctx, 3350, sgsn->cfg.timers.T3350);
+   mmctx_timer_start(ctx, 3350);