Change in ...osmo-sgsn[master]: Introduce define TLLI_UNASSIGNED

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

Change subject: Introduce define TLLI_UNASSIGNED
..

Introduce define TLLI_UNASSIGNED

Change-Id: Ib8be5af2a5e92a7403505b73ce4c1751832de40d
---
M include/osmocom/sgsn/gprs_llc.h
M src/gprs/gprs_gmm.c
M src/gprs/gprs_llc.c
M src/gprs/gprs_sgsn.c
4 files changed, 18 insertions(+), 15 deletions(-)

Approvals:
  Jenkins Builder: Verified
  lynxis lazus: Looks good to me, approved



diff --git a/include/osmocom/sgsn/gprs_llc.h b/include/osmocom/sgsn/gprs_llc.h
index 5b12248..8a0b9ef 100644
--- a/include/osmocom/sgsn/gprs_llc.h
+++ b/include/osmocom/sgsn/gprs_llc.h
@@ -192,6 +192,9 @@

 #define GPRS_LLME_RESET_AGE (0)

+/* 3GPP TS 44.064 § 8.3 TLLI assignment procedures */
+#define TLLI_UNASSIGNED (0x)
+
 extern struct llist_head gprs_llc_llmes;

 /* LLC low level types */
diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c
index 5a6ea28..c8bc0f7 100644
--- a/src/gprs/gprs_gmm.c
+++ b/src/gprs/gprs_gmm.c
@@ -2077,7 +2077,7 @@
/* Unassign the old TLLI */
mmctx->gb.tlli = mmctx->gb.tlli_new;
gprs_llme_copy_key(mmctx, mmctx->gb.llme);
-   gprs_llgmm_assign(mmctx->gb.llme, 0x,
+   gprs_llgmm_assign(mmctx->gb.llme, TLLI_UNASSIGNED,
  mmctx->gb.tlli_new);
}
mmctx->gmm_state = GMM_REGISTERED_NORMAL;
@@ -2102,7 +2102,7 @@
if (mmctx->ran_type == MM_CTX_T_GERAN_Gb) {
/* Unassign the old TLLI */
mmctx->gb.tlli = mmctx->gb.tlli_new;
-   gprs_llgmm_assign(mmctx->gb.llme, 0x,
+   gprs_llgmm_assign(mmctx->gb.llme, TLLI_UNASSIGNED,
  mmctx->gb.tlli_new);
}
mmctx->gmm_state = GMM_REGISTERED_NORMAL;
@@ -2125,7 +2125,7 @@
if (mmctx->ran_type == MM_CTX_T_GERAN_Gb) {
/* Unassign the old TLLI */
mmctx->gb.tlli = mmctx->gb.tlli_new;
-   //gprs_llgmm_assign(mmctx->gb.llme, 0x, 
mmctx->gb.tlli_new, GPRS_ALGO_GEA0, NULL);
+   //gprs_llgmm_assign(mmctx->gb.llme, TLLI_UNASSIGNED, 
mmctx->gb.tlli_new, GPRS_ALGO_GEA0, NULL);
}
rc = 0;
break;
diff --git a/src/gprs/gprs_llc.c b/src/gprs/gprs_llc.c
index acf4b54..a301a63 100644
--- a/src/gprs/gprs_llc.c
+++ b/src/gprs/gprs_llc.c
@@ -527,7 +527,7 @@
lle = >lle[sapi];
return lle;
}
-
+
LOGP(DLLC, LOGL_NOTICE,
"unknown TLLI(0x%08x)/SAPI(%d): Silently dropping\n",
tlli, sapi);
@@ -556,7 +556,7 @@
return NULL;

llme->tlli = tlli;
-   llme->old_tlli = 0x;
+   llme->old_tlli = TLLI_UNASSIGNED;
llme->state = GPRS_LLMS_UNASSIGNED;
llme->age_timestamp = GPRS_LLME_RESET_AGE;
llme->cksn = GSM_KEY_SEQ_INVAL;
@@ -1042,19 +1042,19 @@
 {
unsigned int i;

-   if (old_tlli == 0x && new_tlli != 0x) {
+   if (old_tlli == TLLI_UNASSIGNED && new_tlli != TLLI_UNASSIGNED) {
/* TLLI Assignment 8.3.1 */
/* New TLLI shall be assigned and used when (re)transmitting 
LLC frames */
-   /* If old TLLI != 0x was assigned to LLME, then TLLI
+   /* If old TLLI != TLLI_UNASSIGNED was assigned to LLME, then 
TLLI
 * old is unassigned.  Only TLLI new shall be accepted when
 * received from peer. */
-   if (llme->old_tlli != 0x) {
-   llme->old_tlli = 0x;
+   if (llme->old_tlli != TLLI_UNASSIGNED) {
+   llme->old_tlli = TLLI_UNASSIGNED;
llme->tlli = new_tlli;
} else {
-   /* If TLLI old == 0x was assigned to LLME, then 
this is
+   /* If TLLI old == TLLI_UNASSIGNED was assigned to LLME, 
then this is
 * TLLI assignmemt according to 8.3.1 */
-   llme->old_tlli = 0x;
+   llme->old_tlli = TLLI_UNASSIGNED;
llme->tlli = new_tlli;
llme->state = GPRS_LLMS_ASSIGNED;
/* 8.5.3.1 For all LLE's */
@@ -1066,14 +1066,14 @@
/* FIXME Set parameters according to table 9 */
}
}
-   } else if (old_tlli != 0x && new_tlli != 0x) {
+   } else if (old_tlli != TLLI_UNASSIGNED && new_tlli != TLLI_UNASSIGNED) {
/* TLLI Change 8.3.2 */
/* Both TLLI Old 

Change in ...osmo-sgsn[master]: Introduce define TLLI_UNASSIGNED

2019-08-13 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/15165 )

Change subject: Introduce define TLLI_UNASSIGNED
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ib8be5af2a5e92a7403505b73ce4c1751832de40d
Gerrit-Change-Number: 15165
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Comment-Date: Tue, 13 Aug 2019 09:36:49 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-sgsn[master]: Introduce define TLLI_UNASSIGNED

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


Change subject: Introduce define TLLI_UNASSIGNED
..

Introduce define TLLI_UNASSIGNED

Change-Id: Ib8be5af2a5e92a7403505b73ce4c1751832de40d
---
M include/osmocom/sgsn/gprs_llc.h
M src/gprs/gprs_gmm.c
M src/gprs/gprs_llc.c
M src/gprs/gprs_sgsn.c
4 files changed, 18 insertions(+), 15 deletions(-)



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

diff --git a/include/osmocom/sgsn/gprs_llc.h b/include/osmocom/sgsn/gprs_llc.h
index 5b12248..8a0b9ef 100644
--- a/include/osmocom/sgsn/gprs_llc.h
+++ b/include/osmocom/sgsn/gprs_llc.h
@@ -192,6 +192,9 @@

 #define GPRS_LLME_RESET_AGE (0)

+/* 3GPP TS 44.064 § 8.3 TLLI assignment procedures */
+#define TLLI_UNASSIGNED (0x)
+
 extern struct llist_head gprs_llc_llmes;

 /* LLC low level types */
diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c
index 5a6ea28..c8bc0f7 100644
--- a/src/gprs/gprs_gmm.c
+++ b/src/gprs/gprs_gmm.c
@@ -2077,7 +2077,7 @@
/* Unassign the old TLLI */
mmctx->gb.tlli = mmctx->gb.tlli_new;
gprs_llme_copy_key(mmctx, mmctx->gb.llme);
-   gprs_llgmm_assign(mmctx->gb.llme, 0x,
+   gprs_llgmm_assign(mmctx->gb.llme, TLLI_UNASSIGNED,
  mmctx->gb.tlli_new);
}
mmctx->gmm_state = GMM_REGISTERED_NORMAL;
@@ -2102,7 +2102,7 @@
if (mmctx->ran_type == MM_CTX_T_GERAN_Gb) {
/* Unassign the old TLLI */
mmctx->gb.tlli = mmctx->gb.tlli_new;
-   gprs_llgmm_assign(mmctx->gb.llme, 0x,
+   gprs_llgmm_assign(mmctx->gb.llme, TLLI_UNASSIGNED,
  mmctx->gb.tlli_new);
}
mmctx->gmm_state = GMM_REGISTERED_NORMAL;
@@ -2125,7 +2125,7 @@
if (mmctx->ran_type == MM_CTX_T_GERAN_Gb) {
/* Unassign the old TLLI */
mmctx->gb.tlli = mmctx->gb.tlli_new;
-   //gprs_llgmm_assign(mmctx->gb.llme, 0x, 
mmctx->gb.tlli_new, GPRS_ALGO_GEA0, NULL);
+   //gprs_llgmm_assign(mmctx->gb.llme, TLLI_UNASSIGNED, 
mmctx->gb.tlli_new, GPRS_ALGO_GEA0, NULL);
}
rc = 0;
break;
diff --git a/src/gprs/gprs_llc.c b/src/gprs/gprs_llc.c
index acf4b54..a301a63 100644
--- a/src/gprs/gprs_llc.c
+++ b/src/gprs/gprs_llc.c
@@ -527,7 +527,7 @@
lle = >lle[sapi];
return lle;
}
-
+
LOGP(DLLC, LOGL_NOTICE,
"unknown TLLI(0x%08x)/SAPI(%d): Silently dropping\n",
tlli, sapi);
@@ -556,7 +556,7 @@
return NULL;

llme->tlli = tlli;
-   llme->old_tlli = 0x;
+   llme->old_tlli = TLLI_UNASSIGNED;
llme->state = GPRS_LLMS_UNASSIGNED;
llme->age_timestamp = GPRS_LLME_RESET_AGE;
llme->cksn = GSM_KEY_SEQ_INVAL;
@@ -1042,19 +1042,19 @@
 {
unsigned int i;

-   if (old_tlli == 0x && new_tlli != 0x) {
+   if (old_tlli == TLLI_UNASSIGNED && new_tlli != TLLI_UNASSIGNED) {
/* TLLI Assignment 8.3.1 */
/* New TLLI shall be assigned and used when (re)transmitting 
LLC frames */
-   /* If old TLLI != 0x was assigned to LLME, then TLLI
+   /* If old TLLI != TLLI_UNASSIGNED was assigned to LLME, then 
TLLI
 * old is unassigned.  Only TLLI new shall be accepted when
 * received from peer. */
-   if (llme->old_tlli != 0x) {
-   llme->old_tlli = 0x;
+   if (llme->old_tlli != TLLI_UNASSIGNED) {
+   llme->old_tlli = TLLI_UNASSIGNED;
llme->tlli = new_tlli;
} else {
-   /* If TLLI old == 0x was assigned to LLME, then 
this is
+   /* If TLLI old == TLLI_UNASSIGNED was assigned to LLME, 
then this is
 * TLLI assignmemt according to 8.3.1 */
-   llme->old_tlli = 0x;
+   llme->old_tlli = TLLI_UNASSIGNED;
llme->tlli = new_tlli;
llme->state = GPRS_LLMS_ASSIGNED;
/* 8.5.3.1 For all LLE's */
@@ -1066,14 +1066,14 @@
/* FIXME Set parameters according to table 9 */
}
}
-   } else if (old_tlli != 0x && new_tlli != 0x) {
+   } else if (old_tlli != TLLI_UNASSIGNED && new_tlli != TLLI_UNASSIGNED) {
/* TLLI Change 8.3.2 */
/* Both TLLI Old and TLLI New